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