@pie-players/pie-assessment-player 0.3.75 → 1.0.0-beta.0

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,13 +1,5 @@
1
1
  import "@pie-players/pie-section-player";
2
- import { coerceBooleanLike as R, defineCustomElementSafely as O } from "@pie-players/pie-players-shared";
3
2
  import { createNewAssessmentSession as Q, frameworkErrorFromUnknown as J, setCurrentSectionPosition as K, upsertSectionSession as Y } from "@pie-players/pie-assessment-toolkit";
4
- var y = (e) => {
5
- if (e === null || typeof e != "object") return e;
6
- if (Array.isArray(e)) return e.map(y);
7
- const t = {};
8
- for (const i in e) Object.hasOwn(e, i) && (t[i] = y(e[i]));
9
- return t;
10
- };
11
3
  function w(e) {
12
4
  "@babel/helpers - typeof";
13
5
  return w = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
@@ -20,8 +12,8 @@ function Z(e, t) {
20
12
  if (w(e) != "object" || !e) return e;
21
13
  var i = e[Symbol.toPrimitive];
22
14
  if (i !== void 0) {
23
- var s = i.call(e, t || "default");
24
- if (w(s) != "object") return s;
15
+ var n = i.call(e, t || "default");
16
+ if (w(n) != "object") return n;
25
17
  throw new TypeError("@@toPrimitive must return a primitive value.");
26
18
  }
27
19
  return (t === "string" ? String : Number)(e);
@@ -38,119 +30,7 @@ function f(e, t, i) {
38
30
  writable: !0
39
31
  }) : e[t] = i, e;
40
32
  }
