@pie-qti/assessment-player 1.0.0-beta.4 → 1.0.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/README.md +28 -7
  2. package/dist/components/createPlayerConnection.svelte.d.ts +90 -0
  3. package/dist/components/createPlayerConnection.svelte.js +151 -0
  4. package/dist/components/createPlayerConnection.svelte.js.map +1 -0
  5. package/dist/components/displaySettings.svelte.d.ts +23 -0
  6. package/dist/components/displaySettings.svelte.js +40 -0
  7. package/dist/components/displaySettings.svelte.js.map +1 -0
  8. package/dist/components/srOnly.d.ts +29 -0
  9. package/dist/components/srOnly.js +55 -0
  10. package/dist/components/srOnly.js.map +1 -0
  11. package/dist/components/submitDialogAction.d.ts +25 -0
  12. package/dist/components/submitDialogAction.js +89 -0
  13. package/dist/components/submitDialogAction.js.map +1 -0
  14. package/dist/core/AssessmentPlayer.d.ts +1102 -53
  15. package/dist/core/AssessmentPlayer.js +2835 -460
  16. package/dist/core/AssessmentPlayer.js.map +1 -1
  17. package/dist/core/AssessmentSessionCoordinator.d.ts +76 -7
  18. package/dist/core/AssessmentSessionCoordinator.js +185 -10
  19. package/dist/core/AssessmentSessionCoordinator.js.map +1 -1
  20. package/dist/core/AutosaveManager.d.ts +104 -0
  21. package/dist/core/AutosaveManager.js +181 -0
  22. package/dist/core/AutosaveManager.js.map +1 -0
  23. package/dist/core/ItemSessionController.d.ts +17 -26
  24. package/dist/core/ItemSessionController.js +33 -73
  25. package/dist/core/ItemSessionController.js.map +1 -1
  26. package/dist/core/NavigationManager.d.ts +18 -50
  27. package/dist/core/NavigationManager.js +21 -83
  28. package/dist/core/NavigationManager.js.map +1 -1
  29. package/dist/core/TimeManager.d.ts +62 -16
  30. package/dist/core/TimeManager.js +148 -57
  31. package/dist/core/TimeManager.js.map +1 -1
  32. package/dist/core/autosave.d.ts +44 -0
  33. package/dist/core/autosave.js +46 -0
  34. package/dist/core/autosave.js.map +1 -0
  35. package/dist/core/deliveryStructure.d.ts +54 -0
  36. package/dist/core/deliveryStructure.js +72 -0
  37. package/dist/core/deliveryStructure.js.map +1 -0
  38. package/dist/core/errors.d.ts +116 -0
  39. package/dist/core/errors.js +77 -0
  40. package/dist/core/errors.js.map +1 -0
  41. package/dist/core/exitBoundaries.d.ts +64 -0
  42. package/dist/core/exitBoundaries.js +98 -0
  43. package/dist/core/exitBoundaries.js.map +1 -0
  44. package/dist/core/feedback.d.ts +46 -0
  45. package/dist/core/feedback.js +47 -0
  46. package/dist/core/feedback.js.map +1 -0
  47. package/dist/core/formatTime.d.ts +8 -0
  48. package/dist/core/formatTime.js +20 -0
  49. package/dist/core/formatTime.js.map +1 -0
  50. package/dist/core/index.d.ts +7 -4
  51. package/dist/core/index.js +4 -1
  52. package/dist/core/index.js.map +1 -1
  53. package/dist/core/navigationPolicy.d.ts +42 -0
  54. package/dist/core/navigationPolicy.js +62 -0
  55. package/dist/core/navigationPolicy.js.map +1 -0
  56. package/dist/core/pause.d.ts +58 -0
  57. package/dist/core/pause.js +101 -0
  58. package/dist/core/pause.js.map +1 -0
  59. package/dist/core/playerEvents.d.ts +51 -0
  60. package/dist/core/playerEvents.js +66 -0
  61. package/dist/core/playerEvents.js.map +1 -0
  62. package/dist/core/reviewState.d.ts +81 -0
  63. package/dist/core/reviewState.js +113 -0
  64. package/dist/core/reviewState.js.map +1 -0
  65. package/dist/core/reviewViews.d.ts +43 -0
  66. package/dist/core/reviewViews.js +88 -0
  67. package/dist/core/reviewViews.js.map +1 -0
  68. package/dist/core/scopeLocks.d.ts +36 -0
  69. package/dist/core/scopeLocks.js +78 -0
  70. package/dist/core/scopeLocks.js.map +1 -0
  71. package/dist/core/sessionRecords.d.ts +31 -0
  72. package/dist/core/sessionRecords.js +74 -0
  73. package/dist/core/sessionRecords.js.map +1 -0
  74. package/dist/core/submissionPolicy.d.ts +62 -0
  75. package/dist/core/submissionPolicy.js +67 -0
  76. package/dist/core/submissionPolicy.js.map +1 -0
  77. package/dist/core/templateDefaults.d.ts +26 -0
  78. package/dist/core/templateDefaults.js +53 -0
  79. package/dist/core/templateDefaults.js.map +1 -0
  80. package/dist/core/testStructure.d.ts +118 -3
  81. package/dist/core/testStructure.js +252 -6
  82. package/dist/core/testStructure.js.map +1 -1
  83. package/dist/core/timePolicy.d.ts +40 -0
  84. package/dist/core/timePolicy.js +106 -0
  85. package/dist/core/timePolicy.js.map +1 -0
  86. package/dist/index.d.ts +7 -4
  87. package/dist/index.js +5 -1
  88. package/dist/index.js.map +1 -1
  89. package/dist/integration/ReferenceBackendAdapter.d.ts +64 -101
  90. package/dist/integration/ReferenceBackendAdapter.js +216 -1035
  91. package/dist/integration/ReferenceBackendAdapter.js.map +1 -1
  92. package/dist/integration/api-contract.d.ts +179 -17
  93. package/dist/integration/api-contract.js.map +1 -1
  94. package/dist/integration/assessment-item-scorer.d.ts +56 -5
  95. package/dist/integration/assessment-item-scorer.js +116 -13
  96. package/dist/integration/assessment-item-scorer.js.map +1 -1
  97. package/dist/integration/index.d.ts +2 -2
  98. package/dist/integration/index.js +1 -1
  99. package/dist/integration/index.js.map +1 -1
  100. package/dist/integration/qti-test-parser.d.ts +44 -0
  101. package/dist/integration/qti-test-parser.js +529 -0
  102. package/dist/integration/qti-test-parser.js.map +1 -0
  103. package/dist/integration/session-store.d.ts +54 -0
  104. package/dist/integration/session-store.js +75 -0
  105. package/dist/integration/session-store.js.map +1 -0
  106. package/dist/integration/test-navigation.d.ts +23 -0
  107. package/dist/integration/test-navigation.js +32 -0
  108. package/dist/integration/test-navigation.js.map +1 -0
  109. package/dist/integration/toSectionComposition.js +8 -1
  110. package/dist/integration/toSectionComposition.js.map +1 -1
  111. package/dist/reporting/index.d.ts +3 -0
  112. package/dist/reporting/index.js +3 -0
  113. package/dist/reporting/index.js.map +1 -0
  114. package/dist/reporting/inferBaseType.d.ts +13 -0
  115. package/dist/reporting/inferBaseType.js +26 -0
  116. package/dist/reporting/inferBaseType.js.map +1 -0
  117. package/dist/reporting/serializeAssessmentResult.d.ts +27 -0
  118. package/dist/reporting/serializeAssessmentResult.js +377 -0
  119. package/dist/reporting/serializeAssessmentResult.js.map +1 -0
  120. package/dist/reporting/toAssessmentResultXml.d.ts +39 -0
  121. package/dist/reporting/toAssessmentResultXml.js +304 -0
  122. package/dist/reporting/toAssessmentResultXml.js.map +1 -0
  123. package/dist/reporting/types.d.ts +85 -0
  124. package/dist/reporting/types.js +8 -0
  125. package/dist/reporting/types.js.map +1 -0
  126. package/dist/types/index.d.ts +96 -9
  127. package/dist/types/index.js.map +1 -1
  128. package/package.json +21 -15
  129. package/dist/core/StatePersistenceManager.d.ts +0 -125
  130. package/dist/core/StatePersistenceManager.js +0 -268
  131. package/dist/core/StatePersistenceManager.js.map +0 -1
  132. package/dist/utils/PerformanceMonitor.d.ts +0 -114
  133. package/dist/utils/PerformanceMonitor.js +0 -172
  134. package/dist/utils/PerformanceMonitor.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"AssessmentPlayer.js","sourceRoot":"","sources":["../../src/core/AssessmentPlayer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACN,8BAA8B,GAS9B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,mBAAmB,EAAqB,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAyB1D,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EACN,cAAc,EACd,sBAAsB,EACtB,iBAAiB,EACjB,aAAa,EACb,yBAAyB,EACzB,iBAAiB,EACjB,uBAAuB,GACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AA8GhE,MAAM,OAAO,gBAAgB;IACrB,MAAM,CAAC,KAAK,CAAC,MAAM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AAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAC3E,CAAC;AACH,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC/B,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC;AACpD,CAAC;AAED,SAAS,uBAAuB,CAAC,eAA8D;IAC9F,OAAO,eAAe,KAAK,SAAS,IAAI,eAAe,KAAK,aAAa,CAAC;AAC3E,CAAC","sourcesContent":["/**\n * AssessmentPlayer (backend-authoritative)\n *\n * Client responsibilities:\n * - Render items using @pie-qti/item-player\n * - Collect candidate responses\n * - Submit responses to BackendAdapter\n * - Apply backend navigation decisions + session state\n */\n\nimport {\n\tcreateAssessmentItemDefinition,\n\ttype AssessmentItemDefinition,\n\ttype AssessmentItemDefinitionPlugin,\n\ttype ItemSession,\n\ttype PciConfiguration,\n\ttype PnpProfile,\n\ttype PlayerSecurityConfig,\n\ttype QTIRole,\n\ttype SerializedItemSessionState,\n} from '@pie-qti/item-player';\nimport { DefaultI18nProvider, type I18nProvider } from '@pie-qti/i18n';\nimport { isShownByIdentifier } from '@pie-qti/qti-common';\nimport type { QtiSectionRuntimeHostContract, QtiSectionToolConfig } from '@pie-qti/section-player';\nimport type {\n\tAssessmentRubricBlock,\n\tAssessmentSessionState,\n\tAssessmentScoringResult,\n\tBackendAdapter,\n\tFinalizeAssessmentResponse,\n\tInitSessionRequest,\n\tInitSessionResponse,\n\tSecureAssessment,\n\tSecureItemRef,\n\tSecureSection,\n\tSecureTestPart,\n\tSessionId,\n\tTestFeedbackItem,\n\tTestOutcomeValues,\n} from '../integration/api-contract.js';\nimport type {\n\tAssessmentResults,\n\tItemResult,\n\tNavigationState,\n\tTimeLimits,\n\tVisibleTestFeedback,\n} from '../types/index.js';\nimport { AssessmentSessionCoordinator } from './AssessmentSessionCoordinator.js';\nimport { NavigationManager } from './NavigationManager.js';\nimport {\n\tdeliveredItems,\n\tevaluateTestExpression,\n\tisAdaptiveItemXml,\n\tplainQtiValue,\n\tresolveItemSessionControl,\n\tsectionComponents,\n\ttestOutcomeDeclarations,\n} from './testStructure.js';\nimport { extendTimeLimit, TimeManager } from './TimeManager.js';\n\nexport interface BackendAssessmentPlayerConfig {\n\tbackend: BackendAdapter;\n\tinitSession: InitSessionRequest;\n\trole?: QTIRole;\n\t/**\n\t * @deprecated Ignored. The backend draws selection and ordering at session start; pass an rng to\n\t * `new ReferenceBackendAdapter({ rng })` for deterministic draws.\n\t */\n\trng?: () => number;\n\t/** Definition-lifetime extractor and renderer extensions applied to every item. */\n\tplugins?: readonly AssessmentItemDefinitionPlugin[];\n\t/**\n\t * Shared catalog files the package manifest lists (resource type\n\t * `imsqti_catalog_xmlv3p0`), read by the host that loaded the package. When the\n\t * reference backend parses the assessment test they become package-scope\n\t * catalog sources beneath item-level catalogs (QTI 3.0 §6.3).\n\t */\n\tsharedCatalogs?: ReadonlyArray<{ href?: string; xml?: string }>;\n\t/**\n\t * Optional i18n provider for internationalization.\n\t * If provided, this will be shared across all item players in the assessment.\n\t */\n\ti18nProvider?: I18nProvider;\n\t/**\n\t * Security configuration for URL policy and content restrictions.\n\t * If provided, this will be passed to all item players in the assessment.\n\t */\n\tsecurity?: PlayerSecurityConfig;\n\t/**\n\t * Explicit host trust configuration for Portable Custom Interaction modules.\n\t * Without this resolver, authored PCI code remains disabled.\n\t */\n\tpci?: PciConfiguration;\n\t/**\n\t * Optional host hooks for delegated section rendering.\n\t * Used for section shared-content URL policy and runtime callbacks.\n\t */\n\tsectionHost?: QtiSectionRuntimeHostContract;\n\t/** Optional section-scoped tools rendered by delegated section players. */\n\tsectionTools?: QtiSectionToolConfig[];\n\t/** Optional tools rendered in passage/rubric headers. */\n\tpassageTools?: QtiSectionToolConfig[];\n\t/** Optional tools rendered in item headers. */\n\titemTools?: QtiSectionToolConfig[];\n\t/**\n\t * Demo/reference-only escape hatch. When false (default), rich item-session\n\t * variables stay client-local and are not submitted because template variables\n\t * can contain answer keys. Production backends should own this state server-side.\n\t */\n\tsendItemSessionToBackend?: boolean;\n\t// UI options\n\tshowSections?: boolean;\n\tallowSectionNavigation?: boolean;\n\tshowProgress?: boolean;\n\t// Time management\n\ttimeWarningThreshold?: number;\n\t/**\n\t * Deterministic clock for time-limit tracking. Defaults to Date.now; intended for\n\t * tests and hosts that drive delivery from their own timeline.\n\t */\n\tnow?: () => number;\n\t/**\n\t * QTI 3.0 §6.2 Personal Needs and Preferences profile.\n\t * Extended time (pnp.content.extendedTime) is applied to assessment timeLimits.\n\t * The full profile is passed down to each item player for component-level features\n\t * (color scheme, elimination tool).\n\t */\n\tpnp?: PnpProfile;\n\t// Callbacks\n\tonItemChange?: (itemIndex: number, totalItems: number) => void;\n\tonSectionChange?: (sectionIndex: number, totalSections: number) => void;\n\tonResponseChange?: (responses: Record<string, unknown>) => void;\n\tonComplete?: () => void;\n}\n\ntype FlatItem = {\n\tidentifier: string;\n\titem: SecureItemRef;\n\t/** Innermost enclosing section. */\n\tsection: SecureSection;\n\t/** Enclosing sections, outermost first. */\n\tsections: SecureSection[];\n\ttestPart: SecureTestPart;\n\tindex: number;\n\tsectionIndex: number;\n};\n\ntype CurrentItemView = {\n\tidentifier: string;\n\ttitle?: string;\n\trequired?: boolean;\n\titemXml: string;\n\tdeliveryContext?: SecureItemRef['deliveryContext'];\n};\n\ntype SectionItemRefView = {\n\tidentifier: string;\n\thref?: string;\n\ttitle?: string;\n\titemXml: string;\n\tdeliveryContext?: SecureItemRef['deliveryContext'];\n};\n\nexport interface EffectiveItemTimeLimits {\n\ttimeLimits?: TimeLimits;\n\tsource?: 'item' | 'section' | 'testPart' | 'assessment';\n}\n\nexport class AssessmentPlayer {\n\tpublic static async create(config: BackendAssessmentPlayerConfig): Promise<AssessmentPlayer> {\n\t\tconst init = await config.backend.initSession(config.initSession);\n\t\treturn new AssessmentPlayer(config, init);\n\t}\n\n\tprivate backend: BackendAdapter;\n\tprivate sessionId: SessionId;\n\tprivate assessment: SecureAssessment;\n\tprivate i18nProvider: I18nProvider;\n\n\tprivate navigationManager: NavigationManager;\n\tprivate sessionCoordinator!: AssessmentSessionCoordinator;\n\tprivate timeManager: TimeManager | null = null;\n\n\tprivate items: FlatItem[] = [];\n\tprivate currentItemIndex = -1;\n\tprivate readonly itemDefinitions = new Map<string, AssessmentItemDefinition>();\n\tprivate currentItemSession: ItemSession | null = null;\n\tprivate currentItemSessionUnsubscribe: (() => void) | null = null;\n\t/** Test-level outcomes from the last outcome processing; null until it first runs. */\n\tprivate testOutcomes: TestOutcomeValues | null = null;\n\tprivate finalized = false;\n\t/** Scopes whose time limit expired without late submission, keyed `scope:identifier`. */\n\tprivate readonly lockedScopes = new Set<string>();\n\tprivate legacyFeedback: string | undefined;\n\n\t// Event listeners\n\tprivate itemChangeListeners = new Set<(index: number, total: number) => void>();\n\tprivate sectionChangeListeners = new Set<(index: number, total: number) => void>();\n\tprivate responseChangeListeners = new Set<(responses: Record<string, unknown>) => void>();\n\tprivate completeListeners = new Set<() => void>();\n\tprivate testFeedbackChangeListeners = new Set<() => void>();\n\tprivate timeWarningListeners = new Set<(remainingSeconds: number) => void>();\n\tprivate timeExpiredListeners = new Set<() => void>();\n\tprivate timeTickListeners = new Set<(remainingSeconds: number, elapsedSeconds: number) => void>();\n\n\tprivate constructor(private config: BackendAssessmentPlayerConfig, init: InitSessionResponse) {\n\t\tthis.backend = config.backend;\n\t\tthis.sessionId = init.sessionId;\n\t\tthis.assessment = init.assessment;\n\t\tthis.testOutcomes = init.outcomes ? cloneData(init.outcomes)! : null;\n\t\tthis.i18nProvider = config.i18nProvider ?? this.createDefaultI18nProvider();\n\t\tconst initialState =\n\t\t\tinit.restoredState ??\n\t\t\t({\n\t\t\t\tcurrentItemIdentifier: init.currentItemIdentifier ?? '',\n\t\t\t\tvisitedItems: [],\n\t\t\t\titemResponses: {},\n\t\t\t\titemScores: {},\n\t\t\t\titemSessions: {},\n\t\t\t\ttiming: { startedAt: Date.now(), itemTimes: {}, totalTime: 0 },\n\t\t\t} as AssessmentSessionState);\n\n\t\tthis.items = this.flattenItems(this.assessment);\n\n\t\tconst navigationMode = this.assessment.navigationMode || 'nonlinear';\n\t\tthis.navigationManager = new NavigationManager(navigationMode, this.items.length);\n\n\t\t// Item session control is a UI hint; backend remains authoritative.\n\t\tthis.sessionCoordinator = new AssessmentSessionCoordinator({\n\t\t\tstate: initialState,\n\t\t\titemIdentifiers: this.items.map((q) => q.identifier),\n\t\t\titemSessionControlByItem: Object.fromEntries(\n\t\t\t\tthis.items.map((q) => [q.identifier, resolveItemSessionControl(q.testPart, q.sections, q.item)]),\n\t\t\t),\n\t\t});\n\n\t\tthis.timeManager = new TimeManager({\n\t\t\tassessmentTimeLimits: this.assessment.timeLimits,\n\t\t\twarningThreshold: config.timeWarningThreshold || 60,\n\t\t\tnow: config.now,\n\t\t\textendedTime: config.pnp?.content?.extendedTime,\n\t\t\tonWarning: (remainingSeconds) => this.notifyTimeWarning(remainingSeconds),\n\t\t\tonExpired: () => this.notifyTimeExpired(),\n\t\t\tonScopeExpired: (scope, identifier) => this.handleScopeExpired(scope, identifier),\n\t\t\tonTick: (remainingSeconds, elapsedSeconds) => this.notifyTimeTick(remainingSeconds, elapsedSeconds),\n\t\t});\n\t\tif (init.restoredState?.timing) {\n\t\t\tthis.restoreTimeTracking(init.restoredState.timing);\n\t\t}\n\n\t\t// Restore to backend-provided current item if present\n\t\tconst startId = this.state.currentItemIdentifier;\n\t\tconst idx = startId ? this.items.findIndex((q) => q.identifier === startId) : -1;\n\t\tif (idx >= 0) {\n\t\t\tthis.navigateTo(idx, { restoring: true }).catch(() => {});\n\t\t} else if (this.items.length > 0) {\n\t\t\tthis.navigateTo(0, { restoring: true }).catch(() => {});\n\t\t}\n\t}\n\n\tprivate get state(): AssessmentSessionState {\n\t\treturn this.sessionCoordinator.state;\n\t}\n\n\tprivate set state(state: AssessmentSessionState) {\n\t\tthis.sessionCoordinator.restoreState(state);\n\t}\n\n\tprivate getEffectiveItemTimeLimits(flat: FlatItem): EffectiveItemTimeLimits {\n\t\tconst scopes: Array<{ source: EffectiveItemTimeLimits['source']; limits?: TimeLimits }> = [\n\t\t\t{ source: 'assessment', limits: this.assessment.timeLimits },\n\t\t\t{ source: 'testPart', limits: flat.testPart.timeLimits },\n\t\t\t{ source: 'section', limits: flat.section.timeLimits },\n\t\t\t{ source: 'item', limits: flat.item.timeLimits },\n\t\t];\n\t\tlet source: EffectiveItemTimeLimits['source'];\n\t\tlet minTime: number | undefined;\n\t\tlet maxTime: number | undefined;\n\t\tlet allowLateSubmission: boolean | undefined;\n\t\tfor (const scope of scopes) {\n\t\t\tif (!scope.limits) continue;\n\t\t\tif (scope.limits.minTime !== undefined) {\n\t\t\t\tminTime = minTime === undefined ? scope.limits.minTime : Math.max(minTime, scope.limits.minTime);\n\t\t\t}\n\t\t\tif (scope.limits.maxTime !== undefined) {\n\t\t\t\tconst scopedMaxTime = extendTimeLimit(scope.limits.maxTime, this.config.pnp?.content?.extendedTime);\n\t\t\t\tif (scopedMaxTime !== undefined && (maxTime === undefined || scopedMaxTime < maxTime)) {\n\t\t\t\t\tmaxTime = scopedMaxTime;\n\t\t\t\t\tsource = scope.source;\n\t\t\t\t\tallowLateSubmission = scope.limits.allowLateSubmission;\n\t\t\t\t}\n\t\t\t} else if (scope.limits.allowLateSubmission !== undefined && maxTime === undefined) {\n\t\t\t\tallowLateSubmission = scope.limits.allowLateSubmission;\n\t\t\t\tsource = scope.source;\n\t\t\t}\n\t\t}\n\n\t\tif (maxTime === undefined && minTime === undefined && allowLateSubmission === undefined) {\n\t\t\treturn {};\n\t\t}\n\t\treturn { source, timeLimits: { minTime, maxTime, allowLateSubmission } };\n\t}\n\n\tpublic getCurrentEffectiveTimeLimits(): EffectiveItemTimeLimits {\n\t\tconst q = this.items[this.currentItemIndex];\n\t\treturn q ? this.getEffectiveItemTimeLimits(q) : {};\n\t}\n\n\tprivate getSubmitTimingEvidence(q: FlatItem, elapsedMs: number): import('../integration/api-contract.js').SubmitTimingEvidence | undefined {\n\t\tconst effective = this.getEffectiveItemTimeLimits(q);\n\t\tconst limitSeconds = effective.timeLimits?.maxTime;\n\t\tif (!effective.source || limitSeconds === undefined) return undefined;\n\t\tconst scopeIdentifier = effective.source === 'item'\n\t\t\t? q.identifier\n\t\t\t: effective.source === 'section'\n\t\t\t\t? q.section.identifier\n\t\t\t\t: effective.source === 'testPart'\n\t\t\t\t\t? q.testPart.identifier\n\t\t\t\t\t: undefined;\n\t\tconst tracked = this.timeManager?.getScopeElapsedMs(effective.source, scopeIdentifier);\n\t\tconst scopedElapsedMs = tracked ?? elapsedMs;\n\t\treturn {\n\t\t\tscope: effective.source,\n\t\t\telapsedMs: scopedElapsedMs,\n\t\t\tlimitSeconds,\n\t\t\texpired: scopedElapsedMs >= limitSeconds * 1000,\n\t\t\tallowLateSubmission: effective.timeLimits?.allowLateSubmission,\n\t\t};\n\t}\n\n\tprivate assertMinimumTime(scope: 'assessment' | 'testPart' | 'section' | 'item', q: FlatItem): void {\n\t\tconst limits = scope === 'assessment'\n\t\t\t? this.assessment.timeLimits\n\t\t\t: scope === 'testPart'\n\t\t\t\t? q.testPart.timeLimits\n\t\t\t\t: scope === 'section'\n\t\t\t\t\t? q.section.timeLimits\n\t\t\t\t\t: q.item.timeLimits;\n\t\tif (limits?.minTime === undefined) return;\n\t\tconst identifier = scope === 'testPart'\n\t\t\t? q.testPart.identifier\n\t\t\t: scope === 'section'\n\t\t\t\t? q.section.identifier\n\t\t\t\t: scope === 'item'\n\t\t\t\t\t? q.identifier\n\t\t\t\t\t: undefined;\n\t\tconst elapsedMs = this.timeManager?.getScopeElapsedMs(scope, identifier) ?? 0;\n\t\tif (elapsedMs < limits.minTime * 1000) {\n\t\t\tconst remaining = Math.ceil(limits.minTime - elapsedMs / 1000);\n\t\t\tthrow new Error(`The ${scope} minimum time has not elapsed (${remaining}s remaining).`);\n\t\t}\n\t}\n\n\tprivate assertTransitionMinimum(current: FlatItem, target: FlatItem): void {\n\t\tif (current === target) return;\n\t\tthis.assertMinimumTime('item', current);\n\t\tif (current.section.identifier !== target.section.identifier) this.assertMinimumTime('section', current);\n\t\tif (current.testPart !== target.testPart) this.assertMinimumTime('testPart', current);\n\t}\n\n\tprivate flattenItems(assessment: SecureAssessment): FlatItem[] {\n\t\tconst sectionIndexes = new Map(this.getAllSections().map((section) => [section.id, section.index]));\n\t\treturn deliveredItems(assessment).map(({ item, testPart, sections }, index) => {\n\t\t\tconst section = sections[sections.length - 1];\n\t\t\treturn {\n\t\t\t\tidentifier: item.identifier,\n\t\t\t\titem,\n\t\t\t\tsection,\n\t\t\t\tsections,\n\t\t\t\ttestPart,\n\t\t\t\tindex,\n\t\t\t\tsectionIndex: sectionIndexes.get(section.identifier) ?? 0,\n\t\t\t};\n\t\t});\n\t}\n\n\t// ---------------------------------------------------------------------------\n\t// Public API used by components\n\t// ---------------------------------------------------------------------------\n\n\tpublic getAllSections(): Array<{ id: string; title?: string; visible: boolean; index: number }> {\n\t\tconst out: Array<{ id: string; title?: string; visible: boolean; index: number }> = [];\n\t\tconst seen = new Set<string>();\n\t\tconst visit = (section: SecureSection): void => {\n\t\t\t// A keepTogether=\"false\" section mixed into its parent's shuffle appears as several fragments.\n\t\t\tif (!seen.has(section.identifier)) {\n\t\t\t\tseen.add(section.identifier);\n\t\t\t\tout.push({ id: section.identifier, title: section.title, visible: section.visible, index: out.length });\n\t\t\t}\n\t\t\tfor (const component of sectionComponents(section)) {\n\t\t\t\tif (component.type === 'section') visit(component.section);\n\t\t\t}\n\t\t};\n\t\tfor (const tp of this.assessment.testParts || []) {\n\t\t\tfor (const section of tp.sections || []) visit(section);\n\t\t}\n\t\treturn out;\n\t}\n\n\tpublic getNavigationState(): NavigationState {\n\t\tconst total = this.items.length;\n\t\tconst canPrevious = this.canPrevious();\n\t\tconst canNext = this.canNext();\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tconst totalSections = this.getAllSections().length;\n\t\treturn {\n\t\t\tcurrentIndex: this.currentItemIndex,\n\t\t\ttotalItems: total,\n\t\t\tcanNext,\n\t\t\tcanPrevious,\n\t\t\tisLoading: false,\n\t\t\tcurrentSection: q\n\t\t\t\t? { id: q.section.identifier, title: q.section.title, index: q.sectionIndex }\n\t\t\t\t: undefined,\n\t\t\ttotalSections,\n\t\t};\n\t}\n\n\tpublic getCurrentItem(): CurrentItemView | null {\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tif (!q) return null;\n\t\treturn {\n\t\t\tidentifier: q.item.identifier,\n\t\t\ttitle: q.section.title,\n\t\t\trequired: q.item.required,\n\t\t\titemXml: q.item.itemXml,\n\t\t\tdeliveryContext: q.item.deliveryContext,\n\t\t};\n\t}\n\n\t/**\n\t * The one authoritative live session for the active item.\n\t *\n\t * Section and item renderers receive this exact instance. Serialized item-session\n\t * state is reserved for persistence and restore, never for synchronizing a second\n\t * live player.\n\t */\n\tpublic getCurrentItemSession(): ItemSession | null {\n\t\treturn this.currentItemSession;\n\t}\n\n\tpublic getCurrentSectionItemRefs(): SectionItemRefView[] {\n\t\tconst current = this.items[this.currentItemIndex];\n\t\tif (!current) return [];\n\n\t\treturn this.items\n\t\t\t.filter((item) => item.section.identifier === current.section.identifier)\n\t\t\t.map((item) => {\n\t\t\t\tconst itemRef = item.item as SecureItemRef & { href?: string; title?: string };\n\t\t\t\treturn {\n\t\t\t\t\tidentifier: itemRef.identifier,\n\t\t\t\t\thref: itemRef.href,\n\t\t\t\t\ttitle: itemRef.title,\n\t\t\t\t\titemXml: itemRef.itemXml,\n\t\t\t\t\tdeliveryContext: cloneData(itemRef.deliveryContext),\n\t\t\t\t};\n\t\t\t});\n\t}\n\n\tpublic getResponsesForItem(itemIdentifier: string): Record<string, unknown> {\n\t\treturn cloneData(this.sessionCoordinator.getResponses(itemIdentifier)) ?? {};\n\t}\n\n\tpublic getCurrentSharedRubricBlocks(): AssessmentRubricBlock[] {\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tif (!q) return [];\n\n\t\treturn [\n\t\t\t...(q.testPart.rubricBlocks ?? []),\n\t\t\t...(q.section.rubricBlocks ?? []),\n\t\t].map((block) => ({ ...block, view: [...block.view] }));\n\t}\n\n\tpublic getCurrentRubricBlocks(): AssessmentRubricBlock[] {\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tif (!q) return [];\n\t\treturn q.section.rubricBlocks || q.testPart.rubricBlocks || [];\n\t}\n\n\t/**\n\t * Test feedback shown now, test-level first, then each test part's. Nothing shows before outcome\n\t * processing first runs. `during` feedback then shows by its outcome, test-part `during`\n\t * feedback while its part is current; `atEnd` feedback shows once the test, or its test part,\n\t * has ended.\n\t */\n\tpublic getVisibleFeedback(): VisibleTestFeedback[] {\n\t\tconst outcomes = this.testOutcomes;\n\t\tconst parts = this.assessment.testParts ?? [];\n\t\tconst hasStructured =\n\t\t\t(this.assessment.testFeedback?.length ?? 0) > 0 || parts.some((part) => (part.testFeedback?.length ?? 0) > 0);\n\t\tif (!hasStructured) {\n\t\t\treturn this.finalized && this.legacyFeedback\n\t\t\t\t? [{ key: 'testFeedback', identifier: 'testFeedback', content: this.legacyFeedback, access: 'atEnd' }]\n\t\t\t\t: [];\n\t\t}\n\t\tif (!outcomes) return [];\n\n\t\tconst shown: VisibleTestFeedback[] = [];\n\t\tconst add = (items: TestFeedbackItem[] | undefined, ended: boolean, current: boolean, part?: SecureTestPart) => {\n\t\t\titems?.forEach((fb, index) => {\n\t\t\t\tif (fb.access === 'atEnd' ? !ended : !current) return;\n\t\t\t\tif (!isShownByIdentifier(outcomes[fb.outcomeIdentifier] ?? null, fb.identifier, fb.showHide)) return;\n\t\t\t\tshown.push({\n\t\t\t\t\tkey: part ? `part:${part.identifier}:${index}` : `test:${index}`,\n\t\t\t\t\tidentifier: fb.identifier,\n\t\t\t\t\tcontent: fb.content,\n\t\t\t\t\taccess: fb.access,\n\t\t\t\t\t...(part ? { testPartIdentifier: part.identifier } : {}),\n\t\t\t\t});\n\t\t\t});\n\t\t};\n\t\tadd(this.assessment.testFeedback, this.finalized, true);\n\t\tconst currentPart = this.currentTestPartIndex();\n\t\tparts.forEach((part, index) => {\n\t\t\tadd(part.testFeedback, this.finalized || currentPart > index, currentPart === index, part);\n\t\t});\n\t\treturn shown;\n\t}\n\n\tprivate currentTestPartIndex(): number {\n\t\tconst part = this.items[this.currentItemIndex]?.testPart;\n\t\treturn part ? (this.assessment.testParts ?? []).findIndex((p) => p.identifier === part.identifier) : -1;\n\t}\n\n\tprivate setTestOutcomes(outcomes: TestOutcomeValues | undefined): void {\n\t\tif (!outcomes) return;\n\t\tthis.testOutcomes = cloneData(outcomes)!;\n\t\tthis.notifyTestFeedbackChange();\n\t}\n\n\tpublic updateResponse(responseId: string, value: unknown): void {\n\t\tconst active = this.items[this.currentItemIndex];\n\t\tif (!active) return;\n\t\tif (this.currentItemSession) {\n\t\t\tthis.currentItemSession.dispatch({\n\t\t\t\taction: 'setResponse',\n\t\t\t\tresponseIdentifier: responseId,\n\t\t\t\tvalue,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tthis.sessionCoordinator.updateResponseForItem(active.identifier, responseId, value);\n\t\tthis.notifyResponseChange();\n\t}\n\n\t/**\n\t * Update a response for a specific item.\n\t * Useful when response events are observed outside the current-item renderer and we\n\t * want to be explicit about which item receives the response (some assessments reuse\n\t * the same responseIdentifier like \"RESPONSE\" across items).\n\t */\n\tpublic updateResponseForItem(itemIdentifier: string, responseId: string, value: unknown): void {\n\t\tconst active = this.items[this.currentItemIndex];\n\t\tif (active?.identifier === itemIdentifier && this.currentItemSession) {\n\t\t\tconst liveValue = this.currentItemSession.state().responses[responseId];\n\t\t\tif (!responseValuesEqual(liveValue, value)) {\n\t\t\t\t// Programmatic/host callers still enter through this API. Browser item\n\t\t\t\t// adapters have already dispatched, so their equal value is not applied twice.\n\t\t\t\tthis.currentItemSession.dispatch({\n\t\t\t\t\taction: 'setResponse',\n\t\t\t\t\tresponseIdentifier: responseId,\n\t\t\t\t\tvalue,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tconst persisted = this.sessionCoordinator.getPersistedItemSession(itemIdentifier);\n\t\tif (persisted && !isWritableItemLifecycle(persisted.lifecycleStatus)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Cannot update responses while item session is ${persisted.lifecycleStatus}`,\n\t\t\t);\n\t\t}\n\n\t\tthis.sessionCoordinator.updateResponseForItem(itemIdentifier, responseId, value);\n\t\tthis.notifyResponseChange();\n\t}\n\n\t/**\n\t * Get current unsaved responses for the active item.\n\t * (Useful for host integrations / web components.)\n\t */\n\tpublic getResponses(): Record<string, unknown> {\n\t\tif (this.currentItemSession) {\n\t\t\treturn cloneData(this.currentItemSession.state().responses) ?? {};\n\t\t}\n\t\treturn this.sessionCoordinator.getActiveResponses();\n\t}\n\n\tpublic saveCurrentItemSession(): SerializedItemSessionState | null {\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tif (!q || !this.currentItemSession) return null;\n\n\t\tconst currentView = this.currentItemSession.state();\n\t\tconst transition = isWritableItemLifecycle(currentView.lifecycleStatus)\n\t\t\t? this.currentItemSession.dispatch({ action: 'suspendAttempt' })\n\t\t\t: null;\n\t\tconst itemSession = transition?.result?.sessionState ?? this.currentItemSession.serialize();\n\t\tconst responses = cloneData(transition?.current.responses ?? currentView.responses) ?? {};\n\t\tthis.sessionCoordinator.saveItemSession(\n\t\t\tq.identifier,\n\t\t\tresponses,\n\t\t\titemSession,\n\t\t\ttransition?.current.duration ?? currentView.duration,\n\t\t);\n\t\treturn itemSession;\n\t}\n\n\tprivate endItemSessionForSubmit(\n\t\tq: FlatItem,\n\t\tresponses: Record<string, unknown>,\n\t\titemSession?: SerializedItemSessionState,\n\t): SerializedItemSessionState {\n\t\tconst validateResponses = this.sessionCoordinator.mustValidateResponses(q.identifier);\n\t\tconst endAttempt = (session: ItemSession): SerializedItemSessionState => {\n\t\t\tconst result = session.dispatch({ action: 'endAttempt', validateResponses }).result;\n\t\t\tif (result?.validation && !result.validation.valid) {\n\t\t\t\tthrow new Error(result.validation.issues[0]?.message || `Submit failed: invalid response for item ${q.identifier}`);\n\t\t\t}\n\t\t\treturn result?.sessionState ?? session.serialize();\n\t\t};\n\t\tconst active = this.items[this.currentItemIndex];\n\t\tif (\n\t\t\tactive === q &&\n\t\t\tthis.currentItemSession &&\n\t\t\tthis.currentItemSession.state().lifecycleStatus !== 'suspended'\n\t\t) {\n\t\t\treturn endAttempt(this.currentItemSession);\n\t\t}\n\n\t\tconst session = this.getItemDefinition(q).openSession({\n\t\t\trestore: itemSession,\n\t\t\tresponses: itemSession ? undefined : responses,\n\t\t\tactivate: true,\n\t\t});\n\t\ttry {\n\t\t\treturn endAttempt(session);\n\t\t} finally {\n\t\t\tsession.dispose();\n\t\t}\n\t}\n\n\tprivate getItemDefinition(q: FlatItem): AssessmentItemDefinition {\n\t\tconst cached = this.itemDefinitions.get(q.identifier);\n\t\tif (cached) return cached;\n\n\t\tconst definition = createAssessmentItemDefinition({\n\t\t\titemXml: q.item.itemXml,\n\t\t\t// The assessment host chooses the authorized delivery role. Item refs are\n\t\t\t// content records and must not silently widen or narrow session capabilities.\n\t\t\trole: this.config.role ?? 'candidate',\n\t\t\ti18nProvider: this.i18nProvider,\n\t\t\tpnp: this.config.pnp,\n\t\t\tsecurity: this.config.security,\n\t\t\tpci: this.config.pci,\n\t\t\tplugins: this.config.plugins,\n\t\t\tdeliveryContext: q.item.deliveryContext,\n\t\t});\n\t\tthis.itemDefinitions.set(q.identifier, definition);\n\t\treturn definition;\n\t}\n\n\tprivate mirrorSessionResponses(\n\t\titemIdentifier: string,\n\t\tresponses: Readonly<Record<string, unknown>>,\n\t): boolean {\n\t\tconst current = this.sessionCoordinator.getResponses(itemIdentifier);\n\t\tif (responseValuesEqual(current, responses)) return false;\n\n\t\tconst snapshot = cloneResponseRecord(responses);\n\t\tthis.state.itemResponses[itemIdentifier] = snapshot as any;\n\t\tthis.sessionCoordinator.markAnswered(itemIdentifier, snapshot);\n\t\treturn true;\n\t}\n\n\tprivate attachCurrentItemSession(q: FlatItem, session: ItemSession): void {\n\t\tthis.currentItemSession = session;\n\t\tthis.currentItemSessionUnsubscribe = session.subscribe((transition) => {\n\t\t\tif (this.currentItemSession !== session) return;\n\t\t\tif (this.mirrorSessionResponses(q.identifier, transition.current.responses)) {\n\t\t\t\tthis.notifyResponseChange();\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate releaseCurrentItemSession(): void {\n\t\tthis.currentItemSessionUnsubscribe?.();\n\t\tthis.currentItemSessionUnsubscribe = null;\n\t\tthis.currentItemSession?.dispose();\n\t\tthis.currentItemSession = null;\n\t}\n\n\t/**\n\t * Get the current session state snapshot (client-side view).\n\t * Note: backend remains authoritative; this is intended for simple save/resume.\n\t */\n\tpublic getState(options: { includeItemSessions?: boolean } = {}): AssessmentSessionState {\n\t\tconst snapshot = this.sessionCoordinator.snapshot(options);\n\t\tconst current = this.items[this.currentItemIndex];\n\t\tif (options.includeItemSessions && current && this.currentItemSession) {\n\t\t\t// Navigation snapshots may predate edits made after revisiting this item.\n\t\t\t// Serialize the live authority without suspending the learner's attempt.\n\t\t\tsnapshot.itemSessions = {\n\t\t\t\t...snapshot.itemSessions,\n\t\t\t\t[current.identifier]: this.currentItemSession.serialize(),\n\t\t\t};\n\t\t}\n\t\tconst timing = this.timeManager?.getState();\n\t\tif (timing) {\n\t\t\tsnapshot.timing = {\n\t\t\t\tstartedAt: timing.startedAt,\n\t\t\t\titemTimes: { ...timing.itemTimes },\n\t\t\t\tsectionTimes: { ...timing.sectionTimes },\n\t\t\t\ttestPartTimes: { ...timing.testPartTimes },\n\t\t\t\ttotalTime: timing.totalElapsed,\n\t\t\t\tcurrentItemIdentifier: timing.currentItemId,\n\t\t\t\tcurrentSectionIdentifier: timing.currentSectionId,\n\t\t\t\tcurrentTestPartIdentifier: timing.currentTestPartId,\n\t\t\t\tisPaused: timing.isPaused,\n\t\t\t};\n\t\t}\n\t\treturn snapshot;\n\t}\n\n\t/**\n\t * Restore a previously saved session state.\n\t */\n\tpublic async restoreState(state: AssessmentSessionState): Promise<void> {\n\t\tthis.state = state;\n\t\tthis.restoreTimeTracking(state.timing);\n\n\t\t// Restore visited state for UI navigation hints.\n\t\tconst visitedIdx = (state.visitedItems || [])\n\t\t\t.map((id) => this.items.findIndex((q) => q.identifier === id))\n\t\t\t.filter((i) => i >= 0);\n\t\tthis.navigationManager.restoreState(visitedIdx);\n\n\t\tconst currentId = state.currentItemIdentifier;\n\t\tconst idx = currentId ? this.items.findIndex((q) => q.identifier === currentId) : -1;\n\t\tif (idx >= 0) {\n\t\t\tawait this.navigateTo(idx, { restoring: true });\n\t\t} else if (this.items.length > 0) {\n\t\t\tawait this.navigateTo(0, { restoring: true });\n\t\t}\n\t}\n\n\tprivate restoreTimeTracking(timing: AssessmentSessionState['timing']): void {\n\t\tthis.timeManager?.restoreState({\n\t\t\ttotalElapsed: timing.totalTime,\n\t\t\titemTimes: { ...timing.itemTimes },\n\t\t\tsectionTimes: { ...(timing.sectionTimes ?? {}) },\n\t\t\ttestPartTimes: { ...(timing.testPartTimes ?? {}) },\n\t\t\tstartedAt: timing.startedAt,\n\t\t\tcurrentItemId: timing.currentItemIdentifier,\n\t\t\tcurrentSectionId: timing.currentSectionIdentifier,\n\t\t\tcurrentTestPartId: timing.currentTestPartIdentifier,\n\t\t\tisPaused: timing.isPaused === true,\n\t\t});\n\t}\n\n\tpublic async navigateTo(index: number, options: { restoring?: boolean } = {}): Promise<void> {\n\t\tif (index < 0 || index >= this.items.length) throw new Error(`Invalid item index: ${index}`);\n\n\t\t// Enforce navigation rules (UI hints, still backend-authoritative for real deployments).\n\t\tif (!options.restoring && this.currentItemIndex >= 0 && !this.canNavigateByTestPart(index, this.currentItemIndex)) {\n\t\t\tconst currentMode = this.items[this.currentItemIndex]?.testPart.navigationMode ?? this.assessment.navigationMode;\n\t\t\tif (currentMode === 'linear' && index > this.nextUnlockedIndex(this.currentItemIndex)) {\n\t\t\t\tthrow new Error('In linear navigation mode, you can only move to the next question.');\n\t\t\t}\n\t\t\tthrow new Error('Navigation is not allowed.');\n\t\t}\n\t\tconst target = this.items[index];\n\t\tif (!options.restoring && target && this.isItemLocked(target)) {\n\t\t\tthrow new Error('The time limit for this question has expired.');\n\t\t}\n\t\tif (!options.restoring && target && !this.sessionCoordinator.canReview(target.identifier)) {\n\t\t\tthrow new Error('You cannot go back to previous questions in this assessment.');\n\t\t}\n\n\t\tconst currentItem = this.items[this.currentItemIndex];\n\t\tif (!options.restoring && currentItem && target) {\n\t\t\tthis.assertTransitionMinimum(currentItem, target);\n\t\t\tif (currentItem.testPart !== target.testPart\n\t\t\t\t&& (currentItem.testPart.submissionMode ?? this.assessment.submissionMode) === 'simultaneous') {\n\t\t\t\t// Commit this part before leaving it; a failed request keeps the learner\n\t\t\t\t// in the current part so its remaining answers can be retried.\n\t\t\t\tawait this.submitSimultaneousItems(this.items.filter((q) => q.testPart === currentItem.testPart));\n\t\t\t}\n\t\t}\n\t\tif (!options.restoring && this.currentItemIndex === index && this.currentItemSession) {\n\t\t\treturn;\n\t\t}\n\t\tconst currentSessionStatus = currentItem\n\t\t\t? this.currentItemSession?.state().lifecycleStatus ??\n\t\t\t\tthis.state.itemSessions?.[currentItem.identifier]?.lifecycleStatus\n\t\t\t: undefined;\n\t\tif (\n\t\t\t!options.restoring &&\n\t\t\tthis.currentItemIndex >= 0 &&\n\t\t\tthis.currentItemIndex !== index &&\n\t\t\tcurrentSessionStatus !== 'closed'\n\t\t) {\n\t\t\tthis.saveCurrentItemSession();\n\t\t}\n\t\tif (currentItem && this.currentItemIndex !== index) {\n\t\t\tthis.timeManager?.endItem(currentItem.identifier);\n\t\t}\n\n\t\tthis.currentItemIndex = index;\n\t\tconst q = this.items[index]!;\n\t\tthis.state.currentItemIdentifier = q.identifier;\n\t\tthis.timeManager?.activateScopes({\n\t\t\ttestPart: { identifier: q.testPart.identifier, timeLimits: q.testPart.timeLimits },\n\t\t\tsection: { identifier: q.section.identifier, timeLimits: q.section.timeLimits },\n\t\t\titem: { identifier: q.identifier, timeLimits: q.item.timeLimits },\n\t\t});\n\n\t\t// Restore responses into one live session owned by the assessment. The section\n\t\t// composition and item renderer receive this exact object.\n\t\tconst responses = this.sessionCoordinator.activateItem(q.identifier);\n\t\tconst restoredItemSession = this.state.itemSessions?.[q.identifier];\n\t\tconst control = this.sessionCoordinator.getItemSettings(q.identifier);\n\t\tthis.releaseCurrentItemSession();\n\t\tconst session = this.getItemDefinition(q).openSession({\n\t\t\trestore: restoredItemSession,\n\t\t\tresponses: restoredItemSession ? undefined : responses,\n\t\t\tactivate: true,\n\t\t\ttemplateDefaults: restoredItemSession ? undefined : this.evaluateTemplateDefaults(q),\n\t\t\tpresentation: {\n\t\t\t\t// Feedback during an adaptive item's attempts is part of the item, whatever showFeedback says.\n\t\t\t\tshowFeedback: control.showFeedback === true || isAdaptiveItemXml(q.item.itemXml),\n\t\t\t\tshowSolution: control.showSolution === true,\n\t\t\t},\n\t\t});\n\t\tthis.attachCurrentItemSession(q, session);\n\n\t\tthis.notifyItemChange();\n\t\tthis.notifySectionChange();\n\t\tif (currentItem?.testPart.identifier !== q.testPart.identifier) this.notifyTestFeedbackChange();\n\t}\n\n\tpublic async navigateToSection(sectionId: string): Promise<void> {\n\t\tconst idx = this.items.findIndex((q) => q.section.identifier === sectionId);\n\t\tif (idx >= 0) await this.navigateTo(idx);\n\t}\n\n\tpublic async next(): Promise<void> {\n\t\tconst state = this.getNavigationState();\n\t\tif (!state.canNext) return;\n\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tif (q) {\n\t\t\tconst responses = this.sessionCoordinator.getActiveResponses();\n\t\t\tthis.sessionCoordinator.markAnswered(q.identifier, responses);\n\n\t\t\tconst navAway = this.sessionCoordinator.canNavigateAway(q.identifier, responses);\n\t\t\tif (!navAway.allowed) {\n\t\t\t\tthrow new Error(navAway.reason || 'You must answer this question before continuing.');\n\t\t\t}\n\n\t\t\t// In individual submission mode, submit the current item before moving forward\n\t\t\t// unless its attempts are used up or it is already closed.\n\t\t\tconst lifecycle = this.currentItemSession?.state().lifecycleStatus;\n\t\t\tif (\n\t\t\t\t(q.testPart.submissionMode ?? this.assessment.submissionMode) === 'individual' &&\n\t\t\t\tthis.sessionCoordinator.canSubmit(q.identifier) &&\n\t\t\t\tlifecycle !== 'closed'\n\t\t\t) {\n\t\t\t\tconst before = this.currentItemIndex;\n\t\t\t\tawait this.submitCurrentItem();\n\t\t\t\t// submitCurrentItem may branch/navigate; if it did, we're done.\n\t\t\t\tif (this.currentItemIndex !== before) return;\n\t\t\t}\n\t\t}\n\n\t\tconst nextIndex = this.nextUnlockedIndex(this.currentItemIndex);\n\t\tif (nextIndex < 0) return;\n\t\tawait this.navigateTo(nextIndex);\n\t}\n\n\tpublic async previous(): Promise<void> {\n\t\tconst state = this.getNavigationState();\n\t\tif (!state.canPrevious) return;\n\t\tawait this.navigateTo(this.currentItemIndex - 1);\n\t}\n\n\t/** Submit current item (server-side scoring) */\n\tpublic async submitCurrentItem(): Promise<ItemResult> {\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tif (!q) throw new Error('No current item');\n\t\tthis.assertMinimumTime('item', q);\n\n\t\tconst submittedAt = Date.now();\n\t\tlet itemSession: SerializedItemSessionState | undefined;\n\t\tconst submittedSession = this.currentItemSession;\n\t\tconst preSubmitSession = submittedSession?.serialize();\n\t\tconst responses = this.currentItemSession\n\t\t\t? cloneResponseRecord(this.currentItemSession.state().responses)\n\t\t\t: this.sessionCoordinator.getActiveResponses();\n\t\tlet res: Awaited<ReturnType<BackendAdapter['submitResponses']>>;\n\t\ttry {\n\t\t\tif (submittedSession) {\n\t\t\t\tconst transition = submittedSession.dispatch({\n\t\t\t\t\taction: 'endAttempt',\n\t\t\t\t\tvalidateResponses: this.sessionCoordinator.mustValidateResponses(q.identifier),\n\t\t\t\t});\n\t\t\t\tconst attempt = transition.result;\n\t\t\t\tif (!attempt) throw new Error('Item session did not produce an end-attempt result');\n\t\t\t\tif (attempt.validation && !attempt.validation.valid) {\n\t\t\t\t\tthrow new Error(attempt.validation.issues[0]?.message || 'Submit failed: invalid response');\n\t\t\t\t}\n\t\t\t\titemSession = attempt.sessionState;\n\t\t\t}\n\t\t\tres = await this.backend.submitResponses({\n\t\t\t\tsessionId: this.sessionId,\n\t\t\t\titemIdentifier: q.identifier,\n\t\t\t\tresponses: responses as any,\n\t\t\t\tsubmittedAt,\n\t\t\t\ttimeSpent: itemSession?.duration,\n\t\t\t\ttiming: this.getSubmitTimingEvidence(q, itemSession?.duration ?? 0),\n\t\t\t\titemSession: this.config.sendItemSessionToBackend ? itemSession : undefined,\n\t\t\t\tcomment: this.sessionCoordinator.getItemComment(q.identifier),\n\t\t\t});\n\n\t\t\tif (!res.success || !res.result) {\n\t\t\t\tthrow new Error(res.error || 'Submit failed');\n\t\t\t}\n\t\t} catch (error) {\n\t\t\t// Ending an attempt is a local provisional commit until the backend accepts\n\t\t\t// it. Restore the exact pre-submit lifecycle so a transient failure can be\n\t\t\t// retried without a closed item or a double-counted attempt.\n\t\t\tif (\n\t\t\t\tsubmittedSession &&\n\t\t\t\tpreSubmitSession &&\n\t\t\t\tthis.currentItemSession === submittedSession &&\n\t\t\t\tthis.items[this.currentItemIndex] === q\n\t\t\t) {\n\t\t\t\tthis.releaseCurrentItemSession();\n\t\t\t\tthis.attachCurrentItemSession(\n\t\t\t\t\tq,\n\t\t\t\t\tthis.getItemDefinition(q).openSession({ restore: preSubmitSession }),\n\t\t\t\t);\n\t\t\t\tthis.notifyItemChange();\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (itemSession) {\n\t\t\tthis.sessionCoordinator.setItemSession(q.identifier, itemSession);\n\t\t}\n\n\t\tif (res.updatedState) {\n\t\t\tconst localResponses = cloneData(this.state.itemResponses || {})!;\n\t\t\tlocalResponses[q.identifier] = cloneResponseRecord(responses) as any;\n\t\t\tthis.sessionCoordinator.replaceStatePreservingResponsesAndSessions(\n\t\t\t\tres.updatedState,\n\t\t\t\tlocalResponses,\n\t\t\t\tcloneData(this.state.itemSessions || {})!,\n\t\t\t);\n\t\t} else {\n\t\t\t// Minimal state update when backend doesn't return full state.\n\t\t\tthis.state.itemScores = this.state.itemScores || {};\n\t\t\tthis.state.itemScores[q.identifier] = res.result;\n\t\t\tthis.sessionCoordinator.markVisited(q.identifier);\n\t\t\tthis.state.itemResponses[q.identifier] = responses as any;\n\t\t\tif (itemSession) {\n\t\t\t\tthis.sessionCoordinator.setItemSession(q.identifier, itemSession);\n\t\t\t}\n\t\t}\n\n\t\tthis.setTestOutcomes(res.outcomes);\n\n\t\tconst itemResult: ItemResult = {\n\t\t\titemIdentifier: q.identifier,\n\t\t\tscore: res.result.score,\n\t\t\tmaxScore: res.result.maxScore,\n\t\t\tresponses: { ...responses },\n\t\t};\n\t\tthis.sessionCoordinator.setItemResult(itemResult);\n\n\t\t// Track item session rules (review/attempts) and visited items for navigation hints.\n\t\ttry {\n\t\t\tthis.sessionCoordinator.recordAttempt(q.identifier);\n\t\t} catch {\n\t\t\t// ignore\n\t\t}\n\t\tthis.sessionCoordinator.markAnswered(q.identifier, responses);\n\t\tthis.navigationManager.markVisited(this.currentItemIndex);\n\n\t\t// Apply backend branching decision if provided.\n\t\t// Special QTI targets EXIT_TEST / EXIT_TESTPART / EXIT_SECTION trigger finalization.\n\t\tif (res.nextItemIdentifier) {\n\t\t\tconst special = res.nextItemIdentifier;\n\t\t\tif (special === 'EXIT_TEST') {\n\t\t\t\t// Finalize immediately — no further navigation\n\t\t\t\tfor (const l of this.completeListeners) l();\n\t\t\t\tthis.config.onComplete?.();\n\t\t\t} else if (special === 'EXIT_TESTPART' || special === 'EXIT_SECTION') {\n\t\t\t\t// Advance past all remaining items in the current testPart or section\n\t\t\t\tconst currentItem = this.items[this.currentItemIndex];\n\t\t\t\tconst isSection = special === 'EXIT_SECTION';\n\t\t\t\tconst nextIdx = this.items.findIndex((item, i) =>\n\t\t\t\t\ti > this.currentItemIndex &&\n\t\t\t\t\t(isSection\n\t\t\t\t\t\t? item.section.identifier !== currentItem?.section.identifier\n\t\t\t\t\t\t: item.testPart.identifier !== currentItem?.testPart.identifier)\n\t\t\t\t);\n\t\t\t\tif (nextIdx >= 0) {\n\t\t\t\t\tawait this.navigateTo(nextIdx, { restoring: true });\n\t\t\t\t} else {\n\t\t\t\t\t// No further items — signal completion\n\t\t\t\t\tfor (const l of this.completeListeners) l();\n\t\t\t\t\tthis.config.onComplete?.();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst nextIdx = this.items.findIndex((x) => x.identifier === special);\n\t\t\t\tif (nextIdx >= 0) {\n\t\t\t\t\tawait this.navigateTo(nextIdx, { restoring: true });\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn itemResult;\n\t}\n\n\tprivate canPrevious(): boolean {\n\t\tif (this.currentItemIndex <= 0) return false;\n\t\tconst prev = this.items[this.currentItemIndex - 1];\n\t\tif (!prev || this.isItemLocked(prev)) return false;\n\t\tif (!this.canNavigateByTestPart(this.currentItemIndex - 1, this.currentItemIndex)) return false;\n\t\treturn this.sessionCoordinator.canReview(prev.identifier);\n\t}\n\n\tprivate canNext(): boolean {\n\t\tif (this.currentItemIndex < 0) return false;\n\t\tconst nextIdx = this.nextUnlockedIndex(this.currentItemIndex);\n\t\tif (nextIdx < 0) return false;\n\t\tif (!this.canNavigateByTestPart(nextIdx, this.currentItemIndex)) return false;\n\t\t// Note: itemSessionControl constraints on leaving current item are enforced in next().\n\t\treturn true;\n\t}\n\n\tprivate canNavigateByTestPart(targetIndex: number, currentIndex: number): boolean {\n\t\tif (targetIndex < 0 || targetIndex >= this.items.length) return false;\n\t\tconst current = this.items[currentIndex];\n\t\tconst target = this.items[targetIndex];\n\t\tif (!current || !target) return false;\n\t\t// Items locked by an expired time limit are passed over.\n\t\tconst nextIndex = this.nextUnlockedIndex(currentIndex);\n\t\tif (current.testPart !== target.testPart) {\n\t\t\t// QTI testParts are delivered in sequence. A candidate may enter the next\n\t\t\t// part, but cannot jump across parts or return to a completed part.\n\t\t\treturn targetIndex === nextIndex;\n\t\t}\n\t\tconst mode = current.testPart.navigationMode ?? this.assessment.navigationMode ?? 'nonlinear';\n\t\treturn mode === 'nonlinear' || targetIndex === currentIndex || targetIndex === nextIndex;\n\t}\n\n\tprivate async submitSimultaneousItems(items: readonly FlatItem[]): Promise<void> {\n\t\tif (items.every((q) => this.sessionCoordinator.hasItemResult(q.identifier))) return;\n\t\tconst current = this.items[this.currentItemIndex];\n\t\tconst submittedItem = current && items.includes(current) ? current : undefined;\n\t\tconst preSubmitSession = submittedItem ? this.currentItemSession?.serialize() : undefined;\n\t\tlet allItemSessions: NonNullable<AssessmentSessionState['itemSessions']> = {};\n\n\t\ttry {\n\t\t\t// Suspending the rendered session gives the UI one non-writable state while\n\t\t\t// backend submission is in flight. Detached sessions perform the provisional\n\t\t\t// end-attempt work for every item.\n\t\t\tif (submittedItem) this.saveCurrentItemSession();\n\t\t\t// Preserve client-collected responses across backend state updates.\n\t\t\t// Some backend adapters return an updatedState snapshot that may only include\n\t\t\t// responses for items that have been submitted so far, which would otherwise\n\t\t\t// wipe out responses for later items during this loop.\n\t\t\tconst allItemResponses = cloneData(this.state.itemResponses || {}) as any;\n\t\t\tallItemSessions = cloneData(this.state.itemSessions || {})!;\n\n\t\t\tfor (const q of items) {\n\t\t\t\tif (this.sessionCoordinator.hasItemResult(q.identifier)) continue;\n\t\t\t\tconst submittedAt = Date.now();\n\t\t\t\tconst responsesForItem = (allItemResponses?.[q.identifier] || {}) as any;\n\t\t\t\tconst itemSession = this.endItemSessionForSubmit(\n\t\t\t\t\tq,\n\t\t\t\t\tresponsesForItem,\n\t\t\t\t\tallItemSessions[q.identifier],\n\t\t\t\t);\n\t\t\t\tallItemSessions[q.identifier] = itemSession;\n\t\t\t\tconst res = await this.backend.submitResponses({\n\t\t\t\t\tsessionId: this.sessionId,\n\t\t\t\t\titemIdentifier: q.identifier,\n\t\t\t\t\tresponses: responsesForItem,\n\t\t\t\t\tsubmittedAt,\n\t\t\t\t\ttimeSpent: itemSession.duration,\n\t\t\t\t\ttiming: this.getSubmitTimingEvidence(q, itemSession.duration),\n\t\t\t\t\titemSession: this.config.sendItemSessionToBackend ? itemSession : undefined,\n\t\t\t\t\tcomment: this.sessionCoordinator.getItemComment(q.identifier),\n\t\t\t\t});\n\t\t\t\tif (!res.success || !res.result) {\n\t\t\t\t\tthrow new Error(res.error || `Submit failed for item ${q.identifier}`);\n\t\t\t\t}\n\t\t\t\tif (res.updatedState) {\n\t\t\t\t\tthis.sessionCoordinator.replaceStatePreservingResponsesAndSessions(\n\t\t\t\t\t\tres.updatedState,\n\t\t\t\t\t\tallItemResponses,\n\t\t\t\t\t\tallItemSessions,\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tthis.state.itemScores = this.state.itemScores || {};\n\t\t\t\t\tthis.state.itemScores[q.identifier] = res.result;\n\t\t\t\t\tthis.sessionCoordinator.markVisited(q.identifier);\n\t\t\t\t\tthis.state.itemResponses[q.identifier] = responsesForItem;\n\t\t\t\t\tthis.sessionCoordinator.setItemSession(q.identifier, itemSession);\n\t\t\t\t\tthis.sessionCoordinator.recordAttempt(q.identifier);\n\t\t\t\t}\n\t\t\t\tthis.sessionCoordinator.setItemResult({\n\t\t\t\t\titemIdentifier: q.identifier,\n\t\t\t\t\tscore: res.result.score,\n\t\t\t\t\tmaxScore: res.result.maxScore,\n\t\t\t\t\tresponses: this.state.itemResponses[q.identifier] || {},\n\t\t\t\t});\n\t\t\t\tthis.setTestOutcomes(res.outcomes);\n\t\t\t}\n\n\t\t\t// The attached item must represent the same accepted lifecycle as persistence.\n\t\t\t// Replace the provisional suspended object with one restored from the accepted\n\t\t\t// closed state; no second live state owner remains.\n\t\t\tif (submittedItem && this.items[this.currentItemIndex] === submittedItem) {\n\t\t\t\tconst accepted = allItemSessions[submittedItem.identifier];\n\t\t\t\tif (accepted) {\n\t\t\t\t\tthis.releaseCurrentItemSession();\n\t\t\t\t\tthis.attachCurrentItemSession(\n\t\t\t\t\t\tsubmittedItem,\n\t\t\t\t\t\tthis.getItemDefinition(submittedItem).openSession({ restore: accepted }),\n\t\t\t\t\t);\n\t\t\t\t\tthis.notifyItemChange();\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\t// The backend accepts simultaneous items one request at a time. Keep earlier\n\t\t\t// accepted items committed so retry cannot double-submit them. If the rendered\n\t\t\t// item was not accepted, restore only that item to its exact writable state.\n\t\t\tif (submittedItem && this.items[this.currentItemIndex] === submittedItem) {\n\t\t\t\tconst accepted = this.sessionCoordinator.hasItemResult(submittedItem.identifier)\n\t\t\t\t\t? allItemSessions[submittedItem.identifier]\n\t\t\t\t\t: undefined;\n\t\t\t\tconst restored = accepted ?? preSubmitSession;\n\t\t\t\tif (!accepted && preSubmitSession) {\n\t\t\t\t\tthis.sessionCoordinator.saveItemSession(\n\t\t\t\t\t\tsubmittedItem.identifier,\n\t\t\t\t\t\tcloneResponseRecord(valuesFromItemSession(preSubmitSession)),\n\t\t\t\t\t\tpreSubmitSession,\n\t\t\t\t\t\tpreSubmitSession.duration,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tthis.releaseCurrentItemSession();\n\t\t\t\tif (restored) {\n\t\t\t\t\tthis.attachCurrentItemSession(\n\t\t\t\t\t\tsubmittedItem,\n\t\t\t\t\t\tthis.getItemDefinition(submittedItem).openSession({ restore: restored }),\n\t\t\t\t\t);\n\t\t\t\t\tthis.notifyItemChange();\n\t\t\t\t\tthis.notifyResponseChange();\n\t\t\t\t}\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/** Submit entire assessment (finalize on backend) */\n\tpublic async submit(): Promise<AssessmentResults> {\n\t\tconst current = this.items[this.currentItemIndex];\n\t\tif (current) {\n\t\t\tthis.assertMinimumTime('item', current);\n\t\t\tthis.assertMinimumTime('section', current);\n\t\t\tthis.assertMinimumTime('testPart', current);\n\t\t\tthis.assertMinimumTime('assessment', current);\n\t\t}\n\t\t// Submission modes belong to test parts. The assessment-level field is only\n\t\t// a fallback for older hosts that do not supply a mode on each part.\n\t\tawait this.submitSimultaneousItems(this.items.filter((q) =>\n\t\t\t(q.testPart.submissionMode ?? this.assessment.submissionMode) === 'simultaneous',\n\t\t));\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tif (q && (q.testPart.submissionMode ?? this.assessment.submissionMode) === 'individual'\n\t\t\t&& !this.sessionCoordinator.hasItemResult(q.identifier)) {\n\t\t\tawait this.submitCurrentItem();\n\t\t}\n\n\t\tconst finalized: FinalizeAssessmentResponse = await this.backend.finalizeAssessment({\n\t\t\tsessionId: this.sessionId,\n\t\t});\n\t\tif (!finalized.success) throw new Error('Finalize failed');\n\n\t\t// Map backend itemScores to ItemResult[]\n\t\tconst itemScores = finalized.itemScores || {};\n\t\tconst itemResults: ItemResult[] = Object.values(itemScores).map((r: AssessmentScoringResult) => ({\n\t\t\titemIdentifier: r.itemIdentifier,\n\t\t\tscore: r.score,\n\t\t\tmaxScore: r.maxScore,\n\t\t\tresponses: this.state.itemResponses[r.itemIdentifier] || {},\n\t\t}));\n\n\t\t// Outcome processing has run by the end of the test, so a backend returning no outcomes\n\t\t// leaves them all NULL.\n\t\tthis.finalized = true;\n\t\tthis.legacyFeedback = finalized.feedback;\n\t\tthis.testOutcomes = cloneData(finalized.outcomes ?? this.testOutcomes ?? {})!;\n\t\tthis.notifyTestFeedbackChange();\n\n\t\tthis.notifyComplete();\n\t\tif (this.config.onComplete) this.config.onComplete();\n\n\t\treturn {\n\t\t\ttotalScore: finalized.totalScore,\n\t\t\tmaxScore: finalized.maxScore,\n\t\t\titemResults,\n\t\t\tcompletedAt: new Date(finalized.finalizedAt),\n\t\t};\n\t}\n\n\t// ---------------------------------------------------------------------------\n\t// Session info + time helpers\n\t// ---------------------------------------------------------------------------\n\n\tpublic getItemSessionInfo(_itemIdentifier?: string): {\n\t\tcanSubmit: boolean;\n\t\tremainingAttempts: number | null;\n\t\tattemptCount: number;\n\t\tshowFeedback: boolean;\n\t\tshowSolution: boolean;\n\t\tcanReview: boolean;\n\t\tcanSkip: boolean;\n\t\tcanComment: boolean;\n\t} | null {\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tif (!q) return null;\n\t\tconst id = q.identifier;\n\n\t\treturn this.sessionCoordinator.getItemSessionInfo(id);\n\t}\n\n\t/**\n\t * Records the candidate's comment on an item (QTI `allowComment`), sent with its next submission.\n\t * Defaults to the current item; throws when the item does not allow comments.\n\t */\n\tpublic setItemComment(comment: string, itemIdentifier?: string): void {\n\t\tconst id = itemIdentifier ?? this.items[this.currentItemIndex]?.identifier;\n\t\tif (!id) throw new Error('No current item');\n\t\tthis.sessionCoordinator.setItemComment(id, comment);\n\t}\n\n\tpublic getItemComment(itemIdentifier?: string): string | undefined {\n\t\tconst id = itemIdentifier ?? this.items[this.currentItemIndex]?.identifier;\n\t\treturn id ? this.sessionCoordinator.getItemComment(id) : undefined;\n\t}\n\n\tpublic getRemainingTime(): number {\n\t\t// TimeManager exposes seconds getters.\n\t\treturn this.timeManager?.getRemainingSeconds() ?? 0;\n\t}\n\n\tpublic getElapsedTime(): number {\n\t\treturn this.timeManager?.getElapsedSeconds() ?? 0;\n\t}\n\n\tpublic isTimeExpired(): boolean {\n\t\treturn this.timeManager?.isExpired() ?? false;\n\t}\n\n\t// ---------------------------------------------------------------------------\n\t// Event subscriptions\n\t// ---------------------------------------------------------------------------\n\n\tpublic onItemChange(listener: (index: number, total: number) => void): () => void {\n\t\tthis.itemChangeListeners.add(listener);\n\t\treturn () => this.itemChangeListeners.delete(listener);\n\t}\n\n\tpublic onSectionChange(listener: (index: number, total: number) => void): () => void {\n\t\tthis.sectionChangeListeners.add(listener);\n\t\treturn () => this.sectionChangeListeners.delete(listener);\n\t}\n\n\tpublic onResponseChange(listener: (responses: Record<string, unknown>) => void): () => void {\n\t\tthis.responseChangeListeners.add(listener);\n\t\treturn () => this.responseChangeListeners.delete(listener);\n\t}\n\n\tpublic onComplete(listener: () => void): () => void {\n\t\tthis.completeListeners.add(listener);\n\t\treturn () => this.completeListeners.delete(listener);\n\t}\n\n\t/** Called when `getVisibleFeedback()` may have changed: new outcomes, a new test part, or the end. */\n\tpublic onTestFeedbackChange(listener: () => void): () => void {\n\t\tthis.testFeedbackChangeListeners.add(listener);\n\t\treturn () => this.testFeedbackChangeListeners.delete(listener);\n\t}\n\n\tpublic onTimeWarning(listener: (remainingSeconds: number) => void): () => void {\n\t\tthis.timeWarningListeners.add(listener);\n\t\treturn () => this.timeWarningListeners.delete(listener);\n\t}\n\n\tpublic onTimeExpired(listener: () => void): () => void {\n\t\tthis.timeExpiredListeners.add(listener);\n\t\treturn () => this.timeExpiredListeners.delete(listener);\n\t}\n\n\tpublic onTimeTick(listener: (remainingSeconds: number, elapsedSeconds: number) => void): () => void {\n\t\tthis.timeTickListeners.add(listener);\n\t\treturn () => this.timeTickListeners.delete(listener);\n\t}\n\n\tpublic destroy(): void {\n\t\tthis.timeManager?.destroy();\n\t\tthis.releaseCurrentItemSession();\n\t\tthis.itemDefinitions.clear();\n\t\tthis.itemChangeListeners.clear();\n\t\tthis.sectionChangeListeners.clear();\n\t\tthis.responseChangeListeners.clear();\n\t\tthis.completeListeners.clear();\n\t\tthis.testFeedbackChangeListeners.clear();\n\t\tthis.timeWarningListeners.clear();\n\t\tthis.timeExpiredListeners.clear();\n\t\tthis.timeTickListeners.clear();\n\t}\n\n\t// ---------------------------------------------------------------------------\n\t// Internal notify helpers\n\t// ---------------------------------------------------------------------------\n\n\tprivate notifyItemChange(): void {\n\t\tfor (const l of this.itemChangeListeners) l(this.currentItemIndex, this.items.length);\n\t\tthis.config.onItemChange?.(this.currentItemIndex, this.items.length);\n\t}\n\n\tprivate notifySectionChange(): void {\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tconst sectionIndex = q?.sectionIndex ?? 0;\n\t\tconst totalSections = this.getAllSections().length;\n\t\tfor (const l of this.sectionChangeListeners) l(sectionIndex, totalSections);\n\t\tthis.config.onSectionChange?.(sectionIndex, totalSections);\n\t}\n\n\tprivate notifyResponseChange(): void {\n\t\tconst responses = this.sessionCoordinator.getActiveResponses();\n\t\tfor (const l of this.responseChangeListeners) l(responses);\n\t\tthis.config.onResponseChange?.(responses);\n\t}\n\n\tprivate notifyComplete(): void {\n\t\tfor (const l of this.completeListeners) l();\n\t}\n\n\tprivate notifyTestFeedbackChange(): void {\n\t\tfor (const l of this.testFeedbackChangeListeners) l();\n\t}\n\n\tprivate notifyTimeWarning(remainingSeconds: number): void {\n\t\tfor (const l of this.timeWarningListeners) l(remainingSeconds);\n\t}\n\n\tprivate evaluateTemplateDefaults(q: FlatItem): Record<string, unknown> | undefined {\n\t\tconst defaults = q.item.templateDefaults;\n\t\tif (!defaults?.length) return undefined;\n\t\tconst declarations = testOutcomeDeclarations(this.assessment, this.testOutcomes ?? undefined);\n\t\tconst out: Record<string, unknown> = {};\n\t\tfor (const { templateIdentifier, expressionXml } of defaults) {\n\t\t\tout[templateIdentifier] = plainQtiValue(evaluateTestExpression(expressionXml, declarations, Math.random));\n\t\t}\n\t\treturn out;\n\t}\n\n\tprivate isItemLocked(q: FlatItem): boolean {\n\t\treturn (\n\t\t\tthis.lockedScopes.has(`item:${q.identifier}`) ||\n\t\t\tthis.lockedScopes.has(`testPart:${q.testPart.identifier}`) ||\n\t\t\tq.sections.some((section) => this.lockedScopes.has(`section:${section.identifier}`))\n\t\t);\n\t}\n\n\tprivate nextUnlockedIndex(fromIndex: number): number {\n\t\tfor (let i = fromIndex + 1; i < this.items.length; i++) {\n\t\t\tif (!this.isItemLocked(this.items[i]!)) return i;\n\t\t}\n\t\treturn -1;\n\t}\n\n\t/**\n\t * A test part, section or item without late submission ran out of time: its items close for the\n\t * candidate, and delivery moves to the next item outside it.\n\t */\n\tprivate handleScopeExpired(scope: 'testPart' | 'section' | 'item', identifier: string): void {\n\t\tthis.lockedScopes.add(`${scope}:${identifier}`);\n\t\tconst current = this.items[this.currentItemIndex];\n\t\tif (!current || !this.isItemLocked(current)) return;\n\t\tthis.saveCurrentItemSession();\n\t\tthis.notifyItemChange();\n\t\tconst nextIndex = this.nextUnlockedIndex(this.currentItemIndex);\n\t\tif (nextIndex < 0) {\n\t\t\tthis.notifyTimeExpired();\n\t\t\treturn;\n\t\t}\n\t\tthis.navigateTo(nextIndex, { restoring: true }).catch(() => {});\n\t}\n\n\tprivate notifyTimeExpired(): void {\n\t\tfor (const l of this.timeExpiredListeners) l();\n\t}\n\n\tprivate notifyTimeTick(remainingSeconds: number, elapsedSeconds: number): void {\n\t\tfor (const l of this.timeTickListeners) l(remainingSeconds, elapsedSeconds);\n\t}\n\n\t/**\n\t * Get the i18n provider instance\n\t * @returns I18nProvider instance\n\t */\n\tpublic getI18nProvider(): I18nProvider {\n\t\treturn this.i18nProvider;\n\t}\n\n\t/**\n\t * The provider used when the host passes none: English, from the catalog\n\t * `@pie-qti/i18n` bundles eagerly.\n\t */\n\tprivate createDefaultI18nProvider(): I18nProvider {\n\t\treturn new DefaultI18nProvider('en-US');\n\t}\n}\n\nfunction cloneData<T>(value: T | undefined): T | undefined {\n\treturn value === undefined ? undefined : structuredClone(value);\n}\n\nfunction cloneResponseRecord(\n\tresponses: Readonly<Record<string, unknown>>,\n): Record<string, unknown> {\n\treturn structuredClone(responses) as Record<string, unknown>;\n}\n\nfunction valuesFromItemSession(\n\tstate: SerializedItemSessionState,\n): Record<string, unknown> {\n\treturn Object.fromEntries(\n\t\tObject.entries(state.responseVariables).map(([identifier, variable]) => [\n\t\t\tidentifier,\n\t\t\tcloneData(variable.value),\n\t\t]),\n\t);\n}\n\nfunction responseValuesEqual(left: unknown, right: unknown): boolean {\n\tif (Object.is(left, right)) return true;\n\tif (Array.isArray(left) || Array.isArray(right)) {\n\t\tif (!Array.isArray(left) || !Array.isArray(right) || left.length !== right.length) return false;\n\t\treturn left.every((value, index) => responseValuesEqual(value, right[index]));\n\t}\n\tif (!isRecord(left) || !isRecord(right)) return false;\n\n\tconst leftKeys = Object.keys(left);\n\tconst rightKeys = Object.keys(right);\n\tif (leftKeys.length !== rightKeys.length) return false;\n\tconst rightKeySet = new Set(rightKeys);\n\treturn leftKeys.every(\n\t\t(key) => rightKeySet.has(key) && responseValuesEqual(left[key], right[key]),\n\t);\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn value !== null && typeof value === 'object';\n}\n\nfunction isWritableItemLifecycle(lifecycleStatus: SerializedItemSessionState['lifecycleStatus']): boolean {\n\treturn lifecycleStatus === 'initial' || lifecycleStatus === 'interacting';\n}\n"]}
