@pie-element/simple-cloze 0.1.9-next.20261012213240 → 0.1.9

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 (36) hide show
  1. package/dist/browser/author/index.js +7 -4
  2. package/dist/browser/controller/index.js +2 -2
  3. package/dist/browser/{controller-1IBOQFFL.js → controller-rsFIn-EH.js} +6 -3
  4. package/dist/browser/{controller-1IBOQFFL.js.map → controller-rsFIn-EH.js.map} +1 -1
  5. package/dist/browser/delivery/index.js +6 -3
  6. package/dist/browser/delivery/index.js.map +1 -1
  7. package/dist/browser/editor-runtime/author/index.js +7 -4
  8. package/dist/browser/editor-runtime/author/index.js.map +1 -1
  9. package/dist/browser/editor-runtime/controller/index.js +2 -2
  10. package/dist/browser/editor-runtime/{controller-1IBOQFFL.js → controller-rsFIn-EH.js} +6 -3
  11. package/dist/browser/editor-runtime/{controller-1IBOQFFL.js.map → controller-rsFIn-EH.js.map} +1 -1
  12. package/dist/browser/editor-runtime/delivery/index.js +6 -3
  13. package/dist/browser/editor-runtime/delivery/index.js.map +1 -1
  14. package/dist/browser/editor-runtime/{i18n-zWCApMsi.js → i18n-CD--tSQl.js} +5 -3
  15. package/dist/browser/editor-runtime/i18n-CD--tSQl.js.map +1 -0
  16. package/dist/browser/editor-runtime/{mathjax-CptWnMbQ-B2aE3pmi.js → mathjax-CptWnMbQ-D7vTsrdd.js} +2 -2
  17. package/dist/browser/editor-runtime/{mathjax-CptWnMbQ-B2aE3pmi.js.map → mathjax-CptWnMbQ-D7vTsrdd.js.map} +1 -1
  18. package/dist/browser/editor-runtime/print/index.js +6 -3
  19. package/dist/browser/{i18n-zWCApMsi.js → i18n-CD--tSQl.js} +5 -3
  20. package/dist/browser/i18n-CD--tSQl.js.map +1 -0
  21. package/dist/browser/{mathjax-CptWnMbQ-B2aE3pmi.js → mathjax-CptWnMbQ-D7vTsrdd.js} +2 -2
  22. package/dist/browser/{mathjax-CptWnMbQ-B2aE3pmi.js.map → mathjax-CptWnMbQ-D7vTsrdd.js.map} +1 -1
  23. package/dist/browser/print/index.js +6 -3
  24. package/dist/delivery/index.js +25 -23
  25. package/dist/delivery/index.js.map +1 -1
  26. package/dist/index.iife.js +1 -1
  27. package/dist/print/index.js +3 -1
  28. package/dist/print/index.js.map +1 -1
  29. package/dist/schemas/configuration.schema.json +1 -1
  30. package/dist/schemas/model.schema.json +1 -1
  31. package/dist/schemas/session.schema.json +1 -1
  32. package/module/print.js +3 -1
  33. package/module/print.js.map +1 -1
  34. package/package.json +5 -5
  35. package/dist/browser/editor-runtime/i18n-zWCApMsi.js.map +0 -1
  36. package/dist/browser/i18n-zWCApMsi.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { A as e, C as t, D as n, E as r, F as i, I as a, L as o, M as s, N as c, O as l, P as u, R as d, S as f, T as p, _ as m, a as h, c as g, d as _, f as v, g as y, h as b, i as x, j as S, k as C, l as ee, m as te, n as w, o as ne, p as re, r as ie, s as ae, t as oe, u as T, v as se, w as ce, x as E, y as D, z as le } from "../client-e4ZTphpa.js";
2
- import { l as ue, n as de } from "../controller-1IBOQFFL.js";
2
+ import { n as ue, u as de } from "../controller-rsFIn-EH.js";
3
3
  //#region ../../shared/configure-events/dist/index.js
