@pie-qti/player-elements 0.1.20 → 0.1.21

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.
Files changed (50) hide show
  1. package/dist/{define-BwFVHv-A.js → define-XpbOHJoz.js} +29 -19
  2. package/dist/define-XpbOHJoz.js.map +1 -0
  3. package/dist/{dist-oe9UH-A2.js → dist-4hIHy9-L.js} +583 -628
  4. package/dist/dist-4hIHy9-L.js.map +1 -0
  5. package/dist/dist-Nkkk25AH.js +1275 -0
  6. package/dist/dist-Nkkk25AH.js.map +1 -0
  7. package/dist/{element-BiInkn5Q.js → element-DNnKo2Uk.js} +2 -2
  8. package/dist/{element-BiInkn5Q.js.map → element-DNnKo2Uk.js.map} +1 -1
  9. package/dist/{element-class-CILJ4Ls7-rJWb-Gwb.js → element-class-iN9MRyjF-D6u8ACFm.js} +1829 -1811
  10. package/dist/{element-class-CILJ4Ls7-rJWb-Gwb.js.map → element-class-iN9MRyjF-D6u8ACFm.js.map} +1 -1
  11. package/dist/elements.js +3 -3
  12. package/dist/index.js +2 -2
  13. package/dist/item-toolbar-element-3k36WOlC.js +6086 -0
  14. package/dist/item-toolbar-element-3k36WOlC.js.map +1 -0
  15. package/dist/{mathlive.min-DeR46YTX-D-KAmiue.js → mathlive.min-DeR46YTX-DamfKay_.js} +1 -1
  16. package/dist/{mathlive.min-DeR46YTX-D-KAmiue.js.map → mathlive.min-DeR46YTX-DamfKay_.js.map} +1 -1
  17. package/dist/pie-assessment-toolkit-element-CP-OMtE6.js +28516 -0
  18. package/dist/pie-assessment-toolkit-element-CP-OMtE6.js.map +1 -0
  19. package/dist/pie-tool-calculator-VzYEjxiY.js +2309 -0
  20. package/dist/pie-tool-calculator-VzYEjxiY.js.map +1 -0
  21. package/dist/register-players.js +1 -1
  22. package/dist/register.js +7 -6
  23. package/dist/register.js.map +1 -1
  24. package/dist/{resolveItems-DHNyVysE.js → resolveItems-hMDtJOXa.js} +2 -2
  25. package/dist/{resolveItems-DHNyVysE.js.map → resolveItems-hMDtJOXa.js.map} +1 -1
  26. package/dist/{root-CYGgRw16.js → root--0fyaoNu.js} +3 -3
  27. package/dist/root--0fyaoNu.js.map +1 -0
  28. package/dist/{sre-CgK32OcY.js → sre-CFPLI6BY.js} +1 -1
  29. package/dist/{sre-CgK32OcY.js.map → sre-CFPLI6BY.js.map} +1 -1
  30. package/dist/{tag-names-OgMDHLpx.js → tag-names-ClLtKtXt.js} +2 -2
  31. package/dist/tag-names-ClLtKtXt.js.map +1 -0
  32. package/dist/tool-tts-inline-B-xT_sdY.js +2641 -0
  33. package/dist/tool-tts-inline-B-xT_sdY.js.map +1 -0
  34. package/package.json +6 -6
  35. package/dist/define-BwFVHv-A.js.map +0 -1
  36. package/dist/dist-DswyTalX.js +0 -6731
  37. package/dist/dist-DswyTalX.js.map +0 -1
  38. package/dist/dist-oe9UH-A2.js.map +0 -1
  39. package/dist/item-toolbar-element-t_zI1vE6.js +0 -1892
  40. package/dist/item-toolbar-element-t_zI1vE6.js.map +0 -1
  41. package/dist/pie-assessment-toolkit-element-RzBk8WVs.js +0 -7113
  42. package/dist/pie-assessment-toolkit-element-RzBk8WVs.js.map +0 -1
  43. package/dist/pie-tool-calculator-GW-LhvB_.js +0 -6905
  44. package/dist/pie-tool-calculator-GW-LhvB_.js.map +0 -1
  45. package/dist/root-CYGgRw16.js.map +0 -1
  46. package/dist/sre-Dz5gsR-A.js +0 -17220
  47. package/dist/sre-Dz5gsR-A.js.map +0 -1
  48. package/dist/tag-names-OgMDHLpx.js.map +0 -1
  49. package/dist/tool-tts-inline-drDEIti_.js +0 -3724
  50. package/dist/tool-tts-inline-drDEIti_.js.map +0 -1
