cognikit 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/client.d.ts +10 -0
  2. package/dist/client.js +4601 -0
  3. package/dist/client.js.map +7 -0
  4. package/dist/index.d.ts +9 -4
  5. package/dist/index.js +2075 -1992
  6. package/dist/index.js.map +4 -4
  7. package/dist/interactions/categorize-the-words/static.d.ts +1 -1
  8. package/dist/interactions/fill-blanks/static.d.ts +1 -1
  9. package/dist/interactions/mark-the-words/static.d.ts +1 -1
  10. package/dist/interactions/text-transformation/static.d.ts +1 -1
  11. package/dist/shared/config.d.ts +18 -0
  12. package/dist/shared/icons.d.ts +3 -0
  13. package/dist/shared/index.d.ts +1 -0
  14. package/dist/shared/managers/SoundManager.d.ts +1 -2
  15. package/dist/shared/ssr.d.ts +1 -0
  16. package/package.json +10 -5
  17. package/public/app.js +13713 -0
  18. package/public/app.js.map +7 -0
  19. package/public/assets/audio/failure.mp3 +0 -0
  20. package/public/assets/audio/flip.mp3 +0 -0
  21. package/public/assets/audio/low-time.mp3 +0 -0
  22. package/public/assets/audio/plus.mp3 +0 -0
  23. package/public/assets/audio/pop.mp3 +0 -0
  24. package/public/assets/audio/start.mp3 +0 -0
  25. package/public/assets/audio/success.mp3 +0 -0
  26. package/public/assets/eduguiders-logo.png +0 -0
  27. package/public/assets/icons/audio.svg +83 -0
  28. package/public/assets/icons/data.svg +2 -0
  29. package/public/assets/icons/down.svg +2 -0
  30. package/public/assets/icons/drag-horizontal-svgrepo-com.svg +4 -0
  31. package/public/assets/icons/drag-vertical-svgrepo-com.svg +4 -0
  32. package/public/assets/icons/error.svg +2 -0
  33. package/public/assets/icons/eye-disabled.svg +8 -0
  34. package/public/assets/icons/eye.svg +5 -0
  35. package/public/assets/icons/image-picture-svgrepo-com-dark.svg +17 -0
  36. package/public/assets/icons/image.svg +17 -0
  37. package/public/assets/icons/link.svg +5 -0
  38. package/public/assets/icons/repeat.svg +7 -0
  39. package/public/assets/icons/star.svg +4 -0
  40. package/public/assets/icons/up.svg +2 -0
  41. package/public/assets/icons/video.svg +6 -0
  42. package/public/assets/images/pointing-hand.svg +1 -0
  43. package/public/examples/chip.html +495 -0
  44. package/public/index.html +754 -0
  45. package/public/scalable-bare.html +432 -0
  46. package/public/tables-demo.html +534 -0
  47. package/public/text-interactions-demo.html +604 -0
package/dist/client.js ADDED
@@ -0,0 +1,4601 @@
1
+ var HTMLElement = globalThis.HTMLElement ?? class {}; var customElements = globalThis.customElements ?? { get() { return undefined; }, define() {} };
2
+ function Je(){let e=globalThis;if(typeof e.HTMLElement>"u"&&(e.HTMLElement=class{}),typeof e.customElements>"u"){let n=new Map;e.customElements={define(t,r){n.has(t)||n.set(t,r)},get(t){return n.get(t)},getName(t){for(let[r,i]of n.entries())if(i===t)return r;return null},upgrade(){},whenDefined(){return Promise.resolve(class{})}}}}Je();var O=new Map,C=e=>{let n=O.get(e.id);if(n){if(n.ctor===e.ctor)return;throw new Error(`Duplicate interaction id: "${e.id}"`)}O.set(e.id,e)},va=e=>O.delete(e),xa=()=>{O.clear()},wa=()=>O,ya=()=>Array.from(O.values()),pi=e=>O.get(e)??null,hi=(e,...n)=>{let t=pi(e);if(!t)throw new Error(`Unknown interaction "${e}"`);return new t.ctor(...n)};var qe=class{constructor(){this._current=0;this._total=0}initialize(n){if(n<0)throw new Error("Total must be non-negative");this._total=n,this._current=0}setCurrent(n){n<0?this._current=0:n>this._total?this._current=this._total:this._current=n}increment(){this._current<this._total&&this._current++}decrement(){this._current>0&&this._current--}reset(){this._current=0}getPercentage(){return this._total===0?0:Math.round(this._current/this._total*100)}isComplete(){return this._current===this._total&&this._total>0}get current(){return this._current}get total(){return this._total}get remaining(){return Math.max(0,this._total-this._current)}};var gi=`
3
+ @keyframes shake {
4
+ 0%, 100% { transform: translateX(0); }
5
+ 25% { transform: translateX(-8px); }
6
+ 75% { transform: translateX(8px); }
7
+ }
8
+
9
+ @keyframes pulse-green {
10
+ 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
11
+ 70% { box-shadow: 0 0 0 15px rgba(34, 197, 94, 0); }
12
+ 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
13
+ }
14
+
15
+ @keyframes bounce-in {
16
+ 0% { opacity: 0; transform: scale(0.3); }
17
+ 100% { opacity: 1; transform: scale(1); }
18
+ }
19
+
20
+ @keyframes float {
21
+ 0%, 100% { transform: translateY(0); }
22
+ 50% { transform: translateY(-10px); }
23
+ }
24
+
25
+ @keyframes rubber {
26
+ 0% { transform: scale3d(1, 1, 1); }
27
+ 30% { transform: scale3d(1.25, 0.75, 1); }
28
+ 40% { transform: scale3d(0.75, 1.25, 1); }
29
+ 50% { transform: scale3d(1.15, 0.85, 1); }
30
+ 100% { transform: scale3d(1, 1, 1); }
31
+ }
32
+
33
+ @keyframes jello {
34
+ 11.1% { transform: none; }
35
+ 22.2% { transform: skewX(-12.5deg) skewY(-12.5deg); }
36
+ 44.4% { transform: skewX(6.25deg) skewY(6.25deg); }
37
+ 66.6% { transform: skewX(-1.56deg) skewY(-1.56deg); }
38
+ 100% { transform: none; }
39
+ }
40
+
41
+ @keyframes heartbeat {
42
+ 0% { transform: translateY(-50%) scale(1); }
43
+ 14% { transform: translateY(-50%) scale(1.1); }
44
+ 28% { transform: translateY(-50%) scale(1); }
45
+ 42% { transform: translateY(-50%) scale(1.1); }
46
+ 70% { transform: translateY(-50%) scale(1); }
47
+ }
48
+
49
+ @keyframes shimmer {
50
+ 0% { background-position: 200% 0; }
51
+ 100% { background-position: -200% 0; }
52
+ }
53
+
54
+ @keyframes wobble {
55
+ 0%, 100% { transform: translateX(0); }
56
+ 25% { transform: rotate(-5deg); }
57
+ 75% { transform: rotate(5deg); }
58
+ }
59
+
60
+ @keyframes pop {
61
+ 0% { transform: scale(0); }
62
+ 100% { transform: scale(1); }
63
+ }
64
+
65
+ @keyframes fade-slide {
66
+ from { opacity:0; transform: translateY(10px); }
67
+ to { opacity:1; transform: translateY(0); }
68
+ }
69
+
70
+ @keyframes swing {
71
+ 20% { transform: rotate(15deg); }
72
+ 40% { transform: rotate(-10deg); }
73
+ 60% { transform: rotate(5deg); }
74
+ 80% { transform: rotate(-5deg); }
75
+ 100% { transform: rotate(0deg); }
76
+ }
77
+
78
+ @keyframes spin-pulse {
79
+ 0% { transform: translateY(-50%) scale(1) rotate(0deg); }
80
+ 50% { transform: translateY(-50%) scale(1.8) rotate(180deg); color: #fbbc05; }
81
+ 100% { transform: translateY(-50%) scale(1) rotate(360deg); }
82
+ }
83
+
84
+ @keyframes flash {
85
+ 0%, 50%, 100% { opacity: 1; }
86
+ 25%, 75% { opacity: 0; }
87
+ }
88
+
89
+ @keyframes orbit {
90
+ 0% { transform: rotate(0deg) translateX(0) rotate(0deg); }
91
+ 50% { transform: rotate(180deg) translateX(50px) rotate(-180deg) scale(1.5); }
92
+ 100% { transform: rotate(360deg) translateX(0) rotate(-360deg); }
93
+ }
94
+ `,yt={shake:"0.4s","pulse-green":"2s infinite","bounce-in":"0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55)",float:"3s ease-in-out infinite",rubber:"0.6s",jello:"0.8s",heartbeat:"1.5s ease-in-out infinite",shimmer:"2s infinite",wobble:"4s infinite",pop:"0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)","fade-slide":"0.5s ease-out",swing:"2s infinite",flash:"0.5s",orbit:"1s ease-in-out","spin-pulse":"3s cubic-bezier(0.175, 0.885, 0.32, 1.275) infinite"},M=class{constructor(){this.isEnabled=!1}static{this.injectedRoots=new WeakSet}static injectKeyframes(n){if(this.injectedRoots.has(n))return;let t=document.createElement("style");t.textContent=gi,n.prepend(t),this.injectedRoots.add(n)}animate(n,t,r){if(!this.isEnabled)return;n.style.animation="";let i=r?.duration||"",o=r?.timing||"",a=r?.iterations||"",s=r?.delay||"",l="";i||o||a||s?l=`${t} ${i} ${o} ${s} ${a}`.trim():l=`${t} ${yt[t]}`,n.style.animation=l}stop(n){n.style.animation=""}animateFor(n,t,r,i){this.isEnabled&&(this.animate(n,t,i),setTimeout(()=>{this.stop(n)},r))}getAvailableAnimations(){return Object.keys(yt)}addAnimationClass(n,t){this.isEnabled&&n.classList.add(`anim-${t}`)}removeAnimationClass(n,t){n.classList.remove(`anim-${t}`)}};var mi={"--edu-bg":"247 249 252","--edu-card":"255 255 255","--edu-ink":"31 41 55","--edu-second-ink":"71 85 105","--edu-third-ink":"100 116 139","--edu-inverted-ink":"248 250 252","--edu-success":"22 163 74","--edu-error":"220 38 38","--edu-warning":"255 222 33","--edu-neutral":"14 165 233","--edu-first-accent":"49 120 198","--edu-second-accent":"245 158 11","--edu-third-accent":"236 72 153","--edu-border":"229 231 235","--edu-muted":"243 244 246","--edu-radius":"0.375rem","--edu-shadow-color":"0 0 0","--edu-pad":"1rem","--edu-mar":"0"},L={audioBaseUrl:null,soundFiles:{},injectThemeVariables:!0,themeVariables:{}},Et="cognikit-theme-variables";function fi(e){e.audioBaseUrl!==void 0&&(L.audioBaseUrl=e.audioBaseUrl),e.soundFiles&&(L.soundFiles={...L.soundFiles,...e.soundFiles}),e.injectThemeVariables!==void 0&&(L.injectThemeVariables=e.injectThemeVariables),e.themeVariables&&(L.themeVariables={...L.themeVariables,...e.themeVariables}),ze()}function ze(){if(typeof document>"u"||!L.injectThemeVariables)return;let e=document.documentElement,n=window.getComputedStyle(e),t={...mi,...L.themeVariables},r=document.getElementById(Et);r||(r=document.createElement("style"),r.id=Et,document.head.appendChild(r));let i=Object.entries(t).filter(([o])=>n.getPropertyValue(o).trim()==="");r.textContent=i.length===0?"":`:root {
95
+ ${i.map(([o,a])=>` ${o}: ${a};`).join(`
96
+ `)}
97
+ }`}function kt(e,n){let t=L.soundFiles[e];return t?Ct(t,L.audioBaseUrl):L.audioBaseUrl?Ct(n,L.audioBaseUrl):null}function Ct(e,n){return vi(e)||e.startsWith("data:")?e:n?new URL(e,bi(n)).href:e}function bi(e){return typeof window>"u"?e:new URL(e,document.baseURI||window.location.href).href}function vi(e){return/^https?:\/\//.test(e)}var H=class{constructor(){this.isEnabled=!0;this.audioCache=new Map;this.activeSounds=new Set;this.localSounds={success:"success.mp3",failure:"failure.mp3",pop:"pop.mp3","low-time":"low-time.mp3",start:"start.mp3",flip:"flip.mp3"}}async playSound(n,t={}){if(this.isEnabled)try{let r=this.resolveUrl(n),i=await this.getAudio(r);this.configureAudio(i,t),await this.playAudio(i,t)}catch(r){let i=r instanceof Error?r:new Error(String(r));console.warn(`[SoundManager] Failed to play sound "${n}":`,i.message),t.onError&&t.onError(i)}}async preload(n){let t=n.map(async r=>{try{let i=this.resolveUrl(r);await this.getAudio(i)}catch(i){console.warn(`[SoundManager] Failed to preload sound "${r}":`,i)}});await Promise.allSettled(t)}stopAll(){this.activeSounds.forEach(n=>{n.pause(),n.currentTime=0}),this.activeSounds.clear()}stop(n){let t=this.resolveUrl(n),r=this.audioCache.get(t);r&&(r.pause(),r.currentTime=0,this.activeSounds.delete(r))}clearCache(){this.stopAll(),this.audioCache.clear()}setGlobalVolume(n){let t=Math.max(0,Math.min(1,n));this.activeSounds.forEach(r=>{r.volume=t})}resolveUrl(n){if(n in this.localSounds){let t=this.localSounds[n],r=kt(n,t);if(!r)throw new Error(`No configured URL for sound "${n}"`);return r}return n.startsWith("http://")||n.startsWith("https://")||n.startsWith("data:"),n}async getAudio(n){if(this.audioCache.has(n))return this.audioCache.get(n).cloneNode(!0);let t=new Audio,r=new Promise((i,o)=>{let a=setTimeout(()=>{o(new Error("Audio loading timeout"))},1e4);t.addEventListener("canplaythrough",()=>{clearTimeout(a),i()},{once:!0}),t.addEventListener("error",()=>{clearTimeout(a),o(new Error(`Failed to load audio: ${n}`))},{once:!0})});return t.src=n,t.preload="auto",t.load(),await r,this.audioCache.set(n,t),t.cloneNode(!0)}configureAudio(n,t){n.volume=t.volume!==void 0?Math.max(0,Math.min(1,t.volume)):1,n.loop=t.loop??!1,n.playbackRate=t.playbackRate??1,t.fadeIn&&t.fadeIn>0&&(n.volume=0,this.fadeVolume(n,t.volume??1,t.fadeIn))}async playAudio(n,t){this.activeSounds.add(n);let r=()=>{this.activeSounds.delete(n),t.onEnd&&t.onEnd()};n.addEventListener("ended",r,{once:!0}),t.fadeOut&&t.fadeOut>0&&!t.loop&&n.addEventListener("timeupdate",()=>{n.duration-n.currentTime<=t.fadeOut/1e3&&this.fadeVolume(n,0,t.fadeOut)});try{await n.play()}catch(i){throw this.activeSounds.delete(n),new Error(`Playback failed: ${i instanceof Error?i.message:String(i)}`)}}fadeVolume(n,t,r){let i=n.volume,o=t-i,a=Date.now(),s=()=>{let l=Date.now()-a,c=Math.min(l/r,1);n.volume=i+o*c,c<1&&this.activeSounds.has(n)&&requestAnimationFrame(s)};requestAnimationFrame(s)}},He=new H;var x=class extends HTMLElement{constructor(t,r,i,o){super();this.isValid=!0;this.implementsProgress=!0;this._initialized=!1;this.errors="";if(!t||!r){console.warn("[BaseInteraction] Constructor called without required parameters"),this.id=crypto.randomUUID(),this.data=t,this.config=r||{},this.assets=i||null,this.isValid=!1;return}if(this.id=crypto.randomUUID(),this.data=t,this.config=r,this.assets=i||null,o){let a=o(this.data);a.ok||(this.isValid=!1,Object.entries(a.errors).forEach(([s,l])=>{this.errors=`${this.errors}
98
+ ${s}: ${l}`}))}this.progressTracker=new qe,this.soundManager=new H,this.animationsManager=new M,this.animationsManager.isEnabled=this.config?.animationsEnabled??!0,this.soundManager.isEnabled=this.config?.soundEnabled??!0,this.setAttribute("variant",this.config?.variant??"elegant")}connectedCallback(){if(!this._initialized){if(this._initialized=!0,!this.isValid)return;this.initialize(),requestAnimationFrame(()=>{this.render(),this.emitReady()})}}disconnectedCallback(){this.cleanup()}initialize(){}cleanup(){}initializeProgress(t){this.progressTracker.initialize(t),this.emitProgress()}setProgress(t){this.progressTracker.setCurrent(t),this.emitProgress()}incrementProgress(){this.progressTracker.increment(),this.emitProgress()}decrementProgress(){this.progressTracker.decrement(),this.emitProgress()}getProgress(){return{current:this.progressTracker.current,total:this.progressTracker.total,percentage:this.progressTracker.getPercentage()}}emitReady(){this.dispatchEvent(new CustomEvent("interaction:ready",{detail:{id:this.id},bubbles:!0,composed:!0}))}emitProgress(){let t=this.getProgress();this.dispatchEvent(new CustomEvent("interaction:progress",{detail:t,bubbles:!0,composed:!0}))}emitStateChange(){this.dispatchEvent(new CustomEvent("interaction:state-change",{detail:{state:this.getCurrentState(),isComplete:this.isInteractionComplete()},bubbles:!0,composed:!0}))}emitComplete(){this.dispatchEvent(new CustomEvent("interaction:complete",{detail:{state:this.getCurrentState(),id:this.id},bubbles:!0,composed:!0}))}emitHintShown(t){this.dispatchEvent(new CustomEvent("interaction:hint-shown",{detail:{message:t},bubbles:!0,composed:!0}))}emitError(t,r){this.dispatchEvent(new CustomEvent("interaction:error",{detail:{error:t,message:r||t.message},bubbles:!0,composed:!0}))}onChange(t){}setSteps(t){}submit(){this.setAttribute("inert",""),this.emitComplete()}hint(){this.onHint()}reset(){this.progressTracker.reset(),this.emitProgress(),this.removeAttribute("inert"),this.render()}set(t){this.config.variant=t,this.setAttribute("variant",t),this.onVariantChange(t)}get(){return this.getAttribute("variant")||this.config.variant||"outline"}};var St=`<div class="chip-container" part="container">
99
+
100
+ <div class="content-zone" part="content-zone" role="button" tabindex="0" aria-pressed="false">
101
+ <span class="prefix" part="prefix"></span>
102
+
103
+ <div class="content-inner" part="content">
104
+ <slot></slot>
105
+ </div>
106
+
107
+ <!-- Shows for: audio, video, tts, anchor, interactive, data, dynamic, composite -->
108
+ <button class="modality-action" part="modality-action" type="button" aria-label="Modality action">
109
+ <svg class="icon" width="20" height="20" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
110
+ <circle cx="8" cy="8" r="1.5"/><circle cx="12" cy="8" r="1.5"/><circle cx="16" cy="8" r="1.5"/>
111
+ <circle cx="8" cy="16" r="1.5"/><circle cx="12" cy="16" r="1.5"/><circle cx="16" cy="16" r="1.5"/>
112
+ </svg>
113
+ </button>
114
+
115
+ <span class="drag-handle" part="drag-handle">
116
+ <svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
117
+ <circle cx="8" cy="8" r="1.5"/><circle cx="8" cy="12" r="1.5"/><circle cx="8" cy="16" r="1.5"/>
118
+ <circle cx="16" cy="8" r="1.5"/><circle cx="16" cy="12" r="1.5"/><circle cx="16" cy="16" r="1.5"/>
119
+ </svg>
120
+ </span>
121
+
122
+ </div>
123
+ </div>
124
+
125
+ `;var Tt=`/* ==================== BASE STYLES ==================== */
126
+
127
+ * { box-sizing: border-box; }
128
+
129
+ :host {
130
+ display: inline-block;
131
+ --chip-color: rgb(var(--edu-first-accent));
132
+ --chip-colored-color: #d1d1d1;
133
+ }
134
+
135
+ :host([colored]) {
136
+ & .chip-container { position: relative; }
137
+
138
+ & .chip-container::after {
139
+ content: '';
140
+ position: absolute;
141
+ top: -2px;
142
+ left: -2px;
143
+ right: -2px;
144
+ bottom: -2px;
145
+ border-radius: 10px;
146
+ background: var(--chip-colored-color);
147
+ opacity: 0.18;
148
+ mix-blend-mode: multiply;
149
+ z-index: 2;
150
+ pointer-events: none;
151
+ }
152
+ }
153
+
154
+ :host([aria-disabled]) {
155
+ opacity: 0.4;
156
+ cursor: not-allowed;
157
+ }
158
+
159
+ .chip-container {
160
+ display: flex;
161
+ flex-direction: column;
162
+ align-items: center;
163
+ position: relative;
164
+ width: 100%;height: 100%;
165
+ }
166
+
167
+ ::slotted(img.chip-image) {
168
+ border: 1px solid rgb(var(--edu-border));
169
+ }
170
+
171
+ /* ==================== PREFIX ==================== */
172
+
173
+ .prefix {
174
+ display: none;
175
+ font-weight: 600;
176
+ color: rgb(var(--edu-second-ink));
177
+ flex-shrink: 0;
178
+ margin-right: 1rem;
179
+ position: relative;
180
+ z-index: 1;
181
+ }
182
+
183
+ :host([prefix]) .prefix {
184
+ display: inline-flex;
185
+ }
186
+
187
+ /* ==================== CONTENT ZONE ==================== */
188
+
189
+ .content-zone {
190
+ display: flex;
191
+ align-items: center;
192
+ justify-content: center;
193
+ position: relative;
194
+ background: rgb(var(--edu-card));
195
+ border: 1px solid rgb(var(--edu-border));
196
+ padding: 0.5rem 1rem;
197
+ cursor: pointer;
198
+ font-size: 1rem;
199
+ font-weight: 500;
200
+ text-align: center;
201
+ transition: all 0.2s ease;
202
+ user-select: none;
203
+ margin: 0.25rem;
204
+ border-radius: var(--edu-radius);
205
+ color: rgb(var(--edu-ink));
206
+ width: 100%;
207
+ height: 100%;
208
+ box-sizing: border-box;
209
+ z-index: 1;
210
+ }
211
+
212
+ .content-zone:hover:not([aria-disabled="true"]) {
213
+ box-shadow: 0 2px 8px rgb(var(--edu-shadow-color) / 0.15);
214
+ }
215
+
216
+ .content-zone:active:not([aria-disabled="true"]) {
217
+ }
218
+
219
+ .content-zone[aria-disabled="true"] {
220
+ opacity: 0.5;
221
+ cursor: not-allowed;
222
+ }
223
+
224
+ .content-zone:focus-visible {
225
+ outline: 2px solid var(--chip-color);
226
+ outline-offset: 2px;
227
+ }
228
+
229
+ /* ==================== CONTENT INNER ==================== */
230
+
231
+ .content-inner {
232
+ flex: 1;
233
+ display: flex;
234
+ align-items: center;
235
+ justify-content: center;
236
+ min-width: 0;
237
+ }
238
+
239
+ /* ==================== MODALITY ACTION BUTTON ==================== */
240
+
241
+ .modality-action {
242
+ position: absolute;
243
+ top: 50%;
244
+ left: 50%;
245
+ display: none;
246
+ align-items: center;
247
+ justify-content: center;
248
+ width: 36px;
249
+ height: 36px;
250
+ border-radius: 50%;
251
+ border: none;
252
+ background: var(--chip-color);
253
+ color: rgb(var(--edu-inverted-ink));
254
+ cursor: pointer;
255
+ transition: all 0.2s;
256
+ z-index: 10;
257
+ box-shadow: 0 2px 8px rgba(var(--edu-shadow-color), 0.2);
258
+ }
259
+
260
+ .modality-action:hover:not(:disabled) {
261
+ box-shadow: 0 4px 12px rgba(var(--edu-shadow-color), 0.3);
262
+ }
263
+
264
+ .modality-action:active:not(:disabled) {
265
+ }
266
+
267
+ .modality-action:disabled {
268
+ opacity: 0.5;
269
+ cursor: not-allowed;
270
+ }
271
+
272
+ /* ==================== DRAG HANDLE ==================== */
273
+
274
+ .drag-handle {
275
+ display: none;
276
+ align-items: center;
277
+ justify-content: center;
278
+ background-color: rgb(var(--edu-muted) / 0.6);
279
+ color: rgb(var(--edu-third-ink));
280
+ cursor: grab;
281
+ flex-shrink: 0;
282
+ padding: 0.25rem;
283
+ border-radius: 4px;
284
+ transition: all 0.2s;
285
+ position: relative;
286
+ z-index: 1;
287
+ }
288
+
289
+ .drag-handle:hover {
290
+ background: rgb(var(--edu-muted));
291
+ color: rgb(var(--edu-first-accent));
292
+ }
293
+
294
+ .drag-handle:active {
295
+ cursor: grabbing;
296
+ background-color: rgb(var(--edu-muted) / 0.9);
297
+ }
298
+
299
+ :host([draggable]) .drag-handle {
300
+ display: flex;
301
+ }
302
+
303
+ .drag-handle[aria-disabled="true"] {
304
+ opacity: 0.5;
305
+ cursor: not-allowed;
306
+ }
307
+
308
+
309
+ /* ==================== SELECTED STATE (ENHANCED) ==================== */
310
+
311
+ :host([selected]) .content-zone {
312
+ box-shadow: 0 0 0 3px rgba(var(--chip-color), 0.3);
313
+ border-color: var(--chip-color);
314
+ background: rgba(var(--chip-color), 0.1);
315
+ }
316
+
317
+ /* ==================== STATE FEEDBACK ==================== */
318
+
319
+ :host([state="correct"]) .content-zone {
320
+ border: 4px solid rgb(var(--edu-success));
321
+ background: rgba(var(--edu-success), 0.1);
322
+ box-shadow: 0 0 0 2px rgb(var(--edu-success) / 0.2);
323
+ }
324
+
325
+ :host([state="correct"]) .content-zone::after {
326
+ content: '\u2713';
327
+ position: absolute;
328
+ top: -8px;
329
+ right: -8px;
330
+ width: 24px;
331
+ height: 24px;
332
+ background: rgb(var(--edu-success));
333
+ color: white;
334
+ display: flex;
335
+ align-items: center;
336
+ justify-content: center;
337
+ font-size: 14px;
338
+ font-weight: bold;
339
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
340
+ }
341
+
342
+ :host([state="wrong"]) .content-zone {
343
+ border: 4px solid rgb(var(--edu-error));
344
+ background: rgb(var(--edu-error) / 0.1);
345
+ box-shadow: 0 0 0 2px rgb(var(--edu-error) / 0.2);
346
+ }
347
+
348
+ :host([state="wrong"]) .content-zone::after {
349
+ content: '\u2717';
350
+ position: absolute;
351
+ top: -8px;
352
+ right: -8px;
353
+ width: 24px;
354
+ height: 24px;
355
+ background: rgb(var(--edu-error));
356
+ color: white;
357
+ display: flex;
358
+ align-items: center;
359
+ justify-content: center;
360
+ font-size: 14px;
361
+ font-weight: bold;
362
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
363
+ }
364
+
365
+ :host([state="missed"]) .content-zone {
366
+ border: 4px solid rgb(var(--edu-warning));
367
+ background: rgb(var(--edu-warning) / 0.1);
368
+ box-shadow: 0 0 0 2px rgb(var(--edu-warning) / 0.2);
369
+ }
370
+
371
+ :host([state="missed"]) .content-zone::after {
372
+ content: '!';
373
+ position: absolute;
374
+ top: -8px;
375
+ right: -8px;
376
+ width: 24px;
377
+ height: 24px;
378
+ background: rgb(var(--edu-warning));
379
+ color: rgb(var(--edu-ink));
380
+ display: flex;
381
+ align-items: center;
382
+ justify-content: center;
383
+ font-size: 14px;
384
+ font-weight: bold;
385
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
386
+ }
387
+
388
+ /* ==================== VARIANT: ELEGANT ==================== */
389
+
390
+ :host([variant="elegant"]) .content-zone {
391
+ background-color: rgb(var(--edu-card));
392
+ color: rgb(var(--edu-ink) / 0.8);
393
+ border-radius: 4px;
394
+ box-shadow: 4px 4px 0 rgb(var(--edu-border));
395
+ }
396
+
397
+ :host([variant="elegant"]) .content-zone:hover:not([aria-disabled="true"]) {
398
+ box-shadow: 1px 1px 0 rgb(var(--edu-border));
399
+ }
400
+
401
+ :host([variant="elegant"]) .content-zone:active:not([aria-disabled="true"]) {
402
+ box-shadow: 0 0 0 rgb(var(--edu-border));
403
+ }
404
+
405
+ :host([variant="elegant"]) .prefix {
406
+ color: var(--chip-color);
407
+ }
408
+
409
+ :host([variant="elegant"][selected]) .content-zone {
410
+ border-color: var(--chip-color);
411
+ background: rgb(var(--chip-color) / 0.1);
412
+ box-shadow: 0 0 0 3px rgb(var(--chip-color) / 0.3);
413
+ }
414
+
415
+ :host([variant="elegant"]) ::slotted(img.chip-image) {
416
+ border: none;
417
+ border-radius: 4px;
418
+ box-shadow: 4px 4px 0 rgb(var(--edu-border));
419
+ }
420
+
421
+ /* ==================== VARIANT: PLAYFUL ==================== */
422
+
423
+ :host([variant="playful"]) .content-zone {
424
+ background: var(--chip-color);
425
+ color: rgb(var(--edu-inverted-ink));
426
+ border-radius: 12px;
427
+ border: none;
428
+ box-shadow: 0 4px 12px rgb(var(--chip-color) / 0.3);
429
+ font-weight: 600;
430
+ }
431
+
432
+ :host([variant="playful"]) .content-zone:hover:not([aria-disabled="true"]) {
433
+ box-shadow: 0 6px 16px rgba(var(--chip-color), 0.4);
434
+ }
435
+
436
+ :host([variant="playful"]) .content-zone:active:not([aria-disabled="true"]) {
437
+ }
438
+
439
+ :host([variant="playful"]) .prefix {
440
+ color: rgb(var(--edu-inverted-ink));
441
+ opacity: 0.9;
442
+ }
443
+
444
+ :host([variant="playful"]) .modality-action {
445
+ background: rgb(var(--edu-card));
446
+ color: var(--chip-color);
447
+ }
448
+
449
+ :host([variant="playful"][selected]) .content-zone {
450
+ box-shadow: 0 0 0 3px rgb(var(--edu-first-accent) / 0.4), 0 6px 16px rgb(var(--edu-first-accent) / 0.4);
451
+ }
452
+
453
+ :host([variant="playful"]) ::slotted(img.chip-image) {
454
+ border: 4px solid rgb(var(--edu-border) / 0.6);
455
+ border-radius: 4px;
456
+ }
457
+
458
+
459
+ /* ==================== VARIANT: OUTLINE ==================== */
460
+
461
+ :host([variant="outline"]) .content-zone {
462
+ background: transparent;
463
+ border: 2px solid var(--chip-color);
464
+ border-radius: 0;
465
+ color: rgb(var(--edu-ink));
466
+ }
467
+
468
+ :host([variant="outline"]) .content-zone:hover:not([aria-disabled="true"]) {
469
+ background: var(--chip-color);
470
+ border-color: rgb(var(--edu-inverted-ink));
471
+ color: rgb(var(--edu-inverted-ink));
472
+ }
473
+
474
+ :host([variant="outline"]) .content-zone:hover:not([aria-disabled="true"]) .prefix {
475
+ color: rgb(var(--edu-inverted-ink));
476
+ }
477
+
478
+ :host([variant="outline"][selected]) .content-zone {
479
+ background: rgba(var(--chip-color), 0.1);
480
+ border-color: var(--chip-color);
481
+ color: rgb(var(--edu-ink));
482
+ border-width: 6px;
483
+ }
484
+
485
+ :host([variant="outline"]) ::slotted(img.chip-image) {
486
+ border: 2px solid rgb(var(--edu-first-accent));
487
+ }
488
+
489
+ /* ==================== VARIANT: EMPTY ==================== */
490
+
491
+ :host([variant="empty"]) .content-zone {
492
+ background: transparent;
493
+ border-radius: 0;
494
+ color: rgb(var(--edu-ink));
495
+ padding: 0.25rem 0.5rem;
496
+ border: 3px solid rgb(var(--edu-ink));
497
+ }
498
+
499
+ :host([variant="empty"]) .content-zone:hover:not([aria-disabled="true"]) {
500
+ background: rgb(var(--edu-muted));
501
+ }
502
+
503
+ :host([variant="empty"]) .content-zone:active:not([aria-disabled="true"]) {
504
+ background: rgb(var(--edu-border));
505
+ }
506
+
507
+ :host([variant="empty"][selected]) .content-zone {
508
+ background: rgb(var(--edu-first-accent) / 0.15);
509
+ border-color: var(--chip-color);
510
+ }
511
+
512
+ /* ==================== VARIANT: LETTER ==================== */
513
+
514
+ :host([variant="letter"]) .content-zone {
515
+ font-family: georgia, serif;
516
+ box-shadow: inset 0 0 0 1px rgba(var(--edu-shadow-color), 0.05);
517
+ border-radius: 2px;
518
+ background: rgb(var(--edu-card));
519
+ color: rgb(var(--edu-ink));
520
+ font-size: 0.95rem;
521
+ letter-spacing: 0.5px;
522
+ }
523
+
524
+ :host([variant="letter"]) .content-zone:hover:not([aria-disabled="true"]) {
525
+ box-shadow:
526
+ inset 0 0 0 1px rgba(var(--edu-shadow-color), 0.05),
527
+ 0 2px 6px rgba(var(--edu-shadow-color), 0.1);
528
+ }
529
+
530
+ :host([variant="letter"]) .prefix {
531
+ font-family: georgia, serif;
532
+ font-style: italic;
533
+ }
534
+
535
+ :host([variant="letter"]) .content-inner {
536
+ font-family: georgia, serif;
537
+ }
538
+
539
+ :host([variant="letter"][selected]) .content-zone {
540
+ border-color: var(--chip-color);
541
+ background: rgb(var(--edu-muted));
542
+ box-shadow: 0 0 0 2px rgba(var(--chip-color), 0.3);
543
+ }
544
+
545
+ /* ==================== VARIANT: MINIMAL ==================== */
546
+
547
+ :host([variant="minimal"]) .content-zone {
548
+ background: rgb(var(--edu-card));
549
+ border: 1px solid rgb(var(--edu-border));
550
+ border-radius: 6px;
551
+ color: rgb(var(--edu-ink));
552
+ padding: 0.4rem 0.75rem;
553
+ font-size: 0.9rem;
554
+ }
555
+
556
+ :host([variant="minimal"]) .content-zone:hover:not([aria-disabled="true"]) {
557
+ border-color: rgba(var(--chip-color), 0.5);
558
+ box-shadow: 0 1px 4px rgba(var(--edu-shadow-color), 0.1);
559
+ }
560
+
561
+ :host([variant="minimal"][selected]) .content-zone {
562
+ border-color: var(--chip-color);
563
+ background: rgba(var(--chip-color), 0.08);
564
+ }
565
+
566
+ /* ==================== VARIANT: GLASS ==================== */
567
+
568
+ :host([variant="glass"]) .content-zone {
569
+ background: rgb(var(--edu-card));
570
+ border: 2px solid rgb(var(--edu-border));
571
+ border-radius: 0;
572
+ color: rgb(var(--edu-ink));
573
+ padding: 0.5rem 1.2rem;
574
+ font-weight: 700;
575
+ letter-spacing: 1.5px;
576
+ font-size: 0.9rem;
577
+ }
578
+
579
+ :host([variant="glass"]) .content-zone:hover:not([aria-disabled="true"]) {
580
+ background: var(--chip-color);
581
+ color: rgb(var(--edu-inverted-ink));
582
+ border-color: var(--chip-color);
583
+ }
584
+
585
+ :host([variant="glass"]) .content-zone:active:not([aria-disabled="true"]) {
586
+ background: rgba(var(--chip-color), 0.9);
587
+ }
588
+
589
+ :host([variant="glass"]) .prefix {
590
+ font-weight: 800;
591
+ }
592
+
593
+ :host([variant="glass"][selected]) .content-zone {
594
+ background: rgba(var(--chip-color), 0.15);
595
+ border-color: var(--chip-color);
596
+ box-shadow: 0 0 0 2px rgba(var(--chip-color), 0.3);
597
+ }
598
+
599
+ /* ==================== VARIANT: CARD ==================== */
600
+
601
+ :host([variant="card"]) .content-zone {
602
+ background: transparent;
603
+ border: 2px solid rgb(var(--edu-border));
604
+ border-radius: 4px;
605
+ color: rgb(var(--edu-ink));
606
+ }
607
+
608
+ :host([variant="card"]) .content-zone:hover:not([aria-disabled="true"]) {
609
+ background: rgb(var(--edu-muted));
610
+ border-color: var(--chip-color);
611
+ }
612
+
613
+ :host([variant="card"]) .content-zone:active:not([aria-disabled="true"]) {
614
+ background: rgb(var(--edu-border));
615
+ }
616
+
617
+ :host([variant="card"]) .prefix {
618
+ color: var(--chip-color);
619
+ }
620
+
621
+ :host([variant="card"][selected]) .content-zone {
622
+ border-color: var(--chip-color);
623
+ box-shadow: 0 0 0 3px rgba(var(--chip-color), 0.2);
624
+ }
625
+
626
+ /* ==================== VARIANT: SIGN ==================== */
627
+
628
+ :host([variant="sign"]) .content-zone {
629
+ background: rgb(var(--edu-card));
630
+ border-radius: 0;
631
+ color: rgb(var(--edu-ink));
632
+ padding: 0.5rem 1.2rem;
633
+ font-size: 0.9rem;
634
+ font-weight: bold;
635
+ transform: skewX(-10deg);
636
+ text-transform: uppercase;
637
+ letter-spacing: 0.2rem;
638
+ }
639
+
640
+ :host([variant="sign"]) .content-zone:hover:not([aria-disabled="true"]) {
641
+ background: var(--chip-color);
642
+ color: rgb(var(--edu-inverted-ink));
643
+ border-color: var(--chip-color);
644
+ }
645
+
646
+ :host([variant="sign"]) .content-zone:active:not([aria-disabled="true"]) {
647
+ background: rgba(var(--chip-color), 0.9);
648
+ }
649
+
650
+ :host([variant="sign"]) .prefix {
651
+ font-weight: 800;
652
+ }
653
+
654
+ :host([variant="sign"]) .content-inner {
655
+ transform: skewX(10deg);
656
+ }
657
+
658
+ :host([variant="sign"][selected]) .content-zone {
659
+ background: var(--chip-color);
660
+ color: rgb(var(--edu-inverted-ink));
661
+ border-color: var(--chip-color);
662
+ box-shadow: 0 0 0 3px rgba(var(--chip-color), 0.3);
663
+ }
664
+
665
+ :host([variant="sign"]) ::slotted(img.chip-image) {
666
+ transform: skewX(-10deg);
667
+ }
668
+ `;var yi=`
669
+ <style>
670
+ :host {
671
+ display: none;
672
+ position: fixed;
673
+ inset: 0;
674
+ z-index: 9999;
675
+ align-items: center;
676
+ justify-content: center;
677
+ }
678
+
679
+ :host([open]) {
680
+ display: flex;
681
+ }
682
+
683
+ .backdrop {
684
+ position: absolute;
685
+ inset: 0;
686
+ background: rgba(0, 0, 0, 0.6);
687
+ backdrop-filter: blur(4px);
688
+ animation: fadeIn 0.2s ease;
689
+ }
690
+
691
+ .dialog {
692
+ position: relative;
693
+ background: rgb(var(--edu-card));
694
+ border-radius: 16px;
695
+ max-width: min(90vw, 600px);
696
+ max-height: min(90vh, 800px);
697
+ width: 100%;
698
+ box-shadow: 0 25px 50px -12px rgba(var(--edu-shadow-color), 0.5);
699
+ display: flex;
700
+ flex-direction: column;
701
+ animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
702
+ overflow: hidden;
703
+ }
704
+
705
+ .header {
706
+ padding: 1.5rem;
707
+ border-bottom: 2px solid rgb(var(--edu-border));
708
+ display: flex;
709
+ align-items: center;
710
+ justify-content: space-between;
711
+ flex-shrink: 0;
712
+ }
713
+
714
+ .header h3 {
715
+ margin: 0;
716
+ color: rgb(var(--edu-ink));
717
+ font-size: 1.25rem;
718
+ font-weight: 600;
719
+ }
720
+
721
+ .close-btn {
722
+ background: transparent;
723
+ border: none;
724
+ cursor: pointer;
725
+ padding: 0.5rem;
726
+ border-radius: 8px;
727
+ color: rgb(var(--edu-third-ink));
728
+ transition: all 0.2s;
729
+ display: flex;
730
+ align-items: center;
731
+ justify-content: center;
732
+ }
733
+
734
+ .close-btn:hover {
735
+ background: rgb(var(--edu-muted));
736
+ color: rgb(var(--edu-ink));
737
+ }
738
+
739
+ .content {
740
+ padding: 1.5rem;
741
+ overflow-y: auto;
742
+ flex: 1;
743
+ color: rgb(var(--edu-second-ink));
744
+ }
745
+
746
+ .content::-webkit-scrollbar {
747
+ width: 8px;
748
+ }
749
+
750
+ .content::-webkit-scrollbar-track {
751
+ background: rgb(var(--edu-muted));
752
+ border-radius: 4px;
753
+ }
754
+
755
+ .content::-webkit-scrollbar-thumb {
756
+ background: rgb(var(--edu-border));
757
+ border-radius: 4px;
758
+ }
759
+
760
+ .content::-webkit-scrollbar-thumb:hover {
761
+ background: rgb(var(--edu-third-ink));
762
+ }
763
+
764
+ .footer {
765
+ padding: 1rem 1.5rem;
766
+ border-top: 2px solid rgb(var(--edu-border));
767
+ display: flex;
768
+ justify-content: flex-end;
769
+ gap: 0.75rem;
770
+ flex-shrink: 0;
771
+ }
772
+
773
+ .footer button {
774
+ padding: 0.75rem 1.5rem;
775
+ border-radius: 8px;
776
+ border: none;
777
+ font-weight: 600;
778
+ cursor: pointer;
779
+ transition: all 0.2s;
780
+ font-size: 0.95rem;
781
+ }
782
+
783
+ .footer button.primary {
784
+ background: rgb(var(--edu-first-accent));
785
+ color: rgb(var(--edu-inverted-ink));
786
+ }
787
+
788
+ .footer button.primary:hover {
789
+ filter: brightness(1.1);
790
+ transform: translateY(-1px);
791
+ }
792
+
793
+ .footer button.secondary {
794
+ background: rgb(var(--edu-muted));
795
+ color: rgb(var(--edu-ink));
796
+ }
797
+
798
+ .footer button.secondary:hover {
799
+ background: rgb(var(--edu-border));
800
+ }
801
+
802
+ @keyframes fadeIn {
803
+ from { opacity: 0; }
804
+ to { opacity: 1; }
805
+ }
806
+
807
+ @keyframes slideUp {
808
+ from {
809
+ opacity: 0;
810
+ transform: translateY(20px) scale(0.95);
811
+ }
812
+ to {
813
+ opacity: 1;
814
+ transform: translateY(0) scale(1);
815
+ }
816
+ }
817
+
818
+ @media (max-width: 640px) {
819
+ .dialog {
820
+ max-width: 95vw;
821
+ max-height: 95vh;
822
+ border-radius: 12px;
823
+ }
824
+
825
+ .header, .content, .footer {
826
+ padding: 1rem;
827
+ }
828
+ }
829
+ </style>
830
+
831
+ <div class="backdrop" part="backdrop"></div>
832
+ <div class="dialog" part="dialog">
833
+ <div class="header" part="header">
834
+ <h3 id="title"></h3>
835
+ <button class="close-btn" part="close-btn" aria-label="Close dialog">
836
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor">
837
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 6l8 8M14 6l-8 8"/>
838
+ </svg>
839
+ </button>
840
+ </div>
841
+ <div class="content" part="content">
842
+ <slot></slot>
843
+ </div>
844
+ <div class="footer" part="footer" style="display: none;">
845
+ <slot name="footer"></slot>
846
+ </div>
847
+ </div>
848
+ `,he=class extends HTMLElement{constructor(){super();this.handleEscape=t=>{t.key==="Escape"&&this.hasAttribute("open")&&this.close()};this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=yi,this.$backdrop=this.shadowRoot.querySelector(".backdrop"),this.$dialog=this.shadowRoot.querySelector(".dialog"),this.$title=this.shadowRoot.querySelector("#title"),this.$content=this.shadowRoot.querySelector(".content"),this.$footer=this.shadowRoot.querySelector(".footer"),this.$closeBtn=this.shadowRoot.querySelector(".close-btn")}static get observedAttributes(){return["open","title"]}connectedCallback(){this.$backdrop.addEventListener("click",()=>this.close()),this.$closeBtn.addEventListener("click",()=>this.close()),document.addEventListener("keydown",this.handleEscape);let t=this.shadowRoot.querySelector('slot[name="footer"]');t.addEventListener("slotchange",()=>{let r=t.assignedNodes().length>0;this.$footer.style.display=r?"flex":"none"})}disconnectedCallback(){document.removeEventListener("keydown",this.handleEscape)}attributeChangedCallback(t,r,i){t==="title"?this.$title.textContent=i||"":t==="open"&&i!==r&&(this.hasAttribute("open")?document.body.style.overflow="hidden":document.body.style.overflow="")}open(){this.setAttribute("open",""),this.dispatchEvent(new CustomEvent("dialog:open",{bubbles:!0,composed:!0}))}close(){this.removeAttribute("open"),this.dispatchEvent(new CustomEvent("dialog:close",{bubbles:!0,composed:!0}))}setContent(t){this.$content.innerHTML=t}get isOpen(){return this.hasAttribute("open")}get title(){return this.getAttribute("title")||""}set title(t){this.setAttribute("title",t)}};customElements.get("edu-dialog")||customElements.define("edu-dialog",he);function D(e,n,t){if(!t||!e.startsWith("@:")||e.length<3){n.textContent=e;return}let r=e.slice(2,e.length);if(!t[r]){n.textContent=r;return}let i=t[r],o=i.type;switch(n.modality=o,o){case"image":n.data=i.url;break;case"video":break;case"audio":break;case"html":n.data=i.content;break}}var et=class extends HTMLElement{static get observedAttributes(){return["accent","variant","selected","prefix","disabled","modality","state","display","color","colored","draggable"]}constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=St;let n=document.createElement("style");n.textContent=Tt,this.shadowRoot.append(n),this.$prefix=this.shadowRoot.querySelector(".prefix"),this.$chip=this.shadowRoot.querySelector(".content-zone"),this.$dragHandler=this.shadowRoot.querySelector(".drag-handle"),this.$dialog=new he,M.injectKeyframes(this.shadowRoot)}connectedCallback(){this.hasAttribute("variant")||(this.variant="outline"),this.sync()}attributeChangedCallback(){this.sync()}getButton(){return this.$chip}getPrefix(){return this.$prefix}getDragHandler(){return this.$dragHandler}sync(){this.hasAttribute("prefix")&&(this.$prefix.textContent=this.prefix??""),this.hasAttribute("draggable")&&(this.style.userSelect="none",this.style.touchAction="none");let n=this.selected?"true":"false";this.$chip.setAttribute("aria-pressed",n)}updateContent(){if(!this.hasAttribute("data")||!this.hasAttribute("modality"))return;let n=this.getAttribute("modality"),t=this.getAttribute("data");switch(n){case"image":this.innerHTML=`<img src="${t}" alt="no image" class="chip-image" width="64" height="64"/>`;break;case"audio":break;case"video":break;case"html":this.innerHTML=t}}get variant(){return this.getAttribute("variant")??"outline"}set variant(n){this.setAttribute("variant",n)}get prefix(){return this.getAttribute("prefix")}set prefix(n){n==null||n===""?this.removeAttribute("prefix"):this.setAttribute("prefix",String(n))}get chipState(){return this.getAttribute("state")}set chipState(n){n==null?this.removeAttribute("state"):this.setAttribute("state",String(n))}get draggable(){return this.hasAttribute("draggable")}set draggable(n){n==null||n===!1?this.removeAttribute("draggable"):this.setAttribute("draggable","true")}get color(){return this.getAttribute("color")}set color(n){n==null||n===""?this.removeAttribute("color"):(this.setAttribute("color",String(n)),this.style.setProperty("--chip-colored-color",String(n)))}get colored(){return this.hasAttribute("colored")}set colored(n){n?this.setAttribute("colored","true"):this.removeAttribute("colored")}set data(n){n==null||n===""?this.removeAttribute("data"):(this.setAttribute("data",String(n)),this.updateContent())}set modality(n){n==null?this.removeAttribute("modality"):(console.log(1),this.setAttribute("modality",String(n)),this.updateContent())}get disabled(){return this.hasAttribute("disabled")}set disabled(n){n?(this.setAttribute("aria-disabled","true"),this.$chip.setAttribute("aria-disabled","true"),this.$dragHandler.setAttribute("aria-disabled","true")):(this.removeAttribute("aria-disabled"),this.$chip.removeAttribute("aria-disabled"),this.$dragHandler.removeAttribute("aria-disabled"))}get selected(){return this.hasAttribute("selected")}set selected(n){n?this.setAttribute("selected",""):this.removeAttribute("selected")}get value(){return this.getAttribute("value")??""}set value(n){this.setAttribute("value",String(n))}toggle(n){return typeof n=="boolean"?this.selected=n:this.selected=!this.selected,this.selected}removeSelf(){this.remove()}};customElements.get("edu-chip")||customElements.define("edu-chip",et);var Ei=`
849
+ <style>
850
+ :host {
851
+ display: block;
852
+ cursor: pointer;
853
+ --accent-color: rgb(var(--edu-first-accent));
854
+ }
855
+
856
+ .block {
857
+ display: flex;
858
+ flex-direction: column;
859
+ color: rgb(var(--edu-ink));
860
+ align-items: center;
861
+ justify-content: center;
862
+ gap: 0.5rem;
863
+ padding: 1rem;
864
+ background: rgb(var(--edu-bg));
865
+ border: 2px solid rgb(var(--edu-border));
866
+ border-radius: var(--edu-radius);
867
+ height: 100%;
868
+ box-sizing: border-box;
869
+ transition: all 0.2s ease;
870
+ text-align: center;
871
+ width: 100%;
872
+ min-height: 44px;
873
+ }
874
+
875
+ .block:hover {
876
+ transform: translateY(-2px);
877
+ box-shadow: 0 4px 12px rgba(var(--edu-shadow-color), 0.15);
878
+ }
879
+
880
+ .block[variant="elegant"] {
881
+ background: rgb(var(--edu-card));
882
+ border-radius: 8px;
883
+ color: rgb(var(--edu-ink));
884
+ box-shadow: 0 4px 12px rgba(var(--edu-shadow-color), 0.1);
885
+ border-left: 4px solid var(--accent-color);
886
+ }
887
+
888
+ .block[variant="elegant"]:hover {
889
+ box-shadow: 0 6px 16px rgba(var(--edu-shadow-color), 0.15);
890
+ transform: translateY(-3px);
891
+ }
892
+
893
+ .block[variant="playful"] {
894
+ background: var(--accent-color);
895
+ border: none;
896
+ color: rgb(var(--edu-inverted-ink));
897
+ border-radius: 16px;
898
+ box-shadow: 2px 2px 0px rgba(var(--edu-shadow-color) / 0.2);
899
+ }
900
+
901
+ .block[variant="playful"]:hover {
902
+ transform: translateY(-2px) rotate(-2deg);
903
+ box-shadow: 0 6px 16px rgba(var(--edu-first-accent), 0.4);
904
+ }
905
+
906
+ .block[variant="outline"] {
907
+ background: transparent;
908
+ border: 2px solid var(--accent-color);
909
+ border-top: 6px solid var(--accent-color);
910
+ border-radius: 0;
911
+ }
912
+
913
+ .block[variant="outline"]:hover {
914
+ background: rgb(var(--edu-first-accent) / 0.1);
915
+ border-width: 3px;
916
+ }
917
+
918
+ .block[variant="letter"] {
919
+ font-family: georgia, serif;
920
+ color: rgb(var(--edu-ink));
921
+ background: rgb(var(--edu-card));
922
+ border: 1px solid rgb(var(--edu-border));
923
+ border-radius: 4px;
924
+ box-shadow: inset 0 0 0 1px rgba(var(--edu-shadow-color), 0.05);
925
+ }
926
+
927
+ .block[variant="letter"]:hover {
928
+ box-shadow:
929
+ inset 0 0 0 1px rgba(var(--edu-shadow-color), 0.05),
930
+ 0 2px 6px rgba(var(--edu-shadow-color), 0.1);
931
+ }
932
+
933
+ .block[variant="minimal"] {
934
+ background: rgb(var(--edu-card));
935
+ color: rgb(var(--edu-ink));
936
+ border: 1px solid rgb(var(--edu-border));
937
+ border-radius: 6px;
938
+ padding: 0.75rem;
939
+ }
940
+
941
+ .block[variant="minimal"]:hover {
942
+ border-color: rgb(var(--edu-first-accent) / 0.5);
943
+ box-shadow: 0 1px 4px rgba(var(--edu-shadow-color), 0.1);
944
+ }
945
+
946
+ .block[variant="glass"] {
947
+ background: rgba(var(--edu-card), 0.7);
948
+ backdrop-filter: blur(10px);
949
+ border: 2px solid rgba(var(--edu-border), 0.35);
950
+ border-radius: 12px;
951
+ }
952
+
953
+ .block[variant="glass"]:hover {
954
+ background: rgba(var(--edu-card), 0.85);
955
+ border-color: rgba(var(--edu-first-accent), 0.5);
956
+ }
957
+
958
+ .block[variant="card"] {
959
+ background: rgb(var(--edu-card));
960
+ border: 2px solid rgb(var(--edu-border));
961
+ border-radius: 8px;
962
+ box-shadow: 0 2px 8px rgba(var(--edu-shadow-color), 0.08);
963
+ }
964
+
965
+ .block[variant="card"]:hover {
966
+ border-color: rgb(var(--edu-first-accent));
967
+ box-shadow: 0 4px 12px rgba(var(--edu-shadow-color), 0.12);
968
+ }
969
+
970
+ .block[variant="sign"] {
971
+ background: rgb(var(--edu-card));
972
+ border: 4px double rgb(var(--edu-border));
973
+ color: rgb(var(--edu-ink));
974
+ border-radius: 0;
975
+ text-align: center;
976
+ text-transform: uppercase;
977
+ letter-spacing: 2px;
978
+ font-weight: 700;
979
+ }
980
+
981
+ .block[variant="sign"]:hover {
982
+ border-color: var(--accent-color);
983
+ background: var(accent-color);
984
+ }
985
+
986
+ .block[variant="empty"] {
987
+ background: transparent;
988
+ color: rgb(var(--edu-ink));
989
+ border: 3px solid rgb(var(--edu-ink));
990
+ border-radius: 0;
991
+ padding: 0.75rem;
992
+ }
993
+
994
+ .block[variant="empty"]:hover {
995
+ background: var(--accent-color);
996
+ color: rgb(var(--edu-inverted-ink));
997
+ border-color: rgb(var(--edu-ink));
998
+ }
999
+ </style>
1000
+ <div class="block" part="block">
1001
+ <slot></slot>
1002
+ </div>
1003
+ `,V=class extends HTMLElement{static get observedAttributes(){return["variant"]}constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=Ei,this.$blockEl=this.shadowRoot.querySelector(".block"),M.injectKeyframes(this.shadowRoot)}connectedCallback(){this.hasAttribute("variant")||(this.variant="outline"),this.sync()}attributeChangedCallback(){this.sync()}sync(){this.$blockEl&&this.$blockEl.setAttribute("variant",this.variant)}getBlock(){return this.$blockEl}get variant(){return this.getAttribute("variant")??"outline"}set variant(n){this.setAttribute("variant",n)}setAccentColor(n){this.shadowRoot.host.style.setProperty("--accent-color",n)}removeSelf(){this.remove()}};customElements.get("edu-block")||customElements.define("edu-block",V);function Ot(e){return typeof e>"u"||e===null}function Ci(e){return typeof e=="object"&&e!==null}function ki(e){return Array.isArray(e)?e:Ot(e)?[]:[e]}function Si(e,n){var t,r,i,o;if(n)for(o=Object.keys(n),t=0,r=o.length;t<r;t+=1)i=o[t],e[i]=n[i];return e}function Ti(e,n){var t="",r;for(r=0;r<n;r+=1)t+=e;return t}function $i(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var Ai=Ot,_i=Ci,Ii=ki,Mi=Ti,Li=$i,Di=Si,k={isNothing:Ai,isObject:_i,toArray:Ii,repeat:Mi,isNegativeZero:Li,extend:Di};function Vt(e,n){var t="",r=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(t+='in "'+e.mark.name+'" '),t+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!n&&e.mark.snippet&&(t+=`
1004
+
1005
+ `+e.mark.snippet),r+" "+t):r}function me(e,n){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=n,this.message=Vt(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}me.prototype=Object.create(Error.prototype);me.prototype.constructor=me;me.prototype.toString=function(n){return this.name+": "+Vt(this,n)};var A=me;function tt(e,n,t,r,i){var o="",a="",s=Math.floor(i/2)-1;return r-n>s&&(o=" ... ",n=r-s+o.length),t-r>s&&(a=" ...",t=r+s-a.length),{str:o+e.slice(n,t).replace(/\t/g,"\u2192")+a,pos:r-n+o.length}}function rt(e,n){return k.repeat(" ",n-e.length)+e}function Ri(e,n){if(n=Object.create(n||null),!e.buffer)return null;n.maxLength||(n.maxLength=79),typeof n.indent!="number"&&(n.indent=1),typeof n.linesBefore!="number"&&(n.linesBefore=3),typeof n.linesAfter!="number"&&(n.linesAfter=2);for(var t=/\r?\n|\r|\0/g,r=[0],i=[],o,a=-1;o=t.exec(e.buffer);)i.push(o.index),r.push(o.index+o[0].length),e.position<=o.index&&a<0&&(a=r.length-2);a<0&&(a=r.length-1);var s="",l,c,d=Math.min(e.line+n.linesAfter,i.length).toString().length,u=n.maxLength-(n.indent+d+3);for(l=1;l<=n.linesBefore&&!(a-l<0);l++)c=tt(e.buffer,r[a-l],i[a-l],e.position-(r[a]-r[a-l]),u),s=k.repeat(" ",n.indent)+rt((e.line-l+1).toString(),d)+" | "+c.str+`
1006
+ `+s;for(c=tt(e.buffer,r[a],i[a],e.position,u),s+=k.repeat(" ",n.indent)+rt((e.line+1).toString(),d)+" | "+c.str+`
1007
+ `,s+=k.repeat("-",n.indent+d+3+c.pos)+`^
1008
+ `,l=1;l<=n.linesAfter&&!(a+l>=i.length);l++)c=tt(e.buffer,r[a+l],i[a+l],e.position-(r[a]-r[a+l]),u),s+=k.repeat(" ",n.indent)+rt((e.line+l+1).toString(),d)+" | "+c.str+`
1009
+ `;return s.replace(/\n$/,"")}var Pi=Ri,Bi=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],qi=["scalar","sequence","mapping"];function zi(e){var n={};return e!==null&&Object.keys(e).forEach(function(t){e[t].forEach(function(r){n[String(r)]=t})}),n}function Hi(e,n){if(n=n||{},Object.keys(n).forEach(function(t){if(Bi.indexOf(t)===-1)throw new A('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')}),this.options=n,this.tag=e,this.kind=n.kind||null,this.resolve=n.resolve||function(){return!0},this.construct=n.construct||function(t){return t},this.instanceOf=n.instanceOf||null,this.predicate=n.predicate||null,this.represent=n.represent||null,this.representName=n.representName||null,this.defaultStyle=n.defaultStyle||null,this.multi=n.multi||!1,this.styleAliases=zi(n.styleAliases||null),qi.indexOf(this.kind)===-1)throw new A('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var T=Hi;function $t(e,n){var t=[];return e[n].forEach(function(r){var i=t.length;t.forEach(function(o,a){o.tag===r.tag&&o.kind===r.kind&&o.multi===r.multi&&(i=a)}),t[i]=r}),t}function Gi(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},n,t;function r(i){i.multi?(e.multi[i.kind].push(i),e.multi.fallback.push(i)):e[i.kind][i.tag]=e.fallback[i.tag]=i}for(n=0,t=arguments.length;n<t;n+=1)arguments[n].forEach(r);return e}function nt(e){return this.extend(e)}nt.prototype.extend=function(n){var t=[],r=[];if(n instanceof T)r.push(n);else if(Array.isArray(n))r=r.concat(n);else if(n&&(Array.isArray(n.implicit)||Array.isArray(n.explicit)))n.implicit&&(t=t.concat(n.implicit)),n.explicit&&(r=r.concat(n.explicit));else throw new A("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");t.forEach(function(o){if(!(o instanceof T))throw new A("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(o.loadKind&&o.loadKind!=="scalar")throw new A("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(o.multi)throw new A("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),r.forEach(function(o){if(!(o instanceof T))throw new A("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(nt.prototype);return i.implicit=(this.implicit||[]).concat(t),i.explicit=(this.explicit||[]).concat(r),i.compiledImplicit=$t(i,"implicit"),i.compiledExplicit=$t(i,"explicit"),i.compiledTypeMap=Gi(i.compiledImplicit,i.compiledExplicit),i};var Ft=nt,jt=new T("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),Ut=new T("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),Yt=new T("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),Kt=new Ft({explicit:[jt,Ut,Yt]});function Ni(e){if(e===null)return!0;var n=e.length;return n===1&&e==="~"||n===4&&(e==="null"||e==="Null"||e==="NULL")}function Oi(){return null}function Vi(e){return e===null}var Wt=new T("tag:yaml.org,2002:null",{kind:"scalar",resolve:Ni,construct:Oi,predicate:Vi,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function Fi(e){if(e===null)return!1;var n=e.length;return n===4&&(e==="true"||e==="True"||e==="TRUE")||n===5&&(e==="false"||e==="False"||e==="FALSE")}function ji(e){return e==="true"||e==="True"||e==="TRUE"}function Ui(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var Qt=new T("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Fi,construct:ji,predicate:Ui,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function Yi(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function Ki(e){return 48<=e&&e<=55}function Wi(e){return 48<=e&&e<=57}function Qi(e){if(e===null)return!1;var n=e.length,t=0,r=!1,i;if(!n)return!1;if(i=e[t],(i==="-"||i==="+")&&(i=e[++t]),i==="0"){if(t+1===n)return!0;if(i=e[++t],i==="b"){for(t++;t<n;t++)if(i=e[t],i!=="_"){if(i!=="0"&&i!=="1")return!1;r=!0}return r&&i!=="_"}if(i==="x"){for(t++;t<n;t++)if(i=e[t],i!=="_"){if(!Yi(e.charCodeAt(t)))return!1;r=!0}return r&&i!=="_"}if(i==="o"){for(t++;t<n;t++)if(i=e[t],i!=="_"){if(!Ki(e.charCodeAt(t)))return!1;r=!0}return r&&i!=="_"}}if(i==="_")return!1;for(;t<n;t++)if(i=e[t],i!=="_"){if(!Wi(e.charCodeAt(t)))return!1;r=!0}return!(!r||i==="_")}function Zi(e){var n=e,t=1,r;if(n.indexOf("_")!==-1&&(n=n.replace(/_/g,"")),r=n[0],(r==="-"||r==="+")&&(r==="-"&&(t=-1),n=n.slice(1),r=n[0]),n==="0")return 0;if(r==="0"){if(n[1]==="b")return t*parseInt(n.slice(2),2);if(n[1]==="x")return t*parseInt(n.slice(2),16);if(n[1]==="o")return t*parseInt(n.slice(2),8)}return t*parseInt(n,10)}function Xi(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!k.isNegativeZero(e)}var Zt=new T("tag:yaml.org,2002:int",{kind:"scalar",resolve:Qi,construct:Zi,predicate:Xi,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Ji=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function en(e){return!(e===null||!Ji.test(e)||e[e.length-1]==="_")}function tn(e){var n,t;return n=e.replace(/_/g,"").toLowerCase(),t=n[0]==="-"?-1:1,"+-".indexOf(n[0])>=0&&(n=n.slice(1)),n===".inf"?t===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:n===".nan"?NaN:t*parseFloat(n,10)}var rn=/^[-+]?[0-9]+e/;function nn(e,n){var t;if(isNaN(e))switch(n){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(n){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(n){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(k.isNegativeZero(e))return"-0.0";return t=e.toString(10),rn.test(t)?t.replace("e",".e"):t}function on(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||k.isNegativeZero(e))}var Xt=new T("tag:yaml.org,2002:float",{kind:"scalar",resolve:en,construct:tn,predicate:on,represent:nn,defaultStyle:"lowercase"}),Jt=Kt.extend({implicit:[Wt,Qt,Zt,Xt]}),er=Jt,tr=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),rr=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function an(e){return e===null?!1:tr.exec(e)!==null||rr.exec(e)!==null}function sn(e){var n,t,r,i,o,a,s,l=0,c=null,d,u,p;if(n=tr.exec(e),n===null&&(n=rr.exec(e)),n===null)throw new Error("Date resolve error");if(t=+n[1],r=+n[2]-1,i=+n[3],!n[4])return new Date(Date.UTC(t,r,i));if(o=+n[4],a=+n[5],s=+n[6],n[7]){for(l=n[7].slice(0,3);l.length<3;)l+="0";l=+l}return n[9]&&(d=+n[10],u=+(n[11]||0),c=(d*60+u)*6e4,n[9]==="-"&&(c=-c)),p=new Date(Date.UTC(t,r,i,o,a,s,l)),c&&p.setTime(p.getTime()-c),p}function ln(e){return e.toISOString()}var ir=new T("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:an,construct:sn,instanceOf:Date,represent:ln});function cn(e){return e==="<<"||e===null}var nr=new T("tag:yaml.org,2002:merge",{kind:"scalar",resolve:cn}),ct=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
1010
+ \r`;function dn(e){if(e===null)return!1;var n,t,r=0,i=e.length,o=ct;for(t=0;t<i;t++)if(n=o.indexOf(e.charAt(t)),!(n>64)){if(n<0)return!1;r+=6}return r%8===0}function un(e){var n,t,r=e.replace(/[\r\n=]/g,""),i=r.length,o=ct,a=0,s=[];for(n=0;n<i;n++)n%4===0&&n&&(s.push(a>>16&255),s.push(a>>8&255),s.push(a&255)),a=a<<6|o.indexOf(r.charAt(n));return t=i%4*6,t===0?(s.push(a>>16&255),s.push(a>>8&255),s.push(a&255)):t===18?(s.push(a>>10&255),s.push(a>>2&255)):t===12&&s.push(a>>4&255),new Uint8Array(s)}function pn(e){var n="",t=0,r,i,o=e.length,a=ct;for(r=0;r<o;r++)r%3===0&&r&&(n+=a[t>>18&63],n+=a[t>>12&63],n+=a[t>>6&63],n+=a[t&63]),t=(t<<8)+e[r];return i=o%3,i===0?(n+=a[t>>18&63],n+=a[t>>12&63],n+=a[t>>6&63],n+=a[t&63]):i===2?(n+=a[t>>10&63],n+=a[t>>4&63],n+=a[t<<2&63],n+=a[64]):i===1&&(n+=a[t>>2&63],n+=a[t<<4&63],n+=a[64],n+=a[64]),n}function hn(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var or=new T("tag:yaml.org,2002:binary",{kind:"scalar",resolve:dn,construct:un,predicate:hn,represent:pn}),gn=Object.prototype.hasOwnProperty,mn=Object.prototype.toString;function fn(e){if(e===null)return!0;var n=[],t,r,i,o,a,s=e;for(t=0,r=s.length;t<r;t+=1){if(i=s[t],a=!1,mn.call(i)!=="[object Object]")return!1;for(o in i)if(gn.call(i,o))if(!a)a=!0;else return!1;if(!a)return!1;if(n.indexOf(o)===-1)n.push(o);else return!1}return!0}function bn(e){return e!==null?e:[]}var ar=new T("tag:yaml.org,2002:omap",{kind:"sequence",resolve:fn,construct:bn}),vn=Object.prototype.toString;function xn(e){if(e===null)return!0;var n,t,r,i,o,a=e;for(o=new Array(a.length),n=0,t=a.length;n<t;n+=1){if(r=a[n],vn.call(r)!=="[object Object]"||(i=Object.keys(r),i.length!==1))return!1;o[n]=[i[0],r[i[0]]]}return!0}function wn(e){if(e===null)return[];var n,t,r,i,o,a=e;for(o=new Array(a.length),n=0,t=a.length;n<t;n+=1)r=a[n],i=Object.keys(r),o[n]=[i[0],r[i[0]]];return o}var sr=new T("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:xn,construct:wn}),yn=Object.prototype.hasOwnProperty;function En(e){if(e===null)return!0;var n,t=e;for(n in t)if(yn.call(t,n)&&t[n]!==null)return!1;return!0}function Cn(e){return e!==null?e:{}}var lr=new T("tag:yaml.org,2002:set",{kind:"mapping",resolve:En,construct:Cn}),dt=er.extend({implicit:[ir,nr],explicit:[or,ar,sr,lr]}),N=Object.prototype.hasOwnProperty,Ge=1,cr=2,dr=3,Ne=4,it=1,kn=2,At=3,Sn=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Tn=/[\x85\u2028\u2029]/,$n=/[,\[\]\{\}]/,ur=/^(?:!|!!|![a-z\-]+!)$/i,pr=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function _t(e){return Object.prototype.toString.call(e)}function R(e){return e===10||e===13}function j(e){return e===9||e===32}function _(e){return e===9||e===32||e===10||e===13}function Q(e){return e===44||e===91||e===93||e===123||e===125}function An(e){var n;return 48<=e&&e<=57?e-48:(n=e|32,97<=n&&n<=102?n-97+10:-1)}function _n(e){return e===120?2:e===117?4:e===85?8:0}function In(e){return 48<=e&&e<=57?e-48:-1}function It(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
1011
+ `:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"\x85":e===95?"\xA0":e===76?"\u2028":e===80?"\u2029":""}function Mn(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function hr(e,n,t){n==="__proto__"?Object.defineProperty(e,n,{configurable:!0,enumerable:!0,writable:!0,value:t}):e[n]=t}var gr=new Array(256),mr=new Array(256);for(F=0;F<256;F++)gr[F]=It(F)?1:0,mr[F]=It(F);var F;function Ln(e,n){this.input=e,this.filename=n.filename||null,this.schema=n.schema||dt,this.onWarning=n.onWarning||null,this.legacy=n.legacy||!1,this.json=n.json||!1,this.listener=n.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function fr(e,n){var t={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return t.snippet=Pi(t),new A(n,t)}function f(e,n){throw fr(e,n)}function Oe(e,n){e.onWarning&&e.onWarning.call(null,fr(e,n))}var Mt={YAML:function(n,t,r){var i,o,a;n.version!==null&&f(n,"duplication of %YAML directive"),r.length!==1&&f(n,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),i===null&&f(n,"ill-formed argument of the YAML directive"),o=parseInt(i[1],10),a=parseInt(i[2],10),o!==1&&f(n,"unacceptable YAML version of the document"),n.version=r[0],n.checkLineBreaks=a<2,a!==1&&a!==2&&Oe(n,"unsupported YAML version of the document")},TAG:function(n,t,r){var i,o;r.length!==2&&f(n,"TAG directive accepts exactly two arguments"),i=r[0],o=r[1],ur.test(i)||f(n,"ill-formed tag handle (first argument) of the TAG directive"),N.call(n.tagMap,i)&&f(n,'there is a previously declared suffix for "'+i+'" tag handle'),pr.test(o)||f(n,"ill-formed tag prefix (second argument) of the TAG directive");try{o=decodeURIComponent(o)}catch{f(n,"tag prefix is malformed: "+o)}n.tagMap[i]=o}};function G(e,n,t,r){var i,o,a,s;if(n<t){if(s=e.input.slice(n,t),r)for(i=0,o=s.length;i<o;i+=1)a=s.charCodeAt(i),a===9||32<=a&&a<=1114111||f(e,"expected valid JSON character");else Sn.test(s)&&f(e,"the stream contains non-printable characters");e.result+=s}}function Lt(e,n,t,r){var i,o,a,s;for(k.isObject(t)||f(e,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(t),a=0,s=i.length;a<s;a+=1)o=i[a],N.call(n,o)||(hr(n,o,t[o]),r[o]=!0)}function Z(e,n,t,r,i,o,a,s,l){var c,d;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),c=0,d=i.length;c<d;c+=1)Array.isArray(i[c])&&f(e,"nested arrays are not supported inside keys"),typeof i=="object"&&_t(i[c])==="[object Object]"&&(i[c]="[object Object]");if(typeof i=="object"&&_t(i)==="[object Object]"&&(i="[object Object]"),i=String(i),n===null&&(n={}),r==="tag:yaml.org,2002:merge")if(Array.isArray(o))for(c=0,d=o.length;c<d;c+=1)Lt(e,n,o[c],t);else Lt(e,n,o,t);else!e.json&&!N.call(t,i)&&N.call(n,i)&&(e.line=a||e.line,e.lineStart=s||e.lineStart,e.position=l||e.position,f(e,"duplicated mapping key")),hr(n,i,o),delete t[i];return n}function ut(e){var n;n=e.input.charCodeAt(e.position),n===10?e.position++:n===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):f(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function y(e,n,t){for(var r=0,i=e.input.charCodeAt(e.position);i!==0;){for(;j(i);)i===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),i=e.input.charCodeAt(++e.position);if(n&&i===35)do i=e.input.charCodeAt(++e.position);while(i!==10&&i!==13&&i!==0);if(R(i))for(ut(e),i=e.input.charCodeAt(e.position),r++,e.lineIndent=0;i===32;)e.lineIndent++,i=e.input.charCodeAt(++e.position);else break}return t!==-1&&r!==0&&e.lineIndent<t&&Oe(e,"deficient indentation"),r}function je(e){var n=e.position,t;return t=e.input.charCodeAt(n),!!((t===45||t===46)&&t===e.input.charCodeAt(n+1)&&t===e.input.charCodeAt(n+2)&&(n+=3,t=e.input.charCodeAt(n),t===0||_(t)))}function pt(e,n){n===1?e.result+=" ":n>1&&(e.result+=k.repeat(`
1012
+ `,n-1))}function Dn(e,n,t){var r,i,o,a,s,l,c,d,u=e.kind,p=e.result,h;if(h=e.input.charCodeAt(e.position),_(h)||Q(h)||h===35||h===38||h===42||h===33||h===124||h===62||h===39||h===34||h===37||h===64||h===96||(h===63||h===45)&&(i=e.input.charCodeAt(e.position+1),_(i)||t&&Q(i)))return!1;for(e.kind="scalar",e.result="",o=a=e.position,s=!1;h!==0;){if(h===58){if(i=e.input.charCodeAt(e.position+1),_(i)||t&&Q(i))break}else if(h===35){if(r=e.input.charCodeAt(e.position-1),_(r))break}else{if(e.position===e.lineStart&&je(e)||t&&Q(h))break;if(R(h))if(l=e.line,c=e.lineStart,d=e.lineIndent,y(e,!1,-1),e.lineIndent>=n){s=!0,h=e.input.charCodeAt(e.position);continue}else{e.position=a,e.line=l,e.lineStart=c,e.lineIndent=d;break}}s&&(G(e,o,a,!1),pt(e,e.line-l),o=a=e.position,s=!1),j(h)||(a=e.position+1),h=e.input.charCodeAt(++e.position)}return G(e,o,a,!1),e.result?!0:(e.kind=u,e.result=p,!1)}function Rn(e,n){var t,r,i;if(t=e.input.charCodeAt(e.position),t!==39)return!1;for(e.kind="scalar",e.result="",e.position++,r=i=e.position;(t=e.input.charCodeAt(e.position))!==0;)if(t===39)if(G(e,r,e.position,!0),t=e.input.charCodeAt(++e.position),t===39)r=e.position,e.position++,i=e.position;else return!0;else R(t)?(G(e,r,i,!0),pt(e,y(e,!1,n)),r=i=e.position):e.position===e.lineStart&&je(e)?f(e,"unexpected end of the document within a single quoted scalar"):(e.position++,i=e.position);f(e,"unexpected end of the stream within a single quoted scalar")}function Pn(e,n){var t,r,i,o,a,s;if(s=e.input.charCodeAt(e.position),s!==34)return!1;for(e.kind="scalar",e.result="",e.position++,t=r=e.position;(s=e.input.charCodeAt(e.position))!==0;){if(s===34)return G(e,t,e.position,!0),e.position++,!0;if(s===92){if(G(e,t,e.position,!0),s=e.input.charCodeAt(++e.position),R(s))y(e,!1,n);else if(s<256&&gr[s])e.result+=mr[s],e.position++;else if((a=_n(s))>0){for(i=a,o=0;i>0;i--)s=e.input.charCodeAt(++e.position),(a=An(s))>=0?o=(o<<4)+a:f(e,"expected hexadecimal character");e.result+=Mn(o),e.position++}else f(e,"unknown escape sequence");t=r=e.position}else R(s)?(G(e,t,r,!0),pt(e,y(e,!1,n)),t=r=e.position):e.position===e.lineStart&&je(e)?f(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}f(e,"unexpected end of the stream within a double quoted scalar")}function Bn(e,n){var t=!0,r,i,o,a=e.tag,s,l=e.anchor,c,d,u,p,h,g=Object.create(null),m,b,w,v;if(v=e.input.charCodeAt(e.position),v===91)d=93,h=!1,s=[];else if(v===123)d=125,h=!0,s={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=s),v=e.input.charCodeAt(++e.position);v!==0;){if(y(e,!0,n),v=e.input.charCodeAt(e.position),v===d)return e.position++,e.tag=a,e.anchor=l,e.kind=h?"mapping":"sequence",e.result=s,!0;t?v===44&&f(e,"expected the node content, but found ','"):f(e,"missed comma between flow collection entries"),b=m=w=null,u=p=!1,v===63&&(c=e.input.charCodeAt(e.position+1),_(c)&&(u=p=!0,e.position++,y(e,!0,n))),r=e.line,i=e.lineStart,o=e.position,X(e,n,Ge,!1,!0),b=e.tag,m=e.result,y(e,!0,n),v=e.input.charCodeAt(e.position),(p||e.line===r)&&v===58&&(u=!0,v=e.input.charCodeAt(++e.position),y(e,!0,n),X(e,n,Ge,!1,!0),w=e.result),h?Z(e,s,g,b,m,w,r,i,o):u?s.push(Z(e,null,g,b,m,w,r,i,o)):s.push(m),y(e,!0,n),v=e.input.charCodeAt(e.position),v===44?(t=!0,v=e.input.charCodeAt(++e.position)):t=!1}f(e,"unexpected end of the stream within a flow collection")}function qn(e,n){var t,r,i=it,o=!1,a=!1,s=n,l=0,c=!1,d,u;if(u=e.input.charCodeAt(e.position),u===124)r=!1;else if(u===62)r=!0;else return!1;for(e.kind="scalar",e.result="";u!==0;)if(u=e.input.charCodeAt(++e.position),u===43||u===45)it===i?i=u===43?At:kn:f(e,"repeat of a chomping mode identifier");else if((d=In(u))>=0)d===0?f(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):a?f(e,"repeat of an indentation width identifier"):(s=n+d-1,a=!0);else break;if(j(u)){do u=e.input.charCodeAt(++e.position);while(j(u));if(u===35)do u=e.input.charCodeAt(++e.position);while(!R(u)&&u!==0)}for(;u!==0;){for(ut(e),e.lineIndent=0,u=e.input.charCodeAt(e.position);(!a||e.lineIndent<s)&&u===32;)e.lineIndent++,u=e.input.charCodeAt(++e.position);if(!a&&e.lineIndent>s&&(s=e.lineIndent),R(u)){l++;continue}if(e.lineIndent<s){i===At?e.result+=k.repeat(`
1013
+ `,o?1+l:l):i===it&&o&&(e.result+=`
1014
+ `);break}for(r?j(u)?(c=!0,e.result+=k.repeat(`
1015
+ `,o?1+l:l)):c?(c=!1,e.result+=k.repeat(`
1016
+ `,l+1)):l===0?o&&(e.result+=" "):e.result+=k.repeat(`
1017
+ `,l):e.result+=k.repeat(`
1018
+ `,o?1+l:l),o=!0,a=!0,l=0,t=e.position;!R(u)&&u!==0;)u=e.input.charCodeAt(++e.position);G(e,t,e.position,!1)}return!0}function Dt(e,n){var t,r=e.tag,i=e.anchor,o=[],a,s=!1,l;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=o),l=e.input.charCodeAt(e.position);l!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,f(e,"tab characters must not be used in indentation")),!(l!==45||(a=e.input.charCodeAt(e.position+1),!_(a))));){if(s=!0,e.position++,y(e,!0,-1)&&e.lineIndent<=n){o.push(null),l=e.input.charCodeAt(e.position);continue}if(t=e.line,X(e,n,dr,!1,!0),o.push(e.result),y(e,!0,-1),l=e.input.charCodeAt(e.position),(e.line===t||e.lineIndent>n)&&l!==0)f(e,"bad indentation of a sequence entry");else if(e.lineIndent<n)break}return s?(e.tag=r,e.anchor=i,e.kind="sequence",e.result=o,!0):!1}function zn(e,n,t){var r,i,o,a,s,l,c=e.tag,d=e.anchor,u={},p=Object.create(null),h=null,g=null,m=null,b=!1,w=!1,v;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=u),v=e.input.charCodeAt(e.position);v!==0;){if(!b&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,f(e,"tab characters must not be used in indentation")),r=e.input.charCodeAt(e.position+1),o=e.line,(v===63||v===58)&&_(r))v===63?(b&&(Z(e,u,p,h,g,null,a,s,l),h=g=m=null),w=!0,b=!0,i=!0):b?(b=!1,i=!0):f(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,v=r;else{if(a=e.line,s=e.lineStart,l=e.position,!X(e,t,cr,!1,!0))break;if(e.line===o){for(v=e.input.charCodeAt(e.position);j(v);)v=e.input.charCodeAt(++e.position);if(v===58)v=e.input.charCodeAt(++e.position),_(v)||f(e,"a whitespace character is expected after the key-value separator within a block mapping"),b&&(Z(e,u,p,h,g,null,a,s,l),h=g=m=null),w=!0,b=!1,i=!1,h=e.tag,g=e.result;else if(w)f(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=c,e.anchor=d,!0}else if(w)f(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=c,e.anchor=d,!0}if((e.line===o||e.lineIndent>n)&&(b&&(a=e.line,s=e.lineStart,l=e.position),X(e,n,Ne,!0,i)&&(b?g=e.result:m=e.result),b||(Z(e,u,p,h,g,m,a,s,l),h=g=m=null),y(e,!0,-1),v=e.input.charCodeAt(e.position)),(e.line===o||e.lineIndent>n)&&v!==0)f(e,"bad indentation of a mapping entry");else if(e.lineIndent<n)break}return b&&Z(e,u,p,h,g,null,a,s,l),w&&(e.tag=c,e.anchor=d,e.kind="mapping",e.result=u),w}function Hn(e){var n,t=!1,r=!1,i,o,a;if(a=e.input.charCodeAt(e.position),a!==33)return!1;if(e.tag!==null&&f(e,"duplication of a tag property"),a=e.input.charCodeAt(++e.position),a===60?(t=!0,a=e.input.charCodeAt(++e.position)):a===33?(r=!0,i="!!",a=e.input.charCodeAt(++e.position)):i="!",n=e.position,t){do a=e.input.charCodeAt(++e.position);while(a!==0&&a!==62);e.position<e.length?(o=e.input.slice(n,e.position),a=e.input.charCodeAt(++e.position)):f(e,"unexpected end of the stream within a verbatim tag")}else{for(;a!==0&&!_(a);)a===33&&(r?f(e,"tag suffix cannot contain exclamation marks"):(i=e.input.slice(n-1,e.position+1),ur.test(i)||f(e,"named tag handle cannot contain such characters"),r=!0,n=e.position+1)),a=e.input.charCodeAt(++e.position);o=e.input.slice(n,e.position),$n.test(o)&&f(e,"tag suffix cannot contain flow indicator characters")}o&&!pr.test(o)&&f(e,"tag name cannot contain such characters: "+o);try{o=decodeURIComponent(o)}catch{f(e,"tag name is malformed: "+o)}return t?e.tag=o:N.call(e.tagMap,i)?e.tag=e.tagMap[i]+o:i==="!"?e.tag="!"+o:i==="!!"?e.tag="tag:yaml.org,2002:"+o:f(e,'undeclared tag handle "'+i+'"'),!0}function Gn(e){var n,t;if(t=e.input.charCodeAt(e.position),t!==38)return!1;for(e.anchor!==null&&f(e,"duplication of an anchor property"),t=e.input.charCodeAt(++e.position),n=e.position;t!==0&&!_(t)&&!Q(t);)t=e.input.charCodeAt(++e.position);return e.position===n&&f(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(n,e.position),!0}function Nn(e){var n,t,r;if(r=e.input.charCodeAt(e.position),r!==42)return!1;for(r=e.input.charCodeAt(++e.position),n=e.position;r!==0&&!_(r)&&!Q(r);)r=e.input.charCodeAt(++e.position);return e.position===n&&f(e,"name of an alias node must contain at least one character"),t=e.input.slice(n,e.position),N.call(e.anchorMap,t)||f(e,'unidentified alias "'+t+'"'),e.result=e.anchorMap[t],y(e,!0,-1),!0}function X(e,n,t,r,i){var o,a,s,l=1,c=!1,d=!1,u,p,h,g,m,b;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,o=a=s=Ne===t||dr===t,r&&y(e,!0,-1)&&(c=!0,e.lineIndent>n?l=1:e.lineIndent===n?l=0:e.lineIndent<n&&(l=-1)),l===1)for(;Hn(e)||Gn(e);)y(e,!0,-1)?(c=!0,s=o,e.lineIndent>n?l=1:e.lineIndent===n?l=0:e.lineIndent<n&&(l=-1)):s=!1;if(s&&(s=c||i),(l===1||Ne===t)&&(Ge===t||cr===t?m=n:m=n+1,b=e.position-e.lineStart,l===1?s&&(Dt(e,b)||zn(e,b,m))||Bn(e,m)?d=!0:(a&&qn(e,m)||Rn(e,m)||Pn(e,m)?d=!0:Nn(e)?(d=!0,(e.tag!==null||e.anchor!==null)&&f(e,"alias node should not have any properties")):Dn(e,m,Ge===t)&&(d=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):l===0&&(d=s&&Dt(e,b))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&f(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),u=0,p=e.implicitTypes.length;u<p;u+=1)if(g=e.implicitTypes[u],g.resolve(e.result)){e.result=g.construct(e.result),e.tag=g.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(N.call(e.typeMap[e.kind||"fallback"],e.tag))g=e.typeMap[e.kind||"fallback"][e.tag];else for(g=null,h=e.typeMap.multi[e.kind||"fallback"],u=0,p=h.length;u<p;u+=1)if(e.tag.slice(0,h[u].tag.length)===h[u].tag){g=h[u];break}g||f(e,"unknown tag !<"+e.tag+">"),e.result!==null&&g.kind!==e.kind&&f(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+g.kind+'", not "'+e.kind+'"'),g.resolve(e.result,e.tag)?(e.result=g.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):f(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||d}function On(e){var n=e.position,t,r,i,o=!1,a;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(a=e.input.charCodeAt(e.position))!==0&&(y(e,!0,-1),a=e.input.charCodeAt(e.position),!(e.lineIndent>0||a!==37));){for(o=!0,a=e.input.charCodeAt(++e.position),t=e.position;a!==0&&!_(a);)a=e.input.charCodeAt(++e.position);for(r=e.input.slice(t,e.position),i=[],r.length<1&&f(e,"directive name must not be less than one character in length");a!==0;){for(;j(a);)a=e.input.charCodeAt(++e.position);if(a===35){do a=e.input.charCodeAt(++e.position);while(a!==0&&!R(a));break}if(R(a))break;for(t=e.position;a!==0&&!_(a);)a=e.input.charCodeAt(++e.position);i.push(e.input.slice(t,e.position))}a!==0&&ut(e),N.call(Mt,r)?Mt[r](e,r,i):Oe(e,'unknown document directive "'+r+'"')}if(y(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,y(e,!0,-1)):o&&f(e,"directives end mark is expected"),X(e,e.lineIndent-1,Ne,!1,!0),y(e,!0,-1),e.checkLineBreaks&&Tn.test(e.input.slice(n,e.position))&&Oe(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&je(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,y(e,!0,-1));return}if(e.position<e.length-1)f(e,"end of the stream or a document separator is expected");else return}function br(e,n){e=String(e),n=n||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
1019
+ `),e.charCodeAt(0)===65279&&(e=e.slice(1)));var t=new Ln(e,n),r=e.indexOf("\0");for(r!==-1&&(t.position=r,f(t,"null byte is not allowed in input")),t.input+="\0";t.input.charCodeAt(t.position)===32;)t.lineIndent+=1,t.position+=1;for(;t.position<t.length-1;)On(t);return t.documents}function Vn(e,n,t){n!==null&&typeof n=="object"&&typeof t>"u"&&(t=n,n=null);var r=br(e,t);if(typeof n!="function")return r;for(var i=0,o=r.length;i<o;i+=1)n(r[i])}function Fn(e,n){var t=br(e,n);if(t.length!==0){if(t.length===1)return t[0];throw new A("expected a single document in the stream, but found more")}}var jn=Vn,Un=Fn,vr={loadAll:jn,load:Un},xr=Object.prototype.toString,wr=Object.prototype.hasOwnProperty,ht=65279,Yn=9,fe=10,Kn=13,Wn=32,Qn=33,Zn=34,ot=35,Xn=37,Jn=38,eo=39,to=42,yr=44,ro=45,Ve=58,io=61,no=62,oo=63,ao=64,Er=91,Cr=93,so=96,kr=123,lo=124,Sr=125,$={};$[0]="\\0";$[7]="\\a";$[8]="\\b";$[9]="\\t";$[10]="\\n";$[11]="\\v";$[12]="\\f";$[13]="\\r";$[27]="\\e";$[34]='\\"';$[92]="\\\\";$[133]="\\N";$[160]="\\_";$[8232]="\\L";$[8233]="\\P";var co=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],uo=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function po(e,n){var t,r,i,o,a,s,l;if(n===null)return{};for(t={},r=Object.keys(n),i=0,o=r.length;i<o;i+=1)a=r[i],s=String(n[a]),a.slice(0,2)==="!!"&&(a="tag:yaml.org,2002:"+a.slice(2)),l=e.compiledTypeMap.fallback[a],l&&wr.call(l.styleAliases,s)&&(s=l.styleAliases[s]),t[a]=s;return t}function ho(e){var n,t,r;if(n=e.toString(16).toUpperCase(),e<=255)t="x",r=2;else if(e<=65535)t="u",r=4;else if(e<=4294967295)t="U",r=8;else throw new A("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+t+k.repeat("0",r-n.length)+n}var go=1,be=2;function mo(e){this.schema=e.schema||dt,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=k.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=po(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?be:go,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Rt(e,n){for(var t=k.repeat(" ",n),r=0,i=-1,o="",a,s=e.length;r<s;)i=e.indexOf(`
1020
+ `,r),i===-1?(a=e.slice(r),r=s):(a=e.slice(r,i+1),r=i+1),a.length&&a!==`
1021
+ `&&(o+=t),o+=a;return o}function at(e,n){return`
1022
+ `+k.repeat(" ",e.indent*n)}function fo(e,n){var t,r,i;for(t=0,r=e.implicitTypes.length;t<r;t+=1)if(i=e.implicitTypes[t],i.resolve(n))return!0;return!1}function Fe(e){return e===Wn||e===Yn}function ve(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==ht||65536<=e&&e<=1114111}function Pt(e){return ve(e)&&e!==ht&&e!==Kn&&e!==fe}function Bt(e,n,t){var r=Pt(e),i=r&&!Fe(e);return(t?r:r&&e!==yr&&e!==Er&&e!==Cr&&e!==kr&&e!==Sr)&&e!==ot&&!(n===Ve&&!i)||Pt(n)&&!Fe(n)&&e===ot||n===Ve&&i}function bo(e){return ve(e)&&e!==ht&&!Fe(e)&&e!==ro&&e!==oo&&e!==Ve&&e!==yr&&e!==Er&&e!==Cr&&e!==kr&&e!==Sr&&e!==ot&&e!==Jn&&e!==to&&e!==Qn&&e!==lo&&e!==io&&e!==no&&e!==eo&&e!==Zn&&e!==Xn&&e!==ao&&e!==so}function vo(e){return!Fe(e)&&e!==Ve}function ge(e,n){var t=e.charCodeAt(n),r;return t>=55296&&t<=56319&&n+1<e.length&&(r=e.charCodeAt(n+1),r>=56320&&r<=57343)?(t-55296)*1024+r-56320+65536:t}function Tr(e){var n=/^\n* /;return n.test(e)}var $r=1,st=2,Ar=3,_r=4,W=5;function xo(e,n,t,r,i,o,a,s){var l,c=0,d=null,u=!1,p=!1,h=r!==-1,g=-1,m=bo(ge(e,0))&&vo(ge(e,e.length-1));if(n||a)for(l=0;l<e.length;c>=65536?l+=2:l++){if(c=ge(e,l),!ve(c))return W;m=m&&Bt(c,d,s),d=c}else{for(l=0;l<e.length;c>=65536?l+=2:l++){if(c=ge(e,l),c===fe)u=!0,h&&(p=p||l-g-1>r&&e[g+1]!==" ",g=l);else if(!ve(c))return W;m=m&&Bt(c,d,s),d=c}p=p||h&&l-g-1>r&&e[g+1]!==" "}return!u&&!p?m&&!a&&!i(e)?$r:o===be?W:st:t>9&&Tr(e)?W:a?o===be?W:st:p?_r:Ar}function wo(e,n,t,r,i){e.dump=function(){if(n.length===0)return e.quotingType===be?'""':"''";if(!e.noCompatMode&&(co.indexOf(n)!==-1||uo.test(n)))return e.quotingType===be?'"'+n+'"':"'"+n+"'";var o=e.indent*Math.max(1,t),a=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-o),s=r||e.flowLevel>-1&&t>=e.flowLevel;function l(c){return fo(e,c)}switch(xo(n,s,e.indent,a,l,e.quotingType,e.forceQuotes&&!r,i)){case $r:return n;case st:return"'"+n.replace(/'/g,"''")+"'";case Ar:return"|"+qt(n,e.indent)+zt(Rt(n,o));case _r:return">"+qt(n,e.indent)+zt(Rt(yo(n,a),o));case W:return'"'+Eo(n)+'"';default:throw new A("impossible error: invalid scalar style")}}()}function qt(e,n){var t=Tr(e)?String(n):"",r=e[e.length-1]===`
1023
+ `,i=r&&(e[e.length-2]===`
1024
+ `||e===`
1025
+ `),o=i?"+":r?"":"-";return t+o+`
1026
+ `}function zt(e){return e[e.length-1]===`
1027
+ `?e.slice(0,-1):e}function yo(e,n){for(var t=/(\n+)([^\n]*)/g,r=function(){var c=e.indexOf(`
1028
+ `);return c=c!==-1?c:e.length,t.lastIndex=c,Ht(e.slice(0,c),n)}(),i=e[0]===`
1029
+ `||e[0]===" ",o,a;a=t.exec(e);){var s=a[1],l=a[2];o=l[0]===" ",r+=s+(!i&&!o&&l!==""?`
1030
+ `:"")+Ht(l,n),i=o}return r}function Ht(e,n){if(e===""||e[0]===" ")return e;for(var t=/ [^ ]/g,r,i=0,o,a=0,s=0,l="";r=t.exec(e);)s=r.index,s-i>n&&(o=a>i?a:s,l+=`
1031
+ `+e.slice(i,o),i=o+1),a=s;return l+=`
1032
+ `,e.length-i>n&&a>i?l+=e.slice(i,a)+`
1033
+ `+e.slice(a+1):l+=e.slice(i),l.slice(1)}function Eo(e){for(var n="",t=0,r,i=0;i<e.length;t>=65536?i+=2:i++)t=ge(e,i),r=$[t],!r&&ve(t)?(n+=e[i],t>=65536&&(n+=e[i+1])):n+=r||ho(t);return n}function Co(e,n,t){var r="",i=e.tag,o,a,s;for(o=0,a=t.length;o<a;o+=1)s=t[o],e.replacer&&(s=e.replacer.call(t,String(o),s)),(z(e,n,s,!1,!1)||typeof s>"u"&&z(e,n,null,!1,!1))&&(r!==""&&(r+=","+(e.condenseFlow?"":" ")),r+=e.dump);e.tag=i,e.dump="["+r+"]"}function Gt(e,n,t,r){var i="",o=e.tag,a,s,l;for(a=0,s=t.length;a<s;a+=1)l=t[a],e.replacer&&(l=e.replacer.call(t,String(a),l)),(z(e,n+1,l,!0,!0,!1,!0)||typeof l>"u"&&z(e,n+1,null,!0,!0,!1,!0))&&((!r||i!=="")&&(i+=at(e,n)),e.dump&&fe===e.dump.charCodeAt(0)?i+="-":i+="- ",i+=e.dump);e.tag=o,e.dump=i||"[]"}function ko(e,n,t){var r="",i=e.tag,o=Object.keys(t),a,s,l,c,d;for(a=0,s=o.length;a<s;a+=1)d="",r!==""&&(d+=", "),e.condenseFlow&&(d+='"'),l=o[a],c=t[l],e.replacer&&(c=e.replacer.call(t,l,c)),z(e,n,l,!1,!1)&&(e.dump.length>1024&&(d+="? "),d+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),z(e,n,c,!1,!1)&&(d+=e.dump,r+=d));e.tag=i,e.dump="{"+r+"}"}function So(e,n,t,r){var i="",o=e.tag,a=Object.keys(t),s,l,c,d,u,p;if(e.sortKeys===!0)a.sort();else if(typeof e.sortKeys=="function")a.sort(e.sortKeys);else if(e.sortKeys)throw new A("sortKeys must be a boolean or a function");for(s=0,l=a.length;s<l;s+=1)p="",(!r||i!=="")&&(p+=at(e,n)),c=a[s],d=t[c],e.replacer&&(d=e.replacer.call(t,c,d)),z(e,n+1,c,!0,!0,!0)&&(u=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,u&&(e.dump&&fe===e.dump.charCodeAt(0)?p+="?":p+="? "),p+=e.dump,u&&(p+=at(e,n)),z(e,n+1,d,!0,u)&&(e.dump&&fe===e.dump.charCodeAt(0)?p+=":":p+=": ",p+=e.dump,i+=p));e.tag=o,e.dump=i||"{}"}function Nt(e,n,t){var r,i,o,a,s,l;for(i=t?e.explicitTypes:e.implicitTypes,o=0,a=i.length;o<a;o+=1)if(s=i[o],(s.instanceOf||s.predicate)&&(!s.instanceOf||typeof n=="object"&&n instanceof s.instanceOf)&&(!s.predicate||s.predicate(n))){if(t?s.multi&&s.representName?e.tag=s.representName(n):e.tag=s.tag:e.tag="?",s.represent){if(l=e.styleMap[s.tag]||s.defaultStyle,xr.call(s.represent)==="[object Function]")r=s.represent(n,l);else if(wr.call(s.represent,l))r=s.represent[l](n,l);else throw new A("!<"+s.tag+'> tag resolver accepts not "'+l+'" style');e.dump=r}return!0}return!1}function z(e,n,t,r,i,o,a){e.tag=null,e.dump=t,Nt(e,t,!1)||Nt(e,t,!0);var s=xr.call(e.dump),l=r,c;r&&(r=e.flowLevel<0||e.flowLevel>n);var d=s==="[object Object]"||s==="[object Array]",u,p;if(d&&(u=e.duplicates.indexOf(t),p=u!==-1),(e.tag!==null&&e.tag!=="?"||p||e.indent!==2&&n>0)&&(i=!1),p&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(d&&p&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),s==="[object Object]")r&&Object.keys(e.dump).length!==0?(So(e,n,e.dump,i),p&&(e.dump="&ref_"+u+e.dump)):(ko(e,n,e.dump),p&&(e.dump="&ref_"+u+" "+e.dump));else if(s==="[object Array]")r&&e.dump.length!==0?(e.noArrayIndent&&!a&&n>0?Gt(e,n-1,e.dump,i):Gt(e,n,e.dump,i),p&&(e.dump="&ref_"+u+e.dump)):(Co(e,n,e.dump),p&&(e.dump="&ref_"+u+" "+e.dump));else if(s==="[object String]")e.tag!=="?"&&wo(e,e.dump,n,o,l);else{if(s==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new A("unacceptable kind of an object to dump "+s)}e.tag!==null&&e.tag!=="?"&&(c=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",e.dump=c+" "+e.dump)}return!0}function To(e,n){var t=[],r=[],i,o;for(lt(e,t,r),i=0,o=r.length;i<o;i+=1)n.duplicates.push(t[r[i]]);n.usedDuplicates=new Array(o)}function lt(e,n,t){var r,i,o;if(e!==null&&typeof e=="object")if(i=n.indexOf(e),i!==-1)t.indexOf(i)===-1&&t.push(i);else if(n.push(e),Array.isArray(e))for(i=0,o=e.length;i<o;i+=1)lt(e[i],n,t);else for(r=Object.keys(e),i=0,o=r.length;i<o;i+=1)lt(e[r[i]],n,t)}function $o(e,n){n=n||{};var t=new mo(n);t.noRefs||To(e,t);var r=e;return t.replacer&&(r=t.replacer.call({"":r},"",r)),z(t,0,r,!0,!0)?t.dump+`
1034
+ `:""}var Ao=$o,_o={dump:Ao};function gt(e,n){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+n+" instead, which is now safe by default.")}}var Io=T,Mo=Ft,Lo=Kt,Do=Jt,Ro=er,Po=dt,Bo=vr.load,qo=vr.loadAll,zo=_o.dump,Ho=A,Go={binary:or,float:Xt,map:Yt,null:Wt,pairs:sr,set:lr,timestamp:ir,bool:Qt,int:Zt,merge:nr,omap:ar,seq:Ut,str:jt},No=gt("safeLoad","load"),Oo=gt("safeLoadAll","loadAll"),Vo=gt("safeDump","dump"),Ir={Type:Io,Schema:Mo,FAILSAFE_SCHEMA:Lo,JSON_SCHEMA:Do,CORE_SCHEMA:Ro,DEFAULT_SCHEMA:Po,load:Bo,loadAll:qo,dump:zo,YAMLException:Ho,types:Go,safeLoad:No,safeLoadAll:Oo,safeDump:Vo};var U=["#10b981","#f59e0b","#06b6d4","#ec4899","#8b5cf6","#3b82f6","#f43f5e","#84cc16","#a855f7","#6366f1"];function S(e){let n=e.length,t;for(;n!==0;)t=Math.floor(Math.random()*n),n--,[e[n],e[t]]=[e[t],e[n]];return e}var P=(e,n=0)=>{let t=3735928559^n,r=1103547991^n;for(let i=0,o;i<e.length;i++)o=e.charCodeAt(i),t=Math.imul(t^o,265443561),r=Math.imul(r^o,159334677);return t=Math.imul(t^r>>>16,2246822507)^Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507)^Math.imul(t^t>>>13,3266489909),(4294967296*(2009751&r)+(t>>>0)).toString()};function E(e){return e.replace(/[&<>"']/g,n=>n==="&"?"&amp;":n==="<"?"&lt;":n===">"?"&gt;":n==='"'?"&quot;":"&#39;")}function Fo(e){try{return Ir.load(e)}catch(n){throw new Error(`Invalid YAML assets:
1035
+ ${n instanceof Error?n.message:String(n)}`)}}function I(e){return typeof e=="string"}function mt(e){return typeof e=="number"}function ft(e){return/^(\d{1,2}:)?\d{1,2}:\d{2}$/.test(e)}function Mr(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function Ue(e){return typeof e=="object"&&e!==null&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null)}function Y(e){return e.split("|").map(n=>n.trim()).filter(Boolean)}var J=e=>[...new Set(e)];var xe=class extends Error{constructor(n){super(`Asset validation failed:n- ${n.join(`
1036
+ - `)}`),this.name="AssetValidationError",this.issues=n}};function jo(e){let n=[];if(!Ue(e))throw new xe(["Top-level assets must be an object/map like { mango: {...}, trend: {...} }"]);let t=e,r={};for(let[o,a]of Object.entries(t)){if(!o||typeof o!="string"){n.push(`Asset key must be a non-empty string (got: ${String(o)})`);continue}if(/^[a-zA-Z0-9._-]+$/.test(o)||n.push(`Asset id "${o}" has invalid chars; use letters/numbers/._-`),!Ue(a)){n.push(`Asset "${o}" must be an object (got: ${Mr(a)})`);continue}let s=a,l=s.type,c=!!s.dialog;if(!I(l)){n.push(`Asset "${o}" missing string field "type"`);continue}if(!Uo(l)){n.push(`Asset "${o}" has unsupported type "${l}" (use image|video|audio|html)`);continue}switch(l){case"image":{let d=s.url;I(d)||n.push(`Asset "${o}" (image) missing "url"`);let u=s.size;u!==void 0&&!I(u)&&n.push(`Asset "${o}" (image) field "size" must be a string`),I(d)&&(r[o]={id:o,type:l,dialog:c,url:d,...I(u)?{size:u}:{}});break}case"video":{let d=s.url;I(d)||n.push(`Asset "${o}" (video) missing "url"`);let u=s.span,p;if(u!==void 0)if(!Ue(u))n.push(`Asset "${o}" (video) field "span" must be an object`);else{let h=u.from,g=u.to;!I(h)||!I(g)?n.push(`Asset "${o}" (video) span requires string "from" and "to"`):((!ft(h)||!ft(g))&&n.push(`Asset "${o}" (video) span times should look like "02:15" or "01:02:45"`),p={from:h,to:g})}I(d)&&(r[o]={id:o,type:l,dialog:c,url:d,...p?{span:p}:{}});break}case"audio":{let d=s.url;I(d)||n.push(`Asset "${o}" (audio) missing "url"`);let u=s.volume;u!==void 0&&(!mt(u)||!Number.isFinite(u)?n.push(`Asset "${o}" (audio) field "volume" must be a number`):(u<0||u>100)&&n.push(`Asset "${o}" (audio) field "volume" must be between 0 and 100`)),I(d)&&(r[o]={id:o,type:l,dialog:c,url:d,...mt(u)?{volume:u}:{}});break}case"html":{let d=s.content;if(!I(d)){n.push(`Asset "${o}" (html) missing string field "content"`);break}r[o]={id:o,type:l,dialog:c,content:d};break}case"tts":{let d=s.content;if(!I(d)){n.push(`Asset "${o}" (tts) missing string field "content"`);break}r[o]={id:o,type:l,dialog:c,content:d};break}}}if(n.length)throw new xe(n);let i=Object.keys(r).sort((o,a)=>o.localeCompare(a)).map(o=>r[o]);return{assetsById:r,assetsList:i}}function Uo(e){return e==="image"||e==="video"||e==="audio"||e==="html"}function we(e,n,t){let r=0,i=0;return e.forEach(a=>{a.items.forEach(s=>{i++;let l=n.get(s),c=t.querySelector(`[data-label="${s}"]`);l===a.label?(r++,c.chipState="correct"):c.chipState="wrong"})}),{score:i>0?Math.round(r/i*100):0,correct:r,total:i}}var ye=class extends x{constructor(t,r,i){super(t,r,i);this.interactionMechanic="static";this.categories=["none"];this.allItems=[];this.categoryColors=["#94a3b8","#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#ec4899","#14b8a6","#f97316","#6366f1"];this.currentColor=this.categoryColors[0];this.data.categories.forEach(({label:o,items:a})=>{this.categories.push(o),this.allItems.push(...a)}),this.currentCategory=this.categories[0],this.data.distractors&&this.allItems.push(...this.data.distractors),this.allItems=S(this.allItems),this.categorized=new Map,this.initializeProgress(this.allItems.length)}initialize(){}cleanup(){}onVariantChange(t){this.querySelectorAll("edu-chip, edu-block").forEach(r=>{r.variant!==void 0&&(r.variant=t)})}render(){this.innerHTML=`
1037
+ <style>
1038
+ open-classification {
1039
+ --current-color: #94a3b8;
1040
+ display: flex;
1041
+ width: 100%;
1042
+ height: 100%;
1043
+ box-sizing: border-box;
1044
+ container-type: size;
1045
+ container-name: open-classification;
1046
+ }
1047
+
1048
+ .container {
1049
+ display: flex;
1050
+ flex-direction: column;
1051
+ width: 100%;
1052
+ height: 100%;
1053
+ gap: clamp(0.5rem, min(1.6cqw, 1.6cqh), 1rem);
1054
+ padding: clamp(0.75rem, min(2cqw, 2cqh), 1.5rem);
1055
+ box-sizing: border-box;
1056
+ overflow: hidden;
1057
+ }
1058
+
1059
+ @container open-classification (max-width: 768px) {
1060
+ .container {
1061
+ padding: clamp(0.75rem, min(1.6cqw, 1.6cqh), 1rem);
1062
+ }
1063
+ }
1064
+
1065
+ .items-section {
1066
+ flex: 1;
1067
+ display: flex;
1068
+ flex-direction: column;
1069
+ gap: clamp(0.25rem, min(1cqw, 1cqh), 0.5rem);
1070
+ min-height: 0;
1071
+ overflow: hidden;
1072
+ }
1073
+
1074
+ .items-label {
1075
+ font-size: clamp(0.8rem, 1.8cqh, 1rem);
1076
+ font-weight: 600;
1077
+ color: rgb(var(--edu-second-ink));
1078
+ flex-shrink: 0;
1079
+ }
1080
+
1081
+ .items-container {
1082
+ display: grid;
1083
+ grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
1084
+ grid-auto-rows: minmax(44px, 1fr);
1085
+ gap: clamp(0.5rem, min(1.6cqw, 1.6cqh), 1rem);
1086
+ padding: clamp(0.5rem, min(1.6cqw, 1.6cqh), 1.25rem);
1087
+ background: rgb(var(--edu-muted));
1088
+ border-radius: clamp(6px, 1.6cqw, 8px);
1089
+ flex: 1;
1090
+ overflow-y: auto;
1091
+ overflow-x: hidden;
1092
+ align-content: stretch;
1093
+ min-height: 0;
1094
+ }
1095
+
1096
+ .items-container edu-chip {
1097
+ width: 100%;
1098
+ height: 100%;
1099
+ cursor: pointer;
1100
+ transition: transform 0.2s ease, box-shadow 0.2s ease;
1101
+ }
1102
+
1103
+ .items-container edu-chip:hover {
1104
+ transform: translateY(-3px);
1105
+ box-shadow: 0 6px 16px rgba(var(--edu-shadow-color), 0.15);
1106
+ }
1107
+
1108
+ .items-container edu-chip::part(block) {
1109
+ width: 100%;
1110
+ height: 100%;
1111
+ display: flex;
1112
+ align-items: center;
1113
+ justify-content: center;
1114
+ }
1115
+
1116
+ @container open-classification (max-width: 1024px) {
1117
+ .items-container {
1118
+ grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
1119
+ gap: clamp(0.5rem, min(1.4cqw, 1.4cqh), 0.875rem);
1120
+ }
1121
+ }
1122
+
1123
+ @container open-classification (max-width: 768px) {
1124
+ .items-container {
1125
+ grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr));
1126
+ padding: clamp(0.5rem, min(1.2cqw, 1.2cqh), 1rem);
1127
+ gap: clamp(0.5rem, min(1.2cqw, 1.2cqh), 0.75rem);
1128
+ }
1129
+ }
1130
+
1131
+ @container open-classification (max-width: 560px) {
1132
+ .items-container {
1133
+ grid-template-columns: repeat(auto-fit, minmax(min(100%, 110px), 1fr));
1134
+ }
1135
+ }
1136
+
1137
+ .divider {
1138
+ border: none;
1139
+ border-top: 1px solid rgb(var(--edu-border));
1140
+ margin: 0;
1141
+ flex-shrink: 0;
1142
+ }
1143
+
1144
+ .swatch-section {
1145
+ flex-shrink: 0;
1146
+ display: flex;
1147
+ flex-direction: column;
1148
+ gap: clamp(0.25rem, min(1cqw, 1cqh), 0.5rem);
1149
+ }
1150
+
1151
+ .swatch-label {
1152
+ font-size: clamp(0.8rem, 1.8cqh, 1rem);
1153
+ font-weight: 600;
1154
+ color: rgb(var(--edu-second-ink));
1155
+ flex-shrink: 0;
1156
+ }
1157
+
1158
+ .categories-bar {
1159
+ display: grid;
1160
+ grid-template-columns: repeat(auto-fit, minmax(min(100%, 110px), 1fr));
1161
+ gap: clamp(0.4rem, min(1.2cqw, 1.2cqh), 0.75rem);
1162
+ }
1163
+
1164
+ #categories-bar edu-block::part(block) {
1165
+ padding: clamp(0.35rem, min(1cqw, 1cqh), 0.6rem);
1166
+ font-size: clamp(0.75rem, 1.6cqh, 0.95rem);
1167
+ min-height: clamp(44px, 8cqh, 64px);
1168
+ }
1169
+
1170
+ #categories-bar edu-block.active::part(block) {
1171
+ background: var(--category-color);
1172
+ border-color: var(--category-color);
1173
+ color: rgb(var(--edu-inverted-ink));
1174
+ box-shadow: 0 0 0 3px rgb(var(--edu-first-accent) / 0.2);
1175
+ }
1176
+ </style>
1177
+
1178
+ <div class="container">
1179
+ <div class="items-section">
1180
+ <!--Sacrificing label for space-->
1181
+ <div class="items-container"></div>
1182
+ </div>
1183
+
1184
+ <hr class="divider">
1185
+
1186
+ <div class="swatch-section">
1187
+ <div class="swatch-label">Categories</div>
1188
+ </div>
1189
+
1190
+ <div class="categories-bar" id="categories-bar">
1191
+ <!-- Categories populated dynamically -->
1192
+ </div>
1193
+ </div>
1194
+ `,this.style.setProperty("--current-color",this.currentColor),this.$categoriesBar=this.querySelector("#categories-bar"),this.setCategories(this.$categoriesBar);let t=this.querySelector(".items-container");this.setItems(t)}setItems(t){this.allItems.forEach((r,i)=>{let o=document.createElement("edu-chip");o.variant=this.config.variant,o.dataset.label=r,D(r,o,this.assets?.assetsById),o.addEventListener("click",a=>{let s=a.currentTarget,l=s.dataset.label;if(this.categorized.get(l)===this.currentCategory){this.categorized.delete(l),s.colored=!1,this.decrementProgress(),this.emitStateChange();return}this.categorized.has(l)||this.incrementProgress(),this.categorized.set(l,this.currentCategory),s.color=this.currentColor,s.colored=!0,this.emitStateChange()}),t.append(o)})}setCategories(t){this.categories.forEach((r,i)=>{let o=new V;o.variant=this.config.variant;let a=this.categoryColors[i%this.categoryColors.length];o.dataset.category=r,o.dataset.color=a,o.style.setProperty("--category-color",a),o.innerHTML=`
1195
+ <div class="category-label">${r}</div>
1196
+ `,o.addEventListener("click",s=>{let l=s.currentTarget;this.currentCategory=l.dataset.category,this.currentColor=l.dataset.color,this.style.setProperty("--current-color",this.currentColor),t.querySelectorAll("edu-block").forEach(c=>c.classList.remove("active")),o.classList.add("active")}),r===this.currentCategory&&o.classList.add("active"),t.append(o)})}getCurrentState(){return{categorized:Object.fromEntries(this.categorized),progress:this.progressTracker.current}}isInteractionComplete(){if(this.categorized.size!==this.allItems.length)return!1;for(let t of this.categorized.values())if(t==null)return!1;return!0}onHint(){let t=this.allItems.filter(i=>!this.categorized.has(i));if(t.length===0){alert('All items are categorized! Click "Check" to submit.'),this.emitHintShown("All items categorized");return}let r=t[0];alert(`Hint: You haven't categorized "${r}" yet. Which category does it belong to?`),this.emitHintShown(`Uncategorized item: ${r}`)}submit(){super.submit();let t=we(this.data.categories,this.categorized,this);console.log(`Classification Score: ${t.score.toFixed(1)}% (${t.correct}/${t.total} correct)`),this.dispatchEvent(new CustomEvent("interaction:graded",{detail:{result:t},bubbles:!0,composed:!0})),this.setAttribute("inert","")}reset(){super.reset(),this.categorized.clear(),this.querySelectorAll("edu-chip").forEach(t=>{t.classList.remove("colorized"),t.style.setProperty("--current-color","")})}};customElements.get("open-classification")||customElements.define("open-classification",ye);var Ee=class extends x{constructor(t,r,i){super(t,r,i);this.interactionMechanic="automatic-sequencing";this.categories=[];this.allItems=[];this.categorized=new Map;this.zones=[];this.chips=[];this.activeChip=null;this.currentZone=null;this.isDragging=!1;this.startX=0;this.startY=0;this.offsetX=0;this.offsetY=0;this.data.categories.forEach(({label:o,items:a})=>{this.categories.push(o),this.allItems.push(...a)}),this.data.distractors&&console.warn("Found a distractor in a Sequential Classification interaction, those are not useful and will be ignored"),this.allItems=this.config.shuffle?S(this.allItems):this.allItems,this.initializeProgress(this.allItems.length),this.boundPointerMove=this.handlePointerMove.bind(this),this.boundPointerUp=this.handlePointerUp.bind(this),this.variant=this.config.variant}initialize(){window.addEventListener("pointermove",this.boundPointerMove),window.addEventListener("pointerup",this.boundPointerUp)}cleanup(){window.removeEventListener("pointermove",this.boundPointerMove),window.removeEventListener("pointerup",this.boundPointerUp)}onVariantChange(t){this.querySelectorAll("edu-chip, edu-block").forEach(r=>{r.variant!==void 0&&(r.variant=t)}),this.variant=t}render(){let t=Math.min(this.categories.length,4);this.innerHTML=`
1197
+ <style>
1198
+ sequential-classification {
1199
+ display: flex;
1200
+ width: 100%;
1201
+ height: 100%;
1202
+ box-sizing: border-box;
1203
+ container-type: size;
1204
+ container-name: sequential-classification;
1205
+ }
1206
+
1207
+ #container {
1208
+ position: relative;
1209
+ display: flex;
1210
+ flex-direction: column;
1211
+ width: 100%;
1212
+ height: 100%;
1213
+ gap: clamp(0.5rem, min(1.6cqw, 1.6cqh), 1rem);
1214
+ padding: clamp(0.75rem, min(2cqw, 2cqh), 1.5rem);
1215
+ background: rgb(var(--edu-bg));
1216
+ border-radius: clamp(8px, 2cqw, 12px);
1217
+ overflow: hidden;
1218
+ box-sizing: border-box;
1219
+ }
1220
+
1221
+ .center-zone-container {
1222
+ flex-shrink: 0;
1223
+ display: flex;
1224
+ flex-direction: column;
1225
+ gap: clamp(0.25rem, min(1cqw, 1cqh), 0.5rem);
1226
+ }
1227
+
1228
+ .center-zone-label {
1229
+ font-size: clamp(0.8rem, 1.8cqh, 1rem);
1230
+ font-weight: 600;
1231
+ color: rgb(var(--edu-second-ink));
1232
+ }
1233
+
1234
+ #center-zone {
1235
+ min-height: clamp(70px, 12cqh, 120px);
1236
+ height: clamp(70px, 12cqh, 120px);
1237
+ display: flex;
1238
+ align-items: center;
1239
+ justify-content: center;
1240
+ background: rgba(var(--edu-muted), 0.5);
1241
+ border-radius: clamp(8px, 2cqw, 12px);
1242
+ border: 2px dashed rgb(var(--edu-border));
1243
+ position: relative;
1244
+ }
1245
+
1246
+ #center-zone.empty::before {
1247
+ content: 'All items categorized!';
1248
+ color: rgb(var(--edu-third-ink));
1249
+ font-size: 0.9rem;
1250
+ opacity: 0.6;
1251
+ }
1252
+
1253
+ .zones-container {
1254
+ flex: 1;
1255
+ display: flex;
1256
+ flex-direction: column;
1257
+ gap: clamp(0.25rem, min(1cqw, 1cqh), 0.5rem);
1258
+ min-height: 0;
1259
+ overflow: hidden;
1260
+ }
1261
+
1262
+ .zones-label {
1263
+ font-size: clamp(0.8rem, 1.8cqh, 1rem);
1264
+ font-weight: 600;
1265
+ color: rgb(var(--edu-second-ink));
1266
+ flex-shrink: 0;
1267
+ }
1268
+
1269
+ #zones-grid {
1270
+ position: relative;
1271
+ flex: 1;
1272
+ display: grid;
1273
+ grid-template-columns: repeat(${t}, minmax(0, 1fr));
1274
+ grid-auto-rows: minmax(44px, 1fr);
1275
+ gap: clamp(0.5rem, min(1.5cqw, 1.5cqh), 1rem);
1276
+ overflow-y: auto;
1277
+ overflow-x: hidden;
1278
+ align-content: stretch;
1279
+ padding: clamp(0.25rem, min(1cqw, 1cqh), 0.5rem);
1280
+ min-height: 0;
1281
+ }
1282
+
1283
+ .zone {
1284
+ border-radius: 8px;
1285
+ box-shadow: 0 4px 6px -1px rgb(var(--edu-shadow-color) / 0.1);
1286
+ transition: all 0.3s ease;
1287
+ font-weight: 700;
1288
+ font-size: clamp(1rem, 3cqh, 1.6rem);
1289
+ text-align: center;
1290
+ border: 3px solid transparent;
1291
+ opacity: 0.8;
1292
+ display: flex;
1293
+ align-items: center;
1294
+ justify-content: center;
1295
+ position: relative;
1296
+ height: 100%;
1297
+ }
1298
+
1299
+ .zone.highlight {
1300
+ transform: scale(1.02);
1301
+ opacity: 1;
1302
+ box-shadow: 0 8px 16px rgba(var(--edu-first-accent), 0.3);
1303
+ }
1304
+
1305
+ .zone.empty::after {
1306
+ content: 'Drop here';
1307
+ position: absolute;
1308
+ bottom: 0.5rem;
1309
+ font-size: clamp(0.7rem, 1.8cqh, 0.9rem);
1310
+ font-weight: 500;
1311
+ opacity: 0.4;
1312
+ color: rgb(var(--edu-ink));
1313
+ }
1314
+
1315
+ edu-block::part(block) {
1316
+ height: 100%;
1317
+ }
1318
+
1319
+ edu-chip {
1320
+ position: absolute;
1321
+ user-select: none;
1322
+ touch-action: none;
1323
+ transition: transform 0.2s ease;
1324
+ }
1325
+
1326
+ edu-chip:hover {
1327
+ transform: scale(1.05);
1328
+ }
1329
+
1330
+ edu-chip.dragging {
1331
+ }
1332
+
1333
+ @container sequential-classification (max-width: 920px) {
1334
+ #zones-grid {
1335
+ grid-template-columns: repeat(${Math.min(t,2)}, 1fr);
1336
+ }
1337
+ }
1338
+
1339
+ @container sequential-classification (max-width: 620px) {
1340
+ #zones-grid {
1341
+ grid-template-columns: 1fr;
1342
+ }
1343
+ }
1344
+ </style>
1345
+ <div id="container">
1346
+ <div class="center-zone-container">
1347
+ <div class="center-zone-label">Current Item</div>
1348
+ <div id="center-zone"></div>
1349
+ </div>
1350
+ <div class="zones-container">
1351
+ <div class="zones-label">Categories (Drag item to classify)</div>
1352
+ <div id="zones-grid"></div>
1353
+ </div>
1354
+ </div>
1355
+ `,this.container=this.querySelector("#container"),this.centerZone=this.querySelector("#center-zone"),this.zonesGrid=this.querySelector("#zones-grid"),this.createDropZones(),this.showNextChip()}createDropZones(){let t=this.querySelector("#zones-grid");this.categories.forEach((r,i)=>{let o=document.createElement("edu-block");o.variant=this.variant,o.setAccentColor(U[i%U.length]),o.classList.add("zone","empty"),o.textContent=`${r}: 0`,o.dataset.label=r,t.appendChild(o),this.zones.push(o)})}showNextChip(){let t=this.allItems.find(i=>!this.categorized.has(i));if(!t){this.centerZone.classList.add("empty");return}let r=document.createElement("edu-chip");r.variant=this.variant,D(t,r,this.assets?.assetsById),r.prefix=(this.allItems.indexOf(t)+1).toString(),r.draggable=!0,r.dataset.label=t,r.addEventListener("pointerdown",i=>this.handlePointerDown(i,r)),this.container.appendChild(r),this.chips.push(r),requestAnimationFrame(()=>{let i=this.centerZone.getBoundingClientRect(),o=this.container.getBoundingClientRect(),a=r.getBoundingClientRect(),s=i.left-o.left+(i.width-a.width)/2,l=i.top-o.top+(i.height-a.height)/2;r.style.left=`${s}px`,r.style.top=`${l}px`})}reparentChip(t,r){if(t.parentElement===r)return;let i=t.getBoundingClientRect(),o=r.getBoundingClientRect(),a=i.left-o.left,s=i.top-o.top;r===this.zonesGrid&&(a+=this.zonesGrid.scrollLeft,s+=this.zonesGrid.scrollTop),t.style.left=`${a}px`,t.style.top=`${s}px`,r.appendChild(t)}handlePointerDown(t,r){t.preventDefault(),this.reparentChip(r,this.container),this.activeChip=r,this.isDragging=!0,r.classList.add("dragging");let i=r.getBoundingClientRect(),o=this.container.getBoundingClientRect();this.offsetX=t.clientX-i.left,this.offsetY=t.clientY-i.top,this.chips.forEach(a=>{a!==r&&(a.style.opacity="0.3")}),this.handlePointerMove(t)}handlePointerMove(t){if(!this.isDragging||!this.activeChip)return;let r=this.container.getBoundingClientRect(),i=t.clientX-r.left-this.offsetX,o=t.clientY-r.top-this.offsetY,a=this.activeChip.getBoundingClientRect();i=Math.max(0,Math.min(i,r.width-a.width)),o=Math.max(0,Math.min(o,r.height-a.height)),this.activeChip.style.left=`${i}px`,this.activeChip.style.top=`${o}px`,this.checkZoneOverlap(t.clientX,t.clientY)}handlePointerUp(t){if(!this.isDragging||!this.activeChip)return;this.isDragging=!1,this.chips.forEach(i=>i.style.opacity="1"),this.activeChip.classList.remove("dragging");let r=this.activeChip.dataset.label;if(this.currentZone){let i=this.currentZone.dataset.label,o=this.categorized.get(r);o!==i&&(this.categorized.set(r,i),this.emitStateChange(),o===void 0&&(this.incrementProgress(),this.showNextChip()),o===null&&this.incrementProgress()),this.reparentChip(this.activeChip,this.zonesGrid)}else this.categorized.get(r)&&(this.categorized.set(r,null),this.decrementProgress()),this.reparentChip(this.activeChip,this.container);this.zones.forEach(i=>{i.classList.remove("highlight");let o=Array.from(this.categorized.values()).filter(a=>a===i.dataset.label).length;i.textContent=`${i.dataset.label}: ${o}`,o>0?i.classList.remove("empty"):i.classList.add("empty")}),this.activeChip=null,this.currentZone=null}checkZoneOverlap(t,r){this.currentZone=null;for(let i of this.zones){let o=i.getBoundingClientRect();t>=o.left&&t<=o.right&&r>=o.top&&r<=o.bottom?(i.classList.add("highlight"),this.currentZone=i):i.classList.remove("highlight")}}getCurrentState(){return{categorized:Object.fromEntries(this.categorized),progress:this.progressTracker.current}}isInteractionComplete(){return this.categorized.size===this.allItems.length}onHint(){let t=this.allItems.filter(o=>!this.categorized.has(o));if(t.length===0){alert('All items are categorized! Click "Check" to submit.'),this.emitHintShown("All items categorized");return}let r=t[0],i=this.data.categories.find(o=>o.items.includes(r))?.label;i&&(alert(`Hint: "${r}" belongs to "${i}".`),this.emitHintShown(`Item: ${r} \u2192 Category: ${i}`))}submit(){super.submit();let t=we(this.data.categories,this.categorized,this);console.log(`Classification Score: ${t.score.toFixed(1)}% (${t.correct}/${t.total} correct)`),this.dispatchEvent(new CustomEvent("interaction:graded",{detail:{result:t},bubbles:!0,composed:!0}))}reset(){super.reset(),this.categorized.clear(),this.chips.forEach(t=>t.remove()),this.chips=[],this.centerZone.classList.remove("empty"),this.activeChip=null,this.currentZone=null,this.isDragging=!1,this.zonesGrid&&(this.zonesGrid.scrollTop=0),this.showNextChip()}};customElements.get("sequential-classification")||customElements.define("sequential-classification",Ee);var Yo={audio:`
1356
+ <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
1357
+ <path d="M11 5 6 9H3v6h3l5 4V5Z"/>
1358
+ <path d="M15.5 8.5a5 5 0 0 1 0 7"/>
1359
+ <path d="M18.5 6a8.5 8.5 0 0 1 0 12"/>
1360
+ </svg>
1361
+ `,data:`
1362
+ <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
1363
+ <path d="M12 3c4.97 0 9 1.79 9 4s-4.03 4-9 4-9-1.79-9-4 4.03-4 9-4Z"/>
1364
+ <path d="M3 7v5c0 2.21 4.03 4 9 4s9-1.79 9-4V7"/>
1365
+ <path d="M3 12v5c0 2.21 4.03 4 9 4s9-1.79 9-4v-5"/>
1366
+ </svg>
1367
+ `,down:`
1368
+ <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
1369
+ <path d="M12 5v14"/>
1370
+ <path d="m6 13 6 6 6-6"/>
1371
+ </svg>
1372
+ `,"drag-horizontal":`
1373
+ <svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor" aria-hidden="true">
1374
+ <circle cx="8" cy="8" r="1.5"/><circle cx="8" cy="12" r="1.5"/><circle cx="8" cy="16" r="1.5"/>
1375
+ <circle cx="16" cy="8" r="1.5"/><circle cx="16" cy="12" r="1.5"/><circle cx="16" cy="16" r="1.5"/>
1376
+ </svg>
1377
+ `,"drag-vertical":`
1378
+ <svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor" aria-hidden="true">
1379
+ <circle cx="8" cy="8" r="1.5"/><circle cx="12" cy="8" r="1.5"/><circle cx="16" cy="8" r="1.5"/>
1380
+ <circle cx="8" cy="16" r="1.5"/><circle cx="12" cy="16" r="1.5"/><circle cx="16" cy="16" r="1.5"/>
1381
+ </svg>
1382
+ `,eye:`
1383
+ <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
1384
+ <path d="M2 12s3.5-6 10-6 10 6 10 6-3.5 6-10 6-10-6-10-6Z"/>
1385
+ <circle cx="12" cy="12" r="3"/>
1386
+ </svg>
1387
+ `,image:`
1388
+ <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
1389
+ <rect x="3" y="5" width="18" height="14" rx="2"/>
1390
+ <circle cx="9" cy="10" r="1.5"/>
1391
+ <path d="m21 16-5-5-7 7"/>
1392
+ </svg>
1393
+ `,repeat:`
1394
+ <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
1395
+ <path d="M17 2v4h-4"/>
1396
+ <path d="M7 22v-4h4"/>
1397
+ <path d="M20 11a8 8 0 0 0-13.66-5.66L3 8"/>
1398
+ <path d="M4 13a8 8 0 0 0 13.66 5.66L21 16"/>
1399
+ </svg>
1400
+ `,star:`
1401
+ <svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor" aria-hidden="true">
1402
+ <path d="m12 2.5 2.94 5.96 6.58.96-4.76 4.64 1.12 6.56L12 17.54 6.12 20.62l1.12-6.56L2.48 9.42l6.58-.96L12 2.5Z"/>
1403
+ </svg>
1404
+ `,up:`
1405
+ <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
1406
+ <path d="M12 19V5"/>
1407
+ <path d="m6 11 6-6 6 6"/>
1408
+ </svg>
1409
+ `,video:`
1410
+ <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
1411
+ <rect x="3" y="5" width="14" height="14" rx="2"/>
1412
+ <path d="m17 10 4-2.5v9L17 14"/>
1413
+ </svg>
1414
+ `};function B(e){return Yo[e]}function Lr(e,n,t){if(n.innerHTML="",!e.startsWith("@:")||!t||e.length<3){n.textContent=e;return}let r=e.slice(2),i=t[r];if(!i){n.textContent=r;return}console.log("DIALOG",i.dialog),i.dialog===!0?Ko(n,i):Wo(n,i)}function Ko(e,n){let t=document.createElement("button");t.className="media-dialog-trigger";let r={image:`${B("image")}View Image`,video:`${B("video")}Play Video`,audio:`${B("audio")}Play Audio`,html:`${B("data")}View Content`,tts:`${B("audio")}Play Audio`};t.innerHTML=r[n.type],t.style.cssText=`
1415
+ width: 80%;
1416
+ justify-content: center;
1417
+ padding: 1rem 1.5rem;
1418
+ background: rgb(var(--edu-first-accent));
1419
+ color: white;
1420
+ border: none;
1421
+ border-radius: 8px;
1422
+ font-size: 1rem;
1423
+ font-weight: 600;
1424
+ cursor: pointer;
1425
+ transition: all 0.2s;
1426
+ display: inline-flex;
1427
+ align-items: center;
1428
+ gap: 0.5rem;
1429
+ `,t.addEventListener("mouseenter",()=>{t.style.transform="translateY(-2px)",t.style.boxShadow="0 4px 12px rgba(0,0,0,0.15)"}),t.addEventListener("mouseleave",()=>{t.style.transform="translateY(0)",t.style.boxShadow="none"}),t.addEventListener("click",()=>{Dr(n)}),e.appendChild(t)}function Wo(e,n){let t=document.createElement("div");t.style.cssText=`
1430
+ position: relative;
1431
+ display: flex;
1432
+ justify-content: center;
1433
+ align-items: center;
1434
+ width: 100%;
1435
+ max-height: clamp(140px, 26cqh, 240px);
1436
+ overflow-y: auto;
1437
+ overflow-x: hidden;`;let r=document.createElement("edu-media");r.setAttribute("type",n.type),n.type==="image"||n.type==="video"||n.type==="audio"?r.setAttribute("data",n.url):(n.type==="html"||n.type==="tts")&&r.setAttribute("data",n.content);let i={};n.type==="image"&&n.size?i.size=n.size:n.type==="video"&&n.span?i.span=n.span:(n.type==="audio"||n.type==="tts")&&n.volume!==void 0&&(i.volume=n.volume),Object.keys(i).length>0&&r.setAttribute("spec",JSON.stringify(i));let o=document.createElement("button");o.className="media-expand-button",o.title="Expand to full view",o.innerHTML=`
1438
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor">
1439
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
1440
+ d="M3 7V3h4M17 7V3h-4M3 13v4h4M17 13v4h-4"/>
1441
+ </svg>
1442
+ `,o.style.cssText=`
1443
+ position: absolute;
1444
+ top: 0.5rem;
1445
+ right: 0.5rem;
1446
+ background: rgba(0, 0, 0, 0.7);
1447
+ color: white;
1448
+ border: none;
1449
+ border-radius: 6px;
1450
+ padding: 0.5rem;
1451
+ cursor: pointer;
1452
+ display: flex;
1453
+ align-items: center;
1454
+ justify-content: center;
1455
+ transition: all 0.2s;
1456
+ z-index: 10;
1457
+ opacity: 0.8;
1458
+ `,o.addEventListener("mouseenter",()=>{o.style.opacity="1",o.style.transform="scale(1.1)"}),o.addEventListener("mouseleave",()=>{o.style.opacity="0.8",o.style.transform="scale(1)"}),o.addEventListener("click",()=>{Dr(n)}),t.appendChild(r),t.appendChild(o),e.appendChild(t)}function Dr(e){let n=document.querySelector("edu-dialog#asset-dialog");n||(n=document.createElement("edu-dialog"),n.id="asset-dialog",document.body.appendChild(n));let t={image:"Image",video:"Video",audio:"Audio",html:"Content",tts:"Audio"};n.title=t[e.type];let r=document.createElement("edu-media");r.setAttribute("type",e.type),e.type==="image"||e.type==="video"||e.type==="audio"?r.setAttribute("data",e.url):(e.type==="html"||e.type==="tts")&&r.setAttribute("data",e.content);let i={};e.type==="image"&&e.size?i.size="large":e.type==="video"&&e.span?i.span=e.span:(e.type==="audio"||e.type==="tts")&&e.volume!==void 0&&(i.volume=e.volume),Object.keys(i).length>0&&r.setAttribute("spec",JSON.stringify(i)),n.innerHTML="",n.appendChild(r),n.open()}var bt=class extends HTMLElement{constructor(){super();this.mediaType=null;this.mediaData=null;this.mediaSpec=null;this.audioPlaying=!1;this.currentAudioUrl=null}static get observedAttributes(){return["type","data","spec"]}connectedCallback(){this.render()}attributeChangedCallback(t,r,i){if(r!==i){if(t==="type")this.mediaType=i;else if(t==="data")this.mediaData=i;else if(t==="spec")try{this.mediaSpec=i?JSON.parse(i):null}catch{console.warn("[EduMedia] Invalid spec JSON:",i),this.mediaSpec=null}this.isConnected&&this.render()}}disconnectedCallback(){this.audioPlaying&&this.currentAudioUrl&&(He.stop(this.currentAudioUrl),this.audioPlaying=!1)}render(){if(!this.mediaType||!this.mediaData){this.innerHTML="";return}switch(this.mediaType){case"image":this.renderImage();break;case"video":this.renderVideo();break;case"audio":this.renderAudio();break;case"html":this.renderHtml();break;case"tts":this.innerHTML='<div style="font-style: italic; color: gray;">TTS not yet supported</div>';break;default:console.warn(`[EduMedia] Unknown media type: ${this.mediaType}`),this.innerHTML=""}}renderImage(){let t=this.mediaSpec?.size||"medium";this.innerHTML=`
1459
+ <style>
1460
+ :host {
1461
+ display: block;
1462
+ width: 100%;
1463
+ }
1464
+
1465
+ .media-image {
1466
+ width: 100%;
1467
+ max-height: clamp(140px, 26cqh, 240px);
1468
+ display: block;
1469
+ object-fit: contain;
1470
+ border: 2px solid rgb(var(--edu-ink));
1471
+ }
1472
+
1473
+ .media-image.small {
1474
+ max-width: 200px;
1475
+ }
1476
+
1477
+ .media-image.medium {
1478
+ max-width: 400px;
1479
+ }
1480
+
1481
+ .media-image.large {
1482
+ max-width: 100%;
1483
+ }
1484
+ </style>
1485
+ <img class="media-image ${t}" src="${this.mediaData}" alt="Media content" />
1486
+ `}renderVideo(){let t=this.mediaSpec?.span,r=t?`data-from="${t.from}" data-to="${t.to}"`:"";if(this.innerHTML=`
1487
+ <style>
1488
+ :host {
1489
+ display: block;
1490
+ width: 100%;
1491
+ }
1492
+
1493
+ .media-video {
1494
+ width: 100%;
1495
+ max-height: clamp(160px, 28cqh, 280px);
1496
+ height: auto;
1497
+ display: block;
1498
+ border: 2px solid rgb(var(--edu-ink));
1499
+ }
1500
+ </style>
1501
+ <video class="media-video" controls ${r}>
1502
+ <source src="${this.mediaData}" />
1503
+ Your browser does not support the video tag.
1504
+ </video>
1505
+ `,t){let i=this.querySelector("video");if(i){let o=this.parseTime(t.from),a=this.parseTime(t.to);i.addEventListener("loadedmetadata",()=>{o!==null&&(i.currentTime=o)}),a!==null&&i.addEventListener("timeupdate",()=>{i.currentTime>=a&&i.pause()})}}}renderAudio(){let t=this.mediaSpec?.volume!==void 0?this.mediaSpec.volume/100:1,r=this.mediaSpec?.loop??!1;this.innerHTML=`
1506
+ <style>
1507
+ :host {
1508
+ display: block;
1509
+ width: 100%;
1510
+ }
1511
+
1512
+ .media-audio {
1513
+ display: flex;
1514
+ align-items: center;
1515
+ gap: 1rem;
1516
+ padding: 1rem;
1517
+ background: rgba(var(--edu-first-accent), 0.1);
1518
+ border-radius: 8px;
1519
+ }
1520
+
1521
+ .audio-button {
1522
+ display: flex;
1523
+ align-items: center;
1524
+ justify-content: center;
1525
+ width: 48px;
1526
+ height: 48px;
1527
+ background: rgb(var(--edu-first-accent));
1528
+ border: none;
1529
+ border-radius: 50%;
1530
+ cursor: pointer;
1531
+ transition: all 0.2s ease;
1532
+ }
1533
+
1534
+ .audio-button:hover {
1535
+ transform: scale(1.05);
1536
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
1537
+ }
1538
+
1539
+ .audio-button:active {
1540
+ transform: scale(0.95);
1541
+ }
1542
+
1543
+ .audio-button svg {
1544
+ width: 24px;
1545
+ height: 24px;
1546
+ fill: white;
1547
+ }
1548
+
1549
+ .audio-label {
1550
+ flex: 1;
1551
+ font-size: 0.9rem;
1552
+ color: rgb(var(--edu-ink));
1553
+ }
1554
+ </style>
1555
+ <div class="media-audio">
1556
+ <button class="audio-button" title="Play audio">
1557
+ ${B("audio")}
1558
+ </button>
1559
+ <div class="audio-label">Audio clip</div>
1560
+ </div>
1561
+ `;let i=this.querySelector(".audio-button");i&&i.addEventListener("click",async()=>{this.audioPlaying?(He.stop(this.mediaData),this.audioPlaying=!1,this.currentAudioUrl=null,i.title="Play audio"):(this.currentAudioUrl=this.mediaData,console.log(this.currentAudioUrl),await He.playSound(this.mediaData,{volume:t,loop:r,onEnd:()=>{this.audioPlaying=!1,this.currentAudioUrl=null,i.title="Play audio"},onError:o=>{console.error("[EduMedia] Audio playback error:",o),this.audioPlaying=!1,this.currentAudioUrl=null,i.title="Play audio"}}),this.audioPlaying=!0,i.title="Stop audio")})}renderHtml(){this.innerHTML=`
1562
+ <style>
1563
+ :host {
1564
+ display: block;
1565
+ width: 100%;
1566
+ }
1567
+
1568
+ .media-html {
1569
+ width: 100%;
1570
+ color: rgb(var(--edu-ink));
1571
+ }
1572
+
1573
+ .media-html * {
1574
+ max-width: 100%;
1575
+ }
1576
+ </style>
1577
+ <div class="media-html">${this.mediaData}</div>
1578
+ `}parseTime(t){let r=t.split(":").map(i=>parseInt(i,10));return r.length===2?r[0]*60+r[1]:r.length===3?r[0]*3600+r[1]*60+r[2]:null}};customElements.get("edu-media")||customElements.define("edu-media",bt);function Rr(e,n){let t=0,r=e.data.length;e.data.forEach(a=>{let s=new Set(a.correctOptions),l=new Set(n[a.question]||[]),c=0,d=0,u=0;l.forEach(m=>{s.has(m)?c++:d++}),s.forEach(m=>{l.has(m)||u++});let p=s.size,h=c-d-u,g=Math.max(0,h/p*100);t+=g});let i=Math.round(t/r),o=0;return e.data.forEach(a=>{let s=new Set(a.correctOptions),l=new Set(n[a.question]||[]);s.size===l.size&&[...s].every(c=>l.has(c))&&o++}),{score:i,correct:o,total:r}}var ee=class extends x{constructor(t,r,i){super(t,r,i);this.interactionMechanic="sequential";this.currentQuestionIndex=0;this.userAnswers={};this.shuffledOptions=new Map;this.isGraded=!1;this.data.data.forEach(o=>{this.userAnswers[o.question]=[],this.config.shuffle?this.shuffledOptions.set(o.question,S([...o.options])):this.shuffledOptions.set(o.question,[...o.options])}),this.variant=this.config.variant,this.initializeProgress(this.data.data.length)}get slidesCount(){return this.data.data.length}initialize(){}cleanup(){}onVariantChange(t){this.querySelectorAll("edu-chip, edu-block").forEach(r=>{r.variant!==void 0&&(r.variant=t)}),this.variant=t}setSteps(t){let r=t-1;r>=0&&r<this.data.data.length&&(this.currentQuestionIndex=r,this.renderCurrentQuestion())}render(){this.innerHTML=`
1579
+ <style>
1580
+ mcq-interaction {
1581
+ display: flex;
1582
+ width: 100%;
1583
+ height: 100%;
1584
+ box-sizing: border-box;
1585
+ container-type: size;
1586
+ container-name: mcq;
1587
+ }
1588
+
1589
+ .container {
1590
+ display: flex;
1591
+ flex-direction: column;
1592
+ width: 100%;
1593
+ height: 100%;
1594
+ gap: clamp(0.5rem, min(1.6cqw, 1.6cqh), 1rem);
1595
+ padding: clamp(0.75rem, min(2cqw, 2cqh), 1.5rem);
1596
+ box-sizing: border-box;
1597
+ overflow: hidden;
1598
+ }
1599
+
1600
+ .mode-label {
1601
+ align-self: flex-start;
1602
+ font-size: 0.75rem;
1603
+ font-weight: 600;
1604
+ color: rgb(var(--edu-third-ink));
1605
+ text-transform: uppercase;
1606
+ letter-spacing: 0.5px;
1607
+ opacity: 0.7;
1608
+ margin-bottom: clamp(0.25rem, 1cqh, 0.5rem);
1609
+ }
1610
+
1611
+ .question-section {
1612
+ flex-shrink: 0;
1613
+ display: flex;
1614
+ flex-direction: column;
1615
+ min-height: clamp(64px, 10cqh, 120px);
1616
+ max-height: clamp(120px, 30cqh, 260px);
1617
+ overflow: hidden;
1618
+ }
1619
+
1620
+ .question-text {
1621
+ padding: 0;
1622
+ font-size: clamp(0.95rem, 2.4cqh, 1.2rem);
1623
+ font-weight: 600;
1624
+ color: rgb(var(--edu-ink));
1625
+ line-height: 1.4;
1626
+ }
1627
+
1628
+ .divider {
1629
+ border: none;
1630
+ border-top: 1px solid rgb(var(--edu-border));
1631
+ margin: 0;
1632
+ flex-shrink: 0;
1633
+ }
1634
+
1635
+ .options-section {
1636
+ flex: 1;
1637
+ display: flex;
1638
+ flex-direction: column;
1639
+ gap: clamp(0.25rem, min(1cqw, 1cqh), 0.5rem);
1640
+ min-height: 0;
1641
+ overflow: hidden;
1642
+ }
1643
+
1644
+ .options-label {
1645
+ font-size: clamp(0.8rem, 1.8cqh, 1rem);
1646
+ font-weight: 600;
1647
+ color: rgb(var(--edu-second-ink));
1648
+ flex-shrink: 0;
1649
+ }
1650
+
1651
+ .options-container {
1652
+ flex: 1;
1653
+ display: grid;
1654
+ grid-template-columns: 1fr;
1655
+ grid-auto-rows: minmax(44px, 1fr);
1656
+ gap: clamp(0.5rem, min(1.6cqw, 1.6cqh), 0.9rem);
1657
+ padding: clamp(0.5rem, min(1.6cqw, 1.6cqh), 1rem);
1658
+ background: rgb(var(--edu-muted));
1659
+ border-radius: clamp(6px, 1.6cqw, 8px);
1660
+ overflow-y: auto;
1661
+ overflow-x: hidden;
1662
+ min-height: 0;
1663
+ align-content: stretch;
1664
+ align-items: stretch;
1665
+ }
1666
+
1667
+ edu-chip {
1668
+ cursor: pointer;
1669
+ transition: all 0.2s ease;
1670
+ }
1671
+
1672
+ edu-chip::part(block) {
1673
+ width: 100%;
1674
+ height: 100%;
1675
+ }
1676
+
1677
+ edu-chip:hover {
1678
+ transform: translateY(-2px);
1679
+ }
1680
+
1681
+ edu-chip.selected {
1682
+ transform: translateY(-2px);
1683
+ }
1684
+
1685
+ #question-block edu-block::part(block) {
1686
+ border: none;
1687
+ padding: clamp(0.5rem, min(1.6cqw, 1.6cqh), 1rem);
1688
+ height: 100%;
1689
+ max-height: clamp(120px, 30cqh, 260px);
1690
+ overflow: auto;
1691
+ align-items: center;
1692
+ justify-content: flex-start;
1693
+ }
1694
+
1695
+ #question-block edu-block::part(block) > * {
1696
+ width: 100%;
1697
+ }
1698
+
1699
+ #question-block .question-text {
1700
+ text-align: left;
1701
+ }
1702
+
1703
+ @container mcq (min-width: 920px) {
1704
+ .options-container {
1705
+ grid-template-columns: repeat(2, minmax(min(100%, 220px), 1fr));
1706
+ }
1707
+ }
1708
+
1709
+ @container mcq (max-width: 620px) {
1710
+ .options-container {
1711
+ grid-template-columns: 1fr;
1712
+ padding: clamp(0.5rem, min(1.2cqw, 1.2cqh), 0.75rem);
1713
+ }
1714
+ }
1715
+ </style>
1716
+
1717
+ <div class="container">
1718
+ <div class="question-section">
1719
+ <div class="mode-label"></div>
1720
+ <div id="question-block"></div>
1721
+ </div>
1722
+
1723
+ <hr class="divider">
1724
+
1725
+ <div class="options-section">
1726
+ <div class="options-label">Options</div>
1727
+ <div class="options-container"></div>
1728
+ </div>
1729
+ </div>
1730
+ `,this.$modeLabel=this.querySelector(".mode-label"),this.$optionsContainer=this.querySelector(".options-container");let t=this.querySelector("#question-block");this.$questionBlock=document.createElement("edu-block"),this.$questionBlock.variant=this.config.variant,this.$questionBlock.innerHTML='<div class="question-text"></div>',t.appendChild(this.$questionBlock),this.$questionText=this.$questionBlock.querySelector(".question-text"),this.renderCurrentQuestion()}renderCurrentQuestion(){let t=this.data.data[this.currentQuestionIndex];if(!t)return;let r=t.correctOptions.length===1;this.$modeLabel.textContent=r?"Multiple Choice":"Multiple Response",Lr(t.question,this.$questionText,this.assets?.assetsById);let i=this.shuffledOptions.get(t.question)||t.options;this.$optionsContainer.innerHTML="",i.forEach((o,a)=>{let s=document.createElement("edu-chip");s.variant=this.variant,s.prefix=`${a+1}:`,s.dataset.option=o,D(o,s,this.assets?.assetsById);let l=this.userAnswers[t.question]?.includes(o);if(l&&(s.selected=!0,s.classList.add("selected")),this.isGraded){let c=t.correctOptions.includes(o);l&&c?s.chipState="correct":l&&!c?s.chipState="wrong":!l&&c&&(s.chipState="missed")}this.isGraded||s.addEventListener("click",()=>{this.handleOptionClick(o,s,r)}),this.$optionsContainer.appendChild(s)})}handleOptionClick(t,r,i){let o=this.data.data[this.currentQuestionIndex],a=this.userAnswers[o.question];if(i){let s=a.includes(t);this.$optionsContainer.querySelectorAll("edu-chip").forEach(l=>{l.selected=!1,l.classList.remove("selected")}),this.userAnswers[o.question]=[],s||(r.selected=!0,r.classList.add("selected"),this.userAnswers[o.question]=[t])}else{let s=a.indexOf(t);s>-1?(a.splice(s,1),r.selected=!1,r.classList.remove("selected")):(a.push(t),r.selected=!0,r.classList.add("selected"))}this.updateProgress(),this.emitStateChange()}updateProgress(){let t=0;this.data.data.forEach(r=>{this.userAnswers[r.question]?.length>0&&t++}),this.setProgress(t)}getCurrentState(){return{...this.userAnswers}}isInteractionComplete(){return this.data.data.every(t=>this.userAnswers[t.question]?.length>0)}onHint(){let t=this.data.data[this.currentQuestionIndex];this.userAnswers[t.question]?.length>0?(alert("Hint: You've selected an answer. Review your choice and make sure it's correct before submitting."),this.emitHintShown(`Answer exists for question ${this.currentQuestionIndex+1}`)):(alert("Hint: This question requires at least one selection. Read the question carefully and choose the best answer(s)."),this.emitHintShown(`No answer selected for question ${this.currentQuestionIndex+1}`))}submit(){super.submit();let t=Rr(this.data,this.userAnswers);console.log(`Recognition Score: ${t.score}% (${t.correct}/${t.total} questions fully correct)`),this.isGraded=!0,this.renderCurrentQuestion(),this.dispatchEvent(new CustomEvent("interaction:graded",{detail:{result:t},bubbles:!0,composed:!0})),this.setAttribute("inert","")}reset(){super.reset(),this.data.data.forEach(t=>{this.userAnswers[t.question]=[]}),this.isGraded=!1,this.currentQuestionIndex=0,this.renderCurrentQuestion()}};customElements.get("mcq-interaction")||customElements.define("mcq-interaction",ee);function Ls(e){let n=[],t={},r=e.split(`
1731
+ `).map(s=>s.trim()).filter(Boolean),i=null,o=0;for(let s=0;s<r.length;s++){let l=r[s];if(l.startsWith("#")){i=l.substring(1).trim(),o++;continue}if(l.endsWith(";")){if(!i){t[`parse.noQuestion.line${s+1}`]=`Line ${s+1}: Found options without a preceding question (# question).`;continue}let c=l.slice(0,-1).trim(),d=c.match(/\[([^\]]+)\]/),u=[],p=c;d&&(u=d[1].split("|").map(w=>w.trim()).filter(Boolean),p=c.replace(/\[([^\]]+)\]/,"").trim());let h=p.split("|").map(b=>b.trim()).filter(Boolean),g=[...u,...h],m=new Set;for(let b of g){if(m.has(b)){t[`parse.duplicate.q${o}`]=`Question ${o}: Duplicate option "${b}" found.`;break}m.add(b)}n.push({question:i,correctOptions:u,options:g}),i=null}else t[`parse.missingSemicolon.line${s+1}`]=`Line ${s+1}: Options line must end with ';'.`}i&&(t["parse.danglingQuestion"]=`Question "${i}" has no options defined.`);let a={type:"recognition",data:n};return Object.keys(t).length>0?{data:a,errors:t}:{data:a}}function Rs(e){let n={};return!e.data||e.data.length===0?(n["validation.noQuestions"]="No questions found. Expected at least one question with format: # question\\n[correct] | incorrect;",{ok:!1,errors:n}):(e.data.forEach((t,r)=>{let i=r+1;if((!t.question||t.question.trim()==="")&&(n[`validation.emptyQuestion.q${i}`]=`Question ${i}: Question text cannot be empty.`),(!t.correctOptions||t.correctOptions.length===0)&&(n[`validation.noCorrectOptions.q${i}`]=`Question ${i}: Must have at least one correct answer. Use [correct] syntax.`),(!t.options||t.options.length<2)&&(n[`validation.insufficientOptions.q${i}`]=`Question ${i}: Must have at least 2 options (correct and incorrect).`),t.options&&t.options.forEach((o,a)=>{(!o||o.trim()==="")&&(n[`validation.emptyOption.q${i}.opt${a+1}`]=`Question ${i}, Option ${a+1}: Option text cannot be empty.`)}),t.correctOptions&&t.options&&t.correctOptions.forEach(o=>{t.options.includes(o)||(n[`validation.missingCorrectOption.q${i}`]=`Question ${i}: Correct option "${o}" not found in options array.`)}),t.options){let o=new Set;t.options.forEach(a=>{o.has(a)&&(n[`validation.duplicateOption.q${i}`]=`Question ${i}: Duplicate option "${a}" found.`),o.add(a)})}}),Object.keys(n).length>0?{ok:!1,errors:n}:{ok:!0})}function Pr(e,n,t){let r=0;for(let[a,s]of n.entries()){let l=t.querySelector(`[data-val="${a}"]`),c=e.find(d=>d.left===a);c&&c.right===s?(l.chipState="correct",r++):l.chipState="wrong"}let i=e.length,o=i>0?r/i*100:0;return console.log(`Association Score: ${o.toFixed(1)}% (${r}/${i} correct)`),{score:o,correct:r,total:i,answerKey:e,userResponse:n}}var Ce=class extends x{constructor(t,r,i,o){super(t,r,i);this.interactionMechanic="static";this.leftItems=[];this.rightItems=[];this.matched=new Map;this.matchColors=new Map;this.data.pairs.forEach(({left:a,right:s})=>{this.leftItems.push(a),this.rightItems.push(s)}),this.data.distractors&&this.rightItems.push(...this.data.distractors),this.config.shuffle&&(this.leftItems=S(this.leftItems),this.rightItems=S(this.rightItems)),this.initializeProgress(this.leftItems.length),this.currentColor=U[0]}initialize(){}cleanup(){}onVariantChange(t){this.querySelectorAll("edu-chip").forEach(r=>{r.variant!==void 0&&(r.variant=t)})}render(){this.innerHTML=`
1732
+ <style>
1733
+ simultaneous-association {
1734
+ --current-color: #3b82f6;
1735
+ display: flex;
1736
+ width: 100%;
1737
+ height: 100%;
1738
+ box-sizing: border-box;
1739
+ container-type: size;
1740
+ container-name: association;
1741
+ }
1742
+
1743
+ .container {
1744
+ display: grid;
1745
+ grid-template-columns: repeat(2, minmax(0, 1fr));
1746
+ gap: clamp(0.75rem, min(2.5cqw, 2.5cqh), 2rem);
1747
+ padding: clamp(0.75rem, min(2.5cqw, 2.5cqh), 2rem);
1748
+ width: 100%;
1749
+ height: 100%;
1750
+ align-content: stretch;
1751
+ box-sizing: border-box;
1752
+ }
1753
+
1754
+ .column {
1755
+ display: grid;
1756
+ grid-template-rows: auto 1fr;
1757
+ gap: clamp(0.25rem, min(1.2cqw, 1.2cqh), 0.75rem);
1758
+ width: 100%;
1759
+ min-width: 0;
1760
+ min-height: 0;
1761
+ }
1762
+
1763
+ .column-label {
1764
+ font-size: clamp(0.8rem, 1.8cqh, 1rem);
1765
+ font-weight: 600;
1766
+ color: rgb(var(--edu-second-ink));
1767
+ margin-bottom: 0.25rem;
1768
+ flex-shrink: 0;
1769
+ }
1770
+
1771
+ .items-list {
1772
+ display: grid;
1773
+ grid-template-columns: 1fr;
1774
+ grid-auto-rows: minmax(44px, 1fr);
1775
+ gap: clamp(0.35rem, min(1.2cqw, 1.2cqh), 0.75rem);
1776
+ min-height: 0;
1777
+ height: 100%;
1778
+ align-content: stretch;
1779
+ align-items: stretch;
1780
+ }
1781
+
1782
+ edu-chip:hover {
1783
+ transform: translateY(-2px);
1784
+ }
1785
+
1786
+ edu-chip {
1787
+ width: 100%;
1788
+ height: 100%;
1789
+ }
1790
+
1791
+ edu-chip::part(content-zone) {
1792
+ width: 100%;
1793
+ height: 100%;
1794
+ }
1795
+
1796
+ @container association (max-width: 640px) {
1797
+ .container {
1798
+ gap: clamp(0.5rem, min(1.6cqw, 1.6cqh), 1rem);
1799
+ padding: clamp(0.5rem, min(1.6cqw, 1.6cqh), 1rem);
1800
+ }
1801
+ }
1802
+
1803
+ @container association (max-height: 420px) {
1804
+ .items-list[data-compact="true"] {
1805
+ grid-template-columns: repeat(2, minmax(0, 1fr));
1806
+ }
1807
+ }
1808
+
1809
+ @container association (max-width: 520px) {
1810
+ .items-list[data-compact="true"] {
1811
+ grid-template-columns: repeat(2, minmax(0, 1fr));
1812
+ }
1813
+ }
1814
+ </style>
1815
+
1816
+ <div class="container" id="columns-container">
1817
+ <div class="column">
1818
+ <div class="column-label">Left Items</div>
1819
+ <div class="items-list" id="left-col" data-compact="${this.leftItems.length>=7}"></div>
1820
+ </div>
1821
+ <div class="column">
1822
+ <div class="column-label">Right Items</div>
1823
+ <div class="items-list" id="right-col" data-compact="${this.rightItems.length>=7}"></div>
1824
+ </div>
1825
+ </div>
1826
+ `,this.$leftCol=this.querySelector("#left-col"),this.$rightCol=this.querySelector("#right-col"),this.renderItems()}renderItems(){this.leftItems.forEach((t,r)=>{let i=document.createElement("edu-chip");i.variant=this.config.variant,D(t,i,this.assets?.assetsById),i.dataset.val=t,i.addEventListener("click",o=>{let a=o.currentTarget,s=a.dataset.val;if(this.currentSelected===s){a.selected=!1,this.currentSelected="",this.currentEl=null;return}if(this.matched.get(s)){let l=this.matched.get(s),c=this.querySelector(`[data-val="${l}"]`);a.color="",a.colored=!1,c.colored=!1,c.color="",this.matched.delete(s),this.matchColors.delete(s),this.decrementProgress(),this.emitStateChange();return}this.currentSelected&&(this.currentEl.selected=!1),this.currentSelected=s,this.currentEl=a,a.selected=!0}),this.$leftCol.append(i)}),this.rightItems.forEach((t,r)=>{let i=document.createElement("edu-chip");i.variant=this.config.variant,D(t,i,this.assets?.assetsById),i.dataset.val=t,i.dataset.colorIndex=`${r+1}`,i.addEventListener("click",o=>{let a=o.currentTarget,s=a.dataset.val;if(this.currentSelected===s){this.currentSelected="",this.currentEl=null,a.selected=!1;return}if(![...this.matched.values()].includes(s)){if(this.currentSelected)if(this.leftItems.includes(this.currentSelected)&&this.rightItems.includes(s)){let c=Number(a.dataset.colorIndex)%U.length,d=U[c];this.matched.set(this.currentSelected,s),this.matchColors.set(this.currentSelected,d),a.selected=!1,this.currentEl.selected=!1,a.color=d,a.colored=!0,this.currentEl.color=d,this.currentEl.colored=!0,this.incrementProgress(),this.emitStateChange(),this.currentSelected="",this.currentEl=null;return}else this.currentEl.selected=!1;this.currentSelected=s,this.currentEl=a,a.selected=!0}}),this.$rightCol.append(i)})}getCurrentState(){return{matched:Object.fromEntries(this.matched),progress:this.progressTracker.current}}isInteractionComplete(){return this.matched.size===this.leftItems.length}onHint(){let t=this.leftItems.filter(i=>!this.matched.has(i));if(t.length===0){alert('All items are matched! Click "Check" to submit.'),this.emitHintShown("All items matched");return}let r=t[0];alert(`Hint: You haven't matched "${r}" yet. Select it from the left, then select its match from the right.`),this.emitHintShown(`Unmatched: ${r}`)}submit(){super.submit();let t=Pr(this.data.pairs,this.matched,this);this.dispatchEvent(new CustomEvent("interaction:graded",{detail:{result:t},bubbles:!0,composed:!0}))}reset(){super.reset(),this.matched.clear(),this.matchColors.clear(),this.currentSelected="",this.currentEl=null,this.querySelectorAll("edu-chip").forEach(t=>{t.classList.remove("colorized","selected"),t.style.setProperty("--current-color","")})}};customElements.get("simultaneous-association")||customElements.define("simultaneous-association",Ce);var te=class extends x{constructor(t,r){super(t,r);this.interactionMechanic="static";this._recalledItems=new Set;this.initializeProgress(t.items.length)}initialize(){}cleanup(){}onVariantChange(t){this._$textInput&&(this._$textInput.variant=t),this._$addButton&&(this._$addButton.variant=t),this._$chipsContainer?.querySelectorAll("edu-chip").forEach(r=>{r.variant=t})}render(){this.innerHTML=`
1827
+ <style>
1828
+ list-recall {
1829
+ display: flex;
1830
+ flex-direction: column;
1831
+ width: 100%;
1832
+ height: 100%;
1833
+ padding: clamp(0.75rem, min(2cqw, 2cqh), 1.5rem);
1834
+ gap: clamp(0.5rem, min(1.6cqw, 1.6cqh), 1rem);
1835
+ box-sizing: border-box;
1836
+ container-type: size;
1837
+ }
1838
+
1839
+ .chips-container {
1840
+ flex: 1;
1841
+ display: grid;
1842
+ grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
1843
+ grid-auto-rows: minmax(44px, auto);
1844
+ gap: clamp(0.4rem, min(1.4cqw, 1.4cqh), 0.75rem);
1845
+ padding: clamp(0.5rem, min(1.6cqw, 1.6cqh), 1rem);
1846
+ border: 2px dashed rgb(var(--edu-border));
1847
+ border-radius: clamp(6px, 1.6cqw, 8px);
1848
+ background: rgb(var(--edu-bg));
1849
+ overflow-y: auto;
1850
+ align-content: start;
1851
+ min-height: 0;
1852
+ }
1853
+
1854
+ .chips-container:empty::before {
1855
+ content: 'Your recalled items will appear here...';
1856
+ color: rgb(var(--edu-second-ink));
1857
+ font-size: 0.95rem;
1858
+ opacity: 0.6;
1859
+ font-style: italic;
1860
+ }
1861
+
1862
+ hr {
1863
+ width: 100%;
1864
+ border: none;
1865
+ border-top: 1px solid rgb(var(--edu-border));
1866
+ margin: 0;
1867
+ }
1868
+
1869
+ .input-row {
1870
+ display: flex;
1871
+ gap: clamp(0.4rem, min(1.4cqw, 1.4cqh), 0.75rem);
1872
+ align-items: center;
1873
+ flex-shrink: 0;
1874
+ }
1875
+
1876
+ .input-row edu-input[type="text"] {
1877
+ flex: 1;
1878
+ }
1879
+
1880
+ .input-row edu-input[type="button"] {
1881
+ flex-shrink: 0;
1882
+ }
1883
+
1884
+ edu-chip {
1885
+ cursor: pointer;
1886
+ transition: opacity 0.2s ease;
1887
+ }
1888
+
1889
+ edu-chip:hover {
1890
+ opacity: 0.7;
1891
+ }
1892
+
1893
+ @container (max-width: 640px) {
1894
+ .chips-container {
1895
+ grid-template-columns: repeat(auto-fit, minmax(min(100%, 120px), 1fr));
1896
+ }
1897
+ }
1898
+ </style>
1899
+
1900
+ <div class="chips-container"></div>
1901
+ <hr>
1902
+ <div class="input-row">
1903
+ <edu-input type="text" placeholder="Enter an item..."></edu-input>
1904
+ <edu-input as="button">Add</edu-input>
1905
+ </div>
1906
+ `,this._$chipsContainer=this.querySelector(".chips-container"),this._$textInput=this.querySelector('edu-input[type="text"]'),this._$addButton=this.querySelector('edu-input[as="button"]'),this._$textInput.variant=this.config.variant,this._$addButton.variant=this.config.variant,this._$addButton.addEventListener("click",()=>this.handleAddItem()),this._$textInput.addEventListener("keydown",t=>{t.key==="Enter"&&(t.preventDefault(),this.handleAddItem())})}handleAddItem(){let t=this._$textInput.value.trim();if(!t)return;let r=t.toLowerCase();if(this._recalledItems.has(r)){alert("You have already added this item."),this._$textInput.value="";return}if(this._recalledItems.size>=this.data.items.length){alert(`You can only add up to ${this.data.items.length} items.`),this._$textInput.value="";return}this._recalledItems.add(r),this.addChip(t),this._$textInput.value="",this.setProgress(this._recalledItems.size),this.emitStateChange()}addChip(t){let r=document.createElement("edu-chip");r.textContent=t,r.variant=this.config.variant,r.value=t.toLowerCase(),r.addEventListener("click",()=>{let i=r.value;this._recalledItems.delete(i),r.remove(),this.setProgress(this._recalledItems.size),this.emitStateChange()}),this._$chipsContainer.appendChild(r)}getCurrentState(){return Array.from(this._recalledItems)}isInteractionComplete(){return this._recalledItems.size===this.data.items.length}onHint(){let t=this._recalledItems.size,r=this.data.items.length;t===0?(alert(`Hint: Try to recall all ${r} items from memory.`),this.emitHintShown("No items recalled yet")):t<r?(alert(`Hint: You've recalled ${t} out of ${r} items. Keep going!`),this.emitHintShown(`${t}/${r} items recalled`)):(alert(`Great! You've recalled all items. Click "Check" to submit.`),this.emitHintShown("All items recalled"))}submit(){super.submit();let t=this.gradeRecall();console.log(`List Recall Score: ${t.score.toFixed(1)}% (${t.correct}/${t.total} correct)`),this.applyGradingFeedback(t),this.dispatchEvent(new CustomEvent("interaction:graded",{detail:{result:t},bubbles:!0,composed:!0}))}gradeRecall(){let t=this.data.items.map(s=>s.toLowerCase()),r=Array.from(this._recalledItems),i=0;for(let s of r)t.includes(s)&&i++;let o=this.data.items.length;return{score:o>0?Math.round(i/o*100):0,correct:i,total:o,answerKey:this.data.items,userResponse:r}}applyGradingFeedback(t){let r=this.data.items.map(o=>o.toLowerCase());this._$chipsContainer.querySelectorAll("edu-chip").forEach(o=>{let a=o.value;r.includes(a)?o.chipState="correct":o.chipState="wrong"})}reset(){super.reset(),this._recalledItems.clear(),this._$chipsContainer.innerHTML="";let t=this._$textInput.querySelector(".control");t&&(t.value=""),this.setProgress(0)}};customElements.get("list-recall")||customElements.define("list-recall",te);function el(e){let n=[],t=[],r=new Map,i={},o=/^\s*(?<category>[A-Z_](?:[A-Z0-9_]* ?[A-Z0-9_]+)*)\s*=\s*(?<items>[^;]+?)\s*;\s*$/gm,a=[...e.matchAll(o)];a.length===0&&(i["parse.noMatches"]="No valid category entries found. Expected lines like: CATEGORY = item1 | item2;");let s=new Set;for(let c of a){let d=c.groups?.category??"",u=c.groups?.items??"",p=d.trim().toLowerCase();if(r.has(p)){i[`parse.duplicateCategory.${p}`]=`Duplicate category "${p}" was defined more than once. Merge them into a single entry.`;continue}let h=u.split("|").map(g=>g.replace(/\s+/g," ").trim()).filter(Boolean);if(h.length===0){i[`parse.emptyCategory.${p}`]=`Category "${p}" has no items. Expected at least one item before ';'.`,t.push(p),r.set(p,[]);continue}t.push(p);for(let g of h)s.has(g)||(s.add(g),n.push(g));r.set(p,h)}let l={rows:n,cols:t,answerKey:r};return Object.keys(i).length>0?{data:l,errors:i}:{data:l}}function tl(e){let n={},t=[],r=new Map,i=/^\s*(?<category>[a-z_](?:[a-z0-9_]* ?[a-z0-9_]+)*)\s*=\s*(?<values>[^;]+?)\s*;/gim,o=[...e.matchAll(i)];if(o.length===0)return n["parse.noMatches"]="No valid category entries found. Expected lines like: category = val1 | val2;",{data:{rows:[],cols:[],answerKey:{}},errors:n};let a=new Set;for(let d of o){let u=d.groups?.category??"",p=d.groups?.values??"",h=u.trim().toLowerCase();if(a.has(h)){n[`parse.duplicateCategory.${h}`]=`Duplicate category "${h}" was defined more than once.`;continue}a.add(h);let g=p.split("|").map(m=>m.trim()).filter(Boolean);t.push(h),r.set(h,g)}let s=t.length;for(let d of t){let u=r.get(d)??[],p=s-1;u.length!==p&&(n[`parse.valueCount.${d}`]=`Category "${d}" has ${u.length} values, but expected ${p} (n-1 where n=${s}).`)}let l={};for(let d=0;d<t.length;d++){let u=t[d],p=r.get(u)??[];l[u]={};let h=0;for(let g=0;g<t.length;g++){if(d===g)continue;let m=t[g],b=p[h],w=null;if(b!==void 0&&b!==""){let v=Number(b);w=isNaN(v)?b:v}l[u][m]=w,h++}}let c={rows:t,cols:t,answerKey:l};return Object.keys(n).length>0?{data:c,errors:n}:{data:c}}function rl(e){let n={},t=[],r=[],i={},o=/^\s*=\s*(?<cols>[^;]+?)\s*;/m,a=e.match(o);if(!a)return n["parse.noHeader"]="Missing header line. Expected first line like: = col1 | col2 | col3;",{data:{rows:[],cols:[],answerKey:{}},errors:n};if(t=(a.groups?.cols??"").split("|").map(p=>p.trim()).filter(Boolean),t.length===0)return n["parse.emptyHeader"]='Header line has no columns. Expected at least one column after "=".',{data:{rows:[],cols:[],answerKey:{}},errors:n};let l=/^\s*(?<row>[^=]+?)\s*=\s*(?<values>[^;]+?)\s*;/gm,c=[...e.matchAll(l)],d=new Set;for(let p of c){let h=p.groups?.row??"",g=p.groups?.values??"";if(h.trim()==="")continue;let m=h.trim();if(d.has(m)){n[`parse.duplicateRow.${m}`]=`Duplicate row "${m}" was defined more than once.`;continue}d.add(m);let b=g.split("|").map(w=>w.trim()).filter(w=>w!=="");if(b.length!==t.length){n[`parse.valueCount.${m}`]=`Row "${m}" has ${b.length} values, but expected ${t.length} (matching column count).`;continue}r.push(m),i[m]={};for(let w=0;w<t.length;w++){let v=t[w],q=b[w];if(q==="-"){i[m][v]=null;continue}let K=null;if(q!==void 0&&q!==""){let wt=Number(q);K=isNaN(wt)?q:wt}i[m][v]=K}}r.length===0&&(n["parse.noRows"]="No data rows found. Expected at least one line like: row = val1 | val2;");let u={rows:r,cols:t,answerKey:i};return Object.keys(n).length>0?{data:u,errors:n}:{data:u}}function nl(e,n="classification"){let t={},r=e.answerKey;e.cols.length===0&&(t["cols.empty"]="No categories were found. Expected at least one CATEGORY = ... ; entry."),e.rows.length===0&&(t["rows.empty"]="No row items were found. Expected at least one item in any category.");for(let i of e.cols)e.rows.includes(i)&&(t[`cols.rowConflict.${i}`]=`Category "${i}" is also present as an item. Category labels cannot be used as row items.`);for(let i of e.cols){let o=r.get(i);if(!o){t[`answerKey.missing.${i}`]=`Category "${i}" has no entry in answerKey. This usually indicates a parser issue.`;continue}o.length===0&&(t[`answerKey.emptyCategory.${i}`]=`Category "${i}" has no items. Each category must include at least one item.`)}for(let[i,o]of r.entries()){let a=new Set;for(let s of o){if(a.has(s)){t[`answerKey.duplicateItem.${i}`]=`Category "${i}" includes duplicate item "${s}". Remove duplicates.`;break}a.add(s)}}if(n==="n-ary"){let i=new Map;for(let[o,a]of r.entries())for(let s of a){let l=i.get(s);l?l.push(o):i.set(s,[o])}for(let o of e.rows){let a=i.get(o)??[];if(a.length===0){t[`nary.unassigned.${o}`]=`Item "${o}" is not assigned to any category. In n-ary tables, every item must belong to exactly one category.`;continue}a.length>1&&(t[`nary.multiCategory.${o}`]=`Item "${o}" appears in multiple categories (${a.join(", ")}). In n-ary tables, items must belong to exactly one category.`)}}return Object.keys(t).length>0?{ok:!1,errors:t}:{ok:!0}}function ol(e){let n={};if(e.rows.length===0&&(n["rows.empty"]="No rows found. Expected at least one category."),e.cols.length===0&&(n["cols.empty"]="No columns found. Expected at least one category."),e.rows.length!==e.cols.length)n["symmetry.lengthMismatch"]=`Rows (${e.rows.length}) and columns (${e.cols.length}) must have the same length for adjacency tables.`;else{let t=new Set(e.rows),r=new Set(e.cols);for(let i of e.rows)r.has(i)||(n[`symmetry.rowNotInCols.${i}`]=`Row "${i}" does not appear in columns. Adjacency tables must be symmetric.`);for(let i of e.cols)t.has(i)||(n[`symmetry.colNotInRows.${i}`]=`Column "${i}" does not appear in rows. Adjacency tables must be symmetric.`)}for(let t of e.rows){if(!e.answerKey[t]){n[`answerKey.missingRow.${t}`]=`Row "${t}" has no entry in answer key.`;continue}for(let r of e.cols)if(t===r){let i=e.answerKey[t][r];i!=null&&(n[`answerKey.diagonalValue.${t}`]=`Diagonal cell (${t}, ${t}) should be empty, but has value "${i}".`)}else e.answerKey[t][r]===void 0&&(n[`answerKey.missingCell.${t}.${r}`]=`Missing value at cell (${t}, ${r}). All non-diagonal cells must have values.`)}return Object.keys(n).length>0?{ok:!1,errors:n}:{ok:!0}}function al(e){let n={};e.cols.length===0&&(n["cols.empty"]="No columns found. Expected at least one column in header line."),e.rows.length===0&&(n["rows.empty"]="No rows found. Expected at least one data row.");let t=new Set(e.cols);for(let r of e.rows)t.has(r)&&(n[`naming.rowColConflict.${r}`]=`Row name "${r}" is also a column name. This creates ambiguity and should be avoided.`);for(let r of e.rows){if(!e.answerKey[r]){n[`answerKey.missingRow.${r}`]=`Row "${r}" has no entry in answer key.`;continue}for(let i of e.cols)e.answerKey[r][i]===void 0&&(n[`answerKey.missingCell.${r}.${i}`]=`Missing value at cell (${r}, ${i}). Cells must have values or be marked as disabled with '-'.`)}return Object.keys(n).length>0?{ok:!1,errors:n}:{ok:!0}}function ke(e){let n=[];for(let t of Object.values(e))for(let r of Object.values(t))r!==null&&n.push(r);return n}function Ye(e){let n=ke(e);return Array.from(new Set(n))}function Ke(e){let n=new Set(e.filter(t=>t!==null));return e.every(t=>t===null||typeof t=="number")?"number":n.size>0&&n.size<=10?"select":"text"}function Se(e,n){return e===null||n===null?!1:typeof e=="number"&&typeof n=="number"?Math.abs(e-n)<1e-4:String(e).trim()===String(n).trim()}function Br(e,n,t){let r=0,i=t.length;for(let a of t){let s=n[a]?.selectedCols??[],l=null;for(let[c,d]of e.entries())if(d.includes(a)){l=c;break}s.length===1&&s[0]===l&&r++}return{score:i>0?Math.round(r/i*100):0,correct:r,total:i}}function qr(e,n,t,r){let i=0,o=0;for(let s of t)for(let l of r){let c=e[s]?.[l];if(c===null)continue;let d=n[s]?.values[l];o++,Se(c,d)&&i++}return{score:o>0?Math.round(i/o*100):0,correct:i,total:o}}function zr(e,n,t,r){let i=0,o=0;for(let s of t){let l=new Set(n[s]?.selectedCols??[]),c=new Set;for(let[d,u]of e.entries())u.includes(s)&&c.add(d);for(let d of r){let u=c.has(d),p=l.has(d);u===p&&i++,o++}}return{score:o>0?Math.round(i/o*100):0,correct:i,total:o}}function Hr(e,n,t){let r=0,i=0;for(let a of t)for(let s of t){if(a===s)continue;let l=e[a]?.[s],c=n[a]?.values[s];i++,Se(l,c)&&r++}return{score:i>0?Math.round(r/i*100):0,correct:r,total:i}}function Gr(e,n,t){let r={};for(let i of t){r[i]={};for(let o of t){if(i===o)continue;let a=e[i]?.[o],s=n[i]?.values[o];s==null||s===""?r[i][o]="missed":Se(a,s)?r[i][o]="correct":r[i][o]="wrong"}}return r}function Nr(e,n,t,r){let i={};for(let o of t){i[o]={};for(let a of r){let s=e[o]?.[a];if(s===null)continue;let l=n[o]?.values[a];l==null||l===""?i[o][a]="missed":Se(s,l)?i[o][a]="correct":i[o][a]="wrong"}}return i}function Or(e,n,t,r){let i={};for(let o of t){i[o]={};let a=new Set(n[o]?.selectedCols??[]),s=new Set;for(let[l,c]of e.entries())c.includes(o)&&s.add(l);for(let l of r){let c=s.has(l),d=a.has(l);c===d?i[o][l]="correct":!d&&c?i[o][l]="missed":i[o][l]="wrong"}}return i}function Vr(e,n,t){let r={};for(let i of t){r[i]={};let o=n[i]?.selectedCols??[],a=null;for(let[s,l]of e.entries())if(l.includes(i)){a=s;break}if(o.length===1){let s=o[0];s===a?r[i][s]="correct":r[i][s]="wrong"}else o.length===0&&a&&(r[i][a]="missed")}return r}var Fr=`/* ===========================================
1907
+ BASE TABLE STYLES
1908
+ =========================================== */
1909
+
1910
+ :host {
1911
+ display: block;
1912
+ width: 100%;
1913
+ container-type: inline-size;
1914
+ }
1915
+
1916
+ .wrap {
1917
+ width: 100%;
1918
+ overflow-x: auto;
1919
+ overflow-y: visible;
1920
+ }
1921
+
1922
+ table {
1923
+ width: 100%;
1924
+ border-collapse: collapse;
1925
+ background: rgb(var(--edu-bg));
1926
+ table-layout: auto;
1927
+ }
1928
+
1929
+ /* Cell base styles with text wrapping */
1930
+ td, th {
1931
+ padding: clamp(0.4rem, 1.4cqw, 0.75rem);
1932
+ text-align: center;
1933
+ vertical-align: middle;
1934
+ border: 1px solid rgb(var(--edu-border));
1935
+ color: rgb(var(--edu-ink));
1936
+ font-size: clamp(0.8rem, 1.8cqw, 0.95rem);
1937
+ line-height: 1.2;
1938
+
1939
+ /* Text wrapping and overflow handling */
1940
+ word-wrap: break-word;
1941
+ overflow-wrap: break-word;
1942
+ word-break: break-word;
1943
+ hyphens: auto;
1944
+ max-width: clamp(120px, 26cqw, 220px);
1945
+ min-width: clamp(56px, 12cqw, 90px);
1946
+ }
1947
+
1948
+ th {
1949
+ font-weight: 600;
1950
+ background: rgb(var(--edu-card));
1951
+ }
1952
+
1953
+ /* First column (row headers) */
1954
+ th[scope="row"] {
1955
+ text-align: left;
1956
+ font-weight: 500;
1957
+ background: rgb(var(--edu-card));
1958
+ white-space: normal;
1959
+ }
1960
+
1961
+ /* Disabled cells */
1962
+ .disabled-cell {
1963
+ background: rgb(var(--edu-muted));
1964
+ cursor: not-allowed;
1965
+ opacity: 0.5;
1966
+ }
1967
+
1968
+ /* Grading feedback states */
1969
+ .cell-correct {
1970
+ background: rgb(var(--edu-success) / 0.15);
1971
+ border-color: rgb(var(--edu-success) / 0.5) !important;
1972
+ }
1973
+
1974
+ .cell-wrong {
1975
+ background: rgb(var(--edu-error) / 0.15);
1976
+ border-color: rgb(var(--edu-error) / 0.5) !important;
1977
+ }
1978
+
1979
+ .cell-missed {
1980
+ background: rgb(var(--edu-warning) / 0.15);
1981
+ border-color: rgb(var(--edu-warning) / 0.5) !important;
1982
+ }
1983
+
1984
+ /* Form inputs base styles */
1985
+ input[type="text"],
1986
+ input[type="number"],
1987
+ select {
1988
+ width: 100%;
1989
+ max-width: 100%;
1990
+ padding: clamp(0.35rem, 1.2cqw, 0.5rem);
1991
+ border: 1px solid rgb(var(--edu-border));
1992
+ border-radius: 4px;
1993
+ outline: none;
1994
+ font-family: inherit;
1995
+ font-size: clamp(0.8rem, 1.6cqw, 0.9rem);
1996
+ background: rgb(var(--edu-bg));
1997
+ color: rgb(var(--edu-ink));
1998
+ transition: border-color 0.2s ease;
1999
+ }
2000
+
2001
+ input[type="text"]:focus,
2002
+ input[type="number"]:focus,
2003
+ select:focus {
2004
+ border-color: rgb(var(--edu-first-accent));
2005
+ box-shadow: 0 0 0 2px rgb(var(--edu-first-accent) / 0.15);
2006
+ }
2007
+
2008
+ input[type="checkbox"],
2009
+ input[type="radio"] {
2010
+ width: clamp(14px, 3.2cqw, 18px);
2011
+ height: clamp(14px, 3.2cqw, 18px);
2012
+ cursor: pointer;
2013
+ accent-color: rgb(var(--edu-first-accent));
2014
+ }
2015
+
2016
+ /* ===========================================
2017
+ VARIANT: ELEGANT
2018
+ Refined with subtle box shadows
2019
+ =========================================== */
2020
+
2021
+ :host([variant="elegant"]) {
2022
+ & table {
2023
+ border-collapse: separate;
2024
+ border-spacing: 6;
2025
+ }
2026
+
2027
+ & th {
2028
+ text-transform: uppercase;
2029
+ letter-spacing: 1px;
2030
+ font-size: 0.75rem;
2031
+ font-weight: 600;
2032
+ background: rgb(var(--edu-card));
2033
+ border: none;
2034
+ border-bottom: 2px solid rgb(var(--edu-border));
2035
+ padding: 1rem 0.75rem;
2036
+ }
2037
+
2038
+ & td {
2039
+ border: none;
2040
+ border-bottom: 1px solid rgb(var(--edu-border) / 0.3);
2041
+ box-shadow: inset 0 0 0 1px rgb(var(--edu-border) / 0.1);
2042
+ transition: background 0.2s ease;
2043
+ }
2044
+
2045
+ & td:hover {
2046
+ background: rgb(var(--edu-muted) / 0.3);
2047
+ }
2048
+
2049
+ & th[scope="row"] {
2050
+ font-weight: 500;
2051
+ text-transform: none;
2052
+ letter-spacing: 0;
2053
+ font-size: 0.95rem;
2054
+ }
2055
+
2056
+ & input[type="text"],
2057
+ & input[type="number"],
2058
+ & select {
2059
+ border: none;
2060
+ border-bottom: 1px solid rgb(var(--edu-border));
2061
+ border-radius: 0;
2062
+ background: transparent;
2063
+ }
2064
+
2065
+ & .disabled-cell {
2066
+ background: rgb(var(--edu-muted) / 0.4);
2067
+ }
2068
+ }
2069
+
2070
+ /* ===========================================
2071
+ VARIANT: PLAYFUL
2072
+ Bright, rounded, with color accents
2073
+ =========================================== */
2074
+
2075
+ :host([variant="playful"]) {
2076
+ & table {
2077
+ border-collapse: separate;
2078
+ border-spacing: 6px;
2079
+ }
2080
+
2081
+ & th,
2082
+ & td {
2083
+ border-radius: 8px;
2084
+ border: 2px solid rgb(var(--edu-border));
2085
+ background: rgb(var(--edu-bg));
2086
+ transition: transform 0.2s ease, box-shadow 0.2s ease;
2087
+ }
2088
+
2089
+ & th {
2090
+ background: linear-gradient(135deg, rgb(var(--edu-first-accent) / 0.15), rgb(var(--edu-first-accent) / 0.05));
2091
+ color: rgb(var(--edu-ink));
2092
+ font-weight: 700;
2093
+ }
2094
+
2095
+ & td:hover:not(.disabled-cell) {
2096
+ transform: translateY(-2px);
2097
+ box-shadow: 0 4px 8px rgb(var(--edu-shadow-color) / 0.2);
2098
+ }
2099
+
2100
+ & input[type="text"],
2101
+ & input[type="number"],
2102
+ & select {
2103
+ border: 2px solid rgb(var(--edu-border));
2104
+ border-radius: 12px;
2105
+ background: rgb(var(--edu-bg));
2106
+ }
2107
+
2108
+ & input[type="checkbox"],
2109
+ & input[type="radio"] {
2110
+ transform: scale(1.2);
2111
+ }
2112
+
2113
+ & .disabled-cell {
2114
+ background: rgb(var(--edu-muted));
2115
+ opacity: 0.6;
2116
+ }
2117
+ }
2118
+
2119
+ /* ===========================================
2120
+ VARIANT: OUTLINE
2121
+ Bold borders, clean lines
2122
+ =========================================== */
2123
+
2124
+ :host([variant="outline"]) {
2125
+ & table {
2126
+ background: transparent;
2127
+ border: 3px solid rgb(var(--edu-border));
2128
+ }
2129
+
2130
+ & th,
2131
+ & td {
2132
+ border: 2px solid rgb(var(--edu-border));
2133
+ font-weight: 500;
2134
+ }
2135
+
2136
+ & th {
2137
+ background: rgb(var(--edu-first-accent) / 0.2);
2138
+ font-weight: 700;
2139
+ text-transform: uppercase;
2140
+ letter-spacing: 0.5px;
2141
+ font-size: 0.85rem;
2142
+ }
2143
+
2144
+ & input[type="text"],
2145
+ & input[type="number"],
2146
+ & select {
2147
+ border: 3px solid rgb(var(--edu-border));
2148
+ border-radius: 0;
2149
+ box-shadow: 2px 2px 0px rgb(var(--edu-border) / 0.3);
2150
+ background: rgb(var(--edu-bg));
2151
+ }
2152
+
2153
+ & input[type="text"]:focus,
2154
+ & input[type="number"]:focus,
2155
+ & select:focus {
2156
+ box-shadow: 3px 3px 0px rgb(var(--edu-first-accent));
2157
+ }
2158
+
2159
+ & .disabled-cell {
2160
+ background: repeating-linear-gradient(
2161
+ 45deg,
2162
+ rgb(var(--edu-muted)),
2163
+ rgb(var(--edu-muted)) 10px,
2164
+ rgb(var(--edu-border) / 0.3) 10px,
2165
+ rgb(var(--edu-border) / 0.3) 20px
2166
+ );
2167
+ }
2168
+ }
2169
+
2170
+ /* ===========================================
2171
+ VARIANT: LETTER
2172
+ Typography-focused with serif fonts
2173
+ =========================================== */
2174
+
2175
+ :host([variant="letter"]) {
2176
+ & table {
2177
+ background: transparent;
2178
+ }
2179
+
2180
+ & th,
2181
+ & td {
2182
+ border: none;
2183
+ border-bottom: 1px solid rgb(var(--edu-border));
2184
+ font-family: Georgia, serif;
2185
+ letter-spacing: 0.3px;
2186
+ }
2187
+
2188
+ & th {
2189
+ color: rgb(var(--edu-ink));
2190
+ font-weight: 500;
2191
+ font-size: 1rem;
2192
+ font-style: italic;
2193
+ padding-bottom: 0.5rem;
2194
+ }
2195
+
2196
+ & th[scope="row"] {
2197
+ font-weight: 600;
2198
+ font-style: normal;
2199
+ }
2200
+
2201
+ & td {
2202
+ font-size: 0.95rem;
2203
+ }
2204
+
2205
+ & input[type="text"],
2206
+ & input[type="number"],
2207
+ & select {
2208
+ border: none;
2209
+ border-bottom: 1px dashed rgb(var(--edu-border));
2210
+ border-radius: 0;
2211
+ background: transparent;
2212
+ font-family: Georgia, serif;
2213
+ color: rgb(var(--edu-ink) / 0.9);
2214
+ }
2215
+
2216
+ & .disabled-cell {
2217
+ background: transparent;
2218
+ color: rgb(var(--edu-ink) / 0.3);
2219
+ font-style: italic;
2220
+ }
2221
+ }
2222
+
2223
+ /* ===========================================
2224
+ VARIANT: SIGN
2225
+ Bold, industrial, high-contrast
2226
+ =========================================== */
2227
+
2228
+ :host([variant="sign"]) {
2229
+ & table {
2230
+ border: 3px solid rgb(var(--edu-ink));
2231
+ }
2232
+
2233
+ & th {
2234
+ background: rgb(var(--edu-ink));
2235
+ color: rgb(var(--edu-inverted-ink));
2236
+ text-transform: uppercase;
2237
+ font-style: italic;
2238
+ font-weight: 700;
2239
+ letter-spacing: 1.5px;
2240
+ border: 2px solid rgb(var(--edu-ink));
2241
+ padding: 1rem;
2242
+ }
2243
+
2244
+ & td {
2245
+ border: 2px solid rgb(var(--edu-ink));
2246
+ font-weight: 600;
2247
+ }
2248
+
2249
+ & th[scope="row"] {
2250
+ background: rgb(var(--edu-card));
2251
+ color: rgb(var(--edu-ink));
2252
+ font-style: normal;
2253
+ }
2254
+
2255
+ & input[type="text"],
2256
+ & input[type="number"],
2257
+ & select {
2258
+ border: 2px solid rgb(var(--edu-ink));
2259
+ border-radius: 0;
2260
+ background: rgb(var(--edu-bg));
2261
+ font-weight: 600;
2262
+ }
2263
+
2264
+ & .disabled-cell {
2265
+ background: repeating-linear-gradient(
2266
+ 135deg,
2267
+ rgb(var(--edu-card)),
2268
+ rgb(var(--edu-card)) 8px,
2269
+ rgb(var(--edu-ink) / 0.2) 8px,
2270
+ rgb(var(--edu-ink) / 0.2) 16px
2271
+ );
2272
+ }
2273
+ }
2274
+
2275
+ /* ===========================================
2276
+ VARIANT: MINIMAL
2277
+ Clean, spacious, understated
2278
+ =========================================== */
2279
+
2280
+ :host([variant="minimal"]) {
2281
+ & table {
2282
+ border: none;
2283
+ }
2284
+
2285
+ & th {
2286
+ border: none;
2287
+ border-bottom: 1px solid rgb(var(--edu-border));
2288
+ background: transparent;
2289
+ color: rgb(var(--edu-ink));
2290
+ font-weight: 500;
2291
+ font-size: 0.9rem;
2292
+ padding: 0.5rem 0.75rem;
2293
+ }
2294
+
2295
+ & td {
2296
+ border: none;
2297
+ border-bottom: 1px solid rgb(var(--edu-border) / 0.5);
2298
+ background: transparent;
2299
+ }
2300
+
2301
+ & tr:last-child td {
2302
+ border-bottom: none;
2303
+ }
2304
+
2305
+ & input[type="text"],
2306
+ & input[type="number"],
2307
+ & select {
2308
+ border: none;
2309
+ border-bottom: 1px solid rgb(var(--edu-border) / 0.5);
2310
+ border-radius: 0;
2311
+ background: transparent;
2312
+ padding: 0.25rem;
2313
+ }
2314
+
2315
+ & input[type="text"]:focus,
2316
+ & input[type="number"]:focus,
2317
+ & select:focus {
2318
+ border-bottom-color: rgb(var(--edu-first-accent));
2319
+ box-shadow: none;
2320
+ }
2321
+
2322
+ & .disabled-cell {
2323
+ background: transparent;
2324
+ color: rgb(var(--edu-ink) / 0.3);
2325
+ }
2326
+ }
2327
+
2328
+ /* ===========================================
2329
+ VARIANT: GLASS
2330
+ Frosted glass effect with depth
2331
+ =========================================== */
2332
+
2333
+ :host([variant="glass"]) {
2334
+ & table {
2335
+ background: rgb(var(--edu-bg) / 0.7);
2336
+ backdrop-filter: blur(10px);
2337
+ border: 1px solid rgb(var(--edu-border) / 0.3);
2338
+ border-radius: 12px;
2339
+ overflow: hidden;
2340
+ }
2341
+
2342
+ & th,
2343
+ & td {
2344
+ border: 1px solid rgb(var(--edu-border) / 0.2);
2345
+ background: rgb(var(--edu-bg) / 0.4);
2346
+ }
2347
+
2348
+ & th {
2349
+ color: rgb(var(--edu-ink));
2350
+ font-weight: 600;
2351
+ background: rgb(var(--edu-card) / 0.6);
2352
+ backdrop-filter: blur(5px);
2353
+ border-bottom: 2px solid rgb(var(--edu-border) / 0.4);
2354
+ }
2355
+
2356
+ & input[type="text"],
2357
+ & input[type="number"],
2358
+ & select {
2359
+ background: rgb(var(--edu-bg) / 0.5);
2360
+ border: 1px solid rgb(var(--edu-border) / 0.3);
2361
+ border-radius: 6px;
2362
+ backdrop-filter: blur(5px);
2363
+ }
2364
+
2365
+ & input[type="text"]:focus,
2366
+ & input[type="number"]:focus,
2367
+ & select:focus {
2368
+ background: rgb(var(--edu-bg) / 0.8);
2369
+ border-color: rgb(var(--edu-first-accent) / 0.6);
2370
+ }
2371
+
2372
+ & .disabled-cell {
2373
+ background: rgb(var(--edu-muted) / 0.3);
2374
+ backdrop-filter: blur(3px);
2375
+ }
2376
+ }
2377
+
2378
+ /* ===========================================
2379
+ VARIANT: EMPTY
2380
+ Bare minimum, dashed borders
2381
+ =========================================== */
2382
+
2383
+ :host([variant="empty"]) {
2384
+ & table {
2385
+ border: none;
2386
+ background: none;
2387
+ }
2388
+
2389
+ & th,
2390
+ & td {
2391
+ border: 1px dashed rgb(var(--edu-border));
2392
+ background: transparent;
2393
+ }
2394
+
2395
+ & th {
2396
+ background: transparent;
2397
+ color: rgb(var(--edu-ink));
2398
+ font-weight: 600;
2399
+ }
2400
+
2401
+ & input[type="text"],
2402
+ & input[type="number"],
2403
+ & select {
2404
+ border: none;
2405
+ border-bottom: 1px dashed rgb(var(--edu-border));
2406
+ border-radius: 0;
2407
+ background: transparent;
2408
+ }
2409
+
2410
+ & .disabled-cell {
2411
+ background: transparent;
2412
+ opacity: 0.4;
2413
+ }
2414
+ }
2415
+
2416
+ /* ===========================================
2417
+ RESPONSIVE BEHAVIOR
2418
+ =========================================== */
2419
+
2420
+ @container (max-width: 720px) {
2421
+ td, th {
2422
+ padding: clamp(0.35rem, 1.2cqw, 0.5rem);
2423
+ font-size: clamp(0.75rem, 1.6cqw, 0.85rem);
2424
+ min-width: clamp(52px, 11cqw, 70px);
2425
+ }
2426
+
2427
+ input[type="text"],
2428
+ input[type="number"],
2429
+ select {
2430
+ font-size: clamp(0.75rem, 1.4cqw, 0.85rem);
2431
+ padding: clamp(0.3rem, 1cqw, 0.4rem);
2432
+ }
2433
+
2434
+ input[type="checkbox"],
2435
+ input[type="radio"] {
2436
+ width: clamp(12px, 2.8cqw, 16px);
2437
+ height: clamp(12px, 2.8cqw, 16px);
2438
+ }
2439
+ }
2440
+
2441
+ @container (max-width: 480px) {
2442
+ td, th {
2443
+ padding: clamp(0.3rem, 1cqw, 0.4rem);
2444
+ font-size: clamp(0.7rem, 1.4cqw, 0.8rem);
2445
+ max-width: clamp(90px, 30cqw, 120px);
2446
+ min-width: clamp(48px, 10cqw, 60px);
2447
+ }
2448
+ }
2449
+ `;function re(e){return E(e)}var We=class extends HTMLElement{constructor(){super();this._state={};this._mounted=!1;this.onChange=t=>{let r=t.target,i=r.getAttribute?.("data-r"),o=r.getAttribute?.("data-c");if(!i||!o||!this._config)return;let a=this._config.cellKind,s=null;r instanceof HTMLInputElement&&(a==="checkbox"||a==="radio"?s=r.checked:a==="text"?s=r.value:a==="number"&&(s=r.value===""?null:Number(r.value))),r instanceof HTMLSelectElement&&(s=r.value===""?null:r.value),this.applyCellValue(i,o,s),this.emitChange(i,o,s)};this.onInput=t=>{};this.attachShadow({mode:"open"});let t=document.createElement("section");t.className="wrap",this.shadowRoot.append(t),this.$wrapEl=t}static get observedAttributes(){return["variant"]}connectedCallback(){this._mounted=!0,this.shadowRoot?.addEventListener("change",this.onChange),this.shadowRoot?.addEventListener("input",this.onInput),this.render()}disconnectedCallback(){this._mounted=!1}set config(t){this._config=t,this._state=this.initState(t),t.variant&&this.setAttribute("variant",t.variant),this.render()}get config(){if(!this._config)throw new Error("<edu-table>: spec not set");return this._config}get value(){return this._state}set value(t){this._state=t,this.render()}getValue(){return this._state}setValue(t){this._state=t,this.render()}getState(){let t=this._config;if(!t)return{};let r={};for(let i of t.rows){let o=this._state[i]??{},a=[];for(let s of t.cols){let l=o[s]??null;(t.cellKind==="checkbox"||t.cellKind==="radio")&&l===!0&&a.push(s)}r[i]={selectedCols:a,values:{...o}}}return r}attributeChangedCallback(t,r,i){r!==i&&t==="variant"&&(this.setAttribute("variant",i),this.$wrapEl.querySelectorAll("edu-input").forEach(o=>{o.setAttribute("variant",i)}))}initState(t){let r={};for(let i of t.rows){r[i]={};for(let o of t.cols)switch(t.cellKind){case"checkbox":case"radio":r[i][o]=!1;break;case"select":case"text":case"number":r[i][o]=null;break}}return r}render(){if(!this._mounted||!this.shadowRoot)return;if(!this._config){this.$wrapEl.innerHTML="<style>:host{display:block}</style><div></div>";return}let t=this._config,r=t.shuffle?S(t.cols):t.cols,i=`
2450
+ <tr>
2451
+ <th></th>
2452
+ ${r.map(s=>`<th scope="col">${E(s)}</th>`).join("")}
2453
+ </tr>
2454
+ `,a=(t.shuffle?S(t.rows):t.rows).map(s=>{let l=r.map(c=>this.renderCell(t,s,c)).join("");return`<tr><th scope="row">${E(s)}</th>${l}</tr>`}).join("");this.$wrapEl.innerHTML=`
2455
+ <style>${Fr}</style>
2456
+ <table part="table">
2457
+ <thead>${i}</thead>
2458
+ <tbody>${a}</tbody>
2459
+ </table>
2460
+ `}renderCell(t,r,i){if(t.disabled?.(r,i)??!1)return'<td aria-disabled="true" class="disabled-cell"></td>';let a=`cell-${P(r)}-${P(i)}`,s=this._state[r]?.[i]??null,l=t.gradingState?.[r]?.[i],c=l?`cell-${l}`:"",d=p=>`<td class="${c}">${p}</td>`,u=`id="${a}" data-r="${re(r)}" data-c="${re(i)}"
2461
+ aria-label="${re(`${r} / ${i}`)}" variant="${this.getAttribute("variant")}" `;switch(t.cellKind){case"checkbox":return d(`<input ${u} type="checkbox" ${s===!0?"checked":""}/>`);case"radio":{let p=s===!0?"checked":"";return d(`<input ${u} type="radio" name="row-${P(r)}" ${p}/>`)}case"text":{let p=s==null?"":String(s);return d(`<edu-input ${u} type="text" value="${re(p)}"/>`)}case"number":{let p=s==null?"":String(s);return d(`<edu-input ${u} type="number" value="${re(p)}"/>`)}case"select":{let p=t.allowed?.(r,i)??[],h=s==null?"":String(s),g=['<option value=""></option>',...p.map(m=>{let b=String(m),w=b===h?"selected":"";return`<option value="${re(b)}" ${w}>${E(b)}</option>`})].join("");return d(`<edu-input as="select" ${u}>${g}</select>`)}}}reset(){this._config&&(this._state=this.initState(this._config),this.render(),this.dispatchEvent(new CustomEvent("reset",{bubbles:!0,composed:!0})))}setGradingState(t){this._config&&(this._config.gradingState=t,this.render())}clearGradingState(){this._config&&(this._config.gradingState=void 0,this.render())}applyCellValue(t,r,i){let o=this._config;if(o&&!o.disabled?.(t,r)){if(o.cellKind==="select"){let a=o.allowed?.(t,r);if(a&&i!==null&&!a.some(s=>String(s)===String(i)))return}if(this._state[t]??={},this._config.cellKind==="radio"&&i===!0){for(let a of this._config.cols)this._state[t][a]=!1;this._state[t][r]=!0;return}this._state[t][r]=i}}emitChange(t,r,i){let o={row:t,col:r,value:i,state:this.getValue(),selection:this.getState()};this.dispatchEvent(new CustomEvent("change",{detail:o,bubbles:!0,composed:!0}))}};customElements.get("edu-table")||customElements.define("edu-table",We);var Te=class extends x{constructor(t,r){super(t,r);this.interactionMechanic="static";let i=ke(t.answerKey),o=Ke(i);this._tableConfig={rows:t.rows,cols:t.cols,answerKey:t.answerKey,cellKind:o,preset:"lookup",disabled:(s,l)=>t.answerKey[s]?.[l]===null,allowed:o==="select"?()=>Ye(t.answerKey):void 0,variant:r.variant??"outline",shuffle:r.shuffle??!1};let a=0;for(let s of t.rows)for(let l of t.cols)t.answerKey[s]?.[l]!==null&&a++;this.initializeProgress(a)}initialize(){}cleanup(){}onVariantChange(t){this._tableConfig.variant=t,this._$table&&this._$table.setAttribute("variant",t)}render(){this._tableConfig.variant=this.config.variant,this._$table=document.createElement("edu-table"),this._$table.config=this._tableConfig,this._$table.addEventListener("change",()=>{this.updateProgressBasedOnCompletion(),this.emitStateChange()}),this.innerHTML=`
2462
+ <style>
2463
+ :host {
2464
+ display: flex;
2465
+ width: 100%;
2466
+ height: 100%;
2467
+ box-sizing: border-box;
2468
+ }
2469
+
2470
+ .table-container {
2471
+ display: flex;
2472
+ flex-direction: column;
2473
+ width: 100%;
2474
+ height: 100%;
2475
+ overflow: hidden;
2476
+ box-sizing: border-box;
2477
+ }
2478
+
2479
+ .table-wrapper {
2480
+ flex: 1;
2481
+ overflow-y: auto;
2482
+ overflow-x: auto;
2483
+ min-height: 0;
2484
+ padding: 1rem;
2485
+ }
2486
+ </style>
2487
+ <div class="table-container">
2488
+ <div class="table-wrapper"></div>
2489
+ </div>
2490
+ `,this.querySelector(".table-wrapper").appendChild(this._$table)}updateProgressBasedOnCompletion(){let t=this._$table.getState(),r=0;for(let i of this.data.rows)for(let o of this.data.cols){if(this.data.answerKey[i]?.[o]===null)continue;let a=t[i]?.values[o];a!=null&&a!==""&&r++}this.setProgress(r)}getCurrentState(){return this._$table.getState()}isInteractionComplete(){let t=this._$table.getState();for(let r of this.data.rows)for(let i of this.data.cols){if(this.data.answerKey[r]?.[i]===null)continue;let o=t[r]?.values[i];if(o==null||o==="")return!1}return!0}onHint(){let t=this._$table.getState();for(let r of this.data.rows)for(let i of this.data.cols){if(this.data.answerKey[r]?.[i]===null)continue;let o=t[r]?.values[i];if(o==null||o===""){alert(`Hint: You haven't filled the cell for "${r}" / "${i}" yet.`),this.emitHintShown(`Empty cell: ${r} / ${i}`);return}}alert('All cells are complete! Click "Check" to submit.'),this.emitHintShown("All cells complete")}submit(){super.submit();let t=this.getCurrentState(),r=qr(this.data.answerKey,t,this.data.rows,this.data.cols),i=Nr(this.data.answerKey,t,this.data.rows,this.data.cols);this._$table.setGradingState(i),console.log(`Lookup Table Score: ${r.score.toFixed(1)}% (${r.correct}/${r.total} correct)`),this.dispatchEvent(new CustomEvent("interaction:graded",{detail:{result:r},bubbles:!0,composed:!0}))}reset(){super.reset(),this._$table&&(this._$table.reset(),this._$table.clearGradingState())}};customElements.get("lookup-table")||customElements.define("lookup-table",Te);var $e=class extends x{constructor(t,r){super(t,r);this.interactionMechanic="static";this._tableConfig={rows:t.rows,cols:t.cols,answerKey:t.answerKey,cellKind:"checkbox",preset:"classification",variant:r.variant??"outline",shuffle:r.shuffle},this.initializeProgress(t.rows.length)}initialize(){}cleanup(){}onVariantChange(t){this._tableConfig.variant=t,this._$table&&this._$table.setAttribute("variant",t)}render(){this._tableConfig.variant=this.config.variant,this._$table=document.createElement("edu-table"),this._$table.config=this._tableConfig,this._$table.addEventListener("change",()=>{this.updateProgressBasedOnCompletion(),this.emitStateChange()}),this.innerHTML="",this.appendChild(this._$table)}updateProgressBasedOnCompletion(){let t=this._$table.getState(),r=0;for(let i of this.data.rows)t[i]?.selectedCols.length>0&&r++;this.setProgress(r)}getCurrentState(){return this._$table.getState()}isInteractionComplete(){let t=this._$table.getState();return this.data.rows.every(r=>t[r]?.selectedCols.length>0)}onHint(){let t=this._$table.getState(),r=this.data.rows.filter(o=>!t[o]||t[o].selectedCols.length===0);if(r.length===0){alert('All rows are complete! Click "Check" to submit.'),this.emitHintShown("All rows complete");return}let i=r[0];alert(`Hint: You haven't classified "${i}" yet. Which categories does it belong to?`),this.emitHintShown(`Incomplete row: ${i}`)}submit(){super.submit();let t=this.getCurrentState(),r=zr(this.data.answerKey,t,this.data.rows,this.data.cols),i=Or(this.data.answerKey,t,this.data.rows,this.data.cols);this._$table.setGradingState(i),console.log(`Classification Score: ${r.score.toFixed(1)}% (${r.correct}/${r.total} correct)`),this.dispatchEvent(new CustomEvent("interaction:graded",{detail:{result:r},bubbles:!0,composed:!0}))}reset(){super.reset(),this._$table&&(this._$table.reset(),this._$table.clearGradingState())}};customElements.get("classification-matrix")||customElements.define("classification-matrix",$e);var Ae=class extends x{constructor(t,r){super(t,r);this.interactionMechanic="static";this._tableConfig={rows:t.rows,cols:t.cols,answerKey:t.answerKey,cellKind:"radio",preset:"n-ary",variant:r.variant??"outline",shuffle:!0},this.initializeProgress(t.rows.length)}initialize(){}cleanup(){}onVariantChange(t){this._tableConfig.variant=t,this._$table&&this._$table.setAttribute("variant",t)}render(){this._tableConfig.variant=this.config.variant,this._$table=document.createElement("edu-table"),this._$table.config=this._tableConfig,this._$table.addEventListener("change",()=>{this.updateProgressBasedOnCompletion(),this.emitStateChange()}),this.innerHTML=`
2491
+ <style>
2492
+ nary-choice-table {
2493
+ display: flex;
2494
+ width: 100%;
2495
+ height: 100%;
2496
+ box-sizing: border-box;
2497
+ }
2498
+
2499
+ .table-container {
2500
+ display: flex;
2501
+ flex-direction: column;
2502
+ width: 100%;
2503
+ height: 100%;
2504
+ overflow: hidden;
2505
+ box-sizing: border-box;
2506
+ }
2507
+
2508
+ .table-wrapper {
2509
+ flex: 1;
2510
+ overflow-y: auto;
2511
+ overflow-x: auto;
2512
+ min-height: 0;
2513
+ padding: 1rem;
2514
+ }
2515
+ </style>
2516
+ <div class="table-container">
2517
+ <div class="table-wrapper"></div>
2518
+ </div>
2519
+ `,this.querySelector(".table-wrapper").appendChild(this._$table)}updateProgressBasedOnCompletion(){let t=this._$table.getState(),r=0;for(let i of this.data.rows)t[i]?.selectedCols.length===1&&r++;this.setProgress(r)}getCurrentState(){return this._$table.getState()}isInteractionComplete(){let t=this._$table.getState();return this.data.rows.every(r=>t[r]?.selectedCols.length===1)}onHint(){let t=this._$table.getState(),r=this.data.rows.filter(o=>!t[o]||t[o].selectedCols.length!==1);if(r.length===0){alert('All rows are complete! Click "Check" to submit.'),this.emitHintShown("All rows complete");return}let i=r[0];alert(`Hint: You haven't selected a category for "${i}" yet. Which one does it belong to?`),this.emitHintShown(`Incomplete row: ${i}`)}submit(){super.submit();let t=this.getCurrentState(),r=Br(this.data.answerKey,t,this.data.rows),i=Vr(this.data.answerKey,t,this.data.rows);this._$table.setGradingState(i),console.log(`N-ary Choice Score: ${r.score.toFixed(1)}% (${r.correct}/${r.total} correct)`),this.dispatchEvent(new CustomEvent("interaction:graded",{detail:{result:r},bubbles:!0,composed:!0}))}reset(){super.reset(),this._$table&&(this._$table.reset(),this._$table.clearGradingState())}};customElements.get("nary-choice-table")||customElements.define("nary-choice-table",Ae);var _e=class extends x{constructor(t,r){super(t,r);this.interactionMechanic="static";let i=ke(t.answerKey),o=Ke(i);this._tableConfig={rows:t.rows,cols:t.cols,answerKey:t.answerKey,cellKind:o,preset:"adjacency",disabled:(s,l)=>s===l,allowed:o==="select"?()=>Ye(t.answerKey):void 0,variant:r.variant??"outline",shuffle:r.shuffle??!1};let a=t.rows.length*(t.rows.length-1);this.initializeProgress(a)}initialize(){}cleanup(){}onVariantChange(t){this._tableConfig.variant=t,this._$table&&this._$table.setAttribute("variant",t)}render(){this._tableConfig.variant=this.config.variant,this._$table=document.createElement("edu-table"),this._$table.config=this._tableConfig,this._$table.addEventListener("change",()=>{this.updateProgressBasedOnCompletion(),this.emitStateChange()}),this.innerHTML=`
2520
+ <style>
2521
+ :host {
2522
+ display: flex;
2523
+ width: 100%;
2524
+ height: 100%;
2525
+ box-sizing: border-box;
2526
+ }
2527
+
2528
+ .table-container {
2529
+ display: flex;
2530
+ flex-direction: column;
2531
+ width: 100%;
2532
+ height: 100%;
2533
+ overflow: hidden;
2534
+ box-sizing: border-box;
2535
+ }
2536
+
2537
+ .table-wrapper {
2538
+ flex: 1;
2539
+ overflow-y: auto;
2540
+ overflow-x: auto;
2541
+ min-height: 0;
2542
+ padding: 1rem;
2543
+ }
2544
+ </style>
2545
+ <div class="table-container">
2546
+ <div class="table-wrapper"></div>
2547
+ </div>
2548
+ `,this.querySelector(".table-wrapper").appendChild(this._$table)}updateProgressBasedOnCompletion(){let t=this._$table.getState(),r=0;for(let i of this.data.rows)for(let o of this.data.cols){if(i===o)continue;let a=t[i]?.values[o];a!=null&&a!==""&&r++}this.setProgress(r)}getCurrentState(){return this._$table.getState()}isInteractionComplete(){let t=this._$table.getState();for(let r of this.data.rows)for(let i of this.data.cols){if(r===i)continue;let o=t[r]?.values[i];if(o==null||o==="")return!1}return!0}onHint(){let t=this._$table.getState();for(let r of this.data.rows)for(let i of this.data.cols){if(r===i)continue;let o=t[r]?.values[i];if(o==null||o===""){alert(`Hint: You haven't filled the cell for "${r}" \u2192 "${i}" yet.`),this.emitHintShown(`Empty cell: ${r} \u2192 ${i}`);return}}alert('All cells are complete! Click "Check" to submit.'),this.emitHintShown("All cells complete")}submit(){super.submit();let t=this.getCurrentState(),r=Hr(this.data.answerKey,t,this.data.rows),i=Gr(this.data.answerKey,t,this.data.rows);this._$table.setGradingState(i),console.log(`Adjacency Table Score: ${r.score.toFixed(1)}% (${r.correct}/${r.total} correct)`),this.dispatchEvent(new CustomEvent("interaction:graded",{detail:{result:r},bubbles:!0,composed:!0}))}reset(){super.reset(),this._$table&&(this._$table.reset(),this._$table.clearGradingState())}};customElements.get("adjacency-table")||customElements.define("adjacency-table",_e);var Zo=/\[([^\]]+)\]/g,Xo=/^\s*(-?\d+)\s*(\.\.)\s*(-?\d+)\s*$/,Jo=/^\d{4}\/(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])$/,ea=/^([01]\d|2[0-3]):[0-5]\d$/,jr=e=>{let n=Y(e);if(n.length===0||n.some(o=>!o))return{ok:!1,data:null,errors:{"@tx":"provide at least one non-empty answer."}};let t=J(n),r=`text-${P(e)}`,i=`<edu-input type="text" id="${r}" variant="outline" autocomplete="off"></edu-input>`;return{ok:!0,data:{type:"text",id:r,value:t,html:i},errors:null}},Ur=e=>{let t=[...e.matchAll(Zo)].flatMap(c=>Y(c[1])),r=e.replace(/\[|\]/g,""),i=[" ",...S(J(Y(r)))];if(i.length===0)return{ok:!1,data:null,errors:{"@sl":"provide at least one option for the select."}};if(t.length===0)return{ok:!1,data:null,errors:{"@sl":"Mark at least one correct option inside of square brackets."}};let o=[...i],a=`select-${P(e)}-${Math.random().toString(36).slice(2)}`,s=o.map(c=>`<option>${c}</option>`).join(""),l=`<edu-input as="select" id="${a}" variant="outline">${s}</edu-input>`;return{ok:!0,data:{type:"select",id:a,correctOptions:t,options:i,html:l},errors:null}},Yr=e=>{let n=Y(e);if(n.length===0||n.some(a=>!a.trim()))return{ok:!1,data:null,errors:{"@nm":"provide at least one non-empty option."}};let t=[],r=[];for(let a of n){let s=a.match(Xo);if(s){let l=parseInt(s[1],10),c=parseInt(s[3],10);if(Number.isNaN(l)||Number.isNaN(c)||l>c)return{ok:!1,data:null,errors:{"@nm":"Invalid range ${t}"}};r.push({from:l,to:c})}else{let l=Number(a.trim());if(!Number.isInteger(l))return{ok:!1,data:null,errors:{"@nm":"${t} is not an integer."}};t.push(l)}}let i=`number-${P(e)}-${Math.random().toString(36).slice(2)}`,o=`<edu-input type="number" variant="outline" id="${i}"></edu-input>`;return{ok:!0,data:{type:"number",id:i,targets:J(t),ranges:r,html:o},errors:null}},Kr=e=>{let n=Y(e);if(n.length===0||n.some(a=>!a.trim()))return{ok:!1,data:null,errors:{"@dt":"provide at least one non-empty date option."}};let t=[];for(let a of n){let s=a.trim();if(!Jo.test(s))return{ok:!1,data:null,errors:{"@dt":`"${s}" is not a valid date. Expected format: YYYY/MM/DD`}};t.push(s)}let r=J(t),i=`date-${P(e)}`,o=`<edu-input type="date" id="${i}" variant="outline"></edu-input>`;return{ok:!0,data:{type:"date",id:i,value:r[0],html:o},errors:null}},Wr=e=>{let n=Y(e);if(n.length===0||n.some(a=>!a.trim()))return{ok:!1,data:null,errors:{"@tm":"provide at least one non-empty time option."}};let t=[];for(let a of n){let s=a.trim();if(!ea.test(s))return{ok:!1,data:null,errors:{"@tm":`"${s}" is not a valid time. Expected format: HH:MM (24-hour)`}};t.push(s)}let r=J(t),i=`time-${P(e)}`,o=`<edu-input type="time" id="${i}" variant="outline"></edu-input>`;return{ok:!0,data:{type:"time",id:i,value:r[0],html:o},errors:null}};function Qr(e){return e.trim().split(";;")}var Zr=["tx","nm","sl","dt","tm"],ta={tx:jr,nm:Yr,sl:Ur,dt:Kr,tm:Wr},Xr=e=>{let n=[],t=[],r={},i,o=/^\s*=\s*\[([^\]]+)\]\s*;/m,a=e.match(o);a&&(i=a[1].split("|").map(h=>h.trim().replace(/^["']|["']$/g,"")).filter(Boolean),e=e.replace(o,""));let s="",l=!1,c=null,d=0;for(;d<e.length;){let p=e[d];if(d+1<e.length&&p==="["&&e[d+1]==="["){s+="[",d+=2;continue}if(p==="["){s.trim().length>0&&(n.push(s.trim()),s=""),l=!0,c={words:[],startPos:n.length,endPos:n.length},d++;continue}if(p==="]"){if(!l){r[`at:${d}`]="Unexpected closing bracket ']' without matching opening bracket.",d++;continue}if(s.trim().length>0){let h=s.trim();c.words.push(h),n.push(h),s=""}c.words.length===0?r[`at:${d}`]="Empty brackets [] are not allowed as targets.":(c.endPos=n.length-1,t.push(c)),c=null,l=!1,d++;continue}if(p===" "||p===`
2549
+ `||p===" "||p==="\r"){if(s.trim().length>0){let h=s.trim();l&&c.words.push(h),n.push(h),s=""}d++;continue}s+=p,d++}if(s.trim().length>0){let p=s.trim();l&&(c.words.push(p),c.endPos=n.length,t.push(c)),n.push(p)}l&&(r.unclosed="Unclosed opening bracket '['. Expected ']'.");let u=Object.keys(r).length>0;return{ok:!u,data:{type:"base",parts:n,targets:t,...i&&{distractors:i}},errors:u?r:null}},Jr=e=>{let n={},t=[],r=[],i="",o=0;for(;o<e.length;){let s=e[o];if(o+1<e.length&&s==="@"&&e[o+1]==="@"){i+="@",o+=2;continue}if(s!=="@"){if(s===" "||s===`
2550
+ `||s===" "||s==="\r"){i.trim().length>0&&(t.push(i.trim()),i=""),o++;continue}i+=s,o++;continue}i.trim().length>0&&(t.push(i.trim()),i="");let l=o;o++;let c="";for(;o<e.length&&/[a-z]/i.test(e[o]);)c+=e[o++];if(!c||!Zr.includes(c)){n[`at:${l}`]=`Invalid element reference "@${c}". Expected one of: ${Zr.join(", ")}.`;continue}if(o>=e.length||e[o]!=="("){n[`at:${l}`]=`Expected '(' after @${c} at position ${o}.`;continue}o++;let d="",u=!1;for(;o<e.length;){if(e[o]===")"){u=!0,o++;break}d+=e[o++]}if(!u){n[`at:${l}`]=`Unclosed parenthesis for @${c}. Expected ')'.`;continue}let p=ta[c];if(!p){n[`at:${l}`]=`No parser found for @${c}.`;continue}let h=p(d);if(!h.ok){n[`at:${l}`]=h.errors?JSON.stringify(h.errors):`Failed to parse @${c}(${d})`;continue}t.push(h.data.html);let g={id:h.data.id,expectedValue:h.data};r.push(g)}i.trim().length>0&&t.push(i.trim());let a=Object.keys(n).length>0;return{ok:!a,data:{type:"blanks",parts:t,targets:r},errors:a?n:null}},ei=e=>{let n=[],t={},r=new Map,i="",o=0;for(;o<e.length;){let l=e[o];if(o+1<e.length&&l==="@"&&e[o+1]==="@"){i+="@",o+=2;continue}if(l!=="@"){if(l===" "||l===`
2551
+ `||l===" "||l==="\r"){i.trim().length>0&&(n.push(i.trim()),i=""),o++;continue}i+=l,o++;continue}i.trim().length>0&&(n.push(i.trim()),i="");let c=o;o++;let d="";for(;o<e.length&&/[a-z]/i.test(e[o]);)d+=e[o++];if(d!=="ct"){t[`at:${c}`]=`Invalid reference "@${d}". Expected "@ct" for classification.`;continue}if(o>=e.length||e[o]!=="("){t[`at:${c}`]=`Expected '(' after @ct at position ${o}.`;continue}o++;let u="",p=!1;for(;o<e.length;){if(e[o]===")"){p=!0,o++;break}u+=e[o++]}if(!p){t[`at:${c}`]="Unclosed parenthesis for @ct. Expected ')'.";continue}let h=u.split(",").map(K=>K.trim());if(h.length!==2){t[`at:${c}`]=`Invalid @ct syntax. Expected: @ct(category, word). Got: @ct(${u})`;continue}let[g,m]=h;if(!g||!m){t[`at:${c}`]=`Category and word cannot be empty in @ct(${u}).`;continue}let b=m.split(/\s+/).filter(Boolean),w=n.length;for(let K of b)n.push(K);let v=n.length-1,q={words:b,startPos:w,endPos:v};r.has(g)||r.set(g,[]),r.get(g).push(q)}i.trim().length>0&&n.push(i.trim());let a=[];for(let[l,c]of r.entries())a.push({category:l,targets:c});let s=Object.keys(t).length>0;return{ok:!s,data:{type:"classification",parts:n,targets:a},errors:s?t:null}},ra={base:Xr,blanks:Jr,classification:ei};function ia(e,n){let t=Qr(e),r=ra[n],i=[],o=[];for(let a of t){let s=r(a);if(!s.ok){s.errors&&(Array.isArray(s.errors)?o.push(...s.errors):o.push(s.errors));continue}i.push(s.data)}return o.length>0?{ok:!1,data:null,errors:o}:{ok:!0,data:i,errors:null}}function ti(e){let n={};if((!e.parts||e.parts.length===0)&&(n["parts.empty"]="No parts found. Text must contain at least one word."),(!e.targets||e.targets.length===0)&&(n["targets.empty"]="No targets found. Text must contain at least one [target] to interact with."),e.targets&&e.targets.length>0&&e.parts&&e.parts.length>0)for(let t=0;t<e.targets.length;t++){let r=e.targets[t],i=`targets[${t}]`;if(!r.words||r.words.length===0){n[`${i}.words.empty`]=`Target ${t} has no words. Each target must contain at least one word.`;continue}if(r.startPos<0&&(n[`${i}.startPos.negative`]=`Target ${t} has negative startPos (${r.startPos}).`),r.endPos<0&&(n[`${i}.endPos.negative`]=`Target ${t} has negative endPos (${r.endPos}).`),r.startPos>r.endPos&&(n[`${i}.position.invalid`]=`Target ${t} has startPos (${r.startPos}) greater than endPos (${r.endPos}).`),r.startPos>=e.parts.length&&(n[`${i}.startPos.outOfBounds`]=`Target ${t} startPos (${r.startPos}) is out of bounds (parts length: ${e.parts.length}).`),r.endPos>=e.parts.length&&(n[`${i}.endPos.outOfBounds`]=`Target ${t} endPos (${r.endPos}) is out of bounds (parts length: ${e.parts.length}).`),r.startPos<e.parts.length&&r.endPos<e.parts.length){let o=r.endPos-r.startPos+1;r.words.length!==o&&(n[`${i}.words.countMismatch`]=`Target ${t} has ${r.words.length} words but position range indicates ${o} words.`);for(let a=0;a<r.words.length;a++){let s=r.startPos+a;if(s<e.parts.length){let l=e.parts[s],c=r.words[a];l!==c&&(n[`${i}.words[${a}].mismatch`]=`Target ${t} word "${c}" doesn't match part at position ${s}: "${l}".`)}}}}if(e.distractors)if(!Array.isArray(e.distractors))n["distractors.notArray"]="Distractors must be an array.";else{e.distractors.length===0&&(n["distractors.empty"]="Distractors array is empty. Remove distractors field or add at least one distractor.");let t=new Set;for(let r=0;r<e.distractors.length;r++){let i=e.distractors[r];t.has(i)&&(n[`distractors[${r}].duplicate`]=`Duplicate distractor found: "${i}".`),t.add(i),(!i||i.trim().length===0)&&(n[`distractors[${r}].empty`]=`Distractor at index ${r} is empty.`)}}return Object.keys(n).length>0?{ok:!1,errors:n}:{ok:!0,errors:null}}function ri(e){let n={};(!e.parts||e.parts.length===0)&&(n["parts.empty"]="No parts found. Text must contain at least one part."),(!e.targets||e.targets.length===0)&&(n["targets.empty"]="No targets found. Text must contain at least one input element (@tx, @nm, @sl, @dt, @tm).");let t=new Set;if(e.targets&&e.targets.length>0)for(let r=0;r<e.targets.length;r++){let i=e.targets[r],o=`targets[${r}]`;if(!i.id||i.id.trim().length===0?n[`${o}.id.empty`]=`Target ${r} has no ID. Each input element must have a unique ID.`:(t.has(i.id)&&(n[`${o}.id.duplicate`]=`Duplicate ID found: "${i.id}". Each input element must have a unique ID.`),t.add(i.id)),!i.expectedValue){n[`${o}.expectedValue.missing`]=`Target ${r} has no expectedValue. Each input element must define expected answer data.`;continue}let a=i.expectedValue;a.type||(n[`${o}.expectedValue.type.missing`]=`Target ${r} expectedValue has no type field.`),a.id||(n[`${o}.expectedValue.id.missing`]=`Target ${r} expectedValue has no id field.`),a.html||(n[`${o}.expectedValue.html.missing`]=`Target ${r} expectedValue has no html field.`);let s=a.type;if(s)switch(s){case"text":(!("value"in a)||!Array.isArray(a.value))&&(n[`${o}.expectedValue.text.value`]=`Target ${r} is type 'text' but has no valid 'value' array.`);break;case"number":"targets"in a||(n[`${o}.expectedValue.number.targets`]=`Target ${r} is type 'number' but has no 'targets' field.`);break;case"select":(!("correctOptions"in a)||!("options"in a))&&(n[`${o}.expectedValue.select.options`]=`Target ${r} is type 'select' but is missing 'correctOptions' or 'options' fields.`);break;case"date":case"time":"value"in a||(n[`${o}.expectedValue.${s}.value`]=`Target ${r} is type '${s}' but has no 'value' field.`);break}}return Object.keys(n).length>0?{ok:!1,errors:n}:{ok:!0,errors:null}}function ii(e){let n={};(!e.parts||e.parts.length===0)&&(n["parts.empty"]="No parts found. Text must contain at least one word."),(!e.targets||e.targets.length===0)&&(n["targets.empty"]="No categories found. Text must contain at least one @ct(category, word) reference.");let t=new Set;if(e.targets&&e.targets.length>0)for(let r=0;r<e.targets.length;r++){let i=e.targets[r],o=`targets[${r}]`;if(!i.category||i.category.trim().length===0?n[`${o}.category.empty`]=`Category ${r} has no name.`:(t.has(i.category)&&(n[`${o}.category.duplicate`]=`Duplicate category found: "${i.category}". Each category must have a unique name.`),t.add(i.category)),!i.targets||i.targets.length===0){n[`${o}.targets.empty`]=`Category "${i.category}" has no targets. Each category must contain at least one word.`;continue}for(let a=0;a<i.targets.length;a++){let s=i.targets[a],l=`${o}.targets[${a}]`;if(!s.words||s.words.length===0){n[`${l}.words.empty`]=`Category "${i.category}" target ${a} has no words.`;continue}if(s.startPos<0&&(n[`${l}.startPos.negative`]=`Category "${i.category}" target ${a} has negative startPos.`),s.endPos<0&&(n[`${l}.endPos.negative`]=`Category "${i.category}" target ${a} has negative endPos.`),s.startPos>s.endPos&&(n[`${l}.position.invalid`]=`Category "${i.category}" target ${a} has startPos greater than endPos.`),e.parts&&e.parts.length>0&&(s.startPos>=e.parts.length&&(n[`${l}.startPos.outOfBounds`]=`Category "${i.category}" target ${a} startPos is out of bounds.`),s.endPos>=e.parts.length&&(n[`${l}.endPos.outOfBounds`]=`Category "${i.category}" target ${a} endPos is out of bounds.`),s.startPos<e.parts.length&&s.endPos<e.parts.length)){let c=s.endPos-s.startPos+1;s.words.length!==c&&(n[`${l}.words.countMismatch`]=`Category "${i.category}" target ${a} word count mismatch.`)}}}return Object.keys(n).length>0?{ok:!1,errors:n}:{ok:!0,errors:null}}function na(e){switch(e.type){case"base":return ti(e);case"blanks":return ri(e);case"classification":return ii(e);default:return{ok:!1,errors:{"type.invalid":`Unknown text engine type: ${e.type}`}}}}function Ie(e,n){let t=new Set(n.selectedIndices??[]),r=new Set;for(let p of e.targets)for(let h=p.startPos;h<=p.endPos;h++)r.add(h);let i=0,o=0,a=0;for(let p=0;p<e.parts.length;p++){let h=r.has(p),g=t.has(p);h&&g?i++:h&&!g?a++:!h&&g&&o++}let s=r.size,l=i+o>0?i/(i+o):0,c=i+a>0?i/(i+a):0,d=l+c>0?2*l*c/(l+c):0;return{score:Math.round(d*100),correct:i,total:s}}function oa(e,n){let t=new Set,r=n.dndPlacements??{};for(let l of e.targets)for(let c=l.startPos;c<=l.endPos;c++)t.add(c);let i=0;if(Object.keys(r).length>0)for(let l of t){let c=e.parts[l],d=r[l];d&&Qe(d)===Qe(c)&&i++}else{let l=new Set(n.placedIndices??[]);for(let c of l)t.has(c)&&i++}let a=t.size;return{score:a>0?Math.round(i/a*100):0,correct:i,total:a}}function aa(e,n){let t={},r=n.dndPlacements??{};for(let i of e.targets)for(let o=i.startPos;o<=i.endPos;o++){let a=e.parts[o],s=r[o];s?Qe(s)===Qe(a)?t[o]="correct":t[o]="wrong":t[o]="missed"}return t}function Me(e,n,t){let r=n.transformations??{},i=0,o=0;for(let s=0;s<e.targets.length;s++){let l=t[s],c=r[s];l&&(o++,c&&l.length===c.length&&l.every((u,p)=>u.toLowerCase().trim()===(c[p]||"").toLowerCase().trim())&&i++)}return{score:o>0?Math.round(i/o*100):0,correct:i,total:o}}function vt(e,n,t){let r=n.transformations??{},i={};for(let o=0;o<e.targets.length;o++){let a=t[o],s=r[o];if(!a){i[o]="missed";continue}if(!s||s.length===0){i[o]="missed";continue}if(a.length===s.length){let l=a.every((c,d)=>c.toLowerCase().trim()===(s[d]||"").toLowerCase().trim());i[o]=l?"correct":"wrong"}else i[o]="wrong"}return i}function Le(e,n){let t=new Set(n.selectedIndices??[]),r=new Set,i={};for(let o of e.targets)for(let a=o.startPos;a<=o.endPos;a++)r.add(a);for(let o=0;o<e.parts.length;o++){let a=r.has(o),s=t.has(o);a&&s?i[o]="correct":a&&!s?i[o]="missed":!a&&s&&(i[o]="wrong")}return i}function De(e,n){let t=0,r=e.targets.length;for(let o of e.targets){let a=n.inputValues[o.id],s=o.expectedValue;ai(s,a)&&t++}return{score:r>0?Math.round(t/r*100):0,correct:t,total:r}}function Re(e,n){let t={};for(let r of e.targets){let i=n.inputValues[r.id],o=r.expectedValue;i==null||i===""?t[r.id]="missed":ai(o,i)?t[r.id]="correct":t[r.id]="wrong"}return t}function ai(e,n){if(n==null||n==="")return!1;switch(e.type){case"text":{let t=String(n).toLowerCase().trim();return e.value.some(r=>r.toLowerCase().trim()===t)}case"number":{let t=Number(n);return isNaN(t)?!1:e.targets.includes(t)?!0:e.ranges?e.ranges.some(r=>t>=r.from&&t<=r.to):!1}case"select":{let t=String(n).trim();return e.correctOptions.some(r=>String(r).trim()===t)}case"date":{let t=ni(String(e.value)),r=ni(String(n));return t.length>0&&t===r}case"time":{let t=oi(String(e.value)),r=oi(String(n));return t.length>0&&t===r}default:return!1}}function Qe(e){return String(e).trim().toLowerCase()}function ni(e){return String(e).trim().replace(/\//g,"-")}function oi(e){let n=String(e).trim(),t=n.match(/^([01]\d|2[0-3]):([0-5]\d)(?::[0-5]\d)?$/);return t?`${t[1]}:${t[2]}`:n}function Pe(e,n){let t=0,r=0,i=new Map;for(let a of e.targets)for(let s of a.targets)for(let l=s.startPos;l<=s.endPos;l++)i.set(l,a.category),r++;for(let[a,s]of Object.entries(n.wordCategories)){let l=Number(a),c=i.get(l);c&&s===c&&t++}return{score:r>0?Math.round(t/r*100):0,correct:t,total:r}}function Be(e,n){let t={},r=new Map;for(let i of e.targets)for(let o of i.targets)for(let a=o.startPos;a<=o.endPos;a++)r.set(a,i.category);for(let[i,o]of r){let a=n.wordCategories[i];a?a===o?t[i]="correct":t[i]="wrong":t[i]="missed"}return t}var si=`/* ==================== BASE STYLES ==================== */
2552
+
2553
+ * { box-sizing: border-box; }
2554
+
2555
+ :host {
2556
+ display: block;
2557
+ height: 100%;
2558
+ font-family: system-ui, -apple-system, sans-serif;
2559
+ font-size: clamp(0.92rem, 0.3vw + 0.88rem, 1.05rem);
2560
+ line-height: 2.7;
2561
+ --text-accent: rgb(var(--edu-first-accent));
2562
+ }
2563
+
2564
+ .wrap {
2565
+ padding: clamp(0.6rem, 1.6vw, var(--edu-pad));
2566
+ height: 100%;
2567
+ }
2568
+
2569
+ .text-content {
2570
+ display: block;
2571
+ height: 100%;
2572
+ user-select: none;
2573
+ }
2574
+
2575
+ /* ==================== WORD STYLES ==================== */
2576
+
2577
+ .word {
2578
+ display: inline;
2579
+ margin: 0 0.15rem;
2580
+ padding: 0.15rem 0.25rem;
2581
+ border-radius: var(--edu-radius);
2582
+ transition: all 0.2s ease;
2583
+ overflow-wrap: anywhere;
2584
+ color: rgb(var(--edu-ink));
2585
+ font-weight: 500;
2586
+ }
2587
+
2588
+ /* Selectable words (highlight mode) */
2589
+ .word-selectable {
2590
+ cursor: pointer;
2591
+ background: rgba(var(--edu-muted), 0.5);
2592
+ border: 2px solid rgb(var(--edu-border));
2593
+ color: rgb(var(--edu-ink));
2594
+ }
2595
+
2596
+ .word-selectable:hover {
2597
+ background: rgba(var(--edu-first-accent), 0.15);
2598
+ border-color: rgba(var(--edu-first-accent), 0.5);
2599
+ transform: translateY(-1px);
2600
+ }
2601
+
2602
+ .word-selected {
2603
+ background: rgba(var(--edu-first-accent), 0.25);
2604
+ border-color: var(--text-accent);
2605
+ border-width: 2px;
2606
+ font-weight: 500;
2607
+ color: var(--text-accent);
2608
+ box-shadow: 0 2px 4px rgba(var(--edu-shadow-color), 0.1);
2609
+ }
2610
+
2611
+ /* Editable words (transformation mode) */
2612
+ .word-editable {
2613
+ cursor: text;
2614
+ background: rgb(var(--edu-card));
2615
+ border: 1px solid rgb(var(--edu-border));
2616
+ padding: 0.25rem 0.5rem;
2617
+ min-width: 3ch;
2618
+ outline: none;
2619
+ color: rgb(var(--edu-ink));
2620
+ }
2621
+
2622
+ .word-editable:hover {
2623
+ border-color: rgb(var(--edu-second-ink));
2624
+ }
2625
+
2626
+ .word-editable:focus {
2627
+ border-color: var(--text-accent);
2628
+ background: rgb(var(--edu-card));
2629
+ }
2630
+
2631
+ /* Classifiable words */
2632
+ .word-classifiable {
2633
+ cursor: pointer;
2634
+ position: relative;
2635
+ background: rgb(var(--edu-muted));
2636
+ border: 1px solid rgb(var(--edu-border));
2637
+ color: rgb(var(--edu-ink));
2638
+ }
2639
+
2640
+ .word-classifiable:hover {
2641
+ background: rgb(var(--edu-border));
2642
+ border-color: rgb(var(--edu-second-ink));
2643
+ }
2644
+
2645
+ .word-assigned {
2646
+ background: rgba(var(--category-color), 0.2);
2647
+ border-color: rgb(var(--category-color));
2648
+ font-weight: 600;
2649
+ color: rgb(var(--category-color));
2650
+ }
2651
+
2652
+ /* ==================== GRADING STATES ==================== */
2653
+
2654
+ .word-correct {
2655
+ background: rgba(var(--edu-success), 0.2) !important;
2656
+ border-color: rgb(var(--edu-success)) !important;
2657
+ color: rgb(var(--edu-success));
2658
+ }
2659
+
2660
+ .word-wrong {
2661
+ background: rgba(var(--edu-error), 0.2) !important;
2662
+ border-color: rgb(var(--edu-error)) !important;
2663
+ color: rgb(var(--edu-error));
2664
+ }
2665
+
2666
+ .word-missed {
2667
+ background: rgba(var(--edu-warning), 0.2) !important;
2668
+ border-color: rgb(var(--edu-warning)) !important;
2669
+ color: rgb(var(--edu-second-ink));
2670
+ }
2671
+
2672
+ .input-correct {
2673
+ border-color: rgb(var(--edu-success)) !important;
2674
+ background: rgba(var(--edu-success), 0.1) !important;
2675
+ }
2676
+
2677
+ .input-wrong {
2678
+ border-color: rgb(var(--edu-error)) !important;
2679
+ background: rgba(var(--edu-error), 0.1) !important;
2680
+ }
2681
+
2682
+ .input-missed {
2683
+ border-color: rgb(var(--edu-warning)) !important;
2684
+ background: rgba(var(--edu-warning), 0.1) !important;
2685
+ }
2686
+
2687
+ /* ==================== CLASSIFICATION MODE ==================== */
2688
+
2689
+ .categories {
2690
+ display: flex;
2691
+ gap: 0.5rem;
2692
+ flex-wrap: wrap;
2693
+ justify-content: center;
2694
+ align-items: stretch;
2695
+ padding-top: 1rem;
2696
+ margin-top: auto;
2697
+ }
2698
+
2699
+ .category-btn {
2700
+ min-width: 110px;
2701
+ flex: 0 1 auto;
2702
+ cursor: pointer;
2703
+ }
2704
+
2705
+ .category-btn::part(block) {
2706
+ padding: 0.45rem 0.8rem;
2707
+ min-height: 40px;
2708
+ border-width: 2px;
2709
+ border-color: rgb(var(--edu-border));
2710
+ background: rgb(var(--edu-card));
2711
+ color: rgb(var(--edu-ink));
2712
+ transition: all 0.2s ease;
2713
+ }
2714
+
2715
+ .category-btn:hover {
2716
+ transform: translateY(-1px);
2717
+ }
2718
+
2719
+ .category-btn.category-active::part(block) {
2720
+ border-color: var(--category-color);
2721
+ background: color-mix(in srgb, var(--category-color) 18%, rgb(var(--edu-card)));
2722
+ color: var(--category-color);
2723
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--category-color) 28%, transparent);
2724
+ }
2725
+
2726
+ .category-btn[data-active="true"]::part(block) {
2727
+ border-color: var(--category-color);
2728
+ background: color-mix(in srgb, var(--category-color) 18%, rgb(var(--edu-card)));
2729
+ color: var(--category-color);
2730
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--category-color) 28%, transparent);
2731
+ }
2732
+
2733
+ .words {
2734
+ display: block;
2735
+ line-height: 2.2;
2736
+ flex: 1;
2737
+ overflow-y: auto;
2738
+ min-height: 0;
2739
+ }
2740
+
2741
+ .classification-layout {
2742
+ display: flex;
2743
+ flex-direction: column;
2744
+ min-height: 100%;
2745
+ height: 100%;
2746
+ }
2747
+
2748
+ /* ==================== DND MODE ==================== */
2749
+
2750
+ .dnd-container {
2751
+ display: flex;
2752
+ flex-direction: column;
2753
+ gap: 2rem;
2754
+ }
2755
+
2756
+ .dnd-text {
2757
+ line-height: 2.2;
2758
+ }
2759
+
2760
+ .dropzone {
2761
+ display: inline-block;
2762
+ min-width: clamp(4ch, 5vw, 7ch);
2763
+ min-height: 2rem;
2764
+ padding: 0.25rem 0.75rem;
2765
+ margin: 0 0.25rem;
2766
+ border: 2px dashed rgb(var(--edu-border));
2767
+ border-radius: var(--edu-radius);
2768
+ background: rgb(var(--edu-muted));
2769
+ text-align: center;
2770
+ vertical-align: middle;
2771
+ transition: all 0.2s ease;
2772
+ color: rgb(var(--edu-ink));
2773
+ }
2774
+
2775
+ .dropzone:hover {
2776
+ border-color: rgba(var(--edu-first-accent), 0.5);
2777
+ background: rgba(var(--edu-first-accent), 0.05);
2778
+ }
2779
+
2780
+ .dropzone-filled {
2781
+ border-style: solid;
2782
+ border-color: rgba(var(--edu-first-accent), 0.5);
2783
+ background: rgba(var(--edu-first-accent), 0.1);
2784
+ font-weight: 500;
2785
+ }
2786
+
2787
+ .dropzone-correct {
2788
+ border-color: rgb(var(--edu-success)) !important;
2789
+ background: rgba(var(--edu-success), 0.1) !important;
2790
+ }
2791
+
2792
+ .dropzone-wrong {
2793
+ border-color: rgb(var(--edu-error)) !important;
2794
+ background: rgba(var(--edu-error), 0.1) !important;
2795
+ }
2796
+
2797
+ .dropzone-missed {
2798
+ border-color: rgb(var(--edu-warning)) !important;
2799
+ background: rgba(var(--edu-warning), 0.1) !important;
2800
+ }
2801
+
2802
+ .dnd-chips {
2803
+ display: flex;
2804
+ flex-wrap: wrap;
2805
+ gap: 0.5rem;
2806
+ padding: 1rem;
2807
+ border: 2px solid rgb(var(--edu-border));
2808
+ border-radius: var(--edu-radius);
2809
+ background: rgb(var(--edu-muted));
2810
+ min-height: 4rem;
2811
+ max-height: 11rem;
2812
+ overflow: auto;
2813
+ }
2814
+
2815
+ .chip {
2816
+ padding: 0.5rem 1rem;
2817
+ border: 1px solid rgb(var(--edu-border));
2818
+ background: rgb(var(--edu-card));
2819
+ border-radius: var(--edu-radius);
2820
+ cursor: grab;
2821
+ font-size: 0.875rem;
2822
+ font-weight: 500;
2823
+ transition: all 0.2s ease;
2824
+ user-select: none;
2825
+ color: rgb(var(--edu-ink));
2826
+ }
2827
+
2828
+ .chip:hover {
2829
+ border-color: rgba(var(--edu-first-accent), 0.5);
2830
+ background: rgba(var(--edu-first-accent), 0.05);
2831
+ transform: translateY(-2px);
2832
+ box-shadow: 0 4px 6px rgb(var(--edu-shadow-color) / 0.1);
2833
+ }
2834
+
2835
+ .chip:active {
2836
+ cursor: grabbing;
2837
+ }
2838
+
2839
+ /* ==================== VARIANT: ELEGANT ==================== */
2840
+
2841
+ :host([variant="elegant"]) .word-selectable {
2842
+ background: rgb(var(--edu-card));
2843
+ border: 1px solid rgb(var(--edu-border));
2844
+ box-shadow: 0 1px 2px rgba(var(--edu-shadow-color), 0.05);
2845
+ }
2846
+
2847
+ :host([variant="elegant"]) .word-selectable:hover {
2848
+ border-color: rgba(var(--edu-first-accent), 0.5);
2849
+ box-shadow: 0 4px 8px rgba(var(--edu-shadow-color), 0.12);
2850
+ transform: translateY(-2px);
2851
+ }
2852
+
2853
+ :host([variant="elegant"]) .word-selected {
2854
+ background: linear-gradient(135deg, rgba(var(--edu-first-accent), 0.15), rgba(var(--edu-first-accent), 0.25));
2855
+ border-color: var(--text-accent);
2856
+ border-width: 1px;
2857
+ box-shadow: 0 4px 12px rgba(var(--edu-shadow-color), 0.2);
2858
+ font-weight: 500;
2859
+ color: var(--text-accent);
2860
+ }
2861
+
2862
+ /* ==================== VARIANT: PLAYFUL ==================== */
2863
+
2864
+ :host([variant="playful"]) .word {
2865
+ border-radius: 16px;
2866
+ font-weight: 500;
2867
+ }
2868
+
2869
+ :host([variant="playful"]) .word-selectable {
2870
+ background: linear-gradient(145deg, rgb(var(--edu-card)), rgb(var(--edu-muted)));
2871
+ border: 3px solid rgb(var(--edu-border));
2872
+ box-shadow: 2px 2px 4px rgba(var(--edu-shadow-color), 0.08);
2873
+ }
2874
+
2875
+ :host([variant="playful"]) .word-selectable:hover {
2876
+ transform: scale(1.1) rotate(-2deg);
2877
+ border-color: rgba(var(--edu-first-accent), 0.7);
2878
+ box-shadow: 3px 3px 8px rgba(var(--edu-shadow-color), 0.15);
2879
+ }
2880
+
2881
+ :host([variant="playful"]) .word-selected {
2882
+ background: linear-gradient(135deg, var(--text-accent), rgba(var(--edu-first-accent), 0.8));
2883
+ border-color: var(--text-accent);
2884
+ border-width: 3px;
2885
+ color: rgb(var(--edu-inverted-ink));
2886
+ transform: scale(1.15) rotate(2deg);
2887
+ box-shadow: 4px 4px 12px rgba(var(--edu-shadow-color), 0.25);
2888
+ font-weight: 700;
2889
+ }
2890
+
2891
+ :host([variant="playful"]) .category-btn {
2892
+ border-radius: 24px;
2893
+ }
2894
+
2895
+ /* ==================== VARIANT: OUTLINE ==================== */
2896
+
2897
+ :host([variant="outline"]) .word-selectable {
2898
+ border: 2px solid rgb(var(--edu-border));
2899
+ background: transparent;
2900
+ }
2901
+
2902
+ :host([variant="outline"]) .word-selectable:hover {
2903
+ border-color: rgba(var(--edu-first-accent), 0.7);
2904
+ background: rgba(var(--edu-first-accent), 0.05);
2905
+ border-width: 2px;
2906
+ }
2907
+
2908
+ :host([variant="outline"]) .word-selected {
2909
+ border-color: var(--text-accent);
2910
+ background: rgba(var(--edu-first-accent), 0.12);
2911
+ border-width: 2px;
2912
+ font-weight: 500;
2913
+ color: var(--text-accent);
2914
+ }
2915
+
2916
+ /* ==================== VARIANT: MINIMAL ==================== */
2917
+
2918
+ :host([variant="minimal"]) .word {
2919
+ border: none;
2920
+ border-radius: 0;
2921
+ padding: 0.2rem 0.3rem;
2922
+ margin: 0 0.1rem;
2923
+ }
2924
+
2925
+ :host([variant="minimal"]) .word-selectable {
2926
+ background: transparent;
2927
+ border-bottom: 2px solid transparent;
2928
+ transition: all 0.2s ease;
2929
+ }
2930
+
2931
+ :host([variant="minimal"]) .word-selectable:hover {
2932
+ background: rgba(var(--edu-first-accent), 0.1);
2933
+ border-bottom-color: rgba(var(--edu-first-accent), 0.4);
2934
+ }
2935
+
2936
+ :host([variant="minimal"]) .word-selected {
2937
+ background: linear-gradient(to right, rgba(var(--edu-first-accent), 0.4) 0%, rgba(var(--edu-first-accent), 0.4) 100%);
2938
+ background-size: 100% 60%;
2939
+ background-position: 0 100%;
2940
+ background-repeat: no-repeat;
2941
+ border: none;
2942
+ border-bottom: 3px solid var(--text-accent);
2943
+ font-weight: 500;
2944
+ color: var(--text-accent);
2945
+ }
2946
+
2947
+ /* ==================== VARIANT: LETTER ==================== */
2948
+
2949
+ :host([variant="letter"]) .word {
2950
+ border-radius: 2px;
2951
+ }
2952
+
2953
+ :host([variant="letter"]) .word-selectable {
2954
+ background: rgb(var(--edu-card));
2955
+ border: 1px solid rgb(var(--edu-border));
2956
+ font-family: 'Courier New', monospace;
2957
+ }
2958
+
2959
+ :host([variant="letter"]) .word-selected {
2960
+ background: rgba(var(--edu-first-accent), 0.15);
2961
+ border-color: var(--text-accent);
2962
+ }
2963
+
2964
+ /* ==================== VARIANT: SIGN ==================== */
2965
+
2966
+ :host([variant="sign"]) .word {
2967
+ border-radius: 4px;
2968
+ font-weight: 700;
2969
+ text-transform: uppercase;
2970
+ font-size: 0.95em;
2971
+ letter-spacing: 0.5px;
2972
+ }
2973
+
2974
+ :host([variant="sign"]) .word-selectable {
2975
+ background: linear-gradient(180deg, rgb(var(--edu-card)), rgb(var(--edu-muted)));
2976
+ border: 4px solid rgb(var(--edu-border));
2977
+ border-bottom-width: 6px;
2978
+ box-shadow: 0 4px 0 rgba(var(--edu-shadow-color), 0.15);
2979
+ }
2980
+
2981
+ :host([variant="sign"]) .word-selectable:hover {
2982
+ border-color: rgba(var(--edu-first-accent), 0.6);
2983
+ transform: translateY(-2px);
2984
+ box-shadow: 0 6px 0 rgba(var(--edu-shadow-color), 0.2);
2985
+ }
2986
+
2987
+ :host([variant="sign"]) .word-selected {
2988
+ background: linear-gradient(180deg, var(--text-accent), rgba(var(--edu-first-accent), 0.8));
2989
+ border-color: var(--text-accent);
2990
+ border-width: 4px;
2991
+ border-bottom-width: 6px;
2992
+ color: rgb(var(--edu-inverted-ink));
2993
+ transform: translateY(-4px);
2994
+ box-shadow: 0 8px 0 rgba(var(--edu-shadow-color), 0.25);
2995
+ }
2996
+
2997
+ /* ==================== VARIANT: GLASS ==================== */
2998
+
2999
+ :host([variant="glass"]) .word-selectable {
3000
+ background: rgba(var(--edu-card), 0.6);
3001
+ border: 1px solid rgba(var(--edu-border), 0.3);
3002
+ backdrop-filter: blur(12px) saturate(150%);
3003
+ box-shadow: 0 2px 8px rgba(var(--edu-shadow-color), 0.1);
3004
+ }
3005
+
3006
+ :host([variant="glass"]) .word-selectable:hover {
3007
+ background: rgba(var(--edu-first-accent), 0.2);
3008
+ border-color: rgba(var(--edu-first-accent), 0.5);
3009
+ backdrop-filter: blur(16px) saturate(180%);
3010
+ box-shadow: 0 4px 12px rgba(var(--edu-shadow-color), 0.15);
3011
+ }
3012
+
3013
+ :host([variant="glass"]) .word-selected {
3014
+ background: rgba(var(--edu-first-accent), 0.35);
3015
+ border-color: var(--text-accent);
3016
+ border-width: 2px;
3017
+ backdrop-filter: blur(16px) saturate(200%);
3018
+ box-shadow: 0 6px 16px rgba(var(--edu-shadow-color), 0.2);
3019
+ font-weight: 600;
3020
+ color: var(--text-accent);
3021
+ }
3022
+
3023
+ /* ==================== VARIANT: EMPTY ==================== */
3024
+
3025
+ :host([variant="empty"]) .word {
3026
+ border: none;
3027
+ background: transparent;
3028
+ margin: 0;
3029
+ padding: 0.2rem;
3030
+ }
3031
+
3032
+ :host([variant="empty"]) .word-selectable:hover {
3033
+ opacity: 0.7;
3034
+ }
3035
+
3036
+ :host([variant="empty"]) .word-selected {
3037
+ text-decoration: underline;
3038
+ text-decoration-color: var(--text-accent);
3039
+ text-decoration-thickness: 2px;
3040
+ text-underline-offset: 4px;
3041
+ }
3042
+
3043
+ @media (max-width: 720px) {
3044
+ .word {
3045
+ margin: 0 0.08rem;
3046
+ padding: 0.12rem 0.2rem;
3047
+ }
3048
+
3049
+ .categories {
3050
+ gap: 0.35rem;
3051
+ margin-bottom: 0.9rem;
3052
+ }
3053
+
3054
+ .category-btn {
3055
+ padding: 0.38rem 0.7rem;
3056
+ font-size: 0.8rem;
3057
+ }
3058
+
3059
+ .dnd-container {
3060
+ gap: 1.1rem;
3061
+ }
3062
+ }
3063
+ `;var la=`
3064
+ :host {
3065
+ display: inline-flex;
3066
+ align-items: center;
3067
+ width: auto;
3068
+ font-family: inherit;
3069
+ color: rgb(var(--edu-ink));
3070
+ }
3071
+
3072
+ /* --- SHARED BASE STYLES --- */
3073
+ .control {
3074
+ width: 100%;
3075
+ box-sizing: border-box;
3076
+ padding: 0.6rem 1rem;
3077
+ font-size: 1rem;
3078
+ transition: all 0.2s ease;
3079
+ border: 1px solid rgb(var(--edu-border));
3080
+ border-radius: 4px;
3081
+ outline: none;
3082
+ background: rgb(var(--edu-bg));
3083
+ color: rgb(var(--edu-ink));
3084
+ font-family: inherit;
3085
+ }
3086
+
3087
+ .control:focus {
3088
+ border-color: rgb(var(--edu-first-accent));
3089
+ box-shadow: 0 0 0 2px rgb(var(--edu-first-accent) / 0.2);
3090
+ }
3091
+
3092
+ .control[type="checkbox"],
3093
+ .control[type="radio"] {
3094
+ width: 18px;
3095
+ height: 18px;
3096
+ padding: 0;
3097
+ accent-color: rgb(var(--edu-first-accent));
3098
+ }
3099
+
3100
+ button.control {
3101
+ cursor: pointer;
3102
+ }
3103
+
3104
+ slot {
3105
+ display: none;
3106
+ }
3107
+
3108
+ :host([disabled]) .control {
3109
+ opacity: 0.6;
3110
+ cursor: not-allowed;
3111
+ }
3112
+
3113
+ /* --- VARIANTS --- */
3114
+
3115
+ :host([variant="elegant"]) .control {
3116
+ border-radius: 0;
3117
+ border-bottom: 2px solid rgb(var(--edu-first-accent));
3118
+ background: rgb(var(--edu-card));
3119
+ letter-spacing: 1px;
3120
+ text-transform: uppercase;
3121
+ font-size: 0.8rem;
3122
+ }
3123
+
3124
+ :host([variant="playful"]) .control {
3125
+ border-radius: 50px;
3126
+ background: rgb(var(--edu-first-accent) / 0.7);
3127
+ border: 2px solid rgb(var(--edu-first-accent));
3128
+ font-weight: 700;
3129
+ color: rgb(var(--edu-inverted-ink));
3130
+ }
3131
+
3132
+ :host([variant="outline"]) .control {
3133
+ background: transparent;
3134
+ border: 2px solid rgb(var(--edu-first-accent));
3135
+ color: rgb(var(--edu-ink));
3136
+ }
3137
+
3138
+ :host([variant="letter"]) .control {
3139
+ background: rgb(var(--edu-card));
3140
+ border: 1px solid rgb(var(--edu-muted));
3141
+ font-family: georgia, serif;
3142
+ font-style: italic;
3143
+ box-shadow: 2px 2px 0 rgb(var(--edu-muted));
3144
+ }
3145
+
3146
+ :host([variant="sign"]) .control {
3147
+ background: rgb(var(--edu-bg));
3148
+ font-weight: 800;
3149
+ text-transform: uppercase;
3150
+ letter-spacing: 2px;
3151
+ border-radius: 4px;
3152
+ }
3153
+
3154
+ :host([variant="minimal"]) .control {
3155
+ background: rgb(var(--edu-bg));
3156
+ border: 1px solid rgb(var(--edu-border));
3157
+ }
3158
+
3159
+ :host([variant="glass"]) .control {
3160
+ background: rgba(var(--edu-card), 0.7);
3161
+ backdrop-filter: blur(10px);
3162
+ border: 2px solid rgba(var(--edu-border), 0.35);
3163
+ }
3164
+
3165
+ :host([variant="empty"]) .control {
3166
+ background: transparent;
3167
+ border: 2px solid rgb(var(--edu-border));
3168
+ }
3169
+
3170
+ /* --- STATE FEEDBACK --- */
3171
+ :host([state="correct"]) .control {
3172
+ border: 2px solid rgb(var(--edu-success));
3173
+ background: rgb(var(--edu-success) / 0.1);
3174
+ box-shadow: 0 0 0 2px rgb(var(--edu-success) / 0.2);
3175
+ }
3176
+
3177
+ :host([state="wrong"]) .control {
3178
+ border: 2px solid rgb(var(--edu-error));
3179
+ background: rgb(var(--edu-error) / 0.1);
3180
+ box-shadow: 0 0 0 2px rgb(var(--edu-error) / 0.2);
3181
+ }
3182
+
3183
+ :host([state="missed"]) .control {
3184
+ border: 2px solid rgb(var(--edu-warning));
3185
+ background: rgb(var(--edu-warning) / 0.1);
3186
+ box-shadow: 0 0 0 2px rgb(var(--edu-warning) / 0.2);
3187
+ }
3188
+ `,ca=["input","select","textarea","button"],Ze=class extends HTMLElement{constructor(){super();this.$slot=null;this.controlEl=null;this.currentTag="input";this.handleSlotChange=()=>{this.syncAttributes(),this.syncContent()};this.attachShadow({mode:"open"})}static get observedAttributes(){return["as","variant","state","disabled","readonly","required","placeholder","value","type","name","autocomplete","min","max","step","pattern","rows","cols","multiple","size"]}connectedCallback(){this.hasAttribute("variant")||(this.variant="outline"),this.render(),this.$slot?.addEventListener("slotchange",this.handleSlotChange),this.syncAttributes(),this.syncContent()}disconnectedCallback(){this.$slot?.removeEventListener("slotchange",this.handleSlotChange)}attributeChangedCallback(t,r,i){r!==i&&(t==="as"&&this.render(),this.syncAttributes(),this.syncContent())}getTag(){let t=(this.getAttribute("as")??"input").toLowerCase();return ca.includes(t)?t:"input"}render(){let t=this.getTag();if(this.controlEl&&this.currentTag===t)return;this.currentTag=t,this.shadowRoot.innerHTML="";let r=document.createElement("style");r.textContent=la,this.shadowRoot.append(r);let i=document.createElement(t);i.className="control",i.setAttribute("part","control"),this.$slot=document.createElement("slot"),this.shadowRoot.append(i,this.$slot),this.controlEl=i}applyAttr(t){this.controlEl&&(this.hasAttribute(t)?this.controlEl.setAttribute(t,this.getAttribute(t)??""):this.controlEl.removeAttribute(t))}applyBoolAttr(t){this.controlEl&&(this.hasAttribute(t)?this.controlEl.setAttribute(t,""):this.controlEl.removeAttribute(t))}syncAttributes(){this.controlEl&&(this.applyBoolAttr("disabled"),this.applyBoolAttr("readonly"),this.applyBoolAttr("required"),this.applyAttr("placeholder"),this.applyAttr("name"),this.applyAttr("autocomplete"),this.applyAttr("min"),this.applyAttr("max"),this.applyAttr("step"),this.applyAttr("pattern"),this.controlEl instanceof HTMLInputElement&&this.applyAttr("type"),this.controlEl instanceof HTMLTextAreaElement&&(this.applyAttr("rows"),this.applyAttr("cols")),this.controlEl instanceof HTMLSelectElement&&(this.applyBoolAttr("multiple"),this.applyAttr("size")),"value"in this.controlEl&&(this.hasAttribute("value")?this.controlEl.value=this.getAttribute("value")??"":this.controlEl.value=""))}syncContent(){if(!this.controlEl||!this.$slot)return;let r=this.$slot.assignedNodes({flatten:!0}).filter(i=>i.nodeType===Node.TEXT_NODE?i.textContent?.trim():i.nodeType===Node.ELEMENT_NODE);if(this.controlEl instanceof HTMLSelectElement){this.controlEl.innerHTML="",r.forEach(i=>{(i instanceof HTMLOptionElement||i instanceof HTMLOptGroupElement)&&this.controlEl.append(i.cloneNode(!0))});return}if(this.controlEl instanceof HTMLButtonElement){this.controlEl.innerHTML="",r.forEach(i=>{this.controlEl.append(i.cloneNode(!0))});return}if(this.controlEl instanceof HTMLTextAreaElement&&!this.hasAttribute("value")){let i=r.map(o=>o.textContent??"").join("");this.controlEl.value=i}}get variant(){return this.getAttribute("variant")??"outline"}set variant(t){this.setAttribute("variant",t)}get value(){return this.controlEl&&"value"in this.controlEl?this.controlEl.value:this.getAttribute("value")??""}set value(t){this.setAttribute("value",String(t)),this.controlEl&&"value"in this.controlEl&&(this.controlEl.value=t)}};customElements.get("edu-input")||customElements.define("edu-input",Ze);var Xe=class extends HTMLElement{constructor(){super();this._state={};this._mounted=!1;this.onClick=t=>{let r=t.target;if(r.classList.contains("word-selectable")){let i=parseInt(r.getAttribute("data-index")??"");isNaN(i)||this.toggleWordSelection(i)}if(r.classList.contains("category-btn")){let i=r.getAttribute("data-category");i&&this.setActiveCategory(i)}if(r.classList.contains("word-classifiable")){let i=parseInt(r.getAttribute("data-index")??"");!isNaN(i)&&this._activeCategory&&this.assignWordToCategory(i,this._activeCategory)}if(r.classList.contains("dropzone-filled")){let i=parseInt(r.getAttribute("data-index")??"");isNaN(i)||this.clearDropzone(i)}};this.onChange=t=>{let r=t.target;if(r.tagName==="EDU-INPUT"||r.tagName==="INPUT"){let i=r.getAttribute("id");if(i){let o=r.value;this.updateInputValue(i,o)}}};this.onInput=t=>{let r=t.target;if(r.tagName==="EDU-INPUT"||r.tagName==="INPUT"){let i=r.getAttribute("id");if(i){let o=r.value;this.updateInputValue(i,o)}}if(r.hasAttribute("contenteditable")&&r.getAttribute("contenteditable")==="true"){let i=parseInt(r.getAttribute("data-target-index")??"");if(!isNaN(i)){let o=r.textContent??"";this.updateTransformation(i,o)}}};this.onDragStart=t=>{let r=t,i=r.target;if(!r.dataTransfer||!i.classList.contains("chip"))return;let o=i.getAttribute("data-word")||i.textContent||"";o&&(r.dataTransfer.setData("text/plain",o),r.dataTransfer.effectAllowed="move")};this.onDragOver=t=>{let r=t;r.target.classList.contains("dropzone")&&(r.preventDefault(),r.dataTransfer.dropEffect="move")};this.onDrop=t=>{let r=t,i=r.target;if(!i.classList.contains("dropzone")||(r.preventDefault(),!r.dataTransfer))return;let o=parseInt(i.getAttribute("data-index")??"");if(isNaN(o))return;let a=r.dataTransfer.getData("text/plain");a&&this.placeWordInDropzone(o,a)};this._activeCategory=null;this.attachShadow({mode:"open"});let t=document.createElement("section");t.className="wrap",this.shadowRoot.append(t),this.$wrapEl=t}static get observedAttributes(){return["variant"]}connectedCallback(){this._mounted=!0,this.shadowRoot?.addEventListener("click",this.onClick),this.shadowRoot?.addEventListener("change",this.onChange),this.shadowRoot?.addEventListener("input",this.onInput),this.shadowRoot?.addEventListener("dragstart",this.onDragStart),this.shadowRoot?.addEventListener("dragover",this.onDragOver),this.shadowRoot?.addEventListener("drop",this.onDrop),this.render()}disconnectedCallback(){this._mounted=!1,this.shadowRoot?.removeEventListener("click",this.onClick),this.shadowRoot?.removeEventListener("change",this.onChange),this.shadowRoot?.removeEventListener("input",this.onInput),this.shadowRoot?.removeEventListener("dragstart",this.onDragStart),this.shadowRoot?.removeEventListener("dragover",this.onDragOver),this.shadowRoot?.removeEventListener("drop",this.onDrop)}set config(t){this._config=t,this._state=this.initState(t),t.variant&&this.setAttribute("variant",t.variant),this.render()}get config(){if(!this._config)throw new Error("<edu-text>: config not set");return this._config}getValue(){switch(this._config.data.type){case"base":if(this._config.mode==="highlight")return{selectedIndices:Array.from(this._state.selectedIndices??[])};if(this._config.mode==="dnd"){let r=this._state.dndPlacements??{};return{placedIndices:Object.keys(r).map(i=>Number(i)),dndPlacements:{...r}}}else if(this._config.mode==="transformation")return{transformations:this._state.transformations??{}};break;case"blanks":return{inputValues:this._state.inputValues??{}};case"classification":return{wordCategories:this._state.wordCategories??{}}}return{}}getState(){return{...this._state}}setState(t){t&&(this._state={...this._state,...t.selectedIndices?{selectedIndices:new Set(t.selectedIndices)}:{},...t.dndPlacements?{dndPlacements:{...t.dndPlacements}}:{},...t.inputValues?{inputValues:{...t.inputValues}}:{},...t.wordCategories?{wordCategories:{...t.wordCategories}}:{},...t.transformations?{transformations:{...t.transformations}}:{}},this.render())}reset(){this._config&&(this._state=this.initState(this._config),this.render(),this.dispatchEvent(new CustomEvent("reset",{bubbles:!0,composed:!0})))}setGradingState(t){this._config&&(this._config.gradingState=t,this.render())}clearGradingState(){this._config&&(this._config.gradingState=void 0,this.render())}attributeChangedCallback(t,r,i){r!==i&&t==="variant"&&(this.setAttribute("variant",i),this.shadowRoot?.querySelectorAll("edu-input").forEach(o=>{let a=o;a.variant!==void 0&&(a.variant=i)}),this.shadowRoot?.querySelectorAll("edu-block").forEach(o=>{let a=o;a.variant!==void 0&&(a.variant=i)}),this.render())}upsertHtmlAttribute(t,r,i){let o=new RegExp(`${r}="[^"]*"`,"i");return o.test(t)?t.replace(o,`${r}="${i}"`):t.replace(/<([a-z0-9-]+)/i,`<$1 ${r}="${i}"`)}removeHtmlAttribute(t,r){let i=new RegExp(`\\s${r}="[^"]*"`,"ig");return t.replace(i,"")}upsertHtmlClass(t,r){let i=/class="([^"]*)"/i;return i.test(t)?t.replace(i,(o,a)=>{let s=String(a||"").split(/\s+/).filter(Boolean);return s.includes(r)||s.push(r),`class="${s.join(" ")}"`}):t.replace(/<([a-z0-9-]+)/i,`<$1 class="${r}"`)}removeHtmlClassPrefix(t,r){let i=/class="([^"]*)"/i;return i.test(t)?t.replace(i,(o,a)=>{let s=String(a||"").split(/\s+/).filter(Boolean).filter(l=>!l.startsWith(r));return s.length>0?`class="${s.join(" ")}"`:""}):t}initState(t){let r={};switch(t.data.type){case"base":t.mode==="highlight"||t.mode==="dnd"?(r.selectedIndices=new Set,t.mode==="dnd"&&(r.dndPlacements={})):t.mode==="transformation"&&(r.transformations={});break;case"blanks":r.inputValues={};break;case"classification":r.wordCategories={};break}return r}render(){if(!this._mounted||!this.shadowRoot)return;if(!this._config){this.$wrapEl.innerHTML="<style>:host{display:block}</style><div></div>";return}let t=this._config,r=t.data,i="";switch(t.mode){case"highlight":i=this.renderHighlight(r);break;case"blanks":i=this.renderBlanks(r);break;case"classification":i=this.renderClassification(r);break;case"dnd":i=this.renderDND(r);break;case"transformation":i=this.renderTransformation(r);break}this.$wrapEl.innerHTML=`
3189
+ <style>${si}</style>
3190
+ <div class="text-content" part="content">
3191
+ ${i}
3192
+ </div>
3193
+ `}renderHighlight(t){let r=t.parts,i=this._state.selectedIndices??new Set,o=this._config.gradingState??{};return r.map((a,s)=>{let l=i.has(s),c=o[s],d=["word","word-selectable"];return l&&d.push("word-selected"),c&&d.push(`word-${c}`),`<span class="${d.join(" ")}" data-index="${s}">${E(a)}</span>`}).join(" ")}renderBlanks(t){let r=this._config.gradingState??{},i=this.getAttribute("variant")??this._config.variant??"outline";return t.parts.map((o,a)=>{if(o.startsWith("<")){let s=t.targets.find(l=>l.expectedValue.html===o);if(s){let l=r[s.id],c=l?`input-${l}`:"",d=this._state.inputValues?.[s.id]??"",u=o;if(/<edu-input\b/i.test(u)&&(u=this.upsertHtmlAttribute(u,"variant",i)),u=this.removeHtmlClassPrefix(u,"input-"),u=this.removeHtmlAttribute(u,"state"),l&&(/<edu-input\b/i.test(u)?u=this.upsertHtmlAttribute(u,"state",l):c&&(u=this.upsertHtmlClass(u,c))),d!==""){let p=E(String(d));u.includes("<edu-input")?/value="[^"]*"/.test(u)?u=u.replace(/value="[^"]*"/,`value="${p}"`):u=u.replace("<edu-input",`<edu-input value="${p}"`):u.includes("<input")&&(/value="[^"]*"/.test(u)?u=u.replace(/value="[^"]*"/,`value="${p}"`):u=u.replace("<input",`<input value="${p}"`))}return u}return o}else return`<span class="word">${E(o)}</span>`}).join(" ")}renderClassification(t){let r=t.parts,i=this._state.wordCategories??{},o=this._config.gradingState??{},a=this.getAttribute("variant")??"outline",s=t.targets.map(p=>p.category),l={},c=["--edu-first-accent","--edu-second-accent","--edu-third-accent","--edu-neutral"];s.forEach((p,h)=>{l[p]=c[h%c.length]});let d=r.map((p,h)=>{let g=i[h],m=o[h],b=["word","word-classifiable"];g&&b.push("word-assigned"),m&&b.push(`word-${m}`);let w=g?`style="--category-color: var(${l[g]})"`:"";return`
3194
+ <span class="${b.join(" ")}" data-index="${h}" ${w}>
3195
+ ${E(p)}
3196
+ </span>
3197
+ `}).join(" "),u=`
3198
+ <div class="categories" part="categories">
3199
+ ${s.map(p=>`
3200
+ <edu-block class="category-btn"
3201
+ ${this._activeCategory===p?'data-active="true"':""}
3202
+ data-category="${E(p)}"
3203
+ variant="${E(a)}"
3204
+ style="--category-color: var(${l[p]})">
3205
+ ${E(p)}
3206
+ </edu-block>
3207
+ `).join("")}
3208
+ </div>
3209
+ `;return`
3210
+ <div class="classification-layout" part="classification-layout">
3211
+ <div class="words" part="words">${d}</div>
3212
+ ${u}
3213
+ </div>
3214
+ `}renderDND(t){let r=t.parts,i=this._state.dndPlacements??{},o=this._config.gradingState??{},a=new Set;for(let h of t.targets)for(let g=h.startPos;g<=h.endPos;g++)a.add(g);let s=r.map((h,g)=>{if(a.has(g)){let m=i[g],b=!!m,w=o[g],v=["dropzone"];b&&v.push("dropzone-filled"),w&&v.push(`dropzone-${w}`);let q=b?E(m):"";return`<span class="${v.join(" ")}" data-index="${g}">${q}</span>`}else return`<span class="word">${E(h)}</span>`}).join(" "),l=[...t.targets.flatMap(h=>h.words)];t.distractors&&l.push(...t.distractors);let c=Object.values(i),d=[...l];for(let h of c){let g=d.findIndex(m=>li(m)===li(h));g!==-1&&d.splice(g,1)}let p=S(d).map(h=>`<div class="chip" draggable="true" data-word="${E(h)}">${E(h)}</div>`).join("");return`
3215
+ <div class="dnd-container">
3216
+ <div class="dnd-text">${s}</div>
3217
+ <div class="dnd-chips">${p}</div>
3218
+ </div>
3219
+ `}renderTransformation(t){let r=t.parts,i=this._state.transformations??{},o=this._config.gradingState??{},a=new Map;for(let s=0;s<t.targets.length;s++){let l=t.targets[s];for(let c=l.startPos;c<=l.endPos;c++)a.set(c,s)}return r.map((s,l)=>{let c=a.get(l);if(c!==void 0){let d=o[c],u=i[c],p=u?u.join(" "):t.targets[c].words.join(" "),h=["word","word-editable"];return d&&h.push(`word-${d}`),`
3220
+ <span class="${h.join(" ")}"
3221
+ contenteditable="true"
3222
+ data-target-index="${c}"
3223
+ data-original="${E(s)}">${E(p)}</span>
3224
+ `}else return`<span class="word">${E(s)}</span>`}).join(" ")}toggleWordSelection(t){this._state.selectedIndices||(this._state.selectedIndices=new Set),this._state.selectedIndices.has(t)?this._state.selectedIndices.delete(t):this._state.selectedIndices.add(t),this.render(),this.emitChange()}setActiveCategory(t){this._activeCategory=t,this.shadowRoot?.querySelectorAll(".category-btn").forEach(r=>{r.getAttribute("data-category")===t?(r.classList.add("category-active"),r.setAttribute("data-active","true")):(r.classList.remove("category-active"),r.removeAttribute("data-active")),r instanceof V&&(r.variant=this.getAttribute("variant")??"outline")})}assignWordToCategory(t,r){this._state.wordCategories||(this._state.wordCategories={}),this._state.wordCategories[t]===r?delete this._state.wordCategories[t]:this._state.wordCategories[t]=r,this.render(),this.emitChange()}updateInputValue(t,r){this._state.inputValues||(this._state.inputValues={}),this._state.inputValues[t]=r,this.emitChange()}updateTransformation(t,r){this._state.transformations||(this._state.transformations={});let i=r.split(/\s+/).filter(Boolean);this._state.transformations[t]=i,this.emitChange()}placeWordInDropzone(t,r){this._state.dndPlacements||(this._state.dndPlacements={}),this._state.dndPlacements[t]=r,this.render(),this.emitChange()}clearDropzone(t){this._state.dndPlacements&&t in this._state.dndPlacements&&(delete this._state.dndPlacements[t],this.render(),this.emitChange())}emitChange(){let t={userState:this.getValue(),dataType:this._config.data.type};this.dispatchEvent(new CustomEvent("change",{detail:t,bubbles:!0,composed:!0}))}};function li(e){return e.trim().toLowerCase()}customElements.get("edu-text")||customElements.define("edu-text",Xe);var ie=class extends x{constructor(t,r){super(t,r);this.interactionMechanic="static";this._textConfig={data:t,mode:"highlight",variant:r.variant??"outline"},this.implementsProgress=!1}initialize(){}cleanup(){}onVariantChange(t){this.config.variant=t,this._textConfig.variant=t,this._$text&&this._$text.setAttribute("variant",t)}render(){this._textConfig.variant=this.config.variant,this._$text=document.createElement("edu-text"),this._$text.config=this._textConfig,this._$text.addEventListener("change",()=>{this.emitStateChange()}),this.innerHTML=`
3225
+ <style>
3226
+ mark-the-words {
3227
+ display: flex;
3228
+ width: 100%;
3229
+ height: 100%;
3230
+ box-sizing: border-box;
3231
+ }
3232
+
3233
+ .text-container {
3234
+ display: flex;
3235
+ flex-direction: column;
3236
+ width: 100%;
3237
+ height: 100%;
3238
+ overflow: hidden;
3239
+ box-sizing: border-box;
3240
+ }
3241
+
3242
+ .text-wrapper {
3243
+ flex: 1;
3244
+ overflow-y: auto;
3245
+ overflow-x: auto;
3246
+ min-height: 0;
3247
+ padding: 1rem;
3248
+ }
3249
+ </style>
3250
+ <div class="text-container">
3251
+ <div class="text-wrapper"></div>
3252
+ </div>
3253
+ `,this.querySelector(".text-wrapper").appendChild(this._$text)}getCurrentState(){return this._$text?this._$text.getValue():{selectedIndices:[]}}isInteractionComplete(){let t=this.getCurrentState(),r=new Set(t.selectedIndices??[]);for(let i of this.data.targets)for(let o=i.startPos;o<=i.endPos;o++)if(!r.has(o))return!1;return!0}onHint(){let t=this.getCurrentState(),r=new Set(t.selectedIndices??[]),i=[];for(let o of this.data.targets)for(let a=o.startPos;a<=o.endPos;a++)r.has(a)||i.push(a);if(i.length>0){let o=i[Math.floor(Math.random()*i.length)],a=this.data.parts[o];this.emitHintShown(`Try selecting: "${a}"`)}else this.emitHintShown("All target words have been selected!")}getUserData(){return this.getCurrentState()}submit(){super.submit();let t=this.grade();this.dispatchEvent(new CustomEvent("interaction:graded",{detail:{result:t},bubbles:!0,composed:!0}))}grade(){let t=this.getUserData(),r=Ie(this.data,t),i=Le(this.data,t);return this._$text&&this._$text.setGradingState(i),r}reset(){super.reset(),this._$text&&(this._$text.reset(),this._$text.clearGradingState())}};customElements.get("mark-the-words")||customElements.define("mark-the-words",ie);var ne=class extends x{constructor(t,r){super(t,r);this.interactionMechanic="sequential";this._slides=[];this._currentStep=0;this._responses={};this._gradingByStep={};this._isGraded=!1;if(this._slides=(Array.isArray(t)?t:[]).filter(i=>i.type==="base"),this._slides.length===0){this.isValid=!1,this.errors="SequentialMarkTheWords requires at least one base slide.";return}this._textConfig={data:this._slides[0],mode:"highlight",variant:r.variant??"outline"},this.initializeProgress(this.getTotalTargetCount())}get slidesCount(){return this._slides.length}initialize(){}cleanup(){}onVariantChange(t){this.config.variant=t,this._textConfig.variant=t,this._$text&&this._$text.setAttribute("variant",t)}setSteps(t){this.saveCurrentStepResponse();let r=Math.max(0,Math.min(this._slides.length-1,t-1));r!==this._currentStep&&(this._currentStep=r,this.render())}render(){if(this._slides.length===0)return;this._textConfig={data:this._slides[this._currentStep],mode:"highlight",variant:this.config.variant},this._$text=document.createElement("edu-text"),this._$text.config=this._textConfig;let t=this._responses[this._currentStep];t?.selectedIndices&&this._$text.setState({selectedIndices:new Set(t.selectedIndices)});let r=this._gradingByStep[this._currentStep];this._isGraded&&r&&this._$text.setGradingState(r),this._$text.addEventListener("change",()=>{this.saveCurrentStepResponse(),this.updateProgressAcrossSteps(),this._isGraded&&(delete this._gradingByStep[this._currentStep],this._$text.clearGradingState()),this.emitStateChange()}),this.innerHTML=`
3254
+ <style>
3255
+ sequential-mark-the-words {
3256
+ display: flex;
3257
+ width: 100%;
3258
+ height: 100%;
3259
+ box-sizing: border-box;
3260
+ }
3261
+
3262
+ .text-container {
3263
+ display: flex;
3264
+ flex-direction: column;
3265
+ width: 100%;
3266
+ height: 100%;
3267
+ overflow: hidden;
3268
+ box-sizing: border-box;
3269
+ }
3270
+
3271
+ .text-wrapper {
3272
+ flex: 1;
3273
+ overflow-y: auto;
3274
+ overflow-x: auto;
3275
+ min-height: 0;
3276
+ padding: 1rem;
3277
+ }
3278
+ </style>
3279
+ <div class="text-container">
3280
+ <div class="text-wrapper"></div>
3281
+ </div>
3282
+ `,this.querySelector(".text-wrapper").appendChild(this._$text)}getTargetCountForSlide(t){let r=0;for(let i of t.targets)r+=i.endPos-i.startPos+1;return r}getTotalTargetCount(){return this._slides.reduce((t,r)=>t+this.getTargetCountForSlide(r),0)}saveCurrentStepResponse(){this._$text&&(this._responses[this._currentStep]=this._$text.getValue())}getResponseForStep(t){return this._responses[t]??{selectedIndices:[]}}getTargetIndices(t){let r=new Set;for(let i of t.targets)for(let o=i.startPos;o<=i.endPos;o++)r.add(o);return r}updateProgressAcrossSteps(){let t=0;for(let r=0;r<this._slides.length;r++){let i=this._slides[r],o=this.getResponseForStep(r),a=new Set(o.selectedIndices??[]),s=this.getTargetIndices(i);for(let l of s)a.has(l)&&t++}this.setProgress(t)}getCurrentState(){return this.saveCurrentStepResponse(),{step:this._currentStep,responses:this._responses}}isInteractionComplete(){return this.getProgress().current===this.getProgress().total}onHint(){this.saveCurrentStepResponse();let t=this._slides[this._currentStep],r=this.getResponseForStep(this._currentStep),i=new Set(r.selectedIndices??[]),o=[];for(let a of t.targets)for(let s=a.startPos;s<=a.endPos;s++)i.has(s)||o.push(s);if(o.length>0){let a=o[Math.floor(Math.random()*o.length)];this.emitHintShown(`Try selecting: "${t.parts[a]}"`);return}this.emitHintShown("This step is complete. Move to another step or submit.")}grade(){this.saveCurrentStepResponse();let t=0,r=0,i={};for(let s=0;s<this._slides.length;s++){let l=this._slides[s],c=this.getResponseForStep(s),d=Ie(l,c);t+=d.correct,r+=d.total,i[s]=Le(l,c)}this._gradingByStep=i,this._isGraded=!0;let o=this._gradingByStep[this._currentStep];return o&&this._$text.setGradingState(o),{score:r>0?Math.round(t/r*100):0,correct:t,total:r}}submit(){super.submit();let t=this.grade();this.dispatchEvent(new CustomEvent("interaction:graded",{detail:{result:t},bubbles:!0,composed:!0}))}reset(){super.reset(),this._responses={},this._gradingByStep={},this._isGraded=!1,this._currentStep=0,this._$text&&(this._$text.reset(),this._$text.clearGradingState()),this.setProgress(0),this.render()}};customElements.get("sequential-mark-the-words")||customElements.define("sequential-mark-the-words",ne);var oe=class extends x{constructor(t,r){super(t,r);this.interactionMechanic="static";this._textConfig={data:t,mode:"classification",variant:r.variant??"outline"},this.implementsProgress=!1}initialize(){}cleanup(){}onVariantChange(t){this.config.variant=t,this._textConfig.variant=t,this._$text&&this._$text.setAttribute("variant",t)}render(){this._textConfig.variant=this.config.variant,this._$text=document.createElement("edu-text"),this._$text.config=this._textConfig,this._$text.addEventListener("change",()=>{this.emitStateChange()}),this.innerHTML=`
3283
+ <style>
3284
+ categorize-the-words {
3285
+ display: flex;
3286
+ width: 100%;
3287
+ height: 100%;
3288
+ box-sizing: border-box;
3289
+ }
3290
+
3291
+ .text-container {
3292
+ display: flex;
3293
+ flex-direction: column;
3294
+ width: 100%;
3295
+ height: 100%;
3296
+ overflow: hidden;
3297
+ box-sizing: border-box;
3298
+ }
3299
+
3300
+ .text-wrapper {
3301
+ flex: 1;
3302
+ overflow-y: auto;
3303
+ overflow-x: auto;
3304
+ min-height: 0;
3305
+ padding: 1rem;
3306
+ }
3307
+ </style>
3308
+ <div class="text-container">
3309
+ <div class="text-wrapper"></div>
3310
+ </div>
3311
+ `,this.querySelector(".text-wrapper").appendChild(this._$text)}getTargetIndices(){let t=new Set;for(let r of this.data.targets)for(let i of r.targets)for(let o=i.startPos;o<=i.endPos;o++)t.add(o);return t}getCurrentState(){return this._$text?this._$text.getValue():{wordCategories:{}}}isInteractionComplete(){let t=this.getCurrentState(),r=this.getTargetIndices();for(let i of r)if(!t.wordCategories[i])return!1;return!0}onHint(){let t=this.getCurrentState();for(let r of this.data.targets)for(let i of r.targets)for(let o=i.startPos;o<=i.endPos;o++)if(!t.wordCategories[o]){this.emitHintShown(`Try categorizing "${this.data.parts[o]}"`);return}this.emitHintShown("All target words are categorized.")}grade(){let t=this.getCurrentState(),r=Pe(this.data,t),i=Be(this.data,t);return this._$text&&this._$text.setGradingState(i),r}submit(){super.submit();let t=this.grade();this.dispatchEvent(new CustomEvent("interaction:graded",{detail:{result:t},bubbles:!0,composed:!0}))}reset(){super.reset(),this._$text&&(this._$text.reset(),this._$text.clearGradingState())}};customElements.get("categorize-the-words")||customElements.define("categorize-the-words",oe);var ae=class extends x{constructor(t,r){super(t,r);this.interactionMechanic="sequential";this._slides=[];this._currentStep=0;this._responses={};this._gradingByStep={};this._isGraded=!1;if(this._slides=(Array.isArray(t)?t:[]).filter(i=>i.type==="classification"),this._slides.length===0){this.isValid=!1,this.errors="SequentialCategorizeTheWords requires at least one classification slide.";return}this._textConfig={data:this._slides[0],mode:"classification",variant:r.variant??"outline"},this.initializeProgress(this.getTotalTargetCount())}get slidesCount(){return this._slides.length}initialize(){}cleanup(){}onVariantChange(t){this.config.variant=t,this._textConfig.variant=t,this._$text&&this._$text.setAttribute("variant",t)}setSteps(t){this.saveCurrentStepResponse();let r=Math.max(0,Math.min(this._slides.length-1,t-1));r!==this._currentStep&&(this._currentStep=r,this.render())}render(){if(this._slides.length===0)return;this._textConfig={data:this._slides[this._currentStep],mode:"classification",variant:this.config.variant},this._$text=document.createElement("edu-text"),this._$text.config=this._textConfig;let t=this._responses[this._currentStep];t?.wordCategories&&this._$text.setState({wordCategories:t.wordCategories});let r=this._gradingByStep[this._currentStep];this._isGraded&&r&&this._$text.setGradingState(r),this._$text.addEventListener("change",()=>{this.saveCurrentStepResponse(),this.updateProgressAcrossSteps(),this._isGraded&&(delete this._gradingByStep[this._currentStep],this._$text.clearGradingState()),this.emitStateChange()}),this.innerHTML=`
3312
+ <style>
3313
+ sequential-categorize-the-words {
3314
+ display: flex;
3315
+ width: 100%;
3316
+ height: 100%;
3317
+ box-sizing: border-box;
3318
+ }
3319
+
3320
+ .text-container {
3321
+ display: flex;
3322
+ flex-direction: column;
3323
+ width: 100%;
3324
+ height: 100%;
3325
+ overflow: hidden;
3326
+ box-sizing: border-box;
3327
+ }
3328
+
3329
+ .text-wrapper {
3330
+ flex: 1;
3331
+ overflow-y: auto;
3332
+ overflow-x: auto;
3333
+ min-height: 0;
3334
+ padding: 1rem;
3335
+ }
3336
+ </style>
3337
+ <div class="text-container">
3338
+ <div class="text-wrapper"></div>
3339
+ </div>
3340
+ `,this.querySelector(".text-wrapper").appendChild(this._$text)}getTargetIndices(t){let r=new Set;for(let i of t.targets)for(let o of i.targets)for(let a=o.startPos;a<=o.endPos;a++)r.add(a);return r}getTotalTargetCount(){return this._slides.reduce((t,r)=>t+this.getTargetIndices(r).size,0)}saveCurrentStepResponse(){this._$text&&(this._responses[this._currentStep]=this._$text.getValue())}getResponseForStep(t){return this._responses[t]??{wordCategories:{}}}updateProgressAcrossSteps(){let t=0;for(let r=0;r<this._slides.length;r++){let i=this._slides[r],o=this.getResponseForStep(r),a=this.getTargetIndices(i);for(let s of a)o.wordCategories[s]&&t++}this.setProgress(t)}getCurrentState(){return this.saveCurrentStepResponse(),{step:this._currentStep,responses:this._responses}}isInteractionComplete(){return this.getProgress().current===this.getProgress().total}onHint(){this.saveCurrentStepResponse();let t=this._slides[this._currentStep],r=this.getResponseForStep(this._currentStep),i=this.getTargetIndices(t);for(let o of i)if(!r.wordCategories[o]){this.emitHintShown(`Try categorizing "${t.parts[o]}"`);return}this.emitHintShown("This step is complete. Move to another step or submit.")}grade(){this.saveCurrentStepResponse();let t=0,r=0,i={};for(let s=0;s<this._slides.length;s++){let l=this._slides[s],c=this.getResponseForStep(s),d=Pe(l,c);t+=d.correct,r+=d.total,i[s]=Be(l,c)}this._gradingByStep=i,this._isGraded=!0;let o=this._gradingByStep[this._currentStep];return o&&this._$text.setGradingState(o),{score:r>0?Math.round(t/r*100):0,correct:t,total:r}}submit(){super.submit();let t=this.grade();this.dispatchEvent(new CustomEvent("interaction:graded",{detail:{result:t},bubbles:!0,composed:!0}))}reset(){super.reset(),this._responses={},this._gradingByStep={},this._isGraded=!1,this._currentStep=0,this._$text&&(this._$text.reset(),this._$text.clearGradingState()),this.setProgress(0),this.render()}};customElements.get("sequential-categorize-the-words")||customElements.define("sequential-categorize-the-words",ae);var se=class extends x{constructor(t,r,i){super(t,r);this.interactionMechanic="static";this._expectedTransformations=i??{},Object.keys(this._expectedTransformations).length===0&&t.targets.forEach((o,a)=>{this._expectedTransformations[a]=o.words}),this._textConfig={data:t,mode:"transformation",variant:r.variant??"outline"},this.implementsProgress=!1}initialize(){}cleanup(){}onVariantChange(t){this.config.variant=t,this._textConfig.variant=t,this._$text&&this._$text.setAttribute("variant",t)}render(){this._textConfig.variant=this.config.variant,this._$text=document.createElement("edu-text"),this._$text.config=this._textConfig,this._$text.addEventListener("change",()=>{this.emitStateChange()}),this.innerHTML=`
3341
+ <style>
3342
+ edu-text {
3343
+ display: flex;
3344
+ width: 100%;
3345
+ height: 100%;
3346
+ box-sizing: border-box;
3347
+ }
3348
+
3349
+ .text-container {
3350
+ display: flex;
3351
+ flex-direction: column;
3352
+ width: 100%;
3353
+ height: 100%;
3354
+ overflow: hidden;
3355
+ box-sizing: border-box;
3356
+ }
3357
+
3358
+ .text-wrapper {
3359
+ flex: 1;
3360
+ overflow-y: auto;
3361
+ overflow-x: auto;
3362
+ min-height: 0;
3363
+ padding: 1rem;
3364
+ }
3365
+ </style>
3366
+ <div class="text-container">
3367
+ <div class="text-wrapper"></div>
3368
+ </div>
3369
+ `,this.querySelector(".text-wrapper").appendChild(this._$text)}getCurrentState(){return this._$text?this._$text.getValue():{transformations:{}}}isInteractionComplete(){let r=this.getCurrentState().transformations??{};for(let i=0;i<this.data.targets.length;i++){let o=r[i];if(!o||o.length===0)return!1}return!0}onHint(){let r=this.getCurrentState().transformations??{};for(let i=0;i<this.data.targets.length;i++)if(!r[i]||r[i].length===0){let a=this.data.targets[i].words.join(" "),s=this._expectedTransformations[i]?.join(" ")||a;this.emitHintShown(`Transform "${a}" to "${s}"`);return}this.emitHintShown("All transformations have been attempted!")}getUserData(){return this.getCurrentState()}submit(){super.submit();let t=this.grade();this.dispatchEvent(new CustomEvent("interaction:graded",{detail:{result:t},bubbles:!0,composed:!0}))}grade(){let t=this.getUserData(),r=Me(this.data,t,this._expectedTransformations),i={};for(let o=0;o<this.data.targets.length;o++){let a=this._expectedTransformations[o],s=t.transformations?.[o];if(!s)i[o]="missed";else if(a&&a.length===s.length){let l=a.every((c,d)=>c.toLowerCase().trim()===(s[d]||"").toLowerCase().trim());i[o]=l?"correct":"wrong"}else i[o]="wrong"}return this._$text&&this._$text.setGradingState(i),r}reset(){super.reset(),this._$text&&(this._$text.reset(),this._$text.clearGradingState())}setExpectedTransformations(t){this._expectedTransformations=t}};customElements.get("text-transformation")||customElements.define("text-transformation",se);var le=class extends x{constructor(t,r,i){super(t,r);this.interactionMechanic="sequential";this._slides=[];this._currentStep=0;this._responses={};this._gradingByStep={};this._isGraded=!1;this._expectedByStep={};if(this._slides=(Array.isArray(t)?t:[]).filter(o=>o.type==="base"),this._slides.length===0){this.isValid=!1,this.errors="SequentialTextTransformation requires at least one base slide.";return}this._textConfig={data:this._slides[0],mode:"transformation",variant:r.variant??"outline"},this._expectedByStep=i??this.buildDefaultExpectations(),this.initializeProgress(this.getTotalTargetCount())}get slidesCount(){return this._slides.length}initialize(){}cleanup(){}onVariantChange(t){this.config.variant=t,this._textConfig.variant=t,this._$text&&this._$text.setAttribute("variant",t)}setSteps(t){this.saveCurrentStepResponse();let r=Math.max(0,Math.min(this._slides.length-1,t-1));r!==this._currentStep&&(this._currentStep=r,this.render())}render(){if(this._slides.length===0)return;this._textConfig={data:this._slides[this._currentStep],mode:"transformation",variant:this.config.variant},this._$text=document.createElement("edu-text"),this._$text.config=this._textConfig;let t=this._responses[this._currentStep];t?.transformations&&this._$text.setState({transformations:t.transformations});let r=this._gradingByStep[this._currentStep];this._isGraded&&r&&this._$text.setGradingState(r),this._$text.addEventListener("change",()=>{this.saveCurrentStepResponse(),this.updateProgressAcrossSteps(),this._isGraded&&(delete this._gradingByStep[this._currentStep],this._$text.clearGradingState()),this.emitStateChange()}),this.innerHTML=`
3370
+ <style>
3371
+ sequential-text-transformation {
3372
+ display: flex;
3373
+ width: 100%;
3374
+ height: 100%;
3375
+ box-sizing: border-box;
3376
+ }
3377
+
3378
+ .text-container {
3379
+ display: flex;
3380
+ flex-direction: column;
3381
+ width: 100%;
3382
+ height: 100%;
3383
+ overflow: hidden;
3384
+ box-sizing: border-box;
3385
+ }
3386
+
3387
+ .text-wrapper {
3388
+ flex: 1;
3389
+ overflow-y: auto;
3390
+ overflow-x: auto;
3391
+ min-height: 0;
3392
+ padding: 1rem;
3393
+ }
3394
+ </style>
3395
+ <div class="text-container">
3396
+ <div class="text-wrapper"></div>
3397
+ </div>
3398
+ `,this.querySelector(".text-wrapper").appendChild(this._$text)}getTotalTargetCount(){return this._slides.reduce((t,r)=>t+r.targets.length,0)}buildDefaultExpectations(){let t={};for(let r=0;r<this._slides.length;r++){let i=this._slides[r];t[r]={};for(let o=0;o<i.targets.length;o++)t[r][o]=i.targets[o].words}return t}getExpectedForStep(t){return this._expectedByStep[t]??{}}saveCurrentStepResponse(){this._$text&&(this._responses[this._currentStep]=this._$text.getValue())}getResponseForStep(t){return this._responses[t]??{transformations:{}}}updateProgressAcrossSteps(){let t=0;for(let r=0;r<this._slides.length;r++){let i=this._slides[r],a=this.getResponseForStep(r).transformations??{};t+=i.targets.filter((s,l)=>{let c=a[l];return Array.isArray(c)&&c.length>0}).length}this.setProgress(t)}getCurrentState(){return this.saveCurrentStepResponse(),{step:this._currentStep,responses:this._responses}}isInteractionComplete(){return this.getProgress().current===this.getProgress().total}onHint(){this.saveCurrentStepResponse();let t=this._slides[this._currentStep],i=this.getResponseForStep(this._currentStep).transformations??{},o=this.getExpectedForStep(this._currentStep);for(let a=0;a<t.targets.length;a++)if(!i[a]||i[a].length===0){let s=t.targets[a].words.join(" "),l=o[a]?.join(" ")||s;this.emitHintShown(`Transform "${s}" to "${l}"`);return}this.emitHintShown("This step is complete. Move to another step or submit.")}grade(){this.saveCurrentStepResponse();let t=0,r=0,i={};for(let s=0;s<this._slides.length;s++){let l=this._slides[s],c=this.getResponseForStep(s),d=this.getExpectedForStep(s),u=Me(l,c,d);t+=u.correct,r+=u.total,i[s]=vt(l,c,d)}this._gradingByStep=i,this._isGraded=!0;let o=this._gradingByStep[this._currentStep];return o&&this._$text.setGradingState(o),{score:r>0?Math.round(t/r*100):0,correct:t,total:r}}submit(){super.submit();let t=this.grade();this.dispatchEvent(new CustomEvent("interaction:graded",{detail:{result:t},bubbles:!0,composed:!0}))}reset(){super.reset(),this._responses={},this._gradingByStep={},this._isGraded=!1,this._currentStep=0,this._$text&&(this._$text.reset(),this._$text.clearGradingState()),this.setProgress(0),this.render()}setExpectedTransformationsByStep(t){this._expectedByStep=t}};customElements.get("sequential-text-transformation")||customElements.define("sequential-text-transformation",le);var ce=class extends x{constructor(t,r){super(t,r);this.interactionMechanic="static";this._textConfig={data:t,mode:"blanks",variant:r.variant??"outline"},this.initializeProgress(t.targets.length)}initialize(){}cleanup(){}onVariantChange(t){this.config.variant=t,this._textConfig.variant=t,this._$text&&this._$text.setAttribute("variant",t)}render(){this._textConfig.variant=this.config.variant,this._$text=document.createElement("edu-text"),this._$text.config=this._textConfig,this._$text.addEventListener("change",()=>{this.updateProgressBasedOnInputs(),this.emitStateChange()}),this.innerHTML=`
3399
+ <style>
3400
+ fill-blanks {
3401
+ display: flex;
3402
+ width: 100%;
3403
+ height: 100%;
3404
+ box-sizing: border-box;
3405
+ }
3406
+
3407
+ .text-container {
3408
+ display: flex;
3409
+ flex-direction: column;
3410
+ width: 100%;
3411
+ height: 100%;
3412
+ overflow: hidden;
3413
+ box-sizing: border-box;
3414
+ }
3415
+
3416
+ .text-wrapper {
3417
+ flex: 1;
3418
+ overflow-y: auto;
3419
+ overflow-x: auto;
3420
+ min-height: 0;
3421
+ padding: 1rem;
3422
+ }
3423
+ </style>
3424
+ <div class="text-container">
3425
+ <div class="text-wrapper"></div>
3426
+ </div>
3427
+ `,this.querySelector(".text-wrapper").appendChild(this._$text)}getCurrentState(){return this._$text?this._$text.getValue():{inputValues:{}}}updateProgressBasedOnInputs(){let r=this.getCurrentState().inputValues??{},i=this.data.targets.filter(o=>{let a=r[o.id];return a!=null&&String(a).trim()!==""}).length;this.setProgress(i)}isInteractionComplete(){return this.getProgress().current===this.getProgress().total}onHint(){let r=this.getCurrentState().inputValues??{},i=this.data.targets.find(o=>{let a=r[o.id];return a==null||String(a).trim()===""});if(!i){this.emitHintShown("All blanks are filled. Submit to check answers.");return}this.emitHintShown(this.getHintText(i))}getHintText(t){switch(t.expectedValue.type){case"text":return"Fill the missing text blank.";case"number":return"Fill the numeric blank.";case"select":return"Choose the right option in the select blank.";case"date":return"Fill the date blank in the expected format.";case"time":return"Fill the time blank in the expected format.";default:return"Complete the next blank."}}grade(){let t=this.getCurrentState(),r=De(this.data,t),i=Re(this.data,t);return this._$text&&this._$text.setGradingState(i),r}submit(){super.submit();let t=this.grade();this.dispatchEvent(new CustomEvent("interaction:graded",{detail:{result:t},bubbles:!0,composed:!0}))}reset(){super.reset(),this._$text&&(this._$text.reset(),this._$text.clearGradingState())}};customElements.get("fill-blanks")||customElements.define("fill-blanks",ce);var de=class extends x{constructor(t,r){super(t,r);this.interactionMechanic="sequential";this._slides=[];this._currentStep=0;this._responses={};this._gradingByStep={};this._isGraded=!1;if(this._slides=(Array.isArray(t)?t:[]).filter(i=>i.type==="blanks"),this._slides.length===0){this.isValid=!1,this.errors="SequentialFillBlanks requires at least one blanks slide.";return}this._textConfig={data:this._slides[0],mode:"blanks",variant:r.variant??"outline"},this.initializeProgress(this.getTotalTargetCount())}get slidesCount(){return this._slides.length}initialize(){}cleanup(){}onVariantChange(t){this.config.variant=t,this._textConfig.variant=t,this._$text&&this._$text.setAttribute("variant",t)}setSteps(t){this.saveCurrentStepResponse();let r=Math.max(0,Math.min(this._slides.length-1,t-1));r!==this._currentStep&&(this._currentStep=r,this.render())}render(){if(this._slides.length===0)return;this._textConfig={data:this._slides[this._currentStep],mode:"blanks",variant:this.config.variant},this._$text=document.createElement("edu-text"),this._$text.config=this._textConfig;let t=this._responses[this._currentStep];t?.inputValues&&this._$text.setState({inputValues:t.inputValues});let r=this._gradingByStep[this._currentStep];this._isGraded&&r&&this._$text.setGradingState(r),this._$text.addEventListener("change",()=>{this.saveCurrentStepResponse(),this.updateProgressAcrossSteps(),this._isGraded&&(delete this._gradingByStep[this._currentStep],this._$text.clearGradingState()),this.emitStateChange()}),this.innerHTML=`
3428
+ <style>
3429
+ sequential-fill-blanks {
3430
+ display: flex;
3431
+ width: 100%;
3432
+ height: 100%;
3433
+ box-sizing: border-box;
3434
+ }
3435
+
3436
+ .text-container {
3437
+ display: flex;
3438
+ flex-direction: column;
3439
+ width: 100%;
3440
+ height: 100%;
3441
+ overflow: hidden;
3442
+ box-sizing: border-box;
3443
+ }
3444
+
3445
+ .step-label {
3446
+ padding: 0.5rem 1rem;
3447
+ border-bottom: 1px solid rgb(var(--edu-border));
3448
+ color: rgb(var(--edu-second-ink));
3449
+ font-size: 0.85rem;
3450
+ }
3451
+
3452
+ .text-wrapper {
3453
+ flex: 1;
3454
+ overflow-y: auto;
3455
+ overflow-x: auto;
3456
+ min-height: 0;
3457
+ padding: 1rem;
3458
+ }
3459
+ </style>
3460
+ <div class="text-container">
3461
+ <div class="text-wrapper"></div>
3462
+ </div>
3463
+ `,this.querySelector(".text-wrapper").appendChild(this._$text)}getTotalTargetCount(){return this._slides.reduce((t,r)=>t+r.targets.length,0)}saveCurrentStepResponse(){this._$text&&(this._responses[this._currentStep]=this._$text.getValue())}getResponseForStep(t){return this._responses[t]??{inputValues:{}}}updateProgressAcrossSteps(){let t=0;for(let r=0;r<this._slides.length;r++){let i=this._slides[r],a=this.getResponseForStep(r).inputValues??{};t+=i.targets.filter(s=>{let l=a[s.id];return l!=null&&String(l).trim()!==""}).length}this.setProgress(t)}getCurrentState(){return this.saveCurrentStepResponse(),{step:this._currentStep,responses:this._responses}}isInteractionComplete(){return this.getProgress().current===this.getProgress().total}onHint(){this.saveCurrentStepResponse();let t=this._slides[this._currentStep],i=this.getResponseForStep(this._currentStep).inputValues??{},o=t.targets.find(a=>{let s=i[a.id];return s==null||String(s).trim()===""});if(!o){this.emitHintShown("This step is complete. Move to another step or submit.");return}this.emitHintShown(`Complete the ${o.expectedValue.type} input on this step.`)}grade(){this.saveCurrentStepResponse();let t=0,r=0,i={};for(let s=0;s<this._slides.length;s++){let l=this._slides[s],c=this.getResponseForStep(s),d=De(l,c);t+=d.correct,r+=d.total,i[s]=Re(l,c)}this._gradingByStep=i,this._isGraded=!0;let o=this._gradingByStep[this._currentStep];return o&&this._$text.setGradingState(o),{score:r>0?Math.round(t/r*100):0,correct:t,total:r}}submit(){super.submit();let t=this.grade();this.dispatchEvent(new CustomEvent("interaction:graded",{detail:{result:t},bubbles:!0,composed:!0}))}reset(){super.reset(),this._responses={},this._gradingByStep={},this._isGraded=!1,this._currentStep=0,this._$text&&(this._$text.reset(),this._$text.clearGradingState()),this.setProgress(0),this.render()}};customElements.get("sequential-fill-blanks")||customElements.define("sequential-fill-blanks",de);function da(e){let n={};if(!e)return n.data="Data is required",{ok:!1,errors:n};if(e.type!=="seriation"&&(n.type='Data type must be "seriation"'),!Array.isArray(e.items))return n.items="Items must be an array",{ok:!1,errors:n};e.items.length<2&&(n.items="At least 2 items are required for seriation"),e.items.some(i=>typeof i!="string"||i.trim()==="")&&(n.items="All items must be non-empty strings"),new Set(e.items).size!==e.items.length&&(n.items="All items must be unique (duplicates found)");let r=Object.keys(n).length===0;return{ok:r,errors:r?null:n}}function xt(e,n,t){let r=0,i=0,o=e.length;e.forEach((s,l)=>{let c=n.indexOf(s),d=t.querySelector(`[data-item="${s}"]`);if(c===-1){d&&(d.chipState="wrong");return}let u=Math.abs(c-l);u===0?(r+=100,i++,d&&(d.chipState="correct")):u===1?(r+=50,d&&(d.chipState="missed")):d&&(d.chipState="wrong")});let a=o>0?r/o:0;return console.log(`Seriation Score: ${a.toFixed(1)}% (${i}/${o} in correct position)`),{score:a,correct:i,total:o,answerKey:e,userResponse:n}}function ua(e){try{if(!e||typeof e!="string")return{ok:!1,errors:{input:"Input must be a non-empty string"}};let n=e.trim();if(n.length===0)return{ok:!1,errors:{input:"Input cannot be empty"}};let t=[];return n.includes("|")?t=n.split("|").map(i=>i.trim()).filter(i=>i.length>0):t=n.split(`
3464
+ `).map(i=>i.replace(/^\s*[\d\w]+[\.\)]\s*/,"").trim()).filter(i=>i.length>0),t.length<2?{ok:!1,errors:{items:"At least 2 items are required for seriation"}}:{ok:!0,data:{type:"seriation",items:t}}}catch(n){return{ok:!1,errors:{"Parse Error":`${n instanceof Error?n.message:String(n)}`}}}}var ue=class extends x{constructor(t,r,i){super(t,r,i);this.interactionMechanic="static";this.currentOrder=[];this.isGraded=!1;this.draggedRowIndex=null;this.dragOverRowIndex=null;this.isDragging=!1;this.draggedRow=null;this.dragOffsetY=0;this.MAX_ITEMS=10;this.MIN_ITEM_HEIGHT=44;if(!this.isValid||!this.data||!this.config)return;let o=this.data.items;this.data.items=o,this.config.shuffle?this.currentOrder=S([...this.data.items]):this.currentOrder=[...this.data.items],this.implementsProgress=!1,this.variant=this.config.variant}initialize(){this.boundPointerMove=this.handlePointerMove.bind(this),this.boundPointerUp=this.handlePointerUp.bind(this),window.addEventListener("pointermove",this.boundPointerMove),window.addEventListener("pointerup",this.boundPointerUp)}cleanup(){window.removeEventListener("pointermove",this.boundPointerMove),window.removeEventListener("pointerup",this.boundPointerUp)}onVariantChange(t){this.querySelectorAll("edu-chip").forEach(r=>{r.variant!==void 0&&(r.variant=t)}),this.variant=t}render(){this.innerHTML=`
3465
+ <style>
3466
+ rank-order {
3467
+ display: flex;
3468
+ width: 100%;
3469
+ height: 100%;
3470
+ box-sizing: border-box;
3471
+
3472
+ /* Enable container queries for aspect-ratio detection */
3473
+ container-type: size;
3474
+ container-name: rank-order;
3475
+ }
3476
+
3477
+ .container {
3478
+ display: flex;
3479
+ flex-direction: column;
3480
+ width: 100%;
3481
+ height: 100%;
3482
+ padding: 0;
3483
+ box-sizing: border-box;
3484
+ overflow: hidden;
3485
+
3486
+ /* Height Guardrail - prevents Extreme Y stretch */
3487
+ max-height: 100%;
3488
+
3489
+ /* Vertical centering (Letterboxing) */
3490
+ margin: auto;
3491
+ }
3492
+
3493
+ .rows-container {
3494
+ flex: 1;
3495
+ display: grid;
3496
+
3497
+ /* The Grid Formula - auto-reflow based on container width */
3498
+ /* Single column by default */
3499
+ grid-template-columns: 1fr;
3500
+
3501
+ /* Rows can grow but never below the interaction floor */
3502
+ grid-template-rows: repeat(${this.data.items.length}, minmax(${this.MIN_ITEM_HEIGHT}px, 1fr));
3503
+
3504
+ gap: clamp(2px, min(0.6cqw, 0.6cqh), 6px);
3505
+ row-gap: clamp(2px, min(0.6cqw, 0.6cqh), 6px);
3506
+ column-gap: clamp(4px, min(1.2cqw, 1.2cqh), 10px);
3507
+
3508
+ align-content: stretch;
3509
+ align-items: stretch;
3510
+
3511
+ overflow-y: auto;
3512
+ overflow-x: hidden;
3513
+ min-height: 0;
3514
+ padding: clamp(6px, min(1.4cqw, 1.4cqh), 14px);
3515
+
3516
+ /* Prevent excessive width */
3517
+ max-width: 100%;
3518
+ max-height: 100dvh;
3519
+ margin: auto;
3520
+ width: 100%;
3521
+
3522
+ outline: 0 !important;
3523
+
3524
+ overflow-y: scroll;
3525
+ text-size-adjust: 100%;
3526
+ box-sizing: border-box;
3527
+ }
3528
+
3529
+ /* Height-driven reflow: only split columns when height is tight */
3530
+ @container rank-order (max-height: 220px) {
3531
+ .rows-container {
3532
+ grid-template-columns: repeat(2, 1fr);
3533
+ grid-template-rows: repeat(${Math.ceil(this.data.items.length/2)}, minmax(${this.MIN_ITEM_HEIGHT}px, 1fr));
3534
+ column-gap: clamp(0.5rem, 2cqw, 1rem);
3535
+ }
3536
+ }
3537
+
3538
+ @container rank-order (max-height: 140px) {
3539
+ .rows-container {
3540
+ grid-template-columns: repeat(3, 1fr);
3541
+ grid-template-rows: repeat(${Math.ceil(this.data.items.length/3)}, minmax(${this.MIN_ITEM_HEIGHT}px, 1fr));
3542
+ column-gap: clamp(0.5rem, 2cqw, 1rem);
3543
+ }
3544
+ }
3545
+
3546
+ .row {
3547
+ display: flex;
3548
+ align-items: stretch;
3549
+ background: transparent;
3550
+ border: 2px solid transparent;
3551
+ border-radius: clamp(4px, 1cqw, 6px);
3552
+ transition: all 0.2s ease;
3553
+ cursor: grab;
3554
+ gap: clamp(0.25rem, 1cqw, 0.5rem);
3555
+ position: relative;
3556
+
3557
+ min-height: ${this.MIN_ITEM_HEIGHT}px;
3558
+ height: 100%;
3559
+
3560
+ /* Fill the grid cell completely */
3561
+ width: 100%;
3562
+ box-sizing: border-box;
3563
+ }
3564
+
3565
+ .row:hover:not(.dragging) {
3566
+ background: rgba(var(--edu-first-accent), 0.03);
3567
+ border-color: rgba(var(--edu-first-accent), 0.2);
3568
+ }
3569
+
3570
+ .row:active {
3571
+ cursor: grabbing;
3572
+ }
3573
+
3574
+ .row.drag-over {
3575
+ border-color: rgb(var(--edu-first-accent));
3576
+ background: rgba(var(--edu-first-accent), 0.15);
3577
+ transform: scale(1.02);
3578
+ box-shadow: 0 0 0 3px rgba(var(--edu-first-accent), 0.2);
3579
+ }
3580
+
3581
+ .row.dragging {
3582
+ opacity: 0.6;
3583
+ transform: scale(0.95);
3584
+ cursor: grabbing;
3585
+ background: rgba(var(--edu-second-ink), 0.1);
3586
+ border-color: rgb(var(--edu-second-ink));
3587
+ box-shadow: 0 4px 12px rgba(var(--edu-shadow-color), 0.2);
3588
+ }
3589
+
3590
+ .chip-wrapper {
3591
+ flex: 1;
3592
+ min-width: 0;
3593
+ height: 100%;
3594
+ display: flex;
3595
+ }
3596
+
3597
+ edu-chip {
3598
+ width: 100%;
3599
+ height: 100%;
3600
+ flex: 1;
3601
+ }
3602
+
3603
+ .controls {
3604
+ position: absolute;
3605
+ top: clamp(-14px, -2cqh, -10px);
3606
+ right: clamp(-14px, -2cqw, -10px);
3607
+ display: flex;
3608
+ align-items: center;
3609
+ justify-content: center;
3610
+ z-index: 10;
3611
+ opacity: 0;
3612
+ transition: opacity 0.2s ease;
3613
+ pointer-events: none;
3614
+ }
3615
+
3616
+ .row:hover .controls,
3617
+ .row.dragging .controls {
3618
+ opacity: 1;
3619
+ pointer-events: auto;
3620
+ }
3621
+
3622
+ .btn {
3623
+ display: flex;
3624
+ align-items: center;
3625
+ justify-content: center;
3626
+ background: rgb(var(--edu-card));
3627
+ border: 2px solid rgb(var(--edu-first-accent));
3628
+ cursor: pointer;
3629
+ transition: all 0.2s ease;
3630
+ box-shadow: 0 2px 6px rgba(var(--edu-shadow-color), 0.15);
3631
+
3632
+ /* Compact circular buttons */
3633
+ width: clamp(28px, min(5cqw, 5cqh), 42px);
3634
+ height: clamp(28px, min(5cqw, 5cqh), 42px);
3635
+ min-width: 28px;
3636
+ min-height: 28px;
3637
+ flex-shrink: 0;
3638
+ border-radius: 50%;
3639
+ padding: 0;
3640
+ margin: 0;
3641
+ }
3642
+
3643
+ .btn:hover:not(:disabled) {
3644
+ background: rgb(var(--edu-first-accent));
3645
+ border-color: rgb(var(--edu-first-accent));
3646
+ transform: scale(1.1);
3647
+ box-shadow: 0 4px 12px rgba(var(--edu-first-accent), 0.4);
3648
+ }
3649
+
3650
+ .btn:hover:not(:disabled) img {
3651
+ filter: brightness(0) invert(1);
3652
+ }
3653
+
3654
+ .btn:active:not(:disabled) {
3655
+ transform: scale(0.9);
3656
+ }
3657
+
3658
+ .btn:disabled {
3659
+ opacity: 0.2;
3660
+ cursor: not-allowed;
3661
+ border-color: rgb(var(--edu-border));
3662
+ }
3663
+
3664
+ .btn img {
3665
+ width: 60%;
3666
+ height: 60%;
3667
+ object-fit: contain;
3668
+ transition: filter 0.2s ease;
3669
+ }
3670
+
3671
+ /* Mobile optimizations - ensure tight layout */
3672
+ @media (max-width: 640px) {
3673
+ .row {
3674
+ gap: 0.125rem;
3675
+ }
3676
+ }
3677
+
3678
+ </style>
3679
+
3680
+ <div class="container">
3681
+ <div class="rows-container"></div>
3682
+ </div>
3683
+ `,this.$container=this.querySelector(".container"),this.$rowsContainer=this.querySelector(".rows-container"),this.renderRows()}renderRows(){this.$rowsContainer.innerHTML="",this.currentOrder.forEach((t,r)=>{let i=document.createElement("div");i.className="row",i.dataset.index=String(r);let o=document.createElement("div");o.className="chip-wrapper";let a=document.createElement("edu-chip");a.variant=this.variant,a.dataset.item=t,a.prefix=String(r+1),a.draggable=!0,D(t,a,this.assets?.assetsById),this.isGraded&&(this.data.items.indexOf(t)===r?a.chipState="correct":a.chipState="wrong"),o.appendChild(a);let s=document.createElement("div");s.className="controls";let l=this.createButton("up",r);s.appendChild(l),i.appendChild(o),i.appendChild(s),this.isGraded||i.addEventListener("pointerdown",c=>this.handlePointerDown(c,r)),this.$rowsContainer.appendChild(i)})}createButton(t,r){let i=document.createElement("button");i.className="btn",i.dataset.direction=t,i.dataset.index=String(r),i.setAttribute("aria-label",t==="up"?"Move up":"Move down"),t==="up"&&r===0&&(i.disabled=!0),t==="down"&&r===this.currentOrder.length-1&&(i.disabled=!0),this.isGraded&&(i.disabled=!0);let o=t==="up"?B("up"):B("down");return i.innerHTML=o,i.addEventListener("click",()=>{t==="up"&&r>0?this.swapItems(r,r-1):t==="down"&&r<this.currentOrder.length-1&&this.swapItems(r,r+1)}),i}swapItems(t,r){let i=this.currentOrder[t];this.currentOrder[t]=this.currentOrder[r],this.currentOrder[r]=i,this.renderRows(),this.emitStateChange()}handlePointerDown(t,r){if(t.target.closest(".btn, .controls"))return;t.preventDefault(),t.stopPropagation(),this.isDragging=!0,this.draggedRow=t.currentTarget,this.draggedRowIndex=r;let i=this.draggedRow.getBoundingClientRect();this.dragOffsetY=t.clientY-i.top;try{this.draggedRow.setPointerCapture(t.pointerId)}catch(o){console.warn("Failed to capture pointer:",o)}this.draggedRow.classList.add("dragging"),this.$rowsContainer.style.userSelect="none"}handlePointerMove(t){if(!this.isDragging||!this.draggedRow)return;let r=this.getRowIndexAtY(t.clientY);if(this.$rowsContainer.querySelectorAll(".row").forEach(i=>{i.classList.remove("drag-over")}),r!==-1&&r!==this.draggedRowIndex){let i=Array.from(this.$rowsContainer.children);i[r]&&i[r].classList.add("drag-over")}}handlePointerUp(t){if(!this.isDragging||!this.draggedRow)return;try{this.draggedRow.releasePointerCapture(t.pointerId)}catch{}let r=this.getRowIndexAtY(t.clientY);r!==-1&&r!==this.draggedRowIndex&&this.swapItems(this.draggedRowIndex,r),this.$rowsContainer.querySelectorAll(".row").forEach(i=>{i.classList.remove("dragging","drag-over")}),this.$rowsContainer.style.userSelect="",this.isDragging=!1,this.draggedRow=null,this.draggedRowIndex=null,this.dragOverRowIndex=null}getRowIndexAtY(t){let r=Array.from(this.$rowsContainer.children);for(let i=0;i<r.length;i++){let o=r[i].getBoundingClientRect();if(t>=o.top&&t<=o.bottom)return i}return-1}getCurrentState(){return{currentOrder:[...this.currentOrder],correctOrder:[...this.data.items]}}isInteractionComplete(){return!0}onHint(){let t=0;this.currentOrder.forEach((r,i)=>{this.data.items[i]===r&&t++}),t===this.currentOrder.length?(alert('All items are in the correct order! Click "Check" to submit.'),this.emitHintShown("All items correctly ordered")):(alert(`Hint: ${t} out of ${this.currentOrder.length} items are in the correct position. Keep reordering!`),this.emitHintShown(`${t}/${this.currentOrder.length} correct`))}submit(){super.submit();let t=xt(this.data.items,this.currentOrder,this);console.log(`Rank Order Score: ${t.score.toFixed(1)}% (${t.correct}/${t.total} correct)`),this.isGraded=!0,this.renderRows(),this.dispatchEvent(new CustomEvent("interaction:graded",{detail:{result:t},bubbles:!0,composed:!0})),this.setAttribute("inert","")}reset(){super.reset(),this.config.shuffle?this.currentOrder=S([...this.data.items]):this.currentOrder=[...this.data.items],this.isGraded=!1,this.renderRows()}};customElements.get("rank-order")||customElements.define("rank-order",ue);var ci=!1,pa=()=>{ci||(ci=!0,C({id:"open-classification",label:"Open Classification",elementTag:"open-classification",cognitiveOp:"classification",mechanic:"static",engine:"direct",ctor:ye,capabilities:{isSequential:!1,implementsProgress:!0,usesAssets:!0,hasParser:!0,hasValidator:!0,hasGrader:!0}}),C({id:"sequential-classification",label:"Sequential Classification",elementTag:"sequential-classification",cognitiveOp:"classification",mechanic:"automatic-sequencing",engine:"direct",ctor:Ee,capabilities:{isSequential:!0,implementsProgress:!0,usesAssets:!0,hasParser:!0,hasValidator:!0,hasGrader:!0}}),C({id:"mcq",label:"Multiple Choice / Multiple Response",elementTag:"mcq-interaction",cognitiveOp:"recognition",mechanic:"sequential",engine:"direct",ctor:ee,capabilities:{isSequential:!0,implementsProgress:!0,usesAssets:!0,hasParser:!0,hasValidator:!0,hasGrader:!0}}),C({id:"simultaneous-association",label:"Simultaneous Association",elementTag:"simultaneous-association",cognitiveOp:"association",mechanic:"static",engine:"direct",ctor:Ce,capabilities:{isSequential:!1,implementsProgress:!0,usesAssets:!0,hasParser:!0,hasValidator:!0,hasGrader:!0}}),C({id:"list-recall",label:"List Recall",elementTag:"list-recall",cognitiveOp:"freerecall",mechanic:"static",engine:"direct",ctor:te,capabilities:{isSequential:!1,implementsProgress:!0,usesAssets:!1,hasParser:!0,hasValidator:!0,hasGrader:!0}}),C({id:"lookup-table",label:"Lookup Table",elementTag:"lookup-table",cognitiveOp:"production",mechanic:"static",engine:"tables",ctor:Te,capabilities:{isSequential:!1,implementsProgress:!0,usesAssets:!1,hasParser:!0,hasValidator:!0,hasGrader:!0}}),C({id:"classification-matrix",label:"Classification Matrix",elementTag:"classification-matrix",cognitiveOp:"classification",mechanic:"static",engine:"tables",ctor:$e,capabilities:{isSequential:!1,implementsProgress:!0,usesAssets:!1,hasParser:!0,hasValidator:!0,hasGrader:!0}}),C({id:"nary-choice-table",label:"N-ary Choice Table",elementTag:"nary-choice-table",cognitiveOp:"discrimination",mechanic:"static",engine:"tables",ctor:Ae,capabilities:{isSequential:!1,implementsProgress:!0,usesAssets:!1,hasParser:!0,hasValidator:!0,hasGrader:!0}}),C({id:"adjacency-table",label:"Adjacency Table",elementTag:"adjacency-table",cognitiveOp:"association",mechanic:"static",engine:"tables",ctor:_e,capabilities:{isSequential:!1,implementsProgress:!0,usesAssets:!1,hasParser:!0,hasValidator:!0,hasGrader:!0}}),C({id:"mark-the-words",label:"Mark The Words",elementTag:"mark-the-words",cognitiveOp:"recognition",mechanic:"static",engine:"text",ctor:ie,capabilities:{isSequential:!1,implementsProgress:!0,usesAssets:!1,hasParser:!1,hasValidator:!0,hasGrader:!0}}),C({id:"sequential-mark-the-words",label:"Sequential Mark The Words",elementTag:"sequential-mark-the-words",cognitiveOp:"recognition",mechanic:"sequential",engine:"text",ctor:ne,capabilities:{isSequential:!0,implementsProgress:!0,usesAssets:!1,hasParser:!1,hasValidator:!0,hasGrader:!0}}),C({id:"categorize-the-words",label:"Categorize The Words",elementTag:"categorize-the-words",cognitiveOp:"classification",mechanic:"static",engine:"text",ctor:oe,capabilities:{isSequential:!1,implementsProgress:!0,usesAssets:!1,hasParser:!1,hasValidator:!0,hasGrader:!0}}),C({id:"sequential-categorize-the-words",label:"Sequential Categorize The Words",elementTag:"sequential-categorize-the-words",cognitiveOp:"classification",mechanic:"sequential",engine:"text",ctor:ae,capabilities:{isSequential:!0,implementsProgress:!0,usesAssets:!1,hasParser:!1,hasValidator:!0,hasGrader:!0}}),C({id:"text-transformation",label:"Text Transformation",elementTag:"text-transformation",cognitiveOp:"transformation",mechanic:"static",engine:"text",ctor:se,capabilities:{isSequential:!1,implementsProgress:!0,usesAssets:!1,hasParser:!1,hasValidator:!0,hasGrader:!0}}),C({id:"sequential-text-transformation",label:"Sequential Text Transformation",elementTag:"sequential-text-transformation",cognitiveOp:"transformation",mechanic:"sequential",engine:"text",ctor:le,capabilities:{isSequential:!0,implementsProgress:!0,usesAssets:!1,hasParser:!1,hasValidator:!0,hasGrader:!0}}),C({id:"fill-blanks",label:"Fill Blanks",elementTag:"fill-blanks",cognitiveOp:"cuedrecall",mechanic:"static",engine:"text",ctor:ce,capabilities:{isSequential:!1,implementsProgress:!0,usesAssets:!1,hasParser:!1,hasValidator:!0,hasGrader:!0}}),C({id:"sequential-fill-blanks",label:"Sequential Fill Blanks",elementTag:"sequential-fill-blanks",cognitiveOp:"cuedrecall",mechanic:"sequential",engine:"text",ctor:de,capabilities:{isSequential:!0,implementsProgress:!0,usesAssets:!1,hasParser:!1,hasValidator:!0,hasGrader:!0}}),C({id:"rank-order",label:"Rank Order",elementTag:"rank-order",cognitiveOp:"seriation",mechanic:"static",engine:"direct",ctor:ue,capabilities:{isSequential:!1,implementsProgress:!1,usesAssets:!0,hasParser:!0,hasValidator:!0,hasGrader:!0}}))};pa();var di=`<header part='header'>
3684
+ <div class="prompt-container">
3685
+ <button class="prompt-btn btn" title="See Prompt Data" part="see-prompt">
3686
+ <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
3687
+ <path d="M12 3c4.97 0 9 1.79 9 4s-4.03 4-9 4-9-1.79-9-4 4.03-4 9-4Z"/>
3688
+ <path d="M3 7v5c0 2.21 4.03 4 9 4s9-1.79 9-4V7"/>
3689
+ <path d="M3 12v5c0 2.21 4.03 4 9 4s9-1.79 9-4v-5"/>
3690
+ </svg>
3691
+ </button>
3692
+ <div class='title' part='title'></div>
3693
+ </div>
3694
+ <div class='timer' part='timer'></div>
3695
+ </header>
3696
+
3697
+ <div class='content' part='content'>
3698
+ <!-- Screen 1: Interaction (default) -->
3699
+ <div class="screen" data-screen="interaction">
3700
+ <slot></slot>
3701
+ </div>
3702
+
3703
+ <!-- Screen 2: Error -->
3704
+ <div class="screen" data-screen="error" style="display:none">
3705
+ <div class="error-content"></div>
3706
+ </div>
3707
+
3708
+ <!-- Screen 3: Correct Solution (provided by interaction) -->
3709
+ <div class="screen" data-screen="solution" style="display:none">
3710
+ <slot name="solution">
3711
+ <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;">
3712
+ Solution screen not implemented for this interaction yet
3713
+ </div>
3714
+ </slot>
3715
+ </div>
3716
+
3717
+ <!-- Screen 4: Remaining Attempts -->
3718
+ <div class="screen" data-screen="attempts" style="display:none">
3719
+ <div class="attempts-message"></div>
3720
+ </div>
3721
+
3722
+ <!-- Screen 5: Score -->
3723
+ <div class="screen" data-screen="score" style="display:none">
3724
+ <div class="score-display"></div>
3725
+ </div>
3726
+
3727
+ <div class="screen" data-screen="time" style="display:none">
3728
+ <div class="timer-display"></div>
3729
+ </div>
3730
+ </div>
3731
+
3732
+ <footer id='footer' part='footer'>
3733
+ <div class="progress-container">
3734
+ <progress class="progress-bar" part="progress" value="0" max="100"></progress>
3735
+ <div class="progress-icon-wrapper">
3736
+ <svg viewBox="0 0 24 24" class="progress-icon" width="20" height="20" fill="currentColor" aria-hidden="true">
3737
+ <path d="m12 2.5 2.94 5.96 6.58.96-4.76 4.64 1.12 6.56L12 17.54 6.12 20.62l1.12-6.56L2.48 9.42l6.58-.96L12 2.5Z"/>
3738
+ </svg>
3739
+ </div>
3740
+ <span class="progress-counter">0/0</span>
3741
+ </div>
3742
+ <div class="radio-nav" part="radio-nav"></div>
3743
+ <div class="action-buttons">
3744
+ <button class="check-btn" type="button" part="check">Check</button>
3745
+
3746
+ <button class="see-answers-btn btn" title="See answers" part="see-answers">
3747
+ <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
3748
+ <path d="M2 12s3.5-6 10-6 10 6 10 6-3.5 6-10 6-10-6-10-6Z"/>
3749
+ <circle cx="12" cy="12" r="3"/>
3750
+ </svg>
3751
+ </button>
3752
+ <button class="retry-btn btn" title="Retry" part="retry">
3753
+ <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
3754
+ <path d="M17 2v4h-4"/>
3755
+ <path d="M7 22v-4h4"/>
3756
+ <path d="M20 11a8 8 0 0 0-13.66-5.66L3 8"/>
3757
+ <path d="M4 13a8 8 0 0 0 13.66 5.66L21 16"/>
3758
+ </svg>
3759
+ </button>
3760
+ <button class="scores-btn btn" title="Retry" part="retry">
3761
+ <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
3762
+ <path d="M12 3c4.97 0 9 1.79 9 4s-4.03 4-9 4-9-1.79-9-4 4.03-4 9-4Z"/>
3763
+ <path d="M3 7v5c0 2.21 4.03 4 9 4s9-1.79 9-4V7"/>
3764
+ <path d="M3 12v5c0 2.21 4.03 4 9 4s9-1.79 9-4v-5"/>
3765
+ </svg>
3766
+ </button>
3767
+
3768
+ </div>
3769
+ </footer>
3770
+ `;var ui=`:host {
3771
+ display: flex;
3772
+ width: 100%;
3773
+ height: 100%;
3774
+ box-sizing: border-box;
3775
+ container-type: size;
3776
+ }
3777
+
3778
+ .edu-hidden { display: none !important; }
3779
+
3780
+ .wrap {
3781
+ display: flex;
3782
+ flex-direction: column;
3783
+ width: 100%;
3784
+ height: 100%;
3785
+ color: rgb(var(--edu-ink));
3786
+ background: rgb(var(--edu-bg));
3787
+ overflow: hidden;
3788
+ box-sizing: border-box;
3789
+ }
3790
+
3791
+ header {
3792
+ display: flex;
3793
+ justify-content: space-between;
3794
+ align-items: center;
3795
+ padding: clamp(0.2rem, 0.7cqh, 0.4rem);
3796
+ border-bottom: 1px solid rgb(var(--edu-border));
3797
+ flex-shrink: 0;
3798
+ gap: clamp(0.25rem, 1cqw, 0.5rem);
3799
+ height: clamp(38px, 7cqh, 46px);
3800
+ min-height: clamp(38px, 7cqh, 46px);
3801
+ }
3802
+
3803
+ .prompt-container {
3804
+ display: flex;
3805
+ min-width: 0;
3806
+ gap: clamp(0.25rem, 1cqw, 0.5rem);
3807
+ align-items: center;
3808
+ flex: 1;
3809
+ }
3810
+
3811
+ .title {
3812
+ flex: 1;
3813
+ min-width: 0;
3814
+ padding: 0;
3815
+ font-size: clamp(0.85rem, 2cqh, 1.05rem);
3816
+ font-weight: 700;
3817
+ line-height: 1.2;
3818
+ white-space: nowrap;
3819
+ overflow: hidden;
3820
+ text-overflow: ellipsis;
3821
+ }
3822
+
3823
+ .timer {
3824
+ padding: 0;
3825
+ font-size: clamp(0.75rem, 1.6cqh, 0.9rem);
3826
+ font-weight: 600;
3827
+ color: rgb(var(--edu-second-ink));
3828
+ font-variant-numeric: tabular-nums;
3829
+ cursor: pointer;
3830
+ }
3831
+
3832
+ .timer[data-warning="true"] {
3833
+ color: rgb(var(--edu-warning));
3834
+ }
3835
+
3836
+ .timer[data-danger="true"] {
3837
+ color: rgb(var(--edu-error));
3838
+ }
3839
+
3840
+ .content {
3841
+ flex: 1;
3842
+ overflow: hidden;
3843
+ min-height: 0;
3844
+ padding: clamp(0.5rem, min(2cqw, 2cqh), 1rem);
3845
+ box-sizing: border-box;
3846
+ position: relative;
3847
+ display: flex;
3848
+ }
3849
+
3850
+ .screen {
3851
+ display: flex;
3852
+ width: 100%;
3853
+ height: 100%;
3854
+ box-sizing: border-box;
3855
+ animation: fadeIn 1s ease;
3856
+ flex: 1;
3857
+ min-height: 0;
3858
+ }
3859
+
3860
+ .screen[data-screen="interaction"] {
3861
+ justify-content: stretch;
3862
+ align-items: stretch;
3863
+ }
3864
+
3865
+ .screen:not([data-screen="interaction"]) {
3866
+ justify-content: center;
3867
+ align-items: center;
3868
+ }
3869
+
3870
+ .screen[data-screen="interaction"] ::slotted(*) {
3871
+ width: 100%;
3872
+ height: 100%;
3873
+ min-height: 0;
3874
+ display: block;
3875
+ }
3876
+
3877
+ @keyframes fadeIn {
3878
+ from {
3879
+ opacity: 0;
3880
+ transform: translateY(10px);
3881
+ }
3882
+ to {
3883
+ opacity: 1;
3884
+ transform: translateY(0);
3885
+ }
3886
+ }
3887
+
3888
+ .error-content,
3889
+ .attempts-message,
3890
+ .score-display,
3891
+ .timer-display {
3892
+ display: flex;
3893
+ flex-direction: column;
3894
+ align-items: center;
3895
+ justify-content: center;
3896
+ text-align: center;
3897
+ height: 100%;
3898
+ color: rgb(var(--edu-ink));
3899
+ }
3900
+
3901
+ .timer-display .timer {
3902
+ font-size: 10rem !important;
3903
+ color: rgb(var(--edu-ink)) !important;
3904
+ }
3905
+
3906
+ .error-content {
3907
+ color: rgb(var(--edu-error));
3908
+ }
3909
+
3910
+ .attempts-message {
3911
+ font-weight: 600;
3912
+ font-size: 1.25rem;
3913
+ }
3914
+
3915
+ footer {
3916
+ position: relative;
3917
+ display: flex;
3918
+ flex-direction: column;
3919
+ justify-content: center;
3920
+ align-items: center;
3921
+ /* padding: clamp(0.3rem, 0.8cqh, 0.6rem);*/
3922
+ gap: clamp(0.25rem, 0.8cqh, 0.5rem);
3923
+ flex-shrink: 0;
3924
+ height: clamp(20px, 9cqh, 62px);
3925
+ min-height: clamp(50px, 9cqh, 62px);
3926
+ }
3927
+
3928
+ .progress-container {
3929
+ position: relative;
3930
+ display: flex;
3931
+ align-items: center;
3932
+ justify-content: space-between;
3933
+ gap: clamp(0.25rem, 1cqw, 0.6rem);
3934
+ width: 100%;
3935
+ }
3936
+
3937
+ .progress-bar {
3938
+ flex: 1;
3939
+ height: clamp(8px, 1.6cqh, 12px);
3940
+ appearance: none;
3941
+ -webkit-appearance: none;
3942
+ border: none;
3943
+ }
3944
+
3945
+ .progress-bar::-webkit-progress-bar {
3946
+ background-color: rgb(var(--edu-muted));
3947
+ border-radius: 10px;
3948
+ }
3949
+
3950
+ .progress-bar::-webkit-progress-value {
3951
+ background: rgb(var(--edu-first-accent));
3952
+ border-radius: 10px;
3953
+ transition: width 0.3s ease, background 0.3s ease;
3954
+ }
3955
+
3956
+ .progress-bar::-moz-progress-bar {
3957
+ background: rgb(var(--edu-first-accent));
3958
+ border-radius: 10px;
3959
+ transition: width 0.3s ease, background 0.3s ease;
3960
+ }
3961
+
3962
+ /* Score-based progress bar coloring */
3963
+ .progress-bar.score-fail::-webkit-progress-value {
3964
+ background: rgb(var(--edu-error)) !important;
3965
+ }
3966
+
3967
+ .progress-bar.score-fail::-moz-progress-bar {
3968
+ background: rgb(var(--edu-error)) !important;
3969
+ }
3970
+
3971
+ .progress-bar.score-low::-webkit-progress-value {
3972
+ background: rgb(var(--edu-warning)) !important;
3973
+ }
3974
+
3975
+ .progress-bar.score-low::-moz-progress-bar {
3976
+ background: rgb(var(--edu-warning)) !important;
3977
+ }
3978
+
3979
+ .progress-bar.score-mid::-webkit-progress-value {
3980
+ background: rgb(139, 195, 74) !important; /* Light green */
3981
+ }
3982
+
3983
+ .progress-bar.score-mid::-moz-progress-bar {
3984
+ background: rgb(139, 195, 74) !important;
3985
+ }
3986
+
3987
+ .progress-bar.score-high::-webkit-progress-value {
3988
+ background: rgb(var(--edu-success)) !important;
3989
+ }
3990
+
3991
+ .progress-bar.score-high::-moz-progress-bar {
3992
+ background: rgb(var(--edu-success)) !important;
3993
+ }
3994
+
3995
+ .progress-icon-wrapper {
3996
+ display: flex;
3997
+ align-items: center;
3998
+ justify-content: center;
3999
+ max-width: 24px;
4000
+ max-height: 24px;
4001
+ position: absolute;
4002
+ left: 0;
4003
+ top: 50%;
4004
+ transform: translateY(-50%);
4005
+ pointer-events: none;
4006
+ transition: left 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
4007
+ background-color: rgb(var(--edu-first-accent));
4008
+ border-radius: 50px;
4009
+ box-shadow: 0 0 10px 5px rgb(var(--edu-first-accent));
4010
+ padding: 0;
4011
+ }
4012
+
4013
+ /* Score-based icon coloring */
4014
+ .progress-icon-wrapper.score-fail {
4015
+ background-color: rgb(var(--edu-error));
4016
+ box-shadow: 0 0 10px 5px rgb(var(--edu-error));
4017
+ }
4018
+
4019
+ .progress-icon-wrapper.score-low {
4020
+ background-color: rgb(var(--edu-warning));
4021
+ box-shadow: 0 0 10px 5px rgb(var(--edu-warning));
4022
+ }
4023
+
4024
+ .progress-icon-wrapper.score-mid {
4025
+ background-color: rgba(139, 195, 74, 0.8);
4026
+ box-shadow: 0 0 10px 5px rgba(139, 195, 74, 0.8);
4027
+ }
4028
+
4029
+ .progress-icon-wrapper.score-high {
4030
+ background-color: rgb(var(--edu-success));
4031
+ box-shadow: 0 0 10px 5px rgb(var(--edu-success));
4032
+ }
4033
+
4034
+ .progress-icon {
4035
+ width: clamp(20px, 3.2cqh, 30px);
4036
+ height: clamp(20px, 3.2cqh, 30px);
4037
+ }
4038
+
4039
+ .progress-counter {
4040
+ font-size: clamp(0.7rem, 1.4cqh, 0.85rem);
4041
+ font-weight: 600;
4042
+ color: rgb(var(--edu-second-ink));
4043
+ min-width: 3rem;
4044
+ text-align: right;
4045
+ flex-shrink: 0;
4046
+ }
4047
+
4048
+ .action-buttons {
4049
+ display: flex;
4050
+ gap: 0.5rem;
4051
+ align-items: center;
4052
+ justify-content: center;
4053
+ flex-wrap: wrap;
4054
+ }
4055
+
4056
+ .check-btn {
4057
+ padding: clamp(0.35rem, 1cqh, 0.6rem) clamp(1rem, 2.6cqw, 1.6rem);
4058
+ font-size: clamp(0.8rem, 1.6cqh, 0.95rem);
4059
+ font-weight: 600;
4060
+ cursor: pointer;
4061
+ border: none;
4062
+ border-radius: var(--edu-radius);
4063
+ background: rgb(var(--edu-first-accent));
4064
+ color: rgb(var(--edu-inverted-ink));
4065
+ transition: all 0.2s ease;
4066
+ }
4067
+
4068
+ .check-btn:hover:not(:disabled) {
4069
+ background: rgb(var(--edu-first-accent) / 0.9);
4070
+ transform: translateY(-2px) scale(1.02);
4071
+ box-shadow: 0 4px 12px rgb(var(--edu-first-accent) / 0.3);
4072
+ }
4073
+
4074
+ .check-btn:active:not(:disabled) {
4075
+ transform: translateY(0) scale(0.98);
4076
+ box-shadow: 0 2px 4px rgb(var(--edu-first-accent) / 0.2);
4077
+ }
4078
+
4079
+ .check-btn:disabled {
4080
+ opacity: 0.5;
4081
+ cursor: not-allowed;
4082
+ }
4083
+
4084
+ .btn {
4085
+ padding: clamp(0.25rem, 0.8cqh, 0.4rem);
4086
+ background: transparent;
4087
+ border: 2px solid rgb(var(--edu-border));
4088
+ border-radius: var(--edu-radius);
4089
+ cursor: pointer;
4090
+ display: flex;
4091
+ align-items: center;
4092
+ justify-content: center;
4093
+ transition: all 0.2s ease;
4094
+ }
4095
+
4096
+ .btn:hover {
4097
+ background: rgb(var(--edu-muted));
4098
+ border-color: rgb(var(--edu-first-accent));
4099
+ transform: translateY(-2px) scale(1.05);
4100
+ box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
4101
+ }
4102
+
4103
+ .btn:active {
4104
+ transform: translateY(0) scale(0.95);
4105
+ box-shadow: none;
4106
+ }
4107
+
4108
+ .radio-nav {
4109
+ display: none;
4110
+ flex-wrap: wrap;
4111
+ gap: 0.5rem;
4112
+ align-items: center;
4113
+ justify-content: center;
4114
+ }
4115
+
4116
+ .radio-nav[data-active="true"] {
4117
+ display: flex;
4118
+ }
4119
+
4120
+ @media (max-width: 640px) {
4121
+ .radio-nav {
4122
+ gap: 0.35rem;
4123
+ }
4124
+
4125
+ .radio-nav label {
4126
+ padding: 0.4rem 0.75rem;
4127
+ font-size: 0.875rem;
4128
+ }
4129
+ }
4130
+
4131
+ .radio-nav input { display: none; }
4132
+
4133
+ .radio-nav label {
4134
+ cursor: pointer;
4135
+ transition: all 0.3s ease;
4136
+ padding: 0.5rem 1rem;
4137
+ border-radius: var(--edu-radius);
4138
+ border: 1px solid rgb(var(--edu-border));
4139
+ background: rgb(var(--edu-card));
4140
+ color: rgb(var(--edu-ink));
4141
+ font-weight: 500;
4142
+ }
4143
+
4144
+ .radio-nav label:hover {
4145
+ border-color: rgb(var(--edu-first-accent));
4146
+ }
4147
+
4148
+ .radio-nav input:checked + label {
4149
+ background: rgb(var(--edu-first-accent));
4150
+ color: rgb(var(--edu-inverted-ink));
4151
+ border-color: rgb(var(--edu-first-accent));
4152
+ }
4153
+
4154
+ .actions {
4155
+ display: flex;
4156
+ gap: 0.5rem;
4157
+ }
4158
+
4159
+ .utils-container {
4160
+ display: flex;
4161
+ justify-content: space-between;
4162
+ }
4163
+
4164
+ :host([variant="empty"]) {
4165
+ & .wrap { background: transparent; border: none; }
4166
+ & header { border-bottom: none; }
4167
+
4168
+ & .title {
4169
+ padding-bottom: 5px;
4170
+ max-width: fit-content;
4171
+ border-bottom: 5px solid rgb(var(--edu-ink));
4172
+ }
4173
+
4174
+ & .timer { }
4175
+
4176
+ & .check-btn {
4177
+ background: transparent;
4178
+ color: rgb(var(--edu-ink));
4179
+ border: 2px solid rgb(var(--edu-ink));
4180
+ border-radius: 0;
4181
+ }
4182
+
4183
+ & .check-btn:hover:not(:disabled) {
4184
+ color: rgb(var(--edu-inverted-ink));
4185
+ background: rgb(var(--edu-ink));
4186
+ border-color: rgb(var(--edu-ink));
4187
+ }
4188
+
4189
+ & .progress-bar::-webkit-progress-bar {background: transparent}
4190
+ & .progress-bar::-webkit-progress-value {background: rgb(var(--edu-ink))}
4191
+
4192
+ & .radio-nav label {
4193
+ background: transparent;
4194
+ border: 2px solid rgb(var(--edu-ink));
4195
+ border-radius: 0;
4196
+ }
4197
+
4198
+ & .radio-nav input:checked + label {
4199
+ background: rgb(var(--edu-ink));
4200
+ color: rgb(var(--edu-inverted-ink));
4201
+ }
4202
+
4203
+ & .radio-nav label:hover { background-color: rgb(var(--edu-first-accent)) }
4204
+ }
4205
+
4206
+ :host([variant="minimal"]) {
4207
+ & .wrap {
4208
+ border: 1px solid rgb(var(--edu-border));
4209
+ border-radius: 6px;
4210
+ }
4211
+
4212
+ & .timer {
4213
+ font-size: 0.95rem;
4214
+ }
4215
+
4216
+ & .check-btn {
4217
+ border-radius: 4px;
4218
+ }
4219
+
4220
+ & footer {
4221
+ border-top: 1px solid rgb(var(--edu-border));
4222
+ }
4223
+
4224
+ & .progress-bar {
4225
+ height: 1px;
4226
+ }
4227
+
4228
+ & .progress-bar::-webkit-progress-bar {
4229
+ background-color: rgb(var(--edu-muted));
4230
+ }
4231
+
4232
+ & .progress-bar::-webkit-progress-value {
4233
+ background-color: rgb(var(--edu-ink));
4234
+ }
4235
+
4236
+ & .radio-nav label {
4237
+ border-radius: 4px;
4238
+ }
4239
+ }
4240
+
4241
+ :host([variant="elegant"]) {
4242
+ & .wrap {
4243
+ border-radius: 10px;
4244
+ box-shadow: 0 10px 30px rgba(var(--edu-shadow-color), 0.15);
4245
+ }
4246
+
4247
+ & .timer {
4248
+ font-family: georgia, serif;
4249
+ font-style: italic;
4250
+ font-size: 1.1rem;
4251
+ }
4252
+
4253
+ & .check-btn {
4254
+ border-radius: 8px;
4255
+ font-size: 1rem;
4256
+ }
4257
+
4258
+ & footer {
4259
+ border-top: 1px solid rgb(var(--edu-border) / 0.5);
4260
+ padding: 1.25rem;
4261
+ }
4262
+
4263
+ & .progress-bar {
4264
+ height: 4px;
4265
+ }
4266
+
4267
+ & .progress-bar::-webkit-progress-value {
4268
+ background: linear-gradient(90deg, rgb(var(--edu-first-accent)), rgb(var(--edu-first-accent) / 0.6));
4269
+ }
4270
+
4271
+ & .radio-nav label {
4272
+ font-family: georgia, serif;
4273
+ border: none;
4274
+ border-bottom: 2px solid transparent;
4275
+ background: transparent;
4276
+ padding: 0.5rem 1rem;
4277
+ }
4278
+
4279
+ & .radio-nav input:checked + label {
4280
+ color: rgb(var(--edu-first-accent));
4281
+ border-bottom: 2px solid rgb(var(--edu-first-accent));
4282
+ background: transparent;
4283
+ font-style: italic;
4284
+ }
4285
+
4286
+ & label {
4287
+ font-family: georgia, serif;
4288
+ padding: 0.5rem 1rem;
4289
+ }
4290
+ }
4291
+
4292
+ :host([variant="playful"]) {
4293
+ & .wrap {
4294
+ color: rgb(var(--edu-first-accent));
4295
+ border-radius: 14px;
4296
+ border: 2px dashed rgb(var(--edu-border));
4297
+ }
4298
+
4299
+ & .timer {
4300
+ font-weight: 700;
4301
+ font-size: 1.2rem;
4302
+ }
4303
+
4304
+ & .check-btn {
4305
+ border-radius: 12px;
4306
+ font-weight: 700;
4307
+ text-transform: uppercase;
4308
+ letter-spacing: 0.5px;
4309
+ }
4310
+
4311
+ & .check-btn:hover:not(:disabled) {
4312
+ transform: translateY(-2px) rotate(-1deg);
4313
+ }
4314
+
4315
+ & footer {
4316
+ border-top: 2px dashed rgb(var(--edu-border));
4317
+ }
4318
+
4319
+ & .progress-bar {
4320
+ height: 20px;
4321
+ }
4322
+
4323
+ & .progress-bar::-webkit-progress-bar {
4324
+ background-color: rgb(var(--edu-warning) / 0.3);
4325
+ border-radius: 20px;
4326
+ }
4327
+
4328
+ & .progress-bar::-webkit-progress-value {
4329
+ background: rgb(var(--edu-first-accent));
4330
+ border-radius: 20px;
4331
+ border: 3px solid rgb(var(--edu-warning) / 0.3);
4332
+ }
4333
+
4334
+ & .radio-nav label {
4335
+ background: rgb(var(--edu-muted));
4336
+ border-radius: 50px;
4337
+ font-weight: 700;
4338
+ }
4339
+
4340
+ & .radio-nav label:hover {
4341
+ transform: scale(1.1) rotate(-2deg);
4342
+ }
4343
+
4344
+ & .radio-nav input:checked + label {
4345
+ background: rgb(var(--edu-first-accent));
4346
+ color: rgb(var(--edu-inverted-ink));
4347
+ box-shadow: 0 5px 15px rgb(var(--edu-first-accent) / 0.4);
4348
+ }
4349
+ }
4350
+
4351
+ :host([variant="glass"]) {
4352
+ & .wrap {
4353
+ background: rgba(var(--edu-card), 0.7);
4354
+ backdrop-filter: blur(10px);
4355
+ border: 1px solid rgba(var(--edu-border), 0.35);
4356
+ border-radius: 12px;
4357
+ }
4358
+
4359
+ & .check-btn {
4360
+ background: rgba(var(--edu-first-accent), 0.9);
4361
+ backdrop-filter: blur(5px);
4362
+ border-radius: 10px;
4363
+ }
4364
+
4365
+ & .check-btn:hover:not(:disabled) {
4366
+ background: rgba(var(--edu-first-accent), 1);
4367
+ }
4368
+
4369
+ & footer {
4370
+ border-top: 1px solid rgba(var(--edu-border), 0.35);
4371
+ }
4372
+
4373
+ & .progress-bar::-webkit-progress-bar {
4374
+ background: rgba(var(--edu-card), 0.3);
4375
+ backdrop-filter: blur(5px);
4376
+ }
4377
+
4378
+ & .progress-bar::-webkit-progress-value {
4379
+ background: rgba(var(--edu-first-accent), 0.7);
4380
+ }
4381
+
4382
+ & .radio-nav label {
4383
+ background: rgba(var(--edu-card), 0.5);
4384
+ backdrop-filter: blur(5px);
4385
+ border: 1px solid rgba(var(--edu-border), 0.35);
4386
+ }
4387
+
4388
+ & .radio-nav input:checked + label {
4389
+ background: rgba(var(--edu-first-accent), 0.8);
4390
+ border-color: rgb(var(--edu-first-accent));
4391
+ }
4392
+ }
4393
+
4394
+ :host([variant="letter"]) {
4395
+ & .wrap {
4396
+ border: 1px solid rgb(var(--edu-border));
4397
+ font-family: georgia, serif;
4398
+ box-shadow: inset 0 0 0 1px rgba(var(--edu-shadow-color), 0.1);
4399
+ border-radius: 4px;
4400
+ }
4401
+
4402
+ & .timer {
4403
+ font-family: georgia, serif;
4404
+ letter-spacing: 0.5px;
4405
+ }
4406
+
4407
+ & .check-btn {
4408
+ font-family: georgia, serif;
4409
+ border-radius: 2px;
4410
+ font-size: 0.95rem;
4411
+ letter-spacing: 0.5px;
4412
+ }
4413
+
4414
+ & footer {
4415
+ border-top: 1px solid rgb(var(--edu-border));
4416
+ padding: 1rem 1.5rem;
4417
+ }
4418
+
4419
+ & .progress-bar::-webkit-progress-bar {
4420
+ background-color: rgb(var(--edu-muted));
4421
+ box-shadow: inset 0 0 0 1px rgba(var(--edu-shadow-color), 0.05);
4422
+ }
4423
+
4424
+ & .radio-nav label {
4425
+ width: 40px;
4426
+ height: 40px;
4427
+ display: flex;
4428
+ align-items: center;
4429
+ justify-content: center;
4430
+ padding: 0;
4431
+ background: rgb(var(--edu-third-ink));
4432
+ color: rgb(var(--edu-inverted-ink));
4433
+ font-weight: 900;
4434
+ border-radius: 4px;
4435
+ }
4436
+
4437
+ & .radio-nav input:checked + label {
4438
+ background: rgb(var(--edu-first-accent));
4439
+ transform: translateY(-4px);
4440
+ }
4441
+ }
4442
+
4443
+ :host([variant="sign"]) {
4444
+ & .wrap {
4445
+ border-radius: 6px;
4446
+ text-transform: uppercase;
4447
+ letter-spacing: 1px;
4448
+ border: 2px solid rgb(var(--edu-border));
4449
+ }
4450
+
4451
+ & .timer {
4452
+ text-transform: uppercase;
4453
+ letter-spacing: 1.5px;
4454
+ font-weight: 800;
4455
+ font-size: 0.9rem;
4456
+ }
4457
+
4458
+ & .check-btn {
4459
+ text-transform: uppercase;
4460
+ letter-spacing: 1.5px;
4461
+ font-weight: 800;
4462
+ font-size: 0.9rem;
4463
+ border-radius: 4px;
4464
+ margin: 0.85rem 2.5rem;
4465
+ }
4466
+
4467
+ & footer {
4468
+ border-top: 2px solid rgb(var(--edu-border));
4469
+ }
4470
+
4471
+ & .title {
4472
+ text-transform: uppercase;
4473
+ }
4474
+
4475
+ & .progress-bar {
4476
+ height: 24px;
4477
+ }
4478
+
4479
+ & .progress-bar::-webkit-progress-bar {
4480
+ background: rgb(var(--edu-third-ink));
4481
+ border: 2px solid rgb(var(--edu-third-ink));
4482
+ }
4483
+
4484
+ & .progress-bar::-webkit-progress-value {
4485
+ background: rgb(var(--edu-second-accent));
4486
+ }
4487
+
4488
+ & .radio-nav label {
4489
+ background: rgb(var(--edu-third-ink));
4490
+ color: rgb(var(--edu-second-accent));
4491
+ border-left: 4px solid rgb(var(--edu-second-accent));
4492
+ text-transform: uppercase;
4493
+ font-size: 0.8rem;
4494
+ font-weight: 700;
4495
+ }
4496
+
4497
+ & .radio-nav input:checked + label {
4498
+ background: rgb(var(--edu-second-accent));
4499
+ color: rgb(var(--edu-third-ink));
4500
+ border-left-color: rgb(var(--edu-third-ink));
4501
+ }
4502
+ }
4503
+
4504
+ :host([variant="outline"]) {
4505
+ & .wrap {
4506
+ color: rgb(var(--edu-inverted-ink));
4507
+ background: transparent;
4508
+ border-width: 0 1px 2px 1px;
4509
+ border-style: solid;
4510
+ border-color: rgb(var(--edu-first-accent));
4511
+ background: rgb(var(--edu-bg) / 0.1);
4512
+ }
4513
+
4514
+ & header { background: rgb(var(--edu-first-accent)); color: rgb(var(--edu-inverted-ink)) }
4515
+ & .timer { color: rgb(var(--edu-inverted-ink)) }
4516
+
4517
+ & footer {
4518
+ border-top: none;
4519
+ padding: 0;
4520
+ padding-left: 0.5rem;
4521
+ padding-right: 0.5rem;
4522
+ }
4523
+
4524
+ & .check-btn {
4525
+ font-size: 100%;
4526
+ font-weight: 700;
4527
+ border: none;
4528
+ border-radius: 0;
4529
+ border-top-left-radius: 10px;
4530
+ border-top-right-radius: 10px;
4531
+ color: rgb(var(--edu-inverted-ink));
4532
+ background: rgb(var(--edu-first-accent));
4533
+ margin: 0;
4534
+ padding: 1rem;
4535
+ text-transform: uppercase;
4536
+ }
4537
+
4538
+ & .check-btn:hover:not(:disabled) {
4539
+ background: rgb(var(--edu-first-accent) / 0.9);
4540
+ box-shadow: 0 4px 12px rgb(var(--edu-first-accent) / 0.3);
4541
+ transform: none;
4542
+ }
4543
+
4544
+ & .radio-nav label {
4545
+ border: 2px solid rgb(var(--edu-first-accent));
4546
+ border-radius: 0;
4547
+ background: transparent;
4548
+ color: rgb(var(--edu-ink));
4549
+ }
4550
+
4551
+ & .radio-nav label:hover {
4552
+ background: rgb(var(--edu-first-accent));
4553
+ color: rgb(var(--edu-inverted-ink));
4554
+ }
4555
+
4556
+ & .radio-nav input:checked + label {
4557
+ background: rgb(var(--edu-first-accent));
4558
+ color: rgb(var(--edu-inverted-ink));
4559
+ }
4560
+ }
4561
+
4562
+ :host([variant="card"]) {
4563
+ & .wrap {
4564
+ border-radius: 8px;
4565
+ box-shadow: 0 4px 12px rgba(var(--edu-shadow-color), 0.1), 0 2px 4px rgba(var(--edu-shadow-color), 0.05);
4566
+ }
4567
+
4568
+ & .check-btn {
4569
+ border-radius: 6px;
4570
+ box-shadow: 0 2px 4px rgba(var(--edu-shadow-color), 0.1);
4571
+ }
4572
+
4573
+ & .check-btn:hover:not(:disabled) {
4574
+ box-shadow: 0 4px 8px rgba(var(--edu-first-accent), 0.2);
4575
+ }
4576
+
4577
+ & footer {
4578
+ border-top: 1px solid rgb(var(--edu-border));
4579
+ }
4580
+
4581
+ & .radio-nav label {
4582
+ border-radius: 6px;
4583
+ box-shadow: 0 2px 4px rgba(var(--edu-shadow-color), 0.1);
4584
+ }
4585
+
4586
+ & .radio-nav input:checked + label {
4587
+ box-shadow: 0 4px 8px rgba(var(--edu-first-accent), 0.2);
4588
+ }
4589
+ }
4590
+ `;var pe=class extends HTMLElement{constructor(){super();this.soundManager=new H;this.animationsManager=new M;this.timerInterval=null;this.remainingSeconds=0;this.interactionComplete=!1;this.attemptCount=0;this.attemptLimit=null;this.currentScreen="interaction";this.attachShadow({mode:"open"});let t=document.createElement("style");t.textContent=ui,this.shadowRoot.append(t);let r=document.createElement("section");r.className="wrap",r.innerHTML=di,this.shadowRoot.append(r),M.injectKeyframes(this.shadowRoot),this.$headerEl=r.querySelector("header"),this.$footerEl=r.querySelector("footer"),this.$titleEl=r.querySelector(".title"),this.$promptBtn=r.querySelector(".prompt-btn"),this.$timerEl=r.querySelector(".timer"),this.$checkBtn=r.querySelector(".check-btn"),this.$scoresBtn=r.querySelector(".scores-btn"),this.$seeAnswersBtn=r.querySelector(".see-answers-btn"),this.$retryBtn=r.querySelector(".retry-btn"),this.$radioNav=r.querySelector(".radio-nav"),this.$progressContainer=r.querySelector(".progress-container"),this.$progressBar=r.querySelector(".progress-bar"),this.$progressIcon=r.querySelector(".progress-icon-wrapper"),this.$progressCounter=r.querySelector(".progress-counter"),this.$contentEl=r.querySelector('[part="content"]'),this.animationsManager.isEnabled=!0,this.$interactionScreen=r.querySelector('[data-screen="interaction"]'),this.$errorContent=r.querySelector(".error-content"),this.$attemptsMessage=r.querySelector(".attempts-message"),this.$scoreDisplay=r.querySelector(".score-display"),this.$timerDisplay=r.querySelector(".timer-display"),this.setupShellListeners()}static get observedAttributes(){return["show-header","show-footer"]}connectedCallback(){this.hasAttribute("show-header")||this.setAttribute("show-header","true"),this.hasAttribute("show-footer")||this.setAttribute("show-footer","true"),this.updateVisibility(),this.animationsManager.animate(this.$progressIcon,"heartbeat"),this.animationsManager.animate(this.$promptBtn,"wobble")}disconnectedCallback(){this.stopTimer(),this.removeInteractionListeners()}attributeChangedCallback(t,r,i){r!==i&&this.updateVisibility()}setInteraction(t){if(this.stopTimer(),!t.isValid){this.$errorContent.textContent=t.errors??"Error loading the interaction.",this.switchScreen("error");return}this.soundManager.playSound("start"),this.interaction&&(this.removeInteractionListeners(),this.$interactionScreen.innerHTML=""),this.interaction=t,this.interactionComplete=!1;let r=this.interaction.config;this.reset(),this.switchScreen("interaction");let i=r.variant??"elegant";this.setAttribute("variant",i),this.interaction.onVariantChange(i),this.$titleEl.textContent=r.prompt||"",r.promptData&&r.promptModality?(this.$titleEl.style.cursor="pointer",this.$titleEl.title="Click to view prompt details",this.$promptBtn.addEventListener("click",()=>this.openPromptDialog()),this.$titleEl.addEventListener("click",()=>this.openPromptDialog())):(this.$titleEl.style.cursor="",this.$titleEl.style.textDecoration="",this.$titleEl.title=""),r.timer!==null&&r.timer>30?(this.remainingSeconds=r.timer,this.$timerEl.classList.remove("edu-hidden"),this.updateTimerDisplay(),this.startTimer()):this.$timerEl.classList.add("edu-hidden"),this.attemptLimit=r.attemptLimit,this.attemptCount=0,this.interaction.interactionMechanic==="sequential"?(this.$radioNav.dataset.active="true",this.renderRadioNav()):this.$radioNav.dataset.active="false",this.interaction.implementsProgress?(this.$checkBtn.classList.add("edu-hidden"),this.$progressContainer.classList.remove("edu-hidden"),this.$progressCounter.textContent=`0/${this.interaction.progressTracker.total}`):(this.$progressContainer.classList.add("edu-hidden"),this.$checkBtn.classList.remove("edu-hidden")),this.setupInteractionListeners(),this.$interactionScreen.innerHTML="",this.$interactionScreen.appendChild(t)}removeInteraction(){this.interaction&&(this.removeInteractionListeners(),this.$interactionScreen.innerHTML="",this.interaction=void 0,this.interactionComplete=!1)}setupShellListeners(){this.$checkBtn.addEventListener("click",()=>{this.soundManager.playSound("pop");try{this.interaction.submit()}catch(t){console.error("Submit failed:",t)}}),this.$seeAnswersBtn.addEventListener("click",()=>{this.soundManager.playSound("pop"),this.currentScreen==="solution"?this.switchScreen("interaction"):this.switchScreen("solution")}),this.$scoresBtn.addEventListener("click",()=>{this.soundManager.playSound("pop"),this.currentScreen==="score"?this.switchScreen("interaction"):this.switchScreen("score")}),this.$timerEl.addEventListener("click",()=>{this.soundManager.playSound("pop"),this.$timerDisplay.append(this.$timerEl),this.currentScreen==="time"?(this.switchScreen("interaction"),this.$headerEl.append(this.$timerEl)):this.switchScreen("time")}),this.$retryBtn.addEventListener("click",()=>this.handleRetry()),this.$radioNav.addEventListener("change",t=>{let r=t.target;if(r.type==="radio"){let i=parseInt(r.id.replace("step-",""),10);this.interaction&&this.interaction.setSteps(i),this.dispatchEvent(new CustomEvent("navigation-change",{detail:{step:i},bubbles:!0,composed:!0}))}})}setupInteractionListeners(){this.interaction.addEventListener("interaction:ready",t=>{console.log("[Shell] Interaction ready:",t.detail.id)}),this.interaction.addEventListener("interaction:progress",t=>{let{current:r,total:i,percentage:o}=t.detail;this.updateProgress(r,i),r===i&&i>0?(this.interactionComplete=!0,this.$checkBtn.classList.remove("edu-hidden")):(this.interactionComplete=!1,this.interaction.implementsProgress&&this.$checkBtn.classList.add("edu-hidden"))}),this.interaction.addEventListener("interaction:complete",t=>{console.log("[Shell] Interaction complete:",t.detail),this.stopTimer(),this.handleCompletion(t.detail.state)}),this.interaction.addEventListener("interaction:graded",t=>{t.detail.result.score===100?(this.soundManager.playSound("success"),this.animationsManager.animate(this.$progressIcon,"spin-pulse")):(this.soundManager.playSound("failure"),this.animationsManager.animate(this.$progressIcon,"shake")),this.handleGraded(t.detail.result)}),this.interaction.addEventListener("interaction:hint-shown",t=>{console.log("[Shell] Hint shown:",t.detail.message)}),this.interaction.addEventListener("interaction:error",t=>{console.error("[Shell] Interaction error:",t.detail),alert(t.detail.message)})}removeInteractionListeners(){}updateProgress(t,r){this.$progressBar.max=r,this.$progressBar.value=t??0,this.$progressCounter.textContent=`${t}/${r}`;let i=r>0?t/r*100:0,a=this.$progressBar.offsetWidth*i/100-12;this.$progressIcon.style.left=`${Math.max(0,a)}px`}handleCompletion(t){this.dispatchEvent(new CustomEvent("shell:interaction-complete",{detail:{state:t},bubbles:!0,composed:!0})),console.log("[Shell] Interaction submitted with state:",t)}handleGraded(t){this.$checkBtn.classList.add("edu-hidden"),this.$seeAnswersBtn.classList.remove("edu-hidden"),this.$scoresBtn.classList.remove("edu-hidden"),this.$retryBtn.classList.remove("edu-hidden"),this.attemptLimit&&this.attemptCount>this.attemptLimit&&this.$retryBtn.classList.add("edu-hidden");let r=t.score;this.$scoreDisplay.innerHTML=`
4591
+ <div style="font-size: 4rem; font-weight: 700; color: ${r>=75?"rgb(var(--edu-success))":r>=50?"rgba(139, 195, 74)":r>=25?"rgb(var(--edu-warning))":"rgb(var(--edu-error))"}">${r}%</div>
4592
+ <div style="font-size: 1.5rem; margin-top: 1rem; color: rgb(var(--edu-second-ink));">
4593
+ ${r===100?"Perfect Score! \u{1F389}":r>=75?"Great Job!":r>=50?"Good Effort!":r>=25?"Keep Trying!":"Try Again!"}
4594
+ </div>
4595
+ `,this.$progressIcon.classList.remove("score-fail","score-low","score-mid","score-high"),this.$progressBar.classList.remove("score-fail","score-low","score-mid","score-high");let i="";r<=25?i="score-fail":r<=50?i="score-low":r<=75?i="score-mid":i="score-high",this.$progressIcon.classList.add(i),this.$progressBar.classList.add(i)}reset(){this.resetTimer(),this.interaction.implementsProgress||this.$checkBtn.classList.remove("edu-hidden"),this.$seeAnswersBtn.classList.add("edu-hidden"),this.$scoresBtn.classList.add("edu-hidden"),this.$retryBtn.classList.add("edu-hidden"),this.$progressIcon.classList.remove("score-fail","score-low","score-mid","score-high"),this.$progressBar.classList.remove("score-fail","score-low","score-mid","score-high"),this.animationsManager.animate(this.$progressIcon,"heartbeat"),this.$progressBar.value=0,this.updateProgress(0,this.interaction.progressTracker.total),this.interaction.interactionMechanic==="sequential"&&this.renderRadioNav()}handleRetry(){if(this.$retryBtn.classList.add("edu-hidden"),this.soundManager.playSound("pop"),this.attemptCount++,this.attemptLimit&&this.attemptLimit>0){let t=this.attemptLimit-this.attemptCount+1;this.$attemptsMessage.textContent=`${t} attempt${t!==1?"s":""} remaining`,this.switchScreen("attempts"),setTimeout(()=>{this.switchScreen("interaction"),this.reset(),this.resumeTimer(),this.interaction?.reset(),this.soundManager.playSound("flip")},2e3)}else this.switchScreen("interaction"),this.interaction?.reset()}openPromptDialog(){let t=this.interaction?.config;if(!t)return;this.soundManager.playSound("pop");let r=document.querySelector("edu-dialog#prompt-dialog");r||(r=document.createElement("edu-dialog"),r.id="prompt-dialog",document.body.appendChild(r)),r.title=t.construct||this.interaction?.config.promptModality||"Prompt";let i=document.createElement("edu-media");i.setAttribute("type",t.promptModality),i.setAttribute("data",t.promptData),t.promptDataSpec&&i.setAttribute("spec",t.promptDataSpec),r.innerHTML="",r.appendChild(i),r.open()}switchScreen(t){this.shadowRoot.querySelectorAll(".screen").forEach(r=>{let i=r.getAttribute("data-screen");r.style.display=i===t?"block":"none"}),this.currentScreen=t,console.log(`[Shell] Switched to screen: ${t}`)}startTimer(){this.timerInterval=window.setInterval(()=>{this.remainingSeconds--,this.updateTimerDisplay(),this.remainingSeconds<=0&&(this.stopTimer(),this.handleTimerComplete())},1e3)}stopTimer(){this.timerInterval!==null&&(clearInterval(this.timerInterval),this.timerInterval=null)}getFormattedTime(t){let r=Math.floor(t/60),i=t%60;return`${r}:${i.toString().padStart(2,"0")}`}updateTimerDisplay(){this.$timerEl.textContent=this.getFormattedTime(this.remainingSeconds),this.remainingSeconds===30&&(this.soundManager.playSound("low-time"),this.animationsManager.animate(this.$timerEl,"shake")),delete this.$timerEl.dataset.warning,delete this.$timerEl.dataset.danger,this.remainingSeconds<=10?this.$timerEl.dataset.danger="true":this.remainingSeconds<=30&&(this.$timerEl.dataset.warning="true")}handleTimerComplete(){console.log("[Shell] Timer complete");try{this.interaction.submit()}catch(t){console.error("Auto-submit on timer failed:",t)}this.dispatchEvent(new CustomEvent("shell:timer-complete",{bubbles:!0,composed:!0}))}pauseTimer(){this.stopTimer()}resumeTimer(){this.remainingSeconds>0&&this.timerInterval===null&&this.startTimer()}resetTimer(){this.stopTimer(),this.remainingSeconds=this.interaction.config.timer,this.updateTimerDisplay()}updateVisibility(){let t=this.getAttribute("show-header")!=="false",r=this.getAttribute("show-footer")!=="false";this.$headerEl.style.display=t?"":"none",this.$footerEl.style.display=r?"":"none"}renderRadioNav(){let t=this.interaction&&"slidesCount"in this.interaction?this.interaction.slidesCount:1;this.$radioNav.innerHTML="";for(let r=1;r<=t;r++){let i=document.createElement("input");i.type="radio",i.name="step-nav",i.id=`step-${r}`,r===1&&(i.checked=!0);let o=document.createElement("label");o.htmlFor=`step-${r}`,o.textContent=String(r),this.$radioNav.appendChild(i),this.$radioNav.appendChild(o)}}getContentArea(){return this.$contentEl}};customElements.get("edu-window")||customElements.define("edu-window",pe);Je();ze();export{_e as AdjacencyTable,xe as AssetValidationError,x as BaseInteraction,oe as CategorizeTheWords,$e as ClassificationMatrix,We as EduTable,Xe as EduText,ce as FillBlanks,pe as InteractionsBaseShell,te as ListRecall,Te as LookupTable,ee as MCQ,ie as MarkTheWords,Ae as NaryChoiceTable,ye as OpenClassification,ue as RankOrder,ae as SequentialCategorizeTheWords,Ee as SequentialClassification,de as SequentialFillBlanks,ne as SequentialMarkTheWords,le as SequentialTextTransformation,Ce as SimultaneousAssociation,se as TextTransformation,tl as adjacencyTableDataParser,ol as adjacencyTableDataValidator,Hr as adjacencyTableGrader,el as basicTableDataParser,nl as basicTableDataValidator,zr as classificationTableGrader,xa as clearInteractionRegistry,Se as compareValues,fi as configureCognikit,hi as createInteraction,Ke as detectCellKind,ze as ensureCognikitTheme,Gr as getAdjacencyCellGrading,Ye as getAllUniqueValues,ke as getAllValues,Re as getBlanksGradingState,Or as getClassificationCellGrading,Be as getClassificationGradingState,aa as getDNDGradingState,Le as getHighlightGradingState,pi as getInteraction,wa as getInteractionRegistry,Nr as getLookupCellGrading,Vr as getNaryCellGrading,vt as getTransformationGradingState,ya as listInteractions,rl as lookupTableDataParser,al as lookupTableDataValidator,qr as lookupTableGrader,Br as naryTableGrader,ia as parseTextEngineSequential,Fo as parseYamlAssets,Rr as recognitionGrader,Ls as recognitionParser,Rs as recognitionValidator,pa as registerBuiltInInteractions,C as registerInteraction,xt as seriationGrader,ua as seriationParser,da as seriationValidator,ti as textEngineBaseDataValidator,Xr as textEngineBaseGrammarParser,ri as textEngineBlanksDataValidator,De as textEngineBlanksGrader,Jr as textEngineBlanksGrammarParser,ii as textEngineClassificationDataValidator,Pe as textEngineClassificationGrader,ei as textEngineClassificationGrammarParser,oa as textEngineDNDGrader,na as textEngineDataValidator,Ie as textEngineHighlightGrader,Me as textEngineTransformationGrader,va as unregisterInteraction,jo as validateAndNormalizeAssets};
4596
+ /*! Bundled license information:
4597
+
4598
+ js-yaml/dist/js-yaml.mjs:
4599
+ (*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *)
4600
+ */
4601
+ //# sourceMappingURL=client.js.map