@pie-players/pie-assessment-toolkit 1.0.0-beta.1 → 1.0.0-beta.10

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 (141) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +18 -7
  3. package/custom-elements.json +51 -23
  4. package/dist/attempt/AssessmentSession.d.ts +7 -0
  5. package/dist/attempt/AssessmentSession.js +14 -0
  6. package/dist/attempt/TestSession.d.ts +7 -0
  7. package/dist/attempt/TestSession.js +3 -0
  8. package/dist/components/ItemScope.custom-element.js +1 -1
  9. package/dist/components/ItemToolBar.custom-element.js +1 -1
  10. package/dist/components/PieAssessmentToolkit.custom-element.js +45 -45
  11. package/dist/components/SectionToolBar.custom-element.js +1 -1
  12. package/dist/components/THIRD-PARTY-LICENSES.txt +42 -0
  13. package/dist/components/chunks/ItemToolBar-8qpnhyg4.js +40 -0
  14. package/dist/components/chunks/ItemToolBar-bsww9e8f.js +4 -0
  15. package/dist/components/chunks/ItemToolBar-eg8jarh0.js +2 -0
  16. package/dist/components/chunks/{ItemToolBar-66hcwmfw.js → ItemToolBar-gsb96731.js} +2 -2
  17. package/dist/components/chunks/ItemToolBar-na4e5vwt.js +2 -0
  18. package/dist/components/chunks/{ItemToolBar-kkj69ptr.js → ItemToolBar-wcw4yxjy.js} +1 -1
  19. package/dist/components/chunks/sre-engine-wazxma67.js +1 -0
  20. package/dist/components/element-contracts.d.ts +115 -0
  21. package/dist/components/element-contracts.js +1 -0
  22. package/dist/components/item-scope-element.d.ts +1 -1
  23. package/dist/components/item-scope-element.js +0 -1
  24. package/dist/components/item-toolbar-element.d.ts +1 -1
  25. package/dist/components/item-toolbar-element.js +0 -1
  26. package/dist/components/pie-assessment-toolkit-element.d.ts +1 -1
  27. package/dist/components/pie-assessment-toolkit-element.js +0 -1
  28. package/dist/components/section-toolbar-element.d.ts +1 -1
  29. package/dist/components/section-toolbar-element.js +0 -1
  30. package/dist/context/assessment-toolkit-context.d.ts +15 -1
  31. package/dist/index.d.ts +3 -3
  32. package/dist/index.js +2 -2
  33. package/dist/policy/core/ToolPolicyEngine.d.ts +8 -0
  34. package/dist/policy/core/ToolPolicyEngine.js +4 -2
  35. package/dist/policy/core/compose-decision.js +29 -0
  36. package/dist/policy/core/decision-types.d.ts +20 -0
  37. package/dist/policy/core/feature-decision.d.ts +8 -1
  38. package/dist/policy/core/feature-decision.js +9 -2
  39. package/dist/policy/core/provenance.d.ts +1 -1
  40. package/dist/policy/engine.d.ts +2 -1
  41. package/dist/policy/sources/PnpPolicySource.d.ts +44 -2
  42. package/dist/policy/sources/PnpPolicySource.js +80 -11
  43. package/dist/runtime/SectionControllerBinding.js +14 -6
  44. package/dist/runtime/content-language.js +31 -5
  45. package/dist/runtime/core/engine-resolver.d.ts +17 -0
  46. package/dist/runtime/item-feature-decisions.js +115 -0
  47. package/dist/runtime/registration-events.d.ts +31 -4
  48. package/dist/runtime/registration-events.js +20 -1
  49. package/dist/runtime/shell-event-bridge.d.ts +7 -1
  50. package/dist/runtime/shell-event-bridge.js +44 -1
  51. package/dist/runtime/shell-scope.d.ts +2 -2
  52. package/dist/runtime/shell-scope.js +14 -5
  53. package/dist/services/AccessibilityCatalogResolver.js +9 -5
  54. package/dist/services/HighlightCoordinator.js +54 -47
  55. package/dist/services/SSMLExtractor.js +8 -23
  56. package/dist/services/TTSService.d.ts +5 -3
  57. package/dist/services/TTSService.js +18 -6
  58. package/dist/services/ToolRegistry.d.ts +13 -5
  59. package/dist/services/ToolRegistry.js +10 -5
  60. package/dist/services/ToolkitCoordinator.d.ts +21 -47
  61. package/dist/services/ToolkitCoordinator.js +74 -289
  62. package/dist/services/interfaces.d.ts +10 -0
  63. package/dist/services/section-controller-types.d.ts +71 -20
  64. package/dist/services/support-conflicts.js +11 -0
  65. package/dist/services/tool-config-validation.d.ts +1 -1
  66. package/dist/services/tool-config-validation.js +8 -2
  67. package/dist/services/tool-context.js +94 -11
  68. package/dist/services/tool-icons.js +3 -0
  69. package/dist/services/tool-provider-defaults.js +20 -0
  70. package/dist/services/tool-providers/TTSToolProvider.d.ts +16 -1
  71. package/dist/services/tool-providers/TTSToolProvider.js +50 -32
  72. package/dist/services/toolbar-items.d.ts +1 -1
  73. package/dist/services/tts/browser-provider.js +3 -1
  74. package/dist/services/tts/math-control-names.js +42 -2
  75. package/dist/services/tts/tts-lifecycle.d.ts +142 -0
  76. package/dist/services/tts/tts-lifecycle.js +341 -0
  77. package/dist/tools/content-surfaces.d.ts +35 -0
  78. package/dist/tools/content-surfaces.js +35 -0
  79. package/dist/tools/registration.d.ts +2 -0
  80. package/dist/tools/registration.js +5 -0
  81. package/package.json +31 -23
  82. package/dist/components/chunks/ItemToolBar-3zrc4p3d.js +0 -4
  83. package/dist/components/chunks/ItemToolBar-asenkvx6.js +0 -40
  84. package/dist/components/chunks/ItemToolBar-hzc5wyjp.js +0 -2
  85. package/dist/components/chunks/ItemToolBar-vdkyn9f3.js +0 -2
  86. package/dist/components/chunks/sre-engine-bj997w4b.js +0 -1
  87. package/dist/policy/core/compose-decision.d.ts +0 -58
  88. package/dist/policy/core/pnp-policy-inputs.d.ts +0 -60
  89. package/dist/policy/core/tool-parameters.d.ts +0 -12
  90. package/dist/runtime/RuntimeRegistry.d.ts +0 -12
  91. package/dist/runtime/SectionControllerBinding.d.ts +0 -283
  92. package/dist/runtime/adapter/SectionEngineAdapter.d.ts +0 -82
  93. package/dist/runtime/adapter/dom-event-bridge.d.ts +0 -47
  94. package/dist/runtime/composition-emit-scheduler.d.ts +0 -72
  95. package/dist/runtime/content-language.d.ts +0 -32
  96. package/dist/runtime/content-registration.d.ts +0 -13
  97. package/dist/runtime/core/SectionEngineCore.d.ts +0 -49
  98. package/dist/runtime/core/engine-transition.d.ts +0 -43
  99. package/dist/runtime/page-warnings.d.ts +0 -13
  100. package/dist/runtime/policy-input-forwarding.d.ts +0 -25
  101. package/dist/runtime/runtime-event-claim.d.ts +0 -8
  102. package/dist/runtime/runtime-id.d.ts +0 -7
  103. package/dist/runtime/session-event-emitter-policy.d.ts +0 -11
  104. package/dist/runtime/shell-registration.d.ts +0 -73
  105. package/dist/runtime/unclaimed-registration-watch.d.ts +0 -7
  106. package/dist/services/section-session-assignment.d.ts +0 -21
  107. package/dist/services/spoken-audio-cards.d.ts +0 -50
  108. package/dist/services/tool-config-defaults.d.ts +0 -15
  109. package/dist/services/toolbar-decided-tools.d.ts +0 -17
  110. package/dist/services/tts/catalog-span-alignment.d.ts +0 -24
  111. package/dist/services/tts/generated-speech/assemble-plan.d.ts +0 -35
  112. package/dist/services/tts/generated-speech/dom/build-dom-plan.d.ts +0 -27
  113. package/dist/services/tts/generated-speech/dom/to-chunk-inputs.d.ts +0 -19
  114. package/dist/services/tts/generated-speech/dom/types.d.ts +0 -37
  115. package/dist/services/tts/generated-speech/index.d.ts +0 -17
  116. package/dist/services/tts/generated-speech/math-speech-cache.d.ts +0 -17
  117. package/dist/services/tts/generated-speech/types.d.ts +0 -92
  118. package/dist/services/tts/highlight-pipeline/boundary-normalizer.d.ts +0 -2
  119. package/dist/services/tts/highlight-pipeline/create-highlight-plan.d.ts +0 -6
  120. package/dist/services/tts/highlight-pipeline/highlight-policy.d.ts +0 -2
  121. package/dist/services/tts/highlight-pipeline/index.d.ts +0 -9
  122. package/dist/services/tts/highlight-pipeline/math-semantic-resolver.d.ts +0 -3
  123. package/dist/services/tts/highlight-pipeline/normalize-speech-chunks.d.ts +0 -29
  124. package/dist/services/tts/highlight-pipeline/prose-boundary-resolver.d.ts +0 -2
  125. package/dist/services/tts/highlight-pipeline/readable-region.d.ts +0 -1
  126. package/dist/services/tts/highlight-pipeline/rendered-math-target-resolver.d.ts +0 -6
  127. package/dist/services/tts/highlight-pipeline/types.d.ts +0 -77
  128. package/dist/services/tts/highlight-pipeline/visible-map-range.d.ts +0 -14
  129. package/dist/services/tts/math-alignment/index.d.ts +0 -25
  130. package/dist/services/tts/math-alignment/mathml-tokenizer.d.ts +0 -2
  131. package/dist/services/tts/math-alignment/range-resolver.d.ts +0 -10
  132. package/dist/services/tts/math-alignment/sequence-aligner.d.ts +0 -7
  133. package/dist/services/tts/math-alignment/speech-tokenizer.d.ts +0 -39
  134. package/dist/services/tts/math-alignment/types.d.ts +0 -60
  135. package/dist/services/tts/math-control-names.d.ts +0 -21
  136. package/dist/services/tts/mathml-sanitization.d.ts +0 -8
  137. package/dist/services/tts/sre-engine.d.ts +0 -7
  138. package/dist/services/tts/sre-locales.d.ts +0 -14
  139. package/dist/services/tts/ssml/spoken-text.d.ts +0 -9
  140. package/dist/services/tts/text-segmentation.d.ts +0 -21
  141. package/dist/utils/structural-equality.d.ts +0 -11
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 PIE Framework contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -151,7 +151,13 @@ string and boolean attributes are `assessment-id`, `section-id`, `attempt-id`,
151
151
  - Runtime config on section-player custom elements: `runtime`