@@ -1,7 +1,7 @@
1
- import { _ as e, a as t, c as n, d as r, f as i, g as a, i as o, l as s, m as c, n as l, o as u, p as d, r as f, s as p, t as m, u as h } from "./resolveItems-DHNyVysE.js";
2
- import { A as g, D as _, E as v, F as y, I as b, M as x, N as S, O as C, P as w, S as T, _ as E, a as D, b as O, c as k, d as ee, f as te, g as ne, h as re, i as ie, j as ae, k as oe, l as se, m as ce, n as le, o as ue, p as de, r as fe, s as A, u as pe, v as me, w as he, x as ge, y as _e } from "./element-class-CILJ4Ls7-rJWb-Gwb.js";
3
- import { n as ve, t as ye } from "./root-CYGgRw16.js";
4
- import { c as be, l as xe, r as Se, t as Ce } from "./dist-oe9UH-A2.js";
1
+ import { _ as e, a as t, c as n, d as r, f as i, g as a, i as o, l as s, m as c, n as l, o as u, p as d, r as f, s as p, t as m, u as h } from "./resolveItems-hMDtJOXa.js";
2
+ import { A as g, D as _, E as v, F as y, I as b, M as x, N as S, O as C, P as w, S as T, _ as E, a as D, b as O, c as k, d as ee, f as te, g as ne, h as re, i as ie, j as ae, k as oe, l as se, m as ce, n as le, o as ue, p as de, r as fe, s as A, u as pe, v as me, w as he, x as ge, y as _e } from "./element-class-iN9MRyjF-D6u8ACFm.js";
3
+ import { n as ve, t as ye } from "./root--0fyaoNu.js";
4
+ import { l as be, r as xe, t as Se, u as Ce } from "./dist-4hIHy9-L.js";
5
5
  //#region ../ims-cp-core/dist/package-path.js