4
4
  var fe = class e extends CustomEvent {
5
5
  static {
@@ -17498,7 +17498,7 @@ var jS = AS, MS = D("<div class=\"input-container svelte-13ppn6m\"><span class=\
17498
17498
  };
17499
17499
  function IS(e, n) {
17500
17500
  a(n, !0), ee(e, FS);
17501
- let o = w(n, "model", 7), s = w(n, "configuration", 7), p = `simple-cloze-correct-answer-${Math.random().toString(36).slice(2, 10)}`, g = u(() => de(o() || void 0)), _ = u(() => ve(ue.configuration, s()));
17501
+ let o = w(n, "model", 7), s = w(n, "configuration", 7), p = `simple-cloze-correct-answer-${Math.random().toString(36).slice(2, 10)}`, g = u(() => ue(o() || void 0)), _ = u(() => ve(de.configuration, s()));
17502
17502
  function b(e) {
17503
17503
  let r = {
17504
17504
  ...t(g),
@@ -17608,8 +17608,11 @@ E(["input"]), oe(IS, {
17608
17608
  }, [], []);
17609
17609
  //#endregion
17610
17610
  //#region src/author/index.ts
17611
- var LS = IS.element;
17611
+ var LS = IS.element, RS = Object.freeze({
17612
+ name: "@pie-element/simple-cloze",
17613
+ version: "0.1.9"
17614
+ });
17612
17615
  //#endregion
17613
- export { LS as default };
17616
+ export { LS as default, RS as piePackage };
17614
17617
 
17615
17618
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,2 @@
1
- import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "../controller-1IBOQFFL.js";
2
- export { s as createCorrectResponseSession, r as createDefaultModel, a as getCorrectness, n as getPartialScore, e as model, i as normalizeSession, o as outcome, t as validate };
1
+ import { a as e, c as t, i as n, l as r, n as i, o as a, r as o, s, t as c } from "../controller-rsFIn-EH.js";
2
+ export { c as createCorrectResponseSession, i as createDefaultModel, o as getCorrectness, n as getPartialScore, e as model, a as normalizeSession, s as outcome, t as piePackage, r as validate };
@@ -62,8 +62,11 @@ var t = {
62
62
  }), f = (e = {}, t = {}) => {
63
63
  let i = {};
64
64
  return t?.prompt?.required && !r(e?.prompt) && (i.prompt = "This field is required."), n(e?.correctAnswer) || (i.correctAnswer = "No correct answer defined."), i;
65
- };
65
+ }, p = Object.freeze({
66
+ name: "@pie-element/simple-cloze",
67
+ version: "0.1.9"
68
+ });
66
69
  //#endregion
67
- export { u as a, f as c, a as i, t as l, c as n, l as o, i as r, s, d as t };
70
+ export { u as a, p as c, a as i, f as l, c as n, l as o, i as r, s, d as t, t as u };
68
71
 
69
- //# sourceMappingURL=controller-1IBOQFFL.js.map
72
+ //# sourceMappingURL=controller-rsFIn-EH.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"controller-1IBOQFFL.js","names":[],"sources":["../../src/controller/defaults.ts","../../src/controller/index.ts"],"sourcesContent":["import type { SimpleClozeConfiguration, SimpleClozeModel } from '../types.js';\n\nexport default {\n model: {\n prompt: '<p>Enter your answer:</p>',\n promptEnabled: true,\n correctAnswer: '',\n teacherInstructionsEnabled: true,\n },\n configuration: {\n prompt: {\n label: 'Prompt',\n settings: true,\n },\n teacherInstructions: {\n label: 'Teacher Instructions',\n settings: true,\n },\n settingsPanelDisabled: false,\n },\n} satisfies {\n model: Omit<SimpleClozeModel, 'id' | 'element'>;\n configuration: SimpleClozeConfiguration;\n};\n","import defaults from './defaults.js';\nimport { toPlainText } from './plain-text.js';\nimport type { SimpleClozeConfiguration, SimpleClozeModel, SimpleClozeSession } from '../types.js';\n\nexport type SimpleClozeEnv = {\n mode?: string;\n role?: string;\n [key: string]: unknown;\n};\n\nexport type SimpleClozeCorrectness = 'correct' | 'incorrect' | 'unanswered';\n\nexport type SimpleClozeOutcome = {\n score: number;\n empty: boolean;\n traceLog: string[];\n};\n\n/**\n * Both sides compare as plain text, case-insensitively: an answer key authored\n * as HTML matches the text a learner types.\n */\nconst comparable = (value: unknown): string => toPlainText(value).toLowerCase();\n\n// Strips tags except img, iframe and source (media counts as content), as\n// multiple-choice's `getContent` does.\nconst hasContent = (html: unknown): boolean =>\n typeof html === 'string' &&\n html\n .replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '')\n .replace(/&nbsp;/gi, ' ')\n .trim().length > 0;\n\n/**\n * A response with no text is unanswered; an answer key with no text matches\n * nothing, so a blank key never scores.\n */\nexport const getCorrectness = (\n question: Partial<SimpleClozeModel> | null | undefined,\n session: SimpleClozeSession | null | undefined\n): SimpleClozeCorrectness => {\n const response = comparable(session?.value);\n if (!response) {\n return 'unanswered';\n }\n\n const key = comparable(question?.correctAnswer);\n if (key && response === key) {\n return 'correct';\n }\n\n return 'incorrect';\n};\n\n/** Single response, all-or-nothing: 1 when it matches the answer key, else 0. */\nexport const getPartialScore = (\n question: Partial<SimpleClozeModel> | null | undefined,\n session: SimpleClozeSession | null | undefined\n): number => (getCorrectness(question, session) === 'correct' ? 1 : 0);\n\nconst getTraceLog = (\n question: Partial<SimpleClozeModel> | null | undefined,\n correctness: SimpleClozeCorrectness,\n score: number\n): string[] => {\n const traceLog = [\n 'Response is compared with the answer key as plain text, ignoring case and extra spaces.',\n ];\n if (!comparable(question?.correctAnswer)) {\n traceLog.push('No correct answer is defined, so no response can score.');\n } else {\n traceLog.push(\n correctness === 'correct'\n ? 'Response matches the answer key.'\n : 'Response does not match the answer key.'\n );\n }\n traceLog.push(`Final score: ${score}.`);\n return traceLog;\n};\n\nexport const outcome = (\n question: Partial<SimpleClozeModel> | null | undefined,\n session: SimpleClozeSession | null | undefined,\n _env: SimpleClozeEnv = {}\n): Promise<SimpleClozeOutcome> =>\n new Promise((resolve) => {\n const correctness = getCorrectness(question, session);\n\n if (correctness === 'unanswered') {\n resolve({\n score: 0,\n empty: true,\n traceLog: ['Student did not enter a response. Score is 0.'],\n });\n return;\n }\n\n const score = correctness === 'correct' ? 1 : 0;\n resolve({ score, empty: false, traceLog: getTraceLog(question, correctness, score) });\n });\n\nexport const createDefaultModel = (\n model: Partial<SimpleClozeModel> = {}\n): Partial<SimpleClozeModel> => ({\n ...defaults.model,\n ...model,\n});\n\nexport const normalizeSession = (s: SimpleClozeSession | null | undefined): SimpleClozeSession => ({\n ...s,\n});\n\nexport const model = (\n question: Partial<SimpleClozeModel> | null | undefined,\n session: SimpleClozeSession | null | undefined,\n env: SimpleClozeEnv | null | undefined\n): Promise<Record<string, unknown>> => {\n return new Promise((resolve) => {\n const safeSession = session || {};\n const safeEnv = env || {};\n const normalizedQuestion = createDefaultModel(question || {});\n\n const out: Record<string, unknown> = {\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n disabled: safeEnv.mode !== 'gather',\n mode: safeEnv.mode,\n role: safeEnv.role,\n language: normalizedQuestion.language,\n };\n\n if (safeEnv.mode === 'evaluate') {\n out.correctness = getCorrectness(normalizedQuestion, safeSession);\n // The key is shown in the text input, so it goes out as plain text.\n out.correctAnswer = toPlainText(normalizedQuestion.correctAnswer);\n }\n\n if (safeEnv.role === 'instructor' && (safeEnv.mode === 'view' || safeEnv.mode === 'evaluate')) {\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : null;\n } else {\n out.teacherInstructions = null;\n }\n\n resolve(out);\n });\n};\n\nexport const createCorrectResponseSession = (\n question: Partial<SimpleClozeModel> | null | undefined,\n env: SimpleClozeEnv | null | undefined\n): Promise<SimpleClozeSession | null> => {\n return new Promise((resolve) => {\n if (env?.mode !== 'evaluate' && env?.role === 'instructor') {\n // The player sets `id` and `element` on the entry from the item config.\n resolve({ id: '1', value: toPlainText(question?.correctAnswer) });\n } else {\n resolve(null);\n }\n });\n};\n\nexport const validate = (\n model: Partial<SimpleClozeModel> = {},\n config: SimpleClozeConfiguration = {}\n): Record<string, string> => {\n const errors: Record<string, string> = {};\n\n if (config?.prompt?.required && !hasContent(model?.prompt)) {\n errors.prompt = 'This field is required.';\n }\n\n if (!comparable(model?.correctAnswer)) {\n errors.correctAnswer = 'No correct answer defined.';\n }\n\n return errors;\n};\n"],"mappings":";;AAEA,IAAA,IAAe;CACb,OAAO;EACL,QAAQ;EACR,eAAe;EACf,eAAe;EACf,4BAA4B;CAC9B;CACA,eAAe;EACb,QAAQ;GACN,OAAO;GACP,UAAU;EACZ;EACA,qBAAqB;GACnB,OAAO;GACP,UAAU;EACZ;EACA,uBAAuB;CACzB;AACF,GCEM,KAAc,MAA2B,EAAY,CAAK,CAAC,CAAC,YAAY,GAIxE,KAAc,MAClB,OAAO,KAAS,YAChB,EACG,QAAQ,sCAAsC,EAAE,CAAC,CACjD,QAAQ,YAAY,GAAG,CAAC,CACxB,KAAK,CAAC,CAAC,SAAS,GAMR,KACX,GACA,MAC2B;CAC3B,IAAM,IAAW,EAAW,GAAS,KAAK;CAC1C,IAAI,CAAC,GACH,OAAO;CAGT,IAAM,IAAM,EAAW,GAAU,aAAa;CAK9C,OAJI,KAAO,MAAa,IACf,YAGF;AACT,GAGa,KACX,GACA,MACY,IAAe,GAAU,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AY;CAC9B,AAAI,GAAK,SAAS,cAAc,GAAK,SAAS,eAE5C,EAAQ;EAAE,IAAI;EAAK,OAAO,EAAY,GAAU,aAAa;CAAE,CAAC,IAEhE,EAAQ,IAAI;AAEhB,CAAC,GAGU,KACX,IAAmC,CAAC,GACpC,IAAmC,CAAC,MACT;CAC3B,IAAM,IAAiC,CAAC;CAUxC,OARI,GAAQ,QAAQ,YAAY,CAAC,EAAW,GAAO,MAAM,MACvD,EAAO,SAAS,4BAGb,EAAW,GAAO,aAAa,MAClC,EAAO,gBAAgB,+BAGlB;AACT"}
1
+ {"version":3,"file":"controller-rsFIn-EH.js","names":[],"sources":["../../src/controller/defaults.ts","../../src/controller/index.ts"],"sourcesContent":["import type { SimpleClozeConfiguration, SimpleClozeModel } from '../types.js';\n\nexport default {\n model: {\n prompt: '<p>Enter your answer:</p>',\n promptEnabled: true,\n correctAnswer: '',\n teacherInstructionsEnabled: true,\n },\n configuration: {\n prompt: {\n label: 'Prompt',\n settings: true,\n },\n teacherInstructions: {\n label: 'Teacher Instructions',\n settings: true,\n },\n settingsPanelDisabled: false,\n },\n} satisfies {\n model: Omit<SimpleClozeModel, 'id' | 'element'>;\n configuration: SimpleClozeConfiguration;\n};\n","import defaults from './defaults.js';\nimport { toPlainText } from './plain-text.js';\nimport type { SimpleClozeConfiguration, SimpleClozeModel, SimpleClozeSession } from '../types.js';\n\nexport type SimpleClozeEnv = {\n mode?: string;\n role?: string;\n [key: string]: unknown;\n};\n\nexport type SimpleClozeCorrectness = 'correct' | 'incorrect' | 'unanswered';\n\nexport type SimpleClozeOutcome = {\n score: number;\n empty: boolean;\n traceLog: string[];\n};\n\n/**\n * Both sides compare as plain text, case-insensitively: an answer key authored\n * as HTML matches the text a learner types.\n */\nconst comparable = (value: unknown): string => toPlainText(value).toLowerCase();\n\n// Strips tags except img, iframe and source (media counts as content), as\n// multiple-choice's `getContent` does.\nconst hasContent = (html: unknown): boolean =>\n typeof html === 'string' &&\n html\n .replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '')\n .replace(/&nbsp;/gi, ' ')\n .trim().length > 0;\n\n/**\n * A response with no text is unanswered; an answer key with no text matches\n * nothing, so a blank key never scores.\n */\nexport const getCorrectness = (\n question: Partial<SimpleClozeModel> | null | undefined,\n session: SimpleClozeSession | null | undefined\n): SimpleClozeCorrectness => {\n const response = comparable(session?.value);\n if (!response) {\n return 'unanswered';\n }\n\n const key = comparable(question?.correctAnswer);\n if (key && response === key) {\n return 'correct';\n }\n\n return 'incorrect';\n};\n\n/** Single response, all-or-nothing: 1 when it matches the answer key, else 0. */\nexport const getPartialScore = (\n question: Partial<SimpleClozeModel> | null | undefined,\n session: SimpleClozeSession | null | undefined\n): number => (getCorrectness(question, session) === 'correct' ? 1 : 0);\n\nconst getTraceLog = (\n question: Partial<SimpleClozeModel> | null | undefined,\n correctness: SimpleClozeCorrectness,\n score: number\n): string[] => {\n const traceLog = [\n 'Response is compared with the answer key as plain text, ignoring case and extra spaces.',\n ];\n if (!comparable(question?.correctAnswer)) {\n traceLog.push('No correct answer is defined, so no response can score.');\n } else {\n traceLog.push(\n correctness === 'correct'\n ? 'Response matches the answer key.'\n : 'Response does not match the answer key.'\n );\n }\n traceLog.push(`Final score: ${score}.`);\n return traceLog;\n};\n\nexport const outcome = (\n question: Partial<SimpleClozeModel> | null | undefined,\n session: SimpleClozeSession | null | undefined,\n _env: SimpleClozeEnv = {}\n): Promise<SimpleClozeOutcome> =>\n new Promise((resolve) => {\n const correctness = getCorrectness(question, session);\n\n if (correctness === 'unanswered') {\n resolve({\n score: 0,\n empty: true,\n traceLog: ['Student did not enter a response. Score is 0.'],\n });\n return;\n }\n\n const score = correctness === 'correct' ? 1 : 0;\n resolve({ score, empty: false, traceLog: getTraceLog(question, correctness, score) });\n });\n\nexport const createDefaultModel = (\n model: Partial<SimpleClozeModel> = {}\n): Partial<SimpleClozeModel> => ({\n ...defaults.model,\n ...model,\n});\n\nexport const normalizeSession = (s: SimpleClozeSession | null | undefined): SimpleClozeSession => ({\n ...s,\n});\n\nexport const model = (\n question: Partial<SimpleClozeModel> | null | undefined,\n session: SimpleClozeSession | null | undefined,\n env: SimpleClozeEnv | null | undefined\n): Promise<Record<string, unknown>> => {\n return new Promise((resolve) => {\n const safeSession = session || {};\n const safeEnv = env || {};\n const normalizedQuestion = createDefaultModel(question || {});\n\n const out: Record<string, unknown> = {\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n disabled: safeEnv.mode !== 'gather',\n mode: safeEnv.mode,\n role: safeEnv.role,\n language: normalizedQuestion.language,\n };\n\n if (safeEnv.mode === 'evaluate') {\n out.correctness = getCorrectness(normalizedQuestion, safeSession);\n // The key is shown in the text input, so it goes out as plain text.\n out.correctAnswer = toPlainText(normalizedQuestion.correctAnswer);\n }\n\n if (safeEnv.role === 'instructor' && (safeEnv.mode === 'view' || safeEnv.mode === 'evaluate')) {\n out.teacherInstructions = normalizedQuestion.teacherInstructionsEnabled\n ? normalizedQuestion.teacherInstructions\n : null;\n } else {\n out.teacherInstructions = null;\n }\n\n resolve(out);\n });\n};\n\nexport const createCorrectResponseSession = (\n question: Partial<SimpleClozeModel> | null | undefined,\n env: SimpleClozeEnv | null | undefined\n): Promise<SimpleClozeSession | null> => {\n return new Promise((resolve) => {\n if (env?.mode !== 'evaluate' && env?.role === 'instructor') {\n // The player sets `id` and `element` on the entry from the item config.\n resolve({ id: '1', value: toPlainText(question?.correctAnswer) });\n } else {\n resolve(null);\n }\n });\n};\n\nexport const validate = (\n model: Partial<SimpleClozeModel> = {},\n config: SimpleClozeConfiguration = {}\n): Record<string, string> => {\n const errors: Record<string, string> = {};\n\n if (config?.prompt?.required && !hasContent(model?.prompt)) {\n errors.prompt = 'This field is required.';\n }\n\n if (!comparable(model?.correctAnswer)) {\n errors.correctAnswer = 'No correct answer defined.';\n }\n\n return errors;\n};\n"],"mappings":";;AAEA,IAAA,IAAe;CACb,OAAO;EACL,QAAQ;EACR,eAAe;EACf,eAAe;EACf,4B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1B,IAAU,KAAO,CAAC,GAClB,IAAqB,EAAmB,KAAY,CAAC,CAAC,GAEtD,IAA+B;EACnC,QAAQ,EAAmB,gBAAgB,EAAmB,SAAS;EACvE,UAAU,EAAQ,SAAS;EAC3B,MAAM,EAAQ;EACd,MAAM,EAAQ;EACd,UAAU,EAAmB;CAC/B;CAgBA,AAdI,EAAQ,SAAS,eACnB,EAAI,cAAc,EAAe,GAAoB,CAAW,GAEhE,EAAI,gBAAgB,EAAY,EAAmB,aAAa,IAG9D,EAAQ,SAAS,iBAAiB,EAAQ,SAAS,UAAU,EAAQ,SAAS,cAChF,EAAI,sBAAsB,EAAmB,6BACzC,EAAmB,sBACnB,OAEJ,EAAI,sBAAsB,MAG5B,EAAQ,CAAG;AACb,CAAC,GAGU,KACX,GACA,MAEO,IAAI,SAAS,MAAY;CAC9B,AAAI,GAAK,SAAS,cAAc,GAAK,SAAS,eAE5C,EAAQ;EAAE,IAAI;EAAK,OAAO,EAAY,GAAU,aAAa;CAAE,CAAC,IAEhE,EAAQ,IAAI;AAEhB,CAAC,GAGU,KACX,IAAmC,CAAC,GACpC,IAAmC,CAAC,MACT;CAC3B,IAAM,IAAiC,CAAC;CAUxC,OARI,GAAQ,QAAQ,YAAY,CAAC,EAAW,GAAO,MAAM,MACvD,EAAO,SAAS,4BAGb,EAAW,GAAO,aAAa,MAClC,EAAO,gBAAgB,+BAGlB;AACT"}
@@ -1,5 +1,5 @@
1
1
  import { C as e, E as t, F as n, I as r, M as i, N as a, O as o, P as s, R as c, S as l, T as u, _ as d, a as f, b as p, c as m, f as h, g, j as _, k as v, l as ee, n as y, r as b, t as x, u as S, w as C, x as w, y as T } from "../client-e4ZTphpa.js";
2
- import { l as E, n as D, r as O, t as k } from "../i18n-zWCApMsi.js";
2
+ import { l as E, n as D, r as O, t as k } from "../i18n-CD--tSQl.js";
3
3
  //#region src/delivery/TeacherInstructions.svelte
4
4
  var A = T("<div class=\"teacher-instructions pie-teacher-instructions svelte-1jhejbv\"><button type=\"button\" class=\"teacher-instructions-toggle pie-teacher-instructions-toggle svelte-1jhejbv\"> </button> <div class=\"teacher-instructions-content pie-teacher-instructions-content svelte-1jhejbv\"></div></div>"), j = {
5
5
  hash: "svelte-1jhejbv",
@@ -236,8 +236,11 @@ function R(e, t) {
236
236
  }
237
237
  //#endregion
238
238
  //#region src/delivery/index.ts
239
- var z = R(N, { isComplete: (e, t) => typeof t?.value == "string" && t.value.trim().length > 0 });
239
+ var z = R(N, { isComplete: (e, t) => typeof t?.value == "string" && t.value.trim().length > 0 }), B = Object.freeze({
240
+ name: "@pie-element/simple-cloze",
241
+ version: "0.1.9"
242
+ });
240
243
  //#endregion
241
- export { z as default };
244
+ export { z as default, B as piePackage };
242
245
 
243
246
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["#e","t","#t","e","n"],"sources":["../../../src/delivery/TeacherInstructions.svelte","../../../src/delivery/SimpleCloze.svelte","../../../../../lib-svelte/delivery-events/dist/index2.js","../../../../../shared/player-events/dist/index.js","../../../../../lib-svelte/delivery-events/dist/index3.js","../../../src/delivery/index.ts"],"sourcesContent":["<script lang=\"ts\">\nimport { sanitizeModelHtml } from '@pie-element/shared-utils';\nimport { tCommon } from '../i18n';\n\nlet { html, language }: { html: string; language?: string } = $props();\n\nlet expanded = $state(false);\nconst panelId = `simple-cloze-teacher-instructions-${Math.random().toString(36).slice(2, 10)}`;\n</script>\n\n<!-- Collapsed by default, as multiple-choice shows them; the controller sends them to instructors only. -->\n<div class=\"teacher-instructions pie-teacher-instructions\">\n <button\n type=\"button\"\n class=\"teacher-instructions-toggle pie-teacher-instructions-toggle\"\n aria-expanded={expanded}\n aria-controls={panelId}\n onclick={() => (expanded = !expanded)}\n >\n {tCommon(expanded ? 'hideTeacherInstructions' : 'showTeacherInstructions', language)}\n </button>\n <div id={panelId} class=\"teacher-instructions-content pie-teacher-instructions-content\" hidden={!expanded}>\n {@html sanitizeModelHtml(html)}\n </div>\n</div>\n\n<style>\n .teacher-instructions {\n margin-bottom: 1rem;\n }\n\n .teacher-instructions-toggle {\n padding: 0;\n border: 0;\n border-bottom: 1px dotted currentColor;\n background: transparent;\n font: inherit;\n color: var(--pie-primary, #3f51b5);\n cursor: pointer;\n }\n\n .teacher-instructions-toggle:focus-visible {\n outline: 2px solid var(--pie-button-focus-outline, #3b82f6);\n outline-offset: 2px;\n }\n\n .teacher-instructions-content {\n padding-top: 1rem;\n }\n</style>\n","<svelte:options\n customElement={{\n shadow: 'none',\n props: {\n model: { type: 'Object' },\n session: { type: 'Object' },\n onSessionChange: {}\n }\n }}\n/>\n\n<script lang=\"ts\">\nimport { sanitizeModelHtml } from '@pie-element/shared-utils';\nimport { renderMath } from '@pie-element/shared-math-rendering-mathjax';\nimport { t, tCommon } from '../i18n';\nimport TeacherInstructions from './TeacherInstructions.svelte';\n\nlet {\n model = null,\n session = null,\n onSessionChange,\n}: { model?: any; session?: any; onSessionChange?: (session: any) => void } = $props();\n\n// Per-instance ids: a page can hold several instances, and several versions of\n// this element, each with its own Svelte runtime.\nconst instanceId = `simple-cloze-${Math.random().toString(36).slice(2, 10)}`;\nconst promptId = `${instanceId}-prompt`;\nconst feedbackId = `${instanceId}-feedback`;\n\nlet promptElement: HTMLDivElement | null = $state(null);\nlet inputElement: HTMLInputElement | null = $state(null);\nlet showCorrectAnswer = $state(false);\n\nconst isEvaluateMode = $derived(model?.mode === 'evaluate');\nconst correctness = $derived(model?.correctness);\nconst isCorrect = $derived(correctness === 'correct');\nconst isIncorrect = $derived(correctness === 'incorrect');\nconst isUnanswered = $derived(correctness === 'unanswered');\nconst prompt = $derived(typeof model?.prompt === 'string' ? model.prompt : '');\nconst correctAnswer = $derived(typeof model?.correctAnswer === 'string' ? model.correctAnswer : '');\nconst sessionValue = $derived(typeof session?.value === 'string' ? session.value : '');\n// As in multiple-choice, any response short of correct can be revealed,\n// including none.\nconst canShowCorrectAnswer = $derived(isEvaluateMode && !isCorrect && !!correctAnswer.trim());\nconst showingCorrectAnswer = $derived(showCorrectAnswer && canShowCorrectAnswer);\n\nconst feedbackText = $derived.by(() => {\n if (!isEvaluateMode) return '';\n if (showingCorrectAnswer) return t('correctAnswerShown', model?.language);\n if (isCorrect) return t('correct', model?.language);\n if (isIncorrect) return t('incorrect', model?.language);\n if (isUnanswered) return t('unanswered', model?.language);\n return '';\n});\n\n// Leaving evaluate mode, or a response that turned correct, turns the reveal\n// off, so gather mode never starts on the answer key.\n$effect(() => {\n if (!canShowCorrectAnswer) {\n showCorrectAnswer = false;\n }\n});\n\n// The input shows the session value, or the answer key while it is revealed.\n// A player that resets or replaces the session clears or restores it.\n$effect(() => {\n if (!inputElement) return;\n const next = showingCorrectAnswer ? correctAnswer : sessionValue;\n if (inputElement.value !== next) {\n inputElement.value = next;\n }\n});\n\n// Typesets the prompt's math each time it renders. `renderMath` resolves once\n// MathJax has run, so a load failure arrives as a rejection.\n$effect(() => {\n if (!promptElement || !prompt) return;\n const warn = (err: unknown) => console.warn('simple-cloze: MathJax render failed', err);\n try {\n Promise.resolve(renderMath(promptElement)).catch(warn);\n } catch (err) {\n warn(err);\n }\n});\n\nfunction handleInput(event: Event) {\n const target = event.target as HTMLInputElement;\n const newValue = target.value;\n\n // The player owns the session's `id` and `element` (the versioned tag it\n // registered this element under), so neither is written here.\n onSessionChange?.({ ...session, value: newValue });\n}\n\nfunction toggleCorrectAnswer() {\n if (!canShowCorrectAnswer) return;\n showCorrectAnswer = !showCorrectAnswer;\n}\n</script>\n\n<div class=\"simple-cloze-root\">\n {#if model?.teacherInstructions}\n <TeacherInstructions html={model.teacherInstructions} language={model?.language} />\n {/if}\n\n {#if prompt}\n <div bind:this={promptElement} id={promptId} class=\"simple-cloze-prompt\">{@html sanitizeModelHtml(prompt)}</div>\n {/if}\n\n {#if canShowCorrectAnswer}\n <button\n type=\"button\"\n class=\"simple-cloze-toggle\"\n onclick={toggleCorrectAnswer}\n aria-pressed={showingCorrectAnswer}\n >\n <span class=\"simple-cloze-toggle-icon\" aria-hidden=\"true\">\n {#if showingCorrectAnswer}\n <svg preserveAspectRatio=\"xMinYMin meet\" version=\"1.1\" viewBox=\"-283 359 34 35\" focusable=\"false\">\n <circle cx=\"-266\" cy=\"375.9\" r=\"14\" fill=\"var(--pie-tertiary-light, #bce2ff)\" />\n <path d=\"M-280.5,375.9c0-8,6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5s-6.5,14.5-14.5,14.5S-280.5,383.9-280.5,375.9z M-279.5,375.9c0,7.4,6.1,13.5,13.5,13.5c7.4,0,13.5-6.1,13.5-13.5s-6.1-13.5-13.5-13.5C-273.4,362.4-279.5,368.5-279.5,375.9z\" fill=\"var(--pie-tertiary-light, #bce2ff)\" />\n <polygon points=\"-265.4,383.1 -258.6,377.2 -261.2,374.2 -264.3,376.9 -268.9,368.7 -272.4,370.6\" fill=\"var(--pie-tertiary, #1a9cff)\" />\n </svg>\n {:else}\n <svg preserveAspectRatio=\"xMinYMin meet\" version=\"1.1\" viewBox=\"-129.5 127 34 35\" focusable=\"false\">\n <path style=\"fill: var(--pie-border-light, #D0CAC5); stroke: var(--pie-border-light, #E6E3E0); stroke-width: 0.75; stroke-miterlimit: 10;\" d=\"M-112.9,160.4c-8.5,0-15.5-6.9-15.5-15.5c0-8.5,6.9-15.5,15.5-15.5s15.5,6.9,15.5,15.5 C-97.4,153.5-104.3,160.4-112.9,160.4z\" />\n <path style=\"fill: var(--pie-border-light, #B3ABA4); stroke: var(--pie-border-light, #CDC7C2); stroke-width: 0.5; stroke-miterlimit: 10;\" d=\"M-113.2,159c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-105.2,159-113.2,159z\" />\n <circle cx=\"-114.2\" cy=\"143.5\" r=\"14\" fill=\"var(--pie-background, white)\" />\n <path d=\"M-114.2,158c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-106.2,158-114.2,158z M-114.2,130c-7.4,0-13.5,6.1-13.5,13.5s6.1,13.5,13.5,13.5s13.5-6.1,13.5-13.5S-106.8,130-114.2,130z\" fill=\"var(--pie-tertiary-light, #bce2ff)\" />\n <polygon points=\"-114.8,150.7 -121.6,144.8 -119,141.8 -115.9,144.5 -111.3,136.3 -107.8,138.2\" fill=\"var(--pie-tertiary, #1a9cff)\" />\n </svg>\n {/if}\n </span>\n <span class=\"simple-cloze-toggle-label\">\n {tCommon(showingCorrectAnswer ? 'hideCorrectAnswer' : 'showCorrectAnswer', model?.language)}\n </span>\n </button>\n {/if}\n\n <div class=\"simple-cloze-response\">\n {#if isEvaluateMode && (isCorrect || showingCorrectAnswer)}\n <span class=\"correctness-icon correctness-icon--correct\" aria-hidden=\"true\">\n <svg fill=\"currentColor\" viewBox=\"0 0 24 24\" focusable=\"false\">\n <path d=\"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z\"/>\n </svg>\n </span>\n {:else if isEvaluateMode && isIncorrect}\n <span class=\"correctness-icon correctness-icon--incorrect\" aria-hidden=\"true\">\n <svg fill=\"currentColor\" viewBox=\"0 0 24 24\" focusable=\"false\">\n <path d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z\"/>\n </svg>\n </span>\n {/if}\n <input\n bind:this={inputElement}\n type=\"text\"\n class=\"simple-cloze-input\"\n class:simple-cloze-input--correct={isEvaluateMode && (isCorrect || showingCorrectAnswer)}\n class:simple-cloze-input--incorrect={isEvaluateMode && isIncorrect && !showingCorrectAnswer}\n placeholder={t('placeholder', model?.language)}\n spellcheck=\"false\"\n aria-labelledby={prompt ? promptId : undefined}\n aria-label={prompt ? undefined : t('answerInput', model?.language)}\n aria-describedby={feedbackText ? feedbackId : undefined}\n disabled={model?.disabled}\n readonly={showingCorrectAnswer}\n oninput={handleInput}\n />\n <span id={feedbackId} class=\"sr-only\" role=\"status\">{feedbackText}</span>\n </div>\n</div>\n\n<style>\n /*\n * Self-contained: players ship no Tailwind, so nothing here relies on host\n * utility classes or a CSS reset. Colours are `--pie-*` theme variables with\n * the fallbacks `@pie-lib/render-ui`'s `color` module uses.\n */\n .simple-cloze-root {\n padding: 1rem;\n color: var(--pie-text, black);\n }\n\n .simple-cloze-prompt {\n margin-bottom: 1rem;\n }\n\n .simple-cloze-prompt :global(p) {\n margin: 0.5em 0;\n }\n\n .simple-cloze-prompt :global(strong) {\n font-weight: 600;\n }\n\n .simple-cloze-toggle {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n margin: 0 0 0.75rem;\n padding: 0;\n border: 0;\n background: transparent;\n color: inherit;\n font: inherit;\n cursor: pointer;\n user-select: none;\n }\n\n .simple-cloze-toggle:hover .simple-cloze-toggle-label {\n text-decoration: underline;\n }\n\n .simple-cloze-toggle:focus-visible {\n outline: 2px solid var(--pie-button-focus-outline, #3b82f6);\n outline-offset: 2px;\n }\n\n .simple-cloze-toggle-icon {\n display: inline-flex;\n }\n\n .simple-cloze-toggle-icon svg {\n width: 25px;\n height: 25px;\n }\n\n .simple-cloze-toggle-label {\n font-size: 0.875rem;\n line-height: 1.25rem;\n }\n\n .simple-cloze-response {\n position: relative;\n display: inline-block;\n }\n\n .simple-cloze-input {\n box-sizing: border-box;\n margin: 0;\n padding: 0.5rem 0.75rem;\n /* The text colour, as ECR's input border: a light grey fails 3:1 (WCAG 1.4.11). */\n border: 1px solid var(--pie-text, black);\n border-radius: 0.25rem;\n background-color: transparent;\n color: var(--pie-text, black);\n font: inherit;\n }\n\n .simple-cloze-input:disabled {\n opacity: 1;\n color: var(--pie-text, black);\n -webkit-text-fill-color: currentColor;\n }\n\n .simple-cloze-input:focus-visible {\n outline: 2px solid var(--pie-button-focus-outline, #3b82f6);\n outline-offset: 2px;\n }\n\n .simple-cloze-input--correct {\n border: 2px solid var(--pie-correct-tertiary, #0ea449);\n }\n\n .simple-cloze-input--incorrect {\n border: 2px solid var(--pie-incorrect-icon, #bf0d00);\n }\n\n .simple-cloze-input[readonly] {\n font-weight: 600;\n }\n\n .correctness-icon {\n position: absolute;\n top: -8px;\n left: -8px;\n border-radius: 50%;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n padding: 2px;\n color: var(--pie-background, #ffffff);\n }\n\n .correctness-icon svg {\n width: 12px;\n height: 12px;\n }\n\n .correctness-icon--correct {\n background-color: var(--pie-correct-tertiary, #0ea449);\n }\n\n .correctness-icon--incorrect {\n background-color: var(--pie-incorrect-icon, #bf0d00);\n }\n\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n</style>\n","//#region src/write-session-in-place.ts\nfunction e(e) {\n\treturn !!e && typeof e == \"object\" && !Array.isArray(e);\n}\nfunction t(t, n) {\n\tif (t === n) return t;\n\tif (!e(t) || !e(n) || Object.isFrozen(t) || !Object.isExtensible(t)) return n;\n\ttry {\n\t\tfor (let e of Object.keys(t)) e in n || delete t[e];\n\t\tObject.assign(t, n);\n\t} catch {\n\t\treturn n;\n\t}\n\treturn t;\n}\n//#endregion\nexport { t as writeSessionInPlace };\n","//#region src/session-notifier.ts\nvar e = \"commitPendingSession\", t = /* @__PURE__ */ new WeakMap();\nfunction n(e, n) {\n\tlet r = t.get(e);\n\tr || (r = /* @__PURE__ */ new Set(), t.set(e, r)), r.add(n);\n}\nfunction r(t) {\n\treturn Object.getOwnPropertyDescriptor(t, e) !== void 0;\n}\nfunction i(t) {\n\tif (r(t)) return;\n\tlet n = t[e];\n\tObject.defineProperty(t, e, {\n\t\tvalue: () => {\n\t\t\tif (typeof n == \"function\") try {\n\t\t\t\tn.call(t);\n\t\t\t} catch {}\n\t\t\to(t);\n\t\t},\n\t\tconfigurable: !0,\n\t\tenumerable: !1,\n\t\twritable: !0\n\t});\n}\nfunction a(e, t, r = {}) {\n\tlet a = r.delayMs, o = typeof a == \"function\" ? a : () => a ?? 0, s = r.maxWaitMs, c = null, l = null, u = !1, d = () => {\n\t\tc !== null && (clearTimeout(c), c = null), l !== null && (clearTimeout(l), l = null);\n\t}, f = () => {\n\t\td(), u && (u = !1, t());\n\t}, p = {\n\t\tnotify() {\n\t\t\tu = !0, c !== null && clearTimeout(c), c = setTimeout(f, Math.max(0, o())), s !== void 0 && l === null && (l = setTimeout(f, Math.max(0, s)));\n\t\t},\n\t\tflush() {\n\t\t\tif (!u) {\n\t\t\t\td();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tf();\n\t\t\t} catch (e) {\n\t\t\t\tconsole.warn(\"[session-notifier] a committed session-changed dispatch threw\", e);\n\t\t\t}\n\t\t}\n\t};\n\treturn n(e, p), i(e), p;\n}\nfunction o(e) {\n\tlet n = t.get(e);\n\tif (n) for (let e of [...n]) e.flush();\n}\n//#endregion\n//#region src/index.ts\nvar s = class e extends CustomEvent {\n\tstatic {\n\t\tthis.TYPE = \"model-set\";\n\t}\n\tconstructor(t, n, r) {\n\t\tsuper(e.TYPE, {\n\t\t\tbubbles: !0,\n\t\t\tcomposed: !0,\n\t\t\tdetail: {\n\t\t\t\tcomplete: n,\n\t\t\t\tcomponent: t,\n\t\t\t\thasModel: r\n\t\t\t}\n\t\t}), this.component = t, this.complete = n;\n\t}\n}, c = class e extends CustomEvent {\n\tstatic {\n\t\tthis.TYPE = \"session-changed\";\n\t}\n\tconstructor(t, n) {\n\t\tsuper(e.TYPE, {\n\t\t\tbubbles: !0,\n\t\t\tcomposed: !0,\n\t\t\tdetail: {\n\t\t\t\tcomplete: n,\n\t\t\t\tcomponent: t\n\t\t\t}\n\t\t}), this.component = t, this.complete = n;\n\t}\n};\n//#endregion\nexport { s as ModelSetEvent, e as SESSION_COMMIT_METHOD, c as SessionChangedEvent, a as createSessionNotifier, o as flushSessionNotifiers };\n","import { writeSessionInPlace as e } from \"./index2.js\";\nimport { ModelSetEvent as t, SessionChangedEvent as n } from \"@pie-element/shared-player-events\";\n//#region src/delivery-element.ts\nfunction r(r, i) {\n\tlet a = r.element;\n\tif (!a) throw TypeError(\"defineDeliveryElement: the component was not compiled with `customElement`\");\n\tclass o extends a {\n\t\t#e;\n\t\t#t;\n\t\tconstructor() {\n\t\t\tsuper(), this.onSessionChange = (e) => {\n\t\t\t\tthis.writeSession(e), this.dispatchSessionChanged();\n\t\t\t};\n\t\t}\n\t\tset model(e) {\n\t\t\tthis.#e = e, super.model = e, queueMicrotask(() => {\n\t\t\t\tthis.dispatchEvent(new t(this.tagName.toLowerCase(), this.isComplete(), this.#e !== void 0));\n\t\t\t});\n\t\t}\n\t\tget model() {\n\t\t\treturn this.#e;\n\t\t}\n\t\tset session(e) {\n\t\t\tthis.#t = e, super.session = e, this.dispatchSessionChanged();\n\t\t}\n\t\tget session() {\n\t\t\treturn this.#t;\n\t\t}\n\t\tisComplete() {\n\t\t\treturn i.isComplete(this.#e, this.#t);\n\t\t}\n\t\twriteSession(t) {\n\t\t\tthis.#t = e(this.#t, t), super.session = t;\n\t\t}\n\t\tdispatchSessionChanged() {\n\t\t\tthis.dispatchEvent(new n(this.tagName.toLowerCase(), this.isComplete()));\n\t\t}\n\t}\n\treturn o;\n}\n//#endregion\nexport { r as defineDeliveryElement };\n","import SimpleClozeComponent from './SimpleCloze.svelte';\nimport { defineDeliveryElement } from '@pie-lib/delivery-events-svelte';\nimport type { SimpleClozeModel, SimpleClozeSession } from '../types.js';\n\n// The demo loader and players register it with customElements.define().\nconst SimpleClozeElement = defineDeliveryElement<SimpleClozeModel, SimpleClozeSession>(\n SimpleClozeComponent,\n {\n isComplete: (_model, session) =>\n typeof session?.value === 'string' && session.value.trim().length > 0,\n }\n);\n\nexport default SimpleClozeElement;\n"],"mappings":";;;;;;;iBAAA;;CAIA,IAAM,IAAI,EAAA,GAAA,QAAA,CAAA,GAAE,IAAQ,EAAA,GAAA,YAAA,CAAA,GAEhB,IAAW,EAAO,EAAK,GACrB,IAAU,qCAAqC,KAAK,OAAM,CAAE,CAAC,S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AAIG,EAAE,KAAK,QAAQ,YAAY,GAAG,KAAK,WAAW,CAAC,CAAC;EACxE;CACD;CACA,OAAO;AACR;;;AClCA,IAAM,IAAqB,EACzB,GACA,EACE,aAAa,GAAQ,MACnB,OAAO,GAAS,SAAU,YAAY,EAAQ,MAAM,KAAK,CAAC,CAAC,SAAS,EACxE,CACF"}
1
+ {"version":3,"file":"index.js","names":["#e","t","#t","e","n"],"sources":["../../../src/delivery/TeacherInstructions.svelte","../../../src/delivery/SimpleCloze.svelte","../../../../../lib-svelte/delivery-events/dist/index2.js","../../../../../shared/player-events/dist/index.js","../../../../../lib-svelte/delivery-events/dist/index3.js","../../../src/delivery/index.ts"],"sourcesContent":["<script lang=\"ts\">\nimport { sanitizeModelHtml } from '@pie-element/shared-utils';\nimport { tCommon } from '../i18n';\n\nlet { html, language }: { html: string; language?: string } = $props();\n\nlet expanded = $state(false);\nconst panelId = `simple-cloze-teacher-instructions-${Math.random().toString(36).slice(2, 10)}`;\n</script>\n\n<!-- Collapsed by default, as multiple-choice shows them; the controller sends them to instructors only. -->\n<div class=\"teacher-instructions pie-teacher-instructions\">\n <button\n type=\"button\"\n class=\"teacher-instructions-toggle pie-teacher-instructions-toggle\"\n aria-expanded={expanded}\n aria-controls={panelId}\n onclick={() => (expanded = !expanded)}\n >\n {tCommon(expanded ? 'hideTeacherInstructions' : 'showTeacherInstructions', language)}\n </button>\n <div id={panelId} class=\"teacher-instructions-content pie-teacher-instructions-content\" hidden={!expanded}>\n {@html sanitizeModelHtml(html)}\n </div>\n</div>\n\n<style>\n .teacher-instructions {\n margin-bottom: 1rem;\n }\n\n .teacher-instructions-toggle {\n padding: 0;\n border: 0;\n border-bottom: 1px dotted currentColor;\n background: transparent;\n font: inherit;\n color: var(--pie-primary, #3f51b5);\n cursor: pointer;\n }\n\n .teacher-instructions-toggle:focus-visible {\n outline: 2px solid var(--pie-button-focus-outline, #3b82f6);\n outline-offset: 2px;\n }\n\n .teacher-instructions-content {\n padding-top: 1rem;\n }\n</style>\n","<svelte:options\n customElement={{\n shadow: 'none',\n props: {\n model: { type: 'Object' },\n session: { type: 'Object' },\n onSessionChange: {}\n }\n }}\n/>\n\n<script lang=\"ts\">\nimport { sanitizeModelHtml } from '@pie-element/shared-utils';\nimport { renderMath } from '@pie-element/shared-math-rendering-mathjax';\nimport { t, tCommon } from '../i18n';\nimport TeacherInstructions from './TeacherInstructions.svelte';\n\nlet {\n model = null,\n session = null,\n onSessionChange,\n}: { model?: any; session?: any; onSessionChange?: (session: any) => void } = $props();\n\n// Per-instance ids: a page can hold several instances, and several versions of\n// this element, each with its own Svelte runtime.\nconst instanceId = `simple-cloze-${Math.random().toString(36).slice(2, 10)}`;\nconst promptId = `${instanceId}-prompt`;\nconst feedbackId = `${instanceId}-feedback`;\n\nlet promptElement: HTMLDivElement | null = $state(null);\nlet inputElement: HTMLInputElement | null = $state(null);\nlet showCorrectAnswer = $state(false);\n\nconst isEvaluateMode = $derived(model?.mode === 'evaluate');\nconst correctness = $derived(model?.correctness);\nconst isCorrect = $derived(correctness === 'correct');\nconst isIncorrect = $derived(correctness === 'incorrect');\nconst isUnanswered = $derived(correctness === 'unanswered');\nconst prompt = $derived(typeof model?.prompt === 'string' ? model.prompt : '');\nconst correctAnswer = $derived(typeof model?.correctAnswer === 'string' ? model.correctAnswer : '');\nconst sessionValue = $derived(typeof session?.value === 'string' ? session.value : '');\n// As in multiple-choice, any response short of correct can be revealed,\n// including none.\nconst canShowCorrectAnswer = $derived(isEvaluateMode && !isCorrect && !!correctAnswer.trim());\nconst showingCorrectAnswer = $derived(showCorrectAnswer && canShowCorrectAnswer);\n\nconst feedbackText = $derived.by(() => {\n if (!isEvaluateMode) return '';\n if (showingCorrectAnswer) return t('correctAnswerShown', model?.language);\n if (isCorrect) return t('correct', model?.language);\n if (isIncorrect) return t('incorrect', model?.language);\n if (isUnanswered) return t('unanswered', model?.language);\n return '';\n});\n\n// Leaving evaluate mode, or a response that turned correct, turns the reveal\n// off, so gather mode never starts on the answer key.\n$effect(() => {\n if (!canShowCorrectAnswer) {\n showCorrectAnswer = false;\n }\n});\n\n// The input shows the session value, or the answer key while it is revealed.\n// A player that resets or replaces the session clears or restores it.\n$effect(() => {\n if (!inputElement) return;\n const next = showingCorrectAnswer ? correctAnswer : sessionValue;\n if (inputElement.value !== next) {\n inputElement.value = next;\n }\n});\n\n// Typesets the prompt's math each time it renders. `renderMath` resolves once\n// MathJax has run, so a load failure arrives as a rejection.\n$effect(() => {\n if (!promptElement || !prompt) return;\n const warn = (err: unknown) => console.warn('simple-cloze: MathJax render failed', err);\n try {\n Promise.resolve(renderMath(promptElement)).catch(warn);\n } catch (err) {\n warn(err);\n }\n});\n\nfunction handleInput(event: Event) {\n const target = event.target as HTMLInputElement;\n const newValue = target.value;\n\n // The player owns the session's `id` and `element` (the versioned tag it\n // registered this element under), so neither is written here.\n onSessionChange?.({ ...session, value: newValue });\n}\n\nfunction toggleCorrectAnswer() {\n if (!canShowCorrectAnswer) return;\n showCorrectAnswer = !showCorrectAnswer;\n}\n</script>\n\n<div class=\"simple-cloze-root\">\n {#if model?.teacherInstructions}\n <TeacherInstructions html={model.teacherInstructions} language={model?.language} />\n {/if}\n\n {#if prompt}\n <div bind:this={promptElement} id={promptId} class=\"simple-cloze-prompt\">{@html sanitizeModelHtml(prompt)}</div>\n {/if}\n\n {#if canShowCorrectAnswer}\n <button\n type=\"button\"\n class=\"simple-cloze-toggle\"\n onclick={toggleCorrectAnswer}\n aria-pressed={showingCorrectAnswer}\n >\n <span class=\"simple-cloze-toggle-icon\" aria-hidden=\"true\">\n {#if showingCorrectAnswer}\n <svg preserveAspectRatio=\"xMinYMin meet\" version=\"1.1\" viewBox=\"-283 359 34 35\" focusable=\"false\">\n <circle cx=\"-266\" cy=\"375.9\" r=\"14\" fill=\"var(--pie-tertiary-light, #bce2ff)\" />\n <path d=\"M-280.5,375.9c0-8,6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5s-6.5,14.5-14.5,14.5S-280.5,383.9-280.5,375.9z M-279.5,375.9c0,7.4,6.1,13.5,13.5,13.5c7.4,0,13.5-6.1,13.5-13.5s-6.1-13.5-13.5-13.5C-273.4,362.4-279.5,368.5-279.5,375.9z\" fill=\"var(--pie-tertiary-light, #bce2ff)\" />\n <polygon points=\"-265.4,383.1 -258.6,377.2 -261.2,374.2 -264.3,376.9 -268.9,368.7 -272.4,370.6\" fill=\"var(--pie-tertiary, #1a9cff)\" />\n </svg>\n {:else}\n <svg preserveAspectRatio=\"xMinYMin meet\" version=\"1.1\" viewBox=\"-129.5 127 34 35\" focusable=\"false\">\n <path style=\"fill: var(--pie-border-light, #D0CAC5); stroke: var(--pie-border-light, #E6E3E0); stroke-width: 0.75; stroke-miterlimit: 10;\" d=\"M-112.9,160.4c-8.5,0-15.5-6.9-15.5-15.5c0-8.5,6.9-15.5,15.5-15.5s15.5,6.9,15.5,15.5 C-97.4,153.5-104.3,160.4-112.9,160.4z\" />\n <path style=\"fill: var(--pie-border-light, #B3ABA4); stroke: var(--pie-border-light, #CDC7C2); stroke-width: 0.5; stroke-miterlimit: 10;\" d=\"M-113.2,159c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-105.2,159-113.2,159z\" />\n <circle cx=\"-114.2\" cy=\"143.5\" r=\"14\" fill=\"var(--pie-background, white)\" />\n <path d=\"M-114.2,158c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-106.2,158-114.2,158z M-114.2,130c-7.4,0-13.5,6.1-13.5,13.5s6.1,13.5,13.5,13.5s13.5-6.1,13.5-13.5S-106.8,130-114.2,130z\" fill=\"var(--pie-tertiary-light, #bce2ff)\" />\n <polygon points=\"-114.8,150.7 -121.6,144.8 -119,141.8 -115.9,144.5 -111.3,136.3 -107.8,138.2\" fill=\"var(--pie-tertiary, #1a9cff)\" />\n </svg>\n {/if}\n </span>\n <span class=\"simple-cloze-toggle-label\">\n {tCommon(showingCorrectAnswer ? 'hideCorrectAnswer' : 'showCorrectAnswer', model?.language)}\n </span>\n </button>\n {/if}\n\n <div class=\"simple-cloze-response\">\n {#if isEvaluateMode && (isCorrect || showingCorrectAnswer)}\n <span class=\"correctness-icon correctness-icon--correct\" aria-hidden=\"true\">\n <svg fill=\"currentColor\" viewBox=\"0 0 24 24\" focusable=\"false\">\n <path d=\"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z\"/>\n </svg>\n </span>\n {:else if isEvaluateMode && isIncorrect}\n <span class=\"correctness-icon correctness-icon--incorrect\" aria-hidden=\"true\">\n <svg fill=\"currentColor\" viewBox=\"0 0 24 24\" focusable=\"false\">\n <path d=\"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z\"/>\n </svg>\n </span>\n {/if}\n <input\n bind:this={inputElement}\n type=\"text\"\n class=\"simple-cloze-input\"\n class:simple-cloze-input--correct={isEvaluateMode && (isCorrect || showingCorrectAnswer)}\n class:simple-cloze-input--incorrect={isEvaluateMode && isIncorrect && !showingCorrectAnswer}\n placeholder={t('placeholder', model?.language)}\n spellcheck=\"false\"\n aria-labelledby={prompt ? promptId : undefined}\n aria-label={prompt ? undefined : t('answerInput', model?.language)}\n aria-describedby={feedbackText ? feedbackId : undefined}\n disabled={model?.disabled}\n readonly={showingCorrectAnswer}\n oninput={handleInput}\n />\n <span id={feedbackId} class=\"sr-only\" role=\"status\">{feedbackText}</span>\n </div>\n</div>\n\n<style>\n /*\n * Self-contained: players ship no Tailwind, so nothing here relies on host\n * utility classes or a CSS reset. Colours are `--pie-*` theme variables with\n * the fallbacks `@pie-lib/render-ui`'s `color` module uses.\n */\n .simple-cloze-root {\n padding: 1rem;\n color: var(--pie-text, black);\n }\n\n .simple-cloze-prompt {\n margin-bottom: 1rem;\n }\n\n .simple-cloze-prompt :global(p) {\n margin: 0.5em 0;\n }\n\n .simple-cloze-prompt :global(strong) {\n font-weight: 600;\n }\n\n .simple-cloze-toggle {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n margin: 0 0 0.75rem;\n padding: 0;\n border: 0;\n background: transparent;\n color: inherit;\n font: inherit;\n cursor: pointer;\n user-select: none;\n }\n\n .simple-cloze-toggle:hover .simple-cloze-toggle-label {\n text-decoration: underline;\n }\n\n .simple-cloze-toggle:focus-visible {\n outline: 2px solid var(--pie-button-focus-outline, #3b82f6);\n outline-offset: 2px;\n }\n\n .simple-cloze-toggle-icon {\n display: inline-flex;\n }\n\n .simple-cloze-toggle-icon svg {\n width: 25px;\n height: 25px;\n }\n\n .simple-cloze-toggle-label {\n font-size: 0.875rem;\n line-height: 1.25rem;\n }\n\n .simple-cloze-response {\n position: relative;\n display: inline-block;\n }\n\n .simple-cloze-input {\n box-sizing: border-box;\n margin: 0;\n padding: 0.5rem 0.75rem;\n /* The text colour, as ECR's input border: a light grey fails 3:1 (WCAG 1.4.11). */\n border: 1px solid var(--pie-text, black);\n border-radius: 0.25rem;\n background-color: transparent;\n color: var(--pie-text, black);\n font: inherit;\n }\n\n .simple-cloze-input:disabled {\n opacity: 1;\n color: var(--pie-text, black);\n -webkit-text-fill-color: currentColor;\n }\n\n .simple-cloze-input:focus-visible {\n outline: 2px solid var(--pie-button-focus-outline, #3b82f6);\n outline-offset: 2px;\n }\n\n .simple-cloze-input--correct {\n border: 2px solid var(--pie-correct-tertiary, #0ea449);\n }\n\n .simple-cloze-input--incorrect {\n border: 2px solid var(--pie-incorrect-icon, #bf0d00);\n }\n\n .simple-cloze-input[readonly] {\n font-weight: 600;\n }\n\n .correctness-icon {\n position: absolute;\n top: -8px;\n left: -8px;\n border-radius: 50%;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n padding: 2px;\n color: var(--pie-background, #ffffff);\n }\n\n .correctness-icon svg {\n width: 12px;\n height: 12px;\n }\n\n .correctness-icon--correct {\n background-color: var(--pie-correct-tertiary, #0ea449);\n }\n\n .correctness-icon--incorrect {\n background-color: var(--pie-incorrect-icon, #bf0d00);\n }\n\n .sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n</style>\n","//#region src/write-session-in-place.ts\nfunction e(e) {\n\treturn !!e && typeof e == \"object\" && !Array.isArray(e);\n}\nfunction t(t, n) {\n\tif (t === n) return t;\n\tif (!e(t) || !e(n) || Object.isFrozen(t) || !Object.isExtensible(t)) return n;\n\ttry {\n\t\tfor (let e of Object.keys(t)) e in n || delete t[e];\n\t\tObject.assign(t, n);\n\t} catch {\n\t\treturn n;\n\t}\n\treturn t;\n}\n//#endregion\nexport { t as writeSessionInPlace };\n","//#region src/session-notifier.ts\nvar e = \"commitPendingSession\", t = /* @__PURE__ */ new WeakMap();\nfunction n(e, n) {\n\tlet r = t.get(e);\n\tr || (r = /* @__PURE__ */ new Set(), t.set(e, r)), r.add(n);\n}\nfunction r(t) {\n\treturn Object.getOwnPropertyDescriptor(t, e) !== void 0;\n}\nfunction i(t) {\n\tif (r(t)) return;\n\tlet n = t[e];\n\tObject.defineProperty(t, e, {\n\t\tvalue: () => {\n\t\t\tif (typeof n == \"function\") try {\n\t\t\t\tn.call(t);\n\t\t\t} catch {}\n\t\t\to(t);\n\t\t},\n\t\tconfigurable: !0,\n\t\tenumerable: !1,\n\t\twritable: !0\n\t});\n}\nfunction a(e, t, r = {}) {\n\tlet a = r.delayMs, o = typeof a == \"function\" ? a : () => a ?? 0, s = r.maxWaitMs, c = null, l = null, u = !1, d = () => {\n\t\tc !== null && (clearTimeout(c), c = null), l !== null && (clearTimeout(l), l = null);\n\t}, f = () => {\n\t\td(), u && (u = !1, t());\n\t}, p = {\n\t\tnotify() {\n\t\t\tu = !0, c !== null && clearTimeout(c), c = setTimeout(f, Math.max(0, o())), s !== void 0 && l === null && (l = setTimeout(f, Math.max(0, s)));\n\t\t},\n\t\tflush() {\n\t\t\tif (!u) {\n\t\t\t\td();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tf();\n\t\t\t} catch (e) {\n\t\t\t\tconsole.warn(\"[session-notifier] a committed session-changed dispatch threw\", e);\n\t\t\t}\n\t\t}\n\t};\n\treturn n(e, p), i(e), p;\n}\nfunction o(e) {\n\tlet n = t.get(e);\n\tif (n) for (let e of [...n]) e.flush();\n}\n//#endregion\n//#region ../../../node_modules/.bun/@pie-players+pie-context@1.0.0-beta.3/node_modules/@pie-players/pie-context/dist/events.js\nfunction s(e, t, n) {\n\tlet r = t.ownerDocument?.defaultView?.Event ?? Event;\n\treturn Object.assign(new r(e, {\n\t\tbubbles: !0,\n\t\tcomposed: !0\n\t}), n);\n}\nvar c = /* @__PURE__ */ new WeakSet(), l = (e, t) => typeof t == \"object\" && !!t && e.has(t), u = class {\n\tconstructor(e, t, n, r) {\n\t\tlet i = s(\"context-request\", t, {\n\t\t\tcontext: e,\n\t\t\tcontextTarget: t,\n\t\t\tcallback: n,\n\t\t\tsubscribe: r ?? !1\n\t\t});\n\t\treturn c.add(i), i;\n\t}\n\tstatic [Symbol.hasInstance](e) {\n\t\treturn l(c, e);\n\t}\n}, d = (e) => {\n\tlet t = [];\n\tfor (let n of e) n.requestorRef.deref() && n.callbackRef.deref() && t.push(n);\n\treturn t;\n}, f = class {\n\thost;\n\tpendingByContext = /* @__PURE__ */ new Map();\n\tattached = !1;\n\tconstructor(e) {\n\t\tthis.host = e;\n\t}\n\tattach() {\n\t\tthis.attached || (this.attached = !0, this.host.addEventListener(\"context-request\", this.onContextRequest), this.host.addEventListener(\"context-provider\", this.onContextProvider));\n\t}\n\tdetach() {\n\t\tthis.attached && (this.attached = !1, this.host.removeEventListener(\"context-request\", this.onContextRequest), this.host.removeEventListener(\"context-provider\", this.onContextProvider), this.pendingByContext.clear());\n\t}\n\tonContextRequest = (e) => {\n\t\tif (e.cancelBubble) return;\n\t\tlet t = e;\n\t\tif (t.subscribe !== !0 || typeof t.callback != \"function\" || t.context === void 0) return;\n\t\tlet n = t.contextTarget ?? e.composedPath?.()[0];\n\t\tif (!n) return;\n\t\tlet r = this.pendingByContext.get(t.context);\n\t\tr || (r = {\n\t\t\tcallbacks: /* @__PURE__ */ new WeakMap(),\n\t\t\trequests: []\n\t\t}, this.pendingByContext.set(t.context, r));\n\t\tlet i = t.callback, a = r.callbacks.get(n);\n\t\ta || (a = /* @__PURE__ */ new WeakSet(), r.callbacks.set(n, a)), !a.has(i) && (a.add(i), r.requests.push({\n\t\t\trequestorRef: new WeakRef(n),\n\t\t\tcallbackRef: new WeakRef(i)\n\t\t}), r.requests = d(r.requests));\n\t};\n\tonContextProvider = (e) => {\n\t\tlet t = e.context;\n\t\tif (t === void 0) return;\n\t\tlet n = this.pendingByContext.get(t);\n\t\tif (!(!n || n.requests.length === 0)) {\n\t\t\tthis.pendingByContext.delete(t);\n\t\t\tfor (let e of n.requests) {\n\t\t\t\tlet n = e.requestorRef.deref(), r = e.callbackRef.deref();\n\t\t\t\t!n || !r || n.dispatchEvent(new u(t, n, r, !0));\n\t\t\t}\n\t\t}\n\t};\n}, p = Symbol.for(\"pie.context.documentRoot\");\nfunction m(e) {\n\tif (!e) return;\n\tlet t = e;\n\tif (t[p]) return;\n\tlet n = e.documentElement;\n\tif (!n) return;\n\tlet r = new f(n);\n\tr.attach(), t[p] = r;\n}\n//#endregion\n//#region ../../../node_modules/.bun/@pie-players+pie-context@1.0.0-beta.3/node_modules/@pie-players/pie-context/dist/consumer.js\nvar h = class {\n\thost;\n\tcontext;\n\tsubscribe;\n\tonValue;\n\tisConnected = !1;\n\tisDisconnected = !1;\n\tunsubscribe;\n\tcurrentValue;\n\tconstructor(e, t) {\n\t\tthis.host = e, this.context = t.context, this.subscribe = t.subscribe ?? !0, this.onValue = t.onValue;\n\t}\n\tconnect() {\n\t\tthis.isConnected || (this.isConnected = !0, this.isDisconnected = !1, this.subscribe && m(this.host.ownerDocument), this.requestValue());\n\t}\n\tdisconnect() {\n\t\tthis.isConnected && (this.isConnected = !1, this.isDisconnected = !0, this.unsubscribe?.(), this.unsubscribe = void 0);\n\t}\n\tget value() {\n\t\treturn this.currentValue;\n\t}\n\thandleValue = (e, t) => {\n\t\tif (this.isDisconnected) {\n\t\t\tt?.();\n\t\t\treturn;\n\t\t}\n\t\tt !== this.unsubscribe && (this.unsubscribe?.(), this.unsubscribe = t), !this.subscribe && this.unsubscribe && (this.unsubscribe(), this.unsubscribe = void 0), this.currentValue = e, this.onValue?.(e);\n\t};\n\trequestValue() {\n\t\tthis.host.dispatchEvent(new u(this.context, this.host, this.handleValue, this.subscribe));\n\t}\n}, g = (e, t, n) => {\n\tlet r = new h(e, {\n\t\tcontext: t,\n\t\tsubscribe: !0,\n\t\tonValue: n\n\t});\n\tr.connect();\n\tlet i = (e) => {\n\t\te.context === t && r.requestValue();\n\t};\n\treturn e.addEventListener(\"context-provider\", i), () => {\n\t\te.removeEventListener(\"context-provider\", i), r.disconnect();\n\t};\n}, _ = ((e) => e)(Symbol.for(\"pie.sessionCommit\")), v = 1500;\nfunction y(e) {\n\treturn typeof e == \"number\" && Number.isFinite(e) && e >= 0 ? e : v;\n}\nfunction b(e, t) {\n\treturn g(e, _, (e) => {\n\t\tt(y(e?.idleSaveDelayMs));\n\t});\n}\n//#endregion\n//#region src/index.ts\nvar x = class e extends CustomEvent {\n\tstatic {\n\t\tthis.TYPE = \"model-set\";\n\t}\n\tconstructor(t, n, r) {\n\t\tsuper(e.TYPE, {\n\t\t\tbubbles: !0,\n\t\t\tcomposed: !0,\n\t\t\tdetail: {\n\t\t\t\tcomplete: n,\n\t\t\t\tcomponent: t,\n\t\t\t\thasModel: r\n\t\t\t}\n\t\t}), this.component = t, this.complete = n;\n\t}\n}, S = class e extends CustomEvent {\n\tstatic {\n\t\tthis.TYPE = \"session-changed\";\n\t}\n\tconstructor(t, n) {\n\t\tsuper(e.TYPE, {\n\t\t\tbubbles: !0,\n\t\t\tcomposed: !0,\n\t\t\tdetail: {\n\t\t\t\tcomplete: n,\n\t\t\t\tcomponent: t\n\t\t\t}\n\t\t}), this.component = t, this.complete = n;\n\t}\n};\n//#endregion\nexport { v as DEFAULT_IDLE_SAVE_DELAY_MS, x as ModelSetEvent, e as SESSION_COMMIT_METHOD, S as SessionChangedEvent, a as createSessionNotifier, o as flushSessionNotifiers, y as resolveIdleSaveDelay, b as subscribeIdleSaveDelay };\n","import { writeSessionInPlace as e } from \"./index2.js\";\nimport { ModelSetEvent as t, SessionChangedEvent as n } from \"@pie-element/shared-player-events\";\n//#region src/delivery-element.ts\nfunction r(r, i) {\n\tlet a = r.element;\n\tif (!a) throw TypeError(\"defineDeliveryElement: the component was not compiled with `customElement`\");\n\tclass o extends a {\n\t\t#e;\n\t\t#t;\n\t\tconstructor() {\n\t\t\tsuper(), this.onSessionChange = (e) => {\n\t\t\t\tthis.writeSession(e), this.dispatchSessionChanged();\n\t\t\t};\n\t\t}\n\t\tset model(e) {\n\t\t\tthis.#e = e, super.model = e, queueMicrotask(() => {\n\t\t\t\tthis.dispatchEvent(new t(this.tagName.toLowerCase(), this.isComplete(), this.#e !== void 0));\n\t\t\t});\n\t\t}\n\t\tget model() {\n\t\t\treturn this.#e;\n\t\t}\n\t\tset session(e) {\n\t\t\tthis.#t = e, super.session = e, this.dispatchSessionChanged();\n\t\t}\n\t\tget session() {\n\t\t\treturn this.#t;\n\t\t}\n\t\tisComplete() {\n\t\t\treturn i.isComplete(this.#e, this.#t);\n\t\t}\n\t\twriteSession(t) {\n\t\t\tthis.#t = e(this.#t, t), super.session = t;\n\t\t}\n\t\tdispatchSessionChanged() {\n\t\t\tthis.dispatchEvent(new n(this.tagName.toLowerCase(), this.isComplete()));\n\t\t}\n\t}\n\treturn o;\n}\n//#endregion\nexport { r as defineDeliveryElement };\n","import SimpleClozeComponent from './SimpleCloze.svelte';\nimport { defineDeliveryElement } from '@pie-lib/delivery-events-svelte';\nimport type { SimpleClozeModel, SimpleClozeSession } from '../types.js';\n\n// The demo loader and players register it with customElements.define().\nconst SimpleClozeElement = defineDeliveryElement<SimpleClozeModel, SimpleClozeSession>(\n SimpleClozeComponent,\n {\n isComplete: (_model, session) =>\n typeof session?.value === 'string' && session.value.trim().length > 0,\n }\n);\n\nexport default SimpleClozeElement;\n"],"mappings":";;;;;;;iBAAA;;CAIA,IAAM,IAAI,EAAA,GAAA,QAAA,CAAA,GAAE,IAAQ,EAAA,GAAA,YAAA,CAAA,GAEhB,IAAW,EAAO,EAAK,GACrB,IAAU,qCAAqC,KAAK,OAAM,CAAE,CAAC,SAAS,EAAE,CAAC,CAAC,MAAM,GAAG,EAAE;;;;;;;;;;;;;;IAI1F,IAAG,EAAA,GACD,IAAA,EADF,CAAG,SACD,GAAA,EAAA,GASA,IAAG,EATH,GAAA,CAAA;UASA,SACQ,EAAkB,EAAI,CAAA,GAAC,EAAA,KAD/B,CAAI,KAVN,CAAG;IACD,GAAA,iBAAA,EAGgB,CAAQ,CAAA,KAHxB,GAAA,iBAIgB,CAAO,cAKvB,GAAG,MAAK,CAAO,KAAf,GAAG,UAA4F,CAAC,EAAA,CAAQ,CAAA;WAFtG,EAAQ,EAAA,CAAQ,IAAG,4BAA4B,2BAA2B,EAAQ,CAAA,CAAA,CAAA,cAPpF,SAKU,EAAO,GAAW,CAAC,EAAA,CAAQ,CAAA,CAAC,QANxC,CAAG;AAHI;;;;;;;;;;;iBCGR;;CAMA,IACE,IAAK,EAAA,GAAA,SAAA,GAAG,IAAI,GACZ,IAAO,EAAA,GAAA,WAAA,GAAG,IAAI,GACd,IAAe,EAAA,GAAA,mBAAA,CAAA,GAKX,IAAa,gBAAgB,KAAK,OAAM,CAAE,CAAC,SAAS,EAAE,CAAC,CAAC,MAAM,GAAG,EAAE,KACnE,IAAW,GAAG,EAAU,UACxB,IAAa,GAAG,EAAU,YAE5B,IAAuC,EAAO,IAAI,GAClD,IAAwC,EAAO,IAAI,GACnD,IAAoB,EAAO,EAAK,GAE9B,IAAc,QAAY,EAAK,CAAA,EAAE,SAAS,U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,OAAO,KAAKA;EACb;EACA,IAAI,QAAQ,GAAG;GACd,KAAKE,KAAK,GAAG,MAAM,UAAU,GAAG,KAAK,uBAAuB;EAC7D;EACA,IAAI,UAAU;GACb,OAAO,KAAKA;EACb;EACA,aAAa;GACZ,OAAO,EAAE,WAAW,KAAKF,IAAI,KAAKE,EAAE;EACrC;EACA,aAAa,GAAG;GACf,KAAKA,KAAKC,EAAE,KAAKD,IAAID,CAAC,GAAG,MAAM,UAAUA;EAC1C;EACA,yBAAyB;GACxB,KAAK,cAAc,IAAIG,EAAE,KAAK,QAAQ,YAAY,GAAG,KAAK,WAAW,CAAC,CAAC;EACxE;CACD;CACA,OAAO;AACR;;;AClCA,IAAM,IAAqB,EACzB,GACA,EACE,aAAa,GAAQ,MACnB,OAAO,GAAS,SAAU,YAAY,EAAQ,MAAM,KAAK,CAAC,CAAC,SAAS,EACxE,CACF"}
@@ -1,5 +1,5 @@
1
1
  import { A as e, C as t, D as n, E as r, F as i, I as a, L as o, M as s, N as c, O as l, P as u, R as d, S as f, T as p, _ as m, a as h, c as g, d as _, f as v, g as y, h as b, i as x, j as S, k as C, l as w, m as T, n as E, o as D, p as O, r as k, s as A, t as j, u as M, v as N, w as P, x as F, y as I, z as L } from "../client-e4ZTphpa.js";
2
- import { l as R, n as ee } from "../controller-1IBOQFFL.js";
2
+ import { n as R, u as ee } from "../controller-rsFIn-EH.js";
3
3
  import { Editor as te, Extension as ne } from "@tiptap/core";
4
4
  import { Plugin as re, PluginKey as ie, TextSelection as ae } from "@tiptap/pm/state";
5
5
  import { Table as oe, TableView as se } from "@tiptap/extension-table";
@@ -881,7 +881,7 @@ var Tt = wt, Et = I("<div class=\"input-container svelte-13ppn6m\"><span class=\
881
881
  };
882
882
  function At(e, n) {
883
883
  a(n, !0), w(e, kt);
884
- let o = E(n, "model", 7), s = E(n, "configuration", 7), p = `simple-cloze-correct-answer-${Math.random().toString(36).slice(2, 10)}`, g = u(() => ee(o() || void 0)), _ = u(() => ve(R.configuration, s()));
884
+ let o = E(n, "model", 7), s = E(n, "configuration", 7), p = `simple-cloze-correct-answer-${Math.random().toString(36).slice(2, 10)}`, g = u(() => R(o() || void 0)), _ = u(() => ve(ee.configuration, s()));
885
885
  function b(e) {
886
886
  let r = {
887
887
  ...t(g),
@@ -991,8 +991,11 @@ F(["input"]), j(At, {
991
991
  }, [], []);
992
992
  //#endregion
993
993
  //#region src/author/index.ts
994
- var jt = At.element;
994
+ var jt = At.element, Mt = Object.freeze({
995
+ name: "@pie-element/simple-cloze",
996
+ version: "0.1.9"
997
+ });
995
998
  //#endregion
996
- export { jt as default };
999
+ export { jt as default, Mt as piePackage };
997
1000
 
998
1001
  //# sourceMappingURL=index.js.map