@pie-qti/player-elements 1.0.0-beta.2 → 1.0.0-beta.3

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 (38) hide show
  1. package/dist/{ItemToolBar-4vq9nbxz-BbBw5mfK.js → ItemToolBar-4vq9nbxz-D1Yru90z.js} +2 -2
  2. package/dist/{ItemToolBar-4vq9nbxz-BbBw5mfK.js.map → ItemToolBar-4vq9nbxz-D1Yru90z.js.map} +1 -1
  3. package/dist/{ItemToolBar-n05xjkp8-Bb3g018Z.js → ItemToolBar-n05xjkp8-ClcjdKVw.js} +2 -2
  4. package/dist/{ItemToolBar-n05xjkp8-Bb3g018Z.js.map → ItemToolBar-n05xjkp8-ClcjdKVw.js.map} +1 -1
  5. package/dist/{define-B-ocInH4.js → define-mw8BceaY.js} +10 -10
  6. package/dist/{define-B-ocInH4.js.map → define-mw8BceaY.js.map} +1 -1
  7. package/dist/{dist-BAMUxWGI.js → dist-DmfUd9ZE.js} +2 -2
  8. package/dist/{dist-BAMUxWGI.js.map → dist-DmfUd9ZE.js.map} +1 -1
  9. package/dist/{element-DjIUtH7W.js → element-9ZegGa0D.js} +2 -2
  10. package/dist/{element-DjIUtH7W.js.map → element-9ZegGa0D.js.map} +1 -1
  11. package/dist/elements.js +2 -2
  12. package/dist/index.js +1 -1
  13. package/dist/{item-scope-element-C1EO-QUs.js → item-scope-element-BhZq6tE6.js} +3 -3
  14. package/dist/{item-scope-element-C1EO-QUs.js.map → item-scope-element-BhZq6tE6.js.map} +1 -1
  15. package/dist/{item-toolbar-element-uc1jClIg.js → item-toolbar-element-Drvp1tyg.js} +3 -3
  16. package/dist/{item-toolbar-element-uc1jClIg.js.map → item-toolbar-element-Drvp1tyg.js.map} +1 -1
  17. package/dist/{mathlive.min-CVIUc7ff-rQOKt03P.js → mathlive.min-Cmxm6f5R-rQOKt03P.js} +1 -1
  18. package/dist/mathlive.min-Cmxm6f5R-rQOKt03P.js.map +1 -0
  19. package/dist/{pie-assessment-toolkit-element-Bf3-xqs9.js → pie-assessment-toolkit-element-D2c546tY.js} +6 -6
  20. package/dist/{pie-assessment-toolkit-element-Bf3-xqs9.js.map → pie-assessment-toolkit-element-D2c546tY.js.map} +1 -1
  21. package/dist/{pie-tool-calculator-CeZzHMSB.js → pie-tool-calculator-Ry1Gfvih.js} +3 -3
  22. package/dist/{pie-tool-calculator-CeZzHMSB.js.map → pie-tool-calculator-Ry1Gfvih.js.map} +1 -1
  23. package/dist/{provider-CA-nda-g.js → provider-MVDKl0zU.js} +2 -2
  24. package/dist/{provider-CA-nda-g.js.map → provider-MVDKl0zU.js.map} +1 -1
  25. package/dist/register-players.js +1 -1
  26. package/dist/register.js +6038 -5913
  27. package/dist/register.js.map +1 -1
  28. package/dist/{resolveItems-D_WkE5eY.js → resolveItems-NbAcf9va.js} +4732 -4607
  29. package/dist/resolveItems-NbAcf9va.js.map +1 -0
  30. package/dist/{sre-engine-Bgjl6uRf.js → sre-engine-0LUkEijI.js} +2 -2
  31. package/dist/{sre-engine-Bgjl6uRf.js.map → sre-engine-0LUkEijI.js.map} +1 -1
  32. package/dist/{sre-engine-dq0w45fv-CuD0rBMR.js → sre-engine-dq0w45fv-BkzJHqSa.js} +2 -2
  33. package/dist/{sre-engine-dq0w45fv-CuD0rBMR.js.map → sre-engine-dq0w45fv-BkzJHqSa.js.map} +1 -1
  34. package/dist/{tool-tts-inline-D9WVRkOQ.js → tool-tts-inline-Bik5uGvz.js} +3 -3
  35. package/dist/{tool-tts-inline-D9WVRkOQ.js.map → tool-tts-inline-Bik5uGvz.js.map} +1 -1
  36. package/package.json +9 -9
  37. package/dist/mathlive.min-CVIUc7ff-rQOKt03P.js.map +0 -1
  38. package/dist/resolveItems-D_WkE5eY.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { T as e } from "./define-B-ocInH4.js";
1
+ import { T as e } from "./define-mw8BceaY.js";
2
2
  import { t } from "./types-CqGj8AV3.js";
3
3
  import { Y as n } from "./ItemToolBar-f971t0cw-CwhfViPN.js";
4
4
  //#region ../../node_modules/.bun/@pie-players+pie-context@1.0.0-beta.6/node_modules/@pie-players/pie-context/dist/item-feature-decisions.js
