@pie-players/pie-assessment-player 1.0.0-beta.6 → 1.0.0-beta.7
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.
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AssessmentPlayerDefaultElement } from '../components/AssessmentPlayerDefaultElement.js';
|
|
2
|
+
/** Native host interface, derived from the implementation's public members. */
|
|
3
|
+
export type PieAssessmentPlayerDefaultElement = Pick<AssessmentPlayerDefaultElement, keyof AssessmentPlayerDefaultElement>;
|
|
4
|
+
declare global {
|
|
5
|
+
interface HTMLElementTagNameMap {
|
|
6
|
+
"pie-assessment-player-default": PieAssessmentPlayerDefaultElement;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -329,7 +329,10 @@ var e = {
|
|
|
329
329
|
name: "Antwoorden wegstrepen",
|
|
330
330
|
description: "Antwoordopties doorstrepen",
|
|
331
331
|
buttonA11y: "Doorstrepen, antwoordopties wegstrepen",
|
|
332
|
-
tooltip: "Doorstrepen"
|
|
332
|
+
tooltip: "Doorstrepen",
|
|
333
|
+
toggleA11y: "Wegstrepen aan/uit voor {choice}",
|
|
334
|
+
eliminatedA11y: "(weggestreept)",
|
|
335
|
+
unlabeledChoice: "Keuze zonder label"
|
|
333
336
|
},
|
|
334
337
|
highlighter: {
|
|
335
338
|
name: "Markeerstift",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type { PieAssessmentPlayerDefaultElement } from './contracts/elements.js';
|
|
1
2
|
export { ASSESSMENT_PLAYER_PUBLIC_EVENTS, type AssessmentPlayerPublicEventName, type AssessmentPlayerReadinessPhase, type AssessmentNavigationRequestedDetail, type AssessmentRouteChangedDetail, type AssessmentProgressChangedDetail, type AssessmentSubmissionStateChangedDetail, type AssessmentReadinessChangeDetail, } from './contracts/public-events.js';
|
|
2
3
|
export type { AssessmentPlayerRuntimeHostContract, AssessmentPlayerNavigationSnapshot, AssessmentPlayerProgressSnapshot, AssessmentPlayerSnapshot, } from './contracts/runtime-host-contract.js';
|
|
3
4
|
export type { AssessmentDefinition, AssessmentDeliveryPlan, AssessmentSectionInstance, AssessmentDeliveryPlanContext, AssessmentDeliveryPlanFactoryDefaults, AssessmentSessionPersistenceContext, AssessmentSessionPersistenceStrategy, AssessmentSessionPersistenceFactoryDefaults, AssessmentPlayerHooks, AssessmentPlayerRuntimeConfig, } from './types.js';
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import "@pie-players/pie-section-player";
|
|
2
|
-
import { createNewAssessmentSession as
|
|
3
|
-
function
|
|
2
|
+
import { createNewAssessmentSession as ee, frameworkErrorFromUnknown as te, setCurrentSectionPosition as ie, upsertSectionSession as ne } from "@pie-players/pie-assessment-toolkit";
|
|
3
|
+
function I(e) {
|
|
4
4
|
"@babel/helpers - typeof";
|
|
5
|
-
return
|
|
5
|
+
return I = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
|
|
6
6
|
return typeof t;
|
|
7
7
|
} : function(t) {
|
|
8
8
|
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
9
|
-
},
|
|
9
|
+
}, I(e);
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
if (
|
|
11
|
+
function se(e, t) {
|
|
12
|
+
if (I(e) != "object" || !e) return e;
|
|
13
13
|
var i = e[Symbol.toPrimitive];
|
|
14
14
|
if (i !== void 0) {
|
|
15
15
|
var n = i.call(e, t || "default");
|
|
16
|
-
if (
|
|
16
|
+
if (I(n) != "object") return n;
|
|
17
17
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
18
18
|
}
|
|
19
19
|
return (t === "string" ? String : Number)(e);
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
var t =
|
|
23
|
-
return
|
|
21
|
+
function oe(e) {
|
|
22
|
+
var t = se(e, "string");
|
|
23
|
+
return I(t) == "symbol" ? t : t + "";
|
|
24
24
|
}
|
|
25
25
|
function f(e, t, i) {
|
|
26
|
-
return (t =
|
|
26
|
+
return (t = oe(t)) in e ? Object.defineProperty(e, t, {
|
|
27
27
|
value: i,
|
|
28
28
|
enumerable: !0,
|
|
29
29
|
configurable: !0,
|
|
30
30
|
writable: !0
|
|
31
31
|
}) : e[t] = i, e;
|
|
32
32
|
}
|
|
33
|
-
var
|
|
33
|
+
var re = class {
|
|
34
34
|
constructor() {
|
|
35
35
|
f(this, "initialized", !1), f(this, "config", void 0);
|
|
36
36
|
}
|
|
@@ -95,50 +95,50 @@ var ne = class {
|
|
|
95
95
|
return this.config?.attributeTransformer ? this.config.attributeTransformer(e) : e;
|
|
96
96
|
}
|
|
97
97
|
};
|
|
98
|
-
function
|
|
98
|
+
function M(e) {
|
|
99
99
|
const t = e;
|
|
100
100
|
return typeof t?.noticeError == "function" && typeof t.addPageAction == "function";
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function S() {
|
|
103
103
|
if (typeof window > "u") return;
|
|
104
104
|
const { newrelic: e, NREUM: t } = window;
|
|
105
|
-
if (
|
|
106
|
-
if (
|
|
105
|
+
if (M(e)) return e;
|
|
106
|
+
if (M(t)) return t;
|
|
107
107
|
}
|
|
108
|
-
var
|
|
108
|
+
var ae = class extends re {
|
|
109
109
|
constructor(...e) {
|
|
110
110
|
super(...e), f(this, "providerId", "newrelic"), f(this, "providerName", "New Relic");
|
|
111
111
|
}
|
|
112
112
|
async initialize(e) {
|
|
113
|
-
this.config = e, this.initialized = !0, this.config?.debug && console.log(
|
|
113
|
+
this.config = e, this.initialized = !0, this.config?.debug && console.log(S() ? "[NewRelicProvider] Initialized successfully" : "[NewRelicProvider] Initialized; sends once the New Relic agent is on the page");
|
|
114
114
|
}
|
|
115
115
|
isReady() {
|
|
116
|
-
return this.initialized &&
|
|
116
|
+
return this.initialized && S() !== void 0;
|
|
117
117
|
}
|
|
118
118
|
destroy() {
|
|
119
119
|
this.initialized = !1, this.config?.debug && console.log("[NewRelicProvider] Destroyed");
|
|
120
120
|
}
|
|
121
121
|
doTrackError(e, t) {
|
|
122
|
-
|
|
122
|
+
S()?.noticeError(e, t);
|
|
123
123
|
}
|
|
124
124
|
doTrackEvent(e, t) {
|
|
125
|
-
|
|
125
|
+
S()?.addPageAction(e, t);
|
|
126
126
|
}
|
|
127
127
|
doSetUserContext(e, t) {
|
|
128
|
-
const i =
|
|
128
|
+
const i = S();
|
|
129
129
|
if (typeof i?.setUserId == "function" && i.setUserId(e), t && typeof i?.setCustomAttribute == "function") for (const [n, s] of Object.entries(t)) i.setCustomAttribute(n, s);
|
|
130
130
|
}
|
|
131
131
|
doSetGlobalAttributes(e) {
|
|
132
|
-
const t =
|
|
132
|
+
const t = S();
|
|
133
133
|
if (typeof t?.setCustomAttribute == "function") for (const [i, n] of Object.entries(e)) t.setCustomAttribute(i, n);
|
|
134
134
|
}
|
|
135
135
|
};
|
|
136
|
-
function
|
|
136
|
+
function G(e) {
|
|
137
137
|
if (!e || typeof e != "object") return !1;
|
|
138
138
|
const t = e;
|
|
139
139
|
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";
|
|
140
140
|
}
|
|
141
|
-
var
|
|
141
|
+
var le = /* @__PURE__ */ new Set([
|
|
142
142
|
"annotation-xml",
|
|
143
143
|
"color-profile",
|
|
144
144
|
"font-face",
|
|
@@ -147,17 +147,17 @@ var oe = /* @__PURE__ */ new Set([
|
|
|
147
147
|
"font-face-format",
|
|
148
148
|
"font-face-name",
|
|
149
149
|
"missing-glyph"
|
|
150
|
-
]),
|
|
150
|
+
]), ce = /^[a-z][a-z0-9._-]*-[a-z0-9._-]*$/, de = (e, t = "custom element tag") => {
|
|
151
151
|
if (!e || typeof e != "string") throw new Error(`Invalid ${t}: expected a non-empty string`);
|
|
152
152
|
const i = e.trim();
|
|
153
153
|
if (!i) throw new Error(`Invalid ${t}: tag is empty`);
|
|
154
154
|
if (i !== i.toLowerCase()) throw new Error(`Invalid ${t} "${i}": custom element names must be lowercase`);
|
|
155
155
|
if (!i.includes("-")) throw new Error(`Invalid ${t} "${i}": custom element names must include a hyphen`);
|
|
156
|
-
if (
|
|
157
|
-
if (!
|
|
156
|
+
if (le.has(i)) throw new Error(`Invalid ${t} "${i}": this name is reserved by the HTML spec`);
|
|
157
|
+
if (!ce.test(i)) throw new Error(`Invalid ${t} "${i}": allowed characters are lowercase letters, numbers, ".", "_" and "-"`);
|
|
158
158
|
return i;
|
|
159
|
-
},
|
|
160
|
-
const s =
|
|
159
|
+
}, ue = (e) => typeof DOMException < "u" && e instanceof DOMException ? e.name === "NotSupportedError" || e.code === DOMException.NOT_SUPPORTED_ERR : (typeof e == "object" && e !== null && "name" in e ? String(e.name) : "") === "NotSupportedError", he = (e, t, i = "custom element tag", n = {}) => {
|
|
160
|
+
const s = de(e, i);
|
|
161
161
|
if (customElements.get(s)) return {
|
|
162
162
|
outcome: "already-defined",
|
|
163
163
|
tagName: s
|
|
@@ -168,7 +168,7 @@ var oe = /* @__PURE__ */ new Set([
|
|
|
168
168
|
tagName: s
|
|
169
169
|
};
|
|
170
170
|
} catch (o) {
|
|
171
|
-
if (!
|
|
171
|
+
if (!ue(o)) return {
|
|
172
172
|
outcome: "error",
|
|
173
173
|
tagName: s,
|
|
174
174
|
error: o
|
|
@@ -196,8 +196,8 @@ var oe = /* @__PURE__ */ new Set([
|
|
|
196
196
|
};
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
|
-
},
|
|
200
|
-
const n =
|
|
199
|
+
}, j = (e, t, i = "custom element tag") => {
|
|
200
|
+
const n = he(e, t, i);
|
|
201
201
|
if (n.outcome === "error" || n.outcome === "wrapped-error") throw n.error;
|
|
202
202
|
return {
|
|
203
203
|
status: n.outcome === "already-defined" ? "already-defined" : "defined",
|
|
@@ -212,7 +212,7 @@ var oe = /* @__PURE__ */ new Set([
|
|
|
212
212
|
for (const n in e) Object.hasOwn(e, n) && (i[n] = y(e[n]));
|
|
213
213
|
return i;
|
|
214
214
|
};
|
|
215
|
-
function
|
|
215
|
+
function W(e, t) {
|
|
216
216
|
const i = `[${e}]`;
|
|
217
217
|
return {
|
|
218
218
|
debug: (n, ...s) => {
|
|
@@ -223,11 +223,11 @@ function G(e, t) {
|
|
|
223
223
|
error: (n, ...s) => console.error(i, n, ...s)
|
|
224
224
|
};
|
|
225
225
|
}
|
|
226
|
-
function
|
|
226
|
+
function V() {
|
|
227
227
|
return typeof window < "u" && window.PIE_DEBUG === !0;
|
|
228
228
|
}
|
|
229
|
-
var
|
|
230
|
-
function
|
|
229
|
+
var pe = W("instrumentation-event-bridge", () => V());
|
|
230
|
+
function me(e) {
|
|
231
231
|
if (e === null) return !0;
|
|
232
232
|
const t = typeof e;
|
|
233
233
|
if (t === "function" || t === "symbol") return !1;
|
|
@@ -235,18 +235,18 @@ function ue(e) {
|
|
|
235
235
|
const i = Object.getPrototypeOf(e);
|
|
236
236
|
return i === Object.prototype || i === null;
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function ge(e) {
|
|
239
239
|
if (e && typeof e == "object") {
|
|
240
240
|
const t = {};
|
|
241
|
-
for (const [i, n] of Object.entries(e))
|
|
241
|
+
for (const [i, n] of Object.entries(e)) me(n) && (t[i] = n);
|
|
242
242
|
return t;
|
|
243
243
|
}
|
|
244
244
|
return typeof e > "u" ? {} : { value: e };
|
|
245
245
|
}
|
|
246
|
-
function
|
|
247
|
-
|
|
246
|
+
function fe(e) {
|
|
247
|
+
pe.warn(`[InstrumentationEventBridge:${e}] Ignoring invalid instrumentation provider; expected InstrumentationProvider contract`);
|
|
248
248
|
}
|
|
249
|
-
function
|
|
249
|
+
function ye(e) {
|
|
250
250
|
try {
|
|
251
251
|
e.provider.trackError(e.error instanceof Error ? e.error : new Error(String(e.error ?? "Unknown instrumentation bridge error")), {
|
|
252
252
|
component: e.component,
|
|
@@ -256,13 +256,13 @@ function me(e) {
|
|
|
256
256
|
} catch {
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function ve(e) {
|
|
260
260
|
if (!e.host || !e.eventMap.length) return () => {
|
|
261
261
|
};
|
|
262
262
|
if (!e.instrumentationProvider) return () => {
|
|
263
263
|
};
|
|
264
|
-
if (!
|
|
265
|
-
return e.debug &&
|
|
264
|
+
if (!G(e.instrumentationProvider))
|
|
265
|
+
return e.debug && fe(e.component), () => {
|
|
266
266
|
};
|
|
267
267
|
const t = e.instrumentationProvider, i = [], n = Math.max(0, e.dedupeWindowMs ?? 0), s = /* @__PURE__ */ new Map(), o = (r, a) => {
|
|
268
268
|
const h = [
|
|
@@ -279,7 +279,7 @@ function ge(e) {
|
|
|
279
279
|
const a = (h) => {
|
|
280
280
|
try {
|
|
281
281
|
if (!t.isReady() || e.shouldTrackEvent && !e.shouldTrackEvent(h)) return;
|
|
282
|
-
const d =
|
|
282
|
+
const d = ge(h.detail), c = (/* @__PURE__ */ new Date()).toISOString(), p = {
|
|
283
283
|
...d,
|
|
284
284
|
...e.staticAttributes,
|
|
285
285
|
component: e.component,
|
|
@@ -293,7 +293,7 @@ function ge(e) {
|
|
|
293
293
|
}
|
|
294
294
|
t.trackEvent(r.instrumentationEventName, { ...p });
|
|
295
295
|
} catch (d) {
|
|
296
|
-
|
|
296
|
+
ye({
|
|
297
297
|
provider: t,
|
|
298
298
|
component: e.component,
|
|
299
299
|
error: d,
|
|
@@ -309,14 +309,14 @@ function ge(e) {
|
|
|
309
309
|
for (const r of i) r();
|
|
310
310
|
};
|
|
311
311
|
}
|
|
312
|
-
function
|
|
312
|
+
function D(e) {
|
|
313
313
|
return e && typeof e == "object" ? e : {};
|
|
314
314
|
}
|
|
315
|
-
function
|
|
316
|
-
const t =
|
|
315
|
+
function F(e) {
|
|
316
|
+
const t = D(D(e).loaderConfig);
|
|
317
317
|
return Object.keys(t).length > 0 ? t : null;
|
|
318
318
|
}
|
|
319
|
-
function
|
|
319
|
+
function z(e) {
|
|
320
320
|
if (!e || !("instrumentationProvider" in e)) return { kind: "unset" };
|
|
321
321
|
const t = e.instrumentationProvider;
|
|
322
322
|
return t === null ? { kind: "null" } : typeof t > "u" ? { kind: "unset" } : {
|
|
@@ -324,30 +324,30 @@ function D(e) {
|
|
|
324
324
|
value: t
|
|
325
325
|
};
|
|
326
326
|
}
|
|
327
|
-
function
|
|
327
|
+
function _(e) {
|
|
328
328
|
if (!e || !("trackPageActions" in e)) return;
|
|
329
329
|
const t = e.trackPageActions;
|
|
330
330
|
return typeof t == "boolean" ? t : void 0;
|
|
331
331
|
}
|
|
332
|
-
function
|
|
332
|
+
function be(e, t) {
|
|
333
333
|
return e.kind === "value" || e.kind === "null" ? e : t;
|
|
334
334
|
}
|
|
335
|
-
var E,
|
|
336
|
-
function
|
|
337
|
-
return E || (E = new
|
|
335
|
+
var E, Se = W("instrumentation-provider-resolution", () => V());
|
|
336
|
+
function we() {
|
|
337
|
+
return E || (E = new ae(), E.initialize()), E;
|
|
338
338
|
}
|
|
339
|
-
function
|
|
340
|
-
const t =
|
|
339
|
+
function Ae(e) {
|
|
340
|
+
const t = F(e.runtimePlayer), i = F(e.player), n = _(t), s = _(i), o = n ?? s ?? !1, r = be(z(t), z(i));
|
|
341
341
|
if (r.kind !== "null") {
|
|
342
|
-
if (r.kind === "unset") return o ?
|
|
343
|
-
if (
|
|
342
|
+
if (r.kind === "unset") return o ? we() : void 0;
|
|
343
|
+
if (G(r.value)) return r.value;
|
|
344
344
|
if (e.debug) {
|
|
345
345
|
const a = e.component ? `[${e.component}] ` : "";
|
|
346
|
-
|
|
346
|
+
Se.warn(`${a}Ignoring invalid instrumentation provider; expected InstrumentationProvider contract`);
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
|
-
var
|
|
350
|
+
var Ie = [
|
|
351
351
|
{
|
|
352
352
|
sourceEventName: "assessment-controller-ready",
|
|
353
353
|
instrumentationEventName: "pie-assessment-controller-ready"
|
|
@@ -381,7 +381,7 @@ var Se = [
|
|
|
381
381
|
instrumentationEventName: "pie-assessment-error"
|
|
382
382
|
}
|
|
383
383
|
];
|
|
384
|
-
function
|
|
384
|
+
function R(e, t = !1) {
|
|
385
385
|
if (typeof e == "boolean") return e;
|
|
386
386
|
if (e == null) return t;
|
|
387
387
|
const i = String(e).trim().toLowerCase();
|
|
@@ -392,7 +392,7 @@ function N(e, t = !1) {
|
|
|
392
392
|
"no"
|
|
393
393
|
].includes(i);
|
|
394
394
|
}
|
|
395
|
-
var
|
|
395
|
+
var Q = {
|
|
396
396
|
common: {
|
|
397
397
|
close: "Close",
|
|
398
398
|
cancel: "Cancel",
|
|
@@ -723,7 +723,10 @@ var W = {
|
|
|
723
723
|
name: "Answer Eliminator",
|
|
724
724
|
description: "Strike through answer choices",
|
|
725
725
|
buttonA11y: "Strike Through, eliminate answer choices",
|
|
726
|
-
tooltip: "Strike Through"
|
|
726
|
+
tooltip: "Strike Through",
|
|
727
|
+
toggleA11y: "Toggle elimination for {choice}",
|
|
728
|
+
eliminatedA11y: "(eliminated)",
|
|
729
|
+
unlabeledChoice: "Unlabeled choice"
|
|
727
730
|
},
|
|
728
731
|
highlighter: {
|
|
729
732
|
name: "Highlighter",
|
|
@@ -1011,21 +1014,21 @@ var W = {
|
|
|
1011
1014
|
ssml: "SSML"
|
|
1012
1015
|
}
|
|
1013
1016
|
}
|
|
1014
|
-
},
|
|
1015
|
-
async function
|
|
1016
|
-
if (e === "en-US") return
|
|
1017
|
-
const t =
|
|
1017
|
+
}, Ee = { "nl-NL": () => import("./nl-NL-BM1IvzOs.js") }, Ce = ["en-US", "nl-NL"];
|
|
1018
|
+
async function Pe(e) {
|
|
1019
|
+
if (e === "en-US") return Q;
|
|
1020
|
+
const t = Ee[e];
|
|
1018
1021
|
if (!t) throw new Error(`No bundled i18n catalog for locale: ${e}`);
|
|
1019
1022
|
return (await t()).default;
|
|
1020
1023
|
}
|
|
1021
|
-
function
|
|
1024
|
+
function v(e) {
|
|
1022
1025
|
return e ? e.trim().replace(/_/g, "-").split(/[.@]/)[0].toLowerCase() : "";
|
|
1023
1026
|
}
|
|
1024
|
-
function
|
|
1027
|
+
function A(e) {
|
|
1025
1028
|
return e ? e.trim().replace(/_/g, "-") : "";
|
|
1026
1029
|
}
|
|
1027
|
-
function
|
|
1028
|
-
const t =
|
|
1030
|
+
function ke(e) {
|
|
1031
|
+
const t = v(e);
|
|
1029
1032
|
if (!t) return [];
|
|
1030
1033
|
const i = t.split("-"), n = [];
|
|
1031
1034
|
for (let s = i.length; s > 0; s--) {
|
|
@@ -1034,14 +1037,48 @@ function Ee(e) {
|
|
|
1034
1037
|
}
|
|
1035
1038
|
return n;
|
|
1036
1039
|
}
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1040
|
+
var N = /* @__PURE__ */ new Map();
|
|
1041
|
+
function T(e) {
|
|
1042
|
+
const t = v(e);
|
|
1043
|
+
if (!t || typeof Intl > "u" || typeof Intl.Locale != "function") return;
|
|
1044
|
+
if (N.has(t)) return N.get(t);
|
|
1045
|
+
let i;
|
|
1046
|
+
try {
|
|
1047
|
+
i = new Intl.Locale(t).maximize().script?.toLowerCase();
|
|
1048
|
+
} catch {
|
|
1049
|
+
}
|
|
1050
|
+
return N.set(t, i), i;
|
|
1051
|
+
}
|
|
1052
|
+
function K(e, t) {
|
|
1053
|
+
const i = T(e), n = T(t);
|
|
1054
|
+
return !i || !n || i === n;
|
|
1055
|
+
}
|
|
1056
|
+
function Ne(e) {
|
|
1057
|
+
const t = ke(e), i = T(e);
|
|
1058
|
+
if (!i || t.length < 2) return t;
|
|
1059
|
+
const n = t[t.length - 1], s = `${n}-${i}`;
|
|
1060
|
+
return t.includes(s) ? t : [
|
|
1061
|
+
...t.slice(0, -1),
|
|
1062
|
+
s,
|
|
1063
|
+
n
|
|
1064
|
+
];
|
|
1065
|
+
}
|
|
1066
|
+
function Re(e, t) {
|
|
1067
|
+
const i = v(e);
|
|
1068
|
+
for (const n of Ne(e)) {
|
|
1069
|
+
const s = t.find((o) => v(o) === n && (n === i || K(e, o)));
|
|
1070
|
+
if (s != null) return s;
|
|
1041
1071
|
}
|
|
1042
1072
|
}
|
|
1043
|
-
function
|
|
1044
|
-
const
|
|
1073
|
+
function Te(e, t) {
|
|
1074
|
+
const i = Re(e, t);
|
|
1075
|
+
if (i !== void 0) return i;
|
|
1076
|
+
const n = v(e).split("-")[0];
|
|
1077
|
+
if (n)
|
|
1078
|
+
return t.find((s) => v(s).split("-")[0] === n && K(e, s)) ?? void 0;
|
|
1079
|
+
}
|
|
1080
|
+
function Le(e) {
|
|
1081
|
+
const t = A(e).split(/[.@]/)[0];
|
|
1045
1082
|
if (/^[a-z]{2,3}(-|$)/i.test(t))
|
|
1046
1083
|
try {
|
|
1047
1084
|
return Intl.getCanonicalLocales(t)[0];
|
|
@@ -1049,7 +1086,7 @@ function Ce(e) {
|
|
|
1049
1086
|
return;
|
|
1050
1087
|
}
|
|
1051
1088
|
}
|
|
1052
|
-
var
|
|
1089
|
+
var P = "en-US", xe = /* @__PURE__ */ new Set([
|
|
1053
1090
|
"ar",
|
|
1054
1091
|
"ckb",
|
|
1055
1092
|
"dv",
|
|
@@ -1065,7 +1102,7 @@ var C = "en-US", ke = /* @__PURE__ */ new Set([
|
|
|
1065
1102
|
"ug",
|
|
1066
1103
|
"ur",
|
|
1067
1104
|
"yi"
|
|
1068
|
-
]),
|
|
1105
|
+
]), Me = /* @__PURE__ */ new Set([
|
|
1069
1106
|
"zero",
|
|
1070
1107
|
"one",
|
|
1071
1108
|
"two",
|
|
@@ -1073,23 +1110,23 @@ var C = "en-US", ke = /* @__PURE__ */ new Set([
|
|
|
1073
1110
|
"many",
|
|
1074
1111
|
"other"
|
|
1075
1112
|
]);
|
|
1076
|
-
function
|
|
1113
|
+
function U(e) {
|
|
1077
1114
|
if (typeof e != "object" || e === null) return !1;
|
|
1078
1115
|
const t = Object.keys(e);
|
|
1079
|
-
return t.length > 0 && t.every((i) =>
|
|
1116
|
+
return t.length > 0 && t.every((i) => Me.has(i));
|
|
1080
1117
|
}
|
|
1081
|
-
function
|
|
1118
|
+
function O(e) {
|
|
1082
1119
|
try {
|
|
1083
1120
|
const i = new Intl.Locale(e).textInfo;
|
|
1084
1121
|
if (i?.direction === "rtl" || i?.direction === "ltr") return i.direction;
|
|
1085
1122
|
} catch {
|
|
1086
1123
|
}
|
|
1087
|
-
const t =
|
|
1088
|
-
return
|
|
1124
|
+
const t = v(e).split("-")[0] ?? "";
|
|
1125
|
+
return xe.has(t) ? "rtl" : "ltr";
|
|
1089
1126
|
}
|
|
1090
|
-
var
|
|
1127
|
+
var J = class k {
|
|
1091
1128
|
constructor(t = {}) {
|
|
1092
|
-
f(this, "locale", void 0), f(this, "fallbackLocale", void 0), f(this, "catalogs", void 0), f(this, "customMessages", void 0), f(this, "loading", void 0), f(this, "requests", 0), f(this, "listeners", /* @__PURE__ */ new Set()), f(this, "config", void 0), this.config = { ...t }, this.fallbackLocale =
|
|
1129
|
+
f(this, "locale", void 0), f(this, "fallbackLocale", void 0), f(this, "catalogs", void 0), f(this, "customMessages", void 0), f(this, "loading", void 0), f(this, "requests", 0), f(this, "listeners", /* @__PURE__ */ new Set()), f(this, "config", void 0), this.config = { ...t }, this.fallbackLocale = A(t.fallbackLocale) || "en-US", this.catalogs = /* @__PURE__ */ new Map([[P, Q]]), this.customMessages = { ...t.customMessages ?? {} }, this.loading = /* @__PURE__ */ new Map(), this.locale = this.resolveLocaleTag(t.locale) ?? "en-US";
|
|
1093
1130
|
}
|
|
1094
1131
|
async initialize(t) {
|
|
1095
1132
|
if (this.config = {
|
|
@@ -1104,7 +1141,7 @@ var V = class k {
|
|
|
1104
1141
|
async setLocale(t) {
|
|
1105
1142
|
const i = ++this.requests, n = this.resolveLocaleTag(t);
|
|
1106
1143
|
if (!n) {
|
|
1107
|
-
this.locale =
|
|
1144
|
+
this.locale = A(t) || "en-US", this.notify();
|
|
1108
1145
|
return;
|
|
1109
1146
|
}
|
|
1110
1147
|
if (!this.catalogs.has(n) && this.config.availableLocales?.includes(n)) {
|
|
@@ -1124,14 +1161,14 @@ var V = class k {
|
|
|
1124
1161
|
}
|
|
1125
1162
|
t(t, i) {
|
|
1126
1163
|
const n = this.lookup(t);
|
|
1127
|
-
return n === void 0 ? (this.config.onMissingKey?.(t, this.locale), t) :
|
|
1164
|
+
return n === void 0 ? (this.config.onMissingKey?.(t, this.locale), t) : H(n, i, this.locale);
|
|
1128
1165
|
}
|
|
1129
1166
|
plural(t, i) {
|
|
1130
1167
|
const n = this.lookupNode(t);
|
|
1131
|
-
return n === void 0 || !
|
|
1168
|
+
return n === void 0 || !U(n) ? this.t(t, i) : H(n[this.selectPluralCategory(i.count)] ?? n.other, i, this.locale);
|
|
1132
1169
|
}
|
|
1133
1170
|
getDirection() {
|
|
1134
|
-
return
|
|
1171
|
+
return O(this.locale);
|
|
1135
1172
|
}
|
|
1136
1173
|
getAvailableLocales() {
|
|
1137
1174
|
return [.../* @__PURE__ */ new Set([
|
|
@@ -1153,11 +1190,11 @@ var V = class k {
|
|
|
1153
1190
|
return this.lookup(t) !== void 0;
|
|
1154
1191
|
}
|
|
1155
1192
|
addCustomMessages(t, i) {
|
|
1156
|
-
const n =
|
|
1157
|
-
this.customMessages[n] =
|
|
1193
|
+
const n = A(t);
|
|
1194
|
+
this.customMessages[n] = Y(this.customMessages[n] ?? {}, i), this.notify();
|
|
1158
1195
|
}
|
|
1159
1196
|
withLocale(t) {
|
|
1160
|
-
const i = this.resolveLocaleTag(t) ??
|
|
1197
|
+
const i = this.resolveLocaleTag(t) ?? A(t);
|
|
1161
1198
|
if (i === this.locale) return this;
|
|
1162
1199
|
const n = new k({
|
|
1163
1200
|
...this.config,
|
|
@@ -1169,14 +1206,14 @@ var V = class k {
|
|
|
1169
1206
|
try {
|
|
1170
1207
|
return new Intl.NumberFormat(this.locale, i).format(t);
|
|
1171
1208
|
} catch {
|
|
1172
|
-
return new Intl.NumberFormat(
|
|
1209
|
+
return new Intl.NumberFormat(P, i).format(t);
|
|
1173
1210
|
}
|
|
1174
1211
|
}
|
|
1175
1212
|
formatDate(t, i) {
|
|
1176
1213
|
try {
|
|
1177
1214
|
return new Intl.DateTimeFormat(this.locale, i).format(t);
|
|
1178
1215
|
} catch {
|
|
1179
|
-
return new Intl.DateTimeFormat(
|
|
1216
|
+
return new Intl.DateTimeFormat(P, i).format(t);
|
|
1180
1217
|
}
|
|
1181
1218
|
}
|
|
1182
1219
|
getBundle(t = this.locale) {
|
|
@@ -1187,16 +1224,12 @@ var V = class k {
|
|
|
1187
1224
|
return {
|
|
1188
1225
|
locale: i,
|
|
1189
1226
|
translations: n,
|
|
1190
|
-
direction:
|
|
1227
|
+
direction: O(i)
|
|
1191
1228
|
};
|
|
1192
1229
|
}
|
|
1193
1230
|
resolveLocaleTag(t) {
|
|
1194
|
-
if (
|
|
1195
|
-
|
|
1196
|
-
if (n) return n;
|
|
1197
|
-
const s = I(t).split("-")[0];
|
|
1198
|
-
if (s)
|
|
1199
|
-
return i.find((o) => I(o).split("-")[0] === s);
|
|
1231
|
+
if (t)
|
|
1232
|
+
return Te(t, this.getAvailableLocales());
|
|
1200
1233
|
}
|
|
1201
1234
|
async loadCatalog(t) {
|
|
1202
1235
|
const i = this.config.loadCatalog;
|
|
@@ -1215,14 +1248,14 @@ var V = class k {
|
|
|
1215
1248
|
this.catalogs.get(this.fallbackLocale)
|
|
1216
1249
|
];
|
|
1217
1250
|
for (const n of i) {
|
|
1218
|
-
const s =
|
|
1251
|
+
const s = De(n, t);
|
|
1219
1252
|
if (s !== void 0) return s;
|
|
1220
1253
|
}
|
|
1221
1254
|
}
|
|
1222
1255
|
lookup(t) {
|
|
1223
1256
|
const i = this.lookupNode(t);
|
|
1224
1257
|
if (typeof i == "string") return i;
|
|
1225
|
-
if (i !== void 0 &&
|
|
1258
|
+
if (i !== void 0 && U(i)) return i.other;
|
|
1226
1259
|
}
|
|
1227
1260
|
selectPluralCategory(t) {
|
|
1228
1261
|
let i = k.pluralRules.get(this.locale);
|
|
@@ -1240,46 +1273,46 @@ var V = class k {
|
|
|
1240
1273
|
for (const t of this.listeners) t();
|
|
1241
1274
|
}
|
|
1242
1275
|
};
|
|
1243
|
-
f(
|
|
1244
|
-
function
|
|
1276
|
+
f(J, "pluralRules", /* @__PURE__ */ new Map());
|
|
1277
|
+
function De(e, t) {
|
|
1245
1278
|
if (!e) return;
|
|
1246
1279
|
let i = e;
|
|
1247
1280
|
for (const n of t.split("."))
|
|
1248
1281
|
if (typeof i != "object" || i === null || (i = i[n], i === void 0)) return;
|
|
1249
1282
|
return i;
|
|
1250
1283
|
}
|
|
1251
|
-
var
|
|
1252
|
-
function
|
|
1253
|
-
let i =
|
|
1284
|
+
var B = /* @__PURE__ */ new Map();
|
|
1285
|
+
function Fe(e, t) {
|
|
1286
|
+
let i = B.get(t);
|
|
1254
1287
|
if (!i) {
|
|
1255
1288
|
try {
|
|
1256
1289
|
i = new Intl.NumberFormat(t);
|
|
1257
1290
|
} catch {
|
|
1258
|
-
i = new Intl.NumberFormat(
|
|
1291
|
+
i = new Intl.NumberFormat(P);
|
|
1259
1292
|
}
|
|
1260
|
-
|
|
1293
|
+
B.set(t, i);
|
|
1261
1294
|
}
|
|
1262
1295
|
return i.format(e);
|
|
1263
1296
|
}
|
|
1264
|
-
function
|
|
1297
|
+
function H(e, t, i) {
|
|
1265
1298
|
return t ? e.replace(/\{(\w+)\}/g, (n, s) => {
|
|
1266
1299
|
const o = t[s];
|
|
1267
|
-
return o == null ? n : i !== void 0 && typeof o == "number" && Number.isFinite(o) ?
|
|
1300
|
+
return o == null ? n : i !== void 0 && typeof o == "number" && Number.isFinite(o) ? Fe(o, i) : String(o);
|
|
1268
1301
|
}) : e;
|
|
1269
1302
|
}
|
|
1270
|
-
function
|
|
1303
|
+
function Y(e, t) {
|
|
1271
1304
|
const i = { ...e };
|
|
1272
1305
|
for (const [n, s] of Object.entries(t)) {
|
|
1273
1306
|
const o = i[n];
|
|
1274
|
-
s && typeof s == "object" && o && typeof o == "object" ? i[n] =
|
|
1307
|
+
s && typeof s == "object" && o && typeof o == "object" ? i[n] = Y(o, s) : i[n] = s;
|
|
1275
1308
|
}
|
|
1276
1309
|
return i;
|
|
1277
1310
|
}
|
|
1278
|
-
function
|
|
1311
|
+
function $(e, t) {
|
|
1279
1312
|
const i = t.getLocale();
|
|
1280
|
-
e.setAttribute("lang",
|
|
1313
|
+
e.setAttribute("lang", Le(i) ?? i), e.setAttribute("dir", t.getDirection?.() ?? "ltr");
|
|
1281
1314
|
}
|
|
1282
|
-
function
|
|
1315
|
+
function ze(e, t, i) {
|
|
1283
1316
|
if (!e) return;
|
|
1284
1317
|
const n = {
|
|
1285
1318
|
kind: "i18n-locale-load",
|
|
@@ -1296,38 +1329,38 @@ function xe(e, t, i) {
|
|
|
1296
1329
|
composed: !0
|
|
1297
1330
|
}));
|
|
1298
1331
|
}
|
|
1299
|
-
function
|
|
1300
|
-
return new
|
|
1301
|
-
loadCatalog:
|
|
1302
|
-
availableLocales:
|
|
1332
|
+
function _e(e = {}) {
|
|
1333
|
+
return new J({
|
|
1334
|
+
loadCatalog: Pe,
|
|
1335
|
+
availableLocales: Ce,
|
|
1303
1336
|
...e
|
|
1304
1337
|
});
|
|
1305
1338
|
}
|
|
1306
|
-
function
|
|
1339
|
+
function w() {
|
|
1307
1340
|
return Date.now();
|
|
1308
1341
|
}
|
|
1309
|
-
function
|
|
1342
|
+
function C(e) {
|
|
1310
1343
|
return e.replace(/[^a-zA-Z0-9_-]/g, "-");
|
|
1311
1344
|
}
|
|
1312
|
-
function
|
|
1313
|
-
if (e.attemptId) return `aas_v1_${
|
|
1314
|
-
const t =
|
|
1315
|
-
return `aas_v1_${
|
|
1345
|
+
function Ue(e) {
|
|
1346
|
+
if (e.attemptId) return `aas_v1_${C(e.assessmentId)}_${C(e.attemptId)}`;
|
|
1347
|
+
const t = Z(), i = t ? Oe(t) : "anon";
|
|
1348
|
+
return `aas_v1_${C(e.assessmentId)}_${C(i)}`;
|
|
1316
1349
|
}
|
|
1317
|
-
function
|
|
1350
|
+
function Z() {
|
|
1318
1351
|
try {
|
|
1319
1352
|
return typeof window > "u" ? null : window.localStorage;
|
|
1320
1353
|
} catch {
|
|
1321
1354
|
return null;
|
|
1322
1355
|
}
|
|
1323
1356
|
}
|
|
1324
|
-
function
|
|
1357
|
+
function Oe(e) {
|
|
1325
1358
|
const t = "pie:assessment-player:anonymous-device-id", i = e.getItem(t);
|
|
1326
1359
|
if (i) return i;
|
|
1327
1360
|
const n = `anon-${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;
|
|
1328
1361
|
return e.setItem(t, n), n;
|
|
1329
1362
|
}
|
|
1330
|
-
function
|
|
1363
|
+
function Be(e) {
|
|
1331
1364
|
if (!e) return [];
|
|
1332
1365
|
const t = [], i = e.testParts || [];
|
|
1333
1366
|
return i.length > 0 ? (i.forEach((n, s) => {
|
|
@@ -1350,7 +1383,7 @@ function Fe(e) {
|
|
|
1350
1383
|
});
|
|
1351
1384
|
}), t);
|
|
1352
1385
|
}
|
|
1353
|
-
var
|
|
1386
|
+
var He = class {
|
|
1354
1387
|
constructor(e) {
|
|
1355
1388
|
this.args = e, this.listeners = /* @__PURE__ */ new Set(), this.deliveryPlan = { sections: [] }, this.session = null, this.readiness = "bootstrapping", this.submitted = !1, this.saveQueue = Promise.resolve(), this.disposed = !1, this.storageContext = {
|
|
1356
1389
|
assessmentId: e.assessmentId,
|
|
@@ -1383,7 +1416,7 @@ var ze = class {
|
|
|
1383
1416
|
async getPersistenceStrategy() {
|
|
1384
1417
|
if (this.persistenceStrategy) return this.persistenceStrategy;
|
|
1385
1418
|
const e = { createDefaultPersistence: () => {
|
|
1386
|
-
const t =
|
|
1419
|
+
const t = Z(), { assessmentId: i, attemptId: n } = this.storageContext, s = n ? `pie:assessment-controller:v1:${i}:${n}` : null;
|
|
1387
1420
|
return {
|
|
1388
1421
|
async loadSession() {
|
|
1389
1422
|
if (!t || !s) return null;
|
|
@@ -1406,7 +1439,7 @@ var ze = class {
|
|
|
1406
1439
|
return this.persistenceStrategy = await this.args.hooks?.createAssessmentSessionPersistence?.(this.storageContext, e) ?? await e.createDefaultPersistence(), this.persistenceStrategy;
|
|
1407
1440
|
}
|
|
1408
1441
|
async createDeliveryPlan() {
|
|
1409
|
-
const e = { createDefaultDeliveryPlan: () => ({ sections:
|
|
1442
|
+
const e = { createDefaultDeliveryPlan: () => ({ sections: Be(this.args.assessment) }) }, t = {
|
|
1410
1443
|
assessmentId: this.args.assessmentId,
|
|
1411
1444
|
attemptId: this.args.attemptId,
|
|
1412
1445
|
assessment: this.args.assessment
|
|
@@ -1416,8 +1449,8 @@ var ze = class {
|
|
|
1416
1449
|
ensureSession() {
|
|
1417
1450
|
if (this.session) return this.session;
|
|
1418
1451
|
const e = this.deliveryPlan.sections.map((t) => t.sectionIdentifier);
|
|
1419
|
-
return this.session =
|
|
1420
|
-
assessmentAttemptSessionIdentifier:
|
|
1452
|
+
return this.session = ee({
|
|
1453
|
+
assessmentAttemptSessionIdentifier: Ue({
|
|
1421
1454
|
assessmentId: this.args.assessmentId,
|
|
1422
1455
|
attemptId: this.args.attemptId
|
|
1423
1456
|
}),
|
|
@@ -1450,7 +1483,7 @@ var ze = class {
|
|
|
1450
1483
|
const i = t ?? await e.loadSession(this.storageContext);
|
|
1451
1484
|
this.assertActive(), i && (this.session = i), this.ensureSession(), this.readiness = "ready", i && this.emit({
|
|
1452
1485
|
type: "assessment-session-applied",
|
|
1453
|
-
timestamp:
|
|
1486
|
+
timestamp: w()
|
|
1454
1487
|
}), this.assertActive();
|
|
1455
1488
|
} catch (e) {
|
|
1456
1489
|
throw this.reportFailure(e, "session-load"), e;
|
|
@@ -1512,14 +1545,14 @@ var ze = class {
|
|
|
1512
1545
|
const t = this.buildNavigationSnapshot();
|
|
1513
1546
|
if (e < 0 || e >= t.totalSections) return !1;
|
|
1514
1547
|
const i = t.currentSectionId, n = this.deliveryPlan.sections[e];
|
|
1515
|
-
this.session =
|
|
1548
|
+
this.session = ie(this.ensureSession(), {
|
|
1516
1549
|
currentSectionIndex: e,
|
|
1517
1550
|
currentSectionIdentifier: n?.sectionIdentifier
|
|
1518
1551
|
});
|
|
1519
1552
|
const s = this.buildNavigationSnapshot();
|
|
1520
1553
|
return this.emit({
|
|
1521
1554
|
type: "assessment-route-changed",
|
|
1522
|
-
timestamp:
|
|
1555
|
+
timestamp: w(),
|
|
1523
1556
|
currentSectionIndex: s.currentSectionIndex,
|
|
1524
1557
|
totalSections: s.totalSections,
|
|
1525
1558
|
currentSectionId: s.currentSectionId,
|
|
@@ -1528,10 +1561,10 @@ var ze = class {
|
|
|
1528
1561
|
canPrevious: s.canPrevious
|
|
1529
1562
|
}), this.disposed || (this.emit({
|
|
1530
1563
|
type: "assessment-session-changed",
|
|
1531
|
-
timestamp:
|
|
1564
|
+
timestamp: w()
|
|
1532
1565
|
}), this.disposed) ? !1 : (this.emit({
|
|
1533
1566
|
type: "assessment-progress-changed",
|
|
1534
|
-
timestamp:
|
|
1567
|
+
timestamp: w(),
|
|
1535
1568
|
visitedSectionCount: this.ensureSession().navigationState.visitedSectionIdentifiers.length,
|
|
1536
1569
|
totalSections: s.totalSections
|
|
1537
1570
|
}), !0);
|
|
@@ -1558,7 +1591,7 @@ var ze = class {
|
|
|
1558
1591
|
}
|
|
1559
1592
|
this.disposed || (this.submitted = !0, this.emit({
|
|
1560
1593
|
type: "assessment-submission-state-changed",
|
|
1561
|
-
timestamp:
|
|
1594
|
+
timestamp: w(),
|
|
1562
1595
|
submitted: !0
|
|
1563
1596
|
}));
|
|
1564
1597
|
}
|
|
@@ -1577,12 +1610,12 @@ var ze = class {
|
|
|
1577
1610
|
return this.disposed ? null : this.ensureSession().sectionSessions[e]?.session || null;
|
|
1578
1611
|
}
|
|
1579
1612
|
updateSectionSession(e, t) {
|
|
1580
|
-
this.disposed || (this.session =
|
|
1613
|
+
this.disposed || (this.session = ne(this.ensureSession(), {
|
|
1581
1614
|
sectionIdentifier: e,
|
|
1582
1615
|
sectionSession: t
|
|
1583
1616
|
}), this.emit({
|
|
1584
1617
|
type: "assessment-session-changed",
|
|
1585
|
-
timestamp:
|
|
1618
|
+
timestamp: w()
|
|
1586
1619
|
}));
|
|
1587
1620
|
}
|
|
1588
1621
|
}, g = {
|
|
@@ -1595,7 +1628,7 @@ var ze = class {
|
|
|
1595
1628
|
submissionStateChanged: "assessment-submission-state-changed",
|
|
1596
1629
|
error: "assessment-error"
|
|
1597
1630
|
};
|
|
1598
|
-
function
|
|
1631
|
+
function $e(e) {
|
|
1599
1632
|
const { sectionPlayerRuntime: t, playerType: i, assessmentId: n, env: s, coordinator: o } = e, r = t?.player && typeof t.player == "object" ? {
|
|
1600
1633
|
...t.player,
|
|
1601
1634
|
backend: t.player.backend ? y(t.player.backend) : void 0
|
|
@@ -1609,21 +1642,21 @@ function _e(e) {
|
|
|
1609
1642
|
...r !== void 0 ? { player: r } : {}
|
|
1610
1643
|
};
|
|
1611
1644
|
}
|
|
1612
|
-
function
|
|
1645
|
+
function q(e) {
|
|
1613
1646
|
return !!e && typeof e == "object";
|
|
1614
1647
|
}
|
|
1615
|
-
function
|
|
1648
|
+
function L(e, t) {
|
|
1616
1649
|
if (Object.is(e, t)) return !0;
|
|
1617
1650
|
if (Array.isArray(e) || Array.isArray(t))
|
|
1618
|
-
return !Array.isArray(e) || !Array.isArray(t) || e.length !== t.length ? !1 : e.every((n, s) =>
|
|
1619
|
-
if (!
|
|
1651
|
+
return !Array.isArray(e) || !Array.isArray(t) || e.length !== t.length ? !1 : e.every((n, s) => L(n, t[s]));
|
|
1652
|
+
if (!q(e) || !q(t)) return !1;
|
|
1620
1653
|
const i = /* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)]);
|
|
1621
|
-
for (const n of i) if (!
|
|
1654
|
+
for (const n of i) if (!L(e[n], t[n])) return !1;
|
|
1622
1655
|
return !0;
|
|
1623
1656
|
}
|
|
1624
|
-
var
|
|
1657
|
+
var qe = "pie-section-player-splitpane", Ge = "pie-section-player-vertical", je = class extends HTMLElement {
|
|
1625
1658
|
constructor(...e) {
|
|
1626
|
-
super(...e), this._assessmentId = "", this._attemptId = "", this._locale = "", this._assessment = null, this._env = null, this._coordinator = null, this._hooks = null, this.pendingSession = 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.ownedI18n =
|
|
1659
|
+
super(...e), this._assessmentId = "", this._attemptId = "", this._locale = "", this._assessment = null, this._env = null, this._coordinator = null, this._hooks = null, this.pendingSession = 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.ownedI18n = _e(), this.suppliedI18n = null, this.subscribedI18n = null, 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" };
|
|
1627
1660
|
}
|
|
1628
1661
|
static get observedAttributes() {
|
|
1629
1662
|
return [
|
|
@@ -1668,7 +1701,7 @@ var Ue = "pie-section-player-splitpane", Oe = "pie-section-player-vertical", Be
|
|
|
1668
1701
|
}
|
|
1669
1702
|
set session(e) {
|
|
1670
1703
|
const t = e ?? null;
|
|
1671
|
-
t !== this.pendingSession && (t && this.controller &&
|
|
1704
|
+
t !== this.pendingSession && (t && this.controller && L(t, this.controller.getSession()) || (this.pendingSession = t, this.queueReconciliation()));
|
|
1672
1705
|
}
|
|
1673
1706
|
get locale() {
|
|
1674
1707
|
return this._locale;
|
|
@@ -1714,8 +1747,8 @@ var Ue = "pie-section-player-splitpane", Oe = "pie-section-player-vertical", Be
|
|
|
1714
1747
|
this.unsubscribeI18n && this.subscribedI18n !== e && (this.unsubscribeI18n(), this.unsubscribeI18n = void 0), this.unsubscribeI18n || (this.subscribedI18n = e, this.unsubscribeI18n = e.subscribe?.(() => {
|
|
1715
1748
|
this.isConnected && this.updateNavigationChrome();
|
|
1716
1749
|
})), (this.locale || e === this.ownedI18n) && Promise.resolve(e.setLocale(this.locale || "en-US")).catch((t) => {
|
|
1717
|
-
|
|
1718
|
-
}), this.forwardLocaleToSection(),
|
|
1750
|
+
ze(this, "pie-assessment-player", t);
|
|
1751
|
+
}), this.forwardLocaleToSection(), $(this, e);
|
|
1719
1752
|
}
|
|
1720
1753
|
forwardLocaleToSection() {
|
|
1721
1754
|
const e = this.sectionHost?.firstElementChild;
|
|
@@ -1772,7 +1805,7 @@ var Ue = "pie-section-player-splitpane", Oe = "pie-section-player-vertical", Be
|
|
|
1772
1805
|
return;
|
|
1773
1806
|
}
|
|
1774
1807
|
this.readiness = { phase: "bootstrapping" }, this.renderEmptyState();
|
|
1775
|
-
const e = this.generation, t = this.hooks, i = () => this.isConnected && this.generation === e, n = this.pendingSession, s = new
|
|
1808
|
+
const e = this.generation, t = this.hooks, i = () => this.isConnected && this.generation === e, n = this.pendingSession, s = new He({
|
|
1776
1809
|
assessmentId: this.assessmentId,
|
|
1777
1810
|
attemptId: this.attemptId || void 0,
|
|
1778
1811
|
assessment: this.assessment,
|
|
@@ -1823,17 +1856,17 @@ var Ue = "pie-section-player-splitpane", Oe = "pie-section-player-vertical", Be
|
|
|
1823
1856
|
}
|
|
1824
1857
|
}
|
|
1825
1858
|
resolveInstrumentationProvider() {
|
|
1826
|
-
return
|
|
1859
|
+
return Ae({
|
|
1827
1860
|
runtimePlayer: this.sectionPlayerRuntime?.player,
|
|
1828
1861
|
component: "pie-assessment-player-default"
|
|
1829
1862
|
});
|
|
1830
1863
|
}
|
|
1831
1864
|
attachInstrumentationBridge() {
|
|
1832
|
-
this.detachInstrumentationBridge?.(), this.detachInstrumentationBridge =
|
|
1865
|
+
this.detachInstrumentationBridge?.(), this.detachInstrumentationBridge = ve({
|
|
1833
1866
|
host: this,
|
|
1834
1867
|
instrumentationProvider: this.resolveInstrumentationProvider(),
|
|
1835
1868
|
component: "pie-assessment-player-default",
|
|
1836
|
-
eventMap:
|
|
1869
|
+
eventMap: Ie,
|
|
1837
1870
|
staticAttributes: {
|
|
1838
1871
|
instrumentationLayer: "assessment",
|
|
1839
1872
|
assessmentId: this.assessmentId,
|
|
@@ -1906,10 +1939,10 @@ var Ue = "pie-section-player-splitpane", Oe = "pie-section-player-vertical", Be
|
|
|
1906
1939
|
return;
|
|
1907
1940
|
}
|
|
1908
1941
|
buildSectionPlayerTag() {
|
|
1909
|
-
return this.sectionPlayerLayout === "vertical" ?
|
|
1942
|
+
return this.sectionPlayerLayout === "vertical" ? Ge : qe;
|
|
1910
1943
|
}
|
|
1911
1944
|
buildSectionRuntime() {
|
|
1912
|
-
return
|
|
1945
|
+
return $e({
|
|
1913
1946
|
sectionPlayerRuntime: this.sectionPlayerRuntime,
|
|
1914
1947
|
playerType: this.playerType,
|
|
1915
1948
|
assessmentId: this.assessmentId || void 0,
|
|
@@ -1928,7 +1961,7 @@ var Ue = "pie-section-player-splitpane", Oe = "pie-section-player-vertical", Be
|
|
|
1928
1961
|
try {
|
|
1929
1962
|
i.stop();
|
|
1930
1963
|
} catch (n) {
|
|
1931
|
-
t?.reportFrameworkError?.(
|
|
1964
|
+
t?.reportFrameworkError?.(te({
|
|
1932
1965
|
kind: "tts-init",
|
|
1933
1966
|
source: "AssessmentPlayerDefaultElement.cleanupTtsForSectionNavigation",
|
|
1934
1967
|
error: n,
|
|
@@ -1950,12 +1983,12 @@ var Ue = "pie-section-player-splitpane", Oe = "pie-section-player-vertical", Be
|
|
|
1950
1983
|
let h;
|
|
1951
1984
|
new Promise((c) => {
|
|
1952
1985
|
let p = !1;
|
|
1953
|
-
const u = (
|
|
1954
|
-
p || (p = !0, clearTimeout(m), n.removeEventListener("pie-stage-change", l), c(
|
|
1955
|
-
}, l = (
|
|
1956
|
-
if (
|
|
1957
|
-
const { stage:
|
|
1958
|
-
|
|
1986
|
+
const u = (b) => {
|
|
1987
|
+
p || (p = !0, clearTimeout(m), n.removeEventListener("pie-stage-change", l), c(b));
|
|
1988
|
+
}, l = (b) => {
|
|
1989
|
+
if (b.target !== n) return;
|
|
1990
|
+
const { stage: x, status: X } = b.detail;
|
|
1991
|
+
X === "failed" || x === "disposed" ? u(null) : x === "engine-ready" && u(n.getSectionController?.() || null);
|
|
1959
1992
|
}, m = setTimeout(() => u(null), 5e3);
|
|
1960
1993
|
n.addEventListener("pie-stage-change", l), h = () => u(null);
|
|
1961
1994
|
}).then(async (c) => {
|
|
@@ -2055,7 +2088,7 @@ var Ue = "pie-section-player-splitpane", Oe = "pie-section-player-vertical", Be
|
|
|
2055
2088
|
let h = null, d = null;
|
|
2056
2089
|
{
|
|
2057
2090
|
const u = document.createElement("div");
|
|
2058
|
-
u.className = "pie-assessment-player-navigation", u.hidden = !
|
|
2091
|
+
u.className = "pie-assessment-player-navigation", u.hidden = !R(this.showNavigation, !0);
|
|
2059
2092
|
const l = document.createElement("div");
|
|
2060
2093
|
l.className = "pie-assessment-player-current-position", l.textContent = a;
|
|
2061
2094
|
const m = document.createElement("div");
|
|
@@ -2071,8 +2104,8 @@ var Ue = "pie-section-player-splitpane", Oe = "pie-section-player-vertical", Be
|
|
|
2071
2104
|
if (p) {
|
|
2072
2105
|
const u = this.buildSectionPlayerTag(), l = document.createElement(u);
|
|
2073
2106
|
if (l.setAttribute("section-id", p.sectionIdentifier), this.attemptId && l.setAttribute("attempt-id", this.attemptId), this.locale && l.setAttribute("locale", this.locale), this.debug !== void 0 && this.debug !== null) {
|
|
2074
|
-
const
|
|
2075
|
-
l.setAttribute("debug",
|
|
2107
|
+
const b = typeof this.debug == "boolean" ? String(this.debug) : this.debug;
|
|
2108
|
+
l.setAttribute("debug", b);
|
|
2076
2109
|
}
|
|
2077
2110
|
const m = y(i.getSectionSession(p.sectionIdentifier));
|
|
2078
2111
|
l.section = p.section, m && (l.session = m), l.runtime = this.buildSectionRuntime(), l.hooks = { cardTitleFormatter: this.hooks?.cardTitleFormatter }, c.appendChild(l), this.attachSectionControllerReadyListener(l, p.sectionIdentifier, !!m);
|
|
@@ -2083,12 +2116,12 @@ var Ue = "pie-section-player-splitpane", Oe = "pie-section-player-vertical", Be
|
|
|
2083
2116
|
}), this.announceSectionChange(a));
|
|
2084
2117
|
}
|
|
2085
2118
|
updateNavigationChrome() {
|
|
2086
|
-
|
|
2119
|
+
$(this, this.i18n);
|
|
2087
2120
|
const e = this.selectNavigation(), t = e.totalSections > 0 ? this.i18n.t("player.assessment.sectionPosition", {
|
|
2088
2121
|
position: e.currentIndex + 1,
|
|
2089
2122
|
total: e.totalSections
|
|
2090
2123
|
}) : this.i18n.t("player.assessment.noSections"), i = this.containerRef?.querySelector(".pie-assessment-player-navigation");
|
|
2091
|
-
i && (i.hidden = !
|
|
2124
|
+
i && (i.hidden = !R(this.showNavigation, !0), i.hidden && i.contains(document.activeElement) && this.sectionHost?.focus());
|
|
2092
2125
|
const n = this.containerRef?.querySelector(".pie-assessment-player-current-position");
|
|
2093
2126
|
n && (n.textContent = t);
|
|
2094
2127
|
const s = i?.querySelector('[data-pie-navigation="previous"]'), o = i?.querySelector('[data-pie-navigation="next"]');
|
|
@@ -2198,8 +2231,8 @@ var Ue = "pie-section-player-splitpane", Oe = "pie-section-player-vertical", Be
|
|
|
2198
2231
|
}));
|
|
2199
2232
|
}
|
|
2200
2233
|
};
|
|
2201
|
-
|
|
2202
|
-
var
|
|
2234
|
+
j("pie-assessment-player-default", je, "assessment player default tag");
|
|
2235
|
+
var We = class extends HTMLElement {
|
|
2203
2236
|
static get observedAttributes() {
|
|
2204
2237
|
return ["show-navigation"];
|
|
2205
2238
|
}
|
|
@@ -2219,7 +2252,7 @@ var He = class extends HTMLElement {
|
|
|
2219
2252
|
e === "show-navigation" && (this.showNavigation = i);
|
|
2220
2253
|
}
|
|
2221
2254
|
render() {
|
|
2222
|
-
const e =
|
|
2255
|
+
const e = R(this._showNavigation, !0), t = document.createElement("style");
|
|
2223
2256
|
t.textContent = `
|
|
2224
2257
|
:host {
|
|
2225
2258
|
display: block;
|
|
@@ -2250,7 +2283,7 @@ var He = class extends HTMLElement {
|
|
|
2250
2283
|
n.appendChild(s), i.appendChild(n), this.shadowRoot?.replaceChildren(t, i);
|
|
2251
2284
|
}
|
|
2252
2285
|
};
|
|
2253
|
-
|
|
2286
|
+
j("pie-assessment-player-shell", We, "assessment player shell tag");
|
|
2254
2287
|
export {
|
|
2255
2288
|
g as ASSESSMENT_PLAYER_PUBLIC_EVENTS
|
|
2256
2289
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-players/pie-assessment-player",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Assessment-level coordinator custom elements for orchestrating section-player instances",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,15 +40,15 @@
|
|
|
40
40
|
"lint": "biome lint ."
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@pie-players/pie-assessment-toolkit": "1.0.0-beta.
|
|
44
|
-
"@pie-players/pie-players-shared": "1.0.0-beta.
|
|
45
|
-
"@pie-players/pie-section-player": "1.0.0-beta.
|
|
43
|
+
"@pie-players/pie-assessment-toolkit": "1.0.0-beta.7",
|
|
44
|
+
"@pie-players/pie-players-shared": "1.0.0-beta.7",
|
|
45
|
+
"@pie-players/pie-section-player": "1.0.0-beta.7"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@axe-core/playwright": "^4.14.0",
|
|
49
|
-
"@happy-dom/global-registrator": "^
|
|
49
|
+
"@happy-dom/global-registrator": "^21.0.4",
|
|
50
50
|
"@playwright/test": "^1.64.1",
|
|
51
|
-
"@biomejs/biome": "^2.
|
|
51
|
+
"@biomejs/biome": "^2.6.2",
|
|
52
52
|
"typescript": "^5.9.3",
|
|
53
53
|
"vite": "^8.3.3",
|
|
54
54
|
"vite-plugin-dts": "^5.1.2"
|