41
- function H(e, t) {
42
- const i = `[${e}]`;
43
- return {
44
- debug: (s, ...n) => {
45
- t() && console.debug(i, s, ...n);
46
- },
47
- info: (s, ...n) => console.info(i, s, ...n),
48
- warn: (s, ...n) => console.warn(i, s, ...n),
49
- error: (s, ...n) => console.error(i, s, ...n)
50
- };
51
- }
52
- function q() {
53
- return typeof window < "u" && window.PIE_DEBUG === !0;
54
- }
55
- function G(e) {
56
- if (!e || typeof e != "object") return !1;
57
- const t = e;
58
- 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";
59
- }
60
- var ee = H("instrumentation-event-bridge", () => q());
61
- function te(e) {
62
- if (e === null) return !0;
63
- const t = typeof e;
64
- if (t === "function" || t === "symbol") return !1;
65
- if (t !== "object" || Array.isArray(e)) return !0;
66
- const i = Object.getPrototypeOf(e);
67
- return i === Object.prototype || i === null;
68
- }
69
- function ie(e) {
70
- if (e && typeof e == "object") {
71
- const t = {};
72
- for (const [i, s] of Object.entries(e)) te(s) && (t[i] = s);
73
- return t;
74
- }
75
- return typeof e > "u" ? {} : { value: e };
76
- }
77
- function se(e) {
78
- ee.warn(`[InstrumentationEventBridge:${e}] Ignoring invalid instrumentation provider; expected InstrumentationProvider contract`);
79
- }
80
- function ne(e) {
81
- try {
82
- e.provider.trackError(e.error instanceof Error ? e.error : new Error(String(e.error ?? "Unknown instrumentation bridge error")), {
83
- component: e.component,
84
- errorType: "InstrumentationBridgeError",
85
- sourceEventName: e.sourceEventName
86
- });
87
- } catch {
88
- }
89
- }
90
- function oe(e) {
91
- if (!e.host || !e.eventMap.length) return () => {
92
- };
93
- if (!e.instrumentationProvider) return () => {
94
- };
95
- if (!G(e.instrumentationProvider))
96
- return e.debug && se(e.component), () => {
97
- };
98
- const t = e.instrumentationProvider, i = [], s = Math.max(0, e.dedupeWindowMs ?? 0), n = /* @__PURE__ */ new Map(), o = (r, a) => {
99
- const h = [
100
- a.assessmentId,
101
- a.sectionId,
102
- a.attemptId,
103
- a.itemId,
104
- a.canonicalItemId,
105
- a.sourceRuntimeId
106
- ].map((d) => String(d ?? "")).join("|");
107
- return `${r.instrumentationEventName}|${h}`;
108
- };
109
- for (const r of e.eventMap) {
110
- const a = (h) => {
111
- try {
112
- if (!t.isReady() || e.shouldTrackEvent && !e.shouldTrackEvent(h)) return;
113
- const d = ie(h.detail), c = (/* @__PURE__ */ new Date()).toISOString(), p = {
114
- ...d,
115
- ...e.staticAttributes,
116
- component: e.component,
117
- sourceEventName: r.sourceEventName,
118
- timestamp: c
119
- };
120
- if (s > 0) {
121
- const u = Date.now(), l = o(r, p), m = n.get(l);
122
- if (typeof m == "number" && u - m < s) return;
123
- n.set(l, u);
124
- }
125
- t.trackEvent(r.instrumentationEventName, { ...p });
126
- } catch (d) {
127
- ne({
128
- provider: t,
129
- component: e.component,
130
- error: d,
131
- sourceEventName: r.sourceEventName
132
- });
133
- }
134
- };
135
- e.host.addEventListener(r.sourceEventName, a), i.push(() => {
136
- e.host?.removeEventListener(r.sourceEventName, a);
137
- });
138
- }
139
- return () => {
140
- for (const r of i) r();
141
- };
142
- }
143
- function T(e) {
144
- const t = e;
145
- return typeof t?.noticeError == "function" && typeof t.addPageAction == "function";
146
- }
147
- function b() {
148
- if (typeof window > "u") return;
149
- const { newrelic: e, NREUM: t } = window;
150
- if (T(e)) return e;
151
- if (T(t)) return t;
152
- }
153
- var re = class {
33
+ var ee = class {
154
34
  constructor() {
155
35
  f(this, "initialized", !1), f(this, "config", void 0);
156
36
  }
@@ -159,8 +39,8 @@ var re = class {
159
39
  const i = this.transformAttributes(t);
160
40
  try {
161
41
  this.doTrackError(e, i), this.config?.debug && console.log(`[${this.providerName}] Tracked error:`, e, i);
162
- } catch (s) {
163
- console.error(`[${this.providerName}] Error tracking error:`, s);
42
+ } catch (n) {
43
+ console.error(`[${this.providerName}] Error tracking error:`, n);
164
44
  }
165
45
  }
166
46
  trackEvent(e, t) {
@@ -172,8 +52,8 @@ var re = class {
172
52
  });
173
53
  try {
174
54
  this.doTrackEvent(e, i), this.config?.debug && console.log(`[${this.providerName}] Tracked event:`, e, i);
175
- } catch (s) {
176
- console.error(`[${this.providerName}] Error tracking event:`, s);
55
+ } catch (n) {
56
+ console.error(`[${this.providerName}] Error tracking event:`, n);
177
57
  }
178
58
  }
179
59
  trackMetric(e, t, i) {
@@ -214,7 +94,18 @@ var re = class {
214
94
  transformAttributes(e) {
215
95
  return this.config?.attributeTransformer ? this.config.attributeTransformer(e) : e;
216
96
  }
217
- }, ae = class extends re {
97
+ };
98
+ function x(e) {
99
+ const t = e;
100
+ return typeof t?.noticeError == "function" && typeof t.addPageAction == "function";
101
+ }
102
+ function b() {
103
+ if (typeof window > "u") return;
104
+ const { newrelic: e, NREUM: t } = window;
105
+ if (x(e)) return e;
106
+ if (x(t)) return t;
107
+ }
108
+ var te = class extends ee {
218
109
  constructor(...e) {
219
110
  super(...e), f(this, "providerId", "newrelic"), f(this, "providerName", "New Relic");
220
111
  }
@@ -235,13 +126,187 @@ var re = class {
235
126
  }
236
127
  doSetUserContext(e, t) {
237
128
  const i = b();
238
- if (typeof i?.setUserId == "function" && i.setUserId(e), t && typeof i?.setCustomAttribute == "function") for (const [s, n] of Object.entries(t)) i.setCustomAttribute(s, n);
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);
239
130
  }
240
131
  doSetGlobalAttributes(e) {
241
132
  const t = b();
242
- if (typeof t?.setCustomAttribute == "function") for (const [i, s] of Object.entries(e)) t.setCustomAttribute(i, s);
133
+ if (typeof t?.setCustomAttribute == "function") for (const [i, n] of Object.entries(e)) t.setCustomAttribute(i, n);
134
+ }
135
+ };
136
+ function B(e) {
137
+ if (!e || typeof e != "object") return !1;
138
+ const t = e;
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
+ }
141
+ var ie = /* @__PURE__ */ new Set([
142
+ "annotation-xml",
143
+ "color-profile",
144
+ "font-face",
145
+ "font-face-src",
146
+ "font-face-uri",
147
+ "font-face-format",
148
+ "font-face-name",
149
+ "missing-glyph"
150
+ ]), ne = /^[a-z][a-z0-9._-]*-[a-z0-9._-]*$/, se = (e, t = "custom element tag") => {
151
+ if (!e || typeof e != "string") throw new Error(`Invalid ${t}: expected a non-empty string`);
152
+ const i = e.trim();
153
+ if (!i) throw new Error(`Invalid ${t}: tag is empty`);
154
+ if (i !== i.toLowerCase()) throw new Error(`Invalid ${t} "${i}": custom element names must be lowercase`);
155
+ if (!i.includes("-")) throw new Error(`Invalid ${t} "${i}": custom element names must include a hyphen`);
156
+ if (ie.has(i)) throw new Error(`Invalid ${t} "${i}": this name is reserved by the HTML spec`);
157
+ if (!ne.test(i)) throw new Error(`Invalid ${t} "${i}": allowed characters are lowercase letters, numbers, ".", "_" and "-"`);
158
+ return i;
159
+ }, oe = (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", re = (e, t, i = "custom element tag", n = {}) => {
160
+ const s = se(e, i);
161
+ if (customElements.get(s)) return {
162
+ outcome: "already-defined",
163
+ tagName: s
164
+ };
165
+ try {
166
+ return customElements.define(s, t), {
167
+ outcome: "defined",
168
+ tagName: s
169
+ };
170
+ } catch (o) {
171
+ if (!oe(o)) return {
172
+ outcome: "error",
173
+ tagName: s,
174
+ error: o
175
+ };
176
+ if (customElements.get(s)) return {
177
+ outcome: "already-defined",
178
+ tagName: s
179
+ };
180
+ if (!n.allowWrappedFallback) return {
181
+ outcome: "error",
182
+ tagName: s,
183
+ error: o
184
+ };
185
+ try {
186
+ return customElements.define(s, class extends t {
187
+ }), {
188
+ outcome: "defined-wrapped",
189
+ tagName: s
190
+ };
191
+ } catch (r) {
192
+ return {
193
+ outcome: "wrapped-error",
194
+ tagName: s,
195
+ error: r
196
+ };
197
+ }
243
198
  }
199
+ }, H = (e, t, i = "custom element tag") => {
200
+ const n = re(e, t, i);
201
+ if (n.outcome === "error" || n.outcome === "wrapped-error") throw n.error;
202
+ return {
203
+ status: n.outcome === "already-defined" ? "already-defined" : "defined",
204
+ tagName: n.tagName
205
+ };
206
+ }, y = (e) => {
207
+ if (e === null || typeof e != "object") return e;
208
+ if (Array.isArray(e)) return e.map(y);
209
+ const t = {};
210
+ for (const i in e) Object.hasOwn(e, i) && (t[i] = y(e[i]));
211
+ return t;
244
212
  };
213
+ function $(e, t) {
214
+ const i = `[${e}]`;
215
+ return {
216
+ debug: (n, ...s) => {
217
+ t() && console.debug(i, n, ...s);
218
+ },
219
+ info: (n, ...s) => console.info(i, n, ...s),
220
+ warn: (n, ...s) => console.warn(i, n, ...s),
221
+ error: (n, ...s) => console.error(i, n, ...s)
222
+ };
223
+ }
224
+ function q() {
225
+ return typeof window < "u" && window.PIE_DEBUG === !0;
226
+ }
227
+ var ae = $("instrumentation-event-bridge", () => q());
228
+ function le(e) {
229
+ if (e === null) return !0;
230
+ const t = typeof e;
231
+ if (t === "function" || t === "symbol") return !1;
232
+ if (t !== "object" || Array.isArray(e)) return !0;
233
+ const i = Object.getPrototypeOf(e);
234
+ return i === Object.prototype || i === null;
235
+ }
236
+ function ce(e) {
237
+ if (e && typeof e == "object") {
238
+ const t = {};
239
+ for (const [i, n] of Object.entries(e)) le(n) && (t[i] = n);
240
+ return t;
241
+ }
242
+ return typeof e > "u" ? {} : { value: e };
243
+ }
244
+ function de(e) {
245
+ ae.warn(`[InstrumentationEventBridge:${e}] Ignoring invalid instrumentation provider; expected InstrumentationProvider contract`);
246
+ }
247
+ function ue(e) {
248
+ try {
249
+ e.provider.trackError(e.error instanceof Error ? e.error : new Error(String(e.error ?? "Unknown instrumentation bridge error")), {
250
+ component: e.component,
251
+ errorType: "InstrumentationBridgeError",
252
+ sourceEventName: e.sourceEventName
253
+ });
254
+ } catch {
255
+ }
256
+ }
257
+ function he(e) {
258
+ if (!e.host || !e.eventMap.length) return () => {
259
+ };
260
+ if (!e.instrumentationProvider) return () => {
261
+ };
262
+ if (!B(e.instrumentationProvider))
263
+ return e.debug && de(e.component), () => {
264
+ };
265
+ const t = e.instrumentationProvider, i = [], n = Math.max(0, e.dedupeWindowMs ?? 0), s = /* @__PURE__ */ new Map(), o = (r, a) => {
266
+ const h = [
267
+ a.assessmentId,
268
+ a.sectionId,
269
+ a.attemptId,
270
+ a.itemId,
271
+ a.canonicalItemId,
272
+ a.sourceRuntimeId
273
+ ].map((d) => String(d ?? "")).join("|");
274
+ return `${r.instrumentationEventName}|${h}`;
275
+ };
276
+ for (const r of e.eventMap) {
277
+ const a = (h) => {
278
+ try {
279
+ if (!t.isReady() || e.shouldTrackEvent && !e.shouldTrackEvent(h)) return;
280
+ const d = ce(h.detail), c = (/* @__PURE__ */ new Date()).toISOString(), p = {
281
+ ...d,
282
+ ...e.staticAttributes,
283
+ component: e.component,
284
+ sourceEventName: r.sourceEventName,
285
+ timestamp: c
286
+ };
287
+ if (n > 0) {
288
+ const u = Date.now(), l = o(r, p), m = s.get(l);
289
+ if (typeof m == "number" && u - m < n) return;
290
+ s.set(l, u);
291
+ }
292
+ t.trackEvent(r.instrumentationEventName, { ...p });
293
+ } catch (d) {
294
+ ue({
295
+ provider: t,
296
+ component: e.component,
297
+ error: d,
298
+ sourceEventName: r.sourceEventName
299
+ });
300
+ }
301
+ };
302
+ e.host.addEventListener(r.sourceEventName, a), i.push(() => {
303
+ e.host?.removeEventListener(r.sourceEventName, a);
304
+ });
305
+ }
306
+ return () => {
307
+ for (const r of i) r();
308
+ };
309
+ }
245
310
  function L(e) {
246
311
  return e && typeof e == "object" ? e : {};
247
312
  }
@@ -262,25 +327,25 @@ function F(e) {
262
327
  const t = e.trackPageActions;
263
328
  return typeof t == "boolean" ? t : void 0;
264
329
  }
265
- function le(e, t) {
330
+ function pe(e, t) {
266
331
  return e.kind === "value" || e.kind === "null" ? e : t;
267
332
  }
268
- var I, ce = H("instrumentation-provider-resolution", () => q());
269
- function de() {
270
- return I || (I = new ae(), I.initialize()), I;
333
+ var I, me = $("instrumentation-provider-resolution", () => q());
334
+ function ge() {
335
+ return I || (I = new te(), I.initialize()), I;
271
336
  }
272
- function ue(e) {
273
- const t = D(e.runtimePlayer), i = D(e.player), s = F(t), n = F(i), o = s ?? n ?? !1, r = le(M(t), M(i));
337
+ function fe(e) {
338
+ const t = D(e.runtimePlayer), i = D(e.player), n = F(t), s = F(i), o = n ?? s ?? !1, r = pe(M(t), M(i));
274
339
  if (r.kind !== "null") {
275
- if (r.kind === "unset") return o ? de() : void 0;
276
- if (G(r.value)) return r.value;
340
+ if (r.kind === "unset") return o ? ge() : void 0;
341
+ if (B(r.value)) return r.value;
277
342
  if (e.debug) {
278
343
  const a = e.component ? `[${e.component}] ` : "";
279
- ce.warn(`${a}Ignoring invalid instrumentation provider; expected InstrumentationProvider contract`);
344
+ me.warn(`${a}Ignoring invalid instrumentation provider; expected InstrumentationProvider contract`);
280
345
  }
281
346
  }
282
347
  }
283
- var he = [
348
+ var ye = [
284
349
  {
285
350
  sourceEventName: "assessment-controller-ready",
286
351
  instrumentationEventName: "pie-assessment-controller-ready"
@@ -313,32 +378,47 @@ var he = [
313
378
  sourceEventName: "assessment-error",
314
379
  instrumentationEventName: "pie-assessment-error"
315
380
  }
316
- ], pe = { "nl-NL": () => import("./nl-NL-CfezB59b.js") }, me = ["en-US", "nl-NL"];
317
- async function ge(e) {
318
- const t = pe[e];
381
+ ];
382
+ function R(e, t = !1) {
383
+ if (typeof e == "boolean") return e;
384
+ if (e == null) return t;
385
+ const i = String(e).trim().toLowerCase();
386
+ return i === "" ? t : ![
387
+ "false",
388
+ "0",
389
+ "off",
390
+ "no"
391
+ ].includes(i);
392
+ }
393
+ var ve = { "nl-NL": () => import("./nl-NL-DqnT-1mq.js") }, be = ["en-US", "nl-NL"];
394
+ async function Se(e) {
395
+ const t = ve[e];
319
396
  if (!t) throw new Error(`No bundled i18n catalog for locale: ${e}`);
320
397
  return (await t()).default;
321
398
  }
322
399
  function A(e) {
323
400
  return e ? e.trim().replace(/_/g, "-").split(/[.@]/)[0].toLowerCase() : "";
324
401
  }
325
- function fe(e) {
402
+ function E(e) {
403
+ return e ? e.trim().replace(/_/g, "-") : "";
404
+ }
405
+ function we(e) {
326
406
  const t = A(e);
327
407
  if (!t) return [];
328
- const i = t.split("-"), s = [];
329
- for (let n = i.length; n > 0; n--) {
330
- const o = i.slice(0, n);
331
- o.length > 1 && o[o.length - 1].length === 1 || s.push(o.join("-"));
408
+ const i = t.split("-"), n = [];
409
+ for (let s = i.length; s > 0; s--) {
410
+ const o = i.slice(0, s);
411
+ o.length > 1 && o[o.length - 1].length === 1 || n.push(o.join("-"));
332
412
  }
333
- return s;
413
+ return n;
334
414
  }
335
- function ye(e, t) {
336
- for (const i of fe(e)) {
337
- const s = t.find((n) => A(n) === i);
338
- if (s != null) return s;
415
+ function Ae(e, t) {
416
+ for (const i of we(e)) {
417
+ const n = t.find((s) => A(s) === i);
418
+ if (n != null) return n;
339
419
  }
340
420
  }
341
- var ve = {
421
+ var Ie = {
342
422
  common: {
343
423
  close: "Close",
344
424
  cancel: "Cancel",
@@ -646,20 +726,20 @@ var ve = {
646
726
  textToSpeech: {
647
727
  name: "Text to Speech",
648
728
  description: "Read content aloud",
729
+ initFailed: "Unable to initialize text-to-speech. Try again.",
649
730
  inline: {
650
731
  controlsA11y: "Reading controls",
651
732
  playbackSpeedA11y: "Playback speed",
652
733
  rewindA11y: "Rewind",
653
734
  fastForwardA11y: "Fast-forward",
654
735
  stopA11y: "Stop reading",
655
- initializing: "Initializing text-to-speech",
656
- initFailed: "Unable to initialize text-to-speech. Try again.",
657
736
  starting: "Starting reading",
658
737
  started: "Reading started",
659
738
  resumed: "Reading resumed",
660
739
  pausedAnnouncement: "Reading paused",
661
740
  stopped: "Reading stopped",
662
741
  switchedSection: "Reading switched to another section",
742
+ nothingToRead: "Nothing to read aloud here",
663
743
  startFailed: "Unable to start reading",
664
744
  skippedForward: "Skipped forward",
665
745
  skipForwardFailed: "Unable to skip forward",
@@ -739,6 +819,7 @@ var ve = {
739
819
  pnp: {
740
820
  title: "PNP Profile",
741
821
  noAssessmentBound: "No assessment bound",
822
+ noAssessmentBoundBody: "Profile, district and test-administration policy have nothing to read, so only an item's requiredTools can grant an accommodation. Pass the assessment to the toolkit's assessment property, or call updateAssessment(...) on the toolkit coordinator.",
742
823
  determinationReadOnly: "Determination (read-only)",
743
824
  toolsEditor: "Tools Editor",
744
825
  enforcement: "PNP enforcement",
@@ -814,15 +895,42 @@ var ve = {
814
895
  previewEnterText: "Enter preview text before starting playback.",
815
896
  previewUnavailable: "Cannot preview while this service is unavailable.",
816
897
  browserSynthesisUnavailable: "Browser speech synthesis is unavailable.",
817
- browserSynthesisEndedEarly: "Browser speech synthesis ended before audio started. Restart the browser and try again.",
818
- browserSynthesisQueueFailed: "Browser speech synthesis failed to queue preview audio.",
819
- browserPreviewFailed: "Failed to play browser voice preview.",
820
898
  ssmlWordTrackingDisabled: "Google SSML preview preserves authored SSML, so word tracking is disabled.",
821
899
  applyUnavailable: "Cannot apply settings while this service is unavailable.",
822
- coordinatorUnavailable: "Toolkit coordinator is not available for text-to-speech updates."
900
+ coordinatorUnavailable: "Toolkit coordinator is not available for text-to-speech updates.",
901
+ customProviderNotRegistered: "Custom provider '{id}' is not registered.",
902
+ customProviderNoConfig: "Custom provider '{id}' did not return an apply config.",
903
+ httpError: "HTTP {status}: {message}",
904
+ unknownError: "Unknown error",
905
+ previewRequestFailed: "Preview request failed ({status}).",
906
+ notAvailable: "n/a",
907
+ voiceLocal: "local",
908
+ voiceRemote: "remote",
909
+ voiceBrowserDefault: "browser default",
910
+ browserAvailable: {
911
+ one: "Browser TTS available ({count} voice detected).",
912
+ other: "Browser TTS available ({count} voices detected)."
913
+ },
914
+ pollyAvailable: {
915
+ one: "AWS Polly available ({count} matching voice, {engine} engine).",
916
+ other: "AWS Polly available ({count} matching voices, {engine} engine)."
917
+ },
918
+ googleAvailable: {
919
+ one: "Google Cloud TTS available ({count} matching voice).",
920
+ other: "Google Cloud TTS available ({count} matching voices)."
921
+ },
922
+ headerRowReservation: "Item header row reservation: {state}",
923
+ speedOptionsHelp: "Comma or semicolon-separated multipliers. Include 1 for Normal; leave empty to hide speed controls.",
924
+ usingSelectedVoice: "Using selected voice: {voice}",
925
+ autoVoice: "Best available voice (auto): {voice}",
926
+ autoVoiceWaiting: "Best available voice (auto): waiting for browser voices.",
927
+ previewHintBrowserSsml: "SSML is unsupported in Browser preview.",
928
+ previewHintGoogleSsml: "SSML preserved. Tracking disabled.",
929
+ previewHintCustom: "Tracking enabled when provider returns speech marks.",
930
+ previewHintTracking: "Tracking enabled while preview plays."
823
931
  }
824
932
  }
825
- }, k = "en-US", be = /* @__PURE__ */ new Set([
933
+ }, k = "en-US", Ee = /* @__PURE__ */ new Set([
826
934
  "ar",
827
935
  "ckb",
828
936
  "dv",
@@ -838,7 +946,7 @@ var ve = {
838
946
  "ug",
839
947
  "ur",
840
948
  "yi"
841
- ]), Se = /* @__PURE__ */ new Set([
949
+ ]), Pe = /* @__PURE__ */ new Set([
842
950
  "zero",
843
951
  "one",
844
952
  "two",
@@ -849,7 +957,7 @@ var ve = {
849
957
  function _(e) {
850
958
  if (typeof e != "object" || e === null) return !1;
851
959
  const t = Object.keys(e);
852
- return t.length > 0 && t.every((i) => Se.has(i));
960
+ return t.length > 0 && t.every((i) => Pe.has(i));
853
961
  }
854
962
  function z(e) {
855
963
  try {
@@ -858,17 +966,17 @@ function z(e) {
858
966
  } catch {
859
967
  }
860
968
  const t = A(e).split("-")[0] ?? "";
861
- return be.has(t) ? "rtl" : "ltr";
969
+ return Ee.has(t) ? "rtl" : "ltr";
862
970
  }
863
- var $ = class E {
971
+ var G = class C {
864
972
  constructor(t = {}) {
865
- 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, "listeners", /* @__PURE__ */ new Set()), f(this, "config", void 0), this.config = { ...t }, this.fallbackLocale = P(t.fallbackLocale) || "en-US", this.catalogs = /* @__PURE__ */ new Map([[k, ve]]), this.customMessages = { ...t.customMessages ?? {} }, this.loading = /* @__PURE__ */ new Map(), this.locale = this.resolveLocaleTag(t.locale) ?? "en-US";
973
+ 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, "listeners", /* @__PURE__ */ new Set()), f(this, "config", void 0), this.config = { ...t }, this.fallbackLocale = E(t.fallbackLocale) || "en-US", this.catalogs = /* @__PURE__ */ new Map([[k, Ie]]), this.customMessages = { ...t.customMessages ?? {} }, this.loading = /* @__PURE__ */ new Map(), this.locale = this.resolveLocaleTag(t.locale) ?? "en-US";
866
974
  }
867
975
  async initialize(t) {
868
976
  if (this.config = {
869
977
  ...this.config,
870
978
  ...t
871
- }, t.customMessages) for (const [i, s] of Object.entries(t.customMessages)) this.addCustomMessages(i, s);
979
+ }, t.customMessages) for (const [i, n] of Object.entries(t.customMessages)) this.addCustomMessages(i, n);
872
980
  await this.setLocale(t.locale ?? this.locale);
873
981
  }
874
982
  getLocale() {
@@ -877,17 +985,17 @@ var $ = class E {
877
985
  async setLocale(t) {
878
986
  const i = this.resolveLocaleTag(t);
879
987
  if (!i) {
880
- this.locale = P(t) || "en-US", this.notify();
988
+ this.locale = E(t) || "en-US", this.notify();
881
989
  return;
882
990
  }
883
- if (!this.catalogs.has(i)) {
884
- const s = this.loading.get(i);
885
- if (s) await s;
991
+ if (!this.catalogs.has(i) && this.config.availableLocales?.includes(i)) {
992
+ const n = this.loading.get(i);
993
+ if (n) await n;
886
994
  else {
887
- const n = this.loadCatalog(i);
888
- this.loading.set(i, n);
995
+ const s = this.loadCatalog(i);
996
+ this.loading.set(i, s);
889
997
  try {
890
- await n;
998
+ await s;
891
999
  } finally {
892
1000
  this.loading.delete(i);
893
1001
  }
@@ -896,12 +1004,12 @@ var $ = class E {
896
1004
  this.locale = i, this.notify();
897
1005
  }
898
1006
  t(t, i) {
899
- const s = this.lookup(t);
900
- return s === void 0 ? (this.config.onMissingKey?.(t, this.locale), t) : U(s, i);
1007
+ const n = this.lookup(t);
1008
+ return n === void 0 ? (this.config.onMissingKey?.(t, this.locale), t) : U(n, i);
901
1009
  }
902
1010
  plural(t, i) {
903
- const s = this.lookupNode(t);
904
- return s === void 0 || !_(s) ? this.t(t, i) : U(s[this.selectPluralCategory(i.count)] ?? s.other, i);
1011
+ const n = this.lookupNode(t);
1012
+ return n === void 0 || !_(n) ? this.t(t, i) : U(n[this.selectPluralCategory(i.count)] ?? n.other, i);
905
1013
  }
906
1014
  getDirection() {
907
1015
  return z(this.locale);
@@ -926,17 +1034,17 @@ var $ = class E {
926
1034
  return this.lookup(t) !== void 0;
927
1035
  }
928
1036
  addCustomMessages(t, i) {
929
- const s = P(t);
930
- this.customMessages[s] = j(this.customMessages[s] ?? {}, i), this.notify();
1037
+ const n = E(t);
1038
+ this.customMessages[n] = j(this.customMessages[n] ?? {}, i), this.notify();
931
1039
  }
932
1040
  withLocale(t) {
933
- const i = this.resolveLocaleTag(t) ?? P(t);
1041
+ const i = this.resolveLocaleTag(t) ?? E(t);
934
1042
  if (i === this.locale) return this;
935
- const s = new E({
1043
+ const n = new C({
936
1044
  ...this.config,
937
1045
  locale: i
938
1046
  });
939
- return s.locale = i || "en-US", s.catalogs = this.catalogs, s.customMessages = this.customMessages, s.loading = this.loading, s;
1047
+ return n.locale = i || "en-US", n.catalogs = this.catalogs, n.customMessages = this.customMessages, n.loading = this.loading, n;
940
1048
  }
941
1049
  formatNumber(t, i) {
942
1050
  try {
@@ -955,29 +1063,29 @@ var $ = class E {
955
1063
  getBundle(t = this.locale) {
956
1064
  const i = this.resolveLocaleTag(t);
957
1065
  if (!i) return;
958
- const s = this.catalogs.get(i);
959
- if (s)
1066
+ const n = this.catalogs.get(i);
1067
+ if (n)
960
1068
  return {
961
1069
  locale: i,
962
- translations: s,
1070
+ translations: n,
963
1071
  direction: z(i)
964
1072
  };
965
1073
  }
966
1074
  resolveLocaleTag(t) {
967
1075
  if (!t) return;
968
- const i = this.getAvailableLocales(), s = ye(t, i);
969
- if (s) return s;
970
- const n = A(t).split("-")[0];
971
- if (n)
972
- return i.find((o) => A(o).split("-")[0] === n);
1076
+ const i = this.getAvailableLocales(), n = Ae(t, i);
1077
+ if (n) return n;
1078
+ const s = A(t).split("-")[0];
1079
+ if (s)
1080
+ return i.find((o) => A(o).split("-")[0] === s);
973
1081
  }
974
1082
  async loadCatalog(t) {
975
1083
  const i = this.config.loadCatalog;
976
1084
  if (i)
977
1085
  try {
978
1086
  this.catalogs.set(t, await i(t));
979
- } catch (s) {
980
- throw new Error(`Failed to load i18n catalog for locale: ${t}`, { cause: s });
1087
+ } catch (n) {
1088
+ throw new Error(`Failed to load i18n catalog for locale: ${t}`, { cause: n });
981
1089
  }
982
1090
  }
983
1091
  lookupNode(t) {
@@ -987,9 +1095,9 @@ var $ = class E {
987
1095
  this.customMessages[this.fallbackLocale],
988
1096
  this.catalogs.get(this.fallbackLocale)
989
1097
  ];
990
- for (const s of i) {
991
- const n = we(s, t);
992
- if (n !== void 0) return n;
1098
+ for (const n of i) {
1099
+ const s = Ce(n, t);
1100
+ if (s !== void 0) return s;
993
1101
  }
994
1102
  }
995
1103
  lookup(t) {
@@ -998,14 +1106,14 @@ var $ = class E {
998
1106
  if (i !== void 0 && _(i)) return i.other;
999
1107
  }
1000
1108
  selectPluralCategory(t) {
1001
- let i = E.pluralRules.get(this.locale);
1109
+ let i = C.pluralRules.get(this.locale);
1002
1110
  if (!i) {
1003
1111
  try {
1004
1112
  i = new Intl.PluralRules(this.locale);
1005
1113
  } catch {
1006
1114
  return t === 1 ? "one" : "other";
1007
1115
  }
1008
- E.pluralRules.set(this.locale, i);
1116
+ C.pluralRules.set(this.locale, i);
1009
1117
  }
1010
1118
  return i.select(t);
1011
1119
  }
@@ -1013,48 +1121,45 @@ var $ = class E {
1013
1121
  for (const t of this.listeners) t();
1014
1122
  }
1015
1123
  };
1016
- f($, "pluralRules", /* @__PURE__ */ new Map());
1017
- function P(e) {
1018
- return e ? e.trim().replace(/_/g, "-") : "";
1019
- }
1020
- function we(e, t) {
1124
+ f(G, "pluralRules", /* @__PURE__ */ new Map());
1125
+ function Ce(e, t) {
1021
1126
  if (!e) return;
1022
1127
  let i = e;
1023
- for (const s of t.split("."))
1024
- if (typeof i != "object" || i === null || (i = i[s], i === void 0)) return;
1128
+ for (const n of t.split("."))
1129
+ if (typeof i != "object" || i === null || (i = i[n], i === void 0)) return;
1025
1130
  return i;
1026
1131
  }
1027
1132
  function U(e, t) {
1028
- return t ? e.replace(/\{(\w+)\}/g, (i, s) => {
1029
- const n = t[s];
1030
- return n == null ? i : String(n);
1133
+ return t ? e.replace(/\{(\w+)\}/g, (i, n) => {
1134
+ const s = t[n];
1135
+ return s == null ? i : String(s);
1031
1136
  }) : e;
1032
1137
  }
1033
1138
  function j(e, t) {
1034
1139
  const i = { ...e };
1035
- for (const [s, n] of Object.entries(t)) {
1036
- const o = i[s];
1037
- n && typeof n == "object" && o && typeof o == "object" ? i[s] = j(o, n) : i[s] = n;
1140
+ for (const [n, s] of Object.entries(t)) {
1141
+ const o = i[n];
1142
+ s && typeof s == "object" && o && typeof o == "object" ? i[n] = j(o, s) : i[n] = s;
1038
1143
  }
1039
1144
  return i;
1040
1145
  }
1041
- function Ae(e = {}) {
1042
- return new $({
1043
- loadCatalog: ge,
1044
- availableLocales: me,
1146
+ function ke(e = {}) {
1147
+ return new G({
1148
+ loadCatalog: Se,
1149
+ availableLocales: be,
1045
1150
  ...e
1046
1151
  });
1047
1152
  }
1048
1153
  function S() {
1049
1154
  return Date.now();
1050
1155
  }
1051
- function C(e) {
1156
+ function P(e) {
1052
1157
  return e.replace(/[^a-zA-Z0-9_-]/g, "-");
1053
1158
  }
1054
- function Ie(e) {
1055
- if (e.attemptId) return `aas_v1_${C(e.assessmentId)}_${C(e.attemptId)}`;
1056
- const t = W(), i = t ? Pe(t) : "anon";
1057
- return `aas_v1_${C(e.assessmentId)}_${C(i)}`;
1159
+ function Re(e) {
1160
+ if (e.attemptId) return `aas_v1_${P(e.assessmentId)}_${P(e.attemptId)}`;
1161
+ const t = W(), i = t ? Ne(t) : "anon";
1162
+ return `aas_v1_${P(e.assessmentId)}_${P(i)}`;
1058
1163
  }
1059
1164
  function W() {
1060
1165
  try {
@@ -1063,36 +1168,36 @@ function W() {
1063
1168
  return null;
1064
1169
  }
1065
1170
  }
1066
- function Pe(e) {
1171
+ function Ne(e) {
1067
1172
  const t = "pie:assessment-player:anonymous-device-id", i = e.getItem(t);
1068
1173
  if (i) return i;
1069
- const s = `anon-${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;
1070
- return e.setItem(t, s), s;
1174
+ const n = `anon-${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`;
1175
+ return e.setItem(t, n), n;
1071
1176
  }
1072
- function Ce(e) {
1177
+ function Te(e) {
1073
1178
  if (!e) return [];
1074
1179
  const t = [], i = e.testParts || [];
1075
- return i.length > 0 ? (i.forEach((s, n) => {
1076
- (s.sections || []).forEach((o, r) => {
1180
+ return i.length > 0 ? (i.forEach((n, s) => {
1181
+ (n.sections || []).forEach((o, r) => {
1077
1182
  t.push({
1078
- stageIdentifier: s.identifier,
1079
- stageIndex: n,
1183
+ stageIdentifier: n.identifier,
1184
+ stageIndex: s,
1080
1185
  sectionIndex: t.length,
1081
- sectionIdentifier: o.identifier || `section-${n}-${r}`,
1186
+ sectionIdentifier: o.identifier || `section-${s}-${r}`,
1082
1187
  section: o
1083
1188
  });
1084
1189
  });
1085
- }), t) : ((e.sections || []).forEach((s, n) => {
1190
+ }), t) : ((e.sections || []).forEach((n, s) => {
1086
1191
  t.push({
1087
1192
  stageIdentifier: "default",
1088
1193
  stageIndex: 0,
1089
- sectionIndex: n,
1090
- sectionIdentifier: s.identifier || `section-${n}`,
1091
- section: s
1194
+ sectionIndex: s,
1195
+ sectionIdentifier: n.identifier || `section-${s}`,
1196
+ section: n
1092
1197
  });
1093
1198
  }), t);
1094
1199
  }
1095
- var Ee = class {
1200
+ var xe = class {
1096
1201
  constructor(e) {
1097
1202
  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 = {
1098
1203
  assessmentId: e.assessmentId,
@@ -1109,20 +1214,27 @@ var Ee = class {
1109
1214
  throw e.name = "AbortError", e;
1110
1215
  }
1111
1216
  handleError(e, t, i) {
1112
- const s = e instanceof Error ? e : new Error(String(e));
1113
- this.args.hooks?.onError?.(s, {
1217
+ const n = e instanceof Error ? e : new Error(String(e));
1218
+ this.args.hooks?.onError?.(n, {
1114
1219
  phase: t,
1115
1220
  details: i
1116
1221
  });
1117
1222
  }
1223
+ reportFailure(e, t) {
1224
+ try {
1225
+ this.disposed || (this.readiness = "error", t && this.handleError(e, t));
1226
+ } catch (i) {
1227
+ console.error("Assessment error hook failed", i);
1228
+ }
1229
+ }
1118
1230
  async getPersistenceStrategy() {
1119
1231
  if (this.persistenceStrategy) return this.persistenceStrategy;
1120
1232
  const e = { createDefaultPersistence: () => {
1121
- const t = W(), { assessmentId: i, attemptId: s } = this.storageContext, n = s ? `pie:assessment-controller:v1:${i}:${s}` : null;
1233
+ const t = W(), { assessmentId: i, attemptId: n } = this.storageContext, s = n ? `pie:assessment-controller:v1:${i}:${n}` : null;
1122
1234
  return {
1123
1235
  async loadSession() {
1124
- if (!t || !n) return null;
1125
- const o = t.getItem(n);
1236
+ if (!t || !s) return null;
1237
+ const o = t.getItem(s);
1126
1238
  if (!o) return null;
1127
1239
  try {
1128
1240
  return JSON.parse(o);
@@ -1131,17 +1243,17 @@ var Ee = class {
1131
1243
  }
1132
1244
  },
1133
1245
  async saveSession(o, r) {
1134
- !t || !n || t.setItem(n, JSON.stringify(r));
1246
+ !t || !s || t.setItem(s, JSON.stringify(r));
1135
1247
  },
1136
1248
  async clearSession() {
1137
- !t || !n || t.removeItem(n);
1249
+ !t || !s || t.removeItem(s);
1138
1250
  }
1139
1251
  };
1140
1252
  } };
1141
1253
  return this.persistenceStrategy = await this.args.hooks?.createAssessmentSessionPersistence?.(this.storageContext, e) ?? await e.createDefaultPersistence(), this.persistenceStrategy;
1142
1254
  }
1143
1255
  async createDeliveryPlan() {
1144
- const e = { createDefaultDeliveryPlan: () => ({ sections: Ce(this.args.assessment) }) }, t = {
1256
+ const e = { createDefaultDeliveryPlan: () => ({ sections: Te(this.args.assessment) }) }, t = {
1145
1257
  assessmentId: this.args.assessmentId,
1146
1258
  attemptId: this.args.attemptId,
1147
1259
  assessment: this.args.assessment
@@ -1152,7 +1264,7 @@ var Ee = class {
1152
1264
  if (this.session) return this.session;
1153
1265
  const e = this.deliveryPlan.sections.map((t) => t.sectionIdentifier);
1154
1266
  return this.session = Q({
1155
- assessmentAttemptSessionIdentifier: Ie({
1267
+ assessmentAttemptSessionIdentifier: Re({
1156
1268
  assessmentId: this.args.assessmentId,
1157
1269
  attemptId: this.args.attemptId
1158
1270
  }),
@@ -1171,12 +1283,7 @@ var Ee = class {
1171
1283
  const t = await this.createDeliveryPlan();
1172
1284
  this.assertActive(), this.deliveryPlan = t, this.ensureSession(), e = null, await this.hydrate(), this.assertActive(), this.readiness = "ready";
1173
1285
  } catch (t) {
1174
- try {
1175
- this.disposed || (this.readiness = "error", e && this.handleError(t, e));
1176
- } catch (i) {
1177
- console.error("Assessment error hook failed", i);
1178
- }
1179
- throw t;
1286
+ throw this.reportFailure(t, e), t;
1180
1287
  }
1181
1288
  }
1182
1289
  async hydrate() {
@@ -1193,12 +1300,7 @@ var Ee = class {
1193
1300
  timestamp: S()
1194
1301
  }), this.assertActive();
1195
1302
  } catch (e) {
1196
- try {
1197
- this.disposed || (this.readiness = "error", this.handleError(e, "session-load"));
1198
- } catch (t) {
1199
- console.error("Assessment error hook failed", t);
1200
- }
1201
- throw e;
1303
+ throw this.reportFailure(e, "session-load"), e;
1202
1304
  }
1203
1305
  }
1204
1306
  dispose() {
@@ -1256,21 +1358,21 @@ var Ee = class {
1256
1358
  if (this.disposed) return !1;
1257
1359
  const t = this.buildNavigationSnapshot();
1258
1360
  if (e < 0 || e >= t.totalSections) return !1;
1259
- const i = t.currentSectionId, s = this.deliveryPlan.sections[e];
1361
+ const i = t.currentSectionId, n = this.deliveryPlan.sections[e];
1260
1362
  this.session = K(this.ensureSession(), {
1261
1363
  currentSectionIndex: e,
1262
- currentSectionIdentifier: s?.sectionIdentifier
1364
+ currentSectionIdentifier: n?.sectionIdentifier
1263
1365
  });
1264
- const n = this.buildNavigationSnapshot();
1366
+ const s = this.buildNavigationSnapshot();
1265
1367
  return this.emit({
1266
1368
  type: "assessment-route-changed",
1267
1369
  timestamp: S(),
1268
- currentSectionIndex: n.currentSectionIndex,
1269
- totalSections: n.totalSections,
1270
- currentSectionId: n.currentSectionId,
1370
+ currentSectionIndex: s.currentSectionIndex,
1371
+ totalSections: s.totalSections,
1372
+ currentSectionId: s.currentSectionId,
1271
1373
  previousSectionId: i,
1272
- canNext: n.canNext,
1273
- canPrevious: n.canPrevious
1374
+ canNext: s.canNext,
1375
+ canPrevious: s.canPrevious
1274
1376
  }), this.disposed || (this.emit({
1275
1377
  type: "assessment-session-changed",
1276
1378
  timestamp: S()
@@ -1278,7 +1380,7 @@ var Ee = class {
1278
1380
  type: "assessment-progress-changed",
1279
1381
  timestamp: S(),
1280
1382
  visitedSectionCount: this.ensureSession().navigationState.visitedSectionIdentifiers.length,
1281
- totalSections: n.totalSections
1383
+ totalSections: s.totalSections
1282
1384
  }), !0);
1283
1385
  }
1284
1386
  navigateTo(e) {
@@ -1340,44 +1442,35 @@ var Ee = class {
1340
1442
  submissionStateChanged: "assessment-submission-state-changed",
1341
1443
  error: "assessment-error"
1342
1444
  };
1343
- function ke(e, t) {
1344
- return !e?.delivery || e.delivery.enabled === !1 || !t || e.delivery.assignmentId !== void 0 ? e : {
1345
- ...e,
1346
- delivery: {
1347
- ...e.delivery,
1348
- assignmentId: t
1349
- }
1350
- };
1351
- }
1352
- function Re(e) {
1353
- const { sectionPlayerRuntime: t, playerType: i, assessmentId: s, attemptId: n, env: o, coordinator: r } = e, a = t?.player && typeof t.player == "object" ? {
1445
+ function Le(e) {
1446
+ const { sectionPlayerRuntime: t, playerType: i, assessmentId: n, env: s, coordinator: o } = e, r = t?.player && typeof t.player == "object" ? {
1354
1447
  ...t.player,
1355
- backend: ke(t.player.backend ? y(t.player.backend) : void 0, n)
1448
+ backend: t.player.backend ? y(t.player.backend) : void 0
1356
1449
  } : t?.player;
1357
1450
  return {
1358
1451
  playerType: i,
1359
- ...s ? { assessmentId: s } : {},
1360
- ...o ? { env: o } : {},
1361
- ...r ? { coordinator: r } : {},
1452
+ ...n ? { assessmentId: n } : {},
1453
+ ...s ? { env: s } : {},
1454
+ ...o ? { coordinator: o } : {},
1362
1455
  ...t || {},
1363
- ...a !== void 0 ? { player: a } : {}
1456
+ ...r !== void 0 ? { player: r } : {}
1364
1457
  };
1365
1458
  }
1366
- function B(e) {
1459
+ function O(e) {
1367
1460
  return !!e && typeof e == "object";
1368
1461
  }
1369
1462
  function N(e, t) {
1370
1463
  if (Object.is(e, t)) return !0;
1371
1464
  if (Array.isArray(e) || Array.isArray(t))
1372
- return !Array.isArray(e) || !Array.isArray(t) || e.length !== t.length ? !1 : e.every((s, n) => N(s, t[n]));
1373
- if (!B(e) || !B(t)) return !1;
1465
+ return !Array.isArray(e) || !Array.isArray(t) || e.length !== t.length ? !1 : e.every((n, s) => N(n, t[s]));
1466
+ if (!O(e) || !O(t)) return !1;
1374
1467
  const i = /* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)]);
1375
- for (const s of i) if (!N(e[s], t[s])) return !1;
1468
+ for (const n of i) if (!N(e[n], t[n])) return !1;
1376
1469
  return !0;
1377
1470
  }
1378
- var Ne = "pie-section-player-splitpane", xe = "pie-section-player-vertical", Te = class extends HTMLElement {
1471
+ var De = "pie-section-player-splitpane", Me = "pie-section-player-vertical", Fe = class extends HTMLElement {
1379
1472
  constructor(...e) {
1380
- 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.i18n = Ae(), 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" };
1473
+ 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.i18n = ke(), 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" };
1381
1474
  }
1382
1475
  static get observedAttributes() {
1383
1476
  return [
@@ -1520,11 +1613,11 @@ var Ne = "pie-section-player-splitpane", xe = "pie-section-player-vertical", Te
1520
1613
  return;
1521
1614
  }
1522
1615
  this.readiness = { phase: "bootstrapping" }, this.renderEmptyState();
1523
- const e = this.generation, t = this.hooks, i = () => this.isConnected && this.generation === e, s = this.pendingSession, n = new Ee({
1616
+ const e = this.generation, t = this.hooks, i = () => this.isConnected && this.generation === e, n = this.pendingSession, s = new xe({
1524
1617
  assessmentId: this.assessmentId,
1525
1618
  attemptId: this.attemptId || void 0,
1526
1619
  assessment: this.assessment,
1527
- initialSession: s,
1620
+ initialSession: n,
1528
1621
  hooks: {
1529
1622
  ...t,
1530
1623
  onError: (o, r) => {
@@ -1532,12 +1625,12 @@ var Ne = "pie-section-player-splitpane", xe = "pie-section-player-vertical", Te
1532
1625
  try {
1533
1626
  t?.onError?.(o, r);
1534
1627
  } finally {
1535
- i() && r.phase === "session-load" && this.controller === n && (this.retireController(), this.readiness = { phase: "error" }, this.renderEmptyState(), this.dispatch(g.error, { error: o }));
1628
+ i() && r.phase === "session-load" && this.controller === s && (this.retireController(), this.readiness = { phase: "error" }, this.renderEmptyState(), this.dispatch(g.error, { error: o }));
1536
1629
  }
1537
1630
  }
1538
1631
  }
1539
1632
  });
1540
- this.initializingController = n, this.unsubscribeController = n.subscribe((o) => {
1633
+ this.initializingController = s, this.unsubscribeController = s.subscribe((o) => {
1541
1634
  if (i()) {
1542
1635
  if (o.type === "assessment-route-changed") {
1543
1636
  if (this.syncCurrentSectionSessionIntoAssessment(), !i() || (this.cleanupTtsForSectionNavigation(o), !i()) || (this.dispatch(g.routeChanged, o), !i())) return;
@@ -1547,8 +1640,8 @@ var Ne = "pie-section-player-splitpane", xe = "pie-section-player-vertical", Te
1547
1640
  }
1548
1641
  });
1549
1642
  try {
1550
- if (await n.initialize(), !i()) return;
1551
- this.pendingSession === s && (this.pendingSession = null), this.initializingController = null, this.controller = n, this.readiness = { phase: "ready" }, this.render(), this.settleControllerWaiters(n);
1643
+ if (await s.initialize(), !i()) return;
1644
+ this.pendingSession === n && (this.pendingSession = null), this.initializingController = null, this.controller = s, this.readiness = { phase: "ready" }, this.render(), this.settleControllerWaiters(s);
1552
1645
  const o = (r) => {
1553
1646
  if (i()) {
1554
1647
  try {
@@ -1560,28 +1653,28 @@ var Ne = "pie-section-player-splitpane", xe = "pie-section-player-vertical", Te
1560
1653
  }
1561
1654
  };
1562
1655
  try {
1563
- Promise.resolve(t?.onAssessmentControllerReady?.(n)).catch(o);
1656
+ Promise.resolve(t?.onAssessmentControllerReady?.(s)).catch(o);
1564
1657
  } catch (r) {
1565
1658
  o(r);
1566
1659
  }
1567
- i() && this.dispatch(g.controllerReady, { controller: n });
1660
+ i() && this.dispatch(g.controllerReady, { controller: s });
1568
1661
  } catch (o) {
1569
1662
  if (!i()) return;
1570
1663
  this.retireController(), this.readiness = { phase: "error" }, this.renderEmptyState(), this.dispatch(g.error, { error: o });
1571
1664
  }
1572
1665
  }
1573
1666
  resolveInstrumentationProvider() {
1574
- return ue({
1667
+ return fe({
1575
1668
  runtimePlayer: this.sectionPlayerRuntime?.player,
1576
1669
  component: "pie-assessment-player-default"
1577
1670
  });
1578
1671
  }
1579
1672
  attachInstrumentationBridge() {
1580
- this.detachInstrumentationBridge?.(), this.detachInstrumentationBridge = oe({
1673
+ this.detachInstrumentationBridge?.(), this.detachInstrumentationBridge = he({
1581
1674
  host: this,
1582
1675
  instrumentationProvider: this.resolveInstrumentationProvider(),
1583
1676
  component: "pie-assessment-player-default",
1584
- eventMap: he,
1677
+ eventMap: ye,
1585
1678
  staticAttributes: {
1586
1679
  instrumentationLayer: "assessment",
1587
1680
  assessmentId: this.assessmentId,
@@ -1597,8 +1690,8 @@ var Ne = "pie-section-player-splitpane", xe = "pie-section-player-vertical", Te
1597
1690
  createStatusContent(e, t) {
1598
1691
  const i = document.createElement("div");
1599
1692
  i.className = "pie-assessment-player-empty", i.tabIndex = -1;
1600
- const s = document.createElement("style");
1601
- s.textContent = `
1693
+ const n = document.createElement("style");
1694
+ n.textContent = `
1602
1695
  .pie-assessment-player-empty { display: grid; justify-items: start; gap: 0.75rem; padding: 1rem; }
1603
1696
  .pie-assessment-player-status-message { margin: 0; }
1604
1697
  .pie-assessment-player-retry {
@@ -1618,9 +1711,9 @@ var Ne = "pie-section-player-splitpane", xe = "pie-section-player-vertical", Te
1618
1711
  outline: 2px solid var(--pie-button-focus-outline, var(--pie-primary, #0066cc));
1619
1712
  outline-offset: 2px;
1620
1713
  }
1621
- `, i.appendChild(s);
1622
- const n = document.createElement("p");
1623
- 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) {
1714
+ `, i.appendChild(n);
1715
+ const s = document.createElement("p");
1716
+ if (s.className = "pie-assessment-player-status-message", s.setAttribute("role", t ? "alert" : "status"), s.dataset.pieMessageKey = e, s.textContent = this.i18n.t(e), i.appendChild(s), t) {
1624
1717
  const o = document.createElement("button");
1625
1718
  o.type = "button", o.className = "pie-assessment-player-retry", o.textContent = this.i18n.t("common.retry"), o.addEventListener("click", t), i.appendChild(o);
1626
1719
  }
@@ -1649,19 +1742,18 @@ var Ne = "pie-section-player-splitpane", xe = "pie-section-player-vertical", Te
1649
1742
  t.next,
1650
1743
  this.sectionHost
1651
1744
  ];
1652
- for (const s of i)
1653
- if (s && !(s instanceof HTMLButtonElement && s.disabled) && (s.focus(), document.activeElement === s))
1745
+ for (const n of i)
1746
+ if (n && !(n instanceof HTMLButtonElement && n.disabled) && (n.focus(), document.activeElement === n))
1654
1747
  return;
1655
1748
  }
1656
1749
  buildSectionPlayerTag() {
1657
- return this.sectionPlayerLayout === "vertical" ? xe : Ne;
1750
+ return this.sectionPlayerLayout === "vertical" ? Me : De;
1658
1751
  }
1659
1752
  buildSectionRuntime() {
1660
- return Re({
1753
+ return Le({
1661
1754
  sectionPlayerRuntime: this.sectionPlayerRuntime,
1662
1755
  playerType: this.playerType,
1663
1756
  assessmentId: this.assessmentId || void 0,
1664
- attemptId: this.attemptId || void 0,
1665
1757
  env: this.env,
1666
1758
  coordinator: this.coordinator
1667
1759
  });
@@ -1673,25 +1765,17 @@ var Ne = "pie-section-player-splitpane", xe = "pie-section-player-vertical", Te
1673
1765
  cleanupTtsForSectionNavigation(e) {
1674
1766
  if (e.currentSectionId && e.previousSectionId && e.currentSectionId === e.previousSectionId) return;
1675
1767
  const t = this.coordinator, i = t?.ttsService;
1676
- if (!i) return;
1677
- const s = (n) => {
1678
- t?.reportFrameworkError?.(J({
1679
- kind: "tts-init",
1680
- source: "AssessmentPlayerDefaultElement.cleanupTtsForSectionNavigation",
1681
- error: n,
1682
- recoverable: !0
1683
- }));
1684
- };
1685
- try {
1686
- i.stop?.();
1687
- } catch (n) {
1688
- s(n);
1689
- }
1690
- try {
1691
- i.requestControlHandoff?.();
1692
- } catch (n) {
1693
- s(n);
1694
- }
1768
+ if (i)
1769
+ try {
1770
+ i.stop();
1771
+ } catch (n) {
1772
+ t?.reportFrameworkError?.(J({
1773
+ kind: "tts-init",
1774
+ source: "AssessmentPlayerDefaultElement.cleanupTtsForSectionNavigation",
1775
+ error: n,
1776
+ recoverable: !0
1777
+ }));
1778
+ }
1695
1779
  }
1696
1780
  syncCurrentSectionSessionIntoAssessment() {
1697
1781
  const e = this.controller;
@@ -1702,23 +1786,23 @@ var Ne = "pie-section-player-splitpane", xe = "pie-section-player-vertical", Te
1702
1786
  i && e.updateSectionSession(i, y(t.getSession()));
1703
1787
  }
1704
1788
  attachSectionControllerReadyListener(e, t, i) {
1705
- const s = e, n = this.generation, o = this.sectionHost, r = this.controller, a = () => this.isConnected && this.generation === n && this.sectionHost === o && this.controller === r;
1706
- o.setAttribute("aria-busy", "true"), s.inert = !0;
1789
+ const n = e, s = this.generation, o = this.sectionHost, r = this.controller, a = () => this.isConnected && this.generation === s && this.sectionHost === o && this.controller === r;
1790
+ o.setAttribute("aria-busy", "true"), n.inert = !0;
1707
1791
  let h;
1708
1792
  new Promise((c) => {
1709
1793
  let p = !1;
1710
1794
  const u = (v) => {
1711
- p || (p = !0, clearTimeout(m), s.removeEventListener("pie-stage-change", l), c(v));
1795
+ p || (p = !0, clearTimeout(m), n.removeEventListener("pie-stage-change", l), c(v));
1712
1796
  }, l = (v) => {
1713
- if (v.target !== s) return;
1714
- const { stage: x, status: V } = v.detail;
1715
- V === "failed" || x === "disposed" ? u(null) : x === "engine-ready" && u(s.getSectionController?.() || null);
1797
+ if (v.target !== n) return;
1798
+ const { stage: T, status: V } = v.detail;
1799
+ V === "failed" || T === "disposed" ? u(null) : T === "engine-ready" && u(n.getSectionController?.() || null);
1716
1800
  }, m = setTimeout(() => u(null), 5e3);
1717
- s.addEventListener("pie-stage-change", l), h = () => u(null);
1801
+ n.addEventListener("pie-stage-change", l), h = () => u(null);
1718
1802
  }).then(async (c) => {
1719
1803
  if (a()) {
1720
1804
  if (!c) throw new Error("Section controller did not become ready");
1721
- a() && (this.sectionControllerRef = c, this.sectionSessionReady = !0, s.inert = !1, o.setAttribute("aria-busy", "false"));
1805
+ a() && (this.sectionControllerRef = c, this.sectionSessionReady = !0, n.inert = !1, o.setAttribute("aria-busy", "false"));
1722
1806
  }
1723
1807
  }).catch((c) => {
1724
1808
  if (!a()) return;
@@ -1751,10 +1835,10 @@ var Ne = "pie-section-player-splitpane", xe = "pie-section-player-vertical", Te
1751
1835
  this.detachSectionListeners?.(), this.detachSectionListeners = void 0;
1752
1836
  const i = this.controller;
1753
1837
  this.attachInstrumentationBridge();
1754
- const s = this.restoreFocusOnRender || this.containerRef?.classList.contains("pie-assessment-player-empty") ? this.captureFocusIntent() : null;
1838
+ const n = this.restoreFocusOnRender || this.containerRef?.classList.contains("pie-assessment-player-empty") ? this.captureFocusIntent() : null;
1755
1839
  this.restoreFocusOnRender = !1, this.ensureAnnouncer(), this.sectionControllerRef = null, this.sectionSessionReady = !1;
1756
- const n = document.createElement("div");
1757
- n.className = "pie-assessment-player-default";
1840
+ const s = document.createElement("div");
1841
+ s.className = "pie-assessment-player-default";
1758
1842
  const o = document.createElement("style");
1759
1843
  o.textContent = `
1760
1844
  :host {
@@ -1804,7 +1888,7 @@ var Ne = "pie-section-player-splitpane", xe = "pie-section-player-vertical", Te
1804
1888
  height: 100%;
1805
1889
  overflow: hidden;
1806
1890
  }
1807
- `, n.appendChild(o);
1891
+ `, s.appendChild(o);
1808
1892
  const r = this.getSnapshot(), a = r.navigation.totalSections > 0 ? this.i18n.t("player.assessment.sectionPosition", {
1809
1893
  position: r.navigation.currentIndex + 1,
1810
1894
  total: r.navigation.totalSections
@@ -1820,7 +1904,7 @@ var Ne = "pie-section-player-splitpane", xe = "pie-section-player-vertical", Te
1820
1904
  this.navigatePrevious();
1821
1905
  }), d = document.createElement("button"), d.type = "button", d.className = "pie-assessment-player-nav-btn", d.setAttribute("data-pie-navigation", "next"), d.textContent = this.i18n.t("common.next"), d.disabled = !r.navigation.canNext, d.addEventListener("click", () => {
1822
1906
  this.navigateNext();
1823
- }), m.appendChild(h), m.appendChild(d), u.appendChild(l), u.appendChild(m), n.appendChild(u);
1907
+ }), m.appendChild(h), m.appendChild(d), u.appendChild(l), u.appendChild(m), s.appendChild(u);
1824
1908
  }
1825
1909
  const c = document.createElement("div");
1826
1910
  c.className = "pie-assessment-player-section-host", c.setAttribute("role", "region"), c.setAttribute("aria-label", a), c.tabIndex = -1, this.sectionHost = c;
@@ -1834,7 +1918,7 @@ var Ne = "pie-section-player-splitpane", xe = "pie-section-player-vertical", Te
1834
1918
  const m = y(i.getSectionSession(p.sectionIdentifier));
1835
1919
  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);
1836
1920
  }
1837
- n.appendChild(c), this.swapContent(n), s && (this.applyFocusIntent(s, {
1921
+ s.appendChild(c), this.swapContent(s), n && (this.applyFocusIntent(n, {
1838
1922
  previous: h,
1839
1923
  next: d
1840
1924
  }), this.announceSectionChange(a));
@@ -1845,10 +1929,10 @@ var Ne = "pie-section-player-splitpane", xe = "pie-section-player-vertical", Te
1845
1929
  total: e.totalSections
1846
1930
  }) : this.i18n.t("player.assessment.noSections"), i = this.containerRef?.querySelector(".pie-assessment-player-navigation");
1847
1931
  i && (i.hidden = !R(this.showNavigation, !0), i.hidden && i.contains(document.activeElement) && this.sectionHost?.focus());
1848
- const s = this.containerRef?.querySelector(".pie-assessment-player-current-position");
1849
- s && (s.textContent = t);
1850
- const n = i?.querySelector('[data-pie-navigation="previous"]'), o = i?.querySelector('[data-pie-navigation="next"]');
1851
- n && (n.textContent = this.i18n.t("common.back")), o && (o.textContent = this.i18n.t("common.next")), this.sectionHost?.setAttribute("aria-label", t);
1932
+ const n = this.containerRef?.querySelector(".pie-assessment-player-current-position");
1933
+ n && (n.textContent = t);
1934
+ const s = i?.querySelector('[data-pie-navigation="previous"]'), o = i?.querySelector('[data-pie-navigation="next"]');
1935
+ s && (s.textContent = this.i18n.t("common.back")), o && (o.textContent = this.i18n.t("common.next")), this.sectionHost?.setAttribute("aria-label", t);
1852
1936
  const r = this.containerRef?.querySelector(".pie-assessment-player-status-message");
1853
1937
  r instanceof HTMLElement && r.dataset.pieMessageKey && (r.textContent = this.i18n.t(r.dataset.pieMessageKey));
1854
1938
  const a = this.containerRef?.querySelector(".pie-assessment-player-retry");
@@ -1902,15 +1986,15 @@ var Ne = "pie-section-player-splitpane", xe = "pie-section-player-vertical", Te
1902
1986
  return this.getSnapshot().progress;
1903
1987
  }
1904
1988
  navigateTo(e) {
1905
- const t = this.selectNavigation(), i = t.currentIndex, s = t.currentSectionId;
1906
- let n = i, o;
1989
+ const t = this.selectNavigation(), i = t.currentIndex, n = t.currentSectionId;
1990
+ let s = i, o;
1907
1991
  if (typeof e == "number")
1908
- n = e, o = this.controller?.getSectionAt(n)?.sectionIdentifier;
1992
+ s = e, o = this.controller?.getSectionAt(s)?.sectionIdentifier;
1909
1993
  else if (o = e, this.controller?.getCurrentSection()?.sectionIdentifier === o) return !0;
1910
1994
  if (!this.dispatch(g.navigationRequested, {
1911
1995
  fromIndex: i,
1912
- toIndex: n,
1913
- fromSectionId: s,
1996
+ toIndex: s,
1997
+ fromSectionId: n,
1914
1998
  toSectionId: o,
1915
1999
  reason: "navigate-to"
1916
2000
  }, !0)) return !1;
@@ -1947,21 +2031,21 @@ var Ne = "pie-section-player-splitpane", xe = "pie-section-player-vertical", Te
1947
2031
  async waitForAssessmentController(e = 5e3) {
1948
2032
  const t = this.getAssessmentController();
1949
2033
  return t || (!this.isConnected || this.controller || this.readiness.phase === "error" ? null : new Promise((i) => {
1950
- const s = (o) => {
1951
- clearTimeout(n), this.controllerWaiters.delete(s), i(o);
1952
- }, n = setTimeout(() => s(null), e);
1953
- this.controllerWaiters.add(s);
2034
+ const n = (o) => {
2035
+ clearTimeout(s), this.controllerWaiters.delete(n), i(o);
2036
+ }, s = setTimeout(() => n(null), e);
2037
+ this.controllerWaiters.add(n);
1954
2038
  }));
1955
2039
  }
1956
2040
  };
1957
- O("pie-assessment-player-default", Te, "assessment player default tag");
1958
- var Le = class extends HTMLElement {
1959
- constructor(...e) {
1960
- super(...e), this.showNavigation = !0;
1961
- }
2041
+ H("pie-assessment-player-default", Fe, "assessment player default tag");
2042
+ var _e = class extends HTMLElement {
1962
2043
  static get observedAttributes() {
1963
2044
  return ["show-navigation"];
1964
2045
  }
2046
+ constructor() {
2047
+ super(), this.showNavigation = !0, this.attachShadow({ mode: "open" });
2048
+ }
1965
2049
  connectedCallback() {
1966
2050
  this.showNavigation = this.getAttribute("show-navigation") ?? this.showNavigation, this.render();
1967
2051
  }
@@ -1969,9 +2053,7 @@ var Le = class extends HTMLElement {
1969
2053
  e === "show-navigation" && (this.showNavigation = i), this.render();
1970
2054
  }
1971
2055
  render() {
1972
- const e = R(this.showNavigation, !0);
1973
- this.innerHTML = "";
1974
- const t = document.createElement("style");
2056
+ const e = R(this.showNavigation, !0), t = document.createElement("style");
1975
2057
  t.textContent = `
1976
2058
  :host {
1977
2059
  display: block;
@@ -1979,13 +2061,14 @@ var Le = class extends HTMLElement {
1979
2061
  min-height: 0;
1980
2062
  }
1981
2063
  .pie-assessment-player-shell {
1982
- display: grid;
1983
- grid-template-rows: auto minmax(0, 1fr);
2064
+ display: flex;
2065
+ flex-direction: column;
1984
2066
  height: 100%;
1985
2067
  min-height: 0;
1986
2068
  gap: 0.5rem;
1987
2069
  }
1988
2070
  .pie-assessment-player-shell__body {
2071
+ flex: 1 1 0;
1989
2072
  min-height: 0;
1990
2073
  overflow: hidden;
1991
2074
  }
@@ -1995,13 +2078,13 @@ var Le = class extends HTMLElement {
1995
2078
  const o = document.createElement("slot");
1996
2079
  o.name = "navigation", i.appendChild(o);
1997
2080
  }
1998
- const s = document.createElement("div");
1999
- s.className = "pie-assessment-player-shell__body";
2000
- const n = document.createElement("slot");
2001
- s.appendChild(n), i.appendChild(s), this.appendChild(t), this.appendChild(i);
2081
+ const n = document.createElement("div");
2082
+ n.className = "pie-assessment-player-shell__body";
2083
+ const s = document.createElement("slot");
2084
+ n.appendChild(s), i.appendChild(n), this.shadowRoot?.replaceChildren(t, i);
2002
2085
  }
2003
2086
  };
2004
- O("pie-assessment-player-shell", Le, "assessment player shell tag");
2087
+ H("pie-assessment-player-shell", _e, "assessment player shell tag");
2005
2088
  export {
2006
2089
  g as ASSESSMENT_PLAYER_PUBLIC_EVENTS
2007
2090
  };