@pie-players/pie-assessment-toolkit 1.0.0-beta.0 → 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/components/ItemToolBar.custom-element.js +1 -1
- package/dist/components/PieAssessmentToolkit.custom-element.js +7 -7
- package/dist/components/SectionToolBar.custom-element.js +1 -1
- package/dist/components/chunks/ItemToolBar-asenkvx6.js +40 -0
- package/dist/policy/core/compose-decision.js +2 -0
- package/dist/policy/core/decision-types.d.ts +10 -5
- package/dist/policy/core/feature-decision.d.ts +3 -3
- package/dist/policy/core/pnp-policy-inputs.d.ts +2 -1
- package/dist/policy/core/pnp-policy-inputs.js +6 -2
- package/dist/policy/core/provenance.d.ts +1 -1
- package/dist/policy/core/tool-parameters.d.ts +3 -2
- package/dist/policy/core/tool-parameters.js +17 -5
- package/dist/policy/sources/PnpPolicySource.d.ts +4 -2
- package/dist/policy/sources/PnpPolicySource.js +27 -1
- package/dist/services/TTSService.d.ts +5 -4
- package/dist/services/TTSService.js +25 -11
- package/dist/services/ToolRegistry.d.ts +4 -3
- package/dist/services/interfaces.d.ts +4 -0
- package/dist/services/tool-context.d.ts +33 -2
- package/dist/services/tool-context.js +69 -49
- package/dist/services/toolbar-decided-tools.d.ts +1 -0
- package/dist/services/toolbar-decided-tools.js +1 -0
- package/dist/services/tts/browser-provider.js +9 -2
- package/dist/tools/registration.d.ts +2 -2
- package/dist/tools/registration.js +1 -1
- package/package.json +6 -6
- package/dist/components/chunks/ItemToolBar-9gqhfxtn.js +0 -40
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunks/ItemToolBar-
|
|
1
|
+
import"./chunks/ItemToolBar-asenkvx6.js";import"./chunks/ItemToolBar-hzc5wyjp.js";import{H as E,M as W,O as X,_ as w,aa as G,ba as Y,v as U,w as V,y as F}from"./chunks/ItemToolBar-3zrc4p3d.js";import"./chunks/ItemToolBar-kkj69ptr.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,""),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{m as D6,n as O6,p as N6,r as F6}from"./ItemToolBar-hzc5wyjp.js";import{$ as U6,A as r,B as j6,C as aJ,D as yJ,F as TZ,G as $,H as o,I as J,K as VZ,L as K6,M as LJ,N as xJ,O as y,Q as NJ,R as X6,S as YZ,T as Q0,V as Q6,W as LZ,X as U0,Y as OJ,Z as l,_ as BJ,aa as u,ba as V6,ca as Y6,ha as L6,ia as q6,ka as V0,la as G6,ma as r0,t as AZ,u as GJ,v as J6,w as Z6,x as G,y as h,z as UJ}from"./ItemToolBar-3zrc4p3d.js";import{ContextProvider as O9}from"@pie-players/pie-context";function j0(D,L,M,H){if(typeof D?.reportToolFailure==="function"){D.reportToolFailure(L,M,H);return}console.error(`[${L}] ${M} failed:`,H)}function K0(D){return typeof D.href==="string"}function c0(D){if(!D||typeof D!=="object"||Array.isArray(D))return!1;let L=D;if(typeof L.id!=="string"||L.id.trim().length===0)return!1;if(typeof L.label!=="string"||L.label.trim().length===0)return!1;if(L.ariaLabel!==void 0&&typeof L.ariaLabel!=="string")return!1;if(L.icon!==void 0&&typeof L.icon!=="string")return!1;if(L.tooltip!==void 0&&typeof L.tooltip!=="string")return!1;if(L.active!==void 0&&typeof L.active!=="boolean")return!1;if(L.disabled!==void 0&&typeof L.disabled!=="boolean")return!1;let M=typeof L.href==="string",H=typeof L.onClick==="function";return M!==H}function a0(D){return typeof D==="string"&&D.trimStart().startsWith("<svg")}function i0(D){return typeof D==="string"&&D.trimStart().startsWith("http")}import{sanitizeSvgIcon as o0}from"@pie-players/pie-players-shared/security";import{resolveInterfaceI18n as G9}from"@pie-players/pie-players-shared/i18n/provider";import{collectFocusable as N9,createFocusTrap as F9,createPointerGesture as P9,FOCUSABLE_SELECTOR as W9,isProgrammaticFocusTarget as M9}from"@pie-players/pie-players-shared";var Z9={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 s0(D){return Z9[D]||null}import{runtimeElementTags as j9}from"@pie-players/pie-players-shared/pie";import{parseVersionedTagName as K9}from"@pie-players/pie-players-shared/pie/tag-names";function X9(D){return D.level==="item"}function Q9(D){return D.level==="passage"}function U9(D){return D.level==="element"}function X0(D){if(Array.isArray(D))return D;if(D&&typeof D==="object")return Object.values(D);return[]}function V9(D,L){return X0(D).find((M)=>!!M&&typeof M==="object"&&M.id===L)}function Y9(D,L){if(!L||typeof L!=="object")return;let M=L,H=M[D]??M[K9(D).baseName];return typeof H==="string"&&H?H:void 0}function L9(D){let L;try{L=D.pieSupports}catch{return}if(!Array.isArray(L))return;return L.filter((M)=>typeof M==="string")}function q9(D,L){if(!D||typeof D!=="object")return null;let{id:M,element:H}=D;if(typeof H!=="string"||!H)return null;let p=Y9(H,L),FJ=j9(H,p),$J=typeof customElements>"u"?void 0:customElements;for(let IJ of FJ){let pJ=$J?.get(IJ);if(pJ)return{elementId:typeof M==="string"?M:void 0,tag:H,packageSpec:p,supports:L9(pJ),pendingTags:[]}}return{elementId:typeof M==="string"?M:void 0,tag:H,packageSpec:p,supports:void 0,pendingTags:$J?FJ:[]}}function d0(D){let L,M;if(U9(D))L=D.item.config,M=[V9(L?.models,D.elementId)];else if(X9(D))L=D.item?.config,M=X0(L?.models);else if(Q9(D))L=D.passage?.config,M=X0(L?.models);else return[];return M.flatMap((H)=>{let p=q9(H,L?.elements);return p?[p]:[]})}function l0(){let D=null;return(L,M)=>{if(!L)return D=null,null;let H=L.visibleTools.map((p)=>({toolId:p.toolId,required:p.required,alwaysAvailable:p.alwaysAvailable,activateAtInit:p.activateAtInit,parameters:p.parameters}));if(D?.renderVersion===M&&r0(D.tools,H))return D.tools;return D={renderVersion:M,tools:H},H}}import"@pie-players/pie-players-shared/nds-icon-button";var D9=(D,L)=>{if(customElements.get(D))return;try{customElements.define(D,L)}catch(M){if(!(M instanceof DOMException&&M.name==="NotSupportedError"||M&&typeof M==="object"&&M.name==="NotSupportedError")||!customElements.get(D))throw M}},n0=(D,L=AZ)=>{var M=xJ(),H=yJ(M);{var p=(n)=>{var jJ=t0();Q0(jJ,()=>o0(L()),!0),GJ(jJ),y(n,jJ)},FJ=G(()=>a0(L())),$J=(n)=>{var jJ=R9();o(()=>l(jJ,"src",L())),y(n,jJ)},IJ=G(()=>i0(L())),pJ=(n)=>{let jJ=G(()=>s0(L()));var iJ=xJ(),vJ=yJ(iJ);{var qZ=(PJ)=>{var WJ=t0();Q0(WJ,()=>o0(J(jJ)),!0),GJ(WJ),y(PJ,WJ)},SZ=(PJ)=>{var WJ=k9();o(()=>OJ(WJ,1,`icon icon-${L()}`,"svelte-1c13522")),y(PJ,WJ)};NJ(vJ,(PJ)=>{if(J(jJ))PJ(qZ);else PJ(SZ,-1)})}y(n,iJ)};NJ(H,(n)=>{if(J(FJ))n(p);else if(J(IJ))n($J,1);else n(pJ,-1)})}y(D,M)},t0=LJ('<span aria-hidden="true"></span>'),R9=LJ('<img class="item-toolbar__icon-image svelte-1c13522" alt=""/>'),k9=LJ('<i aria-hidden="true"></i>'),e0=LJ("<span></span>"),z9=LJ('<span class="item-toolbar__nds-button-zoom svelte-1c13522"><nds-icon-button></nds-icon-button></span>',2),H9=LJ("<a><!></a>"),w9=LJ('<button type="button"><!></button>'),B9=LJ("<div></div>"),I9=LJ('<div><div class="item-toolbar__tools-row svelte-1c13522"><!> <!> <!></div> <!></div>'),T9={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 P6(D,L){J6(L,!0),Q6(D,T9);let M=(Z,K=AZ,j=AZ)=>{var Q=xJ(),N=yJ(Q);{var k=(P)=>{var S=xJ(),z=yJ(S);X6(z,()=>J(PZ),(O)=>{var e=e0();LZ(e,(JJ,s)=>u6?.(JJ,s),()=>({mounted:K(),active:J(aZ)[K().toolId]??!1,runtime:J(B),i18n:J(L0)})),o(()=>OJ(e,1,U0(j()),"svelte-1c13522")),y(O,e)}),y(P,S)},q=(P)=>{var S=e0();LZ(S,(z,O)=>h6?.(z,O),()=>K().entry),o(()=>OJ(S,1,U0(j()),"svelte-1c13522")),y(P,S)};NJ(N,(P)=>{if(K().entry.shell)P(k);else P(q,-1)})}y(Z,Q)},H=typeof window<"u",p="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.5.2/css/all.min.css",FJ=/font.?awesome|fa-?pro/i,$J=/fontawesome-free/i,IJ=()=>Array.from(document.querySelectorAll('link[rel="stylesheet"][href]')),pJ=()=>IJ().some((Z)=>FJ.test(Z.href)&&!$J.test(Z.href)),n=(Z,K)=>{let j=pJ()?K:"fa-solid";if(j==="fa-light")return()=>{};let Q=()=>{for(let k of Z.querySelectorAll("i.fa-light"))k.classList.remove("fa-light"),k.classList.add(j)};Q();let N=new MutationObserver(Q);return N.observe(Z,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]}),()=>N.disconnect()},jJ=(Z)=>{if(document.querySelector(`link[href="${Z}"]`))return;let K=document.createElement("link");K.rel="stylesheet",K.href=Z,K.addEventListener("error",()=>{K.dataset.pieLoadFailed=""},{once:!0}),document.head.appendChild(K)},iJ=!1,vJ=()=>{if(!H||iJ)return;if(iJ=!0,IJ().some((K)=>FJ.test(K.href)))return;jJ(p)},qZ="__pieFaToolbarShadowInstalled",SZ=(Z)=>{let K=Z.getRootNode();if(!(K instanceof ShadowRoot))return;let j=K;if(j[qZ])return;j[qZ]=!0;let Q=new Set,N=(q)=>{if(!q||Q.has(q))return;Q.add(q);let P=document.createElement("link");P.rel="stylesheet",P.href=q,K.appendChild(P)},k=IJ().filter((q)=>FJ.test(q.href));for(let q of k){if("pieLoadFailed"in q.dataset)continue;if(q.sheet){N(q.href);continue}let P=(S)=>{if(q.removeEventListener("load",P),q.removeEventListener("error",P),S.type==="load")N(q.href)};q.addEventListener("load",P),q.addEventListener("error",P)}},PJ=(Z)=>{return vJ(),SZ(Z),{destroy:n(Z,"fa-light")}},WJ=(Z,K)=>{let j=K,Q=()=>{let k=Z.querySelector("button");if(k)k.setAttribute("aria-pressed",j?"true":"false")};Q();let N=new MutationObserver(Q);return N.observe(Z,{childList:!0,subtree:!0}),{update(k){j=k,Q()},destroy(){N.disconnect()}}},Y0=(Z)=>Z.faIconName||null,W6=new N6,TJ=UJ(j6({})),EJ=u(L,"level",7,"item"),DZ=u(L,"scopeId",7,""),_Z=u(L,"itemId",7,""),CZ=u(L,"sectionId",7,""),fZ=u(L,"catalogId",7,""),bZ=u(L,"tools",7,""),yZ=u(L,"contentKind",7,"assessment-item"),MJ=u(L,"position",7,"bottom"),OZ=u(L,"scopeElement",7,null),GZ=u(L,"toolRegistry",7,null),xZ=u(L,"item",7,null),NZ=u(L,"hostButtons",23,()=>[]),$Z=u(L,"class",7,""),FZ=u(L,"size",7,"md"),pZ=u(L,"language",7,""),KJ=UJ(null),B=UJ(null),PZ=G(()=>J(B)?.ndsIcons===!0),L0=G(()=>G9(J(B))),M6=G(()=>pZ()||J(B)?.contentLanguage||void 0),gJ=UJ(null),sJ=UJ(0),dJ=UJ(0),vZ=UJ(0),EZ=UJ(0),gZ=UJ(0);$(()=>{if(!J(KJ))return;return L6(J(KJ),(Z)=>{r(B,Z,!0)})}),$(()=>{if(!J(KJ))return;return q6(J(KJ),(Z)=>{r(gJ,Z,!0)})}),$(()=>{let Z=J(B)?.toolkitCoordinator;if(!Z||typeof Z.onPolicyChange!=="function")return;let K=Z.onPolicyChange((j)=>{if(r(dJ,J(dJ)+1),j?.reason!=="item-settings")r(vZ,J(vZ)+1)});return()=>{try{K?.()}catch{}}}),$(()=>{let Z=J(B)?.toolkitCoordinator;if(!Z||typeof Z.onToolContextResolverChange!=="function")return;let K=Z.onToolContextResolverChange(()=>{r(EZ,J(EZ)+1)});return()=>{try{K?.()}catch{}}});let t=G(()=>J(B)?.toolCoordinator),R6=G(()=>J(B)?.ttsService),mZ=G(()=>J(B)?.elementToolStateStore),q0=G(()=>J(B)?.assessmentId??""),WZ=G(()=>_Z()||J(gJ)?.itemId||""),AJ=G(()=>J(gJ)?.canonicalItemId||J(WZ)),rJ=G(()=>CZ()||J(B)?.sectionId||""),lJ=G(()=>yZ()||J(gJ)?.contentKind||(EJ()==="section"?"section":"assessment-item")),A=G(()=>{if(EJ()&&EJ()!=="item")return EJ();if(J(lJ)==="rubric-block-stimulus")return"passage";return"item"}),RJ=G(()=>{if(DZ())return DZ();if(J(A)==="section")return J(rJ)||J(B)?.sectionId||"default-section";if(J(A)==="assessment")return J(B)?.assessmentId||"default-assessment";return J(AJ)||J(WZ)||"default-item"}),k6=G(()=>fZ()||J(RJ)),qJ=G(()=>xZ()||J(gJ)?.item||null),v=G(()=>{if(GZ())return GZ();return J(dJ),J(B)?.toolkitCoordinator?.getToolRegistry?.()||W6}),z6=G(()=>F6(bZ())),H6=G(()=>J(v).normalizeToolIds(J(z6)).filter(Boolean)),D0=G(()=>{if(J(A)==="section")return"section";if(J(A)==="passage"||J(lJ)==="rubric-block-stimulus")return"passage";return"item"}),O0=G(()=>{J(dJ);let Z=J(B)?.toolkitCoordinator;if(!Z||typeof Z.decideToolPolicy!=="function")return null;return Z.decideToolPolicy({level:J(D0),scope:{level:J(A),scopeId:J(RJ),assessmentId:J(B)?.assessmentId,sectionId:J(rJ)||void 0,itemId:J(WZ)||void 0,canonicalItemId:J(AJ)||void 0,contentKind:J(lJ)}})}),w6=l0(),oJ=G(()=>w6(J(O0),J(vZ))),nJ=G(()=>{let Z=(K)=>Array.from(new Set(K));if(J(oJ))return Z(J(v).normalizeToolIds(J(oJ).map((K)=>K.toolId)).filter(Boolean));return Z(J(H6))});$(()=>{if(!J(O0)||J(nJ).length===0)return;if(J(v).getAllTools().length>0)return;let Z=J(KJ)?.ownerDocument,K=J(nJ).join(", "),j=setTimeout(()=>{G6(Z,"toolbarWithoutRegistry",`[pie-item-toolbar] Policy places ${K} on this toolbar, but its tool registry is still empty after ${V0/1000} s, so it renders no buttons. Pass a toolRegistry to <pie-assessment-toolkit> or its coordinator; @pie-players/pie-default-tool-loaders builds the stock one. Reported once per page.`)},V0);return()=>clearTimeout(j)});let hZ=G(()=>{if(J(A)==="section"||J(A)==="assessment")return!0;let Z=J(qJ)?.config;return!!(J(qJ)&&Z&&typeof Z==="object")}),B6=G(()=>{J(dJ);let Z=J(B)?.toolkitCoordinator;if(!Z||typeof Z.getPolicyInputs!=="function")return null;return Z.getPolicyInputs()}),mJ=G(()=>J(B6)?.assessment??null),MZ=G(()=>({id:J(AJ)})),hJ=G(()=>{if(J(A)==="section")return{level:"section",assessment:J(mJ)||{},section:{}};if(J(A)==="assessment")return{level:"assessment",assessment:J(mJ)||{}};if(!J(hZ)||!J(qJ))return null;if(J(A)==="passage")return{level:"passage",assessment:J(mJ)||{},itemRef:J(MZ),passage:J(qJ)};return{level:"item",assessment:J(mJ)||{},itemRef:J(MZ),item:J(qJ)}}),G0=G(()=>{if(J(hJ))return J(hJ);return{level:"item",assessment:J(mJ)||{},itemRef:J(MZ),item:J(qJ)||{id:J(AJ),config:{}}}}),N0=G(()=>{if(J(A)!=="item"&&J(A)!=="passage")return[];if(!J(hZ)||!J(qJ))return[];let Z=J(qJ)?.config?.models;return(Array.isArray(Z)?Z:Z&&typeof Z==="object"?Object.values(Z):[]).filter((j)=>j&&typeof j==="object"&&typeof j.id==="string").map((j)=>({level:"element",assessment:J(mJ)||{},itemRef:J(MZ),item:J(qJ),elementId:j.id}))});function RZ(Z){return D6(Z,J(A),J(RJ))}let SJ=null;function F0(Z,K){if(SJ?.coordinator===Z)SJ.ids.add(K)}function uZ(Z,K){let j=RZ(K);if(!Z.getToolState(j))Z.registerTool(j,K);return F0(Z,j),j}$(()=>{let Z=J(t);if(J(A),J(RJ),!Z)return;let K={coordinator:Z,ids:new Set,activated:new Set};return SJ=K,()=>{if(SJ===K)SJ=null;for(let j of K.ids)Z.releaseTool(j)}});function I6(Z){if(!J(mZ)||!J(q0)||!J(rJ)||!J(AJ))return null;return J(mZ).getGlobalElementId({assessmentId:J(q0),sectionId:J(rJ),attemptId:J(B)?.attemptId??"",itemId:J(AJ),elementId:Z})}function T6(){if(OZ())return OZ();return J(gJ)?.scopeElement||null}function P0(){let Z=J(t)||null;return{scope:{level:J(A),scopeId:J(RJ),assessmentId:J(B)?.assessmentId,sectionId:J(rJ),itemId:J(WZ),canonicalItemId:J(AJ),contentKind:J(lJ)},itemId:J(RJ),catalogId:J(k6),language:J(M6),i18n:J(L0),ui:{size:FZ()},getScopeElement:T6,getGlobalElementId:I6,toolCoordinator:Z,toolkitCoordinator:J(B)?.toolkitCoordinator||null,ttsService:J(R6)||null,elementToolStateStore:J(mZ)||null,toggleTool:(K)=>{if(!Z)return;Z.toggleTool(uZ(Z,K))},isToolVisible:(K)=>Z?.isToolVisible(RZ(K))??!1,subscribeVisibility:Z?(K)=>Z.subscribe(K):null}}let A6=G(P0),cZ=G(()=>{J(EZ);let Z=J(B)?.toolkitCoordinator;if(!Z||typeof Z.hasToolContextResolver!=="function"||typeof Z.resolveToolContext!=="function")return{};let K={};for(let j of J(nJ)){if(!J(v).get(j)?.supportedLevels.includes(J(A)))continue;if(!Z.hasToolContextResolver(j))continue;let N=Z.resolveToolContext({toolId:j,context:J(G0),toolbarContext:J(A6)});if(N)K[j]=N}return K}),S6=G(()=>{J(gZ);let Z=J(cZ),K=(J(oJ)??J(nJ).map((k)=>({toolId:k,required:!1,alwaysAvailable:!1,activateAtInit:!1}))).filter((k)=>!Z[J(v).normalizeToolId(k.toolId)]),j=!J(hZ)?[]:J(hJ)?[J(hJ),...J(N0)]:J(N0),Q=(k,q,P)=>j0(J(B)?.toolkitCoordinator,k,q,P),N=new Set(J(v).filterDecidedToolIds(K,J(A),j,Q));return J(nJ).filter((k)=>N.has(k)||Z[k]?.visible)});$(()=>{if(!H||!J(hJ)||typeof customElements>"u")return;let Z=new Set(d0(J(hJ)).flatMap((j)=>j.pendingTags));if(Z.size===0)return;let K=!1;for(let j of Z)customElements.whenDefined(j).then(()=>{if(!K)r(gZ,J(gZ)+1)},()=>{});return()=>{K=!0}});let tJ=UJ(null),eJ=G(()=>{let Z=J(tJ)?.registry===J(v)?J(tJ).toolIds:null,K=J(v).filterToolIdsByActivation(J(S6),"toolbar-toggle");return Z?K.filter((j)=>!Z.has(j)):K});$(()=>{if(!H)return;let Z=J(v),K=!1;return Z.ensureToolModulesLoaded(J(eJ)).then((j)=>{if(j.size>0){let Q=J(tJ)?.registry===Z?J(tJ).toolIds:[];r(tJ,{registry:Z,toolIds:new Set([...Q,...j.keys()])},!0);for(let[N,k]of j)j0(J(B)?.toolkitCoordinator,N,"tool-module-load",k)}if(!K)r(sJ,J(sJ)+1)}),()=>{K=!0}});let _6=G(()=>{let Z=new Map;for(let K of J(oJ)??[]){if(!K.parameters)continue;let[j]=J(v).normalizeToolIds([K.toolId]);if(j)Z.set(j,K.parameters)}return Z}),_J=G(()=>{let Z=J(_6);return{...P0(),getResolvedToolContext:(K)=>J(cZ)[K]??null,getToolParameters:(K)=>Z.get(J(v).normalizeToolId(K))??null,getToolRenderParams:(K)=>{let j=J(cZ)[K]?.params??null,Q=W0.get(K);if(!Q)return j;return{...j??{},...Q}}}}),W0=new Map,M0=0,XJ=G(()=>{if(!H)return[];J(sJ);let Z=[];for(let K of J(eJ)){let j=J(v).renderForToolbar(K,J(G0),J(_J));if(j)Z.push(j)}return Z});$(()=>{let Z=J(t);if(!Z)return;for(let K of J(XJ))F0(Z,RZ(K.toolId))});let C6=G(()=>new Set(J(v).normalizeToolIds((J(oJ)??[]).filter((Z)=>Z.activateAtInit).map((Z)=>Z.toolId))));$(()=>{let Z=J(t),K=J(C6);J(A),J(RJ);let j=SJ;if(!Z||K.size===0||j?.coordinator!==Z)return;let Q=J(XJ).filter((N)=>N.button&&K.has(N.toolId)).map((N)=>N.toolId).filter((N)=>!j.activated.has(N));if(Q.length===0)return;for(let N of Q)j.activated.add(N);queueMicrotask(()=>{if(SJ!==j)return;for(let N of Q)Z.showTool(uZ(Z,N));CJ()})});let f6=G(()=>{if(!Array.isArray(NZ()))return[];let Z=[];return NZ().forEach((K,j)=>{if(c0(K)){Z.push(K);return}console.warn(`[ItemToolBar] Ignoring invalid host button at index ${j}. Expected { id, label, href | onClick } with valid types.`)}),Z}),b6=G(()=>J(XJ).filter((Z)=>!!Z.button).map((Z)=>{let K=Z.button;return{id:Z.toolId,label:K.label,ariaLabel:K.ariaLabel||K.label,icon:K.icon,faIconName:K.faIconName,tooltip:K.tooltip||K.label,disabled:K.disabled,active:J(TJ)[Z.toolId]??K.active??!1,onClick:()=>{K.onClick(),CJ()}}})),R0=G(()=>[...J(b6),...J(f6)]),aZ=G(()=>{let Z={};for(let K of J(XJ))Z[K.toolId]=J(TJ)[K.toolId]??K.button?.active??!1;return Z}),iZ=(Z,K,j)=>Z.flatMap((Q)=>(Q.elements||[]).filter((N)=>N.mount===K).filter((N)=>Boolean(N.element)).map((N,k)=>({key:`${j}-${Q.toolId}-${k}`,toolId:Q.toolId,entry:N}))),y6=G(()=>iZ(J(XJ),"before-buttons","before")),x6=G(()=>iZ(J(XJ),"after-buttons","after")),k0=G(()=>iZ(J(XJ),"controls-row","controls-row")),z0=G(()=>J(XJ).flatMap((Z)=>(Z.elements||[]).map((K)=>({toolId:Z.toolId,hint:K.layoutHints?.controlsRow})).filter((K)=>Boolean(K.hint)))),H0=G(()=>J(XJ).flatMap((Z)=>(Z.elements||[]).map((K)=>({toolId:Z.toolId,hint:K.layoutHints?.headerOverlay})).filter((K)=>Boolean(K.hint)))),w0=G(()=>J(z0).some((Z)=>Z.hint?.reserveSpace===!0)),B0=G(()=>J(z0).some((Z)=>Z.hint?.showWhenToolActive===!0&&(J(aZ)[Z.toolId]??!1))),$6=G(()=>MJ()==="left"||MJ()==="right"),I0=G(()=>J(H0).some((Z)=>Z.hint?.showWhenToolActive===!0&&(J(aZ)[Z.toolId]??!1))),p6=G(()=>J(k0).length>0||J(w0)||J(B0));function v6(){if(!J(KJ))return null;let Z=J(KJ).getRootNode();if(Z instanceof ShadowRoot)return Z.host;return null}$(()=>{let Z=v6();if(!Z)return;let K=J(H0).length>0,j=J(I0);return Z.setAttribute("data-pie-header-overlay",K?"true":"false"),Z.setAttribute("data-pie-header-overlay-active",j?"true":"false"),()=>{Z.removeAttribute("data-pie-header-overlay"),Z.removeAttribute("data-pie-header-overlay-active")}}),$(()=>{if(!H||!J(PZ))return;if(J(R0).some((Z)=>!!Y0(Z)))vJ()});function kZ(Z){if(Z.id in J(TJ))return J(TJ)[Z.id]===!0;return Z.active===!0}function CJ(){let Z={};for(let K of J(XJ))if(K.sync?.(),K.button)Z[K.toolId]=K.button.active??!1;r(TJ,Z,!0)}$(()=>{let Z=[];CJ();for(let K of J(XJ))if(K.subscribeActive){let j=!1,Q=K.subscribeActive((N)=>{queueMicrotask(()=>{if(j)return;r(TJ,{...J(TJ),[K.toolId]:N},!0),K.sync?.()})});Z.push(()=>{j=!0,Q()})}return()=>{Z.forEach((K)=>K())}}),$(()=>{let Z=J(B)?.toolkitCoordinator;if(typeof Z?.registerToolRequestTarget!=="function")return;let K=J(D0);return Z.registerToolRequestTarget({level:K,get scopeId(){return J(RJ)},hostsTool:(j)=>J(eJ).includes(j),open:(j,Q)=>{if(!J(t))return;if(!J(eJ).includes(j))return;if(Q&&Object.keys(Q).length>0)M0+=1,W0.set(j,{...Q,toolRequestId:M0});let N=uZ(J(t),j);J(t).showTool(N),queueMicrotask(()=>CJ())}})}),$(()=>{if(!J(_J).subscribeVisibility)return;let Z=!1,K=J(_J).subscribeVisibility(()=>{queueMicrotask(()=>{if(Z)return;CJ()})});return()=>{Z=!0,K?.()}}),$(()=>{let Z=J(_J).toolkitCoordinator;if(typeof Z?.subscribeTelemetry!=="function")return;let K=!1,j=Z.subscribeTelemetry(({eventName:Q,payload:N})=>{if(Q!=="pie-toolkit-tool-config-updated")return;if(N?.toolId&&!J(eJ).includes(N.toolId))return;queueMicrotask(()=>{if(K)return;r(sJ,J(sJ)+1),CJ()})});return()=>{K=!0,j?.()}});let E6="[data-pie-tool-overlay-boundary]";function g6(Z,K){if(K.container!=="content-boundary")return Z;let j=Z;while(j){if(j instanceof HTMLElement&&j.matches(E6))return j;if(j instanceof HTMLElement&&j.parentElement){j=j.parentElement;continue}let Q=j.getRootNode();j=Q instanceof ShadowRoot?Q.host:null}return Z}let m6="__pieToolElementUnmount";function sZ(Z){if(!Z)return;let K=Z[m6];if(typeof K==="function")K()}function h6(Z,K){let j=K,Q=null,N=Z,k=(q)=>{if(Q===q)return;if(Q){if(sZ(Q),Q.parentNode===N)N.removeChild(Q)}if(Q=q,Q){if(N=g6(Z,j),Q.parentNode&&Q.parentNode!==N)Q.parentNode.removeChild(Q);N.appendChild(Q)}};return k(K.element),{update(q){j=q,k(q.element)},destroy(){k(null)}}}let T0=720,A0=560,S0=320,dZ=240,kJ=24,zJ=40;function u6(Z,K){let j=K,Q=null,N=null,k=[],q=null,P=null,S=null,z=null,O=null,e=null,JJ=null,s=!1,DJ=!1,JZ=()=>j.mounted.entry.shell?.pageTabOrder===!0,VJ=()=>j.mounted.entry.shell?.ndsHeaderControls===!0,T=null,fJ=null,ZZ=P9({onMove:(X)=>J9(X),onEnd:()=>{fJ=null}}),ZJ=0,w=0,I=0,x=0,HJ=0,C=0,jZ=0,rZ=0,KZ=null,lZ=[],E=0,g=0,f=j.mounted.entry.shell?.initialWidth??T0,b=j.mounted.entry.shell?.initialHeight??A0,C0=f,f0=b,XZ=!1,uJ=null,YJ=null,zZ=!1,oZ=()=>{let X=j.mounted.entry.shell;if(!X)return null;return{toolId:j.mounted.toolId,toolbarContext:J(_J),shellConfig:X}},s6=(X)=>{let V=J(v).get(j.mounted.toolId),F=oZ();if(!V?.onHostedMount||!F)return;V.onHostedMount(X,F)},HZ=()=>{let X=J(v).get(j.mounted.toolId),V=oZ();if(!X?.onHostedResize||!V)return;X.onHostedResize({width:f,height:b},j.mounted.entry.element,V)},d6=()=>{let X=J(v).get(j.mounted.toolId),V=oZ();if(!X?.onHostedUnmount||!V)return;X.onHostedUnmount(j.mounted.entry.element,V)},i=(X,V,F)=>Math.max(V,Math.min(X,F)),bJ=(X)=>{try{X.focus()}catch{}},r6=()=>{let X=j.mounted.entry.shell,V=X?.minWidth??S0,F=X?.minHeight??dZ,Y=X?.maxWidth??window.innerWidth,U=X?.maxHeight??window.innerHeight;return{minWidth:V,minHeight:F,maxWidth:Y,maxHeight:U}},nZ=()=>{let X=j.mounted.entry.shell?.minWidth,V=typeof X==="number"&&X>0&&f<X,F=V?`${X}px`:"";if(T)T.style.minWidth=F;if(q)q.style.minWidth="0";if(P)P.style.minWidth="0",P.style.overflowX=V?"auto":"hidden"},b0=()=>j.mounted.entry.shell?.content?.overflowY==="auto"?"auto":"hidden",l6=()=>{if(!q)return 0;let X=q.getBoundingClientRect().height;if(X>0)return X;return q.offsetHeight||0},tZ=()=>{if(!P)return;let X=j.mounted.entry.shell;if(P.style.overflowY=b0(),!T)return;if(X?.content?.preserveMinHeight===!0){let V=l6(),F=X.minHeight??dZ,Y=Math.max(0,F-V),U=Math.max(0,b-V),W=Math.max(U,Y);T.style.height=`${W}px`,T.style.minHeight="0",T.style.flex=`0 0 ${W}px`;return}T.style.height="100%",T.style.minHeight="0",T.style.flex="1 1 auto"},o6=()=>{let X=j.mounted.entry.shell,V=X?.initialWidth??T0,F=X?.initialHeight??A0;if(V===C0&&F===f0)return;if(C0=V,f0=F,XZ)return;f=V,b=F,IZ()},wZ=()=>{let{minWidth:X,minHeight:V,maxWidth:F,maxHeight:Y}=r6(),U=Math.min(X,window.innerWidth),W=Math.min(V,window.innerHeight);f=i(f,U,Math.max(U,Math.min(F,window.innerWidth))),b=i(b,W,Math.max(W,Math.min(Y,window.innerHeight))),E=i(E,0,Math.max(0,window.innerWidth-f)),g=i(g,0,Math.max(0,window.innerHeight-b)),QZ(),nZ(),tZ(),HZ()},wJ=(X,V)=>{XZ=!0,E+=X,g+=V,wZ()},BZ=(X,V)=>{XZ=!0,f+=X,b+=V,wZ()},y0=(X,V,F,Y="fa-regular")=>{vJ();let U=document.createElement("nds-icon-button");return U.setAttribute("variant","tertiary"),U.setAttribute("size","small"),U.setAttribute("type","circle"),U.setAttribute("icon-name",V),U.setAttribute("button-aria-label",X),U.title=X,U.addEventListener("click",(W)=>{W.stopPropagation(),F(),cJ()}),n(U,Y),U},x0=(X,V,F)=>{let Y=document.createElement("button");return Y.type="button",Y.className="pie-tool-shell__control",Y.setAttribute("aria-label",X),Y.title=X,Y.textContent=V,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=(U)=>{U.stopPropagation(),F(),cJ()},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},QZ=()=>{if(!Q)return;Q.style.left=`${E}px`,Q.style.top=`${g}px`,Q.style.width=`${f}px`,Q.style.height=`${b}px`,Q.style.display=j.active?"flex":"none"},$0=()=>{if(S)S.textContent=j.mounted.entry.shell?.title||j.mounted.toolId;for(let{el:X,key:V}of k){let F=j.i18n.t(V);if(X.tagName==="NDS-ICON-BUTTON")X.setAttribute("button-aria-label",F);else X.setAttribute("aria-label",F);if(X.title)X.title=F}},p0=()=>{if(!P)return;let X=j.mounted.entry.element;if(X.style.display="block",X.style.width="100%",X.style.height="100%",X.style.flex="1 1 auto",X.style.minHeight="0",T&&T!==X){if(T.parentNode===P)sZ(T),P.removeChild(T);T=null}if(X.parentNode&&X.parentNode!==P)X.parentNode.removeChild(X);if(X.parentNode!==P)P.appendChild(X);T=X,nZ(),tZ(),s6(X)},cJ=()=>{if(J(t)&&Q)J(t).bringToFront(Q)},v0=()=>{if(!Q||!J(t)||!j.active)return;let X=RZ(j.mounted.toolId);if(J(t).getToolState(X)?.element===Q)return;J(t).updateToolElement(X,Q)},IZ=()=>{let{innerWidth:X,innerHeight:V}=window,F=j.mounted.entry.shell,Y=F?.initialAlign??"center",U=F?.initialMargin??16,W=U+60;switch(Y){case"top-left":E=U,g=W;break;case"top-right":E=Math.max(0,X-f-U),g=W;break;case"bottom-left":E=U,g=Math.max(0,V-b-W);break;case"bottom-right":E=Math.max(0,X-f-U),g=Math.max(0,V-b-W);break;default:E=Math.max(0,Math.round((X-f)/2)),g=Math.max(0,Math.round((V-b)/2))}wZ()},n6=()=>{let X=YJ;if(!X)return;queueMicrotask(()=>{if(!X.isConnected)return;bJ(X)})},E0=()=>{if(typeof document>"u")return null;let X=document.activeElement;while(X){let V=X.shadowRoot;if(V&&V.activeElement&&V.activeElement!==X)X=V.activeElement;else break}return X??null},g0=()=>{if(!Q||uJ)return;let X=E0();if(!YJ&&X&&!Q.contains(X))YJ=X;if(JZ()&&!DJ)document.addEventListener("keydown",J0,!0),DJ=!0;uJ=F9(Q,{initialFocus:O,onEscape:()=>{Z0()},wrap:!JZ(),onTabExit:JZ()?(V,F)=>{if(V==="backward"){if(YJ?.isConnected)F.preventDefault(),bJ(YJ);return}let Y=eZ();if(Y)F.preventDefault(),bJ(Y)}:void 0})},eZ=()=>{let X=J(_J).getScopeElement?.()??null;if(!X)return null;let V=(Y)=>{if(J(KJ)&&J(KJ).contains(Y))return!0;if(Q&&Q.contains(Y))return!0;return!1},F=(Y)=>{if(Y instanceof HTMLElement){if(V(Y))return null;if(Y.matches?.(W9)&&M9(Y))return Y}let U=Y.shadowRoot;if(U)for(let W=0;W<U.children.length;W++){let R=F(U.children[W]);if(R)return R}for(let W=0;W<Y.children.length;W++){let R=F(Y.children[W]);if(R)return R}return null};return F(X)},t6=()=>{if(!Q)return[];return N9(Q).filter((X)=>X!==e&&X!==JJ)},J0=(X)=>{if(X.key!=="Tab")return;if(!Q||!j.active)return;let V=E0();if(!V)return;if(Q.contains(V))return;let F=t6();if(F.length===0)return;if(X.shiftKey){let Y=eZ();if(V!==Y)return;X.preventDefault(),bJ(F[F.length-1]);return}if(V!==YJ)return;X.preventDefault(),bJ(F[0])},m0=()=>{if(DJ)document.removeEventListener("keydown",J0,!0),DJ=!1;if(!uJ)return;let X=uJ;uJ=null;try{X()}catch{}n6()},Z0=()=>{J(_J).toggleTool(j.mounted.toolId),CJ()},h0=(X)=>{if(!j.mounted.entry.shell?.draggable)return;if(X.target.closest("button")||!Q)return;if(!ZZ.begin(X,Q))return;fJ="drag",XZ=!0,ZJ=X.clientX-E,w=X.clientY-g,Q.setPointerCapture(X.pointerId),cJ()},e6=(X)=>(V)=>{if(!Q||!j.mounted.entry.shell?.resizable)return;if(V.stopPropagation(),!ZZ.begin(V,Q))return;fJ="resize",XZ=!0,KZ=X,I=f,x=b,HJ=V.clientX,C=V.clientY,jZ=E,rZ=g,Q.setPointerCapture(V.pointerId),cJ()},J9=(X)=>{if(!Q)return;if(fJ==="drag"){X.preventDefault();let V=Math.max(0,window.innerWidth-f),F=Math.max(0,window.innerHeight-b);E=i(X.clientX-ZJ,0,V),g=i(X.clientY-w,0,F),QZ();return}if(fJ==="resize"){X.preventDefault();let V=j.mounted.entry.shell,F=V?.minWidth??S0,Y=V?.minHeight??dZ,U=Math.min(F,window.innerWidth),W=Math.min(Y,window.innerHeight),R=V?.maxWidth??window.innerWidth,m=V?.maxHeight??window.innerHeight,c=X.clientX-HJ,d=X.clientY-C;if(KZ==="se")f=i(I+c,U,Math.max(U,Math.min(R,window.innerWidth-E))),b=i(x+d,W,Math.max(W,Math.min(m,window.innerHeight-g)));else if(KZ==="sw"){let a=jZ+I,QJ=i(I-c,U,Math.min(R,a));E=a-QJ,f=QJ,b=i(x+d,W,Math.max(W,Math.min(m,window.innerHeight-g)))}else if(KZ==="ne"){let a=rZ+x;f=i(I+c,U,Math.max(U,Math.min(R,window.innerWidth-E)));let QJ=i(x-d,W,Math.min(m,a));g=a-QJ,b=QJ}else if(KZ==="nw"){let a=jZ+I,QJ=rZ+x,_=i(I-c,U,Math.min(R,a));E=a-_,f=_;let UZ=i(x-d,W,Math.min(m,QJ));g=QJ-UZ,b=UZ}QZ(),nZ(),tZ(),HZ()}},u0=()=>{wZ()};if(H&&j.mounted.entry.shell){let X=VJ()&&J(PZ);if(X)vJ();if(Q=document.createElement("div"),Q.className="pie-tool-shell",Q.setAttribute("data-pie-tool-shell",j.mounted.toolId),Q.style.position="fixed",Q.style.zIndex=String(O6.TOOL),Q.style.background="var(--pie-background, #fff)",Q.style.border="1px solid var(--pie-border-light, #d1d5db)",Q.style.borderRadius="12px",Q.style.boxShadow="0 10px 40px color-mix(in srgb, var(--pie-black, #000) 25%, transparent)",Q.style.setProperty("--color-interactive-blue","var(--pie-calculator-button-color, var(--pie-button-color, var(--pie-text, #222)))"),Q.style.setProperty("--color-new-gray","var(--pie-background-dark, #f3f5f7)"),Q.style.setProperty("--color-primary-white","var(--pie-white, #ffffff)"),Q.style.setProperty("--color-primary-black","var(--pie-text, #000000)"),Q.style.setProperty("--color-focus-blue","var(--pie-button-focus-outline, #2b87ff)"),Q.style.overflow="visible",Q.style.display=j.active?"flex":"none",Q.style.flexDirection="column",Q.style.userSelect="none",Q.style.webkitUserSelect="none",Q.style.touchAction="none",Q.setAttribute("draggable","false"),Q.addEventListener("dragstart",(U)=>U.preventDefault()),q=document.createElement("div"),q.className="pie-tool-shell__header",q.style.display="flex",q.style.flexWrap="wrap",q.style.alignItems="center",q.style.justifyContent="space-between",q.style.gap="6px",q.style.padding=VJ()?"12px 12px 12px 28px":"10px 12px",VJ())q.style.minHeight="48px",q.style.background="var(--pie-section-player-card-header-background, var(--pie-button-active-bg, #f3f4f6))",q.style.color="var(--pie-text, #111827)",q.style.borderBottom="1px solid var(--pie-border-light, #e5e7eb)";else q.style.background="var(--pie-primary-dark, #2c3e50)",q.style.color="var(--pie-white, #fff)";q.style.cursor=j.mounted.entry.shell.draggable===!1?"default":"move",q.style.flex="0 0 auto",q.style.borderRadius="12px 12px 0 0",q.style.overflow="hidden",q.style.userSelect="none",q.style.webkitUserSelect="none",q.style.touchAction="none",q.setAttribute("draggable","false"),q.addEventListener("dragstart",(U)=>U.preventDefault()),S=document.createElement("span"),S.className="pie-tool-shell__title",S.style.minWidth="0",S.style.overflowWrap="anywhere",S.textContent=j.mounted.entry.shell.title||j.mounted.toolId,q.appendChild(S),z=document.createElement("div"),z.className="pie-tool-shell__controls",z.style.display="inline-flex",z.style.flexWrap="wrap",z.style.minWidth="0",z.style.alignItems="center",z.style.gap=VJ()?"6px":"4px";let V=j.mounted.entry.shell,F=(U,W,R,m,c="fa-regular")=>{if(!z)return;let d=j.i18n.t(U),a=X?y0(d,R,m,c):x0(d,W,m);k.push({el:a,key:U}),z.appendChild(a)};if(V?.draggable!==!1)F("toolkit.window.moveLeftA11y","←","chevron-left",()=>wJ(-kJ,0)),F("toolkit.window.moveRightA11y","→","chevron-right",()=>wJ(kJ,0)),F("toolkit.window.moveUpA11y","↑","chevron-up",()=>wJ(0,-kJ)),F("toolkit.window.moveDownA11y","↓","chevron-down",()=>wJ(0,kJ));if(V?.resizable!==!1)F("toolkit.window.shrinkA11y","−","magnifying-glass-minus",()=>BZ(-zJ,-zJ)),F("toolkit.window.growA11y","+","magnifying-glass-plus",()=>BZ(zJ,zJ));if(!VJ()){let U=x0(j.i18n.t("toolkit.window.centerA11y"),"◎",IZ);k.push({el:U,key:"toolkit.window.centerA11y"}),z.appendChild(U)}let Y=null;if(VJ())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(z),q.appendChild(Y);else q.appendChild(z);if(X)O=y0(j.i18n.t("toolkit.window.closeA11y"),"xmark",Z0,"fa-regular"),k.push({el:O,key:"toolkit.window.closeA11y"}),O.style.display=j.mounted.entry.shell.closeable===!1?"none":"inline-block";else{let U=document.createElement("button");U.type="button",U.className="pie-tool-shell__close",U.setAttribute("aria-label",j.i18n.t("toolkit.window.closeA11y")),k.push({el:U,key:"toolkit.window.closeA11y"});let W="http://www.w3.org/2000/svg",R=document.createElementNS(W,"svg");R.setAttribute("xmlns",W),R.setAttribute("viewBox","0 0 16 16"),R.setAttribute("aria-hidden","true");let m=document.createElementNS(W,"path");m.setAttribute("d","M3.5 3.5L12.5 12.5M12.5 3.5L3.5 12.5"),m.setAttribute("stroke","currentColor"),m.setAttribute("stroke-width","1.8"),m.setAttribute("stroke-linecap","round"),R.appendChild(m),U.appendChild(R);let c=R.style;c.width="16px",c.height="16px",c.display="block",c.flexShrink="0",c.pointerEvents="none";let d="color-mix(in srgb, var(--pie-white, #fff) 8%, transparent)",a="color-mix(in srgb, var(--pie-white, #fff) 18%, transparent)";U.style.border="1px solid transparent",U.style.background=d,U.style.color="inherit",U.style.cursor="pointer",U.style.display="inline-flex",U.style.alignItems="center",U.style.justifyItems="center",U.style.width="28px",U.style.height="28px",U.style.padding="0",U.style.borderRadius="8px",U.style.lineHeight="0",U.style.transition="background-color 0.15s ease, border-color 0.15s ease",U.style.display=j.mounted.entry.shell.closeable===!1?"none":"inline-flex",U.onmouseenter=()=>{U.style.background=a},U.onmouseleave=()=>{U.style.background=d},U.onfocus=()=>{U.style.outline="2px solid var(--pie-button-focus-outline, var(--pie-primary, #4A90E2))",U.style.outlineOffset="2px"},U.onblur=()=>{U.style.outline="none",U.style.outlineOffset="0"},U.onclick=Z0,O=U}if(Y)Y.appendChild(O);else q.appendChild(O);if(q.tabIndex=0,q.onkeydown=(U)=>{if(U.key==="Home"){U.preventDefault(),IZ();return}let W=j.mounted.entry.shell;if(U.shiftKey&&W?.resizable!==!1){if(U.key==="ArrowRight"||U.key==="ArrowDown"){U.preventDefault(),BZ(zJ,zJ);return}if(U.key==="ArrowLeft"||U.key==="ArrowUp"){U.preventDefault(),BZ(-zJ,-zJ);return}}if(W?.draggable!==!1){if(U.key==="ArrowLeft")U.preventDefault(),wJ(-kJ,0);else if(U.key==="ArrowRight")U.preventDefault(),wJ(kJ,0);else if(U.key==="ArrowUp")U.preventDefault(),wJ(0,-kJ);else if(U.key==="ArrowDown")U.preventDefault(),wJ(0,kJ)}},P=document.createElement("div"),P.className="pie-tool-shell__content",P.style.position="relative",P.style.width="100%",P.style.flex="1 1 auto",P.style.minHeight="0",P.style.overflowX="hidden",P.style.overflowY=b0(),P.style.borderRadius="0 0 12px 12px",VJ()){let U=(W)=>{let R=document.createElement("div");return R.tabIndex=0,R.setAttribute("aria-hidden","true"),R.setAttribute("data-pie-tool-shell-focus-guard",W),R.style.position="absolute",R.style.width="1px",R.style.height="1px",R.style.padding="0",R.style.margin="-1px",R.style.overflow="hidden",R.style.clipPath="inset(50%)",R.style.whiteSpace="nowrap",R.style.border="0",R};e=U("start"),JJ=U("end"),e.addEventListener("focus",(W)=>{if(s)return;s=!0;try{if(W.stopPropagation(),YJ?.isConnected)bJ(YJ)}finally{queueMicrotask(()=>{s=!1})}}),JJ.addEventListener("focus",(W)=>{if(s)return;s=!0;try{W.stopPropagation();let R=eZ();if(R)bJ(R)}finally{queueMicrotask(()=>{s=!1})}}),Q.appendChild(e)}if(Q.appendChild(q),Q.appendChild(P),VJ()&&JJ)Q.appendChild(JJ);if(j.mounted.entry.shell.resizable!==!1){let U=(W,R,m,c,d,a,QJ)=>{let _=document.createElement("div");if(_.className="pie-tool-shell__resize",_.style.position="absolute",_.style.width="24px",_.style.height="24px",_.style.cursor=a,_.style.zIndex="10",_.style.touchAction="none",_.setAttribute("draggable","false"),R!==null)_.style.top=R;if(m!==null)_.style.right=m;if(c!==null)_.style.bottom=c;if(d!==null)_.style.left=d;if(QJ!==null)_.style.background=`linear-gradient(${QJ}, transparent 0%, transparent 40%, rgba(0,0,0,0.35) 40%, rgba(0,0,0,0.35) 60%, transparent 60%, transparent 100%)`;let UZ=e6(W);_.addEventListener("pointerdown",UZ),Q.appendChild(_),lZ.push({el:_,handler:UZ})};U("se",null,"0","0",null,"nwse-resize",null),U("nw","0",null,null,"0","nwse-resize","135deg"),U("ne","0","0",null,null,"nesw-resize",null),U("sw",null,null,"0","0","nesw-resize",null)}if(q.addEventListener("pointerdown",h0),Q.addEventListener("pointerdown",cJ),window.addEventListener("resize",u0),document.body.appendChild(Q),N=new O9(Q,{context:Y6,initialValue:j.runtime}),N.connect(),IZ(),QZ(),v0(),$0(),p0(),HZ(),j.active)g0();zZ=j.active}return{update(X){if(j=X,!Q||!P||!S||!O)return;N?.setValue(j.runtime),$0(),o6();let V=O.tagName.toLowerCase()==="nds-icon-button"?"inline-block":"inline-flex";if(O.style.display=j.mounted.entry.shell?.closeable===!1?"none":V,QZ(),v0(),p0(),HZ(),!zZ&&j.active)g0();else if(zZ&&!j.active)m0(),YJ=null;zZ=j.active},destroy(){if(d6(),N?.disconnect(),N=null,k.length=0,uJ)m0();if(DJ)document.removeEventListener("keydown",J0,!0),DJ=!1;for(let{el:X,handler:V}of lZ)X.removeEventListener("pointerdown",V);if(YJ=null,lZ.length=0,q)q.removeEventListener("pointerdown",h0),q.onkeydown=null;if(ZZ.release(),Q)Q.removeEventListener("pointerdown",cJ);if(window.removeEventListener("resize",u0),T&&P&&T.parentNode===P)sZ(T),P.removeChild(T);if(T=null,Q&&Q.parentElement)Q.remove()}}}var c6={get level(){return EJ()},set level(Z){EJ(Z),h()},get scopeId(){return DZ()},set scopeId(Z){DZ(Z),h()},get itemId(){return _Z()},set itemId(Z){_Z(Z),h()},get sectionId(){return CZ()},set sectionId(Z){CZ(Z),h()},get catalogId(){return fZ()},set catalogId(Z){fZ(Z),h()},get tools(){return bZ()},set tools(Z){bZ(Z),h()},get contentKind(){return yZ()},set contentKind(Z){yZ(Z),h()},get position(){return MJ()},set position(Z){MJ(Z),h()},get scopeElement(){return OZ()},set scopeElement(Z){OZ(Z),h()},get toolRegistry(){return GZ()},set toolRegistry(Z){GZ(Z),h()},get item(){return xZ()},set item(Z){xZ(Z),h()},get hostButtons(){return NZ()},set hostButtons(Z){NZ(Z),h()},get class(){return $Z()},set class(Z){$Z(Z),h()},get size(){return FZ()},set size(Z){FZ(Z),h()},get language(){return pZ()},set language(Z){pZ(Z),h()}},_0=xJ(),a6=yJ(_0);{var i6=(Z)=>{var K=I9();let j;var Q=aJ(K),N=aJ(Q);YZ(N,17,()=>J(y6),(z)=>z.key,(z,O)=>{M(z,()=>J(O),()=>"item-toolbar__element-host")});var k=TZ(N,2);YZ(k,17,()=>J(R0),(z)=>z.id,(z,O,e,JJ)=>{let s=G(()=>J(PZ)&&!K0(J(O))?Y0(J(O)):null);var DJ=xJ(),JZ=yJ(DJ);{var VJ=(ZJ)=>{var w=z9(),I=aJ(w);OJ(I,1,"item-toolbar__nds-button svelte-1c13522"),BJ(I,"type","circle"),BJ(I,"size","small"),BJ(I,"variant","tertiary"),o(()=>BJ(I,"icon-name",J(s))),o(()=>BJ(I,"button-aria-label",J(O).ariaLabel||J(O).label)),o(()=>BJ(I,"title",J(O).tooltip||J(O).label)),o(()=>BJ(I,"disabled",J(O).disabled)),LZ(I,(x)=>PJ?.(x)),LZ(I,(x,HJ)=>WJ?.(x,HJ),()=>kZ(J(O))),GJ(w),VZ("click",I,function(...x){J(O).onClick?.apply(this,x)}),y(ZJ,w)},T=(ZJ)=>{var w=H9();let I;var x=aJ(w);{var HJ=(C)=>{n0(C,()=>J(O).icon)};NJ(x,(C)=>{if(J(O).icon)C(HJ)})}GJ(w),o((C)=>{I=OJ(w,1,"item-toolbar__button svelte-1c13522",null,I,{"item-toolbar__button--active":C}),l(w,"href",J(O).disabled?void 0:J(O).href),l(w,"target",J(O).target),l(w,"rel",J(O).rel),l(w,"aria-label",J(O).ariaLabel||J(O).label),l(w,"title",J(O).tooltip||J(O).label),l(w,"aria-disabled",J(O).disabled?"true":void 0)},[()=>kZ(J(O))]),VZ("click",w,(C)=>{if(J(O).disabled)C.preventDefault()}),y(ZJ,w)},fJ=G(()=>K0(J(O))),ZZ=(ZJ)=>{var w=w9();let I;var x=aJ(w);{var HJ=(C)=>{n0(C,()=>J(O).icon)};NJ(x,(C)=>{if(J(O).icon)C(HJ)})}GJ(w),o((C,jZ)=>{I=OJ(w,1,"item-toolbar__button svelte-1c13522",null,I,{"item-toolbar__button--active":C}),l(w,"aria-label",J(O).ariaLabel||J(O).label),l(w,"aria-pressed",jZ),l(w,"title",J(O).tooltip||J(O).label),w.disabled=J(O).disabled},[()=>kZ(J(O)),()=>kZ(J(O))]),VZ("click",w,function(...C){J(O).onClick?.apply(this,C)}),y(ZJ,w)};NJ(JZ,(ZJ)=>{if(J(s))ZJ(VJ);else if(J(fJ))ZJ(T,1);else ZJ(ZZ,-1)})}y(z,DJ)});var q=TZ(k,2);YZ(q,17,()=>J(x6),(z)=>z.key,(z,O)=>{M(z,()=>J(O),()=>"item-toolbar__element-host")}),GJ(Q);var P=TZ(Q,2);{var S=(z)=>{var O=B9();let e;YZ(O,21,()=>J(k0),(JJ)=>JJ.key,(JJ,s)=>{M(JJ,()=>J(s),()=>"item-toolbar__controls-host")}),GJ(O),o(()=>e=OJ(O,1,"item-toolbar__controls-row svelte-1c13522",null,e,{"item-toolbar__controls-row--reserve":J(w0),"item-toolbar__controls-row--active":J(B0),"item-toolbar__controls-row--align-start":J($6)})),y(z,O)};NJ(P,(z)=>{if(J(p6))z(S)})}GJ(K),U6(K,(z)=>r(KJ,z),()=>J(KJ)),o(()=>{j=OJ(K,1,`item-toolbar ${$Z()??""} item-toolbar--${FZ()??""}`,"svelte-1c13522",j,{"item-toolbar--top":MJ()==="top","item-toolbar--right":MJ()==="right","item-toolbar--bottom":MJ()==="bottom","item-toolbar--left":MJ()==="left","item-toolbar--header-overlay-active":J(I0)}),l(K,"data-content-kind",J(lJ)),l(K,"data-level",J(A))}),VZ("focusin",Q,(z)=>{if(J(A)==="section"&&z.target instanceof HTMLElement)z.target.scrollIntoView({block:"nearest",inline:"nearest"})}),y(Z,K)};NJ(a6,(Z)=>{if(H)Z(i6)})}return y(D,_0),Z6(c6)}K6(["focusin","click"]);D9("pie-item-toolbar",V6(P6,{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{P6 as l};
|
|
@@ -288,6 +288,7 @@ export function composeDecision(inputs) {
|
|
|
288
288
|
toolId,
|
|
289
289
|
required: flag?.required ?? false,
|
|
290
290
|
alwaysAvailable: flag?.alwaysAvailable ?? false,
|
|
291
|
+
activateAtInit: flag?.activateAtInit ?? false,
|
|
291
292
|
parameters: resolveToolParameters(toolId, pnpPolicy.assessment, pnpPolicy.item),
|
|
292
293
|
};
|
|
293
294
|
});
|
|
@@ -338,6 +339,7 @@ const PNP_RULE_FIELDS = {
|
|
|
338
339
|
"item-requirement": "item settings.requiredTools",
|
|
339
340
|
"district-requirement": "settings.districtPolicy.requiredTools",
|
|
340
341
|
"pnp-support": "personalNeedsProfile.supports",
|
|
342
|
+
"pnp-activate-at-init": "personalNeedsProfile.activateAtInit",
|
|
341
343
|
};
|
|
342
344
|
/**
|
|
343
345
|
* A `tool-policy.overrideBlocked` diagnostic for a tool a `true` test
|
|
@@ -163,17 +163,22 @@ export interface ToolPolicyEntry {
|
|
|
163
163
|
*/
|
|
164
164
|
required: boolean;
|
|
165
165
|
/**
|
|
166
|
-
* `true` for a tool the student's PNP `supports` or a
|
|
167
|
-
* `testAdministration.toolOverrides` entry grants — UI-level signal that
|
|
166
|
+
* `true` for a tool the student's PNP `supports` or `activateAtInit`, or a
|
|
167
|
+
* `testAdministration.toolOverrides` entry, grants — UI-level signal that
|
|
168
168
|
* the host cannot toggle this tool off in user preferences. Does NOT
|
|
169
169
|
* override host blocks (they would have removed the entry before this
|
|
170
170
|
* flag is read).
|
|
171
171
|
*/
|
|
172
172
|
alwaysAvailable: boolean;
|
|
173
173
|
/**
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
|
|
174
|
+
* `true` for a tool the student's PNP `activateAtInit` lists that policy
|
|
175
|
+
* admits: the toolbar turns it on when it first shows it.
|
|
176
|
+
*/
|
|
177
|
+
activateAtInit: boolean;
|
|
178
|
+
/**
|
|
179
|
+
* The tool's parameters: the profile's, assessment's and, on the item's own
|
|
180
|
+
* toolbar, item's `toolParameters` entries merged key by key, later ones
|
|
181
|
+
* winning. Set whether or not a grant admitted the tool.
|
|
177
182
|
*/
|
|
178
183
|
parameters?: Record<string, unknown>;
|
|
179
184
|
}
|
|
@@ -72,9 +72,9 @@ export interface FeaturePolicyDecision<P = Record<string, unknown>> {
|
|
|
72
72
|
*/
|
|
73
73
|
required: boolean;
|
|
74
74
|
/**
|
|
75
|
-
* The feature's parameters: the
|
|
76
|
-
* scope,
|
|
77
|
-
* Set on a denial too; a host denial leaves it out.
|
|
75
|
+
* The feature's parameters: the profile's, assessment's and, for an item's
|
|
76
|
+
* scope, item's `toolParameters` entries for the feature id, merged key by key,
|
|
77
|
+
* later ones winning. Set on a denial too; a host denial leaves it out.
|
|
78
78
|
*/
|
|
79
79
|
parameters?: P;
|
|
80
80
|
/**
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
* record (only `id` / `name`, no PNP and no settings) do not engage
|
|
12
12
|
* PNP/profile gates. The flip happens the moment the assessment carries any of:
|
|
13
13
|
*
|
|
14
|
-
* - `personalNeedsProfile` (any `supports
|
|
14
|
+
* - `personalNeedsProfile` (any `supports`, `prohibitedSupports` or
|
|
15
|
+
* `activateAtInit`),
|
|
15
16
|
* - `settings.districtPolicy` (any `blockedTools` or `requiredTools`),
|
|
16
17
|
* - `settings.testAdministration` (any `toolOverrides` entry),
|
|
17
18
|
* - or, for an item-scoped decision, the item's settings carry
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
* record (only `id` / `name`, no PNP and no settings) do not engage
|
|
12
12
|
* PNP/profile gates. The flip happens the moment the assessment carries any of:
|
|
13
13
|
*
|
|
14
|
-
* - `personalNeedsProfile` (any `supports
|
|
14
|
+
* - `personalNeedsProfile` (any `supports`, `prohibitedSupports` or
|
|
15
|
+
* `activateAtInit`),
|
|
15
16
|
* - `settings.districtPolicy` (any `blockedTools` or `requiredTools`),
|
|
16
17
|
* - `settings.testAdministration` (any `toolOverrides` entry),
|
|
17
18
|
* - or, for an item-scoped decision, the item's settings carry
|
|
@@ -36,7 +37,10 @@ export function assessmentHasPnpPolicyInputs(assessment) {
|
|
|
36
37
|
if (!assessment)
|
|
37
38
|
return false;
|
|
38
39
|
const pnp = assessment.personalNeedsProfile;
|
|
39
|
-
if (pnp &&
|
|
40
|
+
if (pnp &&
|
|
41
|
+
(hasEntries(pnp.supports) ||
|
|
42
|
+
hasEntries(pnp.prohibitedSupports) ||
|
|
43
|
+
hasEntries(pnp.activateAtInit))) {
|
|
40
44
|
return true;
|
|
41
45
|
}
|
|
42
46
|
const settings = assessment.settings;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* provider veto, PNP/profile gates, and custom policy sources.
|
|
9
9
|
*/
|
|
10
10
|
/** The PNP/profile precedence rules, highest first. */
|
|
11
|
-
export type PnpPolicySourceRule = "district-block" | "test-admin-override" | "item-restriction" | "pnp-prohibited" | "item-requirement" | "district-requirement" | "pnp-support";
|
|
11
|
+
export type PnpPolicySourceRule = "district-block" | "test-admin-override" | "item-restriction" | "pnp-prohibited" | "item-requirement" | "district-requirement" | "pnp-support" | "pnp-activate-at-init";
|
|
12
12
|
/**
|
|
13
13
|
* Rule vocabulary for tool policy decisions. A decision's `rule` is the one
|
|
14
14
|
* attribution channel: it names the step that enabled, blocked or advised on a
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { AssessmentEntity, ToolParametersFor } from "@pie-players/pie-players-shared/types";
|
|
2
2
|
import type { PnpPolicyItem } from "../sources/PnpPolicySource.js";
|
|
3
3
|
/**
|
|
4
|
-
* A tool's parameters for one decision: the
|
|
5
|
-
* the assessment's
|
|
4
|
+
* A tool's parameters for one decision, merged key by key: the profile's
|
|
5
|
+
* `toolParameters` entry, overridden by the assessment's, overridden by the
|
|
6
|
+
* item's.
|
|
6
7
|
*
|
|
7
8
|
* Parameters say how a tool behaves wherever policy shows it, so they reach a
|
|
8
9
|
* tool placed without a grant, and PNP enforcement does not gate them. `item` is
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
function asParameters(value) {
|
|
2
|
+
return value && typeof value === "object" && !Array.isArray(value)
|
|
3
|
+
? value
|
|
4
|
+
: undefined;
|
|
5
|
+
}
|
|
1
6
|
/**
|
|
2
|
-
* A tool's parameters for one decision: the
|
|
3
|
-
* the assessment's
|
|
7
|
+
* A tool's parameters for one decision, merged key by key: the profile's
|
|
8
|
+
* `toolParameters` entry, overridden by the assessment's, overridden by the
|
|
9
|
+
* item's.
|
|
4
10
|
*
|
|
5
11
|
* Parameters say how a tool behaves wherever policy shows it, so they reach a
|
|
6
12
|
* tool placed without a grant, and PNP enforcement does not gate them. `item` is
|
|
@@ -8,8 +14,14 @@
|
|
|
8
14
|
*/
|
|
9
15
|
export function resolveToolParameters(toolId, assessment, item) {
|
|
10
16
|
const settings = assessment?.settings;
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
const layers = [
|
|
18
|
+
assessment?.personalNeedsProfile?.toolParameters?.[toolId],
|
|
19
|
+
settings?.toolParameters?.[toolId],
|
|
20
|
+
item?.settings.toolParameters?.[toolId],
|
|
21
|
+
]
|
|
22
|
+
.map(asParameters)
|
|
23
|
+
.filter((layer) => layer !== undefined);
|
|
24
|
+
return layers.length > 0
|
|
25
|
+
? Object.assign({}, ...layers)
|
|
14
26
|
: undefined;
|
|
15
27
|
}
|
|
@@ -16,10 +16,12 @@ export interface PnpPolicyToolFlags {
|
|
|
16
16
|
/** PNP/profile policy mandates this tool (item or district `requiredTools`). */
|
|
17
17
|
required: boolean;
|
|
18
18
|
/**
|
|
19
|
-
* The student's profile supports this tool, or a
|
|
20
|
-
* override grants it (host UI cannot toggle off).
|
|
19
|
+
* The student's profile supports this tool or activates it at start, or a
|
|
20
|
+
* test-administration override grants it (host UI cannot toggle off).
|
|
21
21
|
*/
|
|
22
22
|
alwaysAvailable: boolean;
|
|
23
|
+
/** The student's profile lists this tool in `activateAtInit`. */
|
|
24
|
+
activateAtInit: boolean;
|
|
23
25
|
/** Which PNP/profile rule contributed the surviving verdict. */
|
|
24
26
|
rule: PnpPolicySourceRule;
|
|
25
27
|
}
|
|
@@ -19,6 +19,7 @@ export class PnpPolicySource {
|
|
|
19
19
|
const allSupports = new Set();
|
|
20
20
|
pnp?.supports?.forEach((s) => allSupports.add(s));
|
|
21
21
|
pnp?.prohibitedSupports?.forEach((s) => allSupports.add(s));
|
|
22
|
+
pnp?.activateAtInit?.forEach((s) => allSupports.add(s));
|
|
22
23
|
districtPolicy?.blockedTools?.forEach((s) => allSupports.add(s));
|
|
23
24
|
districtPolicy?.requiredTools?.forEach((s) => allSupports.add(s));
|
|
24
25
|
for (const s of Object.keys(testAdmin?.toolOverrides ?? {})) {
|
|
@@ -162,6 +163,7 @@ export class PnpPolicySource {
|
|
|
162
163
|
});
|
|
163
164
|
return;
|
|
164
165
|
}
|
|
166
|
+
const activateAtInit = ctx.pnp?.activateAtInit?.includes(supportId) === true;
|
|
165
167
|
const mandate = ctx.itemSettings?.requiredTools?.includes(supportId)
|
|
166
168
|
? "item-requirement"
|
|
167
169
|
: ctx.districtPolicy?.requiredTools?.includes(supportId)
|
|
@@ -175,6 +177,7 @@ export class PnpPolicySource {
|
|
|
175
177
|
out.perToolFlags.set(supportId, {
|
|
176
178
|
required: mandate !== undefined,
|
|
177
179
|
alwaysAvailable: true,
|
|
180
|
+
activateAtInit,
|
|
178
181
|
rule: "test-admin-override",
|
|
179
182
|
});
|
|
180
183
|
out.decisions.push({
|
|
@@ -194,6 +197,7 @@ export class PnpPolicySource {
|
|
|
194
197
|
out.perToolFlags.set(supportId, {
|
|
195
198
|
required: true,
|
|
196
199
|
alwaysAvailable: false,
|
|
200
|
+
activateAtInit,
|
|
197
201
|
rule: "item-requirement",
|
|
198
202
|
});
|
|
199
203
|
out.decisions.push({
|
|
@@ -213,6 +217,7 @@ export class PnpPolicySource {
|
|
|
213
217
|
out.perToolFlags.set(supportId, {
|
|
214
218
|
required: true,
|
|
215
219
|
alwaysAvailable: false,
|
|
220
|
+
activateAtInit,
|
|
216
221
|
rule: "district-requirement",
|
|
217
222
|
});
|
|
218
223
|
out.decisions.push({
|
|
@@ -226,11 +231,31 @@ export class PnpPolicySource {
|
|
|
226
231
|
});
|
|
227
232
|
return;
|
|
228
233
|
}
|
|
229
|
-
// 8. Profile supports (student needs)
|
|
234
|
+
// 8. Profile supports (student needs). `activateAtInit` grants as
|
|
235
|
+
// `supports` does and names the tool to turn on at start.
|
|
236
|
+
if (activateAtInit) {
|
|
237
|
+
out.perToolFlags.set(supportId, {
|
|
238
|
+
required: false,
|
|
239
|
+
alwaysAvailable: true,
|
|
240
|
+
activateAtInit,
|
|
241
|
+
rule: "pnp-activate-at-init",
|
|
242
|
+
});
|
|
243
|
+
out.decisions.push({
|
|
244
|
+
precedence: 8,
|
|
245
|
+
rule: "pnp-activate-at-init",
|
|
246
|
+
featureId: supportId,
|
|
247
|
+
action: "enable",
|
|
248
|
+
sourceType: "student",
|
|
249
|
+
reason: `Student PNP profile turns on "${supportId}" at start`,
|
|
250
|
+
value: ctx.pnp?.activateAtInit,
|
|
251
|
+
});
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
230
254
|
if (ctx.pnp?.supports?.includes(supportId)) {
|
|
231
255
|
out.perToolFlags.set(supportId, {
|
|
232
256
|
required: false,
|
|
233
257
|
alwaysAvailable: true,
|
|
258
|
+
activateAtInit: false,
|
|
234
259
|
rule: "pnp-support",
|
|
235
260
|
});
|
|
236
261
|
out.decisions.push({
|
|
@@ -281,6 +306,7 @@ export class PnpPolicySource {
|
|
|
281
306
|
["pnp-prohibited", pnp?.prohibitedSupports],
|
|
282
307
|
["item-requirement", items.flatMap((item) => item.requiredTools ?? [])],
|
|
283
308
|
["district-requirement", settings?.districtPolicy?.requiredTools],
|
|
309
|
+
["pnp-activate-at-init", pnp?.activateAtInit],
|
|
284
310
|
["pnp-support", pnp?.supports],
|
|
285
311
|
];
|
|
286
312
|
for (const [rule, ids] of named) {
|
|
@@ -121,7 +121,8 @@ export declare class TTSService {
|
|
|
121
121
|
*/
|
|
122
122
|
initialize(provider: ITTSProvider, config?: Partial<ToolkitTTSConfig>): Promise<void>;
|
|
123
123
|
/**
|
|
124
|
-
* Update rate, pitch, voice or provider options without
|
|
124
|
+
* Update rate, pitch, volume, voice or provider options without
|
|
125
|
+
* reinitializing.
|
|
125
126
|
* `providerOptions` merge over the ones already configured.
|
|
126
127
|
*/
|
|
127
128
|
updateSettings(settings: Partial<TTSConfig>): Promise<void>;
|
|
@@ -254,10 +255,10 @@ export declare class TTSService {
|
|
|
254
255
|
*/
|
|
255
256
|
speak(target: Range | Element, options?: SpeakOptions): Promise<void>;
|
|
256
257
|
/**
|
|
257
|
-
* Sets the rate a run starts at, after any rate write in
|
|
258
|
-
* no playback yet, so nothing restarts.
|
|
258
|
+
* Sets the rate, pitch and volume a run starts at, after any rate write in
|
|
259
|
+
* flight. The run has no playback yet, so nothing restarts.
|
|
259
260
|
*/
|
|
260
|
-
private
|
|
261
|
+
private applyRunSettings;
|
|
261
262
|
/**
|
|
262
263
|
* Suppression is read from the live ancestors of what is read, because the
|
|
263
264
|
* element carrying it may sit above the content root.
|
|
@@ -389,7 +389,8 @@ export class TTSService {
|
|
|
389
389
|
this.provider = await provider.initialize(config);
|
|
390
390
|
}
|
|
391
391
|
/**
|
|
392
|
-
* Update rate, pitch, voice or provider options without
|
|
392
|
+
* Update rate, pitch, volume, voice or provider options without
|
|
393
|
+
* reinitializing.
|
|
393
394
|
* `providerOptions` merge over the ones already configured.
|
|
394
395
|
*/
|
|
395
396
|
async updateSettings(settings) {
|
|
@@ -1160,24 +1161,37 @@ export class TTSService {
|
|
|
1160
1161
|
return;
|
|
1161
1162
|
}
|
|
1162
1163
|
const runId = waitingRunId ?? this.beginRun(owner);
|
|
1163
|
-
if (options.rate !== undefined
|
|
1164
|
-
|
|
1164
|
+
if (options.rate !== undefined ||
|
|
1165
|
+
options.pitch !== undefined ||
|
|
1166
|
+
options.volume !== undefined) {
|
|
1167
|
+
await this.applyRunSettings(options);
|
|
1165
1168
|
if (runId !== this.speakRunId)
|
|
1166
1169
|
return;
|
|
1167
1170
|
}
|
|
1168
1171
|
await this.speakContent(content.text, content.options, runId);
|
|
1169
1172
|
}
|
|
1170
1173
|
/**
|
|
1171
|
-
* Sets the rate a run starts at, after any rate write in
|
|
1172
|
-
* no playback yet, so nothing restarts.
|
|
1174
|
+
* Sets the rate, pitch and volume a run starts at, after any rate write in
|
|
1175
|
+
* flight. The run has no playback yet, so nothing restarts.
|
|
1173
1176
|
*/
|
|
1174
|
-
async
|
|
1177
|
+
async applyRunSettings(options) {
|
|
1175
1178
|
await this.playbackRateWriteQueue;
|
|
1176
|
-
const
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1179
|
+
const settings = {};
|
|
1180
|
+
if (options.rate !== undefined) {
|
|
1181
|
+
const nextRate = this.normalizePlaybackRate(options.rate);
|
|
1182
|
+
const currentRate = this.normalizePlaybackRate(Number(this.ttsConfig.rate ?? 1));
|
|
1183
|
+
if (nextRate !== currentRate)
|
|
1184
|
+
settings.rate = nextRate;
|
|
1185
|
+
}
|
|
1186
|
+
if (options.pitch !== undefined && options.pitch !== this.ttsConfig.pitch) {
|
|
1187
|
+
settings.pitch = options.pitch;
|
|
1188
|
+
}
|
|
1189
|
+
if (options.volume !== undefined &&
|
|
1190
|
+
options.volume !== this.ttsConfig.volume) {
|
|
1191
|
+
settings.volume = options.volume;
|
|
1192
|
+
}
|
|
1193
|
+
if (Object.keys(settings).length > 0)
|
|
1194
|
+
await this.updateSettings(settings);
|
|
1181
1195
|
}
|
|
1182
1196
|
/**
|
|
1183
1197
|
* Suppression is read from the live ancestors of what is read, because the
|
|
@@ -114,9 +114,10 @@ export interface ToolbarContext {
|
|
|
114
114
|
getResolvedToolContext?: (toolId: string) => ResolvedToolContext | null;
|
|
115
115
|
getToolRenderParams?: (toolId: string) => Record<string, unknown> | null;
|
|
116
116
|
/**
|
|
117
|
-
* The tool's policy parameters on this toolbar: the
|
|
118
|
-
*
|
|
119
|
-
* Authored content, so a registration checks what it
|
|
117
|
+
* The tool's policy parameters on this toolbar: the profile's, assessment's
|
|
118
|
+
* and, on an item's own toolbar, item's `toolParameters` entries merged key by
|
|
119
|
+
* key, later ones winning. Authored content, so a registration checks what it
|
|
120
|
+
* reads.
|
|
120
121
|
*/
|
|
121
122
|
getToolParameters?: <K extends string>(toolId: K) => ToolParametersFor<K> | null;
|
|
122
123
|
}
|
|
@@ -211,6 +211,10 @@ export interface SpeakOptions {
|
|
|
211
211
|
ownerId?: string;
|
|
212
212
|
/** The rate the read starts at; it stays the service's rate afterwards. */
|
|
213
213
|
rate?: number;
|
|
214
|
+
/** The pitch the read starts at, 0–2 with 1 normal; it stays the service's. */
|
|
215
|
+
pitch?: number;
|
|
216
|
+
/** The volume the read starts at, 0–1; it stays the service's. */
|
|
217
|
+
volume?: number;
|
|
214
218
|
}
|
|
215
219
|
/**
|
|
216
220
|
* TTS service interface
|
|
@@ -107,9 +107,40 @@ export type ToolContext = AssessmentToolContext | SectionToolContext | ItemToolC
|
|
|
107
107
|
*/
|
|
108
108
|
export declare function hasMathContent(context: ToolContext): boolean;
|
|
109
109
|
/**
|
|
110
|
-
*
|
|
110
|
+
* What one element of a context declares about the PNP supports it implements.
|
|
111
|
+
*
|
|
112
|
+
* An element declares them on its class, as `static pieSupports`: a list of AfA
|
|
113
|
+
* PNP 3.0 support terms, such as `answer-masking`. The toolkit reads the class
|
|
114
|
+
* `customElements` holds under the element's runtime tag, so the declaration is
|
|
115
|
+
* known before the element renders. What a support needs from the rendered
|
|
116
|
+
* element is between the element and the tool that provides it, and that tool
|
|
117
|
+
* documents it.
|
|
118
|
+
*/
|
|
119
|
+
export interface ElementSupports {
|
|
120
|
+
/** The element's model id. */
|
|
121
|
+
elementId: string | undefined;
|
|
122
|
+
/** The tag the item binds the element to, as authored. */
|
|
123
|
+
tag: string;
|
|
124
|
+
/** The element's package spec in the item's `elements` map, when it has one. */
|
|
125
|
+
packageSpec: string | undefined;
|
|
126
|
+
/**
|
|
127
|
+
* The terms the element's class declares: `undefined` while the class is
|
|
128
|
+
* undefined, and for a class that declares nothing. An empty list is a
|
|
129
|
+
* declaration that the element implements none.
|
|
130
|
+
*/
|
|
131
|
+
supports: readonly string[] | undefined;
|
|
132
|
+
/**
|
|
133
|
+
* The runtime tags the class can still be defined under, empty once it is
|
|
134
|
+
* defined. A definition landing under one of them can change `supports`.
|
|
135
|
+
*/
|
|
136
|
+
pendingTags: readonly string[];
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* The supports each element of a context declares: the element's own at element
|
|
140
|
+
* level, every element of the item or passage config at those levels, and none
|
|
141
|
+
* elsewhere. A model that names no element renders nothing and is skipped.
|
|
111
142
|
*/
|
|
112
|
-
export declare function
|
|
143
|
+
export declare function elementSupports(context: ToolContext): ElementSupports[];
|
|
113
144
|
/**
|
|
114
145
|
* Helper to check if context contains text that can be read aloud
|
|
115
146
|
*/
|