@pie-players/pie-assessment-toolkit 0.3.73 → 0.3.74

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 (108) hide show
  1. package/README.md +171 -56
  2. package/dist/attempt/AssessmentSession.d.ts +1 -5
  3. package/dist/attempt/AssessmentSession.js +0 -29
  4. package/dist/components/ItemToolBar.custom-element.d.ts +1 -0
  5. package/dist/components/ItemToolBar.custom-element.js +1 -1
  6. package/dist/components/PieAssessmentToolkit.custom-element.d.ts +1 -0
  7. package/dist/components/PieAssessmentToolkit.custom-element.js +14 -14
  8. package/dist/components/SectionToolBar.custom-element.d.ts +1 -0
  9. package/dist/components/SectionToolBar.custom-element.js +1 -1
  10. package/dist/components/chunks/ItemToolBar-b9dz5jvd.js +40 -0
  11. package/dist/components/chunks/ItemToolBar-gmrryv2v.js +2 -0
  12. package/dist/components/chunks/ItemToolBar-h4xap0t0.js +4 -0
  13. package/dist/components/chunks/ItemToolBar-wr2myaah.js +2 -0
  14. package/dist/components/chunks/sre-engine-wf9s43gg.js +1 -0
  15. package/dist/context/assessment-toolkit-context.d.ts +5 -0
  16. package/dist/context/runtime-context-consumer.js +5 -38
  17. package/dist/index.d.ts +6 -6
  18. package/dist/index.js +8 -9
  19. package/dist/policy/core/ToolPolicyEngine.d.ts +8 -2
  20. package/dist/policy/core/ToolPolicyEngine.js +12 -0
  21. package/dist/runtime/adapter/SectionEngineAdapter.d.ts +3 -3
  22. package/dist/runtime/adapter/SectionEngineAdapter.js +3 -3
  23. package/dist/runtime/registration-events.d.ts +3 -0
  24. package/dist/runtime/section-runtime-engine-host-context.d.ts +3 -9
  25. package/dist/runtime/section-runtime-engine-host-context.js +5 -43
  26. package/dist/runtime/tool-host-contract.d.ts +20 -0
  27. package/dist/runtime/tool-host-contract.js +21 -0
  28. package/dist/services/HighlightCoordinator.d.ts +1 -7
  29. package/dist/services/HighlightCoordinator.js +1 -3
  30. package/dist/services/TTSService.d.ts +15 -1
  31. package/dist/services/TTSService.js +88 -35
  32. package/dist/services/ToolCoordinator.d.ts +1 -7
  33. package/dist/services/ToolCoordinator.js +1 -3
  34. package/dist/services/ToolRegistry.d.ts +13 -6
  35. package/dist/services/ToolRegistry.js +19 -7
  36. package/dist/services/ToolkitCoordinator.d.ts +110 -18
  37. package/dist/services/ToolkitCoordinator.js +273 -85
  38. package/dist/services/catalog-owner.d.ts +11 -0
  39. package/dist/services/catalog-owner.js +25 -0
  40. package/dist/services/create-tools-config.d.ts +2 -2
  41. package/dist/services/framework-error.d.ts +8 -1
  42. package/dist/services/interfaces.d.ts +9 -9
  43. package/dist/services/pnp-standard-features.d.ts +1 -1
  44. package/dist/services/section-controller-types.d.ts +15 -0
  45. package/dist/services/spoken-audio-cards.js +1 -1
  46. package/dist/services/tool-config-validation.d.ts +13 -2
  47. package/dist/services/tool-config-validation.js +33 -16
  48. package/dist/services/tool-context.js +29 -13
  49. package/dist/services/tool-providers/TTSToolProvider.d.ts +27 -65
  50. package/dist/services/tool-providers/TTSToolProvider.js +47 -9
  51. package/dist/services/tool-providers/ToolProviderRegistry.d.ts +4 -4
  52. package/dist/services/tool-providers/ToolProviderRegistry.js +4 -16
  53. package/dist/services/tool-providers/index.d.ts +0 -9
  54. package/dist/services/tool-providers/index.js +2 -4
  55. package/dist/services/tools-config-normalizer.d.ts +20 -1
  56. package/dist/services/tts/catalog-span-alignment.d.ts +2 -17
  57. package/dist/services/tts/catalog-span-alignment.js +17 -142
  58. package/dist/services/tts/generated-speech/types.d.ts +0 -12
  59. package/dist/services/tts/highlight-pipeline/boundary-normalizer.js +12 -62
  60. package/dist/services/tts/highlight-pipeline/create-highlight-plan.js +26 -1
  61. package/dist/services/tts/highlight-pipeline/normalize-speech-chunks.js +3 -6
  62. package/dist/services/tts/math-alignment/index.d.ts +0 -5
  63. package/dist/services/tts/math-alignment/index.js +5 -25
  64. package/dist/services/tts/math-alignment/speech-tokenizer.d.ts +9 -1
  65. package/dist/services/tts/math-alignment/speech-tokenizer.js +38 -36
  66. package/dist/services/tts/math-alignment/types.d.ts +4 -2
  67. package/dist/services/tts/math-aware-text-processing.js +44 -2
  68. package/dist/services/tts/math-speech.d.ts +5 -1
  69. package/dist/services/tts/math-speech.js +9 -6
  70. package/dist/services/tts/sre-engine.d.ts +7 -0
  71. package/dist/services/tts/sre-engine.js +11 -0
  72. package/dist/services/tts/sre-locales.d.ts +14 -0
  73. package/dist/services/tts/sre-locales.js +57 -0
  74. package/dist/services/tts/text-processing.d.ts +0 -1
  75. package/dist/services/tts/text-processing.js +0 -1
  76. package/dist/services/tts-runtime-config.d.ts +21 -3
  77. package/dist/services/tts-runtime-config.js +11 -3
  78. package/dist/tools/client.d.ts +1 -3
  79. package/dist/tools/client.js +1 -5
  80. package/dist/tools/internal.d.ts +6 -5
  81. package/dist/tools/internal.js +6 -8
  82. package/package.json +17 -36
  83. package/dist/components/chunks/ItemToolBar-byq80z42.js +0 -40
  84. package/dist/components/chunks/ItemToolBar-d36g3aw4.js +0 -49
  85. package/dist/services/ToolConfigResolver.d.ts +0 -161
  86. package/dist/services/ToolConfigResolver.js +0 -229
  87. package/dist/services/catalog-media.d.ts +0 -56
  88. package/dist/services/catalog-media.js +0 -190
  89. package/dist/services/createDefaultToolRegistry.d.ts +0 -53
  90. package/dist/services/createDefaultToolRegistry.js +0 -45
  91. package/dist/services/tool-providers/CortexToolProvider.d.ts +0 -13
  92. package/dist/services/tool-providers/CortexToolProvider.js +0 -32
  93. package/dist/services/tool-providers/DesmosToolProvider.d.ts +0 -14
  94. package/dist/services/tool-providers/DesmosToolProvider.js +0 -32
  95. package/dist/services/tool-providers/GeoGebraToolProvider.d.ts +0 -16
  96. package/dist/services/tool-providers/GeoGebraToolProvider.js +0 -32
  97. package/dist/services/tool-providers/LazyCalculatorToolProvider.d.ts +0 -35
  98. package/dist/services/tool-providers/LazyCalculatorToolProvider.js +0 -95
  99. package/dist/services/tts/visual-line-ranges.d.ts +0 -18
  100. package/dist/services/tts/visual-line-ranges.js +0 -226
  101. package/dist/tools/index.d.ts +0 -8
  102. package/dist/tools/index.js +0 -10
  103. package/dist/tools/response-discovery.d.ts +0 -61
  104. package/dist/tools/response-discovery.js +0 -113
  105. package/dist/tools/types.d.ts +0 -337
  106. package/dist/tools/types.js +0 -12
  107. package/dist/tools/variant-resolver.d.ts +0 -41
  108. package/dist/tools/variant-resolver.js +0 -207
