@pie-players/pie-assessment-player 0.3.69 → 0.3.71
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.
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import "@pie-players/pie-section-player/components/section-player-splitpane-element";
|
|
2
2
|
import "@pie-players/pie-section-player/components/section-player-vertical-element";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
3
|
+
import { SECTION_PLAYER_PUBLIC_EVENTS as x } from "@pie-players/pie-section-player/contracts/public-events";
|
|
4
|
+
import { coerceBooleanLike as L, defineCustomElementSafely as V } from "@pie-players/pie-players-shared";
|
|
5
|
+
import { createNewAssessmentSession as re, frameworkErrorFromUnknown as ae, setCurrentSectionPosition as le, upsertSectionSession as ce } from "@pie-players/pie-assessment-toolkit";
|
|
6
|
+
var S = (e) => {
|
|
6
7
|
if (e === null || typeof e != "object") return e;
|
|
7
|
-
if (Array.isArray(e)) return e.map(
|
|
8
|
+
if (Array.isArray(e)) return e.map(S);
|
|
8
9
|
const t = {};
|
|
9
|
-
for (const
|
|
10
|
+
for (const i in e) Object.hasOwn(e, i) && (t[i] = S(e[i]));
|
|
10
11
|
return t;
|
|
11
|
-
},
|
|
12
|
-
function
|
|
12
|
+
}, Y = "https://proxy.pie-api.com", de = `${Y}/bundles/`;
|
|
13
|
+
function W(e) {
|
|
13
14
|
try {
|
|
14
15
|
const t = {
|
|
15
16
|
BASE_URL: "/",
|
|
@@ -22,167 +23,170 @@ function j(e) {
|
|
|
22
23
|
} catch {
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
|
-
var
|
|
26
|
-
|
|
26
|
+
var nt = typeof window < "u" && window.PIE_BUILDER_ORIGIN_URL || W("PUBLIC_BUILDER_ORIGIN_URL") || Y, ue = typeof window < "u" && window.PIE_BUILDER_BUNDLE_URL || W("PUBLIC_BUILDER_BUNDLE_URL") || de, he = {
|
|
27
|
+
retryDelayMs: 3e3,
|
|
28
|
+
timeoutMs: 12e4
|
|
29
|
+
};
|
|
30
|
+
function w(e) {
|
|
27
31
|
"@babel/helpers - typeof";
|
|
28
|
-
return
|
|
32
|
+
return w = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
|
|
29
33
|
return typeof t;
|
|
30
34
|
} : function(t) {
|
|
31
35
|
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
32
|
-
},
|
|
36
|
+
}, w(e);
|
|
33
37
|
}
|
|
34
|
-
function
|
|
35
|
-
if (
|
|
36
|
-
var
|
|
37
|
-
if (
|
|
38
|
-
var
|
|
39
|
-
if (
|
|
38
|
+
function pe(e, t) {
|
|
39
|
+
if (w(e) != "object" || !e) return e;
|
|
40
|
+
var i = e[Symbol.toPrimitive];
|
|
41
|
+
if (i !== void 0) {
|
|
42
|
+
var s = i.call(e, t || "default");
|
|
43
|
+
if (w(s) != "object") return s;
|
|
40
44
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
41
45
|
}
|
|
42
46
|
return (t === "string" ? String : Number)(e);
|
|
43
47
|
}
|
|
44
|
-
function
|
|
45
|
-
var t =
|
|
46
|
-
return
|
|
48
|
+
function me(e) {
|
|
49
|
+
var t = pe(e, "string");
|
|
50
|
+
return w(t) == "symbol" ? t : t + "";
|
|
47
51
|
}
|
|
48
|
-
function a(e, t,
|
|
49
|
-
return (t =
|
|
50
|
-
value:
|
|
52
|
+
function a(e, t, i) {
|
|
53
|
+
return (t = me(t)) in e ? Object.defineProperty(e, t, {
|
|
54
|
+
value: i,
|
|
51
55
|
enumerable: !0,
|
|
52
56
|
configurable: !0,
|
|
53
57
|
writable: !0
|
|
54
|
-
}) : e[t] =
|
|
58
|
+
}) : e[t] = i, e;
|
|
55
59
|
}
|
|
56
|
-
var
|
|
60
|
+
var D;
|
|
57
61
|
(function(e) {
|
|
58
62
|
e.SAVE = "save", e.MODEL = "model", e.SCORE = "score", e.MANUAL_SCORE = "manual-score";
|
|
59
|
-
})(
|
|
60
|
-
var
|
|
63
|
+
})(D || (D = {}));
|
|
64
|
+
var _;
|
|
61
65
|
(function(e) {
|
|
62
66
|
e.AUTO = "auto", e.MANUAL = "manual";
|
|
63
|
-
})(
|
|
64
|
-
var
|
|
67
|
+
})(_ || (_ = {}));
|
|
68
|
+
var U;
|
|
65
69
|
(function(e) {
|
|
66
70
|
e.GATHER = "gather", e.VIEW = "view", e.EVALUATE = "evaluate";
|
|
67
|
-
})(
|
|
68
|
-
var
|
|
71
|
+
})(U || (U = {}));
|
|
72
|
+
var M;
|
|
69
73
|
(function(e) {
|
|
70
74
|
e.PENDING = "pending", e.IN_PROGRESS = "in_progress", e.COMPLETED = "completed", e.FAILED = "failed";
|
|
71
|
-
})(
|
|
72
|
-
var
|
|
73
|
-
constructor(t,
|
|
74
|
-
super(
|
|
75
|
+
})(M || (M = {}));
|
|
76
|
+
var ge = class Q extends CustomEvent {
|
|
77
|
+
constructor(t, i = !1) {
|
|
78
|
+
super(Q.TYPE, {
|
|
75
79
|
bubbles: !0,
|
|
76
80
|
detail: {
|
|
77
81
|
update: t,
|
|
78
|
-
reset:
|
|
82
|
+
reset: i
|
|
79
83
|
}
|
|
80
|
-
}), a(this, "update", void 0), a(this, "reset", void 0), this.update = t, this.reset =
|
|
84
|
+
}), a(this, "update", void 0), a(this, "reset", void 0), this.update = t, this.reset = i;
|
|
81
85
|
}
|
|
82
86
|
};
|
|
83
|
-
a(
|
|
84
|
-
var
|
|
85
|
-
constructor(t,
|
|
86
|
-
super(
|
|
87
|
+
a(ge, "TYPE", "model.updated");
|
|
88
|
+
var fe = class J extends CustomEvent {
|
|
89
|
+
constructor(t, i) {
|
|
90
|
+
super(J.TYPE, {
|
|
87
91
|
bubbles: !0,
|
|
88
92
|
detail: {
|
|
89
93
|
src: t,
|
|
90
|
-
done:
|
|
94
|
+
done: i
|
|
91
95
|
}
|
|
92
|
-
}), a(this, "src", void 0), a(this, "done", void 0), this.src = t, this.done =
|
|
96
|
+
}), a(this, "src", void 0), a(this, "done", void 0), this.src = t, this.done = i;
|
|
93
97
|
}
|
|
94
98
|
};
|
|
95
|
-
a(
|
|
96
|
-
var
|
|
99
|
+
a(fe, "TYPE", "delete.image");
|
|
100
|
+
var ve = class K extends CustomEvent {
|
|
97
101
|
constructor(t) {
|
|
98
|
-
super(
|
|
102
|
+
super(K.TYPE, {
|
|
99
103
|
bubbles: !0,
|
|
100
104
|
detail: t
|
|
101
105
|
}), a(this, "handler", void 0), this.handler = t;
|
|
102
106
|
}
|
|
103
107
|
};
|
|
104
|
-
a(
|
|
105
|
-
var
|
|
106
|
-
constructor(t,
|
|
107
|
-
super(
|
|
108
|
+
a(ve, "TYPE", "insert.image");
|
|
109
|
+
var ye = class Z extends CustomEvent {
|
|
110
|
+
constructor(t, i) {
|
|
111
|
+
super(Z.TYPE, {
|
|
108
112
|
bubbles: !0,
|
|
109
113
|
detail: {
|
|
110
114
|
src: t,
|
|
111
|
-
done:
|
|
115
|
+
done: i
|
|
112
116
|
}
|
|
113
|
-
}), a(this, "src", void 0), a(this, "done", void 0), this.src = t, this.done =
|
|
117
|
+
}), a(this, "src", void 0), a(this, "done", void 0), this.src = t, this.done = i;
|
|
114
118
|
}
|
|
115
119
|
};
|
|
116
|
-
a(
|
|
117
|
-
var
|
|
120
|
+
a(ye, "TYPE", "delete.sound");
|
|
121
|
+
var be = class X extends CustomEvent {
|
|
118
122
|
constructor(t) {
|
|
119
|
-
super(
|
|
123
|
+
super(X.TYPE, {
|
|
120
124
|
bubbles: !0,
|
|
121
125
|
detail: t
|
|
122
126
|
}), a(this, "handler", void 0), this.handler = t;
|
|
123
127
|
}
|
|
124
128
|
};
|
|
125
|
-
a(
|
|
126
|
-
var
|
|
127
|
-
constructor(t,
|
|
128
|
-
super(
|
|
129
|
+
a(be, "TYPE", "insert.sound");
|
|
130
|
+
var Se = class ee extends CustomEvent {
|
|
131
|
+
constructor(t, i) {
|
|
132
|
+
super(ee.TYPE, {
|
|
129
133
|
bubbles: !0,
|
|
130
134
|
composed: !0,
|
|
131
135
|
detail: {
|
|
132
|
-
complete:
|
|
136
|
+
complete: i,
|
|
133
137
|
component: t
|
|
134
138
|
}
|
|
135
|
-
}), a(this, "component", void 0), a(this, "complete", void 0), this.component = t, this.complete =
|
|
139
|
+
}), a(this, "component", void 0), a(this, "complete", void 0), this.component = t, this.complete = i;
|
|
136
140
|
}
|
|
137
141
|
};
|
|
138
|
-
a(
|
|
139
|
-
var
|
|
142
|
+
a(Se, "TYPE", "session-changed");
|
|
143
|
+
var F;
|
|
140
144
|
(function(e) {
|
|
141
145
|
e[e.ROOT = 0] = "ROOT", e[e.SUBJECT = 1] = "SUBJECT", e[e.LEVEL = 2] = "LEVEL", e[e.STANDARD = 3] = "STANDARD";
|
|
142
|
-
})(
|
|
143
|
-
function
|
|
144
|
-
const
|
|
146
|
+
})(F || (F = {}));
|
|
147
|
+
function v(e, t) {
|
|
148
|
+
const i = `[${e}]`;
|
|
145
149
|
return {
|
|
146
|
-
debug: (
|
|
147
|
-
t() && console.debug(
|
|
150
|
+
debug: (s, ...n) => {
|
|
151
|
+
t() && console.debug(i, s, ...n);
|
|
148
152
|
},
|
|
149
|
-
info: (
|
|
150
|
-
warn: (
|
|
151
|
-
error: (
|
|
153
|
+
info: (s, ...n) => console.info(i, s, ...n),
|
|
154
|
+
warn: (s, ...n) => console.warn(i, s, ...n),
|
|
155
|
+
error: (s, ...n) => console.error(i, s, ...n)
|
|
152
156
|
};
|
|
153
157
|
}
|
|
154
|
-
function
|
|
158
|
+
function y() {
|
|
155
159
|
return typeof window < "u" && window.PIE_DEBUG === !0;
|
|
156
160
|
}
|
|
157
|
-
var
|
|
161
|
+
var T;
|
|
158
162
|
(function(e) {
|
|
159
163
|
e.player = "player.js", e.clientPlayer = "client-player.js", e.editor = "editor.js";
|
|
160
|
-
})(
|
|
161
|
-
var
|
|
164
|
+
})(T || (T = {}));
|
|
165
|
+
var B;
|
|
162
166
|
(function(e) {
|
|
163
167
|
e.loading = "loading", e.loaded = "loaded";
|
|
164
|
-
})(
|
|
165
|
-
var
|
|
166
|
-
buildServiceBase:
|
|
167
|
-
bundleType:
|
|
168
|
+
})(B || (B = {}));
|
|
169
|
+
var ot = v("pie-scoring", () => y()), rt = v("pie-initialize-element", () => y()), at = v("math-rendering", () => y()), lt = v("pie-updates", () => y()), ct = v("pie-initialization", () => y()), dt = he.timeoutMs, ut = {
|
|
170
|
+
buildServiceBase: ue,
|
|
171
|
+
bundleType: T.player,
|
|
168
172
|
env: {
|
|
169
173
|
mode: "gather",
|
|
170
174
|
role: "student"
|
|
171
175
|
}
|
|
172
|
-
},
|
|
173
|
-
function
|
|
176
|
+
}, ht = v("pie-element-observer", () => y()), pt = v("asset-handler", () => y()), mt = v("authoring", () => y());
|
|
177
|
+
function te(e) {
|
|
174
178
|
if (!e || typeof e != "object") return !1;
|
|
175
179
|
const t = e;
|
|
176
180
|
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
181
|
}
|
|
178
|
-
var
|
|
179
|
-
function
|
|
182
|
+
var we = v("instrumentation-event-bridge", () => y());
|
|
183
|
+
function Ae(e) {
|
|
180
184
|
return e && typeof e == "object" ? e : typeof e > "u" ? {} : { value: e };
|
|
181
185
|
}
|
|
182
|
-
function
|
|
183
|
-
|
|
186
|
+
function Ee(e) {
|
|
187
|
+
we.warn(`[InstrumentationEventBridge:${e}] Ignoring invalid instrumentation provider; expected InstrumentationProvider contract`);
|
|
184
188
|
}
|
|
185
|
-
function
|
|
189
|
+
function Ie(e) {
|
|
186
190
|
try {
|
|
187
191
|
e.provider.trackError(e.error instanceof Error ? e.error : new Error(String(e.error ?? "Unknown instrumentation bridge error")), {
|
|
188
192
|
component: e.component,
|
|
@@ -192,16 +196,16 @@ function be(e) {
|
|
|
192
196
|
} catch {
|
|
193
197
|
}
|
|
194
198
|
}
|
|
195
|
-
function
|
|
199
|
+
function Pe(e) {
|
|
196
200
|
if (!e.host || !e.eventMap.length) return () => {
|
|
197
201
|
};
|
|
198
202
|
if (!e.instrumentationProvider) return () => {
|
|
199
203
|
};
|
|
200
|
-
if (!
|
|
201
|
-
return e.debug &&
|
|
204
|
+
if (!te(e.instrumentationProvider))
|
|
205
|
+
return e.debug && Ee(e.component), () => {
|
|
202
206
|
};
|
|
203
|
-
const t = e.instrumentationProvider,
|
|
204
|
-
const
|
|
207
|
+
const t = e.instrumentationProvider, i = [], s = Math.max(0, e.dedupeWindowMs ?? 0), n = /* @__PURE__ */ new Map(), o = (r, l) => {
|
|
208
|
+
const p = [
|
|
205
209
|
l.assessmentId,
|
|
206
210
|
l.sectionId,
|
|
207
211
|
l.attemptId,
|
|
@@ -209,27 +213,27 @@ function Se(e) {
|
|
|
209
213
|
l.canonicalItemId,
|
|
210
214
|
l.sourceRuntimeId
|
|
211
215
|
].map((u) => String(u ?? "")).join("|");
|
|
212
|
-
return `${r.instrumentationEventName}|${
|
|
216
|
+
return `${r.instrumentationEventName}|${p}`;
|
|
213
217
|
};
|
|
214
218
|
for (const r of e.eventMap) {
|
|
215
|
-
const l = (
|
|
219
|
+
const l = (p) => {
|
|
216
220
|
try {
|
|
217
|
-
if (!t.isReady() || e.shouldTrackEvent && !e.shouldTrackEvent(
|
|
218
|
-
const u =
|
|
221
|
+
if (!t.isReady() || e.shouldTrackEvent && !e.shouldTrackEvent(p)) return;
|
|
222
|
+
const u = Ae(p.detail), d = (/* @__PURE__ */ new Date()).toISOString(), g = {
|
|
219
223
|
...u,
|
|
220
224
|
...e.staticAttributes,
|
|
221
225
|
component: e.component,
|
|
222
226
|
sourceEventName: r.sourceEventName,
|
|
223
|
-
timestamp:
|
|
227
|
+
timestamp: d
|
|
224
228
|
};
|
|
225
|
-
if (
|
|
226
|
-
const
|
|
227
|
-
if (typeof
|
|
228
|
-
|
|
229
|
+
if (s > 0) {
|
|
230
|
+
const h = Date.now(), c = o(r, g), f = n.get(c);
|
|
231
|
+
if (typeof f == "number" && h - f < s) return;
|
|
232
|
+
n.set(c, h);
|
|
229
233
|
}
|
|
230
|
-
t.trackEvent(r.instrumentationEventName, { ...
|
|
234
|
+
t.trackEvent(r.instrumentationEventName, { ...g });
|
|
231
235
|
} catch (u) {
|
|
232
|
-
|
|
236
|
+
Ie({
|
|
233
237
|
provider: t,
|
|
234
238
|
component: e.component,
|
|
235
239
|
error: u,
|
|
@@ -237,43 +241,43 @@ function Se(e) {
|
|
|
237
241
|
});
|
|
238
242
|
}
|
|
239
243
|
};
|
|
240
|
-
e.host.addEventListener(r.sourceEventName, l),
|
|
244
|
+
e.host.addEventListener(r.sourceEventName, l), i.push(() => {
|
|
241
245
|
e.host?.removeEventListener(r.sourceEventName, l);
|
|
242
246
|
});
|
|
243
247
|
}
|
|
244
248
|
return () => {
|
|
245
|
-
for (const r of
|
|
249
|
+
for (const r of i) r();
|
|
246
250
|
};
|
|
247
251
|
}
|
|
248
|
-
var
|
|
252
|
+
var Ce = class {
|
|
249
253
|
constructor() {
|
|
250
254
|
a(this, "initialized", !1), a(this, "config", void 0);
|
|
251
255
|
}
|
|
252
256
|
trackError(e, t) {
|
|
253
257
|
if (!this.guardedOperation("trackError", e, t) || !this.applyErrorFilter(e, t)) return;
|
|
254
|
-
const
|
|
258
|
+
const i = this.transformAttributes(t);
|
|
255
259
|
try {
|
|
256
|
-
this.doTrackError(e,
|
|
257
|
-
} catch (
|
|
258
|
-
console.error(`[${this.providerName}] Error tracking error:`,
|
|
260
|
+
this.doTrackError(e, i), this.config?.debug && console.log(`[${this.providerName}] Tracked error:`, e, i);
|
|
261
|
+
} catch (s) {
|
|
262
|
+
console.error(`[${this.providerName}] Error tracking error:`, s);
|
|
259
263
|
}
|
|
260
264
|
}
|
|
261
265
|
trackEvent(e, t) {
|
|
262
266
|
if (!this.guardedOperation("trackEvent", e, t) || !this.applyEventFilter(e, t) || !this.applySampling(e)) return;
|
|
263
|
-
let
|
|
264
|
-
|
|
265
|
-
...
|
|
267
|
+
let i = this.transformAttributes(t);
|
|
268
|
+
i.timestamp || (i = {
|
|
269
|
+
...i,
|
|
266
270
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
267
271
|
});
|
|
268
272
|
try {
|
|
269
|
-
this.doTrackEvent(e,
|
|
270
|
-
} catch (
|
|
271
|
-
console.error(`[${this.providerName}] Error tracking event:`,
|
|
273
|
+
this.doTrackEvent(e, i), this.config?.debug && console.log(`[${this.providerName}] Tracked event:`, e, i);
|
|
274
|
+
} catch (s) {
|
|
275
|
+
console.error(`[${this.providerName}] Error tracking event:`, s);
|
|
272
276
|
}
|
|
273
277
|
}
|
|
274
|
-
trackMetric(e, t,
|
|
278
|
+
trackMetric(e, t, i) {
|
|
275
279
|
this.trackEvent(`metric:${e}`, {
|
|
276
|
-
...
|
|
280
|
+
...i,
|
|
277
281
|
metricValue: t,
|
|
278
282
|
metricName: e
|
|
279
283
|
});
|
|
@@ -282,8 +286,8 @@ var we = class {
|
|
|
282
286
|
if (this.guardedOperation("setUserContext", e, t))
|
|
283
287
|
try {
|
|
284
288
|
this.doSetUserContext(e, t), this.config?.debug && console.log(`[${this.providerName}] Set user context:`, e, t);
|
|
285
|
-
} catch (
|
|
286
|
-
console.error(`[${this.providerName}] Error setting user context:`,
|
|
289
|
+
} catch (i) {
|
|
290
|
+
console.error(`[${this.providerName}] Error setting user context:`, i);
|
|
287
291
|
}
|
|
288
292
|
}
|
|
289
293
|
setGlobalAttributes(e) {
|
|
@@ -309,7 +313,7 @@ var we = class {
|
|
|
309
313
|
transformAttributes(e) {
|
|
310
314
|
return this.config?.attributeTransformer ? this.config.attributeTransformer(e) : e;
|
|
311
315
|
}
|
|
312
|
-
},
|
|
316
|
+
}, Re = class extends Ce {
|
|
313
317
|
constructor(...e) {
|
|
314
318
|
super(...e), a(this, "providerId", "newrelic"), a(this, "providerName", "New Relic");
|
|
315
319
|
}
|
|
@@ -329,22 +333,22 @@ var we = class {
|
|
|
329
333
|
window.newrelic.addPageAction(e, t);
|
|
330
334
|
}
|
|
331
335
|
doSetUserContext(e, t) {
|
|
332
|
-
const
|
|
333
|
-
if (
|
|
336
|
+
const i = window.newrelic;
|
|
337
|
+
if (i.setUserId && i.setUserId(e), t && i.setCustomAttribute) for (const [s, n] of Object.entries(t)) i.setCustomAttribute(s, n);
|
|
334
338
|
}
|
|
335
339
|
doSetGlobalAttributes(e) {
|
|
336
340
|
const t = window.newrelic;
|
|
337
|
-
if (t.setCustomAttribute) for (const [
|
|
341
|
+
if (t.setCustomAttribute) for (const [i, s] of Object.entries(e)) t.setCustomAttribute(i, s);
|
|
338
342
|
}
|
|
339
343
|
};
|
|
340
|
-
function
|
|
344
|
+
function z(e) {
|
|
341
345
|
return e && typeof e == "object" ? e : {};
|
|
342
346
|
}
|
|
343
|
-
function
|
|
344
|
-
const t =
|
|
347
|
+
function O(e) {
|
|
348
|
+
const t = z(z(e).loaderConfig);
|
|
345
349
|
return Object.keys(t).length > 0 ? t : null;
|
|
346
350
|
}
|
|
347
|
-
function
|
|
351
|
+
function G(e) {
|
|
348
352
|
if (!e || !("instrumentationProvider" in e)) return { kind: "unset" };
|
|
349
353
|
const t = e.instrumentationProvider;
|
|
350
354
|
return t === null ? { kind: "null" } : typeof t > "u" ? { kind: "unset" } : {
|
|
@@ -352,35 +356,35 @@ function B(e) {
|
|
|
352
356
|
value: t
|
|
353
357
|
};
|
|
354
358
|
}
|
|
355
|
-
function
|
|
359
|
+
function $(e) {
|
|
356
360
|
if (!e || !("trackPageActions" in e)) return;
|
|
357
361
|
const t = e.trackPageActions;
|
|
358
362
|
return typeof t == "boolean" ? t : void 0;
|
|
359
363
|
}
|
|
360
|
-
function
|
|
364
|
+
function ke(e, t) {
|
|
361
365
|
return e.kind === "value" || e.kind === "null" ? e : t;
|
|
362
366
|
}
|
|
363
|
-
var
|
|
364
|
-
function
|
|
365
|
-
return
|
|
367
|
+
var I, Le = v("instrumentation-provider-resolution", () => y());
|
|
368
|
+
function Te() {
|
|
369
|
+
return I || (I = new Re(), I.initialize()), I;
|
|
366
370
|
}
|
|
367
|
-
function
|
|
368
|
-
const t =
|
|
371
|
+
function Ne(e) {
|
|
372
|
+
const t = O(e.runtimePlayer), i = O(e.player), s = $(t), n = $(i), o = s ?? n ?? !1, r = ke(G(t), G(i));
|
|
369
373
|
if (r.kind !== "null") {
|
|
370
|
-
if (r.kind === "unset") return o ?
|
|
371
|
-
if (
|
|
374
|
+
if (r.kind === "unset") return o ? Te() : void 0;
|
|
375
|
+
if (te(r.value)) return r.value;
|
|
372
376
|
if (e.debug) {
|
|
373
377
|
const l = e.component ? `[${e.component}] ` : "";
|
|
374
|
-
|
|
378
|
+
Le.warn(`${l}Ignoring invalid instrumentation provider; expected InstrumentationProvider contract`);
|
|
375
379
|
}
|
|
376
380
|
}
|
|
377
381
|
}
|
|
378
|
-
var
|
|
382
|
+
var gt = Object.freeze([
|
|
379
383
|
"composed",
|
|
380
384
|
"engine-ready",
|
|
381
385
|
"interactive",
|
|
382
386
|
"disposed"
|
|
383
|
-
]),
|
|
387
|
+
]), xe = [
|
|
384
388
|
{
|
|
385
389
|
sourceEventName: "assessment-controller-ready",
|
|
386
390
|
instrumentationEventName: "pie-assessment-controller-ready"
|
|
@@ -413,7 +417,7 @@ var rt = Object.freeze([
|
|
|
413
417
|
sourceEventName: "assessment-error",
|
|
414
418
|
instrumentationEventName: "pie-assessment-error"
|
|
415
419
|
}
|
|
416
|
-
],
|
|
420
|
+
], ft = /* @__PURE__ */ new Set([
|
|
417
421
|
"id",
|
|
418
422
|
"element",
|
|
419
423
|
.../* @__PURE__ */ new Set([
|
|
@@ -422,32 +426,32 @@ var rt = Object.freeze([
|
|
|
422
426
|
"timestamp",
|
|
423
427
|
"sourceRuntimeId"
|
|
424
428
|
])
|
|
425
|
-
]),
|
|
426
|
-
async function
|
|
427
|
-
const t =
|
|
429
|
+
]), vt = v("pie-overrides", () => y()), De = { "nl-NL": () => import("./nl-NL-FLtEAIq9.js") }, _e = ["en-US", "nl-NL"];
|
|
430
|
+
async function Ue(e) {
|
|
431
|
+
const t = De[e];
|
|
428
432
|
if (!t) throw new Error(`No bundled i18n catalog for locale: ${e}`);
|
|
429
433
|
return (await t()).default;
|
|
430
434
|
}
|
|
431
|
-
function
|
|
435
|
+
function A(e) {
|
|
432
436
|
return e ? e.trim().replace(/_/g, "-").split(/[.@]/)[0].toLowerCase() : "";
|
|
433
437
|
}
|
|
434
|
-
function
|
|
435
|
-
const t =
|
|
438
|
+
function Me(e) {
|
|
439
|
+
const t = A(e);
|
|
436
440
|
if (!t) return [];
|
|
437
|
-
const
|
|
438
|
-
for (let
|
|
439
|
-
const o =
|
|
440
|
-
o.length > 1 && o[o.length - 1].length === 1 ||
|
|
441
|
+
const i = t.split("-"), s = [];
|
|
442
|
+
for (let n = i.length; n > 0; n--) {
|
|
443
|
+
const o = i.slice(0, n);
|
|
444
|
+
o.length > 1 && o[o.length - 1].length === 1 || s.push(o.join("-"));
|
|
441
445
|
}
|
|
442
|
-
return
|
|
446
|
+
return s;
|
|
443
447
|
}
|
|
444
|
-
function
|
|
445
|
-
for (const
|
|
446
|
-
const
|
|
447
|
-
if (
|
|
448
|
+
function Fe(e, t) {
|
|
449
|
+
for (const i of Me(e)) {
|
|
450
|
+
const s = t.find((n) => A(n) === i);
|
|
451
|
+
if (s != null) return s;
|
|
448
452
|
}
|
|
449
453
|
}
|
|
450
|
-
var
|
|
454
|
+
var Be = {
|
|
451
455
|
common: {
|
|
452
456
|
close: "Close",
|
|
453
457
|
cancel: "Cancel",
|
|
@@ -509,7 +513,9 @@ var De = {
|
|
|
509
513
|
resizePassageAndMediaA11y: "Resize passage and media panels",
|
|
510
514
|
assessment: {
|
|
511
515
|
sectionPosition: "Section {position} of {total}",
|
|
512
|
-
noSections: "No sections"
|
|
516
|
+
noSections: "No sections",
|
|
517
|
+
loadFailed: "The assessment could not be loaded. Try again.",
|
|
518
|
+
restoreFailed: "Your saved answers for this section could not be restored. Try again."
|
|
513
519
|
},
|
|
514
520
|
formative: {
|
|
515
521
|
checkAnswer: "Check answer",
|
|
@@ -946,7 +952,7 @@ var De = {
|
|
|
946
952
|
coordinatorUnavailable: "Toolkit coordinator is not available for text-to-speech updates."
|
|
947
953
|
}
|
|
948
954
|
}
|
|
949
|
-
},
|
|
955
|
+
}, k = "en-US", ze = /* @__PURE__ */ new Set([
|
|
950
956
|
"ar",
|
|
951
957
|
"ckb",
|
|
952
958
|
"dv",
|
|
@@ -962,7 +968,7 @@ var De = {
|
|
|
962
968
|
"ug",
|
|
963
969
|
"ur",
|
|
964
970
|
"yi"
|
|
965
|
-
]),
|
|
971
|
+
]), Oe = /* @__PURE__ */ new Set([
|
|
966
972
|
"zero",
|
|
967
973
|
"one",
|
|
968
974
|
"two",
|
|
@@ -970,65 +976,65 @@ var De = {
|
|
|
970
976
|
"many",
|
|
971
977
|
"other"
|
|
972
978
|
]);
|
|
973
|
-
function
|
|
979
|
+
function H(e) {
|
|
974
980
|
if (typeof e != "object" || e === null) return !1;
|
|
975
981
|
const t = Object.keys(e);
|
|
976
|
-
return t.length > 0 && t.every((
|
|
982
|
+
return t.length > 0 && t.every((i) => Oe.has(i));
|
|
977
983
|
}
|
|
978
|
-
function
|
|
984
|
+
function q(e) {
|
|
979
985
|
try {
|
|
980
|
-
const
|
|
981
|
-
if (
|
|
986
|
+
const i = new Intl.Locale(e).textInfo;
|
|
987
|
+
if (i?.direction === "rtl" || i?.direction === "ltr") return i.direction;
|
|
982
988
|
} catch {
|
|
983
989
|
}
|
|
984
|
-
const t =
|
|
985
|
-
return
|
|
990
|
+
const t = A(e).split("-")[0] ?? "";
|
|
991
|
+
return ze.has(t) ? "rtl" : "ltr";
|
|
986
992
|
}
|
|
987
|
-
var
|
|
993
|
+
var ie = class R {
|
|
988
994
|
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 =
|
|
995
|
+
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 = P(t.fallbackLocale) || "en-US", this.catalogs = /* @__PURE__ */ new Map([[k, Be]]), this.customMessages = { ...t.customMessages ?? {} }, this.loading = /* @__PURE__ */ new Map(), this.locale = this.resolveLocaleTag(t.locale) ?? "en-US";
|
|
990
996
|
}
|
|
991
997
|
async initialize(t) {
|
|
992
998
|
if (this.config = {
|
|
993
999
|
...this.config,
|
|
994
1000
|
...t
|
|
995
|
-
}, t.customMessages) for (const [
|
|
1001
|
+
}, t.customMessages) for (const [i, s] of Object.entries(t.customMessages)) this.addCustomMessages(i, s);
|
|
996
1002
|
await this.setLocale(t.locale ?? this.locale);
|
|
997
1003
|
}
|
|
998
1004
|
getLocale() {
|
|
999
1005
|
return this.locale;
|
|
1000
1006
|
}
|
|
1001
1007
|
async setLocale(t) {
|
|
1002
|
-
const
|
|
1003
|
-
if (!
|
|
1004
|
-
this.locale =
|
|
1008
|
+
const i = this.resolveLocaleTag(t);
|
|
1009
|
+
if (!i) {
|
|
1010
|
+
this.locale = P(t) || "en-US", this.notify();
|
|
1005
1011
|
return;
|
|
1006
1012
|
}
|
|
1007
|
-
if (!this.catalogs.has(
|
|
1008
|
-
const
|
|
1009
|
-
if (
|
|
1013
|
+
if (!this.catalogs.has(i)) {
|
|
1014
|
+
const s = this.loading.get(i);
|
|
1015
|
+
if (s) await s;
|
|
1010
1016
|
else {
|
|
1011
|
-
const
|
|
1012
|
-
this.loading.set(
|
|
1017
|
+
const n = this.loadCatalog(i);
|
|
1018
|
+
this.loading.set(i, n);
|
|
1013
1019
|
try {
|
|
1014
|
-
await
|
|
1020
|
+
await n;
|
|
1015
1021
|
} finally {
|
|
1016
|
-
this.loading.delete(
|
|
1022
|
+
this.loading.delete(i);
|
|
1017
1023
|
}
|
|
1018
1024
|
}
|
|
1019
1025
|
}
|
|
1020
|
-
this.locale =
|
|
1026
|
+
this.locale = i, this.notify();
|
|
1021
1027
|
}
|
|
1022
|
-
t(t,
|
|
1023
|
-
const
|
|
1024
|
-
return
|
|
1028
|
+
t(t, i) {
|
|
1029
|
+
const s = this.lookup(t);
|
|
1030
|
+
return s === void 0 ? (this.config.onMissingKey?.(t, this.locale), t) : j(s, i);
|
|
1025
1031
|
}
|
|
1026
|
-
plural(t,
|
|
1027
|
-
const
|
|
1028
|
-
return
|
|
1032
|
+
plural(t, i) {
|
|
1033
|
+
const s = this.lookupNode(t);
|
|
1034
|
+
return s === void 0 || !H(s) ? this.t(t, i) : j(s[this.selectPluralCategory(i.count)] ?? s.other, i);
|
|
1029
1035
|
}
|
|
1030
1036
|
getDirection() {
|
|
1031
|
-
return
|
|
1037
|
+
return q(this.locale);
|
|
1032
1038
|
}
|
|
1033
1039
|
getAvailableLocales() {
|
|
1034
1040
|
return [.../* @__PURE__ */ new Set([
|
|
@@ -1038,8 +1044,8 @@ var X = class I {
|
|
|
1038
1044
|
])];
|
|
1039
1045
|
}
|
|
1040
1046
|
isLocaleLoaded(t) {
|
|
1041
|
-
const
|
|
1042
|
-
return
|
|
1047
|
+
const i = this.resolveLocaleTag(t);
|
|
1048
|
+
return i !== void 0 && this.catalogs.has(i);
|
|
1043
1049
|
}
|
|
1044
1050
|
subscribe(t) {
|
|
1045
1051
|
return this.listeners.add(t), () => {
|
|
@@ -1049,217 +1055,223 @@ var X = class I {
|
|
|
1049
1055
|
hasKey(t) {
|
|
1050
1056
|
return this.lookup(t) !== void 0;
|
|
1051
1057
|
}
|
|
1052
|
-
addCustomMessages(t,
|
|
1053
|
-
const
|
|
1054
|
-
this.customMessages[
|
|
1058
|
+
addCustomMessages(t, i) {
|
|
1059
|
+
const s = P(t);
|
|
1060
|
+
this.customMessages[s] = se(this.customMessages[s] ?? {}, i), this.notify();
|
|
1055
1061
|
}
|
|
1056
1062
|
withLocale(t) {
|
|
1057
|
-
const
|
|
1058
|
-
if (
|
|
1059
|
-
const
|
|
1063
|
+
const i = this.resolveLocaleTag(t) ?? P(t);
|
|
1064
|
+
if (i === this.locale) return this;
|
|
1065
|
+
const s = new R({
|
|
1060
1066
|
...this.config,
|
|
1061
|
-
locale:
|
|
1067
|
+
locale: i
|
|
1062
1068
|
});
|
|
1063
|
-
return
|
|
1069
|
+
return s.locale = i || "en-US", s.catalogs = this.catalogs, s.customMessages = this.customMessages, s.loading = this.loading, s;
|
|
1064
1070
|
}
|
|
1065
|
-
formatNumber(t,
|
|
1071
|
+
formatNumber(t, i) {
|
|
1066
1072
|
try {
|
|
1067
|
-
return new Intl.NumberFormat(this.locale,
|
|
1073
|
+
return new Intl.NumberFormat(this.locale, i).format(t);
|
|
1068
1074
|
} catch {
|
|
1069
|
-
return new Intl.NumberFormat(
|
|
1075
|
+
return new Intl.NumberFormat(k, i).format(t);
|
|
1070
1076
|
}
|
|
1071
1077
|
}
|
|
1072
|
-
formatDate(t,
|
|
1078
|
+
formatDate(t, i) {
|
|
1073
1079
|
try {
|
|
1074
|
-
return new Intl.DateTimeFormat(this.locale,
|
|
1080
|
+
return new Intl.DateTimeFormat(this.locale, i).format(t);
|
|
1075
1081
|
} catch {
|
|
1076
|
-
return new Intl.DateTimeFormat(
|
|
1082
|
+
return new Intl.DateTimeFormat(k, i).format(t);
|
|
1077
1083
|
}
|
|
1078
1084
|
}
|
|
1079
1085
|
getBundle(t = this.locale) {
|
|
1080
|
-
const
|
|
1081
|
-
if (!
|
|
1082
|
-
const
|
|
1083
|
-
if (
|
|
1086
|
+
const i = this.resolveLocaleTag(t);
|
|
1087
|
+
if (!i) return;
|
|
1088
|
+
const s = this.catalogs.get(i);
|
|
1089
|
+
if (s)
|
|
1084
1090
|
return {
|
|
1085
|
-
locale:
|
|
1086
|
-
translations:
|
|
1087
|
-
direction:
|
|
1091
|
+
locale: i,
|
|
1092
|
+
translations: s,
|
|
1093
|
+
direction: q(i)
|
|
1088
1094
|
};
|
|
1089
1095
|
}
|
|
1090
1096
|
resolveLocaleTag(t) {
|
|
1091
1097
|
if (!t) return;
|
|
1092
|
-
const
|
|
1093
|
-
if (
|
|
1094
|
-
const
|
|
1095
|
-
if (
|
|
1096
|
-
return
|
|
1098
|
+
const i = this.getAvailableLocales(), s = Fe(t, i);
|
|
1099
|
+
if (s) return s;
|
|
1100
|
+
const n = A(t).split("-")[0];
|
|
1101
|
+
if (n)
|
|
1102
|
+
return i.find((o) => A(o).split("-")[0] === n);
|
|
1097
1103
|
}
|
|
1098
1104
|
async loadCatalog(t) {
|
|
1099
|
-
const
|
|
1100
|
-
if (
|
|
1105
|
+
const i = this.config.loadCatalog;
|
|
1106
|
+
if (i)
|
|
1101
1107
|
try {
|
|
1102
|
-
this.catalogs.set(t, await
|
|
1103
|
-
} catch (
|
|
1104
|
-
throw new Error(`Failed to load i18n catalog for locale: ${t}`, { cause:
|
|
1108
|
+
this.catalogs.set(t, await i(t));
|
|
1109
|
+
} catch (s) {
|
|
1110
|
+
throw new Error(`Failed to load i18n catalog for locale: ${t}`, { cause: s });
|
|
1105
1111
|
}
|
|
1106
1112
|
}
|
|
1107
1113
|
lookupNode(t) {
|
|
1108
|
-
const
|
|
1114
|
+
const i = [
|
|
1109
1115
|
this.customMessages[this.locale],
|
|
1110
1116
|
this.catalogs.get(this.locale),
|
|
1111
1117
|
this.customMessages[this.fallbackLocale],
|
|
1112
1118
|
this.catalogs.get(this.fallbackLocale)
|
|
1113
1119
|
];
|
|
1114
|
-
for (const
|
|
1115
|
-
const
|
|
1116
|
-
if (
|
|
1120
|
+
for (const s of i) {
|
|
1121
|
+
const n = Ge(s, t);
|
|
1122
|
+
if (n !== void 0) return n;
|
|
1117
1123
|
}
|
|
1118
1124
|
}
|
|
1119
1125
|
lookup(t) {
|
|
1120
|
-
const
|
|
1121
|
-
if (typeof
|
|
1122
|
-
if (
|
|
1126
|
+
const i = this.lookupNode(t);
|
|
1127
|
+
if (typeof i == "string") return i;
|
|
1128
|
+
if (i !== void 0 && H(i)) return i.other;
|
|
1123
1129
|
}
|
|
1124
1130
|
selectPluralCategory(t) {
|
|
1125
|
-
let
|
|
1126
|
-
if (!
|
|
1131
|
+
let i = R.pluralRules.get(this.locale);
|
|
1132
|
+
if (!i) {
|
|
1127
1133
|
try {
|
|
1128
|
-
|
|
1134
|
+
i = new Intl.PluralRules(this.locale);
|
|
1129
1135
|
} catch {
|
|
1130
1136
|
return t === 1 ? "one" : "other";
|
|
1131
1137
|
}
|
|
1132
|
-
|
|
1138
|
+
R.pluralRules.set(this.locale, i);
|
|
1133
1139
|
}
|
|
1134
|
-
return
|
|
1140
|
+
return i.select(t);
|
|
1135
1141
|
}
|
|
1136
1142
|
notify() {
|
|
1137
1143
|
for (const t of this.listeners) t();
|
|
1138
1144
|
}
|
|
1139
1145
|
};
|
|
1140
|
-
a(
|
|
1141
|
-
function
|
|
1146
|
+
a(ie, "pluralRules", /* @__PURE__ */ new Map());
|
|
1147
|
+
function P(e) {
|
|
1142
1148
|
return e ? e.trim().replace(/_/g, "-") : "";
|
|
1143
1149
|
}
|
|
1144
|
-
function
|
|
1150
|
+
function Ge(e, t) {
|
|
1145
1151
|
if (!e) return;
|
|
1146
|
-
let
|
|
1147
|
-
for (const
|
|
1148
|
-
if (typeof
|
|
1149
|
-
return
|
|
1152
|
+
let i = e;
|
|
1153
|
+
for (const s of t.split("."))
|
|
1154
|
+
if (typeof i != "object" || i === null || (i = i[s], i === void 0)) return;
|
|
1155
|
+
return i;
|
|
1150
1156
|
}
|
|
1151
|
-
function
|
|
1152
|
-
return t ? e.replace(/\{(\w+)\}/g, (
|
|
1153
|
-
const
|
|
1154
|
-
return
|
|
1157
|
+
function j(e, t) {
|
|
1158
|
+
return t ? e.replace(/\{(\w+)\}/g, (i, s) => {
|
|
1159
|
+
const n = t[s];
|
|
1160
|
+
return n == null ? i : String(n);
|
|
1155
1161
|
}) : e;
|
|
1156
1162
|
}
|
|
1157
|
-
function
|
|
1158
|
-
const
|
|
1159
|
-
for (const [
|
|
1160
|
-
const o =
|
|
1161
|
-
|
|
1163
|
+
function se(e, t) {
|
|
1164
|
+
const i = { ...e };
|
|
1165
|
+
for (const [s, n] of Object.entries(t)) {
|
|
1166
|
+
const o = i[s];
|
|
1167
|
+
n && typeof n == "object" && o && typeof o == "object" ? i[s] = se(o, n) : i[s] = n;
|
|
1162
1168
|
}
|
|
1163
|
-
return
|
|
1169
|
+
return i;
|
|
1164
1170
|
}
|
|
1165
|
-
function
|
|
1166
|
-
return new
|
|
1167
|
-
loadCatalog:
|
|
1168
|
-
availableLocales:
|
|
1171
|
+
function $e(e = {}) {
|
|
1172
|
+
return new ie({
|
|
1173
|
+
loadCatalog: Ue,
|
|
1174
|
+
availableLocales: _e,
|
|
1169
1175
|
...e
|
|
1170
1176
|
});
|
|
1171
1177
|
}
|
|
1172
|
-
function
|
|
1178
|
+
function b() {
|
|
1173
1179
|
return Date.now();
|
|
1174
1180
|
}
|
|
1175
|
-
function
|
|
1181
|
+
function C(e) {
|
|
1176
1182
|
return e.replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
1177
1183
|
}
|
|
1178
|
-
function
|
|
1179
|
-
if (e.attemptId) return `aas_v1_${
|
|
1180
|
-
const t =
|
|
1181
|
-
return `aas_v1_${
|
|
1184
|
+
function He(e) {
|
|
1185
|
+
if (e.attemptId) return `aas_v1_${C(e.assessmentId)}_${C(e.attemptId)}`;
|
|
1186
|
+
const t = ne(), i = t ? qe(t) : "anon";
|
|
1187
|
+
return `aas_v1_${C(e.assessmentId)}_${C(i)}`;
|
|
1182
1188
|
}
|
|
1183
|
-
function
|
|
1189
|
+
function ne() {
|
|
1184
1190
|
try {
|
|
1185
1191
|
return typeof window > "u" ? null : window.localStorage;
|
|
1186
1192
|
} catch {
|
|
1187
1193
|
return null;
|
|
1188
1194
|
}
|
|
1189
1195
|
}
|
|
1190
|
-
function
|
|
1191
|
-
const t = "pie:assessment-player:anonymous-device-id",
|
|
1192
|
-
if (
|
|
1193
|
-
const
|
|
1194
|
-
return e.setItem(t,
|
|
1196
|
+
function qe(e) {
|
|
1197
|
+
const t = "pie:assessment-player:anonymous-device-id", i = e.getItem(t);
|
|
1198
|
+
if (i) return i;
|
|
1199
|
+
const s = `anon-${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;
|
|
1200
|
+
return e.setItem(t, s), s;
|
|
1195
1201
|
}
|
|
1196
|
-
function
|
|
1202
|
+
function je(e) {
|
|
1197
1203
|
if (!e) return [];
|
|
1198
|
-
const t = [],
|
|
1199
|
-
return
|
|
1200
|
-
(
|
|
1204
|
+
const t = [], i = e.testParts || [];
|
|
1205
|
+
return i.length > 0 ? (i.forEach((s, n) => {
|
|
1206
|
+
(s.sections || []).forEach((o, r) => {
|
|
1201
1207
|
t.push({
|
|
1202
|
-
stageIdentifier:
|
|
1203
|
-
stageIndex:
|
|
1208
|
+
stageIdentifier: s.identifier,
|
|
1209
|
+
stageIndex: n,
|
|
1204
1210
|
sectionIndex: t.length,
|
|
1205
|
-
sectionIdentifier: o.identifier || `section-${
|
|
1211
|
+
sectionIdentifier: o.identifier || `section-${n}-${r}`,
|
|
1206
1212
|
section: o
|
|
1207
1213
|
});
|
|
1208
1214
|
});
|
|
1209
|
-
}), t) : ((e.sections || []).forEach((
|
|
1215
|
+
}), t) : ((e.sections || []).forEach((s, n) => {
|
|
1210
1216
|
t.push({
|
|
1211
1217
|
stageIdentifier: "default",
|
|
1212
1218
|
stageIndex: 0,
|
|
1213
|
-
sectionIndex:
|
|
1214
|
-
sectionIdentifier:
|
|
1215
|
-
section:
|
|
1219
|
+
sectionIndex: n,
|
|
1220
|
+
sectionIdentifier: s.identifier || `section-${n}`,
|
|
1221
|
+
section: s
|
|
1216
1222
|
});
|
|
1217
1223
|
}), t);
|
|
1218
1224
|
}
|
|
1219
|
-
var
|
|
1225
|
+
var Ve = class {
|
|
1220
1226
|
constructor(e) {
|
|
1221
|
-
this.args = e, this.listeners = /* @__PURE__ */ new Set(), this.deliveryPlan = { sections: [] }, this.session = null, this.readiness = "bootstrapping", this.submitted = !1, this.storageContext = {
|
|
1227
|
+
this.args = e, this.listeners = /* @__PURE__ */ new Set(), this.deliveryPlan = { sections: [] }, this.session = null, this.readiness = "bootstrapping", this.submitted = !1, this.disposed = !1, this.storageContext = {
|
|
1222
1228
|
assessmentId: e.assessmentId,
|
|
1223
1229
|
attemptId: e.attemptId
|
|
1224
1230
|
};
|
|
1225
1231
|
}
|
|
1226
1232
|
emit(e) {
|
|
1227
|
-
|
|
1233
|
+
if (!this.disposed)
|
|
1234
|
+
for (const t of this.listeners) t(e);
|
|
1228
1235
|
}
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1236
|
+
assertActive() {
|
|
1237
|
+
if (!this.disposed) return;
|
|
1238
|
+
const e = /* @__PURE__ */ new Error("Assessment controller has been disposed");
|
|
1239
|
+
throw e.name = "AbortError", e;
|
|
1240
|
+
}
|
|
1241
|
+
handleError(e, t, i) {
|
|
1242
|
+
const s = e instanceof Error ? e : new Error(String(e));
|
|
1243
|
+
this.args.hooks?.onError?.(s, {
|
|
1232
1244
|
phase: t,
|
|
1233
|
-
details:
|
|
1245
|
+
details: i
|
|
1234
1246
|
});
|
|
1235
1247
|
}
|
|
1236
1248
|
async getPersistenceStrategy() {
|
|
1237
1249
|
if (this.persistenceStrategy) return this.persistenceStrategy;
|
|
1238
1250
|
const e = { createDefaultPersistence: () => {
|
|
1239
|
-
const t =
|
|
1251
|
+
const t = ne(), i = `pie:assessment-controller:v1:${this.storageContext.assessmentId}:${this.storageContext.attemptId || "default"}`;
|
|
1240
1252
|
return {
|
|
1241
1253
|
async loadSession() {
|
|
1242
1254
|
if (!t) return null;
|
|
1243
|
-
const
|
|
1244
|
-
if (!
|
|
1255
|
+
const s = t.getItem(i);
|
|
1256
|
+
if (!s) return null;
|
|
1245
1257
|
try {
|
|
1246
|
-
return JSON.parse(
|
|
1258
|
+
return JSON.parse(s);
|
|
1247
1259
|
} catch {
|
|
1248
1260
|
return null;
|
|
1249
1261
|
}
|
|
1250
1262
|
},
|
|
1251
|
-
async saveSession(
|
|
1252
|
-
t && t.setItem(
|
|
1263
|
+
async saveSession(s, n) {
|
|
1264
|
+
t && t.setItem(i, JSON.stringify(n));
|
|
1253
1265
|
},
|
|
1254
1266
|
async clearSession() {
|
|
1255
|
-
t && t.removeItem(
|
|
1267
|
+
t && t.removeItem(i);
|
|
1256
1268
|
}
|
|
1257
1269
|
};
|
|
1258
1270
|
} };
|
|
1259
1271
|
return this.persistenceStrategy = await this.args.hooks?.createAssessmentSessionPersistence?.(this.storageContext, e) ?? await e.createDefaultPersistence(), this.persistenceStrategy;
|
|
1260
1272
|
}
|
|
1261
1273
|
async createDeliveryPlan() {
|
|
1262
|
-
const e = { createDefaultDeliveryPlan: () => ({ sections:
|
|
1274
|
+
const e = { createDefaultDeliveryPlan: () => ({ sections: je(this.args.assessment) }) }, t = {
|
|
1263
1275
|
assessmentId: this.args.assessmentId,
|
|
1264
1276
|
attemptId: this.args.attemptId,
|
|
1265
1277
|
assessment: this.args.assessment
|
|
@@ -1269,8 +1281,8 @@ var Ge = class {
|
|
|
1269
1281
|
ensureSession() {
|
|
1270
1282
|
if (this.session) return this.session;
|
|
1271
1283
|
const e = this.deliveryPlan.sections.map((t) => t.sectionIdentifier);
|
|
1272
|
-
return this.session =
|
|
1273
|
-
assessmentAttemptSessionIdentifier:
|
|
1284
|
+
return this.session = re({
|
|
1285
|
+
assessmentAttemptSessionIdentifier: He({
|
|
1274
1286
|
assessmentId: this.args.assessmentId,
|
|
1275
1287
|
attemptId: this.args.attemptId
|
|
1276
1288
|
}),
|
|
@@ -1280,31 +1292,60 @@ var Ge = class {
|
|
|
1280
1292
|
}), this.session;
|
|
1281
1293
|
}
|
|
1282
1294
|
async initialize() {
|
|
1295
|
+
return this.assertActive(), this.initializationPromise ?? (this.initializationPromise = this.initializeOnce());
|
|
1296
|
+
}
|
|
1297
|
+
async initializeOnce() {
|
|
1298
|
+
let e = "delivery-plan-create";
|
|
1283
1299
|
try {
|
|
1284
|
-
this.readiness = "bootstrapping"
|
|
1285
|
-
|
|
1286
|
-
this.
|
|
1300
|
+
this.readiness = "bootstrapping";
|
|
1301
|
+
const t = await this.createDeliveryPlan();
|
|
1302
|
+
this.assertActive(), this.deliveryPlan = t, this.ensureSession(), e = null, await this.hydrate(), this.assertActive(), this.readiness = "ready";
|
|
1303
|
+
} catch (t) {
|
|
1304
|
+
try {
|
|
1305
|
+
this.disposed || (this.readiness = "error", e && this.handleError(t, e));
|
|
1306
|
+
} catch (i) {
|
|
1307
|
+
console.error("Assessment error hook failed", i);
|
|
1308
|
+
}
|
|
1309
|
+
throw t;
|
|
1287
1310
|
}
|
|
1288
1311
|
}
|
|
1289
1312
|
async hydrate() {
|
|
1290
|
-
this.readiness = "hydrating";
|
|
1313
|
+
this.assertActive(), this.readiness = "hydrating";
|
|
1291
1314
|
try {
|
|
1292
|
-
await this.args.hooks?.onBeforeAssessmentHydrate?.(this.storageContext);
|
|
1293
|
-
const e = await
|
|
1294
|
-
|
|
1315
|
+
await this.args.hooks?.onBeforeAssessmentHydrate?.(this.storageContext), this.assertActive();
|
|
1316
|
+
const e = await this.getPersistenceStrategy();
|
|
1317
|
+
this.assertActive();
|
|
1318
|
+
const t = await e.loadSession(this.storageContext);
|
|
1319
|
+
this.assertActive(), t && (this.session = t), this.ensureSession(), this.readiness = "ready", t && this.emit({
|
|
1295
1320
|
type: "assessment-session-applied",
|
|
1296
|
-
timestamp:
|
|
1297
|
-
})
|
|
1321
|
+
timestamp: b()
|
|
1322
|
+
}), this.assertActive();
|
|
1298
1323
|
} catch (e) {
|
|
1299
|
-
|
|
1324
|
+
try {
|
|
1325
|
+
this.disposed || (this.readiness = "error", this.handleError(e, "session-load"));
|
|
1326
|
+
} catch (t) {
|
|
1327
|
+
console.error("Assessment error hook failed", t);
|
|
1328
|
+
}
|
|
1329
|
+
throw e;
|
|
1300
1330
|
}
|
|
1301
1331
|
}
|
|
1332
|
+
dispose() {
|
|
1333
|
+
return this.disposalPromise ? this.disposalPromise : (this.disposed = !0, this.listeners.clear(), this.session = null, this.deliveryPlan = { sections: [] }, this.readiness = "error", this.disposalPromise = Promise.resolve().then(async () => {
|
|
1334
|
+
try {
|
|
1335
|
+
await this.args.hooks?.onAssessmentControllerDispose?.(this);
|
|
1336
|
+
} catch (e) {
|
|
1337
|
+
throw this.handleError(e, "controller-dispose"), e;
|
|
1338
|
+
}
|
|
1339
|
+
}), this.disposalPromise);
|
|
1340
|
+
}
|
|
1302
1341
|
async persist() {
|
|
1342
|
+
this.assertActive();
|
|
1303
1343
|
try {
|
|
1304
1344
|
const e = await this.getPersistenceStrategy();
|
|
1305
|
-
await this.args.hooks?.onBeforeAssessmentPersist?.(this.storageContext, this.session),
|
|
1345
|
+
if (this.disposed || (await this.args.hooks?.onBeforeAssessmentPersist?.(this.storageContext, this.session), this.disposed)) return;
|
|
1346
|
+
await e.saveSession(this.storageContext, this.session);
|
|
1306
1347
|
} catch (e) {
|
|
1307
|
-
this.handleError(e, "session-save");
|
|
1348
|
+
this.disposed || this.handleError(e, "session-save");
|
|
1308
1349
|
}
|
|
1309
1350
|
}
|
|
1310
1351
|
getSession() {
|
|
@@ -1334,36 +1375,37 @@ var Ge = class {
|
|
|
1334
1375
|
};
|
|
1335
1376
|
}
|
|
1336
1377
|
setIndex(e) {
|
|
1378
|
+
if (this.disposed) return !1;
|
|
1337
1379
|
const t = this.buildNavigationSnapshot();
|
|
1338
1380
|
if (e < 0 || e >= t.totalSections) return !1;
|
|
1339
|
-
const
|
|
1340
|
-
this.session =
|
|
1381
|
+
const i = t.currentSectionId, s = this.deliveryPlan.sections[e];
|
|
1382
|
+
this.session = le(this.ensureSession(), {
|
|
1341
1383
|
currentSectionIndex: e,
|
|
1342
|
-
currentSectionIdentifier:
|
|
1384
|
+
currentSectionIdentifier: s?.sectionIdentifier
|
|
1343
1385
|
});
|
|
1344
|
-
const
|
|
1386
|
+
const n = this.buildNavigationSnapshot();
|
|
1345
1387
|
return this.emit({
|
|
1346
1388
|
type: "assessment-route-changed",
|
|
1347
|
-
timestamp:
|
|
1348
|
-
currentSectionIndex:
|
|
1349
|
-
totalSections:
|
|
1350
|
-
currentSectionId:
|
|
1351
|
-
previousSectionId:
|
|
1352
|
-
canNext:
|
|
1353
|
-
canPrevious:
|
|
1354
|
-
}), this.emit({
|
|
1389
|
+
timestamp: b(),
|
|
1390
|
+
currentSectionIndex: n.currentSectionIndex,
|
|
1391
|
+
totalSections: n.totalSections,
|
|
1392
|
+
currentSectionId: n.currentSectionId,
|
|
1393
|
+
previousSectionId: i,
|
|
1394
|
+
canNext: n.canNext,
|
|
1395
|
+
canPrevious: n.canPrevious
|
|
1396
|
+
}), this.disposed || (this.emit({
|
|
1355
1397
|
type: "assessment-session-changed",
|
|
1356
|
-
timestamp:
|
|
1357
|
-
}), this.emit({
|
|
1398
|
+
timestamp: b()
|
|
1399
|
+
}), this.disposed) ? !1 : (this.emit({
|
|
1358
1400
|
type: "assessment-progress-changed",
|
|
1359
|
-
timestamp:
|
|
1401
|
+
timestamp: b(),
|
|
1360
1402
|
visitedSectionCount: this.ensureSession().navigationState.visitedSectionIdentifiers.length,
|
|
1361
|
-
totalSections:
|
|
1362
|
-
}), !0;
|
|
1403
|
+
totalSections: n.totalSections
|
|
1404
|
+
}), !0);
|
|
1363
1405
|
}
|
|
1364
1406
|
navigateTo(e) {
|
|
1365
1407
|
if (typeof e == "number") return this.setIndex(e);
|
|
1366
|
-
const t = this.deliveryPlan.sections.findIndex((
|
|
1408
|
+
const t = this.deliveryPlan.sections.findIndex((i) => i.sectionIdentifier === e);
|
|
1367
1409
|
return t < 0 ? !1 : this.setIndex(t);
|
|
1368
1410
|
}
|
|
1369
1411
|
navigateNext() {
|
|
@@ -1375,14 +1417,15 @@ var Ge = class {
|
|
|
1375
1417
|
return this.setIndex(e.currentSectionIndex - 1);
|
|
1376
1418
|
}
|
|
1377
1419
|
async submit() {
|
|
1378
|
-
this.submitted = !0, this.emit({
|
|
1420
|
+
this.assertActive(), this.submitted = !0, this.emit({
|
|
1379
1421
|
type: "assessment-submission-state-changed",
|
|
1380
|
-
timestamp:
|
|
1422
|
+
timestamp: b(),
|
|
1381
1423
|
submitted: !0
|
|
1382
1424
|
}), await this.persist();
|
|
1383
1425
|
}
|
|
1384
1426
|
subscribe(e) {
|
|
1385
|
-
return this.
|
|
1427
|
+
return this.disposed ? () => {
|
|
1428
|
+
} : (this.listeners.add(e), () => this.listeners.delete(e));
|
|
1386
1429
|
}
|
|
1387
1430
|
getCurrentSection() {
|
|
1388
1431
|
const e = this.buildNavigationSnapshot();
|
|
@@ -1392,18 +1435,18 @@ var Ge = class {
|
|
|
1392
1435
|
return this.deliveryPlan.sections[e] || null;
|
|
1393
1436
|
}
|
|
1394
1437
|
getSectionSession(e) {
|
|
1395
|
-
return this.ensureSession().sectionSessions[e]?.session || null;
|
|
1438
|
+
return this.disposed ? null : this.ensureSession().sectionSessions[e]?.session || null;
|
|
1396
1439
|
}
|
|
1397
1440
|
updateSectionSession(e, t) {
|
|
1398
|
-
this.session =
|
|
1441
|
+
this.disposed || (this.session = ce(this.ensureSession(), {
|
|
1399
1442
|
sectionIdentifier: e,
|
|
1400
1443
|
sectionSession: t
|
|
1401
1444
|
}), this.emit({
|
|
1402
1445
|
type: "assessment-session-changed",
|
|
1403
|
-
timestamp:
|
|
1404
|
-
});
|
|
1446
|
+
timestamp: b()
|
|
1447
|
+
}));
|
|
1405
1448
|
}
|
|
1406
|
-
},
|
|
1449
|
+
}, m = {
|
|
1407
1450
|
controllerReady: "assessment-controller-ready",
|
|
1408
1451
|
navigationRequested: "assessment-navigation-requested",
|
|
1409
1452
|
submitRequested: "assessment-submit-requested",
|
|
@@ -1414,7 +1457,7 @@ var Ge = class {
|
|
|
1414
1457
|
submissionStateChanged: "assessment-submission-state-changed",
|
|
1415
1458
|
error: "assessment-error"
|
|
1416
1459
|
};
|
|
1417
|
-
function
|
|
1460
|
+
function Ye(e, t) {
|
|
1418
1461
|
return !e?.delivery || e.delivery.enabled === !1 || !t || e.delivery.assignmentId !== void 0 ? e : {
|
|
1419
1462
|
...e,
|
|
1420
1463
|
delivery: {
|
|
@@ -1423,20 +1466,23 @@ function $e(e, t) {
|
|
|
1423
1466
|
}
|
|
1424
1467
|
};
|
|
1425
1468
|
}
|
|
1426
|
-
function
|
|
1427
|
-
const { sectionPlayerRuntime: t, playerType:
|
|
1469
|
+
function We(e) {
|
|
1470
|
+
const { sectionPlayerRuntime: t, playerType: i, attemptId: s, env: n, coordinator: o } = e, r = t?.player && typeof t.player == "object" ? {
|
|
1428
1471
|
...t.player,
|
|
1429
|
-
backend:
|
|
1472
|
+
backend: Ye(t.player.backend ? S(t.player.backend) : void 0, s)
|
|
1430
1473
|
} : t?.player;
|
|
1431
1474
|
return {
|
|
1432
|
-
playerType:
|
|
1433
|
-
...
|
|
1475
|
+
playerType: i,
|
|
1476
|
+
...n ? { env: n } : {},
|
|
1434
1477
|
...o ? { coordinator: o } : {},
|
|
1435
1478
|
...t || {},
|
|
1436
1479
|
...r !== void 0 ? { player: r } : {}
|
|
1437
1480
|
};
|
|
1438
1481
|
}
|
|
1439
|
-
var
|
|
1482
|
+
var Qe = "pie-section-player-splitpane", Je = "pie-section-player-vertical", Ke = class extends HTMLElement {
|
|
1483
|
+
constructor(...e) {
|
|
1484
|
+
super(...e), 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.initializingController = null, this.generation = 0, this.reconcileQueued = !1, this.controllerWaiters = /* @__PURE__ */ new Set(), this.i18n = $e(), this.sectionHost = null, this.sectionControllerRef = null, this.sectionSessionReady = !1, this.containerRef = null, this.announcer = null, this.restoreFocusOnRender = !1, this._sectionPlayerRuntime = null, this.readiness = { phase: "bootstrapping" };
|
|
1485
|
+
}
|
|
1440
1486
|
static get observedAttributes() {
|
|
1441
1487
|
return [
|
|
1442
1488
|
"assessment-id",
|
|
@@ -1448,17 +1494,72 @@ var qe = "pie-section-player-splitpane", je = "pie-section-player-vertical", Ve
|
|
|
1448
1494
|
"locale"
|
|
1449
1495
|
];
|
|
1450
1496
|
}
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1497
|
+
get assessmentId() {
|
|
1498
|
+
return this._assessmentId;
|
|
1499
|
+
}
|
|
1500
|
+
set assessmentId(e) {
|
|
1501
|
+
this._assessmentId !== e && (this._assessmentId = e, this.queueReconciliation());
|
|
1502
|
+
}
|
|
1503
|
+
get attemptId() {
|
|
1504
|
+
return this._attemptId;
|
|
1505
|
+
}
|
|
1506
|
+
set attemptId(e) {
|
|
1507
|
+
this._attemptId !== e && (this._attemptId = e, this.queueReconciliation());
|
|
1508
|
+
}
|
|
1509
|
+
get assessment() {
|
|
1510
|
+
return this._assessment;
|
|
1511
|
+
}
|
|
1512
|
+
set assessment(e) {
|
|
1513
|
+
this._assessment !== e && (this._assessment = e, this.queueReconciliation());
|
|
1514
|
+
}
|
|
1515
|
+
get hooks() {
|
|
1516
|
+
return this._hooks;
|
|
1517
|
+
}
|
|
1518
|
+
set hooks(e) {
|
|
1519
|
+
this._hooks !== e && (this._hooks = e, this.queueReconciliation());
|
|
1520
|
+
}
|
|
1521
|
+
get locale() {
|
|
1522
|
+
return this._locale;
|
|
1523
|
+
}
|
|
1524
|
+
set locale(e) {
|
|
1525
|
+
this._locale !== e && (this._locale = e, this.isConnected && this.applyLocale());
|
|
1526
|
+
}
|
|
1527
|
+
get env() {
|
|
1528
|
+
return this._env;
|
|
1529
|
+
}
|
|
1530
|
+
set env(e) {
|
|
1531
|
+
this._env = e, this.isConnected && this.updateCurrentSectionRuntime();
|
|
1532
|
+
}
|
|
1533
|
+
get coordinator() {
|
|
1534
|
+
return this._coordinator;
|
|
1535
|
+
}
|
|
1536
|
+
set coordinator(e) {
|
|
1537
|
+
this._coordinator = e, this.isConnected && this.updateCurrentSectionRuntime();
|
|
1455
1538
|
}
|
|
1456
|
-
|
|
1457
|
-
|
|
1539
|
+
get showNavigation() {
|
|
1540
|
+
return this._showNavigation;
|
|
1541
|
+
}
|
|
1542
|
+
set showNavigation(e) {
|
|
1543
|
+
this._showNavigation = e, this.isConnected && this.updateNavigationChrome();
|
|
1544
|
+
}
|
|
1545
|
+
get sectionPlayerLayout() {
|
|
1546
|
+
return this._sectionPlayerLayout;
|
|
1547
|
+
}
|
|
1548
|
+
set sectionPlayerLayout(e) {
|
|
1549
|
+
this._sectionPlayerLayout !== e && (this._sectionPlayerLayout = e, this.isConnected && this.controller && this.render());
|
|
1550
|
+
}
|
|
1551
|
+
get playerType() {
|
|
1552
|
+
return this._playerType;
|
|
1553
|
+
}
|
|
1554
|
+
set playerType(e) {
|
|
1555
|
+
this._playerType = e, this.isConnected && this.updateCurrentSectionRuntime();
|
|
1556
|
+
}
|
|
1557
|
+
attributeChangedCallback(e, t, i) {
|
|
1558
|
+
t !== i && (e === "assessment-id" && (this.assessmentId = i || ""), e === "attempt-id" && (this.attemptId = i || ""), e === "show-navigation" && (this.showNavigation = i), e === "section-player-layout" && (this.sectionPlayerLayout = i === "vertical" ? "vertical" : "splitpane"), e === "player-type" && (this.playerType = i || "iife"), e === "debug" && (this.debug = i), e === "locale" && (this.locale = i || ""));
|
|
1458
1559
|
}
|
|
1459
1560
|
applyLocale() {
|
|
1460
1561
|
this.unsubscribeI18n || (this.unsubscribeI18n = this.i18n.subscribe?.(() => {
|
|
1461
|
-
this.isConnected && this.
|
|
1562
|
+
this.isConnected && this.updateNavigationChrome();
|
|
1462
1563
|
})), this.i18n.setLocale(this.locale || "en-US"), this.forwardLocaleToSection();
|
|
1463
1564
|
}
|
|
1464
1565
|
forwardLocaleToSection() {
|
|
@@ -1482,52 +1583,101 @@ var qe = "pie-section-player-splitpane", je = "pie-section-player-vertical", Ve
|
|
|
1482
1583
|
const e = this.getAttribute("section-player-layout");
|
|
1483
1584
|
this.sectionPlayerLayout = e === "vertical" ? "vertical" : this.sectionPlayerLayout;
|
|
1484
1585
|
const t = this.getAttribute("player-type");
|
|
1485
|
-
t && (this.playerType = t), this.debug = this.getAttribute("debug") ?? this.debug, this.locale || (this.locale = this.getAttribute("locale") || ""), this.applyLocale(), this.attachInstrumentationBridge(), this.
|
|
1586
|
+
t && (this.playerType = t), this.debug = this.getAttribute("debug") ?? this.debug, this.locale || (this.locale = this.getAttribute("locale") || ""), this.applyLocale(), this.attachInstrumentationBridge(), this.queueReconciliation();
|
|
1486
1587
|
}
|
|
1487
1588
|
disconnectedCallback() {
|
|
1488
|
-
this.
|
|
1589
|
+
this.reconcileQueued = !1, this.retireController(), this.restoreFocusOnRender = !1, this.settleControllerWaiters(null), this.unsubscribeI18n?.(), this.unsubscribeI18n = void 0, this.detachInstrumentationBridge?.(), this.detachInstrumentationBridge = void 0;
|
|
1590
|
+
}
|
|
1591
|
+
settleControllerWaiters(e) {
|
|
1592
|
+
for (const t of this.controllerWaiters) t(e);
|
|
1593
|
+
}
|
|
1594
|
+
retireController() {
|
|
1595
|
+
this.restoreFocusOnRender || (this.restoreFocusOnRender = this.contains(document.activeElement)), this.generation += 1, this.detachSectionListeners?.(), this.detachSectionListeners = void 0;
|
|
1596
|
+
const e = this.controller || this.initializingController;
|
|
1597
|
+
this.controller = null, this.initializingController = null, this.unsubscribeController?.(), this.unsubscribeController = void 0, this.sectionControllerRef = null, this.sectionSessionReady = !1, this.sectionHost = null, this.containerRef?.remove(), this.containerRef = null, this.readiness = { phase: "bootstrapping" }, e && (this.settleControllerWaiters(null), e.dispose().catch((t) => {
|
|
1598
|
+
console.error("Assessment controller disposal failed", t);
|
|
1599
|
+
}));
|
|
1600
|
+
}
|
|
1601
|
+
queueReconciliation() {
|
|
1602
|
+
this.isConnected && ((this.controller || this.initializingController) && this.retireController(), this.readiness = { phase: "bootstrapping" }, !this.reconcileQueued && (this.reconcileQueued = !0, queueMicrotask(() => {
|
|
1603
|
+
this.reconcileQueued && (this.reconcileQueued = !1, this.isConnected && this.bootstrapController());
|
|
1604
|
+
})));
|
|
1489
1605
|
}
|
|
1490
|
-
dispatch(e, t,
|
|
1606
|
+
dispatch(e, t, i = !1) {
|
|
1491
1607
|
return this.dispatchEvent(new CustomEvent(e, {
|
|
1492
1608
|
detail: t,
|
|
1493
1609
|
bubbles: !0,
|
|
1494
1610
|
composed: !0,
|
|
1495
|
-
cancelable:
|
|
1611
|
+
cancelable: i
|
|
1496
1612
|
}));
|
|
1497
1613
|
}
|
|
1498
1614
|
async bootstrapController() {
|
|
1499
1615
|
if (!this.assessmentId || !this.assessment) {
|
|
1500
|
-
this.renderEmptyState(
|
|
1616
|
+
this.renderEmptyState();
|
|
1501
1617
|
return;
|
|
1502
1618
|
}
|
|
1503
|
-
this.readiness = { phase: "bootstrapping" }, this.
|
|
1504
|
-
const e = new
|
|
1619
|
+
this.readiness = { phase: "bootstrapping" }, this.renderEmptyState();
|
|
1620
|
+
const e = this.generation, t = this.hooks, i = () => this.isConnected && this.generation === e, s = new Ve({
|
|
1505
1621
|
assessmentId: this.assessmentId,
|
|
1506
1622
|
attemptId: this.attemptId || void 0,
|
|
1507
1623
|
assessment: this.assessment,
|
|
1508
|
-
hooks:
|
|
1624
|
+
hooks: {
|
|
1625
|
+
...t,
|
|
1626
|
+
onError: (n, o) => {
|
|
1627
|
+
if (i())
|
|
1628
|
+
try {
|
|
1629
|
+
t?.onError?.(n, o);
|
|
1630
|
+
} finally {
|
|
1631
|
+
i() && o.phase === "session-load" && this.controller === s && (this.retireController(), this.readiness = { phase: "error" }, this.renderEmptyState(), this.dispatch(m.error, { error: n }));
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
}
|
|
1509
1635
|
});
|
|
1510
|
-
this.
|
|
1511
|
-
|
|
1636
|
+
this.initializingController = s, this.unsubscribeController = s.subscribe((n) => {
|
|
1637
|
+
if (i()) {
|
|
1638
|
+
if (n.type === "assessment-route-changed") {
|
|
1639
|
+
if (this.syncCurrentSectionSessionIntoAssessment(), !i() || (this.cleanupTtsForSectionNavigation(n), !i()) || (this.dispatch(m.routeChanged, n), !i())) return;
|
|
1640
|
+
this.restoreFocusOnRender = !0, this.render(!1);
|
|
1641
|
+
}
|
|
1642
|
+
n.type === "assessment-session-applied" && this.dispatch(m.sessionApplied, n), n.type === "assessment-session-changed" && this.dispatch(m.sessionChanged, n), n.type === "assessment-progress-changed" && this.dispatch(m.progressChanged, n), n.type === "assessment-submission-state-changed" && this.dispatch(m.submissionStateChanged, n);
|
|
1643
|
+
}
|
|
1512
1644
|
});
|
|
1513
1645
|
try {
|
|
1514
|
-
await
|
|
1515
|
-
|
|
1516
|
-
|
|
1646
|
+
if (await s.initialize(), !i()) return;
|
|
1647
|
+
this.initializingController = null, this.controller = s, this.readiness = { phase: "ready" }, this.render(), this.settleControllerWaiters(s);
|
|
1648
|
+
const n = (o) => {
|
|
1649
|
+
if (i()) {
|
|
1650
|
+
try {
|
|
1651
|
+
t?.onError?.(o instanceof Error ? o : new Error(String(o)), { phase: "controller-init" });
|
|
1652
|
+
} catch (r) {
|
|
1653
|
+
console.error("Assessment error hook failed", r);
|
|
1654
|
+
}
|
|
1655
|
+
i() && this.dispatch(m.error, { error: o });
|
|
1656
|
+
}
|
|
1657
|
+
};
|
|
1658
|
+
try {
|
|
1659
|
+
Promise.resolve(t?.onAssessmentControllerReady?.(s)).catch(n);
|
|
1660
|
+
} catch (o) {
|
|
1661
|
+
n(o);
|
|
1662
|
+
}
|
|
1663
|
+
i() && this.dispatch(m.controllerReady, { controller: s });
|
|
1664
|
+
} catch (n) {
|
|
1665
|
+
if (!i()) return;
|
|
1666
|
+
this.retireController(), this.readiness = { phase: "error" }, this.renderEmptyState(), this.dispatch(m.error, { error: n });
|
|
1517
1667
|
}
|
|
1518
1668
|
}
|
|
1519
1669
|
resolveInstrumentationProvider() {
|
|
1520
|
-
return
|
|
1670
|
+
return Ne({
|
|
1521
1671
|
runtimePlayer: this.sectionPlayerRuntime?.player,
|
|
1522
1672
|
component: "pie-assessment-player-default"
|
|
1523
1673
|
});
|
|
1524
1674
|
}
|
|
1525
1675
|
attachInstrumentationBridge() {
|
|
1526
|
-
this.detachInstrumentationBridge?.(), this.detachInstrumentationBridge =
|
|
1676
|
+
this.detachInstrumentationBridge?.(), this.detachInstrumentationBridge = Pe({
|
|
1527
1677
|
host: this,
|
|
1528
1678
|
instrumentationProvider: this.resolveInstrumentationProvider(),
|
|
1529
1679
|
component: "pie-assessment-player-default",
|
|
1530
|
-
eventMap:
|
|
1680
|
+
eventMap: xe,
|
|
1531
1681
|
staticAttributes: {
|
|
1532
1682
|
instrumentationLayer: "assessment",
|
|
1533
1683
|
assessmentId: this.assessmentId,
|
|
@@ -1535,25 +1685,58 @@ var qe = "pie-section-player-splitpane", je = "pie-section-player-vertical", Ve
|
|
|
1535
1685
|
}
|
|
1536
1686
|
});
|
|
1537
1687
|
}
|
|
1538
|
-
renderEmptyState(
|
|
1539
|
-
|
|
1540
|
-
|
|
1688
|
+
renderEmptyState() {
|
|
1689
|
+
if (!this.isConnected) return;
|
|
1690
|
+
const e = this.restoreFocusOnRender || this.contains(document.activeElement), t = this.readiness.phase === "error", i = this.createStatusContent(t ? "player.assessment.loadFailed" : "common.loading", t ? () => this.queueReconciliation() : void 0);
|
|
1691
|
+
this.swapContent(i), e && i.focus();
|
|
1692
|
+
}
|
|
1693
|
+
createStatusContent(e, t) {
|
|
1694
|
+
const i = document.createElement("div");
|
|
1695
|
+
i.className = "pie-assessment-player-empty", i.tabIndex = -1;
|
|
1696
|
+
const s = document.createElement("style");
|
|
1697
|
+
s.textContent = `
|
|
1698
|
+
.pie-assessment-player-empty { display: grid; justify-items: start; gap: 0.75rem; padding: 1rem; }
|
|
1699
|
+
.pie-assessment-player-status-message { margin: 0; }
|
|
1700
|
+
.pie-assessment-player-retry {
|
|
1701
|
+
font: inherit; min-height: 2rem; padding: 0.5rem 0.75rem;
|
|
1702
|
+
border: 1px solid var(--pie-button-border, var(--pie-border, #8f8f8f));
|
|
1703
|
+
border-radius: 4px;
|
|
1704
|
+
background: var(--pie-button-bg, var(--pie-white, #fff));
|
|
1705
|
+
color: var(--pie-button-color, var(--pie-text, #374151));
|
|
1706
|
+
cursor: pointer;
|
|
1707
|
+
}
|
|
1708
|
+
.pie-assessment-player-retry:hover {
|
|
1709
|
+
background: var(--pie-button-hover-bg, var(--pie-background-dark, #f9fafb));
|
|
1710
|
+
border-color: var(--pie-button-hover-border, var(--pie-border, #8b919c));
|
|
1711
|
+
color: var(--pie-button-hover-color, var(--pie-text, #111827));
|
|
1712
|
+
}
|
|
1713
|
+
.pie-assessment-player-retry:focus-visible {
|
|
1714
|
+
outline: 2px solid var(--pie-button-focus-outline, var(--pie-primary, #0066cc));
|
|
1715
|
+
outline-offset: 2px;
|
|
1716
|
+
}
|
|
1717
|
+
`, i.appendChild(s);
|
|
1718
|
+
const n = document.createElement("p");
|
|
1719
|
+
if (n.className = "pie-assessment-player-status-message", n.setAttribute("role", t ? "alert" : "status"), n.dataset.pieMessageKey = e, n.textContent = this.i18n.t(e), i.appendChild(n), t) {
|
|
1720
|
+
const o = document.createElement("button");
|
|
1721
|
+
o.type = "button", o.className = "pie-assessment-player-retry", o.textContent = this.i18n.t("common.retry"), o.addEventListener("click", t), i.appendChild(o);
|
|
1722
|
+
}
|
|
1723
|
+
return i;
|
|
1541
1724
|
}
|
|
1542
1725
|
swapContent(e) {
|
|
1543
1726
|
this.containerRef?.remove(), this.containerRef = e, this.appendChild(e);
|
|
1544
1727
|
}
|
|
1545
1728
|
ensureAnnouncer() {
|
|
1546
|
-
if (this.announcer?.
|
|
1729
|
+
if (this.announcer?.parentNode === this) return this.announcer;
|
|
1547
1730
|
const e = document.createElement("div");
|
|
1548
1731
|
return e.className = "pie-assessment-player-announcer", e.setAttribute("role", "status"), e.setAttribute("aria-live", "polite"), e.setAttribute("aria-atomic", "true"), e.style.cssText = "position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;", this.announcer = e, this.appendChild(e), e;
|
|
1549
1732
|
}
|
|
1550
1733
|
captureFocusIntent() {
|
|
1551
1734
|
if (typeof document > "u") return null;
|
|
1552
1735
|
const e = document.activeElement;
|
|
1553
|
-
return !e || !this.contains(e) ? null : e.classList?.contains("pie-assessment-player-nav-btn") ? e.
|
|
1736
|
+
return !e || !this.contains(e) ? null : e.classList?.contains("pie-assessment-player-nav-btn") ? e.getAttribute("data-pie-navigation") === "previous" ? "previous" : "next" : "section";
|
|
1554
1737
|
}
|
|
1555
1738
|
applyFocusIntent(e, t) {
|
|
1556
|
-
const
|
|
1739
|
+
const i = e === "section" ? [this.sectionHost] : e === "next" ? [
|
|
1557
1740
|
t.next,
|
|
1558
1741
|
t.previous,
|
|
1559
1742
|
this.sectionHost
|
|
@@ -1562,15 +1745,15 @@ var qe = "pie-section-player-splitpane", je = "pie-section-player-vertical", Ve
|
|
|
1562
1745
|
t.next,
|
|
1563
1746
|
this.sectionHost
|
|
1564
1747
|
];
|
|
1565
|
-
for (const
|
|
1566
|
-
if (
|
|
1748
|
+
for (const s of i)
|
|
1749
|
+
if (s && !(s instanceof HTMLButtonElement && s.disabled) && (s.focus(), document.activeElement === s))
|
|
1567
1750
|
return;
|
|
1568
1751
|
}
|
|
1569
1752
|
buildSectionPlayerTag() {
|
|
1570
|
-
return this.sectionPlayerLayout === "vertical" ?
|
|
1753
|
+
return this.sectionPlayerLayout === "vertical" ? Je : Qe;
|
|
1571
1754
|
}
|
|
1572
1755
|
buildSectionRuntime() {
|
|
1573
|
-
return
|
|
1756
|
+
return We({
|
|
1574
1757
|
sectionPlayerRuntime: this.sectionPlayerRuntime,
|
|
1575
1758
|
playerType: this.playerType,
|
|
1576
1759
|
attemptId: this.attemptId || void 0,
|
|
@@ -1584,55 +1767,95 @@ var qe = "pie-section-player-splitpane", je = "pie-section-player-vertical", Ve
|
|
|
1584
1767
|
}
|
|
1585
1768
|
cleanupTtsForSectionNavigation(e) {
|
|
1586
1769
|
if (e.currentSectionId && e.previousSectionId && e.currentSectionId === e.previousSectionId) return;
|
|
1587
|
-
const t = this.coordinator,
|
|
1588
|
-
if (!
|
|
1589
|
-
const
|
|
1590
|
-
t?.reportFrameworkError?.(
|
|
1770
|
+
const t = this.coordinator, i = t?.ttsService;
|
|
1771
|
+
if (!i) return;
|
|
1772
|
+
const s = (n) => {
|
|
1773
|
+
t?.reportFrameworkError?.(ae({
|
|
1591
1774
|
kind: "tts-init",
|
|
1592
1775
|
source: "AssessmentPlayerDefaultElement.cleanupTtsForSectionNavigation",
|
|
1593
|
-
error:
|
|
1776
|
+
error: n,
|
|
1594
1777
|
recoverable: !0
|
|
1595
1778
|
}));
|
|
1596
1779
|
};
|
|
1597
1780
|
try {
|
|
1598
|
-
|
|
1599
|
-
} catch (
|
|
1600
|
-
|
|
1781
|
+
i.stop?.();
|
|
1782
|
+
} catch (n) {
|
|
1783
|
+
s(n);
|
|
1601
1784
|
}
|
|
1602
1785
|
try {
|
|
1603
|
-
|
|
1604
|
-
} catch (
|
|
1605
|
-
|
|
1786
|
+
i.requestControlHandoff?.();
|
|
1787
|
+
} catch (n) {
|
|
1788
|
+
s(n);
|
|
1606
1789
|
}
|
|
1607
1790
|
}
|
|
1608
1791
|
syncCurrentSectionSessionIntoAssessment() {
|
|
1609
1792
|
const e = this.controller;
|
|
1610
|
-
if (!e) return;
|
|
1611
|
-
const t = this.
|
|
1793
|
+
if (!e || !this.sectionSessionReady) return;
|
|
1794
|
+
const t = this.sectionControllerRef;
|
|
1612
1795
|
if (!t?.getSession) return;
|
|
1613
|
-
const
|
|
1614
|
-
|
|
1796
|
+
const i = this.sectionHost?.firstElementChild?.getAttribute("section-id");
|
|
1797
|
+
i && e.updateSectionSession(i, S(t.getSession()));
|
|
1615
1798
|
}
|
|
1616
1799
|
attachSectionControllerReadyListener(e, t) {
|
|
1617
|
-
const n =
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
}
|
|
1625
|
-
|
|
1800
|
+
const i = e, s = this.generation, n = this.sectionHost, o = this.controller, r = S(o.getSectionSession(t)), l = () => this.isConnected && this.generation === s && this.sectionHost === n && this.controller === o;
|
|
1801
|
+
n.setAttribute("aria-busy", "true"), i.inert = !0;
|
|
1802
|
+
let p;
|
|
1803
|
+
new Promise((d) => {
|
|
1804
|
+
let g = !1;
|
|
1805
|
+
const h = (E) => {
|
|
1806
|
+
g || (g = !0, clearTimeout(f), i.removeEventListener(x.stageChange, c), d(E));
|
|
1807
|
+
}, c = (E) => {
|
|
1808
|
+
if (E.target !== i) return;
|
|
1809
|
+
const { stage: N, status: oe } = E.detail;
|
|
1810
|
+
oe === "failed" || N === "disposed" ? h(null) : N === "engine-ready" && h(i.getSectionController?.() || null);
|
|
1811
|
+
}, f = setTimeout(() => h(null), 5e3);
|
|
1812
|
+
i.addEventListener(x.stageChange, c), p = () => h(null);
|
|
1813
|
+
}).then(async (d) => {
|
|
1814
|
+
if (l()) {
|
|
1815
|
+
if (!d) throw new Error("Section controller did not become ready");
|
|
1816
|
+
if (r) {
|
|
1817
|
+
if (!d.applySession) throw new Error("Section controller cannot restore its saved session");
|
|
1818
|
+
await d.applySession(r, { mode: "replace" });
|
|
1819
|
+
}
|
|
1820
|
+
l() && (this.sectionControllerRef = d, this.sectionSessionReady = !0, i.inert = !1, n.setAttribute("aria-busy", "false"));
|
|
1821
|
+
}
|
|
1822
|
+
}).catch((d) => {
|
|
1823
|
+
if (!l()) return;
|
|
1824
|
+
this.detachSectionListeners?.(), this.detachSectionListeners = void 0, this.sectionControllerRef = null, this.sectionSessionReady = !1;
|
|
1825
|
+
const g = n.contains(document.activeElement), h = this.createStatusContent(r ? "player.assessment.restoreFailed" : "player.assessment.loadFailed", () => {
|
|
1826
|
+
this.restoreFocusOnRender = this.contains(document.activeElement), this.render();
|
|
1827
|
+
});
|
|
1828
|
+
n.replaceChildren(h), n.setAttribute("aria-busy", "false"), g && h.focus();
|
|
1829
|
+
try {
|
|
1830
|
+
this.hooks?.onError?.(d instanceof Error ? d : new Error(String(d)), {
|
|
1831
|
+
phase: "navigation",
|
|
1832
|
+
details: { sectionIdentifier: t }
|
|
1833
|
+
});
|
|
1834
|
+
} catch (c) {
|
|
1835
|
+
console.error("Assessment error hook failed", c);
|
|
1836
|
+
}
|
|
1837
|
+
l() && this.dispatch(m.error, { error: d });
|
|
1838
|
+
});
|
|
1839
|
+
const u = () => {
|
|
1840
|
+
l() && this.syncCurrentSectionSessionIntoAssessment();
|
|
1841
|
+
};
|
|
1842
|
+
e.addEventListener("session-changed", u), e.addEventListener("item-session-changed", u), this.detachSectionListeners = () => {
|
|
1843
|
+
p(), e.removeEventListener("session-changed", u), e.removeEventListener("item-session-changed", u);
|
|
1844
|
+
};
|
|
1626
1845
|
}
|
|
1627
|
-
render() {
|
|
1628
|
-
|
|
1846
|
+
render(e = !0) {
|
|
1847
|
+
if (!this.isConnected || !this.controller) return;
|
|
1848
|
+
const t = this.generation;
|
|
1849
|
+
if (e && this.syncCurrentSectionSessionIntoAssessment(), !this.isConnected || !this.controller || this.generation !== t) return;
|
|
1850
|
+
this.detachSectionListeners?.(), this.detachSectionListeners = void 0;
|
|
1851
|
+
const i = this.controller;
|
|
1629
1852
|
this.attachInstrumentationBridge();
|
|
1630
|
-
const
|
|
1631
|
-
this.restoreFocusOnRender = !1, this.ensureAnnouncer(), this.sectionControllerRef = null;
|
|
1853
|
+
const s = this.restoreFocusOnRender || this.containerRef?.classList.contains("pie-assessment-player-empty") ? this.captureFocusIntent() : null;
|
|
1854
|
+
this.restoreFocusOnRender = !1, this.ensureAnnouncer(), this.sectionControllerRef = null, this.sectionSessionReady = !1;
|
|
1632
1855
|
const n = document.createElement("div");
|
|
1633
1856
|
n.className = "pie-assessment-player-default";
|
|
1634
|
-
const
|
|
1635
|
-
|
|
1857
|
+
const o = document.createElement("style");
|
|
1858
|
+
o.textContent = `
|
|
1636
1859
|
:host {
|
|
1637
1860
|
display: block;
|
|
1638
1861
|
height: 100%;
|
|
@@ -1655,6 +1878,7 @@ var qe = "pie-section-player-splitpane", je = "pie-section-player-vertical", Ve
|
|
|
1655
1878
|
border-radius: 0.375rem;
|
|
1656
1879
|
background: var(--pie-background-light, var(--pie-background, #fff));
|
|
1657
1880
|
}
|
|
1881
|
+
.pie-assessment-player-navigation[hidden] { display: none; }
|
|
1658
1882
|
.pie-assessment-player-current-position {
|
|
1659
1883
|
font-size: 0.9rem;
|
|
1660
1884
|
font-weight: 600;
|
|
@@ -1679,39 +1903,54 @@ var qe = "pie-section-player-splitpane", je = "pie-section-player-vertical", Ve
|
|
|
1679
1903
|
height: 100%;
|
|
1680
1904
|
overflow: hidden;
|
|
1681
1905
|
}
|
|
1682
|
-
`, n.appendChild(
|
|
1683
|
-
const
|
|
1684
|
-
position:
|
|
1685
|
-
total:
|
|
1906
|
+
`, n.appendChild(o);
|
|
1907
|
+
const r = this.getSnapshot(), l = r.navigation.totalSections > 0 ? this.i18n.t("player.assessment.sectionPosition", {
|
|
1908
|
+
position: r.navigation.currentIndex + 1,
|
|
1909
|
+
total: r.navigation.totalSections
|
|
1686
1910
|
}) : this.i18n.t("player.assessment.noSections");
|
|
1687
|
-
let
|
|
1688
|
-
|
|
1689
|
-
const
|
|
1690
|
-
|
|
1911
|
+
let p = null, u = null;
|
|
1912
|
+
{
|
|
1913
|
+
const h = document.createElement("div");
|
|
1914
|
+
h.className = "pie-assessment-player-navigation", h.hidden = !L(this.showNavigation, !0);
|
|
1691
1915
|
const c = document.createElement("div");
|
|
1692
|
-
c.className = "pie-assessment-player-current-position", c.textContent =
|
|
1693
|
-
const
|
|
1694
|
-
|
|
1916
|
+
c.className = "pie-assessment-player-current-position", c.textContent = l;
|
|
1917
|
+
const f = document.createElement("div");
|
|
1918
|
+
f.className = "pie-assessment-player-nav-controls", p = document.createElement("button"), p.type = "button", p.className = "pie-assessment-player-nav-btn", p.setAttribute("data-pie-navigation", "previous"), p.textContent = this.i18n.t("common.back"), p.disabled = !r.navigation.canPrevious, p.addEventListener("click", () => {
|
|
1695
1919
|
this.navigatePrevious();
|
|
1696
|
-
}),
|
|
1920
|
+
}), u = document.createElement("button"), u.type = "button", u.className = "pie-assessment-player-nav-btn", u.setAttribute("data-pie-navigation", "next"), u.textContent = this.i18n.t("common.next"), u.disabled = !r.navigation.canNext, u.addEventListener("click", () => {
|
|
1697
1921
|
this.navigateNext();
|
|
1698
|
-
}),
|
|
1922
|
+
}), f.appendChild(p), f.appendChild(u), h.appendChild(c), h.appendChild(f), n.appendChild(h);
|
|
1699
1923
|
}
|
|
1700
1924
|
const d = document.createElement("div");
|
|
1701
|
-
d.className = "pie-assessment-player-section-host", d.setAttribute("role", "region"), d.setAttribute("aria-label",
|
|
1702
|
-
const
|
|
1703
|
-
if (
|
|
1704
|
-
const
|
|
1705
|
-
if (c.setAttribute("assessment-id", this.assessmentId), c.setAttribute("section-id",
|
|
1706
|
-
const
|
|
1707
|
-
c.setAttribute("debug",
|
|
1925
|
+
d.className = "pie-assessment-player-section-host", d.setAttribute("role", "region"), d.setAttribute("aria-label", l), d.tabIndex = -1, this.sectionHost = d;
|
|
1926
|
+
const g = i?.getCurrentSection() || null;
|
|
1927
|
+
if (g) {
|
|
1928
|
+
const h = this.buildSectionPlayerTag(), c = document.createElement(h);
|
|
1929
|
+
if (c.setAttribute("assessment-id", this.assessmentId), c.setAttribute("section-id", g.sectionIdentifier), this.attemptId && c.setAttribute("attempt-id", this.attemptId), this.locale && c.setAttribute("locale", this.locale), this.debug !== void 0 && this.debug !== null) {
|
|
1930
|
+
const f = typeof this.debug == "boolean" ? String(this.debug) : this.debug;
|
|
1931
|
+
c.setAttribute("debug", f);
|
|
1708
1932
|
}
|
|
1709
|
-
c.section =
|
|
1933
|
+
c.section = g.section, c.runtime = this.buildSectionRuntime(), c.hooks = { cardTitleFormatter: this.hooks?.cardTitleFormatter }, d.appendChild(c), this.attachSectionControllerReadyListener(c, g.sectionIdentifier);
|
|
1710
1934
|
}
|
|
1711
|
-
n.appendChild(d), this.swapContent(n),
|
|
1712
|
-
previous:
|
|
1713
|
-
next:
|
|
1714
|
-
}), this.announceSectionChange(
|
|
1935
|
+
n.appendChild(d), this.swapContent(n), s && (this.applyFocusIntent(s, {
|
|
1936
|
+
previous: p,
|
|
1937
|
+
next: u
|
|
1938
|
+
}), this.announceSectionChange(l));
|
|
1939
|
+
}
|
|
1940
|
+
updateNavigationChrome() {
|
|
1941
|
+
const e = this.selectNavigation(), t = e.totalSections > 0 ? this.i18n.t("player.assessment.sectionPosition", {
|
|
1942
|
+
position: e.currentIndex + 1,
|
|
1943
|
+
total: e.totalSections
|
|
1944
|
+
}) : this.i18n.t("player.assessment.noSections"), i = this.containerRef?.querySelector(".pie-assessment-player-navigation");
|
|
1945
|
+
i && (i.hidden = !L(this.showNavigation, !0), i.hidden && i.contains(document.activeElement) && this.sectionHost?.focus());
|
|
1946
|
+
const s = this.containerRef?.querySelector(".pie-assessment-player-current-position");
|
|
1947
|
+
s && (s.textContent = t);
|
|
1948
|
+
const n = i?.querySelector('[data-pie-navigation="previous"]'), o = i?.querySelector('[data-pie-navigation="next"]');
|
|
1949
|
+
n && (n.textContent = this.i18n.t("common.back")), o && (o.textContent = this.i18n.t("common.next")), this.sectionHost?.setAttribute("aria-label", t);
|
|
1950
|
+
const r = this.containerRef?.querySelector(".pie-assessment-player-status-message");
|
|
1951
|
+
r instanceof HTMLElement && r.dataset.pieMessageKey && (r.textContent = this.i18n.t(r.dataset.pieMessageKey));
|
|
1952
|
+
const l = this.containerRef?.querySelector(".pie-assessment-player-retry");
|
|
1953
|
+
l && (l.textContent = this.i18n.t("common.retry")), this.forwardLocaleToSection();
|
|
1715
1954
|
}
|
|
1716
1955
|
announceSectionChange(e) {
|
|
1717
1956
|
const t = this.ensureAnnouncer();
|
|
@@ -1727,7 +1966,7 @@ var qe = "pie-section-player-splitpane", je = "pie-section-player-vertical", Ve
|
|
|
1727
1966
|
}
|
|
1728
1967
|
getSnapshot() {
|
|
1729
1968
|
const e = this.controller?.getRuntimeState() || {
|
|
1730
|
-
readiness: this.readiness.phase,
|
|
1969
|
+
readiness: this.initializingController?.getRuntimeState().readiness === "hydrating" ? "hydrating" : this.readiness.phase,
|
|
1731
1970
|
currentSectionIndex: 0,
|
|
1732
1971
|
totalSections: 0,
|
|
1733
1972
|
currentSectionId: void 0,
|
|
@@ -1761,61 +2000,60 @@ var qe = "pie-section-player-splitpane", je = "pie-section-player-vertical", Ve
|
|
|
1761
2000
|
return this.getSnapshot().progress;
|
|
1762
2001
|
}
|
|
1763
2002
|
navigateTo(e) {
|
|
1764
|
-
const t = this.selectNavigation(),
|
|
1765
|
-
let
|
|
2003
|
+
const t = this.selectNavigation(), i = t.currentIndex, s = t.currentSectionId;
|
|
2004
|
+
let n = i, o;
|
|
1766
2005
|
if (typeof e == "number")
|
|
1767
|
-
|
|
2006
|
+
n = e, o = this.controller?.getSectionAt(n)?.sectionIdentifier;
|
|
1768
2007
|
else if (o = e, this.controller?.getCurrentSection()?.sectionIdentifier === o) return !0;
|
|
1769
|
-
if (!this.dispatch(
|
|
1770
|
-
fromIndex:
|
|
1771
|
-
toIndex:
|
|
1772
|
-
fromSectionId:
|
|
2008
|
+
if (!this.dispatch(m.navigationRequested, {
|
|
2009
|
+
fromIndex: i,
|
|
2010
|
+
toIndex: n,
|
|
2011
|
+
fromSectionId: s,
|
|
1773
2012
|
toSectionId: o,
|
|
1774
2013
|
reason: "navigate-to"
|
|
1775
2014
|
}, !0)) return !1;
|
|
1776
|
-
this.syncCurrentSectionSessionIntoAssessment();
|
|
1777
2015
|
const r = this.controller?.navigateTo(e) === !0;
|
|
1778
2016
|
return r && this.controller?.persist(), r;
|
|
1779
2017
|
}
|
|
1780
2018
|
navigateNext() {
|
|
1781
2019
|
const e = this.selectNavigation(), t = this.controller?.getSectionAt(e.currentIndex + 1);
|
|
1782
|
-
if (!this.dispatch(
|
|
2020
|
+
if (!this.dispatch(m.navigationRequested, {
|
|
1783
2021
|
fromIndex: e.currentIndex,
|
|
1784
2022
|
toIndex: e.currentIndex + 1,
|
|
1785
2023
|
fromSectionId: e.currentSectionId,
|
|
1786
2024
|
toSectionId: t?.sectionIdentifier,
|
|
1787
2025
|
reason: "navigate-next"
|
|
1788
2026
|
}, !0)) return !1;
|
|
1789
|
-
this.
|
|
1790
|
-
|
|
1791
|
-
return n && this.controller?.persist(), n;
|
|
2027
|
+
const i = this.controller?.navigateNext() === !0;
|
|
2028
|
+
return i && this.controller?.persist(), i;
|
|
1792
2029
|
}
|
|
1793
2030
|
navigatePrevious() {
|
|
1794
2031
|
const e = this.selectNavigation(), t = this.controller?.getSectionAt(e.currentIndex - 1);
|
|
1795
|
-
if (!this.dispatch(
|
|
2032
|
+
if (!this.dispatch(m.navigationRequested, {
|
|
1796
2033
|
fromIndex: e.currentIndex,
|
|
1797
2034
|
toIndex: e.currentIndex - 1,
|
|
1798
2035
|
fromSectionId: e.currentSectionId,
|
|
1799
2036
|
toSectionId: t?.sectionIdentifier,
|
|
1800
2037
|
reason: "navigate-previous"
|
|
1801
2038
|
}, !0)) return !1;
|
|
1802
|
-
this.
|
|
1803
|
-
|
|
1804
|
-
return n && this.controller?.persist(), n;
|
|
2039
|
+
const i = this.controller?.navigatePrevious() === !0;
|
|
2040
|
+
return i && this.controller?.persist(), i;
|
|
1805
2041
|
}
|
|
1806
2042
|
getAssessmentController() {
|
|
1807
|
-
return this.controller;
|
|
2043
|
+
return this.isConnected && this.controller?.getRuntimeState().readiness === "ready" ? this.controller : null;
|
|
1808
2044
|
}
|
|
1809
2045
|
async waitForAssessmentController(e = 5e3) {
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
2046
|
+
const t = this.getAssessmentController();
|
|
2047
|
+
return t || (!this.isConnected || this.controller || this.readiness.phase === "error" ? null : new Promise((i) => {
|
|
2048
|
+
const s = (o) => {
|
|
2049
|
+
clearTimeout(n), this.controllerWaiters.delete(s), i(o);
|
|
2050
|
+
}, n = setTimeout(() => s(null), e);
|
|
2051
|
+
this.controllerWaiters.add(s);
|
|
2052
|
+
}));
|
|
1815
2053
|
}
|
|
1816
2054
|
};
|
|
1817
|
-
|
|
1818
|
-
var
|
|
2055
|
+
V("pie-assessment-player-default", Ke, "assessment player default tag");
|
|
2056
|
+
var Ze = class extends HTMLElement {
|
|
1819
2057
|
constructor(...e) {
|
|
1820
2058
|
super(...e), this.showNavigation = !0;
|
|
1821
2059
|
}
|
|
@@ -1825,11 +2063,11 @@ var Ye = class extends HTMLElement {
|
|
|
1825
2063
|
connectedCallback() {
|
|
1826
2064
|
this.showNavigation = this.getAttribute("show-navigation") ?? this.showNavigation, this.render();
|
|
1827
2065
|
}
|
|
1828
|
-
attributeChangedCallback(e, t,
|
|
1829
|
-
e === "show-navigation" && (this.showNavigation =
|
|
2066
|
+
attributeChangedCallback(e, t, i) {
|
|
2067
|
+
e === "show-navigation" && (this.showNavigation = i), this.render();
|
|
1830
2068
|
}
|
|
1831
2069
|
render() {
|
|
1832
|
-
const e =
|
|
2070
|
+
const e = L(this.showNavigation, !0);
|
|
1833
2071
|
this.innerHTML = "";
|
|
1834
2072
|
const t = document.createElement("style");
|
|
1835
2073
|
t.textContent = `
|
|
@@ -1850,18 +2088,18 @@ var Ye = class extends HTMLElement {
|
|
|
1850
2088
|
overflow: hidden;
|
|
1851
2089
|
}
|
|
1852
2090
|
`;
|
|
1853
|
-
const
|
|
1854
|
-
if (
|
|
2091
|
+
const i = document.createElement("div");
|
|
2092
|
+
if (i.className = "pie-assessment-player-shell", e) {
|
|
1855
2093
|
const o = document.createElement("slot");
|
|
1856
|
-
o.name = "navigation",
|
|
2094
|
+
o.name = "navigation", i.appendChild(o);
|
|
1857
2095
|
}
|
|
1858
|
-
const
|
|
1859
|
-
|
|
1860
|
-
const
|
|
1861
|
-
|
|
2096
|
+
const s = document.createElement("div");
|
|
2097
|
+
s.className = "pie-assessment-player-shell__body";
|
|
2098
|
+
const n = document.createElement("slot");
|
|
2099
|
+
s.appendChild(n), i.appendChild(s), this.appendChild(t), this.appendChild(i);
|
|
1862
2100
|
}
|
|
1863
2101
|
};
|
|
1864
|
-
|
|
2102
|
+
V("pie-assessment-player-shell", Ze, "assessment player shell tag");
|
|
1865
2103
|
export {
|
|
1866
|
-
|
|
2104
|
+
m as ASSESSMENT_PLAYER_PUBLIC_EVENTS
|
|
1867
2105
|
};
|