@@ -256,4 +256,4 @@ function L(e, t) {
256
256
  //#endregion
257
257
  export { A as a, O as c, D as d, k as f, x as i, I as l, y as m, L as n, F as o, j as p, N as r, M as s, E as t, T as u };
258
258
 
259
- //# sourceMappingURL=ItemToolBar-4vq9nbxz-BbBw5mfK.js.map
259
+ //# sourceMappingURL=ItemToolBar-4vq9nbxz-D1Yru90z.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ItemToolBar-4vq9nbxz-BbBw5mfK.js","names":["z","B","q","hasLearnerResponse","ContextProvider","itemFeatureDecisionsContext","createContext","FEATURE_DECISION_APPLIED_EVENT","SESSION_COMMIT_METHOD","OBSERVED_SIGNATURE","isRecord","value","isPieDeliveryElement","element","shadowRootOf","node","assignedElementsOf","slot","collectCandidates","rootShadow","root","seen","out","visit","assigned","children","isElementLike","candidatesIn","candidates","readSession","signatureOf","json","session","readObservedSignature","recorded","writeObservedSignature","signature","markCommitsDuring","target","sweep","stamp","detail","event","reason","commitPendingSessions","result","options","sweepPendingSessions","caller","observed","commit","dispatched","witness","failed","error","logger","J","I","K","R","E","P","V","_","N","Y","A","G","T","M","L","j","$","b","U","O","m","S","D","H","Q","W","C"],"sources":["../../../node_modules/.bun/@pie-players+pie-context@1.0.0-beta.6/node_modules/@pie-players/pie-context/dist/item-feature-decisions.js","../../../node_modules/.bun/@pie-players+pie-players-shared@1.0.0-beta.6/node_modules/@pie-players/pie-players-shared/dist/pie/session-commit.js","../../../node_modules/.bun/@pie-players+pie-assessment-toolkit@1.0.0-beta.6/node_modules/@pie-players/pie-assessment-toolkit/dist/components/chunks/ItemToolBar-4vq9nbxz.js"],"sourcesContent":["import { createContext } from \"./types.js\";\n/**\n * `Symbol.for`, so a player's bundled copy of this package requests the same\n * key the toolkit provides.\n */\nexport const itemFeatureDecisionsContext = createContext(Symbol.for(\"pie.itemFeatureDecisions\"));\n/**\n * The item player's `feature-decision-applied` event, dispatched once per\n * feature before the item's elements render with its decision written to their\n * models. `<pie-item-scope>` relays it to its toolkit.\n */\nexport const FEATURE_DECISION_APPLIED_EVENT = \"feature-decision-applied\";\n","/**\n * Final session commit at a player seam.\n *\n * A delivery element coalesces its `session-changed` dispatch, so a response the\n * learner finished entering can still be pending when the player is about to\n * discard the element. Losing it produces no event, which leaves a host with\n * nothing to detect.\n *\n * Reach, per seam:\n *\n * - `navigate` and `page-hidden` run while the elements are still attached, so\n * the event reaches a `document`-level listener. Quiz Engine listens on\n * `document`.\n * - `teardown` runs from the player's own destroy, which a custom element only\n * learns about in `disconnectedCallback` - after removal. The event reaches\n * the player's own backend save and any listener bound directly to the player\n * element, and it does not reach `document`. An SPA host that unmounts the\n * player is served by `commitPendingSessions()` on the player element, called\n * before the unmount.\n * - Ahead of all three, `flushPendingSessionNotifications` runs when focus\n * leaves a player, so the event lands before the host acts on the click or\n * key that moved it, and carries no reason.\n *\n * Two paths, per element:\n *\n * - An element that owns its notification exposes `commitPendingSession()`, so\n * it dispatches its own event with its own `complete` semantics. The sweep\n * marks that event with `detail.sessionCommitReason`, which the element\n * cannot do for itself and which every guard in a `session-changed`'s way\n * keys on.\n * - An older element gets a synthesized `session-changed` built from its\n * `session` getter. Those elements write the session synchronously and defer\n * only the dispatch, so the read is never older than what the host was last\n * told.\n *\n * Duplicated deliberately into `pie-player-components` and `pie-api-components`,\n * which cannot depend on this package. Changes belong here first; the copies are\n * `src/utils/session-commit.ts` and `src/session-commit.ts` respectively.\n */\nimport { hasLearnerResponse } from \"./item-session-contract.js\";\n/**\n * Commit hook a delivery element installs when it owns a deferred\n * `session-changed`. Owned by `@pie-element/shared-player-events`\n * (`createSessionNotifier`); the name is duplicated rather than imported so the\n * players carry no dependency on an element-repo package.\n */\nexport const SESSION_COMMIT_METHOD = \"commitPendingSession\";\n/**\n * Where the last-observed session signature is recorded, on the element itself.\n *\n * On the element rather than in a module-scope map for two reasons: a nested\n * player stack loads two copies of this module from different bundles, and\n * module state would then let each layer announce the same commit; and a map\n * keyed by element records what the *sweep* last emitted, which suppresses a\n * later commit of a value the sweep emitted once before (answer A, hide, answer\n * B, answer A again, navigate mid-debounce - the host keeps B).\n *\n * `Symbol.for` so the two bundles resolve the same key.\n */\nconst OBSERVED_SIGNATURE = Symbol.for(\"pie.sessionCommit.observedSignature\");\nfunction isRecord(value) {\n return !!value && typeof value === \"object\";\n}\n/**\n * A PIE delivery element carries both halves of the element contract: a\n * `session` accessor and a `model` setter. Requiring both keeps the sweep off\n * player chrome and tool custom elements, and an element that has not been\n * upgraded yet has neither.\n */\nfunction isPieDeliveryElement(element) {\n if (!element.tagName.includes(\"-\"))\n return false;\n return \"session\" in element && \"model\" in element;\n}\nfunction shadowRootOf(node) {\n const candidate = node\n ?.shadowRoot;\n return candidate ?? null;\n}\nfunction assignedElementsOf(element) {\n const slot = element;\n if (typeof slot.assignedElements !== \"function\")\n return [];\n try {\n return slot.assignedElements({ flatten: true });\n }\n catch {\n return [];\n }\n}\n/**\n * Walks the flattened tree: `children`, then open shadow roots, then the\n * elements assigned to each `<slot>`.\n *\n * `querySelectorAll(\"*\")` sees none of the last two, and both are load-bearing\n * here. The section player mounts each item inside `<pie-item-scope>`'s shadow\n * root, and projects its item pane through a slot on the assessment toolkit -\n * a walk that stops at `<slot>` finds every delivery element in a section\n * unreachable.\n */\nfunction collectCandidates(root, seen, out) {\n const rootShadow = shadowRootOf(root);\n if (rootShadow)\n collectCandidates(rootShadow, seen, out);\n const visit = (element) => {\n if (seen.has(element))\n return;\n seen.add(element);\n if (isPieDeliveryElement(element))\n out.push(element);\n collectCandidates(element, seen, out);\n };\n for (const assigned of assignedElementsOf(root))\n visit(assigned);\n const children = root.children;\n if (!children)\n return;\n for (const element of Array.from(children))\n visit(element);\n}\n/**\n * Duck-typed rather than `instanceof Element`: the legacy players' test\n * environment is Stencil's mock DOM, where a mounted element is not an instance\n * of the global `Element`, and a check that silently fails there fails the same\n * way against any other DOM implementation a host brings.\n */\nfunction isElementLike(node) {\n return (!!node &&\n typeof node === \"object\" &&\n typeof node.tagName === \"string\");\n}\nfunction candidatesIn(root) {\n const candidates = [];\n const seen = new Set();\n if (isElementLike(root) && isPieDeliveryElement(root)) {\n seen.add(root);\n candidates.push(root);\n }\n collectCandidates(root, seen, candidates);\n return candidates;\n}\nfunction readSession(element) {\n try {\n return element.session;\n }\n catch {\n // A getter that throws is not a session the player can commit.\n return undefined;\n }\n}\nfunction signatureOf(session) {\n try {\n const json = JSON.stringify(session);\n // `JSON.stringify(undefined)` is `undefined`, which would be written as a\n // signature and then read back as \"no baseline\".\n return typeof json === \"string\" ? json : null;\n }\n catch {\n return null;\n }\n}\nfunction readObservedSignature(element) {\n const recorded = element[OBSERVED_SIGNATURE];\n return typeof recorded === \"string\" ? recorded : undefined;\n}\nfunction writeObservedSignature(element, signature) {\n try {\n Object.defineProperty(element, OBSERVED_SIGNATURE, {\n value: signature,\n configurable: true,\n enumerable: false,\n writable: true,\n });\n }\n catch {\n // A frozen element cannot be marked. It then commits again on the next\n // seam, which a player's own session signature check absorbs.\n }\n}\n/**\n * Record an element's session as one the host has been told about.\n *\n * A player calls this from its `session-changed` listener, which is what makes\n * the commit's discriminant \"has anything happened since the host last heard\"\n * rather than a guess about an element's session schema.\n */\nexport function noteSessionObserved(target) {\n if (!isElementLike(target))\n return;\n const signature = signatureOf(readSession(target));\n if (signature === null)\n return;\n writeObservedSignature(target, signature);\n}\n/**\n * Seed the baseline for every delivery element in a subtree.\n *\n * A player calls this once its elements hold their loaded sessions, so a\n * restored response the learner has not touched is never announced as a change.\n */\nexport function noteSessionBaseline(root) {\n if (!root)\n return;\n for (const element of candidatesIn(root)) {\n const signature = signatureOf(readSession(element));\n if (signature !== null)\n writeObservedSignature(element, signature);\n }\n}\n/**\n * Mark an element-owned commit's own event as a commit, for the length of the\n * sweep.\n *\n * `commitPendingSession()` lets the element dispatch its own `session-changed`,\n * with its own `complete` semantics, and that event carries no commit marker.\n * Every guard a player puts in a `session-changed`'s way keys on\n * `detail.sessionCommitReason` to let a commit through: the Stencil player's\n * model-set blocker, this project's renderer dedupe, the section player's\n * cross-shell dedupe, `<pie-api-player>`'s save-now decision. Unmarked, an\n * element-owned commit is exactly the event those guards drop - and the\n * elements that adopted `createSessionNotifier` are the ones taking that path,\n * so the exemption applied to nothing.\n *\n * A capture listener on the sweep root runs before the target's own listeners\n * and before every bubble listener at or above the root, which is where all\n * four guards sit. Only the absent key is added; a synthesized event already\n * carries its own.\n */\nfunction markCommitsDuring(root, reason, sweep) {\n const target = root;\n if (typeof target.addEventListener !== \"function\")\n return sweep();\n const stamp = (event) => {\n const detail = event.detail;\n if (!isRecord(detail) || \"sessionCommitReason\" in detail)\n return;\n try {\n detail.sessionCommitReason = reason;\n }\n catch {\n // A frozen detail keeps its own contract; the commit still dispatches.\n }\n };\n target.addEventListener(\"session-changed\", stamp, true);\n try {\n return sweep();\n }\n finally {\n target.removeEventListener(\"session-changed\", stamp, true);\n }\n}\nexport function commitPendingSessions(root, options = {}) {\n const result = {\n committed: 0,\n synthesized: 0,\n skipped: 0,\n };\n if (!root)\n return result;\n const reason = options.reason ?? \"teardown\";\n return markCommitsDuring(root, reason, () => sweepPendingSessions(root, reason, options.logger, result));\n}\n/**\n * `reason` is null for a flush, whose events are ordinary announcements.\n */\nfunction sweepPendingSessions(root, reason, logger, result) {\n const caller = reason ? \"commitPendingSessions\" : \"flushPendingSessionNotifications\";\n for (const element of candidatesIn(root)) {\n const session = readSession(element);\n if (!isRecord(session)) {\n result.skipped += 1;\n continue;\n }\n const signature = signatureOf(session);\n if (signature === null) {\n result.skipped += 1;\n continue;\n }\n const observed = readObservedSignature(element);\n if (observed === signature) {\n // The host already has this. Nothing is pending, whichever path the\n // element would have taken.\n result.skipped += 1;\n continue;\n }\n if (observed === undefined && !hasLearnerResponse(session)) {\n // No baseline, so the player never saw this element load - the section\n // player's shells and the legacy Stencil stack both have paths where\n // that happens. Announcing an untouched element's identity-only session\n // makes a host that re-renders on `session-changed` cancel work it was\n // in the middle of: a config swap re-pushed the host's own config and\n // discarded the incoming item.\n result.skipped += 1;\n continue;\n }\n const commit = element[SESSION_COMMIT_METHOD];\n if (typeof commit === \"function\") {\n // An element's own commit is a no-op when nothing is pending, and its\n // session can still differ from what the host heard: a controller\n // writing into the session, or an element path that stores a value\n // without notifying. Counting the call as the announcement recorded a\n // response the host never received and every later seam then skipped\n // it, so what the element dispatches is what counts. `flush()` is\n // synchronous in every implementation of this contract; one that\n // deferred would be announced twice, which a player's signature check\n // absorbs.\n let dispatched = false;\n const witness = () => {\n dispatched = true;\n };\n element.addEventListener(\"session-changed\", witness, true);\n let failed = false;\n try {\n commit.call(element);\n }\n catch (error) {\n failed = true;\n logger?.warn(`[${caller}] ${element.tagName.toLowerCase()} failed to commit its pending session`, error);\n }\n finally {\n element.removeEventListener(\"session-changed\", witness, true);\n }\n if (failed) {\n result.skipped += 1;\n continue;\n }\n if (dispatched) {\n writeObservedSignature(element, signature);\n result.committed += 1;\n continue;\n }\n // Nothing was pending, so fall through and announce the session the\n // element holds.\n }\n try {\n element.dispatchEvent(new CustomEvent(\"session-changed\", {\n bubbles: true,\n composed: true,\n detail: {\n component: element.tagName.toLowerCase(),\n session: JSON.parse(signature),\n ...(reason ? { sessionCommitReason: reason } : {}),\n },\n }));\n writeObservedSignature(element, signature);\n result.synthesized += 1;\n }\n catch (error) {\n logger?.warn(`[${caller}] ${element.tagName.toLowerCase()} session commit dispatch failed`, error);\n result.skipped += 1;\n }\n }\n return result;\n}\n/**\n * Deliver every pending `session-changed` now, as an ordinary announcement.\n *\n * The flush a player runs when focus leaves it, ahead of whatever the learner\n * is moving to, so the host hears the response while the item it belongs to is\n * still current. Same two paths and the same discriminant as the commit, with\n * no `sessionCommitReason`: an adopted element's event is exactly what its\n * debounce would have delivered, only earlier, and the next seam finds nothing\n * pending.\n */\nexport function flushPendingSessionNotifications(root, options = {}) {\n const result = {\n committed: 0,\n synthesized: 0,\n skipped: 0,\n };\n if (!root)\n return result;\n return sweepPendingSessions(root, null, options.logger, result);\n}\n/**\n * Commit on the page going away rather than on the player being removed from it.\n *\n * `visibilitychange` to `hidden` is the primary signal: it is the last event a\n * mobile browser reliably delivers before freezing or discarding a page.\n * `pagehide` backs it up for same-document navigation and back/forward cache\n * entry, and for iOS Safari, which can fire it without a preceding\n * `visibilitychange`. Both fire on an ordinary navigation; the per-element\n * baseline makes the second a no-op, and input arriving between them is still\n * committed - which a \"commit once per hidden transition\" guard would drop.\n * `beforeunload` is not used: it is unreliable on mobile and costs the\n * back/forward cache.\n *\n * Returns an unbind function. Safe to call outside a browser, where it binds\n * nothing.\n */\nexport function bindPageLifecycleCommit(options) {\n if (typeof document === \"undefined\" || typeof window === \"undefined\") {\n return () => { };\n }\n const commit = (reason) => {\n commitPendingSessions(options.root(), {\n reason,\n logger: options.logger,\n });\n try {\n options.onHidden?.(reason);\n }\n catch (error) {\n options.logger?.warn(\"[bindPageLifecycleCommit] onHidden failed\", error);\n }\n };\n const handleVisibilityChange = () => {\n if (document.visibilityState === \"hidden\")\n commit(\"page-hidden\");\n };\n const handlePageHide = () => {\n commit(\"page-hidden\");\n };\n document.addEventListener(\"visibilitychange\", handleVisibilityChange);\n window.addEventListener(\"pagehide\", handlePageHide);\n return () => {\n document.removeEventListener(\"visibilitychange\", handleVisibilityChange);\n window.removeEventListener(\"pagehide\", handlePageHide);\n };\n}\n","import{ContextProvider as z,FEATURE_DECISION_APPLIED_EVENT as q,itemFeatureDecisionsContext as B}from\"@pie-players/pie-context\";var J=[\"autoplayAudio\"],I=Object.freeze({features:Object.freeze({})});function K(E){let R=E.canonicalItemId||E.itemId;return{level:\"item\",scopeId:R,itemId:E.itemId,canonicalItemId:R}}function P(E,R){if(!R||typeof E?.decideFeaturePolicy!==\"function\")return I;let V={};for(let _ of J){let N=E.decideFeaturePolicy(_,R);if(N.rule===\"none\")continue;V[_]={granted:N.granted,rule:N.rule}}return{features:V}}function Y(E){let R=new z(E,{context:B,initialValue:I});R.connect();let V=JSON.stringify(I.features),_=null,N=null,A=null,G=()=>{let T=P(_,N),M=JSON.stringify(T.features);if(M===V)return;V=M,R.setValue(T)},L=()=>{let T=A;A=null;try{T?.()}catch{}},j=(T)=>{let M=T.detail;if(!M||!N)return;_?.reportFeatureDecisionApplied?.(M,N)};return E.addEventListener(q,j),{setCoordinator(T){if(T===_)return;if(L(),_=T,T&&typeof T.onPolicyChange===\"function\")A=T.onPolicyChange((M)=>{if(M.reason===\"disposed\")L(),_=null;G()});G()},setItem(T){let M=T?.itemId?K(T):null;if(M?.scopeId===N?.scopeId&&M?.itemId===N?.itemId)return;N=M,G()},disconnect(){E.removeEventListener(q,j),L(),_=null,N=null,R.disconnect()}}}var $=\"pie-register\",b=\"pie-unregister\",U=\"pie-item-session-changed\",k=\"item-session-changed\",O=\"pie-content-loaded\",m=\"pie-item-player-error\",S=\"pie-formative-action\",D=\"pie-media-time-source\";var H=(E)=>Array.isArray(E)&&E.length>0;function Q(E){if(E.kind===\"passage\")return{ownerKind:\"passage\",assessmentId:E.assessmentId,sectionId:E.sectionId,passageId:E.canonicalItemId||E.itemId};return{ownerKind:\"itemModel\",assessmentId:E.assessmentId,sectionId:E.sectionId,itemId:E.itemId,canonicalItemId:E.canonicalItemId||E.itemId}}function W(E,R){if(!E)return[];let V=Q(R),_=[];if(H(E.accessibilityCatalogs))_.push({context:V,catalogs:E.accessibilityCatalogs});if(H(E.config?.extractedCatalogs))_.push({context:V,catalogs:E.config.extractedCatalogs});if(R.kind===\"passage\")return _;if(V.ownerKind!==\"itemModel\")return _;for(let N of E.config?.models??[]){if(!H(N.accessibilityCatalogs))continue;_.push({context:{...V,modelId:N.id},catalogs:N.accessibilityCatalogs})}return _}function C(E,R){let V=W(E,{kind:R,itemId:\"\"});try{return JSON.stringify(V.map((_)=>[_.context.modelId??null,_.catalogs]))}catch{return null}}\nexport{J as a,Y as b,$ as c,b as d,U as e,k as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E;EAAO,iBAAgBA,EAAE,mBAAiBA,EAAE;CAAM;AAAC;AAAC,SAASqB,EAAE,GAAE,GAAE;CAAC,IAAG,CAACrB,GAAE,OAAM,CAAC;CAAE,IAAIE,IAAEkB,EAAErB,CAAC,GAAEI,IAAE,CAAC;CAA8M,IAAzMgB,EAAEnB,EAAE,qBAAqB,KAAEG,EAAE,KAAK;EAAC,SAAQD;EAAE,UAASF,EAAE;CAAqB,CAAC,GAAKmB,EAAEnB,EAAE,QAAQ,iBAAiB,KAAEG,EAAE,KAAK;EAAC,SAAQD;EAAE,UAASF,EAAE,OAAO;CAAiB,CAAC,GAAKD,EAAE,SAAO,aAAsBG,EAAE,cAAY,aAAY,OAAOC;CAAE,KAAI,IAAIC,KAAKJ,EAAE,QAAQ,UAAQ,CAAC,GAAG,AAAImB,EAAEf,EAAE,qBAAqB,KAAWD,EAAE,KAAK;EAAC,SAAQ;GAAC,GAAGD;GAAE,SAAQE,EAAE;EAAE;EAAE,UAASA,EAAE;CAAqB,CAAC;CAAE,OAAOD;AAAC;AAAC,SAASmB,EAAE,GAAE,GAAE;CAAC,IAAIpB,IAAEmB,EAAErB,GAAE;EAAC,MAAKD;EAAE,QAAO;CAAE,CAAC;CAAE,IAAG;EAAC,OAAO,KAAK,UAAUG,EAAE,KAAK,MAAI,CAACC,EAAE,QAAQ,WAAS,MAAKA,EAAE,QAAQ,CAAC,CAAC;CAAC,QAAM;EAAC,OAAO;CAAI;AAAC"}
1
+ {"version":3,"file":"ItemToolBar-4vq9nbxz-D1Yru90z.js","names":["z","B","q","hasLearnerResponse","ContextProvider","itemFeatureDecisionsContext","createContext","FEATURE_DECISION_APPLIED_EVENT","SESSION_COMMIT_METHOD","OBSERVED_SIGNATURE","isRecord","value","isPieDeliveryElement","element","shadowRootOf","node","assignedElementsOf","slot","collectCandidates","rootShadow","root","seen","out","visit","assigned","children","isElementLike","candidatesIn","candidates","readSession","signatureOf","json","session","readObservedSignature","recorded","writeObservedSignature","signature","markCommitsDuring","target","sweep","stamp","detail","event","reason","commitPendingSessions","result","options","sweepPendingSessions","caller","observed","commit","dispatched","witness","failed","error","logger","J","I","K","R","E","P","V","_","N","Y","A","G","T","M","L","j","$","b","U","O","m","S","D","H","Q","W","C"],"sources":["../../../node_modules/.bun/@pie-players+pie-context@1.0.0-beta.6/node_modules/@pie-players/pie-context/dist/item-feature-decisions.js","../../../node_modules/.bun/@pie-players+pie-players-shared@1.0.0-beta.6/node_modules/@pie-players/pie-players-shared/dist/pie/session-commit.js","../../../node_modules/.bun/@pie-players+pie-assessment-toolkit@1.0.0-beta.6/node_modules/@pie-players/pie-assessment-toolkit/dist/components/chunks/ItemToolBar-4vq9nbxz.js"],"sourcesContent":["import { createContext } from \"./types.js\";\n/**\n * `Symbol.for`, so a player's bundled copy of this package requests the same\n * key the toolkit provides.\n */\nexport const itemFeatureDecisionsContext = createContext(Symbol.for(\"pie.itemFeatureDecisions\"));\n/**\n * The item player's `feature-decision-applied` event, dispatched once per\n * feature before the item's elements render with its decision written to their\n * models. `<pie-item-scope>` relays it to its toolkit.\n */\nexport const FEATURE_DECISION_APPLIED_EVENT = \"feature-decision-applied\";\n","/**\n * Final session commit at a player seam.\n *\n * A delivery element coalesces its `session-changed` dispatch, so a response the\n * learner finished entering can still be pending when the player is about to\n * discard the element. Losing it produces no event, which leaves a host with\n * nothing to detect.\n *\n * Reach, per seam:\n *\n * - `navigate` and `page-hidden` run while the elements are still attached, so\n * the event reaches a `document`-level listener. Quiz Engine listens on\n * `document`.\n * - `teardown` runs from the player's own destroy, which a custom element only\n * learns about in `disconnectedCallback` - after removal. The event reaches\n * the player's own backend save and any listener bound directly to the player\n * element, and it does not reach `document`. An SPA host that unmounts the\n * player is served by `commitPendingSessions()` on the player element, called\n * before the unmount.\n * - Ahead of all three, `flushPendingSessionNotifications` runs when focus\n * leaves a player, so the event lands before the host acts on the click or\n * key that moved it, and carries no reason.\n *\n * Two paths, per element:\n *\n * - An element that owns its notification exposes `commitPendingSession()`, so\n * it dispatches its own event with its own `complete` semantics. The sweep\n * marks that event with `detail.sessionCommitReason`, which the element\n * cannot do for itself and which every guard in a `session-changed`'s way\n * keys on.\n * - An older element gets a synthesized `session-changed` built from its\n * `session` getter. Those elements write the session synchronously and defer\n * only the dispatch, so the read is never older than what the host was last\n * told.\n *\n * Duplicated deliberately into `pie-player-components` and `pie-api-components`,\n * which cannot depend on this package. Changes belong here first; the copies are\n * `src/utils/session-commit.ts` and `src/session-commit.ts` respectively.\n */\nimport { hasLearnerResponse } from \"./item-session-contract.js\";\n/**\n * Commit hook a delivery element installs when it owns a deferred\n * `session-changed`. Owned by `@pie-element/shared-player-events`\n * (`createSessionNotifier`); the name is duplicated rather than imported so the\n * players carry no dependency on an element-repo package.\n */\nexport const SESSION_COMMIT_METHOD = \"commitPendingSession\";\n/**\n * Where the last-observed session signature is recorded, on the element itself.\n *\n * On the element rather than in a module-scope map for two reasons: a nested\n * player stack loads two copies of this module from different bundles, and\n * module state would then let each layer announce the same commit; and a map\n * keyed by element records what the *sweep* last emitted, which suppresses a\n * later commit of a value the sweep emitted once before (answer A, hide, answer\n * B, answer A again, navigate mid-debounce - the host keeps B).\n *\n * `Symbol.for` so the two bundles resolve the same key.\n */\nconst OBSERVED_SIGNATURE = Symbol.for(\"pie.sessionCommit.observedSignature\");\nfunction isRecord(value) {\n return !!value && typeof value === \"object\";\n}\n/**\n * A PIE delivery element carries both halves of the element contract: a\n * `session` accessor and a `model` setter. Requiring both keeps the sweep off\n * player chrome and tool custom elements, and an element that has not been\n * upgraded yet has neither.\n */\nfunction isPieDeliveryElement(element) {\n if (!element.tagName.includes(\"-\"))\n return false;\n return \"session\" in element && \"model\" in element;\n}\nfunction shadowRootOf(node) {\n const candidate = node\n ?.shadowRoot;\n return candidate ?? null;\n}\nfunction assignedElementsOf(element) {\n const slot = element;\n if (typeof slot.assignedElements !== \"function\")\n return [];\n try {\n return slot.assignedElements({ flatten: true });\n }\n catch {\n return [];\n }\n}\n/**\n * Walks the flattened tree: `children`, then open shadow roots, then the\n * elements assigned to each `<slot>`.\n *\n * `querySelectorAll(\"*\")` sees none of the last two, and both are load-bearing\n * here. The section player mounts each item inside `<pie-item-scope>`'s shadow\n * root, and projects its item pane through a slot on the assessment toolkit -\n * a walk that stops at `<slot>` finds every delivery element in a section\n * unreachable.\n */\nfunction collectCandidates(root, seen, out) {\n const rootShadow = shadowRootOf(root);\n if (rootShadow)\n collectCandidates(rootShadow, seen, out);\n const visit = (element) => {\n if (seen.has(element))\n return;\n seen.add(element);\n if (isPieDeliveryElement(element))\n out.push(element);\n collectCandidates(element, seen, out);\n };\n for (const assigned of assignedElementsOf(root))\n visit(assigned);\n const children = root.children;\n if (!children)\n return;\n for (const element of Array.from(children))\n visit(element);\n}\n/**\n * Duck-typed rather than `instanceof Element`: the legacy players' test\n * environment is Stencil's mock DOM, where a mounted element is not an instance\n * of the global `Element`, and a check that silently fails there fails the same\n * way against any other DOM implementation a host brings.\n */\nfunction isElementLike(node) {\n return (!!node &&\n typeof node === \"object\" &&\n typeof node.tagName === \"string\");\n}\nfunction candidatesIn(root) {\n const candidates = [];\n const seen = new Set();\n if (isElementLike(root) && isPieDeliveryElement(root)) {\n seen.add(root);\n candidates.push(root);\n }\n collectCandidates(root, seen, candidates);\n return candidates;\n}\nfunction readSession(element) {\n try {\n return element.session;\n }\n catch {\n // A getter that throws is not a session the player can commit.\n return undefined;\n }\n}\nfunction signatureOf(session) {\n try {\n const json = JSON.stringify(session);\n // `JSON.stringify(undefined)` is `undefined`, which would be written as a\n // signature and then read back as \"no baseline\".\n return typeof json === \"string\" ? json : null;\n }\n catch {\n return null;\n }\n}\nfunction readObservedSignature(element) {\n const recorded = element[OBSERVED_SIGNATURE];\n return typeof recorded === \"string\" ? recorded : undefined;\n}\nfunction writeObservedSignature(element, signature) {\n try {\n Object.defineProperty(element, OBSERVED_SIGNATURE, {\n value: signature,\n configurable: true,\n enumerable: false,\n writable: true,\n });\n }\n catch {\n // A frozen element cannot be marked. It then commits again on the next\n // seam, which a player's own session signature check absorbs.\n }\n}\n/**\n * Record an element's session as one the host has been told about.\n *\n * A player calls this from its `session-changed` listener, which is what makes\n * the commit's discriminant \"has anything happened since the host last heard\"\n * rather than a guess about an element's session schema.\n */\nexport function noteSessionObserved(target) {\n if (!isElementLike(target))\n return;\n const signature = signatureOf(readSession(target));\n if (signature === null)\n return;\n writeObservedSignature(target, signature);\n}\n/**\n * Seed the baseline for every delivery element in a subtree.\n *\n * A player calls this once its elements hold their loaded sessions, so a\n * restored response the learner has not touched is never announced as a change.\n */\nexport function noteSessionBaseline(root) {\n if (!root)\n return;\n for (const element of candidatesIn(root)) {\n const signature = signatureOf(readSession(element));\n if (signature !== null)\n writeObservedSignature(element, signature);\n }\n}\n/**\n * Mark an element-owned commit's own event as a commit, for the length of the\n * sweep.\n *\n * `commitPendingSession()` lets the element dispatch its own `session-changed`,\n * with its own `complete` semantics, and that event carries no commit marker.\n * Every guard a player puts in a `session-changed`'s way keys on\n * `detail.sessionCommitReason` to let a commit through: the Stencil player's\n * model-set blocker, this project's renderer dedupe, the section player's\n * cross-shell dedupe, `<pie-api-player>`'s save-now decision. Unmarked, an\n * element-owned commit is exactly the event those guards drop - and the\n * elements that adopted `createSessionNotifier` are the ones taking that path,\n * so the exemption applied to nothing.\n *\n * A capture listener on the sweep root runs before the target's own listeners\n * and before every bubble listener at or above the root, which is where all\n * four guards sit. Only the absent key is added; a synthesized event already\n * carries its own.\n */\nfunction markCommitsDuring(root, reason, sweep) {\n const target = root;\n if (typeof target.addEventListener !== \"function\")\n return sweep();\n const stamp = (event) => {\n const detail = event.detail;\n if (!isRecord(detail) || \"sessionCommitReason\" in detail)\n return;\n try {\n detail.sessionCommitReason = reason;\n }\n catch {\n // A frozen detail keeps its own contract; the commit still dispatches.\n }\n };\n target.addEventListener(\"session-changed\", stamp, true);\n try {\n return sweep();\n }\n finally {\n target.removeEventListener(\"session-changed\", stamp, true);\n }\n}\nexport function commitPendingSessions(root, options = {}) {\n const result = {\n committed: 0,\n synthesized: 0,\n skipped: 0,\n };\n if (!root)\n return result;\n const reason = options.reason ?? \"teardown\";\n return markCommitsDuring(root, reason, () => sweepPendingSessions(root, reason, options.logger, result));\n}\n/**\n * `reason` is null for a flush, whose events are ordinary announcements.\n */\nfunction sweepPendingSessions(root, reason, logger, result) {\n const caller = reason ? \"commitPendingSessions\" : \"flushPendingSessionNotifications\";\n for (const element of candidatesIn(root)) {\n const session = readSession(element);\n if (!isRecord(session)) {\n result.skipped += 1;\n continue;\n }\n const signature = signatureOf(session);\n if (signature === null) {\n result.skipped += 1;\n continue;\n }\n const observed = readObservedSignature(element);\n if (observed === signature) {\n // The host already has this. Nothing is pending, whichever path the\n // element would have taken.\n result.skipped += 1;\n continue;\n }\n if (observed === undefined && !hasLearnerResponse(session)) {\n // No baseline, so the player never saw this element load - the section\n // player's shells and the legacy Stencil stack both have paths where\n // that happens. Announcing an untouched element's identity-only session\n // makes a host that re-renders on `session-changed` cancel work it was\n // in the middle of: a config swap re-pushed the host's own config and\n // discarded the incoming item.\n result.skipped += 1;\n continue;\n }\n const commit = element[SESSION_COMMIT_METHOD];\n if (typeof commit === \"function\") {\n // An element's own commit is a no-op when nothing is pending, and its\n // session can still differ from what the host heard: a controller\n // writing into the session, or an element path that stores a value\n // without notifying. Counting the call as the announcement recorded a\n // response the host never received and every later seam then skipped\n // it, so what the element dispatches is what counts. `flush()` is\n // synchronous in every implementation of this contract; one that\n // deferred would be announced twice, which a player's signature check\n // absorbs.\n let dispatched = false;\n const witness = () => {\n dispatched = true;\n };\n element.addEventListener(\"session-changed\", witness, true);\n let failed = false;\n try {\n commit.call(element);\n }\n catch (error) {\n failed = true;\n logger?.warn(`[${caller}] ${element.tagName.toLowerCase()} failed to commit its pending session`, error);\n }\n finally {\n element.removeEventListener(\"session-changed\", witness, true);\n }\n if (failed) {\n result.skipped += 1;\n continue;\n }\n if (dispatched) {\n writeObservedSignature(element, signature);\n result.committed += 1;\n continue;\n }\n // Nothing was pending, so fall through and announce the session the\n // element holds.\n }\n try {\n element.dispatchEvent(new CustomEvent(\"session-changed\", {\n bubbles: true,\n composed: true,\n detail: {\n component: element.tagName.toLowerCase(),\n session: JSON.parse(signature),\n ...(reason ? { sessionCommitReason: reason } : {}),\n },\n }));\n writeObservedSignature(element, signature);\n result.synthesized += 1;\n }\n catch (error) {\n logger?.warn(`[${caller}] ${element.tagName.toLowerCase()} session commit dispatch failed`, error);\n result.skipped += 1;\n }\n }\n return result;\n}\n/**\n * Deliver every pending `session-changed` now, as an ordinary announcement.\n *\n * The flush a player runs when focus leaves it, ahead of whatever the learner\n * is moving to, so the host hears the response while the item it belongs to is\n * still current. Same two paths and the same discriminant as the commit, with\n * no `sessionCommitReason`: an adopted element's event is exactly what its\n * debounce would have delivered, only earlier, and the next seam finds nothing\n * pending.\n */\nexport function flushPendingSessionNotifications(root, options = {}) {\n const result = {\n committed: 0,\n synthesized: 0,\n skipped: 0,\n };\n if (!root)\n return result;\n return sweepPendingSessions(root, null, options.logger, result);\n}\n/**\n * Commit on the page going away rather than on the player being removed from it.\n *\n * `visibilitychange` to `hidden` is the primary signal: it is the last event a\n * mobile browser reliably delivers before freezing or discarding a page.\n * `pagehide` backs it up for same-document navigation and back/forward cache\n * entry, and for iOS Safari, which can fire it without a preceding\n * `visibilitychange`. Both fire on an ordinary navigation; the per-element\n * baseline makes the second a no-op, and input arriving between them is still\n * committed - which a \"commit once per hidden transition\" guard would drop.\n * `beforeunload` is not used: it is unreliable on mobile and costs the\n * back/forward cache.\n *\n * Returns an unbind function. Safe to call outside a browser, where it binds\n * nothing.\n */\nexport function bindPageLifecycleCommit(options) {\n if (typeof document === \"undefined\" || typeof window === \"undefined\") {\n return () => { };\n }\n const commit = (reason) => {\n commitPendingSessions(options.root(), {\n reason,\n logger: options.logger,\n });\n try {\n options.onHidden?.(reason);\n }\n catch (error) {\n options.logger?.warn(\"[bindPageLifecycleCommit] onHidden failed\", error);\n }\n };\n const handleVisibilityChange = () => {\n if (document.visibilityState === \"hidden\")\n commit(\"page-hidden\");\n };\n const handlePageHide = () => {\n commit(\"page-hidden\");\n };\n document.addEventListener(\"visibilitychange\", handleVisibilityChange);\n window.addEventListener(\"pagehide\", handlePageHide);\n return () => {\n document.removeEventListener(\"visibilitychange\", handleVisibilityChange);\n window.removeEventListener(\"pagehide\", handlePageHide);\n };\n}\n","import{ContextProvider as z,FEATURE_DECISION_APPLIED_EVENT as q,itemFeatureDecisionsContext as B}from\"@pie-players/pie-context\";var J=[\"autoplayAudio\"],I=Object.freeze({features:Object.freeze({})});function K(E){let R=E.canonicalItemId||E.itemId;return{level:\"item\",scopeId:R,itemId:E.itemId,canonicalItemId:R}}function P(E,R){if(!R||typeof E?.decideFeaturePolicy!==\"function\")return I;let V={};for(let _ of J){let N=E.decideFeaturePolicy(_,R);if(N.rule===\"none\")continue;V[_]={granted:N.granted,rule:N.rule}}return{features:V}}function Y(E){let R=new z(E,{context:B,initialValue:I});R.connect();let V=JSON.stringify(I.features),_=null,N=null,A=null,G=()=>{let T=P(_,N),M=JSON.stringify(T.features);if(M===V)return;V=M,R.setValue(T)},L=()=>{let T=A;A=null;try{T?.()}catch{}},j=(T)=>{let M=T.detail;if(!M||!N)return;_?.reportFeatureDecisionApplied?.(M,N)};return E.addEventListener(q,j),{setCoordinator(T){if(T===_)return;if(L(),_=T,T&&typeof T.onPolicyChange===\"function\")A=T.onPolicyChange((M)=>{if(M.reason===\"disposed\")L(),_=null;G()});G()},setItem(T){let M=T?.itemId?K(T):null;if(M?.scopeId===N?.scopeId&&M?.itemId===N?.itemId)return;N=M,G()},disconnect(){E.removeEventListener(q,j),L(),_=null,N=null,R.disconnect()}}}var $=\"pie-register\",b=\"pie-unregister\",U=\"pie-item-session-changed\",k=\"item-session-changed\",O=\"pie-content-loaded\",m=\"pie-item-player-error\",S=\"pie-formative-action\",D=\"pie-media-time-source\";var H=(E)=>Array.isArray(E)&&E.length>0;function Q(E){if(E.kind===\"passage\")return{ownerKind:\"passage\",assessmentId:E.assessmentId,sectionId:E.sectionId,passageId:E.canonicalItemId||E.itemId};return{ownerKind:\"itemModel\",assessmentId:E.assessmentId,sectionId:E.sectionId,itemId:E.itemId,canonicalItemId:E.canonicalItemId||E.itemId}}function W(E,R){if(!E)return[];let V=Q(R),_=[];if(H(E.accessibilityCatalogs))_.push({context:V,catalogs:E.accessibilityCatalogs});if(H(E.config?.extractedCatalogs))_.push({context:V,catalogs:E.config.extractedCatalogs});if(R.kind===\"passage\")return _;if(V.ownerKind!==\"itemModel\")return _;for(let N of E.config?.models??[]){if(!H(N.accessibilityCatalogs))continue;_.push({context:{...V,modelId:N.id},catalogs:N.accessibilityCatalogs})}return _}function C(E,R){let V=W(E,{kind:R,itemId:\"\"});try{return JSON.stringify(V.map((_)=>[_.context.modelId??null,_.catalogs]))}catch{return null}}\nexport{J as a,Y as b,$ as c,b as d,U as e,k as f,O as g,m as h,S as i,D as j,Q as k,W as l,C as m};\n"],"ignoreList":[0,1,2],"mappings":";;;;AAKA,IAAaK,IAA8BC,EAAc,OAAO,IAAI,0BAA0B,CAAC,GAMlFC,IAAiC,4BCmCjCC,IAAwB,wBAa/BC,IAAqB,OAAO,IAAI,qCAAqC;AAC3E,SAASC,EAAS,GAAO;CACrB,OAAO,CAAC,CAACC,KAAS,OAAOA,KAAU;AACvC;AAOA,SAASC,EAAqB,GAAS;CAGnC,OAFKC,EAAQ,QAAQ,SAAS,GAAG,IAE1B,aAAaA,KAAW,WAAWA,IAD/B;AAEf;AACA,SAASC,EAAa,GAAM;CAGxB,OAFkBC,GACZ,cACc;AACxB;AACA,SAASC,EAAmB,GAAS;CACjC,IAAMC,IAAOJ;CACb,IAAI,OAAOI,EAAK,oBAAqB,YACjC,OAAO,CAAC;CACZ,IAAI;EACA,OAAOA,EAAK,iBAAiB,EAAE,SAAS,GAAK,CAAC;CAClD,QACM;EACF,OAAO,CAAC;CACZ;AACJ;AAWA,SAASC,EAAkB,GAAM,GAAM,GAAK;CACxC,IAAMC,IAAaL,EAAaM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,IAAEmB,EAAErB,GAAE;EAAC,MAAKD;EAAE,QAAO;CAAE,CAAC;CAAE,IAAG;EAAC,OAAO,KAAK,UAAUG,EAAE,KAAK,MAAI,CAACC,EAAE,QAAQ,WAAS,MAAKA,EAAE,QAAQ,CAAC,CAAC;CAAC,QAAM;EAAC,OAAO;CAAI;AAAC"}
@@ -1,4 +1,4 @@
1
- import { A as e, M as t, N as n, k as r } from "./define-B-ocInH4.js";
1
+ import { A as e, M as t, N as n, k as r } from "./define-mw8BceaY.js";
2
2
  import { g as i, m as a } from "./ItemToolBar-f971t0cw-CwhfViPN.js";
3
3
  import { t as o } from "./object-DzSPF7cw.js";
4
4
  //#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@1.0.0-beta.6/node_modules/@pie-players/pie-assessment-toolkit/dist/components/chunks/ItemToolBar-n05xjkp8.js
@@ -541,4 +541,4 @@ function F(e) {
541
541
  //#endregion
542
542
  export { F as a, f as i, j as n, l as o, h as r, C as s, M as t };
543
543
 
544
- //# sourceMappingURL=ItemToolBar-n05xjkp8-Bb3g018Z.js.map
544
+ //# sourceMappingURL=ItemToolBar-n05xjkp8-ClcjdKVw.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ItemToolBar-n05xjkp8-Bb3g018Z.js","names":["h","P","T","D","f","B","isGlobalDebugEnabled","validateCustomElementTag","settleAll","createPieLogger","MP","LP","isPlainRecord","b","_","q","d","X","$","Q","J","R","V","O","k","C","N","Y","E","w","x","G","L","p","H","W","Z","m","j","U","K","u","F","v","c","y","I","M","Hq","g","A","Wq"],"sources":["../../../node_modules/.bun/@pie-players+pie-assessment-toolkit@1.0.0-beta.6/node_modules/@pie-players/pie-assessment-toolkit/dist/components/chunks/ItemToolBar-n05xjkp8.js"],"sourcesContent":["import{ma as D,na as z}from\"./ItemToolBar-f971t0cw.js\";var S=[\"assessment\",\"section\",\"item\",\"passage\",\"rubric\"],b=new Set(S);function _(q){return b.has(q)}function d(q,J,Q){let X=q.trim(),$=Q.trim();if(!X||!$)throw Error(\"Tool instance ids require non-empty tool and scope ids\");if(!_(J))throw Error(`Unknown tool scope level '${J}'.`);return`${X}:${J}:${$}`}function R(q){let J=q.split(\":\");if(J.length!==3)return null;let[Q,X,$]=J;if(!Q||!$)return null;if(!_(X))return null;return{baseToolId:Q,scopeLevel:X,scopeId:$}}import{createPieLogger as h,isGlobalDebugEnabled as P}from\"@pie-players/pie-players-shared/pie\";var V=h(\"ToolCoordinator\",P),O;(function(q){q[q.BASE=0]=\"BASE\",q[q.TOOL=1000]=\"TOOL\",q[q.MODAL=2000]=\"MODAL\",q[q.CONTROL=3000]=\"CONTROL\",q[q.HIGHLIGHT=4000]=\"HIGHLIGHT\"})(O||(O={}));function k(q,J){if(!J?.baseId)return!0;return(R(q)?.baseToolId??q)===J.baseId}function C(q){return{id:q.id,name:q.name,isVisible:q.isVisible,element:q.element,layer:q.layer}}class N{tools=new Map;listeners=new Set;subscribe(q){return this.listeners.add(q),()=>{this.listeners.delete(q)}}notifyListeners(){for(let q of this.listeners)try{q()}catch(J){console.warn(\"[ToolCoordinator] listener failed:\",J)}}registerTool(q,J,Q,X){V.debug(\"registerTool called:\",{id:q,name:J,hasElement:!!Q,layer:X});let $=this.tools.get(q);if($){$.name=J;let Y=$.registered;if($.registered=!0,X!==void 0&&!$.layerDeclared)$.layer=X,$.layerDeclared=!0,this.stackOnTop($);else if(!Y)this.stackOnTop($)}else $={id:q,name:J,registered:!0,element:null,layer:X??O.TOOL,layerDeclared:X!==void 0,isVisible:!1,baseZIndex:0},this.tools.set(q,$),this.stackOnTop($);if(Q)this.updateToolElement(q,Q)}unregisterTool(q){let J=this.tools.get(q);if(!J?.registered)return;this.detachElement(J),J.registered=!1}releaseTool(q){let J=this.tools.get(q);if(!J)return;if(this.detachElement(J),this.tools.delete(q),J.isVisible)this.notifyListeners()}showTool(q){let J=this.tools.get(q);if(!J){V.debug(`Tool ${q} not found`);return}if(J.element)this.bringToFront(J.element);this.setVisible(J,!0)}hideTool(q){let J=this.tools.get(q);if(!J){V.debug(`Tool ${q} not found`);return}this.setVisible(J,!1)}toggleTool(q){let J=this.tools.get(q);if(!J){V.debug(`Tool ${q} not found`);return}if(J.isVisible)this.hideTool(q);else this.showTool(q)}isToolVisible(q){return this.tools.get(q)?.isVisible??!1}bringToFront(q){let J=Array.from(this.tools.values()).find((Q)=>Q.element===q);if(!J)return;this.stackOnTop(J)}destroy(){let q=Array.from(this.tools.values()).some((J)=>J.isVisible);for(let J of this.tools.values())this.detachElement(J);if(this.tools.clear(),q)this.notifyListeners();this.listeners.clear()}setVisible(q,J){if(q.isVisible===J)return;q.isVisible=J,this.notifyListeners()}detachElement(q){if(q.element&&q.mouseDownHandler)q.element.removeEventListener(\"mousedown\",q.mouseDownHandler);q.element=null,q.mouseDownHandler=void 0}stackOnTop(q){let J=Array.from(this.tools.values()).filter((X)=>X.registered&&X.layer===q.layer&&X!==q).sort((X,$)=>X.baseZIndex-$.baseZIndex),Q=q.layer+J.length+1;if(q.baseZIndex===Q&&J.every((X)=>X.baseZIndex<Q))return;[...J,q].forEach((X,$)=>{if(X.baseZIndex=q.layer+1+$,X.element)X.element.style.zIndex=String(X.baseZIndex)})}updateToolElement(q,J){let Q=this.tools.get(q);if(!Q?.registered){V.debug(`Tool ${q} not found`);return}if(Q.element===J)return;if(Q.element?.isConnected&&Q.element.contains(J))return;this.detachElement(Q);let X=()=>this.bringToFront(J);if(J.addEventListener(\"mousedown\",X),Q.element=J,Q.mouseDownHandler=X,J.style.zIndex=String(Q.baseZIndex),Q.isVisible)this.bringToFront(J)}hideAllTools(q){let J=!1;for(let Q of this.tools.values()){if(!Q.isVisible||!k(Q.id,q))continue;Q.isVisible=!1,J=!0}if(J)this.notifyListeners()}getToolState(q){let J=this.tools.get(q);return J?.registered?C(J):void 0}getVisibleTools(q){return Array.from(this.tools.values()).filter((J)=>J.isVisible&&k(J.id,q)).map(C)}}import{dynamicMessageKey as t}from\"@pie-players/pie-players-shared/i18n/provider\";import{settleAll as f}from\"@pie-players/pie-players-shared/promise\";import{validateCustomElementTag as T}from\"@pie-players/pie-players-shared/pie/tag-names\";var E=(q,J)=>{let Q=J?.toolTagMap?.[q];if(Q===void 0&&!q.includes(\"-\"))throw Error(`No element tag is mapped for tool \"${q}\". Install a tag map on the registry via setComponentOverrides({ toolTagMap }) — for the packaged capabilities, PACKAGED_TOOL_TAG_MAP from \"@pie-players/pie-default-tool-loaders\".`);return T(Q??q,`tool component tag for \"${q}\"`)};var w=(q,J,Q)=>console.error(`[ToolRegistry] Tool '${q}' ${J} check threw:`,Q);var x=[\"assessment\",\"section\",\"item\",\"passage\",\"rubric\",\"element\"];function G(q,J){if(typeof q!==\"string\"||q.trim().length===0)throw Error(`Invalid tool registration: \"${J}\" must be a non-empty string.`)}var L=[{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 p(q,J,Q){let X=J.trimStart(),$=X.toLowerCase().startsWith(\"<svg\"),Y=/^https?:/i.test(X);if(/^data:/i.test(X))throw Error(`Invalid tool registration \"${q}\": \"${Q}\" may not be a data: URL.`);if(!$&&!Y)return;for(let{pattern:H,reason:W}of L)if(H.test(J))throw Error(`Invalid tool registration \"${q}\": \"${Q}\" ${W}. Inline SVG icons must not include scriptable content.`)}function Z(q){G(q.toolId,\"toolId\"),G(q.name,\"name\"),G(q.description,\"description\");let J=q.activation===\"region\";if(!J||q.icon!==void 0){if(typeof q.icon!==\"string\"&&typeof q.icon!==\"function\")throw Error(`Invalid tool registration \"${q.toolId}\": \"icon\" must be a string or function.`)}if(typeof q.icon===\"string\")p(q.toolId,q.icon,\"icon\");if(!Array.isArray(q.supportedLevels)||q.supportedLevels.length===0)throw Error(`Invalid tool registration \"${q.toolId}\": \"supportedLevels\" must be a non-empty array.`);let Q=q.supportedLevels.find((X)=>!x.includes(X));if(Q)throw Error(`Invalid tool registration \"${q.toolId}\": unsupported level \"${Q}\".`);if(q.activation!==void 0&&q.activation!==\"toolbar-toggle\"&&q.activation!==\"selection-gateway\"&&q.activation!==\"region\")throw Error(`Invalid tool registration \"${q.toolId}\": unsupported activation \"${String(q.activation)}\".`);if(q.surfaces!==void 0&&(!Array.isArray(q.surfaces)||q.surfaces.some((X)=>typeof X!==\"string\"||X.trim().length===0)))throw Error(`Invalid tool registration \"${q.toolId}\": \"surfaces\" must be an array of non-empty strings.`);if(J&&!q.surfaces?.length)throw Error(`Invalid tool registration \"${q.toolId}\": region tools must declare at least one host surface in \"surfaces\".`);if(J&&typeof q.renderSurface!==\"function\")throw Error(`Invalid tool registration \"${q.toolId}\": region tools must implement \"renderSurface\".`);if(q.resolvesWithoutGrant!==void 0&&typeof q.resolvesWithoutGrant!==\"boolean\")throw Error(`Invalid tool registration \"${q.toolId}\": \"resolvesWithoutGrant\" must be a boolean.`);if(q.resolvesWithoutGrant&&!q.requiresAuthoredContent)throw Error(`Invalid tool registration \"${q.toolId}\": \"resolvesWithoutGrant\" requires \"requiresAuthoredContent\".`);if(q.renderSurface!==void 0&&typeof q.renderSurface!==\"function\")throw Error(`Invalid tool registration \"${q.toolId}\": \"renderSurface\" must be a function.`);if(q.renderSurface&&!q.surfaces?.length)throw Error(`Invalid tool registration \"${q.toolId}\": \"renderSurface\" requires at least one entry in \"surfaces\".`);if(q.singletonScope!==void 0&&q.singletonScope!==\"section\")throw Error(`Invalid tool registration \"${q.toolId}\": unsupported singletonScope \"${String(q.singletonScope)}\".`);if(q.activation===\"selection-gateway\"&&q.singletonScope!==\"section\")throw Error(`Invalid tool registration \"${q.toolId}\": selection-gateway tools must declare singletonScope \"section\".`);if(q.activation!==\"region\"&&typeof q.isVisibleInContext!==\"function\")throw Error(`Invalid tool registration \"${q.toolId}\": \"isVisibleInContext\" must be a function.`);if(q.isVisibleInContext!==void 0&&typeof q.isVisibleInContext!==\"function\")throw Error(`Invalid tool registration \"${q.toolId}\": \"isVisibleInContext\" must be a function when present.`);if(q.isApplicableToContent!==void 0&&typeof q.isApplicableToContent!==\"function\")throw Error(`Invalid tool registration \"${q.toolId}\": \"isApplicableToContent\" must be a function when present.`);if(q.requiresAuthoredContent!==void 0){if(typeof q.requiresAuthoredContent!==\"object\"||q.requiresAuthoredContent===null||typeof q.requiresAuthoredContent.resolve!==\"function\")throw Error(`Invalid tool registration \"${q.toolId}\": \"requiresAuthoredContent\" must be an object with a \"resolve\" function.`)}if(q.renderToolbar!==void 0){if(typeof q.renderToolbar!==\"function\")throw Error(`Invalid tool registration \"${q.toolId}\": \"renderToolbar\" must be a function.`)}else if(!J)throw Error(`Invalid tool registration \"${q.toolId}\": \"renderToolbar\" must be a function.`)}class m{tools=new Map;componentOverrides={};watchedUndefinedToolElements=new Set;moduleLoaders=new Map;loadedToolModules=new Set;warnedLoaderReplacements=new Set;warnedUnregisteredAllowedTools=new Set;moduleLoadPromises=new Map;changeListeners=new Set;emitChange(q){for(let J of this.changeListeners)try{J(q)}catch(Q){console.warn(\"[ToolRegistry] change listener failed:\",Q)}}onRegistryChange(q){this.changeListeners.add(q);let J=!0;return()=>{if(!J)return;J=!1,this.changeListeners.delete(q)}}normalizeToolId(q){return q.trim()}normalizeToolIds(q){return q.map((J)=>this.normalizeToolId(J))}register(q){if(Z(q),this.tools.has(q.toolId))throw Error(`Tool '${q.toolId}' is already registered`);this.tools.set(q.toolId,q),this.emitChange({kind:\"register\",toolIds:[q.toolId]})}override(q){if(Z(q),!this.tools.has(q.toolId))throw Error(`Cannot override non-existent tool '${q.toolId}'`);this.tools.set(q.toolId,q),this.emitChange({kind:\"override\",toolIds:[q.toolId]})}unregister(q){if(!this.tools.has(q))return;this.tools.delete(q),this.emitChange({kind:\"unregister\",toolIds:[q]})}get(q){return this.tools.get(q)}has(q){return this.tools.has(q)}getAllToolIds(){return Array.from(this.tools.keys())}getAllTools(){return Array.from(this.tools.values())}getToolsByLevel(q){return this.getAllTools().filter((J)=>J.supportedLevels.includes(q))}getToolActivation(q){return this.get(q)?.activation||\"toolbar-toggle\"}getToolSingletonScope(q){return this.get(q)?.singletonScope||null}getToolsBySurface(q){if(!q)return[];return this.getAllTools().filter((J)=>typeof J.renderSurface===\"function\"&&J.surfaces?.includes(q))}getContentDependentSupportIds(){return this.getAllTools().filter((q)=>q.requiresAuthoredContent).map((q)=>q.toolId).sort()}filterToolIdsByActivation(q,J){return q.filter((Q)=>this.getToolActivation(Q)===J)}filterVisibleInContext(q,J,Q=w){let X=[];for(let $ of q){let Y=this.get($);if(!Y){if(!this.warnedUnregisteredAllowedTools.has($))this.warnedUnregisteredAllowedTools.add($),console.warn(`Tool '${$}' is allowed but not registered`);continue}if(!Y.supportedLevels.includes(J.level))continue;try{if(Y.isVisibleInContext?.(J))X.push(Y)}catch(j){Q($,\"tool-visibility\",j)}}return X}isApplicableToAnyContext(q,J,Q=w){let X=this.get(q);if(!X?.isApplicableToContent)return!0;if(J.length===0)return!0;return J.some(($)=>{try{return X.isApplicableToContent?.($)??!0}catch(Y){return Q(q,\"tool-applicability\",Y),!0}})}filterDecidedToolIds(q,J,Q,X=w){let $=new Set,Y=[];for(let H of q){let W=this.normalizeToolId(H.toolId);if(!W)continue;if(H.required||H.alwaysAvailable)$.add(W);if(Y.includes(W))continue;if(!this.get(W)?.supportedLevels.includes(J))continue;Y.push(W)}if(J===\"section\")return Y;let j=new Set(Q.length===0?Y:Y.filter((H)=>$.has(H)));for(let H of Q){let W=Y.filter((U)=>!j.has(U));for(let U of this.filterVisibleInContext(W,H,X))j.add(U.toolId)}return Y.filter((H)=>j.has(H)&&this.isApplicableToAnyContext(H,Q,X))}getToolMetadata(){return this.getAllTools().map((q)=>({toolId:q.toolId,name:q.name,description:q.description,supportedLevels:q.supportedLevels,activation:q.activation||\"toolbar-toggle\",singletonScope:q.singletonScope||null,surfaces:q.surfaces||[],requiresAuthoredContent:Boolean(q.requiresAuthoredContent),contentDependencyDescription:q.requiresAuthoredContent?.description??null}))}clear(){let q=this.getAllToolIds();if(q.length===0)return;this.tools.clear(),this.emitChange({kind:\"clear\",toolIds:q})}setComponentOverrides(q){if(this.componentOverrides===q)return;this.componentOverrides=q,this.emitChange({kind:\"component-overrides\",toolIds:[]})}setToolModuleLoaders(q){let J=Object.entries(q).filter((X)=>X[1]!==void 0);for(let[X,$]of J)if(G(X,\"tool module loader id\"),typeof $!==\"function\")throw Error(`Invalid tool module loader for \"${X}\": expected a function.`);let Q=[];for(let[X,$]of J){if(this.moduleLoaders.get(X)===$)continue;if(this.loadedToolModules.has(X)||this.moduleLoadPromises.has(X)){this.warnLoaderReplacedAfterLoad(X);continue}this.moduleLoaders.set(X,$),Q.push(X)}if(Q.length>0)this.emitChange({kind:\"module-loaders\",toolIds:Q})}warnLoaderReplacedAfterLoad(q){if(this.warnedLoaderReplacements.has(q))return;this.warnedLoaderReplacements.add(q),console.warn(`[ToolRegistry] Ignored a new module loader for \"${q}\": its module already loaded, so the elements it defines stay in place. Register loaders before the tool first renders.`)}async ensureToolModuleLoaded(q){if(this.loadedToolModules.has(q))return;let J=this.moduleLoadPromises.get(q);if(J){await J;return}let Q=this.moduleLoaders.get(q);if(!Q){this.watchUndefinedToolElement(q);return}let X=(async()=>{await Q(),this.loadedToolModules.add(q),this.warnIfLoadedToolElementUndefined(q)})();this.moduleLoadPromises.set(q,X);try{await X}finally{this.moduleLoadPromises.delete(q)}}undefinedToolElementTag(q){if(typeof customElements>\"u\"||typeof document>\"u\")return null;let J=this.componentOverrides;if(J.toolComponentFactories?.[q])return null;let Q;try{Q=E(q,J)}catch{return null}return customElements.get(Q)?null:Q}warnIfLoadedToolElementUndefined(q){let J=this.undefinedToolElementTag(q);if(!J)return;z(document,`loadedToolElementUndefined.${q}.${J}`,`[ToolRegistry] Tool \"${q}\" renders <${J}>, but its module loader finished without defining it, so the tool renders blank. The tag map and the loader disagree: map \"${q}\" to the tag its loader defines, or register a loader that defines <${J}>. Reported once per page.`)}watchUndefinedToolElement(q){if(this.watchedUndefinedToolElements.has(q))return;let J=this.undefinedToolElementTag(q);if(!J)return;this.watchedUndefinedToolElements.add(q);let Q=document,X=setTimeout(()=>{if(customElements.get(J))return;z(Q,`undefinedToolElement.${q}`,`[ToolRegistry] Tool \"${q}\" renders <${J}>, which is still undefined after ${D/1000} s, and its registry has no module loader for it. Register one with setToolModuleLoaders or import the tool's package before it renders; a registry from createPackagedToolRegistry has the packaged loaders unless its toolModuleLoaders replaced them. Reported once per page.`)},D);customElements.whenDefined(J).then(()=>clearTimeout(X))}async ensureToolModulesLoaded(q){let J=await f(q.map((X)=>this.ensureToolModuleLoaded(X))),Q=new Map;return J.forEach((X,$)=>{if(X.status===\"rejected\")Q.set(q[$],X.reason)}),Q}isToolModuleLoaded(q){return this.loadedToolModules.has(q)}renderForToolbar(q,J,Q){let X=this.get(q);if(!X)throw Error(`Tool '${q}' is not registered`);if(typeof X.renderToolbar!==\"function\")throw Error(`Tool '${q}' has activation \"${X.activation||\"toolbar-toggle\"}\" and renders into a host surface, not a toolbar. Remove it from toolbar placement.`);let $={...Q,componentOverrides:this.mergeComponentOverrides(Q.componentOverrides)};return X.renderToolbar(J,$)}renderForSurface(q,J){let Q=this.get(q);if(!Q)throw Error(`Tool '${q}' is not registered`);if(typeof Q.renderSurface!==\"function\")throw Error(`Tool '${q}' does not render into a host surface. Surface capabilities declare \"surfaces\" and implement \"renderSurface\".`);return Q.renderSurface({...J,componentOverrides:this.mergeComponentOverrides(J.componentOverrides)})}mergeComponentOverrides(q){return{...this.componentOverrides||{},...q||{}}}}var K={assessment:[],section:[],item:[],passage:[],rubric:[],element:[]};import{isPlainRecord as B}from\"@pie-players/pie-players-shared/object\";var u={section:[...K.section],item:[...K.item],passage:[...K.passage]};function F(q,J){if(q==null)return[];if(!Array.isArray(q))throw Error(`Invalid tools config at \"${J}\": expected an array of tool ids.`);if(q.find((X)=>typeof X!==\"string\")!==void 0)throw Error(`Invalid tools config at \"${J}\": all entries must be strings.`);return q}function v(q){if(q==null)return;if(!B(q))throw Error('Invalid tools config at \"placement\": expected an object with section/item/passage arrays.');return q}function c(q){if(q==null)return;if(!B(q))throw Error('Invalid tools config at \"policy\": expected an object with allowed/blocked arrays.');return q}function y(q,J){if(J==null)return;if(!B(J))throw Error(`Invalid tools config at \"providers.${q}\": expected an object.`);let Q=J;if(\"enabled\"in Q&&Q.enabled!==void 0&&typeof Q.enabled!==\"boolean\")throw Error(`Invalid tools config at \"providers.${q}.enabled\": expected a boolean.`);if(\"settings\"in Q&&Q.settings!==void 0&&!B(Q.settings))throw Error(`Invalid tools config at \"providers.${q}.settings\": expected an object.`);if(\"provider\"in Q&&Q.provider!==void 0&&!B(Q.provider))throw Error(`Invalid tools config at \"providers.${q}.provider\": expected an object.`);return Q}function I(q){if(q==null)return{};if(!B(q))throw Error('Invalid tools config at \"providers\": expected an object keyed by tool id.');let J={};for(let[Q,X]of Object.entries(q))J[Q]=y(Q,X);return J}function M(q){if(!q||q.length===0)return[];let J=new Set;for(let Q of q){if(typeof Q!==\"string\")throw Error(\"Invalid tools config: tool list entries must be strings.\");let X=Q.trim();if(!X)continue;J.add(X)}return Array.from(J)}function Hq(q){if(!q)return[];return M(q.split(\",\").map((J)=>J.trim()).filter(Boolean))}function g(q,J){if(q==null)return;if(q===\"on\"||q===\"off\")return q;throw Error(`Invalid tools config at \"${J}\": expected \"on\" or \"off\", got ${JSON.stringify(q)}.`)}function A(q,J){let Q=M(F(q?.[J],`placement.${J}`));return Q.length?Q:[...u[J]]}function Wq(q){if(q!=null&&!B(q))throw Error('Invalid tools config: expected an object with \"policy\", \"placement\", and \"providers\".');let J=c(q?.policy),Q=v(q?.placement),X=I(q?.providers),$=g(q?.pnpEnforcement,\"pnpEnforcement\"),Y={policy:{allowed:M(F(J?.allowed,\"policy.allowed\")),blocked:M(F(J?.blocked,\"policy.blocked\"))},placement:{section:A(Q,\"section\"),item:A(Q,\"item\"),passage:A(Q,\"passage\")},providers:X};if($)Y.pnpEnforcement=$;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B,EAAE/B,GAAE,SAAS;GAAE,MAAK+B,EAAE/B,GAAE,MAAM;GAAE,SAAQ+B,EAAE/B,GAAE,SAAS;EAAC;EAAE,WAAUF;CAAC;CAA0B,OAArBC,MAAE,EAAE,iBAAeA,IAASS;AAAC"}
1
+ {"version":3,"file":"ItemToolBar-n05xjkp8-ClcjdKVw.js","names":["h","P","T","D","f","B","isGlobalDebugEnabled","validateCustomElementTag","settleAll","createPieLogger","MP","LP","isPlainRecord","b","_","q","d","X","$","Q","J","R","V","O","k","C","N","Y","E","w","x","G","L","p","H","W","Z","m","j","U","K","u","F","v","c","y","I","M","Hq","g","A","Wq"],"sources":["../../../node_modules/.bun/@pie-players+pie-assessment-toolkit@1.0.0-beta.6/node_modules/@pie-players/pie-assessment-toolkit/dist/components/chunks/ItemToolBar-n05xjkp8.js"],"sourcesContent":["import{ma as D,na as z}from\"./ItemToolBar-f971t0cw.js\";var S=[\"assessment\",\"section\",\"item\",\"passage\",\"rubric\"],b=new Set(S);function _(q){return b.has(q)}function d(q,J,Q){let X=q.trim(),$=Q.trim();if(!X||!$)throw Error(\"Tool instance ids require non-empty tool and scope ids\");if(!_(J))throw Error(`Unknown tool scope level '${J}'.`);return`${X}:${J}:${$}`}function R(q){let J=q.split(\":\");if(J.length!==3)return null;let[Q,X,$]=J;if(!Q||!$)return null;if(!_(X))return null;return{baseToolId:Q,scopeLevel:X,scopeId:$}}import{createPieLogger as h,isGlobalDebugEnabled as P}from\"@pie-players/pie-players-shared/pie\";var V=h(\"ToolCoordinator\",P),O;(function(q){q[q.BASE=0]=\"BASE\",q[q.TOOL=1000]=\"TOOL\",q[q.MODAL=2000]=\"MODAL\",q[q.CONTROL=3000]=\"CONTROL\",q[q.HIGHLIGHT=4000]=\"HIGHLIGHT\"})(O||(O={}));function k(q,J){if(!J?.baseId)return!0;return(R(q)?.baseToolId??q)===J.baseId}function C(q){return{id:q.id,name:q.name,isVisible:q.isVisible,element:q.element,layer:q.layer}}class N{tools=new Map;listeners=new Set;subscribe(q){return this.listeners.add(q),()=>{this.listeners.delete(q)}}notifyListeners(){for(let q of this.listeners)try{q()}catch(J){console.warn(\"[ToolCoordinator] listener failed:\",J)}}registerTool(q,J,Q,X){V.debug(\"registerTool called:\",{id:q,name:J,hasElement:!!Q,layer:X});let $=this.tools.get(q);if($){$.name=J;let Y=$.registered;if($.registered=!0,X!==void 0&&!$.layerDeclared)$.layer=X,$.layerDeclared=!0,this.stackOnTop($);else if(!Y)this.stackOnTop($)}else $={id:q,name:J,registered:!0,element:null,layer:X??O.TOOL,layerDeclared:X!==void 0,isVisible:!1,baseZIndex:0},this.tools.set(q,$),this.stackOnTop($);if(Q)this.updateToolElement(q,Q)}unregisterTool(q){let J=this.tools.get(q);if(!J?.registered)return;this.detachElement(J),J.registered=!1}releaseTool(q){let J=this.tools.get(q);if(!J)return;if(this.detachElement(J),this.tools.delete(q),J.isVisible)this.notifyListeners()}showTool(q){let J=this.tools.get(q);if(!J){V.debug(`Tool ${q} not found`);return}if(J.element)this.bringToFront(J.element);this.setVisible(J,!0)}hideTool(q){let J=this.tools.get(q);if(!J){V.debug(`Tool ${q} not found`);return}this.setVisible(J,!1)}toggleTool(q){let J=this.tools.get(q);if(!J){V.debug(`Tool ${q} not found`);return}if(J.isVisible)this.hideTool(q);else this.showTool(q)}isToolVisible(q){return this.tools.get(q)?.isVisible??!1}bringToFront(q){let J=Array.from(this.tools.values()).find((Q)=>Q.element===q);if(!J)return;this.stackOnTop(J)}destroy(){let q=Array.from(this.tools.values()).some((J)=>J.isVisible);for(let J of this.tools.values())this.detachElement(J);if(this.tools.clear(),q)this.notifyListeners();this.listeners.clear()}setVisible(q,J){if(q.isVisible===J)return;q.isVisible=J,this.notifyListeners()}detachElement(q){if(q.element&&q.mouseDownHandler)q.element.removeEventListener(\"mousedown\",q.mouseDownHandler);q.element=null,q.mouseDownHandler=void 0}stackOnTop(q){let J=Array.from(this.tools.values()).filter((X)=>X.registered&&X.layer===q.layer&&X!==q).sort((X,$)=>X.baseZIndex-$.baseZIndex),Q=q.layer+J.length+1;if(q.baseZIndex===Q&&J.every((X)=>X.baseZIndex<Q))return;[...J,q].forEach((X,$)=>{if(X.baseZIndex=q.layer+1+$,X.element)X.element.style.zIndex=String(X.baseZIndex)})}updateToolElement(q,J){let Q=this.tools.get(q);if(!Q?.registered){V.debug(`Tool ${q} not found`);return}if(Q.element===J)return;if(Q.element?.isConnected&&Q.element.contains(J))return;this.detachElement(Q);let X=()=>this.bringToFront(J);if(J.addEventListener(\"mousedown\",X),Q.element=J,Q.mouseDownHandler=X,J.style.zIndex=String(Q.baseZIndex),Q.isVisible)this.bringToFront(J)}hideAllTools(q){let J=!1;for(let Q of this.tools.values()){if(!Q.isVisible||!k(Q.id,q))continue;Q.isVisible=!1,J=!0}if(J)this.notifyListeners()}getToolState(q){let J=this.tools.get(q);return J?.registered?C(J):void 0}getVisibleTools(q){return Array.from(this.tools.values()).filter((J)=>J.isVisible&&k(J.id,q)).map(C)}}import{dynamicMessageKey as t}from\"@pie-players/pie-players-shared/i18n/provider\";import{settleAll as f}from\"@pie-players/pie-players-shared/promise\";import{validateCustomElementTag as T}from\"@pie-players/pie-players-shared/pie/tag-names\";var E=(q,J)=>{let Q=J?.toolTagMap?.[q];if(Q===void 0&&!q.includes(\"-\"))throw Error(`No element tag is mapped for tool \"${q}\". Install a tag map on the registry via setComponentOverrides({ toolTagMap }) — for the packaged capabilities, PACKAGED_TOOL_TAG_MAP from \"@pie-players/pie-default-tool-loaders\".`);return T(Q??q,`tool component tag for \"${q}\"`)};var w=(q,J,Q)=>console.error(`[ToolRegistry] Tool '${q}' ${J} check threw:`,Q);var x=[\"assessment\",\"section\",\"item\",\"passage\",\"rubric\",\"element\"];function G(q,J){if(typeof q!==\"string\"||q.trim().length===0)throw Error(`Invalid tool registration: \"${J}\" must be a non-empty string.`)}var L=[{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 p(q,J,Q){let X=J.trimStart(),$=X.toLowerCase().startsWith(\"<svg\"),Y=/^https?:/i.test(X);if(/^data:/i.test(X))throw Error(`Invalid tool registration \"${q}\": \"${Q}\" may not be a data: URL.`);if(!$&&!Y)return;for(let{pattern:H,reason:W}of L)if(H.test(J))throw Error(`Invalid tool registration \"${q}\": \"${Q}\" ${W}. Inline SVG icons must not include scriptable content.`)}function Z(q){G(q.toolId,\"toolId\"),G(q.name,\"name\"),G(q.description,\"description\");let J=q.activation===\"region\";if(!J||q.icon!==void 0){if(typeof q.icon!==\"string\"&&typeof q.icon!==\"function\")throw Error(`Invalid tool registration \"${q.toolId}\": \"icon\" must be a string or function.`)}if(typeof q.icon===\"string\")p(q.toolId,q.icon,\"icon\");if(!Array.isArray(q.supportedLevels)||q.supportedLevels.length===0)throw Error(`Invalid tool registration \"${q.toolId}\": \"supportedLevels\" must be a non-empty array.`);let Q=q.supportedLevels.find((X)=>!x.includes(X));if(Q)throw Error(`Invalid tool registration \"${q.toolId}\": unsupported level \"${Q}\".`);if(q.activation!==void 0&&q.activation!==\"toolbar-toggle\"&&q.activation!==\"selection-gateway\"&&q.activation!==\"region\")throw Error(`Invalid tool registration \"${q.toolId}\": unsupported activation \"${String(q.activation)}\".`);if(q.surfaces!==void 0&&(!Array.isArray(q.surfaces)||q.surfaces.some((X)=>typeof X!==\"string\"||X.trim().length===0)))throw Error(`Invalid tool registration \"${q.toolId}\": \"surfaces\" must be an array of non-empty strings.`);if(J&&!q.surfaces?.length)throw Error(`Invalid tool registration \"${q.toolId}\": region tools must declare at least one host surface in \"surfaces\".`);if(J&&typeof q.renderSurface!==\"function\")throw Error(`Invalid tool registration \"${q.toolId}\": region tools must implement \"renderSurface\".`);if(q.resolvesWithoutGrant!==void 0&&typeof q.resolvesWithoutGrant!==\"boolean\")throw Error(`Invalid tool registration \"${q.toolId}\": \"resolvesWithoutGrant\" must be a boolean.`);if(q.resolvesWithoutGrant&&!q.requiresAuthoredContent)throw Error(`Invalid tool registration \"${q.toolId}\": \"resolvesWithoutGrant\" requires \"requiresAuthoredContent\".`);if(q.renderSurface!==void 0&&typeof q.renderSurface!==\"function\")throw Error(`Invalid tool registration \"${q.toolId}\": \"renderSurface\" must be a function.`);if(q.renderSurface&&!q.surfaces?.length)throw Error(`Invalid tool registration \"${q.toolId}\": \"renderSurface\" requires at least one entry in \"surfaces\".`);if(q.singletonScope!==void 0&&q.singletonScope!==\"section\")throw Error(`Invalid tool registration \"${q.toolId}\": unsupported singletonScope \"${String(q.singletonScope)}\".`);if(q.activation===\"selection-gateway\"&&q.singletonScope!==\"section\")throw Error(`Invalid tool registration \"${q.toolId}\": selection-gateway tools must declare singletonScope \"section\".`);if(q.activation!==\"region\"&&typeof q.isVisibleInContext!==\"function\")throw Error(`Invalid tool registration \"${q.toolId}\": \"isVisibleInContext\" must be a function.`);if(q.isVisibleInContext!==void 0&&typeof q.isVisibleInContext!==\"function\")throw Error(`Invalid tool registration \"${q.toolId}\": \"isVisibleInContext\" must be a function when present.`);if(q.isApplicableToContent!==void 0&&typeof q.isApplicableToContent!==\"function\")throw Error(`Invalid tool registration \"${q.toolId}\": \"isApplicableToContent\" must be a function when present.`);if(q.requiresAuthoredContent!==void 0){if(typeof q.requiresAuthoredContent!==\"object\"||q.requiresAuthoredContent===null||typeof q.requiresAuthoredContent.resolve!==\"function\")throw Error(`Invalid tool registration \"${q.toolId}\": \"requiresAuthoredContent\" must be an object with a \"resolve\" function.`)}if(q.renderToolbar!==void 0){if(typeof q.renderToolbar!==\"function\")throw Error(`Invalid tool registration \"${q.toolId}\": \"renderToolbar\" must be a function.`)}else if(!J)throw Error(`Invalid tool registration \"${q.toolId}\": \"renderToolbar\" must be a function.`)}class m{tools=new Map;componentOverrides={};watchedUndefinedToolElements=new Set;moduleLoaders=new Map;loadedToolModules=new Set;warnedLoaderReplacements=new Set;warnedUnregisteredAllowedTools=new Set;moduleLoadPromises=new Map;changeListeners=new Set;emitChange(q){for(let J of this.changeListeners)try{J(q)}catch(Q){console.warn(\"[ToolRegistry] change listener failed:\",Q)}}onRegistryChange(q){this.changeListeners.add(q);let J=!0;return()=>{if(!J)return;J=!1,this.changeListeners.delete(q)}}normalizeToolId(q){return q.trim()}normalizeToolIds(q){return q.map((J)=>this.normalizeToolId(J))}register(q){if(Z(q),this.tools.has(q.toolId))throw Error(`Tool '${q.toolId}' is already registered`);this.tools.set(q.toolId,q),this.emitChange({kind:\"register\",toolIds:[q.toolId]})}override(q){if(Z(q),!this.tools.has(q.toolId))throw Error(`Cannot override non-existent tool '${q.toolId}'`);this.tools.set(q.toolId,q),this.emitChange({kind:\"override\",toolIds:[q.toolId]})}unregister(q){if(!this.tools.has(q))return;this.tools.delete(q),this.emitChange({kind:\"unregister\",toolIds:[q]})}get(q){return this.tools.get(q)}has(q){return this.tools.has(q)}getAllToolIds(){return Array.from(this.tools.keys())}getAllTools(){return Array.from(this.tools.values())}getToolsByLevel(q){return this.getAllTools().filter((J)=>J.supportedLevels.includes(q))}getToolActivation(q){return this.get(q)?.activation||\"toolbar-toggle\"}getToolSingletonScope(q){return this.get(q)?.singletonScope||null}getToolsBySurface(q){if(!q)return[];return this.getAllTools().filter((J)=>typeof J.renderSurface===\"function\"&&J.surfaces?.includes(q))}getContentDependentSupportIds(){return this.getAllTools().filter((q)=>q.requiresAuthoredContent).map((q)=>q.toolId).sort()}filterToolIdsByActivation(q,J){return q.filter((Q)=>this.getToolActivation(Q)===J)}filterVisibleInContext(q,J,Q=w){let X=[];for(let $ of q){let Y=this.get($);if(!Y){if(!this.warnedUnregisteredAllowedTools.has($))this.warnedUnregisteredAllowedTools.add($),console.warn(`Tool '${$}' is allowed but not registered`);continue}if(!Y.supportedLevels.includes(J.level))continue;try{if(Y.isVisibleInContext?.(J))X.push(Y)}catch(j){Q($,\"tool-visibility\",j)}}return X}isApplicableToAnyContext(q,J,Q=w){let X=this.get(q);if(!X?.isApplicableToContent)return!0;if(J.length===0)return!0;return J.some(($)=>{try{return X.isApplicableToContent?.($)??!0}catch(Y){return Q(q,\"tool-applicability\",Y),!0}})}filterDecidedToolIds(q,J,Q,X=w){let $=new Set,Y=[];for(let H of q){let W=this.normalizeToolId(H.toolId);if(!W)continue;if(H.required||H.alwaysAvailable)$.add(W);if(Y.includes(W))continue;if(!this.get(W)?.supportedLevels.includes(J))continue;Y.push(W)}if(J===\"section\")return Y;let j=new Set(Q.length===0?Y:Y.filter((H)=>$.has(H)));for(let H of Q){let W=Y.filter((U)=>!j.has(U));for(let U of this.filterVisibleInContext(W,H,X))j.add(U.toolId)}return Y.filter((H)=>j.has(H)&&this.isApplicableToAnyContext(H,Q,X))}getToolMetadata(){return this.getAllTools().map((q)=>({toolId:q.toolId,name:q.name,description:q.description,supportedLevels:q.supportedLevels,activation:q.activation||\"toolbar-toggle\",singletonScope:q.singletonScope||null,surfaces:q.surfaces||[],requiresAuthoredContent:Boolean(q.requiresAuthoredContent),contentDependencyDescription:q.requiresAuthoredContent?.description??null}))}clear(){let q=this.getAllToolIds();if(q.length===0)return;this.tools.clear(),this.emitChange({kind:\"clear\",toolIds:q})}setComponentOverrides(q){if(this.componentOverrides===q)return;this.componentOverrides=q,this.emitChange({kind:\"component-overrides\",toolIds:[]})}setToolModuleLoaders(q){let J=Object.entries(q).filter((X)=>X[1]!==void 0);for(let[X,$]of J)if(G(X,\"tool module loader id\"),typeof $!==\"function\")throw Error(`Invalid tool module loader for \"${X}\": expected a function.`);let Q=[];for(let[X,$]of J){if(this.moduleLoaders.get(X)===$)continue;if(this.loadedToolModules.has(X)||this.moduleLoadPromises.has(X)){this.warnLoaderReplacedAfterLoad(X);continue}this.moduleLoaders.set(X,$),Q.push(X)}if(Q.length>0)this.emitChange({kind:\"module-loaders\",toolIds:Q})}warnLoaderReplacedAfterLoad(q){if(this.warnedLoaderReplacements.has(q))return;this.warnedLoaderReplacements.add(q),console.warn(`[ToolRegistry] Ignored a new module loader for \"${q}\": its module already loaded, so the elements it defines stay in place. Register loaders before the tool first renders.`)}async ensureToolModuleLoaded(q){if(this.loadedToolModules.has(q))return;let J=this.moduleLoadPromises.get(q);if(J){await J;return}let Q=this.moduleLoaders.get(q);if(!Q){this.watchUndefinedToolElement(q);return}let X=(async()=>{await Q(),this.loadedToolModules.add(q),this.warnIfLoadedToolElementUndefined(q)})();this.moduleLoadPromises.set(q,X);try{await X}finally{this.moduleLoadPromises.delete(q)}}undefinedToolElementTag(q){if(typeof customElements>\"u\"||typeof document>\"u\")return null;let J=this.componentOverrides;if(J.toolComponentFactories?.[q])return null;let Q;try{Q=E(q,J)}catch{return null}return customElements.get(Q)?null:Q}warnIfLoadedToolElementUndefined(q){let J=this.undefinedToolElementTag(q);if(!J)return;z(document,`loadedToolElementUndefined.${q}.${J}`,`[ToolRegistry] Tool \"${q}\" renders <${J}>, but its module loader finished without defining it, so the tool renders blank. The tag map and the loader disagree: map \"${q}\" to the tag its loader defines, or register a loader that defines <${J}>. Reported once per page.`)}watchUndefinedToolElement(q){if(this.watchedUndefinedToolElements.has(q))return;let J=this.undefinedToolElementTag(q);if(!J)return;this.watchedUndefinedToolElements.add(q);let Q=document,X=setTimeout(()=>{if(customElements.get(J))return;z(Q,`undefinedToolElement.${q}`,`[ToolRegistry] Tool \"${q}\" renders <${J}>, which is still undefined after ${D/1000} s, and its registry has no module loader for it. Register one with setToolModuleLoaders or import the tool's package before it renders; a registry from createPackagedToolRegistry has the packaged loaders unless its toolModuleLoaders replaced them. Reported once per page.`)},D);customElements.whenDefined(J).then(()=>clearTimeout(X))}async ensureToolModulesLoaded(q){let J=await f(q.map((X)=>this.ensureToolModuleLoaded(X))),Q=new Map;return J.forEach((X,$)=>{if(X.status===\"rejected\")Q.set(q[$],X.reason)}),Q}isToolModuleLoaded(q){return this.loadedToolModules.has(q)}renderForToolbar(q,J,Q){let X=this.get(q);if(!X)throw Error(`Tool '${q}' is not registered`);if(typeof X.renderToolbar!==\"function\")throw Error(`Tool '${q}' has activation \"${X.activation||\"toolbar-toggle\"}\" and renders into a host surface, not a toolbar. Remove it from toolbar placement.`);let $={...Q,componentOverrides:this.mergeComponentOverrides(Q.componentOverrides)};return X.renderToolbar(J,$)}renderForSurface(q,J){let Q=this.get(q);if(!Q)throw Error(`Tool '${q}' is not registered`);if(typeof Q.renderSurface!==\"function\")throw Error(`Tool '${q}' does not render into a host surface. Surface capabilities declare \"surfaces\" and implement \"renderSurface\".`);return Q.renderSurface({...J,componentOverrides:this.mergeComponentOverrides(J.componentOverrides)})}mergeComponentOverrides(q){return{...this.componentOverrides||{},...q||{}}}}var K={assessment:[],section:[],item:[],passage:[],rubric:[],element:[]};import{isPlainRecord as B}from\"@pie-players/pie-players-shared/object\";var u={section:[...K.section],item:[...K.item],passage:[...K.passage]};function F(q,J){if(q==null)return[];if(!Array.isArray(q))throw Error(`Invalid tools config at \"${J}\": expected an array of tool ids.`);if(q.find((X)=>typeof X!==\"string\")!==void 0)throw Error(`Invalid tools config at \"${J}\": all entries must be strings.`);return q}function v(q){if(q==null)return;if(!B(q))throw Error('Invalid tools config at \"placement\": expected an object with section/item/passage arrays.');return q}function c(q){if(q==null)return;if(!B(q))throw Error('Invalid tools config at \"policy\": expected an object with allowed/blocked arrays.');return q}function y(q,J){if(J==null)return;if(!B(J))throw Error(`Invalid tools config at \"providers.${q}\": expected an object.`);let Q=J;if(\"enabled\"in Q&&Q.enabled!==void 0&&typeof Q.enabled!==\"boolean\")throw Error(`Invalid tools config at \"providers.${q}.enabled\": expected a boolean.`);if(\"settings\"in Q&&Q.settings!==void 0&&!B(Q.settings))throw Error(`Invalid tools config at \"providers.${q}.settings\": expected an object.`);if(\"provider\"in Q&&Q.provider!==void 0&&!B(Q.provider))throw Error(`Invalid tools config at \"providers.${q}.provider\": expected an object.`);return Q}function I(q){if(q==null)return{};if(!B(q))throw Error('Invalid tools config at \"providers\": expected an object keyed by tool id.');let J={};for(let[Q,X]of Object.entries(q))J[Q]=y(Q,X);return J}function M(q){if(!q||q.length===0)return[];let J=new Set;for(let Q of q){if(typeof Q!==\"string\")throw Error(\"Invalid tools config: tool list entries must be strings.\");let X=Q.trim();if(!X)continue;J.add(X)}return Array.from(J)}function Hq(q){if(!q)return[];return M(q.split(\",\").map((J)=>J.trim()).filter(Boolean))}function g(q,J){if(q==null)return;if(q===\"on\"||q===\"off\")return q;throw Error(`Invalid tools config at \"${J}\": expected \"on\" or \"off\", got ${JSON.stringify(q)}.`)}function A(q,J){let Q=M(F(q?.[J],`placement.${J}`));return Q.length?Q:[...u[J]]}function Wq(q){if(q!=null&&!B(q))throw Error('Invalid tools config: expected an object with \"policy\", \"placement\", and \"providers\".');let J=c(q?.policy),Q=v(q?.placement),X=I(q?.providers),$=g(q?.pnpEnforcement,\"pnpEnforcement\"),Y={policy:{allowed:M(F(J?.allowed,\"policy.allowed\")),blocked:M(F(J?.blocked,\"policy.blocked\"))},placement:{section:A(Q,\"section\"),item:A(Q,\"item\"),passage:A(Q,\"passage\")},providers:X};if($)Y.pnpEnforcement=$;return Y}\nexport{d as o,O as p,N as q,m as r,M as s,Hq as t,Wq as u};\n"],"ignoreList":[0],"mappings":";;;;AAAuD,IAAyDa,oBAAE,IAAI,IAAI;CAA5D;CAAa;CAAU;CAAO;CAAU;AAAoB,CAAC;AAAE,SAASC,EAAE,GAAE;CAAC,OAAOD,EAAE,IAAIE,CAAC;AAAC;AAAC,SAASC,EAAE,GAAE,GAAE,GAAE;CAAC,IAAIC,IAAEF,EAAE,KAAK,GAAEG,IAAEC,EAAE,KAAK;CAAE,IAAG,CAACF,KAAG,CAACC,GAAE,MAAM,MAAM,wDAAwD;CAAE,IAAG,CAACJ,EAAEM,CAAC,GAAE,MAAM,MAAM,6BAA6BA,EAAE,GAAG;CAAE,OAAM,GAAGH,EAAE,GAAGG,EAAE,GAAGF;AAAG;AAAC,SAASG,EAAE,GAAE;CAAC,IAAID,IAAEL,EAAE,MAAM,GAAG;CAAE,IAAGK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4BK,EAAE,iCAAiC,KAAK,UAAUL,CAAC,EAAE,EAAE;CAAjG;AAAkG;AAAC,SAASmC,EAAE,GAAE,GAAE;CAAC,IAAI/B,IAAE4B,EAAEL,EAAE3B,IAAIK,IAAG,aAAaA,GAAG,CAAC;CAAE,OAAOD,EAAE,SAAOA,IAAE,CAAC,GAAGsB,EAAErB,EAAE;AAAC;AAAC,SAAS+B,EAAG,GAAE;CAAC,IAAGpC,KAAG,QAAM,CAACV,EAAEU,CAAC,GAAE,MAAM,MAAM,6FAAuF;CAAE,IAAIK,IAAEwB,EAAE7B,GAAG,MAAM,GAAEI,IAAEwB,EAAE5B,GAAG,SAAS,GAAEE,IAAE6B,EAAE/B,GAAG,SAAS,GAAEG,IAAE+B,EAAElC,GAAG,gBAAe,gBAAgB,GAAEY,IAAE;EAAC,QAAO;GAAC,SAAQoB,EAAEL,EAAEtB,GAAG,SAAQ,gBAAgB,CAAC;GAAE,SAAQ2B,EAAEL,EAAEtB,GAAG,SAAQ,gBAAgB,CAAC;EAAC;EAAE,WAAU;GAAC,SAAQ8B,EAAE/B,GAAE,SAAS;GAAE,MAAK+B,EAAE/B,GAAE,MAAM;GAAE,SAAQ+B,EAAE/B,GAAE,SAAS;EAAC;EAAE,WAAUF;CAAC;CAA0B,OAArBC,MAAE,EAAE,iBAAeA,IAASS;AAAC"}
@@ -1,4 +1,4 @@
1
- import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as u, K as d, L as f, M as p, N as m, O as h, P as g, Q as _, R as v, S as y, T as b, U as x, V as S, W as C, X as w, Y as ee, Z as te, _ as ne, a as T, at as re, b as ie, c as ae, ct as oe, d as se, dt as ce, et as le, f as ue, g as de, i as fe, it as pe, j as me, k as E, l as he, lt as ge, m as _e, mt as ve, n as ye, nt as be, o as xe, ot as Se, p as Ce, pt as we, q as Te, r as Ee, rt as De, s as Oe, st as ke, t as Ae, tt as je, u as Me, ut as Ne, v as Pe, w as Fe, x as Ie, y as Le, z as Re } from "./resolveItems-D_WkE5eY.js";
1
+ import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as u, K as d, L as f, M as p, N as m, O as h, P as g, Q as _, R as v, S as y, T as b, U as x, V as S, W as C, X as w, Y as ee, Z as te, _ as ne, a as T, at as re, b as ie, c as ae, ct as oe, d as se, dt as ce, et as le, f as ue, g as de, i as fe, it as pe, j as me, k as E, l as he, lt as ge, m as _e, mt as ve, n as ye, nt as be, o as xe, ot as Se, p as Ce, pt as we, q as Te, r as Ee, rt as De, s as Oe, st as ke, t as Ae, tt as je, u as Me, ut as Ne, v as Pe, w as Fe, x as Ie, y as Le, z as Re } from "./resolveItems-NbAcf9va.js";
2
2
  import { t as ze } from "./object-DzSPF7cw.js";