@@ -0,0 +1 @@
1
+ export {};
@@ -1 +1 @@
1
- import"./chunks/ItemToolBar-byq80z42.js";import{H as w,J as G,K as Y,d as U,e as V,g as F,p as E,u as W,w as X}from"./chunks/ItemToolBar-d36g3aw4.js";var x=(H,A)=>{if(customElements.get(H))return;try{customElements.define(H,A)}catch(C){if(!(C instanceof DOMException&&C.name==="NotSupportedError"||C&&typeof C==="object"&&C.name==="NotSupportedError")||!customElements.get(H))throw C}},D=W("<pie-item-toolbar></pie-item-toolbar>",2);function Z(H,A){U(A,!0);let C=G(A,"enabledTools",7,""),J=G(A,"position",7,"bottom"),K=G(A,"sectionId",7,""),L=G(A,"size",7,"md"),M=G(A,"language",7,"en-US"),O=G(A,"toolRegistry",7,null),P=G(A,"item",7,null),Q=G(A,"hostButtons",23,()=>[]);var j={get enabledTools(){return C()},set enabledTools(k){C(k),F()},get position(){return J()},set position(k){J(k),F()},get sectionId(){return K()},set sectionId(k){K(k),F()},get size(){return L()},set size(k){L(k),F()},get language(){return M()},set language(k){M(k),F()},get toolRegistry(){return O()},set toolRegistry(k){O(k),F()},get item(){return P()},set item(k){P(k),F()},get hostButtons(){return Q()},set hostButtons(k){Q(k),F()}},q=D();return w(q,"level","section"),E(()=>w(q,"scope-id",K())),E(()=>w(q,"section-id",K())),E(()=>w(q,"tools",C())),w(q,"content-kind","section"),E(()=>w(q,"position",J())),E(()=>w(q,"size",L())),E(()=>w(q,"language",M())),E(()=>w(q,"toolRegistry",O())),E(()=>w(q,"item",P())),E(()=>w(q,"hostButtons",Q())),X(H,q),V(j)}x("pie-section-toolbar",Y(Z,{enabledTools:{attribute:"enabled-tools",type:"String"},position:{attribute:"position",type:"String"},sectionId:{attribute:"section-id",type:"String"},size:{attribute:"size",type:"String"},language:{attribute:"language",type:"String"},toolRegistry:{type:"Object"},item:{type:"Object"},hostButtons:{type:"Object"}},[],[],{mode:"open"}));export{Z as default};
1
+ import"./chunks/ItemToolBar-b9dz5jvd.js";import{G as w,I as G,J as Y,c as U,d as V,f as F,o as E,t as W,v as X}from"./chunks/ItemToolBar-h4xap0t0.js";import"./chunks/ItemToolBar-gmrryv2v.js";var x=(H,A)=>{if(customElements.get(H))return;try{customElements.define(H,A)}catch(C){if(!(C instanceof DOMException&&C.name==="NotSupportedError"||C&&typeof C==="object"&&C.name==="NotSupportedError")||!customElements.get(H))throw C}},D=W("<pie-item-toolbar></pie-item-toolbar>",2);function Z(H,A){U(A,!0);let C=G(A,"enabledTools",7,""),J=G(A,"position",7,"bottom"),K=G(A,"sectionId",7,""),L=G(A,"size",7,"md"),M=G(A,"language",7,"en-US"),O=G(A,"toolRegistry",7,null),P=G(A,"item",7,null),Q=G(A,"hostButtons",23,()=>[]);var j={get enabledTools(){return C()},set enabledTools(k){C(k),F()},get position(){return J()},set position(k){J(k),F()},get sectionId(){return K()},set sectionId(k){K(k),F()},get size(){return L()},set size(k){L(k),F()},get language(){return M()},set language(k){M(k),F()},get toolRegistry(){return O()},set toolRegistry(k){O(k),F()},get item(){return P()},set item(k){P(k),F()},get hostButtons(){return Q()},set hostButtons(k){Q(k),F()}},q=D();return w(q,"level","section"),E(()=>w(q,"scope-id",K())),E(()=>w(q,"section-id",K())),E(()=>w(q,"tools",C())),w(q,"content-kind","section"),E(()=>w(q,"position",J())),E(()=>w(q,"size",L())),E(()=>w(q,"language",M())),E(()=>w(q,"toolRegistry",O())),E(()=>w(q,"item",P())),E(()=>w(q,"hostButtons",Q())),X(H,q),V(j)}x("pie-section-toolbar",Y(Z,{enabledTools:{attribute:"enabled-tools",type:"String"},position:{attribute:"position",type:"String"},sectionId:{attribute:"section-id",type:"String"},size:{attribute:"size",type:"String"},language:{attribute:"language",type:"String"},toolRegistry:{type:"Object"},item:{type:"Object"},hostButtons:{type:"Object"}},[],[],{mode:"open"}));export{Z as default};
@@ -0,0 +1,40 @@
1
+ import{A as K0,C as Ej,D as xL,E as IL,F as UL,G as yL,H as gj,I as o,J as $j,K as mj,M as hj,O as uj,Q as cj,T as sj,b as PL,c as pj,d as bj,e as O,f as l,g as CL,h as WL,i as _j,j as dL,k as QL,m as H0,n as DL,o as VL,p as L,r as Z0,s as vj,t as ML,u as XL,v as z,x as YL,y as f0,z as U0}from"./ItemToolBar-h4xap0t0.js";import{ContextProvider as AJ}from"@pie-players/pie-context";function a0(f){return typeof f.href==="string"}function Bj(f){if(!f||typeof f!=="object"||Array.isArray(f))return!1;let M=f;if(typeof M.id!=="string"||M.id.trim().length===0)return!1;if(typeof M.label!=="string"||M.label.trim().length===0)return!1;if(M.ariaLabel!==void 0&&typeof M.ariaLabel!=="string")return!1;if(M.icon!==void 0&&typeof M.icon!=="string")return!1;if(M.tooltip!==void 0&&typeof M.tooltip!=="string")return!1;if(M.active!==void 0&&typeof M.active!=="boolean")return!1;if(M.disabled!==void 0&&typeof M.disabled!=="boolean")return!1;let p=typeof M.href==="string",OL=typeof M.onClick==="function";if(p===OL)return!1;if(p)return!0;return OL}function d0(f){return typeof f==="string"&&f.trimStart().startsWith("<svg")}function r0(f){return typeof f==="string"&&f.trimStart().startsWith("http")}import{sanitizeSvgIcon as k0}from"@pie-players/pie-players-shared/security";import{resolveInterfaceI18n as CJ}from"@pie-players/pie-players-shared/i18n/provider";import{collectFocusable as IJ,createFocusTrap as yJ,createPointerGesture as pJ,FOCUSABLE_SELECTOR as bJ,isProgrammaticFocusTarget as _J}from"@pie-players/pie-players-shared";var xJ={calculator:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 2h10a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2Zm0 2v4h10V4H7Zm0 6v2h2v-2H7Zm4 0v2h2v-2h-2Zm4 0v2h2v-2h-2Zm-8 4v2h2v-2H7Zm4 0v2h2v-2h-2Zm4 0v2h2v-2h-2Zm-8 4v2h2v-2H7Zm4 0v2h2v-2h-2Zm4 0v2h2v-2h-2Z" fill="currentColor"/></svg>',"volume-up":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14 3.23v2.06A7.002 7.002 0 0 1 19 12a7 7 0 0 1-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77Zm-2 17.75V3L7 8H3v8h4l5 5Zm4.5-9a4.5 4.5 0 0 0-2.5-4.03v8.05A4.5 4.5 0 0 0 16.5 12Z" fill="currentColor"/></svg>',swatch:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 3a9 9 0 1 0 9 9c0-.55-.45-1-1-1h-2.5a1.5 1.5 0 0 1 0-3H20a1 1 0 0 0 1-1 8.99 8.99 0 0 0-9-4Zm-5.5 9A1.5 1.5 0 1 1 8 13.5 1.5 1.5 0 0 1 6.5 12Zm3-4A1.5 1.5 0 1 1 11 9.5 1.5 1.5 0 0 1 9.5 8Zm5 0A1.5 1.5 0 1 1 16 9.5 1.5 1.5 0 0 1 14.5 8Z" fill="currentColor"/></svg>',"chart-bar":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4.75 5a.76.76 0 0 1 .75.75v11c0 .438.313.75.75.75h13a.76.76 0 0 1 .696 1.039.74.74 0 0 1-.696.461h-13C5 19 4 18 4 16.75v-11A.74.74 0 0 1 4.75 5ZM8 8.25a.74.74 0 0 1 .75-.75h6.5a.76.76 0 0 1 .696 1.039.74.74 0 0 1-.696.461h-6.5A.722.722 0 0 1 8 8.25Zm.75 2.25h4.5a.76.76 0 0 1 .696 1.039.74.74 0 0 1-.696.461h-4.5a.723.723 0 0 1-.75-.75.74.74 0 0 1 .75-.75Zm0 3h8.5a.76.76 0 0 1 .696 1.039.74.74 0 0 1-.696.461h-8.5a.723.723 0 0 1-.75-.75.74.74 0 0 1 .75-.75Z" fill="currentColor"/></svg>',beaker:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5 21c-.85 0-1.454-.38-1.813-1.137-.358-.759-.27-1.463.263-2.113L9 11V5H8a.968.968 0 0 1-.713-.287A.968.968 0 0 1 7 4c0-.283.096-.52.287-.712A.968.968 0 0 1 8 3h8c.283 0 .52.096.712.288.192.191.288.429.288.712s-.096.52-.288.713A.968.968 0 0 1 16 5h-1v6l5.55 6.75c.533.65.62 1.354.262 2.113C20.454 20.62 19.85 21 19 21H5Zm2-3h10l-3.4-4h-3.2L7 18Zm-2 1h14l-6-7.3V5h-2v6.7L5 19Z" fill="currentColor"/></svg>',protractor:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m6.75 21-.25-2.2 2.85-7.85a3.95 3.95 0 0 0 1.75.95l-2.75 7.55L6.75 21Zm10.5 0-1.6-1.55-2.75-7.55a3.948 3.948 0 0 0 1.75-.95l2.85 7.85-.25 2.2ZM12 11a2.893 2.893 0 0 1-2.125-.875A2.893 2.893 0 0 1 9 8c0-.65.188-1.23.563-1.737A2.935 2.935 0 0 1 11 5.2V3h2v2.2c.583.2 1.063.554 1.438 1.063C14.812 6.77 15 7.35 15 8c0 .833-.292 1.542-.875 2.125A2.893 2.893 0 0 1 12 11Zm0-2c.283 0 .52-.096.713-.287A.967.967 0 0 0 13 8a.967.967 0 0 0-.287-.713A.968.968 0 0 0 12 7a.968.968 0 0 0-.713.287A.967.967 0 0 0 11 8c0 .283.096.52.287.713.192.191.43.287.713.287Z" fill="currentColor"/></svg>',"bars-3":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6.85 15c.517 0 .98-.15 1.388-.45.408-.3.695-.692.862-1.175l.375-1.15c.267-.8.2-1.537-.2-2.213C8.875 9.337 8.3 9 7.55 9H4.025l.475 3.925c.083.583.346 1.075.787 1.475.442.4.963.6 1.563.6Zm10.3 0c.6 0 1.12-.2 1.563-.6.441-.4.704-.892.787-1.475L19.975 9h-3.5c-.75 0-1.325.342-1.725 1.025-.4.683-.467 1.425-.2 2.225l.35 1.125c.167.483.454.875.862 1.175.409.3.871.45 1.388.45Zm-10.3 2c-1.1 0-2.063-.363-2.887-1.088a4.198 4.198 0 0 1-1.438-2.737L2 9H1V7h6.55c.733 0 1.404.18 2.013.537A3.906 3.906 0 0 1 11 9h2.025c.35-.617.83-1.104 1.438-1.463A3.892 3.892 0 0 1 16.474 7H23v2h-1l-.525 4.175a4.198 4.198 0 0 1-1.438 2.737A4.238 4.238 0 0 1 17.15 17c-.95 0-1.804-.27-2.562-.813A4.234 4.234 0 0 1 13 14.026l-.375-1.125a21.35 21.35 0 0 1-.1-.363 4.926 4.926 0 0 1-.1-.537h-.85c-.033.2-.067.363-.1.488a21.35 21.35 0 0 1-.1.362L11 14a4.3 4.3 0 0 1-1.588 2.175A4.258 4.258 0 0 1 6.85 17Z" fill="currentColor"/></svg>',ruler:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m8.8 10.95 2.15-2.175-1.4-1.425-1.1 1.1-1.4-1.4 1.075-1.1L7 4.825 4.825 7 8.8 10.95Zm8.2 8.225L19.175 17l-1.125-1.125-1.1 1.075-1.4-1.4 1.075-1.1-1.425-1.4-2.15 2.15L17 19.175ZM7.25 21H3v-4.25l4.375-4.375L2 7l5-5 5.4 5.4 3.775-3.8c.2-.2.425-.35.675-.45a2.068 2.068 0 0 1 1.55 0c.25.1.475.25.675.45L20.4 4.95c.2.2.35.425.45.675.1.25.15.508.15.775a1.975 1.975 0 0 1-.6 1.425l-3.775 3.8L22 17l-5 5-5.375-5.375L7.25 21ZM5 19h1.4l9.8-9.775L14.775 7.8 5 17.6V19Z" fill="currentColor"/></svg>',"book-open":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 6.25a6.6 6.6 0 0 0-2.3-1.32A8.6 8.6 0 0 0 7 4.5c-.63 0-1.25.06-1.85.18-.6.12-1.19.3-1.76.54a1.5 1.5 0 0 0-.93 1.4v10.1c0 .52.26.98.68 1.24.42.26.92.28 1.35.06.36-.18.75-.31 1.18-.4.42-.09.86-.13 1.33-.13.78 0 1.53.14 2.24.42.7.28 1.35.7 1.93 1.24l.83-.75.83.75c.58-.54 1.22-.96 1.93-1.24a6.1 6.1 0 0 1 2.24-.42c.47 0 .91.04 1.33.13.43.09.82.22 1.18.4.43.22.93.2 1.35-.06.42-.26.68-.72.68-1.24V6.62c0-.6-.36-1.15-.93-1.4a9.3 9.3 0 0 0-1.76-.54A9.8 9.8 0 0 0 17 4.5a8.6 8.6 0 0 0-2.7.43A6.6 6.6 0 0 0 12 6.25Zm1 10.06V8.02c.55-.5 1.16-.88 1.84-1.13A6 6 0 0 1 17 6.5c.45 0 .89.04 1.32.11.43.08.85.19 1.26.34v9.24a8.2 8.2 0 0 0-1.28-.24A10 10 0 0 0 17 15.85c-.72 0-1.42.09-2.09.26a7.7 7.7 0 0 0-1.91.8Zm-2 0a7.7 7.7 0 0 0-1.91-.8 8.4 8.4 0 0 0-2.09-.26c-.44 0-.87.02-1.3.07-.43.05-.86.13-1.28.24V6.95c.41-.15.83-.26 1.26-.34A7.7 7.7 0 0 1 7 6.5c.76 0 1.48.13 2.16.39.68.25 1.29.63 1.84 1.13Z" fill="currentColor"/></svg>',photo:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 21c-.55 0-1.02-.2-1.41-.59A1.93 1.93 0 0 1 2 19V5c0-.55.2-1.02.59-1.41A1.93 1.93 0 0 1 4 3h16c.55 0 1.02.2 1.41.59.39.39.59.86.59 1.41v14c0 .55-.2 1.02-.59 1.41-.39.39-.86.59-1.41.59H4Zm0-2h16V5H4v14Zm1.5-2.5h13l-4.1-5.47-3.4 4.47-2.5-3.25L5.5 16.5ZM8.5 10a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z" fill="currentColor"/></svg>'};function Tj(f){return xJ[f]||null}var SJ=["assessment","section","item","passage","rubric"],BJ=new Set(SJ);function Aj(f){return BJ.has(f)}function W0(f,M,p){let OL=f.trim(),pL=p.trim();if(!OL||!pL)throw Error("Tool instance ids require non-empty tool and scope ids");if(!Aj(M))throw Error(`Unknown tool scope level '${M}'. Register custom levels with registerToolScopeLevel().`);return`${OL}:${M}:${pL}`}function l0(f){let M=f.split(":");if(M.length!==3)return null;let[p,OL,pL]=M;if(!p||!pL)return null;if(!Aj(OL))return null;return{baseToolId:p,scopeLevel:OL,scopeId:pL}}import"@pie-players/pie-players-shared/nds-icon-button";var TJ=(f,M)=>{if(customElements.get(f))return;try{customElements.define(f,M)}catch(p){if(!(p instanceof DOMException&&p.name==="NotSupportedError"||p&&typeof p==="object"&&p.name==="NotSupportedError")||!customElements.get(f))throw p}},w0=ML('<span class="item-toolbar__element-host svelte-1c13522"></span>'),vJ=ML('<span class="item-toolbar__nds-button-zoom svelte-1c13522"><nds-icon-button></nds-icon-button></span>',2),z0=ML('<span aria-hidden="true"></span>'),Cj=ML('<img class="item-toolbar__icon-image svelte-1c13522" alt=""/>'),Ij=ML('<i aria-hidden="true"></i>'),EJ=ML("<a><!></a>"),gJ=ML('<button type="button"><!></button>'),yj=ML('<span class="item-toolbar__controls-host svelte-1c13522"></span>'),$J=ML("<div></div>"),mJ=ML('<div><div class="item-toolbar__tools-row svelte-1c13522"><!> <!> <!></div> <!></div>'),hJ={hash:"svelte-1c13522",code:`.item-toolbar.svelte-1c13522 {display:flex;flex-direction:column;align-items:flex-end;min-width:0;max-width:100%;gap:0;--pie-toolbar-tools-row-height: 2rem;--pie-tts-controls-row-height: 2.875rem;}.item-toolbar__tools-row.svelte-1c13522 {display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:0.5rem;max-width:100%;min-height:var(--pie-toolbar-tools-row-height);}
2
+
3
+ /* A granted section tool must stay reachable even when there isn't room for
4
+ every button: scroll the row rather than clipping items past the edge,
5
+ which left them impossible to focus, tab to, or click. \`min-width: 0\`
6
+ beats the flex default (\`auto\`, i.e. never shrink below content), which
7
+ would otherwise keep the row at full content width and make overflow-x
8
+ moot. Item and passage rows wrap without an overflow clip so an inline
9
+ reading-controls panel can still extend outside the row. */.item-toolbar[data-level="section"].svelte-1c13522 .item-toolbar__tools-row:where(.svelte-1c13522) {flex-wrap:nowrap;justify-content:flex-start;
10
+ /* Keep the focus outline inside the scrolling box on both axes. */padding:4px;scroll-padding:4px;box-sizing:border-box;overflow-x:auto;max-width:100%;min-width:0;}.item-toolbar__controls-row.svelte-1c13522 {display:flex;align-items:center;justify-content:flex-end;width:100%;min-height:0;height:auto;}.item-toolbar__controls-row--reserve.svelte-1c13522 {min-height:var(--pie-tts-controls-row-height);height:var(--pie-tts-controls-row-height);}.item-toolbar__controls-row--active.svelte-1c13522 {min-height:var(--pie-tts-controls-row-height);height:var(--pie-tts-controls-row-height);}.item-toolbar__controls-row--align-start.svelte-1c13522 {justify-content:flex-start;}.item-toolbar__controls-host.svelte-1c13522 {display:inline-flex;align-items:center;justify-content:flex-end;width:100%;}.item-toolbar--top.svelte-1c13522,
11
+ .item-toolbar--bottom.svelte-1c13522 {align-items:flex-end;}.item-toolbar--left.svelte-1c13522,
12
+ .item-toolbar--right.svelte-1c13522 {align-items:stretch;}.item-toolbar--left.svelte-1c13522 .item-toolbar__tools-row:where(.svelte-1c13522),
13
+ .item-toolbar--right.svelte-1c13522 .item-toolbar__tools-row:where(.svelte-1c13522) {flex-direction:column;align-items:center;justify-content:flex-start;flex-wrap:nowrap;}.item-toolbar--left.svelte-1c13522 .item-toolbar__controls-row:where(.svelte-1c13522),
14
+ .item-toolbar--right.svelte-1c13522 .item-toolbar__controls-row:where(.svelte-1c13522) {justify-content:flex-start;width:auto;min-height:0;height:auto;}.item-toolbar__button.svelte-1c13522 {display:flex;flex-shrink:0;align-items:center;justify-content:center;width:2rem;height:2rem;padding:0.25rem;border:1px solid var(--pie-button-border, var(--pie-border, #ccc));border-radius:0.25rem;background-color:var(--pie-button-bg, var(--pie-background, white));color:var(--pie-button-color, var(--pie-text, #333));cursor:pointer;transition:all 0.15s ease;text-decoration:none;}
15
+
16
+ /* Drive the vendored NDS icon button's outer size via its own \`--height-32\`
17
+ custom property so its light-DOM inner button matches the toolbar's
18
+ md/sm/lg dimensions (32 / 44 / 40 px) without a layout shift. The glyph
19
+ keeps the NDS-native icon size (we render size="small"), so it isn't
20
+ oversized. */.item-toolbar__nds-button-zoom.svelte-1c13522 {display:inline-flex;flex-shrink:0;}.item-toolbar.svelte-1c13522 nds-icon-button:where(.svelte-1c13522) {
21
+ /* Host-settable button size per toolbar size (drives the NDS outer button
22
+ via its own --height-32). */--height-32: var(--pie-calculator-button-size, 2rem);
23
+ /* Host-settable accent for the calculator button: the NDS tertiary glyph
24
+ colour derives from --color-interactive-blue, remapped here to a
25
+ themeable variable. --pie-calculator-button-color is package-private, so
26
+ nothing sets it and the default is what ships: it now resolves through
27
+ --pie-button-color (DaisyUI base-content) instead of holding the Figma
28
+ blue on every theme, with the literal as the no-theme last resort.
29
+ Not --pie-primary or --pie-tertiary: both are \`direct\` mappings of
30
+ DaisyUI slots chosen to pair with their own -content colour, so a glyph
31
+ taken from either sits at 1.37:1 against the page under \`pastel\` and 11
32
+ of the 35 shipped themes fall under SC 1.4.11's 3:1. */--color-interactive-blue: var(--pie-calculator-button-color, var(--pie-button-color, var(--pie-text, #222)));
33
+ /* NDS palette bridge — keep in sync with the copies in tool-tts-inline
34
+ and section-player SectionItemsPane (asserted by
35
+ scripts/check-theme-tokens.mjs). The vendored button paints its fill,
36
+ its on-accent glyph, its hover ring and its focus ring from the NDS
37
+ design-system palette, which no PIE theme sets, so a tertiary button
38
+ kept a #f3f5f7 pill on every page — and once the glyph followed the
39
+ theme, a light glyph landed on that light pill. */--color-new-gray: var(--pie-background-dark, #f3f5f7);--color-primary-white: var(--pie-white, #ffffff);--color-primary-black: var(--pie-text, #000000);--color-focus-blue: var(--pie-button-focus-outline, #2b87ff);}.item-toolbar--sm.svelte-1c13522 nds-icon-button:where(.svelte-1c13522) {--height-32: var(--pie-calculator-button-size-sm, 2.75rem);}.item-toolbar--lg.svelte-1c13522 nds-icon-button:where(.svelte-1c13522) {--height-32: var(--pie-calculator-button-size-lg, 2.5rem);}.item-toolbar__element-host.svelte-1c13522 {display:contents;}.item-toolbar--sm.svelte-1c13522 .item-toolbar__button:where(.svelte-1c13522) {width:2.75rem;height:2.75rem;}.item-toolbar--sm.svelte-1c13522 {--pie-toolbar-tools-row-height: 2.75rem;--pie-tts-controls-row-height: 3.625rem;}.item-toolbar--lg.svelte-1c13522 .item-toolbar__button:where(.svelte-1c13522) {width:2.5rem;height:2.5rem;}.item-toolbar--lg.svelte-1c13522 {--pie-toolbar-tools-row-height: 2.5rem;--pie-tts-controls-row-height: 3.375rem;}.item-toolbar__button.svelte-1c13522:hover:not(:disabled) {background-color:var(--pie-button-hover-bg, var(--pie-secondary-background, #f5f5f5));border-color:var(--pie-button-hover-border, var(--pie-button-border, var(--pie-border, #ccc)));color:var(--pie-button-hover-color, var(--pie-button-color, var(--pie-text, #333)));transform:translateY(-1px);box-shadow:0 2px 4px color-mix(in srgb, var(--pie-black, #000) 10%, transparent);}.item-toolbar__button.svelte-1c13522:active:not(:disabled) {transform:translateY(0);box-shadow:none;}.item-toolbar__button--active.svelte-1c13522 {background-color:var(--pie-primary, #1976d2);color:var(--pie-white, #fff);border-color:var(--pie-primary, #1976d2);}.item-toolbar__button--active.svelte-1c13522:hover:not(:disabled) {background-color:var(--pie-primary-dark, #1565c0);}.item-toolbar__button.svelte-1c13522:focus-visible {outline:2px solid var(--pie-button-focus-outline, var(--pie-primary, #1976d2));outline-offset:2px;}.item-toolbar__button.svelte-1c13522:disabled {opacity:0.5;cursor:not-allowed;}.item-toolbar__button.svelte-1c13522 svg {width:100%;height:100%;}.item-toolbar__icon-image.svelte-1c13522 {width:100%;height:100%;object-fit:contain;}`};function ij(f,M){pj(M,!0),Ej(f,hJ);let p=typeof window<"u",OL=["/_fa-pro/fontawesome.min.css","/_fa-pro/light.min.css"],pL="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.5.2/css/all.min.css",aj="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap",o0=/font.?awesome|fa-?pro/i,x0=(j)=>{if(document.querySelector(`link[href="${j}"]`))return;let Z=document.createElement("link");Z.rel="stylesheet",Z.href=j,Z.addEventListener("error",()=>{Z.dataset.pieLoadFailed=""},{once:!0}),document.head.appendChild(Z)},n0=!1,S0=()=>{if(!p||n0)return;if(n0=!0,!document.querySelector('link[href*="Roboto"]'))x0(aj);if(Array.from(document.querySelectorAll('link[rel="stylesheet"][href]')).some((Z)=>o0.test(Z.href)))return;x0(pL);for(let Z of OL)x0(Z)},t0="__pieFaToolbarShadowInstalled",dj=(j)=>{let Z=j.getRootNode();if(!(Z instanceof ShadowRoot))return;let J=Z;if(J[t0])return;J[t0]=!0;let K=new Set,R=(V)=>{if(!V||K.has(V))return;K.add(V);let G=document.createElement("link");G.rel="stylesheet",G.href=V,Z.appendChild(G)},_=Array.from(document.querySelectorAll('link[rel="stylesheet"][href]')).filter((V)=>o0.test(V.href));for(let V of _){if("pieLoadFailed"in V.dataset)continue;if(V.sheet){R(V.href);continue}let G=(a)=>{if(V.removeEventListener("load",G),V.removeEventListener("error",G),a.type==="load")R(V.href)};V.addEventListener("load",G),V.addEventListener("error",G)}},rj=(j)=>{return S0(),dj(j),{}},lj=(j,Z)=>{let J=Z,K=()=>{let _=j.querySelector("button");if(_)_.setAttribute("aria-pressed",J?"true":"false")};K();let R=new MutationObserver(K);return R.observe(j,{childList:!0,subtree:!0}),{update(_){J=_,K()},destroy(){R.disconnect()}}},e0=(j)=>j.faIconName||null,oj=new sj,bL=CL(_j({})),mL=o(M,"level",7,"item"),Q0=o(M,"scopeId",7,""),B0=o(M,"itemId",7,""),T0=o(M,"sectionId",7,""),A0=o(M,"catalogId",7,""),C0=o(M,"tools",7,""),I0=o(M,"contentKind",7,"assessment-item"),SL=o(M,"position",7,"bottom"),rL=o(M,"scopeElement",7,null),y0=o(M,"toolRegistry",7,null),p0=o(M,"item",7,null),V0=o(M,"hostButtons",23,()=>[]),b0=o(M,"class",7,""),lL=o(M,"size",7,"md"),X0=o(M,"language",7,"en-US"),RL=CL(null),x=CL(null),hL=O(()=>L(x)?.ndsIcons===!0),oL=O(()=>CJ(L(x))),_L=CL(null),nL=CL(0),Y0=CL(0),_0=CL(0);DL(()=>{if(!L(RL))return;return hj(L(RL),(j)=>{WL(x,j,!0)})}),DL(()=>{if(!L(RL))return;return uj(L(RL),(j)=>{WL(_L,j,!0)})}),DL(()=>{let j=L(x)?.toolkitCoordinator;if(!j||typeof j.onPolicyChange!=="function")return;let Z=j.onPolicyChange(()=>{WL(Y0,L(Y0)+1)});return()=>{try{Z?.()}catch{}}}),DL(()=>{let j=L(x)?.toolkitCoordinator;if(!j||typeof j.onToolContextResolverChange!=="function")return;let Z=j.onToolContextResolverChange(()=>{WL(_0,L(_0)+1)});return()=>{try{Z?.()}catch{}}});let S=O(()=>L(x)?.toolCoordinator),Lj=O(()=>L(x)?.ttsService),uL=O(()=>L(x)?.elementToolStateStore),D0=O(()=>L(x)?.assessmentId??""),tL=O(()=>B0()||L(_L)?.itemId||""),n=O(()=>L(_L)?.canonicalItemId||L(tL)),BL=O(()=>T0()||L(x)?.sectionId||""),cL=O(()=>I0()||L(_L)?.contentKind||(mL()==="section"?"section":"assessment-item")),T=O(()=>{if(mL()&&mL()!=="item")return mL();if(L(cL)==="rubric-block-stimulus")return"passage";return"item"}),kL=O(()=>{if(Q0())return Q0();if(L(T)==="section")return L(BL)||L(x)?.sectionId||"default-section";if(L(T)==="assessment")return L(x)?.assessmentId||"default-assessment";return L(n)||L(tL)||"default-item"}),jj=O(()=>A0()||L(kL)),wL=O(()=>p0()||L(_L)?.item||null),e=O(()=>y0()||oj),nj=O(()=>cj(C0())),tj=O(()=>L(e).normalizeToolIds(L(nj)).filter(Boolean)),Jj=O(()=>{if(L(T)==="section")return"section";if(L(T)==="passage"||L(cL)==="rubric-block-stimulus")return"passage";return"item"}),O0=O(()=>{L(Y0);let j=L(x)?.toolkitCoordinator;if(!j||typeof j.decideToolPolicy!=="function")return null;return j.decideToolPolicy({level:L(Jj),scope:{level:L(T),scopeId:L(kL),assessmentId:L(x)?.assessmentId,sectionId:L(BL)||void 0,itemId:L(tL)||void 0,canonicalItemId:L(n)||void 0,contentKind:L(cL)}})}),Zj=O(()=>{let j=(Z)=>Array.from(new Set(Z));if(L(O0))return j(L(e).normalizeToolIds(L(O0).visibleTools.map((Z)=>Z.toolId)).filter(Boolean));return j(L(tj))}),ej=O(()=>{let j=new Set;if(!L(O0))return j;for(let Z of L(O0).visibleTools){if(!Z.required&&!Z.alwaysAvailable)continue;for(let J of L(e).normalizeToolIds([Z.toolId]).filter(Boolean))j.add(J)}return j}),v0=O(()=>{if(L(T)==="section"||L(T)==="assessment")return!0;let j=L(wL)?.config;return!!(L(wL)&&j&&typeof j==="object")}),Uj=O(()=>{L(Y0);let j=L(x)?.toolkitCoordinator;if(!j||typeof j.getPolicyInputs!=="function")return null;return j.getPolicyInputs()}),sL=O(()=>L(Uj)?.assessment??null),G0=O(()=>L(Uj)?.currentItemRef??null),vL=O(()=>{if(L(T)==="section")return{level:"section",assessment:L(sL)||{},section:{}};if(L(T)==="assessment")return{level:"assessment",assessment:L(sL)||{}};if(!L(v0)||!L(wL))return null;if(L(T)==="passage")return{level:"passage",assessment:L(sL)||{},itemRef:L(G0)||{id:L(n)},passage:L(wL)};return{level:"item",assessment:L(sL)||{},itemRef:L(G0)||{id:L(n)},item:L(wL)}}),Kj=O(()=>{if(L(vL))return L(vL);return{level:"item",assessment:L(sL)||{},itemRef:L(G0)||{id:L(n)},item:L(wL)||{id:L(n),config:{}}}}),N0=O(()=>{if(L(T)!=="item"&&L(T)!=="passage")return[];if(!L(v0)||!L(wL))return[];let j=L(wL)?.config?.models;return(Array.isArray(j)?j:j&&typeof j==="object"?Object.values(j):[]).filter((J)=>J&&typeof J==="object"&&typeof J.id==="string").map((J)=>({level:"element",assessment:L(sL)||{},itemRef:L(G0)||{id:L(n)},item:L(wL),elementId:J.id}))}),LJ=O(()=>{let j=L(x)?.toolkitCoordinator||null,Z=(J)=>l0(J)?J:W0(J,L(T),L(kL));return{scope:{level:L(T),scopeId:L(kL),assessmentId:L(x)?.assessmentId,sectionId:L(BL),itemId:L(tL),canonicalItemId:L(n),contentKind:L(cL)},itemId:L(kL),catalogId:L(jj),language:X0(),i18n:L(oL),ui:{size:lL()},getScopeElement:()=>rL()||L(_L)?.scopeElement||null,getGlobalElementId:()=>{if(!L(uL)||!L(D0)||!L(BL)||!L(n))return null;return L(uL).getGlobalElementId(L(D0),L(BL),L(n),L(n))},toolCoordinator:L(S)||null,toolkitCoordinator:j,ttsService:L(Lj)||null,elementToolStateStore:L(uL)||null,toggleTool:(J)=>{if(!L(S))return;let K=Z(J);if(!L(S).getToolState(K))L(S).registerTool(K,J);L(S).toggleTool(K)},isToolVisible:(J)=>{if(!L(S))return!1;return L(S).isToolVisible(Z(J))},subscribeVisibility:L(S)?(J)=>L(S).subscribe(J):null}}),E0=O(()=>{L(_0);let j=L(x)?.toolkitCoordinator;if(!j||typeof j.hasToolContextResolver!=="function"||typeof j.resolveToolContext!=="function")return{};let Z={};for(let J of L(Zj)){if(!L(e).get(J)?.supportedLevels.includes(L(T)))continue;if(!j.hasToolContextResolver(J))continue;let R=j.resolveToolContext({toolId:J,context:L(Kj),toolbarContext:L(LJ)});if(R)Z[J]=R}return Z}),jJ=O(()=>{let j=L(Zj).filter((V)=>{let G=L(e).get(V);return G?G.supportedLevels.includes(L(T)):!1}),Z=Object.values(L(E0)),J=new Set(Z.map((V)=>V.toolId)),K=new Set(Z.filter((V)=>V.visible).map((V)=>V.toolId)),R=j.filter((V)=>!J.has(V));if(L(T)==="section")return R.forEach((V)=>K.add(V)),Array.from(K);if(!L(v0))return R.forEach((V)=>K.add(V)),Array.from(K);if(!L(vL)&&L(N0).length===0)return R.forEach((V)=>K.add(V)),Array.from(K);if(R.filter((V)=>L(ej).has(V)).forEach((V)=>K.add(V)),L(vL))L(e).filterVisibleInContext(R,L(vL)).forEach((V)=>K.add(V.toolId));for(let V of L(N0))L(e).filterVisibleInContext(R,V).forEach((G)=>K.add(G.toolId));let _=L(vL)?[L(vL),...L(N0)]:L(N0);for(let V of Array.from(K)){if(J.has(V))continue;if(!L(e).isApplicableToAnyContext(V,_))K.delete(V)}return Array.from(K)}),eL=O(()=>L(e).filterToolIdsByActivation(L(jJ),"toolbar-toggle"));DL(()=>{if(!p)return;let j=!1;return L(e).ensureToolModulesLoaded(L(eL)).then(()=>{if(!j)WL(nL,L(nL)+1)}).catch((Z)=>{console.error("[ItemToolBar] Failed to load one or more tool modules:",Z)}),()=>{j=!0}});function JJ(){if(rL())return rL();return L(_L)?.scopeElement||null}function ZJ(){if(!L(uL)||!L(D0)||!L(BL)||!L(n))return null;return L(uL).getGlobalElementId(L(D0),L(BL),L(n),L(n))}let EL=O(()=>{let j=L(x)?.toolkitCoordinator||null,Z=(J)=>{return l0(J)?J:W0(J,L(T),L(kL))};return{scope:{level:L(T),scopeId:L(kL),assessmentId:L(x)?.assessmentId,sectionId:L(BL),itemId:L(tL),canonicalItemId:L(n),contentKind:L(cL)},itemId:L(kL),catalogId:L(jj),language:X0(),i18n:L(oL),ui:{size:lL()},getScopeElement:JJ,getGlobalElementId:ZJ,toolCoordinator:L(S)||null,toolkitCoordinator:j,ttsService:L(Lj)||null,elementToolStateStore:L(uL)||null,toggleTool:(J)=>{if(!L(S))return;let K=Z(J);if(!L(S).getToolState(K))L(S).registerTool(K,J);L(S).toggleTool(K)},isToolVisible:(J)=>{if(!L(S))return!1;return L(S).isToolVisible(Z(J))},subscribeVisibility:L(S)?(J)=>L(S).subscribe(J):null,getResolvedToolContext:(J)=>L(E0)[J]??null,getToolRenderParams:(J)=>{let K=L(E0)[J]?.params??null,R=Qj.get(J);if(!R)return K;return{...K??{},...R}}}}),Qj=new Map,Vj=0,zL=O(()=>{if(!p)return[];L(nL);let j=[];for(let Z of L(eL)){let J=L(e).renderForToolbar(Z,L(Kj),L(EL));if(J)j.push(J)}return j}),UJ=O(()=>{if(!Array.isArray(V0()))return[];let j=[];return V0().forEach((Z,J)=>{if(Bj(Z)){j.push(Z);return}console.warn(`[ItemToolBar] Ignoring invalid host button at index ${J}. Expected { id, label, href | onClick } with valid types.`)}),j}),KJ=O(()=>L(zL).filter((j)=>!!j.button).map((j)=>{let Z=j.button;return{id:j.toolId,label:Z.label,ariaLabel:Z.ariaLabel||Z.label,icon:Z.icon,faIconName:Z.faIconName,tooltip:Z.tooltip||Z.label,disabled:Z.disabled,active:L(bL)[j.toolId]??Z.active??!1,onClick:()=>{Z.onClick(),iL()}}})),Xj=O(()=>[...L(KJ),...L(UJ)]),L0=O(()=>{let j={};for(let Z of L(zL))j[Z.toolId]=L(bL)[Z.toolId]??Z.button?.active??!1;return j}),QJ=O(()=>L(zL).flatMap((j)=>(j.elements||[]).filter((Z)=>Z.mount==="before-buttons").filter((Z)=>Boolean(Z.element)).map((Z,J)=>({key:`before-${j.toolId}-${J}`,toolId:j.toolId,entry:Z})))),VJ=O(()=>L(zL).flatMap((j)=>(j.elements||[]).filter((Z)=>Z.mount==="after-buttons").filter((Z)=>Boolean(Z.element)).map((Z,J)=>({key:`after-${j.toolId}-${J}`,toolId:j.toolId,entry:Z})))),Yj=O(()=>L(zL).flatMap((j)=>(j.elements||[]).filter((Z)=>Z.mount==="controls-row").filter((Z)=>Boolean(Z.element)).map((Z,J)=>({key:`controls-row-${j.toolId}-${J}`,toolId:j.toolId,entry:Z})))),Dj=O(()=>L(zL).flatMap((j)=>(j.elements||[]).map((Z)=>({toolId:j.toolId,hint:Z.layoutHints?.controlsRow})).filter((Z)=>Boolean(Z.hint)))),Oj=O(()=>L(zL).flatMap((j)=>(j.elements||[]).map((Z)=>({toolId:j.toolId,hint:Z.layoutHints?.headerOverlay})).filter((Z)=>Boolean(Z.hint)))),Gj=O(()=>L(Dj).some((j)=>j.hint?.reserveSpace===!0)),Nj=O(()=>L(Dj).some((j)=>j.hint?.showWhenToolActive===!0&&(L(L0)[j.toolId]??!1))),XJ=O(()=>SL()==="left"||SL()==="right"),Pj=O(()=>L(Oj).some((j)=>j.hint?.showWhenToolActive===!0&&(L(L0)[j.toolId]??!1))),YJ=O(()=>L(Yj).length>0||L(Gj)||L(Nj));function DJ(){if(!L(RL))return null;let j=L(RL).getRootNode();if(j instanceof ShadowRoot)return j.host;return null}DL(()=>{let j=DJ();if(!j)return;let Z=L(Oj).length>0,J=L(Pj);return j.setAttribute("data-pie-header-overlay",Z?"true":"false"),j.setAttribute("data-pie-header-overlay-active",J?"true":"false"),()=>{j.removeAttribute("data-pie-header-overlay"),j.removeAttribute("data-pie-header-overlay-active")}}),DL(()=>{if(!p||!L(hL))return;if(L(Xj).some((j)=>!!e0(j)))S0()});function P0(j){if(j.id in L(bL))return L(bL)[j.id]===!0;return j.active===!0}function Mj(j){return Tj(j)}function iL(){let j={};for(let Z of L(zL))if(Z.sync?.(),Z.button)j[Z.toolId]=Z.button.active??!1;WL(bL,j,!0)}DL(()=>{let j=[];iL();for(let Z of L(zL))if(Z.subscribeActive){let J=!1,K=Z.subscribeActive((R)=>{queueMicrotask(()=>{if(J)return;WL(bL,{...L(bL),[Z.toolId]:R},!0),Z.sync?.()})});j.push(()=>{J=!0,K()})}return()=>{j.forEach((Z)=>Z())}}),DL(()=>{let j=L(x)?.toolkitCoordinator;if(typeof j?.registerToolRequestTarget!=="function")return;let Z=L(Jj);return j.registerToolRequestTarget({level:Z,hostsTool:(J)=>L(eL).includes(J),open:(J,K)=>{if(!L(S))return;if(!L(eL).includes(J))return;if(K&&Object.keys(K).length>0)Vj+=1,Qj.set(J,{...K,toolRequestId:Vj});let R=W0(J,L(T),L(kL));if(!L(S).getToolState(R))L(S).registerTool(R,J);L(S).showTool(R),queueMicrotask(()=>iL())}})}),DL(()=>{if(!L(EL).subscribeVisibility)return;let j=!1,Z=L(EL).subscribeVisibility(()=>{queueMicrotask(()=>{if(j)return;iL()})});return()=>{j=!0,Z?.()}}),DL(()=>{let j=L(EL).toolkitCoordinator;if(typeof j?.subscribeTelemetry!=="function")return;let Z=!1,J=j.subscribeTelemetry(({eventName:K,payload:R})=>{if(K!=="pie-toolkit-tool-config-updated")return;if(R?.toolId&&!L(eL).includes(R.toolId))return;queueMicrotask(()=>{if(Z)return;WL(nL,L(nL)+1),iL()})});return()=>{Z=!0,J?.()}});let OJ="[data-pie-tool-overlay-boundary]";function GJ(j,Z){if(Z.container!=="content-boundary")return j;let J=j;while(J){if(J instanceof HTMLElement&&J.matches(OJ))return J;if(J instanceof HTMLElement&&J.parentElement){J=J.parentElement;continue}let K=J.getRootNode();J=K instanceof ShadowRoot?K.host:null}return j}function g0(j,Z){let J=Z,K=null,R=j,_=(G)=>{if(!G)return;let a=G.__pieToolElementUnmount;if(typeof a==="function")a()},V=(G)=>{if(K===G)return;if(K){if(_(K),K.parentNode===R)R.removeChild(K)}if(K=G,K){if(R=GJ(j,J),K.parentNode&&K.parentNode!==R)K.parentNode.removeChild(K);R.appendChild(K)}};return V(Z.element),{update(G){J=G,V(G.element)},destroy(){V(null)}}}function $0(j,Z){let J=Z,K=null,R=null,_=[],V=null,G=null,a=null,k=null,D=null,LL=null,jL=null,h=!1,d=!1,b=()=>J.mounted.entry.shell?.pageTabOrder===!0,B=()=>J.mounted.entry.shell?.ndsHeaderControls===!0,w=null,A=null,i=pJ({onMove:(U)=>fJ(U),onEnd:()=>{A=null}}),v=0,W=0,H=0,$=0,qL=0,u=0,GL=0,gL=0,HL=null,$L=[],E=0,g=0,C=J.mounted.entry.shell?.initialWidth??720,F=J.mounted.entry.shell?.initialHeight??560,I=C,TL=F,fL=!1,FL=null,JL=null,c=!1,r=(U)=>{if(!U)return;let X=U.__pieToolElementUnmount;if(typeof X==="function")X()},m0=()=>{let U=J.mounted.entry.shell;if(!U)return null;return{toolId:J.mounted.toolId,toolbarContext:L(EL),shellConfig:U}},RJ=(U)=>{let X=L(e).get(J.mounted.toolId),N=m0();if(!X?.onHostedMount||!N)return;X.onHostedMount(U,N)},M0=()=>{let U=L(e).get(J.mounted.toolId),X=m0();if(!U?.onHostedResize||!X)return;U.onHostedResize({width:C,height:F},J.mounted.entry.element,X)},qJ=()=>{let U=L(e).get(J.mounted.toolId),X=m0();if(!U?.onHostedUnmount||!X)return;U.onHostedUnmount(J.mounted.entry.element,X)},ZL=(U,X,N)=>Math.max(X,Math.min(U,N)),FJ=()=>{let U=J.mounted.entry.shell,X=U?.minWidth??320,N=U?.minHeight??240,Y=U?.maxWidth??window.innerWidth,Q=U?.maxHeight??window.innerHeight;return{minWidth:X,minHeight:N,maxWidth:Y,maxHeight:Q}},h0=()=>{let U=J.mounted.entry.shell?.minWidth,X=typeof U==="number"&&U>0&&C<U,N=X?`${U}px`:"";if(w)w.style.minWidth=N;if(V)V.style.minWidth="0";if(G)G.style.minWidth="0",G.style.overflowX=X?"auto":"hidden"},qj=()=>J.mounted.entry.shell?.content?.overflowY==="auto"?"auto":"hidden",WJ=()=>{if(!V)return 0;let U=V.getBoundingClientRect().height;if(U>0)return U;return V.offsetHeight||0},u0=()=>{if(!G)return;let U=J.mounted.entry.shell;if(G.style.overflowY=qj(),!w)return;if(U?.content?.preserveMinHeight===!0){let X=WJ(),N=U.minHeight??240,Y=Math.max(0,N-X),Q=Math.max(0,F-X),P=Math.max(Q,Y);w.style.height=`${P}px`,w.style.minHeight="0",w.style.flex=`0 0 ${P}px`;return}w.style.height="100%",w.style.minHeight="0",w.style.flex="1 1 auto"},kJ=()=>{let U=J.mounted.entry.shell,X=U?.initialWidth??720,N=U?.initialHeight??560;if(X===I&&N===TL)return;if(I=X,TL=N,fL)return;C=X,F=N,F0()},R0=()=>{let{minWidth:U,minHeight:X,maxWidth:N,maxHeight:Y}=FJ(),Q=Math.min(U,window.innerWidth),P=Math.min(X,window.innerHeight);C=ZL(C,Q,Math.max(Q,Math.min(N,window.innerWidth))),F=ZL(F,P,Math.max(P,Math.min(Y,window.innerHeight))),E=ZL(E,0,Math.max(0,window.innerWidth-C)),g=ZL(g,0,Math.max(0,window.innerHeight-F)),j0(),h0(),u0(),M0()},AL=(U,X)=>{fL=!0,E+=U,g+=X,R0()},q0=(U,X)=>{fL=!0,C+=U,F+=X,R0()},Fj=(U,X,N,Y="fa-regular")=>{let Q=document.createElement("nds-icon-button");if(Q.setAttribute("variant","tertiary"),Q.setAttribute("size","small"),Q.setAttribute("type","circle"),Q.setAttribute("icon-name",X),Q.setAttribute("button-aria-label",U),Q.title=U,Q.addEventListener("click",(P)=>{P.stopPropagation(),N(),aL()}),Y!=="fa-light"){let P=(y)=>{y.classList.remove("fa-light"),y.classList.add(Y)},q=Q.querySelector("i.fa-light");if(q)P(q);else{let y=new MutationObserver(()=>{let s=Q.querySelector("i.fa-light");if(s)P(s),y.disconnect()});y.observe(Q,{childList:!0,subtree:!0})}}return Q},Wj=(U,X,N)=>{let Y=document.createElement("button");return Y.type="button",Y.className="pie-tool-shell__control",Y.setAttribute("aria-label",U),Y.title=U,Y.textContent=X,Y.style.border="1px solid transparent",Y.style.background="color-mix(in srgb, var(--pie-white, #fff) 10%, transparent)",Y.style.color="inherit",Y.style.cursor="pointer",Y.style.display="inline-flex",Y.style.alignItems="center",Y.style.justifyContent="center",Y.style.width="28px",Y.style.height="28px",Y.style.padding="0",Y.style.fontSize="14px",Y.style.fontWeight="700",Y.style.borderRadius="8px",Y.style.lineHeight="1",Y.onclick=(Q)=>{Q.stopPropagation(),N(),aL()},Y.onfocus=()=>{Y.style.outline="2px solid var(--pie-button-focus-outline, var(--pie-primary, #4A90E2))",Y.style.outlineOffset="2px"},Y.onblur=()=>{Y.style.outline="none",Y.style.outlineOffset="0"},Y},j0=()=>{if(!K)return;K.style.left=`${E}px`,K.style.top=`${g}px`,K.style.width=`${C}px`,K.style.height=`${F}px`,K.style.display=J.active?"flex":"none"},kj=()=>{if(a)a.textContent=J.mounted.entry.shell?.title||J.mounted.toolId;for(let{el:U,key:X}of _){let N=J.i18n.t(X);if(U.tagName==="NDS-ICON-BUTTON")U.setAttribute("button-aria-label",N);else U.setAttribute("aria-label",N);if(U.title)U.title=N}},wj=()=>{if(!G)return;let U=J.mounted.entry.element;if(U.style.display="block",U.style.width="100%",U.style.height="100%",U.style.flex="1 1 auto",U.style.minHeight="0",w&&w!==U){if(w.parentNode===G)r(w),G.removeChild(w);w=null}if(U.parentNode&&U.parentNode!==G)U.parentNode.removeChild(U);if(U.parentNode!==G)G.appendChild(U);w=U,h0(),u0(),RJ(U)},aL=()=>{if(L(S)&&K)L(S).bringToFront(K)},F0=()=>{let{innerWidth:U,innerHeight:X}=window,N=J.mounted.entry.shell,Y=N?.initialAlign??"center",Q=N?.initialMargin??16,P=Q+60;switch(Y){case"top-left":E=Q,g=P;break;case"top-right":E=Math.max(0,U-C-Q),g=P;break;case"bottom-left":E=Q,g=Math.max(0,X-F-P);break;case"bottom-right":E=Math.max(0,U-C-Q),g=Math.max(0,X-F-P);break;default:E=Math.max(0,Math.round((U-C)/2)),g=Math.max(0,Math.round((X-F)/2))}R0()},wJ=()=>{let U=JL;if(!U)return;queueMicrotask(()=>{if(!U.isConnected)return;try{U.focus()}catch{}})},zj=()=>{if(typeof document>"u")return null;let U=document.activeElement;while(U){let X=U.shadowRoot;if(X&&X.activeElement&&X.activeElement!==U)U=X.activeElement;else break}return U??null},Hj=()=>{if(!K||FL)return;let U=zj();if(!JL&&U&&!K.contains(U))JL=U;if(b()&&!d)document.addEventListener("keydown",s0,!0),d=!0;FL=yJ(K,{initialFocus:D,onEscape:()=>{i0()},wrap:!b(),onTabExit:b()?(X,N)=>{if(X==="backward"){if(JL?.isConnected){N.preventDefault();try{JL.focus()}catch{}}return}let Y=c0();if(Y){N.preventDefault();try{Y.focus()}catch{}}}:void 0})},c0=()=>{let U=L(EL).getScopeElement?.()??null;if(!U)return null;let X=(Y)=>{if(L(RL)&&L(RL).contains(Y))return!0;if(K&&K.contains(Y))return!0;return!1},N=(Y)=>{if(Y instanceof HTMLElement){if(X(Y))return null;if(Y.matches?.(bJ)&&_J(Y))return Y}let Q=Y.shadowRoot;if(Q)for(let P=0;P<Q.children.length;P++){let q=N(Q.children[P]);if(q)return q}for(let P=0;P<Y.children.length;P++){let q=N(Y.children[P]);if(q)return q}return null};return N(U)},zJ=()=>{if(!K)return[];return IJ(K).filter((U)=>U!==LL&&U!==jL)},s0=(U)=>{if(U.key!=="Tab")return;if(!K||!J.active)return;let X=zj();if(!X)return;if(K.contains(X))return;let N=zJ();if(N.length===0)return;if(U.shiftKey){let Y=c0();if(X!==Y)return;U.preventDefault();try{N[N.length-1].focus()}catch{}return}if(X!==JL)return;U.preventDefault();try{N[0].focus()}catch{}},fj=()=>{if(d)document.removeEventListener("keydown",s0,!0),d=!1;if(!FL)return;let U=FL;FL=null;try{U()}catch{}wJ()},i0=()=>{L(EL).toggleTool(J.mounted.toolId),iL()},xj=(U)=>{if(!J.mounted.entry.shell?.draggable)return;if(U.target.closest("button")||!K)return;if(!i.begin(U,K))return;A="drag",fL=!0,v=U.clientX-E,W=U.clientY-g,K.setPointerCapture(U.pointerId),aL()},HJ=(U)=>(X)=>{if(!K||!J.mounted.entry.shell?.resizable)return;if(X.stopPropagation(),!i.begin(X,K))return;A="resize",fL=!0,HL=U,H=C,$=F,qL=X.clientX,u=X.clientY,GL=E,gL=g,K.setPointerCapture(X.pointerId),aL()},fJ=(U)=>{if(!K)return;if(A==="drag"){U.preventDefault();let X=Math.max(0,window.innerWidth-C),N=Math.max(0,window.innerHeight-F);E=ZL(U.clientX-v,0,X),g=ZL(U.clientY-W,0,N),j0();return}if(A==="resize"){U.preventDefault();let X=J.mounted.entry.shell,N=X?.minWidth??320,Y=X?.minHeight??240,Q=Math.min(N,window.innerWidth),P=Math.min(Y,window.innerHeight),q=X?.maxWidth??window.innerWidth,y=X?.maxHeight??window.innerHeight,s=U.clientX-qL,KL=U.clientY-u;if(HL==="se")C=ZL(H+s,Q,Math.max(Q,Math.min(q,window.innerWidth-E))),F=ZL($+KL,P,Math.max(P,Math.min(y,window.innerHeight-g)));else if(HL==="sw"){let t=GL+H,NL=ZL(H-s,Q,Math.min(q,t));E=t-NL,C=NL,F=ZL($+KL,P,Math.max(P,Math.min(y,window.innerHeight-g)))}else if(HL==="ne"){let t=gL+$;C=ZL(H+s,Q,Math.max(Q,Math.min(q,window.innerWidth-E)));let NL=ZL($-KL,P,Math.min(y,t));g=t-NL,F=NL}else if(HL==="nw"){let t=GL+H,NL=gL+$,m=ZL(H-s,Q,Math.min(q,t));E=t-m,C=m;let J0=ZL($-KL,P,Math.min(y,NL));g=NL-J0,F=J0}j0(),h0(),u0(),M0()}},Sj=()=>{R0()};if(p&&J.mounted.entry.shell){let U=J.mounted.entry.shell?.ndsHeaderControls===!0&&L(hL);if(U)S0();if(K=document.createElement("div"),K.className="pie-tool-shell",K.setAttribute("data-pie-tool-shell",J.mounted.toolId),K.style.position="fixed",K.style.zIndex="2000",K.style.background="var(--pie-background, #fff)",K.style.border="1px solid var(--pie-border-light, #d1d5db)",K.style.borderRadius="12px",K.style.boxShadow="0 10px 40px color-mix(in srgb, var(--pie-black, #000) 25%, transparent)",K.style.setProperty("--color-interactive-blue","var(--pie-calculator-button-color, var(--pie-button-color, var(--pie-text, #222)))"),K.style.setProperty("--color-new-gray","var(--pie-background-dark, #f3f5f7)"),K.style.setProperty("--color-primary-white","var(--pie-white, #ffffff)"),K.style.setProperty("--color-primary-black","var(--pie-text, #000000)"),K.style.setProperty("--color-focus-blue","var(--pie-button-focus-outline, #2b87ff)"),K.style.overflow="visible",K.style.display=J.active?"flex":"none",K.style.flexDirection="column",K.style.userSelect="none",K.style.webkitUserSelect="none",K.style.touchAction="none",K.setAttribute("draggable","false"),K.addEventListener("dragstart",(Q)=>Q.preventDefault()),V=document.createElement("div"),V.className="pie-tool-shell__header",V.style.display="flex",V.style.flexWrap="wrap",V.style.alignItems="center",V.style.justifyContent="space-between",V.style.gap="6px",V.style.padding=B()?"12px 12px 12px 28px":"10px 12px",B())V.style.minHeight="48px";if(B())V.style.background="var(--pie-section-player-card-header-background, var(--pie-button-active-bg, #f3f4f6))",V.style.color="var(--pie-text, #111827)",V.style.borderBottom="1px solid var(--pie-border-light, #e5e7eb)";else V.style.background="var(--pie-primary-dark, #2c3e50)",V.style.color="var(--pie-white, #fff)";V.style.cursor=J.mounted.entry.shell.draggable===!1?"default":"move",V.style.flex="0 0 auto",V.style.borderRadius="12px 12px 0 0",V.style.overflow="hidden",V.style.userSelect="none",V.style.webkitUserSelect="none",V.style.touchAction="none",V.setAttribute("draggable","false"),V.addEventListener("dragstart",(Q)=>Q.preventDefault()),a=document.createElement("span"),a.className="pie-tool-shell__title",a.style.minWidth="0",a.style.overflowWrap="anywhere",a.textContent=J.mounted.entry.shell.title||J.mounted.toolId,V.appendChild(a),k=document.createElement("div"),k.className="pie-tool-shell__controls",k.style.display="inline-flex",k.style.flexWrap="wrap",k.style.minWidth="0",k.style.alignItems="center",k.style.gap=B()?"6px":"4px";let X=J.mounted.entry.shell,N=(Q,P,q,y,s="fa-regular")=>{if(!k)return;let KL=J.i18n.t(Q),t=U?Fj(KL,q,y,s):Wj(KL,P,y);_.push({el:t,key:Q}),k.appendChild(t)};if(X?.draggable!==!1)N("toolkit.window.moveLeftA11y","←","chevron-left",()=>AL(-24,0)),N("toolkit.window.moveRightA11y","→","chevron-right",()=>AL(24,0)),N("toolkit.window.moveUpA11y","↑","chevron-up",()=>AL(0,-24)),N("toolkit.window.moveDownA11y","↓","chevron-down",()=>AL(0,24));if(X?.resizable!==!1)N("toolkit.window.shrinkA11y","−","magnifying-glass-minus",()=>q0(-40,-40)),N("toolkit.window.growA11y","+","magnifying-glass-plus",()=>q0(40,40));if(!B()){let Q=Wj(J.i18n.t("toolkit.window.centerA11y"),"◎",F0);_.push({el:Q,key:"toolkit.window.centerA11y"}),k.appendChild(Q)}let Y=null;if(B())Y=document.createElement("div"),Y.className="pie-tool-shell__header-right",Y.style.display="inline-flex",Y.style.flexWrap="wrap",Y.style.maxWidth="100%",Y.style.justifyContent="flex-end",Y.style.alignItems="center",Y.style.gap="6px",Y.appendChild(k),V.appendChild(Y);else V.appendChild(k);if(U)D=Fj(J.i18n.t("toolkit.window.closeA11y"),"xmark",i0,"fa-regular"),_.push({el:D,key:"toolkit.window.closeA11y"}),D.style.display=J.mounted.entry.shell.closeable===!1?"none":"inline-block";else{let Q=document.createElement("button");Q.type="button",Q.className="pie-tool-shell__close",Q.setAttribute("aria-label",J.i18n.t("toolkit.window.closeA11y")),_.push({el:Q,key:"toolkit.window.closeA11y"});let P="http://www.w3.org/2000/svg",q=document.createElementNS(P,"svg");q.setAttribute("xmlns",P),q.setAttribute("viewBox","0 0 16 16"),q.setAttribute("aria-hidden","true");let y=document.createElementNS(P,"path");y.setAttribute("d","M3.5 3.5L12.5 12.5M12.5 3.5L3.5 12.5"),y.setAttribute("stroke","currentColor"),y.setAttribute("stroke-width","1.8"),y.setAttribute("stroke-linecap","round"),q.appendChild(y),Q.appendChild(q);let s=q.style;s.width="16px",s.height="16px",s.display="block",s.flexShrink="0",s.pointerEvents="none";let KL="color-mix(in srgb, var(--pie-white, #fff) 8%, transparent)",t="color-mix(in srgb, var(--pie-white, #fff) 18%, transparent)";Q.style.border="1px solid transparent",Q.style.background=KL,Q.style.color="inherit",Q.style.cursor="pointer",Q.style.display="inline-flex",Q.style.alignItems="center",Q.style.justifyItems="center",Q.style.width="28px",Q.style.height="28px",Q.style.padding="0",Q.style.borderRadius="8px",Q.style.lineHeight="0",Q.style.transition="background-color 0.15s ease, border-color 0.15s ease",Q.style.display=J.mounted.entry.shell.closeable===!1?"none":"inline-flex",Q.onmouseenter=()=>{Q.style.background=t},Q.onmouseleave=()=>{Q.style.background=KL},Q.onfocus=()=>{Q.style.outline="2px solid var(--pie-button-focus-outline, var(--pie-primary, #4A90E2))",Q.style.outlineOffset="2px"},Q.onblur=()=>{Q.style.outline="none",Q.style.outlineOffset="0"},Q.onclick=i0,D=Q}if(Y)Y.appendChild(D);else V.appendChild(D);if(V.tabIndex=0,V.onkeydown=(Q)=>{if(Q.key==="Home"){Q.preventDefault(),F0();return}let P=J.mounted.entry.shell;if(Q.shiftKey&&P?.resizable!==!1){if(Q.key==="ArrowRight"||Q.key==="ArrowDown"){Q.preventDefault(),q0(40,40);return}if(Q.key==="ArrowLeft"||Q.key==="ArrowUp"){Q.preventDefault(),q0(-40,-40);return}}if(P?.draggable!==!1){if(Q.key==="ArrowLeft")Q.preventDefault(),AL(-24,0);else if(Q.key==="ArrowRight")Q.preventDefault(),AL(24,0);else if(Q.key==="ArrowUp")Q.preventDefault(),AL(0,-24);else if(Q.key==="ArrowDown")Q.preventDefault(),AL(0,24)}},G=document.createElement("div"),G.className="pie-tool-shell__content",G.style.position="relative",G.style.width="100%",G.style.flex="1 1 auto",G.style.minHeight="0",G.style.overflowX="hidden",G.style.overflowY=qj(),G.style.borderRadius="0 0 12px 12px",B()){let Q=(P)=>{let q=document.createElement("div");return q.tabIndex=0,q.setAttribute("aria-hidden","true"),q.setAttribute("data-pie-tool-shell-focus-guard",P),q.style.position="absolute",q.style.width="1px",q.style.height="1px",q.style.padding="0",q.style.margin="-1px",q.style.overflow="hidden",q.style.clipPath="inset(50%)",q.style.whiteSpace="nowrap",q.style.border="0",q};LL=Q("start"),jL=Q("end"),LL.addEventListener("focus",(P)=>{if(h)return;h=!0;try{if(P.stopPropagation(),JL?.isConnected)try{JL.focus()}catch{}}finally{queueMicrotask(()=>{h=!1})}}),jL.addEventListener("focus",(P)=>{if(h)return;h=!0;try{P.stopPropagation();let q=c0();if(q)try{q.focus()}catch{}}finally{queueMicrotask(()=>{h=!1})}}),K.appendChild(LL)}if(K.appendChild(V),K.appendChild(G),B()&&jL)K.appendChild(jL);if(J.mounted.entry.shell.resizable!==!1){let Q=(P,q,y,s,KL,t,NL)=>{let m=document.createElement("div");if(m.className="pie-tool-shell__resize",m.style.position="absolute",m.style.width="24px",m.style.height="24px",m.style.cursor=t,m.style.zIndex="10",m.style.touchAction="none",m.setAttribute("draggable","false"),q!==null)m.style.top=q;if(y!==null)m.style.right=y;if(s!==null)m.style.bottom=s;if(KL!==null)m.style.left=KL;if(NL!==null)m.style.background=`linear-gradient(${NL}, transparent 0%, transparent 40%, rgba(0,0,0,0.35) 40%, rgba(0,0,0,0.35) 60%, transparent 60%, transparent 100%)`;let J0=HJ(P);m.addEventListener("pointerdown",J0),K.appendChild(m),$L.push({el:m,handler:J0})};Q("se",null,"0","0",null,"nwse-resize",null),Q("nw","0",null,null,"0","nwse-resize","135deg"),Q("ne","0","0",null,null,"nesw-resize",null),Q("sw",null,null,"0","0","nesw-resize",null)}if(V.addEventListener("pointerdown",xj),K.addEventListener("pointerdown",aL),window.addEventListener("resize",Sj),document.body.appendChild(K),R=new AJ(K,{context:mj,initialValue:J.runtime}),R.connect(),F0(),j0(),kj(),wj(),M0(),J.active)Hj();c=J.active}return{update(U){if(J=U,!K||!G||!a||!D)return;R?.setValue(J.runtime),kj(),kJ();let X=D.tagName.toLowerCase()==="nds-icon-button"?"inline-block":"inline-flex";if(D.style.display=J.mounted.entry.shell?.closeable===!1?"none":X,j0(),wj(),M0(),!c&&J.active)Hj();else if(c&&!J.active)fj(),JL=null;c=J.active},destroy(){if(qJ(),R?.disconnect(),R=null,_.length=0,FL)fj();if(d)document.removeEventListener("keydown",s0,!0),d=!1;for(let{el:U,handler:X}of $L)U.removeEventListener("pointerdown",X);if(JL=null,$L.length=0,V)V.removeEventListener("pointerdown",xj),V.onkeydown=null;if(i.release(),K)K.removeEventListener("pointerdown",aL);if(window.removeEventListener("resize",Sj),w&&G&&w.parentNode===G)r(w),G.removeChild(w);if(w=null,K&&K.parentElement)K.remove()}}}var NJ={get level(){return mL()},set level(j){mL(j),l()},get scopeId(){return Q0()},set scopeId(j){Q0(j),l()},get itemId(){return B0()},set itemId(j){B0(j),l()},get sectionId(){return T0()},set sectionId(j){T0(j),l()},get catalogId(){return A0()},set catalogId(j){A0(j),l()},get tools(){return C0()},set tools(j){C0(j),l()},get contentKind(){return I0()},set contentKind(j){I0(j),l()},get position(){return SL()},set position(j){SL(j),l()},get scopeElement(){return rL()},set scopeElement(j){rL(j),l()},get toolRegistry(){return y0()},set toolRegistry(j){y0(j),l()},get item(){return p0()},set item(j){p0(j),l()},get hostButtons(){return V0()},set hostButtons(j){V0(j),l()},get class(){return b0()},set class(j){b0(j),l()},get size(){return lL()},set size(j){lL(j),l()},get language(){return X0()},set language(j){X0(j),l()}},Rj=XL(),PJ=QL(Rj);{var MJ=(j)=>{var Z=mJ();let J;var K=dL(Z),R=dL(K);U0(R,17,()=>L(QJ),(k)=>k.key,(k,D)=>{var LL=XL(),jL=QL(LL);{var h=(b)=>{var B=XL(),w=QL(B);f0(w,()=>L(hL),(A)=>{var i=w0();xL(i,(v,W)=>$0?.(v,W),()=>({mounted:L(D),active:L(L0)[L(D).toolId]??!1,runtime:L(x),i18n:L(oL)})),z(A,i)}),z(b,B)},d=(b)=>{var B=w0();xL(B,(w,A)=>g0?.(w,A),()=>L(D).entry),z(b,B)};YL(jL,(b)=>{if(L(D).entry.shell)b(h);else b(d,-1)})}z(k,LL)});var _=H0(R,2);U0(_,17,()=>L(Xj),(k)=>k.id,(k,D,LL,jL)=>{let h=O(()=>L(hL)&&!a0(L(D))?e0(L(D)):null);var d=XL(),b=QL(d);{var B=(v)=>{var W=vJ(),H=dL(W);IL(H,1,"item-toolbar__nds-button svelte-1c13522"),yL(H,"type","circle"),yL(H,"size","small"),yL(H,"variant","tertiary"),VL(()=>yL(H,"icon-name",L(h))),VL(()=>yL(H,"button-aria-label",L(D).ariaLabel||L(D).label)),VL(()=>yL(H,"title",L(D).tooltip||L(D).label)),VL(()=>yL(H,"disabled",L(D).disabled)),xL(H,($)=>rj?.($)),xL(H,($,qL)=>lj?.($,qL),()=>P0(L(D))),PL(W),Z0("click",H,function(...$){L(D).onClick?.apply(this,$)}),z(v,W)},w=(v)=>{var W=EJ();let H;var $=dL(W);{var qL=(u)=>{var GL=XL(),gL=QL(GL);{var HL=(F)=>{var I=z0();K0(I,()=>k0(L(D).icon),!0),PL(I),z(F,I)},$L=O(()=>d0(L(D).icon)),E=(F)=>{var I=Cj();VL(()=>UL(I,"src",L(D).icon)),z(F,I)},g=O(()=>r0(L(D).icon)),C=(F)=>{let I=O(()=>Mj(L(D).icon));var TL=XL(),fL=QL(TL);{var FL=(c)=>{var r=z0();K0(r,()=>k0(L(I)),!0),PL(r),z(c,r)},JL=(c)=>{var r=Ij();VL(()=>IL(r,1,`icon icon-${L(D).icon}`,"svelte-1c13522")),z(c,r)};YL(fL,(c)=>{if(L(I))c(FL);else c(JL,-1)})}z(F,TL)};YL(gL,(F)=>{if(L($L))F(HL);else if(L(g))F(E,1);else F(C,-1)})}z(u,GL)};YL($,(u)=>{if(L(D).icon)u(qL)})}PL(W),VL((u)=>{H=IL(W,1,"item-toolbar__button svelte-1c13522",null,H,{"item-toolbar__button--active":u}),UL(W,"href",L(D).disabled?void 0:L(D).href),UL(W,"target",L(D).target),UL(W,"rel",L(D).rel),UL(W,"aria-label",L(D).ariaLabel||L(D).label),UL(W,"title",L(D).tooltip||L(D).label),UL(W,"aria-disabled",L(D).disabled?"true":void 0)},[()=>P0(L(D))]),Z0("click",W,(u)=>{if(L(D).disabled)u.preventDefault()}),z(v,W)},A=O(()=>a0(L(D))),i=(v)=>{var W=gJ();let H;var $=dL(W);{var qL=(u)=>{var GL=XL(),gL=QL(GL);{var HL=(F)=>{var I=z0();K0(I,()=>k0(L(D).icon),!0),PL(I),z(F,I)},$L=O(()=>d0(L(D).icon)),E=(F)=>{var I=Cj();VL(()=>UL(I,"src",L(D).icon)),z(F,I)},g=O(()=>r0(L(D).icon)),C=(F)=>{let I=O(()=>Mj(L(D).icon));var TL=XL(),fL=QL(TL);{var FL=(c)=>{var r=z0();K0(r,()=>k0(L(I)),!0),PL(r),z(c,r)},JL=(c)=>{var r=Ij();VL(()=>IL(r,1,`icon icon-${L(D).icon}`,"svelte-1c13522")),z(c,r)};YL(fL,(c)=>{if(L(I))c(FL);else c(JL,-1)})}z(F,TL)};YL(gL,(F)=>{if(L($L))F(HL);else if(L(g))F(E,1);else F(C,-1)})}z(u,GL)};YL($,(u)=>{if(L(D).icon)u(qL)})}PL(W),VL((u,GL)=>{H=IL(W,1,"item-toolbar__button svelte-1c13522",null,H,{"item-toolbar__button--active":u}),UL(W,"aria-label",L(D).ariaLabel||L(D).label),UL(W,"aria-pressed",GL),UL(W,"title",L(D).tooltip||L(D).label),W.disabled=L(D).disabled},[()=>P0(L(D)),()=>P0(L(D))]),Z0("click",W,function(...u){L(D).onClick?.apply(this,u)}),z(v,W)};YL(b,(v)=>{if(L(h))v(B);else if(L(A))v(w,1);else v(i,-1)})}z(k,d)});var V=H0(_,2);U0(V,17,()=>L(VJ),(k)=>k.key,(k,D)=>{var LL=XL(),jL=QL(LL);{var h=(b)=>{var B=XL(),w=QL(B);f0(w,()=>L(hL),(A)=>{var i=w0();xL(i,(v,W)=>$0?.(v,W),()=>({mounted:L(D),active:L(L0)[L(D).toolId]??!1,runtime:L(x),i18n:L(oL)})),z(A,i)}),z(b,B)},d=(b)=>{var B=w0();xL(B,(w,A)=>g0?.(w,A),()=>L(D).entry),z(b,B)};YL(jL,(b)=>{if(L(D).entry.shell)b(h);else b(d,-1)})}z(k,LL)}),PL(K);var G=H0(K,2);{var a=(k)=>{var D=$J();let LL;U0(D,21,()=>L(Yj),(jL)=>jL.key,(jL,h)=>{var d=XL(),b=QL(d);{var B=(A)=>{var i=XL(),v=QL(i);f0(v,()=>L(hL),(W)=>{var H=yj();xL(H,($,qL)=>$0?.($,qL),()=>({mounted:L(h),active:L(L0)[L(h).toolId]??!1,runtime:L(x),i18n:L(oL)})),z(W,H)}),z(A,i)},w=(A)=>{var i=yj();xL(i,(v,W)=>g0?.(v,W),()=>L(h).entry),z(A,i)};YL(b,(A)=>{if(L(h).entry.shell)A(B);else A(w,-1)})}z(jL,d)}),PL(D),VL(()=>LL=IL(D,1,"item-toolbar__controls-row svelte-1c13522",null,LL,{"item-toolbar__controls-row--reserve":L(Gj),"item-toolbar__controls-row--active":L(Nj),"item-toolbar__controls-row--align-start":L(XJ)})),z(k,D)};YL(G,(k)=>{if(L(YJ))k(a)})}PL(Z),gj(Z,(k)=>WL(RL,k),()=>L(RL)),VL(()=>{J=IL(Z,1,`item-toolbar ${b0()??""} item-toolbar--${lL()??""}`,"svelte-1c13522",J,{"item-toolbar--top":SL()==="top","item-toolbar--right":SL()==="right","item-toolbar--bottom":SL()==="bottom","item-toolbar--left":SL()==="left","item-toolbar--header-overlay-active":L(Pj)}),UL(Z,"data-content-kind",L(cL)),UL(Z,"data-level",L(T))}),Z0("focusin",K,(k)=>{if(L(T)==="section"&&k.target instanceof HTMLElement)k.target.scrollIntoView({block:"nearest",inline:"nearest"})}),z(j,Z)};YL(PJ,(j)=>{if(p)j(MJ)})}return z(f,Rj),bj(NJ)}vj(["focusin","click"]);TJ("pie-item-toolbar",$j(ij,{level:{attribute:"level",type:"String"},scopeId:{attribute:"scope-id",type:"String"},itemId:{attribute:"item-id",type:"String"},sectionId:{attribute:"section-id",type:"String"},catalogId:{attribute:"catalog-id",type:"String"},tools:{attribute:"tools",type:"String"},contentKind:{attribute:"content-kind",type:"String"},position:{attribute:"position",type:"String"},size:{attribute:"size",type:"String"},language:{attribute:"language",type:"String"},scopeElement:{type:"Object"},toolRegistry:{type:"Object"},item:{type:"Object"},hostButtons:{type:"Object"},class:{}},[],[],{mode:"open"}));
40
+ export{ij as a};
@@ -0,0 +1,2 @@
1
+ var d=((a)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(b,c)=>(typeof require<"u"?require:b)[c]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});
2
+ export{d as X};
@@ -0,0 +1,4 @@
1
+ var dQ="5";if(typeof window<"u")((window.__svelte??={}).v??=new Set).add(dQ);var h=2,g0=4,J7=8,P7=16777216,n=16,c=32,Z0=64,j7=128,GJ=256,G0=512,T=1024,R=2048,v=4096,d=8192,y=16384,$0=32768,Q7=33554432,U0=65536,U7=131072,fJ=262144,m0=524288,_Q=1048576,x0=33554432,f7=2097152,R0=4194304,I0=8388608,V0=Symbol("$state"),$J=Symbol("component"),d7=Symbol("legacy props"),lQ=Symbol(""),dJ=Symbol("proxy path"),VJ=Symbol("attributes"),_7=Symbol("class"),_J=Symbol("style"),l7=Symbol("text"),lJ=Symbol("form reset"),cQ=Symbol("hmr anchor"),o0=new class extends Error{name="StaleReactionError";message="The reaction that called `getAbortSignal()` was re-run or destroyed"},cJ=!!globalThis.document?.contentType&&globalThis.document.contentType.includes("xml");var T7=3,O0=8;var iQ=1,oQ=2,iJ=4,sQ=8,aQ=16,rQ=1,nQ=2,tQ=4,eQ=8,J4=16;var Q4=1,W4=2;var x7="[",W7="[!",oJ="[?",H7="]",v0={};var E=Symbol("uninitialized"),E0=Symbol("filename"),K4=Symbol("hmr"),qJ="http://www.w3.org/1999/xhtml",c7="http://www.w3.org/2000/svg",sJ="http://www.w3.org/1998/Math/MathML";function X4(){console.warn("https://svelte.dev/e/derived_inert")}function z4(J,Q,W){console.warn("https://svelte.dev/e/hydration_attribute_changed")}function K7(J){console.warn("https://svelte.dev/e/hydration_mismatch")}function Z4(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}var s0=Array.isArray,G4=Array.prototype.indexOf,B7=Array.prototype.includes,E7=Array.from,i7=Object.keys,H0=Object.defineProperty,B0=Object.getOwnPropertyDescriptor,PJ=Object.getOwnPropertyDescriptors,aJ=Object.prototype,$4=Array.prototype,Y7=Object.getPrototypeOf,rJ=Object.isExtensible;var u0=()=>{};function UJ(J){for(var Q=0;Q<J.length;Q++)J[Q]()}function HJ(){var J,Q,W=new Promise((K,X)=>{J=K,Q=X});return{promise:W,resolve:J,reject:Q}}function V4(J){var Q=L;if(Q===null)return F.f|=I0,J;if((Q.f&$0)===0&&(Q.f&g0)===0)throw J;Y0(J,Q)}function Y0(J,Q){if(Q!==null&&(Q.f&y)!==0)return;while(Q!==null){if((Q.f&j7)!==0&&(Q.f&(y|Q7))===0){if((Q.f&$0)===0)throw J;try{Q.b.error(J);return}catch(W){J=W}}Q=Q.parent}throw J}function P4(){throw Error("https://svelte.dev/e/async_derived_orphan")}function U4(J,Q,W){throw Error("https://svelte.dev/e/each_key_duplicate")}function H4(J){throw Error("https://svelte.dev/e/effect_in_teardown")}function B4(){throw Error("https://svelte.dev/e/effect_in_unowned_derived")}function Y4(J){throw Error("https://svelte.dev/e/effect_orphan")}function M4(){throw Error("https://svelte.dev/e/effect_update_depth_exceeded")}function L4(){throw Error("https://svelte.dev/e/hydration_failed")}function w4(J){throw Error("https://svelte.dev/e/props_invalid_value")}function F4(){throw Error("https://svelte.dev/e/state_descriptors_fixed")}function O4(){throw Error("https://svelte.dev/e/state_prototype_fixed")}function D4(){throw Error("https://svelte.dev/e/state_unsafe_mutation")}function S4(){throw Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}var J0=!1,X7=!1;var C=null;function a0(J){C=J}function nJ(J,Q=!1,W){C={p:C,i:!1,c:null,e:null,s:J,x:null,r:L,l:X7&&!Q?{s:null,u:null,$:[]}:null}}function tJ(J){var Q=C,W=Q.e;if(W!==null){Q.e=null;for(var K of W)eJ(K)}if(J!==void 0)Q.x=J;return Q.i=!0,C=Q.p,o7(J)}function o7(J={}){return H0(J,$J,{value:!0}),J}function k0(){return!X7||C!==null&&C.l===null}var M7=[];function A4(){var J=M7;M7=[],UJ(J)}function s(J){if(M7.length===0&&!L7){var Q=M7;queueMicrotask(()=>{if(Q===M7)A4()})}M7.push(J)}function N4(){while(M7.length>0)A4()}function YJ(J){return J===this.v}function MJ(J,Q){return J!=J?Q==Q:J!==Q||J!==null&&typeof J==="object"||typeof J==="function"}function LJ(J){return!MJ(J,this.v)}function w7(J,Q){return J.label=Q,JQ(J.v,Q),J}function JQ(J,Q){return J?.[dJ]?.(Q),J}function p0(J){var Q=F,W=L;u(null),_(null);try{return J()}finally{u(Q),_(W)}}function OJ(J,Q,W,K){let X=k0()?Z7:F7;var z=J.filter((V)=>!V.settled),Z=Q.map(X);if(W.length===0&&z.length===0){K(Z);return}var G=L,$=I4(),H=z.length===1?z[0].promise:z.length>1?Promise.all(z.map((V)=>V.promise)):null;function U(V){if((G.f&y)!==0)return;$();try{K([...Z,...V])}catch(B){Y0(B,G)}k7()}var q=QQ();if(W.length===0){H.then(()=>U([])).finally(q);return}function P(){Promise.all(W.map((V)=>WQ(V))).then(U).catch((V)=>Y0(V,G)).finally(q)}if(H)H.then(()=>{$(),P(),k7()});else P()}function I4(){var J=L,Q=F,W=C,K=D;if(!1)var X;return function(Z=!0){if(_(J),u(Q),a0(W),Z&&(J.f&y)===0)K?.activate(),K?.apply()}}var T8=!1;function k7(J=!0){if(T8=!1,_(null),u(null),a0(null),J)D?.deactivate()}function QQ(){var J=L,Q=J.b,W=D,K=!!Q?.is_rendered();return Q?.update_pending_count(1,W),W.increment(K,J),()=>{Q?.update_pending_count(-1,W),W.decrement(K,J)}}var k8=~(R|v|T);function j(J,Q){J.f=J.f&k8|Q}function b7(J){if((J.f&G0)!==0||J.deps===null)j(J,T);else j(J,v)}function Z7(J){var Q=h|R;if(L!==null)L.f|=m0;return{ctx:C,deps:null,effects:null,equals:YJ,f:Q,fn:J,reactions:null,rv:0,v:E,wv:0,parent:L,ac:null}}var y7=Symbol("obsolete");function WQ(J,Q,W){let K=L;if(K===null)P4();var X=void 0,z=K0(E),Z=!F,G=new Set;return T4(()=>{var $=L,H=HJ();X=H.promise;try{Promise.resolve(J()).then(H.resolve,(V)=>{if(V!==o0)H.reject(V)}).finally(k7)}catch(V){H.reject(V),k7()}var U=D;if(Z){if(($.f&$0)!==0)var q=QQ();if(K.b?.is_rendered())U.async_deriveds.get($)?.reject(y7);else for(let V of G.values())V.reject(y7);G.add(H),U.async_deriveds.set($,H)}let P=(V,B=void 0)=>{if(q?.(),G.delete(H),B===y7)return;if(U.activate(),B)z.f|=I0,b0(z,B);else{if((z.f&I0)!==0)z.f^=I0;b0(z,V)}U.deactivate()};H.promise.then(P,(V)=>P(null,V||"unknown"))}),W0(()=>{for(let $ of G)$.reject(y7)}),new Promise(($)=>{function H(U){function q(){if(U===X)$(z);else H(X)}U.then(q,q)}H(X)})}function b8(J){let Q=Z7(J);if(!J0)SJ(Q);return Q}function F7(J){let Q=Z7(J);return Q.equals=LJ,Q}function y8(J){var Q=J.effects;if(Q!==null){J.effects=null;for(var W=0;W<Q.length;W+=1)m(Q[W])}}function a7(J){var Q,W=L,K=J.parent;if(!D0&&K!==null&&J.v!==E&&(K.f&(y|d))!==0)return X4(),J.v;_(K);try{y8(J),Q=ZQ(J)}finally{_(W)}return Q}function XQ(J){var Q=a7(J);if(!J.equals(Q)){if(J.wv=t7(),!D?.is_fork||J.deps===null){if(D!==null)D.capture(J,Q,!0),O7?.capture(J,Q,!0);else J.v=Q;if(J.deps===null){j(J,T);return}}}if(D0)return;if(a!==null){if(z7()||D?.is_fork)a.set(J,Q)}else b7(J)}function j4(J){if(J.effects===null)return;for(let Q of J.effects)if(Q.teardown||Q.ac){if(Q.teardown?.(),Q.ac!==null)p0(()=>{Q.ac.abort(o0),Q.ac=null});if(Q.fn!==null)Q.teardown=u0;D7(Q,0),n7(Q)}}function zQ(J){if(J.effects===null)return;for(let Q of J.effects)if(Q.teardown&&Q.fn!==null)f0(Q)}var r7=new Set,j0=new Map;var x4=!1;function K0(J,Q){var W={f:0,v:J,reactions:null,equals:YJ,rv:0,wv:0};return W}function d0(J,Q){let W=K0(J,Q);return SJ(W),W}function C7(J,Q=!1,W=!0){let K=K0(J);if(!Q)K.equals=LJ;if(X7&&W&&C!==null&&C.l!==null)(C.l.s??=[]).push(K);return K}function X0(J,Q,W=!1){if(F!==null&&(!C0||(F.f&U7)!==0)&&k0()&&(F.f&(h|n|R0|U7))!==0&&(y0===null||!y0.has(J)))D4();let K=W?r0(Q):Q;return b0(J,K,e7)}var S7=null,GQ=0;function b0(J,Q,W=null){if(!J.equals(Q)){if(D0)j0.set(J,Q);else if(!j0.has(J))j0.set(J,J.v);var K=Q0.ensure();if(K.capture(J,Q),(J.f&h)!==0){let X=J;if((J.f&R)!==0)a7(X);if(a===null)b7(X)}if(J.wv=t7(),S7=null,GQ=0,E4(J,R,W),S7=null,k0()&&L!==null&&(L.f&T)!==0&&(L.f&(c|Z0))===0)if(S0===null)k4([J]);else S0.push(J);if(!K.is_fork&&r7.size>0&&!x4)$Q()}return Q}function $Q(){x4=!1;for(let J of r7){if((J.f&T)!==0)j(J,v);let Q;try{Q=G7(J)}catch{Q=!0}if(Q)f0(J)}r7.clear()}function A7(J){X0(J,J.v+1)}function E4(J,Q,W){var K=J.reactions;if(K===null)return;var X=k0(),z=K.length;if(GQ+=z,GQ>1e5&&S7===null)S7=new Set;if(S7!==null){if(S7.has(J))return;S7.add(J)}for(var Z=0;Z<z;Z++){var G=K[Z],$=G.f;if(!X&&G===L)continue;var H=($&R)===0;if(H)j(G,Q);if(($&U7)!==0)r7.add(G);else if(($&h)!==0){var U=G;a?.delete(U),E4(U,v,W)}else if(H){var q=G;if(($&n)!==0&&T0!==null)T0.add(q);if(W!==null)W.push(q);else JJ(q)}}}function CJ(J,Q,W){if((J.f&R)!==0)Q.add(J);else if((J.f&v)!==0)W.add(J);j(J,T)}var AJ=null,h7=null,D=null,O7=null,a=null,qQ=null,L7=!1,VQ=!1,g7=null,e7=null,b4=0;var m8=1;class Q0{id=m8++;#J=!1;linked=!0;#Q=null;#W=null;async_deriveds=new Map;current=new Map;previous=new Map;#G=new Set;#X=new Set;#Z=0;#K=new Map;#$=null;#z=[];#B=[];#V=new Set;#q=new Set;#U=new Map;#M=new Set;is_fork=!1;#P=!1;constructor(){if(h7===null)AJ=h7=this;else h7.#W=this,this.#Q=h7;h7=this}#O(){if(this.is_fork)return!0;for(let W of this.#K.keys()){var J=W,Q=!1;while(J.parent!==null){if(this.#U.has(J)){Q=!0;break}J=J.parent}if(!Q)return!0}return!1}skip_effect(J){if(!this.#U.has(J))this.#U.set(J,{d:[],m:[]});this.#M.delete(J)}unskip_effect(J,Q=(W)=>this.schedule(W)){var W=this.#U.get(J);if(W){this.#U.delete(J);for(var K of W.d)j(K,R),Q(K);for(K of W.m)j(K,v),Q(K)}this.#M.add(J)}#D(){var J=[];for(let X of this.#z){if((X.f&y)!==0||(X.f&(R|v))===0)continue;var Q=X,W=!1;while(Q.parent!==null){Q=Q.parent;var K=Q.f;if((K&(Z0|c))!==0){if((K&T)===0){W=!0;break}Q.f^=T}}if(!W)J.push(Q)}return this.#z=[],J}#L(){this.#J=!0;for(let Z of this.#V)this.#q.delete(Z),j(Z,R),this.schedule(Z);for(let Z of this.#q)j(Z,v),this.schedule(Z);this.apply();var J=g7=[],Q=[],W=e7=[];while(this.#z.length>0){if(b4++>1000)this.#Y(),v8();for(let Z of this.#D())try{this.#w(Z,J,Q)}catch(G){if(m4(Z),!this.#O())this.discard();throw G}}if(D=null,W.length>0){var K=Q0.ensure();for(let Z of W)K.schedule(Z)}if(g7=null,e7=null,this.#O()){this.#H(Q),this.#H(J);for(let[Z,G]of this.#U)g4(Z,G);if(W.length>0)D.#L();return}let X=this.#C();if(X){this.#H(Q),this.#H(J),X.#S(this);return}this.#V.clear(),this.#q.clear();for(let Z of this.#G)Z(this);this.#G.clear(),O7=this,y4(Q),y4(J),O7=null,this.#$?.resolve();var z=D;if(this.#Z===0&&(this.#z.length===0||z!==null)){if(this.#Y(),J0)this.#F(),D=z}if(this.#z.length>0)if(z!==null){for(let Z of this.#z)z.#z.push(Z);this.#z=[]}else z=this;if(z!==null)j0.clear(),z.#L()}#w(J,Q,W){J.f^=T;var K=J.first;while(K!==null){var X=K.f,z=(X&(c|Z0))!==0,Z=z&&(X&T)!==0,G=Z||(X&d)!==0||this.#U.has(K);if(!G&&K.fn!==null){if(z)K.f^=T;else if((X&g0)!==0)Q.push(K);else if(J0&&(X&(J7|P7))!==0)W.push(K);else if(G7(K)){if((X&n)!==0)this.#q.add(K);f0(K)}var $=K.first;if($!==null){K=$;continue}}while(K!==null){var H=K.next;if(H!==null){K=H;break}K=K.parent}}}#C(){var J=this.#Q;while(J!==null){if(!J.is_fork){for(let[Q,[,W]]of this.current)if(J.current.has(Q)&&!W)return J}J=J.#Q}return null}#S(J){for(let[W,K]of J.current){if(!this.previous.has(W)&&J.previous.has(W))this.previous.set(W,J.previous.get(W));this.current.set(W,K)}for(let[W,K]of J.async_deriveds){let X=this.async_deriveds.get(W);if(X)K.promise.then(X.resolve).catch(X.reject)}J.async_deriveds.clear(),this.transfer_effects(J.#V,J.#q);let Q=(W)=>{var K=W.reactions;if(K===null)return;if((W.f&h)!==0&&(W.f&(R|v))===0)return;for(let Z of K){var X=Z.f;if((X&h)!==0)Q(Z);else{var z=Z;if(X&(R0|n)&&!this.async_deriveds.has(z))this.#q.delete(z),j(z,R),this.schedule(z)}}};for(let W of this.current.keys())Q(W);this.oncommit(()=>J.discard()),J.#Y(),D=this,this.#L()}#H(J){for(var Q=0;Q<J.length;Q+=1)CJ(J[Q],this.#V,this.#q)}capture(J,Q,W=!1){if(J.v!==E&&!this.previous.has(J))this.previous.set(J,J.v);if((J.f&I0)===0)this.current.set(J,[Q,W]),a?.set(J,Q);if(!this.is_fork)J.v=Q}activate(){D=this}deactivate(){D=null,a=null}flush(){try{VQ=!0,D=this,this.#L()}finally{b4=0,qQ=null,g7=null,e7=null,VQ=!1,D=null,a=null,j0.clear()}}discard(){for(let J of this.#X)J(this);this.#X.clear();for(let J of this.async_deriveds.values())J.reject(y7);this.#Y(),this.#$?.resolve()}register_created_effect(J){this.#B.push(J)}#F(){for(let U=AJ;U!==null;U=U.#W){var J=U.id<this.id,Q=[];for(let[q,[P,V]]of this.current){if(U.current.has(q)){var W=U.current.get(q)[0];if(J&&P!==W)U.current.set(q,[P,V]);else continue}Q.push(q)}if(J)for(let[q,P]of this.async_deriveds){let V=U.async_deriveds.get(q);if(V)P.promise.then(V.resolve).catch(V.reject)}var K=[...U.current.keys()].filter((q)=>!U.current.get(q)[1]);if(!U.#J||K.length===0)continue;var X=K.filter((q)=>!this.current.has(q));if(X.length===0){if(J)U.discard()}else if(Q.length>0){if(J)for(let q of this.#M)U.unskip_effect(q,(P)=>{if((P.f&(n|R0))!==0)U.schedule(P);else U.#H([P])});U.activate();var z=new Set,Z=new Map;for(var G of Q)h4(G,X,z,Z);Z=new Map;var $=[...U.current].filter(([q,P])=>{let V=this.current.get(q);if(!V)return!0;return V[0]!==P[0]||V[1]!==P[1]}).map(([q])=>q);if($.length>0){for(let q of this.#B)if((q.f&(y|d|U7))===0&&PQ(q,$,Z))if((q.f&(R0|n))!==0)j(q,R),U.schedule(q);else U.#V.add(q)}if(U.#z.length>0&&!U.#P){U.apply();for(var H of U.#D())U.#w(H,[],[])}U.deactivate()}}}increment(J,Q){if(this.#Z+=1,J){let W=this.#K.get(Q)??0;this.#K.set(Q,W+1)}}decrement(J,Q){if(this.#Z-=1,J){let W=this.#K.get(Q)??0;if(W===1)this.#K.delete(Q);else this.#K.set(Q,W-1)}if(this.#P)return;this.#P=!0,s(()=>{if(this.#P=!1,this.linked)this.flush()})}transfer_effects(J,Q){for(let W of J)this.#V.add(W);for(let W of Q)this.#q.add(W);J.clear(),Q.clear()}oncommit(J){this.#G.add(J)}ondiscard(J){this.#X.add(J)}settled(){return(this.#$??=HJ()).promise}static ensure(){if(D===null){let J=D=new Q0;if(!VQ&&!L7)s(()=>{if(!J.#J)J.flush()})}return D}apply(){if(!J0||!this.is_fork&&this.#Q===null&&this.#W===null){a=null;return}a=new Map;for(let[Q,[W]]of this.current)a.set(Q,W);for(let Q=AJ;Q!==null;Q=Q.#W){if(Q===this||Q.is_fork)continue;var J=!1;if(Q.id<this.id)for(let[W,[,K]]of Q.current){if(K)continue;if(this.current.has(W)){J=!0;break}}if(!J){for(let[W,K]of Q.previous)if(!a.has(W))a.set(W,K)}}}schedule(J){if(qQ=J,J.b?.is_pending&&(J.f&(g0|J7|P7))!==0&&(J.f&$0)===0){J.b.defer_effect(J);return}this.#z.push(J)}#Y(){if(!this.linked)return;var J=this.#Q,Q=this.#W;if(J===null)AJ=Q;else J.#W=Q;if(Q===null)h7=J;else Q.#Q=J;this.linked=!1}}function m7(J){var Q=L7;L7=!0;try{var W;if(J){if(D!==null&&!D.is_fork)D.flush();W=J()}while(!0){if(N4(),D===null)return W;D.flush()}}finally{L7=Q}}function v8(){if(!1){var J;for(let W of D.current.keys())for(let[K,X]of W.updated??[])var Q}try{M4()}catch(W){Y0(W,qQ)}}var T0=null;function y4(J){var Q=J.length;if(Q===0)return;var W=0;while(W<Q){var K=J[W++];if((K.f&(y|d))===0&&G7(K)){if(T0=new Set,f0(K),K.deps===null&&K.first===null&&K.nodes===null&&K.teardown===null&&K.ac===null)UQ(K);if(T0?.size>0){j0.clear();for(let X of T0){if((X.f&(y|d))!==0)continue;let z=[X],Z=X.parent;while(Z!==null){if(T0.has(Z))T0.delete(Z),z.push(Z);Z=Z.parent}for(let G=z.length-1;G>=0;G--){let $=z[G];if(($.f&(y|d))!==0)continue;f0($)}}T0.clear()}}}T0=null}function h4(J,Q,W,K){if(W.has(J))return;if(W.add(J),J.reactions!==null)for(let X of J.reactions){let z=X.f;if((z&h)!==0)h4(X,Q,W,K);else if((z&(R0|n))!==0&&(z&R)===0&&PQ(X,Q,K))j(X,R),JJ(X)}}function PQ(J,Q,W){let K=W.get(J);if(K!==void 0)return K;if(J.deps!==null)for(let X of J.deps){if(B7.call(Q,X))return!0;if((X.f&h)!==0&&PQ(X,Q,W))return W.set(X,!0),!0}return W.set(J,!1),!1}function JJ(J){D.schedule(J)}function g4(J,Q){if((J.f&c)!==0&&(J.f&T)!==0)return;if((J.f&R)!==0)Q.d.push(J);else if((J.f&v)!==0)Q.m.push(J);j(J,T);var W=J.first;while(W!==null)g4(W,Q),W=W.next}function m4(J){j(J,T);var Q=J.first;while(Q!==null)m4(Q),Q=Q.next}function u4(J){if(L===null){if(F===null)Y4(J);B4()}if(D0)H4(J)}function p8(J,Q){var W=Q.last;if(W===null)Q.last=Q.first=J;else W.next=J,J.prev=W,Q.last=J}function _0(J,Q){var W=L;if(W!==null&&(W.f&d)!==0)J|=d;var K={ctx:C,deps:null,nodes:null,f:J|R|G0,first:null,fn:Q,last:null,next:null,parent:W,b:W&&W.b,prev:null,teardown:null,wv:0,ac:null};D?.register_created_effect(K);var X=K;if((J&g0)!==0)if(g7!==null)g7.push(K);else Q0.ensure().schedule(K);else if(Q!==null){try{f0(K)}catch(Z){throw m(K),Z}if(X.deps===null&&X.teardown===null&&X.nodes===null&&X.first===X.last&&(X.f&m0)===0){if(X=X.first,(J&n)!==0&&(J&U0)!==0&&X!==null)X.f|=U0}}if(X!==null){if(X.parent=W,W!==null)p8(X,W);if(F!==null&&(F.f&h)!==0&&(J&Z0)===0){var z=F;(z.effects??=[]).push(X)}}return K}function z7(){return F!==null&&!C0}function W0(J){let Q=_0(J7,null);return j(Q,T),Q.teardown=J,Q}function BQ(J){u4("$effect");var Q=L.f,W=!F&&(Q&c)!==0&&C!==null&&!C.i;if(W){var K=C;(K.e??=[]).push(J)}else return eJ(J)}function eJ(J){return _0(g0|_Q,J)}function YQ(J){Q0.ensure();let Q=_0(Z0|m0,J);return()=>{m(Q)}}function p4(J){Q0.ensure();let Q=_0(Z0|m0,J);return(W={})=>{return new Promise((K)=>{if(W.outro)l0(Q,()=>{m(Q),K(void 0)});else m(Q),K(void 0)})}}function P0(J){return _0(g0,J)}function T4(J){return _0(R0|m0,J)}function r(J,Q=0){return _0(J7|Q,J)}function MQ(J,Q=[],W=[],K=[]){OJ(K,Q,W,(X)=>{_0(J7,()=>{J(...X.map(N))})})}function L0(J,Q=0){var W=_0(n|Q,J);return W}function o(J){return _0(c|m0,J)}function LQ(J){var Q=J.teardown;if(Q!==null){let W=D0,K=F;HQ(!0),u(null);try{Q.call(null)}catch(X){Y0(X,J.parent)}finally{HQ(W),u(K)}}}function n7(J,Q=!1){var W=J.first;J.first=J.last=null;while(W!==null){let X=W.ac;if(X!==null)p0(()=>{X.abort(o0)});var K=W.next;if((W.f&Z0)!==0)W.parent=null;else m(W,Q);W=K}}function f4(J){var Q=J.first;while(Q!==null){var W=Q.next;if((Q.f&c)===0)m(Q);Q=W}}function m(J,Q=!0){var W=!1;if((Q||(J.f&fJ)!==0)&&J.nodes!==null&&J.nodes.end!==null)wQ(J.nodes.start,J.nodes.end),W=!0;J.f|=Q7,n7(J,Q&&!W),D7(J,0);var K=J.nodes&&J.nodes.t;if(K!==null)for(let z of K)z.stop();LQ(J),J.f^=Q7,J.f|=y;var X=J.parent;if(X!==null&&X.first!==null)UQ(J);J.next=J.prev=J.teardown=J.ctx=J.deps=J.fn=J.nodes=J.ac=J.b=null}function wQ(J,Q){while(J!==null){var W=J===Q?null:i(J);J.remove(),J=W}}function UQ(J){var{parent:Q,prev:W,next:K}=J;if(W!==null)W.next=K;if(K!==null)K.prev=W;if(Q!==null){if(Q.first===J)Q.first=K;if(Q.last===J)Q.last=W}}function l0(J,Q,W=!0){var K=[];J.f|=GJ,d4(J,K,!0);var X=()=>{if(W)m(J);if(Q)Q()},z=K.length;if(z>0){var Z=()=>--z||X();for(var G of K)G.out(Z)}else X()}function d4(J,Q,W){if((J.f&d)!==0)return;J.f^=d;var K=J.nodes&&J.nodes.t;if(K!==null){for(let G of K)if(G.is_global||W)Q.push(G)}var X=J.first;while(X!==null){var z=X.next;if((X.f&Z0)===0){var Z=(X.f&U0)!==0||(X.f&c)!==0&&(J.f&n)!==0;d4(X,Q,Z?W:!1)}X=z}}function v7(J){J.f&=~GJ,_4(J,!0)}function _4(J,Q){if((J.f&GJ)!==0)return;if((J.f&d)===0)return;if(J.f^=d,(J.f&T)===0)j(J,R),Q0.ensure().schedule(J);var W=J.first;while(W!==null){var K=W.next,X=(W.f&U0)!==0||(W.f&c)!==0;_4(W,X?Q:!1),W=K}var z=J.nodes&&J.nodes.t;if(z!==null){for(let Z of z)if(Z.is_global||Q)Z.in()}}function u7(J,Q){if(!J.nodes)return;var W=J.nodes.start,K=J.nodes.end;while(W!==null){var X=W===K?null:i(W);Q.append(W),W=X}}var l4=null;var NJ=!1,D0=!1;function HQ(J){D0=J}var F=null,C0=!1;function u(J){F=J}var L=null;function _(J){L=J}var y0=null;function SJ(J){if(F!==null&&(!J0&&(F.f&f7)!==0||(F.f&h)!==0))(y0??=new Set).add(J)}var q0=null,M0=0,S0=null;function k4(J){S0=J}var i4=1,N7=0,$7=N7;function FQ(J){$7=J}function t7(){return++i4}function G7(J){var Q=J.f;if((Q&R)!==0)return!0;if((Q&v)!==0){var W=J.deps,K=W.length;for(var X=0;X<K;X++){var z=W[X];if(G7(z))XQ(z);if(z.wv>J.wv)return!0}if((Q&G0)!==0&&a===null)j(J,T)}return!1}function o4(J,Q,W=!0){var K=J.reactions;if(K===null)return;if(!J0&&y0!==null&&y0.has(J))return;for(var X=0;X<K.length;X++){var z=K[X];if((z.f&h)!==0)o4(z,Q,!1);else if(Q===z){if(W)j(z,R);else if((z.f&T)!==0)j(z,v);JJ(z)}}}function ZQ(J){var Q=q0,W=M0,K=S0,X=F,z=y0,Z=C,G=C0,$=$7,H=J.f;if(q0=null,M0=0,S0=null,F=(H&(c|Z0))===0?J:null,y0=null,a0(J.ctx),C0=!1,$7=++N7,J.ac!==null)p0(()=>{J.ac.abort(o0)}),J.ac=null;try{J.f|=f7;var U=J.fn,q=U();J.f|=$0;var P=c4(J);if(k0()&&S0!==null&&!C0&&P!==null&&(J.f&(h|v|R))===0)for(var V=0;V<S0.length;V++)o4(S0[V],J);if(X!==null&&X!==J){if(N7++,X.deps!==null)for(let B=0;B<W;B+=1)X.deps[B].rv=N7;if(Q!==null)for(let B of Q)B.rv=N7;if(S0!==null)if(K===null)K=S0;else K.push(...S0)}if((J.f&I0)!==0)J.f^=I0;return q}catch(B){return c4(J),V4(B)}finally{J.f^=f7,q0=Q,M0=W,S0=K,F=X,y0=z,a0(Z),C0=G,$7=$}}function c4(J){var Q=J.deps,W=D?.is_fork;if(q0!==null){var K;if(!W)D7(J,M0);if(Q!==null&&M0>0){Q.length=M0+q0.length;for(K=0;K<q0.length;K++)Q[M0+K]=q0[K]}else J.deps=Q=q0;if(z7()&&(J.f&G0)!==0)for(K=M0;K<Q.length;K++)(Q[K].reactions??=[]).push(J)}else if(!W&&Q!==null&&M0<Q.length)D7(J,M0),Q.length=M0;return Q}function d8(J,Q){let W=Q.reactions;if(W!==null){var K=G4.call(W,J);if(K!==-1){var X=W.length-1;if(X===0)W=Q.reactions=null;else W[K]=W[X],W.pop()}}if(W===null&&(Q.f&h)!==0&&(q0===null||!B7.call(q0,Q))){var z=Q;if((z.f&G0)!==0)z.f^=G0;if(z.v!==E)b7(z);if(z.ac!==null)p0(()=>{z.ac.abort(o0),z.ac=null,j(z,R)});j4(z),D7(z,0)}}function D7(J,Q){var W=J.deps;if(W===null)return;for(var K=Q;K<W.length;K++)d8(J,W[K])}function f0(J){var Q=J.f;if((Q&y)!==0)return;j(J,T);var W=L,K=NJ;if(L=J,NJ=(Q&(c|Z0))===0,!1)var X,z;try{if((Q&(n|P7))!==0)f4(J);else n7(J);LQ(J);var Z=ZQ(J);if(J.teardown=typeof Z==="function"?Z:null,J.wv=i4,!1)for(var G of J.deps);}finally{NJ=K,L=W}}function N(J){var Q=J.f,W=(Q&h)!==0;if(l4?.add(J),F!==null&&!C0){var K=L!==null&&(L.f&y)!==0;if(!K&&(y0===null||!y0.has(J))){var X=F.deps;if((F.f&f7)!==0){if(J.rv<N7)if(J.rv=N7,q0===null&&X!==null&&X[M0]===J)M0++;else if(q0===null)q0=[J];else q0.push(J)}else{if(F.deps??=[],!B7.call(F.deps,J))F.deps.push(J);var z=J.reactions;if(z===null)J.reactions=[F];else if(!B7.call(z,F))z.push(F)}}}if(!1){if(!C0&&x8&&D===null&&O7===null&&!x8.warned&&(x8.effect.f&f7)===0&&!x8.effect_deps.has(J))var Z;if(KQ&&!C0&&vW!==null&&F!==null&&vW.reaction===F){if(J.trace);else if(Z)var G,$}}if(D0&&j0.has(J))return j0.get(J);if(W){var H=J;if(D0){var U=H.v;if((H.f&T)===0&&H.reactions!==null||a4(H))U=a7(H);return j0.set(H,U),U}var q=(H.f&G0)===0&&!C0&&F!==null&&(NJ||(F.f&G0)!==0),P=(H.f&$0)===0;if(G7(H)){if(q)H.f|=G0;XQ(H)}if(q&&!P)zQ(H),s4(H)}if(a?.has(J))return a.get(J);if((J.f&I0)!==0)throw J.v;return J.v}function s4(J){if(J.f|=G0,J.deps===null)return;for(let Q of J.deps)if((Q.reactions??=[]).push(J),(Q.f&h)!==0&&(Q.f&G0)===0)zQ(Q),s4(Q)}function a4(J){if(J.v===E)return!0;if(J.deps===null)return!1;for(let Q of J.deps){if(j0.has(Q))return!0;if((Q.f&h)!==0&&a4(Q))return!0}return!1}function k(J){var Q=C0;try{return C0=!0,J()}finally{C0=Q}}function IJ(J){if(typeof J!=="object"||!J||J instanceof EventTarget)return;if(V0 in J)RJ(J);else if(!Array.isArray(J))for(let Q in J){let W=J[Q];if(typeof W==="object"&&W&&V0 in W)RJ(W)}}function RJ(J,Q=new Set){if(typeof J==="object"&&J!==null&&!(J instanceof EventTarget)&&!Q.has(J)){if(Q.add(J),J instanceof Date)J.getTime();for(let K in J)try{RJ(J[K],Q)}catch(X){}let W=Y7(J);if(W!==Object.prototype&&W!==Array.prototype&&W!==Map.prototype&&W!==Set.prototype&&W!==Date.prototype){let K=PJ(W);for(let X in K){let z=K[X].get;if(z)try{z.call(J)}catch(Z){}}}}}var _8=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function r0(J){if(typeof J!=="object"||J===null||V0 in J||$J in J)return J;let Q=Y7(J);if(Q!==aJ&&Q!==$4)return J;var W=new Map,K=s0(J),X=d0(0),z=null,Z=$7,G=(q)=>{if($7===Z)return q();var P=F,V=$7;u(null),FQ(Z);var B=q();return u(P),FQ(V),B};if(K)W.set("length",d0(J.length,z));var $="";let H=!1;function U(q){if(H)return;H=!0,$=q,w7(X,`${$} version`);for(let[P,V]of W)w7(V,l8($,P));H=!1}return new Proxy(J,{defineProperty(q,P,V){if(!("value"in V)||V.configurable===!1||V.enumerable===!1||V.writable===!1)F4();var B=W.get(P);if(B===void 0)G(()=>{var w=d0(V.value,z);return W.set(P,w),w});else X0(B,V.value,!0);return!0},deleteProperty(q,P){var V=W.get(P);if(V===void 0){if(P in q){let B=G(()=>d0(E,z));W.set(P,B),A7(X)}}else X0(V,E),A7(X);return!0},get(q,P,V){if(P===V0)return J;var B=W.get(P),w=P in q;if(B===void 0&&(!w||B0(q,P)?.writable))B=G(()=>{var S=r0(w?q[P]:E),b=d0(S,z);return b}),W.set(P,B);if(B!==void 0){var Y=N(B);return Y===E?void 0:Y}return Reflect.get(q,P,V)},getOwnPropertyDescriptor(q,P){this.has?.(q,P);var V=Reflect.getOwnPropertyDescriptor(q,P),B=W.get(P);if(B!==void 0){var w=N(B);if(w===E)return;if(V&&"value"in V)V.value=w;else return{enumerable:!0,configurable:!0,value:w,writable:!0}}return V},has(q,P){if(P===V0)return!0;var V=W.get(P),B=V!==void 0&&V.v!==E||Reflect.has(q,P);if(V!==void 0||L!==null&&(!B||B0(q,P)?.writable)){if(V===void 0)V=G(()=>{var Y=B?r0(q[P]):E,S=d0(Y,z);return S}),W.set(P,V);var w=N(V);if(w===E)return!1}return B},set(q,P,V,B){var w=W.get(P),Y=P in q;if(K&&P==="length")for(var S=V;S<w.v;S+=1){var b=W.get(S+"");if(b!==void 0)X0(b,E);else if(S in q)b=G(()=>d0(E,z)),W.set(S+"",b)}if(w===void 0){if(!Y||B0(q,P)?.writable)w=G(()=>d0(void 0,z)),X0(w,r0(V)),W.set(P,w)}else{Y=w.v!==E;var x=G(()=>r0(V));X0(w,x)}var A=Reflect.getOwnPropertyDescriptor(q,P);if(A?.set)A.set.call(B,V);if(!Y){if(K&&typeof P==="string"){var N0=W.get("length"),z0=Number(P);if(Number.isInteger(z0)&&z0>=N0.v)X0(N0,z0+1)}A7(X)}return!0},ownKeys(q){N(X);var P=Reflect.ownKeys(q).filter((w)=>{var Y=W.get(w);return Y===void 0||Y.v!==E});for(var[V,B]of W)if(B.v!==E&&!(V in q))P.push(V);return P},setPrototypeOf(){O4()}})}function l8(J,Q){if(typeof Q==="symbol")return`${J}[Symbol(${Q.description??""})]`;if(_8.test(Q))return`${J}.${Q}`;return/^\d+$/.test(Q)?`${J}[${Q}]`:`${J}['${Q}']`}var OQ,r4,BJ,n4,t4;function TJ(){if(OQ!==void 0)return;OQ=window,r4=document,BJ=/Firefox/.test(navigator.userAgent);var J=Element.prototype,Q=Node.prototype,W=Text.prototype;if(n4=B0(Q,"firstChild").get,t4=B0(Q,"nextSibling").get,rJ(J))J[_7]=void 0,J[VJ]=null,J[_J]=void 0,J.__e=void 0;if(rJ(W))W[l7]=void 0}function p(J=""){return document.createTextNode(J)}function g(J){return n4.call(J)}function i(J){return t4.call(J)}function e4(J,Q){if(!M)return g(J);var W=g(O);if(W===null)W=O.appendChild(p());else if(Q&&W.nodeType!==T7){var K=p();return W?.before(K),I(K),K}if(Q)EJ(W);return I(W),W}function c8(J,Q=!1){if(!M){var W=g(J);if(W instanceof Comment&&W.data==="")return i(W);return W}if(Q){if(O?.nodeType!==T7){var K=p();return O?.before(K),I(K),K}EJ(O)}return O}function i8(J,Q=!1){if(!M)return g(J);var W=e4(J,Q);return jJ(J),W}function o8(J,Q=1,W=!1){let K=M?O:J;var X;while(Q--)X=K,K=i(K);if(!M)return K;if(W){if(K?.nodeType!==T7){var z=p();if(K===null)X?.after(z);else K.before(z);return I(z),z}EJ(K)}return I(K),K}function s7(J){J.textContent=""}function xJ(){if(!J0)return!1;if(T0!==null)return!1;var J=L.f;return(J&$0)!==0}function A0(J,Q,W){if(Q==null||Q===qJ)return W?document.createElement(J,{is:W}):document.createElement(J);return W?document.createElementNS(Q,J,{is:W}):document.createElementNS(Q,J)}function EJ(J){if(J.nodeValue.length<65536)return;let Q=J.nextSibling;while(Q!==null&&Q.nodeType===T7)Q.remove(),J.nodeValue+=Q.nodeValue,Q=J.nextSibling}var M=!1;function f(J){M=J}var O;function I(J){if(J===null)throw K7(),v0;return O=J}function l(){return I(i(O))}function jJ(J){if(!M)return;if(i(O)!==null)throw K7(),v0;O=J}function DQ(J=1){if(M){var Q=J,W=O;while(Q--)W=i(W);O=W}}function c0(J=!0){var Q=0,W=O;while(!0){if(W.nodeType===O0){var K=W.data;if(K===H7){if(Q===0)return W;Q-=1}else if(K===x7||K===W7||K[0]==="["&&!isNaN(Number(K.slice(1))))Q+=1}var X=i(W);if(J)W.remove();W=X}}function WJ(J){if(!J||J.nodeType!==O0)throw K7(),v0;return J.data}var p7=Symbol("events"),AQ=new Set,kJ=new Set;function J8(J,Q,W){(Q[p7]??={})[J]=W}function Q8(J){for(var Q=0;Q<J.length;Q++)AQ.add(J[Q]);for(var W of kJ)W(J)}var SQ=null,CQ=!1;function NQ(J){var Q=this,W=Q.ownerDocument,K=J.type,X=J.composedPath?.()||[],z=X[0]||J.target;if(SQ=J,!CQ)CQ=!0,setTimeout(()=>{CQ=!1,SQ=null});var Z=0,G=SQ===J&&J[p7];if(G){var $=X.indexOf(G);if($!==-1&&(Q===document||Q===window)){J[p7]=Q;return}var H=X.indexOf(Q);if(H===-1)return;if($<=H)Z=$}if(z=X[Z]||J.target,z===Q)return;H0(J,"currentTarget",{configurable:!0,get(){return z||W}});var U=F,q=L;u(null),_(null);try{var P,V=[];while(z!==null){if(z===Q)break;try{var B=z[p7]?.[K];if(B!=null&&(!z.disabled||J.target===z))B.call(z,J)}catch(w){if(P)V.push(w);else P=w}if(J.cancelBubble)break;Z++,z=Z<X.length?X[Z]:null}if(P){for(let w of V)queueMicrotask(()=>{throw w});throw P}}finally{J[p7]=Q,delete J.currentTarget,u(U),_(q)}}var s8=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:(J)=>{return J}});function W8(J){return s8?.createHTML(J)??J}function RQ(J){var Q=A0("template");return Q.innerHTML=W8(J.replaceAll("<!>","<!---->")),Q.content}function w0(J,Q){var W=L;if(W.nodes===null)W.nodes={start:J,end:Q,a:null,t:null}}function n8(J,Q){var W=(Q&Q4)!==0,K=(Q&W4)!==0,X,z=!J.startsWith("<!>");return()=>{if(M)return w0(O,null),O;if(X===void 0){if(X=RQ(z?J:"<!>"+J),!W)X=g(X)}var Z=K||BJ?document.importNode(X,!0):X.cloneNode(!0);if(W){var G=g(Z),$=Z.lastChild;w0(G,$)}else w0(Z,Z);return Z}}function t8(){if(M)return w0(O,null),O;var J=document.createDocumentFragment(),Q=document.createComment(""),W=p();return J.append(Q,W),w0(Q,W),J}function KJ(J,Q){if(M){var W=L;if((W.f&$0)===0||W.nodes.end===null)W.nodes.end=O;l();return}if(J===null)return;J.before(Q)}var e8=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected","webkitdirectory","defer","disablepictureinpicture","disableremoteplayback"];var t9=[...e8,"formNoValidate","isMap","noModule","playsInline","readOnly","value","volume","defaultValue","defaultChecked","srcObject","noValidate","allowFullscreen","disablePictureInPicture","disableRemotePlayback"];var J6=["touchstart","touchmove"];function K8(J){return J6.includes(J)}var Q6=["$state","$state.raw","$derived","$derived.by"],e9=[...Q6,"$state.eager","$state.snapshot","$props","$props.id","$bindable","$effect","$effect.pre","$effect.tracking","$effect.root","$effect.pending","$inspect","$inspect().with","$inspect.trace","$host"];function X8(J){let Q=0,W=K0(0),K;return()=>{if(z7())N(W),r(()=>{if(Q===0)K=k(()=>J(()=>A7(W)));return Q+=1,()=>{s(()=>{if(Q-=1,Q===0)K?.(),K=void 0,A7(W)})}})}}var W6=U0|m0;function jQ(J,Q,W,K){new z8(J,Q,W,K)}class z8{parent;is_pending=!1;transform_error;#J;#Q=M?O:null;#W;#G;#X;#Z=null;#K=null;#$=null;#z=null;#B=0;#V=0;#q=!1;#U=new Set;#M=new Set;#P=null;#O=X8(()=>{return this.#P=K0(this.#B),()=>{this.#P=null}});constructor(J,Q,W,K){if(this.#J=J,this.#W=Q,this.#G=(X)=>{var z=L;z.b=this,z.f|=j7,W(X)},this.parent=L.b,this.transform_error=K??this.parent?.transform_error??((X)=>X),this.#X=L0(()=>{if(M){let X=this.#Q;l();let z=X.data===W7;if(X.data.startsWith(oJ)){let G=JSON.parse(X.data.slice(oJ.length));this.#L(G)}else if(z)this.#C();else this.#D()}else this.#S()},W6),M)this.#J=O}#D(){try{this.#Z=o(()=>this.#G(this.#J))}catch(J){this.error(J)}}#L(J){let Q=this.#W.failed,{reset:W,invoke_onerror:K}=this.#w(J);if(s(K),!Q)return;this.#$=o(()=>{Q(this.#J,()=>J,()=>W)})}#w(J){var Q=!1,W=!1;let K=()=>{if(Q){Z4();return}if(Q=!0,W)S4();if(this.#$!==null)l0(this.#$,()=>{this.#$=null});this.#F(()=>{this.#S()})};return{reset:K,invoke_onerror:()=>{try{W=!0,this.#W.onerror?.(J,K),W=!1}catch(z){Y0(z,this.#X&&this.#X.parent)}}}}#C(){let J=this.#W.pending;if(!J)return;this.is_pending=!0,this.#K=o(()=>J(this.#J)),s(()=>{var Q=this.#z=document.createDocumentFragment(),W=p(),K=!1;if(Q.append(W),this.#Z=this.#F(()=>{try{return o(()=>this.#G(W))}catch(X){try{this.error(X),K=!0}catch(z){Y0(z,this.#X.parent)}return null}}),this.#Z===null){if(this.#z=null,K)this.#H(D);return}if(this.#V===0)this.#J.before(Q),this.#z=null,l0(this.#K,()=>{this.#K=null}),this.#H(D)})}#S(){try{if(this.is_pending=this.has_pending_snippet(),this.#V=0,this.#B=0,this.#Z=o(()=>{this.#G(this.#J)}),this.#V>0){var J=this.#z=document.createDocumentFragment();u7(this.#Z,J);let Q=this.#W.pending;this.#K=o(()=>Q(this.#J))}else this.#H(D)}catch(Q){this.error(Q)}}#H(J){this.is_pending=!1,J.transfer_effects(this.#U,this.#M)}defer_effect(J){CJ(J,this.#U,this.#M)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#W.pending}#F(J){var Q=L,W=F,K=C;_(this.#X),u(this.#X),a0(this.#X.ctx);try{return Q0.ensure(),J()}finally{_(Q),u(W),a0(K)}}#Y(J,Q){if(!this.has_pending_snippet()){if(this.parent)this.parent.#Y(J,Q);return}if(this.#V+=J,this.#V===0){if(this.#H(Q),this.#K)l0(this.#K,()=>{this.#K=null});if(this.#z)this.#J.before(this.#z),this.#z=null}}update_pending_count(J,Q){if(this.#Y(J,Q),this.#B+=J,!this.#P||this.#q)return;this.#q=!0,s(()=>{if(this.#q=!1,this.#P)b0(this.#P,this.#B)})}get_effect_pending(){return this.#O(),N(this.#P)}error(J){if(!this.#W.onerror&&!this.#W.failed)throw J;if(D?.is_fork){if(this.#Z)D.skip_effect(this.#Z);if(this.#K)D.skip_effect(this.#K);if(this.#$)D.skip_effect(this.#$);D.oncommit(()=>{this.#A(J)})}else this.#A(J)}#A(J){if(this.#Z)m(this.#Z),this.#Z=null;if(this.#K)m(this.#K),this.#K=null;if(this.#$)m(this.#$),this.#$=null;if(M)I(this.#Q),DQ(),I(c0());let Q=this.#W.failed,W=(K)=>{let{reset:X,invoke_onerror:z}=this.#w(K);if(z(),Q)this.#$=this.#F(()=>{try{return o(()=>{var Z=L;Z.b=this,Z.f|=j7,Q(this.#J,()=>K,()=>X)})}catch(Z){return Y0(Z,this.#X.parent),null}})};s(()=>{var K;try{K=this.transform_error(J)}catch(X){Y0(X,this.#X&&this.#X.parent);return}if(K!==null&&typeof K==="object"&&typeof K.then==="function")K.then(W,(X)=>Y0(X,this.#X&&this.#X.parent));else W(K)})}}var TQ=!0;function K6(J,Q){var W=Q==null?"":typeof Q==="object"?`${Q}`:Q;if(W!==(J[l7]??=J.nodeValue))J[l7]=W,J.nodeValue=`${W}`}function yJ(J,Q){return Z8(J,Q)}function EQ(J,Q){TJ(),Q.intro=Q.intro??!1;let W=Q.target,K=M,X=O;try{var z=g(W);while(z&&(z.nodeType!==O0||z.data!==x7))z=i(z);if(!z)throw v0;f(!0),I(z);let Z=Z8(J,{...Q,anchor:z});return f(!1),Z}catch(Z){if(Z instanceof Error&&Z.message.split(`
2
+ `).some((G)=>G.startsWith("https://svelte.dev/e/")))throw Z;if(Z!==v0)console.warn("Failed to hydrate: ",Z);if(Q.recover===!1)L4();return TJ(),s7(W),f(!1),yJ(J,Q)}finally{f(K),I(X)}}var bJ=new Map;function Z8(J,{target:Q,anchor:W,props:K={},events:X,context:z,intro:Z=!0,transformError:G}){TJ();var $=void 0,H=p4(()=>{var U=W??Q.appendChild(p());jQ(U,{pending:()=>{}},(V)=>{nJ({});var B=C;if(z)B.c=z;if(X)K.$$events=X;if(M)w0(V,null);if(TQ=Z,$=J(V,K)||o7(),TQ=!0,M){if(L.nodes.end=O,O===null||O.nodeType!==O0||O.data!==H7)throw K7(),v0}tJ()},G);var q=new Set,P=(V)=>{for(var B=0;B<V.length;B++){var w=V[B];if(q.has(w))continue;q.add(w);var Y=K8(w);for(let x of[Q,document]){var S=bJ.get(x);if(S===void 0)S=new Map,bJ.set(x,S);var b=S.get(w);if(b===void 0)x.addEventListener(w,NQ,{passive:Y}),S.set(w,1);else S.set(w,b+1)}}};return P(E7(AQ)),kJ.add(P),()=>{for(var V of q)for(let Y of[Q,document]){var B=bJ.get(Y),w=B.get(V);if(--w==0){if(Y.removeEventListener(V,NQ),B.delete(V),B.size===0)bJ.delete(Y)}else B.set(V,w)}if(kJ.delete(P),U!==W)U.parentNode?.removeChild(U)}});return xQ.set($,H),$}var xQ=new WeakMap;function kQ(J,Q){let W=xQ.get(J);if(W)return xQ.delete(J),W(Q);return Promise.resolve()}class n0{anchor;#J=new Map;#Q=new Map;#W=new Map;#G=new Set;#X=!0;constructor(J,Q=!0){this.anchor=J,this.#X=Q}#Z=(J)=>{if(!this.#J.has(J))return;var Q=this.#J.get(J),W=this.#Q.get(Q);if(W)v7(W),this.#G.delete(Q);else{var K=this.#W.get(Q);if(K)v7(K.effect),this.#Q.set(Q,K.effect),this.#W.delete(Q),K.fragment.lastChild.remove(),this.anchor.before(K.fragment),W=K.effect}for(let[X,z]of this.#J){if(this.#J.delete(X),X===J)break;let Z=this.#W.get(z);if(Z)m(Z.effect),this.#W.delete(z)}for(let[X,z]of this.#Q){if(X===Q||this.#G.has(X))continue;let Z=()=>{if(Array.from(this.#J.values()).includes(X)){var $=document.createDocumentFragment();u7(z,$),$.append(p()),this.#W.set(X,{effect:z,fragment:$})}else m(z);this.#G.delete(X),this.#Q.delete(X)};if(this.#X||!W)this.#G.add(X),l0(z,Z,!1);else Z()}};#K=(J)=>{this.#J.delete(J);let Q=Array.from(this.#J.values());for(let[W,K]of this.#W)if(!Q.includes(W))m(K.effect),this.#W.delete(W)};ensure(J,Q){var W=D,K=xJ();if(Q&&!this.#Q.has(J)&&!this.#W.has(J))if(K){var X=document.createDocumentFragment(),z=p();X.append(z),this.#W.set(J,{effect:o(()=>Q(z)),fragment:X})}else this.#Q.set(J,o(()=>Q(this.anchor)));if(this.#J.set(W,J),K){for(let[Z,G]of this.#Q)if(Z===J)W.unskip_effect(G);else W.skip_effect(G);for(let[Z,G]of this.#W)if(Z===J)W.unskip_effect(G.effect);else W.skip_effect(G.effect);W.oncommit(this.#Z),W.ondiscard(this.#K)}else{if(M)this.anchor=O;this.#Z(W)}}}function Z6(J,Q,W=!1){var K;if(M)K=O,l();var X=new n0(J),z=W?U0:0;function Z(G,$){if(M){var H=WJ(K);if(G!==parseInt(H.substring(1))){var U=c0();I(U),X.anchor=U,f(!1),X.ensure(G,$),f(!0);return}}X.ensure(G,$)}L0(()=>{var G=!1;if(Q(($,H=0)=>{G=!0,Z(H,$)}),!G)Z(-1,null)},z)}var G6=Symbol("NaN");function $6(J,Q,W){if(M)l();var K=new n0(J),X=!k0();L0(()=>{var z=Q();if(z!==z)z=G6;if(X&&z!==null&&typeof z==="object")z={};K.ensure(z,W)})}function V6(J,Q,W){var K=[],X=Q.length,z,Z=Q.length;for(var G=0;G<X;G++){let q=Q[G];l0(q,()=>{if(z){if(z.pending.delete(q),z.done.add(q),z.pending.size===0){var P=J.outrogroups;if(bQ(J,E7(z.done)),P.delete(z),P.size===0)J.outrogroups=null}}else Z-=1},!1)}if(Z===0){var $=K.length===0&&W!==null&&J.pending.size===0;if($){var H=W,U=H.parentNode;s7(U),U.append(H),J.items.clear()}bQ(J,Q,!$)}else z={pending:new Set(Q),done:new Set},(J.outrogroups??=new Set).add(z)}function bQ(J,Q,W=!0){var K;if(J.pending.size>0){K=new Set;for(let Z of J.pending.values())for(let G of Z)K.add(J.items.get(G).e)}for(var X=0;X<Q.length;X++){var z=Q[X];if(K?.has(z)){z.f|=x0;let Z=document.createDocumentFragment();u7(z,Z)}else m(Q[X],W)}}var V8;function q6(J,Q,W,K,X,z=null){var Z=J,G=new Map,$=(Q&iJ)!==0;if($){var H=J;Z=M?I(g(H)):H.appendChild(p())}if(M)l();var U=null,q=F7(()=>{var x=W();return s0(x)?x:x==null?[]:E7(x)}),P,V=new Map,B=!0;function w(x){if((b.effect.f&y)!==0)return;if(b.pending.delete(x),b.fallback=U,P6(b,P,Z,Q,K),U!==null)if(P.length===0)if((U.f&x0)===0)v7(U);else U.f^=x0,zJ(U,null,Z);else l0(U,()=>{U=null})}function Y(x){b.pending.delete(x)}var S=L0(()=>{P=N(q);var x=P.length;let A=!1;if(M){var N0=WJ(Z)===W7;if(N0!==(x===0))Z=c0(),I(Z),f(!1),A=!0}var z0=new Set,F0=D,I7=xJ();for(var e0=0;e0<x;e0+=1){if(M&&O.nodeType===O0&&O.data===H7)Z=O,A=!0,f(!1);var h0=P[e0],ZJ=K(h0,e0);if(!1)var P1;var i0=B?null:G.get(ZJ);if(i0){if(i0.v)b0(i0.v,h0);if(i0.i)b0(i0.i,e0);if(I7)F0.unskip_effect(i0.e)}else{if(i0=U6(G,B?Z:V8??=p(),h0,ZJ,e0,X,Q,W),!B)i0.e.f|=x0;G.set(ZJ,i0)}z0.add(ZJ)}if(x===0&&z&&!U)if(B)U=o(()=>z(Z));else U=o(()=>z(V8??=p())),U.f|=x0;if(x>z0.size)U4("","","");if(M&&x>0)I(c0());if(!B)if(V.set(F0,z0),I7){for(let[N8,R8]of G)if(!z0.has(N8))F0.skip_effect(R8.e);F0.oncommit(w),F0.ondiscard(Y)}else w(F0);if(A)f(!0);N(q)}),b={effect:S,flags:Q,items:G,pending:V,outrogroups:null,fallback:U};if(B=!1,M)Z=O}function XJ(J){while(J!==null&&(J.f&c)===0)J=J.next;return J}function P6(J,Q,W,K,X){var z=(K&sQ)!==0,Z=Q.length,G=J.items,$=XJ(J.effect.first),H,U=null,q,P=[],V=[],B,w,Y,S;if(z){for(S=0;S<Z;S+=1)if(B=Q[S],w=X(B,S),Y=G.get(w).e,(Y.f&x0)===0)Y.nodes?.a?.measure(),(q??=new Set).add(Y)}for(S=0;S<Z;S+=1){if(B=Q[S],w=X(B,S),Y=G.get(w).e,J.outrogroups!==null)for(let h0 of J.outrogroups)h0.pending.delete(Y),h0.done.delete(Y);if((Y.f&d)!==0){if(v7(Y),z)Y.nodes?.a?.unfix(),(q??=new Set).delete(Y)}if((Y.f&x0)!==0)if(Y.f^=x0,Y===$)zJ(Y,null,W);else{var b=U?U.next:$;if(Y===J.effect.last)J.effect.last=Y.prev;if(Y.prev)Y.prev.next=Y.next;if(Y.next)Y.next.prev=Y.prev;V7(J,U,Y),V7(J,Y,b),zJ(Y,b,W),U=Y,P=[],V=[],$=XJ(U.next);continue}if(Y!==$){if(H!==void 0&&H.has(Y)){if(P.length<V.length){var x=V[0],A;U=x.prev;var N0=P[0],z0=P[P.length-1];for(A=0;A<P.length;A+=1)zJ(P[A],x,W);for(A=0;A<V.length;A+=1)H.delete(V[A]);V7(J,N0.prev,z0.next),V7(J,U,N0),V7(J,z0,x),$=x,U=z0,S-=1,P=[],V=[]}else H.delete(Y),zJ(Y,$,W),V7(J,Y.prev,Y.next),V7(J,Y,U===null?J.effect.first:U.next),V7(J,U,Y),U=Y;continue}P=[],V=[];while($!==null&&$!==Y)(H??=new Set).add($),V.push($),$=XJ($.next);if($===null)continue}if((Y.f&x0)===0)P.push(Y);U=Y,$=XJ(Y.next)}if(J.outrogroups!==null){for(let h0 of J.outrogroups)if(h0.pending.size===0)bQ(J,E7(h0.done)),J.outrogroups?.delete(h0);if(J.outrogroups.size===0)J.outrogroups=null}if($!==null||H!==void 0){var F0=[];if(H!==void 0){for(Y of H)if((Y.f&d)===0)F0.push(Y)}while($!==null){if(($.f&d)===0&&$!==J.fallback)F0.push($);$=XJ($.next)}var I7=F0.length;if(I7>0){var e0=(K&iJ)!==0&&Z===0?W:null;if(z){for(S=0;S<I7;S+=1)F0[S].nodes?.a?.measure();for(S=0;S<I7;S+=1)F0[S].nodes?.a?.fix()}V6(J,F0,e0)}}if(z)s(()=>{if(q===void 0)return;for(Y of q)Y.nodes?.a?.apply()})}function U6(J,Q,W,K,X,z,Z,G){var $=(Z&iQ)!==0?(Z&aQ)===0?C7(W,!1,!1):K0(W):null,H=(Z&oQ)!==0?K0(X):null;return{v:$,i:H,e:o(()=>{return z(Q,$??W,H??X,G),()=>{J.delete(K)}})}}function zJ(J,Q,W){if(!J.nodes)return;var K=J.nodes.start,X=J.nodes.end,z=Q&&(Q.f&x0)===0?Q.nodes.start:W;while(K!==null){var Z=i(K);if(z.before(K),K===X)return;K=Z}}function V7(J,Q,W){if(Q===null)J.effect.first=W;else Q.next=W;if(W===null)J.effect.last=Q;else W.prev=Q}function H6(J,Q,W=!1,K=!1,X=!1,z=!1){var Z=J,G="";if(W){var $=J;if(M)Z=I(g($))}MQ(()=>{var H=L;if(G===(G=Q()??"")){if(M)l();return}if(W&&!M){if(H.nodes=null,$.innerHTML=G,G!=="")w0(g($),$.lastChild);return}if(H.nodes!==null)wQ(H.nodes.start,H.nodes.end),H.nodes=null;if(G==="")return;if(M){var U=O.data,q=l(),P=q;while(q!==null&&(q.nodeType!==O0||q.data!==""))P=q,q=i(q);if(q===null)throw K7(),v0;w0(O,P),Z=I(q);return}var V=K?c7:X?sJ:void 0,B=A0(K?"svg":X?"math":"template",V);B.innerHTML=G;var w=K||X?B:B.content;if(w0(g(w),w.lastChild),K||X)while(g(w))Z.before(g(w));else Z.before(w)})}function B6(J,Q,W,K,X){if(M)l();if(Q.$$host?.$$shadowRoot){let G=A0("slot");if(W!=="default")G.name=W;if(KJ(J,G),X!==null){let $=p();G.append($),X($)}return}var z=Q.$$slots?.[W],Z=!1;if(z===!0)z=Q[W==="default"?"children":W],Z=!0;if(z===void 0){if(X!==null)X(J)}else z(J,Z?()=>K:K)}function D6(J,Q){P0(()=>{J=L?.parent?.nodes?.start??J;var W=J.getRootNode(),K=W.host?W:W.head??W.ownerDocument.head;if(!K.querySelector("#"+Q.hash)){let X=A0("style");X.id=Q.hash,X.textContent=Q.code,K.appendChild(X)}})}function S6(J,Q,W){P0(()=>{var K=k(()=>Q(J,W?.())||{});if(W&&K?.update){var X=!1,z={};r(()=>{var Z=W();if(IJ(Z),X&&MJ(z,Z))z=Z,K.update(Z)}),X=!0}if(K?.destroy)return()=>K.destroy()})}var q8=[...`
3
+ \r\f \v\uFEFF`];function P8(J,Q,W){var K=J==null?"":""+J;if(Q)K=K?K+" "+Q:Q;if(W){for(var X of Object.keys(W))if(W[X])K=K?K+" "+X:X;else if(K.length){var z=X.length,Z=0;while((Z=K.indexOf(X,Z))>=0){var G=Z+z;if((Z===0||q8.includes(K[Z-1]))&&(G===K.length||q8.includes(K[G])))K=(Z===0?"":K.substring(0,Z))+K.substring(G+1);else Z=G}}}return K===""?null:K}function U8(J,Q,W,K,X,z){var Z=J[_7];if(M||Z!==W||Z===void 0){var G=P8(W,K,z);if(!M||G!==J.getAttribute("class"))if(G==null)J.removeAttribute("class");else if(Q)J.className=G;else J.setAttribute("class",G);J[_7]=W}else if(z&&X!==z)for(var $ in z){var H=!!z[$];if(X==null||H!==!!X[$])J.classList.toggle($,H)}return z}var y6=Symbol("class"),h6=Symbol("style"),g6=Symbol("is custom element"),m6=Symbol("is html"),v6=cJ?"link":"LINK";function Y8(J,Q,W,K){var X=p6(J);if(M){if(X[Q]=J.getAttribute(Q),Q==="src"||Q==="srcset"||Q==="href"&&J.nodeName===v6){if(!K)f6(J,Q,W??"");return}}if(X[Q]===(X[Q]=W))return;if(Q==="loading")J[lQ]=W;if(W==null)J.removeAttribute(Q);else if(typeof W!=="string"&&M8(J).has(Q))J[Q]=W;else J.setAttribute(Q,W)}function u6(J,Q,W){var K=F,X=L;let z=M;if(M)f(!1);u(null),_(null);try{if(Q!=="style"&&(yQ.has(J.getAttribute("is")||J.nodeName)||!customElements||customElements.get(J.getAttribute("is")||J.nodeName.toLowerCase())?M8(J).has(Q):W&&typeof W==="object"))J[Q]=W;else Y8(J,Q,W==null?W:String(W))}finally{if(u(K),_(X),z)f(!0)}}function p6(J){return J[VJ]??={[g6]:J.nodeName.includes("-"),[m6]:J.namespaceURI===qJ}}var yQ=new Map;function M8(J){var Q=J.getAttribute("is")||J.nodeName,W=yQ.get(Q);if(W)return W;yQ.set(Q,W=new Set);var K,X=J,z=Element.prototype;while(z!==X){K=PJ(X);for(var Z in K)if(K[Z].set&&Z!=="innerHTML"&&Z!=="textContent"&&Z!=="innerText")W.add(Z);X=Y7(X)}return W}function f6(J,Q,W){return}function hQ(J,Q){if(J===Q)return!0;return new URL(J,document.baseURI).href===new URL(Q,document.baseURI).href}function H8(J){return J.split(",").map((Q)=>Q.trim().split(" ").filter(Boolean))}function d6(J,Q){var W=H8(J.srcset),K=H8(Q);return K.length===W.length&&K.every(([X,z],Z)=>z===W[Z][1]&&(hQ(W[Z][0],X)||hQ(X,W[Z][0])))}class L8{#J=new WeakMap;#Q;#W;static entries=new WeakMap;constructor(J){this.#W=J}observe(J,Q){var W=this.#J.get(J)||new Set;return W.add(Q),this.#J.set(J,W),this.#G().observe(J,this.#W),()=>{var K=this.#J.get(J);if(K.delete(Q),K.size===0)this.#J.delete(J),this.#Q.unobserve(J)}}#G(){return this.#Q??(this.#Q=new ResizeObserver((J)=>{for(var Q of J){L8.entries.set(Q.target,Q);for(var W of this.#J.get(Q.target)||[])W(Q)}}))}}function gQ(J,Q){return J===Q||J?.[V0]===Q}function _6(J=o7(),Q,W,K){var X=C.r,z=L;return P0(()=>{var Z,G;return r(()=>{Z=G,G=K?.()||[],k(()=>{if(!gQ(W(...G),J)){if(Q(J,...G),Z&&gQ(W(...Z),J))Q(null,...Z)}})}),()=>{let $=z;while($!==X&&$.parent!==null&&$.parent.f&Q7)$=$.parent;let H=()=>{if(G&&gQ(W(...G),J))Q(null,...G)},U=$.teardown;$.teardown=()=>{H(),U?.()}}}),J}var gJ=!1,AG=Symbol("unmounted");function vQ(J){var Q=gJ;try{return gJ=!1,[J(),gJ]}finally{gJ=Q}}function c6(J,Q,W,K){var X=!X7||(W&nQ)!==0,z=(W&eQ)!==0,Z=(W&J4)!==0,G=K,$=!0,H=void 0,U=()=>{if(Z&&X)return H??=Z7(K),N(H);if($)$=!1,G=Z?k(K):K;return G};let q;if(z){var P=V0 in J||d7 in J;q=B0(J,Q)?.set??(P&&Q in J?(A)=>J[Q]=A:void 0)}var V,B=!1;if(z)[V,B]=vQ(()=>J[Q]);else V=J[Q];if(V===void 0&&K!==void 0){if(V=U(),q){if(X)w4(Q);q(V)}}var w;if(X)w=()=>{var A=J[Q];if(A===void 0)return U();return $=!0,A};else w=()=>{var A=J[Q];if(A!==void 0)G=void 0;return A===void 0?G:A};if(X&&(W&tQ)===0)return w;if(q){var Y=J.$$legacy;return function(A,N0){if(arguments.length>0){if(!X||!N0||Y||B)q(N0?w():A);return A}return w()}}var S=!1,b=((W&rQ)!==0?Z7:F7)(()=>{return S=!1,w()});if(z)N(b);var x=L;return function(A,N0){if(arguments.length>0){let z0=N0?N(b):X&&z?r0(A):A;if(X0(b,z0),S=!0,G!==void 0)G=z0;return A}if(D0&&S||(x.f&y)!==0)return b.v;return N(b)}}function w8(J){return new F8(J)}class F8{#J;#Q;constructor(J){var Q=new Map,W=(X,z)=>{var Z=C7(z,!1,!1);return Q.set(X,Z),Z};let K=new Proxy({...J.props||{},$$events:{}},{get(X,z){return N(Q.get(z)??W(z,Reflect.get(X,z)))},has(X,z){if(z===d7)return!0;return N(Q.get(z)??W(z,Reflect.get(X,z))),Reflect.has(X,z)},set(X,z,Z){return X0(Q.get(z)??W(z,Z),Z),Reflect.set(X,z,Z)}});if(this.#Q=(J.hydrate?EQ:yJ)(J.component,{target:J.target,anchor:J.anchor,props:K,context:J.context,intro:J.intro??!1,recover:J.recover,transformError:J.transformError}),!J0&&(!J?.props?.$$host||J.sync===!1))m7();this.#J=K.$$events;for(let X of Object.keys(this.#Q)){if(X==="$set"||X==="$destroy"||X==="$on")continue;H0(this,X,{get(){return this.#Q[X]},set(z){this.#Q[X]=z},enumerable:!0})}this.#Q.$set=(X)=>{Object.assign(K,X)},this.#Q.$destroy=()=>{kQ(this.#Q)}}$set(J){this.#Q.$set(J)}$on(J,Q){this.#J[J]=this.#J[J]||[];let W=(...K)=>Q.call(this,...K);return this.#J[J].push(W),()=>{this.#J[J]=this.#J[J].filter((K)=>K!==W)}}$destroy(){this.#Q.$destroy()}}var O8;if(typeof HTMLElement==="function")O8=class extends HTMLElement{$$ctor;$$s;$$c;$$cn=!1;$$d={};$$r=!1;$$p_d={};$$l={};$$l_u=new Map;$$me;$$shadowRoot=null;constructor(J,Q,W){super();if(this.$$ctor=J,this.$$s=Q,W)this.$$shadowRoot=this.attachShadow(W)}addEventListener(J,Q,W){if(this.$$l[J]=this.$$l[J]||[],this.$$l[J].push(Q),this.$$c){let K=this.$$c.$on(J,Q);this.$$l_u.set(Q,K)}super.addEventListener(J,Q,W)}removeEventListener(J,Q,W){if(super.removeEventListener(J,Q,W),this.$$c){let K=this.$$l_u.get(Q);if(K)K(),this.$$l_u.delete(Q)}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let J=function(K){return(X)=>{let z=A0("slot");if(K!=="default")z.name=K;KJ(X,z)}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;let Q={},W=e6(this);for(let K of this.$$s)if(K in W)if(K==="default"&&!this.$$d.children)this.$$d.children=J(K),Q.default=!0;else Q[K]=J(K);for(let K of this.attributes){let X=this.$$g_p(K.name);if(!(X in this.$$d))this.$$d[X]=mJ(X,K.value,this.$$p_d,"toProp")}for(let K in this.$$p_d)if(!(K in this.$$d)&&this[K]!==void 0)this.$$d[K]=this[K],delete this[K];this.$$c=w8({component:this.$$ctor,target:this.$$shadowRoot||this,props:{...this.$$d,$$slots:Q,$$host:this}}),this.$$me=YQ(()=>{r(()=>{this.$$r=!0;for(let K of i7(this.$$c)){if(!this.$$p_d[K]?.reflect)continue;this.$$d[K]=this.$$c[K];let X=mJ(K,this.$$d[K],this.$$p_d,"toAttribute");if(X==null)this.removeAttribute(this.$$p_d[K].attribute||K);else this.setAttribute(this.$$p_d[K].attribute||K,X)}this.$$r=!1})});for(let K in this.$$l)for(let X of this.$$l[K]){let z=this.$$c.$on(K,X);this.$$l_u.set(X,z)}this.$$l={}}}attributeChangedCallback(J,Q,W){if(this.$$r)return;J=this.$$g_p(J),this.$$d[J]=mJ(J,W,this.$$p_d,"toProp"),this.$$c?.$set({[J]:this.$$d[J]})}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then(()=>{if(!this.$$cn&&this.$$c)this.$$c.$destroy(),this.$$me(),this.$$c=void 0})}$$g_p(J){return i7(this.$$p_d).find((Q)=>this.$$p_d[Q].attribute===J||!this.$$p_d[Q].attribute&&Q.toLowerCase()===J)||J}};function mJ(J,Q,W,K){let X=W[J]?.type;if(Q=X==="Boolean"&&typeof Q!=="boolean"?Q!=null:Q,!K||!W[J])return Q;else if(K==="toAttribute")switch(X){case"Object":case"Array":return Q==null?null:JSON.stringify(Q);case"Boolean":return Q?"":null;case"Number":return Q==null?null:Q;default:return Q}else switch(X){case"Object":case"Array":return Q&&JSON.parse(Q);case"Boolean":return Q;case"Number":return Q!=null?+Q:Q;default:return Q}}function e6(J){let Q={};return J.childNodes.forEach((W)=>{Q[W.slot||"default"]=!0}),Q}function J1(J,Q,W,K,X,z){let Z=class extends O8{constructor(){super(J,W,X);this.$$p_d=Q}static get observedAttributes(){return i7(Q).map((G)=>(Q[G].attribute||G).toLowerCase())}};if(i7(Q).forEach((G)=>{H0(Z.prototype,G,{get(){return this.$$c&&G in this.$$c?this.$$c[G]:this.$$d[G]},set($){$=mJ(G,$,Q),this.$$d[G]=$;var H=this.$$c;if(H){var U=B0(H,G)?.get;if(U)H[G]=$;else H.$set({[G]:$})}}})}),K.forEach((G)=>{H0(Z.prototype,G,{get(){return this.$$c?.[G]}})}),z)Z=z(Z);return J.element=Z,Z}import{createContext as vJ}from"@pie-players/pie-context";var D8=vJ(Symbol.for("pie.assessmentToolkit.runtimeContext")),S8=vJ(Symbol.for("pie.assessmentToolkit.hostRuntimeContext")),C8=vJ(Symbol.for("pie.assessmentToolkit.shellContext")),Q1=vJ(Symbol.for("pie.assessmentToolkit.regionScopeContext"));import{connectContextWithRetry as uQ}from"@pie-players/pie-context";function AU(J,Q){return uQ(J,D8,Q)}function NU(J,Q){return uQ(J,S8,Q)}function RU(J,Q){return uQ(J,C8,Q)}var uJ={assessment:[],section:[],item:[],passage:[],rubric:[],element:[]};var pQ={section:[...uJ.section],item:[...uJ.item],passage:[...uJ.passage]};function R7(J){return typeof J==="object"&&J!==null&&!Array.isArray(J)}function q7(J,Q){if(J==null)return[];if(!Array.isArray(J))throw Error(`Invalid tools config at "${Q}": expected an array of tool ids.`);if(J.find((K)=>typeof K!=="string")!==void 0)throw Error(`Invalid tools config at "${Q}": all entries must be strings.`);return J}function W1(J){if(J==null)return;if(!R7(J))throw Error('Invalid tools config at "placement": expected an object with section/item/passage arrays.');return J}function K1(J){if(J==null)return;if(!R7(J))throw Error('Invalid tools config at "policy": expected an object with allowed/blocked arrays.');return J}function X1(J,Q){if(Q==null)return;if(!R7(Q))throw Error(`Invalid tools config at "providers.${J}": expected an object.`);let W=Q,K=(X)=>X==="polly"||X==="google"||X==="custom";if("enabled"in W&&W.enabled!==void 0&&typeof W.enabled!=="boolean")throw Error(`Invalid tools config at "providers.${J}.enabled": expected a boolean.`);if("settings"in W&&W.settings!==void 0&&!R7(W.settings))throw Error(`Invalid tools config at "providers.${J}.settings": expected an object.`);if("provider"in W&&W.provider!==void 0&&!R7(W.provider)&&!(J==="textToSpeech"&&K(W.provider)))throw Error(`Invalid tools config at "providers.${J}.provider": expected an object.`);return W}function z1(J){if(J==null)return{};if(!R7(J))throw Error('Invalid tools config at "providers": expected an object keyed by tool id.');let Q={};for(let[W,K]of Object.entries(J))Q[W]=X1(W,K);return Q}function fQ(J){let Q=J.trim();if(!Q)return"";return Q}function t0(J){if(!J||J.length===0)return[];let Q=new Set;for(let W of J){if(typeof W!=="string")throw Error("Invalid tools config: tool list entries must be strings.");let K=fQ(W);if(!K)continue;Q.add(K)}return Array.from(Q)}function xU(J){if(!J)return[];return t0(J.split(",").map((Q)=>Q.trim()).filter(Boolean))}function Z1(J,Q){if(J==null)return;if(J==="on"||J==="off")return J;throw Error(`Invalid tools config at "${Q}": expected "on" or "off", got ${JSON.stringify(J)}.`)}function EU(J){if(J!=null&&!R7(J))throw Error('Invalid tools config: expected an object with "policy", "placement", and "providers".');let Q=K1(J?.policy),W=W1(J?.placement),K=z1(J?.providers),X=Z1(J?.pnpEnforcement,"pnpEnforcement"),z={policy:{allowed:t0(q7(Q?.allowed,"policy.allowed")),blocked:t0(q7(Q?.blocked,"policy.blocked"))},placement:{section:t0(q7(W?.section,"placement.section")).length?t0(q7(W?.section,"placement.section")):[...pQ.section],item:t0(q7(W?.item,"placement.item")).length?t0(q7(W?.item,"placement.item")):[...pQ.item],passage:t0(q7(W?.passage,"placement.passage")).length?t0(q7(W?.passage,"placement.passage")):[...pQ.passage]},providers:K};if(X)z.pnpEnforcement=X;return z}import{dynamicMessageKey as yU}from"@pie-players/pie-players-shared/i18n/provider";function gU(J,Q){let W=J.provider;if(!W)return null;return W.getProviderId?.(Q)??Q?.provider?.id??J.toolId}var G1=["assessment","section","item","passage","rubric","element"];function pJ(J,Q){if(typeof J!=="string"||J.trim().length===0)throw Error(`Invalid tool registration: "${Q}" must be a non-empty string.`)}var $1=[{pattern:/<script\b/i,reason:"contains a <script> tag"},{pattern:/\son[a-z]+\s*=/i,reason:"contains an inline event handler (on*=) attribute"},{pattern:/javascript:/i,reason:"contains a javascript: URL"},{pattern:/<foreignObject\b/i,reason:"contains a <foreignObject> element"}];function V1(J,Q,W){let K=Q.trimStart(),X=K.toLowerCase().startsWith("<svg"),z=/^https?:/i.test(K);if(/^data:/i.test(K))throw Error(`Invalid tool registration "${J}": "${W}" may not be a data: URL.`);if(!X&&!z)return;for(let{pattern:G,reason:$}of $1)if(G.test(Q))throw Error(`Invalid tool registration "${J}": "${W}" ${$}. Inline SVG icons must not include scriptable content.`)}function A8(J){pJ(J.toolId,"toolId"),pJ(J.name,"name"),pJ(J.description,"description");let Q=J.activation==="region";if(!Q||J.icon!==void 0){if(typeof J.icon!=="string"&&typeof J.icon!=="function")throw Error(`Invalid tool registration "${J.toolId}": "icon" must be a string or function.`)}if(typeof J.icon==="string")V1(J.toolId,J.icon,"icon");if(!Array.isArray(J.supportedLevels)||J.supportedLevels.length===0)throw Error(`Invalid tool registration "${J.toolId}": "supportedLevels" must be a non-empty array.`);let W=J.supportedLevels.find((K)=>!G1.includes(K));if(W)throw Error(`Invalid tool registration "${J.toolId}": unsupported level "${W}".`);if(J.activation!==void 0&&J.activation!=="toolbar-toggle"&&J.activation!=="selection-gateway"&&J.activation!=="region")throw Error(`Invalid tool registration "${J.toolId}": unsupported activation "${String(J.activation)}".`);if(J.surfaces!==void 0&&(!Array.isArray(J.surfaces)||J.surfaces.some((K)=>typeof K!=="string"||K.trim().length===0)))throw Error(`Invalid tool registration "${J.toolId}": "surfaces" must be an array of non-empty strings.`);if(Q&&!J.surfaces?.length)throw Error(`Invalid tool registration "${J.toolId}": region tools must declare at least one host surface in "surfaces".`);if(Q&&typeof J.renderSurface!=="function")throw Error(`Invalid tool registration "${J.toolId}": region tools must implement "renderSurface".`);if(J.resolvesWithoutGrant!==void 0&&typeof J.resolvesWithoutGrant!=="boolean")throw Error(`Invalid tool registration "${J.toolId}": "resolvesWithoutGrant" must be a boolean.`);if(J.resolvesWithoutGrant&&!J.requiresAuthoredContent)throw Error(`Invalid tool registration "${J.toolId}": "resolvesWithoutGrant" requires "requiresAuthoredContent".`);if(J.renderSurface!==void 0&&typeof J.renderSurface!=="function")throw Error(`Invalid tool registration "${J.toolId}": "renderSurface" must be a function.`);if(J.renderSurface&&!J.surfaces?.length)throw Error(`Invalid tool registration "${J.toolId}": "renderSurface" requires at least one entry in "surfaces".`);if(J.singletonScope!==void 0&&J.singletonScope!=="section")throw Error(`Invalid tool registration "${J.toolId}": unsupported singletonScope "${String(J.singletonScope)}".`);if(J.activation==="selection-gateway"&&J.singletonScope!=="section")throw Error(`Invalid tool registration "${J.toolId}": selection-gateway tools must declare singletonScope "section".`);if(J.pnpSupportIds!==void 0&&(!Array.isArray(J.pnpSupportIds)||J.pnpSupportIds.some((K)=>typeof K!=="string"||K.trim().length===0)))throw Error(`Invalid tool registration "${J.toolId}": "pnpSupportIds" must be an array of non-empty strings.`);if(J.activation!=="region"&&typeof J.isVisibleInContext!=="function")throw Error(`Invalid tool registration "${J.toolId}": "isVisibleInContext" must be a function.`);if(J.isVisibleInContext!==void 0&&typeof J.isVisibleInContext!=="function")throw Error(`Invalid tool registration "${J.toolId}": "isVisibleInContext" must be a function when present.`);if(J.isApplicableToContent!==void 0&&typeof J.isApplicableToContent!=="function")throw Error(`Invalid tool registration "${J.toolId}": "isApplicableToContent" must be a function when present.`);if(J.requiresAuthoredContent!==void 0){if(typeof J.requiresAuthoredContent!=="object"||J.requiresAuthoredContent===null||typeof J.requiresAuthoredContent.resolve!=="function")throw Error(`Invalid tool registration "${J.toolId}": "requiresAuthoredContent" must be an object with a "resolve" function.`);if(!J.pnpSupportIds?.length)throw Error(`Invalid tool registration "${J.toolId}": "requiresAuthoredContent" requires at least one entry in "pnpSupportIds", which is what a host filters a default grant list on.`)}if(J.renderToolbar!==void 0){if(typeof J.renderToolbar!=="function")throw Error(`Invalid tool registration "${J.toolId}": "renderToolbar" must be a function.`)}else if(!Q)throw Error(`Invalid tool registration "${J.toolId}": "renderToolbar" must be a function.`)}class q1{tools=new Map;pnpIndex=new Map;componentOverrides={};moduleLoaders=new Map;loadedToolModules=new Set;moduleLoadPromises=new Map;changeListeners=new Set;emitChange(J){for(let Q of this.changeListeners)try{Q(J)}catch(W){console.warn("[ToolRegistry] change listener failed:",W)}}onRegistryChange(J){this.changeListeners.add(J);let Q=!0;return()=>{if(!Q)return;Q=!1,this.changeListeners.delete(J)}}normalizeToolId(J){return fQ(J)}normalizeToolIds(J){return J.map((Q)=>this.normalizeToolId(Q))}register(J){if(A8(J),this.tools.has(J.toolId))throw Error(`Tool '${J.toolId}' is already registered`);if(this.tools.set(J.toolId,J),J.pnpSupportIds)for(let Q of J.pnpSupportIds){if(!this.pnpIndex.has(Q))this.pnpIndex.set(Q,new Set);this.pnpIndex.get(Q).add(J.toolId)}this.emitChange({kind:"register",toolIds:[J.toolId]})}override(J){if(A8(J),!this.tools.has(J.toolId))throw Error(`Cannot override non-existent tool '${J.toolId}'`);let Q=this.tools.get(J.toolId);if(Q.pnpSupportIds)for(let W of Q.pnpSupportIds)this.pnpIndex.get(W)?.delete(J.toolId);if(this.tools.set(J.toolId,J),J.pnpSupportIds)for(let W of J.pnpSupportIds){if(!this.pnpIndex.has(W))this.pnpIndex.set(W,new Set);this.pnpIndex.get(W).add(J.toolId)}this.emitChange({kind:"override",toolIds:[J.toolId]})}unregister(J){let Q=this.tools.get(J);if(!Q)return;if(Q.pnpSupportIds)for(let W of Q.pnpSupportIds)this.pnpIndex.get(W)?.delete(J);this.tools.delete(J),this.emitChange({kind:"unregister",toolIds:[J]})}get(J){return this.tools.get(J)}has(J){return this.tools.has(J)}getAllToolIds(){return Array.from(this.tools.keys())}getAllTools(){return Array.from(this.tools.values())}getToolsByPNPSupport(J){return this.pnpIndex.get(J)||new Set}getToolsByLevel(J){return this.getAllTools().filter((Q)=>Q.supportedLevels.includes(J))}getToolActivation(J){return this.get(J)?.activation||"toolbar-toggle"}getToolSingletonScope(J){return this.get(J)?.singletonScope||null}getToolsBySurface(J){if(!J)return[];return this.getAllTools().filter((Q)=>typeof Q.renderSurface==="function"&&Q.surfaces?.includes(J))}getContentDependentSupportIds(){let J=new Set;for(let Q of this.getAllTools()){if(!Q.requiresAuthoredContent)continue;for(let W of Q.pnpSupportIds||[])J.add(W)}return[...J].sort()}filterToolIdsByActivation(J,Q){return J.filter((W)=>this.getToolActivation(W)===Q)}filterVisibleInContext(J,Q){let W=[];for(let K of J){let X=this.get(K);if(!X){console.warn(`Tool '${K}' is allowed but not registered`);continue}if(!X.supportedLevels.includes(Q.level))continue;try{if(X.isVisibleInContext?.(Q))W.push(X)}catch(z){console.error(`Error evaluating visibility for tool '${K}':`,z)}}return W}isApplicableToAnyContext(J,Q){let W=this.get(J);if(!W?.isApplicableToContent)return!0;if(Q.length===0)return!0;return Q.some((K)=>{try{return W.isApplicableToContent?.(K)??!0}catch(X){return console.error(`Error evaluating applicability for tool '${J}':`,X),!0}})}getToolMetadata(){return this.getAllTools().map((J)=>({toolId:J.toolId,name:J.name,description:J.description,pnpSupportIds:J.pnpSupportIds||[],supportedLevels:J.supportedLevels,activation:J.activation||"toolbar-toggle",singletonScope:J.singletonScope||null,surfaces:J.surfaces||[],requiresAuthoredContent:Boolean(J.requiresAuthoredContent),contentDependencyDescription:J.requiresAuthoredContent?.description??null}))}generatePNPSupportsFromTools(J){let Q=new Set;for(let W of J){let K=this.get(W);if(K?.pnpSupportIds)for(let X of K.pnpSupportIds)Q.add(X)}return Array.from(Q)}clear(){let J=this.getAllToolIds();if(J.length===0)return;this.tools.clear(),this.pnpIndex.clear(),this.emitChange({kind:"clear",toolIds:J})}setComponentOverrides(J){if(this.componentOverrides===J)return;this.componentOverrides=J,this.emitChange({kind:"component-overrides",toolIds:[]})}setToolModuleLoaders(J){let Q=Object.entries(J).filter((K)=>K[1]!==void 0);for(let[K,X]of Q)if(pJ(K,"tool module loader id"),typeof X!=="function")throw Error(`Invalid tool module loader for "${K}": expected a function.`);let W=[];for(let[K,X]of Q){if(this.moduleLoaders.get(K)===X)continue;this.moduleLoaders.set(K,X),W.push(K)}if(W.length>0)this.emitChange({kind:"module-loaders",toolIds:W})}async ensureToolModuleLoaded(J){if(this.loadedToolModules.has(J))return;let Q=this.moduleLoadPromises.get(J);if(Q){await Q;return}let W=this.moduleLoaders.get(J);if(!W)return;let K=(async()=>{await W(),this.loadedToolModules.add(J)})();this.moduleLoadPromises.set(J,K);try{await K}finally{this.moduleLoadPromises.delete(J)}}async ensureToolModulesLoaded(J){await Promise.all(J.map((Q)=>this.ensureToolModuleLoaded(Q)))}isToolModuleLoaded(J){return this.loadedToolModules.has(J)}renderForToolbar(J,Q,W){let K=this.get(J);if(!K)throw Error(`Tool '${J}' is not registered`);if(typeof K.renderToolbar!=="function")throw Error(`Tool '${J}' has activation "${K.activation||"toolbar-toggle"}" and renders into a host surface, not a toolbar. Remove it from toolbar placement.`);let X={...W,componentOverrides:{...this.componentOverrides||{},...W.componentOverrides||{}}};return K.renderToolbar(Q,X)}renderForSurface(J,Q){let W=this.get(J);if(!W)throw Error(`Tool '${J}' is not registered`);if(typeof W.renderSurface!=="function")throw Error(`Tool '${J}' does not render into a host surface. Surface capabilities declare "surfaces" and implement "renderSurface".`);return W.renderSurface({...Q,componentOverrides:{...this.componentOverrides||{},...Q.componentOverrides||{}}})}}
4
+ export{jJ as b,nJ as c,tJ as d,b8 as e,m7 as f,d0 as g,X0 as h,r0 as i,e4 as j,c8 as k,i8 as l,o8 as m,BQ as n,MQ as o,N as p,k as q,J8 as r,Q8 as s,n8 as t,t8 as u,KJ as v,K6 as w,Z6 as x,$6 as y,q6 as z,H6 as A,B6 as B,D6 as C,S6 as D,U8 as E,Y8 as F,u6 as G,_6 as H,c6 as I,J1 as J,D8 as K,S8 as L,AU as M,NU as N,RU as O,t0 as P,xU as Q,EU as R,gU as S,q1 as T};
@@ -0,0 +1,2 @@
1
+ import{X as w}from"./ItemToolBar-gmrryv2v.js";var y={base:()=>import("speech-rule-engine/lib/mathmaps/base.json"),en:()=>import("speech-rule-engine/lib/mathmaps/en.json"),es:()=>import("speech-rule-engine/lib/mathmaps/es.json")},D=async(f)=>{if(!Object.hasOwn(y,f))throw Error(`no speech-rule-engine locale table is packaged for "${f}"; name a source with mathSpeech.engineOptions.json or .custom`);return(await y[f]()).default},G=()=>typeof window<"u"&&typeof window.document<"u"||typeof globalThis.DedicatedWorkerGlobalScope<"u",z=(f={})=>{let{json:q,custom:v}=f;if(q||v)return{...q?{json:q}:{},...v?{custom:v}:{}};return G()?{custom:D}:{}},x,H=(f)=>{x=z(f)},I=()=>{return x??=z(),x};
2
+ export{z as U,H as V,I as W};
@@ -0,0 +1 @@
1
+ import{W as v}from"./ItemToolBar-wr2myaah.js";import"./ItemToolBar-gmrryv2v.js";import*as q from"speech-rule-engine";var x=q.default??q;x.setupEngine(v());var B=x;export{B as default};
@@ -57,6 +57,11 @@ export interface AssessmentToolkitRuntimeContext {
57
57
  */
58
58
  i18n?: I18nProvider;
59
59
  reportSessionChanged?: (itemId: string, detail: unknown) => void;
60
+ /**
61
+ * Reports a failure that keeps the section's content from loading as the
62
+ * section controller's `section-error`, with source `section-runtime`.
63
+ */
64
+ reportSectionError?: (error: unknown) => void;
60
65
  }
61
66
  export declare const assessmentToolkitRuntimeContext: {
62
67
  __context__: AssessmentToolkitRuntimeContext;
@@ -1,51 +1,18 @@
1
- import { ContextConsumer } from "@pie-players/pie-context";
1
+ import { connectContextWithRetry } from "@pie-players/pie-context";
2
2
  import { assessmentToolkitHostRuntimeContext, assessmentToolkitRegionScopeContext, assessmentToolkitShellContext, assessmentToolkitRuntimeContext, } from "./assessment-toolkit-context.js";
3
- function connectConsumerWithProviderRetry(host, context, onValue) {
4
- let hasValue = false;
5
- const consumer = new ContextConsumer(host, {
6
- context,
7
- subscribe: true,
8
- onValue: (value) => {
9
- hasValue = true;
10
- onValue(value);
11
- },
12
- });
13
- consumer.connect();
14
- const onContextProvider = (event) => {
15
- if (event.context !== context)
16
- return;
17
- consumer.requestValue();
18
- };
19
- host.addEventListener("context-provider", onContextProvider);
20
- let attempts = 0;
21
- const maxAttempts = 200;
22
- const retryTimer = globalThis.setInterval(() => {
23
- if (hasValue || attempts >= maxAttempts) {
24
- globalThis.clearInterval(retryTimer);
25
- return;
26
- }
27
- attempts += 1;
28
- consumer.requestValue();
29
- }, 50);
30
- return () => {
31
- globalThis.clearInterval(retryTimer);
32
- host.removeEventListener("context-provider", onContextProvider);
33
- consumer.disconnect();
34
- };
35
- }
36
3
  /**
37
4
  * Connect a DOM host element to the shared assessment toolkit runtime context.
38
5
  * Returns a cleanup function that disconnects the underlying consumer.
39
6
  */
40
7
  export function connectAssessmentToolkitRuntimeContext(host, onValue) {
41
- return connectConsumerWithProviderRetry(host, assessmentToolkitRuntimeContext, onValue);
8
+ return connectContextWithRetry(host, assessmentToolkitRuntimeContext, onValue);
42
9
  }
43
10
  export function connectAssessmentToolkitHostRuntimeContext(host, onValue) {
44
- return connectConsumerWithProviderRetry(host, assessmentToolkitHostRuntimeContext, onValue);
11
+ return connectContextWithRetry(host, assessmentToolkitHostRuntimeContext, onValue);
45
12
  }
46
13
  export function connectAssessmentToolkitShellContext(host, onValue) {
47
- return connectConsumerWithProviderRetry(host, assessmentToolkitShellContext, onValue);
14
+ return connectContextWithRetry(host, assessmentToolkitShellContext, onValue);
48
15
  }
49
16
  export function connectAssessmentToolkitRegionScopeContext(host, onValue) {
50
- return connectConsumerWithProviderRetry(host, assessmentToolkitRegionScopeContext, onValue);
17
+ return connectContextWithRetry(host, assessmentToolkitRegionScopeContext, onValue);
51
18
  }
package/dist/index.d.ts CHANGED
@@ -10,9 +10,9 @@ export type { AssessmentToolkitHostRuntimeContext, AssessmentToolkitRegionScopeC
10
10
  export type { TTSHighlightContext, TTSHighlightTargetResolver, TTSHighlightTargetResolverProvider, TTSHighlightTargetResolverRuntime, } from "./services/tts/highlight-target-resolver.js";
11
11
  export { assessmentToolkitHostRuntimeContext, assessmentToolkitRegionScopeContext, assessmentToolkitRuntimeContext, assessmentToolkitShellContext, } from "./context/assessment-toolkit-context.js";
12
12
  export { connectAssessmentToolkitHostRuntimeContext, connectAssessmentToolkitRegionScopeContext, connectAssessmentToolkitRuntimeContext, connectAssessmentToolkitShellContext, } from "./context/runtime-context-consumer.js";
13
- export { catalogOwnerContextFor, type CatalogOwnerContext, type CatalogOwnerIdentity, type CatalogOwnerKind, type CatalogSourceEntity, } from "./services/catalog-owner.js";
13
+ export { catalogOwnerContextFor, catalogSourceSignature, type CatalogOwnerContext, type CatalogOwnerIdentity, type CatalogOwnerKind, type CatalogSourceEntity, } from "./services/catalog-owner.js";
14
14
  export { PIE_INTERNAL_CONTENT_LOADED_EVENT, PIE_INTERNAL_FORMATIVE_ACTION_EVENT, PIE_INTERNAL_ITEM_SESSION_CHANGED_EVENT, PIE_INTERNAL_ITEM_PLAYER_ERROR_EVENT, PIE_INTERNAL_MEDIA_TIME_SOURCE_EVENT, PIE_ITEM_SESSION_CHANGED_EVENT, PIE_REGISTER_EVENT, PIE_UNREGISTER_EVENT, type InternalContentLoadedDetail, type InternalFormativeActionDetail, type InternalItemSessionChangedDetail, type InternalItemPlayerErrorDetail, type InternalMediaTimeSourceDetail, type ItemSessionChangedDetail, type RuntimeRegistrationDetail, type RuntimeRegistrationKind, } from "./runtime/registration-events.js";
15
- export { connectToolRegionScopeContext, connectToolRuntimeContext, connectToolShellContext, createCrossBoundaryEvent, dispatchCrossBoundaryEvent, isContextValueDefined, } from "./runtime/tool-host-contract.js";
15
+ export { connectToolRegionScopeContext, connectToolRuntimeContext, connectToolShellContext, createCrossBoundaryEvent, createToolCoordinatorRegistration, dispatchCrossBoundaryEvent, isContextValueDefined, type ToolCoordinatorRegistration, } from "./runtime/tool-host-contract.js";
16
16
  export type { AccessibilityCatalogResolverApi, ElementToolStateStoreApi, HighlightCoordinatorApi, I18nServiceApi, ThemeProviderApi, ToolCoordinatorApi, ToolkitCoordinatorApi, TtsServiceApi, ToolState, } from "./services/interfaces.js";
17
17
  export type { CatalogCardForm, CatalogChangeEvent, CatalogChangeListener, CatalogChangeReason, CatalogLookupContext, CatalogLookupOptions, CatalogOwnerCard, CatalogOwnerRegistration, CatalogOwnerSnapshot, CatalogOwnerView, CatalogStatistics, CatalogType, ResolvedCatalog, } from "./services/AccessibilityCatalogResolver.js";
18
18
  export { AccessibilityCatalogResolver, catalogCardForm, isKnownCatalogType, KNOWN_CATALOG_TYPES, } from "./services/AccessibilityCatalogResolver.js";
@@ -31,14 +31,14 @@ export { DEFAULT_TOOL_REQUEST_LEVEL } from "./services/tool-request.js";
31
31
  export type { ToolSelectionAction, ToolSelectionContext, } from "./services/selection-action.js";
32
32
  export type { AssessmentToolContext, BaseToolContext, ElementToolContext, ItemToolContext, PassageToolContext, RubricToolContext, SectionToolContext, ToolContext, ToolLevel, } from "./services/tool-context.js";
33
33
  export { extractTextContent, hasChoiceInteraction, hasMathContent, hasReadableText, isAssessmentContext, isElementContext, isItemContext, isPassageContext, isRubricContext, isSectionContext, } from "./services/tool-context.js";
34
- export { DEFAULT_TOOL_PLACEMENT } from "./services/createDefaultToolRegistry.js";
34
+ export { DEFAULT_TOOL_PLACEMENT } from "./services/tool-config-defaults.js";
35
35
  export type { CreateToolsConfigArgs } from "./services/create-tools-config.js";
36
36
  export { createToolsConfig } from "./services/create-tools-config.js";
37
37
  export { createEmptyPersonalNeedsProfile } from "./services/defaultPersonalNeedsProfile.js";
38
38
  export type { ToolComponentFactory, ToolComponentFactoryMap, ToolComponentOverrides, ToolTagMap, } from "./tools/tool-tag-map.js";
39
39
  export { createToolElement, resolveToolTag, toToolIdFromTag, } from "./tools/tool-tag-map.js";
40
40
  export { ALL_STANDARD_ACCESS_FEATURES, EXAMPLE_PNP_CONFIGURATIONS, getFeatureCategory, getFeaturesInCategory, isStandardAccessFeature, QTI_STANDARD_ACCESS_FEATURES, } from "./services/pnp-standard-features.js";
41
- export { applyMediaFragment, enforceMediaFragment, isSafeMediaSrc, isUnsupportedMediaAssetVersion, normalizeMediaFragment, normalizeMediaSources, SUPPORTED_MEDIA_ASSET_VERSION, trimmedOrUndefined, } from "./services/catalog-media.js";
41
+ export { applyMediaFragment, enforceMediaFragment, isSafeMediaSrc, isUnsupportedMediaAssetVersion, normalizeMediaFragment, normalizeMediaSources, SUPPORTED_MEDIA_ASSET_VERSION, trimmedOrUndefined, } from "@pie-players/pie-players-shared/media";
42
42
  export type { SpokenAudioMedia } from "./services/spoken-audio-cards.js";
43
43
  export { resolveSpokenAudioMedia, SPOKEN_CATALOG_TYPE, } from "./services/spoken-audio-cards.js";
44
44
  export type { ExtractionResult } from "./services/SSMLExtractor.js";
@@ -48,7 +48,7 @@ export { ThemeProvider } from "./services/ThemeProvider.js";
48
48
  export { ToolCoordinator, ZIndexLayer } from "./services/ToolCoordinator.js";
49
49
  export type { AnswerEliminatorToolConfig, ProviderLifecycleContext, SectionControllerContext, SectionControllerEvent, SectionControllerEventType, SectionItemEvent, SectionItemEventType, SectionControllerFactoryDefaults, SectionControllerHandle, SectionControllerKey, SectionScopedEvent, SectionScopedEventType, SectionSessionPersistenceConfig, SectionItemEventSubscriptionArgs, SectionScopedEventSubscriptionArgs, SectionEventSubscriptionArgs, SectionSessionPersistenceStrategy, SectionControllerLoadedRenderable, SectionControllerRuntimeState, SectionControllerSessionState, SectionPersistenceFactoryDefaults, ToolConfig, ToolkitCoordinatorConfig, ToolkitCoordinatorHooks, ToolkitErrorContext, ToolkitInitStatus, ToolkitServiceBundle, ToolkitToolsConfig, TTSToolConfig, } from "./services/ToolkitCoordinator.js";
50
50
  export { ToolkitCoordinator } from "./services/ToolkitCoordinator.js";
51
- export type { CanonicalToolsConfig, ToolPlacementConfig, ToolPlacementLevel, ToolPolicyConfig, ToolProvidersConfig, } from "./services/tools-config-normalizer.js";
51
+ export type { CalculatorToolProviderConfig, CanonicalToolsConfig, ToolPlacementConfig, ToolPlacementLevel, ToolPolicyConfig, ToolProvidersConfig, ToolsConfigInput, } from "./services/tools-config-normalizer.js";
52
52
  export type { FrameworkErrorKind, FrameworkErrorModel, FrameworkErrorSeverity, } from "./services/framework-error.js";
53
53
  export { formatFrameworkErrorForConsole, frameworkErrorFromToolConfigDiagnostics, frameworkErrorFromUnknown, toFrameworkErrorModel, } from "./services/framework-error.js";
54
54
  export type { FrameworkErrorListener } from "./services/framework-error-bus.js";
@@ -74,6 +74,6 @@ export { createFetchItemLoader, createLoadItem, ItemLoadError, } from "./item-lo
74
74
  export type { StorageLike, TestAttemptItemSession, TestAttemptSession, TestAttemptSessionNavigationState, TestAttemptSessionRealization, } from "./attempt/TestSession.js";
75
75
  export { createMemoryStorage, createTestAttemptSessionIdentifier, createNewTestAttemptSession, getBrowserLocalStorage, getOrCreateAnonymousDeviceId, getTestAttemptSessionStorageKey, loadTestAttemptSession, saveTestAttemptSession, setCurrentPosition, upsertItemSessionFromPieSessionChange, upsertVisitedItem, } from "./attempt/TestSession.js";
76
76
  export type { AssessmentSession, AssessmentSectionSessionState, AssessmentSessionNavigationState, AssessmentSessionRealization, } from "./attempt/AssessmentSession.js";
77
- export { createNewAssessmentSession, getAssessmentSessionStorageKey, loadAssessmentSession, saveAssessmentSession, setCurrentSectionPosition, upsertSectionSession, } from "./attempt/AssessmentSession.js";
77
+ export { createNewAssessmentSession, setCurrentSectionPosition, upsertSectionSession, } from "./attempt/AssessmentSession.js";
78
78
  export type { ActivitySessionPatchPayload, MapActivityToTestAttemptSessionArgs, PieBackendActivityDefinition, PieBackendActivityItemRef, PieBackendActivitySession, } from "./attempt/adapters/activity-to-test-attempt-session.js";
79
79
  export { buildActivitySessionItemUpdate, buildActivitySessionPatchFromTestAttemptSession, mapActivityToTestAttemptSession, toItemSessionsRecord, } from "./attempt/adapters/activity-to-test-attempt-session.js";
package/dist/index.js CHANGED
@@ -8,9 +8,9 @@
8
8
  */
9
9
  export { assessmentToolkitHostRuntimeContext, assessmentToolkitRegionScopeContext, assessmentToolkitRuntimeContext, assessmentToolkitShellContext, } from "./context/assessment-toolkit-context.js";
10
10
  export { connectAssessmentToolkitHostRuntimeContext, connectAssessmentToolkitRegionScopeContext, connectAssessmentToolkitRuntimeContext, connectAssessmentToolkitShellContext, } from "./context/runtime-context-consumer.js";
11
- export { catalogOwnerContextFor, } from "./services/catalog-owner.js";
11
+ export { catalogOwnerContextFor, catalogSourceSignature, } from "./services/catalog-owner.js";
12
12
  export { PIE_INTERNAL_CONTENT_LOADED_EVENT, PIE_INTERNAL_FORMATIVE_ACTION_EVENT, PIE_INTERNAL_ITEM_SESSION_CHANGED_EVENT, PIE_INTERNAL_ITEM_PLAYER_ERROR_EVENT, PIE_INTERNAL_MEDIA_TIME_SOURCE_EVENT, PIE_ITEM_SESSION_CHANGED_EVENT, PIE_REGISTER_EVENT, PIE_UNREGISTER_EVENT, } from "./runtime/registration-events.js";
13
- export { connectToolRegionScopeContext, connectToolRuntimeContext, connectToolShellContext, createCrossBoundaryEvent, dispatchCrossBoundaryEvent, isContextValueDefined, } from "./runtime/tool-host-contract.js";
13
+ export { connectToolRegionScopeContext, connectToolRuntimeContext, connectToolShellContext, createCrossBoundaryEvent, createToolCoordinatorRegistration, dispatchCrossBoundaryEvent, isContextValueDefined, } from "./runtime/tool-host-contract.js";
14
14
  export { AccessibilityCatalogResolver, catalogCardForm, isKnownCatalogType, KNOWN_CATALOG_TYPES, } from "./services/AccessibilityCatalogResolver.js";
15
15
  // Context Variable Store (QTI 3.0 Context Declarations)
16
16
  export { ContextVariableStore } from "./services/ContextVariableStore.js";
@@ -22,18 +22,17 @@ export { I18nService } from "./services/I18nService.js";
22
22
  export { ToolRegistry } from "./services/ToolRegistry.js";
23
23
  export { DEFAULT_TOOL_REQUEST_LEVEL } from "./services/tool-request.js";
24
24
  export { extractTextContent, hasChoiceInteraction, hasMathContent, hasReadableText, isAssessmentContext, isElementContext, isItemContext, isPassageContext, isRubricContext, isSectionContext, } from "./services/tool-context.js";
25
- export { DEFAULT_TOOL_PLACEMENT } from "./services/createDefaultToolRegistry.js";
25
+ export { DEFAULT_TOOL_PLACEMENT } from "./services/tool-config-defaults.js";
26
26
  export { createToolsConfig } from "./services/create-tools-config.js";
27
27
  export { createEmptyPersonalNeedsProfile } from "./services/defaultPersonalNeedsProfile.js";
28
28
  export { createToolElement, resolveToolTag, toToolIdFromTag, } from "./tools/tool-tag-map.js";
29
29
  // QTI 3.0 Standard Access Features
30
30
  export { ALL_STANDARD_ACCESS_FEATURES, EXAMPLE_PNP_CONFIGURATIONS, getFeatureCategory, getFeaturesInCategory, isStandardAccessFeature, QTI_STANDARD_ACCESS_FEATURES, } from "./services/pnp-standard-features.js";
31
31
  // Media-bearing catalog cards: the generic half, shared by every card form that
32
- // references a recording rather than carrying text. `applyMediaFragment` reached
33
- // the public surface through `sign-language-cards.js` until signing moved to
34
- // `@pie-players/pie-tool-sign-language`; it is exported from its own module now,
35
- // alongside the validators a capability package needs to read a media payload.
36
- export { applyMediaFragment, enforceMediaFragment, isSafeMediaSrc, isUnsupportedMediaAssetVersion, normalizeMediaFragment, normalizeMediaSources, SUPPORTED_MEDIA_ASSET_VERSION, trimmedOrUndefined, } from "./services/catalog-media.js";
32
+ // references a recording rather than carrying text. Owned by
33
+ // `@pie-players/pie-players-shared/media`, which an element can import without
34
+ // this package; re-exported here for toolkit consumers.
35
+ export { applyMediaFragment, enforceMediaFragment, isSafeMediaSrc, isUnsupportedMediaAssetVersion, normalizeMediaFragment, normalizeMediaSources, SUPPORTED_MEDIA_ASSET_VERSION, trimmedOrUndefined, } from "@pie-players/pie-players-shared/media";
37
36
  export { resolveSpokenAudioMedia, SPOKEN_CATALOG_TYPE, } from "./services/spoken-audio-cards.js";
38
37
  export { SSMLExtractor } from "./services/SSMLExtractor.js";
39
38
  export { ThemeProvider } from "./services/ThemeProvider.js";
@@ -53,7 +52,7 @@ export { BrowserTTSProvider } from "./services/tts/browser-provider.js";
53
52
  export { DEFAULT_TTS_SPEED_OPTIONS, formatTTSSpeedOptionsAsText, normalizeTTSLayoutMode, normalizeTTSSpeedControlOptions, normalizeTTSSpeedOptionConfigs, normalizeTTSSpeedOptions, parseTTSSpeedOptionsFromText, resolveTTSHostToolbarLayout, resolveTTSLayoutMode, resolveTTSRuntimeSettings, } from "./services/tts-runtime-config.js";
54
53
  export { createFetchItemLoader, createLoadItem, ItemLoadError, } from "./item-loader.js";
55
54
  export { createMemoryStorage, createTestAttemptSessionIdentifier, createNewTestAttemptSession, getBrowserLocalStorage, getOrCreateAnonymousDeviceId, getTestAttemptSessionStorageKey, loadTestAttemptSession, saveTestAttemptSession, setCurrentPosition, upsertItemSessionFromPieSessionChange, upsertVisitedItem, } from "./attempt/TestSession.js";
56
- export { createNewAssessmentSession, getAssessmentSessionStorageKey, loadAssessmentSession, saveAssessmentSession, setCurrentSectionPosition, upsertSectionSession, } from "./attempt/AssessmentSession.js";
55
+ export { createNewAssessmentSession, setCurrentSectionPosition, upsertSectionSession, } from "./attempt/AssessmentSession.js";
57
56
  export { buildActivitySessionItemUpdate, buildActivitySessionPatchFromTestAttemptSession, mapActivityToTestAttemptSession, toItemSessionsRecord, } from "./attempt/adapters/activity-to-test-attempt-session.js";
58
57
  // Section Player - Use @pie-players/pie-section-player web component
59
58
  // ============================================================================
@@ -62,9 +62,9 @@ export interface ResolvedEngineInputs {
62
62
  }
63
63
  export type ToolPolicyChangeListener = (event: ToolPolicyChangeEvent) => void;
64
64
  export declare class ToolPolicyEngine {
65
- private readonly toolRegistry;
65
+ private toolRegistry;
66
66
  private readonly contextId;
67
- private readonly pnpPolicySource;
67
+ private pnpPolicySource;
68
68
  private readonly customSources;
69
69
  private readonly listeners;
70
70
  private tools;
@@ -146,6 +146,12 @@ export declare class ToolPolicyEngine {
146
146
  * event channel.
147
147
  */
148
148
  updateInputs(patch: Partial<ToolPolicyEngineInputs>): void;
149
+ /**
150
+ * Swap the registry PNP support ids resolve against, together with the tools
151
+ * config validated against it, and emit an `"inputs"` change. For a
152
+ * coordinator adopting its toolkit's registry.
153
+ */
154
+ replaceToolRegistry(toolRegistry: ToolRegistry, tools: CanonicalToolsConfig): void;
149
155
  registerPolicySource(source: PolicySource): () => void;
150
156
  onPolicyChange(listener: ToolPolicyChangeListener): () => void;
151
157
  getInputs(): Readonly<ResolvedEngineInputs>;
@@ -209,6 +209,18 @@ export class ToolPolicyEngine {
209
209
  });
210
210
  }
211
211
  }
212
+ /**
213
+ * Swap the registry PNP support ids resolve against, together with the tools
214
+ * config validated against it, and emit an `"inputs"` change. For a
215
+ * coordinator adopting its toolkit's registry.
216
+ */
217
+ replaceToolRegistry(toolRegistry, tools) {
218
+ this.assertNotDisposed();
219
+ this.toolRegistry = toolRegistry;
220
+ this.pnpPolicySource = new PnpPolicySource(toolRegistry);
221
+ this.tools = tools;
222
+ this.emit({ reason: "inputs", inputs: this.snapshotInputs() });
223
+ }
212
224
  registerPolicySource(source) {
213
225
  this.assertNotDisposed();
214
226
  this.customSources.push(source);