1
+ {"version":3,"file":"AssessmentPlayer.js","sourceRoot":"","sources":["../../src/core/AssessmentPlayer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACN,8BAA8B,GAU9B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,mBAAmB,EAAqB,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAkC1D,OAAO,EAAE,4BAA4B,EAA8C,MAAM,mCAAmC,CAAC;AAE7H,OAAO,EAAE,qBAAqB,EAAkC,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAC7G,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EACN,2BAA2B,EAC3B,qBAAqB,EAGrB,yBAAyB,EAEzB,iBAAiB,EACjB,iBAAiB,EAEjB,kBAAkB,EAElB,0BAA0B,EAC1B,yBAAyB,EAEzB,uBAAuB,GACvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EACN,gBAAgB,EAChB,SAAS,EACT,mBAAmB,EACnB,iBAAiB,EACjB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAiC,MAAM,mBAAmB,CAAC;AACrF,OAAO,E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AEO,iBAAiB,CAAC,KAAgC;QACzD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAEO,sBAAsB,CAC7B,KAAoC,EACpC,UAAkB,EAClB,iBAA0B,EAC1B,SAAkB;QAElB,MAAM,KAAK,GAAyB;YACnC,KAAK;YACL,UAAU;YACV,iBAAiB;YACjB,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC;SACjD,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;IAEO,cAAc,CAAC,gBAAwB,EAAE,cAAsB;QACtE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,gBAAgB,EAAE,cAAc,CAAC,CAAC;IAChE,CAAC;IAED;;;OAGG;IACI,eAAe;QACrB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACK,yBAAyB;QAChC,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;CACD","sourcesContent":["/**\n * AssessmentPlayer (backend-authoritative)\n *\n * Client responsibilities:\n * - Render items using @pie-qti/item-player\n * - Collect candidate responses\n * - Submit responses to BackendAdapter\n * - Apply backend navigation decisions + session state\n */\n\nimport {\n\tcreateAssessmentItemDefinition,\n\ttype AssessmentItemDefinition,\n\ttype AssessmentItemDefinitionPlugin,\n\ttype ItemSession,\n\ttype ItemSessionTransition,\n\ttype PciConfiguration,\n\ttype PnpProfile,\n\ttype PlayerSecurityConfig,\n\ttype QTIRole,\n\ttype SerializedItemSessionState,\n} from '@pie-qti/item-player';\nimport { DefaultI18nProvider, type I18nProvider } from '@pie-qti/i18n';\nimport { isShownByIdentifier } from '@pie-qti/qti-common';\nimport type { DeclarationMap, QtiValue, StringComparisonOptions } from '@pie-qti/qti-processing';\nimport type { QtiSectionRuntimeHostContract, QtiSectionToolConfig } from '@pie-qti/section-player';\nimport type {\n\tAssessmentRubricBlock,\n\tAssessmentSessionState,\n\tAssessmentScoringResult,\n\tBackendAdapter,\n\tFinalizeAssessmentResponse,\n\tInitSessionRequest,\n\tInitSessionResponse,\n\tOutcomeProcessingError,\n\tSecureAssessment,\n\tSecureItemRef,\n\tSecureSection,\n\tSecureTestPart,\n\tSessionId,\n\tSubmitTimingEvidence,\n\tTestFeedbackItem,\n\tTestOutcomeValues,\n} from '../integration/api-contract.js';\nimport type {\n\tAssessmentEndReason,\n\tAssessmentResults,\n\tCandidateSectionView,\n\tCheckAnswerState,\n\tItemFeedbackEntry,\n\tItemFeedbackView,\n\tItemResult,\n\tNavigationState,\n\tResultsSummary,\n\tTimeLimits,\n\tVisibleTestFeedback,\n} from '../types/index.js';\nimport { AssessmentSessionCoordinator, isSkippedResponseSet, type ResponseDefault } from './AssessmentSessionCoordinator.js';\nimport { AutosaveManager, type AutosaveState } from './AutosaveManager.js';\nimport { AssessmentPlayerError, type AssessmentPlayerErrorCode, isAssessmentPlayerError } from './errors.js';\nimport { attemptFeedbackVisible, resolveMaxAttempts } from './feedback.js';\nimport { NavigationManager } from './NavigationManager.js';\nimport {\n\taddItemVariableDeclarations,\n\tapplyVariableMappings,\n\ttype DeliveredItem,\n\tdeliveredItems,\n\tendAttemptInteractionInfo,\n\tevaluateTestExpression,\n\tfirstEligibleItem,\n\tisAdaptiveItemXml,\n\titemSessionVariableValues,\n\tnextItemIdentifier,\n\tplainQtiValue,\n\trecordedItemVariableValues,\n\tresolveItemSessionControl,\n\tsectionComponents,\n\ttestOutcomeDeclarations,\n} from './testStructure.js';\nimport { extendTimeLimit, TimeManager } from './TimeManager.js';\nimport {\n\tasResponseValues,\n\tcloneData,\n\tcloneResponseRecord,\n\tclosedItemSession,\n\tisWritableItemLifecycle,\n\tresponseDefaultsOf,\n\tresponseValuesEqual,\n\tvaluesFromItemSession,\n} from './sessionRecords.js';\nimport { TypedEventEmitter, type AssessmentPlayerEventMap } from './playerEvents.js';\nimport {\n\tflattenItems,\n\tpartOrderOf,\n\tpresentedSectionOf,\n\tpresentedSections,\n\ttype CurrentItemView,\n\ttype FlatItem,\n\ttype PresentationPolicy,\n\ttype SectionItemRefView,\n} from './deliveryStructure.js';\nimport {\n\tScopeLocks,\n\tisItemLocked,\n\tlockingScopeOf,\n\tscopeKey,\n\tscopeLimitRanOut,\n\ttype TimeScope,\n} from './scopeLocks.js';\nimport { canNavigateByTestPart, isLegalSectionTarget } from './navigationPolicy.js';\nimport {\n\tbranchExitLeavesPart,\n\tbranchLandingOf,\n\tbranchTargetIndex,\n\tendedEnclosingSection,\n\tresolveExitBoundary,\n} from './exitBoundaries.js';\nimport {\n\tsubmissionBlockerFor,\n\tsubmissionGate as submissionGatePolicy,\n\tthrowForBlockers,\n\ttype SubmissionBlocker,\n} from './submissionPolicy.js';\nimport { ReviewInfoCache, resultsSummaryOf, reviewItemRow } from './reviewViews.js';\nimport {\n\tassertMinTimeElapsed,\n\teffectiveItemTimeLimits,\n\tsubmitTimingEvidence,\n\ttype EffectiveItemTimeLimits,\n} from './timePolicy.js';\nimport { templateDefaultsFor } from './templateDefaults.js';\nimport { PauseController } from './pause.js';\nimport { createSessionAutosave } from './autosave.js';\nimport {\n\tinteractionRequirementFromXml,\n\tinteractionResponseIdentifiers,\n\titemAnswerStatus,\n\titemTitleFromXml,\n\ttype ForwardTransitionInfo,\n\ttype ItemAnswerStatus,\n\ttype ReviewItemView,\n} from './reviewState.js';\n\nexport interface BackendAssessmentPlayerConfig {\n\tbackend: BackendAdapter;\n\tinitSession: InitSessionRequest;\n\trole?: QTIRole;\n\t/** Definition-lifetime extractor and renderer extensions applied to every item. */\n\tplugins?: readonly AssessmentItemDefinitionPlugin[];\n\t/**\n\t * Shared catalog files the package manifest lists (resource type\n\t * `imsqti_catalog_xmlv3p0`), read by the host that loaded the package. When the\n\t * reference backend parses the assessment test they become package-scope\n\t * catalog sources beneath item-level catalogs (QTI 3.0 §6.3).\n\t */\n\tsharedCatalogs?: ReadonlyArray<{ href?: string; xml?: string }>;\n\t/**\n\t * Optional i18n provider for internationalization.\n\t * If provided, this will be shared across all item players in the assessment.\n\t */\n\ti18nProvider?: I18nProvider;\n\t/**\n\t * Security configuration for URL policy and content restrictions.\n\t * If provided, this will be passed to all item players in the assessment.\n\t */\n\tsecurity?: PlayerSecurityConfig;\n\t/**\n\t * Explicit host trust configuration for Portable Custom Interaction modules.\n\t * Without this resolver, authored PCI code remains disabled.\n\t */\n\tpci?: PciConfiguration;\n\t/**\n\t * String comparison folds beyond QTI's equality for the candidates' input, applied by every\n\t * item session the player opens (see the item player's\n\t * `AssessmentItemDefinitionConfig.stringComparison`). Exact when absent. Give the scoring\n\t * backend the same setting: it re-runs response processing on submitted items.\n\t */\n\tstringComparison?: StringComparisonOptions;\n\t/**\n\t * Optional host hooks for delegated section rendering.\n\t * Used for section shared-content URL policy and runtime callbacks.\n\t */\n\tsectionHost?: QtiSectionRuntimeHostContract;\n\t/** Optional section-scoped tools rendered by delegated section players. */\n\tsectionTools?: QtiSectionToolConfig[];\n\t/** Optional tools rendered in passage/rubric headers. */\n\tpassageTools?: QtiSectionToolConfig[];\n\t/** Optional tools rendered in item headers. */\n\titemTools?: QtiSectionToolConfig[];\n\t/**\n\t * Include the rich serialized item session (`SubmitResponsesRequest.itemSession`) in\n\t * submissions. Off by default for production backends: template variables can contain\n\t * answer keys, and such a backend should own that state server-side. A backend that\n\t * scores from the item session declares `requiresItemSession` (the reference adapter —\n\t * reference/preview mode — does) and always receives it, whatever this says.\n\t */\n\tsendItemSessionToBackend?: boolean;\n\t// Shell-presentation options. The headless core never reads these: the bundled\n\t// AssessmentShell does, and it is their single defaulting site (absent means\n\t// shown/enabled). Hosts rendering their own chrome decide for themselves.\n\t/** Show the section menu in the shell header. Default shown; `false` hides it. */\n\tshowSections?: boolean;\n\t/** Let the candidate jump between sections from the shell's section menu. Default allowed; `false` disables the entries. */\n\tallowSectionNavigation?: boolean;\n\t/** Show the position/progress indicator in the shell's navigation bar. Default shown; `false` hides it. */\n\tshowProgress?: boolean;\n\t// Time management\n\t/**\n\t * Seconds before a limit expires at which a warning fires. Default 60 when unset;\n\t * `0` turns this default warning off (`timeWarningThresholds` still fire).\n\t */\n\ttimeWarningThreshold?: number;\n\t/**\n\t * Additional warning thresholds in seconds (for example `[300, 60]` for 5-minute\n\t * and 1-minute warnings). Each fires once per limiting scope.\n\t */\n\ttimeWarningThresholds?: number[];\n\t/**\n\t * Opt-in begin gate. When true the player is created without entering an item and\n\t * every clock stays stopped until `start()` (the shell's Begin button); hosts that\n\t * leave it unset keep starting delivery and the clocks at session creation.\n\t */\n\tbeginGate?: boolean;\n\t/**\n\t * Debounced autosave of the session snapshot through `BackendAdapter.saveState`\n\t * after candidate activity (responses, navigation, flags, timer visibility, pause),\n\t * and an immediate best-effort save via `flushAutosave()`. Default ON when the\n\t * backend reports the save capability (`canSaveState` is not false); set `false`\n\t * when the host persists state itself. Failures are non-fatal and surface through\n\t * `onAutosaveChange` (`failed`) and `onAutosaveFailed`.\n\t */\n\tautosave?: boolean;\n\t/** Autosave debounce window in ms. Default 1500. */\n\tautosaveIntervalMs?: number;\n\t/** Save-indicator state changes: `idle`, `pending`, `saving`, `saved`, `failed`. */\n\tonAutosaveChange?: (state: AutosaveState) => void;\n\t/** A debounced or flushed autosave failed; the draft retries on the next change. */\n\tonAutosaveFailed?: (error: Error) => void;\n\t/**\n\t * Deterministic clock for time-limit tracking. Defaults to Date.now; intended for\n\t * tests and hosts that drive delivery from their own timeline.\n\t */\n\tnow?: () => number;\n\t/**\n\t * QTI 3.0 §6.2 Personal Needs and Preferences profile.\n\t * Extended time (pnp.content.extendedTime) is applied to assessment timeLimits.\n\t * The full profile is passed down to each item player for component-level features\n\t * (color scheme, elimination tool).\n\t */\n\tpnp?: PnpProfile;\n\t// Callbacks\n\tonItemChange?: (itemIndex: number, totalItems: number) => void;\n\tonSectionChange?: (sectionIndex: number, totalSections: number) => void;\n\tonResponseChange?: (responses: Record<string, unknown>) => void;\n\t/**\n\t * The test ended in this delivery (every ending: a candidate submit, a proctor's\n\t * force-submit, a QTI EXIT_TEST branch, a whole-test expiry), with its results.\n\t */\n\tonComplete?: (results: AssessmentResults) => void;\n\t/**\n\t * A hard time limit ran out with no late submission: the whole test (the core then\n\t * finalizes automatically), or a scope whose expiry leaves nothing unlocked.\n\t */\n\tonTimeExpired?: (event: AssessmentTimeExpiryEvent) => void;\n\t/** A test part, section or item limit expired; its items are now closed. */\n\tonScopeTimeExpired?: (event: ScopeTimeExpiryEvent) => void;\n\t/**\n\t * A proctor pause started (`paused` true, with its reason) or ended. A session\n\t * restored paused reports its pause here once, right after creation.\n\t */\n\tonPauseChange?: (paused: boolean, reason?: string) => void;\n\t/**\n\t * The session reached its terminal state: finalized in this delivery\n\t * (`restored: false`) or restored already finalized (`restored: true`).\n\t */\n\tonFinalized?: (event: AssessmentFinalizedEvent) => void;\n\t/**\n\t * Host hook for core and backend failures. Reach policy:\n\t *\n\t * - Core- and backend-reported failures reach it as they happen: a failed item entry\n\t * (the first item, an expiry hop), test-level outcome-processing and item-scoring\n\t * failures, an unevaluable branch rule or preCondition (`testConditionFailed`), a\n\t * failed automatic finalization at a time expiry, autosave rejections.\n\t * - Candidate-initiated hard backend failures (`submitFailed`, `finalizeFailed`) reach\n\t * it too: the core throws them for the candidate flow, and the built-in shell\n\t * (AssessmentShell) additionally calls this hook at those sites, so a host that\n\t * only listens here still hears about a submission the backend refused.\n\t * - Validation refusals stay inline-only: the coded warnings that name questions\n\t * still needing an answer (`finalizeResponseRequired` &c.) and `attemptValidationFailed`\n\t * are candidate-facing state, not failures — they never reach this hook.\n\t *\n\t * Errors are `AssessmentPlayerError` instances carrying a stable `code` for\n\t * localization; `message` keeps the raw detail (including backend error text) for\n\t * logs — never show it to candidates.\n\t */\n\tonError?: (error: Error) => void;\n}\n\n/** What a shell's start screen shows before delivery begins (opt-in begin gate). */\nexport interface AssessmentStartInfo {\n\t/** The assessmentTest title; shells fall back to a localized generic title. */\n\ttitle?: string;\n\t/**\n\t * Seconds the candidate has for the whole test, PNP extended time applied (what\n\t * remains of it for a resumed session); undefined when the test has no maximum.\n\t */\n\ttestTimeLimitSeconds?: number;\n\t/** Whether any test part, section or item adds its own maximum. */\n\thasScopedTimeLimits: boolean;\n\t/** The first test part's rubric blocks (candidate instructions); role-filter before display. */\n\trubricBlocks: import('../integration/api-contract.js').AssessmentRubricBlock[];\n\t/** Delivered item count. */\n\ttotalItems: number;\n\t/** True when the session carries prior activity (a resume). */\n\tresuming: boolean;\n\t/**\n\t * When the restored draft was last saved (client clock), for the resume prompt\n\t * (\"You have answers saved from {time}\"); undefined for a fresh session.\n\t */\n\tsavedAt?: number;\n}\n\n/**\n * Fired through `onTimeExpired` (and the element's `time-expired` event) when a hard\n * time limit runs out with no late submission: the whole-test limit, or a scope whose\n * expiry leaves no unlocked item.\n */\nexport interface AssessmentTimeExpiryEvent {\n\t/** The scope whose hard limit expired; `assessment` is the whole test. */\n\tscope: 'assessment' | 'testPart' | 'section' | 'item';\n\t/** The expired scope's identifier; undefined for the assessment scope. */\n\tidentifier?: string;\n\t/** True when the core already ran the automatic finalization for a whole-test expiry. */\n\tautoFinalized: boolean;\n\t/** True when the candidate must submit now (auto-finalize failed, or nothing unlocked remains). */\n\tsubmissionRequired: boolean;\n}\n\n/** Fired through `onScopeTimeExpired` when a test part, section or item limit expires. */\nexport interface ScopeTimeExpiryEvent {\n\tscope: 'testPart' | 'section' | 'item';\n\tidentifier: string;\n\t/** True when delivery moved on to an open item; false when nothing open remains (a dead end). */\n\tdeliveryContinues: boolean;\n\t/**\n\t * The flat index of the open item delivery moves to (forward in the part, an open\n\t * question earlier in a nonlinear part, or the next part). Absent when the candidate\n\t * was outside the expired scope and stays where they are, and at a dead end.\n\t */\n\tnextIndex?: number;\n}\n\n/** Fired through `onFinalized` once the session is terminal. */\nexport interface AssessmentFinalizedEvent {\n\t/** True for a session the backend restored already finalized; false for a finalization in this delivery. */\n\trestored: boolean;\n\tresults: AssessmentResults;\n\t/**\n\t * Why the test ended, for a finalization in this delivery: a candidate submit, a time\n\t * expiry, a proctor's forced submit, or a QTI branch rule (`EXIT_TEST` and friends).\n\t * Absent for a session restored already finalized (this delivery did not end it).\n\t */\n\tendReason?: AssessmentEndReason;\n}\n\nexport type { AssessmentEndReason };\nexport type { EffectiveItemTimeLimits } from './timePolicy.js';\n\n/**\n * An item a candidate-initiated end of the test would refuse to submit\n * (`getSubmissionBlockers()`): QTI `allowSkipping=false` with no response (`required`),\n * or `validateResponses=true` with responses that do not satisfy the interactions\n * (`invalid`). Both apply only to items in individual submission parts.\n * Defined in `submissionPolicy.ts` with the gate that produces it.\n */\nexport type { SubmissionBlocker } from './submissionPolicy.js';\n\n/** What a shell's countdown shows for the active scope right now. */\nexport interface AssessmentTimeState {\n\t/** Whether any active scope carries a hard maximum (false: nothing to count down). */\n\tlimited: boolean;\n\t/** Seconds left on the nearest active maximum; null when nothing is limited. */\n\tremainingSeconds: number | null;\n\telapsedSeconds: number;\n\t/** Whether the nearest active maximum has run out. */\n\texpired: boolean;\n\t/** The scope the displayed limit was authored on. */\n\tscope: 'assessment' | 'testPart' | 'section' | 'item' | null;\n\t/** Whether the displayed limit allows working past its expiry. */\n\tallowLateSubmission: boolean;\n\t/** Whether a proctor pause currently freezes every clock. */\n\tpaused: boolean;\n\t/** Whether delivery has begun (false while a begin gate holds the start screen). */\n\tstarted: boolean;\n}\n\nexport class AssessmentPlayer {\n\tpublic static async create(config: BackendAssessmentPlayerConfig): Promise<AssessmentPlayer> {\n\t\tconst init = await config.backend.initSession(config.initSession);\n\t\tconst player = new AssessmentPlayer(config, init);\n\t\t// Restored terminal and paused states set no listener off during construction:\n\t\t// the host hooks hear them once here, so an embedding (the element's\n\t\t// `session-finalized` / `player-pause` events) never misses them.\n\t\tif (player.finalized && player.finalResults) {\n\t\t\tconfig.onFinalized?.({ restored: true, results: player.finalResults });\n\t\t} else if (player.paused) {\n\t\t\tconfig.onPauseChange?.(true, player.pauseReason);\n\t\t}\n\t\treturn player;\n\t}\n\n\tprivate backend: BackendAdapter;\n\tprivate sessionId: SessionId;\n\tprivate assessment: SecureAssessment;\n\tprivate i18nProvider: I18nProvider;\n\n\tprivate navigationManager: NavigationManager;\n\tprivate sessionCoordinator!: AssessmentSessionCoordinator;\n\tprivate timeManager: TimeManager | null = null;\n\n\tprivate items: FlatItem[] = [];\n\tprivate currentItemIndex = -1;\n\tprivate readonly itemDefinitions = new Map<string, AssessmentItemDefinition>();\n\t/** endAttemptInteraction bindings per item: response identifier → countAttempt. */\n\tprivate readonly endAttemptResponses = new Map<string, Map<string, boolean>>();\n\tprivate currentItemSession: ItemSession | null = null;\n\tprivate currentItemSessionUnsubscribe: (() => void) | null = null;\n\t/** Test-level outcomes from the last outcome processing; null until it first runs. */\n\tprivate testOutcomes: TestOutcomeValues | null = null;\n\tprivate finalized = false;\n\t/** Set by destroy(); a scheduled end-attempt submission after teardown is dropped. */\n\tprivate destroyed = false;\n\t/** Results produced by the finalization; returned when submit() is called again after the end. */\n\tprivate finalResults: AssessmentResults | null = null;\n\t/** Scopes whose time limit expired without late submission, keyed `scope:identifier`. */\n\tprivate readonly scopeLocks = new ScopeLocks();\n\t/**\n\t * Navigation serialization: exactly one navigation or submission transition may run at\n\t * a time. While set, further navigation and submit calls are rejected as busy.\n\t */\n\tprivate transitionInFlight = false;\n\t/**\n\t * Scope-expiry hops waiting for the transition in flight to settle (the timer fired\n\t * while it ran). The transition checks this to leave the move to the hop, the way it\n\t * previously detected the move an unlocked hop had already made mid-flight.\n\t */\n\tprivate queuedExpiryHops = 0;\n\t/** Last reported test-level outcome-processing failure, so hosts hear about each new one once. */\n\tprivate reportedOutcomeProcessingError: OutcomeProcessingError | null = null;\n\t/**\n\t * Test-scope branch rules and preConditions already reported as unevaluable, keyed by\n\t * condition XML + failure message: the rules re-evaluate on every forward step, and the\n\t * host must hear about each distinct failed rule once, not on every step.\n\t */\n\tprivate reportedTestConditionFailures = new Set<string>();\n\t/** Item scoring failures already reported, keyed by item identifier + failure message. */\n\tprivate reportedItemScoringErrors = new Set<string>();\n\t/** False while an opt-in begin gate holds delivery: no item is entered and no clock runs. */\n\tprivate started = true;\n\t/** A proctor pause: every clock is frozen and candidate actions are rejected. */\n\tprivate readonly pauseControl: PauseController;\n\t/** The whole-test hard limit expired (no late submission); delivery collects and ends. */\n\tprivate assessmentExpired = false;\n\t/** The live attempt was suspended by a pause; resume() reopens it from its pause snapshot. */\n\tprivate suspendedForPause = false;\n\t/** Debounced draft persistence through `saveState` (autosave); null when disabled. */\n\tprivate autosave: AutosaveManager | null = null;\n\t/** True while the session carries a backend-restored snapshot (a resume). */\n\tprivate restoredFromSnapshot = false;\n\t/** `timing.savedAt` of the restored snapshot, shown on the resume prompt. */\n\tprivate restoredSavedAt: number | undefined;\n\t/**\n\t * Item feedback the most recent item-level submission produced (item modal feedback\n\t * from the session's response processing, else the backend's `result.feedback`).\n\t * Shells show it after a check-answer or a submit-on-move; it clears on the next\n\t * submission or when the shell dismisses it.\n\t */\n\tprivate lastItemFeedback: ItemFeedbackView | null = null;\n\t/**\n\t * The responses each item's last counted submission carried. Moving on from an item\n\t * that already has a recorded result (a practice check) re-submits only when the\n\t * candidate changed something: an unchanged response does not spend another attempt.\n\t */\n\tprivate readonly lastSubmittedResponses = new Map<string, Record<string, unknown>>();\n\t/**\n\t * Template defaults of nonlinear test parts, evaluated once at part entry for every\n\t * item ref (QTI): test part identifier → item identifier → defaults.\n\t */\n\tprivate readonly templateDefaultsByPart = new Map<string, Map<string, Record<string, unknown> | undefined>>();\n\t/** The presentation policy the live session was opened with (null: the item-player default). */\n\tprivate liveSessionPresentation: PresentationPolicy | null = null;\n\t/** Set during a proctor force-submit: submissions carry `submissionReason: 'proctor'`. */\n\tprivate administrativeReason: 'proctor' | null = null;\n\t/**\n\t * Items the running end of the test collects although their QTI skipping/validation\n\t * control would refuse them, because the candidate can no longer reach them (their\n\t * test part was left): they go out as they stand, `submissionReason: 'unreachable'`.\n\t */\n\tprivate unreachableCollection = new Set<string>();\n\t/** Why the running (or finished) end of the test happens; the first caller decides. */\n\tprivate endReason: AssessmentEndReason | null = null;\n\t/**\n\t * Scopes that expired while an end of the test ran: they closed at once, but delivery\n\t * leaves them only if that end does not finalize (the end of the test never navigates).\n\t */\n\tprivate readonly expiriesDuringEnd: Array<{ scope: 'testPart' | 'section' | 'item'; identifier: string }> = [];\n\t/** The delivered items as the delivery rules walk them (index-aligned with `items`). */\n\tprivate deliveredForRules: DeliveredItem[] = [];\n\t/** Flat index per item identifier. */\n\tprivate readonly indexByIdentifier = new Map<string, number>();\n\t/**\n\t * Whether the test carries branch rules or preconditions at all; without them the next item\n\t * is always the adjacent open one, and no rule is evaluated.\n\t */\n\tprivate hasDeliveryRules = false;\n\t/** Set while the end of the test persists its final snapshot: every item session in it is closed. */\n\tprivate snapshotsCloseItemSessions = false;\n\t/** Rejections for transitions queued behind a transition (`runWhenIdle`), settled on destroy(). */\n\tprivate readonly queuedIdleTransitions = new Set<(error: Error) => void>();\n\t/** A restored whole-test expiry's automatic finalize is scheduled (or ran). */\n\tprivate restoredExpiryFinalizeScheduled = false;\n\n\t// Event listeners (typed emitter; the host-config callbacks stay in the notify helpers)\n\tprivate readonly events = new TypedEventEmitter<AssessmentPlayerEventMap>();\n\t/** Item XML–derived review facts (interaction response ids, item title) per item identifier. */\n\tprivate reviewInfoCache: ReviewInfoCache;\n\t/** Declared response default values per item (QTI: a response equal to its default is no response). */\n\tprivate readonly responseDefaultsCache = new Map<string, Record<string, unknown>>();\n\n\tprivate constructor(private config: BackendAssessmentPlayerConfig, init: InitSessionResponse) {\n\t\tthis.pauseControl = new PauseController({\n\t\t\tisBusy: () => this.transitionInFlight,\n\t\t\tonTransitionActivity: (listener) => this.onBusyChange(listener),\n\t\t\tfreeze: () => {\n\t\t\t\tthis.timeManager?.pause();\n\t\t\t\tthis.suspendLiveSessionForPause();\n\t\t\t},\n\t\t\tunfreeze: () => {\n\t\t\t\tthis.timeManager?.resume();\n\t\t\t\tthis.reopenLiveSessionAfterPause();\n\t\t\t},\n\t\t\tunfreezeAllowed: () => this.started && !this.finalized,\n\t\t\tchanged: () => this.notifyPauseChange(),\n\t\t\tafterResume: () => this.finalizeRestoredExpiryWhenRunning(),\n\t\t\tisDestroyed: () => this.destroyed,\n\t\t});\n\t\tthis.backend = config.backend;\n\t\tthis.sessionId = init.sessionId;\n\t\tthis.assessment = init.assessment;\n\t\tthis.testOutcomes = init.outcomes ? cloneData(init.outcomes)! : null;\n\t\tthis.i18nProvider = config.i18nProvider ?? this.createDefaultI18nProvider();\n\t\tconst initialState =\n\t\t\tinit.restoredState ??\n\t\t\t({\n\t\t\t\tcurrentItemIdentifier: init.currentItemIdentifier ?? '',\n\t\t\t\tvisitedItems: [],\n\t\t\t\titemResponses: {},\n\t\t\t\titemScores: {},\n\t\t\t\titemSessions: {},\n\t\t\t\ttiming: { startedAt: Date.now(), itemTimes: {}, totalTime: 0 },\n\t\t\t} as AssessmentSessionState);\n\n\t\tthis.items = flattenItems(this.assessment);\n\t\tthis.deliveredForRules = this.items.map(({ item, testPart, sections }) => ({ item, testPart, sections }));\n\t\tfor (const q of this.items) this.indexByIdentifier.set(q.identifier, q.index);\n\t\tthis.reviewInfoCache = new ReviewInfoCache(this.items);\n\t\tconst ruled = (holder: { preConditions?: string[]; branchRule?: unknown[] }) =>\n\t\t\t(holder.preConditions?.length ?? 0) > 0 || (holder.branchRule?.length ?? 0) > 0;\n\t\tthis.hasDeliveryRules = this.items.some(\n\t\t\t(q) => ruled(q.item) || ruled(q.testPart) || q.sections.some((section) => ruled(section)),\n\t\t);\n\n\t\tthis.navigationManager = new NavigationManager();\n\t\t// Visited marks ride the snapshot: a resumed session keeps them, not only a\n\t\t// host-driven restoreState().\n\t\tthis.navigationManager.restoreState(this.visitedIndexes(initialState.visitedItems));\n\n\t\t// Item session control is a UI hint; backend remains authoritative.\n\t\tthis.sessionCoordinator = new AssessmentSessionCoordinator({\n\t\t\tstate: initialState,\n\t\t\titemIdentifiers: this.items.map((q) => q.identifier),\n\t\t\titemSessionControlByItem: Object.fromEntries(\n\t\t\t\tthis.items.map((q) => [q.identifier, resolveItemSessionControl(q.testPart, q.sections, q.item)]),\n\t\t\t),\n\t\t});\n\t\t// A resumed session's snapshot carries the test outcomes its submissions produced:\n\t\t// the delivery rules read them, so the restored session navigates like the live one.\n\t\tif (initialState.testOutcomes) {\n\t\t\tthis.testOutcomes = cloneData(initialState.testOutcomes)!;\n\t\t} else if (init.outcomes) {\n\t\t\tthis.sessionCoordinator.setTestOutcomes(init.outcomes);\n\t\t}\n\n\t\tthis.timeManager = new TimeManager({\n\t\t\tassessmentTimeLimits: this.assessment.timeLimits,\n\t\t\t// The default warning (60 s unless the host moves it; 0 turns it off — a 0 threshold\n\t\t\t// never fires), then any additional ones.\n\t\t\twarningThresholds: [config.timeWarningThreshold ?? 60, ...(config.timeWarningThresholds ?? [])],\n\t\t\tnow: config.now,\n\t\t\textendedTime: config.pnp?.content?.extendedTime,\n\t\t\tonWarning: (remainingSeconds) => this.notifyTimeWarning(remainingSeconds),\n\t\t\tonExpired: () => this.handleAssessmentTimeExpired(),\n\t\t\tonScopeExpired: (scope, identifier) => this.handleScopeExpired(scope, identifier),\n\t\t\tonTick: (remainingSeconds, elapsedSeconds) => this.notifyTimeTick(remainingSeconds, elapsedSeconds),\n\t\t});\n\t\t// Items whose recorded result the snapshot carries were submitted with their\n\t\t// snapshot responses: identical responses must not re-submit (and re-spend an\n\t\t// attempt) on the next move or at finalize after a resume.\n\t\tthis.seedSubmittedResponses(initialState);\n\t\tif (init.restoredState?.timing) {\n\t\t\tthis.restoreTimeTracking(init.restoredState.timing);\n\t\t\t// Expiries are not in the snapshot: every scope whose restored clock already ran\n\t\t\t// out locks now, before any item is entered, so none reopens editable.\n\t\t\tthis.lockExpiredScopesFromClocks(init.restoredState.timing);\n\t\t}\n\t\t// A session saved during a proctor pause reopens paused, its clocks frozen.\n\t\tthis.pauseControl.setFromRestore(\n\t\t\tinit.restoredState?.timing?.isPaused === true,\n\t\t\tinit.restoredState?.timing?.pauseReason,\n\t\t);\n\n\t\tthis.restoredFromSnapshot = init.restoredState !== undefined;\n\t\tthis.restoredSavedAt = init.restoredState?.timing?.savedAt;\n\t\tthis.createAutosave();\n\n\t\t// A session the backend stored as finalized restores terminal: submit() returns\n\t\t// the stored results instead of failing, no item is entered, no clock runs, and\n\t\t// nothing autosaves. The shell shows its already-submitted view for it.\n\t\tif (init.finalized === true) {\n\t\t\tthis.finalized = true;\n\t\t\tthis.finalResults = this.finalResultsFromInit(init);\n\t\t\tthis.autosave?.stop();\n\t\t\tthis.timeManager?.pause();\n\t\t\tthis.timeManager?.stopTimer();\n\t\t\treturn;\n\t\t}\n\n\t\tif (config.beginGate === true) {\n\t\t\t// The begin gate holds delivery: no item is entered and no clock runs until start().\n\t\t\tthis.started = false;\n\t\t\tthis.timeManager.pause();\n\t\t\treturn;\n\t\t}\n\t\tthis.enterInitialItem();\n\t\tthis.finalizeRestoredExpiryWhenRunning();\n\t}\n\n\t/**\n\t * Enter the backend-provided current item (or the first) as delivery begins. The\n\t * restoring navigation has no await before the session is attached, so the live\n\t * session exists when this returns. A failure is recorded (not swallowed): the shell\n\t * shows its typed failure screen with Retry instead of an eternal loading state.\n\t * An item an expired limit closed is never entered editable: delivery lands on the\n\t * next open item, like the live expiry's hop, or — with none left — shows the closed\n\t * item read-only and asks for the submission (reported once listeners can hear it).\n\t */\n\tprivate enterInitialItem(): void {\n\t\tconst startId = this.state.currentItemIdentifier;\n\t\tconst idx = startId ? this.items.findIndex((q) => q.identifier === startId) : -1;\n\t\tconst requested = idx >= 0 ? idx : this.items.length > 0 ? 0 : -1;\n\t\tif (requested < 0) return;\n\t\tconst { index: target, deadEnd } = this.restoringEntryTarget(requested);\n\t\tthis.pendingEntryIndex = target;\n\t\tthis.performNavigateTo(target, { restoring: true })\n\t\t\t.then(() => {\n\t\t\t\tif (this.pendingEntryIndex === target) this.pendingEntryIndex = null;\n\t\t\t\t// The shell attaches its listeners right after creation; report the dead end\n\t\t\t\t// on the next task so it is heard.\n\t\t\t\tif (deadEnd) setTimeout(() => this.notifyExpiryDeadEnd(), 0);\n\t\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\tthis.recordEntryFailure(error);\n\t\t\t});\n\t}\n\n\t/**\n\t * Where a restoring entry lands: the requested item when it is open; else the open item\n\t * the live expiry would have moved the candidate to (forward in the part, an open earlier\n\t * question of a nonlinear part, the next part); else — nothing open remains — the\n\t * requested item itself, shown read-only, as an expiry dead end.\n\t */\n\tprivate restoringEntryTarget(index: number): { index: number; deadEnd: boolean } {\n\t\tconst q = this.items[index];\n\t\tif (!q || !this.isItemLocked(q)) return { index, deadEnd: false };\n\t\tconst open = this.openItemAfterClosure(index);\n\t\treturn open >= 0 ? { index: open, deadEnd: false } : { index, deadEnd: true };\n\t}\n\n\t/** Flat indexes of the snapshot's visited item identifiers. */\n\tprivate visitedIndexes(identifiers: readonly string[] | undefined): number[] {\n\t\treturn (identifiers ?? [])\n\t\t\t.map((id) => this.items.findIndex((q) => q.identifier === id))\n\t\t\t.filter((index) => index >= 0);\n\t}\n\n\t/**\n\t * Lock every scope whose restored clock already ran past its hard maximum (no late\n\t * submission): its live expiry never fired in this runtime, so without this its items\n\t * would reopen editable until the next tick. A whole-test limit that ran out marks the\n\t * test expired. The live timer is told, so it does not fire these expiries again.\n\t */\n\tprivate lockExpiredScopesFromClocks(timing: AssessmentSessionState['timing'] | undefined): void {\n\t\tif (!timing) return;\n\t\tconst extended = this.config.pnp?.content?.extendedTime;\n\t\tconst ranOut = (limits: TimeLimits | undefined, elapsedMs: number | undefined): boolean =>\n\t\t\tscopeLimitRanOut(limits, elapsedMs, extended);\n\t\tconst expired: string[] = [];\n\t\tconst lock = (scope: TimeScope, identifier: string): void => {\n\t\t\tif (this.scopeLocks.lock(scope, identifier)) expired.push(scopeKey(scope, identifier));\n\t\t};\n\t\tfor (const q of this.items) {\n\t\t\tif (ranOut(q.testPart.timeLimits, timing.testPartTimes?.[q.testPart.identifier])) {\n\t\t\t\tlock('testPart', q.testPart.identifier);\n\t\t\t}\n\t\t\tfor (const section of q.sections) {\n\t\t\t\tif (ranOut(section.timeLimits, timing.sectionTimes?.[section.identifier])) lock('section', section.identifier);\n\t\t\t}\n\t\t\tif (ranOut(q.item.timeLimits, timing.itemTimes?.[q.identifier])) lock('item', q.identifier);\n\t\t}\n\t\tif (ranOut(this.assessment.timeLimits, timing.totalTime)) {\n\t\t\tthis.assessmentExpired = true;\n\t\t\texpired.push('assessment');\n\t\t}\n\t\tthis.timeManager?.markExpired(expired);\n\t}\n\n\t/**\n\t * A whole-test limit that ran out while the session was away finalizes like a live\n\t * expiry — once delivery runs (not behind a begin gate, not during a pause), and on\n\t * the next task so the shell's listeners hear it.\n\t */\n\tprivate finalizeRestoredExpiryWhenRunning(): void {\n\t\tif (!this.assessmentExpired || this.restoredExpiryFinalizeScheduled) return;\n\t\tif (this.finalized || this.destroyed || !this.started || this.paused) return;\n\t\tthis.restoredExpiryFinalizeScheduled = true;\n\t\tsetTimeout(() => {\n\t\t\tif (this.finalized || this.destroyed || !this.started || this.paused) {\n\t\t\t\tthis.restoredExpiryFinalizeScheduled = false;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.autoFinalizeForTimeExpiry();\n\t\t}, 0);\n\t}\n\n\t/** The item entry a failed hop will retry: the initial item, or an expiry hop target. */\n\tprivate pendingEntryIndex: number | null = null;\n\t/** The last failed item entry, for the shell's typed failure screen. */\n\tprivate entryError: Error | null = null;\n\n\tprivate recordEntryFailure(error: unknown): void {\n\t\tthis.entryError = error instanceof Error ? error : new Error(String(error));\n\t\tthis.config.onError?.(this.entryError);\n\t}\n\n\t/** Whether the last item entry (the first item, or an expiry hop) failed. */\n\tpublic hasEntryFailure(): boolean {\n\t\treturn this.entryError !== null;\n\t}\n\n\t/** The failed item entry's error, for host logs and localized shell display. */\n\tpublic getEntryError(): Error | null {\n\t\treturn this.entryError;\n\t}\n\n\t/**\n\t * Retry the failed item entry: re-enter the initial item, or re-run the expiry hop\n\t * that failed. Serialized with all other transitions; a renewed failure is reported\n\t * through `onError` and this rejects.\n\t */\n\tpublic async retryEntry(): Promise<void> {\n\t\tconst target = this.pendingEntryIndex;\n\t\tthis.entryError = null;\n\t\tif (target === null || target < 0 || this.destroyed) return;\n\t\tawait this.runExclusive(async () => {\n\t\t\ttry {\n\t\t\t\tawait this.performNavigateTo(target, { restoring: true });\n\t\t\t\tif (this.pendingEntryIndex === target) this.pendingEntryIndex = null;\n\t\t\t} catch (error) {\n\t\t\t\t// Still broken: the failure is recorded again (the shell's error screen\n\t\t\t\t// stays) and the rejection surfaces to the caller.\n\t\t\t\tthis.recordEntryFailure(error);\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate get state(): AssessmentSessionState {\n\t\treturn this.sessionCoordinator.state;\n\t}\n\n\t/**\n\t * Whether a navigation or submission transition is currently in flight. Shells must\n\t * disable navigation controls while this is set.\n\t */\n\tpublic isBusy(): boolean {\n\t\treturn this.transitionInFlight;\n\t}\n\n\t/**\n\t * Serialize navigation and submission transitions. Exactly one transition runs at a\n\t * time; concurrent navigation or submit calls reject with a typed `navigationInFlight`\n\t * error instead of racing the in-flight backend request. The in-flight flag is set\n\t * inside the try so nothing before the operation — a throwing listener included —\n\t * can leave it stuck true (every later transition would then be rejected as busy\n\t * forever); the `finally` always resets it.\n\t */\n\tprivate async runExclusive<T>(operation: () => Promise<T>): Promise<T> {\n\t\tif (this.transitionInFlight) {\n\t\t\tthrow new AssessmentPlayerError(\n\t\t\t\t'navigationInFlight',\n\t\t\t\t'A navigation or submission transition is already in progress.',\n\t\t\t);\n\t\t}\n\t\ttry {\n\t\t\tthis.transitionInFlight = true;\n\t\t\tthis.notifyBusyChange(true);\n\t\t\treturn await operation();\n\t\t} finally {\n\t\t\tthis.transitionInFlight = false;\n\t\t\tthis.notifyBusyChange(false);\n\t\t}\n\t}\n\n\t/**\n\t * A candidate-initiated transition (navigation, submission): rejected with a coded\n\t * error during a proctor pause or before the begin gate opens, otherwise serialized\n\t * like every transition.\n\t */\n\tprivate runCandidateTransition<T>(operation: () => Promise<T>): Promise<T> {\n\t\ttry {\n\t\t\tthis.assertCandidateActionAllowed();\n\t\t} catch (error) {\n\t\t\treturn Promise.reject(error);\n\t\t}\n\t\treturn this.runExclusive(operation);\n\t}\n\n\t/** Whether a proctor pause is in force (owned by `PauseController`). */\n\tprivate get paused(): boolean {\n\t\treturn this.pauseControl.paused;\n\t}\n\n\t/** The candidate-facing reason given for the current pause, if any. */\n\tprivate get pauseReason(): string | undefined {\n\t\treturn this.pauseControl.reason;\n\t}\n\n\tprivate assertCandidateActionAllowed(): void {\n\t\tif (this.paused) {\n\t\t\tthrow new AssessmentPlayerError('assessmentPaused', 'The assessment is paused.');\n\t\t}\n\t\tif (!this.started) {\n\t\t\tthrow new AssessmentPlayerError('navigationNotAllowed', 'The assessment has not started yet.');\n\t\t}\n\t}\n\n\t// ---------------------------------------------------------------------------\n\t// Autosave: debounced draft persistence through BackendAdapter.saveState\n\t// ---------------------------------------------------------------------------\n\n\t/**\n\t * Create the autosave engine. ON by default when the backend reports the save\n\t * capability (`canSaveState !== false`); `config.autosave === false` disables it\n\t * for hosts that persist state themselves.\n\t */\n\tprivate createAutosave(): void {\n\t\tthis.autosave = createSessionAutosave({\n\t\t\tautosave: this.config.autosave,\n\t\t\tautosaveIntervalMs: this.config.autosaveIntervalMs,\n\t\t\tcanSaveState: this.backend.canSaveState,\n\t\t\tsessionId: this.sessionId,\n\t\t\tgetSnapshot: () => this.getState({ includeItemSessions: true }),\n\t\t\tsnapshotsCloseItemSessions: () => this.snapshotsCloseItemSessions,\n\t\t\tisBlocked: () => this.transitionInFlight,\n\t\t\tisStopped: () => this.destroyed || this.finalized,\n\t\t\tsaveState: (request) => this.backend.saveState(request as never),\n\t\t\tonStateChange: (state) => this.notifyAutosaveChange(state),\n\t\t\tonError: (error) => this.config.onAutosaveFailed?.(error),\n\t\t});\n\t}\n\n\t/** A due save is deferred while a transition runs and retried once it settles. */\n\tprivate notifyAutosaveActivity(): void {\n\t\tthis.autosave?.notify();\n\t}\n\n\t/**\n\t * Save the current draft immediately (best-effort): the shell calls this from\n\t * `visibilitychange`/`pagehide`, and hosts may call it before their own teardown.\n\t * While a transition is in flight the save is re-queued instead of racing it.\n\t * Resolves once a save attempt settled (or immediately when autosave is off).\n\t */\n\tpublic flushAutosave(): Promise<void> {\n\t\treturn this.autosave?.flush() ?? Promise.resolve();\n\t}\n\n\t/** The current save-indicator state (`idle` when autosave is disabled). */\n\tpublic getAutosaveState(): AutosaveState {\n\t\treturn this.autosave?.getState() ?? { status: 'idle' };\n\t}\n\n\t/** Whether autosave is active for this session (backend capability + config). */\n\tpublic isAutosaveEnabled(): boolean {\n\t\treturn this.autosave !== null;\n\t}\n\n\t/** Fires on every save-indicator state change. */\n\tpublic onAutosaveChange(listener: (state: AutosaveState) => void): () => void {\n\t\treturn this.events.on('autosaveChange', listener);\n\t}\n\n\tprivate notifyAutosaveChange(state: AutosaveState): void {\n\t\tthis.events.emit('autosaveChange', state);\n\t\tthis.config.onAutosaveChange?.(state);\n\t}\n\n\t// ---------------------------------------------------------------------------\n\t// Resume + start over\n\t// ---------------------------------------------------------------------------\n\n\t/**\n\t * Whether the session was created from a backend snapshot that already carries\n\t * candidate work (a resume worth offering: saved answers). Shells show their\n\t * resume prompt from this. Elapsed time alone does not count: a session that was\n\t * merely started (or started over) has nothing to resume.\n\t */\n\tpublic hasRestoredProgress(): boolean {\n\t\tif (!this.restoredFromSnapshot) return false;\n\t\tconst responses = this.state.itemResponses ?? {};\n\t\treturn Object.values(responses).some(\n\t\t\t(responsesForItem) => responsesForItem !== undefined && Object.keys(responsesForItem).length > 0,\n\t\t);\n\t}\n\n\t/** When the restored snapshot was last saved (client clock), for the resume prompt. */\n\tpublic getRestoredSavedAt(): number | undefined {\n\t\treturn this.hasRestoredProgress() ? this.restoredSavedAt : undefined;\n\t}\n\n\t/**\n\t * Discard the candidate's draft and restart delivery. Start over clears what the\n\t * candidate authored and the backend has not accepted — responses, flags, comments,\n\t * visited state, the timer preference and unrecorded check state — and persists the\n\t * blank draft at once. It keeps the time accounting: every clock, each expired scope\n\t * and a whole-test expiry persist, so restarting never grants a fresh time allowance\n\t * after the questions were seen. Items the backend already accepted keep their\n\t * recorded results (the backend stays authoritative for them). Delivery repositions\n\t * to the first item that is still open; when none is, the closed item is shown\n\t * read-only and the expiry's submit path is requested again (`onTimeExpired` with\n\t * `submissionRequired`). Rejects while paused, behind a begin gate, once finalized,\n\t * and while another transition runs.\n\t */\n\tpublic async startOver(): Promise<void> {\n\t\treturn this.runCandidateTransition(async () => {\n\t\t\tif (this.finalized) {\n\t\t\t\tthrow new AssessmentPlayerError('testFinalized', 'Cannot start over: the assessment has ended.');\n\t\t\t}\n\t\t\tconst snapshot = this.getState({ includeItemSessions: true });\n\t\t\t// Test parts are delivered in order and a left part is never re-entered — not\n\t\t\t// even by a restart. The restart covers the furthest part reached and what\n\t\t\t// follows; questions of parts already left stay closed exactly as they stand\n\t\t\t// (the end of the test collects them so), visited marks included.\n\t\t\tconst reachedIndex = Math.max(this.currentItemIndex, ...this.navigationManager.getVisited(), 0);\n\t\t\tconst reachedPart = partOrderOf(this.assessment, this.items[reachedIndex]);\n\t\t\tconst left = new Set(\n\t\t\t\tthis.items.filter((q) => partOrderOf(this.assessment, q) < reachedPart).map((q) => q.identifier),\n\t\t\t);\n\t\t\t// Accepted items keep their recorded state; everything else is the draft.\n\t\t\tconst accepted = new Set(\n\t\t\t\tthis.items.filter((q) => this.sessionCoordinator.hasItemResult(q.identifier)).map((q) => q.identifier),\n\t\t\t);\n\t\t\tconst keepAccepted = <T>(record: Record<string, T> | undefined): Record<string, T> =>\n\t\t\t\tObject.fromEntries(\n\t\t\t\t\tObject.entries(record ?? {}).filter(([identifier]) => accepted.has(identifier) || left.has(identifier)),\n\t\t\t\t);\n\t\t\tconst keepLeft = <T>(record: Record<string, T> | undefined): Record<string, T> =>\n\t\t\t\tObject.fromEntries(Object.entries(record ?? {}).filter(([identifier]) => left.has(identifier)));\n\t\t\tconst fresh: AssessmentSessionState = {\n\t\t\t\tcurrentItemIdentifier: this.items[0]?.identifier ?? '',\n\t\t\t\tvisitedItems: snapshot.visitedItems.filter((identifier) => left.has(identifier)),\n\t\t\t\titemResponses: keepAccepted(snapshot.itemResponses),\n\t\t\t\titemScores: keepAccepted(snapshot.itemScores),\n\t\t\t\titemSessions: keepAccepted(snapshot.itemSessions),\n\t\t\t\titemSessionStates: keepAccepted(snapshot.itemSessionStates),\n\t\t\t\titemFlags: keepLeft(snapshot.itemFlags),\n\t\t\t\titemComments: keepLeft(snapshot.itemComments),\n\t\t\t\t// The clocks continue: the live TimeManager is not reset, and the draft's\n\t\t\t\t// timing reflects it.\n\t\t\t\ttiming: snapshot.timing,\n\t\t\t};\n\t\t\t// Replaces coordinator state (responses, sessions, results, flags) and clears\n\t\t\t// visited/navigation state beyond the left parts. Locked scopes, the whole-test\n\t\t\t// expiry and the timer's fired-limit record stay as they are.\n\t\t\tthis.sessionCoordinator.restoreState(fresh);\n\t\t\tthis.navigationManager.restoreState(this.visitedIndexes(fresh.visitedItems));\n\t\t\t// (A pause cannot be in force here: startOver is a candidate transition, and a\n\t\t\t// pause requested while it runs applies once it settles.)\n\t\t\t// The resumable draft is gone; the shell's resume prompt must not reappear.\n\t\t\tthis.restoredFromSnapshot = false;\n\t\t\tthis.restoredSavedAt = undefined;\n\t\t\t// Unrecorded check state goes with the draft; the memory of accepted responses stays.\n\t\t\tfor (const identifier of [...this.lastSubmittedResponses.keys()]) {\n\t\t\t\tif (!accepted.has(identifier)) this.lastSubmittedResponses.delete(identifier);\n\t\t\t}\n\t\t\tthis.lastItemFeedback = null;\n\t\t\tthis.templateDefaultsByPart.clear();\n\t\t\t// Delivery repositions to the first open item of the furthest part reached (else\n\t\t\t// the first open item after it); with none left, the expiry dead end: the\n\t\t\t// candidate's way out is the submission.\n\t\t\tconst inReach = (q: FlatItem) => partOrderOf(this.assessment, q) >= reachedPart;\n\t\t\tconst inPart = this.items.findIndex((q) => partOrderOf(this.assessment, q) === reachedPart && this.isOpenTarget(q));\n\t\t\tconst firstOpen =\n\t\t\t\tinPart >= 0 ? inPart : this.items.findIndex((q) => partOrderOf(this.assessment, q) > reachedPart && !this.isItemLocked(q));\n\t\t\tconst target = firstOpen >= 0 ? firstOpen : Math.max(0, this.items.findIndex(inReach));\n\t\t\tif (this.items[target]) {\n\t\t\t\tthis.sessionCoordinator.setCurrentItem(this.items[target]!.identifier);\n\t\t\t\tawait this.performNavigateTo(target, { restoring: true });\n\t\t\t\tif (firstOpen < 0) this.notifyExpiryDeadEnd();\n\t\t\t}\n\t\t\t// Persist the blank draft now so a refresh cannot resurrect the discarded answers.\n\t\t\tawait this.autosave?.flushImmediate();\n\t\t});\n\t}\n\n\tprivate getEffectiveItemTimeLimits(flat: FlatItem): EffectiveItemTimeLimits {\n\t\treturn effectiveItemTimeLimits(flat, this.assessment.timeLimits, this.config.pnp?.content?.extendedTime);\n\t}\n\n\tpublic getCurrentEffectiveTimeLimits(): EffectiveItemTimeLimits {\n\t\tconst q = this.items[this.currentItemIndex];\n\t\treturn q ? this.getEffectiveItemTimeLimits(q) : {};\n\t}\n\n\tprivate getSubmitTimingEvidence(\n\t\tq: FlatItem,\n\t\telapsedMs: number,\n\t\tsubmissionReason?: SubmitTimingEvidence['submissionReason'],\n\t): SubmitTimingEvidence | undefined {\n\t\treturn submitTimingEvidence({\n\t\t\tq,\n\t\t\teffective: this.getEffectiveItemTimeLimits(q),\n\t\t\telapsedMs,\n\t\t\tscopeElapsedMs: (scope, identifier) => this.timeManager?.getScopeElapsedMs(scope, identifier),\n\t\t\tassessmentLimitSeconds: this.assessment.timeLimits?.maxTime === undefined\n\t\t\t\t? undefined\n\t\t\t\t: extendTimeLimit(this.assessment.timeLimits.maxTime, this.config.pnp?.content?.extendedTime),\n\t\t\tassessmentElapsedMs: this.timeManager ? this.timeManager.getScopeElapsedMs('assessment') : undefined,\n\t\t\tsubmissionReason,\n\t\t});\n\t}\n\n\tprivate assertMinimumTime(\n\t\tscope: 'assessment' | 'testPart' | 'section' | 'item',\n\t\tq: FlatItem,\n\t\tsection: FlatItem['section'] = q.section,\n\t): void {\n\t\tconst limits = scope === 'assessment'\n\t\t\t? this.assessment.timeLimits\n\t\t\t: scope === 'testPart'\n\t\t\t\t? q.testPart.timeLimits\n\t\t\t\t: scope === 'section'\n\t\t\t\t\t? section.timeLimits\n\t\t\t\t\t: q.item.timeLimits;\n\t\tif (limits?.minTime === undefined) return;\n\t\tconst identifier = scope === 'testPart'\n\t\t\t? q.testPart.identifier\n\t\t\t: scope === 'section'\n\t\t\t\t? section.identifier\n\t\t\t\t: scope === 'item'\n\t\t\t\t\t? q.identifier\n\t\t\t\t\t: undefined;\n\t\tassertMinTimeElapsed(scope, limits, this.timeManager?.getScopeElapsedMs(scope, identifier) ?? 0);\n\t}\n\n\t/**\n\t * Every enclosing section's minimum time gates leaving it: a transition out of an\n\t * enclosing scope (another section, another test part, or the end of the test) waits\n\t * for the outer sections' minimums too, not only the innermost section's.\n\t */\n\tprivate assertEnclosingSectionMinimumTime(q: FlatItem, target?: FlatItem): void {\n\t\tfor (const section of q.sections) {\n\t\t\tif (target?.sections.some((enclosing) => enclosing.identifier === section.identifier)) continue;\n\t\t\tthis.assertMinimumTime('section', q, section);\n\t\t}\n\t}\n\n\tprivate assertTransitionMinimum(current: FlatItem, target: FlatItem): void {\n\t\tif (current === target) return;\n\t\tthis.assertMinimumTime('item', current);\n\t\tthis.assertEnclosingSectionMinimumTime(current, target);\n\t\tif (current.testPart !== target.testPart) this.assertMinimumTime('testPart', current);\n\t}\n\n\t/**\n\t * Whether an item still owes the backend a submission: it has no recorded result yet\n\t * (the candidate left it open, answered or not), or its live responses differ from the\n\t * ones its last counted submission carried (a practice answer revised after the\n\t * check, or a revised answer a nonlinear jump left behind). Unchanged responses are\n\t * never re-sent, so an accepted item spends no extra attempt here.\n\t */\n\tprivate itemNeedsSubmission(q: FlatItem): boolean {\n\t\tif (!this.sessionCoordinator.hasItemResult(q.identifier)) return true;\n\t\treturn !this.responsesUnchangedSinceSubmission(q.identifier, this.sessionCoordinator.getResponses(q.identifier));\n\t}\n\n\tprivate isIndividual(q: FlatItem): boolean {\n\t\treturn q.testPart.submissionMode === 'individual';\n\t}\n\n\t/**\n\t * Whether submissions carry the serialized item session: always for a backend that\n\t * scores from it (`requiresItemSession` — the reference adapter: a templated item must be\n\t * scored against the instance the candidate saw), else as the host configured.\n\t */\n\tprivate sendsItemSession(): boolean {\n\t\treturn this.backend.requiresItemSession === true || this.config.sendItemSessionToBackend === true;\n\t}\n\n\t/** The item's current responses: the live session's for the active item, else the stored ones. */\n\tprivate currentResponsesFor(q: FlatItem): Record<string, unknown> {\n\t\tif (this.items[this.currentItemIndex] === q && this.currentItemSession) {\n\t\t\treturn cloneResponseRecord(this.currentItemSession.state().responses);\n\t\t}\n\t\treturn this.sessionCoordinator.getResponses(q.identifier);\n\t}\n\n\t/**\n\t * QTI itemSessionControl `allowSkipping` / `validateResponses` for one item's\n\t * responses. Both are \"only applicable when the item is in a testPart with individual\n\t * submission mode\", so a simultaneous part is never gated. A skipped item (no\n\t * response at all: every response NULL, empty or still equal to its declared default —\n\t * the test `numberResponded` applies) may be submitted only when skipping is allowed,\n\t * and is then not validated; an answered item validates when the item asks for it.\n\t */\n\tprivate submissionGate(q: FlatItem, responses: Record<string, unknown>): { mustAnswer: boolean; validate: boolean } {\n\t\treturn submissionGatePolicy({\n\t\t\tindividual: this.isIndividual(q),\n\t\t\tsettings: this.sessionCoordinator.getItemSettings(q.identifier),\n\t\t\tresponses,\n\t\t\tdefaults: this.responseDefaultsFor(q),\n\t\t});\n\t}\n\n\t/**\n\t * The declared default of each response variable, as the item's own session holds it\n\t * (template processing may set it): the live session for the active item, the persisted\n\t * handoff otherwise, else — for an item never opened — a fresh session's declarations.\n\t */\n\tprivate responseDefaultsFor(q: FlatItem): Record<string, ResponseDefault> {\n\t\tconst live = this.items[this.currentItemIndex] === q ? this.currentItemSession : null;\n\t\tconst serialized = live ? live.serialize() : this.state.itemSessions?.[q.identifier];\n\t\tif (serialized) return responseDefaultsOf(serialized);\n\t\tconst cached = this.responseDefaultsCache.get(q.identifier);\n\t\tif (cached) return cached as Record<string, ResponseDefault>;\n\t\tlet defaults: Record<string, ResponseDefault> = {};\n\t\tlet session: ItemSession | null = null;\n\t\ttry {\n\t\t\tsession = this.getItemDefinition(q).openSession({});\n\t\t\tdefaults = responseDefaultsOf(session.serialize());\n\t\t} catch {\n\t\t\t// An item that cannot even open has no defaults to honour; the gate stays NULL-based.\n\t\t} finally {\n\t\t\tsession?.dispose();\n\t\t}\n\t\tthis.responseDefaultsCache.set(q.identifier, defaults);\n\t\treturn defaults;\n\t}\n\n\t/**\n\t * The item's response validation (a QTI valid response: every value well-formed and,\n\t * where an interaction requires input — minChoices, minStrings, matchMin… — complete),\n\t * checked on a detached session so the live attempt is untouched. Null when nothing is\n\t * left to validate: the attempt already closed (accepted as it is), or the session could\n\t * not be opened (the submission reports that, the gate invents no failure).\n\t */\n\tprivate responseValidationFor(q: FlatItem): { ok: boolean; requirement?: SubmissionBlocker['requirement'] } | null {\n\t\tconst live = this.items[this.currentItemIndex] === q ? this.currentItemSession : null;\n\t\tconst restore = live ? live.serialize() : this.state.itemSessions?.[q.identifier];\n\t\tlet session: ItemSession | null = null;\n\t\ttry {\n\t\t\tsession = this.getItemDefinition(q).openSession({\n\t\t\t\trestore,\n\t\t\t\tresponses: live ? undefined : this.sessionCoordinator.getResponses(q.identifier),\n\t\t\t\tactivate: true,\n\t\t\t});\n\t\t\tif (!isWritableItemLifecycle(session.state().lifecycleStatus)) return null;\n\t\t\tconst validation = session.dispatch({ action: 'suspendAttempt' }).result?.validation;\n\t\t\tif (!validation) return null;\n\t\t\tconst unmet = Object.values(validation.entries).find(\n\t\t\t\t(entry) => !entry.valid || (entry.required && !entry.complete),\n\t\t\t);\n\t\t\tif (validation.valid && !unmet) return { ok: true };\n\t\t\tconst constraint = unmet?.valid ? interactionRequirementFromXml(q.item.itemXml, unmet.responseId) : undefined;\n\t\t\treturn { ok: false, requirement: constraint ?? { kind: 'incomplete' } };\n\t\t} catch {\n\t\t\treturn null;\n\t\t} finally {\n\t\t\tsession?.dispose();\n\t\t}\n\t}\n\n\t/** Whether the item's responses satisfy their interactions' constraints (see `responseValidationFor`). */\n\tprivate responsesSatisfyConstraints(q: FlatItem): boolean {\n\t\treturn this.responseValidationFor(q)?.ok !== false;\n\t}\n\n\t/**\n\t * Whether the end of the test would submit this item: mirrors `endTestInternal`'s\n\t * collection — the open current item without an accepted (unchanged) result, and every\n\t * visited individual-mode item whose responses the backend has not accepted yet.\n\t */\n\tprivate wouldCollectAtFinalize(q: FlatItem): boolean {\n\t\tif (!this.isIndividual(q) || this.isItemLocked(q)) return false;\n\t\tif (q.index === this.currentItemIndex) {\n\t\t\tif (!this.sessionCoordinator.hasItemResult(q.identifier)) return true;\n\t\t\tconst status = this.currentItemSession?.state().lifecycleStatus;\n\t\t\treturn (\n\t\t\t\tstatus !== undefined &&\n\t\t\t\tisWritableItemLifecycle(status) &&\n\t\t\t\tthis.sessionCoordinator.canSubmit(q.identifier) &&\n\t\t\t\t!this.responsesUnchangedSinceSubmission(q.identifier)\n\t\t\t);\n\t\t}\n\t\treturn this.navigationManager.isVisited(q.index) && this.itemNeedsSubmission(q);\n\t}\n\n\t/**\n\t * The QTI submission control that would refuse this item's submission now, if any:\n\t * `required` (allowSkipping=false, no response) or `invalid` (validateResponses=true,\n\t * responses that do not satisfy the interactions), with what the response still owes.\n\t */\n\tprivate blockerFor(q: FlatItem): SubmissionBlocker | null {\n\t\tconst gate = this.submissionGate(q, this.currentResponsesFor(q));\n\t\tlet reason: SubmissionBlocker['reason'] | null = gate.mustAnswer ? 'required' : null;\n\t\tlet requirement: SubmissionBlocker['requirement'];\n\t\tif (!reason && gate.validate) {\n\t\t\tconst validation = this.responseValidationFor(q);\n\t\t\tif (validation && !validation.ok) {\n\t\t\t\treason = 'invalid';\n\t\t\t\trequirement = validation.requirement;\n\t\t\t}\n\t\t}\n\t\tif (!reason) return null;\n\t\treturn submissionBlockerFor(q, reason, requirement, this.isNavigationTargetLegal(q.index));\n\t}\n\n\t/** Every item the end of the test would collect against its submission controls, reachable or not. */\n\tprivate blockerCandidates(filter: (q: FlatItem) => boolean = () => true): SubmissionBlocker[] {\n\t\tif (this.finalized) return [];\n\t\tconst blockers: SubmissionBlocker[] = [];\n\t\tfor (const q of this.items) {\n\t\t\tif (!filter(q) || !this.wouldCollectAtFinalize(q)) continue;\n\t\t\tconst blocker = this.blockerFor(q);\n\t\t\tif (blocker) blockers.push(blocker);\n\t\t}\n\t\treturn blockers;\n\t}\n\n\t/**\n\t * Items a candidate-initiated end of the test would refuse to submit: in individual\n\t * parts, an item without any response while `allowSkipping=false` (`required`), or an\n\t * answered item whose responses fail validation while `validateResponses=true`\n\t * (`invalid`). Only items the end of the test would actually submit are considered\n\t * (presented ones the backend has not accepted), and only those the candidate can still\n\t * reach: a question in a test part already left cannot hold Submit — it is collected as\n\t * it stands (`getUnreachableSubmissionBlockers()`, `submissionReason: 'unreachable'`).\n\t * An item an expired limit closed is collected as it stands too. Empty once the delivery\n\t * is closed by time or finalized. Shells list these in the submit confirmation;\n\t * `submit()` rejects naming them.\n\t */\n\tpublic getSubmissionBlockers(): SubmissionBlocker[] {\n\t\tif (this.isTimeClosedDelivery()) return [];\n\t\treturn this.blockerCandidates().filter((blocker) => blocker.reachable);\n\t}\n\n\t/**\n\t * Questions the end of the test collects although their QTI skipping/validation control\n\t * would refuse them, because the candidate can no longer reach them (their test part was\n\t * left — a session restored from before the leave gate, a branch rule). They never hold\n\t * Submit: the end of the test sends them as they stand with `submissionReason: 'unreachable'`.\n\t */\n\tpublic getUnreachableSubmissionBlockers(): SubmissionBlocker[] {\n\t\treturn this.blockerCandidates().filter((blocker) => !blocker.reachable);\n\t}\n\n\t/**\n\t * Questions of the current test part that would be left behind owing an answer: QTI\n\t * parts cannot be re-entered, so leaving an individual part with them would strand them.\n\t * The shell's \"Leave this part?\" confirmation lists them (with jumps) and holds Continue;\n\t * `next()` / `navigateTo()` refuse to leave the part while any remains\n\t * (`leavePartResponseRequired` / `leavePartResponseInvalid`). Only questions the\n\t * candidate can still reach count — one behind them in a linear part (a session restored\n\t * from before this gate) could never be answered, so it cannot hold the way out; the end\n\t * of the test collects it as it stands (`unreachable`). Empty for a simultaneous part\n\t * (QTI: the controls do not apply), once finalized, and in a time-closed delivery.\n\t */\n\tpublic getTestPartBlockers(): SubmissionBlocker[] {\n\t\tconst current = this.items[this.currentItemIndex];\n\t\tif (!current || this.isTimeClosedDelivery()) return [];\n\t\treturn this.blockerCandidates((q) => q.testPart === current.testPart).filter((blocker) => blocker.reachable);\n\t}\n\n\t/** Reject a candidate-initiated end of the test that would submit held-back items, naming them. */\n\tprivate assertNoSubmissionBlockers(): void {\n\t\tthis.throwForBlockers(this.getSubmissionBlockers(), 'finalize');\n\t}\n\n\t/**\n\t * Reject leaving the test part `from` belongs to while questions in it (or, for an\n\t * EXIT_SECTION, in the ended scope) still owe an answer the candidate can still give.\n\t * `exclude` is the item the move itself submits (next() submits the current item before\n\t * it moves). An unreachable question never holds the way out (see `getTestPartBlockers`).\n\t */\n\tprivate assertCanLeaveScope(from: FlatItem, options: { exclude?: FlatItem; scope?: (q: FlatItem) => boolean } = {}): void {\n\t\tif (!this.isIndividual(from)) return;\n\t\tconst inScope = options.scope ?? ((q: FlatItem) => q.testPart === from.testPart);\n\t\tthis.throwForBlockers(\n\t\t\tthis.blockerCandidates((q) => q !== options.exclude && inScope(q)).filter((blocker) => blocker.reachable),\n\t\t\t'leavePart',\n\t\t);\n\t}\n\n\tprivate throwForBlockers(blockers: SubmissionBlocker[], context: 'finalize' | 'leavePart'): void {\n\t\tthrowForBlockers(blockers, context);\n\t}\n\n\t/**\n\t * QTI feedback visibility is attempt-relative: with more than one attempt allowed,\n\t * feedback for every non-final attempt must be shown; once the last attempt has\n\t * ended, `showFeedback` governs. Adaptive items always show their feedback.\n\t * `attemptsAfter` counts the attempts once the attempt being judged has ended.\n\t */\n\tprivate feedbackVisible(q: FlatItem, attemptsAfter: number): boolean {\n\t\tconst control = this.sessionCoordinator.getItemSettings(q.identifier);\n\t\tconst adaptive = isAdaptiveItemXml(q.item.itemXml);\n\t\treturn attemptFeedbackVisible({\n\t\t\tshowFeedback: control.showFeedback === true,\n\t\t\tmaxAttempts: resolveMaxAttempts(control, adaptive),\n\t\t\tattempts: attemptsAfter,\n\t\t\tadaptive,\n\t\t});\n\t}\n\n\t/**\n\t * Sections presented to the candidate: visible themselves and under visible ancestors.\n\t * A QTI `visible=\"false\"` section is not presented as a section — its content appears as\n\t * part of the parent — so neither it nor its descendants surface a title here. Items\n\t * inside keep being delivered in order.\n\t */\n\tprivate presentedSectionList(): SecureSection[] {\n\t\treturn presentedSections(this.assessment);\n\t}\n\n\t/**\n\t * Whether jumping to a presented section is legal right now: in linear navigation there\n\t * is no jumping at all; in nonlinear navigation only sections of the current test part\n\t * are reachable, never locked items or items review has closed. Finalized tests have no\n\t * legal targets.\n\t */\n\tprivate isLegalSectionTarget(section: SecureSection): boolean {\n\t\treturn isLegalSectionTarget({\n\t\t\tsection,\n\t\t\titems: this.items,\n\t\t\tfinalized: this.finalized,\n\t\t\tcurrentIndex: this.currentItemIndex,\n\t\t\tisItemLocked: (q) => this.isItemLocked(q),\n\t\t\tcanReviewItem: (q) => this.canReviewItem(q),\n\t\t});\n\t}\n\n\t// ---------------------------------------------------------------------------\n\t// Public API used by components\n\t// ---------------------------------------------------------------------------\n\n\t/**\n\t * The assessmentTest `title` the backend returned, trimmed, or `undefined` when it\n\t * has none. Shells fall back to a localized generic title, never the identifier.\n\t */\n\tpublic getAssessmentTitle(): string | undefined {\n\t\tconst title = this.assessment.title?.trim();\n\t\treturn title ? title : undefined;\n\t}\n\n\t/**\n\t * Candidate-facing sections: visible sections only (QTI `visible=\"false\"` sections are\n\t * not presented as sections and their titles never surface), each with whether jumping\n\t * to it is legal right now for the current navigationMode.\n\t */\n\tpublic getAllSections(): CandidateSectionView[] {\n\t\treturn this.presentedSectionList().map((section, index) => ({\n\t\t\tid: section.identifier,\n\t\t\ttitle: section.title,\n\t\t\tindex,\n\t\t\tnavigable: this.isLegalSectionTarget(section),\n\t\t}));\n\t}\n\n\t/**\n\t * Whether jumping straight to a delivered item is legal right now: false once the test\n\t * has finalized, and — for any item other than the current one — false while the target\n\t * is time-locked, its review policy forbids returning, or the navigation rules (linear\n\t * mode, test-part sequencing) do not reach it. The review screen renders illegal targets\n\t * status-only; `navigateTo()` still enforces this authoritatively.\n\t */\n\tpublic isNavigationTargetLegal(index: number): boolean {\n\t\treturn this.isNavigationTargetLegalWith(index, this.lazyForward());\n\t}\n\n\t/** `isNavigationTargetLegal` with the forward step computed once for a batch of targets. */\n\tprivate isNavigationTargetLegalWith(index: number, forward: () => number): boolean {\n\t\tif (this.finalized || this.currentItemIndex < 0) return false;\n\t\tconst target = this.items[index];\n\t\tif (!target) return false;\n\t\tif (target !== this.items[this.currentItemIndex]) {\n\t\t\tif (this.isItemLocked(target)) return false;\n\t\t\tif (!this.canReviewItem(target)) return false;\n\t\t\tif (!this.canNavigateByTestPart(index, this.currentItemIndex, forward)) return false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tprivate reviewInfoFor(itemIdentifier: string): { responseIds: string[]; title?: string } {\n\t\treturn this.reviewInfoCache.for(itemIdentifier);\n\t}\n\n\t/**\n\t * Answered / partially answered / unanswered for one delivered item, from its\n\t * candidate responses (one verdict per interaction for composite items). The single\n\t * definition of \"answered\" the review screen, section menu and submit confirmation share.\n\t */\n\tpublic getItemAnswerStatus(itemIdentifier: string): ItemAnswerStatus {\n\t\tconst info = this.reviewInfoFor(itemIdentifier);\n\t\treturn itemAnswerStatus(this.sessionCoordinator.getResponses(itemIdentifier), info.responseIds);\n\t}\n\n\t/** How many delivered items carry a response (answered or partially answered). */\n\tpublic getAnsweredItemCount(): number {\n\t\treturn this.items.filter((item) => this.getItemAnswerStatus(item.identifier) !== 'unanswered').length;\n\t}\n\n\t/** Every delivered item as the review screen lists it: status, flag, visited, jump legality. */\n\tpublic getReviewItems(): ReviewItemView[] {\n\t\tconst forward = this.lazyForward();\n\t\treturn this.items.map((item) =>\n\t\t\treviewItemRow(item, {\n\t\t\t\ttitle: this.reviewInfoFor(item.identifier).title,\n\t\t\t\tstatus: this.getItemAnswerStatus(item.identifier),\n\t\t\t\tflagged: this.sessionCoordinator.isItemFlagged(item.identifier),\n\t\t\t\tvisited: this.navigationManager.isVisited(item.index) || item.index === this.currentItemIndex,\n\t\t\t\tjumpAllowed: this.isNavigationTargetLegalWith(item.index, forward),\n\t\t\t\tisCurrent: item.index === this.currentItemIndex,\n\t\t\t}),\n\t\t);\n\t}\n\n\t/**\n\t * Candidate-facing results for a shell's opt-in completion summary: per delivered\n\t * item the answered status and — when the backend returned one — its score, plus the\n\t * finalized totals. Null until the assessment has been finalized; high-stakes hosts\n\t * simply never render it (the shell's `showResultsSummary` stays off by default).\n\t */\n\tpublic getResultsSummary(): ResultsSummary | null {\n\t\tif (!this.finalized || !this.finalResults) return null;\n\t\treturn resultsSummaryOf({\n\t\t\titems: this.items,\n\t\t\tresults: this.finalResults,\n\t\t\ttitleOf: (itemIdentifier) => this.reviewInfoFor(itemIdentifier).title,\n\t\t\tstatusOf: (itemIdentifier) => this.getItemAnswerStatus(itemIdentifier),\n\t\t});\n\t}\n\n\t/**\n\t * What the candidate's next forward step would do. QTI test parts are delivered in\n\t * sequence and cannot be re-entered, so a step that leaves the current part is the\n\t * irreversible move the shell confirms before making.\n\t */\n\tpublic getForwardTransitionInfo(): ForwardTransitionInfo {\n\t\tconst current = this.items[this.currentItemIndex];\n\t\tif (!current || this.finalized) return { nextIndex: null, leavesTestPart: false };\n\t\t// A decision the backend made for this item and delivery has not followed yet (a\n\t\t// check's, a branch exit held back while questions of the part still owed an answer)\n\t\t// is what Next does now — unless Next re-submits a changed response, which decides anew.\n\t\tconst kept = this.nextSubmits(current) ? null : this.keptBranchDecisionFor(current);\n\t\tif (kept) {\n\t\t\tconst landing = branchLandingOf(kept, this.branchTargetIndex(current, kept));\n\t\t\tif (landing.kind !== 'skipped') {\n\t\t\t\treturn {\n\t\t\t\t\tnextIndex: landing.kind === 'item' ? landing.index : null,\n\t\t\t\t\tleavesTestPart: this.branchExitLeavesPart(current, kept),\n\t\t\t\t};\n\t\t\t}\n\t\t\t// A literal decision that resolves to nothing forward is skipped (the rule does\n\t\t\t// not fire): Next falls through to the delivery rules, so that is what the step\n\t\t\t// reports.\n\t\t}\n\t\tconst nextIndex = this.forwardStepIndex(current);\n\t\tconst next = nextIndex >= 0 ? this.items[nextIndex] : undefined;\n\t\treturn {\n\t\t\tnextIndex: next ? nextIndex : null,\n\t\t\tleavesTestPart: Boolean(next && next.testPart !== current.testPart),\n\t\t};\n\t}\n\n\t/**\n\t * Set (or clear) the candidate's flag-for-review on an item; defaults to the current\n\t * item. Flag state lives in the session state (`itemFlags`), survives navigation and\n\t * is part of `getState()` snapshots.\n\t */\n\tpublic setItemFlag(flagged: boolean, itemIdentifier?: string): void {\n\t\tconst id = itemIdentifier ?? this.items[this.currentItemIndex]?.identifier;\n\t\tif (!id) return;\n\t\tthis.sessionCoordinator.setItemFlag(id, flagged);\n\t\tthis.events.emit('flagChange', id, flagged);\n\t\t// Flags are part of the persisted draft.\n\t\tthis.notifyAutosaveActivity();\n\t}\n\n\t/** Toggle the current (or given) item's flag; returns the new state. */\n\tpublic toggleItemFlag(itemIdentifier?: string): boolean {\n\t\tconst id = itemIdentifier ?? this.items[this.currentItemIndex]?.identifier;\n\t\tif (!id) return false;\n\t\tconst flagged = !this.sessionCoordinator.isItemFlagged(id);\n\t\tthis.setItemFlag(flagged, id);\n\t\treturn flagged;\n\t}\n\n\tpublic isItemFlagged(itemIdentifier?: string): boolean {\n\t\tconst id = itemIdentifier ?? this.items[this.currentItemIndex]?.identifier;\n\t\treturn id ? this.sessionCoordinator.isItemFlagged(id) : false;\n\t}\n\n\t/** Identifiers of the items currently flagged for review. */\n\tpublic getFlaggedItemIdentifiers(): string[] {\n\t\treturn this.sessionCoordinator.getFlaggedItemIdentifiers();\n\t}\n\n\t/** Fires when an item's flag-for-review state changes. */\n\tpublic onFlagChange(listener: (itemIdentifier: string, flagged: boolean) => void): () => void {\n\t\treturn this.events.on('flagChange', listener);\n\t}\n\n\tpublic getNavigationState(): NavigationState {\n\t\tconst presented = this.presentedSectionList();\n\t\tconst sectionIndexes = new Map(presented.map((section, index) => [section.identifier, index]));\n\t\tconst total = this.items.length;\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tconst presentedSection = q ? presentedSectionOf(q.sections) : undefined;\n\t\treturn {\n\t\t\tcurrentIndex: this.currentItemIndex,\n\t\t\ttotalItems: total,\n\t\t\tcanNext: !this.finalized && this.canNext(),\n\t\t\tcanPrevious: !this.finalized && this.canPrevious(),\n\t\t\tisLoading: this.transitionInFlight,\n\t\t\tisComplete: this.finalized,\n\t\t\tcurrentSection: presentedSection\n\t\t\t\t? {\n\t\t\t\t\tid: presentedSection.identifier,\n\t\t\t\t\ttitle: presentedSection.title,\n\t\t\t\t\tindex: sectionIndexes.get(presentedSection.identifier) ?? -1,\n\t\t\t\t}\n\t\t\t\t: undefined,\n\t\t\ttotalSections: presented.length,\n\t\t};\n\t}\n\n\tpublic getCurrentItem(): CurrentItemView | null {\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tif (!q) return null;\n\t\treturn {\n\t\t\tidentifier: q.item.identifier,\n\t\t\ttitle: q.presentedSection?.title,\n\t\t\trequired: q.item.required,\n\t\t\titemXml: q.item.itemXml,\n\t\t\tdeliveryContext: q.item.deliveryContext,\n\t\t};\n\t}\n\n\t/**\n\t * The one authoritative live session for the active item.\n\t *\n\t * Section and item renderers receive this exact instance. Serialized item-session\n\t * state is reserved for persistence and restore, never for synchronizing a second\n\t * live player.\n\t */\n\tpublic getCurrentItemSession(): ItemSession | null {\n\t\treturn this.currentItemSession;\n\t}\n\n\tpublic getCurrentSectionItemRefs(): SectionItemRefView[] {\n\t\tconst current = this.items[this.currentItemIndex];\n\t\tif (!current) return [];\n\n\t\treturn this.items\n\t\t\t.filter((item) => item.section.identifier === current.section.identifier)\n\t\t\t.map((item) => {\n\t\t\t\tconst itemRef = item.item as SecureItemRef & { href?: string; title?: string };\n\t\t\t\treturn {\n\t\t\t\t\tidentifier: itemRef.identifier,\n\t\t\t\t\thref: itemRef.href,\n\t\t\t\t\ttitle: itemRef.title,\n\t\t\t\t\titemXml: itemRef.itemXml,\n\t\t\t\t\t// Shared by reference, not cloned: the delivery context is a static\n\t\t\t\t\t// content record the backend returned, composition rebuilds share it so\n\t\t\t\t\t// unchanged items keep identical props, and callers treat it read-only.\n\t\t\t\t\tdeliveryContext: itemRef.deliveryContext,\n\t\t\t\t};\n\t\t\t});\n\t}\n\n\tpublic getResponsesForItem(itemIdentifier: string): Record<string, unknown> {\n\t\treturn cloneData(this.sessionCoordinator.getResponses(itemIdentifier)) ?? {};\n\t}\n\n\t/**\n\t * The assessment identifier the backend drew this session for (`SecureAssessment.identifier`).\n\t * Section tool bars and host integrations name the assessment with it.\n\t */\n\tpublic getAssessmentId(): string {\n\t\treturn this.assessment.identifier;\n\t}\n\n\t/**\n\t * The delivered items of the active item's innermost section, with their current\n\t * response records shared by reference (a shallow copy of the outer map only).\n\t * For section composition building: the values are read-only views of session\n\t * state and must not be mutated by callers — the deep-cloning accessors above\n\t * remain the boundary for persistence and events.\n\t */\n\tpublic getSectionItemResponses(): Record<string, Record<string, unknown>> {\n\t\tconst current = this.items[this.currentItemIndex];\n\t\tif (!current) return {};\n\t\tconst out: Record<string, Record<string, unknown>> = {};\n\t\tfor (const item of this.items) {\n\t\t\tif (item.section.identifier !== current.section.identifier) continue;\n\t\t\tout[item.identifier] = { ...this.sessionCoordinator.getResponses(item.identifier) };\n\t\t}\n\t\treturn out;\n\t}\n\n\tpublic getCurrentSharedRubricBlocks(): AssessmentRubricBlock[] {\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tif (!q) return [];\n\n\t\treturn [\n\t\t\t...(q.testPart.rubricBlocks ?? []),\n\t\t\t...(q.section.rubricBlocks ?? []),\n\t\t].map((block) => ({ ...block, view: [...block.view] }));\n\t}\n\n\tpublic getCurrentRubricBlocks(): AssessmentRubricBlock[] {\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tif (!q) return [];\n\t\treturn q.section.rubricBlocks || q.testPart.rubricBlocks || [];\n\t}\n\n\t/**\n\t * Test feedback shown now, test-level first, then each test part's. Nothing shows before outcome\n\t * processing first runs. `during` feedback then shows by its outcome, test-part `during`\n\t * feedback while its part is current; `atEnd` feedback shows once the test, or its test part,\n\t * has ended.\n\t */\n\tpublic getVisibleFeedback(): VisibleTestFeedback[] {\n\t\tconst outcomes = this.testOutcomes;\n\t\tif (!outcomes) return [];\n\t\tconst parts = this.assessment.testParts ?? [];\n\n\t\tconst shown: VisibleTestFeedback[] = [];\n\t\tconst add = (items: TestFeedbackItem[] | undefined, ended: boolean, current: boolean, part?: SecureTestPart) => {\n\t\t\titems?.forEach((fb, index) => {\n\t\t\t\tif (fb.access === 'atEnd' ? !ended : !current) return;\n\t\t\t\tif (!isShownByIdentifier(outcomes[fb.outcomeIdentifier] ?? null, fb.identifier, fb.showHide)) return;\n\t\t\t\tshown.push({\n\t\t\t\t\tkey: part ? `part:${part.identifier}:${index}` : `test:${index}`,\n\t\t\t\t\tidentifier: fb.identifier,\n\t\t\t\t\tcontent: fb.content,\n\t\t\t\t\taccess: fb.access,\n\t\t\t\t\t...(part ? { testPartIdentifier: part.identifier } : {}),\n\t\t\t\t\t...(fb.language ? { language: fb.language } : {}),\n\t\t\t\t});\n\t\t\t});\n\t\t};\n\t\tadd(this.assessment.testFeedback, this.finalized, true);\n\t\tconst currentPart = this.currentTestPartIndex();\n\t\tparts.forEach((part, index) => {\n\t\t\tadd(part.testFeedback, this.finalized || currentPart > index, currentPart === index, part);\n\t\t});\n\t\treturn shown;\n\t}\n\n\tprivate currentTestPartIndex(): number {\n\t\tconst part = this.items[this.currentItemIndex]?.testPart;\n\t\treturn part ? (this.assessment.testParts ?? []).findIndex((p) => p.identifier === part.identifier) : -1;\n\t}\n\n\tprivate setTestOutcomes(outcomes: TestOutcomeValues | undefined): void {\n\t\tif (!outcomes) return;\n\t\tthis.testOutcomes = cloneData(outcomes)!;\n\t\t// The snapshot carries them: delivery rules read the same values after a restore.\n\t\tthis.sessionCoordinator.setTestOutcomes(outcomes);\n\t\tthis.notifyTestFeedbackChange();\n\t}\n\n\tpublic updateResponse(responseId: string, value: unknown): void {\n\t\tconst active = this.items[this.currentItemIndex];\n\t\tif (!active) return;\n\t\tthis.assertCandidateActionAllowed();\n\t\tif (this.currentItemSession) {\n\t\t\tthis.currentItemSession.dispatch({\n\t\t\t\taction: 'setResponse',\n\t\t\t\tresponseIdentifier: responseId,\n\t\t\t\tvalue,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\t\tthis.sessionCoordinator.updateResponseForItem(active.identifier, responseId, value);\n\t\tthis.notifyResponseChange();\n\t}\n\n\t/**\n\t * Update a response for a specific item.\n\t * Useful when response events are observed outside the current-item renderer and we\n\t * want to be explicit about which item receives the response (some assessments reuse\n\t * the same responseIdentifier like \"RESPONSE\" across items).\n\t */\n\tpublic updateResponseForItem(itemIdentifier: string, responseId: string, value: unknown): void {\n\t\tthis.assertCandidateActionAllowed();\n\t\tconst active = this.items[this.currentItemIndex];\n\t\tif (active?.identifier === itemIdentifier && this.currentItemSession) {\n\t\t\tconst liveValue = this.currentItemSession.state().responses[responseId];\n\t\t\tif (!responseValuesEqual(liveValue, value)) {\n\t\t\t\t// Programmatic/host callers still enter through this API. Browser item\n\t\t\t\t// adapters have already dispatched, so their equal value is not applied twice.\n\t\t\t\tthis.currentItemSession.dispatch({\n\t\t\t\t\taction: 'setResponse',\n\t\t\t\t\tresponseIdentifier: responseId,\n\t\t\t\t\tvalue,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tconst persisted = this.sessionCoordinator.getPersistedItemSession(itemIdentifier);\n\t\tif (persisted && !isWritableItemLifecycle(persisted.lifecycleStatus)) {\n\t\t\tthrow new AssessmentPlayerError(\n\t\t\t\t'itemSessionLocked',\n\t\t\t\t`Cannot update responses while item session is ${persisted.lifecycleStatus}`,\n\t\t\t\t{ status: persisted.lifecycleStatus },\n\t\t\t);\n\t\t}\n\n\t\tthis.sessionCoordinator.updateResponseForItem(itemIdentifier, responseId, value);\n\t\tthis.notifyResponseChange();\n\t}\n\n\t/**\n\t * Get current unsaved responses for the active item.\n\t * (Useful for host integrations / web components.)\n\t */\n\tpublic getResponses(): Record<string, unknown> {\n\t\tif (this.currentItemSession) {\n\t\t\treturn cloneData(this.currentItemSession.state().responses) ?? {};\n\t\t}\n\t\treturn this.sessionCoordinator.getActiveResponses();\n\t}\n\n\tpublic saveCurrentItemSession(): SerializedItemSessionState | null {\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tif (!q || !this.currentItemSession) return null;\n\n\t\tconst currentView = this.currentItemSession.state();\n\t\tconst transition = isWritableItemLifecycle(currentView.lifecycleStatus)\n\t\t\t? this.currentItemSession.dispatch({ action: 'suspendAttempt' })\n\t\t\t: null;\n\t\tconst itemSession = transition?.result?.sessionState ?? this.currentItemSession.serialize();\n\t\tconst responses = cloneData(transition?.current.responses ?? currentView.responses) ?? {};\n\t\tthis.sessionCoordinator.saveItemSession(\n\t\t\tq.identifier,\n\t\t\tresponses,\n\t\t\titemSession,\n\t\t\ttransition?.current.duration ?? currentView.duration,\n\t\t);\n\t\treturn itemSession;\n\t}\n\n\tprivate endItemSessionForSubmit(\n\t\tq: FlatItem,\n\t\tresponses: Record<string, unknown>,\n\t\titemSession?: SerializedItemSessionState,\n\t\toptions: { validate?: boolean } = {},\n\t): SerializedItemSessionState {\n\t\t// Responses frozen by an expired time limit are final as they stand: validation\n\t\t// cannot ask the candidate to correct them any more.\n\t\tconst validateResponses = options.validate !== false && this.sessionCoordinator.mustValidateResponses(q.identifier);\n\t\tconst endAttempt = (session: ItemSession): SerializedItemSessionState => {\n\t\t\t// A session whose attempt already ended contributes its accepted state unchanged;\n\t\t\t// dispatching another end-attempt on it would throw and fail the final submission.\n\t\t\tif (!isWritableItemLifecycle(session.state().lifecycleStatus)) {\n\t\t\t\treturn session.serialize();\n\t\t\t}\n\t\t\tconst result = session.dispatch({ action: 'endAttempt', validateResponses }).result;\n\t\t\tif (result?.validation && !result.validation.valid) {\n\t\t\t\t// Coded, naming the item, so a shell shows which question to fix instead of a\n\t\t\t\t// generic failure that no retry can clear.\n\t\t\t\tthrow new AssessmentPlayerError(\n\t\t\t\t\t'finalizeResponseInvalid',\n\t\t\t\t\tresult.validation.issues[0]?.message || `Submit failed: invalid response for item ${q.identifier}`,\n\t\t\t\t\t{ items: String(q.index + 1), itemIdentifiers: q.identifier, count: 1 },\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn result?.sessionState ?? session.serialize();\n\t\t};\n\t\tconst active = this.items[this.currentItemIndex];\n\t\tif (\n\t\t\tactive === q &&\n\t\t\tthis.currentItemSession &&\n\t\t\tisWritableItemLifecycle(this.currentItemSession.state().lifecycleStatus)\n\t\t) {\n\t\t\treturn endAttempt(this.currentItemSession);\n\t\t}\n\n\t\tconst session = this.getItemDefinition(q).openSession({\n\t\t\trestore: itemSession,\n\t\t\tresponses: itemSession ? undefined : responses,\n\t\t\tactivate: true,\n\t\t});\n\t\ttry {\n\t\t\treturn endAttempt(session);\n\t\t} finally {\n\t\t\tsession.dispose();\n\t\t}\n\t}\n\n\t/**\n\t * How an item presents feedback and solutions under its resolved item session\n\t * control, for its current attempt count (feedback visibility is attempt-relative,\n\t * see `feedbackVisible`).\n\t */\n\tprivate presentationFor(\n\t\tq: FlatItem,\n\t\tattemptsAfter = this.sessionCoordinator.getItemSessionInfo(q.identifier).attemptCount,\n\t): PresentationPolicy {\n\t\tconst control = this.sessionCoordinator.getItemSettings(q.identifier);\n\t\treturn {\n\t\t\tshowFeedback: this.feedbackVisible(q, attemptsAfter),\n\t\t\tshowSolution: control.showSolution === true,\n\t\t};\n\t}\n\n\t/**\n\t * A counted submission can change what the item shows: feedback a non-final attempt\n\t * revealed hides once the last attempt ended (unless showFeedback is on), and the\n\t * first non-final attempt reveals it. Reopen the live session under the new policy\n\t * when it differs; the item stays where it is.\n\t */\n\tprivate refreshLivePresentation(q: FlatItem, itemSession: SerializedItemSessionState | undefined): void {\n\t\tconst live = this.currentItemSession;\n\t\tif (!live || this.items[this.currentItemIndex] !== q) return;\n\t\tconst next = this.presentationFor(q);\n\t\tconst current = this.liveSessionPresentation ?? { showFeedback: true, showSolution: false };\n\t\tif (current.showFeedback === next.showFeedback && current.showSolution === next.showSolution) return;\n\t\tconst restore = isWritableItemLifecycle(live.state().lifecycleStatus) ? live.serialize() : (itemSession ?? live.serialize());\n\t\tconst session = this.getItemDefinition(q).openSession({ restore, presentation: next });\n\t\tthis.releaseCurrentItemSession();\n\t\tthis.attachCurrentItemSession(q, session, next);\n\t\tthis.notifyItemChange();\n\t}\n\n\tprivate getItemDefinition(q: FlatItem): AssessmentItemDefinition {\n\t\tconst cached = this.itemDefinitions.get(q.identifier);\n\t\tif (cached) return cached;\n\n\t\tconst definition = createAssessmentItemDefinition({\n\t\t\titemXml: q.item.itemXml,\n\t\t\t// The assessment host chooses the authorized delivery role. Item refs are\n\t\t\t// content records and must not silently widen or narrow session capabilities.\n\t\t\trole: this.config.role ?? 'candidate',\n\t\t\ti18nProvider: this.i18nProvider,\n\t\t\tpnp: this.config.pnp,\n\t\t\tsecurity: this.config.security,\n\t\t\tpci: this.config.pci,\n\t\t\tplugins: this.config.plugins,\n\t\t\tdeliveryContext: q.item.deliveryContext,\n\t\t\t...(this.config.stringComparison ? { stringComparison: this.config.stringComparison } : {}),\n\t\t});\n\t\tthis.itemDefinitions.set(q.identifier, definition);\n\t\treturn definition;\n\t}\n\n\tprivate mirrorSessionResponses(\n\t\titemIdentifier: string,\n\t\tresponses: Readonly<Record<string, unknown>>,\n\t): boolean {\n\t\treturn this.sessionCoordinator.mirrorResponses(itemIdentifier, responses);\n\t}\n\n\tprivate attachCurrentItemSession(q: FlatItem, session: ItemSession, presentation?: PresentationPolicy): void {\n\t\tthis.currentItemSession = session;\n\t\tthis.liveSessionPresentation = presentation ?? null;\n\t\tthis.currentItemSessionUnsubscribe = session.subscribe((transition) => {\n\t\t\tif (this.currentItemSession !== session) return;\n\t\t\tif (this.mirrorSessionResponses(q.identifier, transition.current.responses)) {\n\t\t\t\tthis.notifyResponseChange();\n\t\t\t}\n\t\t\tthis.scheduleEndAttemptSubmission(q, session, transition);\n\t\t});\n\t}\n\n\t/** The item's endAttemptInteraction bindings, parsed from its item XML once and cached. */\n\tprivate endAttemptResponseMap(q: FlatItem): Map<string, boolean> {\n\t\tlet map = this.endAttemptResponses.get(q.identifier);\n\t\tif (!map) {\n\t\t\tmap = new Map();\n\t\t\tfor (const info of endAttemptInteractionInfo(q.item.itemXml)) {\n\t\t\t\tmap.set(info.responseIdentifier, info.countAttempt);\n\t\t\t}\n\t\t\tthis.endAttemptResponses.set(q.identifier, map);\n\t\t}\n\t\treturn map;\n\t}\n\n\t/**\n\t * QTI endAttempt on the response path: a candidate activating an endAttemptInteraction writes\n\t * its boolean response. Assessment delivery decides what that means — the item session is\n\t * owned here and must never be closed by a renderer. In a simultaneous test part the response\n\t * processing is deferred to the end of the part, so the response is recorded like any other.\n\t * In an individual test part the item is submitted through the normal per-item path with the\n\t * interaction's countAttempt honored; the candidate stays on the item.\n\t */\n\tprivate scheduleEndAttemptSubmission(q: FlatItem, session: ItemSession, transition: ItemSessionTransition): void {\n\t\tconst command = transition.command;\n\t\tif (command.action !== 'setResponse') return;\n\t\tconst responseId = command.responseIdentifier;\n\t\t// Only the change to true activates the interaction; re-writing the value is inert.\n\t\tif (transition.current.responses[responseId] !== true || transition.previous.responses[responseId] === true) {\n\t\t\treturn;\n\t\t}\n\t\tconst countAttempt = this.endAttemptResponseMap(q).get(responseId);\n\t\tif (countAttempt === undefined) return;\n\t\tif (q.testPart.submissionMode !== 'individual') return;\n\n\t\tqueueMicrotask(() => {\n\t\t\tvoid this.runExclusive(async () => {\n\t\t\t\tif (\n\t\t\t\t\tthis.destroyed ||\n\t\t\t\t\tthis.finalized ||\n\t\t\t\t\tthis.currentItemSession !== session ||\n\t\t\t\t\tthis.items[this.currentItemIndex] !== q\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (!isWritableItemLifecycle(session.state().lifecycleStatus)) return;\n\t\t\t\tawait this.submitCurrentItemInternal({ countAttempt, followBranching: false });\n\t\t\t}).catch((error) => {\n\t\t\t\t// A concurrent navigation or submission owns the transition; its own path submits\n\t\t\t\t// this response. Anything else surfaces to the host without breaking delivery.\n\t\t\t\tif (isAssessmentPlayerError(error) && error.code === 'navigationInFlight') return;\n\t\t\t\tthis.config.onError?.(error instanceof Error ? error : new Error(String(error)));\n\t\t\t});\n\t\t});\n\t}\n\n\tprivate releaseCurrentItemSession(): void {\n\t\tthis.currentItemSessionUnsubscribe?.();\n\t\tthis.currentItemSessionUnsubscribe = null;\n\t\tthis.currentItemSession?.dispose();\n\t\tthis.currentItemSession = null;\n\t}\n\n\t/**\n\t * Freeze the live attempt for a proctor pause: suspend it (its responses become\n\t * read-only and its QTI `duration` is captured in the persisted snapshot). The\n\t * suspended session stays attached so the item keeps rendering, disabled, behind the\n\t * pause; `reopenLiveSessionAfterPause()` reopens it from the snapshot so the paused\n\t * time never counts as time on task.\n\t */\n\tprivate suspendLiveSessionForPause(): void {\n\t\tif (this.suspendedForPause) return;\n\t\tconst session = this.currentItemSession;\n\t\tif (!session || !isWritableItemLifecycle(session.state().lifecycleStatus)) return;\n\t\tthis.saveCurrentItemSession();\n\t\tthis.suspendedForPause = true;\n\t}\n\n\t/** Reopen the attempt a proctor pause froze, at the exact state the pause captured. */\n\tprivate reopenLiveSessionAfterPause(): void {\n\t\tif (!this.suspendedForPause) return;\n\t\tthis.suspendedForPause = false;\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tconst snapshot = q ? this.state.itemSessions?.[q.identifier] : undefined;\n\t\tif (!q || !snapshot) return;\n\t\tthis.releaseCurrentItemSession();\n\t\tconst presentation = this.presentationFor(q);\n\t\tthis.attachCurrentItemSession(\n\t\t\tq,\n\t\t\tthis.getItemDefinition(q).openSession({\n\t\t\t\trestore: snapshot,\n\t\t\t\tactivate: true,\n\t\t\t\tpresentation,\n\t\t\t}),\n\t\t\tpresentation,\n\t\t);\n\t}\n\n\t/**\n\t * Get the current session state snapshot (client-side view).\n\t * Note: backend remains authoritative; this is intended for simple save/resume.\n\t */\n\tpublic getState(options: { includeItemSessions?: boolean } = {}): AssessmentSessionState {\n\t\tconst snapshot = this.sessionCoordinator.snapshot(options);\n\t\t// Every item the candidate has been presented is visited (not only submitted ones),\n\t\t// so the review screen's \"not yet visited\" marks survive a reload.\n\t\tconst visited = new Set(snapshot.visitedItems);\n\t\tfor (const index of this.navigationManager.getVisited()) {\n\t\t\tconst identifier = this.items[index]?.identifier;\n\t\t\tif (identifier) visited.add(identifier);\n\t\t}\n\t\tsnapshot.visitedItems = this.items.map((q) => q.identifier).filter((identifier) => visited.has(identifier));\n\t\tconst current = this.items[this.currentItemIndex];\n\t\tif (options.includeItemSessions && current && this.currentItemSession && !this.paused) {\n\t\t\t// Navigation snapshots may predate edits made after revisiting this item.\n\t\t\t// Serialize the live authority without suspending the learner's attempt.\n\t\t\t// (While paused, the snapshot taken at the pause is current: serializing the\n\t\t\t// suspended session would count the paused time as time on task.)\n\t\t\tsnapshot.itemSessions = {\n\t\t\t\t...snapshot.itemSessions,\n\t\t\t\t[current.identifier]: this.currentItemSession.serialize(),\n\t\t\t};\n\t\t}\n\t\tconst timing = this.timeManager?.getState();\n\t\tif (timing) {\n\t\t\tsnapshot.timing = {\n\t\t\t\tstartedAt: timing.startedAt,\n\t\t\t\titemTimes: { ...timing.itemTimes },\n\t\t\t\tsectionTimes: { ...timing.sectionTimes },\n\t\t\t\ttestPartTimes: { ...timing.testPartTimes },\n\t\t\t\ttotalTime: timing.totalElapsed,\n\t\t\t\tcurrentItemIdentifier: timing.currentItemId,\n\t\t\t\tcurrentSectionIdentifier: timing.currentSectionId,\n\t\t\t\tcurrentTestPartIdentifier: timing.currentTestPartId,\n\t\t\t\t// The proctor pause, not the begin gate's hold: a restored snapshot reopens\n\t\t\t\t// paused only when a proctor paused it.\n\t\t\t\tisPaused: this.paused,\n\t\t\t\t...(this.paused && this.pauseReason ? { pauseReason: this.pauseReason } : {}),\n\t\t\t};\n\t\t}\n\t\treturn snapshot;\n\t}\n\n\t/**\n\t * Restore a previously saved session state.\n\t */\n\tpublic restoreState(state: AssessmentSessionState): Promise<void> {\n\t\treturn this.runExclusive(async () => {\n\t\t\tthis.sessionCoordinator.restoreState(state);\n\t\t\tthis.seedSubmittedResponses(state);\n\t\t\tthis.restoreTimeTracking(state.timing);\n\t\t\t// The snapshot's clocks are the time accounting from here on: expiries are\n\t\t\t// recomputed from them before any item is entered, so a scope that already ran\n\t\t\t// out never reopens editable (and one that has not is not held locked).\n\t\t\tthis.scopeLocks.clear();\n\t\t\tthis.assessmentExpired = false;\n\t\t\tthis.restoredExpiryFinalizeScheduled = false;\n\t\t\tthis.timeManager?.resetExpiryRecord();\n\t\t\tthis.lockExpiredScopesFromClocks(state.timing);\n\t\t\tthis.templateDefaultsByPart.clear();\n\t\t\t// The snapshot replaces delivery — kept branch decisions included, so a restored\n\t\t\t// session lands identically (a snapshot from before the feature simply carries\n\t\t\t// none). The test outcomes ride it too: the delivery rules read the values the\n\t\t\t// session's submissions produced, as the live session did. The snapshot carries\n\t\t\t// the proctor pause; the begin gate keeps holding the clocks.\n\t\t\tthis.testOutcomes = state.testOutcomes ? cloneData(state.testOutcomes)! : null;\n\t\t\tconst pauseChanged = this.pauseControl.setFromRestore(state.timing?.isPaused === true, state.timing?.pauseReason);\n\t\t\tif (!this.started) this.timeManager?.pause();\n\n\t\t\t// Restore visited state for UI navigation hints.\n\t\t\tthis.navigationManager.restoreState(this.visitedIndexes(state.visitedItems));\n\n\t\t\t// Behind a begin gate no item is entered yet: start() enters the restored one.\n\t\t\tlet deadEnd = false;\n\t\t\tif (this.started) {\n\t\t\t\tconst currentId = state.currentItemIdentifier;\n\t\t\t\tconst idx = currentId ? this.items.findIndex((q) => q.identifier === currentId) : -1;\n\t\t\t\tconst requested = idx >= 0 ? idx : this.items.length > 0 ? 0 : -1;\n\t\t\t\tif (requested >= 0) {\n\t\t\t\t\tconst entry = this.restoringEntryTarget(requested);\n\t\t\t\t\tdeadEnd = entry.deadEnd;\n\t\t\t\t\tawait this.performNavigateTo(entry.index, { restoring: true });\n\t\t\t\t}\n\t\t\t\t// The (re-)entry succeeded: a previous entry failure is repaired.\n\t\t\t\tthis.entryError = null;\n\t\t\t\tthis.pendingEntryIndex = null;\n\t\t\t}\n\t\t\tif (pauseChanged) this.notifyPauseChange();\n\t\t\tif (deadEnd) this.notifyExpiryDeadEnd();\n\t\t\tthis.finalizeRestoredExpiryWhenRunning();\n\t\t\t// A host-restored snapshot is the new draft; the save runs once this settles.\n\t\t\tthis.notifyAutosaveActivity();\n\t\t});\n\t}\n\n\tprivate restoreTimeTracking(timing: AssessmentSessionState['timing']): void {\n\t\tthis.timeManager?.restoreState({\n\t\t\ttotalElapsed: timing.totalTime,\n\t\t\titemTimes: { ...timing.itemTimes },\n\t\t\tsectionTimes: { ...(timing.sectionTimes ?? {}) },\n\t\t\ttestPartTimes: { ...(timing.testPartTimes ?? {}) },\n\t\t\tstartedAt: timing.startedAt,\n\t\t\tcurrentItemId: timing.currentItemIdentifier,\n\t\t\tcurrentSectionId: timing.currentSectionIdentifier,\n\t\t\tcurrentTestPartId: timing.currentTestPartIdentifier,\n\t\t\tisPaused: timing.isPaused === true,\n\t\t});\n\t}\n\n\t/**\n\t * Navigate to an item by index. Serialized with all other navigation and submission\n\t * transitions: while one is in flight this rejects with a `navigationInFlight` error,\n\t * and once the test has finalized it rejects with `testFinalized`.\n\t */\n\tpublic navigateTo(index: number, options: { restoring?: boolean } = {}): Promise<void> {\n\t\treturn this.runCandidateTransition(() => this.performNavigateTo(index, options));\n\t}\n\n\tprivate async performNavigateTo(index: number, options: { restoring?: boolean } = {}): Promise<void> {\n\t\tif (index < 0 || index >= this.items.length) {\n\t\t\tthrow new AssessmentPlayerError('invalidNavigationTarget', `Invalid item index: ${index}`, { index });\n\t\t}\n\t\tif (this.finalized && !options.restoring) {\n\t\t\tthrow new AssessmentPlayerError(\n\t\t\t\t'testFinalized',\n\t\t\t\t'Cannot navigate: the assessment has ended.',\n\t\t\t);\n\t\t}\n\n\t\t// Enforce navigation rules (UI hints, still backend-authoritative for real deployments).\n\t\tif (!options.restoring && this.currentItemIndex >= 0 && !this.canNavigateByTestPart(index, this.currentItemIndex)) {\n\t\t\tconst currentMode = this.items[this.currentItemIndex]?.testPart.navigationMode;\n\t\t\tif (currentMode === 'linear' && index > this.nextUnlockedIndex(this.currentItemIndex)) {\n\t\t\t\tthrow new AssessmentPlayerError(\n\t\t\t\t\t'linearNavigationOnly',\n\t\t\t\t\t'In linear navigation mode, you can only move to the next question.',\n\t\t\t\t);\n\t\t\t}\n\t\t\tthrow new AssessmentPlayerError('navigationNotAllowed', 'Navigation is not allowed.');\n\t\t}\n\t\tconst target = this.items[index];\n\t\tif (!options.restoring && target && this.isItemLocked(target)) {\n\t\t\tthrow new AssessmentPlayerError('itemTimeExpired', 'The time limit for this question has expired.');\n\t\t}\n\t\tif (!options.restoring && target && !this.canReviewItem(target)) {\n\t\t\tthrow new AssessmentPlayerError(\n\t\t\t\t'reviewNotAllowed',\n\t\t\t\t'You cannot go back to previous questions in this assessment.',\n\t\t\t);\n\t\t}\n\n\t\tconst currentItem = this.items[this.currentItemIndex];\n\t\tif (!options.restoring && currentItem && target) {\n\t\t\tthis.assertTransitionMinimum(currentItem, target);\n\t\t\t// QTI parts cannot be re-entered: a candidate-initiated step into the next part\n\t\t\t// refuses while questions of the current part still owe an answer (a left part\n\t\t\t// can never be revisited, and the end of the test only collects unreachable\n\t\t\t// questions as they stand). The move's own submission already ran for next();\n\t\t\t// a direct jump leaves the current item behind, so it is included here.\n\t\t\tif (target.testPart !== currentItem.testPart) this.assertCanLeaveScope(currentItem);\n\t\t\tif (target.testPart !== currentItem.testPart && currentItem.testPart.submissionMode === 'simultaneous') {\n\t\t\t\t// Commit this part before leaving it; a failed request keeps the learner\n\t\t\t\t// in the current part so its remaining answers can be retried.\n\t\t\t\tawait this.submitSimultaneousItems(this.items.filter((q) => q.testPart === currentItem.testPart));\n\t\t\t}\n\t\t}\n\t\tif (!options.restoring && this.currentItemIndex === index && this.currentItemSession) {\n\t\t\treturn;\n\t\t}\n\t\tconst currentSessionStatus = currentItem\n\t\t\t? this.currentItemSession?.state().lifecycleStatus ??\n\t\t\t\tthis.state.itemSessions?.[currentItem.identifier]?.lifecycleStatus\n\t\t\t: undefined;\n\t\tif (\n\t\t\t!options.restoring &&\n\t\t\tthis.currentItemIndex >= 0 &&\n\t\t\tthis.currentItemIndex !== index &&\n\t\t\tcurrentSessionStatus !== 'closed'\n\t\t) {\n\t\t\tthis.saveCurrentItemSession();\n\t\t}\n\t\tif (currentItem && this.currentItemIndex !== index) {\n\t\t\tthis.timeManager?.endItem(currentItem.identifier);\n\t\t}\n\n\t\tthis.currentItemIndex = index;\n\t\tthis.navigationManager.markVisited(index);\n\t\tconst q = this.items[index]!;\n\t\tthis.sessionCoordinator.setCurrentItem(q.identifier);\n\t\tthis.timeManager?.activateScopes({\n\t\t\ttestPart: { identifier: q.testPart.identifier, timeLimits: q.testPart.timeLimits },\n\t\t\tsection: { identifier: q.section.identifier, timeLimits: q.section.timeLimits },\n\t\t\t// Every enclosing section runs its own clock, outermost first.\n\t\t\tsections: q.sections.map((section) => ({\n\t\t\t\tidentifier: section.identifier,\n\t\t\t\ttimeLimits: section.timeLimits,\n\t\t\t})),\n\t\t\titem: { identifier: q.identifier, timeLimits: q.item.timeLimits },\n\t\t});\n\n\t\t// Restore responses into one live session owned by the assessment. The section\n\t\t// composition and item renderer receive this exact object.\n\t\tconst responses = this.sessionCoordinator.activateItem(q.identifier);\n\t\tconst restoredItemSession = this.state.itemSessions?.[q.identifier];\n\t\tthis.releaseCurrentItemSession();\n\t\tconst presentation = this.presentationFor(q);\n\t\tconst session = this.getItemDefinition(q).openSession({\n\t\t\trestore: restoredItemSession,\n\t\t\tresponses: restoredItemSession ? undefined : responses,\n\t\t\tactivate: true,\n\t\t\ttemplateDefaults: restoredItemSession ? undefined : this.templateDefaultsFor(q),\n\t\t\tpresentation,\n\t\t});\n\t\tthis.attachCurrentItemSession(q, session, presentation);\n\t\tthis.suspendedForPause = false;\n\t\t// An expired limit closed this item (a restoring entry at an expiry dead end, or a\n\t\t// branch into a closed scope): it shows read-only, never editable.\n\t\tif (this.isItemLocked(q)) this.saveCurrentItemSession();\n\t\t// Entered during a proctor pause (a restore, or a held start): the attempt stays frozen.\n\t\tif (this.paused) this.suspendLiveSessionForPause();\n\n\t\tthis.notifyItemChange();\n\t\tthis.notifySectionChange();\n\t\tif (currentItem?.testPart.identifier !== q.testPart.identifier) this.notifyTestFeedbackChange();\n\t}\n\n\t/**\n\t * Navigate to a section by identifier. Legal targets only: a presented (visible)\n\t * section reachable under the current navigationMode. Illegal jumps reject with a\n\t * typed `AssessmentPlayerError` instead of throwing plain errors.\n\t */\n\tpublic navigateToSection(sectionId: string): Promise<void> {\n\t\treturn this.runCandidateTransition(async () => {\n\t\t\tif (this.finalized) {\n\t\t\t\tthrow new AssessmentPlayerError(\n\t\t\t\t\t'testFinalized',\n\t\t\t\t\t`Cannot navigate to section \"${sectionId}\": the assessment has ended.`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst idx = this.items.findIndex((q) =>\n\t\t\t\tq.sections.some((s) => s.identifier === sectionId),\n\t\t\t);\n\t\t\tif (idx < 0) {\n\t\t\t\tthrow new AssessmentPlayerError(\n\t\t\t\t\t'invalidNavigationTarget',\n\t\t\t\t\t`Unknown section: ${sectionId}`,\n\t\t\t\t\t{ sectionId },\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst presented = this.presentedSectionList().find((s) => s.identifier === sectionId);\n\t\t\tif (!presented || !this.isLegalSectionTarget(presented)) {\n\t\t\t\tthrow new AssessmentPlayerError(\n\t\t\t\t\t'navigationNotAllowed',\n\t\t\t\t\t`Navigation to section \"${sectionId}\" is not allowed.`,\n\t\t\t\t\t{ sectionId },\n\t\t\t\t);\n\t\t\t}\n\t\t\tawait this.performNavigateTo(idx);\n\t\t});\n\t}\n\n\t/** Move forward. Serialized with all other transitions; rejects as busy while one is in flight. */\n\tpublic next(): Promise<void> {\n\t\treturn this.runCandidateTransition(() => this.performNext());\n\t}\n\n\tprivate async performNext(): Promise<void> {\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tif (!q || this.finalized) return;\n\t\tconst responses = this.sessionCoordinator.getActiveResponses();\n\t\t// In individual submission mode the move submits the current item unless its attempts\n\t\t// are used up, it is already closed, or its recorded result already carries these exact\n\t\t// responses (a practice item moved on unchanged): the backend then decides where it goes.\n\t\tconst submits = this.nextSubmits(q, responses);\n\t\t// A move that submits nothing follows the backend's decision kept for this item (a\n\t\t// check's, an end-attempt's, a branch exit held back, an end of the test that did not\n\t\t// complete); with none on record, the delivery rules decide (`ruleForwardIndex`).\n\t\tconst kept = submits ? null : this.keptBranchDecisionFor(q);\n\t\t// Next from a simultaneous part's last item always crosses (or ends the test): the\n\t\t// part commits at the crossing, and only then is a decision on record to follow.\n\t\tconst crossesSimultaneousPart =\n\t\t\t!submits && !kept && this.crossingFlushDue(q);\n\t\t// On a crossing the pre-flush rule result is provisional: the flush can still change\n\t\t// the outcomes the rules read, so the landing is computed again after it.\n\t\tconst forward = crossesSimultaneousPart\n\t\t\t? this.nextUnlockedIndex(q.index)\n\t\t\t: submits\n\t\t\t\t? this.nextUnlockedIndex(q.index)\n\t\t\t\t: kept\n\t\t\t\t\t? -1\n\t\t\t\t\t: this.ruleForwardIndex(q);\n\t\tif (!kept && forward < 0 && !crossesSimultaneousPart) return;\n\n\t\tthis.sessionCoordinator.markAnswered(q.identifier, responses);\n\t\t// QTI allowSkipping (individual parts only): an item that is about to be submitted\n\t\t// without any response may only be skipped when skipping is allowed. A simultaneous\n\t\t// part, an item already closed, or one an expired limit closed (collected as it\n\t\t// stands) is never held here.\n\t\tif (submits && !this.isItemLocked(q) && this.submissionGate(q, responses).mustAnswer) {\n\t\t\tthrow new AssessmentPlayerError('responseRequired', 'You must answer this question before continuing.');\n\t\t}\n\t\t// A step out of the part (the next item lies in the next part, or a kept decision\n\t\t// leaves it) is refused before anything is submitted while another question of the\n\t\t// part still owes an answer: the part cannot be re-entered. The current item is this\n\t\t// move's own submission (or already accepted as it stands).\n\t\tconst leavesPart = kept\n\t\t\t? this.branchExitLeavesPart(q, kept)\n\t\t\t: crossesSimultaneousPart || this.items[forward]!.testPart !== q.testPart;\n\t\tif (leavesPart && !this.isItemLocked(q)) this.assertCanLeaveScope(q, { exclude: q });\n\t\tif (submits) {\n\t\t\tconst before = this.currentItemIndex;\n\t\t\tthis.clearKeptBranchDecisions();\n\t\t\tawait this.submitCurrentItemInternal();\n\t\t\t// The submission may branch, navigate, or finalize the test (EXIT_TEST); in those\n\t\t\t// cases navigation stops here. So does a scope expiry that fired while the\n\t\t\t// submission was in flight: its hop is queued behind this transition and moves\n\t\t\t// delivery (its routing decides where an open question is).\n\t\t\tif (this.currentItemIndex !== before || this.finalized || this.queuedExpiryHops > 0) return;\n\t\t} else if (kept) {\n\t\t\t// The decision the backend made for this item's accepted submission is followed now.\n\t\t\t// The move submits nothing, so its minimum times are checked here (an end of the\n\t\t\t// test checks its own). One that can no longer be followed (it would re-enter a part\n\t\t\t// already left) leaves the forward step to the delivery rules.\n\t\t\tconst target = this.items[this.branchTargetIndex(q, kept)];\n\t\t\tif (target && !this.isItemLocked(q)) this.assertTransitionMinimum(q, target);\n\t\t\tconst before = this.currentItemIndex;\n\t\t\tawait this.followBranch(q, kept);\n\t\t\tif (this.currentItemIndex !== before || this.finalized) return;\n\t\t} else if (crossesSimultaneousPart) {\n\t\t\tawait this.crossSimultaneousPart(q);\n\t\t\treturn;\n\t\t}\n\t\t// The candidate may still return and re-attempt this item: reopen it writable while\n\t\t// attempts remain (a no-op for closed single-attempt or writable items), so the\n\t\t// revisit restores an attemptable state instead of the closed one.\n\t\tthis.reopenForRemainingAttempts(q);\n\t\t// No backend decision moved delivery (none was returned, or it could not be followed):\n\t\t// the delivery rules decide, as the navigation rules check them.\n\t\tconst nextIndex = this.unsubmittedForwardIndex(q);\n\t\tif (nextIndex < 0) return;\n\t\tawait this.performNavigateTo(nextIndex);\n\t}\n\n\t/**\n\t * Leave the simultaneous test part `last` belongs to: its pending responses go out\n\t * first (a failed request throws and keeps the candidate here for a retry), and the\n\t * branch decision the flush returns for the part's last item — the part's testPart\n\t * branchRule ran there, with every item's variables committed — is what delivery\n\t * follows, through `followBranch`'s part-leave, EXIT_TEST and finalized guards. With\n\t * no decision (or one that led nowhere) the delivery rules decide on the committed\n\t * state, honouring the following parts' preconditions.\n\t */\n\tprivate async crossSimultaneousPart(last: FlatItem): Promise<void> {\n\t\tawait this.submitSimultaneousItems(this.items.filter((item) => item.testPart === last.testPart));\n\t\tconst target = this.partCrossingDecisionTarget(last);\n\t\tif (target !== null) {\n\t\t\tconst before = this.currentItemIndex;\n\t\t\tawait this.followBranch(last, target);\n\t\t\tif (this.currentItemIndex !== before || this.finalized) return;\n\t\t}\n\t\t// No decision moved delivery: the delivery rules decide, as the navigation rules\n\t\t// check them — on the state the flush just committed.\n\t\tconst nextIndex = this.unsubmittedForwardIndex(last);\n\t\tif (nextIndex < 0) return;\n\t\tawait this.performNavigateTo(nextIndex);\n\t}\n\n\t/**\n\t * The branch decision a simultaneous part's flush left for its last item, when it takes\n\t * delivery out of the part that is ending. A target inside that part is rejected: the\n\t * part is being left, its responses are out, and its rules cannot deliver into it again.\n\t */\n\tprivate partCrossingDecisionTarget(last: FlatItem): string | null {\n\t\tconst target = this.keptBranchDecisionFor(last);\n\t\tif (!target) return null;\n\t\tconst targetIndex = this.indexOfItem(target);\n\t\tif (targetIndex >= 0 && this.items[targetIndex]!.testPart === last.testPart) return null;\n\t\treturn target;\n\t}\n\n\t/** Whether the delivered item after `q` lies outside `q`'s test part (or nothing does). */\n\tprivate endsTestPart(q: FlatItem): boolean {\n\t\treturn this.items[q.index + 1]?.testPart !== q.testPart;\n\t}\n\n\t/** The part's effective QTI submission mode. */\n\tprivate isSimultaneousSubmission(q: FlatItem): boolean {\n\t\treturn q.testPart.submissionMode === 'simultaneous';\n\t}\n\n\t/**\n\t * Whether `next()` from the item submits it: an individual part's item whose attempts\n\t * remain, that is not closed, and whose responses differ from its last counted submission\n\t * (or that has none).\n\t */\n\tprivate nextSubmits(q: FlatItem, responses = this.sessionCoordinator.getActiveResponses()): boolean {\n\t\treturn (\n\t\t\tthis.isIndividual(q) &&\n\t\t\tthis.sessionCoordinator.canSubmit(q.identifier) &&\n\t\t\tthis.itemLifecycleOf(q.identifier) !== 'closed' &&\n\t\t\t!this.responsesUnchangedSinceSubmission(q.identifier, responses)\n\t\t);\n\t}\n\n\t/**\n\t * The backend's decisions for leaving an item (`nextItemIdentifier`), keyed per item on\n\t * the session state (`state.branchDecisions`) with that item's last-submission record,\n\t * so a restored session lands identically. A counted submission that stays on the item\n\t * (a practice check, a counted endAttemptInteraction) keeps its decision; so does a\n\t * branch exit refused while questions of the part still owed an answer, and a\n\t * simultaneous part's crossing flush keeps the decision made for its last item. The next\n\t * forward step from that item that submits nothing — the candidate moves on with the\n\t * response unchanged — follows it; a changed response re-submits and the fresh decision\n\t * replaces it. At most the freshest decision is kept: any later counted submission voids\n\t * the earlier ones (the outcomes they were decided on have moved), and following a\n\t * decision clears it.\n\t */\n\n\t/** The backend decision kept for `q` that delivery has not followed yet (its target). */\n\tprivate keptDecisionTarget(q: FlatItem): string | null {\n\t\treturn this.sessionCoordinator.getBranchDecision(q.identifier) ?? null;\n\t}\n\n\t/** Keep `target` as the one decision delivery may still follow — the item's freshest. */\n\tprivate keepBranchDecision(q: FlatItem, target: string): void {\n\t\tthis.sessionCoordinator.keepBranchDecision(q.identifier, target);\n\t}\n\n\t/** Every kept decision is void: a counted submission moved the outcomes they decided on. */\n\tprivate clearKeptBranchDecisions(): void {\n\t\tthis.sessionCoordinator.clearBranchDecisions();\n\t}\n\n\t/**\n\t * The backend decision kept for leaving `q` — its item's entry in the session state\n\t * (`branchDecisions`), made by `q`'s last counted submission — if delivery has not\n\t * followed it yet. A decision onto an item an expired time limit has closed since is\n\t * passed over like the item itself: the delivery rules then find the next open item.\n\t */\n\tprivate keptBranchDecisionFor(q: FlatItem): string | null {\n\t\tconst target = this.keptDecisionTarget(q);\n\t\tif (!target) return null;\n\t\tconst targetItem = this.items[this.indexOfItem(target)];\n\t\treturn targetItem && this.isItemLocked(targetItem) ? null : target;\n\t}\n\n\t/**\n\t * Where the candidate's Next goes from `q`: when it submits the item — or crosses out of\n\t * a simultaneous part whose responses still have to go out (`crossingFlushDue`) — the\n\t * backend decides once the submissions are accepted (the adjacent open item stands for\n\t * that decision until then; the pre-flush rules read uncommitted state); otherwise the\n\t * destination is known now (`unsubmittedForwardIndex`). -1 when nothing follows — Submit\n\t * is the way on.\n\t */\n\tprivate forwardStepIndex(q: FlatItem): number {\n\t\treturn this.nextSubmits(q) || this.crossingFlushDue(q)\n\t\t\t? this.nextUnlockedIndex(q.index)\n\t\t\t: this.unsubmittedForwardIndex(q);\n\t}\n\n\t/**\n\t * Whether `next()` from `q` crosses out of its simultaneous part with some of the part's\n\t * responses not yet accepted: the crossing flushes them, and that flush decides the landing.\n\t */\n\tprivate crossingFlushDue(q: FlatItem): boolean {\n\t\treturn (\n\t\t\tthis.endsTestPart(q) &&\n\t\t\tthis.isSimultaneousSubmission(q) &&\n\t\t\t!this.keptBranchDecisionFor(q) &&\n\t\t\tthis.items.some((item) => item.testPart === q.testPart && this.itemNeedsSubmission(item))\n\t\t);\n\t}\n\n\t/**\n\t * Where a forward step from `q` that submits nothing lands — a move on after a practice\n\t * check, a move out of a simultaneous part, a jump into the next test part: the backend's\n\t * decision kept for `q`, else the next item the delivery rules make eligible\n\t * (`ruleForwardIndex`). -1 when nothing follows (an EXIT_* decision nothing follows, or\n\t * nothing eligible). A decision whose literal target resolves to nothing forward is\n\t * skipped — the rule does not fire — so the delivery rules decide, exactly as the\n\t * backend's own walk falls through from an unresolvable target.\n\t */\n\tprivate unsubmittedForwardIndex(q: FlatItem): number {\n\t\tconst kept = this.keptBranchDecisionFor(q);\n\t\tif (!kept) return this.ruleForwardIndex(q);\n\t\tconst landing = branchLandingOf(kept, this.branchTargetIndex(q, kept));\n\t\tswitch (landing.kind) {\n\t\t\tcase 'item':\n\t\t\t\treturn landing.index;\n\t\t\tcase 'exit':\n\t\t\t\t// Nothing follows the EXIT_* boundary; Submit is the way on (its own handling\n\t\t\t\t// ends the scope or the test — see `followBranch`).\n\t\t\t\treturn -1;\n\t\t\tcase 'skipped':\n\t\t\t\treturn this.ruleForwardIndex(q);\n\t\t}\n\t}\n\n\t/**\n\t * The next item after `q` when no backend decision applies, by the reference backend's own\n\t * rules (`nextItemIdentifier`): branch rules first — in a linear part the item's and those\n\t * of each section it ends, the test part's at its end — then preconditions: a test part's on\n\t * entering it in any navigation mode, a linear part's sections and items on reaching them.\n\t * They read the test outcomes the backend last returned and the recorded variables of every\n\t * item it accepted (`ITEM.VARIABLE`), as the backend does. Items an expired time limit closed\n\t * are passed over. A test without branch rules or preconditions moves to the adjacent open item.\n\t */\n\tprivate ruleForwardIndex(q: FlatItem): number {\n\t\tif (!this.hasDeliveryRules) return this.nextUnlockedIndex(q.index);\n\t\tconst decls = this.navigationDeclarationsFor(q);\n\t\tconst first = this.indexOfItem(\n\t\t\tnextItemIdentifier(this.deliveredForRules, q.index, decls, Math.random, this.reportTestConditionFailure),\n\t\t);\n\t\tif (first < 0) return -1;\n\t\tif (!this.isItemLocked(this.items[first]!)) return first;\n\t\tfor (const index of this.eligibleIndexesAfter(first, decls)) {\n\t\t\tif (!this.isItemLocked(this.items[index]!)) return index;\n\t\t}\n\t\treturn -1;\n\t}\n\n\t/**\n\t * The items the delivery rules reach after `fromIndex`, in order: each one whose\n\t * preconditions hold as the sequence enters its test part (any navigation mode) and, in a\n\t * linear part, its sections and the item itself. Without rules, every following item.\n\t */\n\tprivate *eligibleIndexesAfter(fromIndex: number, decls?: DeclarationMap): Generator<number> {\n\t\tif (!this.hasDeliveryRules) {\n\t\t\tfor (let index = fromIndex + 1; index < this.items.length; index++) yield index;\n\t\t\treturn;\n\t\t}\n\t\tconst from = this.items[fromIndex];\n\t\tif (!from) return;\n\t\tconst declarations = decls ?? this.navigationDeclarationsFor(from);\n\t\tlet previous = this.deliveredForRules[fromIndex];\n\t\tlet start = fromIndex + 1;\n\t\twhile (start < this.items.length) {\n\t\t\tconst index = this.indexOfItem(\n\t\t\t\tfirstEligibleItem(\n\t\t\t\t\tthis.deliveredForRules,\n\t\t\t\t\tstart,\n\t\t\t\t\tprevious,\n\t\t\t\t\tdeclarations,\n\t\t\t\t\tMath.random,\n\t\t\t\t\tthis.reportTestConditionFailure,\n\t\t\t\t),\n\t\t\t);\n\t\t\tif (index < 0) return;\n\t\t\tyield index;\n\t\t\tprevious = this.deliveredForRules[index];\n\t\t\tstart = index + 1;\n\t\t}\n\t}\n\n\t/**\n\t * The declarations branch rules and preconditions read, built as the reference backend\n\t * builds them for a decision about leaving `from`: the test outcomes the backend last\n\t * returned, every item with a recorded result as `ITEM.VARIABLE` (an item without one reads\n\t * as NULL), and `from`'s own variables unprefixed where the test declares no such outcome.\n\t */\n\tprivate navigationDeclarationsFor(from: FlatItem): DeclarationMap {\n\t\tconst recorded: Record<string, Record<string, QtiValue>> = {};\n\t\tfor (const item of this.items) {\n\t\t\tconst scoring = this.state.itemScores?.[item.identifier];\n\t\t\tif (!scoring && !this.sessionCoordinator.hasItemResult(item.identifier)) continue;\n\t\t\tconst variables = recordedItemVariableValues(this.state.itemSessions?.[item.identifier], scoring?.outcomeValues);\n\t\t\tif (scoring && !variables.SCORE) variables.SCORE = { kind: 'value', baseType: 'float', cardinality: 'single', value: scoring.score };\n\t\t\trecorded[item.identifier] = applyVariableMappings(variables, item.item.variableMappings);\n\t\t}\n\t\treturn addItemVariableDeclarations(\n\t\t\ttestOutcomeDeclarations(this.assessment, this.testOutcomes ?? this.sessionCoordinator.getTestOutcomes()),\n\t\t\trecorded,\n\t\t\trecorded[from.identifier] ?? {},\n\t\t);\n\t}\n\n\tprivate indexOfItem(identifier: string | undefined): number {\n\t\treturn identifier === undefined ? -1 : (this.indexByIdentifier.get(identifier) ?? -1);\n\t}\n\n\t/** The forward step, computed at most once for a batch of legality checks. */\n\tprivate lazyForward(): () => number {\n\t\tlet forward: number | undefined;\n\t\treturn () => {\n\t\t\tif (forward === undefined) {\n\t\t\t\tconst current = this.items[this.currentItemIndex];\n\t\t\t\tforward = current ? this.unsubmittedForwardIndex(current) : -1;\n\t\t\t}\n\t\t\treturn forward;\n\t\t};\n\t}\n\n\t/**\n\t * Whether the item's last counted submission already carried these responses.\n\t * False when nothing was recorded: the caller then submits as usual.\n\t */\n\tprivate responsesUnchangedSinceSubmission(\n\t\titemIdentifier: string,\n\t\tresponses?: Record<string, unknown>,\n\t): boolean {\n\t\tconst submitted = this.lastSubmittedResponses.get(itemIdentifier);\n\t\tif (!submitted) return false;\n\t\tconst current = responses ?? this.sessionCoordinator.getActiveResponses();\n\t\treturn responseValuesEqual(submitted, current);\n\t}\n\n\t/**\n\t * Seed the submitted-response memory from a restored snapshot: an item whose recorded\n\t * result the snapshot carries was accepted with exactly those responses, so moving on\n\t * (or finalizing) with them unchanged re-submits nothing and re-spends no attempt.\n\t */\n\tprivate seedSubmittedResponses(state: AssessmentSessionState): void {\n\t\tconst scores = state.itemScores ?? {};\n\t\tfor (const [itemIdentifier, responses] of Object.entries(state.itemResponses ?? {})) {\n\t\t\tif (!scores[itemIdentifier]) continue;\n\t\t\tif (this.lastSubmittedResponses.has(itemIdentifier)) continue;\n\t\t\tthis.lastSubmittedResponses.set(\n\t\t\t\titemIdentifier,\n\t\t\t\tcloneResponseRecord(responses as Record<string, unknown>),\n\t\t\t);\n\t\t}\n\t}\n\n\t/** Move back. Serialized with all other transitions; rejects as busy while one is in flight. */\n\tpublic previous(): Promise<void> {\n\t\treturn this.runCandidateTransition(async () => {\n\t\t\tconst state = this.getNavigationState();\n\t\t\tif (!state.canPrevious) return;\n\t\t\tawait this.performNavigateTo(this.currentItemIndex - 1);\n\t\t});\n\t}\n\n\t/**\n\t * Submit current item (server-side scoring). Serialized with all other navigation and\n\t * submission transitions; rejects as busy while one is in flight.\n\t */\n\tpublic submitCurrentItem(): Promise<ItemResult> {\n\t\treturn this.runCandidateTransition(() => this.submitCurrentItemInternal());\n\t}\n\n\t/**\n\t * Whether the shell should offer the item-level \"Check answer\" control on the active\n\t * item, with the attempt facts it displays. The control exists only in `individual`\n\t * submission-mode parts where more than one attempt is allowed (or the item is\n\t * adaptive): QTI shows feedback for every non-final attempt then, whatever\n\t * `showFeedback` says, so checking in place always reveals something. A single\n\t * attempt keeps the submit-on-move delivery (its feedback, under `showFeedback`, rides\n\t * the transition); QTI simultaneous parts have no per-item submission.\n\t */\n\tpublic getCheckAnswerState(): CheckAnswerState | null {\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tif (!q) return null;\n\t\tconst id = q.identifier;\n\t\tconst mode = q.testPart.submissionMode;\n\t\tconst adaptive = isAdaptiveItemXml(q.item.itemXml);\n\t\tif (mode !== 'individual') {\n\t\t\treturn {\n\t\t\t\tavailable: false,\n\t\t\t\treason: 'simultaneous',\n\t\t\t\tadaptive,\n\t\t\t\tattemptsUsed: 0,\n\t\t\t\tmaxAttempts: null,\n\t\t\t\tremainingAttempts: null,\n\t\t\t\tattemptsExhausted: false,\n\t\t\t};\n\t\t}\n\t\tconst info = this.sessionCoordinator.getItemSessionInfo(id);\n\t\tconst maxAttempts = resolveMaxAttempts(this.sessionCoordinator.getItemSettings(id), adaptive);\n\t\tconst remainingAttempts = maxAttempts === null ? null : Math.max(0, maxAttempts - info.attemptCount);\n\t\tconst attemptsExhausted = maxAttempts !== null && info.attemptCount >= maxAttempts;\n\t\t// maxAttempts 1 delivers feedback on the move (submit-on-move): no check control.\n\t\tconst available = maxAttempts === null || maxAttempts > 1;\n\t\treturn {\n\t\t\tavailable,\n\t\t\treason: available ? null : 'feedbackOff',\n\t\t\tadaptive,\n\t\t\tattemptsUsed: info.attemptCount,\n\t\t\tmaxAttempts,\n\t\t\tremainingAttempts,\n\t\t\tattemptsExhausted,\n\t\t};\n\t}\n\n\t/**\n\t * Practice flow: submit the active item through the normal per-item path and STAY on\n\t * it, so its feedback becomes visible (the shell shows `getLastItemFeedback()`).\n\t * The submission counts toward `maxAttempts`; while attempts remain the item reopens\n\t * writable afterwards (non-adaptive items reopen from the pre-submit state with the\n\t * computed outcomes restored), so the candidate can revise and check again. Adaptive\n\t * items keep their engine-driven attempt loop. Once the attempts are used up this\n\t * rejects with a coded `maxAttemptsReached`; moving on with `next()` then needs no\n\t * further submission. Serialized with all other transitions.\n\t */\n\tpublic checkCurrentItem(): Promise<ItemResult | null> {\n\t\treturn this.runCandidateTransition(async () => {\n\t\t\tconst q = this.items[this.currentItemIndex];\n\t\t\tif (!q) return null;\n\t\t\tconst state = this.getCheckAnswerState();\n\t\t\tif (!state?.available) {\n\t\t\t\tthrow new AssessmentPlayerError(\n\t\t\t\t\t'navigationNotAllowed',\n\t\t\t\t\t'Checking answers is not available for this item.',\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (state.attemptsExhausted || !this.sessionCoordinator.canSubmit(q.identifier)) {\n\t\t\t\tthrow new AssessmentPlayerError(\n\t\t\t\t\t'maxAttemptsReached',\n\t\t\t\t\t`No attempts remain for item \"${q.identifier}\".`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst live = this.currentItemSession;\n\t\t\tif (live && !isWritableItemLifecycle(live.state().lifecycleStatus)) {\n\t\t\t\t// The attempt already ended (and attempts remain only for adaptive items the\n\t\t\t\t// engine kept open); nothing to check until delivery reopens the item.\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst result = await this.submitCurrentItemInternal({ countAttempt: true, followBranching: false });\n\t\t\tthis.reopenForRemainingAttempts(q);\n\t\t\treturn result;\n\t\t});\n\t}\n\n\t/**\n\t * While counted attempts remain on a non-adaptive item whose attempt just ended (a\n\t * practice check, a submit-on-move the candidate may come back to), reopen it writable\n\t * from that processed attempt: the session keeps the attempt count (the engine restores\n\t * `contextVariables.numAttempts`, so the next counted attempt runs response processing as\n\t * attempt k+1) and the outcomes response processing computed — the integrated feedback\n\t * renders from them while the candidate revises — with its lifecycle set back to\n\t * `interacting`. What the item persists from then on is the attempt the backend accepted.\n\t */\n\tprivate reopenForRemainingAttempts(q: FlatItem): void {\n\t\tif (isAdaptiveItemXml(q.item.itemXml)) return;\n\t\t// Only the item delivery stands on: this swaps the live session, and another\n\t\t// item's is never replaced.\n\t\tif (this.items[this.currentItemIndex] !== q) return;\n\t\t// An item an expired time limit closed stays closed.\n\t\tif (this.isItemLocked(q)) return;\n\t\tconst live = this.currentItemSession;\n\t\tif (!live || live.state().lifecycleStatus !== 'closed') return;\n\t\tif (!this.sessionCoordinator.canSubmit(q.identifier)) return;\n\t\tconst presentation = this.presentationFor(q);\n\t\tconst session = this.getItemDefinition(q).openSession({\n\t\t\trestore: { ...live.serialize(), lifecycleStatus: 'interacting' },\n\t\t\tpresentation,\n\t\t});\n\t\tthis.releaseCurrentItemSession();\n\t\tthis.attachCurrentItemSession(q, session, presentation);\n\t\tthis.notifyItemChange();\n\t}\n\n\t/**\n\t * The item feedback the most recent item-level submission produced (item modal\n\t * feedback from response processing, or the backend's `result.feedback`), or null.\n\t * Shells show it after `checkCurrentItem()` and after a submit-on-move `next()`.\n\t */\n\tpublic getLastItemFeedback(): ItemFeedbackView | null {\n\t\treturn this.lastItemFeedback ? { ...this.lastItemFeedback, feedback: [...this.lastItemFeedback.feedback] } : null;\n\t}\n\n\t/** Discard the captured item feedback once the shell has shown it. */\n\tpublic clearLastItemFeedback(): void {\n\t\tthis.lastItemFeedback = null;\n\t}\n\n\tprivate getLastItemFeedbackFor(itemIdentifier: string): ItemFeedbackView | null {\n\t\treturn this.lastItemFeedback?.itemIdentifier === itemIdentifier ? this.lastItemFeedback : null;\n\t}\n\n\t/**\n\t * Capture an item-level submission's feedback for the shell, under the item's\n\t * attempt-relative feedback visibility (`attemptsAfter`: the counted attempts once this\n\t * submission is recorded). A submission that produces none clears a stale capture for\n\t * the flow that follows it.\n\t */\n\tprivate captureItemFeedback(\n\t\tq: FlatItem,\n\t\tfeedback: ReadonlyArray<{ identifier: string; content: string; title?: string }> | undefined,\n\t\tattemptsAfter: number,\n\t): void {\n\t\tif (!this.feedbackVisible(q, attemptsAfter) || !feedback || feedback.length === 0) {\n\t\t\tthis.lastItemFeedback = null;\n\t\t\treturn;\n\t\t}\n\t\tthis.lastItemFeedback = {\n\t\t\titemIdentifier: q.identifier,\n\t\t\tfeedback: cloneData([...feedback]) as ItemFeedbackEntry[],\n\t\t};\n\t}\n\n\tprivate async submitCurrentItemInternal(\n\t\toptions: { countAttempt?: boolean; followBranching?: boolean } = {},\n\t): Promise<ItemResult> {\n\t\tconst countAttempt = options.countAttempt ?? true;\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tif (!q) throw new AssessmentPlayerError('invalidNavigationTarget', 'No current item');\n\t\t// An expired limit closed this attempt (or a proctor ends the test): neither its\n\t\t// minimum time nor the skipping/validation gates can hold it open, and the backend\n\t\t// receives it as the collection of the responses as they stand.\n\t\tconst submissionReason = this.submissionReasonFor(q);\n\t\tconst administrative = submissionReason !== undefined;\n\t\tif (!administrative) this.assertMinimumTime('item', q);\n\t\tconst responses = this.currentItemSession\n\t\t\t? cloneResponseRecord(this.currentItemSession.state().responses)\n\t\t\t: this.sessionCoordinator.getActiveResponses();\n\t\t// QTI allowSkipping / validateResponses on the per-item path (individual parts only).\n\t\t// A hint (countAttempt=false) is not an attempt and is not held back.\n\t\tconst gate = administrative || !countAttempt ? { mustAnswer: false, validate: false } : this.submissionGate(q, responses);\n\t\tif (gate.mustAnswer) {\n\t\t\tthrow new AssessmentPlayerError('responseRequired', 'You must answer this question before continuing.');\n\t\t}\n\t\tif (gate.validate && !this.responsesSatisfyConstraints(q)) {\n\t\t\tthrow new AssessmentPlayerError(\n\t\t\t\t'attemptValidationFailed',\n\t\t\t\t`Submit failed: the responses for item ${q.identifier} do not satisfy its interactions`,\n\t\t\t);\n\t\t}\n\t\t// The counted attempts once this submission is recorded: feedback visibility is\n\t\t// attempt-relative (a non-final attempt shows feedback whatever showFeedback says).\n\t\tconst attemptsAfter =\n\t\t\tthis.sessionCoordinator.getItemSessionInfo(q.identifier).attemptCount + (countAttempt ? 1 : 0);\n\n\t\tconst submittedAt = Date.now();\n\t\tlet itemSession: SerializedItemSessionState | undefined;\n\t\tconst submittedSession = this.currentItemSession;\n\t\tconst preSubmitSession = submittedSession?.serialize();\n\t\tlet res: Awaited<ReturnType<BackendAdapter['submitResponses']>>;\n\t\ttry {\n\t\t\tif (submittedSession) {\n\t\t\t\t// A session whose attempt already ended contributes its accepted state unchanged;\n\t\t\t\t// dispatching another end-attempt on it would throw and fail the submission.\n\t\t\t\tconst transition = isWritableItemLifecycle(submittedSession.state().lifecycleStatus)\n\t\t\t\t\t? submittedSession.dispatch({\n\t\t\t\t\t\t\taction: 'endAttempt',\n\t\t\t\t\t\t\tcountAttempt,\n\t\t\t\t\t\t\tvalidateResponses: gate.validate,\n\t\t\t\t\t\t})\n\t\t\t\t\t: undefined;\n\t\t\t\tconst attempt = transition?.result;\n\t\t\t\tif (transition && !attempt) throw new Error('Item session did not produce an end-attempt result');\n\t\t\t\tif (attempt?.validation && !attempt.validation.valid) {\n\t\t\t\t\tthrow new AssessmentPlayerError(\n\t\t\t\t\t\t'attemptValidationFailed',\n\t\t\t\t\t\tattempt.validation.issues[0]?.message || 'Submit failed: invalid response',\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\titemSession = attempt?.sessionState ?? submittedSession.serialize();\n\t\t\t\tthis.captureItemFeedback(q, attempt?.scoring?.modalFeedback, attemptsAfter);\n\t\t\t}\n\t\t\tres = await this.backend.submitResponses({\n\t\t\t\tsessionId: this.sessionId,\n\t\t\t\titemIdentifier: q.identifier,\n\t\t\t\tresponses: asResponseValues(responses),\n\t\t\t\tsubmittedAt,\n\t\t\t\tcountAttempt,\n\t\t\t\ttimeSpent: itemSession?.duration,\n\t\t\t\ttiming: this.getSubmitTimingEvidence(q, itemSession?.duration ?? 0, submissionReason),\n\t\t\t\titemSession: this.sendsItemSession() ? itemSession : undefined,\n\t\t\t\tcomment: this.sessionCoordinator.getItemComment(q.identifier),\n\t\t\t});\n\n\t\t\tif (!res.success || !res.result) {\n\t\t\t\t// Backend error text stays on the Error (logs/host callbacks); candidates\n\t\t\t\t// see the localized `assessment.errors.codes.submitFailed` message instead.\n\t\t\t\tthrow new AssessmentPlayerError('submitFailed', res.error || 'Submit failed');\n\t\t\t}\n\t\t\t// A backend that produced no session-side modal feedback (production item XML\n\t\t\t// is delivered without responseProcessing) may still return feedback entries\n\t\t\t// from its own scoring: the same capture, backend-authored.\n\t\t\tif (res.result.feedback?.length && !this.getLastItemFeedbackFor(q.identifier)) {\n\t\t\t\tthis.captureItemFeedback(\n\t\t\t\t\tq,\n\t\t\t\t\tres.result.feedback.map((item) => ({\n\t\t\t\t\t\tidentifier: item.type,\n\t\t\t\t\t\tcontent: item.content,\n\t\t\t\t\t})),\n\t\t\t\t\tattemptsAfter,\n\t\t\t\t);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\t// Ending an attempt is a local provisional commit until the backend accepts\n\t\t\t// it. Restore the exact pre-submit lifecycle so a transient failure can be\n\t\t\t// retried without a closed item or a double-counted attempt.\n\t\t\tif (\n\t\t\t\tsubmittedSession &&\n\t\t\t\tpreSubmitSession &&\n\t\t\t\tthis.currentItemSession === submittedSession &&\n\t\t\t\tthis.items[this.currentItemIndex] === q\n\t\t\t) {\n\t\t\t\tthis.releaseCurrentItemSession();\n\t\t\t\tconst presentation = this.presentationFor(q);\n\t\t\t\tthis.attachCurrentItemSession(\n\t\t\t\t\tq,\n\t\t\t\t\tthis.getItemDefinition(q).openSession({ restore: preSubmitSession, presentation }),\n\t\t\t\t\tpresentation,\n\t\t\t\t);\n\t\t\t\tthis.notifyItemChange();\n\t\t\t}\n\t\t\t// Nothing committed: no feedback belongs to this attempt.\n\t\t\tthis.lastItemFeedback = null;\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (itemSession) {\n\t\t\tthis.sessionCoordinator.setItemSession(q.identifier, itemSession);\n\t\t}\n\n\t\tthis.setTestOutcomes(res.outcomes);\n\t\tthis.reportOutcomeProcessingError(res.outcomeProcessingError);\n\t\tthis.reportItemScoringError(res.result);\n\n\t\t// An uncounted submission (QTI endAttempt countAttempt=false, a hint request) persists the\n\t\t// response and session but records no result and consumes no attempt: the candidate stays\n\t\t// on the item and a later submission carries the final response.\n\t\tif (countAttempt) {\n\t\t\t// The attempt count before this submission: a backend `updatedState` carries its own\n\t\t\t// authoritative count (`itemSessionStates`), which must not be counted twice.\n\t\t\tconst attemptsBefore = this.sessionCoordinator.getItemSessionInfo(q.identifier).attemptCount;\n\t\t\tif (res.updatedState) {\n\t\t\t\tthis.sessionCoordinator.recordSubmittedItemInUpdatedState(q.identifier, responses, res.updatedState);\n\t\t\t} else {\n\t\t\t\t// Minimal state update when backend doesn't return full state.\n\t\t\t\tthis.sessionCoordinator.recordIndividualSubmission(q.identifier, responses, itemSession, res.result);\n\t\t\t}\n\n\t\t\tconst itemResult: ItemResult = {\n\t\t\t\titemIdentifier: q.identifier,\n\t\t\t\tscore: res.result.score,\n\t\t\t\tmaxScore: res.result.maxScore,\n\t\t\t\tresponses: { ...responses },\n\t\t\t};\n\t\t\tthis.sessionCoordinator.setItemResult(itemResult);\n\t\t\t// The counted submission's response set: a later move-time or end-of-test\n\t\t\t// submission of the same responses is skipped (no wasted attempt).\n\t\t\tthis.lastSubmittedResponses.set(q.identifier, cloneResponseRecord(responses));\n\n\t\t\t// Track item session rules (review/attempts) and visited items for navigation hints.\n\t\t\t// The backend already counted this attempt when its `updatedState` restored a\n\t\t\t// higher count; only a backend without state updates records locally.\n\t\t\tthis.sessionCoordinator.recordAttemptIfUncounted(q.identifier, attemptsBefore);\n\t\t\tthis.sessionCoordinator.markAnswered(q.identifier, responses);\n\t\t\t// The submitted item: delivery stands on it for the whole submission (a scope\n\t\t\t// expiry in flight only queues its hop behind this transition).\n\t\t\tthis.navigationManager.markVisited(q.index);\n\n\t\t\t// Apply the backend's branching decision, if any. QTI branchRule semantics:\n\t\t\t// - EXIT_TEST terminates the test: remaining items are not presented and the test\n\t\t\t// finalizes exactly like a normal end of test.\n\t\t\t// - EXIT_TESTPART ends the current test part; EXIT_SECTION ends the current section.\n\t\t\t// Delivery continues with the next item outside the ended scope; when none follows\n\t\t\t// (for the part, or the test), the ended scope finalizes like a normal end of test.\n\t\t\t// A submission that stays on the item (a practice check, a counted end-attempt) keeps\n\t\t\t// the decision instead: the next forward step from the item that submits nothing\n\t\t\t// follows it. Either way it voids every earlier decision, which was made on outcomes\n\t\t\t// this submission has moved.\n\t\t\tthis.clearKeptBranchDecisions();\n\t\t\tif (options.followBranching === false) {\n\t\t\t\tif (res.nextItemIdentifier) {\n\t\t\t\t\tthis.keepBranchDecision(q, res.nextItemIdentifier);\n\t\t\t\t}\n\t\t\t} else if (res.nextItemIdentifier) {\n\t\t\t\tawait this.followBranch(q, res.nextItemIdentifier);\n\t\t\t}\n\t\t\t// Still on the item (a check, a hint, the last item): what it shows follows the\n\t\t\t// attempt count — a final attempt hides feedback a non-final one revealed.\n\t\t\tif (!this.finalized && this.items[this.currentItemIndex] === q) {\n\t\t\t\tthis.refreshLivePresentation(q, itemSession);\n\t\t\t}\n\n\t\t\treturn itemResult;\n\t\t}\n\n\t\t// The hint consumed no attempt: the item session must be as open as it was before it.\n\t\t// Response processing may have marked the item completed (a hint on a correct answer),\n\t\t// which closes the session and would leave the candidate with no way to answer —\n\t\t// reopen it while attempts remain, as a counted check reopens.\n\t\t// The backend accepted these exact responses (it ran response processing on them), so\n\t\t// they stand as the item's last submitted set: moving on unchanged re-submits nothing\n\t\t// and follows the counted decision on record, never a fresh one on the hint's state.\n\t\tthis.lastSubmittedResponses.set(q.identifier, cloneResponseRecord(responses));\n\t\tthis.reopenForRemainingAttempts(q);\n\t\tthis.sessionCoordinator.markAnswered(q.identifier, responses);\n\t\treturn {\n\t\t\titemIdentifier: q.identifier,\n\t\t\tscore: res.result.score,\n\t\t\tmaxScore: res.result.maxScore,\n\t\t\tresponses: { ...responses },\n\t\t};\n\t}\n\n\t/**\n\t * Follow the backend's branching decision for the item just submitted. A decision that\n\t * would leave the test part (EXIT_TESTPART, an EXIT_SECTION with nothing after it in\n\t * the part, a target in a later part) or end the test (EXIT_TEST) while other questions\n\t * of the part still owe an answer is refused like a candidate's own step out of the\n\t * part: the candidate stays, the coded error names the questions, and the decision is\n\t * kept — the next `next()` from this item follows it once they are answered (a changed\n\t * response re-submits and replaces it).\n\t *\n\t * The end of the test never navigates: a decision its own submission returns is kept\n\t * the same way and the collection runs where the candidate stands. A decision whose\n\t * submission a scope expiry raced (the item's scope ran out while the submission was in\n\t * flight) is not followed — the expiry's queued hop moves delivery, and the decision\n\t * would undo that move or land in the closed scope — and a test part delivery already\n\t * left is never re-entered.\n\t */\n\tprivate async followBranch(q: FlatItem, target: string): Promise<void> {\n\t\t// Literal targets resolve forward-only (QTI 2.2 §5.15: a delivered test never re-enters\n\t\t// presented items) through the same resolver the landing pre-checks use, so the hop\n\t\t// cannot disagree with what `branchTargetIndex` reported; an unresolvable literal is\n\t\t// skipped and delivery falls through to the delivery rules, as on the backend. EXIT_*\n\t\t// land through their own boundary handling below (-1 never navigates).\n\t\tconst targetIndex = branchTargetIndex(q, target, this.items, this.currentItemIndex);\n\t\tconst standing = this.items[this.currentItemIndex] ?? q;\n\t\t// A test part delivery already left is never re-entered, whatever the decision says.\n\t\tif (targetIndex >= 0 && partOrderOf(this.assessment, this.items[targetIndex]) < partOrderOf(this.assessment, standing)) {\n\t\t\tthis.clearKeptBranchDecisions();\n\t\t\treturn;\n\t\t}\n\t\t// An end of the test is running: it collects where the candidate stands.\n\t\tif (this.endReason !== null) {\n\t\t\tthis.keepBranchDecision(q, target);\n\t\t\treturn;\n\t\t}\n\t\t// A scope expiry fired while the submission was in flight: its hop is queued behind\n\t\t// this transition and moves delivery, so the decision is not followed — the same\n\t\t// outcome as a decision that arrived after delivery moved on.\n\t\tif (this.queuedExpiryHops > 0) return;\n\t\ttry {\n\t\t\tif (target === 'EXIT_TEST') this.assertNoSubmissionBlockers();\n\t\t\telse if (this.branchExitLeavesPart(q, target)) this.assertCanLeaveScope(q, { exclude: q });\n\t\t} catch (error) {\n\t\t\tthis.keepBranchDecision(q, target);\n\t\t\tthrow error;\n\t\t}\n\t\tthis.clearKeptBranchDecisions();\n\t\tif (target === 'EXIT_TEST') {\n\t\t\tawait this.endTestInternal({ reason: 'branch' });\n\t\t\treturn;\n\t\t}\n\t\tif (target === 'EXIT_TESTPART' || target === 'EXIT_SECTION') {\n\t\t\tawait this.applyExitBoundary(target, q);\n\t\t\treturn;\n\t\t}\n\t\tif (targetIndex >= 0) {\n\t\t\t// A target in the same part leaves this item revisitable: while attempts remain\n\t\t\t// (QTI allowReview governs only after the last one) its handoff must be\n\t\t\t// attemptable, exactly as on the candidate's own move — reopen it writable and\n\t\t\t// hand it off before the hop (a branch hop does not save the outgoing session).\n\t\t\tif (this.items[targetIndex]!.testPart === q.testPart) {\n\t\t\t\tthis.reopenForRemainingAttempts(q);\n\t\t\t\tconst status = this.currentItemSession?.state().lifecycleStatus;\n\t\t\t\tif (status !== undefined && isWritableItemLifecycle(status)) this.saveCurrentItemSession();\n\t\t\t}\n\t\t\tawait this.performNavigateTo(targetIndex, { restoring: true });\n\t\t}\n\t}\n\n\t/** Where a branch decision lands: an item index, or -1 when it ends the test or resolves to nothing forward. */\n\tprivate branchTargetIndex(q: FlatItem, target: string): number {\n\t\treturn branchTargetIndex(q, target, this.items, this.currentItemIndex);\n\t}\n\n\t/** Whether a branch decision takes delivery out of the item's test part (or ends the test). */\n\tprivate branchExitLeavesPart(q: FlatItem, target: string): boolean {\n\t\treturn branchExitLeavesPart(q, target, this.items, this.currentItemIndex);\n\t}\n\n\t/**\n\t * Leave the scope ended by an EXIT_TESTPART / EXIT_SECTION branch rule: continue with\n\t * the first delivered item outside it, finalizing the ended test part (or, when nothing\n\t * follows anywhere, the whole test) through the same finalization path as submit().\n\t *\n\t * The literal resolves over the item's full enclosing chain (like the backend's\n\t * branch-rule walk), not the innermost section alone: an outer-section EXIT lands\n\t * outside the whole outer section.\n\t */\n\tprivate async applyExitBoundary(\n\t\tspecial: 'EXIT_TESTPART' | 'EXIT_SECTION',\n\t\tcurrent: FlatItem,\n\t): Promise<void> {\n\t\tconst nextIdx = resolveExitBoundary(special, current, this.items, this.currentItemIndex);\n\t\tconst partEnded = nextIdx < 0 || this.items[nextIdx]!.testPart !== current.testPart;\n\t\tif (partEnded) {\n\t\t\t// The part's pending simultaneous-mode responses are due when it ends.\n\t\t\tawait this.submitSimultaneousItems(\n\t\t\t\tthis.items.filter(\n\t\t\t\t\t(item) =>\n\t\t\t\t\t\titem.testPart === current.testPart &&\n\t\t\t\t\t\titem.testPart.submissionMode === 'simultaneous',\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t\tif (nextIdx >= 0) {\n\t\t\tawait this.performNavigateTo(nextIdx, { restoring: true });\n\t\t\treturn;\n\t\t}\n\t\t// No further test part: end the test exactly like a normal end of test.\n\t\tawait this.endTestInternal({ reason: 'branch' });\n\t}\n\n\t/**\n\t * The enclosing section a literal EXIT_SECTION leaves (see\n\t * `exitBoundaries.endedEnclosingSection`).\n\t */\n\tprivate endedEnclosingSection(current: FlatItem): FlatItem['section'] {\n\t\treturn endedEnclosingSection(current, this.items, this.currentItemIndex);\n\t}\n\n\tprivate canPrevious(): boolean {\n\t\tif (this.currentItemIndex <= 0) return false;\n\t\tconst prev = this.items[this.currentItemIndex - 1];\n\t\tif (!prev || this.isItemLocked(prev)) return false;\n\t\tif (!this.canNavigateByTestPart(this.currentItemIndex - 1, this.currentItemIndex)) return false;\n\t\treturn this.canReviewItem(prev);\n\t}\n\n\t/**\n\t * QTI `allowReview` for returning to an item: it governs only once the item's session is\n\t * over — after its last attempt, or (adaptive) once it completed. While attempts remain\n\t * the candidate may come back and use them.\n\t */\n\tprivate canReviewItem(q: FlatItem): boolean {\n\t\tconst completed =\n\t\t\tisAdaptiveItemXml(q.item.itemXml) && this.itemLifecycleOf(q.identifier) === 'closed';\n\t\treturn this.sessionCoordinator.canReview(q.identifier, { completed });\n\t}\n\n\t/** The lifecycle of an item's session: the live one for the active item, else the persisted handoff. */\n\tprivate itemLifecycleOf(itemIdentifier: string): SerializedItemSessionState['lifecycleStatus'] | undefined {\n\t\tconst current = this.items[this.currentItemIndex];\n\t\tif (current?.identifier === itemIdentifier) {\n\t\t\treturn (\n\t\t\t\tthis.currentItemSession?.state().lifecycleStatus ??\n\t\t\t\tthis.state.itemSessions?.[itemIdentifier]?.lifecycleStatus\n\t\t\t);\n\t\t}\n\t\treturn this.state.itemSessions?.[itemIdentifier]?.lifecycleStatus;\n\t}\n\n\tprivate canNext(): boolean {\n\t\tconst current = this.items[this.currentItemIndex];\n\t\tif (!current) return false;\n\t\t// Note: itemSessionControl constraints on leaving current item are enforced in next().\n\t\treturn this.forwardStepIndex(current) >= 0;\n\t}\n\n\t/**\n\t * Whether a candidate-initiated move from `currentIndex` to `targetIndex` follows the\n\t * navigation rules (see `navigationPolicy.canNavigateByTestPart`).\n\t */\n\tprivate canNavigateByTestPart(\n\t\ttargetIndex: number,\n\t\tcurrentIndex: number,\n\t\tforward: () => number = () => {\n\t\t\tconst current = this.items[currentIndex];\n\t\t\treturn current ? this.unsubmittedForwardIndex(current) : -1;\n\t\t},\n\t): boolean {\n\t\treturn canNavigateByTestPart({\n\t\t\ttargetIndex,\n\t\t\tcurrentIndex,\n\t\t\titems: this.items,\n\t\t\tforward,\n\t\t});\n\t}\n\n\tprivate async submitSimultaneousItems(items: readonly FlatItem[]): Promise<void> {\n\t\t// Items the backend already accepted with exactly these responses are done; one\n\t\t// whose recorded result predates the current responses still goes out.\n\t\tif (items.every((q) => !this.itemNeedsSubmission(q))) return;\n\t\tconst current = this.items[this.currentItemIndex];\n\t\tconst submittedItem = current && items.includes(current) ? current : undefined;\n\t\tconst preSubmitSession = submittedItem ? this.currentItemSession?.serialize() : undefined;\n\t\tlet allItemSessions: NonNullable<AssessmentSessionState['itemSessions']> = {};\n\n\t\ttry {\n\t\t\t// Suspending the rendered session gives the UI one non-writable state while\n\t\t\t// backend submission is in flight. Detached sessions perform the provisional\n\t\t\t// end-attempt work for every item.\n\t\t\tif (submittedItem) this.saveCurrentItemSession();\n\t\t\t// Preserve client-collected responses across backend state updates.\n\t\t\t// Some backend adapters return an updatedState snapshot that may only include\n\t\t\t// responses for items that have been submitted so far, which would otherwise\n\t\t\t// wipe out responses for later items during this loop.\n\t\t\tconst allItemResponses = cloneData(this.state.itemResponses) ?? {};\n\t\t\tallItemSessions = cloneData(this.state.itemSessions) ?? {};\n\n\t\t\tfor (const q of items) {\n\t\t\t\tif (!this.itemNeedsSubmission(q)) continue;\n\t\t\t\tconst submittedAt = Date.now();\n\t\t\t\tconst responsesForItem = allItemResponses[q.identifier] || {};\n\t\t\t\t// An item an expired limit closed (or a proctor's end of the test) submits its\n\t\t\t\t// responses as they stand. Response validation is an individual-part control\n\t\t\t\t// (QTI), and a candidate's end of the test checked those items already.\n\t\t\t\tconst submissionReason = this.submissionReasonFor(q);\n\t\t\t\tconst itemSession = this.endItemSessionForSubmit(\n\t\t\t\t\tq,\n\t\t\t\t\tresponsesForItem,\n\t\t\t\t\tallItemSessions[q.identifier],\n\t\t\t\t\t{ validate: submissionReason === undefined && this.isIndividual(q) },\n\t\t\t\t);\n\t\t\t\tallItemSessions[q.identifier] = itemSession;\n\t\t\t\tconst res = await this.backend.submitResponses({\n\t\t\t\t\tsessionId: this.sessionId,\n\t\t\t\t\titemIdentifier: q.identifier,\n\t\t\t\t\tresponses: responsesForItem,\n\t\t\t\t\tsubmittedAt,\n\t\t\t\t\ttimeSpent: itemSession.duration,\n\t\t\t\t\ttiming: this.getSubmitTimingEvidence(q, itemSession.duration, submissionReason),\n\t\t\t\t\titemSession: this.sendsItemSession() ? itemSession : undefined,\n\t\t\t\t\tcomment: this.sessionCoordinator.getItemComment(q.identifier),\n\t\t\t\t});\n\t\t\t\tif (!res.success || !res.result) {\n\t\t\t\t\t// Backend error text stays on the Error for logs/host callbacks only.\n\t\t\t\t\tthrow new AssessmentPlayerError(\n\t\t\t\t\t\t'submitFailed',\n\t\t\t\t\t\tres.error || `Submit failed for item ${q.identifier}`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (res.updatedState) {\n\t\t\t\t\tthis.sessionCoordinator.replaceStatePreservingResponsesAndSessions(\n\t\t\t\t\t\tres.updatedState,\n\t\t\t\t\t\tallItemResponses,\n\t\t\t\t\t\tallItemSessions,\n\t\t\t\t\t);\n\t\t\t\t\tthis.sessionCoordinator.setItemResult({\n\t\t\t\t\t\titemIdentifier: q.identifier,\n\t\t\t\t\t\tscore: res.result.score,\n\t\t\t\t\t\tmaxScore: res.result.maxScore,\n\t\t\t\t\t\tresponses: this.state.itemResponses[q.identifier] || {},\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tthis.sessionCoordinator.recordSimultaneousSubmission(q.identifier, responsesForItem, itemSession, res.result);\n\t\t\t\t}\n\t\t\t\t// The accepted response set: a retry, a later collection pass, or finalize\n\t\t\t\t// must not re-submit identical responses for this item.\n\t\t\t\tthis.lastSubmittedResponses.set(q.identifier, cloneResponseRecord(responsesForItem));\n\t\t\t\t// This submission voids every earlier decision (the outcomes they were decided\n\t\t\t\t// on have moved). Only a part crossing keeps the fresh one — the decision the\n\t\t\t\t// part's last item returns is what the crossing follows — while the end of the\n\t\t\t\t// test's own collection (the same submit path, for every item) stores none: it\n\t\t\t\t// never navigates.\n\t\t\t\tthis.clearKeptBranchDecisions();\n\t\t\t\tif (this.endReason === null && res.nextItemIdentifier) {\n\t\t\t\t\tthis.keepBranchDecision(q, res.nextItemIdentifier);\n\t\t\t\t}\n\t\t\t\tthis.setTestOutcomes(res.outcomes);\n\t\t\t\tthis.reportOutcomeProcessingError(res.outcomeProcessingError);\n\t\t\t\tthis.reportItemScoringError(res.result);\n\t\t\t}\n\n\t\t\t// The attached item must represent the same accepted lifecycle as persistence.\n\t\t\t// Replace the provisional suspended object with one restored from the accepted\n\t\t\t// closed state; no second live state owner remains.\n\t\t\tif (submittedItem && this.items[this.currentItemIndex] === submittedItem) {\n\t\t\t\tconst accepted = allItemSessions[submittedItem.identifier];\n\t\t\t\tif (accepted) {\n\t\t\t\t\tthis.releaseCurrentItemSession();\n\t\t\t\t\tconst presentation = this.presentationFor(submittedItem);\n\t\t\t\t\tthis.attachCurrentItemSession(\n\t\t\t\t\t\tsubmittedItem,\n\t\t\t\t\t\tthis.getItemDefinition(submittedItem).openSession({ restore: accepted, presentation }),\n\t\t\t\t\t\tpresentation,\n\t\t\t\t\t);\n\t\t\t\t\tthis.notifyItemChange();\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\t// The backend accepts simultaneous items one request at a time. Keep earlier\n\t\t\t// accepted items committed so retry cannot double-submit them. If the rendered\n\t\t\t// item was not accepted, restore only that item to its exact writable state.\n\t\t\tif (submittedItem && this.items[this.currentItemIndex] === submittedItem) {\n\t\t\t\tconst accepted = this.sessionCoordinator.hasItemResult(submittedItem.identifier)\n\t\t\t\t\t? allItemSessions[submittedItem.identifier]\n\t\t\t\t\t: undefined;\n\t\t\t\tconst restored = accepted ?? preSubmitSession;\n\t\t\t\tif (!accepted && preSubmitSession) {\n\t\t\t\t\tthis.sessionCoordinator.saveItemSession(\n\t\t\t\t\t\tsubmittedItem.identifier,\n\t\t\t\t\t\tcloneResponseRecord(valuesFromItemSession(preSubmitSession)),\n\t\t\t\t\t\tpreSubmitSession,\n\t\t\t\t\t\tpreSubmitSession.duration,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tthis.releaseCurrentItemSession();\n\t\t\t\tif (restored) {\n\t\t\t\t\tconst presentation = this.presentationFor(submittedItem);\n\t\t\t\t\tthis.attachCurrentItemSession(\n\t\t\t\t\t\tsubmittedItem,\n\t\t\t\t\t\tthis.getItemDefinition(submittedItem).openSession({ restore: restored, presentation }),\n\t\t\t\t\t\tpresentation,\n\t\t\t\t\t);\n\t\t\t\t\tthis.notifyItemChange();\n\t\t\t\t\tthis.notifyResponseChange();\n\t\t\t\t}\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/**\n\t * Submit the entire assessment and finalize on the backend — the single terminal\n\t * transition, also used for QTI `EXIT_TEST` (and for EXIT_TESTPART / EXIT_SECTION when\n\t * nothing follows the ended scope). Serialized with all other navigation and submission\n\t * transitions. Calling it again after the test has ended returns the same results.\n\t *\n\t * A candidate's submit is rejected while paused, and — with a coded\n\t * `finalizeResponseRequired` / `finalizeResponseInvalid` naming the items\n\t * (`getSubmissionBlockers()`) — while items in individual parts would be submitted\n\t * against their `allowSkipping=false` / `validateResponses=true` controls.\n\t *\n\t * `{ force: true }` is the proctor's administrative end of the test: it runs during a\n\t * pause, and neither minimum times nor the skipping/validation gates hold it back; the\n\t * collected submissions carry `timing.submissionReason: 'proctor'` — except items an\n\t * expired time limit closed, which go out as `time-expired` (time wins), and the end is\n\t * an `expiry` end when the time had already closed the delivery. It never fails for\n\t * concurrency: while a candidate's navigation or submission is in flight, it waits for\n\t * that transition to settle and then ends the test (when the transition itself ended\n\t * the test, it resolves with those results).\n\t */\n\tpublic submit(options: { force?: boolean } = {}): Promise<AssessmentResults> {\n\t\tif (options.force === true) {\n\t\t\treturn this.runWhenIdle(async () => {\n\t\t\t\tthis.administrativeReason = 'proctor';\n\t\t\t\ttry {\n\t\t\t\t\treturn await this.endTestInternal({ administrative: true, reason: 'proctor' });\n\t\t\t\t} finally {\n\t\t\t\t\tthis.administrativeReason = null;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn this.runCandidateTransition(() => this.endTestInternal({ reason: 'candidate' }));\n\t}\n\n\t/**\n\t * Run an administrative transition exclusively as soon as the lock is free: queued\n\t * behind the transition in flight (a pause, a force submit, an expiry hop) instead of\n\t * rejecting as busy. The lock is taken synchronously when the in-flight transition\n\t * releases it, so no candidate action can slip in between. Rejects only when the\n\t * player is destroyed.\n\t */\n\tprivate runWhenIdle<T>(operation: () => Promise<T>): Promise<T> {\n\t\tif (this.destroyed) {\n\t\t\treturn Promise.reject(new AssessmentPlayerError('navigationNotAllowed', 'The assessment player was destroyed.'));\n\t\t}\n\t\tif (!this.transitionInFlight) return this.runExclusive(operation);\n\t\treturn new Promise<T>((resolve, reject) => {\n\t\t\tconst cancel = (error: Error) => {\n\t\t\t\toff();\n\t\t\t\treject(error);\n\t\t\t};\n\t\t\tconst off = this.onBusyChange((busy) => {\n\t\t\t\tif (busy || this.transitionInFlight) return;\n\t\t\t\toff();\n\t\t\t\tthis.queuedIdleTransitions.delete(cancel);\n\t\t\t\tthis.runWhenIdle(operation).then(resolve, reject);\n\t\t\t});\n\t\t\tthis.queuedIdleTransitions.add(cancel);\n\t\t});\n\t}\n\n\t/**\n\t * Whether an expired hard limit closed the delivery: the whole test expired, or the\n\t * current item sits inside an expired scope and no open question remains reachable from\n\t * it (an expiry dead end). An earlier question still open in the part keeps delivery\n\t * open — the expiry moves the candidate there instead — so its skipping/validation\n\t * controls and minimum times keep applying. Only a closed delivery is collected as\n\t * `time-expired` without them.\n\t */\n\tprivate isTimeClosedDelivery(): boolean {\n\t\tif (this.assessmentExpired) return true;\n\t\tconst current = this.items[this.currentItemIndex];\n\t\treturn current !== undefined && this.isItemLocked(current) && this.openItemAfterClosure(current.index) < 0;\n\t}\n\n\t/**\n\t * Why an item's submission runs: an item an expired hard limit closed submits the\n\t * responses frozen at the expiry (`time-expired`) — its own scope expired, or the\n\t * whole test did; a proctor's forced end of the test collects as `proctor`; a question\n\t * the candidate can no longer reach although its QTI skipping/validation control would\n\t * refuse it is collected as it stands (`unreachable`); everything else is a normal\n\t * candidate submission.\n\t */\n\tprivate submissionReasonFor(q: FlatItem): SubmitTimingEvidence['submissionReason'] {\n\t\tif (this.assessmentExpired || this.isItemLocked(q)) return 'time-expired';\n\t\tif (this.administrativeReason) return this.administrativeReason;\n\t\tif (this.unreachableCollection.has(q.identifier)) return 'unreachable';\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * The one normal-end-of-test path: pending simultaneous-mode responses are submitted,\n\t * the current individual-mode item is submitted if needed, then the backend finalizes\n\t * (outcome processing runs, results are produced) and navigation closes. Individual-\n\t * mode attempts an expired limit closed are collected as well: their responses were\n\t * frozen when the time ran out. The same is true for any visited individual-mode item\n\t * whose responses never reached the backend because the candidate jumped away without\n\t * a forward submission (nonlinear `navigateTo`/`previous` submit nothing): it is\n\t * collected through the same detached end-attempt loop instead of being finalized\n\t * from NULL.\n\t *\n\t * A candidate-initiated end of the test first checks the QTI submission controls of\n\t * individual parts: it never submits an item without a response while\n\t * `allowSkipping=false`, nor an answered item whose responses fail validation while\n\t * `validateResponses=true` — it rejects naming them instead, as long as the candidate\n\t * can still reach them. A question in a test part already left cannot hold the end of\n\t * the test: it is collected as it stands (`submissionReason: 'unreachable'`). An\n\t * administrative end (a time expiry, a proctor's forced submit) collects everything as\n\t * it stands; an item a skipping control held back is then recorded as skipped.\n\t *\n\t * `reason` records why the test ends; the outermost caller decides (a candidate's\n\t * submit whose final submission branches to EXIT_TEST stays a candidate end) — except\n\t * that an end collecting a delivery the time already closed (the whole test expired, or\n\t * an expiry dead end left nothing open) is an `expiry` end whoever triggers it: the\n\t * auto-finalize, the candidate's Submit after it failed, a proctor's force-submit.\n\t *\n\t * The end never navigates: it collects where the candidate stands. A branch decision\n\t * its own submission returns is kept on record (`followBranch`), and a scope expiry\n\t * while it runs only closes the scope — moving delivery off it waits for this end and\n\t * happens only if the end does not finalize.\n\t */\n\tprivate async endTestInternal(\n\t\toptions: { administrative?: boolean; reason?: AssessmentEndReason } = {},\n\t): Promise<AssessmentResults> {\n\t\tif (this.finalized && this.finalResults) return this.finalResults;\n\t\tconst outermost = this.endReason === null;\n\t\tif (outermost) this.endReason = this.isTimeClosedDelivery() ? 'expiry' : (options.reason ?? 'candidate');\n\t\ttry {\n\t\t\treturn await this.collectAndFinalize(options.administrative === true);\n\t\t} finally {\n\t\t\tif (outermost) {\n\t\t\t\tthis.unreachableCollection = new Set();\n\t\t\t\tconst heldExpiries = this.expiriesDuringEnd.splice(0);\n\t\t\t\tif (!this.finalized) {\n\t\t\t\t\t// A refused or failed end leaves the test running: no reason is pending,\n\t\t\t\t\t// and delivery now leaves the scopes that expired while it ran — inline,\n\t\t\t\t\t// under the lock the end still holds.\n\t\t\t\t\tthis.endReason = null;\n\t\t\t\t\tfor (const expiry of heldExpiries) void this.leaveExpiredScopeLocked(expiry.scope, expiry.identifier);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async collectAndFinalize(administrative: boolean): Promise<AssessmentResults> {\n\t\tconst closed = administrative || this.isTimeClosedDelivery();\n\t\tconst current = this.items[this.currentItemIndex];\n\t\tif (current && !closed) {\n\t\t\t// A current item an expired limit closed is collected as it stands: its own and\n\t\t\t// its scopes' minimum times cannot hold the end of the test.\n\t\t\tif (!this.isItemLocked(current)) {\n\t\t\t\tthis.assertMinimumTime('item', current);\n\t\t\t\tthis.assertEnclosingSectionMinimumTime(current);\n\t\t\t\tthis.assertMinimumTime('testPart', current);\n\t\t\t}\n\t\t\tthis.assertMinimumTime('assessment', current);\n\t\t}\n\t\tif (!closed) this.assertNoSubmissionBlockers();\n\t\t// Questions the candidate can no longer reach go out as they stand, marked so the\n\t\t// backend never mistakes them for a normal candidate submission.\n\t\tif (!administrative) {\n\t\t\tthis.unreachableCollection = new Set(\n\t\t\t\tthis.getUnreachableSubmissionBlockers().map((blocker) => blocker.identifier),\n\t\t\t);\n\t\t}\n\t\tconst isIndividual = (q: FlatItem) => this.isIndividual(q);\n\t\tawait this.submitSimultaneousItems(\n\t\t\tthis.items.filter((q) => q.testPart.submissionMode === 'simultaneous'),\n\t\t);\n\t\tif (this.finalized && this.finalResults) return this.finalResults;\n\t\tawait this.submitSimultaneousItems(\n\t\t\tthis.items.filter(\n\t\t\t\t(q) =>\n\t\t\t\t\tq !== current &&\n\t\t\t\t\tisIndividual(q) &&\n\t\t\t\t\tthis.navigationManager.isVisited(q.index) &&\n\t\t\t\t\t// Only what the backend has not accepted yet: an expired limit froze the\n\t\t\t\t\t// item's responses, but responses it already accepted are never re-sent\n\t\t\t\t\t// (that would spend another attempt and fail the end of the test).\n\t\t\t\t\tthis.itemNeedsSubmission(q),\n\t\t\t),\n\t\t);\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tif (q && isIndividual(q)) {\n\t\t\tconst liveStatus = this.currentItemSession?.state().lifecycleStatus;\n\t\t\tconst liveWritable = liveStatus !== undefined && isWritableItemLifecycle(liveStatus);\n\t\t\tconst hasResult = this.sessionCoordinator.hasItemResult(q.identifier);\n\t\t\t// An item without a recorded result is collected as it stands (an expired limit\n\t\t\t// closed it, or the candidate is leaving it open). An item with a recorded\n\t\t\t// result — a practice check — re-submits only when the live attempt is still\n\t\t\t// open, attempts remain, and the candidate changed their response.\n\t\t\tconst needsSubmission = !hasResult\n\t\t\t\t? true\n\t\t\t\t: liveWritable\n\t\t\t\t\t? this.sessionCoordinator.canSubmit(q.identifier) &&\n\t\t\t\t\t\t!this.responsesUnchangedSinceSubmission(q.identifier)\n\t\t\t\t\t: false;\n\t\t\tif (needsSubmission) {\n\t\t\t\t// Collected where the candidate stands: a branch decision this submission\n\t\t\t\t// returns is kept on record, never followed (`followBranch`).\n\t\t\t\tawait this.submitCurrentItemInternal();\n\t\t\t\tif (this.finalized && this.finalResults) return this.finalResults;\n\t\t\t}\n\t\t}\n\n\t\treturn this.finalizeInternal();\n\t}\n\n\tprivate async finalizeInternal(): Promise<AssessmentResults> {\n\t\tif (this.finalized && this.finalResults) return this.finalResults;\n\n\t\t// Persist the final draft before the backend finalizes: outcome processing reads\n\t\t// the stored timing (the built-in durations), so it must see the end-of-test\n\t\t// clocks, not the last debounced autosave. Safe mid-transition (inside the\n\t\t// exclusive lock); a failed save stays non-fatal. It is the record of the ended\n\t\t// test, so every item session in it is over: a practice item reopened for attempts\n\t\t// the candidate did not use stands closed, as the backend last accepted it (the\n\t\t// collection re-sent every changed response).\n\t\tthis.snapshotsCloseItemSessions = true;\n\t\ttry {\n\t\t\tawait this.autosave?.flushImmediate();\n\t\t} finally {\n\t\t\tthis.snapshotsCloseItemSessions = false;\n\t\t}\n\t\tlet finalized: FinalizeAssessmentResponse;\n\t\ttry {\n\t\t\tfinalized = await this.backend.finalizeAssessment({ sessionId: this.sessionId });\n\t\t\tif (!finalized.success) throw new AssessmentPlayerError('finalizeFailed', 'Finalize failed');\n\t\t} catch (error) {\n\t\t\t// The test goes on: the stored draft gets its open sessions back, so attempts the\n\t\t\t// candidate may still use survive a reload.\n\t\t\tawait this.autosave?.flushImmediate();\n\t\t\tthrow error;\n\t\t}\n\n\t\t// Map backend itemScores to ItemResult[]\n\t\tconst itemScores = finalized.itemScores || {};\n\t\tconst itemResults: ItemResult[] = Object.values(itemScores).map((r: AssessmentScoringResult) => ({\n\t\t\titemIdentifier: r.itemIdentifier,\n\t\t\tscore: r.score,\n\t\t\tmaxScore: r.maxScore,\n\t\t\tresponses: this.state.itemResponses[r.itemIdentifier] || {},\n\t\t}));\n\n\t\t// Outcome processing has run by the end of the test, so a backend returning no outcomes\n\t\t// leaves them all NULL.\n\t\tthis.finalized = true;\n\t\t// A proctor's forced end of the test may land during a pause: the session is over,\n\t\t// so the pause no longer holds anything (no pause event — the end of the test is it).\n\t\tthis.pauseControl.clearSilently();\n\t\tthis.suspendedForPause = false;\n\t\t// The test ended through its real submission: draft autosave has nothing left to do.\n\t\tthis.autosave?.stop();\n\t\t// Delivery is over: no clock keeps running, and no later expiry can fire.\n\t\tthis.timeManager?.pause();\n\t\tthis.timeManager?.stopTimer();\n\t\tthis.testOutcomes = cloneData(finalized.outcomes ?? this.testOutcomes ?? {})!;\n\t\t// The persisted snapshot carries them (testFeedback and rules read them on a resume).\n\t\tthis.sessionCoordinator.setTestOutcomes(this.testOutcomes);\n\t\tthis.notifyTestFeedbackChange();\n\t\tthis.reportOutcomeProcessingError(finalized.outcomeProcessingError);\n\n\t\tconst endReason: AssessmentEndReason = this.endReason ?? 'candidate';\n\t\tthis.endReason = endReason;\n\t\tconst results: AssessmentResults = {\n\t\t\ttotalScore: finalized.totalScore,\n\t\t\tmaxScore: finalized.maxScore,\n\t\t\titemResults,\n\t\t\tcompletedAt: new Date(finalized.finalizedAt),\n\t\t\tendReason,\n\t\t};\n\t\tif (this.reportedOutcomeProcessingError) {\n\t\t\tresults.outcomeProcessingError = this.reportedOutcomeProcessingError;\n\t\t}\n\t\tthis.finalResults = results;\n\t\t// The test is over: no decision remains for delivery to follow.\n\t\tthis.clearKeptBranchDecisions();\n\t\t// Every delivered item session is over, the active one included: the player's record\n\t\t// of the ended test reports each as final, never as owing a submission.\n\t\tthis.closeItemSessionsForEnd();\n\n\t\t// Completion listeners run once the results exist, so `getResultsSummary()` (the\n\t\t// shell's completion screen), `getEndReason()` and `submit()` already report them.\n\t\t// Every ending reaches them alike — a candidate submit, a proctor's force-submit, an\n\t\t// EXIT_TEST branch, a whole-test expiry — so a shell hands the results to its host\n\t\t// from here.\n\t\tthis.notifyComplete(results);\n\t\tif (this.config.onComplete) this.config.onComplete(results);\n\t\tthis.config.onFinalized?.({ restored: false, results, endReason });\n\t\treturn results;\n\t}\n\n\t/**\n\t * Why the test ended in this delivery (`candidate`, `expiry`, `proctor` or `branch`);\n\t * null while it runs and for a session restored already finalized.\n\t */\n\tpublic getEndReason(): AssessmentEndReason | null {\n\t\treturn this.finalized ? this.endReason : null;\n\t}\n\n\t/**\n\t * The test ended: close every delivered item session in the player's record. Nothing\n\t * can be submitted any more, so an item a practice check reopened for attempts the\n\t * candidate did not use stands as the backend accepted it; the active item's live\n\t * session is replaced by a closed one (read-only; no item change — the end never\n\t * navigates).\n\t */\n\tprivate closeItemSessionsForEnd(): void {\n\t\tthis.sessionCoordinator.closeAllItemSessions();\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tconst live = this.currentItemSession;\n\t\tif (!q || !live || live.state().lifecycleStatus === 'closed') return;\n\t\tconst closed = closedItemSession(live.serialize());\n\t\tthis.sessionCoordinator.setItemSession(q.identifier, closed);\n\t\tconst presentation = this.presentationFor(q);\n\t\tthis.releaseCurrentItemSession();\n\t\tthis.attachCurrentItemSession(q, this.getItemDefinition(q).openSession({ restore: closed, presentation }), presentation);\n\t}\n\n\t/**\n\t * Surface a backend test-level outcome-processing failure to the host (onError and,\n\t * for finalize, the results). Candidate responses stay accepted and persisted; only\n\t * SCORE/testFeedback computation failed.\n\t */\n\tprivate reportOutcomeProcessingError(error: OutcomeProcessingError | undefined): void {\n\t\tif (!error) return;\n\t\tconst isNew =\n\t\t\t!this.reportedOutcomeProcessingError ||\n\t\t\tthis.reportedOutcomeProcessingError.message !== error.message ||\n\t\t\tthis.reportedOutcomeProcessingError.code !== error.code;\n\t\tthis.reportedOutcomeProcessingError = error;\n\t\tif (isNew) {\n\t\t\tthis.config.onError?.(\n\t\t\t\tnew AssessmentPlayerError('outcomeProcessingFailed', error.message, { code: error.code }),\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * The reporter the delivery-rules walk (`nextItemIdentifier`, `firstEligibleItem`)\n\t * hands each unevaluable branch rule or preCondition to. A broken rule reads as false\n\t * (delivery proceeds on the default path — the same rule never blocks or aborts the\n\t * test), but the host learns of it through `config.onError` as a coded\n\t * `testConditionFailed` error, once per distinct failed rule rather than on every\n\t * re-evaluation.\n\t */\n\tprivate reportTestConditionFailure = (conditionXml: string, error: unknown): void => {\n\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\tthis.reportOnce(\n\t\t\tthis.reportedTestConditionFailures,\n\t\t\t`${conditionXml}\\n${message}`,\n\t\t\t() => new AssessmentPlayerError('testConditionFailed', message, {}, { cause: error }),\n\t\t);\n\t};\n\n\t/**\n\t * A backend scoring result whose response processing failed carries a degenerate 0\n\t * (its declared maximum where known) plus a `scoringError` — the item-level mirror of\n\t * `outcomeProcessingError`. The submission stands and delivery continues, but the host\n\t * must be able to tell \"answered wrong\" from \"the engine failed to score\"; each\n\t * distinct item failure is reported once.\n\t */\n\tprivate reportItemScoringError(result: AssessmentScoringResult | undefined): void {\n\t\tconst error = result?.scoringError;\n\t\tif (!error) return;\n\t\tconst itemIdentifier = result?.itemIdentifier;\n\t\tthis.reportOnce(\n\t\t\tthis.reportedItemScoringErrors,\n\t\t\t`${itemIdentifier}\\n${error.message}`,\n\t\t\t() =>\n\t\t\t\tnew AssessmentPlayerError('itemScoringFailed', error.message, {\n\t\t\t\t\titemIdentifier: itemIdentifier ?? '',\n\t\t\t\t\tcode: error.code,\n\t\t\t\t}),\n\t\t);\n\t}\n\n\t/**\n\t * Report a distinct failure to the host once: `seen` holds the keys already reported,\n\t * `key` encodes what makes one failure distinct from another (each reporter composes\n\t * its own), and `build` constructs the coded error the host hears through\n\t * `config.onError` the first time the key is seen.\n\t */\n\tprivate reportOnce(seen: Set<string>, key: string, build: () => AssessmentPlayerError): void {\n\t\tif (seen.has(key)) return;\n\t\tseen.add(key);\n\t\tthis.config.onError?.(build());\n\t}\n\n\t// ---------------------------------------------------------------------------\n\t// Session info + time helpers\n\t// ---------------------------------------------------------------------------\n\n\t/** The current item's session-control state (attempts, feedback, review, skipping, comments); null before delivery. */\n\tpublic getItemSessionInfo(): {\n\t\tcanSubmit: boolean;\n\t\tremainingAttempts: number | null;\n\t\tattemptCount: number;\n\t\tshowFeedback: boolean;\n\t\tshowSolution: boolean;\n\t\tcanReview: boolean;\n\t\tcanSkip: boolean;\n\t\tcanComment: boolean;\n\t} | null {\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tif (!q) return null;\n\t\tconst id = q.identifier;\n\n\t\treturn this.sessionCoordinator.getItemSessionInfo(id);\n\t}\n\n\t/**\n\t * Records the candidate's comment on an item (QTI `allowComment`), sent with its next submission.\n\t * Defaults to the current item; throws when the item does not allow comments.\n\t */\n\tpublic setItemComment(comment: string, itemIdentifier?: string): void {\n\t\tconst id = itemIdentifier ?? this.items[this.currentItemIndex]?.identifier;\n\t\tif (!id) throw new Error('No current item');\n\t\tthis.sessionCoordinator.setItemComment(id, comment);\n\t\t// Comments ride the persisted snapshot (`itemComments`), so autosave runs too.\n\t\tthis.notifyAutosaveActivity();\n\t}\n\n\tpublic getItemComment(itemIdentifier?: string): string | undefined {\n\t\tconst id = itemIdentifier ?? this.items[this.currentItemIndex]?.identifier;\n\t\treturn id ? this.sessionCoordinator.getItemComment(id) : undefined;\n\t}\n\n\tpublic getRemainingTime(): number {\n\t\t// TimeManager exposes seconds getters.\n\t\treturn this.timeManager?.getRemainingSeconds() ?? 0;\n\t}\n\n\tpublic getElapsedTime(): number {\n\t\treturn this.timeManager?.getElapsedSeconds() ?? 0;\n\t}\n\n\tpublic isTimeExpired(): boolean {\n\t\treturn this.timeManager?.isExpired() ?? false;\n\t}\n\n\t// ---------------------------------------------------------------------------\n\t// Time administration: begin gate, proctor pause, countdown state\n\t// ---------------------------------------------------------------------------\n\n\t/** Whether delivery has begun. False only while an opt-in begin gate holds the start screen. */\n\tpublic hasStarted(): boolean {\n\t\treturn this.started;\n\t}\n\n\t/**\n\t * Open the begin gate (`beginGate` config): enter the first — or restored — item and\n\t * start every clock. The shell calls it from its Begin button. Idempotent, and a no-op\n\t * without a begin gate (the player then started at creation). A proctor pause in\n\t * force keeps the clocks frozen until `resume()`.\n\t */\n\tpublic start(): void {\n\t\t// A test that already ended (a proctor's force-submit behind the gate) never starts.\n\t\tif (this.started || this.destroyed || this.finalized) return;\n\t\tthis.started = true;\n\t\tif (!this.paused) this.timeManager?.resume();\n\t\tthis.enterInitialItem();\n\t\tthis.finalizeRestoredExpiryWhenRunning();\n\t}\n\n\t/**\n\t * Proctor pause. Freezes every clock — assessment, test part, section and item; the\n\t * live attempt is suspended so its QTI `duration` stops too — and rejects candidate\n\t * actions with a coded `assessmentPaused` error until `resume()`. `reason` is\n\t * host-supplied, candidate-facing text shown with the pause (localize it in the host).\n\t * A pause requested during a navigation or submission applies once it settles; while\n\t * already paused, a new reason replaces the shown one. No-op after the test ended.\n\t */\n\tpublic pause(reason?: string): void {\n\t\tif (this.finalized || this.destroyed) return;\n\t\tthis.pauseControl.pause(reason);\n\t}\n\n\t/** End a proctor pause: the clocks continue and the live attempt reopens where it stood. */\n\tpublic resume(): void {\n\t\tthis.pauseControl.resume();\n\t}\n\n\tpublic isPaused(): boolean {\n\t\treturn this.paused;\n\t}\n\n\t/** The candidate-facing reason given for the current pause, if any. */\n\tpublic getPauseReason(): string | undefined {\n\t\treturn this.paused ? this.pauseReason : undefined;\n\t}\n\n\t/** The countdown a shell shows: the active scope's nearest hard maximum and the clock state. */\n\tpublic getTimeState(): AssessmentTimeState {\n\t\tconst nearest = this.timeManager?.getNearestLimit() ?? null;\n\t\treturn {\n\t\t\tlimited: nearest !== null,\n\t\t\tremainingSeconds: nearest ? Math.max(0, Math.ceil(nearest.remainingSeconds)) : null,\n\t\t\telapsedSeconds: this.getElapsedTime(),\n\t\t\texpired: nearest !== null && nearest.remainingSeconds <= 0,\n\t\t\tscope: nearest?.scope ?? null,\n\t\t\tallowLateSubmission: nearest?.allowLateSubmission ?? false,\n\t\t\tpaused: this.paused,\n\t\t\tstarted: this.started,\n\t\t};\n\t}\n\n\t/**\n\t * Whether the session is terminal: the test has ended here, or the backend restored a\n\t * session it had already finalized. Shells show their completed view; `submit()`\n\t * returns the stored results without another backend round trip.\n\t */\n\tpublic isFinalized(): boolean {\n\t\treturn this.finalized;\n\t}\n\n\t/** The stored results of a session restored already finalized. */\n\tprivate finalResultsFromInit(init: InitSessionResponse): AssessmentResults {\n\t\tconst summary = init.finalResults;\n\t\tconst itemScores = summary?.itemScores ?? {};\n\t\tconst itemResults: ItemResult[] = Object.values(itemScores).map((r) => ({\n\t\t\titemIdentifier: r.itemIdentifier,\n\t\t\tscore: r.score,\n\t\t\tmaxScore: r.maxScore,\n\t\t\tresponses: (this.state.itemResponses[r.itemIdentifier] ?? {}) as Record<string, unknown>,\n\t\t}));\n\t\treturn {\n\t\t\ttotalScore: summary?.totalScore ?? 0,\n\t\t\tmaxScore: summary?.maxScore ?? 0,\n\t\t\titemResults,\n\t\t\tcompletedAt: new Date(summary?.finalizedAt ?? Date.now()),\n\t\t};\n\t}\n\n\t/**\n\t * What a start screen shows before delivery begins: the test title, the time the\n\t * candidate has for the whole test (PNP extended time applied; what remains of it for\n\t * a resumed session), whether parts, sections or items carry their own limits, and the\n\t * first test part's rubric blocks (role-filter them before display).\n\t */\n\tpublic getStartInfo(): AssessmentStartInfo {\n\t\tconst extended = this.config.pnp?.content?.extendedTime;\n\t\tconst limited = (limits?: TimeLimits) =>\n\t\t\tlimits?.maxTime !== undefined && extendTimeLimit(limits.maxTime, extended) !== undefined;\n\t\tconst testRemaining = this.timeManager?.getAssessmentRemainingSeconds() ?? null;\n\t\tconst firstPart = this.items[0]?.testPart ?? this.assessment.testParts?.[0];\n\t\treturn {\n\t\t\ttitle: this.getAssessmentTitle(),\n\t\t\ttestTimeLimitSeconds: testRemaining === null ? undefined : Math.max(0, Math.ceil(testRemaining)),\n\t\t\thasScopedTimeLimits: this.items.some(\n\t\t\t\t(q) =>\n\t\t\t\t\tlimited(q.testPart.timeLimits) ||\n\t\t\t\t\tq.sections.some((section) => limited(section.timeLimits)) ||\n\t\t\t\t\tlimited(q.item.timeLimits),\n\t\t\t),\n\t\t\trubricBlocks: (firstPart?.rubricBlocks ?? []).map((block) => ({ ...block, view: [...block.view] })),\n\t\t\ttotalItems: this.items.length,\n\t\t\tresuming: (this.state.timing?.totalTime ?? 0) > 0 || this.state.visitedItems.length > 0,\n\t\t\tsavedAt: this.getRestoredSavedAt(),\n\t\t};\n\t}\n\n\t/** Whether the candidate hid the countdown. Persisted in the session state, like flags. */\n\tpublic isTimerHidden(): boolean {\n\t\treturn this.state.timerHidden === true;\n\t}\n\n\tpublic setTimerHidden(hidden: boolean): void {\n\t\tthis.sessionCoordinator.setTimerHidden(hidden);\n\t\t// The preference rides the persisted snapshot, like flags.\n\t\tthis.notifyAutosaveActivity();\n\t}\n\n\t// ---------------------------------------------------------------------------\n\t// Event subscriptions\n\t// ---------------------------------------------------------------------------\n\n\tpublic onItemChange(listener: (index: number, total: number) => void): () => void {\n\t\treturn this.events.on('itemChange', listener);\n\t}\n\n\tpublic onSectionChange(listener: (index: number, total: number) => void): () => void {\n\t\treturn this.events.on('sectionChange', listener);\n\t}\n\n\tpublic onResponseChange(listener: (responses: Record<string, unknown>) => void): () => void {\n\t\treturn this.events.on('responseChange', listener);\n\t}\n\n\t/**\n\t * The test ended in this delivery — by any path: a candidate submit, a proctor's\n\t * force-submit, a QTI EXIT_TEST branch, a whole-test expiry — with its results.\n\t */\n\tpublic onComplete(listener: (results: AssessmentResults) => void): () => void {\n\t\treturn this.events.on('complete', listener);\n\t}\n\n\t/** Fires when a navigation/submission transition starts or ends (`getNavigationState().isLoading` mirrors this). */\n\tpublic onBusyChange(listener: (busy: boolean) => void): () => void {\n\t\treturn this.events.on('busyChange', listener);\n\t}\n\n\t/** Called when `getVisibleFeedback()` may have changed: new outcomes, a new test part, or the end. */\n\tpublic onTestFeedbackChange(listener: () => void): () => void {\n\t\treturn this.events.on('testFeedbackChange', listener);\n\t}\n\n\tpublic onTimeWarning(listener: (remainingSeconds: number) => void): () => void {\n\t\treturn this.events.on('timeWarning', listener);\n\t}\n\n\t/**\n\t * A hard time limit ran out with no late submission: the whole test (the core then\n\t * finalizes automatically; the event follows with `autoFinalized`, or with\n\t * `submissionRequired` when finalization failed), or a scope whose expiry leaves nothing\n\t * unlocked (`submissionRequired`: the candidate must submit now).\n\t */\n\tpublic onTimeExpired(listener: (event: AssessmentTimeExpiryEvent) => void): () => void {\n\t\treturn this.events.on('timeExpired', listener);\n\t}\n\n\t/** A test part, section or item limit expired: its items closed, delivery moved on if it could. */\n\tpublic onScopeTimeExpired(listener: (event: ScopeTimeExpiryEvent) => void): () => void {\n\t\treturn this.events.on('scopeTimeExpired', listener);\n\t}\n\n\t/** Fires when a proctor pause starts (with its reason) or ends. */\n\tpublic onPauseChange(listener: (paused: boolean, reason?: string) => void): () => void {\n\t\treturn this.events.on('pauseChange', listener);\n\t}\n\n\tpublic onTimeTick(listener: (remainingSeconds: number, elapsedSeconds: number) => void): () => void {\n\t\treturn this.events.on('timeTick', listener);\n\t}\n\n\tpublic destroy(): void {\n\t\tthis.destroyed = true;\n\t\t// A transition queued behind the one in flight can no longer run.\n\t\tfor (const cancel of [...this.queuedIdleTransitions]) {\n\t\t\tcancel(new AssessmentPlayerError('navigationNotAllowed', 'The assessment player was destroyed.'));\n\t\t}\n\t\tthis.queuedIdleTransitions.clear();\n\t\tthis.autosave?.stop();\n\t\tthis.timeManager?.destroy();\n\t\tthis.releaseCurrentItemSession();\n\t\tthis.lastItemFeedback = null;\n\t\tthis.clearKeptBranchDecisions();\n\t\tthis.itemDefinitions.clear();\n\t\tthis.events.clear();\n\t\tthis.reviewInfoCache.clear();\n\t}\n\n\t// ---------------------------------------------------------------------------\n\t// Internal notify helpers\n\t// ---------------------------------------------------------------------------\n\n\tprivate notifyItemChange(): void {\n\t\tthis.events.emit('itemChange', this.currentItemIndex, this.items.length);\n\t\tthis.config.onItemChange?.(this.currentItemIndex, this.items.length);\n\t\t// A navigation settles into a new draft worth persisting.\n\t\tthis.notifyAutosaveActivity();\n\t}\n\n\tprivate notifySectionChange(): void {\n\t\tconst q = this.items[this.currentItemIndex];\n\t\tconst sectionIndex = q?.sectionIndex ?? -1;\n\t\tconst totalSections = this.presentedSectionList().length;\n\t\tthis.events.emit('sectionChange', sectionIndex, totalSections);\n\t\tthis.config.onSectionChange?.(sectionIndex, totalSections);\n\t}\n\n\tprivate notifyResponseChange(): void {\n\t\tconst responses = this.sessionCoordinator.getActiveResponses();\n\t\tthis.events.emit('responseChange', responses);\n\t\tthis.config.onResponseChange?.(responses);\n\t\t// Candidate input happened: restart the autosave debounce.\n\t\tthis.notifyAutosaveActivity();\n\t}\n\n\tprivate notifyComplete(results: AssessmentResults): void {\n\t\tthis.events.emit('complete', results);\n\t}\n\n\tprivate notifyBusyChange(busy: boolean): void {\n\t\tthis.events.emit('busyChange', busy);\n\t}\n\n\tprivate notifyTestFeedbackChange(): void {\n\t\tthis.events.emit('testFeedbackChange');\n\t}\n\n\tprivate notifyTimeWarning(remainingSeconds: number): void {\n\t\tthis.events.emit('timeWarning', remainingSeconds);\n\t}\n\n\tprivate notifyPauseChange(): void {\n\t\tconst reason = this.pauseReason;\n\t\tthis.events.emit('pauseChange', this.paused, reason);\n\t\tthis.config.onPauseChange?.(this.paused, reason);\n\t\t// The pause rides the snapshot (`timing.isPaused`), so persist it too.\n\t\tthis.notifyAutosaveActivity();\n\t}\n\n\t/**\n\t * The template defaults an item's new session starts from (QTI `templateDefault`;\n\t * see `templateDefaults.templateDefaultsFor`). The part cache is the player's.\n\t */\n\tprivate templateDefaultsFor(q: FlatItem): Record<string, unknown> | undefined {\n\t\treturn templateDefaultsFor({\n\t\t\tq,\n\t\t\titems: this.items,\n\t\t\tassessment: this.assessment,\n\t\t\toutcomes: this.testOutcomes,\n\t\t\tpersistedSessions: this.state.itemSessions,\n\t\t\tbyPart: this.templateDefaultsByPart,\n\t\t});\n\t}\n\n\tprivate isItemLocked(q: FlatItem): boolean {\n\t\treturn isItemLocked(q, this.scopeLocks, this.assessmentExpired);\n\t}\n\n\t/** The expired scope that closes an item (outermost first); the assessment for a whole-test expiry. */\n\tprivate lockingScopeOf(q: FlatItem | undefined): Pick<AssessmentTimeExpiryEvent, 'scope' | 'identifier'> {\n\t\treturn lockingScopeOf(q, this.scopeLocks, this.assessmentExpired);\n\t}\n\n\t/**\n\t * Nothing open remains (a restore, or a start over, landed on an expired scope with\n\t * no open item after it): the candidate must submit now — the same report the live\n\t * expiry dead end makes, so the shell offers Submit wherever the candidate is.\n\t */\n\tprivate notifyExpiryDeadEnd(): void {\n\t\tif (this.finalized || this.destroyed) return;\n\t\tconst scope = this.lockingScopeOf(this.items[this.currentItemIndex]);\n\t\tthis.notifyTimeExpired({ ...scope, autoFinalized: false, submissionRequired: true });\n\t}\n\n\tprivate nextUnlockedIndex(fromIndex: number): number {\n\t\tfor (let i = fromIndex + 1; i < this.items.length; i++) {\n\t\t\tif (!this.isItemLocked(this.items[i]!)) return i;\n\t\t}\n\t\treturn -1;\n\t}\n\n\t/**\n\t * Whether delivery may land on the item after a closure: no expired limit closed it and\n\t * the review policy lets the candidate be there (QTI `allowReview` once its attempts are\n\t * used up). Later parts are entered fresh, so only the time lock applies to them.\n\t */\n\tprivate isOpenTarget(q: FlatItem): boolean {\n\t\treturn !this.isItemLocked(q) && this.canReviewItem(q);\n\t}\n\n\t/**\n\t * Where delivery goes when the item at `fromIndex` closes (a scope expiry, or a restore\n\t * that lands on a closed item), looking across the whole reachable delivery rather than\n\t * only forward: the next open item of its test part; else — in a nonlinear part — the\n\t * nearest open item before it; else the first open item of a later part (parts are\n\t * delivered in order, so earlier parts are never re-entered, and a part is left only\n\t * when nothing in it is open any more). Forward, only items the delivery rules reach\n\t * count: a part (or, in a linear part, a section or item) whose precondition fails is\n\t * skipped as on any forward step. -1 when nothing open remains: the expiry dead end,\n\t * where the candidate's way out is the submission.\n\t */\n\tprivate openItemAfterClosure(fromIndex: number): number {\n\t\tconst from = this.items[fromIndex];\n\t\tif (!from) return -1;\n\t\tconst decls = this.hasDeliveryRules ? this.navigationDeclarationsFor(from) : undefined;\n\t\tfor (const i of this.eligibleIndexesAfter(fromIndex, decls)) {\n\t\t\tconst q = this.items[i]!;\n\t\t\tif (q.testPart !== from.testPart) break;\n\t\t\tif (this.isOpenTarget(q)) return i;\n\t\t}\n\t\tconst mode = from.testPart.navigationMode;\n\t\tif (mode === 'nonlinear') {\n\t\t\tfor (let i = fromIndex - 1; i >= 0; i--) {\n\t\t\t\tconst q = this.items[i]!;\n\t\t\t\tif (q.testPart !== from.testPart) break;\n\t\t\t\tif (this.isOpenTarget(q)) return i;\n\t\t\t}\n\t\t}\n\t\tfor (const i of this.eligibleIndexesAfter(fromIndex, decls)) {\n\t\t\tconst q = this.items[i]!;\n\t\t\tif (q.testPart !== from.testPart && !this.isItemLocked(q)) return i;\n\t\t}\n\t\treturn -1;\n\t}\n\n\t/**\n\t * A test part, section or item without late submission ran out of time: its items close for the\n\t * candidate, and delivery moves to the next open item — forward in the part, else an open\n\t * question earlier in a nonlinear part, else the next part. Only when nothing open\n\t * remains anywhere reachable is it the expiry dead end.\n\t *\n\t * The end of the test never navigates: while one runs, the expiry only closes the scope\n\t * (the collection takes its items as they stand, `time-expired`). Leaving it — the move\n\t * and its report — waits for that end, and is moot once the end finalized.\n\t */\n\tprivate handleScopeExpired(scope: 'testPart' | 'section' | 'item', identifier: string): void {\n\t\tthis.scopeLocks.lock(scope, identifier);\n\t\tif (this.endReason !== null) {\n\t\t\tthis.expiriesDuringEnd.push({ scope, identifier });\n\t\t\treturn;\n\t\t}\n\t\tthis.leaveExpiredScope(scope, identifier);\n\t}\n\n\t/**\n\t * Close an expired scope for the candidate: move delivery off it, or report the dead\n\t * end. Called from the timer's expiry (`handleScopeExpired`), so the hop is a\n\t * state-changing transition like any other: it queues behind the navigation or\n\t * submission transition in flight and takes the transition lock once that settles,\n\t * instead of racing the in-flight backend request.\n\t */\n\tprivate leaveExpiredScope(scope: 'testPart' | 'section' | 'item', identifier: string): void {\n\t\tthis.queuedExpiryHops += 1;\n\t\tthis.runWhenIdle(async () => {\n\t\t\tthis.queuedExpiryHops -= 1;\n\t\t\t// An end of the test finalized while the hop waited: the move is moot.\n\t\t\tif (this.finalized) return;\n\t\t\tawait this.leaveExpiredScopeLocked(scope, identifier);\n\t\t}).catch((error) => {\n\t\t\t// Silent only when the player was destroyed while the hop waited behind a\n\t\t\t// transition: nothing left to close. Any other rejection (a host listener\n\t\t\t// slipping through, a destroyed-queue cancellation race) is a real expiry\n\t\t\t// failure — report it like the automatic finalization does, instead of\n\t\t\t// swallowing it with the scope left locked.\n\t\t\tif (this.destroyed) return;\n\t\t\tthis.config.onError?.(error instanceof Error ? error : new Error(String(error)));\n\t\t});\n\t}\n\n\t/** The hop itself, run under the transition lock (or inline while the end holds it). */\n\tprivate async leaveExpiredScopeLocked(scope: 'testPart' | 'section' | 'item', identifier: string): Promise<void> {\n\t\tconst current = this.items[this.currentItemIndex];\n\t\tif (!current || !this.isItemLocked(current)) {\n\t\t\t// Delivery is already outside the expired scope; the shell still learns it closed.\n\t\t\tthis.notifyScopeTimeExpired(scope, identifier, true);\n\t\t\treturn;\n\t\t}\n\t\tthis.saveCurrentItemSession();\n\t\tthis.notifyItemChange();\n\t\tconst nextIndex = this.openItemAfterClosure(this.currentItemIndex);\n\t\tif (nextIndex < 0) {\n\t\t\t// Nothing unlocked remains: the candidate must submit now (a later expiry of\n\t\t\t// another already-covered scope reports through its own scope event).\n\t\t\tthis.notifyTimeExpired({\n\t\t\t\tscope,\n\t\t\t\tidentifier,\n\t\t\t\tautoFinalized: false,\n\t\t\t\tsubmissionRequired: true,\n\t\t\t});\n\t\t\tthis.notifyScopeTimeExpired(scope, identifier, false);\n\t\t\treturn;\n\t\t}\n\t\tthis.notifyScopeTimeExpired(scope, identifier, true, nextIndex);\n\t\tthis.pendingEntryIndex = nextIndex;\n\t\ttry {\n\t\t\tawait this.performNavigateTo(nextIndex, { restoring: true });\n\t\t} catch (error) {\n\t\t\t// The expiry's hop failed: the shell's typed failure screen (localized, with\n\t\t\t// Retry) replaces the \"moving on\" flow instead of a silently stuck delivery.\n\t\t\tthis.recordEntryFailure(error);\n\t\t}\n\t}\n\n\t/**\n\t * The whole-test hard limit expired without late submission (TimeManager calls this\n\t * only for that case): finalize like a submit so pending responses are collected and\n\t * outcomes computed, then report the expiry. If finalization fails, the session stays\n\t * open and the shell offers the Submit action.\n\t */\n\tprivate handleAssessmentTimeExpired(): void {\n\t\tthis.assessmentExpired = true;\n\t\tif (this.finalized) {\n\t\t\tthis.notifyTimeExpired({ scope: 'assessment', autoFinalized: false, submissionRequired: false });\n\t\t\treturn;\n\t\t}\n\t\tvoid this.autoFinalizeForTimeExpiry();\n\t}\n\n\tprivate autoFinalizeForTimeExpiry(): void {\n\t\tif (this.destroyed || this.finalized) return;\n\t\t// Queued behind a candidate transition in flight, however many administrative\n\t\t// transitions (queued expiry hops, a force submit, a host acting on idle) take the\n\t\t// lock before it: `runWhenIdle` takes the lock the moment it settles, so the end is\n\t\t// never starved and no candidate action slips in first.\n\t\tvoid this.runWhenIdle(async () => {\n\t\t\t// The transition in flight ended the test itself: nothing left to finalize, and\n\t\t\t// (as before) no expiry notice on top of its own ending.\n\t\t\tif (this.finalized) return false;\n\t\t\tawait this.endTestInternal({ reason: 'expiry' });\n\t\t\treturn true;\n\t\t})\n\t\t\t.then((ended) => {\n\t\t\t\tif (!ended || this.destroyed || !this.finalized) return;\n\t\t\t\tthis.notifyTimeExpired({ scope: 'assessment', autoFinalized: true, submissionRequired: false });\n\t\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\tif (this.destroyed) return;\n\t\t\t\t// Finalization failed: the shell's expiry notice with a Submit action and the\n\t\t\t\t// host's error surface keep the candidate unstuck and the host informed.\n\t\t\t\tthis.config.onError?.(error instanceof Error ? error : new Error(String(error)));\n\t\t\t\tthis.notifyTimeExpired({ scope: 'assessment', autoFinalized: false, submissionRequired: true });\n\t\t\t});\n\t}\n\n\tprivate notifyTimeExpired(event: AssessmentTimeExpiryEvent): void {\n\t\tthis.events.emit('timeExpired', event);\n\t\tthis.config.onTimeExpired?.(event);\n\t}\n\n\tprivate notifyScopeTimeExpired(\n\t\tscope: ScopeTimeExpiryEvent['scope'],\n\t\tidentifier: string,\n\t\tdeliveryContinues: boolean,\n\t\tnextIndex?: number,\n\t): void {\n\t\tconst event: ScopeTimeExpiryEvent = {\n\t\t\tscope,\n\t\t\tidentifier,\n\t\t\tdeliveryContinues,\n\t\t\t...(nextIndex === undefined ? {} : { nextIndex }),\n\t\t};\n\t\tthis.events.emit('scopeTimeExpired', event);\n\t\tthis.config.onScopeTimeExpired?.(event);\n\t}\n\n\tprivate notifyTimeTick(remainingSeconds: number, elapsedSeconds: number): void {\n\t\tthis.events.emit('timeTick', remainingSeconds, elapsedSeconds);\n\t}\n\n\t/**\n\t * Get the i18n provider instance\n\t * @returns I18nProvider instance\n\t */\n\tpublic getI18nProvider(): I18nProvider {\n\t\treturn this.i18nProvider;\n\t}\n\n\t/**\n\t * The provider used when the host passes none: English, from the catalog\n\t * `@pie-qti/i18n` bundles eagerly.\n\t */\n\tprivate createDefaultI18nProvider(): I18nProvider {\n\t\treturn new DefaultI18nProvider('en-US');\n\t}\n}\n"]}