3
3
  //#region ../ims-cp-core/dist/package-file-resolver.js
4
4
  function Be(e) {
@@ -13211,7 +13211,7 @@ var Gg = "[data-region='content']", Kg = "[data-pie-shell-root]", qg = (e, t) =>
13211
13211
  }
13212
13212
  return t;
13213
13213
  };
13214
- })(() => import("./sre-engine-Bgjl6uRf.js").then(({ default: e }) => {
13214
+ })(() => import("./sre-engine-0LUkEijI.js").then(({ default: e }) => {
13215
13215
  if (!e || typeof e.toSpeech != "function") throw Error("speech-rule-engine did not expose toSpeech");
13216
13216
  return e;
13217
13217
  })), _y = (e) => {
@@ -18236,7 +18236,7 @@ function jS(e = {}) {
18236
18236
  }
18237
18237
  };
18238
18238
  }
18239
- var MS = jS(), NS = async () => (await import("./dist-BAMUxWGI.js")).ServerTTSProvider, PS = (e) => typeof e == "number" ? e : void 0, FS = {
18239
+ var MS = jS(), NS = async () => (await import("./dist-DmfUd9ZE.js")).ServerTTSProvider, PS = (e) => typeof e == "number" ? e : void 0, FS = {
18240
18240
  toolId: "textToSpeech",
18241
18241
  name: "Text to Speech",
18242
18242
  description: "Read content aloud",
@@ -18381,8 +18381,8 @@ function GS(e, t) {
18381
18381
  textToSpeech: "pie-tool-tts-inline",
18382
18382
  calculator: "pie-tool-calculator"
18383
18383
  } }), e.setToolModuleLoaders({
18384
- textToSpeech: () => import("./tool-tts-inline-D9WVRkOQ.js"),
18385
- calculator: () => import("./pie-tool-calculator-CeZzHMSB.js")
18384
+ textToSpeech: () => import("./tool-tts-inline-Bik5uGvz.js"),
18385
+ calculator: () => import("./pie-tool-calculator-Ry1Gfvih.js")
18386
18386
  }), e;
