cognikit 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +316 -0
- package/dist/core/BaseInteraction.d.ts +78 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/utilities/ProgressTracker.d.ts +58 -0
- package/dist/core/utilities/ScoringTracker.d.ts +0 -0
- package/dist/core/utilities/index.d.ts +1 -0
- package/dist/engines/index.d.ts +2 -0
- package/dist/engines/tables/implementation/graders.d.ts +23 -0
- package/dist/engines/tables/implementation/index.d.ts +4 -0
- package/dist/engines/tables/implementation/parsers.d.ts +36 -0
- package/dist/engines/tables/implementation/utils.d.ts +18 -0
- package/dist/engines/tables/implementation/validators.d.ts +9 -0
- package/dist/engines/tables/index.d.ts +2 -0
- package/dist/engines/tables/script.d.ts +37 -0
- package/dist/engines/text/implementation/graders.d.ts +69 -0
- package/dist/engines/text/implementation/index.d.ts +3 -0
- package/dist/engines/text/implementation/parsers.d.ts +9 -0
- package/dist/engines/text/implementation/validators.d.ts +41 -0
- package/dist/engines/text/index.d.ts +2 -0
- package/dist/engines/text/script.d.ts +56 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +4518 -0
- package/dist/index.js.map +7 -0
- package/dist/interactions/adjacency-table/index.d.ts +26 -0
- package/dist/interactions/categorize-the-words/index.d.ts +2 -0
- package/dist/interactions/categorize-the-words/sequential.d.ts +33 -0
- package/dist/interactions/categorize-the-words/static.d.ts +22 -0
- package/dist/interactions/classification-matrix/index.d.ts +31 -0
- package/dist/interactions/fill-blanks/index.d.ts +2 -0
- package/dist/interactions/fill-blanks/sequential.d.ts +32 -0
- package/dist/interactions/fill-blanks/static.d.ts +23 -0
- package/dist/interactions/index.d.ts +17 -0
- package/dist/interactions/list-recall/implementation/grader.d.ts +0 -0
- package/dist/interactions/list-recall/implementation/index.d.ts +0 -0
- package/dist/interactions/list-recall/implementation/parser.d.ts +0 -0
- package/dist/interactions/list-recall/implementation/validator.d.ts +0 -0
- package/dist/interactions/list-recall/index.d.ts +1 -0
- package/dist/interactions/list-recall/script.d.ts +25 -0
- package/dist/interactions/lookup-table/index.d.ts +26 -0
- package/dist/interactions/mark-the-words/index.d.ts +2 -0
- package/dist/interactions/mark-the-words/sequential.d.ts +34 -0
- package/dist/interactions/mark-the-words/static.d.ts +40 -0
- package/dist/interactions/mcq-mrq/implementation/grader.d.ts +20 -0
- package/dist/interactions/mcq-mrq/implementation/index.d.ts +3 -0
- package/dist/interactions/mcq-mrq/implementation/parser.d.ts +21 -0
- package/dist/interactions/mcq-mrq/implementation/validator.d.ts +17 -0
- package/dist/interactions/mcq-mrq/index.d.ts +2 -0
- package/dist/interactions/mcq-mrq/script.d.ts +37 -0
- package/dist/interactions/nary-choice-table/index.d.ts +28 -0
- package/dist/interactions/open-classification/index.d.ts +32 -0
- package/dist/interactions/rank-order/implementation/grader.d.ts +15 -0
- package/dist/interactions/rank-order/implementation/index.d.ts +3 -0
- package/dist/interactions/rank-order/implementation/parser.d.ts +25 -0
- package/dist/interactions/rank-order/implementation/validator.d.ts +3 -0
- package/dist/interactions/rank-order/index.d.ts +2 -0
- package/dist/interactions/rank-order/script.d.ts +39 -0
- package/dist/interactions/register-builtins.d.ts +1 -0
- package/dist/interactions/registry.d.ts +30 -0
- package/dist/interactions/sequential-classification/index.d.ts +49 -0
- package/dist/interactions/shared/association-implementation/grader.d.ts +3 -0
- package/dist/interactions/shared/association-implementation/index.d.ts +1 -0
- package/dist/interactions/shared/association-implementation/parser.d.ts +0 -0
- package/dist/interactions/shared/association-implementation/validator.d.ts +0 -0
- package/dist/interactions/shared/classification-implementation/grader.d.ts +3 -0
- package/dist/interactions/shared/classification-implementation/index.d.ts +1 -0
- package/dist/interactions/shared/classification-implementation/parser.d.ts +11 -0
- package/dist/interactions/shared/classification-implementation/validator.d.ts +3 -0
- package/dist/interactions/simultaneous-association/index.d.ts +34 -0
- package/dist/interactions/text-transformation/index.d.ts +2 -0
- package/dist/interactions/text-transformation/sequential.d.ts +37 -0
- package/dist/interactions/text-transformation/static.d.ts +47 -0
- package/dist/shared/assets.d.ts +6 -0
- package/dist/shared/dsl.d.ts +9 -0
- package/dist/shared/index.d.ts +4 -0
- package/dist/shared/managers/AnimationsManager.d.ts +55 -0
- package/dist/shared/managers/SoundManager.d.ts +78 -0
- package/dist/shared/managers/index.d.ts +3 -0
- package/dist/shared/types.d.ts +25 -0
- package/dist/shared/utils.d.ts +13 -0
- package/dist/shell/index.d.ts +1 -0
- package/dist/shell/simple-shell/index.d.ts +1 -0
- package/dist/shell/simple-shell/script.d.ts +61 -0
- package/dist/types/Assets.d.ts +40 -0
- package/dist/types/Data.d.ts +32 -0
- package/dist/types/Global.d.ts +24 -0
- package/dist/types/Grading.d.ts +8 -0
- package/dist/types/Input.d.ts +35 -0
- package/dist/types/Interactions.d.ts +28 -0
- package/dist/types/Tables.d.ts +40 -0
- package/dist/types/Text.d.ts +125 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/ui/index.d.ts +2 -0
- package/dist/ui/input/color/color-picker.d.ts +37 -0
- package/dist/ui/input/color/index.d.ts +0 -0
- package/dist/ui/input/index.d.ts +1 -0
- package/dist/ui/input/input/index.d.ts +1 -0
- package/dist/ui/input/input/input.d.ts +22 -0
- package/dist/ui/input/letter/index.d.ts +0 -0
- package/dist/ui/input/letter/letter-picker.d.ts +27 -0
- package/dist/ui/misc/block.d.ts +14 -0
- package/dist/ui/misc/chip/chip.d.ts +46 -0
- package/dist/ui/misc/chip/index.d.ts +1 -0
- package/dist/ui/misc/dialog.d.ts +24 -0
- package/dist/ui/misc/index.d.ts +4 -0
- package/dist/ui/misc/media.d.ts +54 -0
- package/package.json +59 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/core/utilities/ProgressTracker.ts", "../src/shared/managers/AnimationsManager.ts", "../src/shared/managers/SoundManager.ts", "../src/core/BaseInteraction.ts", "../src/ui/misc/block.ts", "../src/ui/misc/chip/index.html", "../src/ui/misc/chip/styles.css", "../src/ui/misc/dialog.ts", "../src/ui/misc/chip/chip.ts", "../src/ui/misc/media.ts", "../src/ui/input/input/input.ts", "../src/engines/tables/implementation/parsers.ts", "../src/engines/tables/implementation/validators.ts", "../src/engines/tables/implementation/utils.ts", "../src/engines/tables/implementation/graders.ts", "../src/engines/tables/styles.css", "../node_modules/.pnpm/js-yaml@4.1.1/node_modules/js-yaml/dist/js-yaml.mjs", "../src/shared/utils.ts", "../src/engines/tables/script.ts", "../src/shared/dsl.ts", "../src/engines/text/implementation/parsers.ts", "../src/engines/text/implementation/validators.ts", "../src/engines/text/implementation/graders.ts", "../src/engines/text/styles.css", "../src/engines/text/script.ts", "../src/interactions/registry.ts", "../src/shared/assets.ts", "../src/interactions/shared/classification-implementation/grader.ts", "../src/interactions/open-classification/index.ts", "../src/interactions/sequential-classification/index.ts", "../src/interactions/mcq-mrq/implementation/grader.ts", "../src/interactions/mcq-mrq/script.ts", "../src/interactions/mcq-mrq/implementation/parser.ts", "../src/interactions/mcq-mrq/implementation/validator.ts", "../src/interactions/shared/association-implementation/grader.ts", "../src/interactions/simultaneous-association/index.ts", "../src/interactions/list-recall/script.ts", "../src/interactions/lookup-table/index.ts", "../src/interactions/classification-matrix/index.ts", "../src/interactions/nary-choice-table/index.ts", "../src/interactions/adjacency-table/index.ts", "../src/interactions/mark-the-words/static.ts", "../src/interactions/mark-the-words/sequential.ts", "../src/interactions/categorize-the-words/static.ts", "../src/interactions/categorize-the-words/sequential.ts", "../src/interactions/text-transformation/static.ts", "../src/interactions/text-transformation/sequential.ts", "../src/interactions/fill-blanks/static.ts", "../src/interactions/fill-blanks/sequential.ts", "../src/interactions/rank-order/implementation/validator.ts", "../src/interactions/rank-order/implementation/grader.ts", "../src/interactions/rank-order/implementation/parser.ts", "../src/interactions/rank-order/script.ts", "../src/interactions/register-builtins.ts", "../src/shell/simple-shell/index.html", "../src/shell/simple-shell/styles.css", "../src/shell/simple-shell/script.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * ProgressTracker - Utility for tracking interaction progress\n *\n * Shell-agnostic progress tracking that can be used by any interaction.\n * Maintains current/total state and calculates percentage.\n *\n * @example\n * ```typescript\n * const tracker = new ProgressTracker();\n * tracker.initialize(10);\n * tracker.increment(); // current = 1\n * tracker.getPercentage(); // 10\n * ```\n */\nexport class ProgressTracker {\n\n\tprivate _current = 0;\n\tpublic _total = 0;\n\n\t/**\n\t * Initialize tracker with total number of items\n\t */\n\tinitialize(total: number): void {\n\t\tif (total < 0) {\n\t\t\tthrow new Error('Total must be non-negative');\n\t\t}\n\t\tthis._total = total;\n\t\tthis._current = 0;\n\t}\n\n\t/**\n\t * Set current progress value\n\t */\n\tsetCurrent(value: number): void {\n\t\tif (value < 0) {\n\t\t\tthis._current = 0;\n\t\t} else if (value > this._total) {\n\t\t\tthis._current = this._total;\n\t\t} else {\n\t\t\tthis._current = value;\n\t\t}\n\t}\n\n\t/**\n\t * Increment progress by 1\n\t */\n\tincrement(): void {\n\t\tif (this._current < this._total) {\n\t\t\tthis._current++;\n\t\t}\n\t}\n\n\t/**\n\t * Decrement progress by 1\n\t */\n\tdecrement(): void {\n\t\tif (this._current > 0) {\n\t\t\tthis._current--;\n\t\t}\n\t}\n\n\t/**\n\t * Reset progress to 0\n\t */\n\treset(): void {\n\t\tthis._current = 0;\n\t}\n\n\t/**\n\t * Get progress percentage (0-100)\n\t */\n\tgetPercentage(): number {\n\t\tif (this._total === 0) return 0;\n\t\treturn Math.round((this._current / this._total) * 100);\n\t}\n\n\t/**\n\t * Check if progress is complete\n\t */\n\tisComplete(): boolean {\n\t\treturn this._current === this._total && this._total > 0;\n\t}\n\n\t/**\n\t * Get current value\n\t */\n\tget current(): number {\n\t\treturn this._current;\n\t}\n\n\t/**\n\t * Get total value\n\t */\n\tget total(): number {\n\t\treturn this._total;\n\t}\n\n\t/**\n\t * Get remaining items\n\t */\n\tget remaining(): number {\n\t\treturn Math.max(0, this._total - this._current);\n\t}\n}\n", "/**\n * AnimationsManager - Utility for managing animations in Shadow DOM components\n *\n * Shadow DOM components cannot access keyframes defined in the main document.\n * This manager injects keyframe definitions into Shadow DOM and provides\n * a simple API to apply animations to elements.\n */\n\nexport type AnimationName =\n\t| 'shake'\n\t| 'pulse-green'\n\t| 'bounce-in'\n\t| 'float'\n\t| 'rubber'\n\t| 'jello'\n\t| 'heartbeat'\n\t| 'shimmer'\n\t| 'wobble'\n\t| 'pop'\n\t| 'fade-slide'\n\t| 'swing'\n\t| 'orbit'\n\t| 'flash'\n\t| 'spin-pulse';\n\nexport interface AnimationOptions {\n\tduration?: string;\n\ttiming?: string;\n\titerations?: string | number;\n\tdelay?: string;\n}\n\n/**\n * All keyframe definitions\n */\nconst KEYFRAMES = `\n@keyframes shake {\n\t0%, 100% { transform: translateX(0); }\n\t25% { transform: translateX(-8px); }\n\t75% { transform: translateX(8px); }\n}\n\n@keyframes pulse-green {\n\t0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }\n\t70% { box-shadow: 0 0 0 15px rgba(34, 197, 94, 0); }\n\t100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }\n}\n\n@keyframes bounce-in {\n\t0% { opacity: 0; transform: scale(0.3); }\n\t100% { opacity: 1; transform: scale(1); }\n}\n\n@keyframes float {\n\t0%, 100% { transform: translateY(0); }\n\t50% { transform: translateY(-10px); }\n}\n\n@keyframes rubber {\n\t0% { transform: scale3d(1, 1, 1); }\n\t30% { transform: scale3d(1.25, 0.75, 1); }\n\t40% { transform: scale3d(0.75, 1.25, 1); }\n\t50% { transform: scale3d(1.15, 0.85, 1); }\n\t100% { transform: scale3d(1, 1, 1); }\n}\n\n@keyframes jello {\n\t11.1% { transform: none; }\n\t22.2% { transform: skewX(-12.5deg) skewY(-12.5deg); }\n\t44.4% { transform: skewX(6.25deg) skewY(6.25deg); }\n\t66.6% { transform: skewX(-1.56deg) skewY(-1.56deg); }\n\t100% { transform: none; }\n}\n\n@keyframes heartbeat {\n\t0% { transform: translateY(-50%) scale(1); }\n\t14% { transform: translateY(-50%) scale(1.1); }\n\t28% { transform: translateY(-50%) scale(1); }\n\t42% { transform: translateY(-50%) scale(1.1); }\n\t70% { transform: translateY(-50%) scale(1); }\n}\n\n@keyframes shimmer {\n\t0% { background-position: 200% 0; }\n\t100% { background-position: -200% 0; }\n}\n\n@keyframes wobble {\n\t0%, 100% { transform: translateX(0); }\n\t25% { transform: rotate(-5deg); }\n\t75% { transform: rotate(5deg); }\n}\n\n@keyframes pop {\n\t0% { transform: scale(0); }\n\t100% { transform: scale(1); }\n}\n\n@keyframes fade-slide {\n\tfrom { opacity:0; transform: translateY(10px); }\n\tto { opacity:1; transform: translateY(0); }\n}\n\n@keyframes swing {\n\t20% { transform: rotate(15deg); }\n\t40% { transform: rotate(-10deg); }\n\t60% { transform: rotate(5deg); }\n\t80% { transform: rotate(-5deg); }\n\t100% { transform: rotate(0deg); }\n}\n\n@keyframes spin-pulse {\n 0% { transform: translateY(-50%) scale(1) rotate(0deg); }\n 50% { transform: translateY(-50%) scale(1.8) rotate(180deg); color: #fbbc05; }\n 100% { transform: translateY(-50%) scale(1) rotate(360deg); }\n}\n\n@keyframes flash {\n\t0%, 50%, 100% { opacity: 1; }\n\t25%, 75% { opacity: 0; }\n}\n\n@keyframes orbit {\n\t0% { transform: rotate(0deg) translateX(0) rotate(0deg); }\n\t50% { transform: rotate(180deg) translateX(50px) rotate(-180deg) scale(1.5); }\n\t100% { transform: rotate(360deg) translateX(0) rotate(-360deg); }\n}\n`;\n\n/**\n * Default animation configurations\n */\nconst DEFAULT_CONFIG: Record<AnimationName, string> = {\n\t'shake': '0.4s',\n\t'pulse-green': '2s infinite',\n\t'bounce-in': '0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55)',\n\t'float': '3s ease-in-out infinite',\n\t'rubber': '0.6s',\n\t'jello': '0.8s',\n\t'heartbeat': '1.5s ease-in-out infinite',\n\t'shimmer': '2s infinite',\n\t'wobble': '4s infinite',\n\t'pop': '0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)',\n\t'fade-slide': '0.5s ease-out',\n\t'swing': '2s infinite',\n\t'flash': '0.5s',\n\t'orbit': '1s ease-in-out',\n\t'spin-pulse': '3s cubic-bezier(0.175, 0.885, 0.32, 1.275) infinite'\n};\n\nexport class AnimationsManager {\n\n\tprivate static injectedRoots = new WeakSet<ShadowRoot>();\n\n\tpublic isEnabled = false;\n\n\t/**\n\t * Inject keyframes into a Shadow DOM\n\t * Call this once during component initialization\n\t */\n\tstatic injectKeyframes(shadowRoot: ShadowRoot): void {\n\t\tif (this.injectedRoots.has(shadowRoot)) {\n\t\t\treturn; \n\t\t}\n\n\t\tconst styleEl = document.createElement('style');\n\t\tstyleEl.textContent = KEYFRAMES;\n\t\tshadowRoot.prepend(styleEl);\n\n\t\tthis.injectedRoots.add(shadowRoot);\n\t}\n\n\t/**\n\t * Apply animation to an element\n\t * @param element - The element to animate (can be in Shadow DOM)\n\t * @param animationName - Name of the animation\n\t * @param options - Optional animation configuration\n\t */\n\tanimate(\n\t\telement: HTMLElement,\n\t\tanimationName: AnimationName,\n\t\toptions?: AnimationOptions\n\t): void {\n\n\t\t\n\t\tif (!this.isEnabled) return;\n\n\t\telement.style.animation = '';\n\n\t\tconst duration = options?.duration || '';\n\t\tconst timing = options?.timing || '';\n\t\tconst iterations = options?.iterations || '';\n\t\tconst delay = options?.delay || '';\n\n\t\t// Build animation string\n\t\tlet animation = '';\n\n\t\tif (duration || timing || iterations || delay) {\n\t\t\tanimation = `${animationName} ${duration} ${timing} ${delay} ${iterations}`.trim();\n\t\t} else {\n\t\t\t// Use default config\n\t\t\tanimation = `${animationName} ${DEFAULT_CONFIG[animationName]}`;\n\t\t}\n\n\t\telement.style.animation = animation;\n\t}\n\n\t/**\n\t * Stop/clear animation on an element\n\t */\n\tstop(element: HTMLElement): void {\n\t\telement.style.animation = '';\n\t}\n\n\t/**\n\t * Animate element for a specific duration then auto-stop\n\t * @param element - The element to animate\n\t * @param animationName - Name of the animation\n\t * @param durationMs - Duration in milliseconds before auto-stopping\n\t * @param options - Optional animation configuration\n\t */\n\tanimateFor(\n\t\telement: HTMLElement,\n\t\tanimationName: AnimationName,\n\t\tdurationMs: number,\n\t\toptions?: AnimationOptions\n\t): void {\n\t\tif (!this.isEnabled) return;\n\n\t\t// Start animation\n\t\tthis.animate(element, animationName, options);\n\n\t\t// Stop after specified time\n\t\tsetTimeout(() => {\n\t\t\tthis.stop(element);\n\t\t}, durationMs);\n\t}\n\n\t/**\n\t * Get all available animation names\n\t */\n\tgetAvailableAnimations(): AnimationName[] {\n\t\treturn Object.keys(DEFAULT_CONFIG) as AnimationName[];\n\t}\n\n\t/**\n\t * Apply animation using CSS class (for hover/active states)\n\t * Requires keyframes to be available in the component's Shadow DOM\n\t */\n\taddAnimationClass(element: HTMLElement, animationName: AnimationName): void {\n\t\tif (!this.isEnabled) return;\n\t\telement.classList.add(`anim-${animationName}`);\n\t}\n\n\t/**\n\t * Remove animation class\n\t */\n\tremoveAnimationClass(element: HTMLElement, animationName: AnimationName): void {\n\t\telement.classList.remove(`anim-${animationName}`);\n\t}\n}\n", "/**\n * SoundManager - Centralized audio playback utility\n *\n * Features:\n * - Play local sounds from /public/assets/audio/\n * - Play sounds from external URLs\n * - Preload and cache audio for better performance\n * - Volume control with fade effects\n * - Error handling and fallbacks\n */\n\nexport type SoundName = 'success' | 'failure' | 'pop' | 'low-time' | 'start' | 'flip';\n\nexport interface PlaySoundOptions {\n\tvolume?: number; // 0.0 to 1.0 (default: 1.0)\n\tloop?: boolean; // Loop the sound (default: false)\n\tfadeIn?: number; // Fade in duration in ms (default: 0)\n\tfadeOut?: number; // Fade out duration in ms (default: 0)\n\tplaybackRate?: number; // Playback speed (default: 1.0)\n\tonEnd?: () => void; // Callback when sound finishes\n\tonError?: (error: Error) => void; // Callback on error\n}\n\nexport class SoundManager {\n\tpublic isEnabled = true;\n\n\tprivate audioCache: Map<string, HTMLAudioElement> = new Map();\n\tprivate activeSounds: Set<HTMLAudioElement> = new Set();\n\tprivate baseUrl = 'assets/audio/';\n\n\tprivate localSounds: Record<SoundName, string> = {\n\t\t'success': 'success.mp3',\n\t\t'failure': 'failure.mp3',\n\t\t'pop': 'pop.mp3',\n\t\t'low-time': 'low-time.mp3',\n\t\t'start': 'start.mp3',\n\t\t'flip': 'flip.mp3'\n\t};\n\n\tconstructor() {\n\t\tif (typeof window !== 'undefined') {\n\t\t\tconst base = document.querySelector('base')?.href || window.location.origin;\n\t\t\tthis.baseUrl = new URL('assets/audio/', base).href;\n\t\t}\n\t}\n\n\t/**\n\t * Play a sound by name or URL\n\t * @param soundNameOrUrl - Predefined sound name or full URL\n\t * @param options - Playback options\n\t */\n\tpublic async playSound(\n\t\tsoundNameOrUrl: SoundName | string,\n\t\toptions: PlaySoundOptions = {}\n\t): Promise<void> {\n\t\tif (!this.isEnabled) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst url = this.resolveUrl(soundNameOrUrl);\n\t\t\tconst audio = await this.getAudio(url);\n\n\t\t\tthis.configureAudio(audio, options);\n\t\t\tawait this.playAudio(audio, options);\n\t\t} catch (error) {\n\t\t\tconst err = error instanceof Error ? error : new Error(String(error));\n\t\t\tconsole.warn(`[SoundManager] Failed to play sound \"${soundNameOrUrl}\":`, err.message);\n\n\t\t\tif (options.onError) {\n\t\t\t\toptions.onError(err);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Preload sounds for better performance\n\t * @param sounds - Array of sound names or URLs to preload\n\t */\n\tpublic async preload(sounds: (SoundName | string)[]): Promise<void> {\n\t\tconst promises = sounds.map(async (sound) => {\n\t\t\ttry {\n\t\t\t\tconst url = this.resolveUrl(sound);\n\t\t\t\tawait this.getAudio(url);\n\t\t\t} catch (error) {\n\t\t\t\tconsole.warn(`[SoundManager] Failed to preload sound \"${sound}\":`, error);\n\t\t\t}\n\t\t});\n\n\t\tawait Promise.allSettled(promises);\n\t}\n\n\t/**\n\t * Stop all currently playing sounds\n\t */\n\tpublic stopAll(): void {\n\t\tthis.activeSounds.forEach(audio => {\n\t\t\taudio.pause();\n\t\t\taudio.currentTime = 0;\n\t\t});\n\t\tthis.activeSounds.clear();\n\t}\n\n\t/**\n\t * Stop a specific sound\n\t * @param soundNameOrUrl - Sound to stop\n\t */\n\tpublic stop(soundNameOrUrl: SoundName | string): void {\n\t\tconst url = this.resolveUrl(soundNameOrUrl);\n\t\tconst audio = this.audioCache.get(url);\n\n\t\tif (audio) {\n\t\t\taudio.pause();\n\t\t\taudio.currentTime = 0;\n\t\t\tthis.activeSounds.delete(audio);\n\t\t}\n\t}\n\n\t/**\n\t * Clear the audio cache\n\t */\n\tpublic clearCache(): void {\n\t\tthis.stopAll();\n\t\tthis.audioCache.clear();\n\t}\n\n\t/**\n\t * Set global volume for all future sounds\n\t * @param volume - Volume level (0.0 to 1.0)\n\t */\n\tpublic setGlobalVolume(volume: number): void {\n\t\tconst clampedVolume = Math.max(0, Math.min(1, volume));\n\n\t\tthis.activeSounds.forEach(audio => {\n\t\t\taudio.volume = clampedVolume;\n\t\t});\n\t}\n\n\t// ==================== PRIVATE METHODS ====================\n\n\t/**\n\t * Resolve sound name to full URL\n\t */\n\tprivate resolveUrl(soundNameOrUrl: SoundName | string): string {\n\t\t// Check if it's a local sound name\n\t\tif (soundNameOrUrl in this.localSounds) {\n\t\t\tconst filename = this.localSounds[soundNameOrUrl as SoundName];\n\t\t\treturn `${this.baseUrl}${filename}`;\n\t\t}\n\n\t\t// Check if it's already a full URL\n\t\tif (soundNameOrUrl.startsWith('http://') || soundNameOrUrl.startsWith('https://')) {\n\t\t\treturn soundNameOrUrl;\n\t\t}\n\n\t\t// Treat as relative path\n\t\treturn `${this.baseUrl}${soundNameOrUrl}`;\n\t}\n\n\t/**\n\t * Get or create audio element\n\t */\n\tprivate async getAudio(url: string): Promise<HTMLAudioElement> {\n\t\t// Return cached audio if available\n\t\tif (this.audioCache.has(url)) {\n\t\t\treturn this.audioCache.get(url)!.cloneNode(true) as HTMLAudioElement;\n\t\t}\n\n\t\t// Create new audio element\n\t\tconst audio = new Audio();\n\n\t\t// Set up loading with timeout\n\t\tconst loaded = new Promise<void>((resolve, reject) => {\n\t\t\tconst timeout = setTimeout(() => {\n\t\t\t\treject(new Error('Audio loading timeout'));\n\t\t\t}, 10000); // 10 second timeout\n\n\t\t\taudio.addEventListener('canplaythrough', () => {\n\t\t\t\tclearTimeout(timeout);\n\t\t\t\tresolve();\n\t\t\t}, { once: true });\n\n\t\t\taudio.addEventListener('error', () => {\n\t\t\t\tclearTimeout(timeout);\n\t\t\t\treject(new Error(`Failed to load audio: ${url}`));\n\t\t\t}, { once: true });\n\t\t});\n\n\t\t// Start loading\n\t\taudio.src = url;\n\t\taudio.preload = 'auto';\n\t\taudio.load();\n\n\t\t// Wait for audio to be ready\n\t\tawait loaded;\n\n\t\t// Cache the original\n\t\tthis.audioCache.set(url, audio);\n\n\t\t// Return a clone for actual playback\n\t\treturn audio.cloneNode(true) as HTMLAudioElement;\n\t}\n\n\t/**\n\t * Configure audio element with options\n\t */\n\tprivate configureAudio(audio: HTMLAudioElement, options: PlaySoundOptions): void {\n\t\taudio.volume = options.volume !== undefined ? Math.max(0, Math.min(1, options.volume)) : 1.0;\n\t\taudio.loop = options.loop ?? false;\n\t\taudio.playbackRate = options.playbackRate ?? 1.0;\n\n\t\t// Apply fade in\n\t\tif (options.fadeIn && options.fadeIn > 0) {\n\t\t\taudio.volume = 0;\n\t\t\tthis.fadeVolume(audio, options.volume ?? 1.0, options.fadeIn);\n\t\t}\n\t}\n\n\t/**\n\t * Play audio with error handling\n\t */\n\tprivate async playAudio(audio: HTMLAudioElement, options: PlaySoundOptions): Promise<void> {\n\t\tthis.activeSounds.add(audio);\n\n\t\tconst cleanup = () => {\n\t\t\tthis.activeSounds.delete(audio);\n\t\t\tif (options.onEnd) {\n\t\t\t\toptions.onEnd();\n\t\t\t}\n\t\t};\n\n\t\taudio.addEventListener('ended', cleanup, { once: true });\n\n\t\tif (options.fadeOut && options.fadeOut > 0 && !options.loop) {\n\t\t\taudio.addEventListener('timeupdate', () => {\n\t\t\t\tconst remainingTime = audio.duration - audio.currentTime;\n\t\t\t\tif (remainingTime <= options.fadeOut! / 1000) {\n\t\t\t\t\tthis.fadeVolume(audio, 0, options.fadeOut!);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\ttry {\n\t\t\tawait audio.play();\n\t\t} catch (error) {\n\t\t\tthis.activeSounds.delete(audio);\n\t\t\tthrow new Error(`Playback failed: ${error instanceof Error ? error.message : String(error)}`);\n\t\t}\n\t}\n\n\t/**\n\t * Fade volume over time\n\t */\n\tprivate fadeVolume(audio: HTMLAudioElement, targetVolume: number, duration: number): void {\n\t\tconst startVolume = audio.volume;\n\t\tconst volumeDelta = targetVolume - startVolume;\n\t\tconst startTime = Date.now();\n\n\t\tconst fade = () => {\n\t\t\tconst elapsed = Date.now() - startTime;\n\t\t\tconst progress = Math.min(elapsed / duration, 1);\n\n\t\t\taudio.volume = startVolume + (volumeDelta * progress);\n\n\t\t\tif (progress < 1 && this.activeSounds.has(audio)) {\n\t\t\t\trequestAnimationFrame(fade);\n\t\t\t}\n\t\t};\n\n\t\trequestAnimationFrame(fade);\n\t}\n}\n\nexport const soundManager = new SoundManager();\n", "import { ProgressTracker } from \"./utilities/ProgressTracker\";\nimport { Variant, ValidationResult } from \"../shared/types\";\nimport { Validator } from \"../types/Global\";\nimport { InteractionConfig, InteractionMechanic } from \"../types/Interactions\";\nimport { InteractionData } from \"../types/Data\";\nimport { NormalizedAssets } from \"../types/Assets\";\nimport { AnimationsManager, SoundManager } from \"../shared/managers\";\n\nexport type InteractionEventMap = {\n\t'interaction:ready': CustomEvent<{ id: string }>;\n\t'interaction:progress': CustomEvent<{ current: number; total: number; percentage: number }>;\n\t'interaction:state-change': CustomEvent<{ state: any; isComplete: boolean }>;\n\t'interaction:complete': CustomEvent<{ state: any; id: string }>;\n\t'interaction:hint-shown': CustomEvent<{ message?: string }>;\n\t'interaction:error': CustomEvent<{ error: Error; message: string }>;\n};\n\nexport abstract class BaseInteraction<T extends InteractionData> extends HTMLElement {\n\t\n\tpublic readonly id: string;\n\t\n\tabstract readonly interactionMechanic: InteractionMechanic;\n\t// abstract readonly isSequential: boolean;\n\t// abstract readonly congnitiveOp: CognitiveOp;\n\t// abstract readonly implementsProgress: boolean;\n\t\n\t// abstract validator: (data: InteractionData): boolean;\n\t// abstract parser: (code: string): GrammarParsingResult;\n\t// abstract grader: (data: InteractionData, userResponse: unknown): GradingResult;\n\n\tpublic isValid = true;\n\tpublic implementsProgress = true;\n\n\tprotected data: T;\n\tpublic config: InteractionConfig;\n\tprotected assets: NormalizedAssets | null;\n\t\n\t// utilities\n\t// public scoringTracker: ScoringTracker;\n\tpublic progressTracker: ProgressTracker;\n\tprotected animationsManager: AnimationsManager;\n\tprotected soundManager: SoundManager;\n\n\tprivate _initialized = false;\n\tpublic errors: string = '';\n\n\tconstructor(data: T, config: InteractionConfig, assets?: NormalizedAssets | null, validator?: Validator) {\n\t\tsuper();\n\n\t\t// Handle undefined parameters gracefully - set defaults\n\t\tif (!data || !config) {\n\t\t\tconsole.warn('[BaseInteraction] Constructor called without required parameters');\n\t\t\tthis.id = crypto.randomUUID();\n\t\t\tthis.data = data;\n\t\t\tthis.config = config || {} as InteractionConfig;\n\t\t\tthis.assets = assets || null;\n\t\t\tthis.isValid = false;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.id = crypto.randomUUID();\n\t\tthis.data = data;\n\t\tthis.config = config;\n\t\tthis.assets = assets || null;\n\n\t\tif (validator) {\n\t\t\tconst validationResult: ValidationResult = validator(this.data);\n\t\t\tif (!validationResult.ok) {\n\t\t\t\tthis.isValid = false;\n\t\t\t\tObject.entries(validationResult.errors).forEach(([k, v]) => {\n\t\t\t\t\tthis.errors = `${this.errors}\\n ${k}: ${v}`;\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t// this.scoringTracker = new ScoringTracker();\n\t\tthis.progressTracker = new ProgressTracker();\n\n\t\tthis.soundManager = new SoundManager();\n\t\tthis.animationsManager = new AnimationsManager();\n\n\t\t// Safely access config properties with fallbacks\n\t\tthis.animationsManager.isEnabled = this.config?.animationsEnabled ?? true;\n\t\tthis.soundManager.isEnabled = this.config?.soundEnabled ?? true;\n\n\t\tthis.setAttribute('variant', this.config?.variant ?? 'elegant');\n\n\t}\n\n\t// ==================== LIFECYCLE (Web Component) ====================\n\n\tconnectedCallback() {\n\t\tif (!this._initialized) {\n\t\t\tthis._initialized = true;\n\t\t\tif (!this.isValid) return;\n\t\t\tthis.initialize();\n\t\t\trequestAnimationFrame(() => {\n\t\t\t\tthis.render();\n\t\t\t\tthis.emitReady();\n\t\t\t});\n\t\t}\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.cleanup();\n\t}\n\n\t// ==================== ABSTRACT METHODS ====================\n\tabstract render(): void;\n\tabstract getCurrentState(): any;\n\tabstract isInteractionComplete(): boolean;\n\tabstract onVariantChange(variant: Variant): void;\n\tabstract onHint(): void;\n\t// for immediate feedback\n\t// abstact correctSingle(): void {}\n\n\t// ==================== OPTIONAL LIFECYCLE HOOKS ====================\n\n\tprotected initialize(): void {}\n\tprotected cleanup(): void {}\n\n\t// ==================== PROGRESS TRACKING ====================\n\tprotected initializeProgress(total: number): void {\n\t\tthis.progressTracker.initialize(total);\n\t\tthis.emitProgress();\n\t}\n\n\tprotected setProgress(current: number): void {\n\t\tthis.progressTracker.setCurrent(current);\n\t\tthis.emitProgress();\n\t}\n\n\tprotected incrementProgress(): void {\n\t\tthis.progressTracker.increment();\n\t\tthis.emitProgress();\n\t}\n\n\tprotected decrementProgress(): void {\n\t\tthis.progressTracker.decrement();\n\t\tthis.emitProgress();\n\t}\n\n\tprotected getProgress(): { current: number; total: number; percentage: number } {\n\t\treturn {\n\t\t\tcurrent: this.progressTracker.current,\n\t\t\ttotal: this.progressTracker.total,\n\t\t\tpercentage: this.progressTracker.getPercentage()\n\t\t};\n\t}\n\n\t// ==================== EVENT EMISSION ====================\n\tprivate emitReady(): void {\n\t\tthis.dispatchEvent(new CustomEvent('interaction:ready', {\n\t\t\tdetail: { id: this.id },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\t}\n\n\tprotected emitProgress(): void {\n\t\tconst progress = this.getProgress();\n\t\tthis.dispatchEvent(new CustomEvent('interaction:progress', {\n\t\t\tdetail: progress,\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\t}\n\n\tprotected emitStateChange(): void {\n\t\tthis.dispatchEvent(new CustomEvent('interaction:state-change', {\n\t\t\tdetail: {\n\t\t\t\tstate: this.getCurrentState(),\n\t\t\t\tisComplete: this.isInteractionComplete()\n\t\t\t},\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\t}\n\n\tprotected emitComplete(): void {\n\t\tthis.dispatchEvent(new CustomEvent('interaction:complete', {\n\t\t\tdetail: {\n\t\t\t\tstate: this.getCurrentState(),\n\t\t\t\tid: this.id\n\t\t\t},\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\t}\n\n\tprotected emitHintShown(message?: string): void {\n\t\tthis.dispatchEvent(new CustomEvent('interaction:hint-shown', {\n\t\t\tdetail: { message },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\t}\n\n\tprotected emitError(error: Error, message?: string): void {\n\t\tthis.dispatchEvent(new CustomEvent('interaction:error', {\n\t\t\tdetail: {\n\t\t\t\terror,\n\t\t\t\tmessage: message || error.message\n\t\t\t},\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\t}\n\n\t// ==================== PUBLIC API ====================\n\tpublic onChange(newVariant: Variant): void {}\n\tpublic setSteps(steps: number): void {}\n\t\n\tpublic submit(): void {\n\t\tthis.setAttribute('inert', '');\n\t\tthis.emitComplete();\n\t}\n\t\n\tpublic hint(): void {\n\t\tthis.onHint();\n\t}\n\n\tpublic reset(): void {\n\t\tthis.progressTracker.reset();\n\t\tthis.emitProgress();\n\t\tthis.removeAttribute('inert');\n\t\tthis.render();\n\t}\n\n\tpublic set(variant: Variant): void {\n\t\tthis.config.variant = variant;\n\t\tthis.setAttribute('variant', variant);\n\t\tthis.onVariantChange(variant);\n\t}\n\n\tpublic get(): Variant {\n\t\treturn (this.getAttribute('variant') as Variant) || this.config.variant || 'outline';\n\t}\n}\n", "import { Variant } from \"../../shared\";\nimport { AnimationsManager } from \"../../shared/managers\";\n\nconst HTML = `\n<style>\n\t:host {\n\t\tdisplay: block;\n\t\tcursor: pointer;\n\t\t--accent-color: rgb(var(--edu-first-accent));\n\t}\n\n\t.block {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tcolor: rgb(var(--edu-ink));\n\t\talign-items: center;\n\t\tjustify-content: center;\n\t\tgap: 0.5rem;\n\t\tpadding: 1rem;\n\t\tbackground: rgb(var(--edu-bg));\n\t\tborder: 2px solid rgb(var(--edu-border));\n\t\tborder-radius: var(--edu-radius);\n\t\theight: 100%;\n\t\tbox-sizing: border-box;\n\t\ttransition: all 0.2s ease;\n\t\ttext-align: center;\n\t\twidth: 100%;\n\t\tmin-height: 44px;\n\t}\n\n\t.block:hover {\n\t\ttransform: translateY(-2px);\n\t\tbox-shadow: 0 4px 12px rgba(var(--edu-shadow-color), 0.15);\n\t}\n\n\t.block[variant=\"elegant\"] {\n\t\tbackground: rgb(var(--edu-card));\n\t\tborder-radius: 8px;\n\t\tcolor: rgb(var(--edu-ink));\n\t\tbox-shadow: 0 4px 12px rgba(var(--edu-shadow-color), 0.1);\n\t\tborder-left: 4px solid var(--accent-color);\n\t}\n\n\t.block[variant=\"elegant\"]:hover {\n\t\tbox-shadow: 0 6px 16px rgba(var(--edu-shadow-color), 0.15);\n\t\ttransform: translateY(-3px);\n\t}\n\n\t.block[variant=\"playful\"] {\n\t\tbackground: var(--accent-color);\n\t\tborder: none;\n\t\tcolor: rgb(var(--edu-inverted-ink));\n\t\tborder-radius: 16px;\n\t\tbox-shadow: 2px 2px 0px rgba(var(--edu-shadow-color) / 0.2);\n\t}\n\n\t.block[variant=\"playful\"]:hover {\n\t\ttransform: translateY(-2px) rotate(-2deg);\n\t\tbox-shadow: 0 6px 16px rgba(var(--edu-first-accent), 0.4);\n\t}\n\n\t.block[variant=\"outline\"] {\n\t\tbackground: transparent;\n\t\tborder: 2px solid var(--accent-color);\n\t\tborder-top: 6px solid var(--accent-color);\n\t\tborder-radius: 0;\n\t}\n\n\t.block[variant=\"outline\"]:hover {\n\t\tbackground: rgb(var(--edu-first-accent) / 0.1);\n\t\tborder-width: 3px;\n\t}\n\n\t.block[variant=\"letter\"] {\n\t\tfont-family: georgia, serif;\n\t\tcolor: rgb(var(--edu-ink));\n\t\tbackground: rgb(var(--edu-card));\n\t\tborder: 1px solid rgb(var(--edu-border));\n\t\tborder-radius: 4px;\n\t\tbox-shadow: inset 0 0 0 1px rgba(var(--edu-shadow-color), 0.05);\n\t}\n\n\t.block[variant=\"letter\"]:hover {\n\t\tbox-shadow:\n\t\t\tinset 0 0 0 1px rgba(var(--edu-shadow-color), 0.05),\n\t\t\t0 2px 6px rgba(var(--edu-shadow-color), 0.1);\n\t}\n\n\t.block[variant=\"minimal\"] {\n\t\tbackground: rgb(var(--edu-card));\n\t\tcolor: rgb(var(--edu-ink));\n\t\tborder: 1px solid rgb(var(--edu-border));\n\t\tborder-radius: 6px;\n\t\tpadding: 0.75rem;\n\t}\n\n\t.block[variant=\"minimal\"]:hover {\n\t\tborder-color: rgb(var(--edu-first-accent) / 0.5);\n\t\tbox-shadow: 0 1px 4px rgba(var(--edu-shadow-color), 0.1);\n\t}\n\n\t.block[variant=\"glass\"] {\n\t\tbackground: rgba(var(--edu-card), 0.7);\n\t\tbackdrop-filter: blur(10px);\n\t\tborder: 2px solid rgba(var(--edu-border), 0.35);\n\t\tborder-radius: 12px;\n\t}\n\n\t.block[variant=\"glass\"]:hover {\n\t\tbackground: rgba(var(--edu-card), 0.85);\n\t\tborder-color: rgba(var(--edu-first-accent), 0.5);\n\t}\n\n\t.block[variant=\"card\"] {\n\t\tbackground: rgb(var(--edu-card));\n\t\tborder: 2px solid rgb(var(--edu-border));\n\t\tborder-radius: 8px;\n\t\tbox-shadow: 0 2px 8px rgba(var(--edu-shadow-color), 0.08);\n\t}\n\n\t.block[variant=\"card\"]:hover {\n\t\tborder-color: rgb(var(--edu-first-accent));\n\t\tbox-shadow: 0 4px 12px rgba(var(--edu-shadow-color), 0.12);\n\t}\n\n\t.block[variant=\"sign\"] {\n\t\tbackground: rgb(var(--edu-card));\n\t\tborder: 4px double rgb(var(--edu-border));\n\t\tcolor: rgb(var(--edu-ink));\n\t\tborder-radius: 0;\n\t\ttext-align: center;\n\t\ttext-transform: uppercase;\n\t\tletter-spacing: 2px;\n\t\tfont-weight: 700;\n\t}\n\n\t.block[variant=\"sign\"]:hover {\n\t\tborder-color: var(--accent-color);\n\t\tbackground: var(accent-color);\n\t}\n\n\t.block[variant=\"empty\"] {\n\t\tbackground: transparent;\n\t\tcolor: rgb(var(--edu-ink));\n\t\tborder: 3px solid rgb(var(--edu-ink));\n\t\tborder-radius: 0;\n\t\tpadding: 0.75rem;\n\t}\n\n\t.block[variant=\"empty\"]:hover {\n\t\tbackground: var(--accent-color);\n\t\tcolor: rgb(var(--edu-inverted-ink));\n\t\tborder-color: rgb(var(--edu-ink));\n\t}\n</style>\n<div class=\"block\" part=\"block\">\n\t<slot></slot>\n</div>\n`;\n\nexport class EduBlock extends HTMLElement {\n\n\tstatic get observedAttributes() { return [\"variant\"]; }\n\n\tprivate $blockEl!: HTMLDivElement;\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.attachShadow({ mode: \"open\" });\n\t\tthis.shadowRoot!.innerHTML = HTML;\n\t\tthis.$blockEl = this.shadowRoot!.querySelector('.block') as HTMLDivElement;\n\n\t\t AnimationsManager.injectKeyframes(this.shadowRoot!);\n\t}\n\n\tconnectedCallback() {\n\t\tif (!this.hasAttribute(\"variant\")) this.variant = \"outline\";\n\t\tthis.sync();\n\t}\n\n\tattributeChangedCallback() {\n\t\tthis.sync();\n\t}\n\n\tprivate sync() {\n\t\tif (this.$blockEl) {\n\t\t\tthis.$blockEl.setAttribute('variant', this.variant);\n\t\t}\n\t}\n\n\tpublic getBlock() { return this.$blockEl };\n\n\tget variant(): Variant {\n\t\treturn (this.getAttribute(\"variant\") ?? \"outline\") as Variant;\n\t}\n\n\tset variant(v: Variant) { this.setAttribute(\"variant\", v); }\n\t\n\tpublic setAccentColor(newAccent: string): void {\n\t\tconst el = this.shadowRoot!.host as EduBlock;\n\t\tel.style.setProperty('--accent-color', newAccent);\n\t}\n\n\tpublic removeSelf() { this.remove(); } \n}\n\nif (!customElements.get(\"edu-block\")) customElements.define(\"edu-block\", EduBlock);\n", "<div class=\"chip-container\" part=\"container\">\n\n\t<div class=\"content-zone\" part=\"content-zone\" role=\"button\" tabindex=\"0\" aria-pressed=\"false\">\n\t\t<span class=\"prefix\" part=\"prefix\"></span>\n\n\t\t<div class=\"content-inner\" part=\"content\">\n\t\t\t<slot></slot>\n\t\t</div>\n\n\t\t<!-- Shows for: audio, video, tts, anchor, interactive, data, dynamic, composite -->\n\t\t<button class=\"modality-action\" part=\"modality-action\" type=\"button\" aria-label=\"Modality action\">\n\t\t\t<svg class=\"icon\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"currentColor\">\n\t\t\t\t<!-- Icon will be set dynamically based on modality -->\n\t\t\t\t<img src=\"assets/icons/drag-vertical-svgrepo-com.svg\" alt=\"...\" width=\"24\" height=\"24\"/>\n\t\t\t</svg>\n\t\t</button>\n\n\t\t<span class=\"drag-handle\" part=\"drag-handle\">\n\t\t\t<img src=\"assets/icons/drag-horizontal-svgrepo-com.svg\" alt=\"...\" width=\"24\" height=\"24\"/>\n\t\t</span>\n\n\t</div>\n</div>\n\n\n", "/* ==================== BASE STYLES ==================== */\n\n* { box-sizing: border-box; }\n\n:host {\n\tdisplay: inline-block;\n\t--chip-color: rgb(var(--edu-first-accent));\n\t--chip-colored-color: #d1d1d1;\n}\n\n:host([colored]) {\n\t& .chip-container { position: relative; }\n\n\t& .chip-container::after {\n\t\tcontent: '';\n\t\tposition: absolute;\n\t\ttop: -2px;\n\t\tleft: -2px;\n\t\tright: -2px;\n\t\tbottom: -2px;\n\t\tborder-radius: 10px;\n\t\tbackground: var(--chip-colored-color);\n\t\topacity: 0.18;\n\t\tmix-blend-mode: multiply;\n\t\tz-index: 2;\n\t\tpointer-events: none;\n\t}\n}\n\n:host([aria-disabled]) {\n\topacity: 0.4;\n\tcursor: not-allowed;\n}\n\n.chip-container {\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: center;\n\tposition: relative;\n\twidth: 100%;height: 100%;\n}\n\n::slotted(img.chip-image) {\n\t border: 1px solid rgb(var(--edu-border));\n}\n\n/* ==================== PREFIX ==================== */\n\n.prefix {\n\tdisplay: none;\n\tfont-weight: 600;\n\tcolor: rgb(var(--edu-second-ink));\n\tflex-shrink: 0;\n\tmargin-right: 1rem;\n\tposition: relative;\n\tz-index: 1;\n}\n\n:host([prefix]) .prefix {\n\tdisplay: inline-flex;\n}\n\n/* ==================== CONTENT ZONE ==================== */\n\n.content-zone {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tposition: relative;\n\tbackground: rgb(var(--edu-card));\n\tborder: 1px solid rgb(var(--edu-border));\n\tpadding: 0.5rem 1rem;\n\tcursor: pointer;\n\tfont-size: 1rem;\n\tfont-weight: 500;\n\ttext-align: center;\n\ttransition: all 0.2s ease;\n\tuser-select: none;\n\tmargin: 0.25rem;\n\tborder-radius: var(--edu-radius);\n\tcolor: rgb(var(--edu-ink));\n\twidth: 100%;\n\theight: 100%;\n\tbox-sizing: border-box;\n\tz-index: 1;\n}\n\n.content-zone:hover:not([aria-disabled=\"true\"]) {\n\tbox-shadow: 0 2px 8px rgb(var(--edu-shadow-color) / 0.15);\n}\n\n.content-zone:active:not([aria-disabled=\"true\"]) {\n}\n\n.content-zone[aria-disabled=\"true\"] {\n\topacity: 0.5;\n\tcursor: not-allowed;\n}\n\n.content-zone:focus-visible {\n\toutline: 2px solid var(--chip-color);\n\toutline-offset: 2px;\n}\n\n/* ==================== CONTENT INNER ==================== */\n\n.content-inner {\n\tflex: 1;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tmin-width: 0;\n}\n\n/* ==================== MODALITY ACTION BUTTON ==================== */\n\n.modality-action {\n\tposition: absolute;\n\ttop: 50%;\n\tleft: 50%;\n\tdisplay: none;\n\talign-items: center;\n\tjustify-content: center;\n\twidth: 36px;\n\theight: 36px;\n\tborder-radius: 50%;\n\tborder: none;\n\tbackground: var(--chip-color);\n\tcolor: rgb(var(--edu-inverted-ink));\n\tcursor: pointer;\n\ttransition: all 0.2s;\n\tz-index: 10;\n\tbox-shadow: 0 2px 8px rgba(var(--edu-shadow-color), 0.2);\n}\n\n.modality-action:hover:not(:disabled) {\n\tbox-shadow: 0 4px 12px rgba(var(--edu-shadow-color), 0.3);\n}\n\n.modality-action:active:not(:disabled) {\n}\n\n.modality-action:disabled {\n\topacity: 0.5;\n\tcursor: not-allowed;\n}\n\n/* ==================== DRAG HANDLE ==================== */\n\n.drag-handle {\n\tdisplay: none;\n\talign-items: center;\n\tjustify-content: center;\n\tbackground-color: rgb(var(--edu-muted) / 0.6);\n\tcolor: rgb(var(--edu-third-ink));\n\tcursor: grab;\n\tflex-shrink: 0;\n\tpadding: 0.25rem;\n\tborder-radius: 4px;\n\ttransition: all 0.2s;\n\tposition: relative;\n\tz-index: 1;\n}\n\n.drag-handle:hover {\n\tbackground: rgb(var(--edu-muted));\n\tcolor: rgb(var(--edu-first-accent));\n}\n\n.drag-handle:active {\n\tcursor: grabbing;\n\tbackground-color: rgb(var(--edu-muted) / 0.9);\n}\n\n:host([draggable]) .drag-handle {\n\tdisplay: flex;\n}\n\n.drag-handle[aria-disabled=\"true\"] {\n\topacity: 0.5;\n\tcursor: not-allowed;\n}\n\n\n/* ==================== SELECTED STATE (ENHANCED) ==================== */\n\n:host([selected]) .content-zone {\n\tbox-shadow: 0 0 0 3px rgba(var(--chip-color), 0.3);\n\tborder-color: var(--chip-color);\n\tbackground: rgba(var(--chip-color), 0.1);\n}\n\n/* ==================== STATE FEEDBACK ==================== */\n\n:host([state=\"correct\"]) .content-zone {\n\tborder: 4px solid rgb(var(--edu-success));\n\tbackground: rgba(var(--edu-success), 0.1);\n\tbox-shadow: 0 0 0 2px rgb(var(--edu-success) / 0.2);\n}\n\n:host([state=\"correct\"]) .content-zone::after {\n\tcontent: '\u2713';\n\tposition: absolute;\n\ttop: -8px;\n\tright: -8px;\n\twidth: 24px;\n\theight: 24px;\n\tbackground: rgb(var(--edu-success));\n\tcolor: white;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tfont-size: 14px;\n\tfont-weight: bold;\n\tbox-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);\n}\n\n:host([state=\"wrong\"]) .content-zone {\n\tborder: 4px solid rgb(var(--edu-error));\n\tbackground: rgb(var(--edu-error) / 0.1);\n\tbox-shadow: 0 0 0 2px rgb(var(--edu-error) / 0.2);\n}\n\n:host([state=\"wrong\"]) .content-zone::after {\n\tcontent: '\u2717';\n\tposition: absolute;\n\ttop: -8px;\n\tright: -8px;\n\twidth: 24px;\n\theight: 24px;\n\tbackground: rgb(var(--edu-error));\n\tcolor: white;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tfont-size: 14px;\n\tfont-weight: bold;\n\tbox-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);\n}\n\n:host([state=\"missed\"]) .content-zone {\n\tborder: 4px solid rgb(var(--edu-warning));\n\tbackground: rgb(var(--edu-warning) / 0.1);\n\tbox-shadow: 0 0 0 2px rgb(var(--edu-warning) / 0.2);\n}\n\n:host([state=\"missed\"]) .content-zone::after {\n\tcontent: '!';\n\tposition: absolute;\n\ttop: -8px;\n\tright: -8px;\n\twidth: 24px;\n\theight: 24px;\n\tbackground: rgb(var(--edu-warning));\n\tcolor: rgb(var(--edu-ink));\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tfont-size: 14px;\n\tfont-weight: bold;\n\tbox-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);\n}\n\n/* ==================== VARIANT: ELEGANT ==================== */\n\n:host([variant=\"elegant\"]) .content-zone {\n\tbackground-color: rgb(var(--edu-card));\n\tcolor: rgb(var(--edu-ink) / 0.8);\n\tborder-radius: 4px;\n\tbox-shadow: 4px 4px 0 rgb(var(--edu-border));\n}\n\n:host([variant=\"elegant\"]) .content-zone:hover:not([aria-disabled=\"true\"]) {\n\tbox-shadow: 1px 1px 0 rgb(var(--edu-border));\n}\n\n:host([variant=\"elegant\"]) .content-zone:active:not([aria-disabled=\"true\"]) {\n\tbox-shadow: 0 0 0 rgb(var(--edu-border));\n}\n\n:host([variant=\"elegant\"]) .prefix {\n\tcolor: var(--chip-color);\n}\n\n:host([variant=\"elegant\"][selected]) .content-zone {\n\tborder-color: var(--chip-color);\n\tbackground: rgb(var(--chip-color) / 0.1);\n\tbox-shadow: 0 0 0 3px rgb(var(--chip-color) / 0.3);\n}\n\n:host([variant=\"elegant\"]) ::slotted(img.chip-image) {\n\tborder: none;\n\tborder-radius: 4px;\n\tbox-shadow: 4px 4px 0 rgb(var(--edu-border));\n}\n\n/* ==================== VARIANT: PLAYFUL ==================== */\n\n:host([variant=\"playful\"]) .content-zone {\n\tbackground: var(--chip-color); \n\tcolor: rgb(var(--edu-inverted-ink));\n\tborder-radius: 12px;\n\tborder: none;\n\tbox-shadow: 0 4px 12px rgb(var(--chip-color) / 0.3);\n\tfont-weight: 600;\n}\n\n:host([variant=\"playful\"]) .content-zone:hover:not([aria-disabled=\"true\"]) {\n\tbox-shadow: 0 6px 16px rgba(var(--chip-color), 0.4);\n}\n\n:host([variant=\"playful\"]) .content-zone:active:not([aria-disabled=\"true\"]) {\n}\n\n:host([variant=\"playful\"]) .prefix {\n\tcolor: rgb(var(--edu-inverted-ink));\n\topacity: 0.9;\n}\n\n:host([variant=\"playful\"]) .modality-action {\n\tbackground: rgb(var(--edu-card));\n\tcolor: var(--chip-color);\n}\n\n:host([variant=\"playful\"][selected]) .content-zone {\n\tbox-shadow: 0 0 0 3px rgb(var(--edu-first-accent) / 0.4), 0 6px 16px rgb(var(--edu-first-accent) / 0.4);\n}\n\n:host([variant=\"playful\"]) ::slotted(img.chip-image) {\n\tborder: 4px solid rgb(var(--edu-border) / 0.6);\n\tborder-radius: 4px;\n}\n\n\n/* ==================== VARIANT: OUTLINE ==================== */\n\n:host([variant=\"outline\"]) .content-zone {\n\tbackground: transparent;\n\tborder: 2px solid var(--chip-color);\n\tborder-radius: 0;\n\tcolor: rgb(var(--edu-ink));\n}\n\n:host([variant=\"outline\"]) .content-zone:hover:not([aria-disabled=\"true\"]) {\n\tbackground: var(--chip-color);\n\tborder-color: rgb(var(--edu-inverted-ink));\n\tcolor: rgb(var(--edu-inverted-ink));\n}\n\n:host([variant=\"outline\"]) .content-zone:hover:not([aria-disabled=\"true\"]) .prefix {\n\tcolor: rgb(var(--edu-inverted-ink));\n}\n\n:host([variant=\"outline\"][selected]) .content-zone {\n\tbackground: rgba(var(--chip-color), 0.1);\n\tborder-color: var(--chip-color);\n\tcolor: rgb(var(--edu-ink));\n\tborder-width: 6px;\n}\n\n:host([variant=\"outline\"]) ::slotted(img.chip-image) {\n\tborder: 2px solid rgb(var(--edu-first-accent));\n}\n\n/* ==================== VARIANT: EMPTY ==================== */\n\n:host([variant=\"empty\"]) .content-zone {\n\tbackground: transparent;\n\tborder-radius: 0;\n\tcolor: rgb(var(--edu-ink));\n\tpadding: 0.25rem 0.5rem;\n\tborder: 3px solid rgb(var(--edu-ink));\n}\n\n:host([variant=\"empty\"]) .content-zone:hover:not([aria-disabled=\"true\"]) {\n\tbackground: rgb(var(--edu-muted));\n}\n\n:host([variant=\"empty\"]) .content-zone:active:not([aria-disabled=\"true\"]) {\n\tbackground: rgb(var(--edu-border));\n}\n\n:host([variant=\"empty\"][selected]) .content-zone {\n\tbackground: rgb(var(--edu-first-accent) / 0.15);\n\tborder-color: var(--chip-color);\n}\n\n/* ==================== VARIANT: LETTER ==================== */\n\n:host([variant=\"letter\"]) .content-zone {\n\tfont-family: georgia, serif;\n\tbox-shadow: inset 0 0 0 1px rgba(var(--edu-shadow-color), 0.05);\n\tborder-radius: 2px;\n\tbackground: rgb(var(--edu-card));\n\tcolor: rgb(var(--edu-ink));\n\tfont-size: 0.95rem;\n\tletter-spacing: 0.5px;\n}\n\n:host([variant=\"letter\"]) .content-zone:hover:not([aria-disabled=\"true\"]) {\n\tbox-shadow:\n\t\tinset 0 0 0 1px rgba(var(--edu-shadow-color), 0.05),\n\t\t0 2px 6px rgba(var(--edu-shadow-color), 0.1);\n}\n\n:host([variant=\"letter\"]) .prefix {\n\tfont-family: georgia, serif;\n\tfont-style: italic;\n}\n\n:host([variant=\"letter\"]) .content-inner {\n\tfont-family: georgia, serif;\n}\n\n:host([variant=\"letter\"][selected]) .content-zone {\n\tborder-color: var(--chip-color);\n\tbackground: rgb(var(--edu-muted));\n\tbox-shadow: 0 0 0 2px rgba(var(--chip-color), 0.3);\n}\n\n/* ==================== VARIANT: MINIMAL ==================== */\n\n:host([variant=\"minimal\"]) .content-zone {\n\tbackground: rgb(var(--edu-card));\n\tborder: 1px solid rgb(var(--edu-border));\n\tborder-radius: 6px;\n\tcolor: rgb(var(--edu-ink));\n\tpadding: 0.4rem 0.75rem;\n\tfont-size: 0.9rem;\n}\n\n:host([variant=\"minimal\"]) .content-zone:hover:not([aria-disabled=\"true\"]) {\n\tborder-color: rgba(var(--chip-color), 0.5);\n\tbox-shadow: 0 1px 4px rgba(var(--edu-shadow-color), 0.1);\n}\n\n:host([variant=\"minimal\"][selected]) .content-zone {\n\tborder-color: var(--chip-color);\n\tbackground: rgba(var(--chip-color), 0.08);\n}\n\n/* ==================== VARIANT: GLASS ==================== */\n\n:host([variant=\"glass\"]) .content-zone {\n\tbackground: rgb(var(--edu-card));\n\tborder: 2px solid rgb(var(--edu-border));\n\tborder-radius: 0;\n\tcolor: rgb(var(--edu-ink));\n\tpadding: 0.5rem 1.2rem;\n\tfont-weight: 700;\n\tletter-spacing: 1.5px;\n\tfont-size: 0.9rem;\n}\n\n:host([variant=\"glass\"]) .content-zone:hover:not([aria-disabled=\"true\"]) {\n\tbackground: var(--chip-color);\n\tcolor: rgb(var(--edu-inverted-ink));\n\tborder-color: var(--chip-color);\n}\n\n:host([variant=\"glass\"]) .content-zone:active:not([aria-disabled=\"true\"]) {\n\tbackground: rgba(var(--chip-color), 0.9);\n}\n\n:host([variant=\"glass\"]) .prefix {\n\tfont-weight: 800;\n}\n\n:host([variant=\"glass\"][selected]) .content-zone {\n\tbackground: rgba(var(--chip-color), 0.15);\n\tborder-color: var(--chip-color);\n\tbox-shadow: 0 0 0 2px rgba(var(--chip-color), 0.3);\n}\n\n/* ==================== VARIANT: CARD ==================== */\n\n:host([variant=\"card\"]) .content-zone {\n\tbackground: transparent;\n\tborder: 2px solid rgb(var(--edu-border));\n\tborder-radius: 4px;\n\tcolor: rgb(var(--edu-ink));\n}\n\n:host([variant=\"card\"]) .content-zone:hover:not([aria-disabled=\"true\"]) {\n\tbackground: rgb(var(--edu-muted));\n\tborder-color: var(--chip-color);\n}\n\n:host([variant=\"card\"]) .content-zone:active:not([aria-disabled=\"true\"]) {\n\tbackground: rgb(var(--edu-border));\n}\n\n:host([variant=\"card\"]) .prefix {\n\tcolor: var(--chip-color);\n}\n\n:host([variant=\"card\"][selected]) .content-zone {\n\tborder-color: var(--chip-color);\n\tbox-shadow: 0 0 0 3px rgba(var(--chip-color), 0.2);\n}\n\n/* ==================== VARIANT: SIGN ==================== */\n\n:host([variant=\"sign\"]) .content-zone {\n\tbackground: rgb(var(--edu-card));\n\tborder-radius: 0;\n\tcolor: rgb(var(--edu-ink));\n\tpadding: 0.5rem 1.2rem;\n\tfont-size: 0.9rem;\n\tfont-weight: bold;\n\ttransform: skewX(-10deg);\n\ttext-transform: uppercase;\n\tletter-spacing: 0.2rem;\n}\n\n:host([variant=\"sign\"]) .content-zone:hover:not([aria-disabled=\"true\"]) {\n\tbackground: var(--chip-color);\n\tcolor: rgb(var(--edu-inverted-ink));\n\tborder-color: var(--chip-color);\n}\n\n:host([variant=\"sign\"]) .content-zone:active:not([aria-disabled=\"true\"]) {\n\tbackground: rgba(var(--chip-color), 0.9);\n}\n\n:host([variant=\"sign\"]) .prefix {\n\tfont-weight: 800;\n}\n\n:host([variant=\"sign\"]) .content-inner {\n\ttransform: skewX(10deg);\n}\n\n:host([variant=\"sign\"][selected]) .content-zone {\n\tbackground: var(--chip-color);\n\tcolor: rgb(var(--edu-inverted-ink));\n\tborder-color: var(--chip-color);\n\tbox-shadow: 0 0 0 3px rgba(var(--chip-color), 0.3);\n}\n\n:host([variant=\"sign\"]) ::slotted(img.chip-image) {\n\ttransform: skewX(-10deg);\n}\n", "/**\n * EduDialog - Reusable modal dialog component\n * Used for displaying rich content from chips and other interactive elements\n */\n\nconst HTML = `\n<style>\n\t:host {\n\t\tdisplay: none;\n\t\tposition: fixed;\n\t\tinset: 0;\n\t\tz-index: 9999;\n\t\talign-items: center;\n\t\tjustify-content: center;\n\t}\n\n\t:host([open]) {\n\t\tdisplay: flex;\n\t}\n\n\t.backdrop {\n\t\tposition: absolute;\n\t\tinset: 0;\n\t\tbackground: rgba(0, 0, 0, 0.6);\n\t\tbackdrop-filter: blur(4px);\n\t\tanimation: fadeIn 0.2s ease;\n\t}\n\n\t.dialog {\n\t\tposition: relative;\n\t\tbackground: rgb(var(--edu-card));\n\t\tborder-radius: 16px;\n\t\tmax-width: min(90vw, 600px);\n\t\tmax-height: min(90vh, 800px);\n\t\twidth: 100%;\n\t\tbox-shadow: 0 25px 50px -12px rgba(var(--edu-shadow-color), 0.5);\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tanimation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);\n\t\toverflow: hidden;\n\t}\n\n\t.header {\n\t\tpadding: 1.5rem;\n\t\tborder-bottom: 2px solid rgb(var(--edu-border));\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: space-between;\n\t\tflex-shrink: 0;\n\t}\n\n\t.header h3 {\n\t\tmargin: 0;\n\t\tcolor: rgb(var(--edu-ink));\n\t\tfont-size: 1.25rem;\n\t\tfont-weight: 600;\n\t}\n\n\t.close-btn {\n\t\tbackground: transparent;\n\t\tborder: none;\n\t\tcursor: pointer;\n\t\tpadding: 0.5rem;\n\t\tborder-radius: 8px;\n\t\tcolor: rgb(var(--edu-third-ink));\n\t\ttransition: all 0.2s;\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: center;\n\t}\n\n\t.close-btn:hover {\n\t\tbackground: rgb(var(--edu-muted));\n\t\tcolor: rgb(var(--edu-ink));\n\t}\n\n\t.content {\n\t\tpadding: 1.5rem;\n\t\toverflow-y: auto;\n\t\tflex: 1;\n\t\tcolor: rgb(var(--edu-second-ink));\n\t}\n\n\t.content::-webkit-scrollbar {\n\t\twidth: 8px;\n\t}\n\n\t.content::-webkit-scrollbar-track {\n\t\tbackground: rgb(var(--edu-muted));\n\t\tborder-radius: 4px;\n\t}\n\n\t.content::-webkit-scrollbar-thumb {\n\t\tbackground: rgb(var(--edu-border));\n\t\tborder-radius: 4px;\n\t}\n\n\t.content::-webkit-scrollbar-thumb:hover {\n\t\tbackground: rgb(var(--edu-third-ink));\n\t}\n\n\t.footer {\n\t\tpadding: 1rem 1.5rem;\n\t\tborder-top: 2px solid rgb(var(--edu-border));\n\t\tdisplay: flex;\n\t\tjustify-content: flex-end;\n\t\tgap: 0.75rem;\n\t\tflex-shrink: 0;\n\t}\n\n\t.footer button {\n\t\tpadding: 0.75rem 1.5rem;\n\t\tborder-radius: 8px;\n\t\tborder: none;\n\t\tfont-weight: 600;\n\t\tcursor: pointer;\n\t\ttransition: all 0.2s;\n\t\tfont-size: 0.95rem;\n\t}\n\n\t.footer button.primary {\n\t\tbackground: rgb(var(--edu-first-accent));\n\t\tcolor: rgb(var(--edu-inverted-ink));\n\t}\n\n\t.footer button.primary:hover {\n\t\tfilter: brightness(1.1);\n\t\ttransform: translateY(-1px);\n\t}\n\n\t.footer button.secondary {\n\t\tbackground: rgb(var(--edu-muted));\n\t\tcolor: rgb(var(--edu-ink));\n\t}\n\n\t.footer button.secondary:hover {\n\t\tbackground: rgb(var(--edu-border));\n\t}\n\n\t@keyframes fadeIn {\n\t\tfrom { opacity: 0; }\n\t\tto { opacity: 1; }\n\t}\n\n\t@keyframes slideUp {\n\t\tfrom {\n\t\t\topacity: 0;\n\t\t\ttransform: translateY(20px) scale(0.95);\n\t\t}\n\t\tto {\n\t\t\topacity: 1;\n\t\t\ttransform: translateY(0) scale(1);\n\t\t}\n\t}\n\n\t@media (max-width: 640px) {\n\t\t.dialog {\n\t\t\tmax-width: 95vw;\n\t\t\tmax-height: 95vh;\n\t\t\tborder-radius: 12px;\n\t\t}\n\n\t\t.header, .content, .footer {\n\t\t\tpadding: 1rem;\n\t\t}\n\t}\n</style>\n\n<div class=\"backdrop\" part=\"backdrop\"></div>\n<div class=\"dialog\" part=\"dialog\">\n\t<div class=\"header\" part=\"header\">\n\t\t<h3 id=\"title\"></h3>\n\t\t<button class=\"close-btn\" part=\"close-btn\" aria-label=\"Close dialog\">\n\t\t\t<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" stroke=\"currentColor\">\n\t\t\t\t<path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"M6 6l8 8M14 6l-8 8\"/>\n\t\t\t</svg>\n\t\t</button>\n\t</div>\n\t<div class=\"content\" part=\"content\">\n\t\t<slot></slot>\n\t</div>\n\t<div class=\"footer\" part=\"footer\" style=\"display: none;\">\n\t\t<slot name=\"footer\"></slot>\n\t</div>\n</div>\n`;\n\nexport class EduDialog extends HTMLElement {\n\n\tprivate $backdrop: HTMLDivElement;\n\tprivate $dialog: HTMLDivElement;\n\tprivate $title: HTMLHeadingElement;\n\tprivate $content: HTMLDivElement;\n\tprivate $footer: HTMLDivElement;\n\tprivate $closeBtn: HTMLButtonElement;\n\n\tstatic get observedAttributes() {\n\t\treturn ['open', 'title'];\n\t}\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.attachShadow({ mode: 'open' });\n\t\tthis.shadowRoot!.innerHTML = HTML;\n\n\t\tthis.$backdrop = this.shadowRoot!.querySelector('.backdrop') as HTMLDivElement;\n\t\tthis.$dialog = this.shadowRoot!.querySelector('.dialog') as HTMLDivElement;\n\t\tthis.$title = this.shadowRoot!.querySelector('#title') as HTMLHeadingElement;\n\t\tthis.$content = this.shadowRoot!.querySelector('.content') as HTMLDivElement;\n\t\tthis.$footer = this.shadowRoot!.querySelector('.footer') as HTMLDivElement;\n\t\tthis.$closeBtn = this.shadowRoot!.querySelector('.close-btn') as HTMLButtonElement;\n\t}\n\n\tconnectedCallback() {\n\t\tthis.$backdrop.addEventListener('click', () => this.close());\n\t\tthis.$closeBtn.addEventListener('click', () => this.close());\n\n\t\t// Close on Escape key\n\t\tdocument.addEventListener('keydown', this.handleEscape);\n\n\t\t// Check if footer slot has content\n\t\tconst footerSlot = this.shadowRoot!.querySelector('slot[name=\"footer\"]') as HTMLSlotElement;\n\t\tfooterSlot.addEventListener('slotchange', () => {\n\t\t\tconst hasFooterContent = footerSlot.assignedNodes().length > 0;\n\t\t\tthis.$footer.style.display = hasFooterContent ? 'flex' : 'none';\n\t\t});\n\t}\n\n\tdisconnectedCallback() {\n\t\tdocument.removeEventListener('keydown', this.handleEscape);\n\t}\n\n\tattributeChangedCallback(name: string, oldValue: string, newValue: string) {\n\t\tif (name === 'title') {\n\t\t\tthis.$title.textContent = newValue || '';\n\t\t} else if (name === 'open' && newValue !== oldValue) {\n\t\t\tif (this.hasAttribute('open')) {\n\t\t\t\tdocument.body.style.overflow = 'hidden';\n\t\t\t} else {\n\t\t\t\tdocument.body.style.overflow = '';\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate handleEscape = (e: KeyboardEvent) => {\n\t\tif (e.key === 'Escape' && this.hasAttribute('open')) {\n\t\t\tthis.close();\n\t\t}\n\t}\n\n\topen() {\n\t\tthis.setAttribute('open', '');\n\t\tthis.dispatchEvent(new CustomEvent('dialog:open', { bubbles: true, composed: true }));\n\t}\n\n\tclose() {\n\t\tthis.removeAttribute('open');\n\t\tthis.dispatchEvent(new CustomEvent('dialog:close', { bubbles: true, composed: true }));\n\t}\n\n\tsetContent(html: string) {\n\t\tthis.$content.innerHTML = html;\n\t}\n\n\tget isOpen(): boolean {\n\t\treturn this.hasAttribute('open');\n\t}\n\n\tget title(): string {\n\t\treturn this.getAttribute('title') || '';\n\t}\n\n\tset title(value: string) {\n\t\tthis.setAttribute('title', value);\n\t}\n}\n\nif (!customElements.get('edu-dialog')) {\n\tcustomElements.define('edu-dialog', EduDialog);\n}\n", "import HTML from \"./index.html\";\nimport CSS from \"./styles.css\";\n\nimport { Variant } from \"../../../shared\";\nimport { AssetType } from \"../../../types/Assets\";\nimport { NormalizedAssets } from \"../../../types/Assets\";\nimport { GradingState } from \"../../../types/Grading\";\n\nimport { AnimationsManager } from \"../../../shared/managers\";\nimport { EduDialog } from \"../dialog\";\n\ntype ChipDisplayMode = 'in-line' | 'dialog';\n\n/**\n * The key is expected to be something like \"@:name\", where string[2:] is expected to be a reference to \n * a key in assets.\n */\nexport function setUpChipData(key: string, chip: EduChip, assets?: NormalizedAssets[\"assetsById\"]): void {\n\t// lazy work, if the set up is messed up set exactly that as the content\n\tif (!assets || !key.startsWith(\"@:\") || key.length < 3) {\n\t\tchip.textContent = key;\n\t\treturn;\n\t};\n\n\tconst ref = key.slice(2, key.length);\n\tif (!assets[ref]) { \n\t\tchip.textContent = ref;\n\t\treturn;\n\t};\n\n\tconst asset = assets[ref];\n\tconst modality = asset.type;\n\n\tchip.modality = modality;\n\tswitch (modality) {\n\t\tcase \"image\":\n\t\t\tchip.data = asset.url;\n\t\t\tbreak;\n\t\t\n\t\tcase \"video\":\n\t\t\tbreak;\n\t\tcase \"audio\":\n\t\t\tbreak;\n\n\t\tcase \"html\":\n\t\t\tchip.data = asset.content;\n\t\t\tbreak;\n\t}\n\n}\n\nexport class EduChip extends HTMLElement {\n\t\n\t// accent not implemtended yet \n\tstatic get observedAttributes() {\n\t\treturn [\"accent\", \"variant\", \"selected\", \"prefix\", \"disabled\", \"modality\", \"state\", \"display\", \"color\", \"colored\", \"draggable\"];\n\t}\n\t\n\tprivate $chip!: HTMLButtonElement;\n\tprivate $prefix!: HTMLSpanElement;\n\tprivate $dragHandler!: HTMLSpanElement;\n\tprivate $dialog!: EduDialog;\n\t\n\tconstructor() {\n\t\tsuper();\n\t\tthis.attachShadow({ mode: \"open\" });\n\n\t\tthis.shadowRoot!.innerHTML = HTML;\n\t\tconst style = document.createElement(\"style\");\n\t\tstyle.textContent = CSS;\n\t\tthis.shadowRoot!.append(style);\n\n\t\tthis.$prefix = this.shadowRoot!.querySelector(\".prefix\");\n\t\tthis.$chip = this.shadowRoot!.querySelector(\".content-zone\");\n\t\tthis.$dragHandler = this.shadowRoot!.querySelector(\".drag-handle\");\n\n\t\tthis.$dialog = new EduDialog();\n\n\t\tAnimationsManager.injectKeyframes(this.shadowRoot!);\n\t}\n\n\tconnectedCallback() {\n\t\tif (!this.hasAttribute(\"variant\")) this.variant = \"outline\";\n\t\tthis.sync();\n\t}\n\n\tattributeChangedCallback() { this.sync(); }\n\n\tpublic getButton() { return this.$chip };\n\tpublic getPrefix() { return this.$prefix };\n\tpublic getDragHandler() { return this.$dragHandler; };\n\n\tprivate sync() {\n\t\tif (this.hasAttribute(\"prefix\")) {\n\t\t\tthis.$prefix.textContent = this.prefix ?? \"\";\n\t\t}\n\n\t\tif (this.hasAttribute(\"draggable\")) {\n\t\t\tthis.style.userSelect = \"none\";\n\t\t\tthis.style.touchAction = \"none\";\n\t\t}\n\n\t\tconst pressed = this.selected ? \"true\" : \"false\";\n\t\tthis.$chip.setAttribute(\"aria-pressed\", pressed);\n\n\t}\n\n\tprivate updateContent() {\n\t\tif (!this.hasAttribute(\"data\") || !this.hasAttribute(\"modality\")) return;\n\n\t\tconst modality = this.getAttribute(\"modality\");\n\t\tconst data = this.getAttribute(\"data\");\n\n\t\tswitch (modality) {\n\t\t\tcase \"image\":\n\t\t\t\tthis.innerHTML = `<img src=\"${data}\" alt=\"no image\" class=\"chip-image\" width=\"64\" height=\"64\"/>`;\n\t\t\t\tbreak;\n\n\t\t\tcase \"audio\":\n\t\t\t\tbreak;\n\n\t\t\tcase \"video\":\n\t\t\t\tbreak;\n\n\t\t\tcase \"html\":\n\t\t\t\tthis.innerHTML = data;\n\t\t}\n\t}\n\n\tget variant(): Variant {\n\t\treturn (this.getAttribute(\"variant\") ?? \"outline\") as Variant;\n\t}\n\tset variant(v: Variant) { this.setAttribute(\"variant\", v); }\n\n\tget prefix(){ return this.getAttribute(\"prefix\"); }\n\tset prefix(v){\n\t\tif (v === null || v === undefined || v === \"\") this.removeAttribute(\"prefix\");\n\t\telse this.setAttribute(\"prefix\", String(v));\n\t}\n\t\n\tget chipState() { return this.getAttribute(\"state\") as GradingState; }\n\tset chipState(v: GradingState) {\n\t\tif (v === null || v === undefined) this.removeAttribute(\"state\");\n\t\telse this.setAttribute(\"state\", String(v));\n\t}\n\t\n\tget draggable() { return this.hasAttribute(\"draggable\"); }\n\tset draggable(v) {\n\t\tif (v === null || v === undefined || v === false) this.removeAttribute(\"draggable\");\t\t\n\t\telse { \t\n\t\t\tthis.setAttribute(\"draggable\", \"true\");\n\t\t}\n\t}\n\t\n\tget color() { return this.getAttribute(\"color\"); }\n\tset color(v: string) {\n\t\tif (v === null || v === undefined || v === \"\") this.removeAttribute(\"color\");\t\t\n\t\telse { \n\t\t\tthis.setAttribute(\"color\", String(v));\n\t\t\tthis.style.setProperty(\"--chip-colored-color\", String(v));\n\t\t}\n\t}\n\t\n\tget colored() { return this.hasAttribute(\"colored\"); }\n\tset colored(v) {\n\t\tif (v) { this.setAttribute(\"colored\", \"true\"); }\n\t\telse { this.removeAttribute(\"colored\"); }\n\t}\n\n\tset data(v: string) {\n\t\tif (v === null || v === undefined || v === \"\") this.removeAttribute(\"data\");\t\t\n\t\telse { \n\t\t\tthis.setAttribute(\"data\", String(v))\n\t\t\tthis.updateContent();\n\t\t};\n\t}\n\n\tset modality(v: AssetType) {\n\t\tif (v === null || v === undefined) this.removeAttribute(\"modality\");\t\t\n\t\telse {\n\t\t\tconsole.log(1);\n\t\t\tthis.setAttribute(\"modality\", String(v));\n\t\t\tthis.updateContent();\n\t\t}\n\t}\n\n\tget disabled(){ return this.hasAttribute(\"disabled\"); }\n\tset disabled(v){\n\t\tif (v) {\n\t\t\tthis.setAttribute(\"aria-disabled\", 'true');\n\t\t\tthis.$chip.setAttribute(\"aria-disabled\", 'true');\n\t\t\tthis.$dragHandler.setAttribute(\"aria-disabled\", 'true');\n\t\t} else {\n\t\t\tthis.removeAttribute(\"aria-disabled\");\n\t\t\tthis.$chip.removeAttribute(\"aria-disabled\");\n\t\t\tthis.$dragHandler.removeAttribute(\"aria-disabled\");\n\t\t}\n\t}\n\n\tget selected(){ return this.hasAttribute(\"selected\"); }\n\tset selected(v){\n\t\tif (v) this.setAttribute(\"selected\", \"\");\n\t\telse this.removeAttribute(\"selected\");\n\t}\n\t\t\n\tget value(){ return this.getAttribute(\"value\") ?? \"\"; }\n\tset value(v){ this.setAttribute(\"value\", String(v)); }\n\t\n\ttoggle(force?: boolean){\n\t\tif (typeof force === \"boolean\") this.selected = force;\n\t\telse this.selected = !this.selected;\n\t\treturn this.selected;\n\t}\n\n\tpublic removeSelf() { this.remove(); } \n\t\n}\n\nif (!customElements.get(\"edu-chip\")) customElements.define(\"edu-chip\", EduChip);\n", "import { soundManager } from \"../../shared/managers/SoundManager\";\nimport { NormalizedAssets, Asset } from \"../../types/Assets\";\nimport { EduDialog } from \"./dialog\";\n\n/**\n * setUpQuestionData - Configure content rendering with asset support\n *\n * Handles asset references (@:assetId) and renders content accordingly:\n * - If dialog=true: Render button that opens content in dialog\n * - If dialog=false/undefined: Render content inline with expand button\n *\n * @param questionString - Question text or asset reference (@:assetId)\n * @param container - Container element to render into\n * @param assets - Assets registry from interaction\n */\nexport function setUpQuestionData(\n\tquestionString: string,\n\tcontainer: HTMLElement,\n\tassets?: NormalizedAssets[\"assetsById\"]\n): void {\n\t// Clear container\n\tcontainer.innerHTML = '';\n\n\t// Check for asset reference\n\tif (!questionString.startsWith(\"@:\") || !assets || questionString.length < 3) {\n\t\t// Plain text fallback\n\t\tcontainer.textContent = questionString;\n\t\treturn;\n\t}\n\n\t// Extract asset reference\n\tconst ref = questionString.slice(2);\n\tconst asset = assets[ref];\n\n\tif (!asset) {\n\t\t// Asset not found, render ref as text\n\t\tcontainer.textContent = ref;\n\t\treturn;\n\t}\n\n\tconsole.log('DIALOG', asset.dialog);\n\n\t// Render based on dialog flag\n\tif (asset.dialog === true) {\n\t\t// Dialog-only mode: render trigger button\n\t\trenderDialogTrigger(container, asset);\n\t} else {\n\t\t// Inline mode: render content with expand button\n\t\trenderInlineWithExpand(container, asset);\n\t}\n}\n\n/**\n * Render a button that opens content in dialog (dialog=true mode)\n */\nfunction renderDialogTrigger(container: HTMLElement, asset: Asset): void {\n\tconst button = document.createElement('button');\n\tbutton.className = 'media-dialog-trigger';\n\n\t// Icon and label based on type\n\tconst labels = {\n\t\timage: '<img src=\"assets/icons/image.svg\" alt=\"image\" width=\"24\" height=\"24\">View Image</img>',\n\t\tvideo: '<img src=\"assets/icons/video.svg\" alt=\"image\" width=\"24\" height=\"24\">Play Video</img>',\n\t\taudio: '<img src=\"assets/icons/audio.svg\" alt=\"image\" width=\"24\" height=\"24\">Play Audio</img>',\n\t\thtml: '<img src=\"assets/icons/data.svg\" alt=\"image\" width=\"24\" height=\"24\">View Content</img>',\n\t\ttts: '<img src=\"assets/icons/audio.svg\" alt=\"image\" width=\"24\" height=\"24\">Play Audio</img>'\n\t};\n\n\tbutton.innerHTML = labels[asset.type];\n\tbutton.style.cssText = `\n\t\twidth: 80%;\n\t\tjustify-content: center;\n\t\tpadding: 1rem 1.5rem;\n\t\tbackground: rgb(var(--edu-first-accent));\n\t\tcolor: white;\n\t\tborder: none;\n\t\tborder-radius: 8px;\n\t\tfont-size: 1rem;\n\t\tfont-weight: 600;\n\t\tcursor: pointer;\n\t\ttransition: all 0.2s;\n\t\tdisplay: inline-flex;\n\t\talign-items: center;\n\t\tgap: 0.5rem;\n\t`;\n\n\tbutton.addEventListener('mouseenter', () => {\n\t\tbutton.style.transform = 'translateY(-2px)';\n\t\tbutton.style.boxShadow = '0 4px 12px rgba(0,0,0,0.15)';\n\t});\n\n\tbutton.addEventListener('mouseleave', () => {\n\t\tbutton.style.transform = 'translateY(0)';\n\t\tbutton.style.boxShadow = 'none';\n\t});\n\n\tbutton.addEventListener('click', () => {\n\t\topenAssetInDialog(asset);\n\t});\n\n\tcontainer.appendChild(button);\n}\n\n/**\n * Render content inline with expand button (dialog=false/undefined mode)\n */\nfunction renderInlineWithExpand(container: HTMLElement, asset: Asset): void {\n\t// Create wrapper\n\tconst wrapper = document.createElement('div');\n\twrapper.style.cssText = `\nposition: relative; \ndisplay: flex; \njustify-content: center; \nalign-items: center;\nwidth: 100%; \nmax-height: clamp(140px, 26cqh, 240px); \noverflow-y: auto; \noverflow-x: hidden;`;\n\n\t// Create edu-media element\n\tconst media = document.createElement('edu-media');\n\tmedia.setAttribute('type', asset.type);\n\n\t// Set data based on asset type\n\tif (asset.type === 'image' || asset.type === 'video' || asset.type === 'audio') {\n\t\tmedia.setAttribute('data', asset.url);\n\t} else if (asset.type === 'html' || asset.type === 'tts') {\n\t\tmedia.setAttribute('data', asset.content);\n\t}\n\n\t// Set spec if available\n\tconst spec: any = {};\n\tif (asset.type === 'image' && asset.size) {\n\t\tspec.size = asset.size;\n\t} else if (asset.type === 'video' && asset.span) {\n\t\tspec.span = asset.span;\n\t} else if ((asset.type === 'audio' || asset.type === 'tts') && asset.volume !== undefined) {\n\t\tspec.volume = asset.volume;\n\t}\n\n\tif (Object.keys(spec).length > 0) {\n\t\tmedia.setAttribute('spec', JSON.stringify(spec));\n\t}\n\n\t// Create expand button\n\tconst expandBtn = document.createElement('button');\n\texpandBtn.className = 'media-expand-button';\n\texpandBtn.title = 'Expand to full view';\n\texpandBtn.innerHTML = `\n\t\t<svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\" stroke=\"currentColor\">\n\t\t\t<path stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"\n\t\t\t\td=\"M3 7V3h4M17 7V3h-4M3 13v4h4M17 13v4h-4\"/>\n\t\t</svg>\n\t`;\n\texpandBtn.style.cssText = `\n\t\tposition: absolute;\n\t\ttop: 0.5rem;\n\t\tright: 0.5rem;\n\t\tbackground: rgba(0, 0, 0, 0.7);\n\t\tcolor: white;\n\t\tborder: none;\n\t\tborder-radius: 6px;\n\t\tpadding: 0.5rem;\n\t\tcursor: pointer;\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: center;\n\t\ttransition: all 0.2s;\n\t\tz-index: 10;\n\t\topacity: 0.8;\n\t`;\n\n\texpandBtn.addEventListener('mouseenter', () => {\n\t\texpandBtn.style.opacity = '1';\n\t\texpandBtn.style.transform = 'scale(1.1)';\n\t});\n\n\texpandBtn.addEventListener('mouseleave', () => {\n\t\texpandBtn.style.opacity = '0.8';\n\t\texpandBtn.style.transform = 'scale(1)';\n\t});\n\n\texpandBtn.addEventListener('click', () => {\n\t\topenAssetInDialog(asset);\n\t});\n\n\twrapper.appendChild(media);\n\twrapper.appendChild(expandBtn);\n\tcontainer.appendChild(wrapper);\n}\n\n/**\n * Open asset content in EduDialog\n */\nfunction openAssetInDialog(asset: Asset): void {\n\t// Create dialog if needed\n\tlet dialog = document.querySelector('edu-dialog#asset-dialog') as EduDialog;\n\n\tif (!dialog) {\n\t\tdialog = document.createElement('edu-dialog') as EduDialog;\n\t\tdialog.id = 'asset-dialog';\n\t\tdocument.body.appendChild(dialog);\n\t}\n\n\tconst titles = {\n\t\timage: 'Image',\n\t\tvideo: 'Video',\n\t\taudio: 'Audio',\n\t\thtml: 'Content',\n\t\ttts: 'Audio'\n\t};\n\tdialog.title = titles[asset.type];\n\n\t// Create edu-media for dialog content\n\tconst media = document.createElement('edu-media');\n\tmedia.setAttribute('type', asset.type);\n\n\tif (asset.type === 'image' || asset.type === 'video' || asset.type === 'audio') {\n\t\tmedia.setAttribute('data', asset.url);\n\t} else if (asset.type === 'html' || asset.type === 'tts') {\n\t\tmedia.setAttribute('data', asset.content);\n\t}\n\n\t// Set spec\n\tconst spec: any = {};\n\tif (asset.type === 'image' && asset.size) {\n\t\tspec.size = 'large'; // Force large in dialog\n\t} else if (asset.type === 'video' && asset.span) {\n\t\tspec.span = asset.span;\n\t} else if ((asset.type === 'audio' || asset.type === 'tts') && asset.volume !== undefined) {\n\t\tspec.volume = asset.volume;\n\t}\n\n\tif (Object.keys(spec).length > 0) {\n\t\tmedia.setAttribute('spec', JSON.stringify(spec));\n\t}\n\n\t// Clear and set content\n\tdialog.innerHTML = '';\n\tdialog.appendChild(media);\n\tdialog.open();\n}\n\n/**\n * EduMedia - Universal media renderer component\n *\n * Renders different media types based on the 'type' attribute.\n * Works with Asset interfaces from src/shared/assets.ts\n *\n * Attributes:\n * - type: \"image\" | \"video\" | \"audio\" | \"html\" | \"tts\"\n * - data: URL string for image/video/audio, or HTML content string\n * - spec: Optional specifications (JSON string)\n * - For image: { size?: \"small\" | \"medium\" | \"large\" }\n * - For video: { span?: { from: string, to: string } }\n * - For audio: { volume?: number, loop?: boolean }\n *\n * Usage:\n * <edu-media type=\"image\" data=\"https://example.com/photo.jpg\" spec='{\"size\":\"large\"}'></edu-media>\n * <edu-media type=\"video\" data=\"/assets/video.mp4\"></edu-media>\n * <edu-media type=\"audio\" data=\"/assets/sound.mp3\" spec='{\"volume\":0.8,\"loop\":true}'></edu-media>\n * <edu-media type=\"html\" data=\"<p>Rich <strong>HTML</strong> content</p>\"></edu-media>\n */\nexport class EduMedia extends HTMLElement {\n\tprivate mediaType: string | null = null;\n\tprivate mediaData: string | null = null;\n\tprivate mediaSpec: Record<string, any> | null = null;\n\n\t// For audio playback control\n\tprivate audioPlaying: boolean = false;\n\tprivate currentAudioUrl: string | null = null;\n\n\tstatic get observedAttributes() {\n\t\treturn ['type', 'data', 'spec'];\n\t}\n\n\tconstructor() {\n\t\tsuper();\n\t}\n\n\tconnectedCallback() {\n\t\tthis.render();\n\t}\n\n\tattributeChangedCallback(name: string, oldValue: string | null, newValue: string | null) {\n\t\tif (oldValue === newValue) return;\n\n\t\tif (name === 'type') {\n\t\t\tthis.mediaType = newValue;\n\t\t} else if (name === 'data') {\n\t\t\tthis.mediaData = newValue;\n\t\t} else if (name === 'spec') {\n\t\t\ttry {\n\t\t\t\tthis.mediaSpec = newValue ? JSON.parse(newValue) : null;\n\t\t\t} catch (error) {\n\t\t\t\tconsole.warn('[EduMedia] Invalid spec JSON:', newValue);\n\t\t\t\tthis.mediaSpec = null;\n\t\t\t}\n\t\t}\n\n\t\tif (this.isConnected) {\n\t\t\tthis.render();\n\t\t}\n\t}\n\n\tdisconnectedCallback() {\n\t\t// Stop audio if playing\n\t\tif (this.audioPlaying && this.currentAudioUrl) {\n\t\t\tsoundManager.stop(this.currentAudioUrl);\n\t\t\tthis.audioPlaying = false;\n\t\t}\n\t}\n\n\tprivate render(): void {\n\t\tif (!this.mediaType || !this.mediaData) {\n\t\t\tthis.innerHTML = '';\n\t\t\treturn;\n\t\t}\n\n\t\tswitch (this.mediaType) {\n\t\t\tcase 'image':\n\t\t\t\tthis.renderImage();\n\t\t\t\tbreak;\n\t\t\tcase 'video':\n\t\t\t\tthis.renderVideo();\n\t\t\t\tbreak;\n\t\t\tcase 'audio':\n\t\t\t\tthis.renderAudio();\n\t\t\t\tbreak;\n\t\t\tcase 'html':\n\t\t\t\tthis.renderHtml();\n\t\t\t\tbreak;\n\t\t\tcase 'tts':\n\t\t\t\t// TTS not implemented yet\n\t\t\t\tthis.innerHTML = '<div style=\"font-style: italic; color: gray;\">TTS not yet supported</div>';\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tconsole.warn(`[EduMedia] Unknown media type: ${this.mediaType}`);\n\t\t\t\tthis.innerHTML = '';\n\t\t}\n\t}\n\n\tprivate renderImage(): void {\n\t\tconst size = this.mediaSpec?.size || 'medium';\n\n\t\tthis.innerHTML = `\n\t\t\t<style>\n\t\t\t\t:host {\n\t\t\t\t\tdisplay: block;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t}\n\n\t\t\t\t.media-image {\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\tmax-height: clamp(140px, 26cqh, 240px);\n\t\t\t\t\tdisplay: block;\n\t\t\t\t\tobject-fit: contain;\n\t\t\t\t\tborder: 2px solid rgb(var(--edu-ink));\n\t\t\t\t}\n\n\t\t\t\t.media-image.small {\n\t\t\t\t\tmax-width: 200px;\n\t\t\t\t}\n\n\t\t\t\t.media-image.medium {\n\t\t\t\t\tmax-width: 400px;\n\t\t\t\t}\n\n\t\t\t\t.media-image.large {\n\t\t\t\t\tmax-width: 100%;\n\t\t\t\t}\n\t\t\t</style>\n\t\t\t<img class=\"media-image ${size}\" src=\"${this.mediaData}\" alt=\"Media content\" />\n\t\t`;\n\t}\n\n\tprivate renderVideo(): void {\n\t\tconst span = this.mediaSpec?.span;\n\t\tconst videoAttrs = span\n\t\t\t? `data-from=\"${span.from}\" data-to=\"${span.to}\"`\n\t\t\t: '';\n\n\t\tthis.innerHTML = `\n\t\t\t<style>\n\t\t\t\t:host {\n\t\t\t\t\tdisplay: block;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t}\n\n\t\t\t\t.media-video {\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\tmax-height: clamp(160px, 28cqh, 280px);\n\t\t\t\t\theight: auto;\n\t\t\t\t\tdisplay: block;\n\t\t\t\t\tborder: 2px solid rgb(var(--edu-ink));\n\t\t\t\t}\n\t\t\t</style>\n\t\t\t<video class=\"media-video\" controls ${videoAttrs}>\n\t\t\t\t<source src=\"${this.mediaData}\" />\n\t\t\t\tYour browser does not support the video tag.\n\t\t\t</video>\n\t\t`;\n\n\t\t// Handle span timing if provided\n\t\tif (span) {\n\t\t\tconst video = this.querySelector('video');\n\t\t\tif (video) {\n\t\t\t\tconst fromSeconds = this.parseTime(span.from);\n\t\t\t\tconst toSeconds = this.parseTime(span.to);\n\n\t\t\t\tvideo.addEventListener('loadedmetadata', () => {\n\t\t\t\t\tif (fromSeconds !== null) {\n\t\t\t\t\t\tvideo.currentTime = fromSeconds;\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tif (toSeconds !== null) {\n\t\t\t\t\tvideo.addEventListener('timeupdate', () => {\n\t\t\t\t\t\tif (video.currentTime >= toSeconds) {\n\t\t\t\t\t\t\tvideo.pause();\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate renderAudio(): void {\n\t\tconst volume = this.mediaSpec?.volume !== undefined\n\t\t\t? this.mediaSpec.volume / 100 // Asset volume is 0-100, SoundManager uses 0-1\n\t\t\t: 1.0;\n\t\tconst loop = this.mediaSpec?.loop ?? false;\n\n\t\tthis.innerHTML = `\n\t\t\t<style>\n\t\t\t\t:host {\n\t\t\t\t\tdisplay: block;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t}\n\n\t\t\t\t.media-audio {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\talign-items: center;\n\t\t\t\t\tgap: 1rem;\n\t\t\t\t\tpadding: 1rem;\n\t\t\t\t\tbackground: rgba(var(--edu-first-accent), 0.1);\n\t\t\t\t\tborder-radius: 8px;\n\t\t\t\t}\n\n\t\t\t\t.audio-button {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\talign-items: center;\n\t\t\t\t\tjustify-content: center;\n\t\t\t\t\twidth: 48px;\n\t\t\t\t\theight: 48px;\n\t\t\t\t\tbackground: rgb(var(--edu-first-accent));\n\t\t\t\t\tborder: none;\n\t\t\t\t\tborder-radius: 50%;\n\t\t\t\t\tcursor: pointer;\n\t\t\t\t\ttransition: all 0.2s ease;\n\t\t\t\t}\n\n\t\t\t\t.audio-button:hover {\n\t\t\t\t\ttransform: scale(1.05);\n\t\t\t\t\tbox-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);\n\t\t\t\t}\n\n\t\t\t\t.audio-button:active {\n\t\t\t\t\ttransform: scale(0.95);\n\t\t\t\t}\n\n\t\t\t\t.audio-button svg {\n\t\t\t\t\twidth: 24px;\n\t\t\t\t\theight: 24px;\n\t\t\t\t\tfill: white;\n\t\t\t\t}\n\n\t\t\t\t.audio-label {\n\t\t\t\t\tflex: 1;\n\t\t\t\t\tfont-size: 0.9rem;\n\t\t\t\t\tcolor: rgb(var(--edu-ink));\n\t\t\t\t}\n\t\t\t</style>\n\t\t\t<div class=\"media-audio\">\n\t\t\t\t<button class=\"audio-button\" title=\"Play audio\">\n\t\t\t\t\t<img src=\"assets/icons/audio.svg\" alt=\"Audio\" width=\"24\" height=\"24\"/>\n\t\t\t\t</button>\n\t\t\t\t<div class=\"audio-label\">Audio clip</div>\n\t\t\t</div>\n\t\t`;\n\n\t\tconst button = this.querySelector('.audio-button') as HTMLButtonElement;\n\n\t\tif (button) {\n\t\t\tbutton.addEventListener('click', async () => {\n\t\t\t\tif (this.audioPlaying) {\n\t\t\t\t\t// Stop\n\t\t\t\t\tsoundManager.stop(this.mediaData!);\n\t\t\t\t\tthis.audioPlaying = false;\n\t\t\t\t\tthis.currentAudioUrl = null;\n\n\t\t\t\t\tbutton.title = 'Play audio';\n\t\t\t\t} else {\n\t\t\t\t\t// Play\n\t\t\t\t\tthis.currentAudioUrl = this.mediaData;\n\n\t\t\t\t\tconsole.log(this.currentAudioUrl);\n\n\t\t\t\t\tawait soundManager.playSound(this.mediaData!, {\n\t\t\t\t\t\tvolume,\n\t\t\t\t\t\tloop,\n\t\t\t\t\t\tonEnd: () => {\n\t\t\t\t\t\t\tthis.audioPlaying = false;\n\t\t\t\t\t\t\tthis.currentAudioUrl = null;\n\t\t\t\t\t\t\tbutton.title = 'Play audio';\n\t\t\t\t\t\t},\n\t\t\t\t\t\tonError: (error) => {\n\t\t\t\t\t\t\tconsole.error('[EduMedia] Audio playback error:', error);\n\t\t\t\t\t\t\tthis.audioPlaying = false;\n\t\t\t\t\t\t\tthis.currentAudioUrl = null;\n\t\t\t\t\t\t\tbutton.title = 'Play audio';\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\n\t\t\t\t\tthis.audioPlaying = true;\n\n\t\t\t\t\tbutton.title = 'Stop audio';\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate renderHtml(): void {\n\t\tthis.innerHTML = `\n\t\t\t<style>\n\t\t\t\t:host {\n\t\t\t\t\tdisplay: block;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t}\n\n\t\t\t\t.media-html {\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\tcolor: rgb(var(--edu-ink));\n\t\t\t\t}\n\n\t\t\t\t.media-html * {\n\t\t\t\t\tmax-width: 100%;\n\t\t\t\t}\n\t\t\t</style>\n\t\t\t<div class=\"media-html\">${this.mediaData}</div>\n\t\t`;\n\t}\n\n\t/**\n\t * Parse time string (mm:ss or hh:mm:ss) to seconds\n\t */\n\tprivate parseTime(timeStr: string): number | null {\n\t\tconst parts = timeStr.split(':').map(p => parseInt(p, 10));\n\n\t\tif (parts.length === 2) {\n\t\t\t// mm:ss\n\t\t\treturn parts[0] * 60 + parts[1];\n\t\t} else if (parts.length === 3) {\n\t\t\t// hh:mm:ss\n\t\t\treturn parts[0] * 3600 + parts[1] * 60 + parts[2];\n\t\t}\n\n\t\treturn null;\n\t}\n}\n\nif (!customElements.get('edu-media')) {\n\tcustomElements.define('edu-media', EduMedia);\n}\n", "import { Variant } from \"../../../shared/types\";\n\n/**\n * Skin wrapper for native form controls (input/select/textarea/button).\n * It applies the variant system via host selectors and styles slotted controls.\n */\n\nconst CSS = `\n:host {\n\tdisplay: inline-flex;\n\talign-items: center;\n\twidth: auto;\n\tfont-family: inherit;\n\tcolor: rgb(var(--edu-ink));\n}\n\n/* --- SHARED BASE STYLES --- */\n.control {\n\twidth: 100%;\n\tbox-sizing: border-box;\n\tpadding: 0.6rem 1rem;\n\tfont-size: 1rem;\n\ttransition: all 0.2s ease;\n\tborder: 1px solid rgb(var(--edu-border));\n\tborder-radius: 4px;\n\toutline: none;\n\tbackground: rgb(var(--edu-bg));\n\tcolor: rgb(var(--edu-ink));\n\tfont-family: inherit;\n}\n\n.control:focus {\n\tborder-color: rgb(var(--edu-first-accent));\n\tbox-shadow: 0 0 0 2px rgb(var(--edu-first-accent) / 0.2);\n}\n\n.control[type=\"checkbox\"],\n.control[type=\"radio\"] {\n\twidth: 18px;\n\theight: 18px;\n\tpadding: 0;\n\taccent-color: rgb(var(--edu-first-accent));\n}\n\nbutton.control {\n\tcursor: pointer;\n}\n\nslot {\n\tdisplay: none;\n}\n\n:host([disabled]) .control {\n\topacity: 0.6;\n\tcursor: not-allowed;\n}\n\n/* --- VARIANTS --- */\n\n:host([variant=\"elegant\"]) .control {\n\tborder-radius: 0;\n\tborder-bottom: 2px solid rgb(var(--edu-first-accent));\n\tbackground: rgb(var(--edu-card));\n\tletter-spacing: 1px;\n\ttext-transform: uppercase;\n\tfont-size: 0.8rem;\n}\n\n:host([variant=\"playful\"]) .control {\n\tborder-radius: 50px;\n\tbackground: rgb(var(--edu-first-accent) / 0.7);\n\tborder: 2px solid rgb(var(--edu-first-accent));\n\tfont-weight: 700;\n\tcolor: rgb(var(--edu-inverted-ink));\n}\n\n:host([variant=\"outline\"]) .control {\n\tbackground: transparent;\n\tborder: 2px solid rgb(var(--edu-first-accent));\n\tcolor: rgb(var(--edu-ink));\n}\n\n:host([variant=\"letter\"]) .control {\n\tbackground: rgb(var(--edu-card));\n\tborder: 1px solid rgb(var(--edu-muted));\n\tfont-family: georgia, serif;\n\tfont-style: italic;\n\tbox-shadow: 2px 2px 0 rgb(var(--edu-muted));\n}\n\n:host([variant=\"sign\"]) .control {\n\tbackground: rgb(var(--edu-bg));\n\tfont-weight: 800;\n\ttext-transform: uppercase;\n\tletter-spacing: 2px;\n\tborder-radius: 4px;\n}\n\n:host([variant=\"minimal\"]) .control {\n\tbackground: rgb(var(--edu-bg));\n\tborder: 1px solid rgb(var(--edu-border));\n}\n\n:host([variant=\"glass\"]) .control {\n\tbackground: rgba(var(--edu-card), 0.7);\n\tbackdrop-filter: blur(10px);\n\tborder: 2px solid rgba(var(--edu-border), 0.35);\n}\n\n:host([variant=\"empty\"]) .control {\n\tbackground: transparent;\n\tborder: 2px solid rgb(var(--edu-border));\n}\n\n/* --- STATE FEEDBACK --- */\n:host([state=\"correct\"]) .control {\n\tborder: 2px solid rgb(var(--edu-success));\n\tbackground: rgb(var(--edu-success) / 0.1);\n\tbox-shadow: 0 0 0 2px rgb(var(--edu-success) / 0.2);\n}\n\n:host([state=\"wrong\"]) .control {\n\tborder: 2px solid rgb(var(--edu-error));\n\tbackground: rgb(var(--edu-error) / 0.1);\n\tbox-shadow: 0 0 0 2px rgb(var(--edu-error) / 0.2);\n}\n\n:host([state=\"missed\"]) .control {\n\tborder: 2px solid rgb(var(--edu-warning));\n\tbackground: rgb(var(--edu-warning) / 0.1);\n\tbox-shadow: 0 0 0 2px rgb(var(--edu-warning) / 0.2);\n}\n`;\n\nconst ALLOWED_TAGS = [\"input\", \"select\", \"textarea\", \"button\"] as const;\ntype AllowedTag = (typeof ALLOWED_TAGS)[number];\n\ntype NativeControl = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | HTMLButtonElement;\n\nexport class EduInput extends HTMLElement {\n\t// state: GradingState from \"types/Grading\"\n\tstatic get observedAttributes() {\n\t\treturn [\n\t\t\t\"as\",\n\t\t\t\"variant\",\n\t\t\t\"state\",\n\t\t\t\"disabled\",\n\t\t\t\"readonly\",\n\t\t\t\"required\",\n\t\t\t\"placeholder\",\n\t\t\t\"value\",\n\t\t\t\"type\",\n\t\t\t\"name\",\n\t\t\t\"autocomplete\",\n\t\t\t\"min\",\n\t\t\t\"max\",\n\t\t\t\"step\",\n\t\t\t\"pattern\",\n\t\t\t\"rows\",\n\t\t\t\"cols\",\n\t\t\t\"multiple\",\n\t\t\t\"size\"\n\t\t];\n\t}\n\n\tprivate $slot: HTMLSlotElement | null = null;\n\tprivate controlEl: NativeControl | null = null;\n\tprivate currentTag: AllowedTag = \"input\";\n\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.attachShadow({ mode: \"open\" });\n\t}\n\n\tconnectedCallback() {\n\t\tif (!this.hasAttribute(\"variant\")) this.variant = \"outline\";\n\t\tthis.render();\n\t\tthis.$slot?.addEventListener(\"slotchange\", this.handleSlotChange);\n\t\tthis.syncAttributes();\n\t\tthis.syncContent();\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.$slot?.removeEventListener(\"slotchange\", this.handleSlotChange);\n\t}\n\n\tattributeChangedCallback(name: string, oldValue: string | null, newValue: string | null) {\n\t\tif (oldValue === newValue) return;\n\t\tif (name === \"as\") {\n\t\t\tthis.render();\n\t\t}\n\n\t\tthis.syncAttributes();\n\t\tthis.syncContent();\n\t}\n\n\tprivate handleSlotChange = () => {\n\t\tthis.syncAttributes();\n\t\tthis.syncContent();\n\t};\n\n\tprivate getTag(): AllowedTag {\n\t\tconst as = (this.getAttribute(\"as\") ?? \"input\").toLowerCase();\n\t\tif (ALLOWED_TAGS.includes(as as AllowedTag)) return as as AllowedTag;\n\t\treturn \"input\";\n\t}\n\n\tprivate render() {\n\t\tconst tag = this.getTag();\n\t\tif (this.controlEl && this.currentTag === tag) return;\n\n\t\tthis.currentTag = tag;\n\t\tthis.shadowRoot!.innerHTML = \"\";\n\n\t\tconst styleEl = document.createElement(\"style\");\n\t\tstyleEl.textContent = CSS;\n\t\tthis.shadowRoot!.append(styleEl);\n\n\t\tconst control = document.createElement(tag) as NativeControl;\n\t\tcontrol.className = \"control\";\n\t\tcontrol.setAttribute(\"part\", \"control\");\n\n\t\tthis.$slot = document.createElement(\"slot\");\n\n\t\tthis.shadowRoot!.append(control, this.$slot);\n\t\tthis.controlEl = control;\n\t}\n\n\tprivate applyAttr(attr: string) {\n\t\tif (!this.controlEl) return;\n\t\tif (this.hasAttribute(attr)) {\n\t\t\tthis.controlEl.setAttribute(attr, this.getAttribute(attr) ?? \"\");\n\t\t} else {\n\t\t\tthis.controlEl.removeAttribute(attr);\n\t\t}\n\t}\n\n\tprivate applyBoolAttr(attr: string) {\n\t\tif (!this.controlEl) return;\n\t\tif (this.hasAttribute(attr)) {\n\t\t\tthis.controlEl.setAttribute(attr, \"\");\n\t\t} else {\n\t\t\tthis.controlEl.removeAttribute(attr);\n\t\t}\n\t}\n\n\tprivate syncAttributes() {\n\t\tif (!this.controlEl) return;\n\n\t\tthis.applyBoolAttr(\"disabled\");\n\t\tthis.applyBoolAttr(\"readonly\");\n\t\tthis.applyBoolAttr(\"required\");\n\n\t\tthis.applyAttr(\"placeholder\");\n\t\tthis.applyAttr(\"name\");\n\t\tthis.applyAttr(\"autocomplete\");\n\t\tthis.applyAttr(\"min\");\n\t\tthis.applyAttr(\"max\");\n\t\tthis.applyAttr(\"step\");\n\t\tthis.applyAttr(\"pattern\");\n\n\t\tif (this.controlEl instanceof HTMLInputElement) {\n\t\t\tthis.applyAttr(\"type\");\n\t\t}\n\n\t\tif (this.controlEl instanceof HTMLTextAreaElement) {\n\t\t\tthis.applyAttr(\"rows\");\n\t\t\tthis.applyAttr(\"cols\");\n\t\t}\n\n\t\tif (this.controlEl instanceof HTMLSelectElement) {\n\t\t\tthis.applyBoolAttr(\"multiple\");\n\t\t\tthis.applyAttr(\"size\");\n\t\t}\n\n\t\tif (\"value\" in this.controlEl) {\n\t\t\tif (this.hasAttribute(\"value\")) {\n\t\t\t\tthis.controlEl.value = this.getAttribute(\"value\") ?? \"\";\n\t\t\t} else {\n\t\t\t\tthis.controlEl.value = \"\";\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate syncContent() {\n\t\tif (!this.controlEl || !this.$slot) return;\n\t\tconst assigned = this.$slot.assignedNodes({ flatten: true });\n\t\tconst filtered = assigned.filter((node) => {\n\t\t\tif (node.nodeType === Node.TEXT_NODE) {\n\t\t\t\treturn node.textContent?.trim();\n\t\t\t}\n\t\t\treturn node.nodeType === Node.ELEMENT_NODE;\n\t\t});\n\n\t\tif (this.controlEl instanceof HTMLSelectElement) {\n\t\t\tthis.controlEl.innerHTML = \"\";\n\t\t\tfiltered.forEach((node) => {\n\t\t\t\tif (node instanceof HTMLOptionElement || node instanceof HTMLOptGroupElement) {\n\t\t\t\t\tthis.controlEl!.append(node.cloneNode(true));\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.controlEl instanceof HTMLButtonElement) {\n\t\t\tthis.controlEl.innerHTML = \"\";\n\t\t\tfiltered.forEach((node) => {\n\t\t\t\tthis.controlEl!.append(node.cloneNode(true));\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.controlEl instanceof HTMLTextAreaElement) {\n\t\t\tif (!this.hasAttribute(\"value\")) {\n\t\t\t\tconst text = filtered.map((node) => node.textContent ?? \"\").join(\"\");\n\t\t\t\tthis.controlEl.value = text;\n\t\t\t}\n\t\t}\n\t}\n\n\tget variant(): Variant {\n\t\treturn (this.getAttribute(\"variant\") ?? \"outline\") as Variant;\n\t}\n\tset variant(v: Variant) {\n\t\tthis.setAttribute(\"variant\", v);\n\t}\n\n\tget value(): string {\n\t\tif (this.controlEl && \"value\" in this.controlEl) return this.controlEl.value;\n\t\treturn this.getAttribute(\"value\") ?? \"\";\n\t}\n\tset value(v: string) {\n\t\tthis.setAttribute(\"value\", String(v));\n\t\tif (this.controlEl && \"value\" in this.controlEl) this.controlEl.value = v;\n\t}\n}\n\nif (!customElements.get(\"edu-input\")) customElements.define(\"edu-input\", EduInput);\n", "import { BaseTableData, ValueTableData, CellValue, TableState } from \"../../../types/Tables\";\n\ntype ParseResult = {\n\tdata: BaseTableData;\n\terrors?: Record<string, string>;\n};\n\ntype ValueTableParseResult = {\n\tdata: ValueTableData;\n\terrors?: Record<string, string>;\n};\n\n\n/**\n * The classification table presents a default configuration where we have non-equal rows and columns and \n * participant is presented with check boxes on each cell to add 'attributes' to each row item. \n * \n * The n-ary table is just a superset or the former, with the discrepancies being using radio buttons instead\n * (single selection) and not allowing row items to be in more than one category (this is handled in the \n * n-ary table validator). \n * \n * For grading, we take the row item and the checked columns. Using the answerKey, we check if those columns\n * that were selected contain the row item; correct if yes, wrong otherwise. If there are mixed correct/wrong,\n * we just fractionate the grading n/100, where n = correct items. \n * \n * Classification Example - Notice repetitions\n *\n * WORK = Talk with my colleagues | Eat | Report Attendance;\n * SCHOOL = Eat | Complete my examns | Play in the basketball club;\n * HOME = Eat | Talk with my colleagues | Sleep;\n *\n * N-ARY example \n *\n * TRUE = Water is Blue | An active volcano is hot;\n * FALSE = MJ was a piano player | Africa is above Europe | A chef is someone who writes poems\t\n */\nexport function basicTableDataParser(code: string): ParseResult {\n\n\tlet rows: string[] = [], cols: string[] = [];\t\n\tlet answerKey: Map<string, string[]> = new Map<string, string[]>();\t\n\tconst errors: Record<string, string> = {};\n\t\n\tconst categoryPattern = \n\t\t/^\\s*(?<category>[A-Z_](?:[A-Z0-9_]* ?[A-Z0-9_]+)*)\\s*=\\s*(?<items>[^;]+?)\\s*;\\s*$/gm;\n\n\tconst matches = [...code.matchAll(categoryPattern)];\n\n\tif (matches.length === 0) {\n\t\terrors['parse.noMatches'] =\n\t\t\t'No valid category entries found. Expected lines like: CATEGORY = item1 | item2;';\n\t}\n\n\tconst seen = new Set<string>();\n\tfor (const match of matches) {\t\t\n\t\tconst rawCategory = match.groups?.category ?? '';\n\t\tconst rawItems = match.groups?.items ?? '';\n\n\t\tconst category = rawCategory.trim().toLowerCase();\n\n\t\tif (answerKey.has(category)) {\n\t\t\terrors[`parse.duplicateCategory.${category}`] =\n\t\t\t\t`Duplicate category \"${category}\" was defined more than once. Merge them into a single entry.`;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst items = rawItems\n\t\t\t.split('|')\n\t\t\t.map(s => s.replace(/\\s+/g, ' ').trim())\n\t\t\t.filter(Boolean);\n\n\t\tif (items.length === 0) {\n\t\t\terrors[`parse.emptyCategory.${category}`] =\n\t\t\t\t`Category \"${category}\" has no items. Expected at least one item before ';'.`;\n\n\t\t\t// still register the column so validator can give consistent feedback\n\t\t\tcols.push(category);\n\t\t\tanswerKey.set(category, []);\n\t\t\tcontinue;\n\t\t}\n\n\t\tcols.push(category);\n\n\t\tfor (const item of items) {\n\t\t\tif (seen.has(item)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tseen.add(item);\n\t\t\trows.push(item);\n\t\t}\n\n\t\tanswerKey.set(category, items);\n\t}\n\n\tconst data: BaseTableData = { rows, cols, answerKey };\n\n\treturn Object.keys(errors).length > 0 ? { data, errors } : { data }; \n}\n\n\n// ==================== ADJACENCY TABLE ====================\n\nexport function adjacencyTableDataParser(code: string): ValueTableParseResult {\n\tconst errors: Record<string, string> = {};\n\tconst categories: string[] = [];\n\tconst rawData: Map<string, string[]> = new Map();\n\n\tconst categoryPattern = /^\\s*(?<category>[a-z_](?:[a-z0-9_]* ?[a-z0-9_]+)*)\\s*=\\s*(?<values>[^;]+?)\\s*;/gim;\n\tconst matches = [...code.matchAll(categoryPattern)];\n\n\tif (matches.length === 0) {\n\t\terrors['parse.noMatches'] = 'No valid category entries found. Expected lines like: category = val1 | val2;';\n\t\treturn { data: { rows: [], cols: [], answerKey: {} }, errors };\n\t}\n\n\tconst seen = new Set<string>();\n\tfor (const match of matches) {\n\t\tconst rawCategory = match.groups?.category ?? '';\n\t\tconst rawValues = match.groups?.values ?? '';\n\t\tconst category = rawCategory.trim().toLowerCase();\n\n\t\tif (seen.has(category)) {\n\t\t\terrors[`parse.duplicateCategory.${category}`] = `Duplicate category \"${category}\" was defined more than once.`;\n\t\t\tcontinue;\n\t\t}\n\t\tseen.add(category);\n\n\t\tconst values = rawValues\n\t\t\t.split('|')\n\t\t\t.map(s => s.trim())\n\t\t\t.filter(Boolean);\n\n\t\tcategories.push(category);\n\t\trawData.set(category, values);\n\t}\n\n\tconst n = categories.length;\n\n\t// Validate value counts\n\tfor (const category of categories) {\n\t\tconst values = rawData.get(category) ?? [];\n\t\tconst expected = n - 1;\n\n\t\tif (values.length !== expected) {\n\t\t\terrors[`parse.valueCount.${category}`] =\n\t\t\t\t`Category \"${category}\" has ${values.length} values, but expected ${expected} (n-1 where n=${n}).`;\n\t\t}\n\t}\n\n\t// Build TableState answer key\n\tconst answerKey: TableState = {};\n\n\tfor (let i = 0; i < categories.length; i++) {\n\t\tconst rowCategory = categories[i];\n\t\tconst values = rawData.get(rowCategory) ?? [];\n\n\t\tanswerKey[rowCategory] = {};\n\n\t\tlet valueIndex = 0;\n\t\tfor (let j = 0; j < categories.length; j++) {\n\t\t\tif (i === j) continue; // Skip diagonal\n\n\t\t\tconst colCategory = categories[j];\n\t\t\tconst rawValue = values[valueIndex];\n\n\t\t\t// Try to parse as number\n\t\t\tlet cellValue: CellValue = null;\n\t\t\tif (rawValue !== undefined && rawValue !== '') {\n\t\t\t\tconst num = Number(rawValue);\n\t\t\t\tcellValue = isNaN(num) ? rawValue : num;\n\t\t\t}\n\n\t\t\tanswerKey[rowCategory][colCategory] = cellValue;\n\t\t\tvalueIndex++;\n\t\t}\n\t}\n\n\tconst data: ValueTableData = {\n\t\trows: categories,\n\t\tcols: categories,\n\t\tanswerKey\n\t};\n\n\treturn Object.keys(errors).length > 0 ? { data, errors } : { data };\n}\n\n\n// ==================== LOOKUP TABLE ====================\n\nexport function lookupTableDataParser(code: string): ValueTableParseResult {\n\tconst errors: Record<string, string> = {};\n\tlet cols: string[] = [];\n\tconst rows: string[] = [];\n\tconst answerKey: TableState = {};\n\n\t// Extract header line (columns)\n\tconst headerPattern = /^\\s*=\\s*(?<cols>[^;]+?)\\s*;/m;\n\tconst headerMatch = code.match(headerPattern);\n\n\tif (!headerMatch) {\n\t\terrors['parse.noHeader'] =\n\t\t\t'Missing header line. Expected first line like: = col1 | col2 | col3;';\n\t\treturn { data: { rows: [], cols: [], answerKey: {} }, errors };\n\t}\n\n\tconst rawCols = headerMatch.groups?.cols ?? '';\n\tcols = rawCols\n\t\t.split('|')\n\t\t.map(s => s.trim())\n\t\t.filter(Boolean);\n\n\tif (cols.length === 0) {\n\t\terrors['parse.emptyHeader'] = 'Header line has no columns. Expected at least one column after \"=\".';\n\t\treturn { data: { rows: [], cols: [], answerKey: {} }, errors };\n\t}\n\n\t// Extract row lines\n\tconst rowPattern = /^\\s*(?<row>[^=]+?)\\s*=\\s*(?<values>[^;]+?)\\s*;/gm;\n\tconst rowMatches = [...code.matchAll(rowPattern)];\n\n\tconst seenRows = new Set<string>();\n\n\tfor (const match of rowMatches) {\n\t\tconst rawRow = match.groups?.row ?? '';\n\t\tconst rawValues = match.groups?.values ?? '';\n\n\t\t// Skip the header line (it has empty row name)\n\t\tif (rawRow.trim() === '') continue;\n\n\t\tconst row = rawRow.trim();\n\n\t\tif (seenRows.has(row)) {\n\t\t\terrors[`parse.duplicateRow.${row}`] = `Duplicate row \"${row}\" was defined more than once.`;\n\t\t\tcontinue;\n\t\t}\n\t\tseenRows.add(row);\n\n\t\tconst values = rawValues\n\t\t\t.split('|')\n\t\t\t.map(s => s.trim())\n\t\t\t.filter(s => s !== '');\n\n\t\t// Validate value count\n\t\tif (values.length !== cols.length) {\n\t\t\terrors[`parse.valueCount.${row}`] =\n\t\t\t\t`Row \"${row}\" has ${values.length} values, but expected ${cols.length} (matching column count).`;\n\t\t\tcontinue;\n\t\t}\n\n\t\trows.push(row);\n\t\tanswerKey[row] = {};\n\n\t\tfor (let i = 0; i < cols.length; i++) {\n\t\t\tconst col = cols[i];\n\t\t\tconst rawValue = values[i];\n\n\t\t\t// Check for disabled cell marker\n\t\t\tif (rawValue === '-') {\n\t\t\t\tanswerKey[row][col] = null;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Try to parse as number\n\t\t\tlet cellValue: CellValue = null;\n\t\t\tif (rawValue !== undefined && rawValue !== '') {\n\t\t\t\tconst num = Number(rawValue);\n\t\t\t\tcellValue = isNaN(num) ? rawValue : num;\n\t\t\t}\n\n\t\t\tanswerKey[row][col] = cellValue;\n\t\t}\n\t}\n\n\tif (rows.length === 0) {\n\t\terrors['parse.noRows'] = 'No data rows found. Expected at least one line like: row = val1 | val2;';\n\t}\n\n\tconst data: ValueTableData = { rows, cols, answerKey };\n\n\treturn Object.keys(errors).length > 0 ? { data, errors } : { data };\n}\n\n", "import { BaseTableData, ValueTableData } from \"../../../types/Tables\";\n\ntype ValidationResult = { ok: boolean; errors?: Record<string, string>; }\n\nexport function basicTableDataValidator(\n\tdata: BaseTableData,\n\tpreset: 'classification' | 'n-ary' = 'classification'\n): ValidationResult {\n\n\tconst errors: Record<string, string> = {};\n\tconst answerKey = data.answerKey;\n\n\t// ----------------------------\n\t// Common checks (all presets)\n\t// ----------------------------\n\n\tif (data.cols.length === 0) {\n\t\terrors['cols.empty'] = 'No categories were found. Expected at least one CATEGORY = ... ; entry.';\n\t}\n\n\tif (data.rows.length === 0) {\n\t\terrors['rows.empty'] = 'No row items were found. Expected at least one item in any category.';\n\t}\n\n\t// 1) Ensure no header is also a row item\n\tfor (const col of data.cols) {\n\t\tif (data.rows.includes(col)) {\n\t\t\terrors[`cols.rowConflict.${col}`] =\n\t\t\t\t`Category \"${col}\" is also present as an item. Category labels cannot be used as row items.`;\n\t\t}\n\t}\n\n\t// 2) All categories contain at least one item + answerKey must match cols\n\t// (Also catches: category exists in cols but missing in answerKey)\n\tfor (const col of data.cols) {\n\t\tconst items = answerKey.get(col);\n\n\t\tif (!items) {\n\t\t\terrors[`answerKey.missing.${col}`] =\n\t\t\t\t`Category \"${col}\" has no entry in answerKey. This usually indicates a parser issue.`;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (items.length === 0) {\n\t\t\terrors[`answerKey.emptyCategory.${col}`] =\n\t\t\t\t`Category \"${col}\" has no items. Each category must include at least one item.`;\n\t\t}\n\t}\n\n\t// 3) Detect duplicate items inside a category list \n\tfor (const [col, items] of answerKey.entries()) {\n\t\tconst seen = new Set<string>();\n\t\tfor (const item of items) {\n\t\t\tif (seen.has(item)) {\n\t\t\t\terrors[`answerKey.duplicateItem.${col}`] =\n\t\t\t\t\t`Category \"${col}\" includes duplicate item \"${item}\". Remove duplicates.`;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tseen.add(item);\n\t\t}\n\t}\n\n\t// -----------------------------------------\n\t// Preset-specific checks: n-ary constraints\n\t// -----------------------------------------\n\tif (preset === 'n-ary') {\n\t\t// Build membership index: row item -> categories it appears in\n\t\tconst membership = new Map<string, string[]>();\n\n\t\tfor (const [col, items] of answerKey.entries()) {\n\t\t\tfor (const item of items) {\n\t\t\t\tconst arr = membership.get(item);\n\t\t\t\tif (arr) arr.push(col);\n\t\t\t\telse membership.set(item, [col]);\n\t\t\t}\n\t\t}\n\n\t\t// Decide policy: \"exactly one\" vs \"at most one\"\n\t\t// Here: exactly one. If you want \"at most one\", remove the unassigned check.\n\t\tfor (const row of data.rows) {\n\t\t\tconst cats = membership.get(row) ?? [];\n\n\t\t\tif (cats.length === 0) {\n\t\t\t\terrors[`nary.unassigned.${row}`] =\n\t\t\t\t\t`Item \"${row}\" is not assigned to any category. In n-ary tables, every item must belong to exactly one category.`;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (cats.length > 1) {\n\t\t\t\terrors[`nary.multiCategory.${row}`] =\n\t\t\t\t\t`Item \"${row}\" appears in multiple categories (${cats.join(', ')}). In n-ary tables, items must belong to exactly one category.`;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn Object.keys(errors).length > 0 ? { ok: false, errors } : { ok: true };\n}\n\nexport function adjacencyTableDataValidator(data: ValueTableData): ValidationResult {\n\tconst errors: Record<string, string> = {};\n\n\t// Check 1: Rows must exist\n\tif (data.rows.length === 0) {\n\t\terrors['rows.empty'] = 'No rows found. Expected at least one category.';\n\t}\n\n\t// Check 2: Cols must exist\n\tif (data.cols.length === 0) {\n\t\terrors['cols.empty'] = 'No columns found. Expected at least one category.';\n\t}\n\n\t// Check 3: Rows and cols must be identical (symmetric matrix)\n\tif (data.rows.length !== data.cols.length) {\n\t\terrors['symmetry.lengthMismatch'] =\n\t\t\t`Rows (${data.rows.length}) and columns (${data.cols.length}) must have the same length for adjacency tables.`;\n\t} else {\n\t\tconst rowSet = new Set(data.rows);\n\t\tconst colSet = new Set(data.cols);\n\n\t\tfor (const row of data.rows) {\n\t\t\tif (!colSet.has(row)) {\n\t\t\t\terrors[`symmetry.rowNotInCols.${row}`] =\n\t\t\t\t\t`Row \"${row}\" does not appear in columns. Adjacency tables must be symmetric.`;\n\t\t\t}\n\t\t}\n\n\t\tfor (const col of data.cols) {\n\t\t\tif (!rowSet.has(col)) {\n\t\t\t\terrors[`symmetry.colNotInRows.${col}`] =\n\t\t\t\t\t`Column \"${col}\" does not appear in rows. Adjacency tables must be symmetric.`;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Check 4: Answer key must have entry for each row\n\tfor (const row of data.rows) {\n\t\tif (!data.answerKey[row]) {\n\t\t\terrors[`answerKey.missingRow.${row}`] =\n\t\t\t\t`Row \"${row}\" has no entry in answer key.`;\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Check 5: Each row must have entries for all OTHER columns (not itself)\n\t\tfor (const col of data.cols) {\n\t\t\tif (row === col) {\n\t\t\t\t// Diagonal should be undefined or null\n\t\t\t\tconst diagValue = data.answerKey[row][col];\n\t\t\t\tif (diagValue !== undefined && diagValue !== null) {\n\t\t\t\t\terrors[`answerKey.diagonalValue.${row}`] =\n\t\t\t\t\t\t`Diagonal cell (${row}, ${row}) should be empty, but has value \"${diagValue}\".`;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Non-diagonal should have a value\n\t\t\t\tconst value = data.answerKey[row][col];\n\t\t\t\tif (value === undefined) {\n\t\t\t\t\terrors[`answerKey.missingCell.${row}.${col}`] =\n\t\t\t\t\t\t`Missing value at cell (${row}, ${col}). All non-diagonal cells must have values.`;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn Object.keys(errors).length > 0 ? { ok: false, errors } : { ok: true };\n}\n\nexport function lookupTableDataValidator(data: ValueTableData): ValidationResult {\n\tconst errors: Record<string, string> = {};\n\n\t// Check 1: Columns must exist\n\tif (data.cols.length === 0) {\n\t\terrors['cols.empty'] = 'No columns found. Expected at least one column in header line.';\n\t}\n\n\t// Check 2: Rows must exist\n\tif (data.rows.length === 0) {\n\t\terrors['rows.empty'] = 'No rows found. Expected at least one data row.';\n\t}\n\n\t// Check 3: No row name should match any column name (avoid confusion)\n\tconst colSet = new Set(data.cols);\n\tfor (const row of data.rows) {\n\t\tif (colSet.has(row)) {\n\t\t\terrors[`naming.rowColConflict.${row}`] =\n\t\t\t\t`Row name \"${row}\" is also a column name. This creates ambiguity and should be avoided.`;\n\t\t}\n\t}\n\n\t// Check 4: Answer key must have entry for each row\n\tfor (const row of data.rows) {\n\t\tif (!data.answerKey[row]) {\n\t\t\terrors[`answerKey.missingRow.${row}`] =\n\t\t\t\t`Row \"${row}\" has no entry in answer key.`;\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Check 5: Each row must have entry for each column (null is allowed for disabled cells)\n\t\tfor (const col of data.cols) {\n\t\t\tconst value = data.answerKey[row][col];\n\t\t\tif (value === undefined) {\n\t\t\t\terrors[`answerKey.missingCell.${row}.${col}`] =\n\t\t\t\t\t`Missing value at cell (${row}, ${col}). Cells must have values or be marked as disabled with '-'.`;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn Object.keys(errors).length > 0 ? { ok: false, errors } : { ok: true };\n}\n\n", "import { CellValue, CellKind, TableState } from \"../../../types/Tables\";\n\n// ==================== SHARED UTILITIES ====================\n/**\n * Extract all values from a TableState answer key\n */\nexport function getAllValues(answerKey: TableState): CellValue[] {\n\tconst values: CellValue[] = [];\n\tfor (const rowData of Object.values(answerKey)) {\n\t\tfor (const value of Object.values(rowData)) {\n\t\t\tif (value !== null) {\n\t\t\t\tvalues.push(value);\n\t\t\t}\n\t\t}\n\t}\n\treturn values;\n}\n\n/**\n * Get all unique values from a TableState answer key\n */\nexport function getAllUniqueValues(answerKey: TableState): CellValue[] {\n\tconst values = getAllValues(answerKey);\n\treturn Array.from(new Set(values));\n}\n\n/**\n * Auto-detect the best cell kind based on the values in the answer key\n */\nexport function detectCellKind(values: CellValue[]): CellKind {\n\tconst uniqueValues = new Set(values.filter(v => v !== null));\n\n\t// All numbers \u2192 'number'\n\tif (values.every(v => v === null || typeof v === 'number')) {\n\t\treturn 'number';\n\t}\n\n\t// Small unique set (\u2264 10) \u2192 'select' for better UX\n\tif (uniqueValues.size > 0 && uniqueValues.size <= 10) {\n\t\treturn 'select';\n\t}\n\n\t// Default \u2192 'text'\n\treturn 'text';\n}\n\n/**\n * Compare two cell values for equality\n * Handles string, number, and boolean comparisons\n */\nexport function compareValues(expected: CellValue, actual: CellValue): boolean {\n\tif (expected === null || actual === null) return false;\n\n\tif (typeof expected === 'number' && typeof actual === 'number') {\n\t\treturn Math.abs(expected - actual) < 0.0001; // Floating point tolerance\n\t}\n\n\treturn String(expected).trim() === String(actual).trim();\n}\n\n\n", "import { TableCompletion, TableState } from \"../../../types/Tables\";\nimport { GradingResult, GradingState } from \"../../../types/Grading\";\nimport { CellGradingState } from \"../../../types/Tables\"\nimport { compareValues } from \"./utils\";\n\nexport function naryTableGrader(\n\tanswerKey: Map<string, string[]>,\n\tuserData: TableCompletion,\n\trows: string[]\n): GradingResult {\n\tlet correctCount = 0;\n\tconst totalCount = rows.length;\n\n\tfor (const row of rows) {\n\t\tconst userSelected = userData[row]?.selectedCols ?? [];\n\n\t\tlet correctColumn: string | null = null;\n\t\tfor (const [col, items] of answerKey.entries()) {\n\t\t\tif (items.includes(row)) {\n\t\t\t\tcorrectColumn = col;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (userSelected.length === 1 && userSelected[0] === correctColumn) {\n\t\t\tcorrectCount++;\n\t\t}\n\t}\n\n\tconst score = totalCount > 0 ? Math.round((correctCount / totalCount) * 100) : 0;\n\n\treturn { score, correct: correctCount, total: totalCount };\n}\n\nexport function lookupTableGrader(\n\tanswerKey: TableState,\n\tuserData: TableCompletion,\n\trows: string[],\n\tcols: string[]\n): GradingResult {\n\tlet correctCount = 0;\n\tlet totalCount = 0;\n\n\tfor (const row of rows) {\n\t\tfor (const col of cols) {\n\t\t\tconst expected = answerKey[row]?.[col];\n\n\t\t\t// Skip disabled cells (marked with '-' in DSL, stored as null)\n\t\t\tif (expected === null) continue;\n\n\t\t\tconst userValue = userData[row]?.values[col];\n\n\t\t\ttotalCount++;\n\t\t\tif (compareValues(expected, userValue)) {\n\t\t\t\tcorrectCount++;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst score = totalCount > 0 ? Math.round((correctCount / totalCount) * 100) : 0;\n\n\treturn { score, correct: correctCount, total: totalCount };\n}\n\nexport function classificationTableGrader(\n\tanswerKey: Map<string, string[]>,\n\tuserData: TableCompletion,\n\trows: string[],\n\tcols: string[]\n): GradingResult {\n\tlet totalCorrectSelections = 0;\n\tlet totalPossibleSelections = 0;\n\n\tfor (const row of rows) {\n\t\tconst userSelected = new Set(userData[row]?.selectedCols ?? []);\n\t\tconst correctColumns = new Set<string>();\n\t\tfor (const [col, items] of answerKey.entries()) {\n\t\t\tif (items.includes(row)) {\n\t\t\t\tcorrectColumns.add(col);\n\t\t\t}\n\t\t}\n\n\t\tfor (const col of cols) {\n\t\t\tconst shouldBeSelected = correctColumns.has(col);\n\t\t\tconst wasSelected = userSelected.has(col);\n\n\t\t\tif (shouldBeSelected === wasSelected) {\n\t\t\t\ttotalCorrectSelections++;\n\t\t\t}\n\t\t\ttotalPossibleSelections++;\n\t\t}\n\t}\n\n\tconst score = totalPossibleSelections > 0\n\t\t? Math.round((totalCorrectSelections / totalPossibleSelections) * 100)\n\t\t: 0;\n\n\treturn {\n\t\tscore,\n\t\tcorrect: totalCorrectSelections,\n\t\ttotal: totalPossibleSelections\n\t};\n}\n\nexport function adjacencyTableGrader(\n\tanswerKey: TableState,\n\tuserData: TableCompletion,\n\trows: string[]\n): GradingResult {\n\tlet correctCount = 0;\n\tlet totalCount = 0;\n\n\tfor (const row of rows) {\n\t\tfor (const col of rows) {\n\t\t\tif (row === col) continue; // Skip diagonal\n\n\t\t\tconst expected = answerKey[row]?.[col];\n\t\t\tconst userValue = userData[row]?.values[col];\n\n\t\t\ttotalCount++;\n\t\t\tif (compareValues(expected, userValue)) {\n\t\t\t\tcorrectCount++;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst score = totalCount > 0 ? Math.round((correctCount / totalCount) * 100) : 0;\n\n\treturn { score, correct: correctCount, total: totalCount };\n}\n\n\n// ==================== GRADING FEEDBACK ====================\n\n/**\n * Generate per-cell grading state for adjacency tables\n */\nexport function getAdjacencyCellGrading(\n\tanswerKey: TableState,\n\tuserData: TableCompletion,\n\trows: string[]\n): CellGradingState {\n\tconst cellStates: CellGradingState = {};\n\n\tfor (const row of rows) {\n\t\tcellStates[row] = {};\n\n\t\tfor (const col of rows) {\n\t\t\tif (row === col) continue; // Skip diagonal\n\n\t\t\tconst expected = answerKey[row]?.[col];\n\t\t\tconst userValue = userData[row]?.values[col];\n\n\t\t\tif (userValue === null || userValue === undefined || userValue === '') {\n\t\t\t\tcellStates[row][col] = 'missed';\n\t\t\t} else if (compareValues(expected, userValue)) {\n\t\t\t\tcellStates[row][col] = 'correct';\n\t\t\t} else {\n\t\t\t\tcellStates[row][col] = 'wrong';\n\t\t\t}\n\t\t}\n\t}\n\n\treturn cellStates;\n}\n\n/**\n * Generate per-cell grading state for lookup tables\n */\nexport function getLookupCellGrading(\n\tanswerKey: TableState,\n\tuserData: TableCompletion,\n\trows: string[],\n\tcols: string[]\n): CellGradingState {\n\tconst cellStates: CellGradingState = {};\n\n\tfor (const row of rows) {\n\t\tcellStates[row] = {};\n\n\t\tfor (const col of cols) {\n\t\t\tconst expected = answerKey[row]?.[col];\n\n\t\t\t// Skip disabled cells\n\t\t\tif (expected === null) continue;\n\n\t\t\tconst userValue = userData[row]?.values[col];\n\n\t\t\tif (userValue === null || userValue === undefined || userValue === '') {\n\t\t\t\tcellStates[row][col] = 'missed';\n\t\t\t} else if (compareValues(expected, userValue)) {\n\t\t\t\tcellStates[row][col] = 'correct';\n\t\t\t} else {\n\t\t\t\tcellStates[row][col] = 'wrong';\n\t\t\t}\n\t\t}\n\t}\n\n\treturn cellStates;\n}\n\n/**\n * Generate per-cell grading state for classification tables\n */\nexport function getClassificationCellGrading(\n\tanswerKey: Map<string, string[]>,\n\tuserData: TableCompletion,\n\trows: string[],\n\tcols: string[]\n): CellGradingState {\n\tconst cellStates: CellGradingState = {};\n\n\tfor (const row of rows) {\n\t\tcellStates[row] = {};\n\n\t\tconst userSelected = new Set(userData[row]?.selectedCols ?? []);\n\t\tconst correctColumns = new Set<string>();\n\n\t\tfor (const [col, items] of answerKey.entries()) {\n\t\t\tif (items.includes(row)) {\n\t\t\t\tcorrectColumns.add(col);\n\t\t\t}\n\t\t}\n\n\t\tfor (const col of cols) {\n\t\t\tconst shouldBeSelected = correctColumns.has(col);\n\t\t\tconst wasSelected = userSelected.has(col);\n\n\t\t\tif (shouldBeSelected === wasSelected) {\n\t\t\t\tcellStates[row][col] = 'correct';\n\t\t\t} else if (!wasSelected && shouldBeSelected) {\n\t\t\t\tcellStates[row][col] = 'missed';\n\t\t\t} else {\n\t\t\t\tcellStates[row][col] = 'wrong';\n\t\t\t}\n\t\t}\n\t}\n\n\treturn cellStates;\n}\n\n/**\n * Generate per-cell grading state for n-ary tables\n */\nexport function getNaryCellGrading(\n\tanswerKey: Map<string, string[]>,\n\tuserData: TableCompletion,\n\trows: string[]\n): CellGradingState {\n\tconst cellStates: CellGradingState = {};\n\n\tfor (const row of rows) {\n\t\tcellStates[row] = {};\n\n\t\tconst userSelected = userData[row]?.selectedCols ?? [];\n\n\t\tlet correctColumn: string | null = null;\n\t\tfor (const [col, items] of answerKey.entries()) {\n\t\t\tif (items.includes(row)) {\n\t\t\t\tcorrectColumn = col;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t// For n-ary, mark the user's selection\n\t\tif (userSelected.length === 1) {\n\t\t\tconst selectedCol = userSelected[0];\n\t\t\tif (selectedCol === correctColumn) {\n\t\t\t\tcellStates[row][selectedCol] = 'correct';\n\t\t\t} else {\n\t\t\t\tcellStates[row][selectedCol] = 'wrong';\n\t\t\t}\n\t\t} else if (userSelected.length === 0 && correctColumn) {\n\t\t\tcellStates[row][correctColumn] = 'missed';\n\t\t}\n\t}\n\n\treturn cellStates;\n}\n// ------------------------------\n", "/* ===========================================\n BASE TABLE STYLES\n =========================================== */\n\n:host {\n\tdisplay: block;\n\twidth: 100%;\n\tcontainer-type: inline-size;\n}\n\n.wrap {\n\twidth: 100%;\n\toverflow-x: auto;\n\toverflow-y: visible;\n}\n\ntable {\n\twidth: 100%;\n\tborder-collapse: collapse;\n\tbackground: rgb(var(--edu-bg));\n\ttable-layout: auto;\n}\n\n/* Cell base styles with text wrapping */\ntd, th {\n\tpadding: clamp(0.4rem, 1.4cqw, 0.75rem);\n\ttext-align: center;\n\tvertical-align: middle;\n\tborder: 1px solid rgb(var(--edu-border));\n\tcolor: rgb(var(--edu-ink));\n\tfont-size: clamp(0.8rem, 1.8cqw, 0.95rem);\n\tline-height: 1.2;\n\n\t/* Text wrapping and overflow handling */\n\tword-wrap: break-word;\n\toverflow-wrap: break-word;\n\tword-break: break-word;\n\thyphens: auto;\n\tmax-width: clamp(120px, 26cqw, 220px);\n\tmin-width: clamp(56px, 12cqw, 90px);\n}\n\nth {\n\tfont-weight: 600;\n\tbackground: rgb(var(--edu-card));\n}\n\n/* First column (row headers) */\nth[scope=\"row\"] {\n\ttext-align: left;\n\tfont-weight: 500;\n\tbackground: rgb(var(--edu-card));\n\twhite-space: normal;\n}\n\n/* Disabled cells */\n.disabled-cell {\n\tbackground: rgb(var(--edu-muted));\n\tcursor: not-allowed;\n\topacity: 0.5;\n}\n\n/* Grading feedback states */\n.cell-correct {\n\tbackground: rgb(var(--edu-success) / 0.15);\n\tborder-color: rgb(var(--edu-success) / 0.5) !important;\n}\n\n.cell-wrong {\n\tbackground: rgb(var(--edu-error) / 0.15);\n\tborder-color: rgb(var(--edu-error) / 0.5) !important;\n}\n\n.cell-missed {\n\tbackground: rgb(var(--edu-warning) / 0.15);\n\tborder-color: rgb(var(--edu-warning) / 0.5) !important;\n}\n\n/* Form inputs base styles */\ninput[type=\"text\"],\ninput[type=\"number\"],\nselect {\n\twidth: 100%;\n\tmax-width: 100%;\n\tpadding: clamp(0.35rem, 1.2cqw, 0.5rem);\n\tborder: 1px solid rgb(var(--edu-border));\n\tborder-radius: 4px;\n\toutline: none;\n\tfont-family: inherit;\n\tfont-size: clamp(0.8rem, 1.6cqw, 0.9rem);\n\tbackground: rgb(var(--edu-bg));\n\tcolor: rgb(var(--edu-ink));\n\ttransition: border-color 0.2s ease;\n}\n\ninput[type=\"text\"]:focus,\ninput[type=\"number\"]:focus,\nselect:focus {\n\tborder-color: rgb(var(--edu-first-accent));\n\tbox-shadow: 0 0 0 2px rgb(var(--edu-first-accent) / 0.15);\n}\n\ninput[type=\"checkbox\"],\ninput[type=\"radio\"] {\n\twidth: clamp(14px, 3.2cqw, 18px);\n\theight: clamp(14px, 3.2cqw, 18px);\n\tcursor: pointer;\n\taccent-color: rgb(var(--edu-first-accent));\n}\n\n/* ===========================================\n VARIANT: ELEGANT\n Refined with subtle box shadows\n =========================================== */\n\n:host([variant=\"elegant\"]) {\n\t& table {\n\t\tborder-collapse: separate;\n\t\tborder-spacing: 6;\n\t}\n\n\t& th {\n\t\ttext-transform: uppercase;\n\t\tletter-spacing: 1px;\n\t\tfont-size: 0.75rem;\n\t\tfont-weight: 600;\n\t\tbackground: rgb(var(--edu-card));\n\t\tborder: none;\n\t\tborder-bottom: 2px solid rgb(var(--edu-border));\n\t\tpadding: 1rem 0.75rem;\n\t}\n\n\t& td {\n\t\tborder: none;\n\t\tborder-bottom: 1px solid rgb(var(--edu-border) / 0.3);\n\t\tbox-shadow: inset 0 0 0 1px rgb(var(--edu-border) / 0.1);\n\t\ttransition: background 0.2s ease;\n\t}\n\n\t& td:hover {\n\t\tbackground: rgb(var(--edu-muted) / 0.3);\n\t}\n\n\t& th[scope=\"row\"] {\n\t\tfont-weight: 500;\n\t\ttext-transform: none;\n\t\tletter-spacing: 0;\n\t\tfont-size: 0.95rem;\n\t}\n\n\t& input[type=\"text\"],\n\t& input[type=\"number\"],\n\t& select {\n\t\tborder: none;\n\t\tborder-bottom: 1px solid rgb(var(--edu-border));\n\t\tborder-radius: 0;\n\t\tbackground: transparent;\n\t}\n\n\t& .disabled-cell {\n\t\tbackground: rgb(var(--edu-muted) / 0.4);\n\t}\n}\n\n/* ===========================================\n VARIANT: PLAYFUL\n Bright, rounded, with color accents\n =========================================== */\n\n:host([variant=\"playful\"]) {\n\t& table {\n\t\tborder-collapse: separate;\n\t\tborder-spacing: 6px;\n\t}\n\n\t& th,\n\t& td {\n\t\tborder-radius: 8px;\n\t\tborder: 2px solid rgb(var(--edu-border));\n\t\tbackground: rgb(var(--edu-bg));\n\t\ttransition: transform 0.2s ease, box-shadow 0.2s ease;\n\t}\n\n\t& th {\n\t\tbackground: linear-gradient(135deg, rgb(var(--edu-first-accent) / 0.15), rgb(var(--edu-first-accent) / 0.05));\n\t\tcolor: rgb(var(--edu-ink));\n\t\tfont-weight: 700;\n\t}\n\n\t& td:hover:not(.disabled-cell) {\n\t\ttransform: translateY(-2px);\n\t\tbox-shadow: 0 4px 8px rgb(var(--edu-shadow-color) / 0.2);\n\t}\n\n\t& input[type=\"text\"],\n\t& input[type=\"number\"],\n\t& select {\n\t\tborder: 2px solid rgb(var(--edu-border));\n\t\tborder-radius: 12px;\n\t\tbackground: rgb(var(--edu-bg));\n\t}\n\n\t& input[type=\"checkbox\"],\n\t& input[type=\"radio\"] {\n\t\ttransform: scale(1.2);\n\t}\n\n\t& .disabled-cell {\n\t\tbackground: rgb(var(--edu-muted));\n\t\topacity: 0.6;\n\t}\n}\n\n/* ===========================================\n VARIANT: OUTLINE\n Bold borders, clean lines\n =========================================== */\n\n:host([variant=\"outline\"]) {\n\t& table {\n\t\tbackground: transparent;\n\t\tborder: 3px solid rgb(var(--edu-border));\n\t}\n\n\t& th,\n\t& td {\n\t\tborder: 2px solid rgb(var(--edu-border));\n\t\tfont-weight: 500;\n\t}\n\n\t& th {\n\t\tbackground: rgb(var(--edu-first-accent) / 0.2); \n\t\tfont-weight: 700;\n\t\ttext-transform: uppercase;\n\t\tletter-spacing: 0.5px;\n\t\tfont-size: 0.85rem;\n\t}\n\n\t& input[type=\"text\"],\n\t& input[type=\"number\"],\n\t& select {\n\t\tborder: 3px solid rgb(var(--edu-border));\n\t\tborder-radius: 0;\n\t\tbox-shadow: 2px 2px 0px rgb(var(--edu-border) / 0.3);\n\t\tbackground: rgb(var(--edu-bg));\n\t}\n\n\t& input[type=\"text\"]:focus,\n\t& input[type=\"number\"]:focus,\n\t& select:focus {\n\t\tbox-shadow: 3px 3px 0px rgb(var(--edu-first-accent));\n\t}\n\n\t& .disabled-cell {\n\t\tbackground: repeating-linear-gradient(\n\t\t\t45deg,\n\t\t\trgb(var(--edu-muted)),\n\t\t\trgb(var(--edu-muted)) 10px,\n\t\t\trgb(var(--edu-border) / 0.3) 10px,\n\t\t\trgb(var(--edu-border) / 0.3) 20px\n\t\t);\n\t}\n}\n\n/* ===========================================\n VARIANT: LETTER\n Typography-focused with serif fonts\n =========================================== */\n\n:host([variant=\"letter\"]) {\n\t& table {\n\t\tbackground: transparent;\n\t}\n\n\t& th,\n\t& td {\n\t\tborder: none;\n\t\tborder-bottom: 1px solid rgb(var(--edu-border));\n\t\tfont-family: Georgia, serif;\n\t\tletter-spacing: 0.3px;\n\t}\n\n\t& th {\n\t\tcolor: rgb(var(--edu-ink));\n\t\tfont-weight: 500;\n\t\tfont-size: 1rem;\n\t\tfont-style: italic;\n\t\tpadding-bottom: 0.5rem;\n\t}\n\n\t& th[scope=\"row\"] {\n\t\tfont-weight: 600;\n\t\tfont-style: normal;\n\t}\n\n\t& td {\n\t\tfont-size: 0.95rem;\n\t}\n\n\t& input[type=\"text\"],\n\t& input[type=\"number\"],\n\t& select {\n\t\tborder: none;\n\t\tborder-bottom: 1px dashed rgb(var(--edu-border));\n\t\tborder-radius: 0;\n\t\tbackground: transparent;\n\t\tfont-family: Georgia, serif;\n\t\tcolor: rgb(var(--edu-ink) / 0.9);\n\t}\n\n\t& .disabled-cell {\n\t\tbackground: transparent;\n\t\tcolor: rgb(var(--edu-ink) / 0.3);\n\t\tfont-style: italic;\n\t}\n}\n\n/* ===========================================\n VARIANT: SIGN\n Bold, industrial, high-contrast\n =========================================== */\n\n:host([variant=\"sign\"]) {\n\t& table {\n\t\tborder: 3px solid rgb(var(--edu-ink));\n\t}\n\n\t& th {\n\t\tbackground: rgb(var(--edu-ink));\n\t\tcolor: rgb(var(--edu-inverted-ink));\n\t\ttext-transform: uppercase;\n\t\tfont-style: italic;\n\t\tfont-weight: 700;\n\t\tletter-spacing: 1.5px;\n\t\tborder: 2px solid rgb(var(--edu-ink));\n\t\tpadding: 1rem;\n\t}\n\n\t& td {\n\t\tborder: 2px solid rgb(var(--edu-ink));\n\t\tfont-weight: 600;\n\t}\n\n\t& th[scope=\"row\"] {\n\t\tbackground: rgb(var(--edu-card));\n\t\tcolor: rgb(var(--edu-ink));\n\t\tfont-style: normal;\n\t}\n\n\t& input[type=\"text\"],\n\t& input[type=\"number\"],\n\t& select {\n\t\tborder: 2px solid rgb(var(--edu-ink));\n\t\tborder-radius: 0;\n\t\tbackground: rgb(var(--edu-bg));\n\t\tfont-weight: 600;\n\t}\n\n\t& .disabled-cell {\n\t\tbackground: repeating-linear-gradient(\n\t\t\t135deg,\n\t\t\trgb(var(--edu-card)),\n\t\t\trgb(var(--edu-card)) 8px,\n\t\t\trgb(var(--edu-ink) / 0.2) 8px,\n\t\t\trgb(var(--edu-ink) / 0.2) 16px\n\t\t);\n\t}\n}\n\n/* ===========================================\n VARIANT: MINIMAL\n Clean, spacious, understated\n =========================================== */\n\n:host([variant=\"minimal\"]) {\n\t& table {\n\t\tborder: none;\n\t}\n\n\t& th {\n\t\tborder: none;\n\t\tborder-bottom: 1px solid rgb(var(--edu-border));\n\t\tbackground: transparent;\n\t\tcolor: rgb(var(--edu-ink));\n\t\tfont-weight: 500;\n\t\tfont-size: 0.9rem;\n\t\tpadding: 0.5rem 0.75rem;\n\t}\n\n\t& td {\n\t\tborder: none;\n\t\tborder-bottom: 1px solid rgb(var(--edu-border) / 0.5);\n\t\tbackground: transparent;\n\t}\n\n\t& tr:last-child td {\n\t\tborder-bottom: none;\n\t}\n\n\t& input[type=\"text\"],\n\t& input[type=\"number\"],\n\t& select {\n\t\tborder: none;\n\t\tborder-bottom: 1px solid rgb(var(--edu-border) / 0.5);\n\t\tborder-radius: 0;\n\t\tbackground: transparent;\n\t\tpadding: 0.25rem;\n\t}\n\n\t& input[type=\"text\"]:focus,\n\t& input[type=\"number\"]:focus,\n\t& select:focus {\n\t\tborder-bottom-color: rgb(var(--edu-first-accent));\n\t\tbox-shadow: none;\n\t}\n\n\t& .disabled-cell {\n\t\tbackground: transparent;\n\t\tcolor: rgb(var(--edu-ink) / 0.3);\n\t}\n}\n\n/* ===========================================\n VARIANT: GLASS\n Frosted glass effect with depth\n =========================================== */\n\n:host([variant=\"glass\"]) {\n\t& table {\n\t\tbackground: rgb(var(--edu-bg) / 0.7);\n\t\tbackdrop-filter: blur(10px);\n\t\tborder: 1px solid rgb(var(--edu-border) / 0.3);\n\t\tborder-radius: 12px;\n\t\toverflow: hidden;\n\t}\n\n\t& th,\n\t& td {\n\t\tborder: 1px solid rgb(var(--edu-border) / 0.2);\n\t\tbackground: rgb(var(--edu-bg) / 0.4);\n\t}\n\n\t& th {\n\t\tcolor: rgb(var(--edu-ink));\n\t\tfont-weight: 600;\n\t\tbackground: rgb(var(--edu-card) / 0.6);\n\t\tbackdrop-filter: blur(5px);\n\t\tborder-bottom: 2px solid rgb(var(--edu-border) / 0.4);\n\t}\n\n\t& input[type=\"text\"],\n\t& input[type=\"number\"],\n\t& select {\n\t\tbackground: rgb(var(--edu-bg) / 0.5);\n\t\tborder: 1px solid rgb(var(--edu-border) / 0.3);\n\t\tborder-radius: 6px;\n\t\tbackdrop-filter: blur(5px);\n\t}\n\n\t& input[type=\"text\"]:focus,\n\t& input[type=\"number\"]:focus,\n\t& select:focus {\n\t\tbackground: rgb(var(--edu-bg) / 0.8);\n\t\tborder-color: rgb(var(--edu-first-accent) / 0.6);\n\t}\n\n\t& .disabled-cell {\n\t\tbackground: rgb(var(--edu-muted) / 0.3);\n\t\tbackdrop-filter: blur(3px);\n\t}\n}\n\n/* ===========================================\n VARIANT: EMPTY\n Bare minimum, dashed borders\n =========================================== */\n\n:host([variant=\"empty\"]) {\n\t& table {\n\t\tborder: none;\n\t\tbackground: none;\n\t}\n\n\t& th,\n\t& td {\n\t\tborder: 1px dashed rgb(var(--edu-border));\n\t\tbackground: transparent;\n\t}\n\n\t& th {\n\t\tbackground: transparent;\n\t\tcolor: rgb(var(--edu-ink));\n\t\tfont-weight: 600;\n\t}\n\n\t& input[type=\"text\"],\n\t& input[type=\"number\"],\n\t& select {\n\t\tborder: none;\n\t\tborder-bottom: 1px dashed rgb(var(--edu-border));\n\t\tborder-radius: 0;\n\t\tbackground: transparent;\n\t}\n\n\t& .disabled-cell {\n\t\tbackground: transparent;\n\t\topacity: 0.4;\n\t}\n}\n\n/* ===========================================\n RESPONSIVE BEHAVIOR\n =========================================== */\n\n@container (max-width: 720px) {\n\ttd, th {\n\t\tpadding: clamp(0.35rem, 1.2cqw, 0.5rem);\n\t\tfont-size: clamp(0.75rem, 1.6cqw, 0.85rem);\n\t\tmin-width: clamp(52px, 11cqw, 70px);\n\t}\n\n\tinput[type=\"text\"],\n\tinput[type=\"number\"],\n\tselect {\n\t\tfont-size: clamp(0.75rem, 1.4cqw, 0.85rem);\n\t\tpadding: clamp(0.3rem, 1cqw, 0.4rem);\n\t}\n\n\tinput[type=\"checkbox\"],\n\tinput[type=\"radio\"] {\n\t\twidth: clamp(12px, 2.8cqw, 16px);\n\t\theight: clamp(12px, 2.8cqw, 16px);\n\t}\n}\n\n@container (max-width: 480px) {\n\ttd, th {\n\t\tpadding: clamp(0.3rem, 1cqw, 0.4rem);\n\t\tfont-size: clamp(0.7rem, 1.4cqw, 0.8rem);\n\t\tmax-width: clamp(90px, 30cqw, 120px);\n\t\tmin-width: clamp(48px, 10cqw, 60px);\n\t}\n}\n", "\n/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */\nfunction isNothing(subject) {\n return (typeof subject === 'undefined') || (subject === null);\n}\n\n\nfunction isObject(subject) {\n return (typeof subject === 'object') && (subject !== null);\n}\n\n\nfunction toArray(sequence) {\n if (Array.isArray(sequence)) return sequence;\n else if (isNothing(sequence)) return [];\n\n return [ sequence ];\n}\n\n\nfunction extend(target, source) {\n var index, length, key, sourceKeys;\n\n if (source) {\n sourceKeys = Object.keys(source);\n\n for (index = 0, length = sourceKeys.length; index < length; index += 1) {\n key = sourceKeys[index];\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\n\nfunction repeat(string, count) {\n var result = '', cycle;\n\n for (cycle = 0; cycle < count; cycle += 1) {\n result += string;\n }\n\n return result;\n}\n\n\nfunction isNegativeZero(number) {\n return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number);\n}\n\n\nvar isNothing_1 = isNothing;\nvar isObject_1 = isObject;\nvar toArray_1 = toArray;\nvar repeat_1 = repeat;\nvar isNegativeZero_1 = isNegativeZero;\nvar extend_1 = extend;\n\nvar common = {\n\tisNothing: isNothing_1,\n\tisObject: isObject_1,\n\ttoArray: toArray_1,\n\trepeat: repeat_1,\n\tisNegativeZero: isNegativeZero_1,\n\textend: extend_1\n};\n\n// YAML error class. http://stackoverflow.com/questions/8458984\n\n\nfunction formatError(exception, compact) {\n var where = '', message = exception.reason || '(unknown reason)';\n\n if (!exception.mark) return message;\n\n if (exception.mark.name) {\n where += 'in \"' + exception.mark.name + '\" ';\n }\n\n where += '(' + (exception.mark.line + 1) + ':' + (exception.mark.column + 1) + ')';\n\n if (!compact && exception.mark.snippet) {\n where += '\\n\\n' + exception.mark.snippet;\n }\n\n return message + ' ' + where;\n}\n\n\nfunction YAMLException$1(reason, mark) {\n // Super constructor\n Error.call(this);\n\n this.name = 'YAMLException';\n this.reason = reason;\n this.mark = mark;\n this.message = formatError(this, false);\n\n // Include stack trace in error object\n if (Error.captureStackTrace) {\n // Chrome and NodeJS\n Error.captureStackTrace(this, this.constructor);\n } else {\n // FF, IE 10+ and Safari 6+. Fallback for others\n this.stack = (new Error()).stack || '';\n }\n}\n\n\n// Inherit from Error\nYAMLException$1.prototype = Object.create(Error.prototype);\nYAMLException$1.prototype.constructor = YAMLException$1;\n\n\nYAMLException$1.prototype.toString = function toString(compact) {\n return this.name + ': ' + formatError(this, compact);\n};\n\n\nvar exception = YAMLException$1;\n\n// get snippet for a single line, respecting maxLength\nfunction getLine(buffer, lineStart, lineEnd, position, maxLineLength) {\n var head = '';\n var tail = '';\n var maxHalfLength = Math.floor(maxLineLength / 2) - 1;\n\n if (position - lineStart > maxHalfLength) {\n head = ' ... ';\n lineStart = position - maxHalfLength + head.length;\n }\n\n if (lineEnd - position > maxHalfLength) {\n tail = ' ...';\n lineEnd = position + maxHalfLength - tail.length;\n }\n\n return {\n str: head + buffer.slice(lineStart, lineEnd).replace(/\\t/g, '\u2192') + tail,\n pos: position - lineStart + head.length // relative position\n };\n}\n\n\nfunction padStart(string, max) {\n return common.repeat(' ', max - string.length) + string;\n}\n\n\nfunction makeSnippet(mark, options) {\n options = Object.create(options || null);\n\n if (!mark.buffer) return null;\n\n if (!options.maxLength) options.maxLength = 79;\n if (typeof options.indent !== 'number') options.indent = 1;\n if (typeof options.linesBefore !== 'number') options.linesBefore = 3;\n if (typeof options.linesAfter !== 'number') options.linesAfter = 2;\n\n var re = /\\r?\\n|\\r|\\0/g;\n var lineStarts = [ 0 ];\n var lineEnds = [];\n var match;\n var foundLineNo = -1;\n\n while ((match = re.exec(mark.buffer))) {\n lineEnds.push(match.index);\n lineStarts.push(match.index + match[0].length);\n\n if (mark.position <= match.index && foundLineNo < 0) {\n foundLineNo = lineStarts.length - 2;\n }\n }\n\n if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;\n\n var result = '', i, line;\n var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;\n var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);\n\n for (i = 1; i <= options.linesBefore; i++) {\n if (foundLineNo - i < 0) break;\n line = getLine(\n mark.buffer,\n lineStarts[foundLineNo - i],\n lineEnds[foundLineNo - i],\n mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),\n maxLineLength\n );\n result = common.repeat(' ', options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) +\n ' | ' + line.str + '\\n' + result;\n }\n\n line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);\n result += common.repeat(' ', options.indent) + padStart((mark.line + 1).toString(), lineNoLength) +\n ' | ' + line.str + '\\n';\n result += common.repeat('-', options.indent + lineNoLength + 3 + line.pos) + '^' + '\\n';\n\n for (i = 1; i <= options.linesAfter; i++) {\n if (foundLineNo + i >= lineEnds.length) break;\n line = getLine(\n mark.buffer,\n lineStarts[foundLineNo + i],\n lineEnds[foundLineNo + i],\n mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),\n maxLineLength\n );\n result += common.repeat(' ', options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) +\n ' | ' + line.str + '\\n';\n }\n\n return result.replace(/\\n$/, '');\n}\n\n\nvar snippet = makeSnippet;\n\nvar TYPE_CONSTRUCTOR_OPTIONS = [\n 'kind',\n 'multi',\n 'resolve',\n 'construct',\n 'instanceOf',\n 'predicate',\n 'represent',\n 'representName',\n 'defaultStyle',\n 'styleAliases'\n];\n\nvar YAML_NODE_KINDS = [\n 'scalar',\n 'sequence',\n 'mapping'\n];\n\nfunction compileStyleAliases(map) {\n var result = {};\n\n if (map !== null) {\n Object.keys(map).forEach(function (style) {\n map[style].forEach(function (alias) {\n result[String(alias)] = style;\n });\n });\n }\n\n return result;\n}\n\nfunction Type$1(tag, options) {\n options = options || {};\n\n Object.keys(options).forEach(function (name) {\n if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {\n throw new exception('Unknown option \"' + name + '\" is met in definition of \"' + tag + '\" YAML type.');\n }\n });\n\n // TODO: Add tag format check.\n this.options = options; // keep original options in case user wants to extend this type later\n this.tag = tag;\n this.kind = options['kind'] || null;\n this.resolve = options['resolve'] || function () { return true; };\n this.construct = options['construct'] || function (data) { return data; };\n this.instanceOf = options['instanceOf'] || null;\n this.predicate = options['predicate'] || null;\n this.represent = options['represent'] || null;\n this.representName = options['representName'] || null;\n this.defaultStyle = options['defaultStyle'] || null;\n this.multi = options['multi'] || false;\n this.styleAliases = compileStyleAliases(options['styleAliases'] || null);\n\n if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {\n throw new exception('Unknown kind \"' + this.kind + '\" is specified for \"' + tag + '\" YAML type.');\n }\n}\n\nvar type = Type$1;\n\n/*eslint-disable max-len*/\n\n\n\n\n\nfunction compileList(schema, name) {\n var result = [];\n\n schema[name].forEach(function (currentType) {\n var newIndex = result.length;\n\n result.forEach(function (previousType, previousIndex) {\n if (previousType.tag === currentType.tag &&\n previousType.kind === currentType.kind &&\n previousType.multi === currentType.multi) {\n\n newIndex = previousIndex;\n }\n });\n\n result[newIndex] = currentType;\n });\n\n return result;\n}\n\n\nfunction compileMap(/* lists... */) {\n var result = {\n scalar: {},\n sequence: {},\n mapping: {},\n fallback: {},\n multi: {\n scalar: [],\n sequence: [],\n mapping: [],\n fallback: []\n }\n }, index, length;\n\n function collectType(type) {\n if (type.multi) {\n result.multi[type.kind].push(type);\n result.multi['fallback'].push(type);\n } else {\n result[type.kind][type.tag] = result['fallback'][type.tag] = type;\n }\n }\n\n for (index = 0, length = arguments.length; index < length; index += 1) {\n arguments[index].forEach(collectType);\n }\n return result;\n}\n\n\nfunction Schema$1(definition) {\n return this.extend(definition);\n}\n\n\nSchema$1.prototype.extend = function extend(definition) {\n var implicit = [];\n var explicit = [];\n\n if (definition instanceof type) {\n // Schema.extend(type)\n explicit.push(definition);\n\n } else if (Array.isArray(definition)) {\n // Schema.extend([ type1, type2, ... ])\n explicit = explicit.concat(definition);\n\n } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {\n // Schema.extend({ explicit: [ type1, type2, ... ], implicit: [ type1, type2, ... ] })\n if (definition.implicit) implicit = implicit.concat(definition.implicit);\n if (definition.explicit) explicit = explicit.concat(definition.explicit);\n\n } else {\n throw new exception('Schema.extend argument should be a Type, [ Type ], ' +\n 'or a schema definition ({ implicit: [...], explicit: [...] })');\n }\n\n implicit.forEach(function (type$1) {\n if (!(type$1 instanceof type)) {\n throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.');\n }\n\n if (type$1.loadKind && type$1.loadKind !== 'scalar') {\n throw new exception('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');\n }\n\n if (type$1.multi) {\n throw new exception('There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.');\n }\n });\n\n explicit.forEach(function (type$1) {\n if (!(type$1 instanceof type)) {\n throw new exception('Specified list of YAML types (or a single Type object) contains a non-Type object.');\n }\n });\n\n var result = Object.create(Schema$1.prototype);\n\n result.implicit = (this.implicit || []).concat(implicit);\n result.explicit = (this.explicit || []).concat(explicit);\n\n result.compiledImplicit = compileList(result, 'implicit');\n result.compiledExplicit = compileList(result, 'explicit');\n result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);\n\n return result;\n};\n\n\nvar schema = Schema$1;\n\nvar str = new type('tag:yaml.org,2002:str', {\n kind: 'scalar',\n construct: function (data) { return data !== null ? data : ''; }\n});\n\nvar seq = new type('tag:yaml.org,2002:seq', {\n kind: 'sequence',\n construct: function (data) { return data !== null ? data : []; }\n});\n\nvar map = new type('tag:yaml.org,2002:map', {\n kind: 'mapping',\n construct: function (data) { return data !== null ? data : {}; }\n});\n\nvar failsafe = new schema({\n explicit: [\n str,\n seq,\n map\n ]\n});\n\nfunction resolveYamlNull(data) {\n if (data === null) return true;\n\n var max = data.length;\n\n return (max === 1 && data === '~') ||\n (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'));\n}\n\nfunction constructYamlNull() {\n return null;\n}\n\nfunction isNull(object) {\n return object === null;\n}\n\nvar _null = new type('tag:yaml.org,2002:null', {\n kind: 'scalar',\n resolve: resolveYamlNull,\n construct: constructYamlNull,\n predicate: isNull,\n represent: {\n canonical: function () { return '~'; },\n lowercase: function () { return 'null'; },\n uppercase: function () { return 'NULL'; },\n camelcase: function () { return 'Null'; },\n empty: function () { return ''; }\n },\n defaultStyle: 'lowercase'\n});\n\nfunction resolveYamlBoolean(data) {\n if (data === null) return false;\n\n var max = data.length;\n\n return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||\n (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'));\n}\n\nfunction constructYamlBoolean(data) {\n return data === 'true' ||\n data === 'True' ||\n data === 'TRUE';\n}\n\nfunction isBoolean(object) {\n return Object.prototype.toString.call(object) === '[object Boolean]';\n}\n\nvar bool = new type('tag:yaml.org,2002:bool', {\n kind: 'scalar',\n resolve: resolveYamlBoolean,\n construct: constructYamlBoolean,\n predicate: isBoolean,\n represent: {\n lowercase: function (object) { return object ? 'true' : 'false'; },\n uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; },\n camelcase: function (object) { return object ? 'True' : 'False'; }\n },\n defaultStyle: 'lowercase'\n});\n\nfunction isHexCode(c) {\n return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) ||\n ((0x41/* A */ <= c) && (c <= 0x46/* F */)) ||\n ((0x61/* a */ <= c) && (c <= 0x66/* f */));\n}\n\nfunction isOctCode(c) {\n return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */));\n}\n\nfunction isDecCode(c) {\n return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */));\n}\n\nfunction resolveYamlInteger(data) {\n if (data === null) return false;\n\n var max = data.length,\n index = 0,\n hasDigits = false,\n ch;\n\n if (!max) return false;\n\n ch = data[index];\n\n // sign\n if (ch === '-' || ch === '+') {\n ch = data[++index];\n }\n\n if (ch === '0') {\n // 0\n if (index + 1 === max) return true;\n ch = data[++index];\n\n // base 2, base 8, base 16\n\n if (ch === 'b') {\n // base 2\n index++;\n\n for (; index < max; index++) {\n ch = data[index];\n if (ch === '_') continue;\n if (ch !== '0' && ch !== '1') return false;\n hasDigits = true;\n }\n return hasDigits && ch !== '_';\n }\n\n\n if (ch === 'x') {\n // base 16\n index++;\n\n for (; index < max; index++) {\n ch = data[index];\n if (ch === '_') continue;\n if (!isHexCode(data.charCodeAt(index))) return false;\n hasDigits = true;\n }\n return hasDigits && ch !== '_';\n }\n\n\n if (ch === 'o') {\n // base 8\n index++;\n\n for (; index < max; index++) {\n ch = data[index];\n if (ch === '_') continue;\n if (!isOctCode(data.charCodeAt(index))) return false;\n hasDigits = true;\n }\n return hasDigits && ch !== '_';\n }\n }\n\n // base 10 (except 0)\n\n // value should not start with `_`;\n if (ch === '_') return false;\n\n for (; index < max; index++) {\n ch = data[index];\n if (ch === '_') continue;\n if (!isDecCode(data.charCodeAt(index))) {\n return false;\n }\n hasDigits = true;\n }\n\n // Should have digits and should not end with `_`\n if (!hasDigits || ch === '_') return false;\n\n return true;\n}\n\nfunction constructYamlInteger(data) {\n var value = data, sign = 1, ch;\n\n if (value.indexOf('_') !== -1) {\n value = value.replace(/_/g, '');\n }\n\n ch = value[0];\n\n if (ch === '-' || ch === '+') {\n if (ch === '-') sign = -1;\n value = value.slice(1);\n ch = value[0];\n }\n\n if (value === '0') return 0;\n\n if (ch === '0') {\n if (value[1] === 'b') return sign * parseInt(value.slice(2), 2);\n if (value[1] === 'x') return sign * parseInt(value.slice(2), 16);\n if (value[1] === 'o') return sign * parseInt(value.slice(2), 8);\n }\n\n return sign * parseInt(value, 10);\n}\n\nfunction isInteger(object) {\n return (Object.prototype.toString.call(object)) === '[object Number]' &&\n (object % 1 === 0 && !common.isNegativeZero(object));\n}\n\nvar int = new type('tag:yaml.org,2002:int', {\n kind: 'scalar',\n resolve: resolveYamlInteger,\n construct: constructYamlInteger,\n predicate: isInteger,\n represent: {\n binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); },\n octal: function (obj) { return obj >= 0 ? '0o' + obj.toString(8) : '-0o' + obj.toString(8).slice(1); },\n decimal: function (obj) { return obj.toString(10); },\n /* eslint-disable max-len */\n hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); }\n },\n defaultStyle: 'decimal',\n styleAliases: {\n binary: [ 2, 'bin' ],\n octal: [ 8, 'oct' ],\n decimal: [ 10, 'dec' ],\n hexadecimal: [ 16, 'hex' ]\n }\n});\n\nvar YAML_FLOAT_PATTERN = new RegExp(\n // 2.5e4, 2.5 and integers\n '^(?:[-+]?(?:[0-9][0-9_]*)(?:\\\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' +\n // .2e4, .2\n // special case, seems not from spec\n '|\\\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' +\n // .inf\n '|[-+]?\\\\.(?:inf|Inf|INF)' +\n // .nan\n '|\\\\.(?:nan|NaN|NAN))$');\n\nfunction resolveYamlFloat(data) {\n if (data === null) return false;\n\n if (!YAML_FLOAT_PATTERN.test(data) ||\n // Quick hack to not allow integers end with `_`\n // Probably should update regexp & check speed\n data[data.length - 1] === '_') {\n return false;\n }\n\n return true;\n}\n\nfunction constructYamlFloat(data) {\n var value, sign;\n\n value = data.replace(/_/g, '').toLowerCase();\n sign = value[0] === '-' ? -1 : 1;\n\n if ('+-'.indexOf(value[0]) >= 0) {\n value = value.slice(1);\n }\n\n if (value === '.inf') {\n return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;\n\n } else if (value === '.nan') {\n return NaN;\n }\n return sign * parseFloat(value, 10);\n}\n\n\nvar SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;\n\nfunction representYamlFloat(object, style) {\n var res;\n\n if (isNaN(object)) {\n switch (style) {\n case 'lowercase': return '.nan';\n case 'uppercase': return '.NAN';\n case 'camelcase': return '.NaN';\n }\n } else if (Number.POSITIVE_INFINITY === object) {\n switch (style) {\n case 'lowercase': return '.inf';\n case 'uppercase': return '.INF';\n case 'camelcase': return '.Inf';\n }\n } else if (Number.NEGATIVE_INFINITY === object) {\n switch (style) {\n case 'lowercase': return '-.inf';\n case 'uppercase': return '-.INF';\n case 'camelcase': return '-.Inf';\n }\n } else if (common.isNegativeZero(object)) {\n return '-0.0';\n }\n\n res = object.toString(10);\n\n // JS stringifier can build scientific format without dots: 5e-100,\n // while YAML requres dot: 5.e-100. Fix it with simple hack\n\n return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res;\n}\n\nfunction isFloat(object) {\n return (Object.prototype.toString.call(object) === '[object Number]') &&\n (object % 1 !== 0 || common.isNegativeZero(object));\n}\n\nvar float = new type('tag:yaml.org,2002:float', {\n kind: 'scalar',\n resolve: resolveYamlFloat,\n construct: constructYamlFloat,\n predicate: isFloat,\n represent: representYamlFloat,\n defaultStyle: 'lowercase'\n});\n\nvar json = failsafe.extend({\n implicit: [\n _null,\n bool,\n int,\n float\n ]\n});\n\nvar core = json;\n\nvar YAML_DATE_REGEXP = new RegExp(\n '^([0-9][0-9][0-9][0-9])' + // [1] year\n '-([0-9][0-9])' + // [2] month\n '-([0-9][0-9])$'); // [3] day\n\nvar YAML_TIMESTAMP_REGEXP = new RegExp(\n '^([0-9][0-9][0-9][0-9])' + // [1] year\n '-([0-9][0-9]?)' + // [2] month\n '-([0-9][0-9]?)' + // [3] day\n '(?:[Tt]|[ \\\\t]+)' + // ...\n '([0-9][0-9]?)' + // [4] hour\n ':([0-9][0-9])' + // [5] minute\n ':([0-9][0-9])' + // [6] second\n '(?:\\\\.([0-9]*))?' + // [7] fraction\n '(?:[ \\\\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour\n '(?::([0-9][0-9]))?))?$'); // [11] tz_minute\n\nfunction resolveYamlTimestamp(data) {\n if (data === null) return false;\n if (YAML_DATE_REGEXP.exec(data) !== null) return true;\n if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;\n return false;\n}\n\nfunction constructYamlTimestamp(data) {\n var match, year, month, day, hour, minute, second, fraction = 0,\n delta = null, tz_hour, tz_minute, date;\n\n match = YAML_DATE_REGEXP.exec(data);\n if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);\n\n if (match === null) throw new Error('Date resolve error');\n\n // match: [1] year [2] month [3] day\n\n year = +(match[1]);\n month = +(match[2]) - 1; // JS month starts with 0\n day = +(match[3]);\n\n if (!match[4]) { // no hour\n return new Date(Date.UTC(year, month, day));\n }\n\n // match: [4] hour [5] minute [6] second [7] fraction\n\n hour = +(match[4]);\n minute = +(match[5]);\n second = +(match[6]);\n\n if (match[7]) {\n fraction = match[7].slice(0, 3);\n while (fraction.length < 3) { // milli-seconds\n fraction += '0';\n }\n fraction = +fraction;\n }\n\n // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute\n\n if (match[9]) {\n tz_hour = +(match[10]);\n tz_minute = +(match[11] || 0);\n delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds\n if (match[9] === '-') delta = -delta;\n }\n\n date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));\n\n if (delta) date.setTime(date.getTime() - delta);\n\n return date;\n}\n\nfunction representYamlTimestamp(object /*, style*/) {\n return object.toISOString();\n}\n\nvar timestamp = new type('tag:yaml.org,2002:timestamp', {\n kind: 'scalar',\n resolve: resolveYamlTimestamp,\n construct: constructYamlTimestamp,\n instanceOf: Date,\n represent: representYamlTimestamp\n});\n\nfunction resolveYamlMerge(data) {\n return data === '<<' || data === null;\n}\n\nvar merge = new type('tag:yaml.org,2002:merge', {\n kind: 'scalar',\n resolve: resolveYamlMerge\n});\n\n/*eslint-disable no-bitwise*/\n\n\n\n\n\n// [ 64, 65, 66 ] -> [ padding, CR, LF ]\nvar BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\\n\\r';\n\n\nfunction resolveYamlBinary(data) {\n if (data === null) return false;\n\n var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;\n\n // Convert one by one.\n for (idx = 0; idx < max; idx++) {\n code = map.indexOf(data.charAt(idx));\n\n // Skip CR/LF\n if (code > 64) continue;\n\n // Fail on illegal characters\n if (code < 0) return false;\n\n bitlen += 6;\n }\n\n // If there are any bits left, source was corrupted\n return (bitlen % 8) === 0;\n}\n\nfunction constructYamlBinary(data) {\n var idx, tailbits,\n input = data.replace(/[\\r\\n=]/g, ''), // remove CR/LF & padding to simplify scan\n max = input.length,\n map = BASE64_MAP,\n bits = 0,\n result = [];\n\n // Collect by 6*4 bits (3 bytes)\n\n for (idx = 0; idx < max; idx++) {\n if ((idx % 4 === 0) && idx) {\n result.push((bits >> 16) & 0xFF);\n result.push((bits >> 8) & 0xFF);\n result.push(bits & 0xFF);\n }\n\n bits = (bits << 6) | map.indexOf(input.charAt(idx));\n }\n\n // Dump tail\n\n tailbits = (max % 4) * 6;\n\n if (tailbits === 0) {\n result.push((bits >> 16) & 0xFF);\n result.push((bits >> 8) & 0xFF);\n result.push(bits & 0xFF);\n } else if (tailbits === 18) {\n result.push((bits >> 10) & 0xFF);\n result.push((bits >> 2) & 0xFF);\n } else if (tailbits === 12) {\n result.push((bits >> 4) & 0xFF);\n }\n\n return new Uint8Array(result);\n}\n\nfunction representYamlBinary(object /*, style*/) {\n var result = '', bits = 0, idx, tail,\n max = object.length,\n map = BASE64_MAP;\n\n // Convert every three bytes to 4 ASCII characters.\n\n for (idx = 0; idx < max; idx++) {\n if ((idx % 3 === 0) && idx) {\n result += map[(bits >> 18) & 0x3F];\n result += map[(bits >> 12) & 0x3F];\n result += map[(bits >> 6) & 0x3F];\n result += map[bits & 0x3F];\n }\n\n bits = (bits << 8) + object[idx];\n }\n\n // Dump tail\n\n tail = max % 3;\n\n if (tail === 0) {\n result += map[(bits >> 18) & 0x3F];\n result += map[(bits >> 12) & 0x3F];\n result += map[(bits >> 6) & 0x3F];\n result += map[bits & 0x3F];\n } else if (tail === 2) {\n result += map[(bits >> 10) & 0x3F];\n result += map[(bits >> 4) & 0x3F];\n result += map[(bits << 2) & 0x3F];\n result += map[64];\n } else if (tail === 1) {\n result += map[(bits >> 2) & 0x3F];\n result += map[(bits << 4) & 0x3F];\n result += map[64];\n result += map[64];\n }\n\n return result;\n}\n\nfunction isBinary(obj) {\n return Object.prototype.toString.call(obj) === '[object Uint8Array]';\n}\n\nvar binary = new type('tag:yaml.org,2002:binary', {\n kind: 'scalar',\n resolve: resolveYamlBinary,\n construct: constructYamlBinary,\n predicate: isBinary,\n represent: representYamlBinary\n});\n\nvar _hasOwnProperty$3 = Object.prototype.hasOwnProperty;\nvar _toString$2 = Object.prototype.toString;\n\nfunction resolveYamlOmap(data) {\n if (data === null) return true;\n\n var objectKeys = [], index, length, pair, pairKey, pairHasKey,\n object = data;\n\n for (index = 0, length = object.length; index < length; index += 1) {\n pair = object[index];\n pairHasKey = false;\n\n if (_toString$2.call(pair) !== '[object Object]') return false;\n\n for (pairKey in pair) {\n if (_hasOwnProperty$3.call(pair, pairKey)) {\n if (!pairHasKey) pairHasKey = true;\n else return false;\n }\n }\n\n if (!pairHasKey) return false;\n\n if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);\n else return false;\n }\n\n return true;\n}\n\nfunction constructYamlOmap(data) {\n return data !== null ? data : [];\n}\n\nvar omap = new type('tag:yaml.org,2002:omap', {\n kind: 'sequence',\n resolve: resolveYamlOmap,\n construct: constructYamlOmap\n});\n\nvar _toString$1 = Object.prototype.toString;\n\nfunction resolveYamlPairs(data) {\n if (data === null) return true;\n\n var index, length, pair, keys, result,\n object = data;\n\n result = new Array(object.length);\n\n for (index = 0, length = object.length; index < length; index += 1) {\n pair = object[index];\n\n if (_toString$1.call(pair) !== '[object Object]') return false;\n\n keys = Object.keys(pair);\n\n if (keys.length !== 1) return false;\n\n result[index] = [ keys[0], pair[keys[0]] ];\n }\n\n return true;\n}\n\nfunction constructYamlPairs(data) {\n if (data === null) return [];\n\n var index, length, pair, keys, result,\n object = data;\n\n result = new Array(object.length);\n\n for (index = 0, length = object.length; index < length; index += 1) {\n pair = object[index];\n\n keys = Object.keys(pair);\n\n result[index] = [ keys[0], pair[keys[0]] ];\n }\n\n return result;\n}\n\nvar pairs = new type('tag:yaml.org,2002:pairs', {\n kind: 'sequence',\n resolve: resolveYamlPairs,\n construct: constructYamlPairs\n});\n\nvar _hasOwnProperty$2 = Object.prototype.hasOwnProperty;\n\nfunction resolveYamlSet(data) {\n if (data === null) return true;\n\n var key, object = data;\n\n for (key in object) {\n if (_hasOwnProperty$2.call(object, key)) {\n if (object[key] !== null) return false;\n }\n }\n\n return true;\n}\n\nfunction constructYamlSet(data) {\n return data !== null ? data : {};\n}\n\nvar set = new type('tag:yaml.org,2002:set', {\n kind: 'mapping',\n resolve: resolveYamlSet,\n construct: constructYamlSet\n});\n\nvar _default = core.extend({\n implicit: [\n timestamp,\n merge\n ],\n explicit: [\n binary,\n omap,\n pairs,\n set\n ]\n});\n\n/*eslint-disable max-len,no-use-before-define*/\n\n\n\n\n\n\n\nvar _hasOwnProperty$1 = Object.prototype.hasOwnProperty;\n\n\nvar CONTEXT_FLOW_IN = 1;\nvar CONTEXT_FLOW_OUT = 2;\nvar CONTEXT_BLOCK_IN = 3;\nvar CONTEXT_BLOCK_OUT = 4;\n\n\nvar CHOMPING_CLIP = 1;\nvar CHOMPING_STRIP = 2;\nvar CHOMPING_KEEP = 3;\n\n\nvar PATTERN_NON_PRINTABLE = /[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F\\x7F-\\x84\\x86-\\x9F\\uFFFE\\uFFFF]|[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?:[^\\uD800-\\uDBFF]|^)[\\uDC00-\\uDFFF]/;\nvar PATTERN_NON_ASCII_LINE_BREAKS = /[\\x85\\u2028\\u2029]/;\nvar PATTERN_FLOW_INDICATORS = /[,\\[\\]\\{\\}]/;\nvar PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\\-]+!)$/i;\nvar PATTERN_TAG_URI = /^(?:!|[^,\\[\\]\\{\\}])(?:%[0-9a-f]{2}|[0-9a-z\\-#;\\/\\?:@&=\\+\\$,_\\.!~\\*'\\(\\)\\[\\]])*$/i;\n\n\nfunction _class(obj) { return Object.prototype.toString.call(obj); }\n\nfunction is_EOL(c) {\n return (c === 0x0A/* LF */) || (c === 0x0D/* CR */);\n}\n\nfunction is_WHITE_SPACE(c) {\n return (c === 0x09/* Tab */) || (c === 0x20/* Space */);\n}\n\nfunction is_WS_OR_EOL(c) {\n return (c === 0x09/* Tab */) ||\n (c === 0x20/* Space */) ||\n (c === 0x0A/* LF */) ||\n (c === 0x0D/* CR */);\n}\n\nfunction is_FLOW_INDICATOR(c) {\n return c === 0x2C/* , */ ||\n c === 0x5B/* [ */ ||\n c === 0x5D/* ] */ ||\n c === 0x7B/* { */ ||\n c === 0x7D/* } */;\n}\n\nfunction fromHexCode(c) {\n var lc;\n\n if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {\n return c - 0x30;\n }\n\n /*eslint-disable no-bitwise*/\n lc = c | 0x20;\n\n if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) {\n return lc - 0x61 + 10;\n }\n\n return -1;\n}\n\nfunction escapedHexLen(c) {\n if (c === 0x78/* x */) { return 2; }\n if (c === 0x75/* u */) { return 4; }\n if (c === 0x55/* U */) { return 8; }\n return 0;\n}\n\nfunction fromDecimalCode(c) {\n if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {\n return c - 0x30;\n }\n\n return -1;\n}\n\nfunction simpleEscapeSequence(c) {\n /* eslint-disable indent */\n return (c === 0x30/* 0 */) ? '\\x00' :\n (c === 0x61/* a */) ? '\\x07' :\n (c === 0x62/* b */) ? '\\x08' :\n (c === 0x74/* t */) ? '\\x09' :\n (c === 0x09/* Tab */) ? '\\x09' :\n (c === 0x6E/* n */) ? '\\x0A' :\n (c === 0x76/* v */) ? '\\x0B' :\n (c === 0x66/* f */) ? '\\x0C' :\n (c === 0x72/* r */) ? '\\x0D' :\n (c === 0x65/* e */) ? '\\x1B' :\n (c === 0x20/* Space */) ? ' ' :\n (c === 0x22/* \" */) ? '\\x22' :\n (c === 0x2F/* / */) ? '/' :\n (c === 0x5C/* \\ */) ? '\\x5C' :\n (c === 0x4E/* N */) ? '\\x85' :\n (c === 0x5F/* _ */) ? '\\xA0' :\n (c === 0x4C/* L */) ? '\\u2028' :\n (c === 0x50/* P */) ? '\\u2029' : '';\n}\n\nfunction charFromCodepoint(c) {\n if (c <= 0xFFFF) {\n return String.fromCharCode(c);\n }\n // Encode UTF-16 surrogate pair\n // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF\n return String.fromCharCode(\n ((c - 0x010000) >> 10) + 0xD800,\n ((c - 0x010000) & 0x03FF) + 0xDC00\n );\n}\n\n// set a property of a literal object, while protecting against prototype pollution,\n// see https://github.com/nodeca/js-yaml/issues/164 for more details\nfunction setProperty(object, key, value) {\n // used for this specific key only because Object.defineProperty is slow\n if (key === '__proto__') {\n Object.defineProperty(object, key, {\n configurable: true,\n enumerable: true,\n writable: true,\n value: value\n });\n } else {\n object[key] = value;\n }\n}\n\nvar simpleEscapeCheck = new Array(256); // integer, for fast access\nvar simpleEscapeMap = new Array(256);\nfor (var i = 0; i < 256; i++) {\n simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;\n simpleEscapeMap[i] = simpleEscapeSequence(i);\n}\n\n\nfunction State$1(input, options) {\n this.input = input;\n\n this.filename = options['filename'] || null;\n this.schema = options['schema'] || _default;\n this.onWarning = options['onWarning'] || null;\n // (Hidden) Remove? makes the loader to expect YAML 1.1 documents\n // if such documents have no explicit %YAML directive\n this.legacy = options['legacy'] || false;\n\n this.json = options['json'] || false;\n this.listener = options['listener'] || null;\n\n this.implicitTypes = this.schema.compiledImplicit;\n this.typeMap = this.schema.compiledTypeMap;\n\n this.length = input.length;\n this.position = 0;\n this.line = 0;\n this.lineStart = 0;\n this.lineIndent = 0;\n\n // position of first leading tab in the current line,\n // used to make sure there are no tabs in the indentation\n this.firstTabInLine = -1;\n\n this.documents = [];\n\n /*\n this.version;\n this.checkLineBreaks;\n this.tagMap;\n this.anchorMap;\n this.tag;\n this.anchor;\n this.kind;\n this.result;*/\n\n}\n\n\nfunction generateError(state, message) {\n var mark = {\n name: state.filename,\n buffer: state.input.slice(0, -1), // omit trailing \\0\n position: state.position,\n line: state.line,\n column: state.position - state.lineStart\n };\n\n mark.snippet = snippet(mark);\n\n return new exception(message, mark);\n}\n\nfunction throwError(state, message) {\n throw generateError(state, message);\n}\n\nfunction throwWarning(state, message) {\n if (state.onWarning) {\n state.onWarning.call(null, generateError(state, message));\n }\n}\n\n\nvar directiveHandlers = {\n\n YAML: function handleYamlDirective(state, name, args) {\n\n var match, major, minor;\n\n if (state.version !== null) {\n throwError(state, 'duplication of %YAML directive');\n }\n\n if (args.length !== 1) {\n throwError(state, 'YAML directive accepts exactly one argument');\n }\n\n match = /^([0-9]+)\\.([0-9]+)$/.exec(args[0]);\n\n if (match === null) {\n throwError(state, 'ill-formed argument of the YAML directive');\n }\n\n major = parseInt(match[1], 10);\n minor = parseInt(match[2], 10);\n\n if (major !== 1) {\n throwError(state, 'unacceptable YAML version of the document');\n }\n\n state.version = args[0];\n state.checkLineBreaks = (minor < 2);\n\n if (minor !== 1 && minor !== 2) {\n throwWarning(state, 'unsupported YAML version of the document');\n }\n },\n\n TAG: function handleTagDirective(state, name, args) {\n\n var handle, prefix;\n\n if (args.length !== 2) {\n throwError(state, 'TAG directive accepts exactly two arguments');\n }\n\n handle = args[0];\n prefix = args[1];\n\n if (!PATTERN_TAG_HANDLE.test(handle)) {\n throwError(state, 'ill-formed tag handle (first argument) of the TAG directive');\n }\n\n if (_hasOwnProperty$1.call(state.tagMap, handle)) {\n throwError(state, 'there is a previously declared suffix for \"' + handle + '\" tag handle');\n }\n\n if (!PATTERN_TAG_URI.test(prefix)) {\n throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive');\n }\n\n try {\n prefix = decodeURIComponent(prefix);\n } catch (err) {\n throwError(state, 'tag prefix is malformed: ' + prefix);\n }\n\n state.tagMap[handle] = prefix;\n }\n};\n\n\nfunction captureSegment(state, start, end, checkJson) {\n var _position, _length, _character, _result;\n\n if (start < end) {\n _result = state.input.slice(start, end);\n\n if (checkJson) {\n for (_position = 0, _length = _result.length; _position < _length; _position += 1) {\n _character = _result.charCodeAt(_position);\n if (!(_character === 0x09 ||\n (0x20 <= _character && _character <= 0x10FFFF))) {\n throwError(state, 'expected valid JSON character');\n }\n }\n } else if (PATTERN_NON_PRINTABLE.test(_result)) {\n throwError(state, 'the stream contains non-printable characters');\n }\n\n state.result += _result;\n }\n}\n\nfunction mergeMappings(state, destination, source, overridableKeys) {\n var sourceKeys, key, index, quantity;\n\n if (!common.isObject(source)) {\n throwError(state, 'cannot merge mappings; the provided source object is unacceptable');\n }\n\n sourceKeys = Object.keys(source);\n\n for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {\n key = sourceKeys[index];\n\n if (!_hasOwnProperty$1.call(destination, key)) {\n setProperty(destination, key, source[key]);\n overridableKeys[key] = true;\n }\n }\n}\n\nfunction storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode,\n startLine, startLineStart, startPos) {\n\n var index, quantity;\n\n // The output is a plain object here, so keys can only be strings.\n // We need to convert keyNode to a string, but doing so can hang the process\n // (deeply nested arrays that explode exponentially using aliases).\n if (Array.isArray(keyNode)) {\n keyNode = Array.prototype.slice.call(keyNode);\n\n for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {\n if (Array.isArray(keyNode[index])) {\n throwError(state, 'nested arrays are not supported inside keys');\n }\n\n if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') {\n keyNode[index] = '[object Object]';\n }\n }\n }\n\n // Avoid code execution in load() via toString property\n // (still use its own toString for arrays, timestamps,\n // and whatever user schema extensions happen to have @@toStringTag)\n if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') {\n keyNode = '[object Object]';\n }\n\n\n keyNode = String(keyNode);\n\n if (_result === null) {\n _result = {};\n }\n\n if (keyTag === 'tag:yaml.org,2002:merge') {\n if (Array.isArray(valueNode)) {\n for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {\n mergeMappings(state, _result, valueNode[index], overridableKeys);\n }\n } else {\n mergeMappings(state, _result, valueNode, overridableKeys);\n }\n } else {\n if (!state.json &&\n !_hasOwnProperty$1.call(overridableKeys, keyNode) &&\n _hasOwnProperty$1.call(_result, keyNode)) {\n state.line = startLine || state.line;\n state.lineStart = startLineStart || state.lineStart;\n state.position = startPos || state.position;\n throwError(state, 'duplicated mapping key');\n }\n\n setProperty(_result, keyNode, valueNode);\n delete overridableKeys[keyNode];\n }\n\n return _result;\n}\n\nfunction readLineBreak(state) {\n var ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch === 0x0A/* LF */) {\n state.position++;\n } else if (ch === 0x0D/* CR */) {\n state.position++;\n if (state.input.charCodeAt(state.position) === 0x0A/* LF */) {\n state.position++;\n }\n } else {\n throwError(state, 'a line break is expected');\n }\n\n state.line += 1;\n state.lineStart = state.position;\n state.firstTabInLine = -1;\n}\n\nfunction skipSeparationSpace(state, allowComments, checkIndent) {\n var lineBreaks = 0,\n ch = state.input.charCodeAt(state.position);\n\n while (ch !== 0) {\n while (is_WHITE_SPACE(ch)) {\n if (ch === 0x09/* Tab */ && state.firstTabInLine === -1) {\n state.firstTabInLine = state.position;\n }\n ch = state.input.charCodeAt(++state.position);\n }\n\n if (allowComments && ch === 0x23/* # */) {\n do {\n ch = state.input.charCodeAt(++state.position);\n } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0);\n }\n\n if (is_EOL(ch)) {\n readLineBreak(state);\n\n ch = state.input.charCodeAt(state.position);\n lineBreaks++;\n state.lineIndent = 0;\n\n while (ch === 0x20/* Space */) {\n state.lineIndent++;\n ch = state.input.charCodeAt(++state.position);\n }\n } else {\n break;\n }\n }\n\n if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {\n throwWarning(state, 'deficient indentation');\n }\n\n return lineBreaks;\n}\n\nfunction testDocumentSeparator(state) {\n var _position = state.position,\n ch;\n\n ch = state.input.charCodeAt(_position);\n\n // Condition state.position === state.lineStart is tested\n // in parent on each call, for efficiency. No needs to test here again.\n if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) &&\n ch === state.input.charCodeAt(_position + 1) &&\n ch === state.input.charCodeAt(_position + 2)) {\n\n _position += 3;\n\n ch = state.input.charCodeAt(_position);\n\n if (ch === 0 || is_WS_OR_EOL(ch)) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction writeFoldedLines(state, count) {\n if (count === 1) {\n state.result += ' ';\n } else if (count > 1) {\n state.result += common.repeat('\\n', count - 1);\n }\n}\n\n\nfunction readPlainScalar(state, nodeIndent, withinFlowCollection) {\n var preceding,\n following,\n captureStart,\n captureEnd,\n hasPendingContent,\n _line,\n _lineStart,\n _lineIndent,\n _kind = state.kind,\n _result = state.result,\n ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (is_WS_OR_EOL(ch) ||\n is_FLOW_INDICATOR(ch) ||\n ch === 0x23/* # */ ||\n ch === 0x26/* & */ ||\n ch === 0x2A/* * */ ||\n ch === 0x21/* ! */ ||\n ch === 0x7C/* | */ ||\n ch === 0x3E/* > */ ||\n ch === 0x27/* ' */ ||\n ch === 0x22/* \" */ ||\n ch === 0x25/* % */ ||\n ch === 0x40/* @ */ ||\n ch === 0x60/* ` */) {\n return false;\n }\n\n if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) {\n following = state.input.charCodeAt(state.position + 1);\n\n if (is_WS_OR_EOL(following) ||\n withinFlowCollection && is_FLOW_INDICATOR(following)) {\n return false;\n }\n }\n\n state.kind = 'scalar';\n state.result = '';\n captureStart = captureEnd = state.position;\n hasPendingContent = false;\n\n while (ch !== 0) {\n if (ch === 0x3A/* : */) {\n following = state.input.charCodeAt(state.position + 1);\n\n if (is_WS_OR_EOL(following) ||\n withinFlowCollection && is_FLOW_INDICATOR(following)) {\n break;\n }\n\n } else if (ch === 0x23/* # */) {\n preceding = state.input.charCodeAt(state.position - 1);\n\n if (is_WS_OR_EOL(preceding)) {\n break;\n }\n\n } else if ((state.position === state.lineStart && testDocumentSeparator(state)) ||\n withinFlowCollection && is_FLOW_INDICATOR(ch)) {\n break;\n\n } else if (is_EOL(ch)) {\n _line = state.line;\n _lineStart = state.lineStart;\n _lineIndent = state.lineIndent;\n skipSeparationSpace(state, false, -1);\n\n if (state.lineIndent >= nodeIndent) {\n hasPendingContent = true;\n ch = state.input.charCodeAt(state.position);\n continue;\n } else {\n state.position = captureEnd;\n state.line = _line;\n state.lineStart = _lineStart;\n state.lineIndent = _lineIndent;\n break;\n }\n }\n\n if (hasPendingContent) {\n captureSegment(state, captureStart, captureEnd, false);\n writeFoldedLines(state, state.line - _line);\n captureStart = captureEnd = state.position;\n hasPendingContent = false;\n }\n\n if (!is_WHITE_SPACE(ch)) {\n captureEnd = state.position + 1;\n }\n\n ch = state.input.charCodeAt(++state.position);\n }\n\n captureSegment(state, captureStart, captureEnd, false);\n\n if (state.result) {\n return true;\n }\n\n state.kind = _kind;\n state.result = _result;\n return false;\n}\n\nfunction readSingleQuotedScalar(state, nodeIndent) {\n var ch,\n captureStart, captureEnd;\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch !== 0x27/* ' */) {\n return false;\n }\n\n state.kind = 'scalar';\n state.result = '';\n state.position++;\n captureStart = captureEnd = state.position;\n\n while ((ch = state.input.charCodeAt(state.position)) !== 0) {\n if (ch === 0x27/* ' */) {\n captureSegment(state, captureStart, state.position, true);\n ch = state.input.charCodeAt(++state.position);\n\n if (ch === 0x27/* ' */) {\n captureStart = state.position;\n state.position++;\n captureEnd = state.position;\n } else {\n return true;\n }\n\n } else if (is_EOL(ch)) {\n captureSegment(state, captureStart, captureEnd, true);\n writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));\n captureStart = captureEnd = state.position;\n\n } else if (state.position === state.lineStart && testDocumentSeparator(state)) {\n throwError(state, 'unexpected end of the document within a single quoted scalar');\n\n } else {\n state.position++;\n captureEnd = state.position;\n }\n }\n\n throwError(state, 'unexpected end of the stream within a single quoted scalar');\n}\n\nfunction readDoubleQuotedScalar(state, nodeIndent) {\n var captureStart,\n captureEnd,\n hexLength,\n hexResult,\n tmp,\n ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch !== 0x22/* \" */) {\n return false;\n }\n\n state.kind = 'scalar';\n state.result = '';\n state.position++;\n captureStart = captureEnd = state.position;\n\n while ((ch = state.input.charCodeAt(state.position)) !== 0) {\n if (ch === 0x22/* \" */) {\n captureSegment(state, captureStart, state.position, true);\n state.position++;\n return true;\n\n } else if (ch === 0x5C/* \\ */) {\n captureSegment(state, captureStart, state.position, true);\n ch = state.input.charCodeAt(++state.position);\n\n if (is_EOL(ch)) {\n skipSeparationSpace(state, false, nodeIndent);\n\n // TODO: rework to inline fn with no type cast?\n } else if (ch < 256 && simpleEscapeCheck[ch]) {\n state.result += simpleEscapeMap[ch];\n state.position++;\n\n } else if ((tmp = escapedHexLen(ch)) > 0) {\n hexLength = tmp;\n hexResult = 0;\n\n for (; hexLength > 0; hexLength--) {\n ch = state.input.charCodeAt(++state.position);\n\n if ((tmp = fromHexCode(ch)) >= 0) {\n hexResult = (hexResult << 4) + tmp;\n\n } else {\n throwError(state, 'expected hexadecimal character');\n }\n }\n\n state.result += charFromCodepoint(hexResult);\n\n state.position++;\n\n } else {\n throwError(state, 'unknown escape sequence');\n }\n\n captureStart = captureEnd = state.position;\n\n } else if (is_EOL(ch)) {\n captureSegment(state, captureStart, captureEnd, true);\n writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));\n captureStart = captureEnd = state.position;\n\n } else if (state.position === state.lineStart && testDocumentSeparator(state)) {\n throwError(state, 'unexpected end of the document within a double quoted scalar');\n\n } else {\n state.position++;\n captureEnd = state.position;\n }\n }\n\n throwError(state, 'unexpected end of the stream within a double quoted scalar');\n}\n\nfunction readFlowCollection(state, nodeIndent) {\n var readNext = true,\n _line,\n _lineStart,\n _pos,\n _tag = state.tag,\n _result,\n _anchor = state.anchor,\n following,\n terminator,\n isPair,\n isExplicitPair,\n isMapping,\n overridableKeys = Object.create(null),\n keyNode,\n keyTag,\n valueNode,\n ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch === 0x5B/* [ */) {\n terminator = 0x5D;/* ] */\n isMapping = false;\n _result = [];\n } else if (ch === 0x7B/* { */) {\n terminator = 0x7D;/* } */\n isMapping = true;\n _result = {};\n } else {\n return false;\n }\n\n if (state.anchor !== null) {\n state.anchorMap[state.anchor] = _result;\n }\n\n ch = state.input.charCodeAt(++state.position);\n\n while (ch !== 0) {\n skipSeparationSpace(state, true, nodeIndent);\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch === terminator) {\n state.position++;\n state.tag = _tag;\n state.anchor = _anchor;\n state.kind = isMapping ? 'mapping' : 'sequence';\n state.result = _result;\n return true;\n } else if (!readNext) {\n throwError(state, 'missed comma between flow collection entries');\n } else if (ch === 0x2C/* , */) {\n // \"flow collection entries can never be completely empty\", as per YAML 1.2, section 7.4\n throwError(state, \"expected the node content, but found ','\");\n }\n\n keyTag = keyNode = valueNode = null;\n isPair = isExplicitPair = false;\n\n if (ch === 0x3F/* ? */) {\n following = state.input.charCodeAt(state.position + 1);\n\n if (is_WS_OR_EOL(following)) {\n isPair = isExplicitPair = true;\n state.position++;\n skipSeparationSpace(state, true, nodeIndent);\n }\n }\n\n _line = state.line; // Save the current line.\n _lineStart = state.lineStart;\n _pos = state.position;\n composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);\n keyTag = state.tag;\n keyNode = state.result;\n skipSeparationSpace(state, true, nodeIndent);\n\n ch = state.input.charCodeAt(state.position);\n\n if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) {\n isPair = true;\n ch = state.input.charCodeAt(++state.position);\n skipSeparationSpace(state, true, nodeIndent);\n composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);\n valueNode = state.result;\n }\n\n if (isMapping) {\n storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);\n } else if (isPair) {\n _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));\n } else {\n _result.push(keyNode);\n }\n\n skipSeparationSpace(state, true, nodeIndent);\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch === 0x2C/* , */) {\n readNext = true;\n ch = state.input.charCodeAt(++state.position);\n } else {\n readNext = false;\n }\n }\n\n throwError(state, 'unexpected end of the stream within a flow collection');\n}\n\nfunction readBlockScalar(state, nodeIndent) {\n var captureStart,\n folding,\n chomping = CHOMPING_CLIP,\n didReadContent = false,\n detectedIndent = false,\n textIndent = nodeIndent,\n emptyLines = 0,\n atMoreIndented = false,\n tmp,\n ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch === 0x7C/* | */) {\n folding = false;\n } else if (ch === 0x3E/* > */) {\n folding = true;\n } else {\n return false;\n }\n\n state.kind = 'scalar';\n state.result = '';\n\n while (ch !== 0) {\n ch = state.input.charCodeAt(++state.position);\n\n if (ch === 0x2B/* + */ || ch === 0x2D/* - */) {\n if (CHOMPING_CLIP === chomping) {\n chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP;\n } else {\n throwError(state, 'repeat of a chomping mode identifier');\n }\n\n } else if ((tmp = fromDecimalCode(ch)) >= 0) {\n if (tmp === 0) {\n throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one');\n } else if (!detectedIndent) {\n textIndent = nodeIndent + tmp - 1;\n detectedIndent = true;\n } else {\n throwError(state, 'repeat of an indentation width identifier');\n }\n\n } else {\n break;\n }\n }\n\n if (is_WHITE_SPACE(ch)) {\n do { ch = state.input.charCodeAt(++state.position); }\n while (is_WHITE_SPACE(ch));\n\n if (ch === 0x23/* # */) {\n do { ch = state.input.charCodeAt(++state.position); }\n while (!is_EOL(ch) && (ch !== 0));\n }\n }\n\n while (ch !== 0) {\n readLineBreak(state);\n state.lineIndent = 0;\n\n ch = state.input.charCodeAt(state.position);\n\n while ((!detectedIndent || state.lineIndent < textIndent) &&\n (ch === 0x20/* Space */)) {\n state.lineIndent++;\n ch = state.input.charCodeAt(++state.position);\n }\n\n if (!detectedIndent && state.lineIndent > textIndent) {\n textIndent = state.lineIndent;\n }\n\n if (is_EOL(ch)) {\n emptyLines++;\n continue;\n }\n\n // End of the scalar.\n if (state.lineIndent < textIndent) {\n\n // Perform the chomping.\n if (chomping === CHOMPING_KEEP) {\n state.result += common.repeat('\\n', didReadContent ? 1 + emptyLines : emptyLines);\n } else if (chomping === CHOMPING_CLIP) {\n if (didReadContent) { // i.e. only if the scalar is not empty.\n state.result += '\\n';\n }\n }\n\n // Break this `while` cycle and go to the funciton's epilogue.\n break;\n }\n\n // Folded style: use fancy rules to handle line breaks.\n if (folding) {\n\n // Lines starting with white space characters (more-indented lines) are not folded.\n if (is_WHITE_SPACE(ch)) {\n atMoreIndented = true;\n // except for the first content line (cf. Example 8.1)\n state.result += common.repeat('\\n', didReadContent ? 1 + emptyLines : emptyLines);\n\n // End of more-indented block.\n } else if (atMoreIndented) {\n atMoreIndented = false;\n state.result += common.repeat('\\n', emptyLines + 1);\n\n // Just one line break - perceive as the same line.\n } else if (emptyLines === 0) {\n if (didReadContent) { // i.e. only if we have already read some scalar content.\n state.result += ' ';\n }\n\n // Several line breaks - perceive as different lines.\n } else {\n state.result += common.repeat('\\n', emptyLines);\n }\n\n // Literal style: just add exact number of line breaks between content lines.\n } else {\n // Keep all line breaks except the header line break.\n state.result += common.repeat('\\n', didReadContent ? 1 + emptyLines : emptyLines);\n }\n\n didReadContent = true;\n detectedIndent = true;\n emptyLines = 0;\n captureStart = state.position;\n\n while (!is_EOL(ch) && (ch !== 0)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n captureSegment(state, captureStart, state.position, false);\n }\n\n return true;\n}\n\nfunction readBlockSequence(state, nodeIndent) {\n var _line,\n _tag = state.tag,\n _anchor = state.anchor,\n _result = [],\n following,\n detected = false,\n ch;\n\n // there is a leading tab before this token, so it can't be a block sequence/mapping;\n // it can still be flow sequence/mapping or a scalar\n if (state.firstTabInLine !== -1) return false;\n\n if (state.anchor !== null) {\n state.anchorMap[state.anchor] = _result;\n }\n\n ch = state.input.charCodeAt(state.position);\n\n while (ch !== 0) {\n if (state.firstTabInLine !== -1) {\n state.position = state.firstTabInLine;\n throwError(state, 'tab characters must not be used in indentation');\n }\n\n if (ch !== 0x2D/* - */) {\n break;\n }\n\n following = state.input.charCodeAt(state.position + 1);\n\n if (!is_WS_OR_EOL(following)) {\n break;\n }\n\n detected = true;\n state.position++;\n\n if (skipSeparationSpace(state, true, -1)) {\n if (state.lineIndent <= nodeIndent) {\n _result.push(null);\n ch = state.input.charCodeAt(state.position);\n continue;\n }\n }\n\n _line = state.line;\n composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);\n _result.push(state.result);\n skipSeparationSpace(state, true, -1);\n\n ch = state.input.charCodeAt(state.position);\n\n if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {\n throwError(state, 'bad indentation of a sequence entry');\n } else if (state.lineIndent < nodeIndent) {\n break;\n }\n }\n\n if (detected) {\n state.tag = _tag;\n state.anchor = _anchor;\n state.kind = 'sequence';\n state.result = _result;\n return true;\n }\n return false;\n}\n\nfunction readBlockMapping(state, nodeIndent, flowIndent) {\n var following,\n allowCompact,\n _line,\n _keyLine,\n _keyLineStart,\n _keyPos,\n _tag = state.tag,\n _anchor = state.anchor,\n _result = {},\n overridableKeys = Object.create(null),\n keyTag = null,\n keyNode = null,\n valueNode = null,\n atExplicitKey = false,\n detected = false,\n ch;\n\n // there is a leading tab before this token, so it can't be a block sequence/mapping;\n // it can still be flow sequence/mapping or a scalar\n if (state.firstTabInLine !== -1) return false;\n\n if (state.anchor !== null) {\n state.anchorMap[state.anchor] = _result;\n }\n\n ch = state.input.charCodeAt(state.position);\n\n while (ch !== 0) {\n if (!atExplicitKey && state.firstTabInLine !== -1) {\n state.position = state.firstTabInLine;\n throwError(state, 'tab characters must not be used in indentation');\n }\n\n following = state.input.charCodeAt(state.position + 1);\n _line = state.line; // Save the current line.\n\n //\n // Explicit notation case. There are two separate blocks:\n // first for the key (denoted by \"?\") and second for the value (denoted by \":\")\n //\n if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) {\n\n if (ch === 0x3F/* ? */) {\n if (atExplicitKey) {\n storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);\n keyTag = keyNode = valueNode = null;\n }\n\n detected = true;\n atExplicitKey = true;\n allowCompact = true;\n\n } else if (atExplicitKey) {\n // i.e. 0x3A/* : */ === character after the explicit key.\n atExplicitKey = false;\n allowCompact = true;\n\n } else {\n throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line');\n }\n\n state.position += 1;\n ch = following;\n\n //\n // Implicit notation case. Flow-style node as the key first, then \":\", and the value.\n //\n } else {\n _keyLine = state.line;\n _keyLineStart = state.lineStart;\n _keyPos = state.position;\n\n if (!composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {\n // Neither implicit nor explicit notation.\n // Reading is done. Go to the epilogue.\n break;\n }\n\n if (state.line === _line) {\n ch = state.input.charCodeAt(state.position);\n\n while (is_WHITE_SPACE(ch)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n if (ch === 0x3A/* : */) {\n ch = state.input.charCodeAt(++state.position);\n\n if (!is_WS_OR_EOL(ch)) {\n throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping');\n }\n\n if (atExplicitKey) {\n storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);\n keyTag = keyNode = valueNode = null;\n }\n\n detected = true;\n atExplicitKey = false;\n allowCompact = false;\n keyTag = state.tag;\n keyNode = state.result;\n\n } else if (detected) {\n throwError(state, 'can not read an implicit mapping pair; a colon is missed');\n\n } else {\n state.tag = _tag;\n state.anchor = _anchor;\n return true; // Keep the result of `composeNode`.\n }\n\n } else if (detected) {\n throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key');\n\n } else {\n state.tag = _tag;\n state.anchor = _anchor;\n return true; // Keep the result of `composeNode`.\n }\n }\n\n //\n // Common reading code for both explicit and implicit notations.\n //\n if (state.line === _line || state.lineIndent > nodeIndent) {\n if (atExplicitKey) {\n _keyLine = state.line;\n _keyLineStart = state.lineStart;\n _keyPos = state.position;\n }\n\n if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {\n if (atExplicitKey) {\n keyNode = state.result;\n } else {\n valueNode = state.result;\n }\n }\n\n if (!atExplicitKey) {\n storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);\n keyTag = keyNode = valueNode = null;\n }\n\n skipSeparationSpace(state, true, -1);\n ch = state.input.charCodeAt(state.position);\n }\n\n if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {\n throwError(state, 'bad indentation of a mapping entry');\n } else if (state.lineIndent < nodeIndent) {\n break;\n }\n }\n\n //\n // Epilogue.\n //\n\n // Special case: last mapping's node contains only the key in explicit notation.\n if (atExplicitKey) {\n storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);\n }\n\n // Expose the resulting mapping.\n if (detected) {\n state.tag = _tag;\n state.anchor = _anchor;\n state.kind = 'mapping';\n state.result = _result;\n }\n\n return detected;\n}\n\nfunction readTagProperty(state) {\n var _position,\n isVerbatim = false,\n isNamed = false,\n tagHandle,\n tagName,\n ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch !== 0x21/* ! */) return false;\n\n if (state.tag !== null) {\n throwError(state, 'duplication of a tag property');\n }\n\n ch = state.input.charCodeAt(++state.position);\n\n if (ch === 0x3C/* < */) {\n isVerbatim = true;\n ch = state.input.charCodeAt(++state.position);\n\n } else if (ch === 0x21/* ! */) {\n isNamed = true;\n tagHandle = '!!';\n ch = state.input.charCodeAt(++state.position);\n\n } else {\n tagHandle = '!';\n }\n\n _position = state.position;\n\n if (isVerbatim) {\n do { ch = state.input.charCodeAt(++state.position); }\n while (ch !== 0 && ch !== 0x3E/* > */);\n\n if (state.position < state.length) {\n tagName = state.input.slice(_position, state.position);\n ch = state.input.charCodeAt(++state.position);\n } else {\n throwError(state, 'unexpected end of the stream within a verbatim tag');\n }\n } else {\n while (ch !== 0 && !is_WS_OR_EOL(ch)) {\n\n if (ch === 0x21/* ! */) {\n if (!isNamed) {\n tagHandle = state.input.slice(_position - 1, state.position + 1);\n\n if (!PATTERN_TAG_HANDLE.test(tagHandle)) {\n throwError(state, 'named tag handle cannot contain such characters');\n }\n\n isNamed = true;\n _position = state.position + 1;\n } else {\n throwError(state, 'tag suffix cannot contain exclamation marks');\n }\n }\n\n ch = state.input.charCodeAt(++state.position);\n }\n\n tagName = state.input.slice(_position, state.position);\n\n if (PATTERN_FLOW_INDICATORS.test(tagName)) {\n throwError(state, 'tag suffix cannot contain flow indicator characters');\n }\n }\n\n if (tagName && !PATTERN_TAG_URI.test(tagName)) {\n throwError(state, 'tag name cannot contain such characters: ' + tagName);\n }\n\n try {\n tagName = decodeURIComponent(tagName);\n } catch (err) {\n throwError(state, 'tag name is malformed: ' + tagName);\n }\n\n if (isVerbatim) {\n state.tag = tagName;\n\n } else if (_hasOwnProperty$1.call(state.tagMap, tagHandle)) {\n state.tag = state.tagMap[tagHandle] + tagName;\n\n } else if (tagHandle === '!') {\n state.tag = '!' + tagName;\n\n } else if (tagHandle === '!!') {\n state.tag = 'tag:yaml.org,2002:' + tagName;\n\n } else {\n throwError(state, 'undeclared tag handle \"' + tagHandle + '\"');\n }\n\n return true;\n}\n\nfunction readAnchorProperty(state) {\n var _position,\n ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch !== 0x26/* & */) return false;\n\n if (state.anchor !== null) {\n throwError(state, 'duplication of an anchor property');\n }\n\n ch = state.input.charCodeAt(++state.position);\n _position = state.position;\n\n while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n if (state.position === _position) {\n throwError(state, 'name of an anchor node must contain at least one character');\n }\n\n state.anchor = state.input.slice(_position, state.position);\n return true;\n}\n\nfunction readAlias(state) {\n var _position, alias,\n ch;\n\n ch = state.input.charCodeAt(state.position);\n\n if (ch !== 0x2A/* * */) return false;\n\n ch = state.input.charCodeAt(++state.position);\n _position = state.position;\n\n while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n if (state.position === _position) {\n throwError(state, 'name of an alias node must contain at least one character');\n }\n\n alias = state.input.slice(_position, state.position);\n\n if (!_hasOwnProperty$1.call(state.anchorMap, alias)) {\n throwError(state, 'unidentified alias \"' + alias + '\"');\n }\n\n state.result = state.anchorMap[alias];\n skipSeparationSpace(state, true, -1);\n return true;\n}\n\nfunction composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {\n var allowBlockStyles,\n allowBlockScalars,\n allowBlockCollections,\n indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this<parent\n atNewLine = false,\n hasContent = false,\n typeIndex,\n typeQuantity,\n typeList,\n type,\n flowIndent,\n blockIndent;\n\n if (state.listener !== null) {\n state.listener('open', state);\n }\n\n state.tag = null;\n state.anchor = null;\n state.kind = null;\n state.result = null;\n\n allowBlockStyles = allowBlockScalars = allowBlockCollections =\n CONTEXT_BLOCK_OUT === nodeContext ||\n CONTEXT_BLOCK_IN === nodeContext;\n\n if (allowToSeek) {\n if (skipSeparationSpace(state, true, -1)) {\n atNewLine = true;\n\n if (state.lineIndent > parentIndent) {\n indentStatus = 1;\n } else if (state.lineIndent === parentIndent) {\n indentStatus = 0;\n } else if (state.lineIndent < parentIndent) {\n indentStatus = -1;\n }\n }\n }\n\n if (indentStatus === 1) {\n while (readTagProperty(state) || readAnchorProperty(state)) {\n if (skipSeparationSpace(state, true, -1)) {\n atNewLine = true;\n allowBlockCollections = allowBlockStyles;\n\n if (state.lineIndent > parentIndent) {\n indentStatus = 1;\n } else if (state.lineIndent === parentIndent) {\n indentStatus = 0;\n } else if (state.lineIndent < parentIndent) {\n indentStatus = -1;\n }\n } else {\n allowBlockCollections = false;\n }\n }\n }\n\n if (allowBlockCollections) {\n allowBlockCollections = atNewLine || allowCompact;\n }\n\n if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {\n if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {\n flowIndent = parentIndent;\n } else {\n flowIndent = parentIndent + 1;\n }\n\n blockIndent = state.position - state.lineStart;\n\n if (indentStatus === 1) {\n if (allowBlockCollections &&\n (readBlockSequence(state, blockIndent) ||\n readBlockMapping(state, blockIndent, flowIndent)) ||\n readFlowCollection(state, flowIndent)) {\n hasContent = true;\n } else {\n if ((allowBlockScalars && readBlockScalar(state, flowIndent)) ||\n readSingleQuotedScalar(state, flowIndent) ||\n readDoubleQuotedScalar(state, flowIndent)) {\n hasContent = true;\n\n } else if (readAlias(state)) {\n hasContent = true;\n\n if (state.tag !== null || state.anchor !== null) {\n throwError(state, 'alias node should not have any properties');\n }\n\n } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {\n hasContent = true;\n\n if (state.tag === null) {\n state.tag = '?';\n }\n }\n\n if (state.anchor !== null) {\n state.anchorMap[state.anchor] = state.result;\n }\n }\n } else if (indentStatus === 0) {\n // Special case: block sequences are allowed to have same indentation level as the parent.\n // http://www.yaml.org/spec/1.2/spec.html#id2799784\n hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);\n }\n }\n\n if (state.tag === null) {\n if (state.anchor !== null) {\n state.anchorMap[state.anchor] = state.result;\n }\n\n } else if (state.tag === '?') {\n // Implicit resolving is not allowed for non-scalar types, and '?'\n // non-specific tag is only automatically assigned to plain scalars.\n //\n // We only need to check kind conformity in case user explicitly assigns '?'\n // tag, for example like this: \"!<?> [0]\"\n //\n if (state.result !== null && state.kind !== 'scalar') {\n throwError(state, 'unacceptable node kind for !<?> tag; it should be \"scalar\", not \"' + state.kind + '\"');\n }\n\n for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {\n type = state.implicitTypes[typeIndex];\n\n if (type.resolve(state.result)) { // `state.result` updated in resolver if matched\n state.result = type.construct(state.result);\n state.tag = type.tag;\n if (state.anchor !== null) {\n state.anchorMap[state.anchor] = state.result;\n }\n break;\n }\n }\n } else if (state.tag !== '!') {\n if (_hasOwnProperty$1.call(state.typeMap[state.kind || 'fallback'], state.tag)) {\n type = state.typeMap[state.kind || 'fallback'][state.tag];\n } else {\n // looking for multi type\n type = null;\n typeList = state.typeMap.multi[state.kind || 'fallback'];\n\n for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {\n if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {\n type = typeList[typeIndex];\n break;\n }\n }\n }\n\n if (!type) {\n throwError(state, 'unknown tag !<' + state.tag + '>');\n }\n\n if (state.result !== null && type.kind !== state.kind) {\n throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be \"' + type.kind + '\", not \"' + state.kind + '\"');\n }\n\n if (!type.resolve(state.result, state.tag)) { // `state.result` updated in resolver if matched\n throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag');\n } else {\n state.result = type.construct(state.result, state.tag);\n if (state.anchor !== null) {\n state.anchorMap[state.anchor] = state.result;\n }\n }\n }\n\n if (state.listener !== null) {\n state.listener('close', state);\n }\n return state.tag !== null || state.anchor !== null || hasContent;\n}\n\nfunction readDocument(state) {\n var documentStart = state.position,\n _position,\n directiveName,\n directiveArgs,\n hasDirectives = false,\n ch;\n\n state.version = null;\n state.checkLineBreaks = state.legacy;\n state.tagMap = Object.create(null);\n state.anchorMap = Object.create(null);\n\n while ((ch = state.input.charCodeAt(state.position)) !== 0) {\n skipSeparationSpace(state, true, -1);\n\n ch = state.input.charCodeAt(state.position);\n\n if (state.lineIndent > 0 || ch !== 0x25/* % */) {\n break;\n }\n\n hasDirectives = true;\n ch = state.input.charCodeAt(++state.position);\n _position = state.position;\n\n while (ch !== 0 && !is_WS_OR_EOL(ch)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n directiveName = state.input.slice(_position, state.position);\n directiveArgs = [];\n\n if (directiveName.length < 1) {\n throwError(state, 'directive name must not be less than one character in length');\n }\n\n while (ch !== 0) {\n while (is_WHITE_SPACE(ch)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n if (ch === 0x23/* # */) {\n do { ch = state.input.charCodeAt(++state.position); }\n while (ch !== 0 && !is_EOL(ch));\n break;\n }\n\n if (is_EOL(ch)) break;\n\n _position = state.position;\n\n while (ch !== 0 && !is_WS_OR_EOL(ch)) {\n ch = state.input.charCodeAt(++state.position);\n }\n\n directiveArgs.push(state.input.slice(_position, state.position));\n }\n\n if (ch !== 0) readLineBreak(state);\n\n if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) {\n directiveHandlers[directiveName](state, directiveName, directiveArgs);\n } else {\n throwWarning(state, 'unknown document directive \"' + directiveName + '\"');\n }\n }\n\n skipSeparationSpace(state, true, -1);\n\n if (state.lineIndent === 0 &&\n state.input.charCodeAt(state.position) === 0x2D/* - */ &&\n state.input.charCodeAt(state.position + 1) === 0x2D/* - */ &&\n state.input.charCodeAt(state.position + 2) === 0x2D/* - */) {\n state.position += 3;\n skipSeparationSpace(state, true, -1);\n\n } else if (hasDirectives) {\n throwError(state, 'directives end mark is expected');\n }\n\n composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);\n skipSeparationSpace(state, true, -1);\n\n if (state.checkLineBreaks &&\n PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {\n throwWarning(state, 'non-ASCII line breaks are interpreted as content');\n }\n\n state.documents.push(state.result);\n\n if (state.position === state.lineStart && testDocumentSeparator(state)) {\n\n if (state.input.charCodeAt(state.position) === 0x2E/* . */) {\n state.position += 3;\n skipSeparationSpace(state, true, -1);\n }\n return;\n }\n\n if (state.position < (state.length - 1)) {\n throwError(state, 'end of the stream or a document separator is expected');\n } else {\n return;\n }\n}\n\n\nfunction loadDocuments(input, options) {\n input = String(input);\n options = options || {};\n\n if (input.length !== 0) {\n\n // Add tailing `\\n` if not exists\n if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ &&\n input.charCodeAt(input.length - 1) !== 0x0D/* CR */) {\n input += '\\n';\n }\n\n // Strip BOM\n if (input.charCodeAt(0) === 0xFEFF) {\n input = input.slice(1);\n }\n }\n\n var state = new State$1(input, options);\n\n var nullpos = input.indexOf('\\0');\n\n if (nullpos !== -1) {\n state.position = nullpos;\n throwError(state, 'null byte is not allowed in input');\n }\n\n // Use 0 as string terminator. That significantly simplifies bounds check.\n state.input += '\\0';\n\n while (state.input.charCodeAt(state.position) === 0x20/* Space */) {\n state.lineIndent += 1;\n state.position += 1;\n }\n\n while (state.position < (state.length - 1)) {\n readDocument(state);\n }\n\n return state.documents;\n}\n\n\nfunction loadAll$1(input, iterator, options) {\n if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') {\n options = iterator;\n iterator = null;\n }\n\n var documents = loadDocuments(input, options);\n\n if (typeof iterator !== 'function') {\n return documents;\n }\n\n for (var index = 0, length = documents.length; index < length; index += 1) {\n iterator(documents[index]);\n }\n}\n\n\nfunction load$1(input, options) {\n var documents = loadDocuments(input, options);\n\n if (documents.length === 0) {\n /*eslint-disable no-undefined*/\n return undefined;\n } else if (documents.length === 1) {\n return documents[0];\n }\n throw new exception('expected a single document in the stream, but found more');\n}\n\n\nvar loadAll_1 = loadAll$1;\nvar load_1 = load$1;\n\nvar loader = {\n\tloadAll: loadAll_1,\n\tload: load_1\n};\n\n/*eslint-disable no-use-before-define*/\n\n\n\n\n\nvar _toString = Object.prototype.toString;\nvar _hasOwnProperty = Object.prototype.hasOwnProperty;\n\nvar CHAR_BOM = 0xFEFF;\nvar CHAR_TAB = 0x09; /* Tab */\nvar CHAR_LINE_FEED = 0x0A; /* LF */\nvar CHAR_CARRIAGE_RETURN = 0x0D; /* CR */\nvar CHAR_SPACE = 0x20; /* Space */\nvar CHAR_EXCLAMATION = 0x21; /* ! */\nvar CHAR_DOUBLE_QUOTE = 0x22; /* \" */\nvar CHAR_SHARP = 0x23; /* # */\nvar CHAR_PERCENT = 0x25; /* % */\nvar CHAR_AMPERSAND = 0x26; /* & */\nvar CHAR_SINGLE_QUOTE = 0x27; /* ' */\nvar CHAR_ASTERISK = 0x2A; /* * */\nvar CHAR_COMMA = 0x2C; /* , */\nvar CHAR_MINUS = 0x2D; /* - */\nvar CHAR_COLON = 0x3A; /* : */\nvar CHAR_EQUALS = 0x3D; /* = */\nvar CHAR_GREATER_THAN = 0x3E; /* > */\nvar CHAR_QUESTION = 0x3F; /* ? */\nvar CHAR_COMMERCIAL_AT = 0x40; /* @ */\nvar CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */\nvar CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */\nvar CHAR_GRAVE_ACCENT = 0x60; /* ` */\nvar CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */\nvar CHAR_VERTICAL_LINE = 0x7C; /* | */\nvar CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */\n\nvar ESCAPE_SEQUENCES = {};\n\nESCAPE_SEQUENCES[0x00] = '\\\\0';\nESCAPE_SEQUENCES[0x07] = '\\\\a';\nESCAPE_SEQUENCES[0x08] = '\\\\b';\nESCAPE_SEQUENCES[0x09] = '\\\\t';\nESCAPE_SEQUENCES[0x0A] = '\\\\n';\nESCAPE_SEQUENCES[0x0B] = '\\\\v';\nESCAPE_SEQUENCES[0x0C] = '\\\\f';\nESCAPE_SEQUENCES[0x0D] = '\\\\r';\nESCAPE_SEQUENCES[0x1B] = '\\\\e';\nESCAPE_SEQUENCES[0x22] = '\\\\\"';\nESCAPE_SEQUENCES[0x5C] = '\\\\\\\\';\nESCAPE_SEQUENCES[0x85] = '\\\\N';\nESCAPE_SEQUENCES[0xA0] = '\\\\_';\nESCAPE_SEQUENCES[0x2028] = '\\\\L';\nESCAPE_SEQUENCES[0x2029] = '\\\\P';\n\nvar DEPRECATED_BOOLEANS_SYNTAX = [\n 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON',\n 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'\n];\n\nvar DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\\.[0-9_]*)?$/;\n\nfunction compileStyleMap(schema, map) {\n var result, keys, index, length, tag, style, type;\n\n if (map === null) return {};\n\n result = {};\n keys = Object.keys(map);\n\n for (index = 0, length = keys.length; index < length; index += 1) {\n tag = keys[index];\n style = String(map[tag]);\n\n if (tag.slice(0, 2) === '!!') {\n tag = 'tag:yaml.org,2002:' + tag.slice(2);\n }\n type = schema.compiledTypeMap['fallback'][tag];\n\n if (type && _hasOwnProperty.call(type.styleAliases, style)) {\n style = type.styleAliases[style];\n }\n\n result[tag] = style;\n }\n\n return result;\n}\n\nfunction encodeHex(character) {\n var string, handle, length;\n\n string = character.toString(16).toUpperCase();\n\n if (character <= 0xFF) {\n handle = 'x';\n length = 2;\n } else if (character <= 0xFFFF) {\n handle = 'u';\n length = 4;\n } else if (character <= 0xFFFFFFFF) {\n handle = 'U';\n length = 8;\n } else {\n throw new exception('code point within a string may not be greater than 0xFFFFFFFF');\n }\n\n return '\\\\' + handle + common.repeat('0', length - string.length) + string;\n}\n\n\nvar QUOTING_TYPE_SINGLE = 1,\n QUOTING_TYPE_DOUBLE = 2;\n\nfunction State(options) {\n this.schema = options['schema'] || _default;\n this.indent = Math.max(1, (options['indent'] || 2));\n this.noArrayIndent = options['noArrayIndent'] || false;\n this.skipInvalid = options['skipInvalid'] || false;\n this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);\n this.styleMap = compileStyleMap(this.schema, options['styles'] || null);\n this.sortKeys = options['sortKeys'] || false;\n this.lineWidth = options['lineWidth'] || 80;\n this.noRefs = options['noRefs'] || false;\n this.noCompatMode = options['noCompatMode'] || false;\n this.condenseFlow = options['condenseFlow'] || false;\n this.quotingType = options['quotingType'] === '\"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;\n this.forceQuotes = options['forceQuotes'] || false;\n this.replacer = typeof options['replacer'] === 'function' ? options['replacer'] : null;\n\n this.implicitTypes = this.schema.compiledImplicit;\n this.explicitTypes = this.schema.compiledExplicit;\n\n this.tag = null;\n this.result = '';\n\n this.duplicates = [];\n this.usedDuplicates = null;\n}\n\n// Indents every line in a string. Empty lines (\\n only) are not indented.\nfunction indentString(string, spaces) {\n var ind = common.repeat(' ', spaces),\n position = 0,\n next = -1,\n result = '',\n line,\n length = string.length;\n\n while (position < length) {\n next = string.indexOf('\\n', position);\n if (next === -1) {\n line = string.slice(position);\n position = length;\n } else {\n line = string.slice(position, next + 1);\n position = next + 1;\n }\n\n if (line.length && line !== '\\n') result += ind;\n\n result += line;\n }\n\n return result;\n}\n\nfunction generateNextLine(state, level) {\n return '\\n' + common.repeat(' ', state.indent * level);\n}\n\nfunction testImplicitResolving(state, str) {\n var index, length, type;\n\n for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {\n type = state.implicitTypes[index];\n\n if (type.resolve(str)) {\n return true;\n }\n }\n\n return false;\n}\n\n// [33] s-white ::= s-space | s-tab\nfunction isWhitespace(c) {\n return c === CHAR_SPACE || c === CHAR_TAB;\n}\n\n// Returns true if the character can be printed without escaping.\n// From YAML 1.2: \"any allowed characters known to be non-printable\n// should also be escaped. [However,] This isn\u2019t mandatory\"\n// Derived from nb-char - \\t - #x85 - #xA0 - #x2028 - #x2029.\nfunction isPrintable(c) {\n return (0x00020 <= c && c <= 0x00007E)\n || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029)\n || ((0x0E000 <= c && c <= 0x00FFFD) && c !== CHAR_BOM)\n || (0x10000 <= c && c <= 0x10FFFF);\n}\n\n// [34] ns-char ::= nb-char - s-white\n// [27] nb-char ::= c-printable - b-char - c-byte-order-mark\n// [26] b-char ::= b-line-feed | b-carriage-return\n// Including s-white (for some reason, examples doesn't match specs in this aspect)\n// ns-char ::= c-printable - b-line-feed - b-carriage-return - c-byte-order-mark\nfunction isNsCharOrWhitespace(c) {\n return isPrintable(c)\n && c !== CHAR_BOM\n // - b-char\n && c !== CHAR_CARRIAGE_RETURN\n && c !== CHAR_LINE_FEED;\n}\n\n// [127] ns-plain-safe(c) ::= c = flow-out \u21D2 ns-plain-safe-out\n// c = flow-in \u21D2 ns-plain-safe-in\n// c = block-key \u21D2 ns-plain-safe-out\n// c = flow-key \u21D2 ns-plain-safe-in\n// [128] ns-plain-safe-out ::= ns-char\n// [129] ns-plain-safe-in ::= ns-char - c-flow-indicator\n// [130] ns-plain-char(c) ::= ( ns-plain-safe(c) - \u201C:\u201D - \u201C#\u201D )\n// | ( /* An ns-char preceding */ \u201C#\u201D )\n// | ( \u201C:\u201D /* Followed by an ns-plain-safe(c) */ )\nfunction isPlainSafe(c, prev, inblock) {\n var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);\n var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);\n return (\n // ns-plain-safe\n inblock ? // c = flow-in\n cIsNsCharOrWhitespace\n : cIsNsCharOrWhitespace\n // - c-flow-indicator\n && c !== CHAR_COMMA\n && c !== CHAR_LEFT_SQUARE_BRACKET\n && c !== CHAR_RIGHT_SQUARE_BRACKET\n && c !== CHAR_LEFT_CURLY_BRACKET\n && c !== CHAR_RIGHT_CURLY_BRACKET\n )\n // ns-plain-char\n && c !== CHAR_SHARP // false on '#'\n && !(prev === CHAR_COLON && !cIsNsChar) // false on ': '\n || (isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP) // change to true on '[^ ]#'\n || (prev === CHAR_COLON && cIsNsChar); // change to true on ':[^ ]'\n}\n\n// Simplified test for values allowed as the first character in plain style.\nfunction isPlainSafeFirst(c) {\n // Uses a subset of ns-char - c-indicator\n // where ns-char = nb-char - s-white.\n // No support of ( ( \u201C?\u201D | \u201C:\u201D | \u201C-\u201D ) /* Followed by an ns-plain-safe(c)) */ ) part\n return isPrintable(c) && c !== CHAR_BOM\n && !isWhitespace(c) // - s-white\n // - (c-indicator ::=\n // \u201C-\u201D | \u201C?\u201D | \u201C:\u201D | \u201C,\u201D | \u201C[\u201D | \u201C]\u201D | \u201C{\u201D | \u201C}\u201D\n && c !== CHAR_MINUS\n && c !== CHAR_QUESTION\n && c !== CHAR_COLON\n && c !== CHAR_COMMA\n && c !== CHAR_LEFT_SQUARE_BRACKET\n && c !== CHAR_RIGHT_SQUARE_BRACKET\n && c !== CHAR_LEFT_CURLY_BRACKET\n && c !== CHAR_RIGHT_CURLY_BRACKET\n // | \u201C#\u201D | \u201C&\u201D | \u201C*\u201D | \u201C!\u201D | \u201C|\u201D | \u201C=\u201D | \u201C>\u201D | \u201C'\u201D | \u201C\"\u201D\n && c !== CHAR_SHARP\n && c !== CHAR_AMPERSAND\n && c !== CHAR_ASTERISK\n && c !== CHAR_EXCLAMATION\n && c !== CHAR_VERTICAL_LINE\n && c !== CHAR_EQUALS\n && c !== CHAR_GREATER_THAN\n && c !== CHAR_SINGLE_QUOTE\n && c !== CHAR_DOUBLE_QUOTE\n // | \u201C%\u201D | \u201C@\u201D | \u201C`\u201D)\n && c !== CHAR_PERCENT\n && c !== CHAR_COMMERCIAL_AT\n && c !== CHAR_GRAVE_ACCENT;\n}\n\n// Simplified test for values allowed as the last character in plain style.\nfunction isPlainSafeLast(c) {\n // just not whitespace or colon, it will be checked to be plain character later\n return !isWhitespace(c) && c !== CHAR_COLON;\n}\n\n// Same as 'string'.codePointAt(pos), but works in older browsers.\nfunction codePointAt(string, pos) {\n var first = string.charCodeAt(pos), second;\n if (first >= 0xD800 && first <= 0xDBFF && pos + 1 < string.length) {\n second = string.charCodeAt(pos + 1);\n if (second >= 0xDC00 && second <= 0xDFFF) {\n // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae\n return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;\n }\n }\n return first;\n}\n\n// Determines whether block indentation indicator is required.\nfunction needIndentIndicator(string) {\n var leadingSpaceRe = /^\\n* /;\n return leadingSpaceRe.test(string);\n}\n\nvar STYLE_PLAIN = 1,\n STYLE_SINGLE = 2,\n STYLE_LITERAL = 3,\n STYLE_FOLDED = 4,\n STYLE_DOUBLE = 5;\n\n// Determines which scalar styles are possible and returns the preferred style.\n// lineWidth = -1 => no limit.\n// Pre-conditions: str.length > 0.\n// Post-conditions:\n// STYLE_PLAIN or STYLE_SINGLE => no \\n are in the string.\n// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1).\n// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1).\nfunction chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth,\n testAmbiguousType, quotingType, forceQuotes, inblock) {\n\n var i;\n var char = 0;\n var prevChar = null;\n var hasLineBreak = false;\n var hasFoldableLine = false; // only checked if shouldTrackWidth\n var shouldTrackWidth = lineWidth !== -1;\n var previousLineBreak = -1; // count the first line correctly\n var plain = isPlainSafeFirst(codePointAt(string, 0))\n && isPlainSafeLast(codePointAt(string, string.length - 1));\n\n if (singleLineOnly || forceQuotes) {\n // Case: no block styles.\n // Check for disallowed characters to rule out plain and single.\n for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {\n char = codePointAt(string, i);\n if (!isPrintable(char)) {\n return STYLE_DOUBLE;\n }\n plain = plain && isPlainSafe(char, prevChar, inblock);\n prevChar = char;\n }\n } else {\n // Case: block styles permitted.\n for (i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {\n char = codePointAt(string, i);\n if (char === CHAR_LINE_FEED) {\n hasLineBreak = true;\n // Check if any line can be folded.\n if (shouldTrackWidth) {\n hasFoldableLine = hasFoldableLine ||\n // Foldable line = too long, and not more-indented.\n (i - previousLineBreak - 1 > lineWidth &&\n string[previousLineBreak + 1] !== ' ');\n previousLineBreak = i;\n }\n } else if (!isPrintable(char)) {\n return STYLE_DOUBLE;\n }\n plain = plain && isPlainSafe(char, prevChar, inblock);\n prevChar = char;\n }\n // in case the end is missing a \\n\n hasFoldableLine = hasFoldableLine || (shouldTrackWidth &&\n (i - previousLineBreak - 1 > lineWidth &&\n string[previousLineBreak + 1] !== ' '));\n }\n // Although every style can represent \\n without escaping, prefer block styles\n // for multiline, since they're more readable and they don't add empty lines.\n // Also prefer folding a super-long line.\n if (!hasLineBreak && !hasFoldableLine) {\n // Strings interpretable as another type have to be quoted;\n // e.g. the string 'true' vs. the boolean true.\n if (plain && !forceQuotes && !testAmbiguousType(string)) {\n return STYLE_PLAIN;\n }\n return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;\n }\n // Edge case: block indentation indicator can only have one digit.\n if (indentPerLevel > 9 && needIndentIndicator(string)) {\n return STYLE_DOUBLE;\n }\n // At this point we know block styles are valid.\n // Prefer literal style unless we want to fold.\n if (!forceQuotes) {\n return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;\n }\n return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;\n}\n\n// Note: line breaking/folding is implemented for only the folded style.\n// NB. We drop the last trailing newline (if any) of a returned block scalar\n// since the dumper adds its own newline. This always works:\n// \u2022 No ending newline => unaffected; already using strip \"-\" chomping.\n// \u2022 Ending newline => removed then restored.\n// Importantly, this keeps the \"+\" chomp indicator from gaining an extra line.\nfunction writeScalar(state, string, level, iskey, inblock) {\n state.dump = (function () {\n if (string.length === 0) {\n return state.quotingType === QUOTING_TYPE_DOUBLE ? '\"\"' : \"''\";\n }\n if (!state.noCompatMode) {\n if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string)) {\n return state.quotingType === QUOTING_TYPE_DOUBLE ? ('\"' + string + '\"') : (\"'\" + string + \"'\");\n }\n }\n\n var indent = state.indent * Math.max(1, level); // no 0-indent scalars\n // As indentation gets deeper, let the width decrease monotonically\n // to the lower bound min(state.lineWidth, 40).\n // Note that this implies\n // state.lineWidth \u2264 40 + state.indent: width is fixed at the lower bound.\n // state.lineWidth > 40 + state.indent: width decreases until the lower bound.\n // This behaves better than a constant minimum width which disallows narrower options,\n // or an indent threshold which causes the width to suddenly increase.\n var lineWidth = state.lineWidth === -1\n ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);\n\n // Without knowing if keys are implicit/explicit, assume implicit for safety.\n var singleLineOnly = iskey\n // No block styles in flow mode.\n || (state.flowLevel > -1 && level >= state.flowLevel);\n function testAmbiguity(string) {\n return testImplicitResolving(state, string);\n }\n\n switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth,\n testAmbiguity, state.quotingType, state.forceQuotes && !iskey, inblock)) {\n\n case STYLE_PLAIN:\n return string;\n case STYLE_SINGLE:\n return \"'\" + string.replace(/'/g, \"''\") + \"'\";\n case STYLE_LITERAL:\n return '|' + blockHeader(string, state.indent)\n + dropEndingNewline(indentString(string, indent));\n case STYLE_FOLDED:\n return '>' + blockHeader(string, state.indent)\n + dropEndingNewline(indentString(foldString(string, lineWidth), indent));\n case STYLE_DOUBLE:\n return '\"' + escapeString(string) + '\"';\n default:\n throw new exception('impossible error: invalid scalar style');\n }\n }());\n}\n\n// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9.\nfunction blockHeader(string, indentPerLevel) {\n var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : '';\n\n // note the special case: the string '\\n' counts as a \"trailing\" empty line.\n var clip = string[string.length - 1] === '\\n';\n var keep = clip && (string[string.length - 2] === '\\n' || string === '\\n');\n var chomp = keep ? '+' : (clip ? '' : '-');\n\n return indentIndicator + chomp + '\\n';\n}\n\n// (See the note for writeScalar.)\nfunction dropEndingNewline(string) {\n return string[string.length - 1] === '\\n' ? string.slice(0, -1) : string;\n}\n\n// Note: a long line without a suitable break point will exceed the width limit.\n// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0.\nfunction foldString(string, width) {\n // In folded style, $k$ consecutive newlines output as $k+1$ newlines\u2014\n // unless they're before or after a more-indented line, or at the very\n // beginning or end, in which case $k$ maps to $k$.\n // Therefore, parse each chunk as newline(s) followed by a content line.\n var lineRe = /(\\n+)([^\\n]*)/g;\n\n // first line (possibly an empty line)\n var result = (function () {\n var nextLF = string.indexOf('\\n');\n nextLF = nextLF !== -1 ? nextLF : string.length;\n lineRe.lastIndex = nextLF;\n return foldLine(string.slice(0, nextLF), width);\n }());\n // If we haven't reached the first content line yet, don't add an extra \\n.\n var prevMoreIndented = string[0] === '\\n' || string[0] === ' ';\n var moreIndented;\n\n // rest of the lines\n var match;\n while ((match = lineRe.exec(string))) {\n var prefix = match[1], line = match[2];\n moreIndented = (line[0] === ' ');\n result += prefix\n + (!prevMoreIndented && !moreIndented && line !== ''\n ? '\\n' : '')\n + foldLine(line, width);\n prevMoreIndented = moreIndented;\n }\n\n return result;\n}\n\n// Greedy line breaking.\n// Picks the longest line under the limit each time,\n// otherwise settles for the shortest line over the limit.\n// NB. More-indented lines *cannot* be folded, as that would add an extra \\n.\nfunction foldLine(line, width) {\n if (line === '' || line[0] === ' ') return line;\n\n // Since a more-indented line adds a \\n, breaks can't be followed by a space.\n var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.\n var match;\n // start is an inclusive index. end, curr, and next are exclusive.\n var start = 0, end, curr = 0, next = 0;\n var result = '';\n\n // Invariants: 0 <= start <= length-1.\n // 0 <= curr <= next <= max(0, length-2). curr - start <= width.\n // Inside the loop:\n // A match implies length >= 2, so curr and next are <= length-2.\n while ((match = breakRe.exec(line))) {\n next = match.index;\n // maintain invariant: curr - start <= width\n if (next - start > width) {\n end = (curr > start) ? curr : next; // derive end <= length-2\n result += '\\n' + line.slice(start, end);\n // skip the space that was output as \\n\n start = end + 1; // derive start <= length-1\n }\n curr = next;\n }\n\n // By the invariants, start <= length-1, so there is something left over.\n // It is either the whole string or a part starting from non-whitespace.\n result += '\\n';\n // Insert a break if the remainder is too long and there is a break available.\n if (line.length - start > width && curr > start) {\n result += line.slice(start, curr) + '\\n' + line.slice(curr + 1);\n } else {\n result += line.slice(start);\n }\n\n return result.slice(1); // drop extra \\n joiner\n}\n\n// Escapes a double-quoted string.\nfunction escapeString(string) {\n var result = '';\n var char = 0;\n var escapeSeq;\n\n for (var i = 0; i < string.length; char >= 0x10000 ? i += 2 : i++) {\n char = codePointAt(string, i);\n escapeSeq = ESCAPE_SEQUENCES[char];\n\n if (!escapeSeq && isPrintable(char)) {\n result += string[i];\n if (char >= 0x10000) result += string[i + 1];\n } else {\n result += escapeSeq || encodeHex(char);\n }\n }\n\n return result;\n}\n\nfunction writeFlowSequence(state, level, object) {\n var _result = '',\n _tag = state.tag,\n index,\n length,\n value;\n\n for (index = 0, length = object.length; index < length; index += 1) {\n value = object[index];\n\n if (state.replacer) {\n value = state.replacer.call(object, String(index), value);\n }\n\n // Write only valid elements, put null instead of invalid elements.\n if (writeNode(state, level, value, false, false) ||\n (typeof value === 'undefined' &&\n writeNode(state, level, null, false, false))) {\n\n if (_result !== '') _result += ',' + (!state.condenseFlow ? ' ' : '');\n _result += state.dump;\n }\n }\n\n state.tag = _tag;\n state.dump = '[' + _result + ']';\n}\n\nfunction writeBlockSequence(state, level, object, compact) {\n var _result = '',\n _tag = state.tag,\n index,\n length,\n value;\n\n for (index = 0, length = object.length; index < length; index += 1) {\n value = object[index];\n\n if (state.replacer) {\n value = state.replacer.call(object, String(index), value);\n }\n\n // Write only valid elements, put null instead of invalid elements.\n if (writeNode(state, level + 1, value, true, true, false, true) ||\n (typeof value === 'undefined' &&\n writeNode(state, level + 1, null, true, true, false, true))) {\n\n if (!compact || _result !== '') {\n _result += generateNextLine(state, level);\n }\n\n if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {\n _result += '-';\n } else {\n _result += '- ';\n }\n\n _result += state.dump;\n }\n }\n\n state.tag = _tag;\n state.dump = _result || '[]'; // Empty sequence if no valid values.\n}\n\nfunction writeFlowMapping(state, level, object) {\n var _result = '',\n _tag = state.tag,\n objectKeyList = Object.keys(object),\n index,\n length,\n objectKey,\n objectValue,\n pairBuffer;\n\n for (index = 0, length = objectKeyList.length; index < length; index += 1) {\n\n pairBuffer = '';\n if (_result !== '') pairBuffer += ', ';\n\n if (state.condenseFlow) pairBuffer += '\"';\n\n objectKey = objectKeyList[index];\n objectValue = object[objectKey];\n\n if (state.replacer) {\n objectValue = state.replacer.call(object, objectKey, objectValue);\n }\n\n if (!writeNode(state, level, objectKey, false, false)) {\n continue; // Skip this pair because of invalid key;\n }\n\n if (state.dump.length > 1024) pairBuffer += '? ';\n\n pairBuffer += state.dump + (state.condenseFlow ? '\"' : '') + ':' + (state.condenseFlow ? '' : ' ');\n\n if (!writeNode(state, level, objectValue, false, false)) {\n continue; // Skip this pair because of invalid value.\n }\n\n pairBuffer += state.dump;\n\n // Both key and value are valid.\n _result += pairBuffer;\n }\n\n state.tag = _tag;\n state.dump = '{' + _result + '}';\n}\n\nfunction writeBlockMapping(state, level, object, compact) {\n var _result = '',\n _tag = state.tag,\n objectKeyList = Object.keys(object),\n index,\n length,\n objectKey,\n objectValue,\n explicitPair,\n pairBuffer;\n\n // Allow sorting keys so that the output file is deterministic\n if (state.sortKeys === true) {\n // Default sorting\n objectKeyList.sort();\n } else if (typeof state.sortKeys === 'function') {\n // Custom sort function\n objectKeyList.sort(state.sortKeys);\n } else if (state.sortKeys) {\n // Something is wrong\n throw new exception('sortKeys must be a boolean or a function');\n }\n\n for (index = 0, length = objectKeyList.length; index < length; index += 1) {\n pairBuffer = '';\n\n if (!compact || _result !== '') {\n pairBuffer += generateNextLine(state, level);\n }\n\n objectKey = objectKeyList[index];\n objectValue = object[objectKey];\n\n if (state.replacer) {\n objectValue = state.replacer.call(object, objectKey, objectValue);\n }\n\n if (!writeNode(state, level + 1, objectKey, true, true, true)) {\n continue; // Skip this pair because of invalid key.\n }\n\n explicitPair = (state.tag !== null && state.tag !== '?') ||\n (state.dump && state.dump.length > 1024);\n\n if (explicitPair) {\n if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {\n pairBuffer += '?';\n } else {\n pairBuffer += '? ';\n }\n }\n\n pairBuffer += state.dump;\n\n if (explicitPair) {\n pairBuffer += generateNextLine(state, level);\n }\n\n if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {\n continue; // Skip this pair because of invalid value.\n }\n\n if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {\n pairBuffer += ':';\n } else {\n pairBuffer += ': ';\n }\n\n pairBuffer += state.dump;\n\n // Both key and value are valid.\n _result += pairBuffer;\n }\n\n state.tag = _tag;\n state.dump = _result || '{}'; // Empty mapping if no valid pairs.\n}\n\nfunction detectType(state, object, explicit) {\n var _result, typeList, index, length, type, style;\n\n typeList = explicit ? state.explicitTypes : state.implicitTypes;\n\n for (index = 0, length = typeList.length; index < length; index += 1) {\n type = typeList[index];\n\n if ((type.instanceOf || type.predicate) &&\n (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) &&\n (!type.predicate || type.predicate(object))) {\n\n if (explicit) {\n if (type.multi && type.representName) {\n state.tag = type.representName(object);\n } else {\n state.tag = type.tag;\n }\n } else {\n state.tag = '?';\n }\n\n if (type.represent) {\n style = state.styleMap[type.tag] || type.defaultStyle;\n\n if (_toString.call(type.represent) === '[object Function]') {\n _result = type.represent(object, style);\n } else if (_hasOwnProperty.call(type.represent, style)) {\n _result = type.represent[style](object, style);\n } else {\n throw new exception('!<' + type.tag + '> tag resolver accepts not \"' + style + '\" style');\n }\n\n state.dump = _result;\n }\n\n return true;\n }\n }\n\n return false;\n}\n\n// Serializes `object` and writes it to global `result`.\n// Returns true on success, or false on invalid object.\n//\nfunction writeNode(state, level, object, block, compact, iskey, isblockseq) {\n state.tag = null;\n state.dump = object;\n\n if (!detectType(state, object, false)) {\n detectType(state, object, true);\n }\n\n var type = _toString.call(state.dump);\n var inblock = block;\n var tagStr;\n\n if (block) {\n block = (state.flowLevel < 0 || state.flowLevel > level);\n }\n\n var objectOrArray = type === '[object Object]' || type === '[object Array]',\n duplicateIndex,\n duplicate;\n\n if (objectOrArray) {\n duplicateIndex = state.duplicates.indexOf(object);\n duplicate = duplicateIndex !== -1;\n }\n\n if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) {\n compact = false;\n }\n\n if (duplicate && state.usedDuplicates[duplicateIndex]) {\n state.dump = '*ref_' + duplicateIndex;\n } else {\n if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {\n state.usedDuplicates[duplicateIndex] = true;\n }\n if (type === '[object Object]') {\n if (block && (Object.keys(state.dump).length !== 0)) {\n writeBlockMapping(state, level, state.dump, compact);\n if (duplicate) {\n state.dump = '&ref_' + duplicateIndex + state.dump;\n }\n } else {\n writeFlowMapping(state, level, state.dump);\n if (duplicate) {\n state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;\n }\n }\n } else if (type === '[object Array]') {\n if (block && (state.dump.length !== 0)) {\n if (state.noArrayIndent && !isblockseq && level > 0) {\n writeBlockSequence(state, level - 1, state.dump, compact);\n } else {\n writeBlockSequence(state, level, state.dump, compact);\n }\n if (duplicate) {\n state.dump = '&ref_' + duplicateIndex + state.dump;\n }\n } else {\n writeFlowSequence(state, level, state.dump);\n if (duplicate) {\n state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;\n }\n }\n } else if (type === '[object String]') {\n if (state.tag !== '?') {\n writeScalar(state, state.dump, level, iskey, inblock);\n }\n } else if (type === '[object Undefined]') {\n return false;\n } else {\n if (state.skipInvalid) return false;\n throw new exception('unacceptable kind of an object to dump ' + type);\n }\n\n if (state.tag !== null && state.tag !== '?') {\n // Need to encode all characters except those allowed by the spec:\n //\n // [35] ns-dec-digit ::= [#x30-#x39] /* 0-9 */\n // [36] ns-hex-digit ::= ns-dec-digit\n // | [#x41-#x46] /* A-F */ | [#x61-#x66] /* a-f */\n // [37] ns-ascii-letter ::= [#x41-#x5A] /* A-Z */ | [#x61-#x7A] /* a-z */\n // [38] ns-word-char ::= ns-dec-digit | ns-ascii-letter | \u201C-\u201D\n // [39] ns-uri-char ::= \u201C%\u201D ns-hex-digit ns-hex-digit | ns-word-char | \u201C#\u201D\n // | \u201C;\u201D | \u201C/\u201D | \u201C?\u201D | \u201C:\u201D | \u201C@\u201D | \u201C&\u201D | \u201C=\u201D | \u201C+\u201D | \u201C$\u201D | \u201C,\u201D\n // | \u201C_\u201D | \u201C.\u201D | \u201C!\u201D | \u201C~\u201D | \u201C*\u201D | \u201C'\u201D | \u201C(\u201D | \u201C)\u201D | \u201C[\u201D | \u201C]\u201D\n //\n // Also need to encode '!' because it has special meaning (end of tag prefix).\n //\n tagStr = encodeURI(\n state.tag[0] === '!' ? state.tag.slice(1) : state.tag\n ).replace(/!/g, '%21');\n\n if (state.tag[0] === '!') {\n tagStr = '!' + tagStr;\n } else if (tagStr.slice(0, 18) === 'tag:yaml.org,2002:') {\n tagStr = '!!' + tagStr.slice(18);\n } else {\n tagStr = '!<' + tagStr + '>';\n }\n\n state.dump = tagStr + ' ' + state.dump;\n }\n }\n\n return true;\n}\n\nfunction getDuplicateReferences(object, state) {\n var objects = [],\n duplicatesIndexes = [],\n index,\n length;\n\n inspectNode(object, objects, duplicatesIndexes);\n\n for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {\n state.duplicates.push(objects[duplicatesIndexes[index]]);\n }\n state.usedDuplicates = new Array(length);\n}\n\nfunction inspectNode(object, objects, duplicatesIndexes) {\n var objectKeyList,\n index,\n length;\n\n if (object !== null && typeof object === 'object') {\n index = objects.indexOf(object);\n if (index !== -1) {\n if (duplicatesIndexes.indexOf(index) === -1) {\n duplicatesIndexes.push(index);\n }\n } else {\n objects.push(object);\n\n if (Array.isArray(object)) {\n for (index = 0, length = object.length; index < length; index += 1) {\n inspectNode(object[index], objects, duplicatesIndexes);\n }\n } else {\n objectKeyList = Object.keys(object);\n\n for (index = 0, length = objectKeyList.length; index < length; index += 1) {\n inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);\n }\n }\n }\n }\n}\n\nfunction dump$1(input, options) {\n options = options || {};\n\n var state = new State(options);\n\n if (!state.noRefs) getDuplicateReferences(input, state);\n\n var value = input;\n\n if (state.replacer) {\n value = state.replacer.call({ '': value }, '', value);\n }\n\n if (writeNode(state, 0, value, true, true)) return state.dump + '\\n';\n\n return '';\n}\n\nvar dump_1 = dump$1;\n\nvar dumper = {\n\tdump: dump_1\n};\n\nfunction renamed(from, to) {\n return function () {\n throw new Error('Function yaml.' + from + ' is removed in js-yaml 4. ' +\n 'Use yaml.' + to + ' instead, which is now safe by default.');\n };\n}\n\n\nvar Type = type;\nvar Schema = schema;\nvar FAILSAFE_SCHEMA = failsafe;\nvar JSON_SCHEMA = json;\nvar CORE_SCHEMA = core;\nvar DEFAULT_SCHEMA = _default;\nvar load = loader.load;\nvar loadAll = loader.loadAll;\nvar dump = dumper.dump;\nvar YAMLException = exception;\n\n// Re-export all types in case user wants to create custom schema\nvar types = {\n binary: binary,\n float: float,\n map: map,\n null: _null,\n pairs: pairs,\n set: set,\n timestamp: timestamp,\n bool: bool,\n int: int,\n merge: merge,\n omap: omap,\n seq: seq,\n str: str\n};\n\n// Removed functions from JS-YAML 3.0.x\nvar safeLoad = renamed('safeLoad', 'load');\nvar safeLoadAll = renamed('safeLoadAll', 'loadAll');\nvar safeDump = renamed('safeDump', 'dump');\n\nvar jsYaml = {\n\tType: Type,\n\tSchema: Schema,\n\tFAILSAFE_SCHEMA: FAILSAFE_SCHEMA,\n\tJSON_SCHEMA: JSON_SCHEMA,\n\tCORE_SCHEMA: CORE_SCHEMA,\n\tDEFAULT_SCHEMA: DEFAULT_SCHEMA,\n\tload: load,\n\tloadAll: loadAll,\n\tdump: dump,\n\tYAMLException: YAMLException,\n\ttypes: types,\n\tsafeLoad: safeLoad,\n\tsafeLoadAll: safeLoadAll,\n\tsafeDump: safeDump\n};\n\nexport { CORE_SCHEMA, DEFAULT_SCHEMA, FAILSAFE_SCHEMA, JSON_SCHEMA, Schema, Type, YAMLException, jsYaml as default, dump, load, loadAll, safeDump, safeLoad, safeLoadAll, types };\n", "import YAML from \"js-yaml\";\n\nexport const randomHexColorsList: string[] = [\n\t'#10b981', // Emerald\n\t'#f59e0b', // Amber\n\t'#06b6d4', // Cyan\n\t'#ec4899', // Pink\n\t'#8b5cf6', // Violet\n\t'#3b82f6', // Blue\n\t'#f43f5e', // Rose\n\t'#84cc16', // Lime\n\t'#a855f7', // Purple\n\t'#6366f1' // Indigo \n];\n\nexport function shuffle<T>(array: T[]): T[] {\n\tlet currentIndex = array.length, randomIndex: number;\n\twhile (currentIndex !== 0) {\n\t\trandomIndex = Math.floor(Math.random() * currentIndex);\n\t\tcurrentIndex--;\n\t\t[array[currentIndex], array[randomIndex]] = [array[randomIndex], array[currentIndex]];\n\t}\n\treturn array;\n}\n\nexport const hash = (str: string, seed = 0): string => {\n\tlet h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;\n\tfor (let i = 0, ch; i < str.length; i++) {\n\t\tch = str.charCodeAt(i);\n\t\th1 = Math.imul(h1 ^ ch, 265443561);\n\t\th2 = Math.imul(h2 ^ ch, 159334677);\n\t}\n\n\th1 = Math.imul(h1 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h2 ^ (h2 >>> 13), 3266489909);\n\th2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507) ^ Math.imul(h1 ^ (h1 >>> 13), 3266489909);\n\treturn (4294967296 * (2009751 & h2) + (h1 >>> 0)).toString();\n}\n\nexport function escapeHtml(s: string) {\n\treturn s.replace(/[&<>\"']/g, m => (\n\t\tm === '&' ? '&' :\n\t\tm === '<' ? '<' :\n\t\tm === '>' ? '>' :\n\t\tm === '\"' ? '"' : '''\n\t));\n}\n\nexport function parseYamlAssets(yamlText: string): unknown {\n\ttry {\n\t\treturn YAML.load(yamlText);\n\t} catch (err) {\n\t\tthrow new Error(\n\t\t\t`Invalid YAML assets:\\n${err instanceof Error ? err.message : String(err)}`\n\t\t);\n\t}\n}\n\nexport function isString(v: unknown): v is string {\n\treturn typeof v === \"string\";\n}\n\nexport function isNumber(v: unknown): v is number {\n\treturn typeof v === \"number\";\n}\n\nexport function looksLikeTime(s: string): boolean {\n\t// Accept mm:ss or hh:mm:ss (not strict bounds validation)\n\treturn /^(\\d{1,2}:)?\\d{1,2}:\\d{2}$/.test(s);\n}\n\nexport function typeOf(v: unknown): string {\n\tif (v === null) return \"null\";\n\tif (Array.isArray(v)) return \"array\";\n\treturn typeof v;\n}\n\nexport function isPlainObject(v: unknown): v is Record<string, unknown> {\n\treturn (\n\t\ttypeof v === \"object\" &&\n\t\tv !== null &&\n\t\t(Object.getPrototypeOf(v) === Object.prototype ||\n\t\tObject.getPrototypeOf(v) === null)\n\t);\n}\n\nexport function splitByPipes(input: string): string[] {\n\treturn input.split(\"|\").map(s => s.trim()).filter(Boolean);\n}\n\nexport const dedupe = <T,>(arr: T[]) => [...new Set(arr)];\n\nexport function isOneOf<const T extends readonly string[]>(\n\tvalue: string,\n\tallowed: T\n): value is T[number] {\n\treturn (allowed as readonly string[]).includes(value);\n}\n", "import CSS from \"./styles.css\";\n\nimport { \n\tTableConfiguration, \n\tTableState, \n\tCellValue, \n\tCellKind, \n\tCellGradingState,\n\tTableCompletion, \n\tRowValues, \n\tEduTableChangeDetail \n} from \"../../types/Tables\"; \n\nimport { EduInput } from \"../../ui/input/input\";\n\nimport { shuffle, hash, escapeHtml } from \"../../shared/utils\";\n\ntype EduTableElement = HTMLElement & {\n\tconfig: TableConfiguration;\n\n\tgetValue(): TableState;\n\tsetValue(next: TableState): void;\n\n\tgetState(): TableCompletion;\n\n\treset(): void;\n}\n\nfunction escapeAttr(s: string) { return escapeHtml(s); }\n\nexport class EduTable extends HTMLElement implements EduTableElement {\n\t\n\tprivate _config: TableConfiguration;\n\tprivate _state: TableState = {};\n\tprivate _mounted = false;\n\n\tstatic get observedAttributes() { \n\t\treturn [\"variant\"]; \n\t}\n\n\tprivate $wrapEl!: HTMLElement;\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.attachShadow({ mode: 'open' });\n\n\t\tconst wrap = document.createElement(\"section\");\n\t\twrap.className = \"wrap\";\n\t\tthis.shadowRoot.append(wrap);\n\n\t\tthis.$wrapEl = wrap;\n\t}\n\n\tconnectedCallback() {\n\t\tthis._mounted = true;\n\t\tthis.shadowRoot?.addEventListener('change', this.onChange);\n\t\tthis.shadowRoot?.addEventListener('input', this.onInput);\n\t\tthis.render();\n\t}\n\t\n\tdisconnectedCallback() {\n\t\tthis._mounted = false;\n\t}\n\n\tset config(v: TableConfiguration) {\n\t\tthis._config = v;\n\t\tthis._state = this.initState(v);\n\t\tif (v.variant) this.setAttribute('variant', v.variant);\n\t\tthis.render();\n\t}\n\n\tget config() {\n\t\tif (!this._config) throw new Error('<edu-table>: spec not set');\n\t\treturn this._config;\n\t}\n\n\tget value() { return this._state; }\n\tset value(v: TableState) { this._state = v; this.render(); }\n\n\tgetValue() { return this._state; }\n\tsetValue(next: TableState) { this._state = next; this.render(); }\n\t\n\tgetState(): TableCompletion {\n\t\tconst config = this._config;\n\t\tif (!config) return {} as TableCompletion;\n\n\t\tconst completion: TableCompletion = {};\n\n\t\tfor (const r of config.rows) {\n\t\t\tconst rowVals = this._state[r] ?? {}; \n\t\t\tconst selectedCols: string[] = [];\n\n\t\t\tfor (const c of config.cols) {\n\t\t\t\tconst v = rowVals[c] ?? null;\n\t\t\t\t\n\t\t\t\tif ((config.cellKind === 'checkbox' || config.cellKind === 'radio') && v === true) {\n\t\t\t\t\tselectedCols.push(c);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcompletion[r] = {\n\t\t\t\tselectedCols,\n\t\t\t\tvalues: { ...rowVals }\n\t\t\t};\n\t\t}\n\n\t\treturn completion;\n\t}\n\n\tattributeChangedCallback(name: string, oldValue: string, newValue: string) {\n\t\tif (oldValue === newValue) return;\n\n\t\tif (name === 'variant') {\n\t\t\tthis.setAttribute('variant', newValue);\n\t\t\tthis.$wrapEl.querySelectorAll('edu-input').forEach((e: EduInput) => {\n\t\t\t\te.setAttribute('variant', newValue);\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate initState(config: TableConfiguration): TableState {\n\t\tconst state: TableState = {}\n\n\t\tfor (const r of config.rows) {\n\t\t\tstate[r] = {};\n\t\t\tfor (const c of config.cols) {\n\t\t\t\tswitch (config.cellKind) {\n\t\t\t\t\tcase 'checkbox':\n\t\t\t\t\tcase 'radio': \n\t\t\t\t\t\tstate[r][c] = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'select':\n\t\t\t\t\tcase 'text':\n\t\t\t\t\tcase 'number':\n\t\t\t\t\t\tstate[r][c] = null;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn state;\n\t}\n\n\tprivate render() {\n\t\tif (!this._mounted || !this.shadowRoot) return;\n\n\t\tif (!this._config) {\n\t\t\tthis.$wrapEl.innerHTML = `<style>:host{display:block}</style><div></div>`;\n\t\t\treturn;\n\t\t}\n\n\t\tconst config = this._config;\n\t\t\n\t\tconst cols = config.shuffle ? shuffle(config.cols) : config.cols; \n\t\tconst header = `\n\t\t\t<tr>\n\t\t\t\t<th></th>\n\t\t\t\t${cols.map(c => `<th scope=\"col\">${escapeHtml(c)}</th>`).join('')}\n\t\t\t</tr>\n\t\t`;\n\t\t\n\t\tconst rows = config.shuffle ? shuffle(config.rows) : config.rows;\n\t\tconst body = rows.map(r => {\n\t\t\tconst cells = cols.map(c => this.renderCell(config, r, c)).join('');\n\t\t\treturn `<tr><th scope=\"row\">${escapeHtml(r)}</th>${cells}</tr>`;\n\t\t}).join('');\n\n\t\tthis.$wrapEl.innerHTML = `\n\t\t\t<style>${CSS}</style>\n\t\t\t<table part=\"table\">\n\t\t\t\t<thead>${header}</thead>\n\t\t\t\t<tbody>${body}</tbody>\n\t\t\t</table>\n\t\t`;\n\t}\n\n\tprivate renderCell(config: TableConfiguration, r: string, c: string): string {\n\t\tconst disabled = config.disabled?.(r, c) ?? false;\n\t\tif (disabled) return `<td aria-disabled=\"true\" class=\"disabled-cell\"></td>`;\n\n\t\tconst id = `cell-${hash(r)}-${hash(c)}`;\n\t\tconst value = this._state[r]?.[c] ?? null;\n\n\t\tconst gradingState = config.gradingState?.[r]?.[c];\n\t\tconst gradingClass = gradingState ? `cell-${gradingState}` : '';\n\n\t\tconst baseTd = (controlHtml: string) => `<td class=\"${gradingClass}\">${controlHtml}</td>`;\n\t\t\n\t\t// let's play the crazy and forget the variant attribute is being set for the check and radio elements\n\t\tconst common = `id=\"${id}\" data-r=\"${escapeAttr(r)}\" data-c=\"${escapeAttr(c)}\"\n\t\t\taria-label=\"${escapeAttr(`${r} / ${c}`)}\" variant=\"${this.getAttribute(\"variant\")}\" `;\n\n\t\tswitch (config.cellKind) {\n\t\t\tcase 'checkbox': {\n\t\t\t\tconst checked = value === true ? 'checked' : '';\n\t\t\t\treturn baseTd(`<input ${common} type=\"checkbox\" ${checked}/>`);\n\t\t\t}\n\t\t\tcase 'radio': {\n\t\t\t\tconst checked = value === true ? 'checked' : '';\n\t\t\t\treturn baseTd(`<input ${common} type=\"radio\" name=\"row-${hash(r)}\" ${checked}/>`);\n\t\t\t}\n\t\t\tcase 'text': {\n\t\t\t\tconst v = value == null ? '' : String(value);\n\t\t\t\treturn baseTd(`<edu-input ${common} type=\"text\" value=\"${escapeAttr(v)}\"/>`);\n\t\t\t}\n\t\t\tcase 'number': {\n\t\t\t\tconst v = value == null ? '' : String(value);\n\t\t\t\treturn baseTd(`<edu-input ${common} type=\"number\" value=\"${escapeAttr(v)}\"/>`);\n\t\t\t}\n\t\t\tcase 'select': {\n\t\t\t\tconst opts = config.allowed?.(r, c) ?? [];\n\t\t\t\tconst selected = value == null ? '' : String(value);\n\n\t\t\t\tconst optionsHtml = [\n\t\t\t\t\t`<option value=\"\"></option>`,\n\t\t\t\t\t...opts.map(v => {\n\t\t\t\t\t\tconst s = String(v);\n\t\t\t\t\t\tconst sel = s === selected ? 'selected' : '';\n\t\t\t\t\t\treturn `<option value=\"${escapeAttr(s)}\" ${sel}>${escapeHtml(s)}</option>`;\n\t\t\t\t\t})\n\t\t\t\t].join('');\n\n\t\t\t\treturn baseTd(`<edu-input as=\"select\" ${common}>${optionsHtml}</select>`);\n\t\t\t}\n\t\t}\n\t}\n\n\treset() {\n\t\tif (!this._config) return;\n\t\tthis._state = this.initState(this._config);\n\t\tthis.render();\n\n\t\tthis.dispatchEvent(new CustomEvent('reset', {\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\t}\n\n\tsetGradingState(gradingState: CellGradingState) {\n\t\tif (!this._config) return;\n\t\tthis._config.gradingState = gradingState;\n\t\tthis.render();\n\t}\n\n\tclearGradingState() {\n\t\tif (!this._config) return;\n\t\tthis._config.gradingState = undefined;\n\t\tthis.render();\n\t}\n\n\tprivate onChange = (e: Event) => {\n\t\tconst t = e.target as HTMLElement;\n\t\tconst r = t.getAttribute?.('data-r');\n\t\tconst c = t.getAttribute?.('data-c');\n\t\tif (!r || !c || !this._config) return;\n\n\t\tconst kind = this._config.cellKind;\n\n\t\tlet value: CellValue = null;\n\n\t\tif (t instanceof HTMLInputElement) {\n\t\t\tif (kind === 'checkbox') value = t.checked;\n\t\t\telse if (kind === 'radio') value = t.checked;\n\t\t\telse if (kind === 'text') value = t.value;\n\t\t\telse if (kind === 'number') value = t.value === '' ? null : Number(t.value);\n\t\t}\n\t\tif (t instanceof HTMLSelectElement) {\n\t\t\tvalue = t.value === '' ? null : t.value;\n\t\t}\n\n\t\tthis.applyCellValue(r, c, value);\n\t\tthis.emitChange(r, c, value);\n\t};\n\n\tprivate onInput = (e: Event) => {}\n\n\tprivate applyCellValue(r: string, c: string, value: CellValue) {\n\t\tconst config = this._config;\n\t\tif (!config) return;\n\n\t\tif (config.disabled?.(r, c)) return;\n\t\t\n\t\tif (config.cellKind === 'select') {\n\t\t\tconst allowed = config.allowed?.(r, c);\n\t\t\tif (allowed && value !== null && !allowed.some(v => String(v) === String(value))) return;\n\t\t}\n\n\t\tthis._state[r] ??= {};\n\n\t\tif (this._config.cellKind === 'radio' && value === true) {\n\t\t\tfor (const col of this._config.cols) this._state[r][col] = false;\n\t\t\tthis._state[r][c] = true;\n\t\t\treturn;\n\t\t}\n\n\t\tthis._state[r][c] = value;\n\t}\n\n\tprivate emitChange(row: string, col: string, value: CellValue) {\n\t\tconst detail: EduTableChangeDetail = {\n\t\t\trow, \n\t\t\tcol,\n\t\t\tvalue,\n\t\t\tstate: this.getValue(),\n\t\t\tselection: this.getState()\n\t\t};\n\n\t\tthis.dispatchEvent(new CustomEvent<EduTableChangeDetail>('change', {\n\t\t\tdetail,\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\t}\n}\n\nif (!customElements.get('edu-table')) customElements.define('edu-table', EduTable);\n", "import { GrammarParseResult, GrammarParser } from \"../types/Global\";\nimport { TextData, NumberData, SelectData, DateData, TimeData } from \"../types/Input\";\nimport { splitByPipes, dedupe, shuffle, hash } from \"./utils\";\n// ===============================================\n\n// These might be useful\nconst MCQ_PATTERN = /\\[([^\\]]+)\\]/g;\nconst NUMBER_PATTERN = /^\\s*(-?\\d+)\\s*(\\.\\.)\\s*(-?\\d+)\\s*$/;\nconst DATE_PATTERN = /^\\d{4}\\/(0[1-9]|1[0-2])\\/(0[1-9]|[12]\\d|3[01])$/;\nconst TIME_PATTERN = /^([01]\\d|2[0-3]):[0-5]\\d$/;\n\n// =================================================\n\nexport const parseTX: GrammarParser<TextData> = (s: string): GrammarParseResult<TextData> => {\n\n\tconst tokens: string[] = splitByPipes(s);\n\tif (tokens.length === 0 || tokens.some(t => !t)) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\tdata: null,\n\t\t\terrors: { \"@tx\": \"provide at least one non-empty answer.\" } \n\t\t}\n\t}\n\n\tconst value = dedupe(tokens);\n\n\tconst id = `text-${hash(s)}`;\n\t// is there a way to enforce a variant here? Maybe do a replace to the innerHTML in whatever implementation uses this\n\tlet html = `<edu-input type=\"text\" id=\"${id}\" variant=\"outline\" autocomplete=\"off\"></edu-input>`;\n\t\n\treturn {\n\t\tok: true,\n\t\tdata: {\n\t\t\ttype: 'text',\n\t\t\tid,\n\t\t\tvalue,\t\n\t\t\thtml\t\n\t\t},\n\t\terrors: null\n\t}\n\n}\n\nexport const parseSL: GrammarParser<SelectData> = (s: string): GrammarParseResult<SelectData> => {\n\t\t\n\tconst bracketMatches = [...s.matchAll(MCQ_PATTERN)];\n\tconst correctOptions = bracketMatches.flatMap(m => splitByPipes(m[1]));\n\n\tconst cleaned = s.replace(/\\[|\\]/g, \"\");\n\tconst options = [\" \", ...shuffle(dedupe(splitByPipes(cleaned)))];\n\n\tif (options.length === 0) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\tdata: null,\n\t\t\terrors: { \"@sl\": \"provide at least one option for the select.\" }\n\t\t}\n\t} \n\n\tif (correctOptions.length === 0) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\tdata: null,\n\t\t\terrors: { \"@sl\": \"Mark at least one correct option inside of square brackets.\" }\n\t\t}\n\t}\n\n\tconst allOptions = [...options];\n\n\tconst id = `select-${hash(s)}-${Math.random().toString(36).slice(2)}`;\n\n\tconst optsElementsHTML = allOptions.map(o => `<option>${o}</option>`).join(\"\");\n\tconst html = `<edu-input as=\"select\" id=\"${id}\" variant=\"outline\">${optsElementsHTML}</edu-input>`;\n\n\treturn {\n\t\tok: true,\n\t\tdata: {\n\t\t\ttype: \"select\",\n\t\t\tid,\n\t\t\tcorrectOptions,\n\t\t\toptions,\n\t\t\thtml\n\t\t},\n\t\terrors: null\n\t}\n\n}\n\nexport const parseNM: GrammarParser<NumberData> = (s: string): GrammarParseResult<NumberData> => {\n\tconst tokens = splitByPipes(s);\n\tif (tokens.length === 0 || tokens.some(t => !t.trim())) { \n\t\treturn {\n\t\t\tok: false,\n\t\t\tdata: null,\n\t\t\terrors: { \"@nm\": \"provide at least one non-empty option.\" } \n\t\t}\n\t} \n\n\tconst values: number[] = [];\n\tconst ranges: { from: number; to: number }[] = [];\n\n\tfor (const t of tokens) {\n\t\tconst m = t.match(NUMBER_PATTERN);\n\t\tif (m) {\n\t\t\tconst from = parseInt(m[1], 10);\n\t\t\tconst to = parseInt(m[3], 10);\n\t\t\tif (Number.isNaN(from) || Number.isNaN(to) || (from > to)) {\n\t\t\t\treturn {\n\t\t\t\t\tok: false,\n\t\t\t\t\tdata: null,\n\t\t\t\t\terrors: { \"@nm\": \"Invalid range ${t}\" }\n\t\t\t\t}\n\t\t\t}\n\t\t\tranges.push({ from, to });\n\t\t} else {\n\t\t\tconst n = Number(t.trim());\n\t\t\tif (!Number.isInteger(n)) {\n\t\t\t\treturn {\n\t\t\t\t\tok: false,\n\t\t\t\t\tdata: null,\n\t\t\t\t\terrors: { \"@nm\": \"${t} is not an integer.\" }\n\t\t\t\t}\n\t\t\t}\n\t\t\tvalues.push(n);\n\t\t}\n\t}\n\n\tconst id = `number-${hash(s)}-${Math.random().toString(36).slice(2)}`;\n\tconst html = `<edu-input type=\"number\" variant=\"outline\" id=\"${id}\"></edu-input>`;\n\n\treturn {\n\t\tok: true,\n\t\tdata: {\n\t\t\ttype: \"number\",\n\t\t\tid,\n\t\t\ttargets: dedupe(values),\n\t\t\tranges,\n\t\t\thtml\n\t\t},\n\t\terrors: null\n\t}\n}\n\nexport const parseDT: GrammarParser<DateData> = (s: string): GrammarParseResult<DateData> => {\n\tconst tokens = splitByPipes(s);\n\n\tif (tokens.length === 0 || tokens.some(t => !t.trim())) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\tdata: null,\n\t\t\terrors: { \"@dt\": \"provide at least one non-empty date option.\" }\n\t\t}\n\t}\n\n\t// Validate all tokens are valid dates (YYYY/MM/DD format)\n\tconst validDates: string[] = [];\n\tfor (const token of tokens) {\n\t\tconst trimmed = token.trim();\n\t\tif (!DATE_PATTERN.test(trimmed)) {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\tdata: null,\n\t\t\t\terrors: { \"@dt\": `\"${trimmed}\" is not a valid date. Expected format: YYYY/MM/DD` }\n\t\t\t}\n\t\t}\n\t\tvalidDates.push(trimmed);\n\t}\n\n\tconst value = dedupe(validDates);\n\tconst id = `date-${hash(s)}`;\n\tconst html = `<edu-input type=\"date\" id=\"${id}\" variant=\"outline\"></edu-input>`;\n\n\treturn {\n\t\tok: true,\n\t\tdata: {\n\t\t\ttype: 'date',\n\t\t\tid,\n\t\t\tvalue: value[0], // For date, we typically expect one correct value\n\t\t\thtml\n\t\t},\n\t\terrors: null\n\t}\n}\n\nexport const parseTM: GrammarParser<TimeData> = (s: string): GrammarParseResult<TimeData> => {\n\tconst tokens = splitByPipes(s);\n\n\tif (tokens.length === 0 || tokens.some(t => !t.trim())) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\tdata: null,\n\t\t\terrors: { \"@tm\": \"provide at least one non-empty time option.\" }\n\t\t}\n\t}\n\n\t// Validate all tokens are valid times (HH:MM format)\n\tconst validTimes: string[] = [];\n\tfor (const token of tokens) {\n\t\tconst trimmed = token.trim();\n\t\tif (!TIME_PATTERN.test(trimmed)) {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\tdata: null,\n\t\t\t\terrors: { \"@tm\": `\"${trimmed}\" is not a valid time. Expected format: HH:MM (24-hour)` }\n\t\t\t}\n\t\t}\n\t\tvalidTimes.push(trimmed);\n\t}\n\n\tconst value = dedupe(validTimes);\n\tconst id = `time-${hash(s)}`;\n\tconst html = `<edu-input type=\"time\" id=\"${id}\" variant=\"outline\"></edu-input>`;\n\n\treturn {\n\t\tok: true,\n\t\tdata: {\n\t\t\ttype: 'time',\n\t\t\tid,\n\t\t\tvalue: value[0], // For time, we typically expect one correct value\n\t\t\thtml\n\t\t},\n\t\terrors: null\n\t}\n}\n\n// =================================================\n// not really solid I guess\nexport function isInteractionSequential(s: string): boolean {\n\treturn s.split(';;').length > 0;\n}\n\n// same here\nexport function splitByDoubleSemiColon(s: string): string[] {\n\treturn s.trim().split(\";;\");\n}\n", "import { parseTX, parseSL, parseNM, parseDT, parseTM } from \"../../../shared/dsl\";\nimport { splitByDoubleSemiColon } from \"../../../shared/dsl\";\n\nimport { \n\tTextEngineDataUnion,\n\tTextEngineModality, \n\tTextEngineBaseData, \n\tTextEngineBlanksData, \n\tTextEngineClassificationData, \n\tTextEngineSequentialInteractionData \n} from \"../../../types/Text\";\n\nimport { InputElementReference, InputElementData } from \"../../../types/Input\";\nimport { TextEngineBaseDataTarget, TextEngineBlanksDataTarget, TextEngineClassificationDataTarget } from \"../../../types/Text\";\nimport { SimpleErrorObject, ComplexErrorObject, GrammarParser, GrammarParseResult } from \"../../../types/Global\";\n\nconst ELEMENT_REFERENCE = ['tx', 'nm', 'sl', 'dt', 'tm'] as const;\nconst ELEMENT_REFERENCE_MAP = {\n\ttx: parseTX,\n\tnm: parseNM,\n\tsl: parseSL,\n\tdt: parseDT,\n\ttm: parseTM\n}\n\nexport const textEngineBaseGrammarParser: GrammarParser<TextEngineBaseData> = (code: string): GrammarParseResult<TextEngineBaseData> => {\n\n\tconst parts: string[] = [];\n\tconst targets: TextEngineBaseDataTarget[] = [];\n\tconst errors: SimpleErrorObject = {};\n\tlet distractors: string[] | undefined = undefined;\n\n\t// Check for distractors pattern: = [distractor1 | distractor2 | ...];\n\tconst distractorPattern = /^\\s*=\\s*\\[([^\\]]+)\\]\\s*;/m;\n\tconst distractorMatch = code.match(distractorPattern);\n\n\tif (distractorMatch) {\n\t\t// Extract distractors\n\t\tconst distractorContent = distractorMatch[1];\n\t\tdistractors = distractorContent\n\t\t\t.split('|')\n\t\t\t.map(d => d.trim().replace(/^[\"']|[\"']$/g, '')) // Remove quotes if present\n\t\t\t.filter(Boolean);\n\n\t\t// Remove the distractor line from the code\n\t\tcode = code.replace(distractorPattern, '');\n\t}\n\n\tlet currentWord = \"\";\n\tlet inTarget = false;\n\tlet currentTarget: TextEngineBaseDataTarget | null = null;\n\n\tlet i = 0;\n\twhile (i < code.length) {\n\n\t\tconst curr = code[i];\n\n\t\t// Handle escaped brackets [[ -> [\n\t\tif (i + 1 < code.length && curr === \"[\" && code[i + 1] === \"[\") {\n\t\t\tcurrentWord += \"[\";\n\t\t\ti += 2;\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Opening bracket - start a target\n\t\tif (curr === \"[\") {\n\t\t\t// Save any accumulated word before the bracket\n\t\t\tif (currentWord.trim().length > 0) {\n\t\t\t\tparts.push(currentWord.trim());\n\t\t\t\tcurrentWord = \"\";\n\t\t\t}\n\n\t\t\tinTarget = true;\n\t\t\tcurrentTarget = {\n\t\t\t\twords: [],\n\t\t\t\tstartPos: parts.length,\n\t\t\t\tendPos: parts.length\n\t\t\t};\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Closing bracket - end a target\n\t\tif (curr === \"]\") {\n\t\t\tif (!inTarget) {\n\t\t\t\terrors[`at:${i}`] = \"Unexpected closing bracket ']' without matching opening bracket.\";\n\t\t\t\ti++;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Save the last word in the target\n\t\t\tif (currentWord.trim().length > 0) {\n\t\t\t\tconst word = currentWord.trim();\n\t\t\t\tcurrentTarget!.words.push(word);\n\t\t\t\tparts.push(word);\n\t\t\t\tcurrentWord = \"\";\n\t\t\t}\n\n\t\t\t// Finalize the target\n\t\t\tif (currentTarget!.words.length === 0) {\n\t\t\t\terrors[`at:${i}`] = \"Empty brackets [] are not allowed as targets.\";\n\t\t\t} else {\n\t\t\t\tcurrentTarget!.endPos = parts.length - 1;\n\t\t\t\ttargets.push(currentTarget!);\n\t\t\t}\n\n\t\t\tcurrentTarget = null;\n\t\t\tinTarget = false;\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Space/newline/tab - word boundary\n\t\tif (curr === \" \" || curr === \"\\n\" || curr === \"\\t\" || curr === \"\\r\") {\n\t\t\tif (currentWord.trim().length > 0) {\n\t\t\t\tconst word = currentWord.trim();\n\n\t\t\t\tif (inTarget) {\n\t\t\t\t\tcurrentTarget!.words.push(word);\n\t\t\t\t}\n\n\t\t\t\tparts.push(word);\n\t\t\t\tcurrentWord = \"\";\n\t\t\t}\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Regular character\n\t\tcurrentWord += curr;\n\t\ti++;\n\t}\n\n\t// Handle any remaining word\n\tif (currentWord.trim().length > 0) {\n\t\tconst word = currentWord.trim();\n\n\t\tif (inTarget) {\n\t\t\tcurrentTarget!.words.push(word);\n\t\t\tcurrentTarget!.endPos = parts.length;\n\t\t\ttargets.push(currentTarget!);\n\t\t}\n\n\t\tparts.push(word);\n\t}\n\n\t// Check for unclosed brackets\n\tif (inTarget) {\n\t\terrors['unclosed'] = \"Unclosed opening bracket '['. Expected ']'.\";\n\t}\n\n\tconst hasErrors = Object.keys(errors).length > 0;\n\n\treturn {\n\t\tok: !hasErrors,\n\t\tdata: {\n\t\t\ttype: 'base',\n\t\t\tparts,\n\t\t\ttargets,\n\t\t\t...(distractors && { distractors })\n\t\t},\n\t\terrors: hasErrors ? errors : null\n\t}\n\n}\n\n// Blanks parser - parts include words AND generated HTML elements\n// Example: \"I @tx(am) someone\" -> parts: [\"I\", \"<edu-input.../>\", \"someone\"]\nexport const textEngineBlanksGrammarParser: GrammarParser<TextEngineBlanksData> = (code: string): GrammarParseResult<TextEngineBlanksData> => {\n\tconst errors: SimpleErrorObject = {};\n\tconst parts: string[] = [];\n\tconst targets: TextEngineBlanksDataTarget[] = [];\n\n\tlet currentWord = \"\";\n\tlet i = 0;\n\n\twhile (i < code.length) {\n\n\t\tconst curr = code[i];\n\n\t\t// Handle escaped @@ -> @\n\t\tif (i + 1 < code.length && curr === \"@\" && code[i + 1] === \"@\") {\n\t\t\tcurrentWord += \"@\";\n\t\t\ti += 2;\n\t\t\tcontinue;\n\t\t}\n\n\t\t// If not @, check for space or accumulate\n\t\tif (curr !== \"@\") {\n\t\t\t// Space/newline/tab - word boundary\n\t\t\tif (curr === \" \" || curr === \"\\n\" || curr === \"\\t\" || curr === \"\\r\") {\n\t\t\t\tif (currentWord.trim().length > 0) {\n\t\t\t\t\tparts.push(currentWord.trim());\n\t\t\t\t\tcurrentWord = \"\";\n\t\t\t\t}\n\t\t\t\ti++;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Regular character\n\t\t\tcurrentWord += curr;\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\n\t\t// We found an @ - save any accumulated word\n\t\tif (currentWord.trim().length > 0) {\n\t\t\tparts.push(currentWord.trim());\n\t\t\tcurrentWord = \"\";\n\t\t}\n\n\t\tconst currentPos = i;\n\t\ti++; // move past the @\n\n\t\t// Parse the reference (tx, nm, sl, dt, tm)\n\t\tlet ref = \"\";\n\t\twhile (i < code.length && /[a-z]/i.test(code[i])) {\n\t\t\tref += code[i++];\n\t\t}\n\n\t\t// Validate reference\n\t\tif (!ref || !(ELEMENT_REFERENCE as readonly string[]).includes(ref)) {\n\t\t\terrors[`at:${currentPos}`] = `Invalid element reference \"@${ref}\". Expected one of: ${ELEMENT_REFERENCE.join(', ')}.`;\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Expect opening parenthesis\n\t\tif (i >= code.length || code[i] !== \"(\") {\n\t\t\terrors[`at:${currentPos}`] = `Expected '(' after @${ref} at position ${i}.`;\n\t\t\tcontinue;\n\t\t}\n\t\ti++; // move past the (\n\n\t\t// Parse the content inside parentheses\n\t\tlet parenContent = \"\";\n\t\tlet closed = false;\n\t\twhile (i < code.length) {\n\t\t\tif (code[i] === \")\") {\n\t\t\t\tclosed = true;\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tparenContent += code[i++];\n\t\t}\n\n\t\tif (!closed) {\n\t\t\terrors[`at:${currentPos}`] = `Unclosed parenthesis for @${ref}. Expected ')'.`;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst parser: GrammarParser<InputElementData> = ELEMENT_REFERENCE_MAP[ref as keyof typeof ELEMENT_REFERENCE_MAP];\n\n\t\tif (!parser) {\n\t\t\terrors[`at:${currentPos}`] = `No parser found for @${ref}.`;\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Parse the content\n\t\tconst result: GrammarParseResult<InputElementData> = parser(parenContent);\n\n\t\tif (!result.ok) {\n\t\t\terrors[`at:${currentPos}`] = result.errors ? JSON.stringify(result.errors) : `Failed to parse @${ref}(${parenContent})`;\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Add the generated HTML as a single part (NOT split by words)\n\t\tparts.push(result.data!.html);\n\n\t\t// Build the target\n\t\tconst target: TextEngineBlanksDataTarget = {\n\t\t\tid: result.data!.id,\n\t\t\texpectedValue: result.data!\n\t\t};\n\n\t\ttargets.push(target);\n\t}\n\n\t// Add any remaining word\n\tif (currentWord.trim().length > 0) {\n\t\tparts.push(currentWord.trim());\n\t}\n\n\tconst hasErrors = Object.keys(errors).length > 0;\n\n\treturn {\n\t\tok: !hasErrors,\n\t\tdata: {\n\t\t\ttype: \"blanks\",\n\t\t\tparts,\n\t\t\ttargets\n\t\t},\n\t\terrors: hasErrors ? errors : null\n\t}\n}\n\n// Classification parser for @ct(category, word) syntax\n// Splits by words like base parser, tracks which words belong to which categories\nexport const textEngineClassificationGrammarParser: GrammarParser<TextEngineClassificationData> =\n\t(code: string): GrammarParseResult<TextEngineClassificationData> => {\n\n\tconst parts: string[] = [];\n\tconst errors: SimpleErrorObject = {};\n\tconst categoryMap = new Map<string, TextEngineBaseDataTarget[]>();\n\n\tlet currentWord = \"\";\n\tlet i = 0;\n\n\twhile (i < code.length) {\n\t\tconst curr = code[i];\n\n\t\t// Handle escaped @@ -> @\n\t\tif (i + 1 < code.length && curr === \"@\" && code[i + 1] === \"@\") {\n\t\t\tcurrentWord += \"@\";\n\t\t\ti += 2;\n\t\t\tcontinue;\n\t\t}\n\n\t\t// If not @, check for space or accumulate\n\t\tif (curr !== \"@\") {\n\t\t\t// Space/newline/tab - word boundary\n\t\t\tif (curr === \" \" || curr === \"\\n\" || curr === \"\\t\" || curr === \"\\r\") {\n\t\t\t\tif (currentWord.trim().length > 0) {\n\t\t\t\t\tparts.push(currentWord.trim());\n\t\t\t\t\tcurrentWord = \"\";\n\t\t\t\t}\n\t\t\t\ti++;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Regular character\n\t\t\tcurrentWord += curr;\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\n\t\t// We found an @ - save any accumulated word\n\t\tif (currentWord.trim().length > 0) {\n\t\t\tparts.push(currentWord.trim());\n\t\t\tcurrentWord = \"\";\n\t\t}\n\n\t\tconst currentPos = i;\n\t\ti++; // move past the @\n\n\t\t// Parse 'ct'\n\t\tlet ref = \"\";\n\t\twhile (i < code.length && /[a-z]/i.test(code[i])) {\n\t\t\tref += code[i++];\n\t\t}\n\n\t\t// Validate it's 'ct'\n\t\tif (ref !== 'ct') {\n\t\t\terrors[`at:${currentPos}`] = `Invalid reference \"@${ref}\". Expected \"@ct\" for classification.`;\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Expect opening parenthesis\n\t\tif (i >= code.length || code[i] !== \"(\") {\n\t\t\terrors[`at:${currentPos}`] = `Expected '(' after @ct at position ${i}.`;\n\t\t\tcontinue;\n\t\t}\n\t\ti++; // move past the (\n\n\t\t// Parse the content inside parentheses: category, word(s)\n\t\tlet parenContent = \"\";\n\t\tlet closed = false;\n\t\twhile (i < code.length) {\n\t\t\tif (code[i] === \")\") {\n\t\t\t\tclosed = true;\n\t\t\t\ti++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tparenContent += code[i++];\n\t\t}\n\n\t\tif (!closed) {\n\t\t\terrors[`at:${currentPos}`] = `Unclosed parenthesis for @ct. Expected ')'.`;\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Split by comma to get category and word(s)\n\t\tconst commaParts = parenContent.split(',').map(p => p.trim());\n\t\tif (commaParts.length !== 2) {\n\t\t\terrors[`at:${currentPos}`] = `Invalid @ct syntax. Expected: @ct(category, word). Got: @ct(${parenContent})`;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst [category, wordOrPhrase] = commaParts;\n\n\t\tif (!category || !wordOrPhrase) {\n\t\t\terrors[`at:${currentPos}`] = `Category and word cannot be empty in @ct(${parenContent}).`;\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Split the phrase into words (in case it's multi-word like \"tired of\")\n\t\tconst words = wordOrPhrase.split(/\\s+/).filter(Boolean);\n\t\tconst startPos = parts.length;\n\n\t\t// Add all words to parts\n\t\tfor (const word of words) {\n\t\t\tparts.push(word);\n\t\t}\n\n\t\tconst endPos = parts.length - 1;\n\n\t\tconst target: TextEngineBaseDataTarget = {\n\t\t\twords,\n\t\t\tstartPos,\n\t\t\tendPos\n\t\t};\n\n\t\t// Group by category\n\t\tif (!categoryMap.has(category)) {\n\t\t\tcategoryMap.set(category, []);\n\t\t}\n\t\tcategoryMap.get(category)!.push(target);\n\t}\n\n\t// Add any remaining word\n\tif (currentWord.trim().length > 0) {\n\t\tparts.push(currentWord.trim());\n\t}\n\n\t// Convert map to target array\n\tconst targets: TextEngineClassificationDataTarget[] = [];\n\tfor (const [category, categoryTargets] of categoryMap.entries()) {\n\t\ttargets.push({\n\t\t\tcategory,\n\t\t\ttargets: categoryTargets\n\t\t});\n\t}\n\n\tconst hasErrors = Object.keys(errors).length > 0;\n\n\treturn {\n\t\tok: !hasErrors,\n\t\tdata: {\n\t\t\ttype: 'classification',\n\t\t\tparts,\n\t\t\ttargets\n\t\t},\n\t\terrors: hasErrors ? errors : null\n\t}\n}\n\nconst TEXT_ENGINE_PARSER_MAP = {\n\tbase: textEngineBaseGrammarParser,\n\tblanks: textEngineBlanksGrammarParser,\n\tclassification: textEngineClassificationGrammarParser\n}\n\n\n/**\n * Just a bulk caller to the guys who do the real job.\n */ \nexport function parseTextEngineSequential<T extends TextEngineDataUnion>(\n\tcode: string,\n\tmodality: TextEngineModality\n): GrammarParseResult<TextEngineSequentialInteractionData> {\n\n\tconst chunks: string[] = splitByDoubleSemiColon(code);\n\tconst parser: GrammarParser<T> = TEXT_ENGINE_PARSER_MAP[modality] as GrammarParser<T>;\n\n\tconst data: TextEngineSequentialInteractionData = [];\n\tconst errors: SimpleErrorObject[] = [];\n\n\tfor (const chunk of chunks) {\n\n\t\t// We don't know what exact union member the parser will return here as to specify.\n\t\t// We are sure it is a union member and that it will be consistent, but not which one specifically.\n\t\t// The interaction to use this should infer the types of each member of the list as a check out.\n\t\tconst result: GrammarParseResult<T> = parser(chunk);\n\t\tif (!result.ok) {\n\t\t\tif (result.errors) {\n\t\t\t\tif (Array.isArray(result.errors)) {\n\t\t\t\t\terrors.push(...result.errors);\n\t\t\t\t} else {\n\t\t\t\t\terrors.push(result.errors);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\n\t\t// should we validate it beforehands? Or leave it to the interaction as we have been doing?\n\t\tdata.push(result.data as TextEngineDataUnion);\n\t}\n\n\tif (errors.length > 0) return { ok: false, data: null, errors: errors }\n\n\treturn {\n\t\tok: true,\n\t\tdata: data,\n\t\terrors: null\n\t}\n}\n\n\n", "import {\n\tTextEngineBaseData,\n\tTextEngineBlanksData,\n\tTextEngineClassificationData,\n\tTextEngineDataUnion\n} from \"../../../types/Text\";\nimport { ValidationResult } from \"../../../types/Global\";\n\n/**\n * Validates TextEngineBaseData for highlight/DND/transformation interactions\n *\n * Checks:\n * - Parts array is not empty\n * - Targets array is not empty\n * - Each target has valid words, startPos, endPos\n * - Target positions are within bounds of parts array\n * - Target words match parts at specified positions\n * - Distractors (if present) are non-empty and unique\n */\nexport function textEngineBaseDataValidator(data: TextEngineBaseData): ValidationResult {\n\tconst errors: Record<string, string> = {};\n\n\t// Check 1: Parts must exist\n\tif (!data.parts || data.parts.length === 0) {\n\t\terrors['parts.empty'] = 'No parts found. Text must contain at least one word.';\n\t}\n\n\t// Check 2: Targets must exist\n\tif (!data.targets || data.targets.length === 0) {\n\t\terrors['targets.empty'] = 'No targets found. Text must contain at least one [target] to interact with.';\n\t}\n\n\t// Check 3: Validate each target\n\tif (data.targets && data.targets.length > 0 && data.parts && data.parts.length > 0) {\n\t\tfor (let i = 0; i < data.targets.length; i++) {\n\t\t\tconst target = data.targets[i];\n\t\t\tconst prefix = `targets[${i}]`;\n\n\t\t\t// Target must have words\n\t\t\tif (!target.words || target.words.length === 0) {\n\t\t\t\terrors[`${prefix}.words.empty`] = `Target ${i} has no words. Each target must contain at least one word.`;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Validate positions\n\t\t\tif (target.startPos < 0) {\n\t\t\t\terrors[`${prefix}.startPos.negative`] = `Target ${i} has negative startPos (${target.startPos}).`;\n\t\t\t}\n\n\t\t\tif (target.endPos < 0) {\n\t\t\t\terrors[`${prefix}.endPos.negative`] = `Target ${i} has negative endPos (${target.endPos}).`;\n\t\t\t}\n\n\t\t\tif (target.startPos > target.endPos) {\n\t\t\t\terrors[`${prefix}.position.invalid`] =\n\t\t\t\t\t`Target ${i} has startPos (${target.startPos}) greater than endPos (${target.endPos}).`;\n\t\t\t}\n\n\t\t\t// Check if positions are within parts bounds\n\t\t\tif (target.startPos >= data.parts.length) {\n\t\t\t\terrors[`${prefix}.startPos.outOfBounds`] =\n\t\t\t\t\t`Target ${i} startPos (${target.startPos}) is out of bounds (parts length: ${data.parts.length}).`;\n\t\t\t}\n\n\t\t\tif (target.endPos >= data.parts.length) {\n\t\t\t\terrors[`${prefix}.endPos.outOfBounds`] =\n\t\t\t\t\t`Target ${i} endPos (${target.endPos}) is out of bounds (parts length: ${data.parts.length}).`;\n\t\t\t}\n\n\t\t\t// Verify target words match parts at specified positions\n\t\t\tif (target.startPos < data.parts.length && target.endPos < data.parts.length) {\n\t\t\t\tconst expectedWordCount = target.endPos - target.startPos + 1;\n\t\t\t\tif (target.words.length !== expectedWordCount) {\n\t\t\t\t\terrors[`${prefix}.words.countMismatch`] =\n\t\t\t\t\t\t`Target ${i} has ${target.words.length} words but position range indicates ${expectedWordCount} words.`;\n\t\t\t\t}\n\n\t\t\t\t// Check if words match\n\t\t\t\tfor (let j = 0; j < target.words.length; j++) {\n\t\t\t\t\tconst partIndex = target.startPos + j;\n\t\t\t\t\tif (partIndex < data.parts.length) {\n\t\t\t\t\t\tconst expectedWord = data.parts[partIndex];\n\t\t\t\t\t\tconst actualWord = target.words[j];\n\t\t\t\t\t\tif (expectedWord !== actualWord) {\n\t\t\t\t\t\t\terrors[`${prefix}.words[${j}].mismatch`] =\n\t\t\t\t\t\t\t\t`Target ${i} word \"${actualWord}\" doesn't match part at position ${partIndex}: \"${expectedWord}\".`;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Check 4: Validate distractors (if present)\n\tif (data.distractors) {\n\t\tif (!Array.isArray(data.distractors)) {\n\t\t\terrors['distractors.notArray'] = 'Distractors must be an array.';\n\t\t} else {\n\t\t\tif (data.distractors.length === 0) {\n\t\t\t\terrors['distractors.empty'] = 'Distractors array is empty. Remove distractors field or add at least one distractor.';\n\t\t\t}\n\n\t\t\t// Check for duplicates\n\t\t\tconst seen = new Set<string>();\n\t\t\tfor (let i = 0; i < data.distractors.length; i++) {\n\t\t\t\tconst distractor = data.distractors[i];\n\t\t\t\tif (seen.has(distractor)) {\n\t\t\t\t\terrors[`distractors[${i}].duplicate`] = `Duplicate distractor found: \"${distractor}\".`;\n\t\t\t\t}\n\t\t\t\tseen.add(distractor);\n\n\t\t\t\t// Check if distractor is empty\n\t\t\t\tif (!distractor || distractor.trim().length === 0) {\n\t\t\t\t\terrors[`distractors[${i}].empty`] = `Distractor at index ${i} is empty.`;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn Object.keys(errors).length > 0 ? { ok: false, errors } : { ok: true, errors: null };\n}\n\n/**\n * Validates TextEngineBlanksData for fill-in-the-blanks interactions\n *\n * Checks:\n * - Parts array is not empty\n * - Targets array is not empty\n * - Each target has valid id and expectedValue\n * - Expected values have proper structure (InputElementData)\n * - No duplicate target IDs\n */\nexport function textEngineBlanksDataValidator(data: TextEngineBlanksData): ValidationResult {\n\tconst errors: Record<string, string> = {};\n\n\t// Check 1: Parts must exist\n\tif (!data.parts || data.parts.length === 0) {\n\t\terrors['parts.empty'] = 'No parts found. Text must contain at least one part.';\n\t}\n\n\t// Check 2: Targets must exist\n\tif (!data.targets || data.targets.length === 0) {\n\t\terrors['targets.empty'] = 'No targets found. Text must contain at least one input element (@tx, @nm, @sl, @dt, @tm).';\n\t}\n\n\t// Track IDs to detect duplicates\n\tconst seenIds = new Set<string>();\n\n\t// Check 3: Validate each target\n\tif (data.targets && data.targets.length > 0) {\n\t\tfor (let i = 0; i < data.targets.length; i++) {\n\t\t\tconst target = data.targets[i];\n\t\t\tconst prefix = `targets[${i}]`;\n\n\t\t\t// Target must have ID\n\t\t\tif (!target.id || target.id.trim().length === 0) {\n\t\t\t\terrors[`${prefix}.id.empty`] = `Target ${i} has no ID. Each input element must have a unique ID.`;\n\t\t\t} else {\n\t\t\t\t// Check for duplicate IDs\n\t\t\t\tif (seenIds.has(target.id)) {\n\t\t\t\t\terrors[`${prefix}.id.duplicate`] = `Duplicate ID found: \"${target.id}\". Each input element must have a unique ID.`;\n\t\t\t\t}\n\t\t\t\tseenIds.add(target.id);\n\t\t\t}\n\n\t\t\t// Target must have expectedValue\n\t\t\tif (!target.expectedValue) {\n\t\t\t\terrors[`${prefix}.expectedValue.missing`] = `Target ${i} has no expectedValue. Each input element must define expected answer data.`;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst expectedValue = target.expectedValue;\n\n\t\t\t// Validate expectedValue structure\n\t\t\tif (!expectedValue.type) {\n\t\t\t\terrors[`${prefix}.expectedValue.type.missing`] = `Target ${i} expectedValue has no type field.`;\n\t\t\t}\n\n\t\t\tif (!expectedValue.id) {\n\t\t\t\terrors[`${prefix}.expectedValue.id.missing`] = `Target ${i} expectedValue has no id field.`;\n\t\t\t}\n\n\t\t\tif (!expectedValue.html) {\n\t\t\t\terrors[`${prefix}.expectedValue.html.missing`] = `Target ${i} expectedValue has no html field.`;\n\t\t\t}\n\n\t\t\t// Type-specific validation\n\t\t\tconst evType = expectedValue.type;\n\t\t\tif (evType) {\n\t\t\t\tswitch (evType) {\n\t\t\t\t\tcase 'text':\n\t\t\t\t\t\tif (!('value' in expectedValue) || !Array.isArray((expectedValue as any).value)) {\n\t\t\t\t\t\t\terrors[`${prefix}.expectedValue.text.value`] =\n\t\t\t\t\t\t\t\t`Target ${i} is type 'text' but has no valid 'value' array.`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'number':\n\t\t\t\t\t\tif (!('targets' in expectedValue)) {\n\t\t\t\t\t\t\terrors[`${prefix}.expectedValue.number.targets`] =\n\t\t\t\t\t\t\t\t`Target ${i} is type 'number' but has no 'targets' field.`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'select':\n\t\t\t\t\t\tif (!('correctOptions' in expectedValue) || !('options' in expectedValue)) {\n\t\t\t\t\t\t\terrors[`${prefix}.expectedValue.select.options`] =\n\t\t\t\t\t\t\t\t`Target ${i} is type 'select' but is missing 'correctOptions' or 'options' fields.`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'date':\n\t\t\t\t\tcase 'time':\n\t\t\t\t\t\tif (!('value' in expectedValue)) {\n\t\t\t\t\t\t\terrors[`${prefix}.expectedValue.${evType}.value`] =\n\t\t\t\t\t\t\t\t`Target ${i} is type '${evType}' but has no 'value' field.`;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn Object.keys(errors).length > 0 ? { ok: false, errors } : { ok: true, errors: null };\n}\n\n/**\n * Validates TextEngineClassificationData\n *\n * Checks:\n * - Parts array is not empty\n * - Targets array is not empty (at least one category)\n * - Each category target has valid category name and targets array\n * - Category names are unique\n * - Each category has at least one target\n * - Target positions are valid and within bounds\n */\nexport function textEngineClassificationDataValidator(data: TextEngineClassificationData): ValidationResult {\n\tconst errors: Record<string, string> = {};\n\n\t// Check 1: Parts must exist\n\tif (!data.parts || data.parts.length === 0) {\n\t\terrors['parts.empty'] = 'No parts found. Text must contain at least one word.';\n\t}\n\n\t// Check 2: Targets must exist (at least one category)\n\tif (!data.targets || data.targets.length === 0) {\n\t\terrors['targets.empty'] = 'No categories found. Text must contain at least one @ct(category, word) reference.';\n\t}\n\n\t// Track category names to detect duplicates\n\tconst seenCategories = new Set<string>();\n\n\t// Check 3: Validate each category\n\tif (data.targets && data.targets.length > 0) {\n\t\tfor (let i = 0; i < data.targets.length; i++) {\n\t\t\tconst categoryTarget = data.targets[i];\n\t\t\tconst prefix = `targets[${i}]`;\n\n\t\t\t// Category must have a name\n\t\t\tif (!categoryTarget.category || categoryTarget.category.trim().length === 0) {\n\t\t\t\terrors[`${prefix}.category.empty`] = `Category ${i} has no name.`;\n\t\t\t} else {\n\t\t\t\t// Check for duplicate category names\n\t\t\t\tif (seenCategories.has(categoryTarget.category)) {\n\t\t\t\t\terrors[`${prefix}.category.duplicate`] =\n\t\t\t\t\t\t`Duplicate category found: \"${categoryTarget.category}\". Each category must have a unique name.`;\n\t\t\t\t}\n\t\t\t\tseenCategories.add(categoryTarget.category);\n\t\t\t}\n\n\t\t\t// Category must have targets\n\t\t\tif (!categoryTarget.targets || categoryTarget.targets.length === 0) {\n\t\t\t\terrors[`${prefix}.targets.empty`] =\n\t\t\t\t\t`Category \"${categoryTarget.category}\" has no targets. Each category must contain at least one word.`;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Validate each target within the category\n\t\t\tfor (let j = 0; j < categoryTarget.targets.length; j++) {\n\t\t\t\tconst target = categoryTarget.targets[j];\n\t\t\t\tconst targetPrefix = `${prefix}.targets[${j}]`;\n\n\t\t\t\t// Target must have words\n\t\t\t\tif (!target.words || target.words.length === 0) {\n\t\t\t\t\terrors[`${targetPrefix}.words.empty`] =\n\t\t\t\t\t\t`Category \"${categoryTarget.category}\" target ${j} has no words.`;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Validate positions\n\t\t\t\tif (target.startPos < 0) {\n\t\t\t\t\terrors[`${targetPrefix}.startPos.negative`] =\n\t\t\t\t\t\t`Category \"${categoryTarget.category}\" target ${j} has negative startPos.`;\n\t\t\t\t}\n\n\t\t\t\tif (target.endPos < 0) {\n\t\t\t\t\terrors[`${targetPrefix}.endPos.negative`] =\n\t\t\t\t\t\t`Category \"${categoryTarget.category}\" target ${j} has negative endPos.`;\n\t\t\t\t}\n\n\t\t\t\tif (target.startPos > target.endPos) {\n\t\t\t\t\terrors[`${targetPrefix}.position.invalid`] =\n\t\t\t\t\t\t`Category \"${categoryTarget.category}\" target ${j} has startPos greater than endPos.`;\n\t\t\t\t}\n\n\t\t\t\t// Check if positions are within parts bounds\n\t\t\t\tif (data.parts && data.parts.length > 0) {\n\t\t\t\t\tif (target.startPos >= data.parts.length) {\n\t\t\t\t\t\terrors[`${targetPrefix}.startPos.outOfBounds`] =\n\t\t\t\t\t\t\t`Category \"${categoryTarget.category}\" target ${j} startPos is out of bounds.`;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (target.endPos >= data.parts.length) {\n\t\t\t\t\t\terrors[`${targetPrefix}.endPos.outOfBounds`] =\n\t\t\t\t\t\t\t`Category \"${categoryTarget.category}\" target ${j} endPos is out of bounds.`;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Verify words match parts\n\t\t\t\t\tif (target.startPos < data.parts.length && target.endPos < data.parts.length) {\n\t\t\t\t\t\tconst expectedWordCount = target.endPos - target.startPos + 1;\n\t\t\t\t\t\tif (target.words.length !== expectedWordCount) {\n\t\t\t\t\t\t\terrors[`${targetPrefix}.words.countMismatch`] =\n\t\t\t\t\t\t\t\t`Category \"${categoryTarget.category}\" target ${j} word count mismatch.`;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn Object.keys(errors).length > 0 ? { ok: false, errors } : { ok: true, errors: null };\n}\n\n/**\n * Unified validator that routes to the appropriate validator based on data type\n */\nexport function textEngineDataValidator(data: TextEngineDataUnion): ValidationResult {\n\tswitch (data.type) {\n\t\tcase 'base':\n\t\t\treturn textEngineBaseDataValidator(data);\n\t\tcase 'blanks':\n\t\t\treturn textEngineBlanksDataValidator(data);\n\t\tcase 'classification':\n\t\t\treturn textEngineClassificationDataValidator(data);\n\t\tdefault:\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\terrors: { 'type.invalid': `Unknown text engine type: ${(data as any).type}` }\n\t\t\t};\n\t}\n}\n", "import {\n\tTextEngineBaseData,\n\tTextEngineBlanksData,\n\tTextEngineClassificationData,\n\tTextEngineBaseDataTarget\n} from \"../../../types/Text\";\nimport { InputElementData } from \"../../../types/Input\";\nimport { GradingResult, GradingState } from \"../../../types/Grading\";\n\n// ==================== USER DATA TYPES ====================\n\n/**\n * User data for base interactions (highlight, DND, transformation)\n */\nexport type TextEngineBaseUserData = {\n\t// For highlight: indices of selected words in parts array\n\tselectedIndices?: number[];\n\n\t// For DND: indices of words placed in target positions\n\tplacedIndices?: number[];\n\n\t// For DND: exact word dropped in each target position\n\tdndPlacements?: Record<number, string>;\n\n\t// For transformation: edited text for each target\n\ttransformations?: Record<number, string[]>; // target index -> transformed words\n};\n\n/**\n * User data for blanks interactions (fill-in-the-blanks)\n */\nexport type TextEngineBlanksUserData = {\n\t// Input values keyed by input element ID\n\tinputValues: Record<string, any>;\n};\n\n/**\n * User data for classification interactions\n */\nexport type TextEngineClassificationUserData = {\n\t// Word assignments: word index in parts array -> category name\n\twordCategories: Record<number, string>;\n};\n\n// ==================== GRADING STATE TYPES ====================\nexport type TextEngineBaseGradingState = Record<number, GradingState>; // target index -> state\nexport type TextEngineBlanksGradingState = Record<string, GradingState>; // input ID -> state\nexport type TextEngineClassificationGradingState = Record<number, GradingState>; // word index -> state\n\n// ==================== BASE GRADERS ====================\n\n/**\n * Grade highlight interaction\n * User must select all and only the target words\n */\nexport function textEngineHighlightGrader(\n\tdata: TextEngineBaseData,\n\tuserData: TextEngineBaseUserData\n): GradingResult {\n\tconst selectedIndices = new Set(userData.selectedIndices ?? []);\n\tconst targetIndices = new Set<number>();\n\n\t// Collect all indices that should be selected\n\tfor (const target of data.targets) {\n\t\tfor (let i = target.startPos; i <= target.endPos; i++) {\n\t\t\ttargetIndices.add(i);\n\t\t}\n\t}\n\n\tlet correctCount = 0; // true positives\n\tlet wrongCount = 0; // false positives\n\tlet missedCount = 0; // false negatives\n\n\t// Check each position in parts\n\tfor (let i = 0; i < data.parts.length; i++) {\n\t\tconst shouldBeSelected = targetIndices.has(i);\n\t\tconst isSelected = selectedIndices.has(i);\n\n\t\tif (shouldBeSelected && isSelected) {\n\t\t\tcorrectCount++;\n\t\t} else if (shouldBeSelected && !isSelected) {\n\t\t\tmissedCount++;\n\t\t} else if (!shouldBeSelected && isSelected) {\n\t\t\twrongCount++;\n\t\t}\n\t}\n\n\tconst total = targetIndices.size;\n\n\t// Precision/Recall balance:\n\t// - Prevents \"select all words = 100%\"\n\t// - Still allows free selection without hard caps\n\tconst precision = (correctCount + wrongCount) > 0\n\t\t? correctCount / (correctCount + wrongCount)\n\t\t: 0;\n\tconst recall = (correctCount + missedCount) > 0\n\t\t? correctCount / (correctCount + missedCount)\n\t\t: 0;\n\tconst f1 = (precision + recall) > 0\n\t\t? (2 * precision * recall) / (precision + recall)\n\t\t: 0;\n\tconst score = Math.round(f1 * 100);\n\n\treturn { score, correct: correctCount, total };\n}\n\n/**\n * Grade DND (drag and drop) interaction\n * User must place target words in correct positions\n */\nexport function textEngineDNDGrader(\n\tdata: TextEngineBaseData,\n\tuserData: TextEngineBaseUserData\n): GradingResult {\n\tconst targetIndices = new Set<number>();\n\tconst placements = userData.dndPlacements ?? {};\n\n\t// Collect all indices that should be placed\n\tfor (const target of data.targets) {\n\t\tfor (let i = target.startPos; i <= target.endPos; i++) {\n\t\t\ttargetIndices.add(i);\n\t\t}\n\t}\n\n\tlet correctCount = 0;\n\tconst hasPlacementMap = Object.keys(placements).length > 0;\n\n\tif (hasPlacementMap) {\n\t\t// Strict grading: placement must match the expected word at that index.\n\t\tfor (const index of targetIndices) {\n\t\t\tconst expected = data.parts[index];\n\t\t\tconst actual = placements[index];\n\n\t\t\tif (!actual) continue;\n\t\t\tif (normalize(actual) === normalize(expected)) {\n\t\t\t\tcorrectCount++;\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// Backward-compatible fallback for older user state shape.\n\t\tconst placedIndices = new Set(userData.placedIndices ?? []);\n\t\tfor (const index of placedIndices) {\n\t\t\tif (targetIndices.has(index)) {\n\t\t\t\tcorrectCount++;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst total = targetIndices.size;\n\tconst score = total > 0 ? Math.round((correctCount / total) * 100) : 0;\n\n\treturn { score, correct: correctCount, total };\n}\n\nexport function getDNDGradingState(\n\tdata: TextEngineBaseData,\n\tuserData: TextEngineBaseUserData\n): TextEngineBaseGradingState {\n\tconst gradingState: TextEngineBaseGradingState = {};\n\tconst placements = userData.dndPlacements ?? {};\n\n\tfor (const target of data.targets) {\n\t\tfor (let i = target.startPos; i <= target.endPos; i++) {\n\t\t\tconst expected = data.parts[i];\n\t\t\tconst actual = placements[i];\n\n\t\t\tif (!actual) {\n\t\t\t\tgradingState[i] = 'missed';\n\t\t\t} else if (normalize(actual) === normalize(expected)) {\n\t\t\t\tgradingState[i] = 'correct';\n\t\t\t} else {\n\t\t\t\tgradingState[i] = 'wrong';\n\t\t\t}\n\t\t}\n\t}\n\n\treturn gradingState;\n}\n\n/**\n * Grade transformation interaction\n * User must transform target text correctly\n * Comparison is case-insensitive and trimmed\n */\nexport function textEngineTransformationGrader(\n\tdata: TextEngineBaseData,\n\tuserData: TextEngineBaseUserData,\n\texpectedTransformations: Record<number, string[]> // target index -> expected transformed words\n): GradingResult {\n\tconst userTransformations = userData.transformations ?? {};\n\n\tlet correctCount = 0;\n\tlet totalCount = 0;\n\n\tfor (let i = 0; i < data.targets.length; i++) {\n\t\tconst expected = expectedTransformations[i];\n\t\tconst actual = userTransformations[i];\n\n\t\tif (!expected) continue;\n\n\t\ttotalCount++;\n\n\t\tif (!actual) continue;\n\n\t\t// Compare arrays (case-insensitive, trimmed)\n\t\tif (expected.length === actual.length) {\n\t\t\tconst matches = expected.every((word, j) =>\n\t\t\t\tword.toLowerCase().trim() === (actual[j] || '').toLowerCase().trim()\n\t\t\t);\n\n\t\t\tif (matches) {\n\t\t\t\tcorrectCount++;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst score = totalCount > 0 ? Math.round((correctCount / totalCount) * 100) : 0;\n\n\treturn { score, correct: correctCount, total: totalCount };\n}\n\n/**\n * Generate per-target grading state for transformation interaction\n */\nexport function getTransformationGradingState(\n\tdata: TextEngineBaseData,\n\tuserData: TextEngineBaseUserData,\n\texpectedTransformations: Record<number, string[]>\n): TextEngineBaseGradingState {\n\tconst userTransformations = userData.transformations ?? {};\n\tconst gradingState: TextEngineBaseGradingState = {};\n\n\tfor (let i = 0; i < data.targets.length; i++) {\n\t\tconst expected = expectedTransformations[i];\n\t\tconst actual = userTransformations[i];\n\n\t\tif (!expected) {\n\t\t\tgradingState[i] = 'missed';\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!actual || actual.length === 0) {\n\t\t\tgradingState[i] = 'missed';\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Compare arrays (case-insensitive, trimmed)\n\t\tif (expected.length === actual.length) {\n\t\t\tconst matches = expected.every((word, j) =>\n\t\t\t\tword.toLowerCase().trim() === (actual[j] || '').toLowerCase().trim()\n\t\t\t);\n\t\t\tgradingState[i] = matches ? 'correct' : 'wrong';\n\t\t} else {\n\t\t\tgradingState[i] = 'wrong';\n\t\t}\n\t}\n\n\treturn gradingState;\n}\n\n/**\n * Generate per-target grading state for highlight interaction\n */\nexport function getHighlightGradingState(\n\tdata: TextEngineBaseData,\n\tuserData: TextEngineBaseUserData\n): TextEngineBaseGradingState {\n\tconst selectedIndices = new Set(userData.selectedIndices ?? []);\n\tconst targetIndices = new Set<number>();\n\tconst gradingState: TextEngineBaseGradingState = {};\n\n\tfor (const target of data.targets) {\n\t\tfor (let i = target.startPos; i <= target.endPos; i++) {\n\t\t\ttargetIndices.add(i);\n\t\t}\n\t}\n\n\t// Mark word-level grading states:\n\t// - selected target word => correct\n\t// - missed target word => missed\n\t// - selected non-target word => wrong\n\tfor (let i = 0; i < data.parts.length; i++) {\n\t\tconst isTarget = targetIndices.has(i);\n\t\tconst isSelected = selectedIndices.has(i);\n\n\t\tif (isTarget && isSelected) gradingState[i] = 'correct';\n\t\telse if (isTarget && !isSelected) gradingState[i] = 'missed';\n\t\telse if (!isTarget && isSelected) gradingState[i] = 'wrong';\n\t}\n\n\treturn gradingState;\n}\n\n// ==================== BLANKS GRADER ====================\n\n/**\n * Grade fill-in-the-blanks interaction\n * Compares user input values against expected values for each input element\n */\nexport function textEngineBlanksGrader(\n\tdata: TextEngineBlanksData,\n\tuserData: TextEngineBlanksUserData\n): GradingResult {\n\tlet correctCount = 0;\n\tlet totalCount = data.targets.length;\n\n\tfor (const target of data.targets) {\n\t\tconst userValue = userData.inputValues[target.id];\n\t\tconst expected = target.expectedValue;\n\n\t\tif (compareInputValue(expected, userValue)) {\n\t\t\tcorrectCount++;\n\t\t}\n\t}\n\n\tconst score = totalCount > 0 ? Math.round((correctCount / totalCount) * 100) : 0;\n\n\treturn { score, correct: correctCount, total: totalCount };\n}\n\n/**\n * Generate per-input grading state for blanks interaction\n */\nexport function getBlanksGradingState(\n\tdata: TextEngineBlanksData,\n\tuserData: TextEngineBlanksUserData\n): TextEngineBlanksGradingState {\n\tconst gradingState: TextEngineBlanksGradingState = {};\n\n\tfor (const target of data.targets) {\n\t\tconst userValue = userData.inputValues[target.id];\n\t\tconst expected = target.expectedValue;\n\n\t\tif (userValue === undefined || userValue === null || userValue === '') {\n\t\t\tgradingState[target.id] = 'missed';\n\t\t} else if (compareInputValue(expected, userValue)) {\n\t\t\tgradingState[target.id] = 'correct';\n\t\t} else {\n\t\t\tgradingState[target.id] = 'wrong';\n\t\t}\n\t}\n\n\treturn gradingState;\n}\n\n/**\n * Compare user input value against expected InputElementData\n */\nfunction compareInputValue(expected: InputElementData, userValue: any): boolean {\n\tif (userValue === undefined || userValue === null || userValue === '') {\n\t\treturn false;\n\t}\n\n\tswitch (expected.type) {\n\t\tcase 'text': {\n\t\t\tconst userStr = String(userValue).toLowerCase().trim();\n\t\t\t// Check if user value matches any of the acceptable values\n\t\t\treturn expected.value.some(v => v.toLowerCase().trim() === userStr);\n\t\t}\n\n\t\tcase 'number': {\n\t\t\tconst userNum = Number(userValue);\n\t\t\tif (isNaN(userNum)) return false;\n\n\t\t\t// Check if in targets\n\t\t\tif (expected.targets.includes(userNum)) return true;\n\n\t\t\t// Check if in any range\n\t\t\tif (expected.ranges) {\n\t\t\t\treturn expected.ranges.some(range =>\n\t\t\t\t\tuserNum >= range.from && userNum <= range.to\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}\n\n\t\tcase 'select': {\n\t\t\tconst userStr = String(userValue).trim();\n\t\t\treturn expected.correctOptions.some(opt =>\n\t\t\t\tString(opt).trim() === userStr\n\t\t\t);\n\t\t}\n\n\t\tcase 'date':\n\t\t{\n\t\t\t// Accept both parser format (YYYY/MM/DD) and native date input format (YYYY-MM-DD)\n\t\t\tconst expectedDate = normalizeDate(String(expected.value));\n\t\t\tconst actualDate = normalizeDate(String(userValue));\n\t\t\treturn expectedDate.length > 0 && expectedDate === actualDate;\n\t\t}\n\n\t\tcase 'time': {\n\t\t\t// Normalize both to HH:MM when possible\n\t\t\tconst expectedTime = normalizeTime(String(expected.value));\n\t\t\tconst actualTime = normalizeTime(String(userValue));\n\t\t\treturn expectedTime.length > 0 && expectedTime === actualTime;\n\t\t}\n\n\t\tdefault:\n\t\t\treturn false;\n\t}\n}\n\nfunction normalize(value: string): string {\n\treturn String(value).trim().toLowerCase();\n}\n\nfunction normalizeDate(value: string): string {\n\treturn String(value).trim().replace(/\\//g, \"-\");\n}\n\nfunction normalizeTime(value: string): string {\n\tconst raw = String(value).trim();\n\tconst match = raw.match(/^([01]\\d|2[0-3]):([0-5]\\d)(?::[0-5]\\d)?$/);\n\tif (!match) return raw;\n\treturn `${match[1]}:${match[2]}`;\n}\n\n// ==================== CLASSIFICATION GRADER ====================\n\n/**\n * Grade classification interaction\n * User must assign each target word to the correct category\n */\nexport function textEngineClassificationGrader(\n\tdata: TextEngineClassificationData,\n\tuserData: TextEngineClassificationUserData\n): GradingResult {\n\tlet correctCount = 0;\n\tlet totalCount = 0;\n\n\t// Build a map of word index -> correct category\n\tconst correctCategories = new Map<number, string>();\n\n\tfor (const categoryTarget of data.targets) {\n\t\tfor (const target of categoryTarget.targets) {\n\t\t\tfor (let i = target.startPos; i <= target.endPos; i++) {\n\t\t\t\tcorrectCategories.set(i, categoryTarget.category);\n\t\t\t\ttotalCount++;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Check user assignments\n\tfor (const [wordIndex, userCategory] of Object.entries(userData.wordCategories)) {\n\t\tconst index = Number(wordIndex);\n\t\tconst correctCategory = correctCategories.get(index);\n\n\t\tif (correctCategory && userCategory === correctCategory) {\n\t\t\tcorrectCount++;\n\t\t}\n\t}\n\n\tconst score = totalCount > 0 ? Math.round((correctCount / totalCount) * 100) : 0;\n\n\treturn { score, correct: correctCount, total: totalCount };\n}\n\n/**\n * Generate per-word grading state for classification interaction\n */\nexport function getClassificationGradingState(\n\tdata: TextEngineClassificationData,\n\tuserData: TextEngineClassificationUserData\n): TextEngineClassificationGradingState {\n\tconst gradingState: TextEngineClassificationGradingState = {};\n\n\t// Build a map of word index -> correct category\n\tconst correctCategories = new Map<number, string>();\n\n\tfor (const categoryTarget of data.targets) {\n\t\tfor (const target of categoryTarget.targets) {\n\t\t\tfor (let i = target.startPos; i <= target.endPos; i++) {\n\t\t\t\tcorrectCategories.set(i, categoryTarget.category);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Grade each word\n\tfor (const [index, correctCategory] of correctCategories) {\n\t\tconst userCategory = userData.wordCategories[index];\n\n\t\tif (!userCategory) {\n\t\t\tgradingState[index] = 'missed';\n\t\t} else if (userCategory === correctCategory) {\n\t\t\tgradingState[index] = 'correct';\n\t\t} else {\n\t\t\tgradingState[index] = 'wrong';\n\t\t}\n\t}\n\n\treturn gradingState;\n}\n", "/* ==================== BASE STYLES ==================== */\n\n* { box-sizing: border-box; }\n\n:host {\n\tdisplay: block;\n\theight: 100%;\n\tfont-family: system-ui, -apple-system, sans-serif;\n\tfont-size: clamp(0.92rem, 0.3vw + 0.88rem, 1.05rem);\n\tline-height: 2.7;\n\t--text-accent: rgb(var(--edu-first-accent));\n}\n\n.wrap {\n\tpadding: clamp(0.6rem, 1.6vw, var(--edu-pad));\n\theight: 100%;\n}\n\n.text-content {\n\tdisplay: block;\n\theight: 100%;\n\tuser-select: none;\n}\n\n/* ==================== WORD STYLES ==================== */\n\n.word {\n\tdisplay: inline;\n\tmargin: 0 0.15rem;\n\tpadding: 0.15rem 0.25rem;\n\tborder-radius: var(--edu-radius);\n\ttransition: all 0.2s ease;\n\toverflow-wrap: anywhere;\n\tcolor: rgb(var(--edu-ink));\n\tfont-weight: 500;\n}\n\n/* Selectable words (highlight mode) */\n.word-selectable {\n\tcursor: pointer;\n\tbackground: rgba(var(--edu-muted), 0.5);\n\tborder: 2px solid rgb(var(--edu-border));\n\tcolor: rgb(var(--edu-ink));\n}\n\n.word-selectable:hover {\n\tbackground: rgba(var(--edu-first-accent), 0.15);\n\tborder-color: rgba(var(--edu-first-accent), 0.5);\n\ttransform: translateY(-1px);\n}\n\n.word-selected {\n\tbackground: rgba(var(--edu-first-accent), 0.25);\n\tborder-color: var(--text-accent);\n\tborder-width: 2px;\n\tfont-weight: 500;\n\tcolor: var(--text-accent);\n\tbox-shadow: 0 2px 4px rgba(var(--edu-shadow-color), 0.1);\n}\n\n/* Editable words (transformation mode) */\n.word-editable {\n\tcursor: text;\n\tbackground: rgb(var(--edu-card));\n\tborder: 1px solid rgb(var(--edu-border));\n\tpadding: 0.25rem 0.5rem;\n\tmin-width: 3ch;\n\toutline: none;\n\tcolor: rgb(var(--edu-ink));\n}\n\n.word-editable:hover {\n\tborder-color: rgb(var(--edu-second-ink));\n}\n\n.word-editable:focus {\n\tborder-color: var(--text-accent);\n\tbackground: rgb(var(--edu-card));\n}\n\n/* Classifiable words */\n.word-classifiable {\n\tcursor: pointer;\n\tposition: relative;\n\tbackground: rgb(var(--edu-muted));\n\tborder: 1px solid rgb(var(--edu-border));\n\tcolor: rgb(var(--edu-ink));\n}\n\n.word-classifiable:hover {\n\tbackground: rgb(var(--edu-border));\n\tborder-color: rgb(var(--edu-second-ink));\n}\n\n.word-assigned {\n\tbackground: rgba(var(--category-color), 0.2);\n\tborder-color: rgb(var(--category-color));\n\tfont-weight: 600;\n\tcolor: rgb(var(--category-color));\n}\n\n/* ==================== GRADING STATES ==================== */\n\n.word-correct {\n\tbackground: rgba(var(--edu-success), 0.2) !important;\n\tborder-color: rgb(var(--edu-success)) !important;\n\tcolor: rgb(var(--edu-success));\n}\n\n.word-wrong {\n\tbackground: rgba(var(--edu-error), 0.2) !important;\n\tborder-color: rgb(var(--edu-error)) !important;\n\tcolor: rgb(var(--edu-error));\n}\n\n.word-missed {\n\tbackground: rgba(var(--edu-warning), 0.2) !important;\n\tborder-color: rgb(var(--edu-warning)) !important;\n\tcolor: rgb(var(--edu-second-ink));\n}\n\n.input-correct {\n\tborder-color: rgb(var(--edu-success)) !important;\n\tbackground: rgba(var(--edu-success), 0.1) !important;\n}\n\n.input-wrong {\n\tborder-color: rgb(var(--edu-error)) !important;\n\tbackground: rgba(var(--edu-error), 0.1) !important;\n}\n\n.input-missed {\n\tborder-color: rgb(var(--edu-warning)) !important;\n\tbackground: rgba(var(--edu-warning), 0.1) !important;\n}\n\n/* ==================== CLASSIFICATION MODE ==================== */\n\n.categories {\n\tdisplay: flex;\n\tgap: 0.5rem;\n\tflex-wrap: wrap;\n\tjustify-content: center;\n\talign-items: stretch;\n\tpadding-top: 1rem;\n\tmargin-top: auto;\n}\n\n.category-btn {\n\tmin-width: 110px;\n\tflex: 0 1 auto;\n\tcursor: pointer;\n}\n\n.category-btn::part(block) {\n\tpadding: 0.45rem 0.8rem;\n\tmin-height: 40px;\n\tborder-width: 2px;\n\tborder-color: rgb(var(--edu-border));\n\tbackground: rgb(var(--edu-card));\n\tcolor: rgb(var(--edu-ink));\n\ttransition: all 0.2s ease;\n}\n\n.category-btn:hover {\n\ttransform: translateY(-1px);\n}\n\n.category-btn.category-active::part(block) {\n\tborder-color: var(--category-color);\n\tbackground: color-mix(in srgb, var(--category-color) 18%, rgb(var(--edu-card)));\n\tcolor: var(--category-color);\n\tbox-shadow: 0 0 0 3px color-mix(in srgb, var(--category-color) 28%, transparent);\n}\n\n.category-btn[data-active=\"true\"]::part(block) {\n\tborder-color: var(--category-color);\n\tbackground: color-mix(in srgb, var(--category-color) 18%, rgb(var(--edu-card)));\n\tcolor: var(--category-color);\n\tbox-shadow: 0 0 0 3px color-mix(in srgb, var(--category-color) 28%, transparent);\n}\n\n.words {\n\tdisplay: block;\n\tline-height: 2.2;\n\tflex: 1;\n\toverflow-y: auto;\n\tmin-height: 0;\n}\n\n.classification-layout {\n\tdisplay: flex;\n\tflex-direction: column;\n\tmin-height: 100%;\n\theight: 100%;\n}\n\n/* ==================== DND MODE ==================== */\n\n.dnd-container {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 2rem;\n}\n\n.dnd-text {\n\tline-height: 2.2;\n}\n\n.dropzone {\n\tdisplay: inline-block;\n\tmin-width: clamp(4ch, 5vw, 7ch);\n\tmin-height: 2rem;\n\tpadding: 0.25rem 0.75rem;\n\tmargin: 0 0.25rem;\n\tborder: 2px dashed rgb(var(--edu-border));\n\tborder-radius: var(--edu-radius);\n\tbackground: rgb(var(--edu-muted));\n\ttext-align: center;\n\tvertical-align: middle;\n\ttransition: all 0.2s ease;\n\tcolor: rgb(var(--edu-ink));\n}\n\n.dropzone:hover {\n\tborder-color: rgba(var(--edu-first-accent), 0.5);\n\tbackground: rgba(var(--edu-first-accent), 0.05);\n}\n\n.dropzone-filled {\n\tborder-style: solid;\n\tborder-color: rgba(var(--edu-first-accent), 0.5);\n\tbackground: rgba(var(--edu-first-accent), 0.1);\n\tfont-weight: 500;\n}\n\n.dropzone-correct {\n\tborder-color: rgb(var(--edu-success)) !important;\n\tbackground: rgba(var(--edu-success), 0.1) !important;\n}\n\n.dropzone-wrong {\n\tborder-color: rgb(var(--edu-error)) !important;\n\tbackground: rgba(var(--edu-error), 0.1) !important;\n}\n\n.dropzone-missed {\n\tborder-color: rgb(var(--edu-warning)) !important;\n\tbackground: rgba(var(--edu-warning), 0.1) !important;\n}\n\n.dnd-chips {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 0.5rem;\n\tpadding: 1rem;\n\tborder: 2px solid rgb(var(--edu-border));\n\tborder-radius: var(--edu-radius);\n\tbackground: rgb(var(--edu-muted));\n\tmin-height: 4rem;\n\tmax-height: 11rem;\n\toverflow: auto;\n}\n\n.chip {\n\tpadding: 0.5rem 1rem;\n\tborder: 1px solid rgb(var(--edu-border));\n\tbackground: rgb(var(--edu-card));\n\tborder-radius: var(--edu-radius);\n\tcursor: grab;\n\tfont-size: 0.875rem;\n\tfont-weight: 500;\n\ttransition: all 0.2s ease;\n\tuser-select: none;\n\tcolor: rgb(var(--edu-ink));\n}\n\n.chip:hover {\n\tborder-color: rgba(var(--edu-first-accent), 0.5);\n\tbackground: rgba(var(--edu-first-accent), 0.05);\n\ttransform: translateY(-2px);\n\tbox-shadow: 0 4px 6px rgb(var(--edu-shadow-color) / 0.1);\n}\n\n.chip:active {\n\tcursor: grabbing;\n}\n\n/* ==================== VARIANT: ELEGANT ==================== */\n\n:host([variant=\"elegant\"]) .word-selectable {\n\tbackground: rgb(var(--edu-card));\n\tborder: 1px solid rgb(var(--edu-border));\n\tbox-shadow: 0 1px 2px rgba(var(--edu-shadow-color), 0.05);\n}\n\n:host([variant=\"elegant\"]) .word-selectable:hover {\n\tborder-color: rgba(var(--edu-first-accent), 0.5);\n\tbox-shadow: 0 4px 8px rgba(var(--edu-shadow-color), 0.12);\n\ttransform: translateY(-2px);\n}\n\n:host([variant=\"elegant\"]) .word-selected {\n\tbackground: linear-gradient(135deg, rgba(var(--edu-first-accent), 0.15), rgba(var(--edu-first-accent), 0.25));\n\tborder-color: var(--text-accent);\n\tborder-width: 1px;\n\tbox-shadow: 0 4px 12px rgba(var(--edu-shadow-color), 0.2);\n\tfont-weight: 500;\n\tcolor: var(--text-accent);\n}\n\n/* ==================== VARIANT: PLAYFUL ==================== */\n\n:host([variant=\"playful\"]) .word {\n\tborder-radius: 16px;\n\tfont-weight: 500;\n}\n\n:host([variant=\"playful\"]) .word-selectable {\n\tbackground: linear-gradient(145deg, rgb(var(--edu-card)), rgb(var(--edu-muted)));\n\tborder: 3px solid rgb(var(--edu-border));\n\tbox-shadow: 2px 2px 4px rgba(var(--edu-shadow-color), 0.08);\n}\n\n:host([variant=\"playful\"]) .word-selectable:hover {\n\ttransform: scale(1.1) rotate(-2deg);\n\tborder-color: rgba(var(--edu-first-accent), 0.7);\n\tbox-shadow: 3px 3px 8px rgba(var(--edu-shadow-color), 0.15);\n}\n\n:host([variant=\"playful\"]) .word-selected {\n\tbackground: linear-gradient(135deg, var(--text-accent), rgba(var(--edu-first-accent), 0.8));\n\tborder-color: var(--text-accent);\n\tborder-width: 3px;\n\tcolor: rgb(var(--edu-inverted-ink));\n\ttransform: scale(1.15) rotate(2deg);\n\tbox-shadow: 4px 4px 12px rgba(var(--edu-shadow-color), 0.25);\n\tfont-weight: 700;\n}\n\n:host([variant=\"playful\"]) .category-btn {\n\tborder-radius: 24px;\n}\n\n/* ==================== VARIANT: OUTLINE ==================== */\n\n:host([variant=\"outline\"]) .word-selectable {\n\tborder: 2px solid rgb(var(--edu-border));\n\tbackground: transparent;\n}\n\n:host([variant=\"outline\"]) .word-selectable:hover {\n\tborder-color: rgba(var(--edu-first-accent), 0.7);\n\tbackground: rgba(var(--edu-first-accent), 0.05);\n\tborder-width: 2px;\n}\n\n:host([variant=\"outline\"]) .word-selected {\n\tborder-color: var(--text-accent);\n\tbackground: rgba(var(--edu-first-accent), 0.12);\n\tborder-width: 2px;\n\tfont-weight: 500;\n\tcolor: var(--text-accent);\n}\n\n/* ==================== VARIANT: MINIMAL ==================== */\n\n:host([variant=\"minimal\"]) .word {\n\tborder: none;\n\tborder-radius: 0;\n\tpadding: 0.2rem 0.3rem;\n\tmargin: 0 0.1rem;\n}\n\n:host([variant=\"minimal\"]) .word-selectable {\n\tbackground: transparent;\n\tborder-bottom: 2px solid transparent;\n\ttransition: all 0.2s ease;\n}\n\n:host([variant=\"minimal\"]) .word-selectable:hover {\n\tbackground: rgba(var(--edu-first-accent), 0.1);\n\tborder-bottom-color: rgba(var(--edu-first-accent), 0.4);\n}\n\n:host([variant=\"minimal\"]) .word-selected {\n\tbackground: linear-gradient(to right, rgba(var(--edu-first-accent), 0.4) 0%, rgba(var(--edu-first-accent), 0.4) 100%);\n\tbackground-size: 100% 60%;\n\tbackground-position: 0 100%;\n\tbackground-repeat: no-repeat;\n\tborder: none;\n\tborder-bottom: 3px solid var(--text-accent);\n\tfont-weight: 500;\n\tcolor: var(--text-accent);\n}\n\n/* ==================== VARIANT: LETTER ==================== */\n\n:host([variant=\"letter\"]) .word {\n\tborder-radius: 2px;\n}\n\n:host([variant=\"letter\"]) .word-selectable {\n\tbackground: rgb(var(--edu-card));\n\tborder: 1px solid rgb(var(--edu-border));\n\tfont-family: 'Courier New', monospace;\n}\n\n:host([variant=\"letter\"]) .word-selected {\n\tbackground: rgba(var(--edu-first-accent), 0.15);\n\tborder-color: var(--text-accent);\n}\n\n/* ==================== VARIANT: SIGN ==================== */\n\n:host([variant=\"sign\"]) .word {\n\tborder-radius: 4px;\n\tfont-weight: 700;\n\ttext-transform: uppercase;\n\tfont-size: 0.95em;\n\tletter-spacing: 0.5px;\n}\n\n:host([variant=\"sign\"]) .word-selectable {\n\tbackground: linear-gradient(180deg, rgb(var(--edu-card)), rgb(var(--edu-muted)));\n\tborder: 4px solid rgb(var(--edu-border));\n\tborder-bottom-width: 6px;\n\tbox-shadow: 0 4px 0 rgba(var(--edu-shadow-color), 0.15);\n}\n\n:host([variant=\"sign\"]) .word-selectable:hover {\n\tborder-color: rgba(var(--edu-first-accent), 0.6);\n\ttransform: translateY(-2px);\n\tbox-shadow: 0 6px 0 rgba(var(--edu-shadow-color), 0.2);\n}\n\n:host([variant=\"sign\"]) .word-selected {\n\tbackground: linear-gradient(180deg, var(--text-accent), rgba(var(--edu-first-accent), 0.8));\n\tborder-color: var(--text-accent);\n\tborder-width: 4px;\n\tborder-bottom-width: 6px;\n\tcolor: rgb(var(--edu-inverted-ink));\n\ttransform: translateY(-4px);\n\tbox-shadow: 0 8px 0 rgba(var(--edu-shadow-color), 0.25);\n}\n\n/* ==================== VARIANT: GLASS ==================== */\n\n:host([variant=\"glass\"]) .word-selectable {\n\tbackground: rgba(var(--edu-card), 0.6);\n\tborder: 1px solid rgba(var(--edu-border), 0.3);\n\tbackdrop-filter: blur(12px) saturate(150%);\n\tbox-shadow: 0 2px 8px rgba(var(--edu-shadow-color), 0.1);\n}\n\n:host([variant=\"glass\"]) .word-selectable:hover {\n\tbackground: rgba(var(--edu-first-accent), 0.2);\n\tborder-color: rgba(var(--edu-first-accent), 0.5);\n\tbackdrop-filter: blur(16px) saturate(180%);\n\tbox-shadow: 0 4px 12px rgba(var(--edu-shadow-color), 0.15);\n}\n\n:host([variant=\"glass\"]) .word-selected {\n\tbackground: rgba(var(--edu-first-accent), 0.35);\n\tborder-color: var(--text-accent);\n\tborder-width: 2px;\n\tbackdrop-filter: blur(16px) saturate(200%);\n\tbox-shadow: 0 6px 16px rgba(var(--edu-shadow-color), 0.2);\n\tfont-weight: 600;\n\tcolor: var(--text-accent);\n}\n\n/* ==================== VARIANT: EMPTY ==================== */\n\n:host([variant=\"empty\"]) .word {\n\tborder: none;\n\tbackground: transparent;\n\tmargin: 0;\n\tpadding: 0.2rem;\n}\n\n:host([variant=\"empty\"]) .word-selectable:hover {\n\topacity: 0.7;\n}\n\n:host([variant=\"empty\"]) .word-selected {\n\ttext-decoration: underline;\n\ttext-decoration-color: var(--text-accent);\n\ttext-decoration-thickness: 2px;\n\ttext-underline-offset: 4px;\n}\n\n@media (max-width: 720px) {\n\t.word {\n\t\tmargin: 0 0.08rem;\n\t\tpadding: 0.12rem 0.2rem;\n\t}\n\n\t.categories {\n\t\tgap: 0.35rem;\n\t\tmargin-bottom: 0.9rem;\n\t}\n\n\t.category-btn {\n\t\tpadding: 0.38rem 0.7rem;\n\t\tfont-size: 0.8rem;\n\t}\n\n\t.dnd-container {\n\t\tgap: 1.1rem;\n\t}\n}\n", "import CSS from \"./styles.css\";\n\nimport {\n\tTextEngineConfiguration,\n\tTextEngineState,\n\tTextEngineDataUnion,\n\tTextEngineBaseData,\n\tTextEngineBlanksData,\n\tTextEngineClassificationData,\n\n\tEduTextChangeDetail,\n\n\tTextEngineGradingState\n} from \"../../types/Text\";\n\nimport { EduBlock, EduInput } from \"../../ui\";\n\nimport { Variant } from \"../../shared/types\";\nimport { shuffle, escapeHtml, hash } from \"../../shared/utils\";\n\ntype EduTextElement = HTMLElement & {\n\tconfig: TextEngineConfiguration;\n\n\tgetValue(): any;\n\tgetState(): TextEngineState;\n\tsetState(next: Partial<TextEngineState>): void;\n\treset(): void;\n\n\tsetGradingState(state: TextEngineGradingState): void;\n\tclearGradingState(): void;\n};\n\nexport class EduText extends HTMLElement implements EduTextElement {\n\n\tprivate _config!: TextEngineConfiguration;\n\tprivate _state: TextEngineState = {};\n\tprivate _mounted = false;\n\n\tstatic get observedAttributes() {\n\t\treturn [\"variant\"];\n\t}\n\n\tprivate $wrapEl!: HTMLElement;\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.attachShadow({ mode: 'open' });\n\n\t\tconst wrap = document.createElement(\"section\");\n\t\twrap.className = \"wrap\";\n\t\tthis.shadowRoot!.append(wrap);\n\n\t\tthis.$wrapEl = wrap;\n\t}\n\n\tconnectedCallback() {\n\t\tthis._mounted = true;\n\t\tthis.shadowRoot?.addEventListener('click', this.onClick);\n\t\tthis.shadowRoot?.addEventListener('change', this.onChange);\n\t\tthis.shadowRoot?.addEventListener('input', this.onInput);\n\t\tthis.shadowRoot?.addEventListener('dragstart', this.onDragStart);\n\t\tthis.shadowRoot?.addEventListener('dragover', this.onDragOver);\n\t\tthis.shadowRoot?.addEventListener('drop', this.onDrop);\n\t\tthis.render();\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis._mounted = false;\n\t\tthis.shadowRoot?.removeEventListener('click', this.onClick);\n\t\tthis.shadowRoot?.removeEventListener('change', this.onChange);\n\t\tthis.shadowRoot?.removeEventListener('input', this.onInput);\n\t\tthis.shadowRoot?.removeEventListener('dragstart', this.onDragStart);\n\t\tthis.shadowRoot?.removeEventListener('dragover', this.onDragOver);\n\t\tthis.shadowRoot?.removeEventListener('drop', this.onDrop);\n\t}\n\n\tset config(v: TextEngineConfiguration) {\n\t\tthis._config = v;\n\t\tthis._state = this.initState(v);\n\t\tif (v.variant) this.setAttribute('variant', v.variant);\n\t\tthis.render();\n\t}\n\n\tget config() {\n\t\tif (!this._config) throw new Error('<edu-text>: config not set');\n\t\treturn this._config;\n\t}\n\n\tgetValue(): any {\n\t\t// Return user data in the format expected by graders\n\t\tconst data = this._config.data;\n\n\t\tswitch (data.type) {\n\t\t\tcase 'base':\n\t\t\t\tif (this._config.mode === 'highlight') {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tselectedIndices: Array.from(this._state.selectedIndices ?? [])\n\t\t\t\t\t};\n\t\t\t\t} else if (this._config.mode === 'dnd') {\n\t\t\t\t\tconst placements = this._state.dndPlacements ?? {};\n\t\t\t\t\treturn {\n\t\t\t\t\t\tplacedIndices: Object.keys(placements).map((k) => Number(k)),\n\t\t\t\t\t\tdndPlacements: { ...placements }\n\t\t\t\t\t};\n\t\t\t\t} else if (this._config.mode === 'transformation') {\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttransformations: this._state.transformations ?? {}\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 'blanks':\n\t\t\t\treturn {\n\t\t\t\t\tinputValues: this._state.inputValues ?? {}\n\t\t\t\t};\n\n\t\t\tcase 'classification':\n\t\t\t\treturn {\n\t\t\t\t\twordCategories: this._state.wordCategories ?? {}\n\t\t\t\t};\n\t\t}\n\n\t\treturn {};\n\t}\n\n\tgetState(): TextEngineState {\n\t\treturn { ...this._state };\n\t}\n\n\tsetState(next: Partial<TextEngineState>) {\n\t\tif (!next) return;\n\n\t\tthis._state = {\n\t\t\t...this._state,\n\t\t\t...(next.selectedIndices ? { selectedIndices: new Set(next.selectedIndices) } : {}),\n\t\t\t...(next.dndPlacements ? { dndPlacements: { ...next.dndPlacements } } : {}),\n\t\t\t...(next.inputValues ? { inputValues: { ...next.inputValues } } : {}),\n\t\t\t...(next.wordCategories ? { wordCategories: { ...next.wordCategories } } : {}),\n\t\t\t...(next.transformations ? { transformations: { ...next.transformations } } : {})\n\t\t};\n\n\t\tthis.render();\n\t}\n\n\treset() {\n\t\tif (!this._config) return;\n\t\tthis._state = this.initState(this._config);\n\t\tthis.render();\n\n\t\tthis.dispatchEvent(new CustomEvent('reset', {\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\t}\n\n\tsetGradingState(state: TextEngineGradingState) {\n\t\tif (!this._config) return;\n\t\tthis._config.gradingState = state;\n\t\tthis.render();\n\t}\n\n\tclearGradingState() {\n\t\tif (!this._config) return;\n\t\tthis._config.gradingState = undefined;\n\t\tthis.render();\n\t}\n\n\tattributeChangedCallback(name: string, oldValue: string, newValue: string) {\n\t\tif (oldValue === newValue) return;\n\n\t\tif (name === 'variant') {\n\t\t\tthis.setAttribute('variant', newValue);\n\n\t\t\tthis.shadowRoot?.querySelectorAll('edu-input').forEach((el) => {\n\t\t\t\tconst inputEl = el as EduInput;\n\t\t\t\tif (inputEl.variant !== undefined) {\n\t\t\t\t\tinputEl.variant = newValue as Variant;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\tthis.shadowRoot?.querySelectorAll('edu-block').forEach((el) => {\n\t\t\t\tconst blockEl = el as EduBlock;\n\t\t\t\tif (blockEl.variant !== undefined) {\n\t\t\t\t\tblockEl.variant = newValue as Variant;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t// Update variant in all child elements if needed\n\t\t\tthis.render();\n\t\t}\n\t}\n\n\tprivate upsertHtmlAttribute(html: string, attr: string, value: string): string {\n\t\tconst attrPattern = new RegExp(`${attr}=\"[^\"]*\"`, \"i\");\n\t\tif (attrPattern.test(html)) {\n\t\t\treturn html.replace(attrPattern, `${attr}=\"${value}\"`);\n\t\t}\n\t\treturn html.replace(/<([a-z0-9-]+)/i, `<$1 ${attr}=\"${value}\"`);\n\t}\n\n\tprivate removeHtmlAttribute(html: string, attr: string): string {\n\t\tconst attrPattern = new RegExp(`\\\\s${attr}=\"[^\"]*\"`, \"ig\");\n\t\treturn html.replace(attrPattern, \"\");\n\t}\n\n\tprivate upsertHtmlClass(html: string, className: string): string {\n\t\tconst classPattern = /class=\"([^\"]*)\"/i;\n\t\tif (classPattern.test(html)) {\n\t\t\treturn html.replace(classPattern, (_m, cls) => {\n\t\t\t\tconst existing = String(cls || \"\").split(/\\s+/).filter(Boolean);\n\t\t\t\tif (!existing.includes(className)) existing.push(className);\n\t\t\t\treturn `class=\"${existing.join(\" \")}\"`;\n\t\t\t});\n\t\t}\n\t\treturn html.replace(/<([a-z0-9-]+)/i, `<$1 class=\"${className}\"`);\n\t}\n\n\tprivate removeHtmlClassPrefix(html: string, prefix: string): string {\n\t\tconst classPattern = /class=\"([^\"]*)\"/i;\n\t\tif (!classPattern.test(html)) return html;\n\n\t\treturn html.replace(classPattern, (_m, cls) => {\n\t\t\tconst filtered = String(cls || \"\")\n\t\t\t\t.split(/\\s+/)\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.filter((name) => !name.startsWith(prefix));\n\t\t\treturn filtered.length > 0 ? `class=\"${filtered.join(\" \")}\"` : \"\";\n\t\t});\n\t}\n\n\t// ==================== INITIALIZATION ====================\n\n\tprivate initState(config: TextEngineConfiguration): TextEngineState {\n\t\tconst state: TextEngineState = {};\n\n\t\tswitch (config.data.type) {\n\t\t\tcase 'base':\n\t\t\t\tif (config.mode === 'highlight' || config.mode === 'dnd') {\n\t\t\t\t\tstate.selectedIndices = new Set<number>();\n\t\t\t\t\tif (config.mode === 'dnd') {\n\t\t\t\t\t\tstate.dndPlacements = {};\n\t\t\t\t\t}\n\t\t\t\t} else if (config.mode === 'transformation') {\n\t\t\t\t\tstate.transformations = {};\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 'blanks':\n\t\t\t\tstate.inputValues = {};\n\t\t\t\tbreak;\n\n\t\t\tcase 'classification':\n\t\t\t\tstate.wordCategories = {};\n\t\t\t\tbreak;\n\t\t}\n\n\t\treturn state;\n\t}\n\n\t// ==================== RENDERING ====================\n\n\tprivate render() {\n\t\tif (!this._mounted || !this.shadowRoot) return;\n\n\t\tif (!this._config) {\n\t\t\tthis.$wrapEl.innerHTML = `<style>:host{display:block}</style><div></div>`;\n\t\t\treturn;\n\t\t}\n\n\t\tconst config = this._config;\n\t\tconst data = config.data;\n\n\t\tlet contentHtml = '';\n\n\t\tswitch (config.mode) {\n\t\t\tcase 'highlight':\n\t\t\t\tcontentHtml = this.renderHighlight(data as TextEngineBaseData);\n\t\t\t\tbreak;\n\t\t\tcase 'blanks':\n\t\t\t\tcontentHtml = this.renderBlanks(data as TextEngineBlanksData);\n\t\t\t\tbreak;\n\t\t\tcase 'classification':\n\t\t\t\tcontentHtml = this.renderClassification(data as TextEngineClassificationData);\n\t\t\t\tbreak;\n\t\t\tcase 'dnd':\n\t\t\t\tcontentHtml = this.renderDND(data as TextEngineBaseData);\n\t\t\t\tbreak;\n\t\t\tcase 'transformation':\n\t\t\t\tcontentHtml = this.renderTransformation(data as TextEngineBaseData);\n\t\t\t\tbreak;\n\t\t}\n\n\t\tthis.$wrapEl.innerHTML = `\n\t\t\t<style>${CSS}</style>\n\t\t\t<div class=\"text-content\" part=\"content\">\n\t\t\t\t${contentHtml}\n\t\t\t</div>\n\t\t`;\n\t}\n\n\tprivate renderHighlight(data: TextEngineBaseData): string {\n\t\tconst parts = data.parts;\n\t\tconst selectedIndices = this._state.selectedIndices ?? new Set();\n\t\tconst gradingState = this._config.gradingState ?? {};\n\n\t\treturn parts.map((word, index) => {\n\t\t\tconst isSelected = selectedIndices.has(index);\n\t\t\tconst grading = gradingState[index];\n\n\t\t\tlet classes = ['word', 'word-selectable'];\n\t\t\tif (isSelected) classes.push('word-selected');\n\t\t\tif (grading) classes.push(`word-${grading}`);\n\n\t\t\treturn `<span class=\"${classes.join(' ')}\" data-index=\"${index}\">${escapeHtml(word)}</span>`;\n\t\t}).join(' ');\n\t}\n\n\tprivate renderBlanks(data: TextEngineBlanksData): string {\n\t\t// Parts already contain HTML for input elements (generated by parser)\n\t\t// We just need to render them with proper state\n\t\tconst gradingState = this._config.gradingState ?? {};\n\t\tconst currentVariant = this.getAttribute(\"variant\") ?? this._config.variant ?? \"outline\";\n\n\t\treturn data.parts.map((part, index) => {\n\t\t\t// Check if this part is an input element (starts with <)\n\t\t\tif (part.startsWith('<')) {\n\t\t\t\t// Find the target for this part to get its ID\n\t\t\t\tconst target = data.targets.find(t => t.expectedValue.html === part);\n\t\t\t\tif (target) {\n\t\t\t\t\tconst grading = gradingState[target.id];\n\t\t\t\t\tconst gradingClass = grading ? `input-${grading}` : '';\n\n\t\t\t\t\t// Inject grading class and current value if exists\n\t\t\t\t\tconst value = this._state.inputValues?.[target.id] ?? '';\n\t\t\t\t\tlet modifiedPart = part;\n\n\t\t\t\t\t// Ensure edu-input follows the active variant from host/config.\n\t\t\t\t\tif (/<edu-input\\b/i.test(modifiedPart)) {\n\t\t\t\t\t\tmodifiedPart = this.upsertHtmlAttribute(modifiedPart, \"variant\", currentVariant);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Apply grading feedback:\n\t\t\t\t\t// - edu-input uses `state` attr\n\t\t\t\t\t// - native inputs/selects can use helper classes\n\t\t\t\t\tmodifiedPart = this.removeHtmlClassPrefix(modifiedPart, \"input-\");\n\t\t\t\t\tmodifiedPart = this.removeHtmlAttribute(modifiedPart, \"state\");\n\t\t\t\t\tif (grading) {\n\t\t\t\t\t\tif (/<edu-input\\b/i.test(modifiedPart)) {\n\t\t\t\t\t\t\tmodifiedPart = this.upsertHtmlAttribute(modifiedPart, \"state\", grading);\n\t\t\t\t\t\t} else if (gradingClass) {\n\t\t\t\t\t\t\tmodifiedPart = this.upsertHtmlClass(modifiedPart, gradingClass);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (value !== '') {\n\t\t\t\t\t\tconst valueStr = escapeHtml(String(value));\n\t\t\t\t\t\tif (modifiedPart.includes('<edu-input')) {\n\t\t\t\t\t\t\tif (/value=\"[^\"]*\"/.test(modifiedPart)) {\n\t\t\t\t\t\t\t\tmodifiedPart = modifiedPart.replace(/value=\"[^\"]*\"/, `value=\"${valueStr}\"`);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmodifiedPart = modifiedPart.replace('<edu-input', `<edu-input value=\"${valueStr}\"`);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if (modifiedPart.includes('<input')) {\n\t\t\t\t\t\t\tif (/value=\"[^\"]*\"/.test(modifiedPart)) {\n\t\t\t\t\t\t\t\tmodifiedPart = modifiedPart.replace(/value=\"[^\"]*\"/, `value=\"${valueStr}\"`);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tmodifiedPart = modifiedPart.replace('<input', `<input value=\"${valueStr}\"`);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn modifiedPart;\n\t\t\t\t}\n\t\t\t\treturn part;\n\t\t\t} else {\n\t\t\t\t// Regular word\n\t\t\t\treturn `<span class=\"word\">${escapeHtml(part)}</span>`;\n\t\t\t}\n\t\t}).join(' ');\n\t}\n\n\tprivate renderClassification(data: TextEngineClassificationData): string {\n\t\tconst parts = data.parts;\n\t\tconst wordCategories = this._state.wordCategories ?? {};\n\t\tconst gradingState = this._config.gradingState ?? {};\n\t\tconst currentVariant = this.getAttribute(\"variant\") ?? \"outline\";\n\n\t\t// Extract categories from targets\n\t\tconst categories = data.targets.map(t => t.category);\n\n\t\t// Assign colors to categories (cycle through accent colors)\n\t\tconst categoryColors: Record<string, string> = {};\n\t\tconst colors = ['--edu-first-accent', '--edu-second-accent', '--edu-third-accent', '--edu-neutral'];\n\t\tcategories.forEach((cat, i) => {\n\t\t\tcategoryColors[cat] = colors[i % colors.length];\n\t\t});\n\n\t\tconst wordsHtml = parts.map((word, index) => {\n\t\t\tconst assignedCategory = wordCategories[index];\n\t\t\tconst grading = gradingState[index];\n\n\t\t\tlet classes = ['word', 'word-classifiable'];\n\t\t\tif (assignedCategory) classes.push('word-assigned');\n\t\t\tif (grading) classes.push(`word-${grading}`);\n\n\t\t\t// Use category color instead of label\n\t\t\tconst categoryStyle = assignedCategory\n\t\t\t\t? `style=\"--category-color: var(${categoryColors[assignedCategory]})\"`\n\t\t\t\t: '';\n\n\t\t\treturn `\n\t\t\t\t<span class=\"${classes.join(' ')}\" data-index=\"${index}\" ${categoryStyle}>\n\t\t\t\t\t${escapeHtml(word)}\n\t\t\t\t</span>\n\t\t\t`;\n\t\t}).join(' ');\n\n\t\tconst categoriesHtml = `\n\t\t\t<div class=\"categories\" part=\"categories\">\n\t\t\t\t${categories.map(cat => `\n\t\t\t\t\t<edu-block class=\"category-btn\"\n\t\t\t\t\t\t${this._activeCategory === cat ? 'data-active=\"true\"' : ''}\n\t\t\t\t\t\tdata-category=\"${escapeHtml(cat)}\"\n\t\t\t\t\t\tvariant=\"${escapeHtml(currentVariant)}\"\n\t\t\t\t\t\tstyle=\"--category-color: var(${categoryColors[cat]})\">\n\t\t\t\t\t\t${escapeHtml(cat)}\n\t\t\t\t\t</edu-block>\n\t\t\t\t`).join('')}\n\t\t\t</div>\n\t\t`;\n\n\t\treturn `\n\t\t\t<div class=\"classification-layout\" part=\"classification-layout\">\n\t\t\t\t<div class=\"words\" part=\"words\">${wordsHtml}</div>\n\t\t\t\t${categoriesHtml}\n\t\t\t</div>\n\t\t`;\n\t}\n\n\tprivate renderDND(data: TextEngineBaseData): string {\n\t\t// Render blanks (dropzones) and draggable chips\n\t\tconst parts = data.parts;\n\t\tconst placements = this._state.dndPlacements ?? {};\n\t\tconst gradingState = this._config.gradingState ?? {};\n\n\t\t// Create dropzones for target positions\n\t\tconst targetIndices = new Set<number>();\n\t\tfor (const target of data.targets) {\n\t\t\tfor (let i = target.startPos; i <= target.endPos; i++) {\n\t\t\t\ttargetIndices.add(i);\n\t\t\t}\n\t\t}\n\n\t\tconst contentHtml = parts.map((word, index) => {\n\t\t\tif (targetIndices.has(index)) {\n\t\t\t\tconst placedWord = placements[index];\n\t\t\t\tconst isPlaced = Boolean(placedWord);\n\t\t\t\tconst grading = gradingState[index];\n\n\t\t\t\tlet classes = ['dropzone'];\n\t\t\t\tif (isPlaced) classes.push('dropzone-filled');\n\t\t\t\tif (grading) classes.push(`dropzone-${grading}`);\n\n\t\t\t\tconst content = isPlaced ? escapeHtml(placedWord) : '';\n\n\t\t\t\treturn `<span class=\"${classes.join(' ')}\" data-index=\"${index}\">${content}</span>`;\n\t\t\t} else {\n\t\t\t\treturn `<span class=\"word\">${escapeHtml(word)}</span>`;\n\t\t\t}\n\t\t}).join(' ');\n\n\t\t// Create draggable chips\n\t\tconst allWords = [...data.targets.flatMap(t => t.words)];\n\t\tif (data.distractors) {\n\t\t\tallWords.push(...data.distractors);\n\t\t}\n\n\t\tconst placedWords = Object.values(placements);\n\t\tconst availableWords = [...allWords];\n\n\t\tfor (const placed of placedWords) {\n\t\t\tconst idx = availableWords.findIndex((w) => normalizeWord(w) === normalizeWord(placed));\n\t\t\tif (idx !== -1) availableWords.splice(idx, 1);\n\t\t}\n\n\t\tconst shuffledWords = shuffle(availableWords);\n\t\tconst chipsHtml = shuffledWords.map(word => {\n\t\t\treturn `<div class=\"chip\" draggable=\"true\" data-word=\"${escapeHtml(word)}\">${escapeHtml(word)}</div>`;\n\t\t}).join('');\n\n\t\treturn `\n\t\t\t<div class=\"dnd-container\">\n\t\t\t\t<div class=\"dnd-text\">${contentHtml}</div>\n\t\t\t\t<div class=\"dnd-chips\">${chipsHtml}</div>\n\t\t\t</div>\n\t\t`;\n\t}\n\n\tprivate renderTransformation(data: TextEngineBaseData): string {\n\t\tconst parts = data.parts;\n\t\tconst transformations = this._state.transformations ?? {};\n\t\tconst gradingState = this._config.gradingState ?? {};\n\n\t\t// Track which indices are targets\n\t\tconst targetMap = new Map<number, number>(); // part index -> target index\n\t\tfor (let i = 0; i < data.targets.length; i++) {\n\t\t\tconst target = data.targets[i];\n\t\t\tfor (let j = target.startPos; j <= target.endPos; j++) {\n\t\t\t\ttargetMap.set(j, i);\n\t\t\t}\n\t\t}\n\n\t\treturn parts.map((word, index) => {\n\t\t\tconst targetIndex = targetMap.get(index);\n\n\t\t\tif (targetIndex !== undefined) {\n\t\t\t\t// This is an editable target\n\t\t\t\tconst grading = gradingState[targetIndex];\n\t\t\t\tconst transformed = transformations[targetIndex];\n\t\t\t\tconst displayText = transformed ? transformed.join(' ') : data.targets[targetIndex].words.join(' ');\n\n\t\t\t\tlet classes = ['word', 'word-editable'];\n\t\t\t\tif (grading) classes.push(`word-${grading}`);\n\n\t\t\t\treturn `\n\t\t\t\t\t<span class=\"${classes.join(' ')}\"\n\t\t\t\t\t\t contenteditable=\"true\"\n\t\t\t\t\t\t data-target-index=\"${targetIndex}\"\n\t\t\t\t\t\t data-original=\"${escapeHtml(word)}\">${escapeHtml(displayText)}</span>\n\t\t\t\t`;\n\t\t\t} else {\n\t\t\t\treturn `<span class=\"word\">${escapeHtml(word)}</span>`;\n\t\t\t}\n\t\t}).join(' ');\n\t}\n\n\t// ==================== EVENT HANDLERS ====================\n\n\tprivate onClick = (e: Event) => {\n\t\tconst target = e.target as HTMLElement;\n\n\t\t// Handle highlight mode word selection\n\t\tif (target.classList.contains('word-selectable')) {\n\t\t\tconst index = parseInt(target.getAttribute('data-index') ?? '');\n\t\t\tif (!isNaN(index)) {\n\t\t\t\tthis.toggleWordSelection(index);\n\t\t\t}\n\t\t}\n\n\t\t// Handle classification mode category selection\n\t\tif (target.classList.contains('category-btn')) {\n\t\t\tconst category = target.getAttribute('data-category');\n\t\t\tif (category) {\n\t\t\t\tthis.setActiveCategory(category);\n\t\t\t}\n\t\t}\n\n\t\t// Handle classification mode word selection\n\t\tif (target.classList.contains('word-classifiable')) {\n\t\t\tconst index = parseInt(target.getAttribute('data-index') ?? '');\n\t\t\tif (!isNaN(index) && this._activeCategory) {\n\t\t\t\tthis.assignWordToCategory(index, this._activeCategory);\n\t\t\t}\n\t\t}\n\n\t\t// Allow clearing a placed dropzone with click.\n\t\tif (target.classList.contains('dropzone-filled')) {\n\t\t\tconst index = parseInt(target.getAttribute('data-index') ?? '');\n\t\t\tif (!isNaN(index)) {\n\t\t\t\tthis.clearDropzone(index);\n\t\t\t}\n\t\t}\n\t};\n\n\tprivate onChange = (e: Event) => {\n\t\tconst target = e.target as HTMLElement;\n\n\t\t// Handle input elements from blanks mode\n\t\tif (target.tagName === 'EDU-INPUT' || target.tagName === 'INPUT') {\n\t\t\tconst id = target.getAttribute('id');\n\t\t\tif (id) {\n\t\t\t\tconst value = (target as any).value;\n\t\t\t\tthis.updateInputValue(id, value);\n\t\t\t}\n\t\t}\n\t};\n\n\tprivate onInput = (e: Event) => {\n\t\tconst target = e.target as HTMLElement;\n\n\t\t// Handle input elements from blanks mode in realtime\n\t\tif (target.tagName === 'EDU-INPUT' || target.tagName === 'INPUT') {\n\t\t\tconst id = target.getAttribute('id');\n\t\t\tif (id) {\n\t\t\t\tconst value = (target as any).value;\n\t\t\t\tthis.updateInputValue(id, value);\n\t\t\t}\n\t\t}\n\n\t\t// Handle contenteditable transformation\n\t\tif (target.hasAttribute('contenteditable') && target.getAttribute('contenteditable') === 'true') {\n\t\t\tconst targetIndex = parseInt(target.getAttribute('data-target-index') ?? '');\n\t\t\tif (!isNaN(targetIndex)) {\n\t\t\t\tconst text = target.textContent ?? '';\n\t\t\t\tthis.updateTransformation(targetIndex, text);\n\t\t\t}\n\t\t}\n\t};\n\n\tprivate onDragStart = (e: Event) => {\n\t\tconst dragEvent = e as DragEvent;\n\t\tconst target = dragEvent.target as HTMLElement;\n\n\t\tif (!dragEvent.dataTransfer) return;\n\t\tif (!target.classList.contains('chip')) return;\n\n\t\tconst word = target.getAttribute('data-word') || target.textContent || '';\n\t\tif (!word) return;\n\n\t\tdragEvent.dataTransfer.setData('text/plain', word);\n\t\tdragEvent.dataTransfer.effectAllowed = 'move';\n\t};\n\n\tprivate onDragOver = (e: Event) => {\n\t\tconst dragEvent = e as DragEvent;\n\t\tconst target = dragEvent.target as HTMLElement;\n\n\t\tif (!target.classList.contains('dropzone')) return;\n\t\tdragEvent.preventDefault();\n\t\tdragEvent.dataTransfer!.dropEffect = 'move';\n\t};\n\n\tprivate onDrop = (e: Event) => {\n\t\tconst dragEvent = e as DragEvent;\n\t\tconst target = dragEvent.target as HTMLElement;\n\n\t\tif (!target.classList.contains('dropzone')) return;\n\t\tdragEvent.preventDefault();\n\t\tif (!dragEvent.dataTransfer) return;\n\n\t\tconst index = parseInt(target.getAttribute('data-index') ?? '');\n\t\tif (isNaN(index)) return;\n\n\t\tconst word = dragEvent.dataTransfer.getData('text/plain');\n\t\tif (!word) return;\n\n\t\tthis.placeWordInDropzone(index, word);\n\t};\n\n\t// ==================== STATE MANAGEMENT ====================\n\n\tprivate _activeCategory: string | null = null;\n\n\tprivate toggleWordSelection(index: number) {\n\t\tif (!this._state.selectedIndices) {\n\t\t\tthis._state.selectedIndices = new Set();\n\t\t}\n\n\t\tif (this._state.selectedIndices.has(index)) {\n\t\t\tthis._state.selectedIndices.delete(index);\n\t\t} else {\n\t\t\tthis._state.selectedIndices.add(index);\n\t\t}\n\n\t\tthis.render();\n\t\tthis.emitChange();\n\t}\n\n\tprivate setActiveCategory(category: string) {\n\t\tthis._activeCategory = category;\n\n\t\t// Visual feedback: highlight active category button\n\t\tthis.shadowRoot?.querySelectorAll('.category-btn').forEach((btn) => {\n\t\t\tif (btn.getAttribute('data-category') === category) {\n\t\t\t\tbtn.classList.add('category-active');\n\t\t\t\tbtn.setAttribute('data-active', 'true');\n\t\t\t} else {\n\t\t\t\tbtn.classList.remove('category-active');\n\t\t\t\tbtn.removeAttribute('data-active');\n\t\t\t}\n\n\t\t\tif (btn instanceof EduBlock) {\n\t\t\t\tbtn.variant = (this.getAttribute(\"variant\") ?? \"outline\") as Variant;\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate assignWordToCategory(index: number, category: string) {\n\t\tif (!this._state.wordCategories) {\n\t\t\tthis._state.wordCategories = {};\n\t\t}\n\n\t\t// Toggle: if word is already assigned to this category, unassign it\n\t\tif (this._state.wordCategories[index] === category) {\n\t\t\tdelete this._state.wordCategories[index];\n\t\t} else {\n\t\t\tthis._state.wordCategories[index] = category;\n\t\t}\n\n\t\tthis.render();\n\t\tthis.emitChange();\n\t}\n\n\tprivate updateInputValue(id: string, value: any) {\n\t\tif (!this._state.inputValues) {\n\t\t\tthis._state.inputValues = {};\n\t\t}\n\n\t\tthis._state.inputValues[id] = value;\n\t\tthis.emitChange();\n\t}\n\n\tprivate updateTransformation(targetIndex: number, text: string) {\n\t\tif (!this._state.transformations) {\n\t\t\tthis._state.transformations = {};\n\t\t}\n\n\t\tconst words = text.split(/\\s+/).filter(Boolean);\n\t\tthis._state.transformations[targetIndex] = words;\n\n\t\tthis.emitChange();\n\t}\n\n\tprivate placeWordInDropzone(index: number, word: string) {\n\t\tif (!this._state.dndPlacements) {\n\t\t\tthis._state.dndPlacements = {};\n\t\t}\n\n\t\tthis._state.dndPlacements[index] = word;\n\t\tthis.render();\n\t\tthis.emitChange();\n\t}\n\n\tprivate clearDropzone(index: number) {\n\t\tif (!this._state.dndPlacements) return;\n\t\tif (!(index in this._state.dndPlacements)) return;\n\n\t\tdelete this._state.dndPlacements[index];\n\t\tthis.render();\n\t\tthis.emitChange();\n\t}\n\n\tprivate emitChange() {\n\t\tconst detail: EduTextChangeDetail = {\n\t\t\tuserState: this.getValue(),\n\t\t\tdataType: this._config.data.type\n\t\t};\n\n\t\tthis.dispatchEvent(new CustomEvent<EduTextChangeDetail>('change', {\n\t\t\tdetail,\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\t}\n}\n\nfunction normalizeWord(value: string): string {\n\treturn value.trim().toLowerCase();\n}\n\nif (!customElements.get('edu-text')) customElements.define('edu-text', EduText);\n", "import { BaseInteraction } from \"../core/BaseInteraction\";\nimport { CognitiveOp } from \"../shared/types\";\nimport { InteractionData } from \"../types/Data\";\nimport { InteractionMechanic } from \"../types/Interactions\";\n\nexport type InteractionConstructor = new (...args: any[]) => BaseInteraction<InteractionData>;\n\nexport type InteractionCapabilities = {\n\tisSequential: boolean;\n\timplementsProgress: boolean;\n\tusesAssets: boolean;\n\thasParser: boolean;\n\thasValidator: boolean;\n\thasGrader: boolean;\n};\n\nexport type InteractionRegistryItem = {\n\tid: string;\n\tlabel: string;\n\telementTag: string;\n\tcognitiveOp?: CognitiveOp;\n\tmechanic: InteractionMechanic;\n\tengine: \"tables\" | \"text\" | \"direct\" | \"mixed\";\n\tctor: InteractionConstructor;\n\tcapabilities: InteractionCapabilities;\n};\n\nconst interactionsRegistry = new Map<string, InteractionRegistryItem>();\n\nexport const registerInteraction = (item: InteractionRegistryItem): void => {\n\tconst current = interactionsRegistry.get(item.id);\n\tif (current) {\n\t\tif (current.ctor === item.ctor) return;\n\t\tthrow new Error(`Duplicate interaction id: \"${item.id}\"`);\n\t}\n\n\tinteractionsRegistry.set(item.id, item);\n};\n\nexport const unregisterInteraction = (id: string): boolean => {\n\treturn interactionsRegistry.delete(id);\n};\n\nexport const clearInteractionRegistry = (): void => {\n\tinteractionsRegistry.clear();\n};\n\nexport const getInteractionRegistry = (): ReadonlyMap<string, InteractionRegistryItem> => {\n\treturn interactionsRegistry;\n};\n\nexport const listInteractions = (): InteractionRegistryItem[] => {\n\treturn Array.from(interactionsRegistry.values());\n};\n\nexport const getInteraction = (id: string): InteractionRegistryItem | null => {\n\treturn interactionsRegistry.get(id) ?? null;\n};\n\nexport const createInteraction = (id: string, ...args: any[]): BaseInteraction<InteractionData> => {\n\tconst item = getInteraction(id);\n\tif (!item) {\n\t\tthrow new Error(`Unknown interaction \"${id}\"`);\n\t}\n\treturn new item.ctor(...args);\n};\n", "import { \n\tAssetType,\n\tAssetRegistryInput,\n\tAsset,\n\tImageAsset,\n\tAudioAsset,\n\tVideoAsset,\n\tHtmlAsset,\n\tTtsAsset,\n\tNormalizedAssets\n} from \"../types/Assets\";\n\nimport { isString, isNumber, looksLikeTime, typeOf, isPlainObject } from \"./utils\";\n\nexport class AssetValidationError extends Error {\n\tissues: string[];\n\tconstructor(issues: string[]) {\n\t\tsuper(`Asset validation failed:n- ${issues.join(\"\\n- \")}`);\n\t\tthis.name = \"AssetValidationError\";\n\t\tthis.issues = issues;\n\t};\n}\n\nexport function validateAndNormalizeAssets(input: unknown): NormalizedAssets {\n\tconst issues: string[] = [];\n\n\tif (!isPlainObject(input)) {\n\t\tthrow new AssetValidationError([\n\t\t\t`Top-level assets must be an object/map like { mango: {...}, trend: {...} }`,\n\t\t]);\n\t}\n\n\tconst raw = input as AssetRegistryInput;\n\tconst assetsById: Record<string, Asset> = {};\n\n\tfor (const [id, value] of Object.entries(raw)) {\n\n\t\tif (!id || typeof id !== \"string\") {\n\t\t\tissues.push(`Asset key must be a non-empty string (got: ${String(id)})`);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!/^[a-zA-Z0-9._-]+$/.test(id)) {\n\t\t\tissues.push(\n\t\t\t\t`Asset id \"${id}\" has invalid chars; use letters/numbers/._-`\n\t\t\t);\n\t\t}\n\n\t\tif (!isPlainObject(value)) {\n\t\t\tissues.push(`Asset \"${id}\" must be an object (got: ${typeOf(value)})`);\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst obj = value as Record<string, unknown>;\n\t\tconst type = obj.type;\n\t\tconst dialog = Boolean(obj.dialog);\n\n\t\tif (!isString(type)) {\n\t\t\tissues.push(`Asset \"${id}\" missing string field \"type\"`);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!isAssetType(type)) {\n\t\t\tissues.push(\n\t\t\t\t`Asset \"${id}\" has unsupported type \"${type}\" (use image|video|audio|html)`\n\t\t\t);\n\t\t\tcontinue;\n\t\t}\n\n\t\tswitch (type) {\n\n\t\t\tcase \"image\": {\n\t\t\t\tconst url = obj.url;\n\t\t\t\tif (!isString(url)) issues.push(`Asset \"${id}\" (image) missing \"url\"`);\n\n\t\t\t\tconst size = obj.size;\n\t\t\t\tif (size !== undefined && !isString(size)) {\n\t\t\t\t\tissues.push(`Asset \"${id}\" (image) field \"size\" must be a string`);\n\t\t\t\t}\n\n\t\t\t\tif (isString(url)) {\n\t\t\t\t\tassetsById[id] = {\n\t\t\t\t\t\tid,\n\t\t\t\t\t\ttype,\n\t\t\t\t\t\tdialog,\n\t\t\t\t\t\turl,\n\t\t\t\t\t\t...(isString(size) ? { size } : {}),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase \"video\": {\n\t\t\t\tconst url = obj.url;\n\t\t\t\tif (!isString(url)) issues.push(`Asset \"${id}\" (video) missing \"url\"`);\n\n\t\t\t\tconst span = obj.span;\n\t\t\t\tlet normalizedSpan: VideoAsset[\"span\"] | undefined;\n\n\t\t\t\tif (span !== undefined) {\n\t\t\t\t\tif (!isPlainObject(span)) {\n\t\t\t\t\t\tissues.push(`Asset \"${id}\" (video) field \"span\" must be an object`);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst from = (span as any).from;\n\t\t\t\t\t\tconst to = (span as any).to;\n\t\t\t\t\t\tif (!isString(from) || !isString(to)) {\n\t\t\t\t\t\t\tissues.push(\n\t\t\t\t\t\t\t`Asset \"${id}\" (video) span requires string \"from\" and \"to\"`\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Light format check: mm:ss or hh:mm:ss\n\t\t\t\t\t\t\tif (!looksLikeTime(from) || !looksLikeTime(to)) {\n\t\t\t\t\t\t\t\tissues.push(\n\t\t\t\t\t\t\t\t\t`Asset \"${id}\" (video) span times should look like \"02:15\" or \"01:02:45\"`\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tnormalizedSpan = { from, to };\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (isString(url)) {\n\t\t\t\t\tassetsById[id] = {\n\t\t\t\t\t\tid,\n\t\t\t\t\t\ttype,\n\t\t\t\t\t\tdialog,\n\t\t\t\t\t\turl,\n\t\t\t\t\t\t...(normalizedSpan ? { span: normalizedSpan } : {}),\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase \"audio\": {\n\t\t\t\tconst url = obj.url;\n\t\t\t\tif (!isString(url)) issues.push(`Asset \"${id}\" (audio) missing \"url\"`);\n\n\t\t\t\tconst volume = obj.volume;\n\t\t\t\tif (volume !== undefined) {\n\t\t\t\t\tif (!isNumber(volume) || !Number.isFinite(volume)) {\n\t\t\t\t\t\tissues.push(\n\t\t\t\t\t\t\t`Asset \"${id}\" (audio) field \"volume\" must be a number`\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if (volume < 0 || volume > 100) {\n\t\t\t\t\t\tissues.push(\n\t\t\t\t\t\t\t`Asset \"${id}\" (audio) field \"volume\" must be between 0 and 100`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (isString(url)) {\n\t\t\t\t\tassetsById[id] = {\n\t\t\t\t\t\tid,\n\t\t\t\t\t\ttype,\n\t\t\t\t\t\tdialog,\n\t\t\t\t\t\turl,\n\t\t\t\t\t\t...(isNumber(volume) ? { volume } : {}),\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase \"html\": {\n\t\t\t\tconst content = obj.content;\n\t\t\t\tif (!isString(content)) {\n\t\t\t\t\tissues.push(`Asset \"${id}\" (html) missing string field \"content\"`);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tassetsById[id] = { id, type, dialog, content };\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase \"tts\": {\n\t\t\t\tconst content = obj.content;\n\t\t\t\tif (!isString(content)) {\n\t\t\t\t\tissues.push(`Asset \"${id}\" (tts) missing string field \"content\"`);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tassetsById[id] = { id, type, dialog, content };\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t\n\tif (issues.length) throw new AssetValidationError(issues);\n\n\tconst assetsList = Object.keys(assetsById)\n\t\t.sort((a, b) => a.localeCompare(b))\n\t\t.map((id) => assetsById[id]);\n\n\treturn { assetsById, assetsList };\n}\n \nfunction isAssetType(v: string): v is AssetType {\n\treturn v === \"image\" || v === \"video\" || v === \"audio\" || v === \"html\";\n}\n\n", "import { ClassificationData } from \"../../../types/Data\";\nimport { GradingResult } from \"../../../types/Grading\";\n\nexport function classificationGrader(correctData: ClassificationData[\"categories\"], userData: Map<string, string>, els): GradingResult {\n\tlet correctCount = 0;\n\tlet totalCount = 0;\n\n\tcorrectData.forEach(category => {\n\t\tcategory.items.forEach(correctItem => {\n\t\t\ttotalCount++;\n\t\t\tconst userCategory = userData.get(correctItem);\n\t\t\tconst el = els.querySelector(`[data-label=\"${correctItem}\"]`);\n\t\t\tif (userCategory === category.label) {\n\t\t\t\tcorrectCount++;\n\t\t\t\tel.chipState = \"correct\";\n\t\t\t} else el.chipState = \"wrong\"; \n\t\t});\n\t});\n\t\n\tconst score = totalCount > 0 ? Math.round((correctCount / totalCount) * 100) : 0;\n\treturn { score: score, correct: correctCount, total: totalCount }; \t\n}\n", "/**\n * Open Classification \n *\n * No idea if there's something like out there, but it's something I just came with\n */\n\nimport { BaseInteraction } from \"../../core/BaseInteraction\";\nimport { Variant } from \"../../shared/types\";\n\nimport { InteractionConfig, InteractionMechanic } from \"../../types/Interactions\";\nimport { NormalizedAssets } from \"../../types/Assets\";\nimport { ClassificationData } from \"../../types/Data\";\n\nimport { EduChip, setUpChipData } from \"../../ui/misc/chip\";\nimport { EduBlock } from \"../../ui/misc/block\";\n\nimport { shuffle } from \"../../shared\";\nimport { classificationGrader } from \"../shared/classification-implementation\";\n\nexport class OpenClassification extends BaseInteraction<ClassificationData> {\n\t\n\tinteractionMechanic: InteractionMechanic = \"static\";\n\n\tprivate categories: string[] = [\"none\"];\n\tprivate allItems: string[] = [];\n\n\tprivate categoryColors: string[] = [\n\t\t'#94a3b8',\n\t\t'#3b82f6',\n\t\t'#10b981',\n\t\t'#f59e0b',\n\t\t'#ef4444',\n\t\t'#8b5cf6',\n\t\t'#ec4899',\n\t\t'#14b8a6',\n\t\t'#f97316',\n\t\t'#6366f1'\n\t];\n\n\tprivate categorized: Map<string, string>;\n\tprivate currentCategory: string;\n\tprivate currentColor: string = this.categoryColors[0];\n\n\t// DOM elements\n\tprivate $categoriesBar!: HTMLDivElement;\n\n\tconstructor(\n\t\tdata: ClassificationData, config: InteractionConfig, assets: NormalizedAssets | null\n\t) {\n\t\tsuper(data, config, assets);\n\n\t\tthis.data.categories.forEach(({label, items}) => {\n\t\t\tthis.categories.push(label);\n\t\t\tthis.allItems.push(...items);\n\t\t});\n\n\t\tthis.currentCategory = this.categories[0];\n\n\t\tif (this.data.distractors) {\n\t\t\tthis.allItems.push(...this.data.distractors);\n\t\t}\n\n\t\tthis.allItems = shuffle(this.allItems);\n\n\t\tthis.categorized = new Map<string, string>();\n\t\tthis.initializeProgress(this.allItems.length);\n\t}\n\n\tprotected initialize(): void {}\n\tprotected cleanup(): void {}\n\n\tonVariantChange(newVariant: Variant): void {\n\t\tthis.querySelectorAll('edu-chip, edu-block').forEach((el: EduChip | EduBlock) => {\n\t\t\tif (el.variant !== undefined) {\n\t\t\t\tel.variant = newVariant;\n\t\t\t}\n\t\t});\n\t}\n\n\t// ==================== RENDERING ====================\n\n\trender(): void {\n\t\tthis.innerHTML = `\n\t\t\t<style>\n\t\t\t\topen-classification {\n\t\t\t\t\t--current-color: #94a3b8;\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t\tcontainer-type: size;\n\t\t\t\t\tcontainer-name: open-classification;\n\t\t\t\t}\n\n\t\t\t\t.container {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\tflex-direction: column;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tgap: clamp(0.5rem, min(1.6cqw, 1.6cqh), 1rem);\n\t\t\t\t\tpadding: clamp(0.75rem, min(2cqw, 2cqh), 1.5rem);\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t\toverflow: hidden;\n\t\t\t\t}\n\n\t\t\t\t@container open-classification (max-width: 768px) {\n\t\t\t\t\t.container {\n\t\t\t\t\t\tpadding: clamp(0.75rem, min(1.6cqw, 1.6cqh), 1rem);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t.items-section {\n\t\t\t\t\tflex: 1;\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\tflex-direction: column;\n\t\t\t\t\tgap: clamp(0.25rem, min(1cqw, 1cqh), 0.5rem);\n\t\t\t\t\tmin-height: 0;\n\t\t\t\t\toverflow: hidden;\n\t\t\t\t}\n\n\t\t\t\t.items-label {\n\t\t\t\t\tfont-size: clamp(0.8rem, 1.8cqh, 1rem);\n\t\t\t\t\tfont-weight: 600;\n\t\t\t\t\tcolor: rgb(var(--edu-second-ink));\n\t\t\t\t\tflex-shrink: 0;\n\t\t\t\t}\n\n\t\t\t\t.items-container {\n\t\t\t\t\tdisplay: grid;\n\t\t\t\t\tgrid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));\n\t\t\t\t\tgrid-auto-rows: minmax(44px, 1fr);\n\t\t\t\t\tgap: clamp(0.5rem, min(1.6cqw, 1.6cqh), 1rem);\n\t\t\t\t\tpadding: clamp(0.5rem, min(1.6cqw, 1.6cqh), 1.25rem);\n\t\t\t\t\tbackground: rgb(var(--edu-muted));\n\t\t\t\t\tborder-radius: clamp(6px, 1.6cqw, 8px);\n\t\t\t\t\tflex: 1;\n\t\t\t\t\toverflow-y: auto;\n\t\t\t\t\toverflow-x: hidden;\n\t\t\t\t\talign-content: stretch;\n\t\t\t\t\tmin-height: 0;\n\t\t\t\t}\n\n\t\t\t\t.items-container edu-chip {\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tcursor: pointer;\n\t\t\t\t\ttransition: transform 0.2s ease, box-shadow 0.2s ease;\n\t\t\t\t}\n\n\t\t\t\t.items-container edu-chip:hover {\n\t\t\t\t\ttransform: translateY(-3px);\n\t\t\t\t\tbox-shadow: 0 6px 16px rgba(var(--edu-shadow-color), 0.15);\n\t\t\t\t}\n\n\t\t\t\t.items-container edu-chip::part(block) {\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\talign-items: center;\n\t\t\t\t\tjustify-content: center;\n\t\t\t\t}\n\n\t\t\t\t@container open-classification (max-width: 1024px) {\n\t\t\t\t\t.items-container {\n\t\t\t\t\t\tgrid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));\n\t\t\t\t\t\tgap: clamp(0.5rem, min(1.4cqw, 1.4cqh), 0.875rem);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t@container open-classification (max-width: 768px) {\n\t\t\t\t\t.items-container {\n\t\t\t\t\t\tgrid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr));\n\t\t\t\t\t\tpadding: clamp(0.5rem, min(1.2cqw, 1.2cqh), 1rem);\n\t\t\t\t\t\tgap: clamp(0.5rem, min(1.2cqw, 1.2cqh), 0.75rem);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t@container open-classification (max-width: 560px) {\n\t\t\t\t\t.items-container {\n\t\t\t\t\t\tgrid-template-columns: repeat(auto-fit, minmax(min(100%, 110px), 1fr));\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t.divider {\n\t\t\t\t\tborder: none;\n\t\t\t\t\tborder-top: 1px solid rgb(var(--edu-border));\n\t\t\t\t\tmargin: 0;\n\t\t\t\t\tflex-shrink: 0;\n\t\t\t\t}\n\n\t\t\t\t.swatch-section {\n\t\t\t\t\tflex-shrink: 0;\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\tflex-direction: column;\n\t\t\t\t\tgap: clamp(0.25rem, min(1cqw, 1cqh), 0.5rem);\n\t\t\t\t}\n\n\t\t\t\t.swatch-label {\n\t\t\t\t\tfont-size: clamp(0.8rem, 1.8cqh, 1rem);\n\t\t\t\t\tfont-weight: 600;\n\t\t\t\t\tcolor: rgb(var(--edu-second-ink));\n\t\t\t\t\tflex-shrink: 0;\n\t\t\t\t}\n\n\t\t\t\t.categories-bar {\n\t\t\t\t\tdisplay: grid;\n\t\t\t\t\tgrid-template-columns: repeat(auto-fit, minmax(min(100%, 110px), 1fr));\n\t\t\t\t\tgap: clamp(0.4rem, min(1.2cqw, 1.2cqh), 0.75rem);\n\t\t\t\t}\n\n\t\t\t\t#categories-bar edu-block::part(block) {\n\t\t\t\t\tpadding: clamp(0.35rem, min(1cqw, 1cqh), 0.6rem);\n\t\t\t\t\tfont-size: clamp(0.75rem, 1.6cqh, 0.95rem);\n\t\t\t\t\tmin-height: clamp(44px, 8cqh, 64px);\n\t\t\t\t}\n\n\t\t\t\t#categories-bar edu-block.active::part(block) {\n\t\t\t\t\tbackground: var(--category-color);\n\t\t\t\t\tborder-color: var(--category-color);\n\t\t\t\t\tcolor: rgb(var(--edu-inverted-ink));\n\t\t\t\t\tbox-shadow: 0 0 0 3px rgb(var(--edu-first-accent) / 0.2);\n\t\t\t\t}\n\t\t\t</style>\n\n\t\t\t<div class=\"container\">\n\t\t\t\t<div class=\"items-section\">\n\t\t\t\t\t<!--Sacrificing label for space-->\n\t\t\t\t\t<div class=\"items-container\"></div>\n\t\t\t\t</div>\n\n\t\t\t\t<hr class=\"divider\">\n\n\t\t\t\t<div class=\"swatch-section\">\n\t\t\t\t\t<div class=\"swatch-label\">Categories</div>\n\t\t\t\t</div>\n\n\t\t\t\t<div class=\"categories-bar\" id=\"categories-bar\">\n\t\t\t\t\t<!-- Categories populated dynamically -->\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t`;\n\n\t\tthis.style.setProperty('--current-color', this.currentColor);\n\n\t\tthis.$categoriesBar = this.querySelector(\"#categories-bar\") as HTMLDivElement;\n\t\tthis.setCategories(this.$categoriesBar);\n\n\t\tconst itemsContainer = this.querySelector(\".items-container\") as HTMLDivElement;\n\t\tthis.setItems(itemsContainer);\n\t}\n\n\tprivate setItems(container: HTMLDivElement): void {\n\t\tthis.allItems.forEach((item, i) => {\n\t\t\tconst chip = document.createElement(\"edu-chip\") as EduChip;\n\t\t\tchip.variant = this.config.variant;\n\t\t\t// chip.prefix = `${i+1}:`;\n\t\t\tchip.dataset.label = item;\n\n\t\t\tsetUpChipData(item, chip, this.assets?.assetsById);\n\n\t\t\tchip.addEventListener(\"click\", (e) => {\n\t\t\t\tconst chip = e.currentTarget as EduChip;\n\t\t\t\tconst label = chip.dataset.label!;\n\n\t\t\t\tif (this.categorized.get(label) === this.currentCategory) {\n\t\t\t\t\tthis.categorized.delete(label);\n\t\t\t\t\tchip.colored = false;\n\t\t\t\t\tthis.decrementProgress();\n\t\t\t\t\tthis.emitStateChange();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (!this.categorized.has(label)) {\n\t\t\t\t\tthis.incrementProgress();\n\t\t\t\t}\n\n\t\t\t\tthis.categorized.set(label, this.currentCategory);\n\t\t\t\tchip.color = this.currentColor;\n\t\t\t\tchip.colored = true;\n\t\t\t\tthis.emitStateChange();\n\t\t\t});\n\n\t\t\tcontainer.append(chip);\n\t\t});\n\t}\n\n\tprivate setCategories(container: HTMLDivElement): void {\n\t\tthis.categories.forEach((cat, i) => {\n\t\t\tconst categoryBlock = new EduBlock();\n\t\t\tcategoryBlock.variant = this.config.variant;\n\n\t\t\tconst color = this.categoryColors[i % this.categoryColors.length];\n\n\t\t\tcategoryBlock.dataset.category = cat;\n\t\t\tcategoryBlock.dataset.color = color;\n\t\t\tcategoryBlock.style.setProperty('--category-color', color);\n\t\t\tcategoryBlock.innerHTML = `\n\t\t\t\t<div class=\"category-label\">${cat}</div>\n\t\t\t`;\n\n\t\t\tcategoryBlock.addEventListener(\"click\", (e) => {\n\t\t\t\tconst block = e.currentTarget as HTMLElement;\n\t\t\t\tthis.currentCategory = block.dataset.category!;\n\t\t\t\tthis.currentColor = block.dataset.color!;\n\n\t\t\t\tthis.style.setProperty('--current-color', this.currentColor);\n\t\t\t\tcontainer.querySelectorAll('edu-block').forEach((el) => el.classList.remove('active'));\n\t\t\t\tcategoryBlock.classList.add('active');\n\t\t\t});\n\n\t\t\tif (cat === this.currentCategory) {\n\t\t\t\tcategoryBlock.classList.add('active');\n\t\t\t}\n\n\t\t\tcontainer.append(categoryBlock);\n\t\t});\n\t}\n\n\t// ==================== INTERACTION LOGIC ====================\n\n\tgetCurrentState(): any {\n\t\treturn {\n\t\t\tcategorized: Object.fromEntries(this.categorized),\n\t\t\tprogress: this.progressTracker.current\n\t\t};\n\t}\n\n\tisInteractionComplete(): boolean {\n\t\tif (this.categorized.size !== this.allItems.length) {\n\t\t\treturn false;\n\t\t}\n\n\t\tfor (const value of this.categorized.values()) {\n\t\t\tif (value === null || value === undefined) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tonHint(): void {\n\t\tconst uncategorized = this.allItems.filter(item => !this.categorized.has(item));\n\n\t\tif (uncategorized.length === 0) {\n\t\t\talert('All items are categorized! Click \"Check\" to submit.');\n\t\t\tthis.emitHintShown('All items categorized');\n\t\t\treturn;\n\t\t}\n\n\t\tconst firstUncategorized = uncategorized[0];\n\t\talert(`Hint: You haven't categorized \"${firstUncategorized}\" yet. Which category does it belong to?`);\n\t\tthis.emitHintShown(`Uncategorized item: ${firstUncategorized}`);\n\t}\n\n\t// ==================== GRADING ====================\n\n\tpublic submit(): void {\n\t\tsuper.submit();\n\t\tconst result = classificationGrader(this.data.categories, this.categorized, this);\n\t\t\n\t\tconsole.log(`Classification Score: ${result.score.toFixed(1)}% (${result.correct}/${result.total} correct)`);\n\n\t\tthis.dispatchEvent(new CustomEvent('interaction:graded', {\n\t\t\tdetail: { result },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\n\t\tthis.setAttribute(\"inert\", \"\");\n\t}\n\n\t// ==================== RESET ====================\n\n\tpublic reset(): void {\n\t\tsuper.reset();\n\t\tthis.categorized.clear();\n\n\t\tthis.querySelectorAll('edu-chip').forEach((chip: any) => {\n\t\t\tchip.classList.remove('colorized');\n\t\t\tchip.style.setProperty('--current-color', '');\n\t\t});\n\t}\n}\n\n// Register as custom element\nif (!customElements.get('open-classification')) {\n\tcustomElements.define('open-classification', OpenClassification);\n}\n", "/**\n * SEQUENTIAL CLASSIFICATION - Classify items one at a time\n *\n * interaction mechanics inspired from\n * @see https://learningapps.org\n */\n\nimport { BaseInteraction } from \"../../core/BaseInteraction\";\nimport { Variant } from \"../../shared/types\";\n\nimport { InteractionConfig, InteractionMechanic } from \"../../types/Interactions\";\nimport { NormalizedAssets } from \"../../types/Assets\";\nimport { ClassificationData } from \"../../types/Data\";\n\nimport { EduChip, setUpChipData } from \"../../ui/misc/chip\";\nimport { EduBlock } from \"../../ui/misc/block\";\n\nimport { shuffle, randomHexColorsList } from \"../../shared\";\nimport { classificationGrader } from \"../shared/classification-implementation\";\n\nexport class SequentialClassification extends BaseInteraction<ClassificationData> {\n\n\tinteractionMechanic: InteractionMechanic = \"automatic-sequencing\";\n\n\tprivate categories: string[] = [];\n\tprivate allItems: string[] = [];\n\t\n\tprivate categorized: Map<string, string | null> = new Map();\n\n\tprivate container: HTMLDivElement;\n\tprivate centerZone: HTMLDivElement;\n\tprivate zonesGrid!: HTMLDivElement;\n\tprivate zones: EduBlock[] = [];\n\tprivate chips: EduChip[] = [];\n\tprivate activeChip: EduChip | null = null;\n\tprivate currentZone: HTMLDivElement | EduBlock | null = null;\n\n\tprivate isDragging: boolean = false;\n\tprivate startX: number = 0;\n\tprivate startY: number = 0;\n\tprivate offsetX: number = 0;\n\tprivate offsetY: number = 0;\n\n\tprivate boundPointerMove: (e: PointerEvent) => void;\n\tprivate boundPointerUp: (e: PointerEvent) => void;\n\t\n\tprivate variant: Variant;\n\n\tconstructor(\n\t\tdata: ClassificationData, config: InteractionConfig, assets: NormalizedAssets | null\n\t) {\n\t\tsuper(data, config, assets);\n\n\t\tthis.data.categories.forEach(({label, items}) => {\n\t\t\tthis.categories.push(label);\n\t\t\tthis.allItems.push(...items);\n\t\t});\n\n\t\tif (this.data.distractors) {\n\t\t\tconsole.warn(\"Found a distractor in a Sequential Classification interaction, those are not useful and will be ignored\");\n\t\t}\n\n\t\tthis.allItems = this.config.shuffle ? shuffle(this.allItems) : this.allItems;\n\n\t\tthis.initializeProgress(this.allItems.length);\n\n\t\tthis.boundPointerMove = this.handlePointerMove.bind(this);\n\t\tthis.boundPointerUp = this.handlePointerUp.bind(this);\n\n\t\tthis.variant = this.config.variant;\n\t}\n\n\tprotected initialize(): void {\n\t\twindow.addEventListener(\"pointermove\", this.boundPointerMove);\n\t\twindow.addEventListener(\"pointerup\", this.boundPointerUp);\n\t}\n\n\tprotected cleanup(): void {\n\t\twindow.removeEventListener(\"pointermove\", this.boundPointerMove);\n\t\twindow.removeEventListener(\"pointerup\", this.boundPointerUp);\n\t}\n\n\tonVariantChange(newVariant: Variant): void {\n\t\tthis.querySelectorAll('edu-chip, edu-block').forEach((el: EduChip | EduBlock) => {\n\t\t\tif (el.variant !== undefined) el.variant = newVariant;\n\t\t});\n\t\tthis.variant = newVariant;\n\t}\n\n\t// ==================== RENDERING ====================\n\n\trender(): void {\n\t\tconst gridCols = Math.min(this.categories.length, 4);\n\n\t\tthis.innerHTML = `\n\t\t\t<style>\n\t\t\t\tsequential-classification {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t\tcontainer-type: size;\n\t\t\t\t\tcontainer-name: sequential-classification;\n\t\t\t\t}\n\n\t\t\t\t#container {\n\t\t\t\t\tposition: relative;\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\tflex-direction: column;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tgap: clamp(0.5rem, min(1.6cqw, 1.6cqh), 1rem);\n\t\t\t\t\tpadding: clamp(0.75rem, min(2cqw, 2cqh), 1.5rem);\n\t\t\t\t\tbackground: rgb(var(--edu-bg));\n\t\t\t\t\tborder-radius: clamp(8px, 2cqw, 12px);\n\t\t\t\t\toverflow: hidden;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t}\n\n\t\t\t\t.center-zone-container {\n\t\t\t\t\tflex-shrink: 0;\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\tflex-direction: column;\n\t\t\t\t\tgap: clamp(0.25rem, min(1cqw, 1cqh), 0.5rem);\n\t\t\t\t}\n\n\t\t\t\t.center-zone-label {\n\t\t\t\t\tfont-size: clamp(0.8rem, 1.8cqh, 1rem);\n\t\t\t\t\tfont-weight: 600;\n\t\t\t\t\tcolor: rgb(var(--edu-second-ink));\n\t\t\t\t}\n\n\t\t\t\t#center-zone {\n\t\t\t\t\tmin-height: clamp(70px, 12cqh, 120px);\n\t\t\t\t\theight: clamp(70px, 12cqh, 120px);\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\talign-items: center;\n\t\t\t\t\tjustify-content: center;\n\t\t\t\t\tbackground: rgba(var(--edu-muted), 0.5);\n\t\t\t\t\tborder-radius: clamp(8px, 2cqw, 12px);\n\t\t\t\t\tborder: 2px dashed rgb(var(--edu-border));\n\t\t\t\t\tposition: relative;\n\t\t\t\t}\n\n\t\t\t\t#center-zone.empty::before {\n\t\t\t\t\tcontent: 'All items categorized!';\n\t\t\t\t\tcolor: rgb(var(--edu-third-ink));\n\t\t\t\t\tfont-size: 0.9rem;\n\t\t\t\t\topacity: 0.6;\n\t\t\t\t}\n\n\t\t\t\t.zones-container {\n\t\t\t\t\tflex: 1;\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\tflex-direction: column;\n\t\t\t\t\tgap: clamp(0.25rem, min(1cqw, 1cqh), 0.5rem);\n\t\t\t\t\tmin-height: 0;\n\t\t\t\t\toverflow: hidden;\n\t\t\t\t}\n\n\t\t\t\t.zones-label {\n\t\t\t\t\tfont-size: clamp(0.8rem, 1.8cqh, 1rem);\n\t\t\t\t\tfont-weight: 600;\n\t\t\t\t\tcolor: rgb(var(--edu-second-ink));\n\t\t\t\t\tflex-shrink: 0;\n\t\t\t\t}\n\n\t\t\t\t#zones-grid {\n\t\t\t\t\tposition: relative;\n\t\t\t\t\tflex: 1;\n\t\t\t\t\tdisplay: grid;\n\t\t\t\t\tgrid-template-columns: repeat(${gridCols}, minmax(0, 1fr));\n\t\t\t\t\tgrid-auto-rows: minmax(44px, 1fr);\n\t\t\t\t\tgap: clamp(0.5rem, min(1.5cqw, 1.5cqh), 1rem);\n\t\t\t\t\toverflow-y: auto;\n\t\t\t\t\toverflow-x: hidden;\n\t\t\t\t\talign-content: stretch;\n\t\t\t\t\tpadding: clamp(0.25rem, min(1cqw, 1cqh), 0.5rem);\n\t\t\t\t\tmin-height: 0;\n\t\t\t\t}\n\n\t\t\t\t.zone {\n\t\t\t\t\tborder-radius: 8px;\n\t\t\t\t\tbox-shadow: 0 4px 6px -1px rgb(var(--edu-shadow-color) / 0.1);\n\t\t\t\t\ttransition: all 0.3s ease;\n\t\t\t\t\tfont-weight: 700;\n\t\t\t\t\tfont-size: clamp(1rem, 3cqh, 1.6rem);\n\t\t\t\t\ttext-align: center;\n\t\t\t\t\tborder: 3px solid transparent;\n\t\t\t\t\topacity: 0.8;\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\talign-items: center;\n\t\t\t\t\tjustify-content: center;\n\t\t\t\t\tposition: relative;\n\t\t\t\t\theight: 100%;\n\t\t\t\t}\n\n\t\t\t\t.zone.highlight {\n\t\t\t\t\ttransform: scale(1.02);\n\t\t\t\t\topacity: 1;\n\t\t\t\t\tbox-shadow: 0 8px 16px rgba(var(--edu-first-accent), 0.3);\n\t\t\t\t}\n\n\t\t\t\t.zone.empty::after {\n\t\t\t\t\tcontent: 'Drop here';\n\t\t\t\t\tposition: absolute;\n\t\t\t\t\tbottom: 0.5rem;\n\t\t\t\t\tfont-size: clamp(0.7rem, 1.8cqh, 0.9rem);\n\t\t\t\t\tfont-weight: 500;\n\t\t\t\t\topacity: 0.4;\n\t\t\t\t\tcolor: rgb(var(--edu-ink));\n\t\t\t\t}\n\n\t\t\t\tedu-block::part(block) {\n\t\t\t\t\theight: 100%;\n\t\t\t\t}\n\n\t\t\t\tedu-chip {\n\t\t\t\t\tposition: absolute;\n\t\t\t\t\tuser-select: none;\n\t\t\t\t\ttouch-action: none;\n\t\t\t\t\ttransition: transform 0.2s ease;\n\t\t\t\t}\n\n\t\t\t\tedu-chip:hover {\n\t\t\t\t\ttransform: scale(1.05);\n\t\t\t\t}\n\n\t\t\t\tedu-chip.dragging {\n\t\t\t\t}\n\n\t\t\t\t@container sequential-classification (max-width: 920px) {\n\t\t\t\t\t#zones-grid {\n\t\t\t\t\t\tgrid-template-columns: repeat(${Math.min(gridCols, 2)}, 1fr);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t@container sequential-classification (max-width: 620px) {\n\t\t\t\t\t#zones-grid {\n\t\t\t\t\t\tgrid-template-columns: 1fr;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t</style>\n\t\t\t<div id=\"container\">\n\t\t\t\t<div class=\"center-zone-container\">\n\t\t\t\t\t<div class=\"center-zone-label\">Current Item</div>\n\t\t\t\t\t<div id=\"center-zone\"></div>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"zones-container\">\n\t\t\t\t\t<div class=\"zones-label\">Categories (Drag item to classify)</div>\n\t\t\t\t\t<div id=\"zones-grid\"></div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t`;\n\n\t\tthis.container = this.querySelector(\"#container\") as HTMLDivElement;\n\t\tthis.centerZone = this.querySelector(\"#center-zone\") as HTMLDivElement;\n\t\tthis.zonesGrid = this.querySelector(\"#zones-grid\") as HTMLDivElement;\n\n\t\tthis.createDropZones();\n\t\tthis.showNextChip();\n\t}\n\n\tprivate createDropZones(): void {\n\t\tconst zonesGrid = this.querySelector(\"#zones-grid\") as HTMLDivElement;\n\n\t\tthis.categories.forEach((label, i) => {\n\t\t\tconst zone = document.createElement('edu-block') as EduBlock;\n\t\t\tzone.variant = this.variant;\n\t\t\tzone.setAccentColor(randomHexColorsList[i % randomHexColorsList.length]);\n\t\t\tzone.classList.add('zone', 'empty');\n\t\t\tzone.textContent = `${label}: 0`;\n\t\t\tzone.dataset.label = label;\n\n\t\t\tzonesGrid.appendChild(zone);\n\t\t\tthis.zones.push(zone);\n\t\t});\n\t}\n\n\tprivate showNextChip(): void {\n\t\tconst nextItem = this.allItems.find(item => !this.categorized.has(item));\n\t\tif (!nextItem) {\n\t\t\tthis.centerZone.classList.add('empty');\n\t\t\treturn;\n\t\t}\n\n\t\tconst chip = document.createElement(\"edu-chip\") as EduChip;\n\t\tchip.variant = this.variant;\n\n\t\tsetUpChipData(nextItem, chip, this.assets?.assetsById);\n\t\tchip.prefix = (this.allItems.indexOf(nextItem) + 1).toString();\n\t\tchip.draggable = true;\n\t\tchip.dataset.label = nextItem;\n\n\t\tchip.addEventListener(\"pointerdown\", (e) => this.handlePointerDown(e, chip));\n\n\t\tthis.container.appendChild(chip);\n\t\tthis.chips.push(chip);\n\n\t\t// Center the chip after it's added to DOM\n\t\trequestAnimationFrame(() => {\n\t\t\tconst centerRect = this.centerZone.getBoundingClientRect();\n\t\t\tconst containerRect = this.container.getBoundingClientRect();\n\t\t\tconst chipRect = chip.getBoundingClientRect();\n\n\t\t\tconst x = (centerRect.left - containerRect.left) + (centerRect.width - chipRect.width) / 2;\n\t\t\tconst y = (centerRect.top - containerRect.top) + (centerRect.height - chipRect.height) / 2;\n\n\t\t\tchip.style.left = `${x}px`;\n\t\t\tchip.style.top = `${y}px`;\n\t\t});\n\t}\n\n\tprivate reparentChip(chip: EduChip, newParent: HTMLElement): void {\n\t\tif (chip.parentElement === newParent) return;\n\n\t\tconst chipRect = chip.getBoundingClientRect();\n\t\tconst parentRect = newParent.getBoundingClientRect();\n\n\t\tlet left = chipRect.left - parentRect.left;\n\t\tlet top = chipRect.top - parentRect.top;\n\n\t\tif (newParent === this.zonesGrid) {\n\t\t\tleft += this.zonesGrid.scrollLeft;\n\t\t\ttop += this.zonesGrid.scrollTop;\n\t\t}\n\n\t\tchip.style.left = `${left}px`;\n\t\tchip.style.top = `${top}px`;\n\t\tnewParent.appendChild(chip);\n\t}\n\n\tprivate handlePointerDown(e: PointerEvent, chip: EduChip): void {\n\t\te.preventDefault();\n\n\t\tthis.reparentChip(chip, this.container);\n\t\tthis.activeChip = chip;\n\t\tthis.isDragging = true;\n\t\tchip.classList.add(\"dragging\");\n\n\t\tconst chipRect = chip.getBoundingClientRect();\n\t\tconst containerRect = this.container.getBoundingClientRect();\n\n\t\tthis.offsetX = e.clientX - chipRect.left;\n\t\tthis.offsetY = e.clientY - chipRect.top;\n\n\t\tthis.chips.forEach(c => {\n\t\t\tif (c !== chip) c.style.opacity = \"0.3\"\n\t\t});\n\t\t\n\t\t// THIS DOES NOT GET TRIGGERED IF THE CHIP IS *ONLY* CLICKED!\n\t\tthis.handlePointerMove(e);\n\t}\n\n\tprivate handlePointerMove(e: PointerEvent): void {\n\t\tif (!this.isDragging || !this.activeChip) return;\n\n\t\tconst containerRect = this.container.getBoundingClientRect();\n\n\t\tlet x = e.clientX - containerRect.left - this.offsetX;\n\t\tlet y = e.clientY - containerRect.top - this.offsetY;\n\n\t\t// Clamp to container bounds\n\t\tconst chipRect = this.activeChip.getBoundingClientRect();\n\t\tx = Math.max(0, Math.min(x, containerRect.width - chipRect.width));\n\t\ty = Math.max(0, Math.min(y, containerRect.height - chipRect.height));\n\n\t\tthis.activeChip.style.left = `${x}px`;\n\t\tthis.activeChip.style.top = `${y}px`;\n\n\t\tthis.checkZoneOverlap(e.clientX, e.clientY);\n\t}\n\n\tprivate handlePointerUp(e: PointerEvent): void {\n\t\tif (!this.isDragging || !this.activeChip) return;\n\t\t\n\t\tthis.isDragging = false;\n\t\tthis.chips.forEach(c => c.style.opacity = \"1\");\n\t\tthis.activeChip.classList.remove(\"dragging\");\n\n\t\tconst itemLabel = this.activeChip.dataset.label!;\n\n\t\tif (this.currentZone) {\n\t\t\tconst zoneLabel = this.currentZone.dataset.label!;\n\t\t\tconst previousCategory = this.categorized.get(itemLabel);\n\n\t\t\tif (previousCategory !== zoneLabel) {\n\n\t\t\t\tthis.categorized.set(itemLabel, zoneLabel);\n\t\t\t\tthis.emitStateChange();\n\n\t\t\t\tif (previousCategory === undefined) {\n\t\t\t\t\tthis.incrementProgress();\n\t\t\t\t\tthis.showNextChip();\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (previousCategory === null) this.incrementProgress();\n\t\t\t}\n\t\t\tthis.reparentChip(this.activeChip, this.zonesGrid);\n\t\t} else {\n\t\t\tif (this.categorized.get(itemLabel)) {\n\t\t\t\tthis.categorized.set(itemLabel, null);\n\t\t\t\tthis.decrementProgress();\n\t\t\t}\n\t\t\tthis.reparentChip(this.activeChip, this.container);\n\t\t}\n\n\t\tthis.zones.forEach(zone => {\n\t\t\tzone.classList.remove(\"highlight\");\n\t\t\tconst count = Array.from(this.categorized.values()).filter(v => v === zone.dataset.label).length;\n\t\t\tzone.textContent = `${zone.dataset.label}: ${count}`;\n\n\t\t\t// Toggle empty class based on count\n\t\t\tif (count > 0) {\n\t\t\t\tzone.classList.remove('empty');\n\t\t\t} else {\n\t\t\t\tzone.classList.add('empty');\n\t\t\t}\n\t\t});\n\n\t\tthis.activeChip = null;\n\t\tthis.currentZone = null;\n\t}\n\n\tprivate checkZoneOverlap(clientX: number, clientY: number): void {\n\t\tthis.currentZone = null;\n\t\tfor (const zone of this.zones) {\n\t\t\tconst rect = zone.getBoundingClientRect();\n\n\t\t\tif (clientX >= rect.left && clientX <= rect.right &&\n\t\t\t clientY >= rect.top && clientY <= rect.bottom) {\n\t\t\t\tzone.classList.add(\"highlight\");\n\t\t\t\tthis.currentZone = zone;\n\t\t\t} else {\n\t\t\t\tzone.classList.remove(\"highlight\");\n\t\t\t}\n\t\t}\n\t}\n\n\t// ==================== INTERACTION LOGIC ====================\n\n\tgetCurrentState(): any {\n\t\treturn {\n\t\t\tcategorized: Object.fromEntries(this.categorized),\n\t\t\tprogress: this.progressTracker.current\n\t\t};\n\t}\n\n\tisInteractionComplete(): boolean {\n\t\treturn this.categorized.size === this.allItems.length;\n\t}\n\n\tonHint(): void {\n\t\tconst uncategorized = this.allItems.filter(item => !this.categorized.has(item));\n\n\t\tif (uncategorized.length === 0) {\n\t\t\talert('All items are categorized! Click \"Check\" to submit.');\n\t\t\tthis.emitHintShown('All items categorized');\n\t\t\treturn;\n\t\t}\n\n\t\tconst firstUncategorized = uncategorized[0];\n\t\tconst correctCategory = this.data.categories.find(cat =>\n\t\t\tcat.items.includes(firstUncategorized)\n\t\t)?.label;\n\n\t\tif (correctCategory) {\n\t\t\talert(`Hint: \"${firstUncategorized}\" belongs to \"${correctCategory}\".`);\n\t\t\tthis.emitHintShown(`Item: ${firstUncategorized} \u2192 Category: ${correctCategory}`);\n\t\t}\n\t}\n\n\tpublic submit(): void {\n\t\tsuper.submit();\n\t\tconst result = classificationGrader(this.data.categories, this.categorized, this);\n\t\tconsole.log(`Classification Score: ${result.score.toFixed(1)}% (${result.correct}/${result.total} correct)`);\n\n\t\tthis.dispatchEvent(new CustomEvent('interaction:graded', {\n\t\t\tdetail: { result },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\t}\n\n\t// ==================== RESET ====================\n\n\tpublic reset(): void {\n\t\tsuper.reset();\n\t\tthis.categorized.clear();\n\n\t\t// Remove all chips\n\t\tthis.chips.forEach(chip => chip.remove());\n\t\tthis.chips = [];\n\n\t\tthis.centerZone.classList.remove('empty');\n\t\tthis.activeChip = null;\n\t\tthis.currentZone = null;\n\t\tthis.isDragging = false;\n\n\t\tif (this.zonesGrid) this.zonesGrid.scrollTop = 0;\n\n\t\tthis.showNextChip();\n\t}\n}\n\nif (!customElements.get('sequential-classification')) {\n\tcustomElements.define('sequential-classification', SequentialClassification);\n}\n", "import { GradingResult } from \"../../../types/Grading\";\nimport { RecognitionData } from \"../../../types/Data\";\n\n/**\n * User's answers for MCQ/MRQ\n * Format: { \"question text\": [\"selected option 1\", \"selected option 2\", ...] }\n */\nexport type RecognitionAnswers = Record<string, string[]>;\n\n/**\n * Grader for MCQ/MRQ interactions\n *\n * Grading logic per question:\n * - Each correct option selected: +1 point\n * - Each incorrect option selected: -1 point (penalty)\n * - Each correct option NOT selected (missed): -1 point (penalty)\n * - Score is (correct selections - wrong selections - missed) / total correct options\n * - Rounded to whole number percentage\n *\n * Overall score: average of all question scores\n */\nexport function recognitionGrader(\n\tdata: RecognitionData,\n\tuserAnswers: RecognitionAnswers\n): GradingResult {\n\tlet totalScore = 0;\n\tconst questionCount = data.data.length;\n\n\t// Grade each question\n\tdata.data.forEach(question => {\n\t\tconst correctOptions = new Set(question.correctOptions);\n\t\tconst userSelected = new Set(userAnswers[question.question] || []);\n\n\t\tlet correctSelections = 0;\n\t\tlet wrongSelections = 0;\n\t\tlet missedCorrect = 0;\n\n\t\t// Check each option the user selected\n\t\tuserSelected.forEach(selected => {\n\t\t\tif (correctOptions.has(selected)) {\n\t\t\t\tcorrectSelections++;\n\t\t\t} else {\n\t\t\t\twrongSelections++;\n\t\t\t}\n\t\t});\n\n\t\t// Check for missed correct options\n\t\tcorrectOptions.forEach(correct => {\n\t\t\tif (!userSelected.has(correct)) {\n\t\t\t\tmissedCorrect++;\n\t\t\t}\n\t\t});\n\n\t\t// Calculate question score\n\t\tconst totalCorrect = correctOptions.size;\n\t\tconst rawScore = correctSelections - wrongSelections - missedCorrect;\n\t\tconst questionScore = Math.max(0, (rawScore / totalCorrect) * 100);\n\n\t\ttotalScore += questionScore;\n\t});\n\n\t// Calculate overall score (average of all questions)\n\tconst score = Math.round(totalScore / questionCount);\n\n\t// Count how many questions were fully correct\n\tlet fullyCorrectCount = 0;\n\tdata.data.forEach(question => {\n\t\tconst correctOptions = new Set(question.correctOptions);\n\t\tconst userSelected = new Set(userAnswers[question.question] || []);\n\n\t\t// Check if sets are equal\n\t\tif (\n\t\t\tcorrectOptions.size === userSelected.size &&\n\t\t\t[...correctOptions].every(opt => userSelected.has(opt))\n\t\t) {\n\t\t\tfullyCorrectCount++;\n\t\t}\n\t});\n\n\treturn {\n\t\tscore,\n\t\tcorrect: fullyCorrectCount,\n\t\ttotal: questionCount\n\t};\n}\n", "import { BaseInteraction } from \"../../core/BaseInteraction\";\nimport { Variant } from \"../../shared/types\";\nimport { InteractionConfig, InteractionMechanic } from \"../../types/Interactions\";\nimport { NormalizedAssets } from \"../../types/Assets\";\nimport { RecognitionData } from \"../../types/Data\";\n\nimport { EduChip, setUpChipData } from \"../../ui/misc/chip\";\nimport { EduBlock } from \"../../ui/misc/block\";\nimport { setUpQuestionData } from \"../../ui/misc/media\";\n\nimport { shuffle } from \"../../shared\";\nimport { recognitionGrader, RecognitionAnswers } from \"./implementation/grader\";\n\nexport class MCQ extends BaseInteraction<RecognitionData> {\n\n\tinteractionMechanic: InteractionMechanic = \"sequential\";\n\n\tprivate currentQuestionIndex: number = 0;\n\tprivate userAnswers: RecognitionAnswers = {};\n\tprivate shuffledOptions: Map<string, string[]> = new Map(); // Store shuffled order per question\n\tprivate isGraded: boolean = false;\n\n\tprivate $questionBlock!: EduBlock;\n\tprivate $questionText!: HTMLElement;\n\tprivate $optionsContainer!: HTMLDivElement;\n\tprivate $modeLabel!: HTMLElement;\n\n\tprivate variant: Variant;\n\n\t// Expose question count for shell\n\tpublic get slidesCount(): number {\n\t\treturn this.data.data.length;\n\t}\n\n\tconstructor(\n\t\tdata: RecognitionData,\n\t\tconfig: InteractionConfig,\n\t\tassets: NormalizedAssets | null\n\t) {\n\t\tsuper(data, config, assets);\n\t\t\n\t\t// Initialize user answers and shuffle options once\n\t\tthis.data.data.forEach(q => {\n\t\t\tthis.userAnswers[q.question] = [];\n\n\t\t\t// Shuffle and store options order\n\t\t\tif (this.config.shuffle) {\n\t\t\t\tthis.shuffledOptions.set(q.question, shuffle([...q.options]));\n\t\t\t} else {\n\t\t\t\tthis.shuffledOptions.set(q.question, [...q.options]);\n\t\t\t}\n\t\t});\n\n\t\tthis.variant = this.config.variant;\n\n\t\t// Initialize progress tracking (one per question)\n\t\tthis.initializeProgress(this.data.data.length);\n\t}\n\n\tprotected initialize(): void {}\n\tprotected cleanup(): void {}\n\n\tonVariantChange(newVariant: Variant): void {\n\t\tthis.querySelectorAll('edu-chip, edu-block').forEach((el: EduChip | EduBlock) => {\n\t\t\tif (el.variant !== undefined) {\n\t\t\t\tel.variant = newVariant;\n\t\t\t}\n\t\t});\n\t\tthis.variant = newVariant;\n\t}\n\n\t// ==================== SEQUENTIAL NAVIGATION ====================\n\n\t/**\n\t * Called by shell when radio navigation changes\n\t * @param stepIndex 1-based index from shell\n\t */\n\tpublic setSteps(stepIndex: number): void {\n\t\t// Convert from 1-based to 0-based\n\t\tconst newIndex = stepIndex - 1;\n\n\t\tif (newIndex >= 0 && newIndex < this.data.data.length) {\n\t\t\tthis.currentQuestionIndex = newIndex;\n\t\t\tthis.renderCurrentQuestion();\n\t\t}\n\t}\n\n\t// ==================== RENDERING ====================\n\n\trender(): void {\n\t\tthis.innerHTML = `\n\t\t\t<style>\n\t\t\t\tmcq-interaction {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t\tcontainer-type: size;\n\t\t\t\t\tcontainer-name: mcq;\n\t\t\t\t}\n\n\t\t\t\t.container {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\tflex-direction: column;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tgap: clamp(0.5rem, min(1.6cqw, 1.6cqh), 1rem);\n\t\t\t\t\tpadding: clamp(0.75rem, min(2cqw, 2cqh), 1.5rem);\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t\toverflow: hidden;\n\t\t\t\t}\n\n\t\t\t\t.mode-label {\n\t\t\t\t\talign-self: flex-start;\n\t\t\t\t\tfont-size: 0.75rem;\n\t\t\t\t\tfont-weight: 600;\n\t\t\t\t\tcolor: rgb(var(--edu-third-ink));\n\t\t\t\t\ttext-transform: uppercase;\n\t\t\t\t\tletter-spacing: 0.5px;\n\t\t\t\t\topacity: 0.7;\n\t\t\t\t\tmargin-bottom: clamp(0.25rem, 1cqh, 0.5rem);\n\t\t\t\t}\n\n\t\t\t\t.question-section {\n\t\t\t\t\tflex-shrink: 0;\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\tflex-direction: column;\n\t\t\t\t\tmin-height: clamp(64px, 10cqh, 120px);\n\t\t\t\t\tmax-height: clamp(120px, 30cqh, 260px);\n\t\t\t\t\toverflow: hidden;\n\t\t\t\t}\n\n\t\t\t\t.question-text {\n\t\t\t\t\tpadding: 0;\n\t\t\t\t\tfont-size: clamp(0.95rem, 2.4cqh, 1.2rem);\n\t\t\t\t\tfont-weight: 600;\n\t\t\t\t\tcolor: rgb(var(--edu-ink));\n\t\t\t\t\tline-height: 1.4;\n\t\t\t\t}\n\n\t\t\t\t.divider {\n\t\t\t\t\tborder: none;\n\t\t\t\t\tborder-top: 1px solid rgb(var(--edu-border));\n\t\t\t\t\tmargin: 0;\n\t\t\t\t\tflex-shrink: 0;\n\t\t\t\t}\n\n\t\t\t\t.options-section {\n\t\t\t\t\tflex: 1;\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\tflex-direction: column;\n\t\t\t\t\tgap: clamp(0.25rem, min(1cqw, 1cqh), 0.5rem);\n\t\t\t\t\tmin-height: 0;\n\t\t\t\t\toverflow: hidden;\n\t\t\t\t}\n\n\t\t\t\t.options-label {\n\t\t\t\t\tfont-size: clamp(0.8rem, 1.8cqh, 1rem);\n\t\t\t\t\tfont-weight: 600;\n\t\t\t\t\tcolor: rgb(var(--edu-second-ink));\n\t\t\t\t\tflex-shrink: 0;\n\t\t\t\t}\n\n\t\t\t\t.options-container {\n\t\t\t\t\tflex: 1;\n\t\t\t\t\tdisplay: grid;\n\t\t\t\t\tgrid-template-columns: 1fr;\n\t\t\t\t\tgrid-auto-rows: minmax(44px, 1fr);\n\t\t\t\t\tgap: clamp(0.5rem, min(1.6cqw, 1.6cqh), 0.9rem);\n\t\t\t\t\tpadding: clamp(0.5rem, min(1.6cqw, 1.6cqh), 1rem);\n\t\t\t\t\tbackground: rgb(var(--edu-muted));\n\t\t\t\t\tborder-radius: clamp(6px, 1.6cqw, 8px);\n\t\t\t\t\toverflow-y: auto;\n\t\t\t\t\toverflow-x: hidden;\n\t\t\t\t\tmin-height: 0;\n\t\t\t\t\talign-content: stretch;\n\t\t\t\t\talign-items: stretch;\n\t\t\t\t}\n\n\t\t\t\tedu-chip {\n\t\t\t\t\tcursor: pointer;\n\t\t\t\t\ttransition: all 0.2s ease;\n\t\t\t\t}\n\n\t\t\t\tedu-chip::part(block) {\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t}\n\n\t\t\t\tedu-chip:hover {\n\t\t\t\t\ttransform: translateY(-2px);\n\t\t\t\t}\n\n\t\t\t\tedu-chip.selected {\n\t\t\t\t\ttransform: translateY(-2px);\n\t\t\t\t}\n\n\t\t\t\t#question-block edu-block::part(block) {\n\t\t\t\t\tborder: none;\n\t\t\t\t\tpadding: clamp(0.5rem, min(1.6cqw, 1.6cqh), 1rem);\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tmax-height: clamp(120px, 30cqh, 260px);\n\t\t\t\t\toverflow: auto;\n\t\t\t\t\talign-items: center;\n\t\t\t\t\tjustify-content: flex-start;\n\t\t\t\t}\n\n\t\t\t\t#question-block edu-block::part(block) > * {\n\t\t\t\t\twidth: 100%;\n\t\t\t\t}\n\n\t\t\t\t#question-block .question-text {\n\t\t\t\t\ttext-align: left;\n\t\t\t\t}\n\n\t\t\t\t@container mcq (min-width: 920px) {\n\t\t\t\t\t.options-container {\n\t\t\t\t\t\tgrid-template-columns: repeat(2, minmax(min(100%, 220px), 1fr));\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t@container mcq (max-width: 620px) {\n\t\t\t\t\t.options-container {\n\t\t\t\t\t\tgrid-template-columns: 1fr;\n\t\t\t\t\t\tpadding: clamp(0.5rem, min(1.2cqw, 1.2cqh), 0.75rem);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t</style>\n\n\t\t\t<div class=\"container\">\n\t\t\t\t<div class=\"question-section\">\n\t\t\t\t\t<div class=\"mode-label\"></div>\n\t\t\t\t\t<div id=\"question-block\"></div>\n\t\t\t\t</div>\n\n\t\t\t\t<hr class=\"divider\">\n\n\t\t\t\t<div class=\"options-section\">\n\t\t\t\t\t<div class=\"options-label\">Options</div>\n\t\t\t\t\t<div class=\"options-container\"></div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t`;\n\n\t\t// Cache DOM elements\n\t\tthis.$modeLabel = this.querySelector('.mode-label')!;\n\t\tthis.$optionsContainer = this.querySelector('.options-container')!;\n\n\t\tconst questionBlockContainer = this.querySelector('#question-block')!;\n\t\tthis.$questionBlock = document.createElement('edu-block') as EduBlock;\n\t\tthis.$questionBlock.variant = this.config.variant;\n\t\tthis.$questionBlock.innerHTML = '<div class=\"question-text\"></div>';\n\t\tquestionBlockContainer.appendChild(this.$questionBlock);\n\n\t\tthis.$questionText = this.$questionBlock.querySelector('.question-text')!;\n\n\t\t// Render first question\n\t\tthis.renderCurrentQuestion();\n\t}\n\n\tprivate renderCurrentQuestion(): void {\n\n\t\tconst question = this.data.data[this.currentQuestionIndex];\n\t\tif (!question) return;\n\n\t\tconst isMCQ = question.correctOptions.length === 1;\n\t\tthis.$modeLabel.textContent = isMCQ ? 'Multiple Choice' : 'Multiple Response';\n\n\t\t// Render question with asset support\n\t\tsetUpQuestionData(question.question, this.$questionText, this.assets?.assetsById);\n\n\t\tconst options = this.shuffledOptions.get(question.question) || question.options;\n\t\t\n\t\tthis.$optionsContainer.innerHTML = '';\n\t\toptions.forEach((option, i) => {\n\t\t\tconst chip = document.createElement('edu-chip') as EduChip;\n\t\t\tchip.variant = this.variant;\n\t\t\tchip.prefix = `${i + 1}:`;\n\t\t\tchip.dataset.option = option;\n\n\t\t\tsetUpChipData(option, chip, this.assets?.assetsById);\n\n\t\t\tconst isSelected = this.userAnswers[question.question]?.includes(option);\n\t\t\tif (isSelected) {\n\t\t\t\tchip.selected = true;\n\t\t\t\tchip.classList.add('selected');\n\t\t\t}\n\n\t\t\t// Show correctness state if graded\n\t\t\tif (this.isGraded) {\n\t\t\t\tconst isCorrect = question.correctOptions.includes(option);\n\t\t\t\tif (isSelected && isCorrect) {\n\t\t\t\t\tchip.chipState = 'correct';\n\t\t\t\t} else if (isSelected && !isCorrect) {\n\t\t\t\t\tchip.chipState = 'wrong';\n\t\t\t\t} else if (!isSelected && isCorrect) {\n\t\t\t\t\tchip.chipState = 'missed';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!this.isGraded) {\n\t\t\t\tchip.addEventListener('click', () => {\n\t\t\t\t\tthis.handleOptionClick(option, chip, isMCQ);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tthis.$optionsContainer.appendChild(chip);\n\t\t});\n\t}\n\n\tprivate handleOptionClick(option: string, chip: EduChip, isMCQ: boolean): void {\n\n\t\tconst question = this.data.data[this.currentQuestionIndex];\n\t\tconst selected = this.userAnswers[question.question];\n\n\t\tif (isMCQ) {\n\t\t\t// Single selection - clear all others\n\t\t\tconst wasSelected = selected.includes(option);\n\t\t\t\n\t\t\t// Clear all selections visually and in state\n\t\t\tthis.$optionsContainer.querySelectorAll('edu-chip').forEach((c: EduChip) => {\n\t\t\t\tc.selected = false;\n\t\t\t\tc.classList.remove('selected');\n\t\t\t});\n\t\t\tthis.userAnswers[question.question] = [];\n\n\t\t\t// Toggle this option\n\t\t\tif (!wasSelected) {\n\t\t\t\tchip.selected = true;\n\t\t\t\tchip.classList.add('selected');\n\t\t\t\tthis.userAnswers[question.question] = [option];\n\t\t\t}\n\t\t} else {\n\t\t\tconst index = selected.indexOf(option);\n\t\t\tif (index > -1) {\n\t\t\t\tselected.splice(index, 1);\n\t\t\t\tchip.selected = false;\n\t\t\t\tchip.classList.remove('selected');\n\t\t\t} else {\n\t\t\t\tselected.push(option);\n\t\t\t\tchip.selected = true;\n\t\t\t\tchip.classList.add('selected');\n\t\t\t}\n\t\t}\n\n\t\tthis.updateProgress();\n\t\tthis.emitStateChange();\n\t}\n\n\tprivate updateProgress(): void {\n\t\tlet answeredCount = 0;\n\t\tthis.data.data.forEach(q => {\n\t\t\tif (this.userAnswers[q.question]?.length > 0) {\n\t\t\t\tansweredCount++;\n\t\t\t}\n\t\t});\n\n\t\tthis.setProgress(answeredCount);\n\t}\n\n\t// ==================== INTERACTION LOGIC ====================\n\n\tgetCurrentState(): RecognitionAnswers {\n\t\treturn { ...this.userAnswers };\n\t}\n\n\tisInteractionComplete(): boolean {\n\t\t// All questions must have at least one selection\n\t\treturn this.data.data.every(q =>\n\t\t\tthis.userAnswers[q.question]?.length > 0\n\t\t);\n\t}\n\n\tonHint(): void {\n\t\tconst question = this.data.data[this.currentQuestionIndex];\n\t\tconst hasAnswer = this.userAnswers[question.question]?.length > 0;\n\n\t\tif (!hasAnswer) {\n\t\t\talert(`Hint: This question requires at least one selection. Read the question carefully and choose the best answer(s).`);\n\t\t\tthis.emitHintShown(`No answer selected for question ${this.currentQuestionIndex + 1}`);\n\t\t} else {\n\t\t\talert(`Hint: You've selected an answer. Review your choice and make sure it's correct before submitting.`);\n\t\t\tthis.emitHintShown(`Answer exists for question ${this.currentQuestionIndex + 1}`);\n\t\t}\n\t}\n\n\t// ==================== GRADING ====================\n\n\tpublic submit(): void {\n\t\tsuper.submit();\n\n\t\tconst result = recognitionGrader(this.data, this.userAnswers);\n\n\t\tconsole.log(`Recognition Score: ${result.score}% (${result.correct}/${result.total} questions fully correct)`);\n\n\t\t// Mark as graded and re-render to show correctness states\n\t\tthis.isGraded = true;\n\t\tthis.renderCurrentQuestion();\n\n\t\tthis.dispatchEvent(new CustomEvent('interaction:graded', {\n\t\t\tdetail: { result },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\n\t\tthis.setAttribute('inert', '');\n\t}\n\n\t// ==================== RESET ====================\n\n\tpublic reset(): void {\n\t\tsuper.reset();\n\n\t\tthis.data.data.forEach(q => {\n\t\t\tthis.userAnswers[q.question] = [];\n\t\t});\n\n\t\tthis.isGraded = false;\n\n\t\tthis.currentQuestionIndex = 0;\n\n\t\tthis.renderCurrentQuestion();\n\t}\n}\n\nif (!customElements.get('mcq-interaction')) {\n\tcustomElements.define('mcq-interaction', MCQ);\n}\n", "import { RecognitionData } from \"../../../types/Data\";\n\ntype ParseResult = {\n\tdata: RecognitionData;\n\terrors?: Record<string, string>;\n};\n\n/**\n * Parser for MCQ/MRQ grammar\n *\n * Grammar:\n * # question\n * [correct1 | correct2] | incorrect1 | incorrect2;\n *\n * Rules:\n * - '#' indicates a question\n * - '[...]' contains correct options separated by '|'\n * - Options outside brackets are incorrect\n * - Lines must end with ';'\n * - '@:assetName' for asset references (preserved as-is)\n */\nexport function recognitionParser(code: string): ParseResult {\n\tconst questions: Array<{ question: string; correctOptions: string[]; options: string[] }> = [];\n\tconst errors: Record<string, string> = {};\n\n\t// Split into lines and process\n\tconst lines = code.split('\\n').map(line => line.trim()).filter(Boolean);\n\n\tlet currentQuestion: string | null = null;\n\tlet questionIndex = 0;\n\n\tfor (let i = 0; i < lines.length; i++) {\n\t\tconst line = lines[i];\n\n\t\t// Question line (starts with #)\n\t\tif (line.startsWith('#')) {\n\t\t\tcurrentQuestion = line.substring(1).trim();\n\t\t\tquestionIndex++;\n\t\t\tcontinue;\n\t\t}\n\n\t\t// Options line (must end with ;)\n\t\tif (line.endsWith(';')) {\n\t\t\tif (!currentQuestion) {\n\t\t\t\terrors[`parse.noQuestion.line${i + 1}`] =\n\t\t\t\t\t`Line ${i + 1}: Found options without a preceding question (# question).`;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Remove trailing semicolon\n\t\t\tconst optionsLine = line.slice(0, -1).trim();\n\n\t\t\t// Extract correct options from brackets [...]\n\t\t\tconst correctMatch = optionsLine.match(/\\[([^\\]]+)\\]/);\n\t\t\tlet correctOptions: string[] = [];\n\t\t\tlet remainingLine = optionsLine;\n\n\t\t\tif (correctMatch) {\n\t\t\t\tconst correctStr = correctMatch[1];\n\t\t\t\tcorrectOptions = correctStr\n\t\t\t\t\t.split('|')\n\t\t\t\t\t.map(opt => opt.trim())\n\t\t\t\t\t.filter(Boolean);\n\n\t\t\t\t// Remove the bracketed section from the line\n\t\t\t\tremainingLine = optionsLine.replace(/\\[([^\\]]+)\\]/, '').trim();\n\t\t\t}\n\n\t\t\t// Extract incorrect options (everything outside brackets)\n\t\t\tconst incorrectOptions = remainingLine\n\t\t\t\t.split('|')\n\t\t\t\t.map(opt => opt.trim())\n\t\t\t\t.filter(Boolean);\n\n\t\t\t// Combine all options\n\t\t\tconst allOptions = [...correctOptions, ...incorrectOptions];\n\n\t\t\t// Validation: check for duplicates\n\t\t\tconst seen = new Set<string>();\n\t\t\tfor (const opt of allOptions) {\n\t\t\t\tif (seen.has(opt)) {\n\t\t\t\t\terrors[`parse.duplicate.q${questionIndex}`] =\n\t\t\t\t\t\t`Question ${questionIndex}: Duplicate option \"${opt}\" found.`;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tseen.add(opt);\n\t\t\t}\n\n\t\t\t// Add the parsed question\n\t\t\tquestions.push({\n\t\t\t\tquestion: currentQuestion,\n\t\t\t\tcorrectOptions,\n\t\t\t\toptions: allOptions\n\t\t\t});\n\n\t\t\t// Reset for next question\n\t\t\tcurrentQuestion = null;\n\t\t} else {\n\t\t\terrors[`parse.missingSemicolon.line${i + 1}`] =\n\t\t\t\t`Line ${i + 1}: Options line must end with ';'.`;\n\t\t}\n\t}\n\n\t// Check for dangling question\n\tif (currentQuestion) {\n\t\terrors['parse.danglingQuestion'] =\n\t\t\t`Question \"${currentQuestion}\" has no options defined.`;\n\t}\n\n\tconst data: RecognitionData = {\n\t\ttype: 'recognition',\n\t\tdata: questions\n\t};\n\n\treturn Object.keys(errors).length > 0 ? { data, errors } : { data };\n}\n", "import { RecognitionData } from \"../../../types/Data\";\n\ntype ValidationResult = {\n\tok: boolean;\n\terrors?: Record<string, string>;\n};\n\n/**\n * Validator for MCQ/MRQ recognition data\n *\n * Validates:\n * - At least one question exists\n * - Each question has at least one correct answer\n * - Each question has at least two total options\n * - No duplicate options within a question\n * - Question text is not empty\n */\nexport function recognitionValidator(data: RecognitionData): ValidationResult {\n\tconst errors: Record<string, string> = {};\n\n\t// Check if questions exist\n\tif (!data.data || data.data.length === 0) {\n\t\terrors['validation.noQuestions'] =\n\t\t\t'No questions found. Expected at least one question with format: # question\\\\n[correct] | incorrect;';\n\t\treturn { ok: false, errors };\n\t}\n\n\t// Validate each question\n\tdata.data.forEach((q, index) => {\n\t\tconst qNum = index + 1;\n\n\t\t// Question text must not be empty\n\t\tif (!q.question || q.question.trim() === '') {\n\t\t\terrors[`validation.emptyQuestion.q${qNum}`] =\n\t\t\t\t`Question ${qNum}: Question text cannot be empty.`;\n\t\t}\n\n\t\t// Must have at least one correct option\n\t\tif (!q.correctOptions || q.correctOptions.length === 0) {\n\t\t\terrors[`validation.noCorrectOptions.q${qNum}`] =\n\t\t\t\t`Question ${qNum}: Must have at least one correct answer. Use [correct] syntax.`;\n\t\t}\n\n\t\t// Must have at least two total options\n\t\tif (!q.options || q.options.length < 2) {\n\t\t\terrors[`validation.insufficientOptions.q${qNum}`] =\n\t\t\t\t`Question ${qNum}: Must have at least 2 options (correct and incorrect).`;\n\t\t}\n\n\t\t// Check for empty options\n\t\tif (q.options) {\n\t\t\tq.options.forEach((opt, optIndex) => {\n\t\t\t\tif (!opt || opt.trim() === '') {\n\t\t\t\t\terrors[`validation.emptyOption.q${qNum}.opt${optIndex + 1}`] =\n\t\t\t\t\t\t`Question ${qNum}, Option ${optIndex + 1}: Option text cannot be empty.`;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t// Verify all correct options are in the options array\n\t\tif (q.correctOptions && q.options) {\n\t\t\tq.correctOptions.forEach(correct => {\n\t\t\t\tif (!q.options.includes(correct)) {\n\t\t\t\t\terrors[`validation.missingCorrectOption.q${qNum}`] =\n\t\t\t\t\t\t`Question ${qNum}: Correct option \"${correct}\" not found in options array.`;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t// Check for duplicate options\n\t\tif (q.options) {\n\t\t\tconst seen = new Set<string>();\n\t\t\tq.options.forEach(opt => {\n\t\t\t\tif (seen.has(opt)) {\n\t\t\t\t\terrors[`validation.duplicateOption.q${qNum}`] =\n\t\t\t\t\t\t`Question ${qNum}: Duplicate option \"${opt}\" found.`;\n\t\t\t\t}\n\t\t\t\tseen.add(opt);\n\t\t\t});\n\t\t}\n\t});\n\n\treturn Object.keys(errors).length > 0 ? { ok: false, errors } : { ok: true };\n}\n", "import { AssociationData } from \"../../../types/Data\";\nimport { GradingResult } from \"../../../types/Grading\";\nimport { EduChip } from \"../../../ui/misc/chip\";\n\nexport function associationDataGrader(\n\tanswerKey: AssociationData[\"pairs\"], userData: Map<string, string>, parent: any \n): GradingResult {\n\n\tlet correct = 0;\n\n\tfor (const [l, r] of userData.entries()) {\n\t\tconst chip = parent.querySelector(`[data-val=\"${l}\"]`) as EduChip;\n\t\tconst correctPair = answerKey.find(p => p.left === l);\n\t\tif (correctPair && correctPair.right === r) {\n\t\t\tchip.chipState = \"correct\";\n\t\t\tcorrect++;\n\t\t} else chip.chipState =\"wrong\";\n\t}\n\n\tconst total = answerKey.length;\n\tconst score = total > 0 ? (correct / total) * 100 : 0;\n\tconsole.log(`Association Score: ${score.toFixed(1)}% (${correct}/${total} correct)`);\n\n\treturn { score, correct, total, answerKey, userResponse: userData };\n}\n", "import { BaseInteraction } from \"../../core/BaseInteraction\";\nimport { Variant } from \"../../shared/types\";\nimport { InteractionConfig, InteractionMechanic, IInteractionSpec } from \"../../types/Interactions\";\n\nimport { NormalizedAssets } from \"../../types/Assets\";\nimport { AssociationData } from \"../../types/Data\";\n\nimport { associationDataGrader } from \"../shared/association-implementation/grader\";\nimport { randomHexColorsList, shuffle } from \"../../shared/utils\";\n\nimport { EduChip, setUpChipData } from \"../../ui/misc/chip\";\n\n// could expand something like: mechanic: 'click' | 'drawLine'; \ntype SimultaneousAssociationSpec = {\n\trightColumnLabel: string;\n\tleftColumnLabel: string;\n\tlayoutDirection: 'vertical' | 'horizontal';\n}\n\nexport class SimultaneousAssociation extends BaseInteraction<AssociationData> {\n\n\tinteractionMechanic: InteractionMechanic = \"static\";\n\n\tprivate leftItems: string[] = [];\n\tprivate rightItems: string[] = [];\n\n\tprivate matched: Map<string, string> = new Map<string, string>();\n\tprivate matchColors: Map<string, string> = new Map<string, string>();\n\n\tprivate currentSelected: string;\n\tprivate currentEl: EduChip;\n\tprivate currentColor: string;\n\n\tprivate $leftCol: HTMLDivElement;\n\tprivate $rightCol: HTMLDivElement;\n\n\tconstructor(\n\t\tdata: AssociationData, \n\t\tconfig: InteractionConfig, \n\t\tassets: NormalizedAssets | null,\n\t\tspec: SimultaneousAssociationSpec | null\n\t) {\n\t\tsuper(data, config, assets);\n\n\t\tthis.data.pairs.forEach(({ left, right }) => {\n\t\t\tthis.leftItems.push(left);\n\t\t\tthis.rightItems.push(right);\n\t\t});\n\n\t\tif (this.data.distractors) this.rightItems.push(...this.data.distractors);\n\n\t\tif (this.config.shuffle) {\n\t\t\tthis.leftItems = shuffle(this.leftItems);\n\t\t\tthis.rightItems = shuffle(this.rightItems);\n\t\t}\n\n\t\tthis.initializeProgress(this.leftItems.length);\n\t\tthis.currentColor = randomHexColorsList[0];\n\t}\n\n\tprotected initialize(): void {}\n\tprotected cleanup(): void {}\n\n\tonVariantChange(newVariant: Variant): void {\n\t\tthis.querySelectorAll('edu-chip').forEach((el: EduChip) => {\n\t\t\tif (el.variant !== undefined) el.variant = newVariant;\n\t\t});\n\t}\n\n\t// ------------ Interaction Specific Logic ---------------\n\n\trender(): void {\n\t\tthis.innerHTML = `\n\t\t\t<style>\n\t\t\t\tsimultaneous-association {\n\t\t\t\t\t--current-color: #3b82f6;\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t\tcontainer-type: size;\n\t\t\t\t\tcontainer-name: association;\n\t\t\t\t}\n\n\t\t\t\t.container {\n\t\t\t\t\tdisplay: grid;\n\t\t\t\t\tgrid-template-columns: repeat(2, minmax(0, 1fr));\n\t\t\t\t\tgap: clamp(0.75rem, min(2.5cqw, 2.5cqh), 2rem);\n\t\t\t\t\tpadding: clamp(0.75rem, min(2.5cqw, 2.5cqh), 2rem);\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\talign-content: stretch;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t}\n\n\t\t\t\t.column {\n\t\t\t\t\tdisplay: grid;\n\t\t\t\t\tgrid-template-rows: auto 1fr;\n\t\t\t\t\tgap: clamp(0.25rem, min(1.2cqw, 1.2cqh), 0.75rem);\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\tmin-width: 0;\n\t\t\t\t\tmin-height: 0;\n\t\t\t\t}\n\n\t\t\t\t.column-label {\n\t\t\t\t\tfont-size: clamp(0.8rem, 1.8cqh, 1rem);\n\t\t\t\t\tfont-weight: 600;\n\t\t\t\t\tcolor: rgb(var(--edu-second-ink));\n\t\t\t\t\tmargin-bottom: 0.25rem;\n\t\t\t\t\tflex-shrink: 0;\n\t\t\t\t}\n\n\t\t\t\t.items-list {\n\t\t\t\t\tdisplay: grid;\n\t\t\t\t\tgrid-template-columns: 1fr;\n\t\t\t\t\tgrid-auto-rows: minmax(44px, 1fr);\n\t\t\t\t\tgap: clamp(0.35rem, min(1.2cqw, 1.2cqh), 0.75rem);\n\t\t\t\t\tmin-height: 0;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\talign-content: stretch;\n\t\t\t\t\talign-items: stretch;\n\t\t\t\t}\n\n\t\t\t\tedu-chip:hover {\n\t\t\t\t\ttransform: translateY(-2px);\n\t\t\t\t}\n\n\t\t\t\tedu-chip {\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t}\n\n\t\t\t\tedu-chip::part(content-zone) {\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t}\n\n\t\t\t\t@container association (max-width: 640px) {\n\t\t\t\t\t.container {\n\t\t\t\t\t\tgap: clamp(0.5rem, min(1.6cqw, 1.6cqh), 1rem);\n\t\t\t\t\t\tpadding: clamp(0.5rem, min(1.6cqw, 1.6cqh), 1rem);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t@container association (max-height: 420px) {\n\t\t\t\t\t.items-list[data-compact=\"true\"] {\n\t\t\t\t\t\tgrid-template-columns: repeat(2, minmax(0, 1fr));\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t@container association (max-width: 520px) {\n\t\t\t\t\t.items-list[data-compact=\"true\"] {\n\t\t\t\t\t\tgrid-template-columns: repeat(2, minmax(0, 1fr));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t</style>\n\n\t\t\t<div class=\"container\" id=\"columns-container\">\n\t\t\t\t<div class=\"column\">\n\t\t\t\t\t<div class=\"column-label\">Left Items</div>\n\t\t\t\t\t<div class=\"items-list\" id=\"left-col\" data-compact=\"${this.leftItems.length >= 7}\"></div>\n\t\t\t\t</div>\n\t\t\t\t<div class=\"column\">\n\t\t\t\t\t<div class=\"column-label\">Right Items</div>\n\t\t\t\t\t<div class=\"items-list\" id=\"right-col\" data-compact=\"${this.rightItems.length >= 7}\"></div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t`;\n\n\t\tthis.$leftCol = this.querySelector(\"#left-col\") as HTMLDivElement;\n\t\tthis.$rightCol = this.querySelector(\"#right-col\") as HTMLDivElement;\n\t\tthis.renderItems();\n\t}\n\n\tprivate renderItems() {\n\t\tthis.leftItems.forEach((item, i) => {\n\t\t\tconst chip = document.createElement('edu-chip') as EduChip;\n\t\t\tchip.variant = this.config.variant;\n\t\t\t\n\t\t\tsetUpChipData(item, chip, this.assets?.assetsById);\n\t\t\tchip.dataset.val = item;\n\t\t\t// chip.prefix = `${i+1})`;\n\n\t\t\tchip.addEventListener(\"click\", (e) => {\n\t\t\t\tconst chip = e.currentTarget as EduChip;\n\t\t\t\tconst val = chip.dataset.val;\n\n\t\t\t\tif (this.currentSelected === val) {\n\t\t\t\t\tchip.selected = false;\n\t\t\t\t\tthis.currentSelected = '';\n\t\t\t\t\tthis.currentEl = null;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (this.matched.get(val)) {\n\t\t\t\t\tconst rightElVal = this.matched.get(val);\n\t\t\t\t\tconst rightChip = this.querySelector(`[data-val=\"${rightElVal}\"]`) as EduChip;\n\t\t\t\t\t\n\t\t\t\t\tchip.color = \"\";\n\t\t\t\t\tchip.colored = false;\n\n\t\t\t\t\trightChip.colored = false;\n\t\t\t\t\trightChip.color = \"\";\n\n\t\t\t\t\tthis.matched.delete(val);\n\t\t\t\t\tthis.matchColors.delete(val);\n\t\t\t\t\tthis.decrementProgress();\n\t\t\t\t\tthis.emitStateChange();\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (this.currentSelected) this.currentEl.selected = false; \n\t\t\t\tthis.currentSelected = val;\n\t\t\t\tthis.currentEl = chip;\n\t\t\t\tchip.selected = true;\n\t\t\t});\n\n\t\t\tthis.$leftCol.append(chip);\n\t\t});\n\n\t\tthis.rightItems.forEach((item, i) => {\n\t\t\tconst chip = document.createElement('edu-chip') as EduChip;\n\t\t\tchip.variant = this.config.variant;\n\n\t\t\tsetUpChipData(item, chip, this.assets?.assetsById);\n\t\t\tchip.dataset.val = item;\n\t\t\tchip.dataset.colorIndex = `${i+1}`; \n\t\t\t// chip.prefix = `${i+1})`; \n\n\t\t\tchip.addEventListener(\"click\", (e) => {\n\t\t\t\tconst chip = e.currentTarget as EduChip;\n\t\t\t\tconst val = chip.dataset.val;\n\n\t\t\t\tif (this.currentSelected === val) {\n\t\t\t\t\tthis.currentSelected = '';\n\t\t\t\t\tthis.currentEl = null;\n\t\t\t\t\tchip.selected = false;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst mapVals = [...this.matched.values()];\n\t\t\t\tif (mapVals.includes(val)) return;\n\n\t\t\t\tif (this.currentSelected) {\n\t\t\t\t\tif (this.leftItems.includes(this.currentSelected) && this.rightItems.includes(val)) {\n\t\t\t\t\t\tconst colorIndex = Number(chip.dataset.colorIndex) % randomHexColorsList.length;\n\t\t\t\t\t\tconst matchColor = randomHexColorsList[colorIndex];\n\n\t\t\t\t\t\tthis.matched.set(this.currentSelected, val);\n\t\t\t\t\t\tthis.matchColors.set(this.currentSelected, matchColor);\n\n\t\t\t\t\t\tchip.selected = false;\n\t\t\t\t\t\tthis.currentEl.selected = false;\n\n\t\t\t\t\t\tchip.color = matchColor;\n\t\t\t\t\t\tchip.colored = true;\n\n\t\t\t\t\t\tthis.currentEl.color = matchColor;\n\t\t\t\t\t\tthis.currentEl.colored = true;\n\n\t\t\t\t\t\tthis.incrementProgress();\n\t\t\t\t\t\tthis.emitStateChange();\n\n\t\t\t\t\t\tthis.currentSelected = '';\n\t\t\t\t\t\tthis.currentEl = null;\n\t\t\t\t\t\treturn;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.currentEl.selected = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.currentSelected = val;\n\t\t\t\tthis.currentEl = chip;\n\t\t\t\tchip.selected = true;\n\t\t\t});\n\n\t\t\tthis.$rightCol.append(chip);\n\t\t});\n\t}\n\n\t// ------------ Abstract Methods ---------------\n\n\tgetCurrentState(): any {\n\t\treturn {\n\t\t\tmatched: Object.fromEntries(this.matched),\n\t\t\tprogress: this.progressTracker.current\n\t\t};\n\t}\n\n\tisInteractionComplete(): boolean {\n\t\tif (this.matched.size !== this.leftItems.length) return false;\n\t\treturn true;\n\t}\n\n\tonHint(): void {\n\t\tconst unmatched = this.leftItems.filter(item => !this.matched.has(item));\n\n\t\tif (unmatched.length === 0) {\n\t\t\talert('All items are matched! Click \"Check\" to submit.');\n\t\t\tthis.emitHintShown('All items matched');\n\t\t\treturn;\n\t\t}\n\n\t\tconst firstUnmatched = unmatched[0];\n\t\talert(`Hint: You haven't matched \"${firstUnmatched}\" yet. Select it from the left, then select its match from the right.`);\n\t\tthis.emitHintShown(`Unmatched: ${firstUnmatched}`);\n\t}\n\n\tpublic submit(): void {\n\t\tsuper.submit();\n\t\t\n\t\tconst result = associationDataGrader(this.data.pairs, this.matched, this);\n\t\tthis.dispatchEvent(new CustomEvent('interaction:graded', {\n\t\t\tdetail: { result },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\t}\n\n\tpublic reset(): void {\n\t\tsuper.reset();\n\t\tthis.matched.clear();\n\t\tthis.matchColors.clear();\n\t\tthis.currentSelected = '';\n\t\tthis.currentEl = null;\n\t\tthis.querySelectorAll('edu-chip').forEach((chip: EduChip) => {\n\t\t\tchip.classList.remove('colorized', 'selected');\n\t\t\tchip.style.setProperty('--current-color', '');\n\t\t});\n\t}\n}\n\nif (!customElements.get('simultaneous-association')) {\n\tcustomElements.define('simultaneous-association', SimultaneousAssociation);\n}\n", "import { BaseInteraction } from \"../../core/BaseInteraction\";\nimport { Variant } from \"../../shared/types\";\n\nimport { EduChip } from \"../../ui/misc/chip\";\nimport { EduInput } from \"../../ui/input/input\";\n\nimport { InteractionConfig, InteractionMechanic } from \"../../types/Interactions\";\nimport { FreeRecallData } from \"../../types/Data\";\nimport { GradingResult } from \"../../types/Grading\";\n\nexport class ListRecall extends BaseInteraction<FreeRecallData> {\n\n\tinteractionMechanic: InteractionMechanic = \"static\";\n\n\tprivate _$chipsContainer!: HTMLDivElement;\n\tprivate _$textInput!: EduInput;\n\tprivate _$addButton!: EduInput;\n\tprivate _recalledItems: Set<string> = new Set();\n\n\tconstructor(data: FreeRecallData, config: InteractionConfig) {\n\t\tsuper(data, config);\n\n\t\tthis.initializeProgress(data.items.length);\n\t}\n\n\t// ==================== LIFECYCLE ====================\n\n\tprotected initialize(): void {}\n\tprotected cleanup(): void {}\n\n\tonVariantChange(newVariant: Variant): void {\n\t\tif (this._$textInput) this._$textInput.variant = newVariant;\n\t\tif (this._$addButton) this._$addButton.variant = newVariant;\n\t\tthis._$chipsContainer?.querySelectorAll('edu-chip').forEach(chip => {\n\t\t\t(chip as EduChip).variant = newVariant;\n\t\t});\n\t}\n\n\t// ==================== RENDERING ====================\n\n\trender(): void {\n\t\tthis.innerHTML = `\n\t\t\t<style>\n\t\t\t\tlist-recall {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\tflex-direction: column;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tpadding: clamp(0.75rem, min(2cqw, 2cqh), 1.5rem);\n\t\t\t\t\tgap: clamp(0.5rem, min(1.6cqw, 1.6cqh), 1rem);\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t\tcontainer-type: size;\n\t\t\t\t}\n\n\t\t\t\t.chips-container {\n\t\t\t\t\tflex: 1;\n\t\t\t\t\tdisplay: grid;\n\t\t\t\t\tgrid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));\n\t\t\t\t\tgrid-auto-rows: minmax(44px, auto);\n\t\t\t\t\tgap: clamp(0.4rem, min(1.4cqw, 1.4cqh), 0.75rem);\n\t\t\t\t\tpadding: clamp(0.5rem, min(1.6cqw, 1.6cqh), 1rem);\n\t\t\t\t\tborder: 2px dashed rgb(var(--edu-border));\n\t\t\t\t\tborder-radius: clamp(6px, 1.6cqw, 8px);\n\t\t\t\t\tbackground: rgb(var(--edu-bg));\n\t\t\t\t\toverflow-y: auto;\n\t\t\t\t\talign-content: start;\n\t\t\t\t\tmin-height: 0;\n\t\t\t\t}\n\n\t\t\t\t.chips-container:empty::before {\n\t\t\t\t\tcontent: 'Your recalled items will appear here...';\n\t\t\t\t\tcolor: rgb(var(--edu-second-ink));\n\t\t\t\t\tfont-size: 0.95rem;\n\t\t\t\t\topacity: 0.6;\n\t\t\t\t\tfont-style: italic;\n\t\t\t\t}\n\n\t\t\t\thr {\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\tborder: none;\n\t\t\t\t\tborder-top: 1px solid rgb(var(--edu-border));\n\t\t\t\t\tmargin: 0;\n\t\t\t\t}\n\n\t\t\t\t.input-row {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\tgap: clamp(0.4rem, min(1.4cqw, 1.4cqh), 0.75rem);\n\t\t\t\t\talign-items: center;\n\t\t\t\t\tflex-shrink: 0;\n\t\t\t\t}\n\n\t\t\t\t.input-row edu-input[type=\"text\"] {\n\t\t\t\t\tflex: 1;\n\t\t\t\t}\n\n\t\t\t\t.input-row edu-input[type=\"button\"] {\n\t\t\t\t\tflex-shrink: 0;\n\t\t\t\t}\n\n\t\t\t\tedu-chip {\n\t\t\t\t\tcursor: pointer;\n\t\t\t\t\ttransition: opacity 0.2s ease;\n\t\t\t\t}\n\n\t\t\t\tedu-chip:hover {\n\t\t\t\t\topacity: 0.7;\n\t\t\t\t}\n\n\t\t\t\t@container (max-width: 640px) {\n\t\t\t\t\t.chips-container {\n\t\t\t\t\t\tgrid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t</style>\n\n\t\t\t<div class=\"chips-container\"></div>\n\t\t\t<hr>\n\t\t\t<div class=\"input-row\">\n\t\t\t\t<edu-input type=\"text\" placeholder=\"Enter an item...\"></edu-input>\n\t\t\t\t<edu-input as=\"button\">Add</edu-input>\n\t\t\t</div>\n\t\t`;\n\n\t\t// Get references\n\t\tthis._$chipsContainer = this.querySelector('.chips-container') as HTMLDivElement;\n\t\tthis._$textInput = this.querySelector('edu-input[type=\"text\"]') as EduInput;\n\t\tthis._$addButton = this.querySelector('edu-input[as=\"button\"]') as EduInput;\n\n\t\t// Set variant\n\t\tthis._$textInput.variant = this.config.variant;\n\t\tthis._$addButton.variant = this.config.variant;\n\n\t\t// Set up event listeners\n\t\tthis._$addButton.addEventListener('click', () => this.handleAddItem());\n\t\tthis._$textInput.addEventListener('keydown', (e: KeyboardEvent) => {\n\t\t\tif (e.key === 'Enter') {\n\t\t\t\te.preventDefault();\n\t\t\t\tthis.handleAddItem();\n\t\t\t}\n\t\t});\n\t}\n\n\t// ==================== INTERACTION LOGIC ====================\n\n\tprivate handleAddItem(): void {\n\t\tconst value = this._$textInput.value.trim();\n\t\tif (!value) return;\n\n\t\tconst normalizedValue = value.toLowerCase();\n\n\t\tif (this._recalledItems.has(normalizedValue)) {\n\t\t\talert('You have already added this item.');\n\t\t\tthis._$textInput.value = '';\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._recalledItems.size >= this.data.items.length) {\n\t\t\talert(`You can only add up to ${this.data.items.length} items.`);\n\t\t\tthis._$textInput.value = '';\n\t\t\treturn;\n\t\t}\n\n\t\tthis._recalledItems.add(normalizedValue);\n\t\tthis.addChip(value);\n\t\t\n\t\tthis._$textInput.value = '';\n\n\t\tthis.setProgress(this._recalledItems.size);\n\n\t\tthis.emitStateChange();\n\t}\n\n\tprivate addChip(text: string): void {\n\t\tconst chip = document.createElement('edu-chip') as EduChip;\n\t\tchip.textContent = text;\n\t\tchip.variant = this.config.variant;\n\t\tchip.value = text.toLowerCase(); // Store normalized value for removal\n\n\t\t// Click to remove\n\t\tchip.addEventListener('click', () => {\n\t\t\tconst normalizedValue = chip.value;\n\t\t\tthis._recalledItems.delete(normalizedValue);\n\t\t\tchip.remove();\n\n\t\t\t// Update progress\n\t\t\tthis.setProgress(this._recalledItems.size);\n\n\t\t\t// Emit state change\n\t\t\tthis.emitStateChange();\n\t\t});\n\n\t\tthis._$chipsContainer.appendChild(chip);\n\t}\n\n\tgetCurrentState(): string[] {\n\t\treturn Array.from(this._recalledItems);\n\t}\n\n\tisInteractionComplete(): boolean {\n\t\treturn this._recalledItems.size === this.data.items.length;\n\t}\n\n\tonHint(): void {\n\t\tconst recalled = this._recalledItems.size;\n\t\tconst total = this.data.items.length;\n\n\t\tif (recalled === 0) {\n\t\t\talert(`Hint: Try to recall all ${total} items from memory.`);\n\t\t\tthis.emitHintShown('No items recalled yet');\n\t\t} else if (recalled < total) {\n\t\t\talert(`Hint: You've recalled ${recalled} out of ${total} items. Keep going!`);\n\t\t\tthis.emitHintShown(`${recalled}/${total} items recalled`);\n\t\t} else {\n\t\t\talert('Great! You\\'ve recalled all items. Click \"Check\" to submit.');\n\t\t\tthis.emitHintShown('All items recalled');\n\t\t}\n\t}\n\n\t// ==================== GRADING ====================\n\n\tpublic submit(): void {\n\t\tsuper.submit();\n\t\tconst result = this.gradeRecall();\n\t\tconsole.log(`List Recall Score: ${result.score.toFixed(1)}% (${result.correct}/${result.total} correct)`);\n\n\t\tthis.applyGradingFeedback(result);\n\t\tthis.dispatchEvent(new CustomEvent('interaction:graded', {\n\t\t\tdetail: { result },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\t}\n\t\n\t// TODO: Use our existing functions\n\tprivate gradeRecall(): GradingResult {\n\t\tconst normalizedAnswerKey = this.data.items.map(item => item.toLowerCase());\n\t\tconst userRecalled = Array.from(this._recalledItems);\n\n\t\tlet correctCount = 0;\n\n\t\t// Count how many recalled items match the answer key\n\t\tfor (const item of userRecalled) {\n\t\t\tif (normalizedAnswerKey.includes(item)) {\n\t\t\t\tcorrectCount++;\n\t\t\t}\n\t\t}\n\n\t\tconst totalItems = this.data.items.length;\n\t\tconst score = totalItems > 0 ? Math.round((correctCount / totalItems) * 100) : 0;\n\n\t\treturn {\n\t\t\tscore,\n\t\t\tcorrect: correctCount,\n\t\t\ttotal: totalItems,\n\t\t\tanswerKey: this.data.items,\n\t\t\tuserResponse: userRecalled\n\t\t};\n\t}\n\n\tprivate applyGradingFeedback(result: GradingResult): void {\n\t\tconst normalizedAnswerKey = this.data.items.map(item => item.toLowerCase());\n\t\tconst chips = this._$chipsContainer.querySelectorAll('edu-chip');\n\n\t\tchips.forEach((chip: EduChip) => {\n\t\t\tconst chipValue = chip.value;\n\n\t\t\tif (normalizedAnswerKey.includes(chipValue)) {\n\t\t\t\tchip.chipState = 'correct';\n\t\t\t} else {\n\t\t\t\tchip.chipState = 'wrong';\n\t\t\t}\n\t\t});\n\t}\n\n\t// ==================== RESET ====================\n\n\tpublic reset(): void {\n\t\tsuper.reset();\n\n\t\t// Clear recalled items\n\t\tthis._recalledItems.clear();\n\n\t\t// Clear chips container\n\t\tthis._$chipsContainer.innerHTML = '';\n\n\t\t// Clear text input\n\t\tconst input = this._$textInput.querySelector('.control') as HTMLInputElement;\n\t\tif (input) input.value = '';\n\n\t\t// Reset progress\n\t\tthis.setProgress(0);\n\n\t\t// Remove grading state from chips (already cleared)\n\t}\n}\n\nif (!customElements.get('list-recall')) {\n\tcustomElements.define('list-recall', ListRecall);\n}\n", "import { BaseInteraction } from \"../../core/BaseInteraction\";\nimport { Variant } from \"../../shared/types\";\nimport { InteractionConfig, InteractionMechanic } from \"../../types/Interactions\";\nimport { TableConfiguration, ValueTableData, TableCompletion } from \"../../types/Tables\";\nimport { EduTable, lookupTableGrader, detectCellKind, getAllValues, getAllUniqueValues, getLookupCellGrading } from \"../../engines/tables\";\n\nexport class LookupTable extends BaseInteraction<ValueTableData> {\n\n\tinteractionMechanic: InteractionMechanic = \"static\";\n\n\tprivate _tableConfig: TableConfiguration;\n\tprivate _$table!: EduTable;\n\n\tconstructor(data: ValueTableData, config: InteractionConfig) {\n\t\tsuper(data, config);\n\n\t\tconst allValues = getAllValues(data.answerKey);\n\t\tconst cellKind = detectCellKind(allValues);\n\n\t\t// Configure table for lookup mode\n\t\tthis._tableConfig = {\n\t\t\trows: data.rows,\n\t\t\tcols: data.cols,\n\t\t\tanswerKey: data.answerKey,\n\t\t\tcellKind,\n\t\t\tpreset: 'lookup',\n\t\t\tdisabled: (r, c) => data.answerKey[r]?.[c] === null, // Disable cells marked with '-'\n\t\t\tallowed: cellKind === 'select' ? () => getAllUniqueValues(data.answerKey) : undefined,\n\t\t\tvariant: config.variant ?? 'outline',\n\t\t\tshuffle: config.shuffle ?? false\n\t\t};\n\n\t\t// Initialize progress tracking (count only non-disabled cells)\n\t\tlet totalCells = 0;\n\t\tfor (const row of data.rows) {\n\t\t\tfor (const col of data.cols) {\n\t\t\t\tif (data.answerKey[row]?.[col] !== null) {\n\t\t\t\t\ttotalCells++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis.initializeProgress(totalCells);\n\t}\n\n\t// ==================== LIFECYCLE ====================\n\n\tprotected initialize(): void {}\n\tprotected cleanup(): void {}\n\n\tonVariantChange(newVariant: Variant): void {\n\t\tthis._tableConfig.variant = newVariant;\n\t\tif (this._$table) {\n\t\t\tthis._$table.setAttribute('variant', newVariant);\n\t\t}\n\t}\n\n\t// ==================== RENDERING ====================\n\n\trender(): void {\n\t\t// Update table config variant to match current\n\t\tthis._tableConfig.variant = this.config.variant;\n\n\t\t// Create table\n\t\tthis._$table = document.createElement('edu-table') as EduTable;\n\t\tthis._$table.config = this._tableConfig;\n\n\t\t// Listen to table changes\n\t\tthis._$table.addEventListener('change', () => {\n\t\t\tthis.updateProgressBasedOnCompletion();\n\t\t\tthis.emitStateChange();\n\t\t});\n\n\t\t// Render with wrapper for proper height/overflow handling\n\t\tthis.innerHTML = `\n\t\t\t<style>\n\t\t\t\t:host {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t}\n\n\t\t\t\t.table-container {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\tflex-direction: column;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\toverflow: hidden;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t}\n\n\t\t\t\t.table-wrapper {\n\t\t\t\t\tflex: 1;\n\t\t\t\t\toverflow-y: auto;\n\t\t\t\t\toverflow-x: auto;\n\t\t\t\t\tmin-height: 0;\n\t\t\t\t\tpadding: 1rem;\n\t\t\t\t}\n\t\t\t</style>\n\t\t\t<div class=\"table-container\">\n\t\t\t\t<div class=\"table-wrapper\"></div>\n\t\t\t</div>\n\t\t`;\n\n\t\tconst wrapper = this.querySelector('.table-wrapper') as HTMLDivElement;\n\t\twrapper.appendChild(this._$table);\n\t}\n\n\t// ==================== INTERACTION LOGIC ====================\n\n\t/**\n\t * Update progress bar based on how many cells are filled\n\t */\n\tprivate updateProgressBasedOnCompletion(): void {\n\t\tconst state = this._$table.getState();\n\t\tlet completedCells = 0;\n\n\t\tfor (const row of this.data.rows) {\n\t\t\tfor (const col of this.data.cols) {\n\t\t\t\t// Skip disabled cells\n\t\t\t\tif (this.data.answerKey[row]?.[col] === null) continue;\n\n\t\t\t\tconst value = state[row]?.values[col];\n\t\t\t\tif (value !== null && value !== undefined && value !== '') {\n\t\t\t\t\tcompletedCells++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthis.setProgress(completedCells);\n\t}\n\n\tgetCurrentState(): TableCompletion {\n\t\treturn this._$table.getState();\n\t}\n\n\tisInteractionComplete(): boolean {\n\t\tconst state = this._$table.getState();\n\n\t\t// All non-disabled cells must have values\n\t\tfor (const row of this.data.rows) {\n\t\t\tfor (const col of this.data.cols) {\n\t\t\t\t// Skip disabled cells\n\t\t\t\tif (this.data.answerKey[row]?.[col] === null) continue;\n\n\t\t\t\tconst value = state[row]?.values[col];\n\t\t\t\tif (value === null || value === undefined || value === '') {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tonHint(): void {\n\t\tconst state = this._$table.getState();\n\n\t\t// Find first empty non-disabled cell\n\t\tfor (const row of this.data.rows) {\n\t\t\tfor (const col of this.data.cols) {\n\t\t\t\t// Skip disabled cells\n\t\t\t\tif (this.data.answerKey[row]?.[col] === null) continue;\n\n\t\t\t\tconst value = state[row]?.values[col];\n\t\t\t\tif (value === null || value === undefined || value === '') {\n\t\t\t\t\talert(`Hint: You haven't filled the cell for \"${row}\" / \"${col}\" yet.`);\n\t\t\t\t\tthis.emitHintShown(`Empty cell: ${row} / ${col}`);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\talert('All cells are complete! Click \"Check\" to submit.');\n\t\tthis.emitHintShown('All cells complete');\n\t}\n\n\t// ==================== GRADING ====================\n\n\t/**\n\t * Override submit to include grading using lookup grader\n\t */\n\tpublic submit(): void {\n\t\t// Check completion first (will throw if not complete)\n\t\tsuper.submit();\n\n\t\t// Grade the response using lookup grader\n\t\tconst userData = this.getCurrentState();\n\t\tconst result = lookupTableGrader(\n\t\t\tthis.data.answerKey,\n\t\t\tuserData,\n\t\t\tthis.data.rows,\n\t\t\tthis.data.cols\n\t\t);\n\n\t\t// Generate per-cell grading feedback\n\t\tconst cellGrading = getLookupCellGrading(\n\t\t\tthis.data.answerKey,\n\t\t\tuserData,\n\t\t\tthis.data.rows,\n\t\t\tthis.data.cols\n\t\t);\n\n\t\t// Apply grading state to table\n\t\tthis._$table.setGradingState(cellGrading);\n\n\t\tconsole.log(`Lookup Table Score: ${result.score.toFixed(1)}% (${result.correct}/${result.total} correct)`);\n\n\t\t// Emit grading event\n\t\tthis.dispatchEvent(new CustomEvent('interaction:graded', {\n\t\t\tdetail: { result },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\t}\n\n\t// ==================== RESET ====================\n\n\tpublic reset(): void {\n\t\tsuper.reset();\n\t\tif (this._$table) {\n\t\t\tthis._$table.reset();\n\t\t\tthis._$table.clearGradingState();\n\t\t}\n\t}\n}\n\nif (!customElements.get('lookup-table')) {\n\tcustomElements.define('lookup-table', LookupTable);\n}\n", "import { BaseInteraction } from \"../../core/BaseInteraction\";\nimport { Variant } from \"../../shared/types\";\nimport { InteractionConfig, InteractionMechanic } from \"../../types/Interactions\";\nimport { TableConfiguration, BaseTableData, TableCompletion } from \"../../types/Tables\";\nimport { EduTable, classificationTableGrader, getClassificationCellGrading } from \"../../engines/tables\";\n\n/**\n * ClassificationMatrix\n *\n * Table-based interaction using checkboxes to assign multiple attributes\n * to items.\n * \n * Inspired from Typeform's matrix and based on my table's engine\n * See their implementation in their content features:\n * @see https://admin.typeform.com\n * \n */\nexport class ClassificationMatrix extends BaseInteraction<BaseTableData> {\n\n\tinteractionMechanic: InteractionMechanic = \"static\";\n\n\tprivate _tableConfig: TableConfiguration;\n\tprivate _$table!: EduTable;\n\n\tconstructor(data: BaseTableData, config: InteractionConfig) {\n\n\t\tsuper(data, config);\n\n\t\tthis._tableConfig = {\n\t\t\trows: data.rows,\n\t\t\tcols: data.cols,\n\t\t\tanswerKey: data.answerKey,\n\t\t\tcellKind: 'checkbox',\n\t\t\tpreset: 'classification',\n\t\t\tvariant: config.variant ?? 'outline',\n\t\t\tshuffle: config.shuffle \n\t\t};\n\n\t\tthis.initializeProgress(data.rows.length);\n\t}\n\n\t// ==================== LIFECYCLE ====================\n\n\tprotected initialize(): void {}\n\n\tprotected cleanup(): void {}\n\n\tonVariantChange(newVariant: Variant): void {\n\t\tthis._tableConfig.variant = newVariant;\n\t\tif (this._$table) {\n\t\t\tthis._$table.setAttribute('variant', newVariant);\n\t\t}\n\t}\n\n\t// ==================== RENDERING ====================\n\n\trender(): void {\n\t\tthis._tableConfig.variant = this.config.variant;\n\n\t\tthis._$table = document.createElement('edu-table') as EduTable;\n\t\tthis._$table.config = this._tableConfig;\n\n\t\tthis._$table.addEventListener('change', () => {\n\t\t\tthis.updateProgressBasedOnCompletion();\n\t\t\tthis.emitStateChange();\n\t\t});\n\n\t\tthis.innerHTML = '';\n\t\tthis.appendChild(this._$table);\n\t}\n\n\t// ==================== INTERACTION LOGIC ====================\n\n\tprivate updateProgressBasedOnCompletion(): void {\n\t\tconst state = this._$table.getState();\n\t\tlet completedRows = 0;\n\n\t\tfor (const row of this.data.rows) {\n\t\t\tif (state[row]?.selectedCols.length > 0) {\n\t\t\t\tcompletedRows++;\n\t\t\t}\n\t\t}\n\n\t\tthis.setProgress(completedRows);\n\t}\n\n\tgetCurrentState(): TableCompletion {\n\t\treturn this._$table.getState();\n\t}\n\n\tisInteractionComplete(): boolean {\n\t\tconst state = this._$table.getState();\n\n\t\treturn this.data.rows.every(row =>\n\t\t\tstate[row]?.selectedCols.length > 0\n\t\t);\n\t}\n\n\tonHint(): void {\n\t\tconst state = this._$table.getState();\n\t\tconst emptyRows = this.data.rows.filter(row =>\n\t\t\t!state[row] || state[row].selectedCols.length === 0\n\t\t);\n\n\t\tif (emptyRows.length === 0) {\n\t\t\talert('All rows are complete! Click \"Check\" to submit.');\n\t\t\tthis.emitHintShown('All rows complete');\n\t\t\treturn;\n\t\t}\n\n\t\t// Show hint for first incomplete row\n\t\tconst firstEmpty = emptyRows[0];\n\t\talert(`Hint: You haven't classified \"${firstEmpty}\" yet. Which categories does it belong to?`);\n\t\tthis.emitHintShown(`Incomplete row: ${firstEmpty}`);\n\t}\n\n\t// ==================== GRADING ====================\n\tpublic submit(): void {\n\t\tsuper.submit();\n\n\t\tconst userData = this.getCurrentState();\n\t\tconst result = classificationTableGrader(\n\t\t\tthis.data.answerKey,\n\t\t\tuserData,\n\t\t\tthis.data.rows,\n\t\t\tthis.data.cols\n\t\t);\n\n\t\t// Generate per-cell grading feedback\n\t\tconst cellGrading = getClassificationCellGrading(\n\t\t\tthis.data.answerKey,\n\t\t\tuserData,\n\t\t\tthis.data.rows,\n\t\t\tthis.data.cols\n\t\t);\n\n\t\t// Apply grading state to table\n\t\tthis._$table.setGradingState(cellGrading);\n\n\t\tconsole.log(`Classification Score: ${result.score.toFixed(1)}% (${result.correct}/${result.total} correct)`);\n\n\t\tthis.dispatchEvent(new CustomEvent('interaction:graded', {\n\t\t\tdetail: { result },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\t}\n\n\t// ==================== RESET ====================\n\n\tpublic reset(): void {\n\t\tsuper.reset();\n\t\tif (this._$table) {\n\t\t\tthis._$table.reset();\n\t\t\tthis._$table.clearGradingState();\n\t\t}\n\t}\n}\n\nif (!customElements.get('classification-matrix')) {\n\tcustomElements.define('classification-matrix', ClassificationMatrix);\n}\n", "import { BaseInteraction } from \"../../core/BaseInteraction\";\nimport { Variant } from \"../../shared/types\";\nimport { InteractionConfig, InteractionMechanic } from \"../../types/Interactions\";\nimport { TableConfiguration, BaseTableData, TableCompletion } from \"../../types/Tables\";\nimport { EduTable, naryTableGrader, getNaryCellGrading } from \"../../engines/tables\";\n\nexport class NaryChoiceTable extends BaseInteraction<BaseTableData> {\n\n\tinteractionMechanic: InteractionMechanic = \"static\";\n\n\tprivate _tableConfig: TableConfiguration;\n\tprivate _$table!: EduTable;\n\n\tconstructor(data: BaseTableData, config: InteractionConfig) {\n\t\tsuper(data, config);\n\n\t\t// Configure table for n-ary mode (radio buttons)\n\t\tthis._tableConfig = {\n\t\t\trows: data.rows,\n\t\t\tcols: data.cols,\n\t\t\tanswerKey: data.answerKey,\n\t\t\tcellKind: 'radio',\n\t\t\tpreset: 'n-ary',\n\t\t\tvariant: config.variant ?? 'outline',\n\t\t\tshuffle: true \n\t\t};\n\n\t\t// Initialize progress tracking (one per row)\n\t\tthis.initializeProgress(data.rows.length);\n\t}\n\n\t// ==================== LIFECYCLE ====================\n\n\tprotected initialize(): void {}\n\tprotected cleanup(): void {}\n\n\tonVariantChange(newVariant: Variant): void {\n\t\tthis._tableConfig.variant = newVariant;\n\t\tif (this._$table) {\n\t\t\tthis._$table.setAttribute('variant', newVariant);\n\t\t}\n\t}\n\n\t// ==================== RENDERING ====================\n\n\trender(): void {\n\t\t// Update table config variant to match current\n\t\tthis._tableConfig.variant = this.config.variant;\n\n\t\t// Create table\n\t\tthis._$table = document.createElement('edu-table') as EduTable;\n\t\tthis._$table.config = this._tableConfig;\n\n\t\t// Listen to table changes\n\t\tthis._$table.addEventListener('change', () => {\n\t\t\tthis.updateProgressBasedOnCompletion();\n\t\t\tthis.emitStateChange();\n\t\t});\n\n\t\t// Render with wrapper for proper height/overflow handling\n\t\tthis.innerHTML = `\n\t\t\t<style>\n\t\t\t\tnary-choice-table {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t}\n\n\t\t\t\t.table-container {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\tflex-direction: column;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\toverflow: hidden;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t}\n\n\t\t\t\t.table-wrapper {\n\t\t\t\t\tflex: 1;\n\t\t\t\t\toverflow-y: auto;\n\t\t\t\t\toverflow-x: auto;\n\t\t\t\t\tmin-height: 0;\n\t\t\t\t\tpadding: 1rem;\n\t\t\t\t}\n\t\t\t</style>\n\t\t\t<div class=\"table-container\">\n\t\t\t\t<div class=\"table-wrapper\"></div>\n\t\t\t</div>\n\t\t`;\n\n\t\tconst wrapper = this.querySelector('.table-wrapper') as HTMLDivElement;\n\t\twrapper.appendChild(this._$table);\n\t}\n\n\t// ==================== INTERACTION LOGIC ====================\n\n\t/**\n\t * Update progress bar based on how many rows have exactly one selection\n\t * N-ary requires single selection per row\n\t */\n\tprivate updateProgressBasedOnCompletion(): void {\n\t\tconst state = this._$table.getState();\n\t\tlet completedRows = 0;\n\n\t\tfor (const row of this.data.rows) {\n\t\t\t// N-ary requires exactly 1 selection per row\n\t\t\tif (state[row]?.selectedCols.length === 1) {\n\t\t\t\tcompletedRows++;\n\t\t\t}\n\t\t}\n\n\t\tthis.setProgress(completedRows);\n\t}\n\n\tgetCurrentState(): TableCompletion {\n\t\treturn this._$table.getState();\n\t}\n\n\tisInteractionComplete(): boolean {\n\t\tconst state = this._$table.getState();\n\n\t\t// All rows must have exactly one selection (n-ary constraint)\n\t\treturn this.data.rows.every(row =>\n\t\t\tstate[row]?.selectedCols.length === 1\n\t\t);\n\t}\n\n\tonHint(): void {\n\t\tconst state = this._$table.getState();\n\t\tconst incompleteRows = this.data.rows.filter(row =>\n\t\t\t!state[row] || state[row].selectedCols.length !== 1\n\t\t);\n\n\t\tif (incompleteRows.length === 0) {\n\t\t\talert('All rows are complete! Click \"Check\" to submit.');\n\t\t\tthis.emitHintShown('All rows complete');\n\t\t\treturn;\n\t\t}\n\n\t\t// Show hint for first incomplete row\n\t\tconst firstIncomplete = incompleteRows[0];\n\t\talert(`Hint: You haven't selected a category for \"${firstIncomplete}\" yet. Which one does it belong to?`);\n\t\tthis.emitHintShown(`Incomplete row: ${firstIncomplete}`);\n\t}\n\n\t// ==================== GRADING ====================\n\n\t/**\n\t * Override submit to include grading using n-ary grader\n\t * N-ary grading is binary per row (100% or 0%)\n\t */\n\tpublic submit(): void {\n\t\t// Check completion first (will throw if not complete)\n\t\tsuper.submit();\n\n\t\t// Grade the response using n-ary grader\n\t\tconst userData = this.getCurrentState();\n\t\tconst result = naryTableGrader(\n\t\t\tthis.data.answerKey,\n\t\t\tuserData,\n\t\t\tthis.data.rows\n\t\t);\n\n\t\t// Generate per-cell grading feedback\n\t\tconst cellGrading = getNaryCellGrading(\n\t\t\tthis.data.answerKey,\n\t\t\tuserData,\n\t\t\tthis.data.rows\n\t\t);\n\n\t\t// Apply grading state to table\n\t\tthis._$table.setGradingState(cellGrading);\n\n\t\tconsole.log(`N-ary Choice Score: ${result.score.toFixed(1)}% (${result.correct}/${result.total} correct)`);\n\n\t\t// Emit grading event\n\t\tthis.dispatchEvent(new CustomEvent('interaction:graded', {\n\t\t\tdetail: { result },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\t}\n\n\t// ==================== RESET ====================\n\n\tpublic reset(): void {\n\t\tsuper.reset();\n\t\tif (this._$table) {\n\t\t\tthis._$table.reset();\n\t\t\tthis._$table.clearGradingState();\n\t\t}\n\t}\n}\n\nif (!customElements.get('nary-choice-table')) {\n\tcustomElements.define('nary-choice-table', NaryChoiceTable);\n}\n", "import { BaseInteraction } from \"../../core/BaseInteraction\";\nimport { Variant } from \"../../shared/types\";\nimport { InteractionConfig, InteractionMechanic } from \"../../types/Interactions\";\nimport { TableConfiguration, ValueTableData, TableCompletion } from \"../../types/Tables\";\nimport { EduTable, adjacencyTableGrader, detectCellKind, getAllValues, getAllUniqueValues, getAdjacencyCellGrading } from \"../../engines/tables\";\n\nexport class AdjacencyTable extends BaseInteraction<ValueTableData> {\n\n\tinteractionMechanic: InteractionMechanic = \"static\";\n\n\tprivate _tableConfig: TableConfiguration;\n\tprivate _$table!: EduTable;\n\n\tconstructor(data: ValueTableData, config: InteractionConfig) {\n\t\tsuper(data, config);\n\n\t\tconst allValues = getAllValues(data.answerKey);\n\t\tconst cellKind = detectCellKind(allValues);\n\n\t\t// Configure table for adjacency mode\n\t\tthis._tableConfig = {\n\t\t\trows: data.rows,\n\t\t\tcols: data.cols,\n\t\t\tanswerKey: data.answerKey,\n\t\t\tcellKind,\n\t\t\tpreset: 'adjacency',\n\t\t\tdisabled: (r, c) => r === c, // Disable diagonal\n\t\t\tallowed: cellKind === 'select' ? () => getAllUniqueValues(data.answerKey) : undefined,\n\t\t\tvariant: config.variant ?? 'outline',\n\t\t\tshuffle: config.shuffle ?? false\n\t\t};\n\n\t\t// Initialize progress tracking (total cells excluding diagonal)\n\t\tconst totalCells = data.rows.length * (data.rows.length - 1);\n\t\tthis.initializeProgress(totalCells);\n\t}\n\n\t// ==================== LIFECYCLE ====================\n\n\tprotected initialize(): void {}\n\tprotected cleanup(): void {}\n\n\tonVariantChange(newVariant: Variant): void {\n\t\tthis._tableConfig.variant = newVariant;\n\t\tif (this._$table) {\n\t\t\tthis._$table.setAttribute('variant', newVariant);\n\t\t}\n\t}\n\n\t// ==================== RENDERING ====================\n\n\trender(): void {\n\t\t// Update table config variant to match current\n\t\tthis._tableConfig.variant = this.config.variant;\n\n\t\t// Create table\n\t\tthis._$table = document.createElement('edu-table') as EduTable;\n\t\tthis._$table.config = this._tableConfig;\n\n\t\t// Listen to table changes\n\t\tthis._$table.addEventListener('change', () => {\n\t\t\tthis.updateProgressBasedOnCompletion();\n\t\t\tthis.emitStateChange();\n\t\t});\n\n\t\t// Render with wrapper for proper height/overflow handling\n\t\tthis.innerHTML = `\n\t\t\t<style>\n\t\t\t\t:host {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t}\n\n\t\t\t\t.table-container {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\tflex-direction: column;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\toverflow: hidden;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t}\n\n\t\t\t\t.table-wrapper {\n\t\t\t\t\tflex: 1;\n\t\t\t\t\toverflow-y: auto;\n\t\t\t\t\toverflow-x: auto;\n\t\t\t\t\tmin-height: 0;\n\t\t\t\t\tpadding: 1rem;\n\t\t\t\t}\n\t\t\t</style>\n\t\t\t<div class=\"table-container\">\n\t\t\t\t<div class=\"table-wrapper\"></div>\n\t\t\t</div>\n\t\t`;\n\n\t\tconst wrapper = this.querySelector('.table-wrapper') as HTMLDivElement;\n\t\twrapper.appendChild(this._$table);\n\t}\n\n\t// ==================== INTERACTION LOGIC ====================\n\n\t/**\n\t * Update progress bar based on how many non-diagonal cells are filled\n\t */\n\tprivate updateProgressBasedOnCompletion(): void {\n\t\tconst state = this._$table.getState();\n\t\tlet completedCells = 0;\n\n\t\tfor (const row of this.data.rows) {\n\t\t\tfor (const col of this.data.cols) {\n\t\t\t\tif (row === col) continue; // Skip diagonal\n\n\t\t\t\tconst value = state[row]?.values[col];\n\t\t\t\tif (value !== null && value !== undefined && value !== '') {\n\t\t\t\t\tcompletedCells++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthis.setProgress(completedCells);\n\t}\n\n\tgetCurrentState(): TableCompletion {\n\t\treturn this._$table.getState();\n\t}\n\n\tisInteractionComplete(): boolean {\n\t\tconst state = this._$table.getState();\n\n\t\t// All non-diagonal cells must have values\n\t\tfor (const row of this.data.rows) {\n\t\t\tfor (const col of this.data.cols) {\n\t\t\t\tif (row === col) continue; // Skip diagonal\n\n\t\t\t\tconst value = state[row]?.values[col];\n\t\t\t\tif (value === null || value === undefined || value === '') {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tonHint(): void {\n\t\tconst state = this._$table.getState();\n\n\t\t// Find first empty non-diagonal cell\n\t\tfor (const row of this.data.rows) {\n\t\t\tfor (const col of this.data.cols) {\n\t\t\t\tif (row === col) continue;\n\n\t\t\t\tconst value = state[row]?.values[col];\n\t\t\t\tif (value === null || value === undefined || value === '') {\n\t\t\t\t\talert(`Hint: You haven't filled the cell for \"${row}\" \u2192 \"${col}\" yet.`);\n\t\t\t\t\tthis.emitHintShown(`Empty cell: ${row} \u2192 ${col}`);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\talert('All cells are complete! Click \"Check\" to submit.');\n\t\tthis.emitHintShown('All cells complete');\n\t}\n\n\t// ==================== GRADING ====================\n\n\t/**\n\t * Override submit to include grading using adjacency grader\n\t */\n\tpublic submit(): void {\n\t\t// Check completion first (will throw if not complete)\n\t\tsuper.submit();\n\n\t\t// Grade the response using adjacency grader\n\t\tconst userData = this.getCurrentState();\n\t\tconst result = adjacencyTableGrader(\n\t\t\tthis.data.answerKey,\n\t\t\tuserData,\n\t\t\tthis.data.rows\n\t\t);\n\n\t\t// Generate per-cell grading feedback\n\t\tconst cellGrading = getAdjacencyCellGrading(\n\t\t\tthis.data.answerKey,\n\t\t\tuserData,\n\t\t\tthis.data.rows\n\t\t);\n\n\t\t// Apply grading state to table\n\t\tthis._$table.setGradingState(cellGrading);\n\n\t\tconsole.log(`Adjacency Table Score: ${result.score.toFixed(1)}% (${result.correct}/${result.total} correct)`);\n\n\t\t// Emit grading event\n\t\tthis.dispatchEvent(new CustomEvent('interaction:graded', {\n\t\t\tdetail: { result },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\t}\n\n\t// ==================== RESET ====================\n\n\tpublic reset(): void {\n\t\tsuper.reset();\n\t\tif (this._$table) {\n\t\t\tthis._$table.reset();\n\t\t\tthis._$table.clearGradingState();\n\t\t}\n\t}\n}\n\nif (!customElements.get('adjacency-table')) {\n\tcustomElements.define('adjacency-table', AdjacencyTable);\n}\n", "import { BaseInteraction } from \"../../core/BaseInteraction\";\nimport { Variant } from \"../../shared/types\";\nimport { InteractionConfig, InteractionMechanic } from \"../../types/Interactions\";\nimport { TextEngineBaseData, TextEngineConfiguration } from \"../../types/Text\";\n\nimport {\n\tEduText,\n\n\ttextEngineHighlightGrader,\n\tgetHighlightGradingState,\n\n\ttype TextEngineBaseUserData\n} from \"../../engines/text\";\n\n/**\n * Mark The Words - Text Highlight Interaction\n *\n * Users click to select/highlight target words in a passage of text.\n * Based on the TextEngineBaseData with highlight mode.\n *\n * Example data:\n * ```\n * {\n * type: 'base',\n * parts: ['The', 'cat', 'sat', 'on', 'the', 'mat'],\n * targets: [\n * { words: ['cat'], startPos: 1, endPos: 1 },\n * { words: ['mat'], startPos: 5, endPos: 5 }\n * ]\n * }\n * ```\n */\nexport class MarkTheWords extends BaseInteraction<TextEngineBaseData> {\n\n\tinteractionMechanic: InteractionMechanic = \"static\";\n\n\tprivate _textConfig: TextEngineConfiguration;\n\tprivate _$text!: EduText;\n\n\tconstructor(data: TextEngineBaseData, config: InteractionConfig) {\n\t\tsuper(data, config);\n\n\t\t// Configure text engine for highlight mode\n\t\tthis._textConfig = {\n\t\t\tdata: data,\n\t\t\tmode: 'highlight',\n\t\t\tvariant: config.variant ?? 'outline'\n\t\t};\n\n\t\tthis.implementsProgress = false;\n\t}\n\n\t// ==================== LIFECYCLE ====================\n\n\tprotected initialize(): void {}\n\tprotected cleanup(): void {}\n\n\tonVariantChange(newVariant: Variant): void {\n\t\tthis.config.variant = newVariant;\n\t\tthis._textConfig.variant = newVariant;\n\t\tif (this._$text) {\n\t\t\tthis._$text.setAttribute('variant', newVariant);\n\t\t}\n\t}\n\n\t// ==================== RENDERING ====================\n\n\trender(): void {\n\t\t// Update text config variant to match current\n\t\tthis._textConfig.variant = this.config.variant;\n\n\t\t// Create text element\n\t\tthis._$text = document.createElement('edu-text') as EduText;\n\t\tthis._$text.config = this._textConfig;\n\n\t\t// Listen to text changes\n\t\tthis._$text.addEventListener('change', () => {\n\t\t\tthis.emitStateChange();\n\t\t});\n\n\t\t// Render with wrapper for proper height/overflow handling\n\t\tthis.innerHTML = `\n\t\t\t<style>\n\t\t\t\tmark-the-words {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t}\n\n\t\t\t\t.text-container {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\tflex-direction: column;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\toverflow: hidden;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t}\n\n\t\t\t\t.text-wrapper {\n\t\t\t\t\tflex: 1;\n\t\t\t\t\toverflow-y: auto;\n\t\t\t\t\toverflow-x: auto;\n\t\t\t\t\tmin-height: 0;\n\t\t\t\t\tpadding: 1rem;\n\t\t\t\t}\n\t\t\t</style>\n\t\t\t<div class=\"text-container\">\n\t\t\t\t<div class=\"text-wrapper\"></div>\n\t\t\t</div>\n\t\t`;\n\n\t\tconst wrapper = this.querySelector('.text-wrapper') as HTMLDivElement;\n\t\twrapper.appendChild(this._$text);\n\t}\n\t//\n\t// ==================== REQUIRED ABSTRACT METHODS ====================\n\n\tgetCurrentState(): TextEngineBaseUserData {\n\t\tif (!this._$text) return { selectedIndices: [] };\n\t\treturn this._$text.getValue();\n\t}\n\n\tisInteractionComplete(): boolean {\n\t\tconst userData = this.getCurrentState();\n\t\tconst selected = new Set(userData.selectedIndices ?? []);\n\n\t\tfor (const target of this.data.targets) {\n\t\t\tfor (let i = target.startPos; i <= target.endPos; i++) {\n\t\t\t\tif (!selected.has(i)) return false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tonHint(): void {\n\t\t// Highlight one random unselected target word\n\t\tconst userData = this.getCurrentState();\n\t\tconst selectedIndices = new Set(userData.selectedIndices ?? []);\n\n\t\t// Find all unselected target indices\n\t\tconst unselectedTargets: number[] = [];\n\t\tfor (const target of this.data.targets) {\n\t\t\tfor (let i = target.startPos; i <= target.endPos; i++) {\n\t\t\t\tif (!selectedIndices.has(i)) {\n\t\t\t\t\tunselectedTargets.push(i);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (unselectedTargets.length > 0) {\n\t\t\tconst randomIndex = unselectedTargets[Math.floor(Math.random() * unselectedTargets.length)];\n\t\t\tconst word = this.data.parts[randomIndex];\n\t\t\tthis.emitHintShown(`Try selecting: \"${word}\"`);\n\t\t} else {\n\t\t\tthis.emitHintShown('All target words have been selected!');\n\t\t}\n\t}\n\n\t// ==================== STATE & GRADING ====================\n\n\tgetUserData(): TextEngineBaseUserData {\n\t\treturn this.getCurrentState();\n\t}\n\n\tpublic submit(): void {\n\t\tsuper.submit();\n\t\tconst result = this.grade();\n\t\tthis.dispatchEvent(new CustomEvent('interaction:graded', {\n\t\t\tdetail: { result },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\t}\n\n\tgrade() {\n\t\tconst userData = this.getUserData();\n\t\tconst result = textEngineHighlightGrader(this.data, userData);\n\n\t\t// Generate word-level grading state for visual feedback\n\t\tconst wordGradingState = getHighlightGradingState(this.data, userData);\n\n\t\t// Apply grading visualization\n\t\tif (this._$text) {\n\t\t\tthis._$text.setGradingState(wordGradingState);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\treset() {\n\t\tsuper.reset();\n\t\tif (this._$text) {\n\t\t\tthis._$text.reset();\n\t\t\tthis._$text.clearGradingState();\n\t\t}\n\t}\n}\n\nif (!customElements.get('mark-the-words')) {\n\tcustomElements.define('mark-the-words', MarkTheWords);\n}\n", "import { BaseInteraction } from \"../../core/BaseInteraction\";\nimport { Variant } from \"../../shared/types\";\nimport { InteractionConfig, InteractionMechanic } from \"../../types/Interactions\";\nimport { GradingResult } from \"../../types/Grading\";\nimport { TextEngineBaseData, TextEngineConfiguration, TextEngineSequentialInteractionData } from \"../../types/Text\";\n\nimport {\n\tEduText,\n\ttextEngineHighlightGrader,\n\tgetHighlightGradingState,\n\ttype TextEngineBaseUserData,\n\ttype TextEngineBaseGradingState\n} from \"../../engines/text\";\n\nexport class SequentialMarkTheWords extends BaseInteraction<TextEngineSequentialInteractionData> {\n\n\tinteractionMechanic: InteractionMechanic = \"sequential\";\n\n\tprivate _slides: TextEngineBaseData[] = [];\n\tprivate _currentStep = 0;\n\n\tprivate _textConfig!: TextEngineConfiguration;\n\tprivate _$text!: EduText;\n\n\tprivate _responses: Record<number, TextEngineBaseUserData> = {};\n\tprivate _gradingByStep: Record<number, TextEngineBaseGradingState> = {};\n\tprivate _isGraded = false;\n\n\tpublic get slidesCount(): number {\n\t\treturn this._slides.length;\n\t}\n\n\tconstructor(data: TextEngineSequentialInteractionData, config: InteractionConfig) {\n\t\tsuper(data, config);\n\n\t\tthis._slides = (Array.isArray(data) ? data : []).filter(\n\t\t\t(slide): slide is TextEngineBaseData => slide.type === \"base\"\n\t\t);\n\n\t\tif (this._slides.length === 0) {\n\t\t\tthis.isValid = false;\n\t\t\tthis.errors = \"SequentialMarkTheWords requires at least one base slide.\";\n\t\t\treturn;\n\t\t}\n\n\t\tthis._textConfig = {\n\t\t\tdata: this._slides[0],\n\t\t\tmode: \"highlight\",\n\t\t\tvariant: config.variant ?? \"outline\"\n\t\t};\n\n\t\tthis.initializeProgress(this.getTotalTargetCount());\n\t}\n\n\tprotected initialize(): void {}\n\tprotected cleanup(): void {}\n\n\tonVariantChange(newVariant: Variant): void {\n\t\tthis.config.variant = newVariant;\n\t\tthis._textConfig.variant = newVariant;\n\t\tif (this._$text) {\n\t\t\tthis._$text.setAttribute(\"variant\", newVariant);\n\t\t}\n\t}\n\n\tpublic setSteps(stepIndex: number): void {\n\t\tthis.saveCurrentStepResponse();\n\n\t\tconst nextStep = Math.max(0, Math.min(this._slides.length - 1, stepIndex - 1));\n\t\tif (nextStep === this._currentStep) return;\n\n\t\tthis._currentStep = nextStep;\n\t\tthis.render();\n\t}\n\n\trender(): void {\n\t\tif (this._slides.length === 0) return;\n\n\t\tthis._textConfig = {\n\t\t\tdata: this._slides[this._currentStep],\n\t\t\tmode: \"highlight\",\n\t\t\tvariant: this.config.variant\n\t\t};\n\n\t\tthis._$text = document.createElement(\"edu-text\") as EduText;\n\t\tthis._$text.config = this._textConfig;\n\n\t\tconst stepState = this._responses[this._currentStep];\n\t\tif (stepState?.selectedIndices) {\n\t\t\tthis._$text.setState({ selectedIndices: new Set(stepState.selectedIndices) });\n\t\t}\n\n\t\tconst stepGrading = this._gradingByStep[this._currentStep];\n\t\tif (this._isGraded && stepGrading) {\n\t\t\tthis._$text.setGradingState(stepGrading);\n\t\t}\n\n\t\tthis._$text.addEventListener(\"change\", () => {\n\t\t\tthis.saveCurrentStepResponse();\n\t\t\tthis.updateProgressAcrossSteps();\n\t\t\tif (this._isGraded) {\n\t\t\t\tdelete this._gradingByStep[this._currentStep];\n\t\t\t\tthis._$text.clearGradingState();\n\t\t\t}\n\t\t\tthis.emitStateChange();\n\t\t});\n\n\t\tthis.innerHTML = `\n\t\t\t<style>\n\t\t\t\tsequential-mark-the-words {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t}\n\n\t\t\t\t.text-container {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\tflex-direction: column;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\toverflow: hidden;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t}\n\n\t\t\t\t.text-wrapper {\n\t\t\t\t\tflex: 1;\n\t\t\t\t\toverflow-y: auto;\n\t\t\t\t\toverflow-x: auto;\n\t\t\t\t\tmin-height: 0;\n\t\t\t\t\tpadding: 1rem;\n\t\t\t\t}\n\t\t\t</style>\n\t\t\t<div class=\"text-container\">\n\t\t\t\t<div class=\"text-wrapper\"></div>\n\t\t\t</div>\n\t\t`;\n\n\t\tconst wrapper = this.querySelector(\".text-wrapper\") as HTMLDivElement;\n\t\twrapper.appendChild(this._$text);\n\t}\n\n\tprivate getTargetCountForSlide(slide: TextEngineBaseData): number {\n\t\tlet total = 0;\n\t\tfor (const target of slide.targets) {\n\t\t\ttotal += (target.endPos - target.startPos + 1);\n\t\t}\n\t\treturn total;\n\t}\n\n\tprivate getTotalTargetCount(): number {\n\t\treturn this._slides.reduce((sum, slide) => sum + this.getTargetCountForSlide(slide), 0);\n\t}\n\n\tprivate saveCurrentStepResponse(): void {\n\t\tif (!this._$text) return;\n\t\tthis._responses[this._currentStep] = this._$text.getValue();\n\t}\n\n\tprivate getResponseForStep(step: number): TextEngineBaseUserData {\n\t\treturn this._responses[step] ?? { selectedIndices: [] };\n\t}\n\n\tprivate getTargetIndices(slide: TextEngineBaseData): Set<number> {\n\t\tconst targetIndices = new Set<number>();\n\t\tfor (const target of slide.targets) {\n\t\t\tfor (let i = target.startPos; i <= target.endPos; i++) {\n\t\t\t\ttargetIndices.add(i);\n\t\t\t}\n\t\t}\n\t\treturn targetIndices;\n\t}\n\n\tprivate updateProgressAcrossSteps(): void {\n\t\tlet correctSelections = 0;\n\n\t\tfor (let i = 0; i < this._slides.length; i++) {\n\t\t\tconst slide = this._slides[i];\n\t\t\tconst response = this.getResponseForStep(i);\n\t\t\tconst selected = new Set(response.selectedIndices ?? []);\n\t\t\tconst targets = this.getTargetIndices(slide);\n\n\t\t\tfor (const idx of targets) {\n\t\t\t\tif (selected.has(idx)) correctSelections++;\n\t\t\t}\n\t\t}\n\n\t\tthis.setProgress(correctSelections);\n\t}\n\n\tgetCurrentState(): any {\n\t\tthis.saveCurrentStepResponse();\n\t\treturn {\n\t\t\tstep: this._currentStep,\n\t\t\tresponses: this._responses\n\t\t};\n\t}\n\n\tisInteractionComplete(): boolean {\n\t\treturn this.getProgress().current === this.getProgress().total;\n\t}\n\n\tonHint(): void {\n\t\tthis.saveCurrentStepResponse();\n\n\t\tconst slide = this._slides[this._currentStep];\n\t\tconst response = this.getResponseForStep(this._currentStep);\n\t\tconst selected = new Set(response.selectedIndices ?? []);\n\n\t\tconst unselectedTargets: number[] = [];\n\t\tfor (const target of slide.targets) {\n\t\t\tfor (let i = target.startPos; i <= target.endPos; i++) {\n\t\t\t\tif (!selected.has(i)) {\n\t\t\t\t\tunselectedTargets.push(i);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (unselectedTargets.length > 0) {\n\t\t\tconst randomIndex = unselectedTargets[Math.floor(Math.random() * unselectedTargets.length)];\n\t\t\tthis.emitHintShown(`Try selecting: \"${slide.parts[randomIndex]}\"`);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.emitHintShown(\"This step is complete. Move to another step or submit.\");\n\t}\n\n\tgrade(): GradingResult {\n\t\tthis.saveCurrentStepResponse();\n\n\t\tlet correct = 0;\n\t\tlet total = 0;\n\t\tconst gradingByStep: Record<number, TextEngineBaseGradingState> = {};\n\n\t\tfor (let i = 0; i < this._slides.length; i++) {\n\t\t\tconst slide = this._slides[i];\n\t\t\tconst response = this.getResponseForStep(i);\n\t\t\tconst result = textEngineHighlightGrader(slide, response);\n\n\t\t\tcorrect += result.correct;\n\t\t\ttotal += result.total;\n\t\t\tgradingByStep[i] = getHighlightGradingState(slide, response);\n\t\t}\n\n\t\tthis._gradingByStep = gradingByStep;\n\t\tthis._isGraded = true;\n\n\t\tconst currentGrading = this._gradingByStep[this._currentStep];\n\t\tif (currentGrading) {\n\t\t\tthis._$text.setGradingState(currentGrading);\n\t\t}\n\n\t\tconst score = total > 0 ? Math.round((correct / total) * 100) : 0;\n\t\treturn { score, correct, total };\n\t}\n\n\tpublic submit(): void {\n\t\tsuper.submit();\n\t\tconst result = this.grade();\n\t\tthis.dispatchEvent(new CustomEvent(\"interaction:graded\", {\n\t\t\tdetail: { result },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\t}\n\n\tpublic reset(): void {\n\t\tsuper.reset();\n\t\tthis._responses = {};\n\t\tthis._gradingByStep = {};\n\t\tthis._isGraded = false;\n\t\tthis._currentStep = 0;\n\t\tif (this._$text) {\n\t\t\tthis._$text.reset();\n\t\t\tthis._$text.clearGradingState();\n\t\t}\n\t\tthis.setProgress(0);\n\t\tthis.render();\n\t}\n}\n\nif (!customElements.get(\"sequential-mark-the-words\")) {\n\tcustomElements.define(\"sequential-mark-the-words\", SequentialMarkTheWords);\n}\n", "import { BaseInteraction } from \"../../core/BaseInteraction\";\nimport { Variant } from \"../../shared/types\";\nimport { InteractionConfig, InteractionMechanic } from \"../../types/Interactions\";\nimport { TextEngineClassificationData, TextEngineConfiguration } from \"../../types/Text\";\n\nimport {\n\tEduText,\n\ttextEngineClassificationGrader,\n\tgetClassificationGradingState,\n\ttype TextEngineClassificationUserData\n} from \"../../engines/text\";\n\nexport class CategorizeTheWords extends BaseInteraction<TextEngineClassificationData> {\n\n\tinteractionMechanic: InteractionMechanic = \"static\";\n\n\tprivate _textConfig: TextEngineConfiguration;\n\tprivate _$text!: EduText;\n\n\tconstructor(data: TextEngineClassificationData, config: InteractionConfig) {\n\t\tsuper(data, config);\n\n\t\tthis._textConfig = {\n\t\t\tdata,\n\t\t\tmode: \"classification\",\n\t\t\tvariant: config.variant ?? \"outline\"\n\t\t};\n\n\t\tthis.implementsProgress = false;\n\t}\n\n\tprotected initialize(): void {}\n\tprotected cleanup(): void {}\n\n\tonVariantChange(newVariant: Variant): void {\n\t\tthis.config.variant = newVariant;\n\t\tthis._textConfig.variant = newVariant;\n\t\tif (this._$text) {\n\t\t\tthis._$text.setAttribute(\"variant\", newVariant);\n\t\t}\n\t}\n\n\trender(): void {\n\t\tthis._textConfig.variant = this.config.variant;\n\n\t\tthis._$text = document.createElement(\"edu-text\") as EduText;\n\t\tthis._$text.config = this._textConfig;\n\n\t\tthis._$text.addEventListener(\"change\", () => {\n\t\t\tthis.emitStateChange();\n\t\t});\n\n\t\tthis.innerHTML = `\n\t\t\t<style>\n\t\t\t\tcategorize-the-words {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t}\n\n\t\t\t\t.text-container {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\tflex-direction: column;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\toverflow: hidden;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t}\n\n\t\t\t\t.text-wrapper {\n\t\t\t\t\tflex: 1;\n\t\t\t\t\toverflow-y: auto;\n\t\t\t\t\toverflow-x: auto;\n\t\t\t\t\tmin-height: 0;\n\t\t\t\t\tpadding: 1rem;\n\t\t\t\t}\n\t\t\t</style>\n\t\t\t<div class=\"text-container\">\n\t\t\t\t<div class=\"text-wrapper\"></div>\n\t\t\t</div>\n\t\t`;\n\n\t\tconst wrapper = this.querySelector(\".text-wrapper\") as HTMLDivElement;\n\t\twrapper.appendChild(this._$text);\n\t}\n\n\tprivate getTargetIndices(): Set<number> {\n\t\tconst indices = new Set<number>();\n\t\tfor (const category of this.data.targets) {\n\t\t\tfor (const target of category.targets) {\n\t\t\t\tfor (let i = target.startPos; i <= target.endPos; i++) {\n\t\t\t\t\tindices.add(i);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn indices;\n\t}\n\n\tgetCurrentState(): TextEngineClassificationUserData {\n\t\tif (!this._$text) return { wordCategories: {} };\n\t\treturn this._$text.getValue();\n\t}\n\n\tisInteractionComplete(): boolean {\n\t\tconst userData = this.getCurrentState();\n\t\tconst targetIndices = this.getTargetIndices();\n\t\tfor (const idx of targetIndices) {\n\t\t\tif (!userData.wordCategories[idx]) return false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tonHint(): void {\n\t\tconst userData = this.getCurrentState();\n\n\t\tfor (const category of this.data.targets) {\n\t\t\tfor (const target of category.targets) {\n\t\t\t\tfor (let i = target.startPos; i <= target.endPos; i++) {\n\t\t\t\t\tif (!userData.wordCategories[i]) {\n\t\t\t\t\t\tthis.emitHintShown(`Try categorizing \"${this.data.parts[i]}\"`);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthis.emitHintShown(\"All target words are categorized.\");\n\t}\n\n\tgrade() {\n\t\tconst userData = this.getCurrentState();\n\t\tconst result = textEngineClassificationGrader(this.data, userData);\n\t\tconst gradingState = getClassificationGradingState(this.data, userData);\n\n\t\tif (this._$text) {\n\t\t\tthis._$text.setGradingState(gradingState);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tpublic submit(): void {\n\t\tsuper.submit();\n\t\tconst result = this.grade();\n\t\tthis.dispatchEvent(new CustomEvent(\"interaction:graded\", {\n\t\t\tdetail: { result },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\t}\n\n\tpublic reset(): void {\n\t\tsuper.reset();\n\t\tif (this._$text) {\n\t\t\tthis._$text.reset();\n\t\t\tthis._$text.clearGradingState();\n\t\t}\n\t}\n}\n\nif (!customElements.get(\"categorize-the-words\")) {\n\tcustomElements.define(\"categorize-the-words\", CategorizeTheWords);\n}\n", "import { BaseInteraction } from \"../../core/BaseInteraction\";\nimport { Variant } from \"../../shared/types\";\nimport { InteractionConfig, InteractionMechanic } from \"../../types/Interactions\";\nimport { GradingResult } from \"../../types/Grading\";\nimport { TextEngineClassificationData, TextEngineConfiguration, TextEngineSequentialInteractionData } from \"../../types/Text\";\n\nimport {\n\tEduText,\n\ttextEngineClassificationGrader,\n\tgetClassificationGradingState,\n\ttype TextEngineClassificationUserData,\n\ttype TextEngineClassificationGradingState\n} from \"../../engines/text\";\n\nexport class SequentialCategorizeTheWords extends BaseInteraction<TextEngineSequentialInteractionData> {\n\n\tinteractionMechanic: InteractionMechanic = \"sequential\";\n\n\tprivate _slides: TextEngineClassificationData[] = [];\n\tprivate _currentStep = 0;\n\n\tprivate _textConfig!: TextEngineConfiguration;\n\tprivate _$text!: EduText;\n\n\tprivate _responses: Record<number, TextEngineClassificationUserData> = {};\n\tprivate _gradingByStep: Record<number, TextEngineClassificationGradingState> = {};\n\tprivate _isGraded = false;\n\n\tpublic get slidesCount(): number {\n\t\treturn this._slides.length;\n\t}\n\n\tconstructor(data: TextEngineSequentialInteractionData, config: InteractionConfig) {\n\t\tsuper(data, config);\n\n\t\tthis._slides = (Array.isArray(data) ? data : []).filter(\n\t\t\t(slide): slide is TextEngineClassificationData => slide.type === \"classification\"\n\t\t);\n\n\t\tif (this._slides.length === 0) {\n\t\t\tthis.isValid = false;\n\t\t\tthis.errors = \"SequentialCategorizeTheWords requires at least one classification slide.\";\n\t\t\treturn;\n\t\t}\n\n\t\tthis._textConfig = {\n\t\t\tdata: this._slides[0],\n\t\t\tmode: \"classification\",\n\t\t\tvariant: config.variant ?? \"outline\"\n\t\t};\n\n\t\tthis.initializeProgress(this.getTotalTargetCount());\n\t}\n\n\tprotected initialize(): void {}\n\tprotected cleanup(): void {}\n\n\tonVariantChange(newVariant: Variant): void {\n\t\tthis.config.variant = newVariant;\n\t\tthis._textConfig.variant = newVariant;\n\t\tif (this._$text) {\n\t\t\tthis._$text.setAttribute(\"variant\", newVariant);\n\t\t}\n\t}\n\n\tpublic setSteps(stepIndex: number): void {\n\t\tthis.saveCurrentStepResponse();\n\n\t\tconst nextStep = Math.max(0, Math.min(this._slides.length - 1, stepIndex - 1));\n\t\tif (nextStep === this._currentStep) return;\n\n\t\tthis._currentStep = nextStep;\n\t\tthis.render();\n\t}\n\n\trender(): void {\n\t\tif (this._slides.length === 0) return;\n\n\t\tthis._textConfig = {\n\t\t\tdata: this._slides[this._currentStep],\n\t\t\tmode: \"classification\",\n\t\t\tvariant: this.config.variant\n\t\t};\n\n\t\tthis._$text = document.createElement(\"edu-text\") as EduText;\n\t\tthis._$text.config = this._textConfig;\n\n\t\tconst stepState = this._responses[this._currentStep];\n\t\tif (stepState?.wordCategories) {\n\t\t\tthis._$text.setState({ wordCategories: stepState.wordCategories });\n\t\t}\n\n\t\tconst stepGrading = this._gradingByStep[this._currentStep];\n\t\tif (this._isGraded && stepGrading) {\n\t\t\tthis._$text.setGradingState(stepGrading);\n\t\t}\n\n\t\tthis._$text.addEventListener(\"change\", () => {\n\t\t\tthis.saveCurrentStepResponse();\n\t\t\tthis.updateProgressAcrossSteps();\n\t\t\tif (this._isGraded) {\n\t\t\t\tdelete this._gradingByStep[this._currentStep];\n\t\t\t\tthis._$text.clearGradingState();\n\t\t\t}\n\t\t\tthis.emitStateChange();\n\t\t});\n\n\t\tthis.innerHTML = `\n\t\t\t<style>\n\t\t\t\tsequential-categorize-the-words {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t}\n\n\t\t\t\t.text-container {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\tflex-direction: column;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\toverflow: hidden;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t}\n\n\t\t\t\t.text-wrapper {\n\t\t\t\t\tflex: 1;\n\t\t\t\t\toverflow-y: auto;\n\t\t\t\t\toverflow-x: auto;\n\t\t\t\t\tmin-height: 0;\n\t\t\t\t\tpadding: 1rem;\n\t\t\t\t}\n\t\t\t</style>\n\t\t\t<div class=\"text-container\">\n\t\t\t\t<div class=\"text-wrapper\"></div>\n\t\t\t</div>\n\t\t`;\n\n\t\tconst wrapper = this.querySelector(\".text-wrapper\") as HTMLDivElement;\n\t\twrapper.appendChild(this._$text);\n\t}\n\n\tprivate getTargetIndices(slide: TextEngineClassificationData): Set<number> {\n\t\tconst indices = new Set<number>();\n\t\tfor (const category of slide.targets) {\n\t\t\tfor (const target of category.targets) {\n\t\t\t\tfor (let i = target.startPos; i <= target.endPos; i++) {\n\t\t\t\t\tindices.add(i);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn indices;\n\t}\n\n\tprivate getTotalTargetCount(): number {\n\t\treturn this._slides.reduce((sum, slide) => sum + this.getTargetIndices(slide).size, 0);\n\t}\n\n\tprivate saveCurrentStepResponse(): void {\n\t\tif (!this._$text) return;\n\t\tthis._responses[this._currentStep] = this._$text.getValue();\n\t}\n\n\tprivate getResponseForStep(step: number): TextEngineClassificationUserData {\n\t\treturn this._responses[step] ?? { wordCategories: {} };\n\t}\n\n\tprivate updateProgressAcrossSteps(): void {\n\t\tlet answered = 0;\n\n\t\tfor (let i = 0; i < this._slides.length; i++) {\n\t\t\tconst slide = this._slides[i];\n\t\t\tconst response = this.getResponseForStep(i);\n\t\t\tconst targetIndices = this.getTargetIndices(slide);\n\n\t\t\tfor (const idx of targetIndices) {\n\t\t\t\tif (response.wordCategories[idx]) answered++;\n\t\t\t}\n\t\t}\n\n\t\tthis.setProgress(answered);\n\t}\n\n\tgetCurrentState(): any {\n\t\tthis.saveCurrentStepResponse();\n\t\treturn {\n\t\t\tstep: this._currentStep,\n\t\t\tresponses: this._responses\n\t\t};\n\t}\n\n\tisInteractionComplete(): boolean {\n\t\treturn this.getProgress().current === this.getProgress().total;\n\t}\n\n\tonHint(): void {\n\t\tthis.saveCurrentStepResponse();\n\n\t\tconst slide = this._slides[this._currentStep];\n\t\tconst response = this.getResponseForStep(this._currentStep);\n\t\tconst targetIndices = this.getTargetIndices(slide);\n\n\t\tfor (const idx of targetIndices) {\n\t\t\tif (!response.wordCategories[idx]) {\n\t\t\t\tthis.emitHintShown(`Try categorizing \"${slide.parts[idx]}\"`);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tthis.emitHintShown(\"This step is complete. Move to another step or submit.\");\n\t}\n\n\tgrade(): GradingResult {\n\t\tthis.saveCurrentStepResponse();\n\n\t\tlet correct = 0;\n\t\tlet total = 0;\n\t\tconst gradingByStep: Record<number, TextEngineClassificationGradingState> = {};\n\n\t\tfor (let i = 0; i < this._slides.length; i++) {\n\t\t\tconst slide = this._slides[i];\n\t\t\tconst response = this.getResponseForStep(i);\n\t\t\tconst result = textEngineClassificationGrader(slide, response);\n\n\t\t\tcorrect += result.correct;\n\t\t\ttotal += result.total;\n\t\t\tgradingByStep[i] = getClassificationGradingState(slide, response);\n\t\t}\n\n\t\tthis._gradingByStep = gradingByStep;\n\t\tthis._isGraded = true;\n\n\t\tconst currentGrading = this._gradingByStep[this._currentStep];\n\t\tif (currentGrading) {\n\t\t\tthis._$text.setGradingState(currentGrading);\n\t\t}\n\n\t\tconst score = total > 0 ? Math.round((correct / total) * 100) : 0;\n\t\treturn { score, correct, total };\n\t}\n\n\tpublic submit(): void {\n\t\tsuper.submit();\n\t\tconst result = this.grade();\n\t\tthis.dispatchEvent(new CustomEvent(\"interaction:graded\", {\n\t\t\tdetail: { result },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\t}\n\n\tpublic reset(): void {\n\t\tsuper.reset();\n\t\tthis._responses = {};\n\t\tthis._gradingByStep = {};\n\t\tthis._isGraded = false;\n\t\tthis._currentStep = 0;\n\t\tif (this._$text) {\n\t\t\tthis._$text.reset();\n\t\t\tthis._$text.clearGradingState();\n\t\t}\n\t\tthis.setProgress(0);\n\t\tthis.render();\n\t}\n}\n\nif (!customElements.get(\"sequential-categorize-the-words\")) {\n\tcustomElements.define(\"sequential-categorize-the-words\", SequentialCategorizeTheWords);\n}\n", "import { BaseInteraction } from \"../../core/BaseInteraction\";\nimport { Variant } from \"../../shared/types\";\nimport { InteractionConfig, InteractionMechanic } from \"../../types/Interactions\";\nimport { TextEngineBaseData, TextEngineConfiguration } from \"../../types/Text\";\n\nimport {\n\tEduText,\n\ttextEngineTransformationGrader,\n\ttype TextEngineBaseUserData\n} from \"../../engines/text\";\n\n/**\n * Text Transformation Interaction\n *\n * Users edit highlighted text segments to transform them according to instructions.\n * For example: convert present tense to past tense, singular to plural, etc.\n *\n * Example data:\n * ```\n * {\n * type: 'base',\n * parts: ['I', 'drink', 'water', 'every', 'day'],\n * targets: [\n * { words: ['drink'], startPos: 1, endPos: 1 }\n * ]\n * }\n * ```\n *\n * Expected transformations would be provided separately in config or instructions.\n */\nexport class TextTransformation extends BaseInteraction<TextEngineBaseData> {\n\n\tinteractionMechanic: InteractionMechanic = \"static\";\n\n\tprivate _textConfig: TextEngineConfiguration;\n\tprivate _$text!: EduText;\n\tprivate _expectedTransformations: Record<number, string[]>;\n\n\tconstructor(\n\t\tdata: TextEngineBaseData,\n\t\tconfig: InteractionConfig,\n\t\texpectedTransformations?: Record<number, string[]>\n\t) {\n\t\tsuper(data, config);\n\n\t\t// Store expected transformations\n\t\t// If not provided, use targets words as is (for testing/demo)\n\t\tthis._expectedTransformations = expectedTransformations ?? {};\n\n\t\t// If no expected transformations provided, create default ones\n\t\tif (Object.keys(this._expectedTransformations).length === 0) {\n\t\t\tdata.targets.forEach((target, index) => {\n\t\t\t\t// Default: expect the same words (no transformation required)\n\t\t\t\t// In real usage, this would be provided by the author\n\t\t\t\tthis._expectedTransformations[index] = target.words;\n\t\t\t});\n\t\t}\n\n\t\t// Configure text engine for transformation mode\n\t\tthis._textConfig = {\n\t\t\tdata: data,\n\t\t\tmode: 'transformation',\n\t\t\tvariant: config.variant ?? 'outline'\n\t\t};\n\t\t\n\t\tthis.implementsProgress = false;\n\t}\n\n\t// ==================== LIFECYCLE ====================\n\n\tprotected initialize(): void {}\n\tprotected cleanup(): void {}\n\n\tonVariantChange(newVariant: Variant): void {\n\t\tthis.config.variant = newVariant;\n\t\tthis._textConfig.variant = newVariant;\n\t\tif (this._$text) {\n\t\t\tthis._$text.setAttribute('variant', newVariant);\n\t\t}\n\t}\n\n\t// ==================== RENDERING ====================\n\n\trender(): void {\n\t\t// Update text config variant to match current\n\t\tthis._textConfig.variant = this.config.variant;\n\n\t\t// Create text element\n\t\tthis._$text = document.createElement('edu-text') as EduText;\n\t\tthis._$text.config = this._textConfig;\n\n\t\t// Listen to text changes\n\t\tthis._$text.addEventListener('change', () => {\n\t\t\tthis.emitStateChange();\n\t\t});\n\n\t\t// Render with wrapper for proper height/overflow handling\n\t\tthis.innerHTML = `\n\t\t\t<style>\n\t\t\t\tedu-text {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t}\n\n\t\t\t\t.text-container {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\tflex-direction: column;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\toverflow: hidden;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t}\n\n\t\t\t\t.text-wrapper {\n\t\t\t\t\tflex: 1;\n\t\t\t\t\toverflow-y: auto;\n\t\t\t\t\toverflow-x: auto;\n\t\t\t\t\tmin-height: 0;\n\t\t\t\t\tpadding: 1rem;\n\t\t\t\t}\n\t\t\t</style>\n\t\t\t<div class=\"text-container\">\n\t\t\t\t<div class=\"text-wrapper\"></div>\n\t\t\t</div>\n\t\t`;\n\n\t\tconst wrapper = this.querySelector('.text-wrapper') as HTMLDivElement;\n\t\twrapper.appendChild(this._$text);\n\t}\n\n\t// ==================== REQUIRED ABSTRACT METHODS ====================\n\n\tgetCurrentState(): TextEngineBaseUserData {\n\t\tif (!this._$text) return { transformations: {} };\n\t\treturn this._$text.getValue();\n\t}\n\n\tisInteractionComplete(): boolean {\n\t\tconst userData = this.getCurrentState();\n\t\tconst transformations = userData.transformations ?? {};\n\n\t\tfor (let i = 0; i < this.data.targets.length; i++) {\n\t\t\tconst transformed = transformations[i];\n\t\t\tif (!transformed || transformed.length === 0) return false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tonHint(): void {\n\t\t// Find first non-edited target and show hint\n\t\tconst userData = this.getCurrentState();\n\t\tconst transformations = userData.transformations ?? {};\n\n\t\tfor (let i = 0; i < this.data.targets.length; i++) {\n\t\t\tif (!transformations[i] || transformations[i].length === 0) {\n\t\t\t\tconst target = this.data.targets[i];\n\t\t\t\tconst originalWords = target.words.join(' ');\n\t\t\t\tconst expectedWords = this._expectedTransformations[i]?.join(' ') || originalWords;\n\t\t\t\tthis.emitHintShown(`Transform \"${originalWords}\" to \"${expectedWords}\"`);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tthis.emitHintShown('All transformations have been attempted!');\n\t}\n\n\t// ==================== STATE & GRADING ====================\n\n\tgetUserData(): TextEngineBaseUserData {\n\t\treturn this.getCurrentState();\n\t}\n\n\tpublic submit(): void {\n\t\tsuper.submit();\n\t\tconst result = this.grade();\n\t\tthis.dispatchEvent(new CustomEvent('interaction:graded', {\n\t\t\tdetail: { result },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\t}\n\n\tgrade() {\n\t\tconst userData = this.getUserData();\n\t\tconst result = textEngineTransformationGrader(\n\t\t\tthis.data,\n\t\t\tuserData,\n\t\t\tthis._expectedTransformations\n\t\t);\n\n\t\t// Generate grading state for visual feedback\n\t\tconst gradingState: Record<number, any> = {};\n\n\t\tfor (let i = 0; i < this.data.targets.length; i++) {\n\t\t\tconst expected = this._expectedTransformations[i];\n\t\t\tconst actual = userData.transformations?.[i];\n\n\t\t\tif (!actual) {\n\t\t\t\tgradingState[i] = 'missed';\n\t\t\t} else if (expected && expected.length === actual.length) {\n\t\t\t\tconst matches = expected.every((word, j) =>\n\t\t\t\t\tword.toLowerCase().trim() === (actual[j] || '').toLowerCase().trim()\n\t\t\t\t);\n\t\t\t\tgradingState[i] = matches ? 'correct' : 'wrong';\n\t\t\t} else {\n\t\t\t\tgradingState[i] = 'wrong';\n\t\t\t}\n\t\t}\n\n\t\t// Apply grading visualization\n\t\tif (this._$text) {\n\t\t\tthis._$text.setGradingState(gradingState);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\treset() {\n\t\tsuper.reset();\n\t\tif (this._$text) {\n\t\t\tthis._$text.reset();\n\t\t\tthis._$text.clearGradingState();\n\t\t}\n\t}\n\n\t/**\n\t * Set the expected transformations after construction\n\t * Useful for dynamic configuration\n\t */\n\tsetExpectedTransformations(transformations: Record<number, string[]>) {\n\t\tthis._expectedTransformations = transformations;\n\t}\n}\n\nif (!customElements.get('text-transformation')) {\n\tcustomElements.define('text-transformation', TextTransformation);\n}\n", "import { BaseInteraction } from \"../../core/BaseInteraction\";\nimport { Variant } from \"../../shared/types\";\nimport { InteractionConfig, InteractionMechanic } from \"../../types/Interactions\";\nimport { GradingResult } from \"../../types/Grading\";\nimport { TextEngineBaseData, TextEngineConfiguration, TextEngineSequentialInteractionData } from \"../../types/Text\";\n\nimport {\n\tEduText,\n\ttextEngineTransformationGrader,\n\tgetTransformationGradingState,\n\ttype TextEngineBaseUserData,\n\ttype TextEngineBaseGradingState\n} from \"../../engines/text\";\n\nexport type SequentialTransformationExpectations = Record<number, Record<number, string[]>>;\n\nexport class SequentialTextTransformation extends BaseInteraction<TextEngineSequentialInteractionData> {\n\n\tinteractionMechanic: InteractionMechanic = \"sequential\";\n\n\tprivate _slides: TextEngineBaseData[] = [];\n\tprivate _currentStep = 0;\n\n\tprivate _textConfig!: TextEngineConfiguration;\n\tprivate _$text!: EduText;\n\n\tprivate _responses: Record<number, TextEngineBaseUserData> = {};\n\tprivate _gradingByStep: Record<number, TextEngineBaseGradingState> = {};\n\tprivate _isGraded = false;\n\n\tprivate _expectedByStep: SequentialTransformationExpectations = {};\n\n\tpublic get slidesCount(): number {\n\t\treturn this._slides.length;\n\t}\n\n\tconstructor(\n\t\tdata: TextEngineSequentialInteractionData,\n\t\tconfig: InteractionConfig,\n\t\texpectedByStep?: SequentialTransformationExpectations\n\t) {\n\t\tsuper(data, config);\n\n\t\tthis._slides = (Array.isArray(data) ? data : []).filter(\n\t\t\t(slide): slide is TextEngineBaseData => slide.type === \"base\"\n\t\t);\n\n\t\tif (this._slides.length === 0) {\n\t\t\tthis.isValid = false;\n\t\t\tthis.errors = \"SequentialTextTransformation requires at least one base slide.\";\n\t\t\treturn;\n\t\t}\n\n\t\tthis._textConfig = {\n\t\t\tdata: this._slides[0],\n\t\t\tmode: \"transformation\",\n\t\t\tvariant: config.variant ?? \"outline\"\n\t\t};\n\n\t\tthis._expectedByStep = expectedByStep ?? this.buildDefaultExpectations();\n\t\tthis.initializeProgress(this.getTotalTargetCount());\n\t}\n\n\tprotected initialize(): void {}\n\tprotected cleanup(): void {}\n\n\tonVariantChange(newVariant: Variant): void {\n\t\tthis.config.variant = newVariant;\n\t\tthis._textConfig.variant = newVariant;\n\t\tif (this._$text) {\n\t\t\tthis._$text.setAttribute(\"variant\", newVariant);\n\t\t}\n\t}\n\n\tpublic setSteps(stepIndex: number): void {\n\t\tthis.saveCurrentStepResponse();\n\n\t\tconst nextStep = Math.max(0, Math.min(this._slides.length - 1, stepIndex - 1));\n\t\tif (nextStep === this._currentStep) return;\n\n\t\tthis._currentStep = nextStep;\n\t\tthis.render();\n\t}\n\n\trender(): void {\n\t\tif (this._slides.length === 0) return;\n\n\t\tthis._textConfig = {\n\t\t\tdata: this._slides[this._currentStep],\n\t\t\tmode: \"transformation\",\n\t\t\tvariant: this.config.variant\n\t\t};\n\n\t\tthis._$text = document.createElement(\"edu-text\") as EduText;\n\t\tthis._$text.config = this._textConfig;\n\n\t\tconst stepState = this._responses[this._currentStep];\n\t\tif (stepState?.transformations) {\n\t\t\tthis._$text.setState({ transformations: stepState.transformations });\n\t\t}\n\n\t\tconst stepGrading = this._gradingByStep[this._currentStep];\n\t\tif (this._isGraded && stepGrading) {\n\t\t\tthis._$text.setGradingState(stepGrading);\n\t\t}\n\n\t\tthis._$text.addEventListener(\"change\", () => {\n\t\t\tthis.saveCurrentStepResponse();\n\t\t\tthis.updateProgressAcrossSteps();\n\t\t\tif (this._isGraded) {\n\t\t\t\tdelete this._gradingByStep[this._currentStep];\n\t\t\t\tthis._$text.clearGradingState();\n\t\t\t}\n\t\t\tthis.emitStateChange();\n\t\t});\n\n\t\tthis.innerHTML = `\n\t\t\t<style>\n\t\t\t\tsequential-text-transformation {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t}\n\n\t\t\t\t.text-container {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\tflex-direction: column;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\toverflow: hidden;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t}\n\n\t\t\t\t.text-wrapper {\n\t\t\t\t\tflex: 1;\n\t\t\t\t\toverflow-y: auto;\n\t\t\t\t\toverflow-x: auto;\n\t\t\t\t\tmin-height: 0;\n\t\t\t\t\tpadding: 1rem;\n\t\t\t\t}\n\t\t\t</style>\n\t\t\t<div class=\"text-container\">\n\t\t\t\t<div class=\"text-wrapper\"></div>\n\t\t\t</div>\n\t\t`;\n\n\t\tconst wrapper = this.querySelector(\".text-wrapper\") as HTMLDivElement;\n\t\twrapper.appendChild(this._$text);\n\t}\n\n\tprivate getTotalTargetCount(): number {\n\t\treturn this._slides.reduce((sum, slide) => sum + slide.targets.length, 0);\n\t}\n\n\tprivate buildDefaultExpectations(): SequentialTransformationExpectations {\n\t\tconst out: SequentialTransformationExpectations = {};\n\n\t\tfor (let step = 0; step < this._slides.length; step++) {\n\t\t\tconst slide = this._slides[step];\n\t\t\tout[step] = {};\n\n\t\t\tfor (let i = 0; i < slide.targets.length; i++) {\n\t\t\t\tout[step][i] = slide.targets[i].words;\n\t\t\t}\n\t\t}\n\n\t\treturn out;\n\t}\n\n\tprivate getExpectedForStep(step: number): Record<number, string[]> {\n\t\treturn this._expectedByStep[step] ?? {};\n\t}\n\n\tprivate saveCurrentStepResponse(): void {\n\t\tif (!this._$text) return;\n\t\tthis._responses[this._currentStep] = this._$text.getValue();\n\t}\n\n\tprivate getResponseForStep(step: number): TextEngineBaseUserData {\n\t\treturn this._responses[step] ?? { transformations: {} };\n\t}\n\n\tprivate updateProgressAcrossSteps(): void {\n\t\tlet answered = 0;\n\n\t\tfor (let i = 0; i < this._slides.length; i++) {\n\t\t\tconst slide = this._slides[i];\n\t\t\tconst response = this.getResponseForStep(i);\n\t\t\tconst transformations = response.transformations ?? {};\n\n\t\t\tanswered += slide.targets.filter((_target, idx) => {\n\t\t\t\tconst transformed = transformations[idx];\n\t\t\t\treturn Array.isArray(transformed) && transformed.length > 0;\n\t\t\t}).length;\n\t\t}\n\n\t\tthis.setProgress(answered);\n\t}\n\n\tgetCurrentState(): any {\n\t\tthis.saveCurrentStepResponse();\n\t\treturn {\n\t\t\tstep: this._currentStep,\n\t\t\tresponses: this._responses\n\t\t};\n\t}\n\n\tisInteractionComplete(): boolean {\n\t\treturn this.getProgress().current === this.getProgress().total;\n\t}\n\n\tonHint(): void {\n\t\tthis.saveCurrentStepResponse();\n\n\t\tconst slide = this._slides[this._currentStep];\n\t\tconst response = this.getResponseForStep(this._currentStep);\n\t\tconst transformations = response.transformations ?? {};\n\t\tconst expected = this.getExpectedForStep(this._currentStep);\n\n\t\tfor (let i = 0; i < slide.targets.length; i++) {\n\t\t\tif (!transformations[i] || transformations[i].length === 0) {\n\t\t\t\tconst originalWords = slide.targets[i].words.join(\" \");\n\t\t\t\tconst expectedWords = expected[i]?.join(\" \") || originalWords;\n\t\t\t\tthis.emitHintShown(`Transform \"${originalWords}\" to \"${expectedWords}\"`);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tthis.emitHintShown(\"This step is complete. Move to another step or submit.\");\n\t}\n\n\tgrade(): GradingResult {\n\t\tthis.saveCurrentStepResponse();\n\n\t\tlet correct = 0;\n\t\tlet total = 0;\n\t\tconst gradingByStep: Record<number, TextEngineBaseGradingState> = {};\n\n\t\tfor (let i = 0; i < this._slides.length; i++) {\n\t\t\tconst slide = this._slides[i];\n\t\t\tconst response = this.getResponseForStep(i);\n\t\t\tconst expected = this.getExpectedForStep(i);\n\n\t\t\tconst result = textEngineTransformationGrader(slide, response, expected);\n\t\t\tcorrect += result.correct;\n\t\t\ttotal += result.total;\n\n\t\t\tgradingByStep[i] = getTransformationGradingState(slide, response, expected);\n\t\t}\n\n\t\tthis._gradingByStep = gradingByStep;\n\t\tthis._isGraded = true;\n\n\t\tconst currentGrading = this._gradingByStep[this._currentStep];\n\t\tif (currentGrading) {\n\t\t\tthis._$text.setGradingState(currentGrading);\n\t\t}\n\n\t\tconst score = total > 0 ? Math.round((correct / total) * 100) : 0;\n\t\treturn { score, correct, total };\n\t}\n\n\tpublic submit(): void {\n\t\tsuper.submit();\n\t\tconst result = this.grade();\n\t\tthis.dispatchEvent(new CustomEvent(\"interaction:graded\", {\n\t\t\tdetail: { result },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\t}\n\n\tpublic reset(): void {\n\t\tsuper.reset();\n\t\tthis._responses = {};\n\t\tthis._gradingByStep = {};\n\t\tthis._isGraded = false;\n\t\tthis._currentStep = 0;\n\t\tif (this._$text) {\n\t\t\tthis._$text.reset();\n\t\t\tthis._$text.clearGradingState();\n\t\t}\n\t\tthis.setProgress(0);\n\t\tthis.render();\n\t}\n\n\tsetExpectedTransformationsByStep(expectedByStep: SequentialTransformationExpectations): void {\n\t\tthis._expectedByStep = expectedByStep;\n\t}\n}\n\nif (!customElements.get(\"sequential-text-transformation\")) {\n\tcustomElements.define(\"sequential-text-transformation\", SequentialTextTransformation);\n}\n", "import { BaseInteraction } from \"../../core/BaseInteraction\";\nimport { Variant } from \"../../shared/types\";\nimport { InteractionConfig, InteractionMechanic } from \"../../types/Interactions\";\n\nimport {\n\tTextEngineBlanksData,\n\tTextEngineBlanksDataTarget\n} from \"../../types/Text\";\n\nimport {\n\tEduText,\n\ttextEngineBlanksGrader,\n\tgetBlanksGradingState,\n\ttype TextEngineBlanksUserData\n} from \"../../engines/text\";\n\nexport class FillBlanks extends BaseInteraction<TextEngineBlanksData> {\n\n\tinteractionMechanic: InteractionMechanic = \"static\";\n\n\tprivate _textConfig: { data: TextEngineBlanksData; mode: \"blanks\"; variant: Variant; };\n\tprivate _$text!: EduText;\n\n\tconstructor(data: TextEngineBlanksData, config: InteractionConfig) {\n\t\tsuper(data, config);\n\n\t\tthis._textConfig = {\n\t\t\tdata,\n\t\t\tmode: \"blanks\",\n\t\t\tvariant: config.variant ?? \"outline\"\n\t\t};\n\n\t\tthis.initializeProgress(data.targets.length);\n\t}\n\n\tprotected initialize(): void {}\n\tprotected cleanup(): void {}\n\n\tonVariantChange(newVariant: Variant): void {\n\t\tthis.config.variant = newVariant;\n\t\tthis._textConfig.variant = newVariant;\n\t\tif (this._$text) {\n\t\t\tthis._$text.setAttribute(\"variant\", newVariant);\n\t\t}\n\n\t}\n\n\trender(): void {\n\t\tthis._textConfig.variant = this.config.variant;\n\n\t\tthis._$text = document.createElement(\"edu-text\") as EduText;\n\t\tthis._$text.config = this._textConfig;\n\t\tthis._$text.addEventListener(\"change\", () => {\n\t\t\tthis.updateProgressBasedOnInputs();\n\t\t\tthis.emitStateChange();\n\t\t});\n\n\t\tthis.innerHTML = `\n\t\t\t<style>\n\t\t\t\tfill-blanks {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t}\n\n\t\t\t\t.text-container {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\tflex-direction: column;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\toverflow: hidden;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t}\n\n\t\t\t\t.text-wrapper {\n\t\t\t\t\tflex: 1;\n\t\t\t\t\toverflow-y: auto;\n\t\t\t\t\toverflow-x: auto;\n\t\t\t\t\tmin-height: 0;\n\t\t\t\t\tpadding: 1rem;\n\t\t\t\t}\n\t\t\t</style>\n\t\t\t<div class=\"text-container\">\n\t\t\t\t<div class=\"text-wrapper\"></div>\n\t\t\t</div>\n\t\t`;\n\n\t\tconst wrapper = this.querySelector(\".text-wrapper\") as HTMLDivElement;\n\t\twrapper.appendChild(this._$text);\n\t}\n\n\tgetCurrentState(): TextEngineBlanksUserData {\n\t\tif (!this._$text) return { inputValues: {} };\n\t\treturn this._$text.getValue();\n\t}\n\n\tprivate updateProgressBasedOnInputs(): void {\n\t\tconst userData = this.getCurrentState();\n\t\tconst values = userData.inputValues ?? {};\n\t\tconst answered = this.data.targets.filter((target) => {\n\t\t\tconst value = values[target.id];\n\t\t\treturn value !== undefined && value !== null && String(value).trim() !== \"\";\n\t\t}).length;\n\t\tthis.setProgress(answered);\n\t}\n\n\tisInteractionComplete(): boolean {\n\t\treturn this.getProgress().current === this.getProgress().total;\n\t}\n\n\tonHint(): void {\n\t\tconst userData = this.getCurrentState();\n\t\tconst values = userData.inputValues ?? {};\n\t\tconst firstMissed = this.data.targets.find((target) => {\n\t\t\tconst value = values[target.id];\n\t\t\treturn value === undefined || value === null || String(value).trim() === \"\";\n\t\t});\n\n\t\tif (!firstMissed) {\n\t\t\tthis.emitHintShown(\"All blanks are filled. Submit to check answers.\");\n\t\t\treturn;\n\t\t}\n\n\t\tthis.emitHintShown(this.getHintText(firstMissed));\n\t}\n\n\tprivate getHintText(target: TextEngineBlanksDataTarget): string {\n\t\tswitch (target.expectedValue.type) {\n\t\t\tcase \"text\":\n\t\t\t\treturn \"Fill the missing text blank.\";\n\t\t\tcase \"number\":\n\t\t\t\treturn \"Fill the numeric blank.\";\n\t\t\tcase \"select\":\n\t\t\t\treturn \"Choose the right option in the select blank.\";\n\t\t\tcase \"date\":\n\t\t\t\treturn \"Fill the date blank in the expected format.\";\n\t\t\tcase \"time\":\n\t\t\t\treturn \"Fill the time blank in the expected format.\";\n\t\t\tdefault:\n\t\t\t\treturn \"Complete the next blank.\";\n\t\t}\n\t}\n\n\tgrade() {\n\t\tconst userData = this.getCurrentState();\n\t\tconst result = textEngineBlanksGrader(this.data, userData);\n\t\tconst gradingState = getBlanksGradingState(this.data, userData);\n\n\t\tif (this._$text) {\n\t\t\tthis._$text.setGradingState(gradingState);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tpublic submit(): void {\n\t\tsuper.submit();\n\t\tconst result = this.grade();\n\t\tthis.dispatchEvent(new CustomEvent(\"interaction:graded\", {\n\t\t\tdetail: { result },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\t}\n\n\tpublic reset(): void {\n\t\tsuper.reset();\n\t\tif (this._$text) {\n\t\t\tthis._$text.reset();\n\t\t\tthis._$text.clearGradingState();\n\t\t}\n\t}\n}\n\nif (!customElements.get(\"fill-blanks\")) {\n\tcustomElements.define(\"fill-blanks\", FillBlanks);\n}\n", "import { BaseInteraction } from \"../../core/BaseInteraction\";\nimport { Variant } from \"../../shared/types\";\nimport { InteractionConfig, InteractionMechanic } from \"../../types/Interactions\";\n\nimport {\n\tTextEngineBlanksData,\n\tTextEngineSequentialInteractionData\n} from \"../../types/Text\";\n\nimport {\n\tEduText,\n\ttextEngineBlanksGrader,\n\tgetBlanksGradingState,\n\ttype TextEngineBlanksUserData,\n\ttype TextEngineBlanksGradingState\n} from \"../../engines/text\";\n\nimport { GradingResult } from \"../../types/Grading\";\n\nexport class SequentialFillBlanks extends BaseInteraction<TextEngineSequentialInteractionData> {\n\n\tinteractionMechanic: InteractionMechanic = \"sequential\";\n\n\tprivate _slides: TextEngineBlanksData[] = [];\n\tprivate _currentStep = 0;\n\n\tprivate _textConfig!: { data: TextEngineBlanksData; mode: \"blanks\"; variant: Variant; };\n\tprivate _$text!: EduText;\n\n\tprivate _responses: Record<number, TextEngineBlanksUserData> = {};\n\tprivate _gradingByStep: Record<number, TextEngineBlanksGradingState> = {};\n\tprivate _isGraded = false;\n\n\tpublic get slidesCount(): number {\n\t\treturn this._slides.length;\n\t}\n\n\tconstructor(data: TextEngineSequentialInteractionData, config: InteractionConfig) {\n\t\tsuper(data, config);\n\n\t\tthis._slides = (Array.isArray(data) ? data : []).filter(\n\t\t\t(slide): slide is TextEngineBlanksData => slide.type === \"blanks\"\n\t\t);\n\n\t\tif (this._slides.length === 0) {\n\t\t\tthis.isValid = false;\n\t\t\tthis.errors = \"SequentialFillBlanks requires at least one blanks slide.\";\n\t\t\treturn;\n\t\t}\n\n\t\tthis._textConfig = {\n\t\t\tdata: this._slides[0],\n\t\t\tmode: \"blanks\",\n\t\t\tvariant: config.variant ?? \"outline\"\n\t\t};\n\n\t\tthis.initializeProgress(this.getTotalTargetCount());\n\t}\n\n\tprotected initialize(): void {}\n\tprotected cleanup(): void {}\n\n\tonVariantChange(newVariant: Variant): void {\n\t\tthis.config.variant = newVariant;\n\t\tthis._textConfig.variant = newVariant;\n\t\tif (this._$text) {\n\t\t\tthis._$text.setAttribute(\"variant\", newVariant);\n\t\t}\n\t}\n\n\tpublic setSteps(stepIndex: number): void {\n\t\tthis.saveCurrentStepResponse();\n\n\t\tconst nextStep = Math.max(0, Math.min(this._slides.length - 1, stepIndex - 1));\n\t\tif (nextStep === this._currentStep) return;\n\n\t\tthis._currentStep = nextStep;\n\t\tthis.render();\n\t}\n\n\trender(): void {\n\t\tif (this._slides.length === 0) return;\n\n\t\tthis._textConfig = {\n\t\t\tdata: this._slides[this._currentStep],\n\t\t\tmode: \"blanks\",\n\t\t\tvariant: this.config.variant\n\t\t};\n\n\t\tthis._$text = document.createElement(\"edu-text\") as EduText;\n\t\tthis._$text.config = this._textConfig;\n\n\t\tconst stepState = this._responses[this._currentStep];\n\t\tif (stepState?.inputValues) {\n\t\t\tthis._$text.setState({ inputValues: stepState.inputValues });\n\t\t}\n\n\t\tconst stepGrading = this._gradingByStep[this._currentStep];\n\t\tif (this._isGraded && stepGrading) {\n\t\t\tthis._$text.setGradingState(stepGrading);\n\t\t}\n\n\t\tthis._$text.addEventListener(\"change\", () => {\n\t\t\tthis.saveCurrentStepResponse();\n\t\t\tthis.updateProgressAcrossSteps();\n\t\t\t// If user edits after grading, clear stale grading for this step.\n\t\t\tif (this._isGraded) {\n\t\t\t\tdelete this._gradingByStep[this._currentStep];\n\t\t\t\tthis._$text.clearGradingState();\n\t\t\t}\n\t\t\tthis.emitStateChange();\n\t\t});\n\n\t\tthis.innerHTML = `\n\t\t\t<style>\n\t\t\t\tsequential-fill-blanks {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t}\n\n\t\t\t\t.text-container {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\tflex-direction: column;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\toverflow: hidden;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t}\n\n\t\t\t\t.step-label {\n\t\t\t\t\tpadding: 0.5rem 1rem;\n\t\t\t\t\tborder-bottom: 1px solid rgb(var(--edu-border));\n\t\t\t\t\tcolor: rgb(var(--edu-second-ink));\n\t\t\t\t\tfont-size: 0.85rem;\n\t\t\t\t}\n\n\t\t\t\t.text-wrapper {\n\t\t\t\t\tflex: 1;\n\t\t\t\t\toverflow-y: auto;\n\t\t\t\t\toverflow-x: auto;\n\t\t\t\t\tmin-height: 0;\n\t\t\t\t\tpadding: 1rem;\n\t\t\t\t}\n\t\t\t</style>\n\t\t\t<div class=\"text-container\">\n\t\t\t\t<div class=\"text-wrapper\"></div>\n\t\t\t</div>\n\t\t`;\n\n\t\tconst wrapper = this.querySelector(\".text-wrapper\") as HTMLDivElement;\n\t\twrapper.appendChild(this._$text);\n\t}\n\n\tprivate getTotalTargetCount(): number {\n\t\treturn this._slides.reduce((sum, slide) => sum + slide.targets.length, 0);\n\t}\n\n\tprivate saveCurrentStepResponse() {\n\t\tif (!this._$text) return;\n\t\tthis._responses[this._currentStep] = this._$text.getValue();\n\t}\n\n\tprivate getResponseForStep(step: number): TextEngineBlanksUserData {\n\t\treturn this._responses[step] ?? { inputValues: {} };\n\t}\n\n\tprivate updateProgressAcrossSteps(): void {\n\t\tlet answered = 0;\n\n\t\tfor (let i = 0; i < this._slides.length; i++) {\n\t\t\tconst slide = this._slides[i];\n\t\t\tconst response = this.getResponseForStep(i);\n\t\t\tconst values = response.inputValues ?? {};\n\n\t\t\tanswered += slide.targets.filter((target) => {\n\t\t\t\tconst value = values[target.id];\n\t\t\t\treturn value !== undefined && value !== null && String(value).trim() !== \"\";\n\t\t\t}).length;\n\t\t}\n\n\t\tthis.setProgress(answered);\n\t}\n\n\tgetCurrentState(): any {\n\t\tthis.saveCurrentStepResponse();\n\t\treturn {\n\t\t\tstep: this._currentStep,\n\t\t\tresponses: this._responses\n\t\t};\n\t}\n\n\tisInteractionComplete(): boolean {\n\t\treturn this.getProgress().current === this.getProgress().total;\n\t}\n\n\tonHint(): void {\n\t\tthis.saveCurrentStepResponse();\n\n\t\tconst slide = this._slides[this._currentStep];\n\t\tconst response = this.getResponseForStep(this._currentStep);\n\t\tconst values = response.inputValues ?? {};\n\n\t\tconst firstMissed = slide.targets.find((target) => {\n\t\t\tconst value = values[target.id];\n\t\t\treturn value === undefined || value === null || String(value).trim() === \"\";\n\t\t});\n\n\t\tif (!firstMissed) {\n\t\t\tthis.emitHintShown(\"This step is complete. Move to another step or submit.\");\n\t\t\treturn;\n\t\t}\n\n\t\tthis.emitHintShown(`Complete the ${firstMissed.expectedValue.type} input on this step.`);\n\t}\n\n\tgrade(): GradingResult {\n\t\tthis.saveCurrentStepResponse();\n\n\t\tlet correct = 0;\n\t\tlet total = 0;\n\t\tconst gradingByStep: Record<number, TextEngineBlanksGradingState> = {};\n\n\t\tfor (let i = 0; i < this._slides.length; i++) {\n\t\t\tconst slide = this._slides[i];\n\t\t\tconst response = this.getResponseForStep(i);\n\t\t\tconst result = textEngineBlanksGrader(slide, response);\n\t\t\tcorrect += result.correct;\n\t\t\ttotal += result.total;\n\t\t\tgradingByStep[i] = getBlanksGradingState(slide, response);\n\t\t}\n\n\t\tthis._gradingByStep = gradingByStep;\n\t\tthis._isGraded = true;\n\t\tconst currentGrading = this._gradingByStep[this._currentStep];\n\t\tif (currentGrading) {\n\t\t\tthis._$text.setGradingState(currentGrading);\n\t\t}\n\n\t\tconst score = total > 0 ? Math.round((correct / total) * 100) : 0;\n\t\treturn { score, correct, total };\n\t}\n\n\tpublic submit(): void {\n\t\tsuper.submit();\n\t\tconst result = this.grade();\n\t\tthis.dispatchEvent(new CustomEvent(\"interaction:graded\", {\n\t\t\tdetail: { result },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\t}\n\n\tpublic reset(): void {\n\t\tsuper.reset();\n\t\tthis._responses = {};\n\t\tthis._gradingByStep = {};\n\t\tthis._isGraded = false;\n\t\tthis._currentStep = 0;\n\t\tif (this._$text) {\n\t\t\tthis._$text.reset();\n\t\t\tthis._$text.clearGradingState();\n\t\t}\n\t\tthis.setProgress(0);\n\t\tthis.render();\n\t}\n}\n\nif (!customElements.get(\"sequential-fill-blanks\")) {\n\tcustomElements.define(\"sequential-fill-blanks\", SequentialFillBlanks);\n}\n", "import { ValidationResult } from \"../../../shared\";\nimport { SeriationData } from \"../../../types/Data\";\n\nexport function seriationValidator(data: SeriationData): ValidationResult {\n\tconst errors: Record<string, string> = {};\n\n\tif (!data) {\n\t\terrors['data'] = 'Data is required';\n\t\treturn { ok: false, errors };\n\t}\n\n\tif (data.type !== 'seriation') {\n\t\terrors['type'] = 'Data type must be \"seriation\"';\n\t}\n\n\tif (!Array.isArray(data.items)) {\n\t\terrors['items'] = 'Items must be an array';\n\t\treturn { ok: false, errors };\n\t}\n\n\tif (data.items.length < 2) {\n\t\terrors['items'] = 'At least 2 items are required for seriation';\n\t}\n\n\tif (data.items.some(item => typeof item !== 'string' || item.trim() === '')) {\n\t\terrors['items'] = 'All items must be non-empty strings';\n\t}\n\n\tconst uniqueItems = new Set(data.items);\n\tif (uniqueItems.size !== data.items.length) {\n\t\terrors['items'] = 'All items must be unique (duplicates found)';\n\t}\n\n\tconst ok = Object.keys(errors).length === 0;\n\treturn { ok, errors: ok ? null : errors };\n}\n", "import { SeriationData } from \"../../../types/Data\";\nimport { GradingResult } from \"../../../types/Grading\";\nimport { EduChip } from \"../../../ui/misc/chip\";\n\n/**\n * Grades a seriation/sequencing interaction with partial credit\n *\n * Scoring approach:\n * - Correct position: 100% for that item\n * - Adjacent position (\u00B11): 50% for that item\n * - Further away: 0% for that item\n *\n * @param correctOrder - The correct sequence of items\n * @param userOrder - The user's submitted sequence\n * @param parent - Parent element containing chips (for visual feedback)\n */\nexport function seriationGrader(\n\tcorrectOrder: SeriationData[\"items\"],\n\tuserOrder: string[],\n\tparent: HTMLElement\n): GradingResult {\n\tlet totalScore = 0;\n\tlet correctCount = 0;\n\tconst totalItems = correctOrder.length;\n\n\tcorrectOrder.forEach((correctItem, correctIndex) => {\n\t\tconst userIndex = userOrder.indexOf(correctItem);\n\t\tconst chip = parent.querySelector(`[data-item=\"${correctItem}\"]`) as EduChip;\n\n\t\tif (userIndex === -1) {\n\t\t\t// Item not placed (shouldn't happen in complete interaction)\n\t\t\tif (chip) chip.chipState = \"wrong\";\n\t\t\treturn;\n\t\t}\n\n\t\tconst distance = Math.abs(userIndex - correctIndex);\n\n\t\tif (distance === 0) {\n\t\t\t// Perfect position\n\t\t\ttotalScore += 100;\n\t\t\tcorrectCount++;\n\t\t\tif (chip) chip.chipState = \"correct\";\n\t\t} else if (distance === 1) {\n\t\t\t// Adjacent position - partial credit\n\t\t\ttotalScore += 50;\n\t\t\tif (chip) chip.chipState = \"missed\";\n\t\t} else {\n\t\t\t// Wrong position\n\t\t\tif (chip) chip.chipState = \"wrong\";\n\t\t}\n\t});\n\n\tconst score = totalItems > 0 ? totalScore / totalItems : 0;\n\n\tconsole.log(`Seriation Score: ${score.toFixed(1)}% (${correctCount}/${totalItems} in correct position)`);\n\n\treturn {\n\t\tscore,\n\t\tcorrect: correctCount,\n\t\ttotal: totalItems,\n\t\tanswerKey: correctOrder,\n\t\tuserResponse: userOrder\n\t};\n}\n", "import { ParsingResult } from \"../../../shared\";\nimport { SeriationData } from \"../../../types/Data\";\n\n/**\n * Parses a simple DSL for seriation data\n *\n * Format: Items separated by pipes (|) or newlines\n *\n * Example 1 (pipe-separated):\n * ```\n * Egg | Caterpillar | Chrysalis | Butterfly\n * ```\n *\n * Example 2 (numbered):\n * ```\n * 1. American Revolution\n * 2. French Revolution\n * 3. Industrial Revolution\n * 4. World War I\n * ```\n *\n * Example 3 (with assets):\n * ```\n * @:step1 | @:step2 | @:step3 | Final Product\n * ```\n */\nexport function seriationParser(code: string): ParsingResult {\n\ttry {\n\t\tif (!code || typeof code !== 'string') {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\terrors: { 'input': 'Input must be a non-empty string' }\n\t\t\t};\n\t\t}\n\n\t\tconst trimmed = code.trim();\n\t\tif (trimmed.length === 0) {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\terrors: { 'input': 'Input cannot be empty' }\n\t\t\t};\n\t\t}\n\n\t\tlet items: string[] = [];\n\n\t\t// Check if pipe-separated format\n\t\tif (trimmed.includes('|')) {\n\t\t\titems = trimmed\n\t\t\t\t.split('|')\n\t\t\t\t.map(item => item.trim())\n\t\t\t\t.filter(item => item.length > 0);\n\t\t} else {\n\t\t\t// Newline-separated format (with optional numbering)\n\t\t\titems = trimmed\n\t\t\t\t.split('\\n')\n\t\t\t\t.map(line => {\n\t\t\t\t\t// Remove leading numbers like \"1.\", \"2)\", \"a.\", etc.\n\t\t\t\t\treturn line.replace(/^\\s*[\\d\\w]+[\\.\\)]\\s*/, '').trim();\n\t\t\t\t})\n\t\t\t\t.filter(item => item.length > 0);\n\t\t}\n\n\t\tif (items.length < 2) {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\terrors: { 'items': 'At least 2 items are required for seriation' }\n\t\t\t};\n\t\t}\n\n\t\tconst result: SeriationData = {\n\t\t\ttype: 'seriation',\n\t\t\titems\n\t\t};\n\n\t\treturn { ok: true, data: result };\n\n\t} catch (err) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\terrors: { 'Parse Error': `${err instanceof Error ? err.message : String(err)}` }\n\t\t};\n\t}\n}\n", "import { BaseInteraction } from \"../../core/BaseInteraction\";\nimport { Variant } from \"../../shared/types\";\nimport { InteractionConfig, InteractionMechanic } from \"../../types/Interactions\";\nimport { NormalizedAssets } from \"../../types/Assets\";\nimport { SeriationData } from \"../../types/Data\";\n\nimport { EduChip, setUpChipData } from \"../../ui/misc/chip\";\nimport { shuffle } from \"../../shared\";\nimport { seriationGrader } from \"./implementation/grader\";\n\nexport class RankOrder extends BaseInteraction<SeriationData> {\n\n\tinteractionMechanic: InteractionMechanic = \"static\";\n\n\tprivate currentOrder: string[] = [];\n\tprivate isGraded: boolean = false;\n\n\tprivate $container!: HTMLDivElement;\n\tprivate $rowsContainer!: HTMLDivElement;\n\n\tprivate draggedRowIndex: number | null = null;\n\tprivate dragOverRowIndex: number | null = null;\n\n\tprivate isDragging: boolean = false;\n\tprivate draggedRow: HTMLElement | null = null;\n\tprivate dragOffsetY: number = 0;\n\tprivate boundPointerMove: (e: PointerEvent) => void;\n\tprivate boundPointerUp: (e: PointerEvent) => void;\n\n\tprivate variant: Variant;\n\n\t// Scalability constants\n\tprivate readonly MAX_ITEMS = 10; // Cognitive Ceiling\n\tprivate readonly MIN_ITEM_HEIGHT = 44; // Interaction Floor (px)\n\n\tconstructor(\n\t\tdata: SeriationData,\n\t\tconfig: InteractionConfig,\n\t\tassets: NormalizedAssets | null\n\t) {\n\t\tsuper(data, config, assets);\n\n\t\t// Parent class now handles undefined data gracefully\n\t\tif (!this.isValid || !this.data || !this.config) return;\n\n\t\tconst items = this.data.items;\n\t\tthis.data.items = items;\n\n\t\tif (this.config.shuffle) this.currentOrder = shuffle([...this.data.items]);\n\t\telse this.currentOrder = [...this.data.items];\n\n\t\tthis.implementsProgress = false;\n\t\tthis.variant = this.config.variant;\n\t}\n\n\tprotected initialize(): void {\n\t\tthis.boundPointerMove = this.handlePointerMove.bind(this);\n\t\tthis.boundPointerUp = this.handlePointerUp.bind(this);\n\t\twindow.addEventListener(\"pointermove\", this.boundPointerMove);\n\t\twindow.addEventListener(\"pointerup\", this.boundPointerUp);\n\t}\n\n\tprotected cleanup(): void {\n\t\twindow.removeEventListener(\"pointermove\", this.boundPointerMove);\n\t\twindow.removeEventListener(\"pointerup\", this.boundPointerUp);\n\t}\n\n\tonVariantChange(newVariant: Variant): void {\n\t\tthis.querySelectorAll('edu-chip').forEach((el: EduChip) => {\n\t\t\tif (el.variant !== undefined) {\n\t\t\t\tel.variant = newVariant;\n\t\t\t}\n\t\t});\n\t\tthis.variant = newVariant;\n\t}\n\n\t// ==================== RENDERING ====================\n\n\trender(): void {\n\t\tthis.innerHTML = `\n\t\t\t<style>\n\t\t\t\trank-order {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tbox-sizing: border-box;\n\n\t\t\t\t\t/* Enable container queries for aspect-ratio detection */\n\t\t\t\t\tcontainer-type: size;\n\t\t\t\t\tcontainer-name: rank-order;\n\t\t\t\t}\n\n\t\t\t\t.container {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\tflex-direction: column;\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tpadding: 0;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t\toverflow: hidden;\n\n\t\t\t\t\t/* Height Guardrail - prevents Extreme Y stretch */\n\t\t\t\t\tmax-height: 100%;\n\n\t\t\t\t\t/* Vertical centering (Letterboxing) */\n\t\t\t\t\tmargin: auto;\n\t\t\t\t}\n\n\t\t\t\t.rows-container {\n\t\t\t\t\tflex: 1;\n\t\t\t\t\tdisplay: grid;\n\n\t\t\t\t\t/* The Grid Formula - auto-reflow based on container width */\n\t\t\t\t\t/* Single column by default */\n\t\t\t\t\tgrid-template-columns: 1fr;\n\n\t\t\t\t\t/* Rows can grow but never below the interaction floor */\n\t\t\t\t\tgrid-template-rows: repeat(${this.data.items.length}, minmax(${this.MIN_ITEM_HEIGHT}px, 1fr));\n\n\t\t\t\t\tgap: clamp(2px, min(0.6cqw, 0.6cqh), 6px);\n\t\t\t\t\trow-gap: clamp(2px, min(0.6cqw, 0.6cqh), 6px);\n\t\t\t\t\tcolumn-gap: clamp(4px, min(1.2cqw, 1.2cqh), 10px);\n\n\t\t\t\t\talign-content: stretch;\n\t\t\t\t\talign-items: stretch;\n\n\t\t\t\t\toverflow-y: auto;\n\t\t\t\t\toverflow-x: hidden;\n\t\t\t\t\tmin-height: 0;\n\t\t\t\t\tpadding: clamp(6px, min(1.4cqw, 1.4cqh), 14px);\n\n\t\t\t\t\t/* Prevent excessive width */\n\t\t\t\t\tmax-width: 100%;\n\t\t\t\t\tmax-height: 100dvh;\n\t\t\t\t\tmargin: auto;\n\t\t\t\t\twidth: 100%;\n\n\t\t\t\t\toutline: 0 !important;\n\n\t\t\t\t\toverflow-y: scroll;\n\t\t\t\t\ttext-size-adjust: 100%;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t}\n\n\t\t\t\t/* Height-driven reflow: only split columns when height is tight */\n\t\t\t\t@container rank-order (max-height: 220px) {\n\t\t\t\t\t.rows-container {\n\t\t\t\t\t\tgrid-template-columns: repeat(2, 1fr);\n\t\t\t\t\t\tgrid-template-rows: repeat(${Math.ceil(this.data.items.length / 2)}, minmax(${this.MIN_ITEM_HEIGHT}px, 1fr));\n\t\t\t\t\t\tcolumn-gap: clamp(0.5rem, 2cqw, 1rem);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t@container rank-order (max-height: 140px) {\n\t\t\t\t\t.rows-container {\n\t\t\t\t\t\tgrid-template-columns: repeat(3, 1fr);\n\t\t\t\t\t\tgrid-template-rows: repeat(${Math.ceil(this.data.items.length / 3)}, minmax(${this.MIN_ITEM_HEIGHT}px, 1fr));\n\t\t\t\t\t\tcolumn-gap: clamp(0.5rem, 2cqw, 1rem);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t.row {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\talign-items: stretch;\n\t\t\t\t\tbackground: transparent;\n\t\t\t\t\tborder: 2px solid transparent;\n\t\t\t\t\tborder-radius: clamp(4px, 1cqw, 6px);\n\t\t\t\t\ttransition: all 0.2s ease;\n\t\t\t\t\tcursor: grab;\n\t\t\t\t\tgap: clamp(0.25rem, 1cqw, 0.5rem);\n\t\t\t\t\tposition: relative;\n\n\t\t\t\t\tmin-height: ${this.MIN_ITEM_HEIGHT}px;\n\t\t\t\t\theight: 100%;\n\n\t\t\t\t\t/* Fill the grid cell completely */\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t}\n\n\t\t\t\t.row:hover:not(.dragging) {\n\t\t\t\t\tbackground: rgba(var(--edu-first-accent), 0.03);\n\t\t\t\t\tborder-color: rgba(var(--edu-first-accent), 0.2);\n\t\t\t\t}\n\n\t\t\t\t.row:active {\n\t\t\t\t\tcursor: grabbing;\n\t\t\t\t}\n\n\t\t\t\t.row.drag-over {\n\t\t\t\t\tborder-color: rgb(var(--edu-first-accent));\n\t\t\t\t\tbackground: rgba(var(--edu-first-accent), 0.15);\n\t\t\t\t\ttransform: scale(1.02);\n\t\t\t\t\tbox-shadow: 0 0 0 3px rgba(var(--edu-first-accent), 0.2);\n\t\t\t\t}\n\n\t\t\t\t.row.dragging {\n\t\t\t\t\topacity: 0.6;\n\t\t\t\t\ttransform: scale(0.95);\n\t\t\t\t\tcursor: grabbing;\n\t\t\t\t\tbackground: rgba(var(--edu-second-ink), 0.1);\n\t\t\t\t\tborder-color: rgb(var(--edu-second-ink));\n\t\t\t\t\tbox-shadow: 0 4px 12px rgba(var(--edu-shadow-color), 0.2);\n\t\t\t\t}\n\n\t\t\t\t.chip-wrapper {\n\t\t\t\t\tflex: 1;\n\t\t\t\t\tmin-width: 0;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t}\n\n\t\t\t\tedu-chip {\n\t\t\t\t\twidth: 100%;\n\t\t\t\t\theight: 100%;\n\t\t\t\t\tflex: 1;\n\t\t\t\t}\n\n\t\t\t\t.controls {\n\t\t\t\t\tposition: absolute;\n\t\t\t\t\ttop: clamp(-14px, -2cqh, -10px);\n\t\t\t\t\tright: clamp(-14px, -2cqw, -10px);\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\talign-items: center;\n\t\t\t\t\tjustify-content: center;\n\t\t\t\t\tz-index: 10;\n\t\t\t\t\topacity: 0;\n\t\t\t\t\ttransition: opacity 0.2s ease;\n\t\t\t\t\tpointer-events: none;\n\t\t\t\t}\n\n\t\t\t\t.row:hover .controls,\n\t\t\t\t.row.dragging .controls {\n\t\t\t\t\topacity: 1;\n\t\t\t\t\tpointer-events: auto;\n\t\t\t\t}\n\n\t\t\t\t.btn {\n\t\t\t\t\tdisplay: flex;\n\t\t\t\t\talign-items: center;\n\t\t\t\t\tjustify-content: center;\n\t\t\t\t\tbackground: rgb(var(--edu-card));\n\t\t\t\t\tborder: 2px solid rgb(var(--edu-first-accent));\n\t\t\t\t\tcursor: pointer;\n\t\t\t\t\ttransition: all 0.2s ease;\n\t\t\t\t\tbox-shadow: 0 2px 6px rgba(var(--edu-shadow-color), 0.15);\n\n\t\t\t\t\t/* Compact circular buttons */\n\t\t\t\t\twidth: clamp(28px, min(5cqw, 5cqh), 42px);\n\t\t\t\t\theight: clamp(28px, min(5cqw, 5cqh), 42px);\n\t\t\t\t\tmin-width: 28px;\n\t\t\t\t\tmin-height: 28px;\n\t\t\t\t\tflex-shrink: 0;\n\t\t\t\t\tborder-radius: 50%;\n\t\t\t\t\tpadding: 0;\n\t\t\t\t\tmargin: 0;\n\t\t\t\t}\n\n\t\t\t\t.btn:hover:not(:disabled) {\n\t\t\t\t\tbackground: rgb(var(--edu-first-accent));\n\t\t\t\t\tborder-color: rgb(var(--edu-first-accent));\n\t\t\t\t\ttransform: scale(1.1);\n\t\t\t\t\tbox-shadow: 0 4px 12px rgba(var(--edu-first-accent), 0.4);\n\t\t\t\t}\n\n\t\t\t\t.btn:hover:not(:disabled) img {\n\t\t\t\t\tfilter: brightness(0) invert(1);\n\t\t\t\t}\n\n\t\t\t\t.btn:active:not(:disabled) {\n\t\t\t\t\ttransform: scale(0.9);\n\t\t\t\t}\n\n\t\t\t\t.btn:disabled {\n\t\t\t\t\topacity: 0.2;\n\t\t\t\t\tcursor: not-allowed;\n\t\t\t\t\tborder-color: rgb(var(--edu-border));\n\t\t\t\t}\n\n\t\t\t\t.btn img {\n\t\t\t\t\twidth: 60%;\n\t\t\t\t\theight: 60%;\n\t\t\t\t\tobject-fit: contain;\n\t\t\t\t\ttransition: filter 0.2s ease;\n\t\t\t\t}\n\n\t\t\t\t/* Mobile optimizations - ensure tight layout */\n\t\t\t\t@media (max-width: 640px) {\n\t\t\t\t\t.row {\n\t\t\t\t\t\tgap: 0.125rem;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t</style>\n\n\t\t\t<div class=\"container\">\n\t\t\t\t<div class=\"rows-container\"></div>\n\t\t\t</div>\n\t\t`;\n\n\t\tthis.$container = this.querySelector('.container')!;\n\t\tthis.$rowsContainer = this.querySelector('.rows-container')!;\n\n\t\tthis.renderRows();\n\t}\n\n\tprivate renderRows(): void {\n\t\tthis.$rowsContainer.innerHTML = '';\n\n\t\tthis.currentOrder.forEach((item, index) => {\n\t\t\tconst row = document.createElement('div');\n\t\t\trow.className = 'row';\n\t\t\trow.dataset.index = String(index);\n\n\t\t\t// Chip\n\t\t\tconst chipWrapper = document.createElement('div');\n\t\t\tchipWrapper.className = 'chip-wrapper';\n\n\t\t\tconst chip = document.createElement('edu-chip') as EduChip;\n\t\t\tchip.variant = this.variant;\n\t\t\tchip.dataset.item = item;\n\t\t\tchip.prefix = String(index + 1);\n\t\t\tchip.draggable = true;\n\t\t\tsetUpChipData(item, chip, this.assets?.assetsById);\n\n\t\t\t// Show correctness state if graded\n\t\t\tif (this.isGraded) {\n\t\t\t\tconst correctIndex = this.data.items.indexOf(item);\n\t\t\t\tif (correctIndex === index) {\n\t\t\t\t\tchip.chipState = 'correct';\n\t\t\t\t} else {\n\t\t\t\t\tchip.chipState = 'wrong';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tchipWrapper.appendChild(chip);\n\n\t\t\t// Controls - Only UP button as requested\n\t\t\tconst controls = document.createElement('div');\n\t\t\tcontrols.className = 'controls';\n\n\t\t\tconst upBtn = this.createButton('up', index);\n\t\t\tcontrols.appendChild(upBtn);\n\n\t\t\t// Assemble row\n\t\t\trow.appendChild(chipWrapper);\n\t\t\trow.appendChild(controls);\n\n\t\t\t// Pointer event listener for drag\n\t\t\tif (!this.isGraded) {\n\t\t\t\trow.addEventListener('pointerdown', (e) => this.handlePointerDown(e, index));\n\t\t\t}\n\n\t\t\tthis.$rowsContainer.appendChild(row);\n\t\t});\n\t}\n\n\tprivate createButton(direction: 'up' | 'down', index: number): HTMLButtonElement {\n\t\tconst btn = document.createElement('button');\n\t\tbtn.className = 'btn';\n\t\tbtn.dataset.direction = direction;\n\t\tbtn.dataset.index = String(index);\n\t\tbtn.setAttribute('aria-label', direction === 'up' ? 'Move up' : 'Move down');\n\n\t\t// Disable buttons at boundaries\n\t\tif (direction === 'up' && index === 0) {\n\t\t\tbtn.disabled = true;\n\t\t}\n\t\tif (direction === 'down' && index === this.currentOrder.length - 1) {\n\t\t\tbtn.disabled = true;\n\t\t}\n\n\t\t// Disable all buttons if graded\n\t\tif (this.isGraded) {\n\t\t\tbtn.disabled = true;\n\t\t}\n\n\t\t// SVG icons\n\t\tconst svg = direction === 'up'\n\t\t\t? `<img src=\"assets/icons/up.svg\" alt=\"^\" />`\n\t\t\t: `<img src=\"assets/icons/down.svg\" alt=\"v\" />`;\n\n\t\tbtn.innerHTML = svg;\n\n\t\t// Click handler\n\t\tbtn.addEventListener('click', () => {\n\t\t\tif (direction === 'up' && index > 0) {\n\t\t\t\tthis.swapItems(index, index - 1);\n\t\t\t} else if (direction === 'down' && index < this.currentOrder.length - 1) {\n\t\t\t\tthis.swapItems(index, index + 1);\n\t\t\t}\n\t\t});\n\n\t\treturn btn;\n\t}\n\n\t// ==================== SWAP LOGIC ====================\n\n\tprivate swapItems(index1: number, index2: number): void {\n\t\tconst temp = this.currentOrder[index1];\n\t\tthis.currentOrder[index1] = this.currentOrder[index2];\n\t\tthis.currentOrder[index2] = temp;\n\n\t\tthis.renderRows();\n\t\tthis.emitStateChange();\n\t}\n\n\t// ==================== DRAG & DROP ====================\n\n\tprivate handlePointerDown(e: PointerEvent, index: number): void {\n\t\t// Don't drag on button clicks or control elements\n\t\tif ((e.target as HTMLElement).closest('.btn, .controls')) return;\n\n\t\te.preventDefault();\n\t\te.stopPropagation();\n\n\t\tthis.isDragging = true;\n\t\tthis.draggedRow = e.currentTarget as HTMLElement;\n\t\tthis.draggedRowIndex = index;\n\n\t\tconst rect = this.draggedRow.getBoundingClientRect();\n\t\tthis.dragOffsetY = e.clientY - rect.top;\n\n\t\ttry {\n\t\t\tthis.draggedRow.setPointerCapture(e.pointerId);\n\t\t} catch (err) {\n\t\t\tconsole.warn('Failed to capture pointer:', err);\n\t\t}\n\n\t\tthis.draggedRow.classList.add('dragging');\n\n\t\t// Add visual feedback to container\n\t\tthis.$rowsContainer.style.userSelect = 'none';\n\t}\n\n\tprivate handlePointerMove(e: PointerEvent): void {\n\t\tif (!this.isDragging || !this.draggedRow) return;\n\n\t\t// Determine which row we're hovering over\n\t\tconst hoverIndex = this.getRowIndexAtY(e.clientY);\n\n\t\t// Remove drag-over class from all rows\n\t\tthis.$rowsContainer.querySelectorAll('.row').forEach(row => {\n\t\t\trow.classList.remove('drag-over');\n\t\t});\n\n\t\tif (hoverIndex !== -1 && hoverIndex !== this.draggedRowIndex) {\n\t\t\t// Add drag-over class to the hovered row\n\t\t\tconst rows = Array.from(this.$rowsContainer.children) as HTMLElement[];\n\t\t\tif (rows[hoverIndex]) {\n\t\t\t\trows[hoverIndex].classList.add('drag-over');\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate handlePointerUp(e: PointerEvent): void {\n\t\tif (!this.isDragging || !this.draggedRow) return;\n\n\t\ttry {\n\t\t\tthis.draggedRow.releasePointerCapture(e.pointerId);\n\t\t} catch (err) {\n\t\t\t// Capture may not be active - that's okay\n\t\t}\n\n\t\tconst hoverIndex = this.getRowIndexAtY(e.clientY);\n\n\t\tif (hoverIndex !== -1 && hoverIndex !== this.draggedRowIndex) {\n\t\t\t// Swap items with animation feedback\n\t\t\tthis.swapItems(this.draggedRowIndex, hoverIndex);\n\t\t}\n\n\t\t// Clean up all drag states\n\t\tthis.$rowsContainer.querySelectorAll('.row').forEach(row => {\n\t\t\trow.classList.remove('dragging', 'drag-over');\n\t\t});\n\n\t\t// Reset container style\n\t\tthis.$rowsContainer.style.userSelect = '';\n\n\t\tthis.isDragging = false;\n\t\tthis.draggedRow = null;\n\t\tthis.draggedRowIndex = null;\n\t\tthis.dragOverRowIndex = null;\n\t}\n\n\tprivate getRowIndexAtY(clientY: number): number {\n\t\tconst rows = Array.from(this.$rowsContainer.children) as HTMLElement[];\n\n\t\tfor (let i = 0; i < rows.length; i++) {\n\t\t\tconst rect = rows[i].getBoundingClientRect();\n\t\t\tif (clientY >= rect.top && clientY <= rect.bottom) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\n\t\treturn -1;\n\t}\n\n\t// ==================== INTERACTION LOGIC ====================\n\n\tgetCurrentState(): any {\n\t\treturn {\n\t\t\tcurrentOrder: [...this.currentOrder],\n\t\t\tcorrectOrder: [...this.data.items]\n\t\t};\n\t}\n\n\tisInteractionComplete(): boolean {\n\t\t// Always complete (user can submit anytime)\n\t\treturn true;\n\t}\n\n\tonHint(): void {\n\t\t// Count correctly positioned items\n\t\tlet correctCount = 0;\n\t\tthis.currentOrder.forEach((item, index) => {\n\t\t\tif (this.data.items[index] === item) {\n\t\t\t\tcorrectCount++;\n\t\t\t}\n\t\t});\n\n\t\tif (correctCount === this.currentOrder.length) {\n\t\t\talert('All items are in the correct order! Click \"Check\" to submit.');\n\t\t\tthis.emitHintShown('All items correctly ordered');\n\t\t} else {\n\t\t\talert(`Hint: ${correctCount} out of ${this.currentOrder.length} items are in the correct position. Keep reordering!`);\n\t\t\tthis.emitHintShown(`${correctCount}/${this.currentOrder.length} correct`);\n\t\t}\n\t}\n\n\t// ==================== GRADING ====================\n\n\tpublic submit(): void {\n\t\tsuper.submit();\n\n\t\tconst result = seriationGrader(this.data.items, this.currentOrder, this);\n\n\t\tconsole.log(`Rank Order Score: ${result.score.toFixed(1)}% (${result.correct}/${result.total} correct)`);\n\n\t\t// Mark as graded and re-render to show correctness states\n\t\tthis.isGraded = true;\n\t\tthis.renderRows();\n\n\t\tthis.dispatchEvent(new CustomEvent('interaction:graded', {\n\t\t\tdetail: { result },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\n\t\tthis.setAttribute('inert', '');\n\t}\n\n\t// ==================== RESET ====================\n\n\tpublic reset(): void {\n\t\tsuper.reset();\n\n\t\t// Re-shuffle order\n\t\tif (this.config.shuffle) {\n\t\t\tthis.currentOrder = shuffle([...this.data.items]);\n\t\t} else {\n\t\t\tthis.currentOrder = [...this.data.items];\n\t\t}\n\n\t\tthis.isGraded = false;\n\t\tthis.renderRows();\n\t}\n}\n\n// Register as custom element\nif (!customElements.get('rank-order')) {\n\tcustomElements.define('rank-order', RankOrder);\n}\n", "import { registerInteraction, type InteractionConstructor } from \"./registry\";\n\nimport { OpenClassification } from \"./open-classification\";\nimport { SequentialClassification } from \"./sequential-classification\";\nimport { MCQ } from \"./mcq-mrq\";\nimport { SimultaneousAssociation } from \"./simultaneous-association\";\nimport { ListRecall } from \"./list-recall\";\nimport { LookupTable } from \"./lookup-table\";\nimport { ClassificationMatrix } from \"./classification-matrix\";\nimport { NaryChoiceTable } from \"./nary-choice-table\";\nimport { AdjacencyTable } from \"./adjacency-table\";\nimport { MarkTheWords, SequentialMarkTheWords } from \"./mark-the-words\";\nimport { CategorizeTheWords, SequentialCategorizeTheWords } from \"./categorize-the-words\";\nimport { TextTransformation, SequentialTextTransformation } from \"./text-transformation\";\nimport { FillBlanks, SequentialFillBlanks } from \"./fill-blanks\";\nimport { RankOrder } from \"./rank-order\";\n\nlet builtinsRegistered = false;\n\nexport const registerBuiltInInteractions = (): void => {\n\tif (builtinsRegistered) return;\n\tbuiltinsRegistered = true;\n\n\tregisterInteraction({\n\t\tid: \"open-classification\",\n\t\tlabel: \"Open Classification\",\n\t\telementTag: \"open-classification\",\n\t\tcognitiveOp: \"classification\",\n\t\tmechanic: \"static\",\n\t\tengine: \"direct\",\n\t\tctor: OpenClassification as unknown as InteractionConstructor,\n\t\tcapabilities: {\n\t\t\tisSequential: false,\n\t\t\timplementsProgress: true,\n\t\t\tusesAssets: true,\n\t\t\thasParser: true,\n\t\t\thasValidator: true,\n\t\t\thasGrader: true\n\t\t}\n\t});\n\n\tregisterInteraction({\n\t\tid: \"sequential-classification\",\n\t\tlabel: \"Sequential Classification\",\n\t\telementTag: \"sequential-classification\",\n\t\tcognitiveOp: \"classification\",\n\t\tmechanic: \"automatic-sequencing\",\n\t\tengine: \"direct\",\n\t\tctor: SequentialClassification as unknown as InteractionConstructor,\n\t\tcapabilities: {\n\t\t\tisSequential: true,\n\t\t\timplementsProgress: true,\n\t\t\tusesAssets: true,\n\t\t\thasParser: true,\n\t\t\thasValidator: true,\n\t\t\thasGrader: true\n\t\t}\n\t});\n\n\tregisterInteraction({\n\t\tid: \"mcq\",\n\t\tlabel: \"Multiple Choice / Multiple Response\",\n\t\telementTag: \"mcq-interaction\",\n\t\tcognitiveOp: \"recognition\",\n\t\tmechanic: \"sequential\",\n\t\tengine: \"direct\",\n\t\tctor: MCQ as unknown as InteractionConstructor,\n\t\tcapabilities: {\n\t\t\tisSequential: true,\n\t\t\timplementsProgress: true,\n\t\t\tusesAssets: true,\n\t\t\thasParser: true,\n\t\t\thasValidator: true,\n\t\t\thasGrader: true\n\t\t}\n\t});\n\n\tregisterInteraction({\n\t\tid: \"simultaneous-association\",\n\t\tlabel: \"Simultaneous Association\",\n\t\telementTag: \"simultaneous-association\",\n\t\tcognitiveOp: \"association\",\n\t\tmechanic: \"static\",\n\t\tengine: \"direct\",\n\t\tctor: SimultaneousAssociation as unknown as InteractionConstructor,\n\t\tcapabilities: {\n\t\t\tisSequential: false,\n\t\t\timplementsProgress: true,\n\t\t\tusesAssets: true,\n\t\t\thasParser: true,\n\t\t\thasValidator: true,\n\t\t\thasGrader: true\n\t\t}\n\t});\n\n\tregisterInteraction({\n\t\tid: \"list-recall\",\n\t\tlabel: \"List Recall\",\n\t\telementTag: \"list-recall\",\n\t\tcognitiveOp: \"freerecall\",\n\t\tmechanic: \"static\",\n\t\tengine: \"direct\",\n\t\tctor: ListRecall as unknown as InteractionConstructor,\n\t\tcapabilities: {\n\t\t\tisSequential: false,\n\t\t\timplementsProgress: true,\n\t\t\tusesAssets: false,\n\t\t\thasParser: true,\n\t\t\thasValidator: true,\n\t\t\thasGrader: true\n\t\t}\n\t});\n\n\tregisterInteraction({\n\t\tid: \"lookup-table\",\n\t\tlabel: \"Lookup Table\",\n\t\telementTag: \"lookup-table\",\n\t\tcognitiveOp: \"production\",\n\t\tmechanic: \"static\",\n\t\tengine: \"tables\",\n\t\tctor: LookupTable as unknown as InteractionConstructor,\n\t\tcapabilities: {\n\t\t\tisSequential: false,\n\t\t\timplementsProgress: true,\n\t\t\tusesAssets: false,\n\t\t\thasParser: true,\n\t\t\thasValidator: true,\n\t\t\thasGrader: true\n\t\t}\n\t});\n\n\tregisterInteraction({\n\t\tid: \"classification-matrix\",\n\t\tlabel: \"Classification Matrix\",\n\t\telementTag: \"classification-matrix\",\n\t\tcognitiveOp: \"classification\",\n\t\tmechanic: \"static\",\n\t\tengine: \"tables\",\n\t\tctor: ClassificationMatrix as unknown as InteractionConstructor,\n\t\tcapabilities: {\n\t\t\tisSequential: false,\n\t\t\timplementsProgress: true,\n\t\t\tusesAssets: false,\n\t\t\thasParser: true,\n\t\t\thasValidator: true,\n\t\t\thasGrader: true\n\t\t}\n\t});\n\n\tregisterInteraction({\n\t\tid: \"nary-choice-table\",\n\t\tlabel: \"N-ary Choice Table\",\n\t\telementTag: \"nary-choice-table\",\n\t\tcognitiveOp: \"discrimination\",\n\t\tmechanic: \"static\",\n\t\tengine: \"tables\",\n\t\tctor: NaryChoiceTable as unknown as InteractionConstructor,\n\t\tcapabilities: {\n\t\t\tisSequential: false,\n\t\t\timplementsProgress: true,\n\t\t\tusesAssets: false,\n\t\t\thasParser: true,\n\t\t\thasValidator: true,\n\t\t\thasGrader: true\n\t\t}\n\t});\n\n\tregisterInteraction({\n\t\tid: \"adjacency-table\",\n\t\tlabel: \"Adjacency Table\",\n\t\telementTag: \"adjacency-table\",\n\t\tcognitiveOp: \"association\",\n\t\tmechanic: \"static\",\n\t\tengine: \"tables\",\n\t\tctor: AdjacencyTable as unknown as InteractionConstructor,\n\t\tcapabilities: {\n\t\t\tisSequential: false,\n\t\t\timplementsProgress: true,\n\t\t\tusesAssets: false,\n\t\t\thasParser: true,\n\t\t\thasValidator: true,\n\t\t\thasGrader: true\n\t\t}\n\t});\n\n\tregisterInteraction({\n\t\tid: \"mark-the-words\",\n\t\tlabel: \"Mark The Words\",\n\t\telementTag: \"mark-the-words\",\n\t\tcognitiveOp: \"recognition\",\n\t\tmechanic: \"static\",\n\t\tengine: \"text\",\n\t\tctor: MarkTheWords as unknown as InteractionConstructor,\n\t\tcapabilities: {\n\t\t\tisSequential: false,\n\t\t\timplementsProgress: true,\n\t\t\tusesAssets: false,\n\t\t\thasParser: false,\n\t\t\thasValidator: true,\n\t\t\thasGrader: true\n\t\t}\n\t});\n\n\tregisterInteraction({\n\t\tid: \"sequential-mark-the-words\",\n\t\tlabel: \"Sequential Mark The Words\",\n\t\telementTag: \"sequential-mark-the-words\",\n\t\tcognitiveOp: \"recognition\",\n\t\tmechanic: \"sequential\",\n\t\tengine: \"text\",\n\t\tctor: SequentialMarkTheWords as unknown as InteractionConstructor,\n\t\tcapabilities: {\n\t\t\tisSequential: true,\n\t\t\timplementsProgress: true,\n\t\t\tusesAssets: false,\n\t\t\thasParser: false,\n\t\t\thasValidator: true,\n\t\t\thasGrader: true\n\t\t}\n\t});\n\n\tregisterInteraction({\n\t\tid: \"categorize-the-words\",\n\t\tlabel: \"Categorize The Words\",\n\t\telementTag: \"categorize-the-words\",\n\t\tcognitiveOp: \"classification\",\n\t\tmechanic: \"static\",\n\t\tengine: \"text\",\n\t\tctor: CategorizeTheWords as unknown as InteractionConstructor,\n\t\tcapabilities: {\n\t\t\tisSequential: false,\n\t\t\timplementsProgress: true,\n\t\t\tusesAssets: false,\n\t\t\thasParser: false,\n\t\t\thasValidator: true,\n\t\t\thasGrader: true\n\t\t}\n\t});\n\n\tregisterInteraction({\n\t\tid: \"sequential-categorize-the-words\",\n\t\tlabel: \"Sequential Categorize The Words\",\n\t\telementTag: \"sequential-categorize-the-words\",\n\t\tcognitiveOp: \"classification\",\n\t\tmechanic: \"sequential\",\n\t\tengine: \"text\",\n\t\tctor: SequentialCategorizeTheWords as unknown as InteractionConstructor,\n\t\tcapabilities: {\n\t\t\tisSequential: true,\n\t\t\timplementsProgress: true,\n\t\t\tusesAssets: false,\n\t\t\thasParser: false,\n\t\t\thasValidator: true,\n\t\t\thasGrader: true\n\t\t}\n\t});\n\n\tregisterInteraction({\n\t\tid: \"text-transformation\",\n\t\tlabel: \"Text Transformation\",\n\t\telementTag: \"text-transformation\",\n\t\tcognitiveOp: \"transformation\",\n\t\tmechanic: \"static\",\n\t\tengine: \"text\",\n\t\tctor: TextTransformation as unknown as InteractionConstructor,\n\t\tcapabilities: {\n\t\t\tisSequential: false,\n\t\t\timplementsProgress: true,\n\t\t\tusesAssets: false,\n\t\t\thasParser: false,\n\t\t\thasValidator: true,\n\t\t\thasGrader: true\n\t\t}\n\t});\n\n\tregisterInteraction({\n\t\tid: \"sequential-text-transformation\",\n\t\tlabel: \"Sequential Text Transformation\",\n\t\telementTag: \"sequential-text-transformation\",\n\t\tcognitiveOp: \"transformation\",\n\t\tmechanic: \"sequential\",\n\t\tengine: \"text\",\n\t\tctor: SequentialTextTransformation as unknown as InteractionConstructor,\n\t\tcapabilities: {\n\t\t\tisSequential: true,\n\t\t\timplementsProgress: true,\n\t\t\tusesAssets: false,\n\t\t\thasParser: false,\n\t\t\thasValidator: true,\n\t\t\thasGrader: true\n\t\t}\n\t});\n\n\tregisterInteraction({\n\t\tid: \"fill-blanks\",\n\t\tlabel: \"Fill Blanks\",\n\t\telementTag: \"fill-blanks\",\n\t\tcognitiveOp: \"cuedrecall\",\n\t\tmechanic: \"static\",\n\t\tengine: \"text\",\n\t\tctor: FillBlanks as unknown as InteractionConstructor,\n\t\tcapabilities: {\n\t\t\tisSequential: false,\n\t\t\timplementsProgress: true,\n\t\t\tusesAssets: false,\n\t\t\thasParser: false,\n\t\t\thasValidator: true,\n\t\t\thasGrader: true\n\t\t}\n\t});\n\n\tregisterInteraction({\n\t\tid: \"sequential-fill-blanks\",\n\t\tlabel: \"Sequential Fill Blanks\",\n\t\telementTag: \"sequential-fill-blanks\",\n\t\tcognitiveOp: \"cuedrecall\",\n\t\tmechanic: \"sequential\",\n\t\tengine: \"text\",\n\t\tctor: SequentialFillBlanks as unknown as InteractionConstructor,\n\t\tcapabilities: {\n\t\t\tisSequential: true,\n\t\t\timplementsProgress: true,\n\t\t\tusesAssets: false,\n\t\t\thasParser: false,\n\t\t\thasValidator: true,\n\t\t\thasGrader: true\n\t\t}\n\t});\n\n\tregisterInteraction({\n\t\tid: \"rank-order\",\n\t\tlabel: \"Rank Order\",\n\t\telementTag: \"rank-order\",\n\t\tcognitiveOp: \"seriation\",\n\t\tmechanic: \"static\",\n\t\tengine: \"direct\",\n\t\tctor: RankOrder as unknown as InteractionConstructor,\n\t\tcapabilities: {\n\t\t\tisSequential: false,\n\t\t\timplementsProgress: false,\n\t\t\tusesAssets: true,\n\t\t\thasParser: true,\n\t\t\thasValidator: true,\n\t\t\thasGrader: true\n\t\t}\n\t});\n};\n\nregisterBuiltInInteractions();\n", "<header part='header'>\n\t<div class=\"prompt-container\">\n\t\t<button class=\"prompt-btn btn\" title=\"See Prompt Data\" part=\"see-prompt\">\n\t\t\t<img src=\"assets/icons/data.svg\" alt=\"See Prompt\" width=\"20\" height=\"20\"/>\n\t\t</button>\n\t\t<div class='title' part='title'></div>\t\t\t\n\t</div>\n\t<div class='timer' part='timer'></div>\n</header>\n\n<div class='content' part='content'>\n\t<!-- Screen 1: Interaction (default) -->\n\t<div class=\"screen\" data-screen=\"interaction\">\n\t\t<slot></slot>\n\t</div>\n\n\t<!-- Screen 2: Error -->\n\t<div class=\"screen\" data-screen=\"error\" style=\"display:none\">\n\t\t<div class=\"error-content\"></div>\n\t</div>\n\n\t<!-- Screen 3: Correct Solution (provided by interaction) -->\n\t<div class=\"screen\" data-screen=\"solution\" style=\"display:none\">\n\t\t<slot name=\"solution\">\n\t\t\t<div style=\"display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 200px; padding: 2rem; text-align: center; color: rgb(var(--edu-second-ink)); font-style: italic;\">\n\t\t\t\tSolution screen not implemented for this interaction yet\n\t\t\t</div>\n\t\t</slot>\n\t</div>\n\n\t<!-- Screen 4: Remaining Attempts -->\n\t<div class=\"screen\" data-screen=\"attempts\" style=\"display:none\">\n\t\t<div class=\"attempts-message\"></div>\n\t</div>\n\n\t<!-- Screen 5: Score -->\n\t<div class=\"screen\" data-screen=\"score\" style=\"display:none\">\n\t\t<div class=\"score-display\"></div>\n\t</div>\n\n\t<div class=\"screen\" data-screen=\"time\" style=\"display:none\">\n\t\t<div class=\"timer-display\"></div>\n\t</div>\t\n</div>\n\n<footer id='footer' part='footer'>\n\t<div class=\"progress-container\">\n\t\t<progress class=\"progress-bar\" part=\"progress\" value=\"0\" max=\"100\"></progress>\n\t\t<div class=\"progress-icon-wrapper\">\n\t\t\t<img src=\"assets/icons/star.svg\" class=\"progress-icon\" alt=\"Progress\" />\n\t\t</div>\n\t\t<span class=\"progress-counter\">0/0</span>\n\t</div>\n\t<div class=\"radio-nav\" part=\"radio-nav\"></div>\n\t<div class=\"action-buttons\">\n\t\t<button class=\"check-btn\" type=\"button\" part=\"check\">Check</button>\n\n\t\t<button class=\"see-answers-btn btn\" title=\"See answers\" part=\"see-answers\">\n\t\t\t<img src=\"assets/icons/eye.svg\" alt=\"See answers\" width=\"20\" height=\"20\"/>\n\t\t</button>\n\t\t<button class=\"retry-btn btn\" title=\"Retry\" part=\"retry\">\n\t\t\t<img src=\"assets/icons/repeat.svg\" alt=\"Retry\" width=\"20\" height=\"20\"/>\n\t\t</button>\n\t\t<button class=\"scores-btn btn\" title=\"Retry\" part=\"retry\">\n\t\t\t<img src=\"assets/icons/data.svg\" alt=\"Retry\" width=\"20\" height=\"20\"/>\n\t\t</button>\n\n\t</div>\n</footer>\n", ":host {\n\tdisplay: flex;\n\twidth: 100%;\n\theight: 100%;\n\tbox-sizing: border-box;\n\tcontainer-type: size;\n}\n\n.edu-hidden { display: none !important; }\n\n.wrap {\n\tdisplay: flex;\n\tflex-direction: column;\n\twidth: 100%;\n\theight: 100%;\n\tcolor: rgb(var(--edu-ink));\n\tbackground: rgb(var(--edu-bg));\n\toverflow: hidden;\n\tbox-sizing: border-box;\n}\n\nheader {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\talign-items: center;\n\tpadding: clamp(0.2rem, 0.7cqh, 0.4rem);\n\tborder-bottom: 1px solid rgb(var(--edu-border));\n\tflex-shrink: 0;\n\tgap: clamp(0.25rem, 1cqw, 0.5rem);\n\theight: clamp(38px, 7cqh, 46px);\n\tmin-height: clamp(38px, 7cqh, 46px);\n}\n\n.prompt-container {\n\tdisplay: flex;\n\tmin-width: 0;\n\tgap: clamp(0.25rem, 1cqw, 0.5rem);\n\talign-items: center;\n\tflex: 1;\n}\n\n.title {\n\tflex: 1;\n\tmin-width: 0;\n\tpadding: 0;\n\tfont-size: clamp(0.85rem, 2cqh, 1.05rem);\n\tfont-weight: 700;\n\tline-height: 1.2;\n\twhite-space: nowrap;\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n}\n\n.timer {\n\tpadding: 0;\n\tfont-size: clamp(0.75rem, 1.6cqh, 0.9rem);\n\tfont-weight: 600;\n\tcolor: rgb(var(--edu-second-ink));\n\tfont-variant-numeric: tabular-nums;\n\tcursor: pointer;\n}\n\n.timer[data-warning=\"true\"] {\n\tcolor: rgb(var(--edu-warning));\n}\n\n.timer[data-danger=\"true\"] {\n\tcolor: rgb(var(--edu-error));\n}\n\n.content {\n\tflex: 1;\n\toverflow: hidden;\n\tmin-height: 0;\n\tpadding: clamp(0.5rem, min(2cqw, 2cqh), 1rem);\n\tbox-sizing: border-box;\n\tposition: relative;\n\tdisplay: flex;\n}\n\n.screen {\n\tdisplay: flex;\n\twidth: 100%;\n\theight: 100%;\n\tbox-sizing: border-box;\n\tanimation: fadeIn 1s ease;\n\tflex: 1;\n\tmin-height: 0;\n}\n\n.screen[data-screen=\"interaction\"] {\n\tjustify-content: stretch;\n\talign-items: stretch;\n}\n\n.screen:not([data-screen=\"interaction\"]) {\n\tjustify-content: center;\n\talign-items: center;\n}\n\n.screen[data-screen=\"interaction\"] ::slotted(*) {\n\twidth: 100%;\n\theight: 100%;\n\tmin-height: 0;\n\tdisplay: block;\n}\n\n@keyframes fadeIn {\n\tfrom {\n\t\topacity: 0;\n\t\ttransform: translateY(10px);\n\t}\n\tto {\n\t\topacity: 1;\n\t\ttransform: translateY(0);\n\t}\n}\n\n.error-content,\n.attempts-message,\n.score-display,\n.timer-display {\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: center;\n\tjustify-content: center;\n\ttext-align: center;\n\theight: 100%;\n\tcolor: rgb(var(--edu-ink));\n}\n\n.timer-display .timer {\n\tfont-size: 10rem !important;\n\tcolor: rgb(var(--edu-ink)) !important;\n}\n\n.error-content {\n\tcolor: rgb(var(--edu-error));\n}\n\n.attempts-message {\n\tfont-weight: 600;\n\tfont-size: 1.25rem;\n}\n\nfooter {\n\tposition: relative;\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: center;\n\talign-items: center;\n\t/* padding: clamp(0.3rem, 0.8cqh, 0.6rem);*/ \n\tgap: clamp(0.25rem, 0.8cqh, 0.5rem);\n\tflex-shrink: 0;\n\theight: clamp(20px, 9cqh, 62px);\n\tmin-height: clamp(50px, 9cqh, 62px);\n}\n\n.progress-container {\n\tposition: relative;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tgap: clamp(0.25rem, 1cqw, 0.6rem);\n\twidth: 100%;\n}\n\n.progress-bar {\n\tflex: 1;\n\theight: clamp(8px, 1.6cqh, 12px);\n\tappearance: none;\n\t-webkit-appearance: none;\n\tborder: none;\n}\n\n.progress-bar::-webkit-progress-bar {\n\tbackground-color: rgb(var(--edu-muted));\n\tborder-radius: 10px;\n}\n\n.progress-bar::-webkit-progress-value {\n\tbackground: rgb(var(--edu-first-accent));\n\tborder-radius: 10px;\n\ttransition: width 0.3s ease, background 0.3s ease;\n}\n\n.progress-bar::-moz-progress-bar {\n\tbackground: rgb(var(--edu-first-accent));\n\tborder-radius: 10px;\n\ttransition: width 0.3s ease, background 0.3s ease;\n}\n\n/* Score-based progress bar coloring */\n.progress-bar.score-fail::-webkit-progress-value {\n\tbackground: rgb(var(--edu-error)) !important;\n}\n\n.progress-bar.score-fail::-moz-progress-bar {\n\tbackground: rgb(var(--edu-error)) !important;\n}\n\n.progress-bar.score-low::-webkit-progress-value {\n\tbackground: rgb(var(--edu-warning)) !important;\n}\n\n.progress-bar.score-low::-moz-progress-bar {\n\tbackground: rgb(var(--edu-warning)) !important;\n}\n\n.progress-bar.score-mid::-webkit-progress-value {\n\tbackground: rgb(139, 195, 74) !important; /* Light green */\n}\n\n.progress-bar.score-mid::-moz-progress-bar {\n\tbackground: rgb(139, 195, 74) !important;\n}\n\n.progress-bar.score-high::-webkit-progress-value {\n\tbackground: rgb(var(--edu-success)) !important;\n}\n\n.progress-bar.score-high::-moz-progress-bar {\n\tbackground: rgb(var(--edu-success)) !important;\n}\n\n.progress-icon-wrapper {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tmax-width: 24px;\n\tmax-height: 24px;\n\tposition: absolute;\n\tleft: 0;\n\ttop: 50%;\n\ttransform: translateY(-50%);\n\tpointer-events: none;\n\ttransition: left 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;\n\tbackground-color: rgb(var(--edu-first-accent));\n\tborder-radius: 50px;\n\tbox-shadow: 0 0 10px 5px rgb(var(--edu-first-accent));\n\tpadding: 0;\n}\n\n/* Score-based icon coloring */\n.progress-icon-wrapper.score-fail {\n\tbackground-color: rgb(var(--edu-error));\n\tbox-shadow: 0 0 10px 5px rgb(var(--edu-error));\n}\n\n.progress-icon-wrapper.score-low {\n\tbackground-color: rgb(var(--edu-warning));\n\tbox-shadow: 0 0 10px 5px rgb(var(--edu-warning));\n}\n\n.progress-icon-wrapper.score-mid {\n\tbackground-color: rgba(139, 195, 74, 0.8);\n\tbox-shadow: 0 0 10px 5px rgba(139, 195, 74, 0.8);\n}\n\n.progress-icon-wrapper.score-high {\n\tbackground-color: rgb(var(--edu-success));\n\tbox-shadow: 0 0 10px 5px rgb(var(--edu-success));\n}\n\n.progress-icon {\n\twidth: clamp(20px, 3.2cqh, 30px);\n\theight: clamp(20px, 3.2cqh, 30px);\n}\n\n.progress-counter {\n\tfont-size: clamp(0.7rem, 1.4cqh, 0.85rem);\n\tfont-weight: 600;\n\tcolor: rgb(var(--edu-second-ink));\n\tmin-width: 3rem;\n\ttext-align: right;\n\tflex-shrink: 0;\n}\n\n.action-buttons {\n\tdisplay: flex;\n\tgap: 0.5rem;\n\talign-items: center;\n\tjustify-content: center;\n\tflex-wrap: wrap;\n}\n\n.check-btn {\n\tpadding: clamp(0.35rem, 1cqh, 0.6rem) clamp(1rem, 2.6cqw, 1.6rem);\n\tfont-size: clamp(0.8rem, 1.6cqh, 0.95rem);\n\tfont-weight: 600;\n\tcursor: pointer;\n\tborder: none;\n\tborder-radius: var(--edu-radius);\n\tbackground: rgb(var(--edu-first-accent));\n\tcolor: rgb(var(--edu-inverted-ink));\n\ttransition: all 0.2s ease;\n}\n\n.check-btn:hover:not(:disabled) {\n\tbackground: rgb(var(--edu-first-accent) / 0.9);\n\ttransform: translateY(-2px) scale(1.02);\n\tbox-shadow: 0 4px 12px rgb(var(--edu-first-accent) / 0.3);\n}\n\n.check-btn:active:not(:disabled) {\n\ttransform: translateY(0) scale(0.98);\n\tbox-shadow: 0 2px 4px rgb(var(--edu-first-accent) / 0.2);\n}\n\n.check-btn:disabled {\n\topacity: 0.5;\n\tcursor: not-allowed;\n}\n\n.btn {\n\tpadding: clamp(0.25rem, 0.8cqh, 0.4rem);\n\tbackground: transparent;\n\tborder: 2px solid rgb(var(--edu-border));\n\tborder-radius: var(--edu-radius);\n\tcursor: pointer;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\ttransition: all 0.2s ease;\n}\n\n.btn:hover {\t\n\tbackground: rgb(var(--edu-muted));\n\tborder-color: rgb(var(--edu-first-accent));\n\ttransform: translateY(-2px) scale(1.05);\n\tbox-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);\n}\n\n.btn:active {\n\ttransform: translateY(0) scale(0.95);\n\tbox-shadow: none;\n}\n\n.radio-nav {\n\tdisplay: none;\n\tflex-wrap: wrap;\n\tgap: 0.5rem;\n\talign-items: center;\n\tjustify-content: center;\n}\n\n.radio-nav[data-active=\"true\"] {\n\tdisplay: flex;\n}\n\n@media (max-width: 640px) {\n\t.radio-nav {\n\t\tgap: 0.35rem;\n\t}\n\n\t.radio-nav label {\n\t\tpadding: 0.4rem 0.75rem;\n\t\tfont-size: 0.875rem;\n\t}\n}\n\n.radio-nav input { display: none; }\n\n.radio-nav label {\n\tcursor: pointer;\n\ttransition: all 0.3s ease;\n\tpadding: 0.5rem 1rem;\n\tborder-radius: var(--edu-radius);\n\tborder: 1px solid rgb(var(--edu-border));\n\tbackground: rgb(var(--edu-card));\n\tcolor: rgb(var(--edu-ink));\n\tfont-weight: 500;\n}\n\n.radio-nav label:hover {\n\tborder-color: rgb(var(--edu-first-accent));\n}\n\n.radio-nav input:checked + label {\n\tbackground: rgb(var(--edu-first-accent));\n\tcolor: rgb(var(--edu-inverted-ink));\n\tborder-color: rgb(var(--edu-first-accent));\n}\n\n.actions {\n\tdisplay: flex;\n\tgap: 0.5rem;\n}\n\n.utils-container {\n\tdisplay: flex;\n\tjustify-content: space-between;\n}\n\n:host([variant=\"empty\"]) {\n\t& .wrap { background: transparent; border: none; }\n\t& header { border-bottom: none; }\n\n\t& .title {\n\t\tpadding-bottom: 5px;\n\t\tmax-width: fit-content;\n\t\tborder-bottom: 5px solid rgb(var(--edu-ink));\n\t}\n\n\t& .timer { }\n\n\t& .check-btn {\n\t\tbackground: transparent;\n\t\tcolor: rgb(var(--edu-ink));\n\t\tborder: 2px solid rgb(var(--edu-ink));\n\t\tborder-radius: 0;\n\t}\n\n\t& .check-btn:hover:not(:disabled) {\n\t\tcolor: rgb(var(--edu-inverted-ink));\n\t\tbackground: rgb(var(--edu-ink));\n\t\tborder-color: rgb(var(--edu-ink));\n\t}\n\n\t& .progress-bar::-webkit-progress-bar {background: transparent}\n\t& .progress-bar::-webkit-progress-value {background: rgb(var(--edu-ink))}\n\n\t& .radio-nav label {\n\t\tbackground: transparent;\n\t\tborder: 2px solid rgb(var(--edu-ink));\n\t\tborder-radius: 0;\n\t}\n\n\t& .radio-nav input:checked + label {\n\t\tbackground: rgb(var(--edu-ink));\n\t\tcolor: rgb(var(--edu-inverted-ink));\n\t}\n\n\t& .radio-nav label:hover { background-color: rgb(var(--edu-first-accent)) }\n}\n\n:host([variant=\"minimal\"]) {\n\t& .wrap {\n\t\tborder: 1px solid rgb(var(--edu-border));\n\t\tborder-radius: 6px;\n\t}\n\n\t& .timer {\n\t\tfont-size: 0.95rem;\n\t}\n\n\t& .check-btn {\n\t\tborder-radius: 4px;\n\t}\n\n\t& footer {\n\t\tborder-top: 1px solid rgb(var(--edu-border));\n\t}\n\n\t& .progress-bar {\n\t\theight: 1px;\n\t}\n\n\t& .progress-bar::-webkit-progress-bar {\n\t\tbackground-color: rgb(var(--edu-muted));\n\t}\n\n\t& .progress-bar::-webkit-progress-value {\n\t\tbackground-color: rgb(var(--edu-ink));\n\t}\n\n\t& .radio-nav label {\n\t\tborder-radius: 4px;\n\t}\n}\n\n:host([variant=\"elegant\"]) {\n\t& .wrap {\n\t\tborder-radius: 10px;\n\t\tbox-shadow: 0 10px 30px rgba(var(--edu-shadow-color), 0.15);\n\t}\n\n\t& .timer {\n\t\tfont-family: georgia, serif;\n\t\tfont-style: italic;\n\t\tfont-size: 1.1rem;\n\t}\n\n\t& .check-btn {\n\t\tborder-radius: 8px;\n\t\tfont-size: 1rem;\n\t}\n\n\t& footer {\n\t\tborder-top: 1px solid rgb(var(--edu-border) / 0.5);\n\t\tpadding: 1.25rem;\n\t}\n\n\t& .progress-bar {\n\t\theight: 4px;\n\t}\n\n\t& .progress-bar::-webkit-progress-value {\n\t\tbackground: linear-gradient(90deg, rgb(var(--edu-first-accent)), rgb(var(--edu-first-accent) / 0.6));\n\t}\n\n\t& .radio-nav label {\n\t\tfont-family: georgia, serif;\n\t\tborder: none;\n\t\tborder-bottom: 2px solid transparent;\n\t\tbackground: transparent;\n\t\tpadding: 0.5rem 1rem;\n\t}\n\n\t& .radio-nav input:checked + label {\n\t\tcolor: rgb(var(--edu-first-accent));\n\t\tborder-bottom: 2px solid rgb(var(--edu-first-accent));\n\t\tbackground: transparent;\n\t\tfont-style: italic;\n\t}\n\n\t& label {\n\t\tfont-family: georgia, serif;\n\t\tpadding: 0.5rem 1rem;\n\t}\n}\n\n:host([variant=\"playful\"]) {\n\t& .wrap {\n\t\tcolor: rgb(var(--edu-first-accent));\n\t\tborder-radius: 14px;\n\t\tborder: 2px dashed rgb(var(--edu-border));\n\t}\n\n\t& .timer {\n\t\tfont-weight: 700;\n\t\tfont-size: 1.2rem;\n\t}\n\n\t& .check-btn {\n\t\tborder-radius: 12px;\n\t\tfont-weight: 700;\n\t\ttext-transform: uppercase;\n\t\tletter-spacing: 0.5px;\n\t}\n\n\t& .check-btn:hover:not(:disabled) {\n\t\ttransform: translateY(-2px) rotate(-1deg);\n\t}\n\n\t& footer {\n\t\tborder-top: 2px dashed rgb(var(--edu-border));\n\t}\n\n\t& .progress-bar {\n\t\theight: 20px;\n\t}\n\n\t& .progress-bar::-webkit-progress-bar {\n\t\tbackground-color: rgb(var(--edu-warning) / 0.3);\n\t\tborder-radius: 20px;\n\t}\n\n\t& .progress-bar::-webkit-progress-value {\n\t\tbackground: rgb(var(--edu-first-accent));\n\t\tborder-radius: 20px;\n\t\tborder: 3px solid rgb(var(--edu-warning) / 0.3);\n\t}\n\n\t& .radio-nav label {\n\t\tbackground: rgb(var(--edu-muted));\n\t\tborder-radius: 50px;\n\t\tfont-weight: 700;\n\t}\n\n\t& .radio-nav label:hover {\n\t\ttransform: scale(1.1) rotate(-2deg);\n\t}\n\n\t& .radio-nav input:checked + label {\n\t\tbackground: rgb(var(--edu-first-accent));\n\t\tcolor: rgb(var(--edu-inverted-ink));\n\t\tbox-shadow: 0 5px 15px rgb(var(--edu-first-accent) / 0.4);\n\t}\n}\n\n:host([variant=\"glass\"]) {\n\t& .wrap {\n\t\tbackground: rgba(var(--edu-card), 0.7);\n\t\tbackdrop-filter: blur(10px);\n\t\tborder: 1px solid rgba(var(--edu-border), 0.35);\n\t\tborder-radius: 12px;\n\t}\n\n\t& .check-btn {\n\t\tbackground: rgba(var(--edu-first-accent), 0.9);\n\t\tbackdrop-filter: blur(5px);\n\t\tborder-radius: 10px;\n\t}\n\n\t& .check-btn:hover:not(:disabled) {\n\t\tbackground: rgba(var(--edu-first-accent), 1);\n\t}\n\n\t& footer {\n\t\tborder-top: 1px solid rgba(var(--edu-border), 0.35);\n\t}\n\n\t& .progress-bar::-webkit-progress-bar {\n\t\tbackground: rgba(var(--edu-card), 0.3);\n\t\tbackdrop-filter: blur(5px);\n\t}\n\n\t& .progress-bar::-webkit-progress-value {\n\t\tbackground: rgba(var(--edu-first-accent), 0.7);\n\t}\n\n\t& .radio-nav label {\n\t\tbackground: rgba(var(--edu-card), 0.5);\n\t\tbackdrop-filter: blur(5px);\n\t\tborder: 1px solid rgba(var(--edu-border), 0.35);\n\t}\n\n\t& .radio-nav input:checked + label {\n\t\tbackground: rgba(var(--edu-first-accent), 0.8);\n\t\tborder-color: rgb(var(--edu-first-accent));\n\t}\n}\n\n:host([variant=\"letter\"]) {\n\t& .wrap {\n\t\tborder: 1px solid rgb(var(--edu-border));\n\t\tfont-family: georgia, serif;\n\t\tbox-shadow: inset 0 0 0 1px rgba(var(--edu-shadow-color), 0.1);\n\t\tborder-radius: 4px;\n\t}\n\n\t& .timer {\n\t\tfont-family: georgia, serif;\n\t\tletter-spacing: 0.5px;\n\t}\n\n\t& .check-btn {\n\t\tfont-family: georgia, serif;\n\t\tborder-radius: 2px;\n\t\tfont-size: 0.95rem;\n\t\tletter-spacing: 0.5px;\n\t}\n\n\t& footer {\n\t\tborder-top: 1px solid rgb(var(--edu-border));\n\t\tpadding: 1rem 1.5rem;\n\t}\n\n\t& .progress-bar::-webkit-progress-bar {\n\t\tbackground-color: rgb(var(--edu-muted));\n\t\tbox-shadow: inset 0 0 0 1px rgba(var(--edu-shadow-color), 0.05);\n\t}\n\n\t& .radio-nav label {\n\t\twidth: 40px;\n\t\theight: 40px;\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: center;\n\t\tpadding: 0;\n\t\tbackground: rgb(var(--edu-third-ink));\n\t\tcolor: rgb(var(--edu-inverted-ink));\n\t\tfont-weight: 900;\n\t\tborder-radius: 4px;\n\t}\n\n\t& .radio-nav input:checked + label {\n\t\tbackground: rgb(var(--edu-first-accent));\n\t\ttransform: translateY(-4px);\n\t}\n}\n\n:host([variant=\"sign\"]) {\n\t& .wrap {\n\t\tborder-radius: 6px;\n\t\ttext-transform: uppercase;\n\t\tletter-spacing: 1px;\n\t\tborder: 2px solid rgb(var(--edu-border));\n\t}\n\n\t& .timer {\n\t\ttext-transform: uppercase;\n\t\tletter-spacing: 1.5px;\n\t\tfont-weight: 800;\n\t\tfont-size: 0.9rem;\n\t}\n\n\t& .check-btn {\n\t\ttext-transform: uppercase;\n\t\tletter-spacing: 1.5px;\n\t\tfont-weight: 800;\n\t\tfont-size: 0.9rem;\n\t\tborder-radius: 4px;\n\t\tmargin: 0.85rem 2.5rem;\n\t}\n\n\t& footer {\n\t\tborder-top: 2px solid rgb(var(--edu-border));\n\t}\n\n\t& .title {\n\t\ttext-transform: uppercase;\n\t}\n\n\t& .progress-bar {\n\t\theight: 24px;\n\t}\n\n\t& .progress-bar::-webkit-progress-bar {\n\t\tbackground: rgb(var(--edu-third-ink));\n\t\tborder: 2px solid rgb(var(--edu-third-ink));\n\t}\n\n\t& .progress-bar::-webkit-progress-value {\n\t\tbackground: rgb(var(--edu-second-accent));\n\t}\n\n\t& .radio-nav label {\n\t\tbackground: rgb(var(--edu-third-ink));\n\t\tcolor: rgb(var(--edu-second-accent));\n\t\tborder-left: 4px solid rgb(var(--edu-second-accent));\n\t\ttext-transform: uppercase;\n\t\tfont-size: 0.8rem;\n\t\tfont-weight: 700;\n\t}\n\n\t& .radio-nav input:checked + label {\n\t\tbackground: rgb(var(--edu-second-accent));\n\t\tcolor: rgb(var(--edu-third-ink));\n\t\tborder-left-color: rgb(var(--edu-third-ink));\n\t}\n}\n\n:host([variant=\"outline\"]) {\n\t& .wrap {\n\t\tcolor: rgb(var(--edu-inverted-ink));\n\t\tbackground: transparent;\n\t\tborder-width: 0 1px 2px 1px;\n\t\tborder-style: solid;\n\t\tborder-color: rgb(var(--edu-first-accent));\n\t\tbackground: rgb(var(--edu-bg) / 0.1);\n\t}\n\n\t& header { background: rgb(var(--edu-first-accent)); color: rgb(var(--edu-inverted-ink)) }\n\t& .timer { color: rgb(var(--edu-inverted-ink)) }\n\n\t& footer {\n\t\tborder-top: none;\n\t\tpadding: 0;\n\t\tpadding-left: 0.5rem;\n\t\tpadding-right: 0.5rem;\n\t}\n\n\t& .check-btn {\n\t\tfont-size: 100%;\n\t\tfont-weight: 700;\n\t\tborder: none;\n\t\tborder-radius: 0;\n\t\tborder-top-left-radius: 10px;\n\t\tborder-top-right-radius: 10px;\n\t\tcolor: rgb(var(--edu-inverted-ink));\n\t\tbackground: rgb(var(--edu-first-accent));\n\t\tmargin: 0;\n\t\tpadding: 1rem;\n\t\ttext-transform: uppercase;\n\t}\n\n\t& .check-btn:hover:not(:disabled) {\n\t\tbackground: rgb(var(--edu-first-accent) / 0.9);\n\t\tbox-shadow: 0 4px 12px rgb(var(--edu-first-accent) / 0.3);\n\t\ttransform: none;\n\t}\n\n\t& .radio-nav label {\n\t\tborder: 2px solid rgb(var(--edu-first-accent));\n\t\tborder-radius: 0;\n\t\tbackground: transparent;\n\t\tcolor: rgb(var(--edu-ink));\n\t}\n\n\t& .radio-nav label:hover {\n\t\tbackground: rgb(var(--edu-first-accent));\n\t\tcolor: rgb(var(--edu-inverted-ink));\n\t}\n\n\t& .radio-nav input:checked + label {\n\t\tbackground: rgb(var(--edu-first-accent));\n\t\tcolor: rgb(var(--edu-inverted-ink));\n\t}\n}\n\n:host([variant=\"card\"]) {\n\t& .wrap {\n\t\tborder-radius: 8px;\n\t\tbox-shadow: 0 4px 12px rgba(var(--edu-shadow-color), 0.1), 0 2px 4px rgba(var(--edu-shadow-color), 0.05);\n\t}\n\n\t& .check-btn {\n\t\tborder-radius: 6px;\n\t\tbox-shadow: 0 2px 4px rgba(var(--edu-shadow-color), 0.1);\n\t}\n\n\t& .check-btn:hover:not(:disabled) {\n\t\tbox-shadow: 0 4px 8px rgba(var(--edu-first-accent), 0.2);\n\t}\n\n\t& footer {\n\t\tborder-top: 1px solid rgb(var(--edu-border));\n\t}\n\n\t& .radio-nav label {\n\t\tborder-radius: 6px;\n\t\tbox-shadow: 0 2px 4px rgba(var(--edu-shadow-color), 0.1);\n\t}\n\n\t& .radio-nav input:checked + label {\n\t\tbox-shadow: 0 4px 8px rgba(var(--edu-first-accent), 0.2);\n\t}\n}\n", "import HTML from './index.html';\nimport CSS from './styles.css';\n\nimport { BaseInteraction } from \"../../core/BaseInteraction\";\nimport { Variant } from \"../../shared\";\nimport { InteractionData } from \"../../types/Data\";\nimport { SoundManager, AnimationsManager } from \"../../shared/managers\";\n\nexport class InteractionsBaseShell extends HTMLElement {\n\n\tstatic get observedAttributes() {\n\t\treturn ['show-header', 'show-footer'];\n\t}\n\n\tprivate soundManager: SoundManager = new SoundManager();\n\tprivate animationsManager: AnimationsManager = new AnimationsManager();\n\n\t// ==================== DOM ELEMENTS ====================\n\tprivate $titleEl!: HTMLElement;\n\tprivate $promptBtn!: HTMLButtonElement;\n\tprivate $timerEl!: HTMLElement;\n\n\tprivate $headerEl!: HTMLElement;\n\tprivate $footerEl!: HTMLElement;\n\n\tprivate $contentEl!: HTMLElement;\n\n\tprivate $checkBtn!: HTMLButtonElement;\n\tprivate $seeAnswersBtn!: HTMLButtonElement;\n\tprivate $scoresBtn!: HTMLButtonElement;\n\tprivate $retryBtn!: HTMLButtonElement;\n\n\tprivate $radioNav!: HTMLElement;\n\n\tprivate $progressContainer!: HTMLDivElement;\n\tprivate $progressBar!: HTMLProgressElement;\n\tprivate $progressIcon!: HTMLImageElement;\n\tprivate $progressCounter!: HTMLSpanElement;\n\n\t// Screen elements\n\tprivate $interactionScreen!: HTMLElement;\n\tprivate $errorContent!: HTMLElement;\n\tprivate $attemptsMessage!: HTMLElement;\n\tprivate $scoreDisplay!: HTMLElement;\n\tprivate $timerDisplay!: HTMLElement;\n\n\t// ==================== STATE ====================\n\tprivate interaction?: BaseInteraction<any>;\n\tprivate timerInterval: number | null = null;\n\tprivate remainingSeconds: number = 0;\n\tprivate interactionComplete = false;\n\tprivate attemptCount: number = 0;\n\tprivate attemptLimit: number | null = null;\n\n\tprivate currentScreen: 'interaction' | 'error' | 'solution' | 'attempts' | 'score' | 'time' = 'interaction';\n\n\t// ==================== CONSTRUCTOR ====================\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis.attachShadow({ mode: 'open' });\n\n\t\tconst style = document.createElement('style');\n\t\tstyle.textContent = CSS;\n\t\tthis.shadowRoot!.append(style);\n\n\t\tconst wrap = document.createElement('section');\n\t\twrap.className = \"wrap\";\n\t\twrap.innerHTML = HTML;\n\t\tthis.shadowRoot!.append(wrap);\n\n\t\tAnimationsManager.injectKeyframes(this.shadowRoot);\n\n\t\t// Cache\n\t\tthis.$headerEl = wrap.querySelector('header')!;\n\t\tthis.$footerEl = wrap.querySelector('footer')!;\n\n\t\tthis.$titleEl = wrap.querySelector('.title')!;\n\t\tthis.$promptBtn = wrap.querySelector('.prompt-btn');\n\t\tthis.$timerEl = wrap.querySelector('.timer')!;\n\n\t\tthis.$checkBtn = wrap.querySelector('.check-btn')!;\n\t\tthis.$scoresBtn = wrap.querySelector('.scores-btn');\n\t\tthis.$seeAnswersBtn = wrap.querySelector('.see-answers-btn')!;\n\t\tthis.$retryBtn = wrap.querySelector('.retry-btn')!;\n\n\t\tthis.$radioNav = wrap.querySelector('.radio-nav')!;\n\n\t\tthis.$progressContainer = wrap.querySelector('.progress-container');\n\t\tthis.$progressBar = wrap.querySelector('.progress-bar')!;\n\t\tthis.$progressIcon = wrap.querySelector('.progress-icon-wrapper')!;\n\t\tthis.$progressCounter = wrap.querySelector('.progress-counter')!;\n\n\t\tthis.$contentEl = wrap.querySelector('[part=\"content\"]')!;\n\n\t\t\n\t\tthis.animationsManager.isEnabled = true; \n\n\t\t// Cache\n\t\tthis.$interactionScreen = wrap.querySelector('[data-screen=\"interaction\"]')!;\n\t\tthis.$errorContent = wrap.querySelector('.error-content')!;\n\t\tthis.$attemptsMessage = wrap.querySelector('.attempts-message')!;\n\t\tthis.$scoreDisplay = wrap.querySelector('.score-display')!;\n\t\tthis.$timerDisplay = wrap.querySelector('.timer-display');\n\n\t\tthis.setupShellListeners();\n}\n\n\t// ==================== LIFECYCLE ====================\n\tconnectedCallback() {\n\t\tif (!this.hasAttribute(\"show-header\")) this.setAttribute(\"show-header\", \"true\");\n\t\tif (!this.hasAttribute(\"show-footer\")) this.setAttribute(\"show-footer\", \"true\");\n\n\t\tthis.updateVisibility();\n\n\t\tthis.animationsManager.animate(this.$progressIcon, 'heartbeat');\n\t\tthis.animationsManager.animate(this.$promptBtn, 'wobble');\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.stopTimer();\n\t\tthis.removeInteractionListeners();\n\t}\n\n\tattributeChangedCallback(name: string, oldValue: string, newValue: string) {\n\t\tif (oldValue === newValue) return;\n\t\tthis.updateVisibility();\n\t}\n\t\n\t// ==================== INTERACTION MANAGEMENT ====================\n\tpublic setInteraction<T extends InteractionData>(interaction: BaseInteraction<T>): void {\n\t\t\n\t\tthis.stopTimer();\n\n\t\tif (!interaction.isValid) {\n\t\t\tthis.$errorContent.textContent = interaction.errors ?? 'Error loading the interaction.';\n\t\t\tthis.switchScreen('error');\n\t\t\treturn;\n\t\t}\n\n\t\tthis.soundManager.playSound('start');\n\t\t\n\t\tif (this.interaction) {\n\t\t\tthis.removeInteractionListeners();\n\t\t\tthis.$interactionScreen.innerHTML = '';\n\t\t}\n\t\t\n\t\tthis.interaction = interaction;\n\t\tthis.interactionComplete = false;\n\t\tconst cfg = this.interaction.config;\n\n\t\tthis.reset();\n\t\tthis.switchScreen('interaction');\n\t\t\n\t\tconst variant = cfg.variant ?? 'elegant';\n\t\tthis.setAttribute('variant', variant);\n\t\tthis.interaction.onVariantChange(variant);\n\n\t\tthis.$titleEl.textContent = cfg.prompt || '';\n\t\tif (cfg.promptData && cfg.promptModality) {\n\t\t\tthis.$titleEl.style.cursor = 'pointer';\n\t\t\tthis.$titleEl.title = 'Click to view prompt details';\n\n\t\t\tthis.$promptBtn.addEventListener('click', () => this.openPromptDialog());\n\t\t\tthis.$titleEl.addEventListener('click', () => this.openPromptDialog());\n\t\t} else {\n\t\t\tthis.$titleEl.style.cursor = '';\n\t\t\tthis.$titleEl.style.textDecoration = '';\n\t\t\tthis.$titleEl.title = '';\n\t\t}\n\t\t\n\t\t// render error screen if time too low?\n\t\tif (cfg.timer !== null && cfg.timer > 30) {\n\t\t\tthis.remainingSeconds = cfg.timer;\n\t\t\tthis.$timerEl.classList.remove('edu-hidden');\n\t\t\tthis.updateTimerDisplay();\n\t\t\tthis.startTimer();\n\t\t} else this.$timerEl.classList.add('edu-hidden');\n\n\t\tthis.attemptLimit = cfg.attemptLimit;\n\t\tthis.attemptCount = 0;\n\t\t\n\t\t// TODO: update to use the 'isSequential' flag instead\n\t\tif (this.interaction.interactionMechanic === 'sequential') {\n\t\t\tthis.$radioNav.dataset.active = 'true';\n\t\t\tthis.renderRadioNav();\n\t\t} else this.$radioNav.dataset.active = 'false';\n\n\t\tif (!this.interaction.implementsProgress) {\n\t\t\tthis.$progressContainer.classList.add('edu-hidden');\n\t\t\tthis.$checkBtn.classList.remove('edu-hidden');\n\t\t} else {\n\t\t\tthis.$checkBtn.classList.add('edu-hidden');\n\t\t\tthis.$progressContainer.classList.remove('edu-hidden');\n\t\t\tthis.$progressCounter.textContent = `0/${this.interaction.progressTracker.total}`;\n\t\t}\n\n\t\tthis.setupInteractionListeners();\n\n\t\tthis.$interactionScreen.innerHTML = '';\n\t\tthis.$interactionScreen.appendChild(interaction);\n\t}\n\n\tpublic removeInteraction(): void {\n\t\tif (this.interaction) {\n\t\t\tthis.removeInteractionListeners();\n\t\t\tthis.$interactionScreen.innerHTML = '';\n\t\t\tthis.interaction = undefined;\n\t\t\tthis.interactionComplete = false;\n\t\t}\n\t}\n\n\t// ==================== EVENT LISTENERS ====================\n\tprivate setupShellListeners(): void {\n\t\tthis.$checkBtn.addEventListener('click', () => {\n\t\t\tthis.soundManager.playSound('pop');\n\t\t\ttry {\n\t\t\t\tthis.interaction.submit();\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error('Submit failed:', error);\n\t\t\t}\n\t\t});\n\n\t\tthis.$seeAnswersBtn.addEventListener('click', () => {\n\t\t\tthis.soundManager.playSound('pop');\n\t\t\tif (this.currentScreen === 'solution') this.switchScreen('interaction');\n\t\t\telse this.switchScreen('solution');\n\t\t});\n\n\t\tthis.$scoresBtn.addEventListener('click', () => {\n\t\t\tthis.soundManager.playSound('pop');\n\t\t\tif (this.currentScreen === 'score') this.switchScreen('interaction');\n\t\t\telse this.switchScreen('score');\n\t\t});\n\n\t\tthis.$timerEl.addEventListener('click', () => {\n\t\t\tthis.soundManager.playSound('pop');\n\t\t\tthis.$timerDisplay.append(this.$timerEl);\n\t\t\tif (this.currentScreen === 'time') { \n\t\t\t\tthis.switchScreen('interaction');\n\t\t\t\tthis.$headerEl.append(this.$timerEl);\n\t\t\t}\n\t\t\telse this.switchScreen('time');\n\t\t});\n\n\t\tthis.$retryBtn.addEventListener('click', () => this.handleRetry());\n\n\t\tthis.$radioNav.addEventListener('change', (e) => {\n\t\t\tconst target = e.target as HTMLInputElement;\n\n\t\t\tif (target.type === 'radio') {\n\t\t\t\tconst stepIndex = parseInt(target.id.replace('step-', ''), 10);\n\n\t\t\t\tif (this.interaction) this.interaction.setSteps(stepIndex);\n\n\t\t\t\tthis.dispatchEvent(new CustomEvent('navigation-change', {\n\t\t\t\t\tdetail: { step: stepIndex },\n\t\t\t\t\tbubbles: true,\n\t\t\t\t\tcomposed: true\n\t\t\t\t}));\n\t\t\t}\n\t\t});\n\t}\n\t\n\tprivate setupInteractionListeners(): void {\n\n\t\tthis.interaction.addEventListener('interaction:ready', ((e: CustomEvent) => {\n\t\t\tconsole.log('[Shell] Interaction ready:', e.detail.id);\n\t\t}) as EventListener);\n\n\t\tthis.interaction.addEventListener('interaction:progress', ((e: CustomEvent) => {\n\t\t\tconst { current, total, percentage } = e.detail;\n\t\t\tthis.updateProgress(current, total);\n\n\t\t\tif (current === total && total > 0) {\n\t\t\t\tthis.interactionComplete = true;\n\t\t\t\tthis.$checkBtn.classList.remove('edu-hidden');\n\t\t\t} else {\n\t\t\t\tthis.interactionComplete = false;\n\t\t\t\tif (this.interaction.implementsProgress) this.$checkBtn.classList.add('edu-hidden');\n\t\t\t}\n\t\t}) as EventListener);\n\n\t\tthis.interaction.addEventListener('interaction:complete', ((e: CustomEvent) => {\n\t\t\tconsole.log('[Shell] Interaction complete:', e.detail);\n\t\t\tthis.stopTimer();\n\t\t\tthis.handleCompletion(e.detail.state);\n\t\t}) as EventListener);\n\n\t\tthis.interaction.addEventListener('interaction:graded', ((e: CustomEvent) => {\n\t\t\tif (e.detail.result.score === 100) {\n\t\t\t\tthis.soundManager.playSound('success');\t\n\t\t\t\tthis.animationsManager.animate(this.$progressIcon, 'spin-pulse');\n\t\t\t} else {\n\t\t\t\tthis.soundManager.playSound('failure');\n\t\t\t\tthis.animationsManager.animate(this.$progressIcon, 'shake');\n\t\t\t};\n\n\t\t\tthis.handleGraded(e.detail.result);\n\t\t}) as EventListener);\n\n\t\tthis.interaction.addEventListener('interaction:hint-shown', ((e: CustomEvent) => {\n\t\t\tconsole.log('[Shell] Hint shown:', e.detail.message);\n\t\t}) as EventListener);\n\n\t\tthis.interaction.addEventListener('interaction:error', ((e: CustomEvent) => {\n\t\t\tconsole.error('[Shell] Interaction error:', e.detail);\n\t\t\talert(e.detail.message);\n\t\t}) as EventListener);\n\t}\n\n\tprivate removeInteractionListeners(): void {}\n\n\t// ==================== UI UPDATES ====================\n\n\tprivate updateProgress(current: number, total: number): void {\n\t\tthis.$progressBar.max = total;\n\t\tthis.$progressBar.value = current ?? 0;\n\n\t\tthis.$progressCounter.textContent = `${current}/${total}`;\n\n\t\tconst percentage = total > 0 ? (current / total) * 100 : 0;\n\t\tconst progressBarWidth = this.$progressBar.offsetWidth;\n\t\tconst iconPosition = (progressBarWidth * percentage) / 100 - 12; // Center icon on tip\n\t\tthis.$progressIcon.style.left = `${Math.max(0, iconPosition)}px`;\n\t}\n\n\tprivate handleCompletion(state: any): void {\n\t\tthis.dispatchEvent(new CustomEvent('shell:interaction-complete', {\n\t\t\tdetail: { state },\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\t\tconsole.log('[Shell] Interaction submitted with state:', state);\n\t}\n\n\tprivate handleGraded(result: any): void {\n\n\t\tthis.$checkBtn.classList.add('edu-hidden');\n\t\tthis.$seeAnswersBtn.classList.remove('edu-hidden');\n\t\tthis.$scoresBtn.classList.remove('edu-hidden');\n\t\tthis.$retryBtn.classList.remove('edu-hidden');\n\t\t\n\t\tif (this.attemptLimit && this.attemptCount > this.attemptLimit) {\n\t\t\tthis.$retryBtn.classList.add('edu-hidden');\n\t\t}\n\n\t\tconst score = result.score;\n\t\tthis.$scoreDisplay.innerHTML = `\n\t\t\t<div style=\"font-size: 4rem; font-weight: 700; color: ${score >= 75 ? 'rgb(var(--edu-success))' : score >= 50 ? 'rgba(139, 195, 74)' : score >= 25 ? 'rgb(var(--edu-warning))' : 'rgb(var(--edu-error))'}\">${score}%</div>\n\t\t\t<div style=\"font-size: 1.5rem; margin-top: 1rem; color: rgb(var(--edu-second-ink));\">\n\t\t\t\t${score === 100 ? 'Perfect Score! \uD83C\uDF89' : score >= 75 ? 'Great Job!' : score >= 50 ? 'Good Effort!' : score >= 25 ? 'Keep Trying!' : 'Try Again!'}\n\t\t\t</div>\n\t\t`;\n\n\t\tthis.$progressIcon.classList.remove('score-fail', 'score-low', 'score-mid', 'score-high');\n\t\tthis.$progressBar.classList.remove('score-fail', 'score-low', 'score-mid', 'score-high');\n\n\t\tlet scoreClass = '';\n\t\tif (score <= 25) {\n\t\t\tscoreClass = 'score-fail';\n\t\t} else if (score <= 50) {\n\t\t\tscoreClass = 'score-low';\n\t\t} else if (score <= 75) {\n\t\t\tscoreClass = 'score-mid';\n\t\t} else {\n\t\t\tscoreClass = 'score-high';\n\t\t}\n\n\t\tthis.$progressIcon.classList.add(scoreClass);\n\t\tthis.$progressBar.classList.add(scoreClass);\n\t}\n\n\tprivate reset() {\n\t\tthis.resetTimer();\n\n\t\tif (!this.interaction.implementsProgress) {\n\t\t\tthis.$checkBtn.classList.remove('edu-hidden');\n\t\t}\n\n\t\tthis.$seeAnswersBtn.classList.add('edu-hidden');\n\t\tthis.$scoresBtn.classList.add('edu-hidden');\n\t\tthis.$retryBtn.classList.add('edu-hidden');\n\n\t\tthis.$progressIcon.classList.remove('score-fail', 'score-low', 'score-mid', 'score-high');\n\t\tthis.$progressBar.classList.remove('score-fail', 'score-low', 'score-mid', 'score-high');\n\n\t\tthis.animationsManager.animate(this.$progressIcon, 'heartbeat');\n\n\t\tthis.$progressBar.value = 0;\n\t\tthis.updateProgress(0, this.interaction.progressTracker.total);\n\n\t\tif (this.interaction.interactionMechanic === 'sequential') this.renderRadioNav();\n\t}\n\n\tprivate handleRetry(): void {\n\t\t// only this one. others can stay there\n\t\tthis.$retryBtn.classList.add('edu-hidden');\n\n\t\tthis.soundManager.playSound('pop');\n\t\tthis.attemptCount++;\n\n\t\tif (this.attemptLimit && this.attemptLimit > 0) {\n\t\t\tconst remaining = this.attemptLimit - this.attemptCount + 1;\n\n\t\t\tthis.$attemptsMessage.textContent = `${remaining} attempt${remaining !== 1 ? 's' : ''} remaining`;\n\t\t\tthis.switchScreen('attempts');\n\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis.switchScreen('interaction');\n\t\t\t\tthis.reset();\n\t\t\t\tthis.resumeTimer();\n\t\t\t\tthis.interaction?.reset();\n\t\t\t\tthis.soundManager.playSound('flip');\n\t\t\t}, 2000);\n\t\t} else {\n\t\t\tthis.switchScreen('interaction');\n\t\t\tthis.interaction?.reset();\n\t\t}\n\t}\n\n\tprivate openPromptDialog(): void {\n\t\tconst config = this.interaction?.config;\n\t\tif (!config) return;\n\n\t\tthis.soundManager.playSound('pop');\n\n\t\tlet dialog = document.querySelector('edu-dialog#prompt-dialog') as any;\n\t\tif (!dialog) {\n\t\t\tdialog = document.createElement('edu-dialog');\n\t\t\tdialog.id = 'prompt-dialog';\n\t\t\tdocument.body.appendChild(dialog);\n\t\t}\n\n\t\tdialog.title = config.construct || this.interaction?.config.promptModality || 'Prompt';\n\n\t\tconst media = document.createElement('edu-media');\n\t\tmedia.setAttribute('type', config.promptModality!);\n\t\tmedia.setAttribute('data', config.promptData!);\n\t\tif (config.promptDataSpec) {\n\t\t\tmedia.setAttribute('spec', config.promptDataSpec);\n\t\t}\n\n\t\tdialog.innerHTML = '';\n\t\tdialog.appendChild(media);\n\t\tdialog.open();\n\t}\n\n\t// ==================== SCREEN MANAGEMENT ====================\n\n\tprivate switchScreen(screenName: 'time' | 'interaction' | 'error' | 'solution' | 'attempts' | 'score'): void {\n\t\tthis.shadowRoot!.querySelectorAll('.screen').forEach(screen => {\n\t\t\tconst name = screen.getAttribute('data-screen');\n\t\t\t(screen as HTMLElement).style.display = name === screenName ? 'block' : 'none';\n\t\t});\n\n\t\tthis.currentScreen = screenName;\n\t\tconsole.log(`[Shell] Switched to screen: ${screenName}`);\n\t}\n\n\t// ==================== TIMER MANAGEMENT ====================\n\n\tprivate startTimer(): void {\n\t\tthis.timerInterval = window.setInterval(() => {\n\t\t\tthis.remainingSeconds--;\n\t\t\tthis.updateTimerDisplay();\n\n\t\t\tif (this.remainingSeconds <= 0) {\n\t\t\t\tthis.stopTimer();\n\t\t\t\tthis.handleTimerComplete();\n\t\t\t}\n\t\t}, 1000);\n\t}\n\n\tprivate stopTimer(): void {\n\t\tif (this.timerInterval !== null) {\n\t\t\tclearInterval(this.timerInterval);\n\t\t\tthis.timerInterval = null;\n\t\t}\n\t}\n\n\tprivate getFormattedTime(time: number): string {\n\t\tconst minutes = Math.floor(time / 60);\n\t\tconst seconds = time % 60;\n\t\tconst formattedTime = `${minutes}:${seconds.toString().padStart(2, '0')}`;\n\t\treturn formattedTime;\n\t}\n\n\tprivate updateTimerDisplay(): void {\n\t\tthis.$timerEl.textContent = this.getFormattedTime(this.remainingSeconds);\n\n\t\tif (this.remainingSeconds === 30) {\n\t\t\tthis.soundManager.playSound('low-time');\n\t\t\tthis.animationsManager.animate(this.$timerEl, 'shake')\n\t\t}\n\n\t\tdelete this.$timerEl.dataset.warning;\n\t\tdelete this.$timerEl.dataset.danger;\n\n\t\tif (this.remainingSeconds <= 10) this.$timerEl.dataset.danger = 'true';\n\t\telse if (this.remainingSeconds <= 30) this.$timerEl.dataset.warning = 'true';\n\t}\n\n\tprivate handleTimerComplete(): void {\n\t\tconsole.log('[Shell] Timer complete');\n\n\t\ttry {\n\t\t\tthis.interaction.submit();\n\t\t} catch (error) {\n\t\t\tconsole.error('Auto-submit on timer failed:', error);\n\t\t}\n\n\t\tthis.dispatchEvent(new CustomEvent('shell:timer-complete', {\n\t\t\tbubbles: true,\n\t\t\tcomposed: true\n\t\t}));\n\t}\n\n\tpublic pauseTimer(): void {\n\t\tthis.stopTimer();\n\t}\n\n\tpublic resumeTimer(): void {\n\t\tif (this.remainingSeconds > 0 && this.timerInterval === null) {\n\t\t\tthis.startTimer();\n\t\t}\n\t}\n\n\tpublic resetTimer(): void {\n\t\tthis.stopTimer();\n\t\tthis.remainingSeconds = this.interaction.config.timer;\n\t\tthis.updateTimerDisplay();\n\t}\n\n\t// ==================== DISPLAY UPDATES ====================\n\n\tprivate updateVisibility(): void {\n\t\tconst showHeader = this.getAttribute('show-header') !== 'false';\n\t\tconst showFooter = this.getAttribute('show-footer') !== 'false';\n\n\t\tthis.$headerEl.style.display = showHeader ? '' : 'none';\n\t\tthis.$footerEl.style.display = showFooter ? '' : 'none';\n\t}\n\n\tprivate renderRadioNav(): void {\n\t\tconst count = this.interaction && 'slidesCount' in this.interaction\n\t\t\t? (this.interaction as any).slidesCount\n\t\t\t: 1;\n\n\t\tthis.$radioNav.innerHTML = '';\n\n\t\tfor (let i = 1; i <= count; i++) {\n\t\t\tconst input = document.createElement('input');\n\t\t\tinput.type = 'radio';\n\t\t\tinput.name = 'step-nav';\n\t\t\tinput.id = `step-${i}`;\n\t\t\tif (i === 1) input.checked = true;\n\n\t\t\tconst label = document.createElement('label');\n\t\t\tlabel.htmlFor = `step-${i}`;\n\t\t\tlabel.textContent = String(i);\n\n\t\t\tthis.$radioNav.appendChild(input);\n\t\t\tthis.$radioNav.appendChild(label);\n\t\t}\n\t}\n\n\t// ==================== PUBLIC API ====================\n\n\tpublic getContentArea(): HTMLElement {\n\t\treturn this.$contentEl;\n\t}\n}\n\nif (!customElements.get('edu-window')) {\n\tcustomElements.define('edu-window', InteractionsBaseShell);\n}\n"],
|
|
5
|
+
"mappings": "AAcO,IAAMA,GAAN,KAAsB,CAAtB,cAEN,KAAQ,SAAW,EACnB,KAAO,OAAS,EAKhB,WAAWC,EAAqB,CAC/B,GAAIA,EAAQ,EACX,MAAM,IAA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K,CAChC,IAAMC,EAAQ,SAAS,cAAc,OAAO,EAC5CA,EAAM,KAAO,QACbA,EAAM,KAAO,WACbA,EAAM,GAAK,QAAQD,CAAC,GAChBA,IAAM,IAAGC,EAAM,QAAU,IAE7B,IAAMC,EAAQ,SAAS,cAAc,OAAO,EAC5CA,EAAM,QAAU,QAAQF,CAAC,GACzBE,EAAM,YAAc,OAAOF,CAAC,EAE5B,KAAK,UAAU,YAAYC,CAAK,EAChC,KAAK,UAAU,YAAYC,CAAK,CACjC,CACD,CAIO,gBAA8B,CACpC,OAAO,KAAK,UACb,CACD,EAEK,eAAe,IAAI,YAAY,GACnC,eAAe,OAAO,aAAcvC,EAAqB",
|
|
6
|
+
"names": ["ProgressTracker", "total", "value", "KEYFRAMES", "DEFAULT_CONFIG", "AnimationsManager", "shadowRoot", "styleEl", "element", "animationName", "options", "duration", "timing", "iterations", "delay", "animation", "durationMs", "SoundManager", "base", "soundNameOrUrl", "options", "url", "audio", "error", "err", "sounds", "promises", "sound", "volume", "clampedVolume", "filename", "loaded", "resolve", "reject", "timeout", "cleanup", "targetVolume", "duration", "startVolume", "volumeDelta", "startTime", "fade", "elapsed", "progress", "soundManager", "BaseInteraction", "data", "config", "assets", "validator", "validationResult", "k", "v", "ProgressTracker", "SoundManager", "AnimationsManager", "total", "current", "progress", "message", "error", "newVariant", "steps", "variant", "HTML", "EduBlock", "AnimationsManager", "v", "newAccent", "chip_default", "styles_default", "HTML", "EduDialog", "e", "footerSlot", "hasFooterContent", "name", "oldValue", "newValue", "html", "value", "setUpChipData", "key", "chip", "assets", "ref", "asset", "modality", "EduChip", "chip_default", "style", "styles_default", "EduDialog", "AnimationsManager", "pressed", "data", "v", "force", "setUpQuestionData", "questionString", "container", "assets", "ref", "asset", "renderDialogTrigger", "renderInlineWithExpand", "button", "labels", "openAssetInDialog", "wrapper", "media", "spec", "expandBtn", "dialog", "titles", "EduMedia", "name", "oldValue", "newValue", "soundManager", "size", "span", "videoAttrs", "video", "fromSeconds", "toSeconds", "volume", "loop", "error", "timeStr", "parts", "p", "CSS", "ALLOWED_TAGS", "EduInput", "name", "oldValue", "newValue", "as", "tag", "styleEl", "control", "attr", "filtered", "node", "text", "v", "basicTableDataParser", "code", "rows", "cols", "answerKey", "errors", "categoryPattern", "matches", "seen", "match", "rawCategory", "rawItems", "category", "items", "s", "item", "data", "adjacencyTableDataParser", "categories", "rawData", "rawValues", "values", "n", "expected", "i", "rowCategory", "valueIndex", "j", "colCategory", "rawValue", "cellValue", "num", "lookupTableDataParser", "headerPattern", "headerMatch", "rowPattern", "rowMatches", "seenRows", "rawRow", "row", "col", "basicTableDataValidator", "data", "preset", "errors", "answerKey", "col", "items", "seen", "item", "membership", "arr", "row", "cats", "adjacencyTableDataValidator", "rowSet", "colSet", "diagValue", "lookupTableDataValidator", "getAllValues", "answerKey", "values", "rowData", "value", "getAllUniqueValues", "detectCellKind", "uniqueValues", "v", "compareValues", "expected", "actual", "naryTableGrader", "answerKey", "userData", "rows", "correctCount", "totalCount", "row", "userSelected", "correctColumn", "col", "items", "lookupTableGrader", "cols", "expected", "userValue", "compareValues", "classificationTableGrader", "totalCorrectSelections", "totalPossibleSelections", "correctColumns", "shouldBeSelected", "wasSelected", "adjacencyTableGrader", "getAdjacencyCellGrading", "cellStates", "getLookupCellGrading", "getClassificationCellGrading", "getNaryCellGrading", "selectedCol", "styles_default", "isNothing", "subject", "isObject", "toArray", "sequence", "extend", "target", "source", "index", "length", "key", "sourceKeys", "repeat", "string", "count", "result", "cycle", "isNegativeZero", "number", "isNothing_1", "isObject_1", "toArray_1", "repeat_1", "isNegativeZero_1", "extend_1", "common", "formatError", "exception", "compact", "where", "message", "YAMLException$1", "reason", "mark", "getLine", "buffer", "lineStart", "lineEnd", "position", "maxLineLength", "head", "tail", "maxHalfLength", "padStart", "max", "makeSnippet", "options", "re", "lineStarts", "lineEnds", "match", "foundLineNo", "i", "line", "lineNoLength", "snippet", "TYPE_CONSTRUCTOR_OPTIONS", "YAML_NODE_KINDS", "compileStyleAliases", "map", "style", "alias", "Type$1", "tag", "name", "data", "type", "compileList", "schema", "currentType", "newIndex", "previousType", "previousIndex", "compileMap", "collectType", "Schema$1", "definition", "implicit", "explicit", "type$1", "str", "seq", "failsafe", "resolveYamlNull", "constructYamlNull", "isNull", "object", "_null", "resolveYamlBoolean", "constructYamlBoolean", "isBoolean", "bool", "isHexCode", "c", "isOctCode", "isDecCode", "resolveYamlInteger", "hasDigits", "ch", "constructYamlInteger", "value", "sign", "isInteger", "int", "obj", "YAML_FLOAT_PATTERN", "resolveYamlFloat", "constructYamlFloat", "SCIENTIFIC_WITHOUT_DOT", "representYamlFloat", "res", "isFloat", "float", "json", "core", "YAML_DATE_REGEXP", "YAML_TIMESTAMP_REGEXP", "resolveYamlTimestamp", "constructYamlTimestamp", "year", "month", "day", "hour", "minute", "second", "fraction", "delta", "tz_hour", "tz_minute", "date", "representYamlTimestamp", "timestamp", "resolveYamlMerge", "merge", "BASE64_MAP", "resolveYamlBinary", "code", "idx", "bitlen", "constructYamlBinary", "tailbits", "input", "bits", "representYamlBinary", "isBinary", "binary", "_hasOwnProperty$3", "_toString$2", "resolveYamlOmap", "objectKeys", "pair", "pairKey", "pairHasKey", "constructYamlOmap", "omap", "_toString$1", "resolveYamlPairs", "keys", "constructYamlPairs", "pairs", "_hasOwnProperty$2", "resolveYamlSet", "constructYamlSet", "set", "_default", "_hasOwnProperty$1", "CONTEXT_FLOW_IN", "CONTEXT_FLOW_OUT", "CONTEXT_BLOCK_IN", "CONTEXT_BLOCK_OUT", "CHOMPING_CLIP", "CHOMPING_STRIP", "CHOMPING_KEEP", "PATTERN_NON_PRINTABLE", "PATTERN_NON_ASCII_LINE_BREAKS", "PATTERN_FLOW_INDICATORS", "PATTERN_TAG_HANDLE", "PATTERN_TAG_URI", "_class", "is_EOL", "is_WHITE_SPACE", "is_WS_OR_EOL", "is_FLOW_INDICATOR", "fromHexCode", "lc", "escapedHexLen", "fromDecimalCode", "simpleEscapeSequence", "charFromCodepoint", "setProperty", "simpleEscapeCheck", "simpleEscapeMap", "State$1", "generateError", "state", "throwError", "throwWarning", "directiveHandlers", "args", "major", "minor", "handle", "prefix", "captureSegment", "start", "end", "checkJson", "_position", "_length", "_character", "_result", "mergeMappings", "destination", "overridableKeys", "quantity", "storeMappingPair", "keyTag", "keyNode", "valueNode", "startLine", "startLineStart", "startPos", "readLineBreak", "skipSeparationSpace", "allowComments", "checkIndent", "lineBreaks", "testDocumentSeparator", "writeFoldedLines", "readPlainScalar", "nodeIndent", "withinFlowCollection", "preceding", "following", "captureStart", "captureEnd", "hasPendingContent", "_line", "_lineStart", "_lineIndent", "_kind", "readSingleQuotedScalar", "readDoubleQuotedScalar", "hexLength", "hexResult", "tmp", "readFlowCollection", "readNext", "_pos", "_tag", "_anchor", "terminator", "isPair", "isExplicitPair", "isMapping", "composeNode", "readBlockScalar", "folding", "chomping", "didReadContent", "detectedIndent", "textIndent", "emptyLines", "atMoreIndented", "readBlockSequence", "detected", "readBlockMapping", "flowIndent", "allowCompact", "_keyLine", "_keyLineStart", "_keyPos", "atExplicitKey", "readTagProperty", "isVerbatim", "isNamed", "tagHandle", "tagName", "readAnchorProperty", "readAlias", "parentIndent", "nodeContext", "allowToSeek", "allowBlockStyles", "allowBlockScalars", "allowBlockCollections", "indentStatus", "atNewLine", "hasContent", "typeIndex", "typeQuantity", "typeList", "blockIndent", "readDocument", "documentStart", "directiveName", "directiveArgs", "hasDirectives", "loadDocuments", "nullpos", "loadAll$1", "iterator", "documents", "load$1", "loadAll_1", "load_1", "loader", "_toString", "_hasOwnProperty", "CHAR_BOM", "CHAR_TAB", "CHAR_LINE_FEED", "CHAR_CARRIAGE_RETURN", "CHAR_SPACE", "CHAR_EXCLAMATION", "CHAR_DOUBLE_QUOTE", "CHAR_SHARP", "CHAR_PERCENT", "CHAR_AMPERSAND", "CHAR_SINGLE_QUOTE", "CHAR_ASTERISK", "CHAR_COMMA", "CHAR_MINUS", "CHAR_COLON", "CHAR_EQUALS", "CHAR_GREATER_THAN", "CHAR_QUESTION", "CHAR_COMMERCIAL_AT", "CHAR_LEFT_SQUARE_BRACKET", "CHAR_RIGHT_SQUARE_BRACKET", "CHAR_GRAVE_ACCENT", "CHAR_LEFT_CURLY_BRACKET", "CHAR_VERTICAL_LINE", "CHAR_RIGHT_CURLY_BRACKET", "ESCAPE_SEQUENCES", "DEPRECATED_BOOLEANS_SYNTAX", "DEPRECATED_BASE60_SYNTAX", "compileStyleMap", "encodeHex", "character", "QUOTING_TYPE_SINGLE", "QUOTING_TYPE_DOUBLE", "State", "indentString", "spaces", "ind", "next", "generateNextLine", "level", "testImplicitResolving", "isWhitespace", "isPrintable", "isNsCharOrWhitespace", "isPlainSafe", "prev", "inblock", "cIsNsCharOrWhitespace", "cIsNsChar", "isPlainSafeFirst", "isPlainSafeLast", "codePointAt", "pos", "first", "needIndentIndicator", "leadingSpaceRe", "STYLE_PLAIN", "STYLE_SINGLE", "STYLE_LITERAL", "STYLE_FOLDED", "STYLE_DOUBLE", "chooseScalarStyle", "singleLineOnly", "indentPerLevel", "lineWidth", "testAmbiguousType", "quotingType", "forceQuotes", "char", "prevChar", "hasLineBreak", "hasFoldableLine", "shouldTrackWidth", "previousLineBreak", "plain", "writeScalar", "iskey", "indent", "testAmbiguity", "blockHeader", "dropEndingNewline", "foldString", "escapeString", "indentIndicator", "clip", "keep", "chomp", "width", "lineRe", "nextLF", "foldLine", "prevMoreIndented", "moreIndented", "breakRe", "curr", "escapeSeq", "writeFlowSequence", "writeNode", "writeBlockSequence", "writeFlowMapping", "objectKeyList", "objectKey", "objectValue", "pairBuffer", "writeBlockMapping", "explicitPair", "detectType", "block", "isblockseq", "tagStr", "objectOrArray", "duplicateIndex", "duplicate", "getDuplicateReferences", "objects", "duplicatesIndexes", "inspectNode", "dump$1", "dump_1", "dumper", "renamed", "from", "to", "Type", "Schema", "FAILSAFE_SCHEMA", "JSON_SCHEMA", "CORE_SCHEMA", "DEFAULT_SCHEMA", "load", "loadAll", "dump", "YAMLException", "types", "safeLoad", "safeLoadAll", "safeDump", "jsYaml", "randomHexColorsList", "shuffle", "array", "currentIndex", "randomIndex", "hash", "str", "seed", "h1", "h2", "ch", "escapeHtml", "s", "m", "parseYamlAssets", "yamlText", "jsYaml", "err", "isString", "v", "isNumber", "looksLikeTime", "typeOf", "isPlainObject", "splitByPipes", "input", "dedupe", "arr", "isOneOf", "value", "allowed", "escapeAttr", "s", "escapeHtml", "EduTable", "e", "t", "r", "c", "kind", "value", "wrap", "v", "next", "config", "completion", "rowVals", "selectedCols", "name", "oldValue", "newValue", "state", "cols", "shuffle", "header", "body", "cells", "styles_default", "id", "hash", "gradingState", "gradingClass", "baseTd", "controlHtml", "common", "checked", "opts", "selected", "optionsHtml", "sel", "allowed", "col", "row", "detail", "MCQ_PATTERN", "NUMBER_PATTERN", "DATE_PATTERN", "TIME_PATTERN", "parseTX", "s", "tokens", "splitByPipes", "t", "value", "dedupe", "id", "hash", "html", "parseSL", "correctOptions", "m", "cleaned", "options", "shuffle", "allOptions", "optsElementsHTML", "o", "parseNM", "values", "ranges", "from", "to", "n", "parseDT", "validDates", "token", "trimmed", "parseTM", "validTimes", "splitByDoubleSemiColon", "s", "ELEMENT_REFERENCE", "ELEMENT_REFERENCE_MAP", "parseTX", "parseNM", "parseSL", "parseDT", "parseTM", "textEngineBaseGrammarParser", "code", "parts", "targets", "errors", "distractors", "distractorPattern", "distractorMatch", "d", "currentWord", "inTarget", "currentTarget", "i", "curr", "word", "hasErrors", "textEngineBlanksGrammarParser", "currentPos", "ref", "parenContent", "closed", "parser", "result", "target", "textEngineClassificationGrammarParser", "categoryMap", "commaParts", "p", "category", "wordOrPhrase", "words", "startPos", "endPos", "categoryTargets", "TEXT_ENGINE_PARSER_MAP", "parseTextEngineSequential", "modality", "chunks", "splitByDoubleSemiColon", "data", "chunk", "textEngineBaseDataValidator", "data", "errors", "i", "target", "prefix", "expectedWordCount", "j", "partIndex", "expectedWord", "actualWord", "seen", "distractor", "textEngineBlanksDataValidator", "seenIds", "expectedValue", "evType", "textEngineClassificationDataValidator", "seenCategories", "categoryTarget", "targetPrefix", "textEngineDataValidator", "textEngineHighlightGrader", "data", "userData", "selectedIndices", "targetIndices", "target", "i", "correctCount", "wrongCount", "missedCount", "shouldBeSelected", "isSelected", "total", "precision", "recall", "f1", "textEngineDNDGrader", "placements", "index", "expected", "actual", "normalize", "placedIndices", "getDNDGradingState", "gradingState", "textEngineTransformationGrader", "expectedTransformations", "userTransformations", "totalCount", "word", "j", "getTransformationGradingState", "matches", "getHighlightGradingState", "isTarget", "textEngineBlanksGrader", "userValue", "compareInputValue", "getBlanksGradingState", "userStr", "v", "userNum", "range", "opt", "expectedDate", "normalizeDate", "actualDate", "expectedTime", "normalizeTime", "actualTime", "value", "raw", "match", "textEngineClassificationGrader", "correctCategories", "categoryTarget", "wordIndex", "userCategory", "correctCategory", "getClassificationGradingState", "styles_default", "EduText", "e", "target", "index", "category", "id", "value", "targetIndex", "text", "dragEvent", "word", "wrap", "v", "placements", "k", "next", "state", "name", "oldValue", "newValue", "el", "inputEl", "blockEl", "html", "attr", "attrPattern", "className", "classPattern", "_m", "cls", "existing", "prefix", "filtered", "config", "data", "contentHtml", "styles_default", "parts", "selectedIndices", "gradingState", "isSelected", "grading", "classes", "escapeHtml", "currentVariant", "part", "t", "gradingClass", "modifiedPart", "valueStr", "wordCategories", "categories", "categoryColors", "colors", "cat", "i", "wordsHtml", "assignedCategory", "categoryStyle", "categoriesHtml", "targetIndices", "placedWord", "isPlaced", "content", "allWords", "placedWords", "availableWords", "placed", "idx", "w", "normalizeWord", "chipsHtml", "shuffle", "transformations", "targetMap", "j", "transformed", "displayText", "btn", "EduBlock", "words", "detail", "interactionsRegistry", "registerInteraction", "item", "current", "unregisterInteraction", "id", "clearInteractionRegistry", "getInteractionRegistry", "listInteractions", "getInteraction", "createInteraction", "args", "AssetValidationError", "issues", "validateAndNormalizeAssets", "input", "isPlainObject", "raw", "assetsById", "id", "value", "typeOf", "obj", "type", "dialog", "isString", "isAssetType", "url", "size", "span", "normalizedSpan", "from", "to", "looksLikeTime", "volume", "isNumber", "content", "assetsList", "b", "v", "classificationGrader", "correctData", "userData", "els", "correctCount", "totalCount", "category", "correctItem", "userCategory", "el", "OpenClassification", "BaseInteraction", "data", "config", "assets", "label", "items", "shuffle", "newVariant", "el", "itemsContainer", "container", "item", "chip", "setUpChipData", "e", "cat", "categoryBlock", "EduBlock", "color", "block", "value", "uncategorized", "firstUncategorized", "result", "classificationGrader", "SequentialClassification", "BaseInteraction", "data", "config", "assets", "label", "items", "shuffle", "newVariant", "el", "gridCols", "zonesGrid", "zone", "randomHexColorsList", "nextItem", "item", "chip", "setUpChipData", "e", "centerRect", "containerRect", "chipRect", "x", "y", "newParent", "parentRect", "left", "top", "c", "itemLabel", "zoneLabel", "previousCategory", "count", "v", "clientX", "clientY", "rect", "uncategorized", "firstUncategorized", "correctCategory", "cat", "result", "classificationGrader", "recognitionGrader", "data", "userAnswers", "totalScore", "questionCount", "question", "correctOptions", "userSelected", "correctSelections", "wrongSelections", "missedCorrect", "selected", "correct", "totalCorrect", "rawScore", "questionScore", "score", "fullyCorrectCount", "opt", "MCQ", "BaseInteraction", "data", "config", "assets", "q", "shuffle", "newVariant", "el", "stepIndex", "newIndex", "questionBlockContainer", "question", "isMCQ", "setUpQuestionData", "options", "option", "i", "chip", "setUpChipData", "isSelected", "isCorrect", "selected", "wasSelected", "c", "index", "answeredCount", "result", "recognitionGrader", "recognitionParser", "code", "questions", "errors", "lines", "line", "currentQuestion", "questionIndex", "i", "optionsLine", "correctMatch", "correctOptions", "remainingLine", "opt", "incorrectOptions", "allOptions", "seen", "data", "recognitionValidator", "data", "errors", "q", "index", "qNum", "opt", "optIndex", "correct", "seen", "associationDataGrader", "answerKey", "userData", "parent", "correct", "l", "r", "chip", "correctPair", "p", "total", "score", "SimultaneousAssociation", "BaseInteraction", "data", "config", "assets", "spec", "left", "right", "shuffle", "randomHexColorsList", "newVariant", "el", "item", "i", "chip", "setUpChipData", "e", "val", "rightElVal", "rightChip", "colorIndex", "matchColor", "unmatched", "firstUnmatched", "result", "associationDataGrader", "ListRecall", "BaseInteraction", "data", "config", "newVariant", "chip", "e", "value", "normalizedValue", "text", "recalled", "total", "result", "normalizedAnswerKey", "item", "userRecalled", "correctCount", "totalItems", "chipValue", "input", "LookupTable", "BaseInteraction", "data", "config", "allValues", "getAllValues", "cellKind", "detectCellKind", "r", "c", "getAllUniqueValues", "totalCells", "row", "col", "newVariant", "state", "completedCells", "value", "userData", "result", "lookupTableGrader", "cellGrading", "getLookupCellGrading", "ClassificationMatrix", "BaseInteraction", "data", "config", "newVariant", "state", "completedRows", "row", "emptyRows", "firstEmpty", "userData", "result", "classificationTableGrader", "cellGrading", "getClassificationCellGrading", "NaryChoiceTable", "BaseInteraction", "data", "config", "newVariant", "state", "completedRows", "row", "incompleteRows", "firstIncomplete", "userData", "result", "naryTableGrader", "cellGrading", "getNaryCellGrading", "AdjacencyTable", "BaseInteraction", "data", "config", "allValues", "getAllValues", "cellKind", "detectCellKind", "r", "c", "getAllUniqueValues", "totalCells", "newVariant", "state", "completedCells", "row", "col", "value", "userData", "result", "adjacencyTableGrader", "cellGrading", "getAdjacencyCellGrading", "MarkTheWords", "BaseInteraction", "data", "config", "newVariant", "userData", "selected", "target", "i", "selectedIndices", "unselectedTargets", "randomIndex", "word", "result", "textEngineHighlightGrader", "wordGradingState", "getHighlightGradingState", "SequentialMarkTheWords", "BaseInteraction", "data", "config", "slide", "newVariant", "stepIndex", "nextStep", "stepState", "stepGrading", "total", "target", "sum", "step", "targetIndices", "i", "correctSelections", "response", "selected", "targets", "idx", "unselectedTargets", "randomIndex", "correct", "gradingByStep", "result", "textEngineHighlightGrader", "getHighlightGradingState", "currentGrading", "CategorizeTheWords", "BaseInteraction", "data", "config", "newVariant", "indices", "category", "target", "i", "userData", "targetIndices", "idx", "result", "textEngineClassificationGrader", "gradingState", "getClassificationGradingState", "SequentialCategorizeTheWords", "BaseInteraction", "data", "config", "slide", "newVariant", "stepIndex", "nextStep", "stepState", "stepGrading", "indices", "category", "target", "i", "sum", "step", "answered", "response", "targetIndices", "idx", "correct", "total", "gradingByStep", "result", "textEngineClassificationGrader", "getClassificationGradingState", "currentGrading", "TextTransformation", "BaseInteraction", "data", "config", "expectedTransformations", "target", "index", "newVariant", "transformations", "transformed", "originalWords", "expectedWords", "result", "userData", "textEngineTransformationGrader", "gradingState", "i", "expected", "actual", "matches", "word", "j", "SequentialTextTransformation", "BaseInteraction", "data", "config", "expectedByStep", "slide", "newVariant", "stepIndex", "nextStep", "stepState", "stepGrading", "sum", "out", "step", "i", "answered", "transformations", "_target", "idx", "transformed", "expected", "originalWords", "expectedWords", "correct", "total", "gradingByStep", "response", "result", "textEngineTransformationGrader", "getTransformationGradingState", "currentGrading", "FillBlanks", "BaseInteraction", "data", "config", "newVariant", "values", "answered", "target", "value", "firstMissed", "userData", "result", "textEngineBlanksGrader", "gradingState", "getBlanksGradingState", "SequentialFillBlanks", "BaseInteraction", "data", "config", "slide", "newVariant", "stepIndex", "nextStep", "stepState", "stepGrading", "sum", "step", "answered", "i", "values", "target", "value", "firstMissed", "correct", "total", "gradingByStep", "response", "result", "textEngineBlanksGrader", "getBlanksGradingState", "currentGrading", "seriationValidator", "data", "errors", "item", "ok", "seriationGrader", "correctOrder", "userOrder", "parent", "totalScore", "correctCount", "totalItems", "correctItem", "correctIndex", "userIndex", "chip", "distance", "score", "seriationParser", "code", "trimmed", "items", "item", "line", "err", "RankOrder", "BaseInteraction", "data", "config", "assets", "items", "shuffle", "newVariant", "el", "item", "index", "row", "chipWrapper", "chip", "setUpChipData", "controls", "upBtn", "e", "direction", "btn", "svg", "index1", "index2", "temp", "rect", "err", "hoverIndex", "rows", "clientY", "correctCount", "result", "seriationGrader", "builtinsRegistered", "registerBuiltInInteractions", "registerInteraction", "OpenClassification", "SequentialClassification", "MCQ", "SimultaneousAssociation", "ListRecall", "LookupTable", "ClassificationMatrix", "NaryChoiceTable", "AdjacencyTable", "MarkTheWords", "SequentialMarkTheWords", "CategorizeTheWords", "SequentialCategorizeTheWords", "TextTransformation", "SequentialTextTransformation", "FillBlanks", "SequentialFillBlanks", "RankOrder", "simple_shell_default", "styles_default", "InteractionsBaseShell", "SoundManager", "AnimationsManager", "style", "styles_default", "wrap", "simple_shell_default", "name", "oldValue", "newValue", "interaction", "cfg", "variant", "error", "e", "target", "stepIndex", "current", "total", "percentage", "iconPosition", "state", "result", "score", "scoreClass", "remaining", "config", "dialog", "media", "screenName", "screen", "time", "minutes", "seconds", "showHeader", "showFooter", "count", "i", "input", "label"]
|
|
7
|
+
}
|