@pie-players/pie-assessment-player 0.3.69 → 0.3.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pie-assessment-player.js +117 -114
- package/package.json +7 -7
|
@@ -22,7 +22,10 @@ function j(e) {
|
|
|
22
22
|
} catch {
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
var
|
|
25
|
+
var Xe = typeof window < "u" && window.PIE_BUILDER_ORIGIN_URL || j("PUBLIC_BUILDER_ORIGIN_URL") || q, ae = typeof window < "u" && window.PIE_BUILDER_BUNDLE_URL || j("PUBLIC_BUILDER_BUNDLE_URL") || re, le = {
|
|
26
|
+
retryDelayMs: 3e3,
|
|
27
|
+
timeoutMs: 12e4
|
|
28
|
+
};
|
|
26
29
|
function y(e) {
|
|
27
30
|
"@babel/helpers - typeof";
|
|
28
31
|
return y = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
|
|
@@ -31,7 +34,7 @@ function y(e) {
|
|
|
31
34
|
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
32
35
|
}, y(e);
|
|
33
36
|
}
|
|
34
|
-
function
|
|
37
|
+
function ce(e, t) {
|
|
35
38
|
if (y(e) != "object" || !e) return e;
|
|
36
39
|
var n = e[Symbol.toPrimitive];
|
|
37
40
|
if (n !== void 0) {
|
|
@@ -41,26 +44,26 @@ function le(e, t) {
|
|
|
41
44
|
}
|
|
42
45
|
return (t === "string" ? String : Number)(e);
|
|
43
46
|
}
|
|
44
|
-
function
|
|
45
|
-
var t =
|
|
47
|
+
function de(e) {
|
|
48
|
+
var t = ce(e, "string");
|
|
46
49
|
return y(t) == "symbol" ? t : t + "";
|
|
47
50
|
}
|
|
48
51
|
function a(e, t, n) {
|
|
49
|
-
return (t =
|
|
52
|
+
return (t = de(t)) in e ? Object.defineProperty(e, t, {
|
|
50
53
|
value: n,
|
|
51
54
|
enumerable: !0,
|
|
52
55
|
configurable: !0,
|
|
53
56
|
writable: !0
|
|
54
57
|
}) : e[t] = n, e;
|
|
55
58
|
}
|
|
56
|
-
var
|
|
59
|
+
var T;
|
|
57
60
|
(function(e) {
|
|
58
61
|
e.SAVE = "save", e.MODEL = "model", e.SCORE = "score", e.MANUAL_SCORE = "manual-score";
|
|
59
|
-
})(
|
|
60
|
-
var
|
|
62
|
+
})(T || (T = {}));
|
|
63
|
+
var N;
|
|
61
64
|
(function(e) {
|
|
62
65
|
e.AUTO = "auto", e.MANUAL = "manual";
|
|
63
|
-
})(
|
|
66
|
+
})(N || (N = {}));
|
|
64
67
|
var L;
|
|
65
68
|
(function(e) {
|
|
66
69
|
e.GATHER = "gather", e.VIEW = "view", e.EVALUATE = "evaluate";
|
|
@@ -69,7 +72,7 @@ var x;
|
|
|
69
72
|
(function(e) {
|
|
70
73
|
e.PENDING = "pending", e.IN_PROGRESS = "in_progress", e.COMPLETED = "completed", e.FAILED = "failed";
|
|
71
74
|
})(x || (x = {}));
|
|
72
|
-
var
|
|
75
|
+
var ue = class V extends CustomEvent {
|
|
73
76
|
constructor(t, n = !1) {
|
|
74
77
|
super(V.TYPE, {
|
|
75
78
|
bubbles: !0,
|
|
@@ -80,8 +83,8 @@ var de = class V extends CustomEvent {
|
|
|
80
83
|
}), a(this, "update", void 0), a(this, "reset", void 0), this.update = t, this.reset = n;
|
|
81
84
|
}
|
|
82
85
|
};
|
|
83
|
-
a(
|
|
84
|
-
var
|
|
86
|
+
a(ue, "TYPE", "model.updated");
|
|
87
|
+
var he = class Y extends CustomEvent {
|
|
85
88
|
constructor(t, n) {
|
|
86
89
|
super(Y.TYPE, {
|
|
87
90
|
bubbles: !0,
|
|
@@ -92,8 +95,8 @@ var ue = class Y extends CustomEvent {
|
|
|
92
95
|
}), a(this, "src", void 0), a(this, "done", void 0), this.src = t, this.done = n;
|
|
93
96
|
}
|
|
94
97
|
};
|
|
95
|
-
a(
|
|
96
|
-
var
|
|
98
|
+
a(he, "TYPE", "delete.image");
|
|
99
|
+
var pe = class W extends CustomEvent {
|
|
97
100
|
constructor(t) {
|
|
98
101
|
super(W.TYPE, {
|
|
99
102
|
bubbles: !0,
|
|
@@ -101,8 +104,8 @@ var he = class W extends CustomEvent {
|
|
|
101
104
|
}), a(this, "handler", void 0), this.handler = t;
|
|
102
105
|
}
|
|
103
106
|
};
|
|
104
|
-
a(
|
|
105
|
-
var
|
|
107
|
+
a(pe, "TYPE", "insert.image");
|
|
108
|
+
var me = class J extends CustomEvent {
|
|
106
109
|
constructor(t, n) {
|
|
107
110
|
super(J.TYPE, {
|
|
108
111
|
bubbles: !0,
|
|
@@ -113,8 +116,8 @@ var pe = class J extends CustomEvent {
|
|
|
113
116
|
}), a(this, "src", void 0), a(this, "done", void 0), this.src = t, this.done = n;
|
|
114
117
|
}
|
|
115
118
|
};
|
|
116
|
-
a(
|
|
117
|
-
var
|
|
119
|
+
a(me, "TYPE", "delete.sound");
|
|
120
|
+
var ge = class Q extends CustomEvent {
|
|
118
121
|
constructor(t) {
|
|
119
122
|
super(Q.TYPE, {
|
|
120
123
|
bubbles: !0,
|
|
@@ -122,8 +125,8 @@ var me = class Q extends CustomEvent {
|
|
|
122
125
|
}), a(this, "handler", void 0), this.handler = t;
|
|
123
126
|
}
|
|
124
127
|
};
|
|
125
|
-
a(
|
|
126
|
-
var
|
|
128
|
+
a(ge, "TYPE", "insert.sound");
|
|
129
|
+
var fe = class K extends CustomEvent {
|
|
127
130
|
constructor(t, n) {
|
|
128
131
|
super(K.TYPE, {
|
|
129
132
|
bubbles: !0,
|
|
@@ -135,12 +138,12 @@ var ge = class K extends CustomEvent {
|
|
|
135
138
|
}), a(this, "component", void 0), a(this, "complete", void 0), this.component = t, this.complete = n;
|
|
136
139
|
}
|
|
137
140
|
};
|
|
138
|
-
a(
|
|
141
|
+
a(fe, "TYPE", "session-changed");
|
|
139
142
|
var D;
|
|
140
143
|
(function(e) {
|
|
141
144
|
e[e.ROOT = 0] = "ROOT", e[e.SUBJECT = 1] = "SUBJECT", e[e.LEVEL = 2] = "LEVEL", e[e.STANDARD = 3] = "STANDARD";
|
|
142
145
|
})(D || (D = {}));
|
|
143
|
-
function
|
|
146
|
+
function u(e, t) {
|
|
144
147
|
const n = `[${e}]`;
|
|
145
148
|
return {
|
|
146
149
|
debug: (i, ...s) => {
|
|
@@ -151,10 +154,10 @@ function m(e, t) {
|
|
|
151
154
|
error: (i, ...s) => console.error(n, i, ...s)
|
|
152
155
|
};
|
|
153
156
|
}
|
|
154
|
-
function
|
|
157
|
+
function h() {
|
|
155
158
|
return typeof window < "u" && window.PIE_DEBUG === !0;
|
|
156
159
|
}
|
|
157
|
-
var
|
|
160
|
+
var C;
|
|
158
161
|
(function(e) {
|
|
159
162
|
e.player = "player.js", e.clientPlayer = "client-player.js", e.editor = "editor.js";
|
|
160
163
|
})(C || (C = {}));
|
|
@@ -162,27 +165,27 @@ var U;
|
|
|
162
165
|
(function(e) {
|
|
163
166
|
e.loading = "loading", e.loaded = "loaded";
|
|
164
167
|
})(U || (U = {}));
|
|
165
|
-
var et =
|
|
168
|
+
var et = u("pie-scoring", () => h()), tt = u("pie-initialize-element", () => h()), nt = u("math-rendering", () => h()), it = u("pie-updates", () => h()), st = u("pie-initialization", () => h()), ot = le.timeoutMs, rt = {
|
|
166
169
|
buildServiceBase: ae,
|
|
167
170
|
bundleType: C.player,
|
|
168
171
|
env: {
|
|
169
172
|
mode: "gather",
|
|
170
173
|
role: "student"
|
|
171
174
|
}
|
|
172
|
-
},
|
|
175
|
+
}, at = u("pie-element-observer", () => h()), lt = u("asset-handler", () => h()), ct = u("authoring", () => h());
|
|
173
176
|
function Z(e) {
|
|
174
177
|
if (!e || typeof e != "object") return !1;
|
|
175
178
|
const t = e;
|
|
176
179
|
return typeof t.providerId == "string" && typeof t.providerName == "string" && typeof t.initialize == "function" && typeof t.trackError == "function" && typeof t.trackEvent == "function" && typeof t.destroy == "function" && typeof t.isReady == "function";
|
|
177
180
|
}
|
|
178
|
-
var
|
|
179
|
-
function ve(e) {
|
|
180
|
-
return e && typeof e == "object" ? e : typeof e > "u" ? {} : { value: e };
|
|
181
|
-
}
|
|
181
|
+
var ve = u("instrumentation-event-bridge", () => h());
|
|
182
182
|
function ye(e) {
|
|
183
|
-
|
|
183
|
+
return e && typeof e == "object" ? e : typeof e > "u" ? {} : { value: e };
|
|
184
184
|
}
|
|
185
185
|
function be(e) {
|
|
186
|
+
ve.warn(`[InstrumentationEventBridge:${e}] Ignoring invalid instrumentation provider; expected InstrumentationProvider contract`);
|
|
187
|
+
}
|
|
188
|
+
function Se(e) {
|
|
186
189
|
try {
|
|
187
190
|
e.provider.trackError(e.error instanceof Error ? e.error : new Error(String(e.error ?? "Unknown instrumentation bridge error")), {
|
|
188
191
|
component: e.component,
|
|
@@ -192,13 +195,13 @@ function be(e) {
|
|
|
192
195
|
} catch {
|
|
193
196
|
}
|
|
194
197
|
}
|
|
195
|
-
function
|
|
198
|
+
function we(e) {
|
|
196
199
|
if (!e.host || !e.eventMap.length) return () => {
|
|
197
200
|
};
|
|
198
201
|
if (!e.instrumentationProvider) return () => {
|
|
199
202
|
};
|
|
200
203
|
if (!Z(e.instrumentationProvider))
|
|
201
|
-
return e.debug &&
|
|
204
|
+
return e.debug && be(e.component), () => {
|
|
202
205
|
};
|
|
203
206
|
const t = e.instrumentationProvider, n = [], i = Math.max(0, e.dedupeWindowMs ?? 0), s = /* @__PURE__ */ new Map(), o = (r, l) => {
|
|
204
207
|
const d = [
|
|
@@ -208,31 +211,31 @@ function Se(e) {
|
|
|
208
211
|
l.itemId,
|
|
209
212
|
l.canonicalItemId,
|
|
210
213
|
l.sourceRuntimeId
|
|
211
|
-
].map((
|
|
214
|
+
].map((p) => String(p ?? "")).join("|");
|
|
212
215
|
return `${r.instrumentationEventName}|${d}`;
|
|
213
216
|
};
|
|
214
217
|
for (const r of e.eventMap) {
|
|
215
218
|
const l = (d) => {
|
|
216
219
|
try {
|
|
217
220
|
if (!t.isReady() || e.shouldTrackEvent && !e.shouldTrackEvent(d)) return;
|
|
218
|
-
const
|
|
219
|
-
...
|
|
221
|
+
const p = ye(d.detail), f = (/* @__PURE__ */ new Date()).toISOString(), c = {
|
|
222
|
+
...p,
|
|
220
223
|
...e.staticAttributes,
|
|
221
224
|
component: e.component,
|
|
222
225
|
sourceEventName: r.sourceEventName,
|
|
223
226
|
timestamp: f
|
|
224
227
|
};
|
|
225
228
|
if (i > 0) {
|
|
226
|
-
const
|
|
227
|
-
if (typeof R == "number" &&
|
|
228
|
-
s.set(k,
|
|
229
|
+
const g = Date.now(), k = o(r, c), R = s.get(k);
|
|
230
|
+
if (typeof R == "number" && g - R < i) return;
|
|
231
|
+
s.set(k, g);
|
|
229
232
|
}
|
|
230
233
|
t.trackEvent(r.instrumentationEventName, { ...c });
|
|
231
|
-
} catch (
|
|
232
|
-
|
|
234
|
+
} catch (p) {
|
|
235
|
+
Se({
|
|
233
236
|
provider: t,
|
|
234
237
|
component: e.component,
|
|
235
|
-
error:
|
|
238
|
+
error: p,
|
|
236
239
|
sourceEventName: r.sourceEventName
|
|
237
240
|
});
|
|
238
241
|
}
|
|
@@ -245,7 +248,7 @@ function Se(e) {
|
|
|
245
248
|
for (const r of n) r();
|
|
246
249
|
};
|
|
247
250
|
}
|
|
248
|
-
var
|
|
251
|
+
var Ae = class {
|
|
249
252
|
constructor() {
|
|
250
253
|
a(this, "initialized", !1), a(this, "config", void 0);
|
|
251
254
|
}
|
|
@@ -309,7 +312,7 @@ var we = class {
|
|
|
309
312
|
transformAttributes(e) {
|
|
310
313
|
return this.config?.attributeTransformer ? this.config.attributeTransformer(e) : e;
|
|
311
314
|
}
|
|
312
|
-
},
|
|
315
|
+
}, Ie = class extends Ae {
|
|
313
316
|
constructor(...e) {
|
|
314
317
|
super(...e), a(this, "providerId", "newrelic"), a(this, "providerName", "New Relic");
|
|
315
318
|
}
|
|
@@ -357,30 +360,30 @@ function _(e) {
|
|
|
357
360
|
const t = e.trackPageActions;
|
|
358
361
|
return typeof t == "boolean" ? t : void 0;
|
|
359
362
|
}
|
|
360
|
-
function
|
|
363
|
+
function Ee(e, t) {
|
|
361
364
|
return e.kind === "value" || e.kind === "null" ? e : t;
|
|
362
365
|
}
|
|
363
|
-
var S,
|
|
364
|
-
function
|
|
365
|
-
return S || (S = new
|
|
366
|
+
var S, Pe = u("instrumentation-provider-resolution", () => h());
|
|
367
|
+
function Ce() {
|
|
368
|
+
return S || (S = new Ie(), S.initialize()), S;
|
|
366
369
|
}
|
|
367
|
-
function
|
|
368
|
-
const t = F(e.runtimePlayer), n = F(e.player), i = _(t), s = _(n), o = i ?? s ?? !1, r =
|
|
370
|
+
function ke(e) {
|
|
371
|
+
const t = F(e.runtimePlayer), n = F(e.player), i = _(t), s = _(n), o = i ?? s ?? !1, r = Ee(B(t), B(n));
|
|
369
372
|
if (r.kind !== "null") {
|
|
370
|
-
if (r.kind === "unset") return o ?
|
|
373
|
+
if (r.kind === "unset") return o ? Ce() : void 0;
|
|
371
374
|
if (Z(r.value)) return r.value;
|
|
372
375
|
if (e.debug) {
|
|
373
376
|
const l = e.component ? `[${e.component}] ` : "";
|
|
374
|
-
|
|
377
|
+
Pe.warn(`${l}Ignoring invalid instrumentation provider; expected InstrumentationProvider contract`);
|
|
375
378
|
}
|
|
376
379
|
}
|
|
377
380
|
}
|
|
378
|
-
var
|
|
381
|
+
var dt = Object.freeze([
|
|
379
382
|
"composed",
|
|
380
383
|
"engine-ready",
|
|
381
384
|
"interactive",
|
|
382
385
|
"disposed"
|
|
383
|
-
]),
|
|
386
|
+
]), Re = [
|
|
384
387
|
{
|
|
385
388
|
sourceEventName: "assessment-controller-ready",
|
|
386
389
|
instrumentationEventName: "pie-assessment-controller-ready"
|
|
@@ -413,7 +416,7 @@ var rt = Object.freeze([
|
|
|
413
416
|
sourceEventName: "assessment-error",
|
|
414
417
|
instrumentationEventName: "pie-assessment-error"
|
|
415
418
|
}
|
|
416
|
-
],
|
|
419
|
+
], ut = /* @__PURE__ */ new Set([
|
|
417
420
|
"id",
|
|
418
421
|
"element",
|
|
419
422
|
.../* @__PURE__ */ new Set([
|
|
@@ -422,16 +425,16 @@ var rt = Object.freeze([
|
|
|
422
425
|
"timestamp",
|
|
423
426
|
"sourceRuntimeId"
|
|
424
427
|
])
|
|
425
|
-
]),
|
|
426
|
-
async function
|
|
427
|
-
const t =
|
|
428
|
+
]), ht = u("pie-overrides", () => h()), Te = { "nl-NL": () => import("./nl-NL-BnK-g-oc.js") }, Ne = ["en-US", "nl-NL"];
|
|
429
|
+
async function Le(e) {
|
|
430
|
+
const t = Te[e];
|
|
428
431
|
if (!t) throw new Error(`No bundled i18n catalog for locale: ${e}`);
|
|
429
432
|
return (await t()).default;
|
|
430
433
|
}
|
|
431
434
|
function b(e) {
|
|
432
435
|
return e ? e.trim().replace(/_/g, "-").split(/[.@]/)[0].toLowerCase() : "";
|
|
433
436
|
}
|
|
434
|
-
function
|
|
437
|
+
function xe(e) {
|
|
435
438
|
const t = b(e);
|
|
436
439
|
if (!t) return [];
|
|
437
440
|
const n = t.split("-"), i = [];
|
|
@@ -441,13 +444,13 @@ function Le(e) {
|
|
|
441
444
|
}
|
|
442
445
|
return i;
|
|
443
446
|
}
|
|
444
|
-
function
|
|
445
|
-
for (const n of
|
|
447
|
+
function De(e, t) {
|
|
448
|
+
for (const n of xe(e)) {
|
|
446
449
|
const i = t.find((s) => b(s) === n);
|
|
447
450
|
if (i != null) return i;
|
|
448
451
|
}
|
|
449
452
|
}
|
|
450
|
-
var
|
|
453
|
+
var Ue = {
|
|
451
454
|
common: {
|
|
452
455
|
close: "Close",
|
|
453
456
|
cancel: "Cancel",
|
|
@@ -946,7 +949,7 @@ var De = {
|
|
|
946
949
|
coordinatorUnavailable: "Toolkit coordinator is not available for text-to-speech updates."
|
|
947
950
|
}
|
|
948
951
|
}
|
|
949
|
-
}, E = "en-US",
|
|
952
|
+
}, E = "en-US", Me = /* @__PURE__ */ new Set([
|
|
950
953
|
"ar",
|
|
951
954
|
"ckb",
|
|
952
955
|
"dv",
|
|
@@ -962,7 +965,7 @@ var De = {
|
|
|
962
965
|
"ug",
|
|
963
966
|
"ur",
|
|
964
967
|
"yi"
|
|
965
|
-
]),
|
|
968
|
+
]), Fe = /* @__PURE__ */ new Set([
|
|
966
969
|
"zero",
|
|
967
970
|
"one",
|
|
968
971
|
"two",
|
|
@@ -970,23 +973,23 @@ var De = {
|
|
|
970
973
|
"many",
|
|
971
974
|
"other"
|
|
972
975
|
]);
|
|
973
|
-
function
|
|
976
|
+
function O(e) {
|
|
974
977
|
if (typeof e != "object" || e === null) return !1;
|
|
975
978
|
const t = Object.keys(e);
|
|
976
|
-
return t.length > 0 && t.every((n) =>
|
|
979
|
+
return t.length > 0 && t.every((n) => Fe.has(n));
|
|
977
980
|
}
|
|
978
|
-
function
|
|
981
|
+
function z(e) {
|
|
979
982
|
try {
|
|
980
983
|
const n = new Intl.Locale(e).textInfo;
|
|
981
984
|
if (n?.direction === "rtl" || n?.direction === "ltr") return n.direction;
|
|
982
985
|
} catch {
|
|
983
986
|
}
|
|
984
987
|
const t = b(e).split("-")[0] ?? "";
|
|
985
|
-
return
|
|
988
|
+
return Me.has(t) ? "rtl" : "ltr";
|
|
986
989
|
}
|
|
987
990
|
var X = class I {
|
|
988
991
|
constructor(t = {}) {
|
|
989
|
-
a(this, "locale", void 0), a(this, "fallbackLocale", void 0), a(this, "catalogs", void 0), a(this, "customMessages", void 0), a(this, "loading", void 0), a(this, "listeners", /* @__PURE__ */ new Set()), a(this, "config", void 0), this.config = { ...t }, this.fallbackLocale = w(t.fallbackLocale) || "en-US", this.catalogs = /* @__PURE__ */ new Map([[E,
|
|
992
|
+
a(this, "locale", void 0), a(this, "fallbackLocale", void 0), a(this, "catalogs", void 0), a(this, "customMessages", void 0), a(this, "loading", void 0), a(this, "listeners", /* @__PURE__ */ new Set()), a(this, "config", void 0), this.config = { ...t }, this.fallbackLocale = w(t.fallbackLocale) || "en-US", this.catalogs = /* @__PURE__ */ new Map([[E, Ue]]), this.customMessages = { ...t.customMessages ?? {} }, this.loading = /* @__PURE__ */ new Map(), this.locale = this.resolveLocaleTag(t.locale) ?? "en-US";
|
|
990
993
|
}
|
|
991
994
|
async initialize(t) {
|
|
992
995
|
if (this.config = {
|
|
@@ -1025,10 +1028,10 @@ var X = class I {
|
|
|
1025
1028
|
}
|
|
1026
1029
|
plural(t, n) {
|
|
1027
1030
|
const i = this.lookupNode(t);
|
|
1028
|
-
return i === void 0 || !
|
|
1031
|
+
return i === void 0 || !O(i) ? this.t(t, n) : G(i[this.selectPluralCategory(n.count)] ?? i.other, n);
|
|
1029
1032
|
}
|
|
1030
1033
|
getDirection() {
|
|
1031
|
-
return
|
|
1034
|
+
return z(this.locale);
|
|
1032
1035
|
}
|
|
1033
1036
|
getAvailableLocales() {
|
|
1034
1037
|
return [.../* @__PURE__ */ new Set([
|
|
@@ -1084,12 +1087,12 @@ var X = class I {
|
|
|
1084
1087
|
return {
|
|
1085
1088
|
locale: n,
|
|
1086
1089
|
translations: i,
|
|
1087
|
-
direction:
|
|
1090
|
+
direction: z(n)
|
|
1088
1091
|
};
|
|
1089
1092
|
}
|
|
1090
1093
|
resolveLocaleTag(t) {
|
|
1091
1094
|
if (!t) return;
|
|
1092
|
-
const n = this.getAvailableLocales(), i =
|
|
1095
|
+
const n = this.getAvailableLocales(), i = De(t, n);
|
|
1093
1096
|
if (i) return i;
|
|
1094
1097
|
const s = b(t).split("-")[0];
|
|
1095
1098
|
if (s)
|
|
@@ -1112,14 +1115,14 @@ var X = class I {
|
|
|
1112
1115
|
this.catalogs.get(this.fallbackLocale)
|
|
1113
1116
|
];
|
|
1114
1117
|
for (const i of n) {
|
|
1115
|
-
const s =
|
|
1118
|
+
const s = Be(i, t);
|
|
1116
1119
|
if (s !== void 0) return s;
|
|
1117
1120
|
}
|
|
1118
1121
|
}
|
|
1119
1122
|
lookup(t) {
|
|
1120
1123
|
const n = this.lookupNode(t);
|
|
1121
1124
|
if (typeof n == "string") return n;
|
|
1122
|
-
if (n !== void 0 &&
|
|
1125
|
+
if (n !== void 0 && O(n)) return n.other;
|
|
1123
1126
|
}
|
|
1124
1127
|
selectPluralCategory(t) {
|
|
1125
1128
|
let n = I.pluralRules.get(this.locale);
|
|
@@ -1141,7 +1144,7 @@ a(X, "pluralRules", /* @__PURE__ */ new Map());
|
|
|
1141
1144
|
function w(e) {
|
|
1142
1145
|
return e ? e.trim().replace(/_/g, "-") : "";
|
|
1143
1146
|
}
|
|
1144
|
-
function
|
|
1147
|
+
function Be(e, t) {
|
|
1145
1148
|
if (!e) return;
|
|
1146
1149
|
let n = e;
|
|
1147
1150
|
for (const i of t.split("."))
|
|
@@ -1162,9 +1165,9 @@ function ee(e, t) {
|
|
|
1162
1165
|
}
|
|
1163
1166
|
return n;
|
|
1164
1167
|
}
|
|
1165
|
-
function
|
|
1168
|
+
function _e(e = {}) {
|
|
1166
1169
|
return new X({
|
|
1167
|
-
loadCatalog:
|
|
1170
|
+
loadCatalog: Le,
|
|
1168
1171
|
availableLocales: Ne,
|
|
1169
1172
|
...e
|
|
1170
1173
|
});
|
|
@@ -1175,7 +1178,7 @@ function v() {
|
|
|
1175
1178
|
function A(e) {
|
|
1176
1179
|
return e.replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
1177
1180
|
}
|
|
1178
|
-
function
|
|
1181
|
+
function Oe(e) {
|
|
1179
1182
|
if (e.attemptId) return `aas_v1_${A(e.assessmentId)}_${A(e.attemptId)}`;
|
|
1180
1183
|
const t = te(), n = t ? ze(t) : "anon";
|
|
1181
1184
|
return `aas_v1_${A(e.assessmentId)}_${A(n)}`;
|
|
@@ -1193,7 +1196,7 @@ function ze(e) {
|
|
|
1193
1196
|
const i = `anon-${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;
|
|
1194
1197
|
return e.setItem(t, i), i;
|
|
1195
1198
|
}
|
|
1196
|
-
function
|
|
1199
|
+
function Ge(e) {
|
|
1197
1200
|
if (!e) return [];
|
|
1198
1201
|
const t = [], n = e.testParts || [];
|
|
1199
1202
|
return n.length > 0 ? (n.forEach((i, s) => {
|
|
@@ -1216,7 +1219,7 @@ function Oe(e) {
|
|
|
1216
1219
|
});
|
|
1217
1220
|
}), t);
|
|
1218
1221
|
}
|
|
1219
|
-
var
|
|
1222
|
+
var $e = class {
|
|
1220
1223
|
constructor(e) {
|
|
1221
1224
|
this.args = e, this.listeners = /* @__PURE__ */ new Set(), this.deliveryPlan = { sections: [] }, this.session = null, this.readiness = "bootstrapping", this.submitted = !1, this.storageContext = {
|
|
1222
1225
|
assessmentId: e.assessmentId,
|
|
@@ -1259,7 +1262,7 @@ var Ge = class {
|
|
|
1259
1262
|
return this.persistenceStrategy = await this.args.hooks?.createAssessmentSessionPersistence?.(this.storageContext, e) ?? await e.createDefaultPersistence(), this.persistenceStrategy;
|
|
1260
1263
|
}
|
|
1261
1264
|
async createDeliveryPlan() {
|
|
1262
|
-
const e = { createDefaultDeliveryPlan: () => ({ sections:
|
|
1265
|
+
const e = { createDefaultDeliveryPlan: () => ({ sections: Ge(this.args.assessment) }) }, t = {
|
|
1263
1266
|
assessmentId: this.args.assessmentId,
|
|
1264
1267
|
attemptId: this.args.attemptId,
|
|
1265
1268
|
assessment: this.args.assessment
|
|
@@ -1270,7 +1273,7 @@ var Ge = class {
|
|
|
1270
1273
|
if (this.session) return this.session;
|
|
1271
1274
|
const e = this.deliveryPlan.sections.map((t) => t.sectionIdentifier);
|
|
1272
1275
|
return this.session = ne({
|
|
1273
|
-
assessmentAttemptSessionIdentifier:
|
|
1276
|
+
assessmentAttemptSessionIdentifier: Oe({
|
|
1274
1277
|
assessmentId: this.args.assessmentId,
|
|
1275
1278
|
attemptId: this.args.attemptId
|
|
1276
1279
|
}),
|
|
@@ -1403,7 +1406,7 @@ var Ge = class {
|
|
|
1403
1406
|
timestamp: v()
|
|
1404
1407
|
});
|
|
1405
1408
|
}
|
|
1406
|
-
},
|
|
1409
|
+
}, m = {
|
|
1407
1410
|
controllerReady: "assessment-controller-ready",
|
|
1408
1411
|
navigationRequested: "assessment-navigation-requested",
|
|
1409
1412
|
submitRequested: "assessment-submit-requested",
|
|
@@ -1414,7 +1417,7 @@ var Ge = class {
|
|
|
1414
1417
|
submissionStateChanged: "assessment-submission-state-changed",
|
|
1415
1418
|
error: "assessment-error"
|
|
1416
1419
|
};
|
|
1417
|
-
function
|
|
1420
|
+
function He(e, t) {
|
|
1418
1421
|
return !e?.delivery || e.delivery.enabled === !1 || !t || e.delivery.assignmentId !== void 0 ? e : {
|
|
1419
1422
|
...e,
|
|
1420
1423
|
delivery: {
|
|
@@ -1423,10 +1426,10 @@ function $e(e, t) {
|
|
|
1423
1426
|
}
|
|
1424
1427
|
};
|
|
1425
1428
|
}
|
|
1426
|
-
function
|
|
1429
|
+
function qe(e) {
|
|
1427
1430
|
const { sectionPlayerRuntime: t, playerType: n, attemptId: i, env: s, coordinator: o } = e, r = t?.player && typeof t.player == "object" ? {
|
|
1428
1431
|
...t.player,
|
|
1429
|
-
backend:
|
|
1432
|
+
backend: He(t.player.backend ? P(t.player.backend) : void 0, i)
|
|
1430
1433
|
} : t?.player;
|
|
1431
1434
|
return {
|
|
1432
1435
|
playerType: n,
|
|
@@ -1436,7 +1439,7 @@ function He(e) {
|
|
|
1436
1439
|
...r !== void 0 ? { player: r } : {}
|
|
1437
1440
|
};
|
|
1438
1441
|
}
|
|
1439
|
-
var
|
|
1442
|
+
var je = "pie-section-player-splitpane", Ve = "pie-section-player-vertical", Ye = class extends HTMLElement {
|
|
1440
1443
|
static get observedAttributes() {
|
|
1441
1444
|
return [
|
|
1442
1445
|
"assessment-id",
|
|
@@ -1449,7 +1452,7 @@ var qe = "pie-section-player-splitpane", je = "pie-section-player-vertical", Ve
|
|
|
1449
1452
|
];
|
|
1450
1453
|
}
|
|
1451
1454
|
constructor() {
|
|
1452
|
-
super(), this.assessmentId = "", this.attemptId = "", this.locale = "", this.assessment = null, this.env = null, this.coordinator = null, this.hooks = null, this.showNavigation = !0, this.sectionPlayerLayout = "splitpane", this.playerType = "iife", this._debug = void 0, this.controller = null, this.controllerReadyPromise = null, this.controllerReadyResolve = null, this.i18n =
|
|
1455
|
+
super(), this.assessmentId = "", this.attemptId = "", this.locale = "", this.assessment = null, this.env = null, this.coordinator = null, this.hooks = null, this.showNavigation = !0, this.sectionPlayerLayout = "splitpane", this.playerType = "iife", this._debug = void 0, this.controller = null, this.controllerReadyPromise = null, this.controllerReadyResolve = null, this.i18n = _e(), this.sectionHost = null, this.sectionControllerRef = null, this.containerRef = null, this.announcer = null, this.restoreFocusOnRender = !1, this._sectionPlayerRuntime = null, this.readiness = { phase: "bootstrapping" }, this.controllerReadyPromise = new Promise((e) => {
|
|
1453
1456
|
this.controllerReadyResolve = e;
|
|
1454
1457
|
});
|
|
1455
1458
|
}
|
|
@@ -1501,33 +1504,33 @@ var qe = "pie-section-player-splitpane", je = "pie-section-player-vertical", Ve
|
|
|
1501
1504
|
return;
|
|
1502
1505
|
}
|
|
1503
1506
|
this.readiness = { phase: "bootstrapping" }, this.render();
|
|
1504
|
-
const e = new
|
|
1507
|
+
const e = new $e({
|
|
1505
1508
|
assessmentId: this.assessmentId,
|
|
1506
1509
|
attemptId: this.attemptId || void 0,
|
|
1507
1510
|
assessment: this.assessment,
|
|
1508
1511
|
hooks: this.hooks || void 0
|
|
1509
1512
|
});
|
|
1510
1513
|
this.unsubscribeController?.(), this.controller = e, this.unsubscribeController = e.subscribe((t) => {
|
|
1511
|
-
t.type === "assessment-route-changed" && (this.cleanupTtsForSectionNavigation(t), this.dispatch(
|
|
1514
|
+
t.type === "assessment-route-changed" && (this.cleanupTtsForSectionNavigation(t), this.dispatch(m.routeChanged, t), this.restoreFocusOnRender = !0, this.render()), t.type === "assessment-session-applied" && this.dispatch(m.sessionApplied, t), t.type === "assessment-session-changed" && this.dispatch(m.sessionChanged, t), t.type === "assessment-progress-changed" && this.dispatch(m.progressChanged, t), t.type === "assessment-submission-state-changed" && this.dispatch(m.submissionStateChanged, t);
|
|
1512
1515
|
});
|
|
1513
1516
|
try {
|
|
1514
|
-
await e.initialize(), this.readiness = { phase: "ready" }, this.controllerReadyResolve?.(e), this.dispatch(
|
|
1517
|
+
await e.initialize(), this.readiness = { phase: "ready" }, this.controllerReadyResolve?.(e), this.dispatch(m.controllerReady, { controller: e }), this.hooks?.onAssessmentControllerReady?.(e), this.render();
|
|
1515
1518
|
} catch (t) {
|
|
1516
|
-
this.readiness = { phase: "error" }, this.dispatch(
|
|
1519
|
+
this.readiness = { phase: "error" }, this.dispatch(m.error, { error: t }), this.renderEmptyState("Failed to initialize assessment player");
|
|
1517
1520
|
}
|
|
1518
1521
|
}
|
|
1519
1522
|
resolveInstrumentationProvider() {
|
|
1520
|
-
return
|
|
1523
|
+
return ke({
|
|
1521
1524
|
runtimePlayer: this.sectionPlayerRuntime?.player,
|
|
1522
1525
|
component: "pie-assessment-player-default"
|
|
1523
1526
|
});
|
|
1524
1527
|
}
|
|
1525
1528
|
attachInstrumentationBridge() {
|
|
1526
|
-
this.detachInstrumentationBridge?.(), this.detachInstrumentationBridge =
|
|
1529
|
+
this.detachInstrumentationBridge?.(), this.detachInstrumentationBridge = we({
|
|
1527
1530
|
host: this,
|
|
1528
1531
|
instrumentationProvider: this.resolveInstrumentationProvider(),
|
|
1529
1532
|
component: "pie-assessment-player-default",
|
|
1530
|
-
eventMap:
|
|
1533
|
+
eventMap: Re,
|
|
1531
1534
|
staticAttributes: {
|
|
1532
1535
|
instrumentationLayer: "assessment",
|
|
1533
1536
|
assessmentId: this.assessmentId,
|
|
@@ -1567,10 +1570,10 @@ var qe = "pie-section-player-splitpane", je = "pie-section-player-vertical", Ve
|
|
|
1567
1570
|
return;
|
|
1568
1571
|
}
|
|
1569
1572
|
buildSectionPlayerTag() {
|
|
1570
|
-
return this.sectionPlayerLayout === "vertical" ?
|
|
1573
|
+
return this.sectionPlayerLayout === "vertical" ? Ve : je;
|
|
1571
1574
|
}
|
|
1572
1575
|
buildSectionRuntime() {
|
|
1573
|
-
return
|
|
1576
|
+
return qe({
|
|
1574
1577
|
sectionPlayerRuntime: this.sectionPlayerRuntime,
|
|
1575
1578
|
playerType: this.playerType,
|
|
1576
1579
|
attemptId: this.attemptId || void 0,
|
|
@@ -1690,23 +1693,23 @@ var qe = "pie-section-player-splitpane", je = "pie-section-player-vertical", Ve
|
|
|
1690
1693
|
f.className = "pie-assessment-player-navigation";
|
|
1691
1694
|
const c = document.createElement("div");
|
|
1692
1695
|
c.className = "pie-assessment-player-current-position", c.textContent = o;
|
|
1693
|
-
const
|
|
1694
|
-
|
|
1696
|
+
const g = document.createElement("div");
|
|
1697
|
+
g.className = "pie-assessment-player-nav-controls", r = document.createElement("button"), r.className = "pie-assessment-player-nav-btn", r.textContent = this.i18n.t("common.back"), r.disabled = !s.navigation.canPrevious, r.addEventListener("click", () => {
|
|
1695
1698
|
this.navigatePrevious();
|
|
1696
1699
|
}), l = document.createElement("button"), l.className = "pie-assessment-player-nav-btn", l.textContent = this.i18n.t("common.next"), l.disabled = !s.navigation.canNext, l.addEventListener("click", () => {
|
|
1697
1700
|
this.navigateNext();
|
|
1698
|
-
}),
|
|
1701
|
+
}), g.appendChild(r), g.appendChild(l), f.appendChild(c), f.appendChild(g), n.appendChild(f);
|
|
1699
1702
|
}
|
|
1700
1703
|
const d = document.createElement("div");
|
|
1701
1704
|
d.className = "pie-assessment-player-section-host", d.setAttribute("role", "region"), d.setAttribute("aria-label", o), d.tabIndex = -1, this.sectionHost = d;
|
|
1702
|
-
const
|
|
1703
|
-
if (
|
|
1705
|
+
const p = e?.getCurrentSection() || null;
|
|
1706
|
+
if (p) {
|
|
1704
1707
|
const f = this.buildSectionPlayerTag(), c = document.createElement(f);
|
|
1705
|
-
if (c.setAttribute("assessment-id", this.assessmentId), c.setAttribute("section-id",
|
|
1706
|
-
const
|
|
1707
|
-
c.setAttribute("debug",
|
|
1708
|
+
if (c.setAttribute("assessment-id", this.assessmentId), c.setAttribute("section-id", p.sectionIdentifier), this.attemptId && c.setAttribute("attempt-id", this.attemptId), this.locale && c.setAttribute("locale", this.locale), this.debug !== void 0 && this.debug !== null) {
|
|
1709
|
+
const g = typeof this.debug == "boolean" ? String(this.debug) : this.debug;
|
|
1710
|
+
c.setAttribute("debug", g);
|
|
1708
1711
|
}
|
|
1709
|
-
c.section =
|
|
1712
|
+
c.section = p.section, c.runtime = this.buildSectionRuntime(), c.hooks = { cardTitleFormatter: this.hooks?.cardTitleFormatter }, d.appendChild(c), this.attachSectionControllerReadyListener(c, p.sectionIdentifier);
|
|
1710
1713
|
}
|
|
1711
1714
|
n.appendChild(d), this.swapContent(n), t && (this.applyFocusIntent(t, {
|
|
1712
1715
|
previous: r,
|
|
@@ -1766,7 +1769,7 @@ var qe = "pie-section-player-splitpane", je = "pie-section-player-vertical", Ve
|
|
|
1766
1769
|
if (typeof e == "number")
|
|
1767
1770
|
s = e, o = this.controller?.getSectionAt(s)?.sectionIdentifier;
|
|
1768
1771
|
else if (o = e, this.controller?.getCurrentSection()?.sectionIdentifier === o) return !0;
|
|
1769
|
-
if (!this.dispatch(
|
|
1772
|
+
if (!this.dispatch(m.navigationRequested, {
|
|
1770
1773
|
fromIndex: n,
|
|
1771
1774
|
toIndex: s,
|
|
1772
1775
|
fromSectionId: i,
|
|
@@ -1779,7 +1782,7 @@ var qe = "pie-section-player-splitpane", je = "pie-section-player-vertical", Ve
|
|
|
1779
1782
|
}
|
|
1780
1783
|
navigateNext() {
|
|
1781
1784
|
const e = this.selectNavigation(), t = this.controller?.getSectionAt(e.currentIndex + 1);
|
|
1782
|
-
if (!this.dispatch(
|
|
1785
|
+
if (!this.dispatch(m.navigationRequested, {
|
|
1783
1786
|
fromIndex: e.currentIndex,
|
|
1784
1787
|
toIndex: e.currentIndex + 1,
|
|
1785
1788
|
fromSectionId: e.currentSectionId,
|
|
@@ -1792,7 +1795,7 @@ var qe = "pie-section-player-splitpane", je = "pie-section-player-vertical", Ve
|
|
|
1792
1795
|
}
|
|
1793
1796
|
navigatePrevious() {
|
|
1794
1797
|
const e = this.selectNavigation(), t = this.controller?.getSectionAt(e.currentIndex - 1);
|
|
1795
|
-
if (!this.dispatch(
|
|
1798
|
+
if (!this.dispatch(m.navigationRequested, {
|
|
1796
1799
|
fromIndex: e.currentIndex,
|
|
1797
1800
|
toIndex: e.currentIndex - 1,
|
|
1798
1801
|
fromSectionId: e.currentSectionId,
|
|
@@ -1814,8 +1817,8 @@ var qe = "pie-section-player-splitpane", je = "pie-section-player-vertical", Ve
|
|
|
1814
1817
|
return Promise.race([t, n]);
|
|
1815
1818
|
}
|
|
1816
1819
|
};
|
|
1817
|
-
H("pie-assessment-player-default",
|
|
1818
|
-
var
|
|
1820
|
+
H("pie-assessment-player-default", Ye, "assessment player default tag");
|
|
1821
|
+
var We = class extends HTMLElement {
|
|
1819
1822
|
constructor(...e) {
|
|
1820
1823
|
super(...e), this.showNavigation = !0;
|
|
1821
1824
|
}
|
|
@@ -1861,7 +1864,7 @@ var Ye = class extends HTMLElement {
|
|
|
1861
1864
|
i.appendChild(s), n.appendChild(i), this.appendChild(t), this.appendChild(n);
|
|
1862
1865
|
}
|
|
1863
1866
|
};
|
|
1864
|
-
H("pie-assessment-player-shell",
|
|
1867
|
+
H("pie-assessment-player-shell", We, "assessment player shell tag");
|
|
1865
1868
|
export {
|
|
1866
|
-
|
|
1869
|
+
m as ASSESSMENT_PLAYER_PUBLIC_EVENTS
|
|
1867
1870
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-players/pie-assessment-player",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.70",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Assessment-level coordinator custom elements for orchestrating section-player instances",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,22 +44,22 @@
|
|
|
44
44
|
"scripts": {
|
|
45
45
|
"build": "vite build",
|
|
46
46
|
"dev": "vite build --watch",
|
|
47
|
-
"test": "bun test
|
|
47
|
+
"test": "bun test",
|
|
48
48
|
"typecheck": "tsc --noEmit",
|
|
49
49
|
"check": "tsc --noEmit",
|
|
50
50
|
"lint": "biome check ."
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@pie-players/pie-assessment-toolkit": "0.3.
|
|
54
|
-
"@pie-players/pie-players-shared": "0.3.
|
|
55
|
-
"@pie-players/pie-section-player": "0.3.
|
|
53
|
+
"@pie-players/pie-assessment-toolkit": "0.3.70",
|
|
54
|
+
"@pie-players/pie-players-shared": "0.3.70",
|
|
55
|
+
"@pie-players/pie-section-player": "0.3.70"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@axe-core/playwright": "^4.13.0",
|
|
59
59
|
"@playwright/test": "^1.62.1",
|
|
60
|
-
"@biomejs/biome": "^2.5.
|
|
60
|
+
"@biomejs/biome": "^2.5.11",
|
|
61
61
|
"typescript": "^5.9.3",
|
|
62
|
-
"vite": "^8.2.
|
|
62
|
+
"vite": "^8.2.2",
|
|
63
63
|
"vite-plugin-dts": "^5.0.3"
|
|
64
64
|
},
|
|
65
65
|
"homepage": "https://github.com/pie-framework/pie-players/tree/master/packages/assessment-player#readme",
|