@citolab/qti-components 10.0.0-next.2 → 10.0.0-next.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.
- package/cdn/index.global.js +1 -1
- package/cdn/index.js +4334 -2688
- package/dist/base.d.ts +39 -13
- package/dist/base.js +14 -1
- package/dist/{chunk-RU6332MD.js → chunk-2A52V5TQ.js} +4 -4
- package/dist/{chunk-2KP5UU5A.js → chunk-55WWIRLN.js} +117 -92
- package/dist/chunk-55WWIRLN.js.map +1 -0
- package/dist/{chunk-MI7774NV.js → chunk-5BP2A7BI.js} +2 -2
- package/dist/{chunk-35WWWFS6.js → chunk-DAESCCLR.js} +2 -2
- package/dist/chunk-DJ7PB252.js +7 -0
- package/dist/chunk-DJ7PB252.js.map +1 -0
- package/dist/{chunk-TDWJ6WZA.js → chunk-GPC53O7P.js} +166 -10
- package/dist/chunk-GPC53O7P.js.map +1 -0
- package/dist/{chunk-6U3YPHXU.js → chunk-H6DO5UHC.js} +277 -154
- package/dist/chunk-H6DO5UHC.js.map +1 -0
- package/dist/chunk-J6VX4N7M.js +197 -0
- package/dist/chunk-J6VX4N7M.js.map +1 -0
- package/dist/{chunk-3ZNECUPV.js → chunk-JIDSFFFD.js} +2 -2
- package/dist/{chunk-FD4AB6TM.js → chunk-KQ2LED4X.js} +2 -2
- package/dist/{chunk-6K3QWJHH.js → chunk-LPYZVKHX.js} +48 -7
- package/dist/chunk-LPYZVKHX.js.map +1 -0
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/chunk-PZ5AY32C.js.map +1 -0
- package/dist/{chunk-K3VKQ6QF.js → chunk-TB2OI3ED.js} +677 -1894
- package/dist/chunk-TB2OI3ED.js.map +1 -0
- package/dist/{chunk-GBZNFSFY.js → chunk-TSJGL6FI.js} +2 -2
- package/dist/{chunk-RSMYGGQK.js → chunk-TZCOXFPB.js} +1590 -610
- package/dist/chunk-TZCOXFPB.js.map +1 -0
- package/dist/chunk-UCXLDQYA.js +56 -0
- package/dist/chunk-UCXLDQYA.js.map +1 -0
- package/dist/chunk-WWY2H2YO.js +7 -0
- package/dist/chunk-WWY2H2YO.js.map +1 -0
- package/dist/{chunk-LFVPS7KB.js → chunk-XWRZP2RM.js} +2 -2
- package/dist/{chunk-TLAVOBEM.js → chunk-ZRORBAHB.js} +122 -3
- package/dist/chunk-ZRORBAHB.js.map +1 -0
- package/dist/computed.types.d-6Ht-HNRx.d.ts +80 -0
- package/dist/{config.context.d-BvU9r-Mg.d.ts → config.context.d-Dm11aAuw.d.ts} +21 -3
- package/dist/corrections.d.ts +137 -24
- package/dist/corrections.js +12 -12
- package/dist/corrections.js.map +1 -1
- package/dist/elements.d.ts +66 -73
- package/dist/elements.js +9 -6
- package/dist/index.d.ts +21 -17
- package/dist/index.js +47 -61
- package/dist/interactions.d.ts +98 -19
- package/dist/interactions.js +8 -3
- package/dist/item.css +1948 -1946
- package/dist/item.d.ts +8 -6
- package/dist/item.js +6 -5
- package/dist/item.types.d-Zc6ZQDhu.d.ts +25 -0
- package/dist/loader.d.ts +5 -3
- package/dist/loader.js +3 -2
- package/dist/processing.d.ts +19 -7
- package/dist/processing.js +4 -3
- package/dist/public-events.d-3dGip9pd.d.ts +105 -0
- package/dist/qti-components-jsx.d.ts +1780 -1727
- package/dist/{qti-condition-expression.d-VJH6cWxf.d.ts → qti-condition-expression.d-7Kd4LBxn.d.ts} +1 -1
- package/dist/{qti-expression.d-BPxEp8HU.d.ts → qti-expression.d-iH3w6mqf.d.ts} +2 -1
- package/dist/{qti-feedback.d-wMYNVkkj.d.ts → qti-feedback.d-CT0W-8Gm.d.ts} +8 -1
- package/dist/{qti-item.d-DgC1AQbY.d.ts → qti-item.d-CxP6KtCH.d.ts} +3 -2
- package/dist/{qti-rule-base.d-Bdzg8eGH.d.ts → qti-rule-base.d-CeKP0Ooi.d.ts} +2 -2
- package/dist/qti-test-state-CF9S8X9C.d.ts +68 -0
- package/dist/qti-test-state.d-D8Q89RzZ.d.ts +57 -0
- package/dist/{qti-test.d-DkpBNcsv.d.ts → qti-test.d-DBT-YpRu.d.ts} +124 -485
- package/dist/{qti-text-entry-interaction.d-q8u5BiVK.d.ts → qti-text-entry-interaction.d-m0EFv9no.d.ts} +221 -73
- package/dist/{qti-transform-test.d-BL7GGFJj.d.ts → qti-transform-test.d-Bb9vnLzP.d.ts} +1 -0
- package/dist/{interaction.d-g6XG0T0Z.d.ts → record.d-N1Bq7e1f.d.ts} +67 -4
- package/dist/{session.context.d-D5080LVx.d.ts → session.context.d-9gRdGK4T.d.ts} +7 -1
- package/dist/test-plugin-api.d.ts +134 -0
- package/dist/test-plugin-api.js +19 -0
- package/dist/test-plugin-api.js.map +1 -0
- package/dist/test.d.ts +26 -57
- package/dist/test.js +19 -48
- package/dist/transformers.d.ts +1 -1
- package/dist/transformers.js +2 -1
- package/dist/{item.types.d-B55QkJ92.d.ts → variables.d-DWHlTszN.d.ts} +8 -24
- package/package.json +16 -11
- package/dist/chunk-2KP5UU5A.js.map +0 -1
- package/dist/chunk-6K3QWJHH.js.map +0 -1
- package/dist/chunk-6U3YPHXU.js.map +0 -1
- package/dist/chunk-K3VKQ6QF.js.map +0 -1
- package/dist/chunk-RSMYGGQK.js.map +0 -1
- package/dist/chunk-TDWJ6WZA.js.map +0 -1
- package/dist/chunk-TLAVOBEM.js.map +0 -1
- package/dist/chunk-ZP6QQYSU.js +0 -7
- package/dist/chunk-ZP6QQYSU.js.map +0 -1
- package/dist/computed.types.d-gJrBeUMG.d.ts +0 -42
- /package/dist/{chunk-RU6332MD.js.map → chunk-2A52V5TQ.js.map} +0 -0
- /package/dist/{chunk-MI7774NV.js.map → chunk-5BP2A7BI.js.map} +0 -0
- /package/dist/{chunk-35WWWFS6.js.map → chunk-DAESCCLR.js.map} +0 -0
- /package/dist/{chunk-3ZNECUPV.js.map → chunk-JIDSFFFD.js.map} +0 -0
- /package/dist/{chunk-FD4AB6TM.js.map → chunk-KQ2LED4X.js.map} +0 -0
- /package/dist/{chunk-GBZNFSFY.js.map → chunk-TSJGL6FI.js.map} +0 -0
- /package/dist/{chunk-LFVPS7KB.js.map → chunk-XWRZP2RM.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../qti-corrections/src/components/item-correct-response-mode/item-correct-response-mode.ts","../../qti-corrections/src/components/item-show-candidate-correction/item-show-candidate-correction.ts","../../qti-corrections/src/components/styles.ts","../../qti-corrections/src/components/item-show-correct-response/item-show-correct-response.ts","../../qti-corrections/src/components/test-show-correct-response/test-show-correct-response.ts","../../qti-corrections/src/styles/correction.styles.ts","../../qti-corrections/src/elements/qti-gap-text-correction.ts","../../qti-corrections/src/mixins/active-element-correction.mixin.ts","../../qti-corrections/src/elements/qti-hotspot-choice-correction.ts","../../qti-corrections/src/elements/qti-hottext-correction.ts","../../qti-corrections/src/elements/qti-simple-associable-choice-correction.ts","../../qti-corrections/src/elements/qti-simple-choice-correction.ts","../../qti-corrections/src/mixins/correct-response.mixin.ts","../../qti-corrections/src/mixins/candidate-correction.mixin.ts","../../qti-corrections/src/mixins/drag-drop-correction.mixin.ts","../../qti-corrections/src/interactions/qti-associate-interaction-correction.ts","../../qti-corrections/src/mixins/choice-correction.mixin.ts","../../qti-corrections/src/interactions/qti-choice-interaction-correction.ts","../../qti-corrections/src/interactions/qti-extended-text-interaction-correction.ts","../../qti-corrections/src/interactions/shared.ts","../../qti-corrections/src/interactions/qti-gap-match-interaction-correction.ts","../../qti-corrections/src/interactions/qti-graphic-associate-interaction-correction.ts","../../qti-corrections/src/interactions/qti-graphic-gap-match-interaction-correction.ts","../../qti-corrections/src/interactions/qti-graphic-order-interaction-correction.ts","../../qti-corrections/src/interactions/qti-hotspot-interaction-correction.ts","../../qti-corrections/src/interactions/qti-hottext-interaction-correction.ts","../../qti-corrections/src/interactions/qti-inline-choice-interaction-correction.ts","../../qti-corrections/src/interactions/qti-match-interaction-correction.ts","../../qti-corrections/src/utils/longest-increasing-subsequence.ts","../../qti-corrections/src/interactions/qti-order-interaction-correction.ts","../../qti-corrections/src/interactions/qti-portable-custom-interaction-correction.ts","../../qti-corrections/src/interactions/qti-select-point-interaction-correction.ts","../../qti-corrections/src/interactions/qti-slider-interaction-correction.ts","../../qti-corrections/src/interactions/qti-text-entry-interaction-correction.ts","../../qti-corrections/src/components/qti-assessment-item-correction.ts","../../qti-corrections/src/components/qti-item-correction.ts","../../qti-corrections/src/components/test-correction-elements.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { consume } from '@lit/context';\n\nimport { configContext } from '@qti-components/base';\n\nimport type { ConfigContext } from '@qti-components/base';\nimport type { CorrectionConfig, CorrectResponseMode } from '../../context/correction-config';\n\nexport class ItemCorrectResponseMode extends LitElement {\n @consume({ context: configContext, subscribe: true })\n private itemContext: ConfigContext & CorrectionConfig;\n\n @property({ type: String })\n label = 'Correct response mode';\n\n @state()\n private _options = {\n internal: 'Internal',\n full: 'Full (copy)'\n };\n\n #switchMode(view: CorrectResponseMode) {\n this.dispatchEvent(\n new CustomEvent('item-switch-correct-response-mode', {\n detail: view,\n bubbles: true\n })\n );\n }\n\n override render() {\n return html`\n <label part=\"label\" for=\"modeSelect\">${this.label}</label>\n <select\n part=\"select\"\n id=\"modeSelect\"\n @change=${(e: Event) => {\n const el = e.target as HTMLSelectElement;\n this.#switchMode(el.value as CorrectResponseMode);\n }}\n >\n ${Object.keys(this._options).map(\n value =>\n html`<option value=\"${value}\" ?selected=${value === this.itemContext?.correctResponseMode}>\n ${this._options[value as keyof typeof this._options]}\n </option>`\n )}\n </select>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'item-correct-response-mode': ItemCorrectResponseMode;\n }\n}\n","import { css, html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { consume } from '@lit/context';\n\nimport { computedItemContext } from '@qti-components/base';\n\nimport * as styles from '../styles';\n\nimport type { ComputedItemContext } from '@qti-components/base';\n\nexport class ItemShowCandidateCorrection extends LitElement {\n @consume({ context: computedItemContext, subscribe: true })\n public computedContext?: ComputedItemContext;\n\n static override styles = css`\n :host {\n ${styles.hostBox};\n }\n div {\n ${styles.btn};\n }\n :host([disabled]) {\n ${styles.dis};\n }\n `;\n\n @property({ type: Boolean, reflect: true }) shown = false;\n @property({ type: Boolean, reflect: true }) disabled = false; // Reflects to `disabled` attribute\n @property({ type: String }) showCandidateCorrectionText = 'Show candidate correction';\n @property({ type: String }) hideCandidateCorrectionText = 'Hide candidate correction';\n @property({ type: String }) noCorrectResponseText = 'No correct response specified';\n\n #hasCorrectResponse = false; // correct response is removed on certain point\n #previousActiveItem = ''; // Store previous active item reference\n\n constructor() {\n super();\n }\n\n override updated() {\n if (!this.#hasCorrectResponse || this.#previousActiveItem !== this.computedContext?.identifier) {\n this.#previousActiveItem = this.computedContext?.identifier;\n const containsCorrectResponse = !!this.computedContext?.variables.some(v => (v as any)['correctResponse']);\n const containsMapping = !!this.computedContext?.variables.some(v => {\n return (v as any)['mapping']?.mapEntries?.length > 0 || (v as any)['areaMapping']?.areaMapEntries?.length > 0;\n });\n this.#hasCorrectResponse = containsCorrectResponse || containsMapping;\n }\n this.disabled = !this.#hasCorrectResponse;\n }\n\n #toggleState() {\n if (this.disabled) return; // Prevent toggle if disabled\n\n this.dispatchEvent(\n new CustomEvent('item-show-candidate-correction', {\n detail: !this.shown,\n bubbles: true\n })\n );\n }\n\n #getDisplayedText(): string {\n return this.disabled\n ? this.noCorrectResponseText\n : this.shown\n ? this.hideCandidateCorrectionText\n : this.showCandidateCorrectionText;\n }\n\n override render() {\n return html` <div @click=\"${this.#toggleState}\">${this.#getDisplayedText()}</div> `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'item-show-candidate-correction': ItemShowCandidateCorrection;\n }\n}\n","import { css } from 'lit';\n\n/*\n * The look sits on an inner element, not on the host: a page's reset (Tailwind's preflight: `* { padding: 0 }`) is a page\n * rule and beats the `:host` rules of a shadow root, so a host that paints its own padding loses it. The inner element\n * is in the shadow tree, out of reach of the page's `*`. The host keeps its display, cursor and radius.\n */\nexport const hostBox = css`\n display: inline-flex;\n cursor: pointer;\n border-radius: 0.25rem;\n user-select: none;\n`;\n\nexport const form = css`\n display: flex;\n flex: 1 1 auto;\n align-items: center;\n cursor: pointer;\n padding: 0.5rem 1rem;\n border-radius: 0.25rem;\n user-select: none;\n`;\n\nexport const btn = css`\n background-color: lightgray;\n ${form};\n`;\n\nexport const dis = css`\n cursor: not-allowed;\n opacity: 0.8;\n`;\n\nexport const ind = css`\n ${form};\n border: 1px solid gray;\n`;\n","import { css, html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { consume } from '@lit/context';\n\nimport { computedItemContext } from '@qti-components/base';\n\nimport * as styles from '../styles';\n\nimport type { ComputedItemContext } from '@qti-components/base';\n\nexport class ItemShowCorrectResponse extends LitElement {\n @consume({ context: computedItemContext, subscribe: true })\n public computedContext?: ComputedItemContext;\n\n static override styles = css`\n :host {\n ${styles.hostBox};\n }\n div {\n ${styles.btn};\n }\n :host([disabled]) {\n ${styles.dis};\n }\n `;\n\n @property({ type: Boolean, reflect: true }) shown = false;\n @property({ type: Boolean, reflect: true }) disabled = false; // Reflects to `disabled` attribute\n @property({ type: String }) showCorrectText = 'Show correct response';\n @property({ type: String }) hideCorrectText = 'Hide correct response';\n @property({ type: String }) noCorrectResponseText = 'No correct response specified';\n\n #hasCorrectResponse = false; // correct response is removed on certain point\n #previousActiveItem = ''; // Store previous active item reference\n\n override updated() {\n if (!this.#hasCorrectResponse || this.#previousActiveItem !== this.computedContext?.identifier) {\n this.#previousActiveItem = this.computedContext?.identifier;\n const containsCorrectResponse = !!this.computedContext?.variables.some(v => (v as any)['correctResponse']);\n const containsMapping = !!this.computedContext?.variables.some(v => {\n return (v as any)['mapping']?.mapEntries?.length > 0 || (v as any)['areaMapping']?.areaMapEntries?.length > 0;\n });\n this.#hasCorrectResponse = containsCorrectResponse || containsMapping;\n }\n this.disabled = !this.#hasCorrectResponse;\n }\n\n #toggleState() {\n if (this.disabled) return; // Prevent toggle if disabled\n\n this.dispatchEvent(\n new CustomEvent('item-show-correct-response', {\n detail: !this.shown,\n bubbles: true\n })\n );\n }\n\n #getDisplayedText(): string {\n return this.disabled ? this.noCorrectResponseText : this.shown ? this.hideCorrectText : this.showCorrectText;\n }\n\n override render() {\n return html` <div @click=\"${this.#toggleState}\">${this.#getDisplayedText()}</div> `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'item-show-correct-response': ItemShowCorrectResponse;\n }\n}\n","import { css, html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { consume } from '@lit/context';\n\nimport { computedContext } from '@qti-components/base';\n\nimport * as styles from '../styles';\n\nimport type { ComputedContext } from '@qti-components/base';\n\n/**\n * A button that shows and hides the correct response of the active item. Put it inside\n * `<test-navigation>`: it reads the active item from there, and it is disabled when that item\n * declares no correct response or mapping. It switches back to \"show\" when the candidate moves on.\n *\n * Needs the corrections build (`@citolab/qti-components/corrections`), whose `<test-navigation>`\n * passes the request to the active item's `showCorrectResponse(show)`.\n *\n * @customElement test-show-correct-response\n * @fires test-show-correct-response - `detail` is `true` to show the correct response, `false` to hide it.\n */\nexport class TestShowCorrectResponse extends LitElement {\n @consume({ context: computedContext, subscribe: true })\n public computedContext?: ComputedContext;\n\n static override styles = css`\n :host {\n ${styles.hostBox};\n }\n div {\n ${styles.btn};\n }\n :host(:focus-visible) {\n outline: 2px solid currentColor;\n outline-offset: 2px;\n }\n :host([disabled]) {\n ${styles.dis};\n }\n `;\n\n #internals: ElementInternals;\n\n constructor() {\n super();\n this.#internals = this.attachInternals();\n this.#internals.role = 'button';\n this.addEventListener('click', () => this.#toggleState());\n this.addEventListener('keydown', event => {\n if (event.key !== 'Enter' && event.key !== ' ') return;\n event.preventDefault();\n this.#toggleState();\n });\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n if (!this.hasAttribute('tabindex')) this.tabIndex = 0;\n }\n\n @property({ type: Boolean, reflect: true }) shown = false;\n @property({ type: Boolean, reflect: true }) disabled = false;\n @property({ type: String }) showCorrectText = 'Show correct response';\n @property({ type: String }) hideCorrectText = 'Hide correct response';\n @property({ type: String }) noCorrectResponseText = 'No correct response specified';\n\n #previousActiveItem?: string; // The identifier of the item the control last showed\n\n override willUpdate(_changedProperties: Map<string | number | symbol, unknown>) {\n const activeItem = this.computedContext?.testParts\n .flatMap(testPart => testPart.sections.flatMap(section => section.items))\n .find(item => item.active);\n\n // Another item on screen: back to \"show\". By identifier, because the context is rebuilt (new\n // objects) on every change, also on the one this control's own toggle causes.\n if (this.#previousActiveItem !== activeItem?.identifier) {\n this.shown = false;\n this.#previousActiveItem = activeItem?.identifier;\n }\n\n if (activeItem) {\n const containsCorrectResponse = !!activeItem?.variables?.some(v => (v as any)['correctResponse']);\n const containsMapping = !!activeItem?.variables?.some(v => {\n return (v as any)['mapping']?.mapEntries?.length > 0 || (v as any)['areaMapping']?.areaMapEntries?.length > 0;\n });\n this.disabled = !containsCorrectResponse && !containsMapping;\n } else {\n this.disabled = true;\n }\n this.#internals.ariaDisabled = String(this.disabled);\n this.#internals.ariaPressed = String(this.shown);\n }\n #toggleState() {\n if (this.disabled) return;\n this.shown = !this.shown;\n\n this.dispatchEvent(\n new CustomEvent('test-show-correct-response', {\n detail: this.shown,\n bubbles: true\n })\n );\n }\n\n #getDisplayedText(): string {\n return this.disabled ? this.noCorrectResponseText : this.shown ? this.hideCorrectText : this.showCorrectText;\n }\n\n override render() {\n // The look is on this inner element (see `styles`), where a page's CSS reset does not reach.\n return html`<div part=\"button\">${this.#getDisplayedText()}</div>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'test-show-correct-response': TestShowCorrectResponse;\n }\n}\n","import { css } from 'lit';\n\n/**\n * The candidate-correction badge shared by correction-package elements.\n *\n * The component decides where the badge sits in the markup — last, after the label — and how big\n * its box is. It decides nothing about how it looks. The disc, the tick, the cross, and whether it\n * is lifted out of flow at all are the theme's, keyed on ::part(correction candidate-correct) /\n * ::part(correction candidate-incorrect) / ::part(correction candidate-partial) (CONTRACT.md §3; the\n * old single tokens correction-correct etc. stay on the part for one major).\n *\n * It replaces six implementations of one idea: four ::after glyph blocks in kennisnet, an\n * ::before/::after pair in order-interaction, and a .correct-option span that gap-match and match\n * built in JavaScript with inline styles. Several of those set margin-left and width inside a\n * :state(candidate-*) rule — a transient state doing layout, which is the bug this contract exists\n * to prevent.\n *\n * Reachable everywhere. A chip has three homes, and inside a drop target's shadow root the document\n * cannot see its badge: parts do not chain, so ::part(drag)::part(correction) is inert. A part\n * token survives exportparts, so one bare ::part(correction candidate-correct) reaches the badge in the drag\n * bank, on the floating clone, and inside a gap. Verified in Chromium.\n *\n * Deliberately not anchored, and not absolutely positioned. Both were tried; both left\n * qti-choice-interaction unable to reach layout stability, and the VRT stability detector spent 20\n * seconds waiting before capturing a half-settled frame. A theme that wants a corner badge can\n * position ::part(correction candidate-correct) itself — it is a part, that is the point.\n */\nexport const correctionPart = css`\n /* Nothing at all until the item judges this element. */\n [part~='correction'] {\n display: none;\n }\n\n [part~='correction'][part~='candidate-correct'],\n [part~='correction'][part~='candidate-incorrect'],\n [part~='correction'][part~='candidate-partial'] {\n display: inline-flex;\n flex: 0 0 auto;\n\n /*\n * The badge aligns ITSELF, and that is the whole of the vertical story.\n *\n * It is a flex item with a definite height, so left alone its cross-axis position is decided by\n * whatever its host says — and the hosts disagree: qti-simple-associable-choice defaults to\n * align-items: normal, and qti-gap-text gates center behind :not([part~='drag']), so the\n * same chip centred its badge in the bank and top-aligned it once placed. align-self settles it\n * from the badge's side, in one line, without touching a single container.\n *\n * This replaces an align-items/justify-content: center pair that had never done anything: the\n * badge is empty — a mask painted over a background — so centring its CONTENTS centres nothing.\n */\n align-self: center;\n\n box-sizing: border-box;\n width: var(--qti-correction-size, 1em);\n height: var(--qti-correction-size, 1em);\n margin-left: var(--qti-glyph-gap, 0.5em);\n\n pointer-events: none;\n }\n`;\n","import { html } from 'lit';\n\nimport { QtiGapText } from '@qti-components/interactions-core/elements/qti-gap-text';\n\nimport { ActiveElementCorrectionMixin } from '../mixins/active-element-correction.mixin';\nimport { correctionPart } from '../styles/correction.styles';\n\n/**\n * `qti-gap-text` with a verdict badge after its label; the verdict states come from `ActiveElementCorrectionMixin`.\n *\n * @cssstate candidate-correct - The candidate's answer on this element is correct.\n * @cssstate candidate-incorrect - The candidate's answer on this element is incorrect.\n * @cssstate candidate-partial - The candidate's answer on this element is partially correct (alias `candidate-partially-correct`, one major).\n * @csspart correction - The verdict badge; its second token is the verdict state (`candidate-correct`, `candidate-incorrect`, `candidate-partial`), followed by the old `correction-<verdict>` token for one major.\n */\nexport class QtiGapTextCorrection extends ActiveElementCorrectionMixin(QtiGapText) {\n static override styles = [QtiGapText.styles, correctionPart];\n\n override render() {\n return html`<div part=\"control\"></div>\n <slot part=\"label\"></slot>\n <span part=${this.correctionPart} aria-hidden=\"true\"></span>`;\n }\n}\n","import { setState } from '@qti-components/base';\n\ntype AbstractConstructor<T = {}> = abstract new (...args: any[]) => T;\n\nexport type CandidateCorrection = 'correct' | 'incorrect' | 'partially-correct' | null;\n\n/**\n * The `:state()` name of a verdict (CONTRACT.md §3): `candidate-correct`, `candidate-incorrect`,\n * `candidate-partial`. The third is the one place the state name is not `candidate-` + the value:\n * the old `candidate-partially-correct` is kept as an alias by `setState` for one major.\n */\nexport const verdictState = (value: Exclude<CandidateCorrection, null>): string =>\n value === 'partially-correct' ? 'candidate-partial' : `candidate-${value}`;\n\n/** The three verdict states, cleared together whenever a verdict changes. */\nexport const VERDICT_STATES = ['candidate-correct', 'candidate-incorrect', 'candidate-partial'] as const;\n\n/**\n * The badge's part: `correction`, plus the verdict as a second token and, for one major, the old\n * suffixed token (`correction candidate-partial correction-partially-correct`).\n */\nexport const correctionPartFor = (value: CandidateCorrection): string =>\n value ? `correction ${verdictState(value)} correction-${value}` : 'correction';\n\n/** Sets the verdict states on `states`: all three cleared (with their aliases), then one set. */\nexport const applyVerdictStates = (\n states: ElementInternals['states'] | undefined,\n value: CandidateCorrection\n): void => {\n for (const name of VERDICT_STATES) setState(states, name, false);\n if (value) setState(states, verdictState(value), true);\n};\n\nexport interface ActiveElementCorrectionInterface {\n candidateCorrection: CandidateCorrection;\n readonly correctionPart: string;\n}\n\ntype ActiveElement = HTMLElement & {\n readonly internals: ElementInternals;\n requestUpdate(name?: PropertyKey, oldValue?: unknown): unknown;\n};\n\n/**\n * Adds candidate-verdict state to a lean choice/chip element.\n *\n * @cssstate candidate-correct - The candidate's answer on this element is correct.\n * @cssstate candidate-incorrect - The candidate's answer on this element is incorrect.\n * @cssstate candidate-partial - The candidate's answer on this element is partially correct (alias `candidate-partially-correct`, one major).\n * @csspart correction - The verdict badge; its second token is the verdict state (`candidate-correct`, `candidate-incorrect`, `candidate-partial`), followed by the old `correction-<verdict>` token for one major.\n */\nexport const ActiveElementCorrectionMixin = <T extends AbstractConstructor<ActiveElement>>(superClass: T) => {\n abstract class ActiveElementCorrectionMixinClass extends superClass {\n #candidateCorrection: CandidateCorrection = null;\n\n public get candidateCorrection(): CandidateCorrection {\n return this.#candidateCorrection;\n }\n\n public set candidateCorrection(value: CandidateCorrection) {\n if (this.#candidateCorrection === value) return;\n const previous = this.#candidateCorrection;\n this.#candidateCorrection = value;\n\n applyVerdictStates(this.internals.states, value);\n this.requestUpdate('candidateCorrection', previous);\n }\n\n public get correctionPart(): string {\n return correctionPartFor(this.#candidateCorrection);\n }\n }\n\n return ActiveElementCorrectionMixinClass as unknown as AbstractConstructor<ActiveElementCorrectionInterface> & T;\n};\n","import { property } from 'lit/decorators.js';\n\nimport { QtiHotspotChoice } from '@qti-components/interactions-core/elements/qti-hotspot-choice';\n\nimport { ActiveElementCorrectionMixin } from '../mixins/active-element-correction.mixin';\n\nimport type { PropertyValues } from 'lit';\n\n/**\n * A hotspot choice that carries a verdict and, in graphic-order, its position in the answer key.\n *\n * The position is the attribute `data-order-correct` (a hotspot paints it as a pin in CSS, so it is\n * an attribute, not a state: the theme reads it as `[data-order-correct]`). The property still\n * reflects to its old name `aria-ordercorrectvalue` for one major; `updated()` mirrors it.\n *\n * @cssstate candidate-correct - This hotspot's answer is correct.\n * @cssstate candidate-incorrect - This hotspot's answer is incorrect.\n * @cssstate candidate-partial - This hotspot's answer is partially correct (alias `candidate-partially-correct`, one major).\n * @cssstate answer-key - In a hotspot interaction, this hotspot is part of the correct response (alias `correct-response`, one major).\n */\nexport class QtiHotspotChoiceCorrection extends ActiveElementCorrectionMixin(QtiHotspotChoice) {\n @property({ attribute: 'aria-ordercorrectvalue', type: Number, reflect: true })\n orderCorrect: number | null = null;\n\n protected override updated(changed: PropertyValues<this>): void {\n super.updated(changed);\n if (!changed.has('orderCorrect')) return;\n if (this.orderCorrect == null) this.removeAttribute('data-order-correct');\n else this.setAttribute('data-order-correct', String(this.orderCorrect));\n }\n}\n","import { html } from 'lit';\n\nimport { QtiHottext } from '@qti-components/interactions-core/elements/qti-hottext';\n\nimport { ActiveElementCorrectionMixin } from '../mixins/active-element-correction.mixin';\nimport { correctionPart } from '../styles/correction.styles';\n\n/**\n * `qti-hottext` with a verdict badge after its label; the verdict states come from `ActiveElementCorrectionMixin`.\n *\n * @cssstate candidate-correct - The candidate's answer on this element is correct.\n * @cssstate candidate-incorrect - The candidate's answer on this element is incorrect.\n * @cssstate candidate-partial - The candidate's answer on this element is partially correct (alias `candidate-partially-correct`, one major).\n * @cssstate answer-key - This element is part of the correct response (alias `correct-response`, one major).\n * @csspart correction - The verdict badge; its second token is the verdict state (`candidate-correct`, `candidate-incorrect`, `candidate-partial`), followed by the old `correction-<verdict>` token for one major.\n */\nexport class QtiHottextCorrection extends ActiveElementCorrectionMixin(QtiHottext) {\n static override styles = [QtiHottext.styles, correctionPart];\n\n override render() {\n return html`<div part=\"control\"><div part=\"control-mark\"></div></div>\n <slot part=\"label\"></slot>\n <span part=${this.correctionPart} aria-hidden=\"true\"></span>`;\n }\n}\n","import { html } from 'lit';\nimport { repeat } from 'lit/directives/repeat.js';\n\nimport { QtiSimpleAssociableChoice } from '@qti-components/interactions-core/elements/qti-simple-associable-choice';\n\nimport { ActiveElementCorrectionMixin } from '../mixins/active-element-correction.mixin';\nimport { correctionPart } from '../styles/correction.styles';\n\n/**\n * `qti-simple-associable-choice` with a verdict badge after its label; the verdict states come from `ActiveElementCorrectionMixin`.\n *\n * @cssstate candidate-correct - The candidate's answer on this element is correct.\n * @cssstate candidate-incorrect - The candidate's answer on this element is incorrect.\n * @cssstate candidate-partial - The candidate's answer on this element is partially correct (alias `candidate-partially-correct`, one major).\n * @csspart correction - The verdict badge; its second token is the verdict state (`candidate-correct`, `candidate-incorrect`, `candidate-partial`), followed by the old `correction-<verdict>` token for one major.\n */\nexport class QtiSimpleAssociableChoiceCorrection extends ActiveElementCorrectionMixin(QtiSimpleAssociableChoice) {\n static override styles = [QtiSimpleAssociableChoice.styles, correctionPart];\n\n override render() {\n return html`\n <div part=\"control\"></div>\n <slot part=\"label\"></slot>\n <span part=${this.correctionPart} aria-hidden=\"true\"></span>\n <div part=\"drop\">\n ${repeat(\n this.drags,\n node => node.getAttribute('identifier'),\n node => node\n )}\n </div>\n `;\n }\n}\n","import { html, nothing } from 'lit';\n\nimport { QtiSimpleChoice } from '@qti-components/interactions-core/elements/qti-simple-choice';\n\nimport { ActiveElementCorrectionMixin } from '../mixins/active-element-correction.mixin';\nimport { correctionPart } from '../styles/correction.styles';\n\n/**\n * `qti-simple-choice` with a verdict badge after its label; the verdict states come from `ActiveElementCorrectionMixin`.\n *\n * @cssstate candidate-correct - The candidate's answer on this element is correct.\n * @cssstate candidate-incorrect - The candidate's answer on this element is incorrect.\n * @cssstate candidate-partial - The candidate's answer on this element is partially correct (alias `candidate-partially-correct`, one major).\n * @cssstate answer-key - This element is part of the correct response (alias `correct-response`, one major).\n * @csspart correction - The verdict badge; its second token is the verdict state (`candidate-correct`, `candidate-incorrect`, `candidate-partial`), followed by the old `correction-<verdict>` token for one major.\n */\nexport class QtiSimpleChoiceCorrection extends ActiveElementCorrectionMixin(QtiSimpleChoice) {\n static override styles = [QtiSimpleChoice.styles, correctionPart];\n\n // Same template as QtiSimpleChoice plus the badge. No tabindex on the control: the choice takes\n // focus on its host, and a focusable control made every choice two Tab stops.\n override render() {\n return html`<div part=\"control\"><div part=\"control-mark\"></div></div>\n ${this.marker ? html`<div id=\"label\" part=\"marker\">${this.marker}</div>` : nothing}\n <slot part=\"label\"></slot>\n <span part=${this.correctionPart} aria-hidden=\"true\"></span>`;\n }\n}\n","import { property, state } from 'lit/decorators.js';\n\nimport { watch } from '@qti-components/utilities';\nimport { responseAttributeConverter, setState, type Interaction, type ResponseValue } from '@qti-components/base';\n\nimport type { CorrectionConfig } from '../context/correction-config';\n\ntype AbstractConstructor<T = {}> = abstract new (...args: any[]) => T;\n\nexport enum Correctness {\n Correct = 'correct',\n PartiallyCorrect = 'partially-correct',\n Incorrect = 'incorrect'\n}\n\n/**\n * Adds correct-response and full-correct-response behaviour\n * on top of any `Interaction` subclass.\n *\n * @cssstate answer-key - This host IS the answer key: the clone the full mode inserts after the\n * interaction.\n * @cssstate answer-key-shown - This host shows its answer key inline, next to the candidate's\n * answer (internal mode; alias `show-correct-response` for one major). The clone also carries the `answer-key` attribute and sits in a\n * `div.full-correct-response` wrapper, which a `<div>` has no internals to replace.\n * @csspart correction - The verdict badge, bare `correction` until a verdict is set.\n *\n * Usage:\n * ```ts\n * export abstract class CorrectableInteraction extends CorrectResponseMixin(Interaction) {}\n * ```\n *\n * Interactions that genuinely have no correct-response concept\n * (extended-text, upload, media) should extend `Interaction` directly\n * and omit this mixin.\n */\nexport const CorrectResponseMixin = <T extends AbstractConstructor<Interaction>>(superClass: T) => {\n abstract class CorrectResponseMixinClass extends superClass {\n // ─── Correct-response attribute ──────────────────────────────────────────\n\n /**\n * The correct response for this interaction. Can be set as a comma-separated\n * string via attribute or as string/string[] via property.\n *\n * @example\n * ```html\n * <qti-choice-interaction correct-response=\"A,B\">\n * ```\n */\n @property({\n attribute: 'correct-response',\n reflect: true,\n converter: responseAttributeConverter({ emptyAs: null })\n })\n set correctResponseAttr(val: ResponseValue) {\n this._correctResponse = val;\n }\n\n get correctResponseAttr(): ResponseValue {\n return this._correctResponse;\n }\n\n // ─── Show-correct-response ────────────────────────────────────────────────\n\n @property({ type: Boolean, attribute: 'show-correct-response', reflect: true })\n showCorrectResponse = false;\n\n @watch('showCorrectResponse', { waitUntilFirstUpdate: true })\n protected _handleShowCorrectResponseChange = (_: boolean, show: boolean) => {\n this.toggleInternalCorrectResponse(show);\n };\n\n // ─── Show-full-correct-response ───────────────────────────────────────────\n\n @property({ type: Boolean, attribute: 'show-full-correct-response', reflect: true })\n showFullCorrectResponse = false;\n\n @watch('showFullCorrectResponse', { waitUntilFirstUpdate: true })\n protected _handleShowFullCorrectResponseChange = (_: boolean, show: boolean) => {\n this.toggleFullCorrectResponse(show);\n };\n\n // ─── Show-candidate-correction ────────────────────────────────────────────\n\n @property({ type: Boolean, attribute: 'show-candidate-correction', reflect: true })\n showCandidateCorrection = false;\n\n @watch('showCandidateCorrection', { waitUntilFirstUpdate: true })\n protected _handleShowCandidateCorrectionChange = (_: boolean, show: boolean) => {\n this.toggleCandidateCorrection(show);\n };\n\n // ─── isFullCorrectResponse ────────────────────────────────────────────────\n\n @state()\n protected _isFullCorrectResponse: boolean;\n\n get isFullCorrectResponse(): boolean {\n return this._isFullCorrectResponse;\n }\n\n protected override get registersWithItem(): boolean {\n return !this.isFullCorrectResponse && super.registersWithItem;\n }\n\n set isFullCorrectResponse(val: boolean) {\n this._isFullCorrectResponse = val;\n if (val) {\n // `inert` already makes the answer-key clone non-interactive. Do NOT also set `disabled`:\n // it would mark every choice `:state(disabled)`, which the theme dims (opacity), fading the\n // answer key that is meant to be crisp. inert is enough.\n this.setAttribute('inert', '');\n this.setAttribute('response-identifier', this.responseIdentifier + '_cr');\n // An answer key shows the answer, not the means of giving one, so every drag-drop\n // interaction hides its chip bank here. Each one does that in its own stylesheet, keyed on\n // this attribute — hiding removes a box from the flow, which makes it layout, and layout is\n // not the theme's to declare (CONTRACT.md §7).\n //\n // The class the theme used instead, `.full-correct-response`, is on the wrapper *around*\n // this element, so only a document selector could see it. This attribute is on the clone\n // itself, which is what a shadow root can reach.\n this.setAttribute('answer-key', '');\n // The clone has internals, so it carries the state too (CONTRACT.md §3). Only the new name:\n // the clone never had `show-correct-response`, whose paint is the internal mode's outline.\n setState(this._internals.states, 'answer-key', true, []);\n }\n }\n\n // ─── correctResponse property ─────────────────────────────────────────────\n\n @state()\n protected _correctResponse: string | string[] | null = null;\n\n get correctResponse(): Readonly<string | string[] | null> {\n const responseVariable = this.responseVariable;\n if (responseVariable?.correctResponse) {\n return responseVariable.correctResponse;\n }\n return this._correctResponse;\n }\n\n set correctResponse(val: Readonly<string | string[] | null>) {\n const oldVal = this._correctResponse;\n this._correctResponse = val as string | string[] | null;\n if (val === null || val === undefined) {\n this.removeAttribute('correct-response');\n } else {\n this.setAttribute('correct-response', Array.isArray(val) ? val.join(',') : (val as string));\n }\n this.requestUpdate('_correctResponse', oldVal);\n }\n\n // ─── correctness getter ───────────────────────────────────────────────────\n\n get correctness(): Readonly<Correctness | null> {\n const correctResponse = this.correctResponse;\n if (!correctResponse) return null;\n\n const currentResponse = this.response;\n if (\n currentResponse === null ||\n currentResponse === undefined ||\n currentResponse === '' ||\n (Array.isArray(currentResponse) && currentResponse.length === 0)\n ) {\n return null;\n }\n\n const correctArr = Array.isArray(correctResponse) ? correctResponse : [correctResponse];\n const responseArr = Array.isArray(currentResponse) ? currentResponse : [currentResponse];\n const filteredResponseArr = responseArr.filter(r => r !== '');\n if (filteredResponseArr.length === 0) return null;\n\n const correctCount = filteredResponseArr.filter(r => correctArr.includes(r)).length;\n const incorrectCount = filteredResponseArr.filter(r => !correctArr.includes(r)).length;\n\n if (\n correctCount === correctArr.length &&\n incorrectCount === 0 &&\n filteredResponseArr.length === correctArr.length\n ) {\n return Correctness.Correct;\n }\n\n if (correctCount > 0 && (correctCount < correctArr.length || incorrectCount > 0)) {\n return Correctness.PartiallyCorrect;\n }\n\n return Correctness.Incorrect;\n }\n\n // ─── correctionPart ───────────────────────────────────────────────────────\n\n public get correctionPart(): string {\n return 'correction';\n }\n\n // ─── toggle methods ───────────────────────────────────────────────────────\n\n public toggleCorrectResponse(show: boolean): void {\n const correctionConfig = this.configContext as CorrectionConfig | undefined;\n const correctResponseMode = correctionConfig?.correctResponseMode || 'internal';\n\n if (correctResponseMode === 'full') {\n this.toggleFullCorrectResponse(show);\n } else {\n this.toggleInternalCorrectResponse(show);\n }\n }\n\n /**\n * Whether the full correct response is withheld from a candidate who is already correct.\n *\n * Withheld by default, unless the item configures `fullCorrectResponseOnlyWhenIncorrect: false`\n * — the behaviour `show-full-correct-response` has always had, on the reasoning that a correct\n * answer already *is* the key.\n *\n * An interaction that routes its internal mode here overrides this to false: there, the caller\n * asked to show the correct response, and silently showing nothing is worse than showing the\n * candidate the answer they already gave.\n */\n protected get withholdsFullCorrectResponseWhenCorrect(): boolean {\n return (this.configContext as CorrectionConfig | undefined)?.fullCorrectResponseOnlyWhenIncorrect !== false;\n }\n\n protected async toggleFullCorrectResponse(show: boolean): Promise<void> {\n const nextSibling = this.nextSibling;\n const nextSiblingIsFullCorrectResponse =\n nextSibling instanceof HTMLDivElement && nextSibling?.classList.contains('full-correct-response');\n\n const correctResponse = this.correctResponse;\n\n if (!correctResponse) {\n return;\n }\n\n const showFullCorrectResponse =\n show && (!this.withholdsFullCorrectResponseWhenCorrect || this.correctness !== Correctness.Correct);\n\n if (!showFullCorrectResponse) {\n if (!nextSiblingIsFullCorrectResponse) {\n return;\n }\n this.parentElement?.removeChild(nextSibling);\n return;\n }\n\n if (nextSiblingIsFullCorrectResponse) {\n return;\n }\n\n const clone = this.cloneNode(true) as Interaction & CorrectResponseMixinClass;\n\n clone.removeAttribute('show-full-correct-response');\n clone.removeAttribute('show-correct-response');\n clone.removeAttribute('show-candidate-correction');\n\n const containerDiv = document.createElement('div');\n containerDiv.classList.add('full-correct-response');\n if (this.isInline) {\n containerDiv.classList.add('full-correct-response-inline');\n } else {\n containerDiv.classList.add('full-correct-response-block');\n }\n containerDiv.role = 'full-correct-response';\n containerDiv.appendChild(clone);\n\n clone.isFullCorrectResponse = true;\n\n this.parentElement?.insertBefore(containerDiv, this.nextSibling);\n await clone.updateComplete;\n\n clone.response = Array.isArray(correctResponse)\n ? ([...correctResponse] as string[])\n : (correctResponse as string);\n }\n\n public toggleInternalCorrectResponse(show: boolean): void {\n // The host shows its key inline, next to the candidate's answer: `answer-key-shown`, not\n // `answer-key`, which is what the clone (and a choice in the key) IS. `show-correct-response`\n // is the old name, set for one major; `correct-response` was a choice's and never a host's\n // (see `ChoiceCorrectionMixin`).\n setState(this._internals.states, 'answer-key-shown', Boolean(show && this.correctResponse), [\n 'show-correct-response'\n ]);\n }\n\n public toggleCandidateCorrection(show: boolean): void {\n if (!show) {\n return;\n }\n }\n\n // ─── Lifecycle ────────────────────────────────────────────────────────────\n\n protected override firstUpdated(): void {\n super.firstUpdated();\n\n if (this.isFullCorrectResponse) {\n return;\n }\n\n if (this.showCorrectResponse) {\n this.toggleInternalCorrectResponse(true);\n }\n if (this.showFullCorrectResponse) {\n this.toggleFullCorrectResponse(true);\n }\n }\n }\n\n // Cast strips the anonymous class type so TypeScript can generate clean .d.ts\n // for any named class that extends this mixin (avoids TS4094).\n return CorrectResponseMixinClass as unknown as AbstractConstructor<CorrectResponseInterface> & T;\n};\n\n/** Public type surface exposed by `CorrectResponseMixin`. */\nexport interface CorrectResponseInterface {\n correctResponseAttr: ResponseValue;\n showCorrectResponse: boolean;\n showFullCorrectResponse: boolean;\n showCandidateCorrection: boolean;\n isFullCorrectResponse: boolean;\n correctResponse: Readonly<string | string[] | null>;\n readonly correctness: Readonly<Correctness | null>;\n readonly correctionPart: string;\n toggleCorrectResponse(show: boolean): void;\n toggleCandidateCorrection(show: boolean): void;\n /** Protected at runtime; exposed here so subclasses can call `super.toggleInternalCorrectResponse()`. */\n toggleInternalCorrectResponse(show: boolean): void;\n /** Protected at runtime. */\n toggleFullCorrectResponse(show: boolean): Promise<void>;\n /** Protected at runtime; declared here so a subclass can `override` it. */\n readonly withholdsFullCorrectResponseWhenCorrect: boolean;\n}\n","import { state } from 'lit/decorators.js';\n\nimport { applyVerdictStates, correctionPartFor, type CandidateCorrection } from './active-element-correction.mixin';\nimport { CorrectResponseMixin, Correctness, type CorrectResponseInterface } from './correct-response.mixin';\n\nimport type { Interaction } from '@qti-components/base';\n\ntype AbstractConstructor<T = {}> = abstract new (...args: any[]) => T;\n\n/**\n * Judges the interaction's own response against its correct response and exposes the verdict.\n *\n * @cssstate candidate-correct - The candidate's response is correct.\n * @cssstate candidate-incorrect - The candidate's response is incorrect.\n * @cssstate candidate-partial - The candidate's response is partially correct (alias `candidate-partially-correct`, one major).\n * @csspart correction - The verdict badge; its second token is the verdict state (`candidate-correct`, `candidate-incorrect`, `candidate-partial`), followed by the old `correction-<verdict>` token for one major.\n */\nexport const CandidateCorrectionMixin = <T extends AbstractConstructor<Interaction>>(superClass: T) => {\n abstract class CandidateCorrectionMixinClass extends CorrectResponseMixin(superClass) {\n @state() private _candidateCorrection: CandidateCorrection = null;\n\n public override get correctionPart(): string {\n return correctionPartFor(this._candidateCorrection);\n }\n\n public override toggleCandidateCorrection(show: boolean): void {\n if (this.showCandidateCorrection !== show) {\n this.showCandidateCorrection = show;\n }\n\n super.toggleCandidateCorrection(show);\n\n const internals = (this as unknown as { _internals: ElementInternals })._internals;\n\n let verdict: CandidateCorrection = null;\n\n if (show) {\n if (this.correctness === Correctness.Correct) verdict = 'correct';\n if (this.correctness === Correctness.PartiallyCorrect) verdict = 'partially-correct';\n if (this.correctness === Correctness.Incorrect) verdict = 'incorrect';\n }\n\n applyVerdictStates(internals.states, verdict);\n\n if (this._candidateCorrection !== verdict) {\n this._candidateCorrection = verdict;\n }\n }\n\n override connectedCallback(): void {\n super.connectedCallback?.();\n\n queueMicrotask(() => {\n if (!this.isConnected || this.isFullCorrectResponse) {\n return;\n }\n if (this.showCandidateCorrection) {\n this.toggleCandidateCorrection(true);\n }\n });\n }\n }\n\n return CandidateCorrectionMixinClass as unknown as AbstractConstructor<CorrectResponseInterface> & T;\n};\n","import { CandidateCorrectionMixin } from './candidate-correction.mixin';\n\nimport type { Interaction } from '@qti-components/base';\nimport type { CorrectResponseInterface } from './correct-response.mixin';\n\ntype AbstractConstructor<T = {}> = abstract new (...args: any[]) => T;\n\ntype DragDropInteraction = Interaction & {\n afterCache(): void;\n};\n\n/** Adds correction lifecycle behavior shared by drag-and-drop interactions. */\nexport const DragDropCorrectionMixin = <T extends AbstractConstructor<DragDropInteraction>>(superClass: T) => {\n abstract class DragDropCorrectionMixinClass extends CandidateCorrectionMixin(superClass) {\n public override toggleInternalCorrectResponse(show: boolean): void {\n if (!this.showFullCorrectResponse) {\n this.toggleFullCorrectResponse(show);\n }\n }\n\n public override afterCache(): void {\n super.afterCache();\n if (this.showCorrectResponse) this.toggleInternalCorrectResponse(true);\n if (this.showCandidateCorrection) this.toggleCandidateCorrection(true);\n if (this.showFullCorrectResponse) this.toggleFullCorrectResponse(true);\n }\n }\n\n return DragDropCorrectionMixinClass as unknown as AbstractConstructor<CorrectResponseInterface> & T;\n};\n","import { QtiAssociateInteraction } from '@qti-components/associate-interaction/elements';\n\nimport { DragDropCorrectionMixin } from '../mixins/drag-drop-correction.mixin';\n\nexport class QtiAssociateInteractionCorrection extends DragDropCorrectionMixin(QtiAssociateInteraction) {}\n","import { setState } from '@qti-components/base';\n\nimport { CandidateCorrectionMixin } from './candidate-correction.mixin';\n\nimport type { Interaction } from '@qti-components/base';\nimport type { CorrectResponseInterface } from './correct-response.mixin';\n\ntype AbstractConstructor<T = {}> = abstract new (...args: any[]) => T;\n\ntype CorrectableChoice = HTMLElement & {\n identifier: string;\n internals: ElementInternals;\n candidateCorrection: 'correct' | 'incorrect' | 'partially-correct' | null;\n};\n\ntype ChoicesCorrectionBase = Interaction & {\n readonly response: string | string[] | null;\n readonly internals: ElementInternals;\n};\n\n/**\n * Adds per-choice candidate marking to interactions built on `ChoicesMixin`.\n *\n * Each choice gets its own states (CONTRACT.md §3): the verdict through its `candidateCorrection`\n * (`ActiveElementCorrectionMixin`), and `answer-key` when it is part of the correct response (alias\n * `correct-response`, one major). A choice outside the key gets nothing; the old `incorrect-response`\n * was never styled and is gone.\n */\nexport const ChoiceCorrectionMixin = <T extends AbstractConstructor<ChoicesCorrectionBase>>(superClass: T) => {\n abstract class ChoiceCorrectionMixinClass extends CandidateCorrectionMixin(superClass) {\n declare protected _choiceElements: CorrectableChoice[];\n\n public override toggleInternalCorrectResponse(show: boolean): void {\n super.toggleInternalCorrectResponse(show);\n\n const correctResponse = this.correctResponse;\n const correctResponses = correctResponse\n ? Array.isArray(correctResponse)\n ? correctResponse\n : [correctResponse]\n : [];\n\n for (const choice of this._choiceElements) {\n const inKey = show && correctResponses.includes(choice.identifier);\n setState(choice.internals.states, 'answer-key', inKey, ['correct-response']);\n }\n }\n\n public override toggleCandidateCorrection(show: boolean): void {\n super.toggleCandidateCorrection(show);\n\n for (const choice of this._choiceElements) {\n choice.candidateCorrection = null;\n }\n\n if (!show || !this.correctResponse) {\n return;\n }\n\n const correctResponses = Array.isArray(this.correctResponse) ? this.correctResponse : [this.correctResponse];\n const candidateResponses = Array.isArray(this.response) ? this.response : this.response ? [this.response] : [];\n\n for (const choice of this._choiceElements) {\n if (!candidateResponses.includes(choice.identifier)) {\n continue;\n }\n choice.candidateCorrection = correctResponses.includes(choice.identifier) ? 'correct' : 'incorrect';\n }\n }\n }\n\n return ChoiceCorrectionMixinClass as unknown as AbstractConstructor<CorrectResponseInterface> & T;\n};\n","import { QtiChoiceInteraction } from '@qti-components/choice-interaction/elements';\n\nimport { ChoiceCorrectionMixin } from '../mixins/choice-correction.mixin';\n\n/**\n * Correction-capable `qti-choice-interaction` implementation.\n *\n * It is registered under the standard tag only inside a correction registry;\n * the standard package constructor remains correction-free.\n */\nexport class QtiChoiceInteractionCorrection extends ChoiceCorrectionMixin(QtiChoiceInteraction) {}\n","import { css, html } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { QtiExtendedTextInteraction } from '@qti-components/extended-text-interaction/elements';\n\nimport { ActiveElementCorrectionMixin } from '../mixins/active-element-correction.mixin';\nimport { correctionPart } from '../styles/correction.styles';\n\nimport type { CandidateCorrection } from '../mixins/active-element-correction.mixin';\n\n/**\n * Extended-text, judged from OUTSIDE.\n *\n * Every other correction class in this folder derives its verdict: it is handed a `correct-response`\n * and compares. Extended-text cannot — the response is free prose, there is nothing to compare it\n * to, and that is exactly why the base component extends `Interaction` directly and carries no\n * correction machinery (correct-response.mixin.ts says so for extended-text, upload and media).\n *\n * But an extended-text answer is still judged; just not here. A teacher, a marking service, or an app\n * that already knows the score decides, and then has to tell the component. This class is that\n * channel and nothing more: it computes no correctness, it only accepts one.\n *\n * Hence `ActiveElementCorrectionMixin` rather than `CandidateCorrectionMixin`. The two are otherwise\n * the same bookkeeping — clear the three `candidate-*` states, add one, expose `correctionPart` — but\n * `CandidateCorrectionMixin` sits on top of `CorrectResponseMixin` and drives everything off a\n * computed `correctness` getter with no setter. `ActiveElementCorrectionMixin` is the settable one,\n * written for chips whose parent interaction pushes a verdict into them. An externally-graded essay\n * is the same shape: something else knows the answer.\n *\n * Two consequences worth knowing:\n *\n * - The `item-show-candidate-correction` button will not drive this. It disables itself unless a\n * response variable declares a correctResponse / mapping / areaMapping, which a prose item never\n * does. Correct: the verdict comes from the host application, which sets the attribute.\n * - The verdict survives typing. It is a property, not the `showCandidateCorrection` toggle, so\n * `afterResponseVariableUpdated()` does not clear it. If a stale grade should be dropped when the\n * candidate edits their answer, that is an explicit decision for the host app to make.\n *\n * @cssstate candidate-correct - The verdict pushed in is `correct`.\n * @cssstate candidate-incorrect - The verdict pushed in is `incorrect`.\n * @cssstate candidate-partial - The verdict pushed in is `partially-correct` (alias `candidate-partially-correct`, one major).\n * @csspart correction - The verdict badge in the field's top end corner; its second token is the verdict state, followed by the old `correction-<verdict>` token for one major.\n */\nexport class QtiExtendedTextInteractionCorrection extends ActiveElementCorrectionMixin(QtiExtendedTextInteraction) {\n static override styles = [\n QtiExtendedTextInteraction.styles,\n correctionPart,\n css`\n /*\n * Placement only — the glyph itself is the theme's, keyed on ::part(correction-*). That split\n * is the contract in correction.styles.ts, which deliberately leaves the shared badge in flow\n * and invites a component to lift it out if it wants a corner badge.\n *\n * A textarea is a box the candidate writes in, so the badge goes in its top end corner (top\n * right in a left-to-right text) rather than trailing the text the way a chip's does, and the\n * theme reserves the gutter for it (the end padding on ::part(textarea)).\n *\n * Anchored to the TEXTAREA, not to the host. The badge's containing block is :host, and the\n * host also contains the prompt slot — so a plain top: 0.85rem measured from the host lands on\n * the prompt and the badge floats above the field, which is exactly what it did. Only the\n * vertical offset needs anchoring: the textarea spans the host's full width, so the left\n * offset is the same measured from either.\n */\n [part~='textarea'] {\n anchor-name: --qti-extended-text-field;\n }\n\n [part~='correction'] {\n position: absolute;\n position-anchor: --qti-extended-text-field;\n margin: 0;\n width: var(--qti-correction-size);\n\n /*\n * One FIELD line tall, not square — this is what puts the glyph on the text rather than near\n * it. The mask is drawn center / contain, so in a box exactly one line high it centres itself\n * on that line while the width still governs the glyph's size.\n *\n * Not 1lh: that unit resolves against the BADGE's own inherited line-height (measured 18.4px),\n * not the textarea's (24px), so it landed a third of a line low. --qti-field-line-height is\n * the same number @mixin field-typography gives the field, so the two cannot drift.\n */\n height: calc(var(--qti-correction-size) * var(--qti-field-line-height));\n\n /* In the gutter at the end of the line, inset exactly as the text is from the other side:\n the same trailing token the two field-shaped interactions use. The gutter was on the start\n side once, which left every answer indented by the badge's room even when ungraded. */\n inset-inline-end: var(--qti-correction-inset);\n\n /* Anchored to the field's first line: its top edge plus the field's own padding-top. */\n top: calc(anchor(top) + var(--qti-spacing));\n }\n\n /*\n * Fallback for engines without anchor positioning, where the top above does not parse and the\n * badge would fall to its static position below the field. The bottom of the gutter needs no\n * knowledge of where the field starts, and the gutter runs the full height, so the badge still\n * clears the text.\n *\n * Scoped by @supports rather than declared alongside. Both were set at first, on the assumption\n * that top + height over-constrains the box and bottom is ignored — it is not: measured, the\n * bottom won and put the badge on the third line.\n */\n @supports not (anchor-name: --probe) {\n [part~='correction'] {\n top: auto;\n bottom: var(--qti-correction-inset);\n }\n }\n `\n ];\n\n /**\n * The verdict, pushed in from outside: `correct`, `partially-correct`, `incorrect`, or absent.\n *\n * `noAccessor` because the mixin already owns the accessor — its setter is what writes the\n * `:state(candidate-*)` custom states — and Lit would otherwise replace it with a generated one and\n * silently drop that bookkeeping. Same pattern as the `response` attribute on\n * qti-inline-choice-interaction and qti-slider-interaction.\n */\n @property({ attribute: 'candidate-correction', reflect: true, noAccessor: true })\n declare candidateCorrection: CandidateCorrection;\n\n /** The badge goes between the field and the validation message; everything else is the base's. */\n override render() {\n return html`${this.renderPrompt()}${this.renderTextarea()}\n <span part=${this.correctionPart} aria-hidden=\"true\"></span>\n ${this.renderValidationMessage()}`;\n }\n}\n","/** Helpers shared by more than one correction interaction. */\n\n/** A choice element that can carry a per-candidate correction verdict. */\nexport type CorrectableChoice = HTMLElement & {\n identifier: string;\n candidateCorrection: 'correct' | 'incorrect' | 'partially-correct' | null;\n};\n\n/** Splits a `\"source target\"` correct-response into its pairs. */\nexport const parsePairs = (response: Readonly<string | string[] | null>): Array<{ source: string; target: string }> => {\n if (!response) return [];\n const entries = Array.isArray(response) ? response : [response];\n return entries.map(entry => {\n const [source, target] = entry.split(' ');\n return { source, target };\n });\n};\n","import { QtiGapMatchInteraction } from '@qti-components/gap-match-interaction/elements';\n\nimport { DragDropCorrectionMixin } from '../mixins/drag-drop-correction.mixin';\nimport { parsePairs, type CorrectableChoice } from './shared';\n\nexport class QtiGapMatchInteractionCorrection extends DragDropCorrectionMixin(QtiGapMatchInteraction) {\n public override toggleCandidateCorrection(show: boolean): void {\n super.toggleCandidateCorrection(show);\n const matches = parsePairs(this.correctResponse);\n\n for (const target of this.querySelectorAll('qti-gap')) {\n const targetId = target.getAttribute('identifier');\n const selectedChoices = (target as unknown as HTMLElement & { drags: readonly CorrectableChoice[] }).drags;\n for (const choice of selectedChoices) {\n choice.candidateCorrection = null;\n if (show && matches.some(match => match.source === choice.identifier && match.target === targetId)) {\n choice.candidateCorrection = 'correct';\n } else if (show) {\n choice.candidateCorrection = 'incorrect';\n }\n }\n }\n }\n}\n","import { svg } from 'lit';\nimport { repeat } from 'lit/directives/repeat.js';\n\nimport { QtiGraphicAssociateInteraction } from '@qti-components/graphic-associate-interaction/elements';\n\nimport { CandidateCorrectionMixin } from '../mixins/candidate-correction.mixin';\n\n/**\n * @csspart line - An association line; the answer key's lines carry the `answer-key` token\n * (`line answer-key`), followed by the old `correct-line` token for one major.\n */\nexport class QtiGraphicAssociateInteractionCorrection extends CandidateCorrectionMixin(QtiGraphicAssociateInteraction) {\n #correctLines: string[] = [];\n\n public override toggleInternalCorrectResponse(show: boolean): void {\n super.toggleInternalCorrectResponse(show);\n const response = this.correctResponse;\n const previous = this.#correctLines;\n this.#correctLines = show && response ? (Array.isArray(response) ? [...response] : [response]) : [];\n this.requestUpdate('correctLines', previous);\n }\n\n protected override renderSupplementalLines(): unknown {\n return repeat(\n this.#correctLines,\n line => line,\n line => svg`\n <line\n part=\"line answer-key correct-line\"\n x1=${parseInt(this.querySelector<SVGLineElement>(`[identifier=${line.split(' ')[0]}]`)!.style.left)}\n y1=${parseInt(this.querySelector<SVGLineElement>(`[identifier=${line.split(' ')[0]}]`)!.style.top)}\n x2=${parseInt(this.querySelector<SVGLineElement>(`[identifier=${line.split(' ')[1]}]`)!.style.left)}\n y2=${parseInt(this.querySelector<SVGLineElement>(`[identifier=${line.split(' ')[1]}]`)!.style.top)}\n stroke=\"var(--qti-correct)\"\n stroke-width=\"3\"\n stroke-dasharray=\"5,5\"\n />\n `\n );\n }\n}\n","import { QtiGraphicGapMatchInteraction } from '@qti-components/graphic-gap-match-interaction/elements';\n\nimport { DragDropCorrectionMixin } from '../mixins/drag-drop-correction.mixin';\n\nexport class QtiGraphicGapMatchInteractionCorrection extends DragDropCorrectionMixin(QtiGraphicGapMatchInteraction) {}\n","import { hasState } from '@qti-components/base';\nimport { QtiGraphicOrderInteraction } from '@qti-components/graphic-order-interaction/elements';\n\nimport { CandidateCorrectionMixin } from '../mixins/candidate-correction.mixin';\n\nimport type { Choice } from '@qti-components/interactions-core/mixins/choices/choices.mixin';\n\ntype OrderedHotspot = Choice & { order: number | null };\n\ntype CorrectableOrderedHotspot = OrderedHotspot & {\n internals: ElementInternals;\n candidateCorrection: 'correct' | 'incorrect' | 'partially-correct' | null;\n orderCorrect: number | null;\n};\n\n/**\n * Judges each hotspot's position in the order and paints its pin from the hotspot's verdict state.\n * The answer key is the hotspot's `orderCorrect` (`data-order-correct`), set by\n * `toggleInternalCorrectResponse`; it sets no state on the hotspot.\n */\nexport class QtiGraphicOrderInteractionCorrection extends CandidateCorrectionMixin(QtiGraphicOrderInteraction) {\n protected override resolvePinColor(choice: OrderedHotspot): string {\n const { internals } = choice as CorrectableOrderedHotspot;\n if (hasState(internals.states, 'candidate-incorrect')) return 'var(--qti-incorrect)';\n if (hasState(internals.states, 'candidate-correct')) return 'var(--qti-correct)';\n return super.resolvePinColor(choice);\n }\n\n public override toggleInternalCorrectResponse(show: boolean): void {\n super.toggleInternalCorrectResponse(show);\n const response = this.correctResponse;\n const correctOrder = response ? (Array.isArray(response) ? response : [response]) : [];\n for (const hotspot of this._choiceElements as CorrectableOrderedHotspot[]) {\n const index = correctOrder.indexOf(hotspot.identifier);\n hotspot.orderCorrect = show && index >= 0 ? index + 1 : null;\n }\n this.refreshLocatorPins();\n }\n\n public override toggleCandidateCorrection(show: boolean): void {\n super.toggleCandidateCorrection(show);\n const response = this.correctResponse;\n const correctOrder = response ? (Array.isArray(response) ? response : [response]) : [];\n for (const hotspot of this._choiceElements as CorrectableOrderedHotspot[]) {\n hotspot.candidateCorrection = null;\n if (show && hotspot.order != null) {\n hotspot.candidateCorrection = correctOrder[hotspot.order - 1] === hotspot.identifier ? 'correct' : 'incorrect';\n }\n }\n this.refreshLocatorPins();\n }\n}\n","import { QtiHotspotInteraction } from '@qti-components/hotspot-interaction/elements';\n\nimport { ChoiceCorrectionMixin } from '../mixins/choice-correction.mixin';\n\nexport class QtiHotspotInteractionCorrection extends ChoiceCorrectionMixin(QtiHotspotInteraction) {}\n","import { QtiHottextInteraction } from '@qti-components/hottext-interaction/elements';\n\nimport { ChoiceCorrectionMixin } from '../mixins/choice-correction.mixin';\n\nexport class QtiHottextInteractionCorrection extends ChoiceCorrectionMixin(QtiHottextInteraction) {}\n","import { css, html } from 'lit';\n\nimport { QtiInlineChoiceInteraction } from '@qti-components/inline-choice-interaction/elements';\n\nimport { CandidateCorrectionMixin } from '../mixins/candidate-correction.mixin';\nimport { correctionPart } from '../styles/correction.styles';\n\n/**\n * @csspart correction - The verdict badge after the validation message; see `CandidateCorrectionMixin` for its tokens.\n */\nexport class QtiInlineChoiceInteractionCorrection extends CandidateCorrectionMixin(QtiInlineChoiceInteraction) {\n static override get styles() {\n return [\n QtiInlineChoiceInteraction.styles,\n correctionPart,\n css`\n /*\n * Only the TRAILING inset — the leading gap is the shared --qti-glyph-gap, like every other\n * badge. This used to set both margins to --qti-gap (1rem), twice everyone else's 0.5em, on\n * the one token qti-variables.css calls \"the page's rhythm … an order of magnitude too wide\n * for a glyph sitting inside a line\".\n *\n * The trailing inset is needed here, and in text-entry, because these two put the field's box\n * on the HOST while its padding sits on an inner element (::part(trigger), ::part(input)) —\n * so a badge that is a child of the host falls outside that padding and lands on the border.\n * Chips, choices and hottext carry their padding on the host, so their badge is already inset\n * by it and needs nothing.\n */\n [part~='correction'] {\n margin-inline-end: var(--qti-correction-inset);\n }\n `\n ];\n }\n\n /**\n * Internal mode defers to the full correct response, exactly as text-entry does.\n *\n * There is no room beside a dropdown for an answer key: the interaction sits inside a line of\n * running text, so a marker next to the field competes with the sentence around it, and when the\n * candidate happened to pick the correct option it printed the same word twice. The full variant\n * puts the key in a `div.full-correct-response-inline` after the field instead — one already-themed\n * presentation for both inline interactions rather than a second one only these two use.\n *\n * `super` is deliberately not called: its `show-correct-response` host state paints the dashed\n * outline in qti-states.css, and this element is no longer the thing presenting the key — the\n * wrapper beside it is. Leaving the state off keeps internal mode looking identical to an item\n * authored with `show-full-correct-response`.\n *\n * The guard stops the two entry points rendering two wrappers: `showFullCorrectResponse` has its\n * own watcher, so with both flags set this would otherwise run a second time.\n */\n public override toggleInternalCorrectResponse(show: boolean): void {\n if (!this.showFullCorrectResponse) this.toggleFullCorrectResponse(show);\n }\n\n /**\n * The key is shown whether or not the candidate was right.\n *\n * The base withholds it from a correct candidate, on the reasoning that their answer already is\n * the key. That reasoning does not survive contact with this element: asking for the correct\n * response and being shown nothing is indistinguishable from the feature being broken, and it is\n * the only inline interaction where the answer and the key are the same short phrase, so there is\n * no visual clue either. Show it, and let the correctness badge say who was right.\n */\n public override get withholdsFullCorrectResponseWhenCorrect(): boolean {\n return false;\n }\n\n /** The badge trails the validation message; everything else is the base's. */\n override render() {\n return html`\n ${this.renderTrigger()} ${this.renderMenu()} ${this.renderValidationMessage()}\n <span part=${this.correctionPart} aria-hidden=\"true\"></span>\n `;\n }\n}\n","import { QtiMatchInteraction } from '@qti-components/match-interaction/elements';\n\nimport { DragDropCorrectionMixin } from '../mixins/drag-drop-correction.mixin';\nimport { parsePairs, type CorrectableChoice } from './shared';\n\n/**\n * @csspart control - A tabular cell; once judged, a checked cell carries the verdict token\n * (`control … candidate-correct` / `candidate-incorrect`), followed by the old bare `correct` /\n * `incorrect` token for one major. `control-mark` carries the same tokens.\n */\nexport class QtiMatchInteractionCorrection extends DragDropCorrectionMixin(QtiMatchInteraction) {\n #correctPairs = new Set<string>();\n\n public override toggleCandidateCorrection(show: boolean): void {\n super.toggleCandidateCorrection(show);\n const matches = parsePairs(this.correctResponse);\n this.#correctPairs = show ? new Set(matches.map(match => `${match.source} ${match.target}`)) : new Set();\n\n for (const target of this.targetChoices) {\n const targetId = target.getAttribute('identifier');\n const selectedChoices = (target as unknown as { drags: readonly CorrectableChoice[] }).drags;\n for (const choice of selectedChoices) {\n choice.candidateCorrection = null;\n if (show) {\n choice.candidateCorrection = this.#correctPairs.has(`${choice.identifier} ${targetId}`)\n ? 'correct'\n : 'incorrect';\n }\n }\n }\n this.requestUpdate();\n }\n\n protected override getCellStateVariant(value: string, checked: boolean): string {\n if (!this.showCandidateCorrection || !checked) return '';\n // The verdict state's name as a token (CONTRACT.md §3), then the old bare token for one major.\n return this.#correctPairs.has(value) ? 'candidate-correct correct' : 'candidate-incorrect incorrect';\n }\n}\n","/**\n * Numeric core: indices of the chosen longest increasing subsequence within a\n * sequence of distinct numbers.\n *\n * Tiebreaker: strict `>` comparisons keep the smallest predecessor index when\n * lengths tie, and the smallest ending index is picked when multiple indices\n * achieve the maximum length. This is equivalent to \"the first LIS found when\n * iterating left-to-right\".\n */\nexport function findLongestIncreasingSubsequenceIndices(sequence: number[]): Set<number> {\n if (sequence.length === 0) {\n return new Set();\n }\n\n const lengthEndingAt: number[] = new Array(sequence.length).fill(1);\n const predecessorIndex: number[] = new Array(sequence.length).fill(-1);\n\n for (let currentIndex = 0; currentIndex < sequence.length; currentIndex++) {\n for (let previousIndex = 0; previousIndex < currentIndex; previousIndex++) {\n if (\n sequence[previousIndex] < sequence[currentIndex] &&\n lengthEndingAt[previousIndex] + 1 > lengthEndingAt[currentIndex]\n ) {\n lengthEndingAt[currentIndex] = lengthEndingAt[previousIndex] + 1;\n predecessorIndex[currentIndex] = previousIndex;\n }\n }\n }\n\n let bestEndIndex = 0;\n for (let index = 1; index < sequence.length; index++) {\n if (lengthEndingAt[index] > lengthEndingAt[bestEndIndex]) {\n bestEndIndex = index;\n }\n }\n\n const resultIndices = new Set<number>();\n for (let index = bestEndIndex; index !== -1; index = predecessorIndex[index]) {\n resultIndices.add(index);\n }\n\n return resultIndices;\n}\n\n/**\n * Domain wrapper: identifiers of candidate-placed choices counted as\n * correctly placed, i.e. the longest run of choices whose relative order\n * matches the correct order.\n *\n * Assumes identifiers are unique within both arrays (guaranteed by QTI).\n * Identifiers not present in `correctOrder` are foreign to the response and\n * are never included in the result.\n */\nexport function findCorrectlyPlacedIdentifiers(candidateOrder: string[], correctOrder: string[]): Set<string> {\n const rankByIdentifier = new Map<string, number>(correctOrder.map((identifier, position) => [identifier, position]));\n\n const knownIdentifiers = candidateOrder.filter(identifier => rankByIdentifier.has(identifier));\n const rankSequence = knownIdentifiers.map(identifier => rankByIdentifier.get(identifier));\n\n const winningIndices = findLongestIncreasingSubsequenceIndices(rankSequence);\n\n const result = new Set<string>();\n winningIndices.forEach(index => result.add(knownIdentifiers[index]));\n return result;\n}\n","import { QtiOrderInteraction } from '@qti-components/order-interaction/elements';\n\nimport { DragDropCorrectionMixin } from '../mixins/drag-drop-correction.mixin';\nimport { findCorrectlyPlacedIdentifiers } from '../utils/longest-increasing-subsequence';\nimport { type CorrectableChoice } from './shared';\n\nexport class QtiOrderInteractionCorrection extends DragDropCorrectionMixin(QtiOrderInteraction) {\n public override toggleCandidateCorrection(show: boolean): void {\n super.toggleCandidateCorrection(show);\n\n const dropTargets = Array.from(this.shadowRoot!.querySelectorAll<HTMLElement>(`[part~='drop']`));\n const placedChoices = dropTargets.flatMap(drop => this.chipsIn(drop) as CorrectableChoice[]);\n for (const choice of placedChoices) choice.candidateCorrection = null;\n if (!show) return;\n\n const response = this.correctResponse;\n const entries = response ? (Array.isArray(response) ? response : [response]) : [];\n const correctOrder = entries\n .map((entry, index) => {\n const [identifier, dropId] = entry.split(' ');\n const parsed = dropId?.startsWith('droplist') ? parseInt(dropId.slice('droplist'.length), 10) : index;\n return { identifier, dropIndex: Number.isNaN(parsed) ? index : parsed };\n })\n .filter(entry => entry.identifier)\n .sort((a, b) => a.dropIndex - b.dropIndex)\n .map(entry => entry.identifier);\n if (correctOrder.length === 0) return;\n\n const placedEntries = placedChoices\n .map(choice => ({ choice, identifier: choice.getAttribute('identifier') }))\n .filter((entry): entry is { choice: CorrectableChoice; identifier: string } => Boolean(entry.identifier));\n const correctlyPlaced = findCorrectlyPlacedIdentifiers(\n placedEntries.map(entry => entry.identifier),\n correctOrder\n );\n for (const { choice, identifier } of placedEntries) {\n choice.candidateCorrection = correctlyPlaced.has(identifier) ? 'correct' : 'incorrect';\n }\n }\n}\n","import { QtiPortableCustomInteraction } from '@qti-components/portable-custom-interaction/elements';\n\nimport { CandidateCorrectionMixin } from '../mixins/candidate-correction.mixin';\n\nimport type { BaseType, Cardinality } from '@qti-components/base';\n\nexport class QtiPortableCustomInteractionCorrection extends CandidateCorrectionMixin(QtiPortableCustomInteraction) {\n public override toggleInternalCorrectResponse(show: boolean): void {\n super.toggleInternalCorrectResponse(show);\n const responseVariable = this.responseVariable;\n const sourceResponse = responseVariable?.correctResponse ?? this.correctResponse;\n this.correctResponse = show ? sourceResponse : responseVariable?.cardinality === 'single' ? '' : [];\n\n const containerId = `correct-response-container-${this.responseIdentifier}`;\n this.parentElement?.querySelectorAll(`#${containerId}`).forEach(element => element.remove());\n\n if (!show) {\n this.enable();\n return;\n }\n this.disable();\n if (!this.correctResponse) return;\n\n const container = document.createElement('div');\n container.id = containerId;\n container.className = 'pci-correct-response-container';\n Object.assign(container.style, {\n position: 'relative',\n marginTop: '20px',\n border: '2px solid green',\n padding: '16px',\n borderRadius: '4px',\n backgroundColor: 'rgba(0, 128, 0, 0.05)'\n });\n\n const label = document.createElement('div');\n label.textContent = 'Correct Response:';\n Object.assign(label.style, { fontWeight: 'bold', marginBottom: '10px', color: 'green' });\n container.append(label);\n\n // `cloneNode(false)`, not `document.createElement`: a shallow clone is created in the same\n // custom element registry as this element, so the viewer is still upgraded when the item was\n // rendered into a scoped registry. It carries the attributes over and none of the children.\n const viewer = this.cloneNode(false) as QtiPortableCustomInteractionCorrection;\n // Two elements in one tree cannot share an id, and the flags would have the viewer show a\n // correction of its own.\n viewer.removeAttribute('id');\n viewer.removeAttribute('show-correct-response');\n viewer.removeAttribute('show-full-correct-response');\n viewer.removeAttribute('show-candidate-correction');\n viewer.isFullCorrectResponse = true;\n const originalResponseId = this.responseIdentifier;\n viewer.responseIdentifier = `${originalResponseId}-correct`;\n\n // Only the authored light DOM — modules, markup, properties, stylesheets. The runtime's own\n // children must not come along: the PCI appends its iframe to itself, and the `disable()` above\n // has just added the review overlay. A cloned iframe never loads, so the viewer would paint a\n // dead frame above the live one.\n for (const child of Array.from(this.children)) {\n if (child.tagName.startsWith('QTI-')) viewer.append(child.cloneNode(true));\n }\n\n const correctResponse = this.correctResponse as string | string[];\n const cardinality: Cardinality =\n responseVariable?.cardinality ?? (Array.isArray(correctResponse) ? 'multiple' : 'single');\n const baseType: BaseType = responseVariable?.baseType ?? 'string';\n\n // The standards-conformant handoff, for a PCI that implements the solution use case: it reads\n // the key out of its own `getInstance` configuration rather than having a response pushed at it.\n // Set explicitly because the viewer has no response declaration to derive one from — it is not a\n // registered interaction, so `responseVariable` is undefined and the derived getter returns null.\n // See https://github.com/1EdTech/qti-project-management/issues/210\n viewer.status = 'solution';\n viewer.responseDeclaration = {\n baseType,\n cardinality,\n correctResponse: { value: correctResponse }\n };\n\n // The push below stays for PCIs that do NOT implement the solution use case: those only know how\n // to render a response bound to them. It goes out once the viewer's own iframe has finished its\n // handshake — listened for rather than hooked into `connectedCallback`, since custom element\n // reactions are looked up on the prototype when the element is defined, so an instance-level\n // override of it is never read.\n viewer.addEventListener(\n 'qti-portable-custom-interaction-loaded',\n () => {\n const value = viewer.responseVariablesToQtiVariableJSON(correctResponse, cardinality, baseType);\n viewer.sendMessageToIframe('setBoundTo', { [originalResponseId]: value });\n viewer.sendMessageToIframe('setState', { state: 'review' });\n },\n { once: true }\n );\n viewer.style.pointerEvents = 'none';\n container.append(viewer);\n this.after(container);\n }\n}\n","import { css, html } from 'lit';\nimport { repeat } from 'lit/directives/repeat.js';\nimport { styleMap } from 'lit/directives/style-map.js';\n\nimport { ScoringHelper } from '@qti-components/base';\nimport { QtiSelectPointInteraction } from '@qti-components/select-point-interaction/elements';\n\nimport { CandidateCorrectionMixin } from '../mixins/candidate-correction.mixin';\n\nimport type { QtiAreaMapEntry } from '@qti-components/base';\n\n/**\n * @csspart point - A placed marker; once judged it carries the verdict token (`point candidate-correct`,\n * `point candidate-incorrect`), followed by the old bare `correct` / `incorrect` token for one major.\n */\nexport class QtiSelectPointInteractionCorrection extends CandidateCorrectionMixin(QtiSelectPointInteraction) {\n #correctAreas: Array<{ shape: string; coords: string }> = [];\n\n #responseCorrection: boolean[] = [];\n\n static override styles = [\n QtiSelectPointInteraction.styles,\n css`\n [part~='candidate-correct'] {\n --qti-select-point-marker-color: var(--qti-correct);\n }\n [part~='candidate-incorrect'] {\n --qti-select-point-marker-color: var(--qti-incorrect);\n }\n `\n ];\n\n public override toggleCandidateCorrection(show: boolean): void {\n super.toggleCandidateCorrection(show);\n const previous = this.#responseCorrection;\n this.#responseCorrection = [];\n if (!show) {\n this.requestUpdate('responseCorrection', previous);\n return;\n }\n\n const areaEntries = this._effectiveAreaEntries;\n const baseType = this.responseVariable?.baseType;\n const response = this.correctResponse;\n for (const point of this.responsePoints) {\n let correct = areaEntries.some(area =>\n ScoringHelper.isPointInArea(`${point.x} ${point.y}`, `${area.shape},${area.coords}`, baseType)\n );\n if (!areaEntries.length && response) {\n const expected = Array.isArray(response) ? response : [response];\n correct = expected.some(entry => {\n const [x, y] = entry.split(' ').map(Number);\n return Number.isFinite(x) && Number.isFinite(y) && Math.hypot(point.x - x, point.y - y) <= 10;\n });\n }\n this.#responseCorrection.push(correct);\n }\n this.requestUpdate('responseCorrection', previous);\n }\n\n public override toggleInternalCorrectResponse(show: boolean): void {\n super.toggleInternalCorrectResponse(show);\n if (!show) {\n const previous = this.#correctAreas;\n this.#correctAreas = [];\n this.requestUpdate('correctAreas', previous);\n return;\n }\n\n let entries: QtiAreaMapEntry[] = this._effectiveAreaEntries;\n if (!entries.length) {\n const response = this.correctResponse;\n const values = response ? (Array.isArray(response) ? response : [response]) : [];\n if (values.some(value => value.split(' ').length < 2)) {\n console.error('No valid correct responses found.');\n return;\n }\n entries = values.map(value => ({\n shape: 'circle',\n coords: `${value.split(' ').join(',')},10`,\n defaultValue: 1,\n mappedValue: 1\n }));\n }\n const previous = this.#correctAreas;\n this.#correctAreas = entries.map(entry => ({ shape: entry.shape, coords: entry.coords }));\n this.requestUpdate('correctAreas', previous);\n }\n\n protected override pointPart(_point: string, index: number): string {\n const verdict = this.#responseCorrection[index];\n if (verdict === undefined) return 'point';\n // The verdict state's name as a token (CONTRACT.md §3), then the old bare token for one major.\n return verdict ? 'point candidate-correct correct' : 'point candidate-incorrect incorrect';\n }\n\n protected override renderSupplementalLayer(): unknown {\n return repeat(\n this.#correctAreas,\n area => `${area.shape}:${area.coords}`,\n (area, index) =>\n html`<div\n style=${styleMap({\n position: 'absolute',\n pointerEvents: 'none',\n backgroundColor: 'var(--qti-correct)',\n opacity: '0.5'\n })}\n data-correction-area\n data-coord=${area.coords}\n data-shape=${area.shape}\n alt=${`correct-response-${index + 1}`}\n ></div>`\n );\n }\n\n protected override updated(changedProperties: Map<string | number | symbol, unknown>): void {\n super.updated(changedProperties);\n if (changedProperties.has('correctAreas' as never)) {\n this.positionOverlayElements(this.shadowRoot!.querySelectorAll<HTMLElement>('[data-correction-area]'));\n }\n }\n}\n","import { css, html, nothing } from 'lit';\n\nimport { QtiSliderInteraction } from '@qti-components/slider-interaction/elements';\n\nimport { CandidateCorrectionMixin } from '../mixins/candidate-correction.mixin';\n\n/**\n * @csspart knob - The ghost knob at the correct response position carries the `answer-key` token\n * (`knob answer-key`), followed by the old `knob-correct` token for one major.\n */\nexport class QtiSliderInteractionCorrection extends CandidateCorrectionMixin(QtiSliderInteraction) {\n #correctResponseNumber: number | null = null;\n\n static override styles = [\n QtiSliderInteraction.styles,\n css`\n [part~='knob'][part~='answer-key'] {\n background-color: var(--qti-correct-light);\n border: 2px solid var(--qti-correct);\n position: relative;\n height: 1rem;\n width: 1rem;\n transform-origin: center;\n transform: translateX(-50%);\n cursor: pointer;\n border-radius: 9999px;\n left: var(--value-percentage-correct);\n }\n `\n ];\n\n public override toggleInternalCorrectResponse(show: boolean): void {\n super.toggleInternalCorrectResponse(show);\n const response = this.correctResponse;\n const raw = Array.isArray(response) ? response[0] : response;\n const value = show && raw ? parseFloat(raw) : NaN;\n const previous = this.#correctResponseNumber;\n this.#correctResponseNumber = Number.isFinite(value) ? value : null;\n if (this.#correctResponseNumber !== null) {\n const percentage = ((this.#correctResponseNumber - this.min) / (this.max - this.min)) * 100;\n this.style.setProperty('--value-percentage-correct', `${percentage}%`);\n } else {\n this.style.removeProperty('--value-percentage-correct');\n }\n this.requestUpdate('correctResponseNumber', previous);\n }\n\n protected override renderRailSupplement(): unknown {\n return this.#correctResponseNumber === null\n ? nothing\n : html`<div id=\"knob-correct\" part=\"knob answer-key knob-correct\">\n <div id=\"value\" part=\"value\">${this.#correctResponseNumber}</div>\n </div>`;\n }\n}\n","import { css, html } from 'lit';\n\nimport { QtiTextEntryInteraction } from '@qti-components/text-entry-interaction/elements';\n\nimport { CandidateCorrectionMixin } from '../mixins/candidate-correction.mixin';\nimport { Correctness } from '../mixins/correct-response.mixin';\nimport { correctionPart } from '../styles/correction.styles';\n\n/**\n * @csspart correction - The verdict badge between the field and the validation message; see\n * `CandidateCorrectionMixin` for its tokens. The answer key itself is the base's `answer-key` part.\n */\nexport class QtiTextEntryInteractionCorrection extends CandidateCorrectionMixin(QtiTextEntryInteraction) {\n static override styles = [\n QtiTextEntryInteraction.styles,\n correctionPart,\n css`\n /*\n * The trailing inset only — size and leading gap come from the shared sheet.\n *\n * This block used to also set position: static; translate: none (dead: nothing positions this\n * badge) and size it with --qti-control-size, the radio/checkbox token — 1rem, absolute, where\n * every other badge is 1em and scales with the text it annotates. The two agreed only while the\n * item's font-size happened to equal the root's.\n *\n * The inset is needed because the field's box is the HOST while its padding is on ::part(input),\n * so the badge — a child of the host — falls outside that padding and lands flush on the border.\n * Measured at 0px from the border, against 16px for a choice and 12.8px for a chip.\n */\n [part~='correction'] {\n margin-inline-end: var(--qti-correction-inset);\n }\n :host {\n position: relative;\n anchor-name: --text-entry-host, --qti-correction-anchor;\n }\n `\n ];\n\n public override get correctness(): Readonly<Correctness | null> {\n const variable = this.responseVariable;\n if (!variable) return super.correctness;\n if (variable.value === null) return Correctness.Incorrect;\n\n if (variable.mapping) {\n const maxScore = variable.mapping.mapEntries.reduce((maximum, entry) => Math.max(entry.mappedValue, maximum), 0);\n for (const entry of variable.mapping.mapEntries) {\n let expected = entry.mapKey;\n let actual = variable.value as string;\n if (!entry.caseSensitive) {\n expected = expected.toLowerCase();\n actual = actual.toLowerCase();\n }\n if (expected !== actual) continue;\n if (entry.mappedValue === maxScore) return Correctness.Correct;\n if (entry.mappedValue <= (variable.mapping.defaultValue || 0)) return Correctness.Incorrect;\n return Correctness.PartiallyCorrect;\n }\n }\n\n return variable.correctResponse === variable.value ? Correctness.Correct : Correctness.Incorrect;\n }\n\n public override toggleInternalCorrectResponse(show: boolean): void {\n if (!this.showFullCorrectResponse) this.toggleFullCorrectResponse(show);\n }\n\n /** The badge goes between the field and the validation message; everything else is the base's. */\n override render() {\n return html`\n ${this.renderAnswer()} ${this.renderInput()}\n <span part=${this.correctionPart} aria-hidden=\"true\"></span>\n ${this.renderValidationMessage()}\n `;\n }\n}\n","import { QtiAssessmentItem } from '@qti-components/elements/elements';\n\ntype CorrectionInteraction = {\n toggleCorrectResponse(show: boolean): void;\n toggleCandidateCorrection(show: boolean): void;\n};\n\n/** Assessment-item extension that coordinates correction-capable interactions. */\nexport class QtiAssessmentItemCorrection extends QtiAssessmentItem {\n public showCorrectResponse(show: boolean): void {\n for (const interaction of this.interactionElements) {\n (interaction as unknown as Partial<CorrectionInteraction>).toggleCorrectResponse?.(show);\n }\n\n this.updateControlState('item-show-correct-response', show);\n }\n\n public showCandidateCorrection(show: boolean): void {\n for (const interaction of this.interactionElements) {\n (interaction as unknown as Partial<CorrectionInteraction>).toggleCandidateCorrection?.(show);\n }\n\n this.updateControlState('item-show-candidate-correction', show);\n }\n\n protected override afterResponseVariableUpdated(): void {\n this.showCandidateCorrection(false);\n }\n\n private updateControlState(selector: string, shown: boolean): void {\n let root = this.getRootNode();\n while (true) {\n (root as ParentNode)\n .querySelectorAll<HTMLElement & { shown: boolean }>(selector)\n .forEach(control => (control.shown = shown));\n\n if (!(root instanceof ShadowRoot)) return;\n root = root.host.getRootNode();\n }\n }\n}\n","import { QtiItem } from '@qti-components/item/elements';\n\nimport type { QtiAssessmentItem } from '@qti-components/elements';\nimport type { View } from '@qti-components/base';\nimport type { CorrectResponseMode } from '../context/correction-config';\n\ntype CorrectionAssessmentItem = {\n showCorrectResponse(show: boolean): void;\n showCandidateCorrection(show: boolean): void;\n};\n\n/** Item host extension that handles correction controls and mode changes. */\nexport class QtiItemCorrection extends QtiItem {\n readonly #onShowCorrectResponse = (event: Event) => {\n const show = (event as CustomEvent<boolean>).detail;\n (this.assessmentItem as unknown as Partial<CorrectionAssessmentItem>)?.showCorrectResponse?.(show);\n this.updateControlState('item-show-correct-response', show);\n };\n\n readonly #onShowCandidateCorrection = (event: Event) => {\n const show = (event as CustomEvent<boolean>).detail;\n (this.assessmentItem as unknown as Partial<CorrectionAssessmentItem>)?.showCandidateCorrection?.(show);\n this.updateControlState('item-show-candidate-correction', show);\n };\n\n readonly #onSwitchCorrectResponseMode = (event: Event) => {\n (this.assessmentItem as unknown as Partial<CorrectionAssessmentItem>)?.showCorrectResponse?.(false);\n this.configContext = {\n ...this.configContext,\n correctResponseMode: (event as CustomEvent<CorrectResponseMode>).detail\n } as typeof this.configContext;\n };\n\n /**\n * Scorer view IS the answer key, the same pairing `QtiTestCorrection` makes at test level.\n * A marker switching to `scorer` to read the rubric would otherwise have to ask for the key\n * separately, and the two would drift apart.\n *\n * `scorer` alone because that is what the test side does — not because no other audience has\n * a use for a key. An author reviewing their own item plainly wants one, and arguably a tutor\n * does too. If that is ever granted it has to be granted in both places at once, or the same\n * item answers differently depending on whether it is delivered inside a test.\n */\n override updateAssessmentItemView(assessmentItem: QtiAssessmentItem, view: View): void {\n (assessmentItem as unknown as Partial<CorrectionAssessmentItem>)?.showCorrectResponse?.(view === 'scorer');\n this.updateControlState('item-show-correct-response', view === 'scorer');\n }\n\n constructor() {\n super();\n this.addEventListener('item-show-correct-response', this.#onShowCorrectResponse);\n this.addEventListener('item-show-candidate-correction', this.#onShowCandidateCorrection);\n this.addEventListener('item-switch-correct-response-mode', this.#onSwitchCorrectResponseMode);\n }\n\n private updateControlState(selector: string, shown: boolean): void {\n this.querySelectorAll<HTMLElement & { shown: boolean }>(selector).forEach(control => (control.shown = shown));\n }\n\n override disconnectedCallback(): void {\n this.removeEventListener('item-show-correct-response', this.#onShowCorrectResponse);\n this.removeEventListener('item-show-candidate-correction', this.#onShowCandidateCorrection);\n this.removeEventListener('item-switch-correct-response-mode', this.#onSwitchCorrectResponseMode);\n super.disconnectedCallback();\n }\n}\n","import { QtiTest, TestNavigation } from '@qti-components/test/elements';\n\nimport type { ComputedItem, View } from '@qti-components/base';\nimport type { QtiAssessmentItem } from '@qti-components/elements';\n\ntype CorrectionAssessmentItem = QtiAssessmentItem & {\n showCorrectResponse(show: boolean): void;\n showCandidateCorrection(show: boolean): void;\n};\n\n/** Test navigation extension that routes correction controls to the active item. */\nexport class TestNavigationCorrection extends TestNavigation {\n readonly #onShowCorrectResponse = (event: Event) => {\n (this.activeAssessmentItem as Partial<CorrectionAssessmentItem> | undefined)?.showCorrectResponse?.(\n (event as CustomEvent<boolean>).detail\n );\n };\n\n readonly #onShowCandidateCorrection = (event: Event) => {\n (this.activeAssessmentItem as Partial<CorrectionAssessmentItem> | undefined)?.showCandidateCorrection?.(\n (event as CustomEvent<boolean>).detail\n );\n };\n\n constructor() {\n super();\n this.addEventListener('test-show-correct-response', this.#onShowCorrectResponse);\n this.addEventListener('test-show-candidate-correction', this.#onShowCandidateCorrection);\n }\n\n override disconnectedCallback(): void {\n this.removeEventListener('test-show-correct-response', this.#onShowCorrectResponse);\n this.removeEventListener('test-show-candidate-correction', this.#onShowCandidateCorrection);\n super.disconnectedCallback();\n }\n\n /**\n * Reflect correctness back to the candidate after an ended attempt, for items\n * the assessment opted in via the standard `qti-item-session-control\n * show-solution` (QTI 3.0 ItemSessionControl.show-solution) — the player takes\n * no opinion of its own:\n * - candidate correction (a mark on the learner's selection) after every attempt;\n * - the correct response (a mark on the right answer) once the item is done —\n * the candidate reached the optimal outcome, or ran out of attempts.\n */\n protected override afterAttemptEnded(\n assessmentItem: QtiAssessmentItem | undefined,\n computedItem: ComputedItem | undefined,\n done: boolean\n ): void {\n if (!assessmentItem || !computedItem?.sessionControl?.showSolution) return;\n\n const correctable = assessmentItem as Partial<CorrectionAssessmentItem>;\n correctable.showCandidateCorrection?.(true);\n correctable.showCorrectResponse?.(done);\n }\n}\n\n/** Test host extension that shows correct responses in scorer view. */\nexport class QtiTestCorrection extends QtiTest {\n public override updateAssessmentItemView(assessmentItem: QtiAssessmentItem, view: View): void {\n (assessmentItem as Partial<CorrectionAssessmentItem>).showCorrectResponse?.(view === 'scorer');\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,MAAM,kBAAkB;AACjC,SAAS,UAAU,aAAa;AAChC,SAAS,eAAe;;;;;;;AAOlB,IAAO,0BAAP,cAAuC,WAAU;EAAvD,cAAA;;AAKE,SAAA,QAAQ;AAGA,SAAA,WAAW;MACjB,UAAU;MACV,MAAM;;EAgCV;EA7BE,YAAY,MAAyB;AACnC,SAAK,cACH,IAAI,YAAY,qCAAqC;MACnD,QAAQ;MACR,SAAS;KACV,CAAC;EAEN;EAES,SAAM;AACb,WAAO;6CACkC,KAAK,KAAK;;;;kBAIrC,CAAC,MAAY;AACrB,YAAM,KAAK,EAAE;AACb,WAAK,YAAY,GAAG,KAA4B;IAClD,CAAC;;UAEC,OAAO,KAAK,KAAK,QAAQ,EAAE,IAC3B,WACE,sBAAsB,KAAK,eAAe,UAAU,KAAK,a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,KAAK,4BAA4B;AAC/F,UAAM,qBAAoB;EAC5B;;;;ACrDI,IAAO,2BAAP,cAAwC,eAAc;EACjD,yBAAyB,CAAC,UAAgB;AAChD,SAAK,sBAAwE,sBAC3E,MAA+B,MAAM;EAE1C;EAES,6BAA6B,CAAC,UAAgB;AACpD,SAAK,sBAAwE,0BAC3E,MAA+B,MAAM;EAE1C;EAEA,cAAA;AACE,UAAK;AACL,SAAK,iBAAiB,8BAA8B,KAAK,sBAAsB;AAC/E,SAAK,iBAAiB,kCAAkC,KAAK,0BAA0B;EACzF;EAES,uBAAoB;AAC3B,SAAK,oBAAoB,8BAA8B,KAAK,sBAAsB;AAClF,SAAK,oBAAoB,kCAAkC,KAAK,0BAA0B;AAC1F,UAAM,qBAAoB;EAC5B;;;;;;;;;;EAWmB,kBACjB,gBACA,cACA,MAAa;AAEb,QAAI,CAAC,kBAAkB,CAAC,cAAc,gBAAgB;AAAc;AAEpE,UAAM,cAAc;AACpB,gBAAY,0BAA0B,IAAI;AAC1C,gBAAY,sBAAsB,IAAI;EACxC;;AAII,IAAO,oBAAP,cAAiC,QAAO;EAC5B,yBAAyB,gBAAmC,MAAU;AACnF,mBAAqD,sBAAsB,SAAS,QAAQ;EAC/F;;","names":["css","html","LitElement","property","consume","LitElement","css","html","__decorate","consume","property","css","html","LitElement","property","consume","LitElement","css","html","__decorate","consume","property","css","html","LitElement","property","consume","LitElement","css","html","__decorate","consume","property","css","html","html","property","__decorate","property","html","html","html","html","html","html","property","state","Correctness","__decorate","property","state","state","__decorate","state","css","html","property","css","html","__decorate","property","repeat","repeat","css","html","css","html","css","html","repeat","css","previous","repeat","html","css","html","nothing","css","nothing","html","css","html","css","html"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
qtiProcessingElements
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LPYZVKHX.js";
|
|
4
4
|
|
|
5
5
|
// ../qti-processing/dist/register.js
|
|
6
6
|
for (const { tag, ctor } of qtiProcessingElements) {
|
|
@@ -8,4 +8,4 @@ for (const { tag, ctor } of qtiProcessingElements) {
|
|
|
8
8
|
customElements.define(tag, ctor);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
//# sourceMappingURL=chunk-
|
|
11
|
+
//# sourceMappingURL=chunk-5BP2A7BI.js.map
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
elements8,
|
|
22
22
|
elements9,
|
|
23
23
|
qtiInteractionElements
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-TZCOXFPB.js";
|
|
25
25
|
|
|
26
26
|
// ../qti-interactions/dist/register-all.js
|
|
27
27
|
for (const { tag, ctor } of qtiInteractionElements) {
|
|
@@ -176,4 +176,4 @@ for (const { tag, ctor } of elements21) {
|
|
|
176
176
|
customElements.define(tag, ctor);
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
|
-
//# sourceMappingURL=chunk-
|
|
179
|
+
//# sourceMappingURL=chunk-DAESCCLR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../qti-test/src/plugin-state.ts"],"sourcesContent":["import type { ComputedContext } from '@qti-components/base';\nimport type { QtiTestPluginState } from './types/qti-test-state';\n\n/**\n * A plugin's entry in the state, typed through `QtiTestPluginState`, or `undefined` before the\n * plugin has stored anything. Read it from `computedContext`; write it by dispatching\n * `qc-test-update-plugin-state` (`dispatchPublic`).\n */\nexport const pluginState = <K extends keyof QtiTestPluginState & string>(\n context: Pick<ComputedContext, 'plugins'> | undefined,\n plugin: K\n): QtiTestPluginState[K] | undefined => context?.plugins?.[plugin] as QtiTestPluginState[K] | undefined;\n"],"mappings":";AAQO,IAAM,cAAc,CACzB,SACA,WACsC,SAAS,UAAU,MAAM;","names":[]}
|
|
@@ -106,7 +106,8 @@ var itemContextVariables = [
|
|
|
106
106
|
identifier: "completionStatus",
|
|
107
107
|
cardinality: "single",
|
|
108
108
|
baseType: "string",
|
|
109
|
-
|
|
109
|
+
// QTI info model §2.2.2; the item makes it `unknown` once it is presented.
|
|
110
|
+
value: "not_attempted",
|
|
110
111
|
type: "outcome"
|
|
111
112
|
},
|
|
112
113
|
{
|
|
@@ -201,6 +202,35 @@ var validationMessage = css3`
|
|
|
201
202
|
}
|
|
202
203
|
`;
|
|
203
204
|
|
|
205
|
+
// ../qti-base/dist/utils/state-aliases.js
|
|
206
|
+
var STATE_ALIASES = {
|
|
207
|
+
chip: ["drag"],
|
|
208
|
+
drop: ["droppable"],
|
|
209
|
+
lifted: ["dragging"],
|
|
210
|
+
used: ["placeholder"],
|
|
211
|
+
"return-target": ["return-anchor"],
|
|
212
|
+
"drag-over": ["hover"],
|
|
213
|
+
"candidate-partial": ["candidate-partially-correct"]
|
|
214
|
+
};
|
|
215
|
+
function setState(states, name, on, oldNames) {
|
|
216
|
+
if (!states)
|
|
217
|
+
return;
|
|
218
|
+
const names = [name, ...oldNames ?? STATE_ALIASES[name] ?? []];
|
|
219
|
+
for (const n of names) {
|
|
220
|
+
if (on)
|
|
221
|
+
states.add(n);
|
|
222
|
+
else
|
|
223
|
+
states.delete(n);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
function hasState(states, name) {
|
|
227
|
+
if (!states)
|
|
228
|
+
return false;
|
|
229
|
+
if (states.has(name))
|
|
230
|
+
return true;
|
|
231
|
+
return (STATE_ALIASES[name] ?? []).some((n) => states.has(n));
|
|
232
|
+
}
|
|
233
|
+
|
|
204
234
|
// ../qti-base/dist/abstract/interaction.js
|
|
205
235
|
import { ContextConsumer, consume, provide } from "@lit/context";
|
|
206
236
|
import { LitElement } from "lit";
|
|
@@ -320,11 +350,40 @@ var Interaction = class extends LitElement {
|
|
|
320
350
|
set value(val) {
|
|
321
351
|
this.response = val ? JSON.parse(val) : null;
|
|
322
352
|
}
|
|
323
|
-
|
|
353
|
+
/** Forget that a submit has reported: a reset or a new attempt waits for a submit again. */
|
|
354
|
+
resetValidityReport() {
|
|
355
|
+
this._validityReported = false;
|
|
356
|
+
this.clearInlineValidationMessage();
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Show the validity state, in the configured mode.
|
|
360
|
+
*
|
|
361
|
+
* When it shows depends on what asked: a `change` (the candidate picked or dropped something)
|
|
362
|
+
* reports what they just did wrong, too many, at once; too few is not an error until they say they
|
|
363
|
+
* are done, so a `submit` (the item's end attempt, a form's submit) is what first shows it. After
|
|
364
|
+
* that first submit, changes report in full, so the message clears the moment the minimum is met
|
|
365
|
+
* and comes back if it is lost again. The validity itself is always set: a form with a
|
|
366
|
+
* below-minimum interaction cannot submit either way.
|
|
367
|
+
*/
|
|
368
|
+
reportValidity(options) {
|
|
369
|
+
const trigger = options?.trigger ?? "submit";
|
|
370
|
+
if (trigger === "submit")
|
|
371
|
+
this.validate?.();
|
|
324
372
|
const isValid = this._internals.validity.valid;
|
|
325
373
|
const mode = this.validationDisplayMode;
|
|
374
|
+
if (trigger === "submit")
|
|
375
|
+
this._validityReported = true;
|
|
376
|
+
if (trigger === "change" && !this._validityReported && this._validityKind === "min") {
|
|
377
|
+
this.clearInlineValidationMessage();
|
|
378
|
+
return isValid;
|
|
379
|
+
}
|
|
326
380
|
if (mode === "native" || mode === "both") {
|
|
327
|
-
this.
|
|
381
|
+
this._reportingNatively = true;
|
|
382
|
+
try {
|
|
383
|
+
this._internals.reportValidity();
|
|
384
|
+
} finally {
|
|
385
|
+
this._reportingNatively = false;
|
|
386
|
+
}
|
|
328
387
|
}
|
|
329
388
|
if (mode === "inline" || mode === "both") {
|
|
330
389
|
this.updateInlineValidationMessage();
|
|
@@ -371,6 +430,7 @@ var Interaction = class extends LitElement {
|
|
|
371
430
|
setInteractionValidity(isValid, validityMessage = "", anchor, options) {
|
|
372
431
|
const validityAnchor = anchor ?? this;
|
|
373
432
|
this._internals.setValidity(isValid ? {} : { customError: true }, validityMessage, validityAnchor);
|
|
433
|
+
this._validityKind = isValid ? void 0 : options?.kind ?? "other";
|
|
374
434
|
if (options?.suppressInline !== true && (this.validationDisplayMode === "inline" || this.validationDisplayMode === "both")) {
|
|
375
435
|
this.updateInlineValidationMessage();
|
|
376
436
|
}
|
|
@@ -400,9 +460,11 @@ var Interaction = class extends LitElement {
|
|
|
400
460
|
return this.shadowRoot?.querySelector("#validation-message");
|
|
401
461
|
}
|
|
402
462
|
reset() {
|
|
463
|
+
this.resetValidityReport();
|
|
403
464
|
this.response = null;
|
|
404
465
|
}
|
|
405
466
|
formResetCallback() {
|
|
467
|
+
this.resetValidityReport();
|
|
406
468
|
this.reset();
|
|
407
469
|
}
|
|
408
470
|
connectedCallback() {
|
|
@@ -432,6 +494,24 @@ var Interaction = class extends LitElement {
|
|
|
432
494
|
}
|
|
433
495
|
}));
|
|
434
496
|
}
|
|
497
|
+
/**
|
|
498
|
+
* `disabled` and `readonly` are states as well as attributes (qti-theme CONTRACT.md §3): a theme
|
|
499
|
+
* reads `:state(disabled)` on the host the way it reads it on a choice. The attribute stays
|
|
500
|
+
* reflected, so `[disabled]` keeps matching.
|
|
501
|
+
*/
|
|
502
|
+
update(changed) {
|
|
503
|
+
const first = !this.hasUpdated;
|
|
504
|
+
super.update(changed);
|
|
505
|
+
if (first) {
|
|
506
|
+
const run = () => this.isConnected && this.validate();
|
|
507
|
+
void this.updateComplete.then(run);
|
|
508
|
+
requestAnimationFrame(() => requestAnimationFrame(run));
|
|
509
|
+
}
|
|
510
|
+
if (changed.has("disabled"))
|
|
511
|
+
setState(this._internals.states, "disabled", this.disabled);
|
|
512
|
+
if (changed.has("readonly"))
|
|
513
|
+
setState(this._internals.states, "readonly", this.readonly);
|
|
514
|
+
}
|
|
435
515
|
constructor() {
|
|
436
516
|
super();
|
|
437
517
|
this.#itemContext = new ContextConsumer(this, {
|
|
@@ -444,7 +524,17 @@ var Interaction = class extends LitElement {
|
|
|
444
524
|
this._interactionContext = { choiceRole: null, draggablesSelector: null };
|
|
445
525
|
this.disabled = false;
|
|
446
526
|
this.readonly = false;
|
|
527
|
+
this._validityReported = false;
|
|
528
|
+
this._reportingNatively = false;
|
|
447
529
|
this._internals = this.attachInternals();
|
|
530
|
+
this.addEventListener("invalid", () => {
|
|
531
|
+
if (this._reportingNatively)
|
|
532
|
+
return;
|
|
533
|
+
this._validityReported = true;
|
|
534
|
+
if (this.validationDisplayMode === "inline" || this.validationDisplayMode === "both") {
|
|
535
|
+
this.updateInlineValidationMessage();
|
|
536
|
+
}
|
|
537
|
+
});
|
|
448
538
|
this.addEventListener("qti-interaction-response", (e) => {
|
|
449
539
|
this.#lastResponse = JSON.stringify(e.detail?.response ?? null);
|
|
450
540
|
});
|
|
@@ -803,6 +893,7 @@ var QtiFeedback = class extends LitElement4 {
|
|
|
803
893
|
subscribe: true,
|
|
804
894
|
callback: (context) => this.#followItem(context)
|
|
805
895
|
});
|
|
896
|
+
this.#hostShows = false;
|
|
806
897
|
}
|
|
807
898
|
/**
|
|
808
899
|
* The item's variables. Feedback follows them itself: every time the item publishes a new context
|
|
@@ -844,12 +935,38 @@ var QtiFeedback = class extends LitElement4 {
|
|
|
844
935
|
}
|
|
845
936
|
this.#showFeedback(isFound);
|
|
846
937
|
}
|
|
938
|
+
/** The host cancelled the show: it has this feedback, and is not asked again until the condition has gone. */
|
|
939
|
+
#hostShows;
|
|
847
940
|
#showFeedback(value) {
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
941
|
+
const next = this.#sessionControlAllowsFeedback() && this.#conditionHolds(value) ? "on" : "off";
|
|
942
|
+
if (next === "on") {
|
|
943
|
+
if (this.showStatus === "on" || this.#hostShows)
|
|
944
|
+
return;
|
|
945
|
+
if (!this.feedbackShowing()) {
|
|
946
|
+
this.#hostShows = true;
|
|
947
|
+
this.showStatus = "off";
|
|
948
|
+
return;
|
|
949
|
+
}
|
|
950
|
+
} else {
|
|
951
|
+
this.#hostShows = false;
|
|
952
|
+
if (this.showStatus === "on" && !this.feedbackHiding())
|
|
953
|
+
return;
|
|
851
954
|
}
|
|
852
|
-
this.showStatus =
|
|
955
|
+
this.showStatus = next;
|
|
956
|
+
}
|
|
957
|
+
#conditionHolds(value) {
|
|
958
|
+
return value && this.showHide === "show" || !value && this.showHide === "hide";
|
|
959
|
+
}
|
|
960
|
+
/**
|
|
961
|
+
* Called when this feedback is about to show. Return `false` to keep it hidden: the host shows the
|
|
962
|
+
* content itself. The elements dispatch `qc-feedback-show` here.
|
|
963
|
+
*/
|
|
964
|
+
feedbackShowing() {
|
|
965
|
+
return true;
|
|
966
|
+
}
|
|
967
|
+
/** Called when this feedback is about to hide. Return `false` to keep it showing: the host hides it itself. */
|
|
968
|
+
feedbackHiding() {
|
|
969
|
+
return true;
|
|
853
970
|
}
|
|
854
971
|
/**
|
|
855
972
|
* The QTI `show-feedback` constraint governs exactly one state: after the end of
|
|
@@ -870,11 +987,11 @@ var QtiFeedback = class extends LitElement4 {
|
|
|
870
987
|
if (!this._computedContext)
|
|
871
988
|
return true;
|
|
872
989
|
const activeItem = this._computedContext.testParts?.find((tp) => tp.active)?.sections.flatMap((s) => s.items).find((i) => i.active);
|
|
873
|
-
if (!activeItem || activeItem.showFeedback)
|
|
990
|
+
if (!activeItem || activeItem.sessionControl?.showFeedback)
|
|
874
991
|
return true;
|
|
875
992
|
if (activeItem.adaptive)
|
|
876
993
|
return activeItem.completionStatus !== "completed";
|
|
877
|
-
const maxAttempts = activeItem.maxAttempts ?? 1;
|
|
994
|
+
const maxAttempts = activeItem.sessionControl?.maxAttempts ?? 1;
|
|
878
995
|
if (maxAttempts <= 0)
|
|
879
996
|
return true;
|
|
880
997
|
const numAttempts = Number(this._context?.variables?.find((v) => v.identifier === "numAttempts")?.value) || 0;
|
|
@@ -984,6 +1101,39 @@ function responseAttributeConverter(opts) {
|
|
|
984
1101
|
};
|
|
985
1102
|
}
|
|
986
1103
|
|
|
1104
|
+
// ../qti-base/dist/lib/record.js
|
|
1105
|
+
var isRecordValue = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
1106
|
+
var readRecordFieldValues = (valueElements) => {
|
|
1107
|
+
const value = {};
|
|
1108
|
+
const baseTypes = {};
|
|
1109
|
+
for (const element of valueElements) {
|
|
1110
|
+
const fieldIdentifier = element.getAttribute("field-identifier");
|
|
1111
|
+
if (!fieldIdentifier)
|
|
1112
|
+
continue;
|
|
1113
|
+
value[fieldIdentifier] = element.textContent?.trim() ?? "";
|
|
1114
|
+
const baseType = element.getAttribute("base-type");
|
|
1115
|
+
if (baseType)
|
|
1116
|
+
baseTypes[fieldIdentifier] = baseType;
|
|
1117
|
+
}
|
|
1118
|
+
return { value, baseTypes };
|
|
1119
|
+
};
|
|
1120
|
+
var NUMBER = /^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/;
|
|
1121
|
+
var inferRecordFieldBaseType = (value) => {
|
|
1122
|
+
if (typeof value === "number")
|
|
1123
|
+
return Number.isInteger(value) ? "integer" : "float";
|
|
1124
|
+
if (typeof value === "boolean")
|
|
1125
|
+
return "boolean";
|
|
1126
|
+
if (typeof value !== "string")
|
|
1127
|
+
return "string";
|
|
1128
|
+
const text = value.trim();
|
|
1129
|
+
if (NUMBER.test(text))
|
|
1130
|
+
return "float";
|
|
1131
|
+
const parts = text.split(/\s+/);
|
|
1132
|
+
if (parts.length === 2 && parts.every((part) => NUMBER.test(part)))
|
|
1133
|
+
return "point";
|
|
1134
|
+
return "string";
|
|
1135
|
+
};
|
|
1136
|
+
|
|
987
1137
|
// ../qti-base/dist/lib/qti-rule-base.js
|
|
988
1138
|
import { LitElement as LitElement5 } from "lit";
|
|
989
1139
|
var QtiRuleElement = class extends LitElement5 {
|
|
@@ -1219,6 +1369,9 @@ export {
|
|
|
1219
1369
|
boxSizing,
|
|
1220
1370
|
dropRegion,
|
|
1221
1371
|
validationMessage,
|
|
1372
|
+
STATE_ALIASES,
|
|
1373
|
+
setState,
|
|
1374
|
+
hasState,
|
|
1222
1375
|
Interaction,
|
|
1223
1376
|
QtiVariableDeclaration,
|
|
1224
1377
|
QtiExpression,
|
|
@@ -1236,6 +1389,9 @@ export {
|
|
|
1236
1389
|
parsePoint,
|
|
1237
1390
|
serializePoint,
|
|
1238
1391
|
responseAttributeConverter,
|
|
1392
|
+
isRecordValue,
|
|
1393
|
+
readRecordFieldValues,
|
|
1394
|
+
inferRecordFieldBaseType,
|
|
1239
1395
|
QtiRuleElement,
|
|
1240
1396
|
QtiExitResponseSignal,
|
|
1241
1397
|
QtiExitTestSignal,
|
|
@@ -1244,4 +1400,4 @@ export {
|
|
|
1244
1400
|
getCustomOperator,
|
|
1245
1401
|
ScoringHelper
|
|
1246
1402
|
};
|
|
1247
|
-
//# sourceMappingURL=chunk-
|
|
1403
|
+
//# sourceMappingURL=chunk-GPC53O7P.js.map
|