18387
18387
  })(), w = /* @__PURE__ */ P(() => W(g).find((e) => e.toolId === "textToSpeech")?.provider ?? {}), ee = /* @__PURE__ */ P(() => W(v)?.renderParams?.calculatorType), te = /* @__PURE__ */ P(() => typeof W(ee) == "string" ? { toolParameters: { calculator: { type: W(ee) } } } : null), ne = /* @__PURE__ */ P(() => ({
18388
18388
  pnpEnforcement: "off",
@@ -18417,9 +18417,9 @@ function GS(e, t) {
18417
18417
  if (W(g).length === 0 || W(m)) return;
18418
18418
  let e = !1;
18419
18419
  return Promise.all([
18420
- import("./item-scope-element-C1EO-QUs.js"),
18421
- import("./item-toolbar-element-uc1jClIg.js"),
18422
- import("./pie-assessment-toolkit-element-Bf3-xqs9.js").then((e) => e.t)
18420
+ import("./item-scope-element-BhZq6tE6.js"),
18421
+ import("./item-toolbar-element-Drvp1tyg.js"),
18422
+ import("./pie-assessment-toolkit-element-D2c546tY.js").then((e) => e.t)
18423
18423
  ]).then(() => {
18424
18424
  e || R(m, !0);
18425
18425
  }).catch((t) => {
@@ -18941,7 +18941,7 @@ function _C(e, t) {
18941
18941
  yl(t, !0), Ef(e, gC);
18942
18942
  let n = Z(t, "itemRef", 7), r = Z(t, "responses", 7), i = Z(t, "role", 7, "candidate"), a = Z(t, "disabled", 7, !1), o = Z(t, "i18n", 7), s = Z(t, "security", 7), c = Z(t, "pci", 7), l = Z(t, "pnp", 7), u = Z(t, "typeset", 7), d = Z(t, "onResponseChange", 7), f = Z(t, "onFrameworkError", 7), p = /* @__PURE__ */ L(!1), m = /* @__PURE__ */ L(null), h = /* @__PURE__ */ L(null), g = /* @__PURE__ */ P(() => n().title ?? "Question"), _ = /* @__PURE__ */ P(() => (n().tools?.length ?? 0) > 0), v = /* @__PURE__ */ P(() => fp(n().itemXml, { security: s() }));
18943
18943
  async function y() {
18944
- customElements.get("pie-qti-item-player") || await import("./element-DjIUtH7W.js"), await customElements.whenDefined("pie-qti-item-player");
18944
+ customElements.get("pie-qti-item-player") || await import("./element-9ZegGa0D.js"), await customElements.whenDefined("pie-qti-item-player");
18945
18945
  }
18946
18946
  pf(() => {
18947
18947
  let e = !1;
@@ -22261,4 +22261,4 @@ function Ww() {
22261
22261
  //#endregion
22262
22262
  export { Ep as A, Jp as C, Pp as D, Rp as E, wp as M, xp as N, Kp as O, gp as P, Xp as S, Lp as T, Lg as _, Vw as a, Qp as b, vS as c, fy as d, qg as f, Rg as g, Fg as h, Bw as i, Dp as j, Tp as k, Tx as l, Hg as m, Hw as n, Lw as o, Ug as p, Uw as r, Rw as s, Ww as t, Ib as u, zg as v, Yp as w, Zp as x, Sg as y };
22263
22263
 
22264
- //# sourceMappingURL=define-B-ocInH4.js.map
22264
+ //# sourceMappingURL=define-mw8BceaY.js.map