6
6
  function we(...e) {
7
7
  return e.filter(Boolean).join("/");
@@ -2884,7 +2884,7 @@ function jr(e, t, n = !1) {
2884
2884
  }
2885
2885
  var Mr = class {
2886
2886
  constructor(e, t, n = {}) {
2887
- this.interactionDataCache = null, this.responseProcessingProgram = null, this.templateProcessingProgram = null, this.outcomeProcessingProgram = null, this._catalogIndex = /* @__PURE__ */ new Map(), this._stimulusCatalogIndexes = /* @__PURE__ */ new Map(), this._pciHosts = /* @__PURE__ */ new Map(), this._pnpChangeListeners = /* @__PURE__ */ new Set(), this.lifecycleStatus = "initial", this.accumulatedDurationMs = 0, this.config = e, this.itemXml = e.itemXml ?? "", this.role = e.role ?? "candidate", this.sessionGuid = Pr(), this.sessionStartedAt = Date.now(), this.rng = e.rng ?? (typeof e.seed == "number" ? Ut(e.seed) : Math.random), t ? this.mapper = t.mapper : e.elementNameMapper ? this.mapper = e.elementNameMapper : x(this.itemXml) === "3.0" ? this.mapper = new y() : this.mapper = new b();
2887
+ this.interactionDataCache = null, this.warnedImpliedZeroMaxScore = !1, this.responseProcessingProgram = null, this.templateProcessingProgram = null, this.outcomeProcessingProgram = null, this._catalogIndex = /* @__PURE__ */ new Map(), this._stimulusCatalogIndexes = /* @__PURE__ */ new Map(), this._pciHosts = /* @__PURE__ */ new Map(), this._pnpChangeListeners = /* @__PURE__ */ new Set(), this.lifecycleStatus = "initial", this.accumulatedDurationMs = 0, this.config = e, this.itemXml = e.itemXml ?? "", this.role = e.role ?? "candidate", this.sessionGuid = Pr(), this.sessionStartedAt = Date.now(), this.rng = e.rng ?? (typeof e.seed == "number" ? Ut(e.seed) : Math.random), t ? this.mapper = t.mapper : e.elementNameMapper ? this.mapper = e.elementNameMapper : x(this.itemXml) === "3.0" ? this.mapper = new y() : this.mapper = new b();
2888
2888
  let r = t?.attributeMapper ?? e.attributeNameMapper ?? (this.mapper.version === "3.0" ? new S() : new w());
2889
2889
  if (this.config = {
2890
2890
  ...e,
@@ -3138,13 +3138,16 @@ var Mr = class {
3138
3138
  resetTemplatesToDefault() {
3139
3139
  for (let e of Object.values(this.decls)) e.isTemplate && this.ctx.resetToDefault(e.identifier);
3140
3140
  }
3141
+ warnOnceOnImpliedZeroMaxScore(e) {
3142
+ this.warnedImpliedZeroMaxScore || this.decls.MAXSCORE?.impliedNumericDefault && e.MAXSCORE === 0 && (this.warnedImpliedZeroMaxScore = !0, console.warn(`[QTI Player] MAXSCORE is 0 for item "${this.itemDocument.getAssessmentItemAttribute("identifier") ?? "unknown"}": its outcomeDeclaration has no <defaultValue>, so QTI initializes it to 0 and response processing never assigned it. Declare <defaultValue> on the MAXSCORE outcomeDeclaration to score against a real maximum.`));
3143
+ }
3141
3144
  runResponseProcessing(e) {
3142
3145
  if (this.updateDuration(), this.resetOutcomesToDefault(), this.responseProcessing.present && (this.responseProcessing.hasStatements ? this.execResponseProcessingProgram() : this.responseProcessing.template && this.execResponseProcessingTemplate(this.responseProcessing.template)), this.execOutcomeProcessingProgram(), !this.isAdaptive() && e.finalizeNonAdaptiveAttempt && (this.ctx.setValue("completionStatus", k("identifier", "single", "completed")), e.countAttempt ?? !0)) {
3143
3146
  let e = this.getNumAttempts();
3144
3147
  this.ctx.setValue("numAttempts", k("integer", "single", e + 1));
3145
3148
  }
3146
3149
  let t = this.collectOutcomes();
3147
- return {
3150
+ return this.warnOnceOnImpliedZeroMaxScore(t), {
3148
3151
  score: Number(t.SCORE ?? 0),
3149
3152
  maxScore: Number(t.MAXSCORE ?? 1),
3150
3153
  completed: (t.completionStatus ?? "not_attempted") === "completed" || !this.isAdaptive() && e.finalizeNonAdaptiveAttempt,
@@ -3468,14 +3471,15 @@ var Mr = class {
3468
3471
  let e = {}, t = (t, n) => {
3469
3472
  let r = this.getAttrMapped(n, "identifier"), i = this.getAttrMapped(n, "cardinality") || "single", a = i === "record" ? void 0 : this.getAttrMapped(n, "baseType") || "string";
3470
3473
  if (!r) return;
3471
- let o = this.parseDefaultValue(n, a, i);
3474
+ let o = this.parseDefaultValue(n, a, i), s = !o && this.hasImpliedNumericDefault(t, a, i), c = o ?? this.impliedDefaultValue(t, a, i);
3472
3475
  if (e[r] = {
3473
3476
  identifier: r,
3474
3477
  ...a ? { baseType: a } : {},
3475
3478
  cardinality: i,
3476
- defaultValue: o,
3477
- value: o,
3479
+ defaultValue: c,
3480
+ value: c,
3478
3481
  isTemplate: t === "template",
3482
+ impliedNumericDefault: s,
3479
3483
  __kind: t
3480
3484
  }, t === "response" || t === "outcome") {
3481
3485
  let t = ge(n, this.mapper.toNative("mapping"));
@@ -3653,9 +3657,15 @@ var Mr = class {
3653
3657
  let e = this.ctx.getValue("duration");
3654
3658
  return Math.max(0, Math.floor(pe(e) || 0));
3655
3659
  }
3660
+ hasImpliedNumericDefault(e, t, n) {
3661
+ return e !== "outcome" || n !== "single" ? !1 : t === "integer" || t === "float";
3662
+ }
3663
+ impliedDefaultValue(e, t, n) {
3664
+ return this.hasImpliedNumericDefault(e, t, n) ? k(t, "single", 0) : A(t, n);
3665
+ }
3656
3666
  parseDefaultValue(e, t, n) {
3657
3667
  let r = ge(e, this.mapper.toNative("defaultvalue"));
3658
- return r ? this.parseDeclarationValues(r, t, n) : A(t, n);
3668
+ if (r) return this.parseDeclarationValues(r, t, n);
3659
3669
  }
3660
3670
  parseCorrectResponse(e, t, n) {
3661
3671
  return this.parseDeclarationValues(e, t, n);
@@ -4267,7 +4277,7 @@ function Oi(e) {
4267
4277
  return e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
4268
4278
  }
4269
4279
  function ki(e) {
4270
- return e.replace(/<(\w+Interaction|qti-[\w-]+-interaction)(\s[^>]*)?>[\s\S]*?<\/\1>/gi, (e, t) => di(t.toLowerCase()) ? e : `<span class="qti-hidden-interaction">${e}</span>`);
4280
+ return e.replace(/<(\w+Interaction|qti-[\w-]+-interaction|positionObjectStage|qti-position-object-stage)(\s[^>]*)?>[\s\S]*?<\/\1>/gi, (e, t) => di(t.toLowerCase()) ? e : `<span class="qti-hidden-interaction">${e}</span>`);
4271
4281
  }
4272
4282
  function Ai({ interactions: e, source: t, responses: n, correctResponses: r, roleCapabilities: i, effectiveDisabled: a, onComponentError: o }) {
4273
4283
  return e.filter((e) => !ui(e.type)).map((e) => {
@@ -8145,11 +8155,11 @@ var Fu = /* @__PURE__ */ Y("<pie-assessment-toolkit><pie-item-toolbar></pie-item
8145
8155
  };
8146
8156
  function Ru(e, t) {
8147
8157
  Ho(t, !0), $l(e, Lu);
8148
- let n = $(t, "tools", 23, () => []), r = $(t, "scopeId", 7), i = $(t, "scopeLabel", 7), a = $(t, "sourceText", 7, ""), o = $(t, "sourceXml", 7, ""), s = $(t, "scopeElement", 7, null), c = /* @__PURE__ */ V(null), l = null, u = null, d = null, f = null, p = /* @__PURE__ */ V(null), m = /* @__PURE__ */ V(null), h = /* @__PURE__ */ V(!1), g = /* @__PURE__ */ R(() => n().filter((e) => e.enabled !== !1)), _ = /* @__PURE__ */ R(() => J(g).some((e) => e.toolId === "textToSpeech")), v = /* @__PURE__ */ R(() => J(g).find((e) => e.toolId === "calculator")), y = /* @__PURE__ */ R(() => [J(_) ? "textToSpeech" : "", J(v) ? "calculator" : ""].filter(Boolean).join(",")), b = /* @__PURE__ */ R(() => i() === "passage" ? "rubric-block-stimulus" : "assessment-item"), x = /* @__PURE__ */ R(() => i() === "passage" ? "passage" : "item"), S = /* @__PURE__ */ R(() => o().trim() || a().trim()), C = Se({
8158
+ let n = $(t, "tools", 23, () => []), r = $(t, "scopeId", 7), i = $(t, "scopeLabel", 7), a = $(t, "sourceText", 7, ""), o = $(t, "sourceXml", 7, ""), s = $(t, "scopeElement", 7, null), c = /* @__PURE__ */ V(null), l = null, u = null, d = null, f = null, p = /* @__PURE__ */ V(null), m = /* @__PURE__ */ V(null), h = /* @__PURE__ */ V(!1), g = /* @__PURE__ */ R(() => n().filter((e) => e.enabled !== !1)), _ = /* @__PURE__ */ R(() => J(g).some((e) => e.toolId === "textToSpeech")), v = /* @__PURE__ */ R(() => J(g).find((e) => e.toolId === "calculator")), y = /* @__PURE__ */ R(() => [J(_) ? "textToSpeech" : "", J(v) ? "calculator" : ""].filter(Boolean).join(",")), b = /* @__PURE__ */ R(() => i() === "passage" ? "rubric-block-stimulus" : "assessment-item"), x = /* @__PURE__ */ R(() => i() === "passage" ? "passage" : "item"), S = /* @__PURE__ */ R(() => o().trim() || a().trim()), C = xe({
8149
8159
  toolIds: ["textToSpeech", "calculator"],
8150
8160
  toolModuleLoaders: {
8151
- textToSpeech: () => import("./tool-tts-inline-drDEIti_.js"),
8152
- calculator: () => import("./pie-tool-calculator-GW-LhvB_.js")
8161
+ textToSpeech: () => import("./tool-tts-inline-B-xT_sdY.js"),
8162
+ calculator: () => import("./pie-tool-calculator-VzYEjxiY.js")
8153
8163
  }
8154
8164
  }), w = /* @__PURE__ */ R(() => J(g).find((e) => e.toolId === "textToSpeech")?.provider ?? {}), T = /* @__PURE__ */ R(() => J(v)?.renderParams ?? {}), E = /* @__PURE__ */ R(() => ({
8155
8165
  pnpEnforcement: "off",
@@ -8203,7 +8213,7 @@ function Ru(e, t) {
8203
8213
  vc(() => {
8204
8214
  if (J(g).length === 0 || J(h)) return;
8205
8215
  let e = !1;
8206
- return Promise.all([import("./item-toolbar-element-t_zI1vE6.js"), import("./pie-assessment-toolkit-element-RzBk8WVs.js")]).then(() => {
8216
+ return Promise.all([import("./item-toolbar-element-3k36WOlC.js"), import("./pie-assessment-toolkit-element-CP-OMtE6.js")]).then(() => {
8207
8217
  e || H(h, !0);
8208
8218
  }).catch((t) => {
8209
8219
  e || console.error("Unable to load assessment toolkit elements:", t);
@@ -8400,7 +8410,7 @@ function Ru(e, t) {
8400
8410
  je(t);
8401
8411
  }
8402
8412
  Me(), vc(() => {
8403
- J(m) || H(m, new Ce({
8413
+ J(m) || H(m, new Se({
8404
8414
  assessmentId: `qti-section-demo-${r()}`,
8405
8415
  lazyInit: !1,
8406
8416
  toolConfigStrictness: "off",
@@ -8409,7 +8419,7 @@ function Ru(e, t) {
8409
8419
  }), !0);
8410
8420
  }), vc(() => {
8411
8421
  if (!(!J(c) || !J(te))) return l = new ve(J(c), {
8412
- context: xe,
8422
+ context: Ce,
8413
8423
  initialValue: J(te)
8414
8424
  }), l.connect(), u = new ye(J(c)), u.attach(), () => {
8415
8425
  u?.detach(), u = null, l?.disconnect(), l = null;
@@ -8989,7 +8999,7 @@ function Dd(e, t) {
8989
8999
  Ho(t, !0), $l(e, Ed);
8990
9000
  let n = $(t, "itemRef", 7), r = $(t, "responses", 7), i = $(t, "role", 7, "candidate"), a = $(t, "disabled", 7, !1), o = $(t, "i18n", 7), s = $(t, "security", 7), c = $(t, "pci", 7), l = $(t, "pnp", 7), u = $(t, "typeset", 7), d = $(t, "onResponseChange", 7), f = $(t, "onFrameworkError", 7), p = /* @__PURE__ */ V(!1), m = /* @__PURE__ */ V(null), h = /* @__PURE__ */ V(null), g = /* @__PURE__ */ R(() => n().title ?? "Question"), _ = /* @__PURE__ */ R(() => (n().tools?.length ?? 0) > 0), v = /* @__PURE__ */ R(() => yd(n().itemXml, { security: s() }));
8991
9001
  async function y() {
8992
- customElements.get("pie-qti-item-player") || await import("./element-BiInkn5Q.js"), await customElements.whenDefined("pie-qti-item-player");
9002
+ customElements.get("pie-qti-item-player") || await import("./element-DNnKo2Uk.js"), await customElements.whenDefined("pie-qti-item-player");
8993
9003
  }
8994
9004
  zl(() => {
8995
9005
  let e = !1;
@@ -12094,4 +12104,4 @@ function Uf() {
12094
12104
  //#endregion
12095
12105
  export { Bf as a, zf as i, Vf as n, If as o, Hf as r, Lf as s, Uf as t };
12096
12106
 
12097
- //# sourceMappingURL=define-BwFVHv-A.js.map
12107
+ //# sourceMappingURL=define-XpbOHJoz.js.map