152
152
  - Toolkit-only object properties: `tools`, `toolRegistry`, `coordinator`,
153
153
  `accessibility`
154
- - Interface: `nds-icons`, `locale`
154
+ - Interface: `nds-icons`, `locale`. Once a host chose a locale — set
155
+ `locale`, or supplied an `i18n` provider asked for a locale other than
156
+ `en-US` — the toolkit stamps the served locale's `lang` and `dir` on its own
157
+ host element, never on the document, and answers `interfaceLocaleContext`
158
+ (`@pie-players/pie-context`) for the PIE elements inside it, as
159
+ `{ locale, direction }` with the requested tag. Until then it stamps
160
+ nothing and leaves the request unanswered
155
161
  - Diagnostics: `tool-config-strictness`, and `debug` on the section-player layouts. Framework-error
156
162
  delivery is via the `onFrameworkError` callback (a toolkit property,
157
163
  `runtime.onFrameworkError` on a section player) and the
@@ -538,8 +544,9 @@ tools: {
538
544
  calculator
539
545
  - **Annotation toolbar** (`annotationToolbar`): highlights and annotates
540
546
  selected text; it opens from a text selection, outside the toolbars
541
- - **Line reader** (`lineReader`), **ruler** (`ruler`), **protractor**
542
- (`protractor`), **graph** (`graph`) and **periodic table** (`periodicTable`)
547
+ - **Line reader** (`lineReader`), **magnifier** (`magnification`), **ruler**
548
+ (`ruler`), **protractor** (`protractor`), **graph** (`graph`) and **periodic
549
+ table** (`periodicTable`)
543
550
  - **Dictionaries** (`dictionary`, `pictureDictionary`, `dictionarySpanish`,
544
551
  `pictureDictionarySpanish`)
545
552
 
@@ -575,6 +582,7 @@ tools: {
575
582
  - **Protractor** (`protractor`): angle measurement
576
583
  - **Ruler** (`ruler`): linear measurement (metric and imperial)
577
584
  - **Line reader** (`lineReader`): reading guide and masking overlay
585
+ - **Magnifier** (`magnification`): movable magnifying lens
578
586
  - **Dictionaries** (`dictionary`, `pictureDictionary`, `dictionarySpanish`,
579
587
  `pictureDictionarySpanish`)
580
588
  - **The color-scheme tool** (`theme`): high-contrast color schemes; it also
@@ -668,9 +676,12 @@ providers: {
668
676
  }
669
677
  ```
670
678
 
671
- Select the bundled open-source implementation in the same way. It uses no API
672
- key or runtime network request and supports basic, scientific, and focused
673
- graphing modes:
679
+ The bundled open-source implementation uses no API key or runtime network
680
+ request and supports basic, scientific, and focused graphing modes. It is
681
+ outside the packaged set, so the host first adds it with
682
+ `createCalculatorToolRegistration`
683
+ ([Adding a backend](../default-tool-loaders/README.md#adding-a-backend)) and then
684
+ selects it in the same way:
674
685
 
675
686
  ```typescript
676
687
  providers: {
@@ -922,7 +933,7 @@ export interface ToolkitCoordinatorConfig {
922
933
  calculator?: {
923
934
  enabled?: boolean;
924
935
  provider?: {
925
- id?: 'calculator-desmos' | 'calculator-geogebra' | 'calculator-cortex';
936
+ id?: string; // 'calculator-desmos' (default), 'calculator-geogebra', or a composed-in backend
926
937
  init?: Record<string, unknown>;
927
938
  runtime?: {
928
939
  authFetcher?: () => Promise<Record<string, unknown>>;
@@ -70,7 +70,7 @@
70
70
  "kind": "field",
71
71
  "name": "item",
72
72
  "type": {
73
- "text": "object"
73
+ "text": "unknown"
74
74
  },
75
75
  "default": "null",
76
76
  "attribute": "item"
@@ -137,7 +137,7 @@
137
137
  {
138
138
  "name": "item",
139
139
  "type": {
140
- "text": "object"
140
+ "text": "unknown"
141
141
  },
142
142
  "default": "null",
143
143
  "fieldName": "item"
@@ -173,6 +173,13 @@
173
173
  },
174
174
  "description": "In a toolkit that holds a section, when the item player reports a response change; the player's own `session-changed` stops at the scope."
175
175
  },
176
+ {
177
+ "name": "item-player-event",
178
+ "type": {
179
+ "text": "CustomEvent<{ itemId: string; canonicalItemId: string; type: \"load-complete\" | \"player-error\" | \"correct-responses-populated\" | \"bundle-retry-status\" | \"session-snapshot-available\" | \"backend-load-complete\" | \"backend-model-complete\" | \"backend-session-saved\" | \"backend-score-complete\" | \"backend-error\"; detail: unknown }>"
180
+ },
181
+ "description": "In a toolkit that holds a section, when the item player fires one of these events, carrying its detail; `load-complete` and `player-error` still stop at the scope."
182
+ },
176
183
  {
177
184
  "name": "pie-item-session-changed",
178
185
  "type": {
@@ -295,7 +302,7 @@
295
302
  "kind": "field",
296
303
  "name": "position",
297
304
  "type": {
298
- "text": "'top' | 'right' | 'bottom' | 'left' | 'none'"
305
+ "text": "\"top\" | \"right\" | \"bottom\" | \"left\" | \"none\""
299
306
  },
300
307
  "default": "'bottom'",
301
308
  "attribute": "position"
@@ -344,13 +351,14 @@
344
351
  "text": "string"
345
352
  },
346
353
  "default": "''",
354
+ "description": "Svelte-side only; the element has no `class` property.",
347
355
  "attribute": "class"
348
356
  },
349
357
  {
350
358
  "kind": "field",
351
359
  "name": "size",
352
360
  "type": {
353
- "text": "'sm' | 'md' | 'lg'"
361
+ "text": "\"sm\" | \"md\" | \"lg\""
354
362
  },
355
363
  "default": "'md'",
356
364
  "attribute": "size"
@@ -470,6 +478,7 @@
470
478
  "text": "string"
471
479
  },
472
480
  "default": "''",
481
+ "description": "Svelte-side only; the element has no `class` property.",
473
482
  "fieldName": "class"
474
483
  },
475
484
  {
@@ -534,7 +543,7 @@
534
543
  "kind": "field",
535
544
  "name": "section",
536
545
  "type": {
537
- "text": "object"
546
+ "text": "AssessmentSection | null"
538
547
  },
539
548
  "default": "null",
540
549
  "attribute": "section"
@@ -561,7 +570,7 @@
561
570
  "kind": "field",
562
571
  "name": "env",
563
572
  "type": {
564
- "text": "object"
573
+ "text": "{ mode?: string; role?: string } & Record<string, unknown>"
565
574
  },
566
575
  "default": "{}",
567
576
  "attribute": "env"
@@ -573,7 +582,7 @@
573
582
  "text": "boolean"
574
583
  },
575
584
  "default": "false",
576
- "description": "Presentation flag surfaced onto the runtime context. Consumers render the vendored <nds-icon-button> only when this is explicitly `true`; otherwise they use plain <button>s. Defaults to `false` (opt-in).",
585
+ "description": "Presentation flag surfaced onto the runtime context. Consumers render the vendored <pie-nds-icon-button> only when this is explicitly `true`; otherwise they use plain <button>s. Defaults to `false` (opt-in).",
577
586
  "attribute": "nds-icons"
578
587
  },
579
588
  {
@@ -586,6 +595,16 @@
586
595
  "description": "Interface locale, published onto the runtime context so every tool resolves the same provider. `type: \"String\"` because hosts pass attribute values as strings and a BCP-47 tag is one; POSIX (`nl_NL`) and bare (`nl`) forms both resolve.",
587
596
  "attribute": "locale"
588
597
  },
598
+ {
599
+ "kind": "field",
600
+ "name": "i18n",
601
+ "type": {
602
+ "text": "I18nProvider | null"
603
+ },
604
+ "default": "null",
605
+ "description": "The interface-locale provider a host composes, published onto the runtime context in place of the one built here: the generated locale tier, host messages, or a provider of the host's own. JS-only, since it carries loaders. `locale` above still names the locale; a supplied provider is driven only by it.",
606
+ "attribute": "i18n"
607
+ },
589
608
  {
590
609
  "kind": "field",
591
610
  "name": "contentLanguage",
@@ -618,7 +637,7 @@
618
637
  "kind": "field",
619
638
  "name": "tools",
620
639
  "type": {
621
- "text": "object"
640
+ "text": "ToolkitCoordinatorConfig[\"tools\"]"
622
641
  },
623
642
  "default": "{}",
624
643
  "attribute": "tools"
@@ -627,7 +646,7 @@
627
646
  "kind": "field",
628
647
  "name": "toolContextResolvers",
629
648
  "type": {
630
- "text": "Record<string, unknown> | null"
649
+ "text": "ToolkitCoordinatorConfig[\"toolContextResolvers\"] | null"
631
650
  },
632
651
  "default": "null",
633
652
  "attribute": "toolcontextresolvers"
@@ -654,7 +673,7 @@
654
673
  "kind": "field",
655
674
  "name": "accessibility",
656
675
  "type": {
657
- "text": "object"
676
+ "text": "ToolkitCoordinatorConfig[\"accessibility\"]"
658
677
  },
659
678
  "default": "{}",
660
679
  "attribute": "accessibility"
@@ -690,7 +709,7 @@
690
709
  "kind": "field",
691
710
  "name": "createSectionController",
692
711
  "type": {
693
- "text": "null | (() => unknown)"
712
+ "text": "(() => unknown) | null"
694
713
  },
695
714
  "default": "null",
696
715
  "attribute": "createsectioncontroller"
@@ -699,7 +718,7 @@
699
718
  "kind": "field",
700
719
  "name": "onFrameworkError",
701
720
  "type": {
702
- "text": "null | ((errorModel: FrameworkErrorModel) => void)"
721
+ "text": "((errorModel: FrameworkErrorModel) => void) | null"
703
722
  },
704
723
  "default": "null",
705
724
  "attribute": "onframeworkerror"
@@ -708,7 +727,7 @@
708
727
  "kind": "field",
709
728
  "name": "errorRenderer",
710
729
  "type": {
711
- "text": "null | ((errorModel: FrameworkErrorModel) => { title?: string; details?: string[]; })"
730
+ "text": "((errorModel: FrameworkErrorModel) => { title?: string; details?: string[] }) | null"
712
731
  },
713
732
  "default": "null",
714
733
  "attribute": "errorrenderer"
@@ -727,7 +746,7 @@
727
746
  "kind": "field",
728
747
  "name": "isolation",
729
748
  "type": {
730
- "text": "string"
749
+ "text": "\"inherit\" | \"force\""
731
750
  },
732
751
  "default": "\"inherit\"",
733
752
  "description": "`\"inherit\"` (the default) or `\"force\"`, as an attribute or a property; section-player layouts set the property from `runtime.isolation`. `type: \"String\"` because an observed attribute of type `Object` is JSON-parsed, and `isolation=\"force\"` would throw.",
@@ -835,7 +854,7 @@
835
854
  {
836
855
  "name": "section",
837
856
  "type": {
838
- "text": "object"
857
+ "text": "AssessmentSection | null"
839
858
  },
840
859
  "default": "null",
841
860
  "fieldName": "section"
@@ -859,7 +878,7 @@
859
878
  {
860
879
  "name": "env",
861
880
  "type": {
862
- "text": "object"
881
+ "text": "{ mode?: string; role?: string } & Record<string, unknown>"
863
882
  },
864
883
  "default": "{}",
865
884
  "fieldName": "env"
@@ -870,7 +889,7 @@
870
889
  "text": "boolean"
871
890
  },
872
891
  "default": "false",
873
- "description": "Presentation flag surfaced onto the runtime context. Consumers render the vendored <nds-icon-button> only when this is explicitly `true`; otherwise they use plain <button>s. Defaults to `false` (opt-in).",
892
+ "description": "Presentation flag surfaced onto the runtime context. Consumers render the vendored <pie-nds-icon-button> only when this is explicitly `true`; otherwise they use plain <button>s. Defaults to `false` (opt-in).",
874
893
  "fieldName": "ndsIcons"
875
894
  },
876
895
  {
@@ -882,6 +901,15 @@
882
901
  "description": "Interface locale, published onto the runtime context so every tool resolves the same provider. `type: \"String\"` because hosts pass attribute values as strings and a BCP-47 tag is one; POSIX (`nl_NL`) and bare (`nl`) forms both resolve.",
883
902
  "fieldName": "locale"
884
903
  },
904
+ {
905
+ "name": "i18n",
906
+ "type": {
907
+ "text": "I18nProvider | null"
908
+ },
909
+ "default": "null",
910
+ "description": "The interface-locale provider a host composes, published onto the runtime context in place of the one built here: the generated locale tier, host messages, or a provider of the host's own. JS-only, since it carries loaders. `locale` above still names the locale; a supplied provider is driven only by it.",
911
+ "fieldName": "i18n"
912
+ },
885
913
  {
886
914
  "name": "content-language",
887
915
  "type": {
@@ -910,7 +938,7 @@
910
938
  {
911
939
  "name": "tools",
912
940
  "type": {
913
- "text": "object"
941
+ "text": "ToolkitCoordinatorConfig[\"tools\"]"
914
942
  },
915
943
  "default": "{}",
916
944
  "fieldName": "tools"
@@ -918,7 +946,7 @@
918
946
  {
919
947
  "name": "toolcontextresolvers",
920
948
  "type": {
921
- "text": "Record<string, unknown> | null"
949
+ "text": "ToolkitCoordinatorConfig[\"toolContextResolvers\"] | null"
922
950
  },
923
951
  "default": "null",
924
952
  "fieldName": "toolContextResolvers"
@@ -942,7 +970,7 @@
942
970
  {
943
971
  "name": "accessibility",
944
972
  "type": {
945
- "text": "object"
973
+ "text": "ToolkitCoordinatorConfig[\"accessibility\"]"
946
974
  },
947
975
  "default": "{}",
948
976
  "fieldName": "accessibility"
@@ -974,7 +1002,7 @@
974
1002
  {
975
1003
  "name": "createsectioncontroller",
976
1004
  "type": {
977
- "text": "null | (() => unknown)"
1005
+ "text": "(() => unknown) | null"
978
1006
  },
979
1007
  "default": "null",
980
1008
  "fieldName": "createSectionController"
@@ -982,7 +1010,7 @@
982
1010
  {
983
1011
  "name": "onframeworkerror",
984
1012
  "type": {
985
- "text": "null | ((errorModel: FrameworkErrorModel) => void)"
1013
+ "text": "((errorModel: FrameworkErrorModel) => void) | null"
986
1014
  },
987
1015
  "default": "null",
988
1016
  "fieldName": "onFrameworkError"
@@ -990,7 +1018,7 @@
990
1018
  {
991
1019
  "name": "errorrenderer",
992
1020
  "type": {
993
- "text": "null | ((errorModel: FrameworkErrorModel) => { title?: string; details?: string[]; })"
1021
+ "text": "((errorModel: FrameworkErrorModel) => { title?: string; details?: string[] }) | null"
994
1022
  },
995
1023
  "default": "null",
996
1024
  "fieldName": "errorRenderer"
@@ -19,3 +19,10 @@ export declare function setCurrentSectionPosition(session: AssessmentSession, ar
19
19
  currentSectionIndex: number;
20
20
  currentSectionIdentifier?: string;
21
21
  }): AssessmentSession;
22
+ /**
23
+ * Marks the administration submitted: stamps `completedAt` on the first submit
24
+ * and refreshes `updatedAt`. A repeated submit keeps the first timestamp, so a
25
+ * host that calls `submit()` twice, or resumes an already-submitted session,
26
+ * does not move the completion time.
27
+ */
28
+ export declare function markAssessmentSessionSubmitted(session: AssessmentSession): AssessmentSession;
@@ -57,3 +57,17 @@ export function setCurrentSectionPosition(session, args) {
57
57
  },
58
58
  };
59
59
  }
60
+ /**
61
+ * Marks the administration submitted: stamps `completedAt` on the first submit
62
+ * and refreshes `updatedAt`. A repeated submit keeps the first timestamp, so a
63
+ * host that calls `submit()` twice, or resumes an already-submitted session,
64
+ * does not move the completion time.
65
+ */
66
+ export function markAssessmentSessionSubmitted(session) {
67
+ const at = nowIso();
68
+ return {
69
+ ...session,
70
+ updatedAt: at,
71
+ completedAt: session.completedAt ?? at,
72
+ };
73
+ }
@@ -1,3 +1,4 @@
1
+ import type { ServedContentIdentity } from "@pie-players/pie-players-shared/types";
1
2
  export interface TestAttemptSessionNavigationState {
2
3
  currentItemIndex: number;
3
4
  visitedItemIdentifiers: string[];
@@ -29,6 +30,11 @@ export interface TestAttemptItemSession {
29
30
  updatedAt?: string;
30
31
  completedAt?: string;
31
32
  session?: unknown;
33
+ /**
34
+ * The content version this item was delivered as, and its language. Present
35
+ * when the item declares a language or a backend reported what it served.
36
+ */
37
+ content?: ServedContentIdentity;
32
38
  }
33
39
  export interface TestAttemptSession {
34
40
  version: 1;
@@ -67,5 +73,6 @@ export declare function upsertItemSessionFromPieSessionChange(session: TestAttem
67
73
  pieSessionId: string;
68
74
  isCompleted?: boolean;
69
75
  session?: unknown;
76
+ content?: ServedContentIdentity;
70
77
  }): TestAttemptSession;
71
78
  export declare function toItemSessionsRecord(testAttemptSession: TestAttemptSession): Record<string, unknown>;
@@ -70,6 +70,9 @@ export function upsertItemSessionFromPieSessionChange(session, args) {
70
70
  updatedAt: now,
71
71
  completedAt: completed ? existing?.completedAt || now : undefined,
72
72
  session: args.session ?? existing?.session,
73
+ ...(args.content || existing?.content
74
+ ? { content: args.content ?? existing?.content }
75
+ : {}),
73
76
  };
74
77
  return {
75
78
  ...session,
@@ -1 +1 @@
1
- import{a as b,b as m,c as y,d as v,e as D,f as $,k as T}from"./chunks/ItemToolBar-vdkyn9f3.js";import{$ as YJ,A as e,D as JJ,F as QJ,G as I,I as H,M as ZJ,O as XJ,U as qJ,V as WJ,aa as L,ba as UJ,ea as d,fa as o,ga as C,ja as _,ka as g,la as MJ,ma as u,v as n,w as a,x as i,y as k,z as t}from"./chunks/ItemToolBar-3zrc4p3d.js";import"./chunks/ItemToolBar-kkj69ptr.js";import{commitPendingSessions as zJ,createPieLogger as KJ,normalizeItemSessionChange as xJ}from"@pie-players/pie-players-shared";function OJ(Q){let J=Q&&typeof Q==="object"?{...Q}:Q;if(J&&typeof J==="object")delete J.timestamp,delete J.sourceRuntimeId;try{return JSON.stringify(J)}catch{return String(J)}}var wJ=(Q)=>Boolean(Q&&typeof Q==="object"&&Q.sessionCommitReason);function h(Q){let{host:J,kind:Z,identity:W,mode:j,send:Y}=Q,U=KJ(J.localName||"pie-shell",()=>!1),z="",x=(B)=>{let{itemId:M,canonicalItemId:K}=W();if(!M)return;Y(y,{itemId:M,session:B});let X=xJ({itemId:M,sessionDetail:B});if(X.intent==="metadata-only"||!X.session)return;let q={itemId:M,canonicalItemId:K||M,session:X.session,...X.sessionCommitReason?{sessionCommitReason:X.sessionCommitReason}:{}};C(J,v,q)},O=(B)=>{if(j()!=="section")return;if(B.stopPropagation(),Z!=="item")return;let M=B.detail,K=OJ(M);if(!wJ(M)&&K===z)return;z=K,x(M)},w=(B)=>{if(j()==="section")B.stopPropagation();let{itemId:M,canonicalItemId:K,contentKind:G}=W();if(!M)return;let X={itemId:M,canonicalItemId:K||M,contentKind:G,detail:B.detail};Y(D,X)},A=(B)=>{if(j()==="section")B.stopPropagation();let{itemId:M,canonicalItemId:K,contentKind:G}=W();if(!M)return;let X={itemId:M,canonicalItemId:K||M,contentKind:G,error:B.detail};Y($,X)};return J.addEventListener("session-changed",O),J.addEventListener("load-complete",w),J.addEventListener("player-error",A),{disconnect:()=>{try{if(Z==="item"&&j()==="section")zJ(J,{reason:"teardown",logger:U})}finally{J.removeEventListener("session-changed",O),J.removeEventListener("load-complete",w),J.removeEventListener("player-error",A)}}}}import{ContextProvider as GJ}from"@pie-players/pie-context";function AJ(Q,J){return Q.kind===J.kind&&Q.host===J.host&&Q.itemId===J.itemId&&Q.canonicalItemId===J.canonicalItemId&&Q.contentKind===J.contentKind&&u(Q.settings,J.settings)}function p(Q){return T(Q.item,Q.kind)}function E(Q,J){return Q.isConnected||!J?Q:J.eventTarget}function N(Q,J,Z){let W={kind:J.kind,itemId:J.itemId,canonicalItemId:J.canonicalItemId,contentKind:J.contentKind,item:J.item,...J.settings?{settings:J.settings}:{},element:J.host,...Z?{runtimeId:Z.runtimeId}:{}};C(E(J.host,Z),Q,W)}function c(){let Q=null,J=null,Z;function W(){let Y=Q;if(!Y)return;let U=Z;Q=null,J=null,Z=void 0,N(m,Y,U)}function j(Y,U){if(!Y){W();return}if(Q&&Z?.runtimeId!==U?.runtimeId)W();if(Q&&AJ(Q,Y)){if(Q.item===Y.item)return;let z=p(Y);if(z!==null&&z===J){Q=Y;return}Q=Y,J=z,N(b,Y,U);return}Q=Y,J=p(Y),Z=U,N(b,Y,U)}return{sync:j,retire:W}}var fJ=50;function l(Q,J,Z){let W=new GJ(Q,{context:J,initialValue:Z});return W.connect(),{provider:W,value:Z}}function r(Q,J,Z){if(Z(Q.value,J))return;Q.value=J,Q.provider.setValue(J)}var kJ=(Q,J,Z)=>{if(Q===J)return!0;if(!Q||!J)return!1;if(Q.id!==J.id)return!1;let W=T(Q,Z);return W!==null&&W===T(J,Z)},LJ=(Q,J)=>Q.kind===J.kind&&Q.itemId===J.itemId&&Q.canonicalItemId===J.canonicalItemId&&Q.contentKind===J.contentKind&&Q.regionPolicy===J.regionPolicy&&Q.scopeElement===J.scopeElement&&kJ(Q.item,J.item,Q.kind),FJ=(Q,J)=>Q.scopeElement===J.scopeElement&&Q.ttsHighlightTargetResolver===J.ttsHighlightTargetResolver,S=(Q,J,Z)=>{if(Q.getAttribute(J)!==Z)Q.setAttribute(J,Z)};function s(){let Q=c(),J=Date.now(),Z=null,W=null,j=null,Y=null,U=null,z=null,x=[],O=null,w=()=>{if(U!==null)Q.sync(z,U)},A=(X,q)=>X.isConnected&&q.eventTarget.isConnected===!1;function B(X,q){if(X===D)O=q;if(Z&&U!==null&&!A(Z,U)){C(E(Z,U),X,{...q,runtimeId:U.runtimeId});return}if(x.push({type:X,detail:q}),x.length>fJ)x.shift()}function M(X){let q=U!==null&&X.runtimeId!==U.runtimeId;if(X.runtimeId!==U?.runtimeId)U={runtimeId:X.runtimeId,eventTarget:X.eventTarget},w();let F=x;x=[];for(let f of F)B(f.type,f.detail);let V=F.some((f)=>f.type===D);if(q&&O&&!V)B(D,O)}function K(){for(let X of[W,j])X?.provider.disconnect();Y?.(),Y=null,U=null,x=[],O=null,z=null,W=null,j=null,Z=null}function G(X){if(!X){Q.sync(null),K();return}if(X.host!==Z)K();Z=X.host;let q=X.canonicalItemId||X.itemId,F=X.regionPolicy||"default",V=X.scopeElement||X.host,f={kind:X.kind,itemId:X.itemId,canonicalItemId:q,contentKind:X.contentKind,regionPolicy:F,scopeElement:V,item:X.item??null,contextVersion:J};if(W)r(W,f,LJ);else W=l(Z,d,f);let R={scopeElement:V,ttsHighlightTargetResolver:X.ttsHighlightTargetResolver??null};if(j)r(j,R,FJ);else j=l(Z,o,R);S(Z,"data-item-id",X.itemId),S(Z,"data-canonical-item-id",q),S(Z,"data-pie-shell-root",X.kind),S(Z,"data-region-policy",F);let P=z;if(z=X.itemId?{kind:X.kind,host:Z,itemId:X.itemId,canonicalItemId:q,contentKind:X.contentKind,item:X.item??null,settings:X.settings??null}:null,P&&(P.itemId!==z?.itemId||P.canonicalItemId!==z?.canonicalItemId))O=null;Y??=_(Z,M),w()}return{publish:G,retire:Q.retire,disconnect:K,send:B}}var VJ=(Q,J)=>{if(customElements.get(Q))return;try{customElements.define(Q,J)}catch(Z){if(!(Z instanceof DOMException&&Z.name==="NotSupportedError"||Z&&typeof Z==="object"&&Z.name==="NotSupportedError")||!customElements.get(Q))throw Z}},HJ=ZJ('<div class="pie-item-scope-anchor svelte-980v5l" aria-hidden="true"></div> <!>',1),CJ={hash:"svelte-980v5l",code:".pie-item-scope-anchor.svelte-980v5l {display:none;}"};function BJ(Q,J){n(J,!0),WJ(Q,CJ);let Z=L(J,"itemId",7,""),W=L(J,"canonicalItemId",7,""),j=L(J,"contentKind",7,"assessment-item"),Y=L(J,"regionPolicy",7,"default"),U=L(J,"scopeElement",7,null),z=L(J,"ttsHighlightTargetResolver",7,null),x=L(J,"item",7,null),O=L(J,"settings",7,null),w=t(null),A=i(()=>{let q=H(w)?.getRootNode();return q instanceof ShadowRoot?q.host:null}),B=s();I(()=>{if(!H(A))return;let q=H(A),F=!1,V=!1,f=_(q,(jJ)=>{V=!0,F=jJ.sectionBound===!0}),R=setTimeout(()=>{if(V||!q.isConnected)return;MJ(q.ownerDocument,"itemScopeWithoutToolkit",`[pie-item-scope] No <pie-assessment-toolkit> has answered item "${Z()}" after ${g/1000} s, so the item is not registered and the tools inside the scope have no runtime. Place the scope inside the toolkit element; it keeps waiting for one. Reported once per page.`)},g),P=h({host:q,kind:"item",identity:()=>({itemId:Z(),canonicalItemId:W(),contentKind:j()}),mode:()=>F?"section":"plain",send:B.send});return()=>{clearTimeout(R);try{P.disconnect()}finally{f(),B.retire(),B.disconnect()}}}),I(()=>{B.publish(H(A)?{host:H(A),kind:"item",itemId:Z(),canonicalItemId:W(),contentKind:j(),regionPolicy:Y(),scopeElement:U(),ttsHighlightTargetResolver:z(),item:x(),settings:O()}:null)});var M={get itemId(){return Z()},set itemId(q){Z(q),k()},get canonicalItemId(){return W()},set canonicalItemId(q){W(q),k()},get contentKind(){return j()},set contentKind(q){j(q),k()},get regionPolicy(){return Y()},set regionPolicy(q){Y(q),k()},get scopeElement(){return U()},set scopeElement(q){U(q),k()},get ttsHighlightTargetResolver(){return z()},set ttsHighlightTargetResolver(q){z(q),k()},get item(){return x()},set item(q){x(q),k()},get settings(){return O()},set settings(q){O(q),k()}},K=HJ(),G=JJ(K);YJ(G,(q)=>e(w,q),()=>H(w));var X=QJ(G,2);return qJ(X,J,"default",{},null),XJ(Q,K),a(M)}VJ("pie-item-scope",UJ(BJ,{itemId:{attribute:"item-id",type:"String"},canonicalItemId:{attribute:"canonical-item-id",type:"String"},contentKind:{attribute:"content-kind",type:"String"},regionPolicy:{attribute:"region-policy",type:"String"},scopeElement:{type:"Object"},ttsHighlightTargetResolver:{type:"Object"},item:{type:"Object"},settings:{type:"Object"}},["default"],[],{mode:"open"}));export{BJ as default};
1
+ import{b as wJ,c as g,d as o,e as u,f as p,g as m,h as E,i as T,j as S,k as c,p as _}from"./chunks/ItemToolBar-eg8jarh0.js";import{A as JJ,B as QJ,C as ZJ,D as f,E as XJ,F as qJ,I as WJ,K as UJ,L as y,N as C,R as YJ,T as MJ,Z as jJ,_ as zJ,ea as KJ,fa as k,ga as xJ,ja as i,ka as t,la as P,oa as b,pa as v,qa as OJ,ra as d}from"./chunks/ItemToolBar-bsww9e8f.js";import"./chunks/ItemToolBar-wcw4yxjy.js";import{commitPendingSessions as AJ,createPieLogger as FJ,normalizeItemSessionChange as LJ}from"@pie-players/pie-players-shared";function VJ(Q){let J=Q&&typeof Q==="object"?{...Q}:Q;if(J&&typeof J==="object")delete J.timestamp,delete J.sourceRuntimeId;try{return JSON.stringify(J)}catch{return String(J)}}var fJ=(Q)=>Boolean(Q&&typeof Q==="object"&&Q.sessionSource==="correct-response"),kJ=(Q)=>Boolean(Q&&typeof Q==="object"&&Q.sessionCommitReason);function l(Q){let{host:J,kind:Z,identity:U,mode:z,send:Y}=Q,M=FJ(J.localName||"pie-shell",()=>!1),x="",O=(j)=>{let{itemId:W,canonicalItemId:K}=U();if(!W)return;Y(u,{itemId:W,session:j});let X=LJ({itemId:W,sessionDetail:j});if(X.intent==="metadata-only"||!X.session)return;let L={itemId:W,canonicalItemId:K||W,session:X.session,...X.sessionCommitReason?{sessionCommitReason:X.sessionCommitReason}:{}};P(J,p,L)},w=(j)=>{if(z()!=="section")return;if(j.stopPropagation(),Z!=="item")return;let W=j.detail;if(fJ(W))return;let K=VJ(W);if(!kJ(W)&&K===x)return;x=K,O(W)},A=(j)=>{if(z()==="section")j.stopPropagation();let{itemId:W,canonicalItemId:K,contentKind:q}=U();if(!W)return;let X={itemId:W,canonicalItemId:K||W,contentKind:q,detail:j.detail};Y(T,X)},F=(j)=>{if(z()!=="section"||Z!=="item")return;let W=j.detail;if(W?.scope!=="delivery")return;let{itemId:K,canonicalItemId:q}=U();if(!K)return;let X={itemId:K,canonicalItemId:q||K,...W.identity?{identity:W.identity}:{}};Y(S,X)},V=(j)=>{if(z()==="section")j.stopPropagation();let{itemId:W,canonicalItemId:K,contentKind:q}=U();if(!W)return;let X={itemId:W,canonicalItemId:K||W,contentKind:q,error:j.detail};Y(c,X)},B=(j)=>{if(z()!=="section"||Z!=="item")return;let{itemId:W,canonicalItemId:K}=U();if(!W)return;let q={itemId:W,canonicalItemId:K||W,type:j.type,detail:j.detail};P(J,m,q)};J.addEventListener("session-changed",w),J.addEventListener("load-complete",A),J.addEventListener("backend-load-complete",F),J.addEventListener("player-error",V);for(let j of E)J.addEventListener(j,B);return{disconnect:()=>{try{if(Z==="item"&&z()==="section")AJ(J,{reason:"teardown",logger:M})}finally{J.removeEventListener("session-changed",w),J.removeEventListener("load-complete",A),J.removeEventListener("backend-load-complete",F),J.removeEventListener("player-error",V);for(let j of E)J.removeEventListener(j,B)}}}}import{ContextProvider as CJ}from"@pie-players/pie-context";function HJ(Q,J){return Q.kind===J.kind&&Q.host===J.host&&Q.itemId===J.itemId&&Q.canonicalItemId===J.canonicalItemId&&Q.contentKind===J.contentKind&&d(Q.settings,J.settings)}function r(Q){return _(Q.item,Q.kind)}function $(Q,J){return Q.isConnected||!J?Q:J.eventTarget}function I(Q,J,Z){let U={kind:J.kind,itemId:J.itemId,canonicalItemId:J.canonicalItemId,contentKind:J.contentKind,item:J.item,...J.settings?{settings:J.settings}:{},element:J.host,...Z?{runtimeId:Z.runtimeId}:{}};P($(J.host,Z),Q,U)}function s(){let Q=null,J=null,Z;function U(){let Y=Q;if(!Y)return;let M=Z;Q=null,J=null,Z=void 0,I(o,Y,M)}function z(Y,M){if(!Y){U();return}if(Q&&Z?.runtimeId!==M?.runtimeId)U();if(Q&&HJ(Q,Y)){if(Q.item===Y.item)return;let x=r(Y);if(x!==null&&x===J){Q=Y;return}Q=Y,J=x,I(g,Y,M);return}Q=Y,J=r(Y),Z=M,I(g,Y,M)}return{sync:z,retire:U}}var PJ=50;function n(Q,J,Z){let U=new CJ(Q,{context:J,initialValue:Z});return U.connect(),{provider:U,value:Z}}function a(Q,J,Z){if(Z(Q.value,J))return;Q.value=J,Q.provider.setValue(J)}var DJ=(Q,J,Z)=>{if(Q===J)return!0;if(!Q||!J)return!1;if(Q.id!==J.id)return!1;let U=_(Q,Z);return U!==null&&U===_(J,Z)},TJ=(Q,J)=>Q.kind===J.kind&&Q.itemId===J.itemId&&Q.canonicalItemId===J.canonicalItemId&&Q.contentKind===J.contentKind&&Q.regionPolicy===J.regionPolicy&&Q.scopeElement===J.scopeElement&&DJ(Q.item,J.item,Q.kind),SJ=(Q,J)=>Q.scopeElement===J.scopeElement&&Q.ttsHighlightTargetResolver===J.ttsHighlightTargetResolver,N=(Q,J,Z)=>{if(Q.getAttribute(J)!==Z)Q.setAttribute(J,Z)};function e(){let Q=s(),J=Date.now(),Z=null,U=null,z=null,Y=null,M=null,x=null,O=[],w=null,A=null,F=()=>{if(M!==null)Q.sync(x,M)},V=(q,X)=>q.isConnected&&X.eventTarget.isConnected===!1;function B(q,X){if(q===T)w=X;if(q===S)A=X;if(Z&&M!==null&&!V(Z,M)){P($(Z,M),q,{...X,runtimeId:M.runtimeId});return}if(O.push({type:q,detail:X}),O.length>PJ)O.shift()}function j(q){let X=M!==null&&q.runtimeId!==M.runtimeId;if(q.runtimeId!==M?.runtimeId)M={runtimeId:q.runtimeId,eventTarget:q.eventTarget},F();let L=O;O=[];for(let G of L)B(G.type,G.detail);if(!X)return;let H=(G)=>L.some((D)=>D.type===G);if(A&&!H(S))B(S,A);if(w&&!H(T))B(T,w)}function W(){for(let q of[U,z])q?.provider.disconnect();Y?.(),Y=null,M=null,O=[],w=null,A=null,x=null,U=null,z=null,Z=null}function K(q){if(!q){Q.sync(null),W();return}if(q.host!==Z)W();Z=q.host;let X=q.canonicalItemId||q.itemId,L=q.regionPolicy||"default",H=q.scopeElement||q.host,G={kind:q.kind,itemId:q.itemId,canonicalItemId:X,contentKind:q.contentKind,regionPolicy:L,scopeElement:H,item:q.item??null,contextVersion:J};if(U)a(U,G,TJ);else U=n(Z,i,G);let D={scopeElement:H,ttsHighlightTargetResolver:q.ttsHighlightTargetResolver??null};if(z)a(z,D,SJ);else z=n(Z,t,D);N(Z,"data-item-id",q.itemId),N(Z,"data-canonical-item-id",X),N(Z,"data-pie-shell-root",q.kind),N(Z,"data-region-policy",L);let R=x;if(x=q.itemId?{kind:q.kind,host:Z,itemId:q.itemId,canonicalItemId:X,contentKind:q.contentKind,item:q.item??null,settings:q.settings??null}:null,R&&(R.itemId!==x?.itemId||R.canonicalItemId!==x?.canonicalItemId))w=null;Y??=b(Z,j),F()}return{publish:K,retire:Q.retire,disconnect:W,send:B}}var RJ=(Q,J)=>{if(customElements.get(Q))return;try{customElements.define(Q,J)}catch(Z){if(!(Z instanceof DOMException&&Z.name==="NotSupportedError"||Z&&typeof Z==="object"&&Z.name==="NotSupportedError")||!customElements.get(Q))throw Z}},_J=YJ('<div class="pie-item-scope-anchor svelte-980v5l" aria-hidden="true"></div> <!>',1),NJ={hash:"svelte-980v5l",code:".pie-item-scope-anchor.svelte-980v5l {display:none;}"};function BJ(Q,J){JJ(J,!0),zJ(Q,NJ);let Z=k(J,"itemId",7,""),U=k(J,"canonicalItemId",7,""),z=k(J,"contentKind",7,"assessment-item"),Y=k(J,"regionPolicy",7,"default"),M=k(J,"scopeElement",7,null),x=k(J,"ttsHighlightTargetResolver",7,null),O=k(J,"item",7,null),w=k(J,"settings",7,null),A=XJ(null),F=ZJ(()=>{let X=C(A)?.getRootNode();return X instanceof ShadowRoot?X.host:null}),V=e(),B=null;y(()=>{if(!C(F))return;let X=C(F),L=!1,H=!1,G=wJ(X);B=G;let D=b(X,(h)=>{H=!0,L=h.sectionBound===!0,G.setCoordinator(h.coordinator??null)}),R=setTimeout(()=>{if(H||!X.isConnected)return;OJ(X.ownerDocument,"itemScopeWithoutToolkit",`[pie-item-scope] No <pie-assessment-toolkit> has answered item "${Z()}" after ${v/1000} s, so the item is not registered and the tools inside the scope have no runtime. Place the scope inside the toolkit element; it keeps waiting for one. Reported once per page.`)},v),GJ=l({host:X,kind:"item",identity:()=>({itemId:Z(),canonicalItemId:U(),contentKind:z()}),mode:()=>L?"section":"plain",send:V.send});return()=>{clearTimeout(R);try{GJ.disconnect()}finally{if(D(),V.retire(),V.disconnect(),G.disconnect(),B===G)B=null}}}),y(()=>{V.publish(C(F)?{host:C(F),kind:"item",itemId:Z(),canonicalItemId:U(),contentKind:z(),regionPolicy:Y(),scopeElement:M(),ttsHighlightTargetResolver:x(),item:O(),settings:w()}:null),B?.setItem(C(F)?{itemId:Z(),canonicalItemId:U()}:null)});var j={get itemId(){return Z()},set itemId(X){Z(X),f()},get canonicalItemId(){return U()},set canonicalItemId(X){U(X),f()},get contentKind(){return z()},set contentKind(X){z(X),f()},get regionPolicy(){return Y()},set regionPolicy(X){Y(X),f()},get scopeElement(){return M()},set scopeElement(X){M(X),f()},get ttsHighlightTargetResolver(){return x()},set ttsHighlightTargetResolver(X){x(X),f()},get item(){return O()},set item(X){O(X),f()},get settings(){return w()},set settings(X){w(X),f()}},W=_J(),K=WJ(W);KJ(K,(X)=>qJ(A,X),()=>C(A));var q=UJ(K,2);return jJ(q,J,"default",{},null),MJ(Q,W),QJ(j)}RJ("pie-item-scope",xJ(BJ,{itemId:{attribute:"item-id",type:"String"},canonicalItemId:{attribute:"canonical-item-id",type:"String"},contentKind:{attribute:"content-kind",type:"String"},regionPolicy:{attribute:"region-policy",type:"String"},scopeElement:{type:"Object"},ttsHighlightTargetResolver:{type:"Object"},item:{type:"Object"},settings:{type:"Object"}},["default"],[],{mode:"open"}));export{BJ as default};
@@ -1 +1 @@
1
- import{l as a}from"./chunks/ItemToolBar-asenkvx6.js";import"./chunks/ItemToolBar-hzc5wyjp.js";import"./chunks/ItemToolBar-3zrc4p3d.js";import"./chunks/ItemToolBar-kkj69ptr.js";export{a as default};
1
+ import{q as a}from"./chunks/ItemToolBar-8qpnhyg4.js";import"./chunks/ItemToolBar-na4e5vwt.js";import"./chunks/ItemToolBar-bsww9e8f.js";import"./chunks/ItemToolBar-wcw4yxjy.js";export{a as default};