@aceshooting/lyra-ui 29.2.2 → 30.0.0

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 (440) hide show
  1. package/CHANGELOG.md +126 -106
  2. package/README.md +8 -7
  3. package/dist/ai/snapshot.js +1 -1
  4. package/dist/all.d.ts +1 -1
  5. package/dist/all.js +1 -1
  6. package/dist/autoloader.js +1 -1
  7. package/dist/cli/component-inventory.mjs +1 -1
  8. package/dist/cli/lyra-rename-ledger.mjs +1 -1
  9. package/dist/cli/migrate-wa.mjs +7 -3
  10. package/dist/cli/migration-analysis.mjs +1 -1
  11. package/dist/cli/migration-contract.json +1 -1
  12. package/dist/cli/migration-contract.mjs +1 -1
  13. package/dist/cli/migration-immutable-collections.mjs +6 -0
  14. package/dist/cli/migration-renames.mjs +1 -1
  15. package/dist/cli/migration-transforms.mjs +1 -1
  16. package/dist/components/agent-tools/activity-feed/activity-feed.class.d.ts +1 -1
  17. package/dist/components/agent-tools/agent-eval-dashboard/agent-eval-dashboard.class.d.ts +1 -2
  18. package/dist/components/agent-tools/agent-eval-dashboard/agent-eval-dashboard.class.js +1 -1
  19. package/dist/components/agent-tools/agent-run/agent-run.class.d.ts +3 -4
  20. package/dist/components/agent-tools/agent-run/agent-run.class.js +1 -1
  21. package/dist/components/agent-tools/agent-trace/agent-trace.class.d.ts +1 -1
  22. package/dist/components/agent-tools/agent-trace/agent-trace.class.js +2 -2
  23. package/dist/components/agent-tools/background-runs/background-runs.class.d.ts +1 -2
  24. package/dist/components/agent-tools/background-runs/background-runs.class.js +1 -1
  25. package/dist/components/agent-tools/change-review/change-review.class.d.ts +1 -2
  26. package/dist/components/agent-tools/change-review/change-review.class.js +1 -1
  27. package/dist/components/agent-tools/eval-dataset/eval-dataset.class.d.ts +3 -2
  28. package/dist/components/agent-tools/eval-dataset/eval-dataset.class.js +1 -1
  29. package/dist/components/agent-tools/evaluation-run/evaluation-run.class.d.ts +7 -1
  30. package/dist/components/agent-tools/evaluation-run/evaluation-run.class.js +1 -1
  31. package/dist/components/agent-tools/prompt-studio/prompt-studio.class.d.ts +2 -2
  32. package/dist/components/agent-tools/prompt-studio/prompt-studio.class.js +3 -3
  33. package/dist/components/agent-tools/span-waterfall/span-waterfall.class.d.ts +1 -1
  34. package/dist/components/agent-tools/subagent-panel/subagent-panel.class.d.ts +1 -2
  35. package/dist/components/agent-tools/subagent-panel/subagent-panel.class.js +2 -2
  36. package/dist/components/agent-tools/task-list/task-list.class.d.ts +1 -1
  37. package/dist/components/agent-tools/test-results/test-results.class.d.ts +1 -1
  38. package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.d.ts +3 -4
  39. package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.js +1 -5
  40. package/dist/components/agent-tools/tool-timeline/tool-timeline.class.d.ts +3 -3
  41. package/dist/components/agent-tools/trace-tree/trace-tree.class.d.ts +1 -0
  42. package/dist/components/agent-tools/trace-tree/trace-tree.class.js +1 -1
  43. package/dist/components/charts/chart/chart.class.js +3 -3
  44. package/dist/components/charts/chart-3d/chart-3d-data.d.ts +50 -0
  45. package/dist/components/charts/chart-3d/chart-3d-data.js +1 -0
  46. package/dist/components/charts/chart-3d/chart-3d-engine.js +1 -0
  47. package/dist/components/charts/chart-3d/chart-3d.class.d.ts +96 -0
  48. package/dist/components/charts/chart-3d/chart-3d.class.js +47 -0
  49. package/dist/components/charts/chart-3d/chart-3d.d.ts +1 -0
  50. package/dist/components/charts/chart-3d/chart-3d.js +1 -0
  51. package/dist/components/charts/chart-3d/chart-3d.styles.js +1 -0
  52. package/dist/components/charts/index.d.ts +1 -1
  53. package/dist/components/charts/index.js +1 -1
  54. package/dist/components/conversation/agent-workspace/agent-workspace.class.d.ts +3 -3
  55. package/dist/components/conversation/agent-workspace/agent-workspace.class.js +4 -5
  56. package/dist/components/conversation/code-block/code-block-base.class.js +1 -1
  57. package/dist/components/conversation/code-block/shiki-oniguruma.d.ts +3 -0
  58. package/dist/components/conversation/code-block/shiki-oniguruma.js +1 -0
  59. package/dist/components/conversation/code-block/shiki-types.d.ts +3 -5
  60. package/dist/components/conversation/code-block/shiki-types.js +1 -1
  61. package/dist/components/conversation/generation-metrics/generation-metrics.class.js +1 -1
  62. package/dist/components/conversation/markdown/markdown-progressive.js +1 -1
  63. package/dist/components/conversation/message-actions/message-actions.class.js +1 -1
  64. package/dist/components/conversation/message-parts/message-parts.class.js +1 -1
  65. package/dist/components/conversation/model-select/model-select.class.js +1 -1
  66. package/dist/components/conversation/model-settings-panel/model-settings-panel.class.js +1 -1
  67. package/dist/components/conversation/prompt-input/prompt-input.class.js +3 -4
  68. package/dist/components/conversation/prompt-queue/prompt-queue.class.d.ts +1 -1
  69. package/dist/components/conversation/push-to-talk/push-to-talk.class.js +1 -1
  70. package/dist/components/conversation/selection-toolbar/selection-toolbar.class.js +1 -1
  71. package/dist/components/conversation/thread-list/thread-list.class.d.ts +2 -2
  72. package/dist/components/conversation/thread-list/thread-list.class.js +1 -1
  73. package/dist/components/conversation/widget-renderer/registry.js +1 -1
  74. package/dist/components/conversation/widget-renderer/resolve.js +1 -1
  75. package/dist/components/data/calendar/calendar.class.d.ts +3 -1
  76. package/dist/components/data/data-grid/data-grid.class.js +2 -2
  77. package/dist/components/data/flow-canvas/flow-canvas.class.js +2 -2
  78. package/dist/components/data/flow-canvas/flow-source.js +1 -1
  79. package/dist/components/data/flow-node/flow-node.class.d.ts +2 -3
  80. package/dist/components/data/flow-node/flow-node.class.js +2 -4
  81. package/dist/components/data/heatmap/heatmap.class.js +1 -1
  82. package/dist/components/data/sparkline/sparkline.class.d.ts +0 -1
  83. package/dist/components/data/sparkline/sparkline.class.js +1 -1
  84. package/dist/components/data/table/table.class.js +1 -1
  85. package/dist/components/forms/color-picker/color-core.js +1 -1
  86. package/dist/components/forms/date-picker/calendar-core.js +1 -1
  87. package/dist/components/forms/otp-input/otp-input.class.js +1 -1
  88. package/dist/components/forms/signature-pad/signature-pad.class.d.ts +4 -3
  89. package/dist/components/forms/signature-pad/signature-pad.class.js +1 -1
  90. package/dist/components/forms/swatch-picker/swatch-picker.class.d.ts +3 -2
  91. package/dist/components/forms/swatch-picker/swatch-picker.class.js +1 -1
  92. package/dist/components/layout/app-rail/app-rail-item.class.d.ts +0 -2
  93. package/dist/components/layout/app-rail/app-rail-item.class.js +1 -1
  94. package/dist/components/layout/app-rail/app-rail.class.d.ts +3 -3
  95. package/dist/components/layout/command-palette/command-palette.class.d.ts +1 -1
  96. package/dist/components/layout/details/accordion-item.class.d.ts +1 -2
  97. package/dist/components/layout/details/accordion-item.class.js +1 -1
  98. package/dist/components/layout/dock-panel/dock-panel.class.d.ts +4 -11
  99. package/dist/components/layout/dock-panel/dock-panel.class.js +1 -1
  100. package/dist/components/layout/drilldown-panel/drilldown-panel.class.js +1 -1
  101. package/dist/components/layout/menu/menu.class.js +1 -1
  102. package/dist/components/layout/menubar/menubar-item.class.d.ts +1 -1
  103. package/dist/components/layout/menubar/menubar.class.d.ts +1 -1
  104. package/dist/components/layout/multi-split/multi-split.class.d.ts +1 -1
  105. package/dist/components/layout/multi-split/multi-split.class.js +1 -1
  106. package/dist/components/layout/navigation-menu/navigation-menu.class.d.ts +2 -6
  107. package/dist/components/layout/navigation-menu/navigation-menu.class.js +1 -1
  108. package/dist/components/layout/tab-group/tab-group.class.js +1 -1
  109. package/dist/components/layout/virtual-list/virtual-list.class.d.ts +3 -2
  110. package/dist/components/layout/virtual-list/virtual-list.class.js +1 -1
  111. package/dist/components/layout/widget/widget.class.d.ts +5 -14
  112. package/dist/components/layout/widget/widget.class.js +2 -2
  113. package/dist/components/lr-chart-3d.js +1 -0
  114. package/dist/components/lr-model-viewer.js +1 -0
  115. package/dist/components/media/av-player/av-metadata.d.ts +1 -13
  116. package/dist/components/media/av-player/av-metadata.js +1 -1
  117. package/dist/components/media/av-player/av-player.class.js +1 -1
  118. package/dist/components/media/file-input/file-input.class.d.ts +10 -13
  119. package/dist/components/media/file-input/file-input.class.js +3 -3
  120. package/dist/components/media/file-input/file-input.styles.js +1 -1
  121. package/dist/components/media/image-viewer/image-viewer-panorama.d.ts +5 -0
  122. package/dist/components/media/image-viewer/image-viewer-panorama.js +8 -0
  123. package/dist/components/media/image-viewer/image-viewer-panorama.styles.js +1 -0
  124. package/dist/components/media/image-viewer/image-viewer.class.d.ts +29 -5
  125. package/dist/components/media/image-viewer/image-viewer.class.js +8 -5
  126. package/dist/components/media/image-viewer/image-viewer.styles.js +1 -1
  127. package/dist/components/media/map/map-anchor-controller.js +1 -0
  128. package/dist/components/media/map/map-anchor-options.d.ts +14 -0
  129. package/dist/components/media/map/map-anchor-options.js +1 -0
  130. package/dist/components/media/map/map-camera.d.ts +34 -0
  131. package/dist/components/media/map/map-camera.js +1 -0
  132. package/dist/components/media/map/map-construction-scheduler.d.ts +13 -0
  133. package/dist/components/media/map/map-construction-scheduler.js +1 -0
  134. package/dist/components/media/map/map-control-options.d.ts +39 -0
  135. package/dist/components/media/map/map-control-options.js +1 -0
  136. package/dist/components/media/map/map-controls-lifecycle.js +1 -0
  137. package/dist/components/media/map/map-cursor.js +1 -0
  138. package/dist/components/media/map/map-data-layer-model.d.ts +40 -0
  139. package/dist/components/media/map/map-data-layer-model.js +1 -0
  140. package/dist/components/media/map/map-drawing-controller.js +1 -0
  141. package/dist/components/media/map/map-drawing-gesture.js +1 -0
  142. package/dist/components/media/map/map-drawing-pan.js +1 -0
  143. package/dist/components/media/map/map-drawing-pointer.js +1 -0
  144. package/dist/components/media/map/map-drawing.d.ts +29 -0
  145. package/dist/components/media/map/map-drawing.js +1 -0
  146. package/dist/components/media/map/map-empty-style.d.ts +8 -0
  147. package/dist/components/media/map/map-empty-style.js +1 -0
  148. package/dist/components/media/map/map-engine-events.js +1 -0
  149. package/dist/components/media/map/map-export-attribution.js +1 -0
  150. package/dist/components/media/map/map-external-source-effects.js +1 -0
  151. package/dist/components/media/map/map-feature-loader-core.js +1 -0
  152. package/dist/components/media/map/map-feature-loader.js +1 -0
  153. package/dist/components/media/map/map-feature-state-router.d.ts +16 -0
  154. package/dist/components/media/map/map-feature-state-router.js +1 -0
  155. package/dist/components/media/map/map-feature-state-routes.js +1 -0
  156. package/dist/components/media/map/map-feature-state.d.ts +16 -0
  157. package/dist/components/media/map/map-feature-state.js +1 -0
  158. package/dist/components/media/map/map-hash-option.js +1 -0
  159. package/dist/components/media/map/map-hash-owner.js +1 -0
  160. package/dist/components/media/map/map-hash.js +1 -0
  161. package/dist/components/media/map/map-hit-test.d.ts +17 -0
  162. package/dist/components/media/map/map-hit-test.js +1 -0
  163. package/dist/components/media/map/map-image-admission.d.ts +7 -0
  164. package/dist/components/media/map/map-image-admission.js +1 -0
  165. package/dist/components/media/map/map-image-export-controller.js +1 -0
  166. package/dist/components/media/map/map-image-export-error.d.ts +3 -0
  167. package/dist/components/media/map/map-image-export-error.js +1 -0
  168. package/dist/components/media/map/map-image-export.d.ts +15 -0
  169. package/dist/components/media/map/map-image-export.js +5 -0
  170. package/dist/components/media/map/map-image-limits.d.ts +4 -0
  171. package/dist/components/media/map/map-image-limits.js +1 -0
  172. package/dist/components/media/map/map-image-metadata.js +3 -0
  173. package/dist/components/media/map/map-image-provider.d.ts +33 -0
  174. package/dist/components/media/map/map-image-provider.js +1 -0
  175. package/dist/components/media/map/map-images.d.ts +9 -0
  176. package/dist/components/media/map/map-images.js +1 -0
  177. package/dist/components/media/map/map-interaction-options.d.ts +26 -0
  178. package/dist/components/media/map/map-interaction-options.js +1 -0
  179. package/dist/components/media/map/map-layer-order.js +1 -0
  180. package/dist/components/media/map/map-loader.d.ts +35 -5
  181. package/dist/components/media/map/map-loader.js +1 -1
  182. package/dist/components/media/map/map-local-image-url.js +1 -0
  183. package/dist/components/media/map/map-local-image.js +1 -0
  184. package/dist/components/media/map/map-overlay-admission.d.ts +13 -0
  185. package/dist/components/media/map/map-overlay-admission.js +1 -0
  186. package/dist/components/media/map/map-owned-feature-input.js +1 -0
  187. package/dist/components/media/map/map-owned-features.js +1 -0
  188. package/dist/components/media/map/map-owned-resources.js +1 -0
  189. package/dist/components/media/map/map-paint-batch.js +1 -0
  190. package/dist/components/media/map/map-readers.js +1 -0
  191. package/dist/components/media/map/map-readiness.js +1 -0
  192. package/dist/components/media/map/map-resource-feature-loaders.js +1 -0
  193. package/dist/components/media/map/map-source-updates.js +1 -0
  194. package/dist/components/media/map/map-style-input.js +1 -0
  195. package/dist/components/media/map/map-style-lifecycle.js +1 -0
  196. package/dist/components/media/map/map-style-override-admission.d.ts +10 -0
  197. package/dist/components/media/map/map-style-override-admission.js +1 -0
  198. package/dist/components/media/map/map-style-overrides.js +1 -0
  199. package/dist/components/media/map/map-style-value.d.ts +3 -0
  200. package/dist/components/media/map/map-style-value.js +1 -0
  201. package/dist/components/media/map/map-vector-style.d.ts +10 -0
  202. package/dist/components/media/map/map-vector-style.js +1 -0
  203. package/dist/components/media/map/map.class.d.ts +558 -51
  204. package/dist/components/media/map/map.class.js +58 -11
  205. package/dist/components/media/map/map.styles.js +1 -1
  206. package/dist/components/media/qr-code/qr-code.class.d.ts +1 -3
  207. package/dist/components/media/qr-code/qr-code.class.js +1 -1
  208. package/dist/components/media/qr-code/qr-code.styles.js +1 -1
  209. package/dist/components/media/video/video.class.d.ts +25 -4
  210. package/dist/components/media/video/video.class.js +11 -3
  211. package/dist/components/media/video/video.styles.js +1 -1
  212. package/dist/components/media/video-playlist/video-playlist.class.d.ts +0 -1
  213. package/dist/components/media/video-playlist/video-playlist.class.js +1 -1
  214. package/dist/components/overlays/chip/chip-group.class.d.ts +1 -1
  215. package/dist/components/overlays/chip/chip-group.class.js +1 -1
  216. package/dist/components/overlays/dialog/confirm.js +1 -1
  217. package/dist/components/overlays/overlay/popover.class.d.ts +1 -1
  218. package/dist/components/overlays/overlay/popover.class.js +2 -1
  219. package/dist/components/overlays/overlay/tooltip.class.js +1 -1
  220. package/dist/components/retrieval/chunk-inspector/chunk-inspector.class.d.ts +4 -7
  221. package/dist/components/retrieval/chunk-inspector/chunk-inspector.class.js +2 -2
  222. package/dist/components/retrieval/claim-evidence/claim-evidence.class.d.ts +2 -2
  223. package/dist/components/retrieval/community-card/community-card.class.d.ts +1 -4
  224. package/dist/components/retrieval/community-card/community-card.class.js +1 -1
  225. package/dist/components/retrieval/embedding-explorer/embedding-explorer-data.d.ts +12 -0
  226. package/dist/components/retrieval/embedding-explorer/embedding-explorer-data.js +1 -0
  227. package/dist/components/retrieval/embedding-explorer/embedding-explorer-engine.js +1 -0
  228. package/dist/components/retrieval/embedding-explorer/embedding-explorer.class.d.ts +26 -7
  229. package/dist/components/retrieval/embedding-explorer/embedding-explorer.class.js +35 -4
  230. package/dist/components/retrieval/embedding-explorer/embedding-explorer.styles.js +1 -1
  231. package/dist/components/retrieval/entity-dossier/entity-dossier.class.d.ts +3 -9
  232. package/dist/components/retrieval/graph/graph-builtin-3d-engine.js +1 -0
  233. package/dist/components/retrieval/graph/graph-engine-adapter.js +1 -0
  234. package/dist/components/retrieval/graph/graph-engine-columns.js +1 -0
  235. package/dist/components/retrieval/graph/graph-model.js +1 -1
  236. package/dist/components/retrieval/graph/graph-spatial-controller.js +13 -8
  237. package/dist/components/retrieval/graph/graph-webgl-engine.js +1 -0
  238. package/dist/components/retrieval/graph/graph.class.d.ts +18 -5
  239. package/dist/components/retrieval/graph/graph.class.js +4 -4
  240. package/dist/components/retrieval/graph/graph.styles.js +1 -1
  241. package/dist/components/retrieval/grounding-summary/grounding-summary.class.d.ts +1 -1
  242. package/dist/components/retrieval/ingestion-queue/ingestion-queue.class.d.ts +1 -1
  243. package/dist/components/retrieval/ingestion-queue/ingestion-queue.class.js +2 -2
  244. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.d.ts +6 -3
  245. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.js +3 -3
  246. package/dist/components/retrieval/memory-panel/memory-panel.class.d.ts +3 -10
  247. package/dist/components/retrieval/memory-panel/memory-panel.class.js +1 -1
  248. package/dist/components/retrieval/node-palette/node-palette.class.d.ts +1 -1
  249. package/dist/components/retrieval/path-strip/path-strip.class.d.ts +1 -4
  250. package/dist/components/retrieval/path-strip/path-strip.class.js +1 -1
  251. package/dist/components/retrieval/provenance-panel/provenance-panel.class.d.ts +2 -8
  252. package/dist/components/retrieval/rag-answer/rag-answer.class.d.ts +2 -2
  253. package/dist/components/retrieval/rag-answer/rag-answer.class.js +2 -3
  254. package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.class.d.ts +1 -11
  255. package/dist/components/retrieval/rag-eval-dashboard/rag-eval-dashboard.class.js +1 -1
  256. package/dist/components/retrieval/retrieval-results/retrieval-results.class.d.ts +8 -12
  257. package/dist/components/retrieval/retrieval-results/retrieval-results.class.js +5 -6
  258. package/dist/components/retrieval/retrieval-search/retrieval-search.class.d.ts +1 -1
  259. package/dist/components/retrieval/retrieval-trace/retrieval-trace.class.d.ts +4 -7
  260. package/dist/components/retrieval/retrieval-trace/retrieval-trace.class.js +2 -3
  261. package/dist/components/retrieval/source-card/source-card.class.d.ts +6 -9
  262. package/dist/components/retrieval/source-card/source-card.class.js +1 -1
  263. package/dist/components/retrieval/source-picker/source-picker.class.d.ts +1 -4
  264. package/dist/components/retrieval/source-picker/source-picker.class.js +1 -1
  265. package/dist/components/utility/diff-view/diff-view.class.js +1 -1
  266. package/dist/components/utility/format/format-options.js +1 -1
  267. package/dist/components/utility/icon/icon.class.d.ts +0 -5
  268. package/dist/components/utility/icon/icon.class.js +2 -2
  269. package/dist/components/utility/icon/icon.styles.js +1 -1
  270. package/dist/components/utility/json-viewer/json-viewer.class.js +1 -1
  271. package/dist/components/utility/known-date/known-date.class.d.ts +0 -3
  272. package/dist/components/utility/known-date/known-date.class.js +1 -1
  273. package/dist/components/utility/mention-popover/mention-popover.class.d.ts +3 -2
  274. package/dist/components/utility/mention-popover/mention-popover.class.js +1 -1
  275. package/dist/components/viewers/archive-viewer/archive-viewer.class.js +1 -1
  276. package/dist/components/viewers/calendar-viewer/calendar-viewer.class.js +1 -1
  277. package/dist/components/viewers/contact-viewer/contact-viewer.class.js +1 -1
  278. package/dist/components/viewers/document-preview/document-preview.class.js +1 -1
  279. package/dist/components/viewers/document-viewer/document-viewer-kinds.d.ts +1 -1
  280. package/dist/components/viewers/document-viewer/document-viewer-kinds.js +1 -1
  281. package/dist/components/viewers/document-viewer/document-viewer.class.js +1 -1
  282. package/dist/components/viewers/document-viewer/registry.d.ts +1 -69
  283. package/dist/components/viewers/document-viewer/registry.js +1 -1
  284. package/dist/components/viewers/docx-viewer/docx-viewer.class.js +1 -1
  285. package/dist/components/viewers/email-viewer/email-viewer.class.js +1 -1
  286. package/dist/components/viewers/html-viewer/html-viewer.class.js +1 -1
  287. package/dist/components/viewers/include/include.class.js +1 -1
  288. package/dist/components/viewers/index.d.ts +1 -1
  289. package/dist/components/viewers/index.js +1 -1
  290. package/dist/components/viewers/model-viewer/model-viewer-document.js +1 -0
  291. package/dist/components/viewers/model-viewer/model-viewer-loader.js +1 -0
  292. package/dist/components/viewers/model-viewer/model-viewer-register.d.ts +1 -0
  293. package/dist/components/viewers/model-viewer/model-viewer-register.js +1 -0
  294. package/dist/components/viewers/model-viewer/model-viewer-source.d.ts +1 -0
  295. package/dist/components/viewers/model-viewer/model-viewer-source.js +1 -0
  296. package/dist/components/viewers/model-viewer/model-viewer.class.d.ts +61 -0
  297. package/dist/components/viewers/model-viewer/model-viewer.class.js +9 -0
  298. package/dist/components/viewers/model-viewer/model-viewer.d.ts +1 -0
  299. package/dist/components/viewers/model-viewer/model-viewer.js +1 -0
  300. package/dist/components/viewers/model-viewer/model-viewer.styles.js +1 -0
  301. package/dist/components/viewers/notebook-viewer/notebook-viewer.class.js +2 -2
  302. package/dist/components/viewers/page-rail/page-rail.class.js +1 -1
  303. package/dist/components/viewers/pdf-viewer/pdf-viewer.class.js +1 -1
  304. package/dist/components/viewers/pptx-viewer/pptx-viewer.class.js +3 -3
  305. package/dist/components/viewers/svg-viewer/svg-viewer.class.js +1 -1
  306. package/dist/components/viewers/table-viewer-shared.js +1 -1
  307. package/dist/components/viewers/xml-viewer/xml-viewer.class.js +1 -1
  308. package/dist/custom-elements-jsx.d.ts +1 -1
  309. package/dist/events.d.ts +137 -92
  310. package/dist/framework-types.d.ts +2 -2
  311. package/dist/hydration.d.ts +1 -1
  312. package/dist/internal/ansi.d.ts +3 -1
  313. package/dist/internal/ansi.js +1 -1
  314. package/dist/internal/autoloader-manifest.js +1 -1
  315. package/dist/internal/autoloader-tags.d.ts +1 -1
  316. package/dist/internal/autoloader-tags.js +1 -1
  317. package/dist/internal/av-metadata.d.ts +13 -0
  318. package/dist/internal/av-metadata.js +1 -0
  319. package/dist/internal/collection-snapshot.js +1 -1
  320. package/dist/internal/component-loaders.generated.js +1 -1
  321. package/dist/internal/data-descriptors.d.ts +30 -0
  322. package/dist/internal/default-strings/agent-tools.generated.js +1 -1
  323. package/dist/internal/default-strings/charts.generated.js +1 -1
  324. package/dist/internal/default-strings/conversation.generated.js +1 -1
  325. package/dist/internal/default-strings/media.generated.js +1 -1
  326. package/dist/internal/default-strings/shared.generated.js +1 -1
  327. package/dist/internal/default-strings/viewers.generated.js +1 -1
  328. package/dist/internal/document-renderer-registry.d.ts +75 -0
  329. package/dist/internal/document-renderer-registry.js +1 -0
  330. package/dist/internal/drop-session-controller.js +1 -1
  331. package/dist/internal/engine-3d-loader.d.ts +47 -0
  332. package/dist/internal/engine-3d-loader.js +1 -0
  333. package/dist/internal/engine-3d.d.ts +57 -0
  334. package/dist/internal/engine-3d.js +1 -0
  335. package/dist/internal/hierarchy-source-controller.js +1 -1
  336. package/dist/internal/localization-runtime.js +1 -1
  337. package/dist/internal/localization-types.d.ts +1 -1
  338. package/dist/internal/localization.js +1 -1
  339. package/dist/internal/lyra-element.d.ts +2 -2
  340. package/dist/internal/lyra-element.js +1 -1
  341. package/dist/internal/model-viewer-contract.d.ts +5 -0
  342. package/dist/internal/model-viewer-contract.js +1 -0
  343. package/dist/internal/package-metadata.js +1 -1
  344. package/dist/internal/positioner.js +1 -1
  345. package/dist/internal/rendered-state.js +1 -1
  346. package/dist/internal/root-registration-allowlist.js +1 -1
  347. package/dist/internal/scoped-definitions.generated.js +1 -1
  348. package/dist/internal/typed-columns.d.ts +39 -0
  349. package/dist/internal/typed-columns.js +1 -0
  350. package/dist/localization.js +1 -1
  351. package/dist/lyra.d.ts +1 -1
  352. package/dist/lyra.js +1 -1
  353. package/dist/ssr/all.d.ts +1 -1
  354. package/dist/ssr/all.js +1 -1
  355. package/dist/ssr.d.ts +4 -4
  356. package/dist/ssr.js +1 -1
  357. package/dist/svelte.d.ts +1 -1
  358. package/dist/testing/lyra-tag-event-map.d.ts +2 -2
  359. package/dist/testing/lyra-tag-event-map.js +1 -1
  360. package/dist/theme/theme-bootstrap.js +1 -1
  361. package/dist/theme/theme.js +1 -1
  362. package/dist/vue.d.ts +1 -1
  363. package/llms/components/lr-accordion-item.md +2 -2
  364. package/llms/components/lr-agent-eval-dashboard.md +3 -3
  365. package/llms/components/lr-agent-run.md +3 -3
  366. package/llms/components/lr-agent-trace.md +1 -1
  367. package/llms/components/lr-agent-workspace.md +1 -1
  368. package/llms/components/lr-app-rail-item.md +1 -1
  369. package/llms/components/lr-app-rail.md +5 -6
  370. package/llms/components/lr-background-runs.md +4 -4
  371. package/llms/components/lr-calendar.md +1 -1
  372. package/llms/components/lr-change-review.md +5 -5
  373. package/llms/components/lr-chart-3d.md +164 -0
  374. package/llms/components/lr-chunk-inspector.md +4 -5
  375. package/llms/components/lr-citation-badge.md +1 -1
  376. package/llms/components/lr-code-block-core.md +2 -4
  377. package/llms/components/lr-command-palette.md +3 -3
  378. package/llms/components/lr-community-card.md +2 -2
  379. package/llms/components/lr-date-picker.md +1 -1
  380. package/llms/components/lr-details.md +2 -2
  381. package/llms/components/lr-diff-view.md +2 -2
  382. package/llms/components/lr-dock-panel.md +5 -10
  383. package/llms/components/lr-document-viewer.md +21 -14
  384. package/llms/components/lr-embedding-explorer.md +24 -4
  385. package/llms/components/lr-entity-dossier.md +3 -4
  386. package/llms/components/lr-eval-dataset.md +3 -3
  387. package/llms/components/lr-eval-run.md +7 -1
  388. package/llms/components/lr-file-input.md +10 -11
  389. package/llms/components/lr-flow-node.md +2 -3
  390. package/llms/components/lr-geojson-viewer.md +1 -1
  391. package/llms/components/lr-graph.md +21 -2
  392. package/llms/components/lr-grounding-summary.md +1 -1
  393. package/llms/components/lr-icon.md +1 -3
  394. package/llms/components/lr-image-viewer.md +29 -2
  395. package/llms/components/lr-ingestion-queue.md +1 -1
  396. package/llms/components/lr-knowledge-base-admin.md +2 -2
  397. package/llms/components/lr-knowledge-graph-explorer.md +7 -1
  398. package/llms/components/lr-known-date.md +3 -10
  399. package/llms/components/lr-lite-chart.md +1 -1
  400. package/llms/components/lr-map.md +861 -49
  401. package/llms/components/lr-markdown-core.md +1 -2
  402. package/llms/components/lr-memory-panel.md +4 -8
  403. package/llms/components/lr-model-viewer.md +170 -0
  404. package/llms/components/lr-navigation-menu.md +3 -4
  405. package/llms/components/lr-node-palette.md +1 -1
  406. package/llms/components/lr-path-strip.md +2 -3
  407. package/llms/components/lr-provenance-panel.md +3 -5
  408. package/llms/components/lr-qr-code.md +3 -4
  409. package/llms/components/lr-rag-answer.md +1 -1
  410. package/llms/components/lr-rag-eval-dashboard.md +2 -5
  411. package/llms/components/lr-retrieval-results.md +6 -7
  412. package/llms/components/lr-retrieval-trace.md +3 -4
  413. package/llms/components/lr-signature-pad.md +4 -3
  414. package/llms/components/lr-source-card.md +1 -1
  415. package/llms/components/lr-source-list.md +5 -5
  416. package/llms/components/lr-source-picker.md +2 -3
  417. package/llms/components/lr-span-waterfall.md +4 -3
  418. package/llms/components/lr-sparkline.md +3 -3
  419. package/llms/components/lr-subagent-panel.md +3 -3
  420. package/llms/components/lr-tool-call-chip.md +6 -6
  421. package/llms/components/lr-tool-timeline.md +1 -1
  422. package/llms/components/lr-video-playlist.md +3 -3
  423. package/llms/components/lr-video.md +29 -2
  424. package/llms/components/lr-virtual-list.md +3 -2
  425. package/llms/components/lr-widget.md +6 -13
  426. package/llms/index.md +98 -95
  427. package/llms/migration.md +27 -38
  428. package/llms/peers.md +7 -6
  429. package/llms/shared/ai-and-peers.md +1 -1
  430. package/llms/shared/events-and-types.md +8 -0
  431. package/llms/shared/imports-and-registration.md +2 -2
  432. package/llms/shared/v29-to-v30-migration.md +256 -0
  433. package/llms/shared.md +11 -3
  434. package/llms.txt +4 -4
  435. package/locales.json +1 -2328
  436. package/package.json +41 -13
  437. package/registrations.json +1 -1
  438. package/skills/lyra-ui/SKILL.md +4 -3
  439. /package/dist/{components/viewers/document-viewer → internal}/deferred-teardown.js +0 -0
  440. /package/dist/{components/viewers/document-viewer/registry-ownership.js → internal/document-renderer-registry-ownership.js} +0 -0
@@ -1 +1 @@
1
- import{focusRing}from"../../../internal/interactive-control.styles.js";import{css}from"lit";const styles=css` :host { display: block; block-size: var( --lr-canvas-reserved-height, var(--_lr-graph-requested-height, var(--lr-size-24rem)) ); } .source-layout { display: flex; flex-direction: column; block-size: 100%; min-inline-size: 0; min-block-size: 0; } .source-diagram { flex: 1 1 50%; min-block-size: 0; } [part="source-navigator"] { flex: 0 1 50%; min-block-size: 0; min-inline-size: 0; overflow: auto; padding: var(--lr-space-s); border-block-start: var(--lr-border-width-thin) solid var(--lr-color-border); } .source-list [part="source-navigator"] { flex: 1 1 auto; } .source-toolbar { display: flex; flex-wrap: wrap; gap: var(--lr-space-s); } .source-toolbar input { flex: 1 1 auto; min-inline-size: 0; } .source-rows { list-style: none; padding: 0; margin-block: var(--lr-space-s); } .source-rows li { display: flex; flex-wrap: wrap; gap: var(--lr-space-xs); margin-block: var(--lr-space-xs); } [part="source-navigator"] :where(button, input, select), [part="source-status"] button { --_lr-source-fill: var(--lr-color-neutral-fill-quiet); min-block-size: var(--lr-icon-button-size); min-inline-size: var(--lr-icon-button-size); max-inline-size: 100%; padding: var(--lr-space-xs) var(--lr-space-s); border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-radius-xs); font: inherit; color: var(--lr-color-text); background: var(--_lr-source-fill); transition: var(--lr-transition-interactive); overflow-wrap: anywhere; } [part~="source-row"] { flex: 1 1 auto; text-align: start; } [part~="source-row"]:where([aria-pressed="true"]) { --_lr-source-fill: var(--lr-color-brand-fill-quiet); } [part="source-navigator"] button, [part="source-status"] button { cursor: pointer; } [part="source-navigator"] :where(button, input, select):hover, [part="source-status"] button:hover { background: color-mix(in oklab, var(--_lr-source-fill), var(--lr-color-mix-partner) var(--lr-color-mix-hover)); } [part="source-navigator"] button:active, [part="source-status"] button:active { background: color-mix(in oklab, var(--_lr-source-fill), var(--lr-color-mix-partner) var(--lr-color-mix-active)); } [part="source-navigator"] :where(button, input, select):focus-visible, [part="source-status"] button:focus-visible { ${focusRing} } [part="source-status"], [part="source-coverage"] { overflow-wrap: anywhere; margin-block: var(--lr-space-s); } [part="base"] { position: relative; inline-size: 100%; block-size: 100%; } .spatial-base { display: flex; flex-direction: column; min-inline-size: 0; overflow: hidden; } [part="spatial-toolbar"], [part="spatial-pagination"] { display: flex; flex-wrap: wrap; gap: var(--lr-space-s); padding: var(--lr-space-s); } [part="spatial-control"], [part="spatial-list-item"] { --_lr-spatial-fill: var(--lr-color-neutral-fill-quiet); min-inline-size: var(--lr-icon-button-size); min-block-size: var(--lr-icon-button-size); padding: var(--lr-space-s) var(--lr-space-m); border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-radius-xs); background: var(--_lr-spatial-fill); color: var(--lr-color-text); font: inherit; cursor: pointer; transition: var(--lr-transition-interactive); overflow-wrap: anywhere; } [part="spatial-control"]:where([aria-pressed="true"]), [part="spatial-list-item"]:where([aria-pressed="true"], [aria-current="true"]) { --_lr-spatial-fill: var(--lr-color-brand-fill-quiet); } [part="spatial-control"]:hover:where(:not(:disabled)), [part="spatial-list-item"]:hover { background: color-mix(in oklab, var(--_lr-spatial-fill), var(--lr-color-mix-partner) var(--lr-color-mix-hover)); } [part="spatial-control"]:active:where(:not(:disabled)), [part="spatial-list-item"]:active { background: color-mix(in oklab, var(--_lr-spatial-fill), var(--lr-color-mix-partner) var(--lr-color-mix-active)); } [part="spatial-control"]:focus-visible, [part="spatial-list-item"]:focus-visible, [part="spatial-canvas"]:focus-visible { ${focusRing} } [part="spatial-control"]:disabled { cursor: default; opacity: var(--lr-opacity-disabled); } [part="spatial-instructions"], [part="spatial-page-count"] { margin: 0; padding: var(--lr-space-s); font-size: var(--lr-font-size-sm); overflow-wrap: anywhere; } [part="spatial-canvas"] { min-inline-size: var(--lr-icon-button-size); display: block; flex: 1 1 auto; inline-size: 100%; block-size: 0; min-block-size: var(--lr-icon-button-size); touch-action: none; transition: var(--lr-transition-interactive); } [part="spatial-list"] { min-block-size: 0; overflow: auto; padding: var(--lr-space-s); } [part="spatial-list"] ul { list-style: none; margin: 0; padding: 0; } [part="spatial-list-item"] { inline-size: 100%; text-align: start; margin-block-end: var(--lr-space-xs); } svg { display: block; inline-size: 100%; block-size: 100%; } [part="canvas"] { display: block; inline-size: 100%; block-size: 100%; touch-action: none; transition: background-color var(--lr-transition-fast); } [part="canvas"]:focus-visible { ${focusRing} } [part="canvas"]:hover, [part="spatial-canvas"]:hover { background: color-mix( in oklab, transparent, var(--lr-color-mix-partner) var(--lr-color-mix-hover) ); } [part="tooltip"] { position: absolute; left: 0; top: 0; pointer-events: none; background: var(--lr-color-surface); color: var(--lr-color-text); font-size: var(--lr-font-size-2xs); font-family: var(--lr-font); padding-block: var(--lr-size-2px); padding-inline: var(--lr-size-6px); border-radius: var(--lr-radius-xs); border: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); z-index: var(--lr-layer-content); transform: translate(var(--lr-size-6px), calc(-100% - var(--lr-size-6px))); max-inline-size: min( calc(100% - var(--lr-size-0-75rem)), calc(100vw - var(--lr-size-0-75rem)) ); overflow-wrap: anywhere; white-space: normal; } [part="tooltip"][hidden] { display: none; } [part="link"] { stroke: var(--lr-graph-edge-color, var(--lr-color-border)); fill: none; cursor: pointer; } [data-hit-area] { fill: none; stroke: var(--lr-color-text); stroke-opacity: 0.001; stroke-width: calc( var(--lr-size-24px) * var(--_lr-graph-hit-area-scale, 1) ); cursor: pointer; } [data-hit-area="node"], [data-hit-area="link"] { stroke-linecap: round; pointer-events: stroke; } [data-hit-area="hull"] { fill: transparent; stroke-linecap: round; stroke-linejoin: round; pointer-events: all; } [part="link"]:hover { stroke: color-mix( in oklab, var(--lr-graph-edge-color, var(--lr-color-border)), var(--lr-color-mix-partner) var(--lr-color-mix-hover) ); } [part="link"]:active { stroke: color-mix( in oklab, var(--lr-graph-edge-color, var(--lr-color-border)), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part="arrowhead"] { fill: context-stroke; } [part="link"]:focus-visible { ${focusRing} } [part="link"][data-dangling] { stroke-dasharray: var(--lr-size-2px) var(--lr-size-2px); opacity: var(--lr-opacity-disabled); } [part="node"] { fill: var(--lr-graph-node-fill, var(--lr-color-brand)); cursor: pointer; } [part="node"]:hover { fill: color-mix( in oklab, var(--lr-graph-node-fill, var(--lr-color-brand)), var(--lr-color-mix-partner) var(--lr-color-mix-hover) ); } [part="node"]:active { fill: color-mix( in oklab, var(--lr-graph-node-fill, var(--lr-color-brand)), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part="node"]:focus-visible { ${focusRing} } [part="label"] { font-size: var(--lr-font-size-2xs); fill: var(--lr-color-text); font-family: var(--lr-font); pointer-events: none; } [part="link-label"] { font-size: var(--lr-font-size-2xs); fill: var(--lr-color-text); font-family: var(--lr-font); pointer-events: none; paint-order: stroke; stroke: var(--lr-graph-edge-label-halo, var(--lr-color-surface)); stroke-width: var(--lr-border-width-thick); } g[data-edge-labels-hidden] [part="link-label"], g[data-edge-labels-hidden] [part="community-label"] { display: none; } g[data-node-labels-hidden] [part="label"] { display: none; } [part="empty"] { color: var(--lr-color-text-quiet); font-size: var(--lr-font-size-md-sm); } [part="error"] { margin: 0; padding: var(--lr-space-l); color: var(--lr-color-danger); font-size: var(--lr-font-size-md-sm); text-align: center; } [part="expand-indicator"] circle { fill: var(--lr-color-surface); stroke: var(--lr-color-border-strong); stroke-width: var(--lr-border-width-thin); } [part="expand-indicator"] path { stroke: var(--lr-color-text); stroke-width: var(--lr-border-width-thin); fill: none; } [part="focus-halo"] { fill: none; stroke: var(--lr-graph-focus-halo-color, var(--lr-color-brand)); stroke-width: var(--lr-border-width-medium); pointer-events: none; } [part="node"][data-selected] { stroke: var(--lr-graph-selected-color, var(--lr-color-success)); stroke-width: var(--lr-border-width-medium); } [part="link"][data-selected] { stroke: var(--lr-graph-selected-color, var(--lr-color-success)) !important; stroke-width: var(--lr-border-width-thick); } [part="link"][data-selected]:hover { stroke: color-mix( in oklab, var(--lr-graph-selected-color, var(--lr-color-success)), var(--lr-color-mix-partner) var(--lr-color-mix-hover) ) !important; } [part="link"][data-selected]:active { stroke: color-mix( in oklab, var(--lr-graph-selected-color, var(--lr-color-success)), var(--lr-color-mix-partner) var(--lr-color-mix-active) ) !important; } [part="node"][data-dimmed] { opacity: var(--lr-graph-dimmed-opacity, 0.35); } [part="link"][data-dimmed] { opacity: var(--lr-graph-dimmed-opacity, 0.35); } [data-hit-area="link"][data-inert] { pointer-events: none; } [part="hull"] { fill: var(--lr-graph-hull-fill, var(--lr-color-brand)); stroke: var(--lr-graph-hull-fill, var(--lr-color-brand)); stroke-width: calc(var(--lr-size-24px) * 2); stroke-linejoin: round; stroke-linecap: round; opacity: var(--lr-graph-hull-opacity, 0.12); cursor: pointer; } [part="hull"]:hover { fill: color-mix( in oklab, var(--lr-graph-hull-fill, var(--lr-color-brand)), var(--lr-color-mix-partner) var(--lr-color-mix-hover) ); stroke: color-mix( in oklab, var(--lr-graph-hull-fill, var(--lr-color-brand)), var(--lr-color-mix-partner) var(--lr-color-mix-hover) ); } [part="hull"]:active { fill: color-mix( in oklab, var(--lr-graph-hull-fill, var(--lr-color-brand)), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); stroke: color-mix( in oklab, var(--lr-graph-hull-fill, var(--lr-color-brand)), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part="hull"]:focus-visible { ${focusRing} } [part="community-label"] { font-size: var(--lr-font-size-2xs); fill: var(--lr-color-text); font-family: var(--lr-font); text-anchor: middle; pointer-events: none; paint-order: stroke; stroke: var(--lr-graph-edge-label-halo, var(--lr-color-surface)); stroke-width: var(--lr-border-width-thick); } `;export{styles};
1
+ import{focusRing}from"../../../internal/interactive-control.styles.js";import{css}from"lit";const styles=css` :host { display: block; block-size: var( --lr-canvas-reserved-height, var(--_lr-graph-requested-height, var(--lr-size-24rem)) ); } .source-layout { display: flex; flex-direction: column; block-size: 100%; min-inline-size: 0; min-block-size: 0; } .source-diagram { flex: 1 1 50%; min-block-size: 0; } [part="source-navigator"] { flex: 0 1 50%; min-block-size: 0; min-inline-size: 0; overflow: auto; padding: var(--lr-space-s); border-block-start: var(--lr-border-width-thin) solid var(--lr-color-border); } .source-list [part="source-navigator"] { flex: 1 1 auto; } .source-toolbar { display: flex; flex-wrap: wrap; gap: var(--lr-space-s); } .source-toolbar input { flex: 1 1 auto; min-inline-size: 0; } .source-rows { list-style: none; padding: 0; margin-block: var(--lr-space-s); } .source-rows li { display: flex; flex-wrap: wrap; gap: var(--lr-space-xs); margin-block: var(--lr-space-xs); } [part="source-navigator"] :where(button, input, select), [part="source-status"] button { --_lr-source-fill: var(--lr-color-neutral-fill-quiet); min-block-size: var(--lr-icon-button-size); min-inline-size: var(--lr-icon-button-size); max-inline-size: 100%; padding: var(--lr-space-xs) var(--lr-space-s); border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-radius-xs); font: inherit; color: var(--lr-color-text); background: var(--_lr-source-fill); transition: var(--lr-transition-interactive); overflow-wrap: anywhere; } [part~="source-row"] { flex: 1 1 auto; text-align: start; } [part~="source-row"]:where([aria-pressed="true"]) { --_lr-source-fill: var(--lr-color-brand-fill-quiet); } [part="source-navigator"] button, [part="source-status"] button { cursor: pointer; } [part="source-navigator"] :where(button, input, select):hover, [part="source-status"] button:hover { background: color-mix(in oklab, var(--_lr-source-fill), var(--lr-color-mix-partner) var(--lr-color-mix-hover)); } [part="source-navigator"] button:active, [part="source-status"] button:active { background: color-mix(in oklab, var(--_lr-source-fill), var(--lr-color-mix-partner) var(--lr-color-mix-active)); } [part="source-navigator"] :where(button, input, select):focus-visible, [part="source-status"] button:focus-visible { ${focusRing} } [part="source-status"], [part="source-coverage"] { overflow-wrap: anywhere; margin-block: var(--lr-space-s); } [part="base"] { position: relative; inline-size: 100%; block-size: 100%; } .spatial-base { display: flex; flex-direction: column; min-inline-size: 0; overflow: hidden; } [part="spatial-toolbar"], [part="spatial-pagination"] { display: flex; flex-wrap: wrap; gap: var(--lr-space-s); padding: var(--lr-space-s); } [part="spatial-control"], [part="spatial-list-item"] { --_lr-spatial-fill: var(--lr-color-neutral-fill-quiet); min-inline-size: var(--lr-icon-button-size); min-block-size: var(--lr-icon-button-size); padding: var(--lr-space-s) var(--lr-space-m); border: var(--lr-border-width-thin) solid var(--lr-color-border); border-radius: var(--lr-radius-xs); background: var(--_lr-spatial-fill); color: var(--lr-color-text); font: inherit; cursor: pointer; transition: var(--lr-transition-interactive); overflow-wrap: anywhere; } [part="spatial-control"]:where([aria-pressed="true"]), [part="spatial-list-item"]:where([aria-pressed="true"], [aria-current="true"]) { --_lr-spatial-fill: var(--lr-color-brand-fill-quiet); } [part="spatial-control"]:hover:where(:not(:disabled)), [part="spatial-list-item"]:hover { background: color-mix(in oklab, var(--_lr-spatial-fill), var(--lr-color-mix-partner) var(--lr-color-mix-hover)); } [part="spatial-control"]:active:where(:not(:disabled)), [part="spatial-list-item"]:active { background: color-mix(in oklab, var(--_lr-spatial-fill), var(--lr-color-mix-partner) var(--lr-color-mix-active)); } [part="spatial-control"]:focus-visible, [part="spatial-list-item"]:focus-visible, [part="spatial-canvas"]:focus-visible { ${focusRing} } [part="spatial-control"]:disabled { cursor: default; opacity: var(--lr-opacity-disabled); } [part="spatial-instructions"], [part="spatial-page-count"] { margin: 0; padding: var(--lr-space-s); font-size: var(--lr-font-size-sm); overflow-wrap: anywhere; } [part="spatial-canvas"] { min-inline-size: var(--lr-icon-button-size); display: block; flex: 1 1 auto; inline-size: 100%; block-size: 0; min-block-size: var(--lr-icon-button-size); touch-action: none; transition: var(--lr-transition-interactive); } .webgl-surface { position: relative; } .webgl-surface[hidden] { display: none; } [data-graph-labels] { position: absolute; inset: 0; inline-size: 100%; block-size: 100%; pointer-events: none; } [part="spatial-list"] { min-block-size: 0; overflow: auto; padding: var(--lr-space-s); } [part="spatial-list"] ul { list-style: none; margin: 0; padding: 0; } [part="spatial-list-item"] { inline-size: 100%; text-align: start; margin-block-end: var(--lr-space-xs); } svg { display: block; inline-size: 100%; block-size: 100%; } [part="canvas"] { display: block; inline-size: 100%; block-size: 100%; touch-action: none; transition: background-color var(--lr-transition-fast); } [part="canvas"]:focus-visible { ${focusRing} } [part="canvas"]:hover, [part="spatial-canvas"]:hover { background: color-mix( in oklab, transparent, var(--lr-color-mix-partner) var(--lr-color-mix-hover) ); } [part="tooltip"] { position: absolute; left: 0; top: 0; pointer-events: none; background: var(--lr-color-surface); color: var(--lr-color-text); font-size: var(--lr-font-size-2xs); font-family: var(--lr-font); padding-block: var(--lr-size-2px); padding-inline: var(--lr-size-6px); border-radius: var(--lr-radius-xs); border: var(--lr-border-width-thin) solid var(--lr-color-border-subtle); z-index: var(--lr-layer-content); transform: translate(var(--lr-size-6px), calc(-100% - var(--lr-size-6px))); max-inline-size: min( calc(100% - var(--lr-size-0-75rem)), calc(100vw - var(--lr-size-0-75rem)) ); overflow-wrap: anywhere; white-space: normal; } [part="tooltip"][hidden] { display: none; } [part="link"] { stroke: var(--lr-graph-edge-color, var(--lr-color-border)); fill: none; cursor: pointer; } [data-hit-area] { fill: none; stroke: var(--lr-color-text); stroke-opacity: 0.001; stroke-width: calc( var(--lr-size-24px) * var(--_lr-graph-hit-area-scale, 1) ); cursor: pointer; } [data-hit-area="node"], [data-hit-area="link"] { stroke-linecap: round; pointer-events: stroke; } [data-hit-area="hull"] { fill: transparent; stroke-linecap: round; stroke-linejoin: round; pointer-events: all; } [part="link"]:hover { stroke: color-mix( in oklab, var(--lr-graph-edge-color, var(--lr-color-border)), var(--lr-color-mix-partner) var(--lr-color-mix-hover) ); } [part="link"]:active { stroke: color-mix( in oklab, var(--lr-graph-edge-color, var(--lr-color-border)), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part="arrowhead"] { fill: context-stroke; } [part="link"]:focus-visible { ${focusRing} } [part="link"][data-dangling] { stroke-dasharray: var(--lr-size-2px) var(--lr-size-2px); opacity: var(--lr-opacity-disabled); } [part="node"] { fill: var(--lr-graph-node-fill, var(--lr-color-brand)); cursor: pointer; } [part="node"]:hover { fill: color-mix( in oklab, var(--lr-graph-node-fill, var(--lr-color-brand)), var(--lr-color-mix-partner) var(--lr-color-mix-hover) ); } [part="node"]:active { fill: color-mix( in oklab, var(--lr-graph-node-fill, var(--lr-color-brand)), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part="node"]:focus-visible { ${focusRing} } [part="label"] { font-size: var(--lr-font-size-2xs); fill: var(--lr-color-text); font-family: var(--lr-font); pointer-events: none; } [part="link-label"] { font-size: var(--lr-font-size-2xs); fill: var(--lr-color-text); font-family: var(--lr-font); pointer-events: none; paint-order: stroke; stroke: var(--lr-graph-edge-label-halo, var(--lr-color-surface)); stroke-width: var(--lr-border-width-thick); } g[data-edge-labels-hidden] [part="link-label"], g[data-edge-labels-hidden] [part="community-label"] { display: none; } g[data-node-labels-hidden] [part="label"] { display: none; } [part="empty"] { color: var(--lr-color-text-quiet); font-size: var(--lr-font-size-md-sm); } [part="error"] { margin: 0; padding: var(--lr-space-l); color: var(--lr-color-danger); font-size: var(--lr-font-size-md-sm); text-align: center; } [part="expand-indicator"] circle { fill: var(--lr-color-surface); stroke: var(--lr-color-border-strong); stroke-width: var(--lr-border-width-thin); } [part="expand-indicator"] path { stroke: var(--lr-color-text); stroke-width: var(--lr-border-width-thin); fill: none; } [part="focus-halo"] { fill: none; stroke: var(--lr-graph-focus-halo-color, var(--lr-color-brand)); stroke-width: var(--lr-border-width-medium); pointer-events: none; } [part="node"][data-selected] { stroke: var(--lr-graph-selected-color, var(--lr-color-success)); stroke-width: var(--lr-border-width-medium); } [part="link"][data-selected] { stroke: var(--lr-graph-selected-color, var(--lr-color-success)) !important; stroke-width: var(--lr-border-width-thick); } [part="link"][data-selected]:hover { stroke: color-mix( in oklab, var(--lr-graph-selected-color, var(--lr-color-success)), var(--lr-color-mix-partner) var(--lr-color-mix-hover) ) !important; } [part="link"][data-selected]:active { stroke: color-mix( in oklab, var(--lr-graph-selected-color, var(--lr-color-success)), var(--lr-color-mix-partner) var(--lr-color-mix-active) ) !important; } [part="node"][data-dimmed] { opacity: var(--lr-graph-dimmed-opacity, 0.35); } [part="link"][data-dimmed] { opacity: var(--lr-graph-dimmed-opacity, 0.35); } [data-hit-area="link"][data-inert] { pointer-events: none; } [part="hull"] { fill: var(--lr-graph-hull-fill, var(--lr-color-brand)); stroke: var(--lr-graph-hull-fill, var(--lr-color-brand)); stroke-width: calc(var(--lr-size-24px) * 2); stroke-linejoin: round; stroke-linecap: round; opacity: var(--lr-graph-hull-opacity, 0.12); cursor: pointer; } [part="hull"]:hover { fill: color-mix( in oklab, var(--lr-graph-hull-fill, var(--lr-color-brand)), var(--lr-color-mix-partner) var(--lr-color-mix-hover) ); stroke: color-mix( in oklab, var(--lr-graph-hull-fill, var(--lr-color-brand)), var(--lr-color-mix-partner) var(--lr-color-mix-hover) ); } [part="hull"]:active { fill: color-mix( in oklab, var(--lr-graph-hull-fill, var(--lr-color-brand)), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); stroke: color-mix( in oklab, var(--lr-graph-hull-fill, var(--lr-color-brand)), var(--lr-color-mix-partner) var(--lr-color-mix-active) ); } [part="hull"]:focus-visible { ${focusRing} } [part="community-label"] { font-size: var(--lr-font-size-2xs); fill: var(--lr-color-text); font-family: var(--lr-font); text-anchor: middle; pointer-events: none; paint-order: stroke; stroke: var(--lr-graph-edge-label-halo, var(--lr-color-surface)); stroke-width: var(--lr-border-width-thick); } `;export{styles};
@@ -68,7 +68,7 @@ assessment:Readonly<GroundingAssessment> |null;
68
68
  /** Evidence citations backing the assessment, each rendered as an `<lr-citation-badge>` linking
69
69
  * back to its exact `span`. Independent of `assessment` -- the evidence section is simply
70
70
  * omitted when this is empty, same as the warnings section is omitted when `assessment.warnings`
71
- * is empty/unset. */
71
+ * is empty/unset. Assign a new array to update: mutating an array and assigning it again does not. */
72
72
  citations:readonly Citation[];
73
73
  /** Tone thresholds applied to both `coverage` and `confidence` (both 0-1 fractions): at or above
74
74
  * `high` renders `success`, at or above `medium` renders `warning`, below `medium` renders
@@ -120,7 +120,7 @@ export interface IngestionCancelEventDetail extends CancelEventDetail{itemId:str
120
120
  */
121
121
  export declare class LyraIngestionQueue extends LyraElement<LyraIngestionQueueEventMap>{protected static collectionSupport:import("../../../internal/lyra-element.js").LyraCollectionSupport;protected static readonly identityCollectionProperties:readonly string[];protected static readonly ownedCollectionProperties:readonly string[];static styles:import("lit").CSSResultGroup[];
122
122
  /** The queue to render, in display order. Controlled and never mutated by this component --
123
- * pass a new array (e.g. as ingestion progresses) to update it. */
123
+ * pass a new array (e.g. as ingestion progresses) to update it. Assign a new array to update: mutating an array and assigning it again does not. */
124
124
  items:readonly IngestionQueueItem[];private _dataSource?;private sourceEpoch;private sourceSyncing;private sourceInputs?;private sourceSize?;private sourceResult?;private sourceRows;private readonly sourceItemIdentities;private sourceStateVersion;private readonly sourcePages;
125
125
  /** Full queue provider. A present invalid source fails visibly; undefined restores items.
126
126
  * Reassign even the same source or call requestUpdate() to publish a new provider snapshot. */
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{collectionSupport,publicCollectionTruncation}from"../../../internal/collection-snapshot.js";import{html,nothing,svg}from"lit";import{property,state}from"lit/decorators.js";import{guard}from"lit/directives/guard.js";import{repeat}from"lit/directives/repeat.js";import{LyraElement}from"../../../internal/lyra-element.js";import{firstByRetrievalIdentity,isNonBlankIdentity,isRecord}from"../retrieval-identity.js";import{readOwnDataValue}from"../../../internal/data-descriptors.js";import{srOnly}from"../../../internal/a11y.js";import{acquireAnnouncementSink,AnnouncementSinkController}from"../../../internal/announcer.js";import{SourcePageController}from"../../../internal/source-page-controller.js";import{getOwnDataDescriptor,MISSING_OWN_DATA_DESCRIPTOR,UNSAFE_OWN_DATA_DESCRIPTOR}from"../../../internal/data-descriptors.js";import{finiteCount,finiteInteger}from"../../../internal/numbers.js";import{getListFormat,getNumberFormat}from"../../../internal/intl-cache.js";import{closeIcon}from"../../../internal/icons.js";import{styles}from"./ingestion-queue.styles.js";import{retrievalSemanticLabel,retrievalSemanticRole}from"../retrieval-semantic-owner.js";import{LYRA_DEFAULT_ingestionAttemptCount,LYRA_DEFAULT_ingestionCancelWithContext,LYRA_DEFAULT_ingestionChunkCount,LYRA_DEFAULT_ingestionEmbeddedOfTotal,LYRA_DEFAULT_ingestionItemProgressLabel,LYRA_DEFAULT_ingestionQueueEmpty,LYRA_DEFAULT_ingestionQueueInputLimit,LYRA_DEFAULT_ingestionQueueLabel,LYRA_DEFAULT_ingestionRetryWithContext,LYRA_DEFAULT_ingestionStageCancelled,LYRA_DEFAULT_ingestionStageChunking,LYRA_DEFAULT_ingestionStageDone,LYRA_DEFAULT_ingestionStageEmbedding,LYRA_DEFAULT_ingestionStageExtracting,LYRA_DEFAULT_ingestionStageFailed,LYRA_DEFAULT_ingestionStageIndexing,LYRA_DEFAULT_ingestionStageQueued,LYRA_DEFAULT_ingestionStageUnknown,LYRA_DEFAULT_ingestionStageUploading,LYRA_DEFAULT_untitledSource}from"../../../internal/default-strings/retrieval.generated.js";import{LYRA_DEFAULT_cancel,LYRA_DEFAULT_loading,LYRA_DEFAULT_retry,LYRA_DEFAULT_tableLoadFailed}from"../../../internal/default-strings/shared.generated.js";const INGESTION_STAGES=new Set(["queued","uploading","extracting","chunking","embedding","indexing","done","failed","cancelled"]);function normalizedStage(stage){return INGESTION_STAGES.has(stage)?stage:"unknown"}const ACTIVE_STAGES=["uploading","extracting","chunking","embedding","indexing"],CANCELABLE_STAGES=["queued",...ACTIVE_STAGES];function badgeVariantForStage(stage){switch(stage){case"done":return"success";case"failed":return"danger";case"queued":case"cancelled":case"unknown":return"neutral";default:return"brand"}}const SOURCE_QUERY=Object.freeze({}),ICON_VIEW_BOX="0 0 24 24",ICON_STROKE_WIDTH="1.75";function retryIcon(){return svg`
1
+ import{__decorate}from"tslib";import{collectionSupport,publicCollectionTruncation}from"../../../internal/collection-snapshot.js";import{html,nothing,svg}from"lit";import{property,state}from"lit/decorators.js";import{repeat}from"lit/directives/repeat.js";import{LyraElement}from"../../../internal/lyra-element.js";import{firstByRetrievalIdentity,isNonBlankIdentity,isRecord}from"../retrieval-identity.js";import{readOwnDataValue}from"../../../internal/data-descriptors.js";import{srOnly}from"../../../internal/a11y.js";import{acquireAnnouncementSink,AnnouncementSinkController}from"../../../internal/announcer.js";import{SourcePageController}from"../../../internal/source-page-controller.js";import{getOwnDataDescriptor,MISSING_OWN_DATA_DESCRIPTOR,UNSAFE_OWN_DATA_DESCRIPTOR}from"../../../internal/data-descriptors.js";import{finiteCount,finiteInteger}from"../../../internal/numbers.js";import{getListFormat,getNumberFormat}from"../../../internal/intl-cache.js";import{closeIcon}from"../../../internal/icons.js";import{styles}from"./ingestion-queue.styles.js";import{retrievalSemanticLabel,retrievalSemanticRole}from"../retrieval-semantic-owner.js";import{LYRA_DEFAULT_ingestionAttemptCount,LYRA_DEFAULT_ingestionCancelWithContext,LYRA_DEFAULT_ingestionChunkCount,LYRA_DEFAULT_ingestionEmbeddedOfTotal,LYRA_DEFAULT_ingestionItemProgressLabel,LYRA_DEFAULT_ingestionQueueEmpty,LYRA_DEFAULT_ingestionQueueInputLimit,LYRA_DEFAULT_ingestionQueueLabel,LYRA_DEFAULT_ingestionRetryWithContext,LYRA_DEFAULT_ingestionStageCancelled,LYRA_DEFAULT_ingestionStageChunking,LYRA_DEFAULT_ingestionStageDone,LYRA_DEFAULT_ingestionStageEmbedding,LYRA_DEFAULT_ingestionStageExtracting,LYRA_DEFAULT_ingestionStageFailed,LYRA_DEFAULT_ingestionStageIndexing,LYRA_DEFAULT_ingestionStageQueued,LYRA_DEFAULT_ingestionStageUnknown,LYRA_DEFAULT_ingestionStageUploading,LYRA_DEFAULT_untitledSource}from"../../../internal/default-strings/retrieval.generated.js";import{LYRA_DEFAULT_cancel,LYRA_DEFAULT_loading,LYRA_DEFAULT_retry,LYRA_DEFAULT_tableLoadFailed}from"../../../internal/default-strings/shared.generated.js";const INGESTION_STAGES=new Set(["queued","uploading","extracting","chunking","embedding","indexing","done","failed","cancelled"]);function normalizedStage(stage){return INGESTION_STAGES.has(stage)?stage:"unknown"}const ACTIVE_STAGES=["uploading","extracting","chunking","embedding","indexing"],CANCELABLE_STAGES=["queued",...ACTIVE_STAGES];function badgeVariantForStage(stage){switch(stage){case"done":return"success";case"failed":return"danger";case"queued":case"cancelled":case"unknown":return"neutral";default:return"brand"}}const SOURCE_QUERY=Object.freeze({}),ICON_VIEW_BOX="0 0 24 24",ICON_STROKE_WIDTH="1.75";function retryIcon(){return svg`
2
2
  <svg
3
3
  width="1em"
4
4
  height="1em"
@@ -63,7 +63,7 @@ import{__decorate}from"tslib";import{collectionSupport,publicCollectionTruncatio
63
63
  `}}static{this.defaultStrings={...super.defaultStrings,cancel:LYRA_DEFAULT_cancel,ingestionAttemptCount:LYRA_DEFAULT_ingestionAttemptCount,ingestionCancelWithContext:LYRA_DEFAULT_ingestionCancelWithContext,ingestionChunkCount:LYRA_DEFAULT_ingestionChunkCount,ingestionEmbeddedOfTotal:LYRA_DEFAULT_ingestionEmbeddedOfTotal,ingestionItemProgressLabel:LYRA_DEFAULT_ingestionItemProgressLabel,ingestionQueueEmpty:LYRA_DEFAULT_ingestionQueueEmpty,ingestionQueueInputLimit:LYRA_DEFAULT_ingestionQueueInputLimit,ingestionQueueLabel:LYRA_DEFAULT_ingestionQueueLabel,ingestionRetryWithContext:LYRA_DEFAULT_ingestionRetryWithContext,ingestionStageCancelled:LYRA_DEFAULT_ingestionStageCancelled,ingestionStageChunking:LYRA_DEFAULT_ingestionStageChunking,ingestionStageDone:LYRA_DEFAULT_ingestionStageDone,ingestionStageEmbedding:LYRA_DEFAULT_ingestionStageEmbedding,ingestionStageExtracting:LYRA_DEFAULT_ingestionStageExtracting,ingestionStageFailed:LYRA_DEFAULT_ingestionStageFailed,ingestionStageIndexing:LYRA_DEFAULT_ingestionStageIndexing,ingestionStageQueued:LYRA_DEFAULT_ingestionStageQueued,ingestionStageUnknown:LYRA_DEFAULT_ingestionStageUnknown,ingestionStageUploading:LYRA_DEFAULT_ingestionStageUploading,loading:LYRA_DEFAULT_loading,retry:LYRA_DEFAULT_retry,tableLoadFailed:LYRA_DEFAULT_tableLoadFailed,untitledSource:LYRA_DEFAULT_untitledSource}}static{this.collectionSupport=collectionSupport}static{this.identityCollectionProperties=Object.freeze(["items"])}static{this.ownedCollectionProperties=Object.freeze(["items"])}static{this.styles=[LyraElement.styles,styles,srOnly]}get dataSource(){return this._dataSource}set dataSource(value){const previous=this._dataSource;this._dataSource=value,this.sourceEpoch++,this.requestUpdate("dataSource",previous)}get sourceTotal(){return this.sourceMode?this.sourcePages.state.result?.total??null:null}get sourceMode(){return this.dataSource!==void 0}get sourceFailed(){return this.sourceMode&&!this.sourcePages.state.pending&&!this.sourcePages.state.result}get sourceBlocked(){return this.sourceMode&&(!this.isConnected||this.sourcePages.state.pending||this.sourceFailed)}projectSourceItem(record,isCurrent){const assertCurrent=()=>{if(!isCurrent())throw new TypeError("Obsolete source record")},descriptorOf=(target,key)=>{assertCurrent();const descriptor=getOwnDataDescriptor(target,key);return assertCurrent(),descriptor};assertCurrent();const field=(value2,key)=>{if(!isRecord(value2))throw new TypeError("Invalid source item");const descriptor=descriptorOf(value2,key);if(descriptor===UNSAFE_OWN_DATA_DESCRIPTOR)throw new TypeError("Invalid source field");return descriptor===MISSING_OWN_DATA_DESCRIPTOR?void 0:descriptor.value};let units=0;const text=(value2,required=!1)=>{if(!(value2===void 0&&!required)){if(typeof value2!="string"||value2.length>65536||(units+=value2.length)>65536)throw new TypeError("Invalid source text");return value2}},raw=record.value,id=text(field(raw,"id"),!0),rawDocument=field(raw,"document"),documentId=text(field(rawDocument,"id"),!0);if(id!==record.key||!isNonBlankIdentity(documentId))throw new TypeError("Invalid source identity");const document=Object.freeze({id:documentId,name:text(field(rawDocument,"name"),!0),mimeType:text(field(rawDocument,"mimeType")),uri:text(field(rawDocument,"uri")),version:text(field(rawDocument,"version"))}),stage=text(field(raw,"stage")),errorValue=field(raw,"error"),error=errorValue==null?void 0:text(typeof errorValue=="string"?errorValue:this.localize("ingestionStageFailed")),numbers={};for(const key of["progress","chunkCount","embeddedChunkCount","attempts"]){const value2=field(raw,key);if(value2!==void 0){if(typeof value2!="number")throw new TypeError("Invalid source number");numbers[key]=value2}}const value=Object.freeze({id,document,stage,error,...numbers});return assertCurrent(),this.sourceItemIdentities.add(value),errorValue!=null&&typeof errorValue!="string"&&this.fallbackFailureItems.add(value),assertCurrent(),{key:record.key,order:record.order,value}}syncSource(){if(!(!this.sourcePages||this.sourceSyncing)){this.sourceSyncing=!0;try{if(!this.sourceMode){this.sourceInputs&&this.sourcePages.bind(void 0),this.sourceInputs=void 0,this.sourceSize=void 0,this.sourceResult=void 0,this.sourceRows=[];return}const source=this.dataSource,size=finiteInteger(this.sourcePageSize,100,1,500);let page=finiteInteger(this.sourcePage,0,0,Math.floor(Number.MAX_SAFE_INTEGER/size));this.sourceSize!==void 0&&this.sourceSize!==size&&(page=0,this.sourcePage=0),this.sourceSize=size;const revision=source.revision,inputs=[source,revision,this.sourceEpoch,this.effectiveLocale,size,page];if(this.sourceInputs&&inputs.every((value,index)=>value===this.sourceInputs[index]))return;this.sourceInputs=inputs,this.sourceRows=[],this.sourceResult=void 0,this.sourcePages.bind({source,revision,epoch:this.sourceEpoch,locale:this.effectiveLocale}),this.sourcePages.request(SOURCE_QUERY,page,size)}catch{this.sourcePages.bind(void 0),this.sourceRows=[],this.sourceResult=void 0}finally{this.sourceSyncing=!1}}}acceptSourcePage(){const result=this.sourcePages.state.result;!result||result===this.sourceResult||(this.sourceResult=result,this.sourceRows=result.rows.map(record=>record.value),this.sourcePage!==this.sourcePages.state.page&&(this.sourceSyncing=!0,this.sourcePage=this.sourcePages.state.page,this.sourceSyncing=!1,this.sourceInputs=this.sourceInputs?[...this.sourceInputs.slice(0,-1),this.sourcePages.state.page]:void 0))}requestUpdate(...args){args[0]===void 0&&(this.sourceEpoch=(this.sourceEpoch??0)+1),(args[0]===void 0||["dataSource","sourcePage","sourcePageSize"].includes(String(args[0])))&&this.syncSource(),super.requestUpdate(...args)}onSourceRetry(source,state2){!this.isConnected||!this.sourceMode||!this.sourceFailed||this.dataSource!==source||this.sourcePages.state!==state2||(this.sourceInputs=void 0,this.syncSource(),this.sourceStateVersion++)}adoptedCallback(){super.adoptedCallback(),this.limitAnnouncements.adopted(),this.sourcePages.adopted(),this.sourceStatusInitialized=!1}inputLimitText(){const truncation=publicCollectionTruncation(this,"items"),number=getNumberFormat(this.effectiveLocale);return truncation?this.localize("ingestionQueueInputLimit",void 0,{count:number.format(truncation.retained),total:number.format(truncation.source)}):""}updated(changed){if(super.updated(changed),this.sourceMode){const status=this.sourceFailed?this.localize("tableLoadFailed"):this.sourcePages.state.pending?this.localize("loading"):"";this.sourceStatusInitialized&&status&&status!==this.previousSourceStatus&&this.limitAnnouncements.announcePolite(status),this.sourceStatusInitialized=!0,this.previousSourceStatus=status;return}this.sourceStatusInitialized=!1,this.previousSourceStatus="";const inputTruncated=publicCollectionTruncation(this,"items")!==void 0;this.limitInitialized&&inputTruncated&&!this.previouslyInputTruncated&&this.limitAnnouncements.announcePolite(this.inputLimitText()),this.limitInitialized=!0,this.previouslyInputTruncated=inputTruncated}renderInputLimit(){const text=this.inputLimitText();return text?html`<p part="limit" role="note">${text}</p>`:nothing}get effectiveVirtualizeAt(){return finiteCount(this.virtualizeAt,DEFAULT_VIRTUALIZE_AT)}normalizeItems(value){const rows=[];for(const valueItem of Array.isArray(value)?value:[])try{if(!isRecord(valueItem))continue;const id=readOwnDataValue(valueItem,"id"),source=readOwnDataValue(valueItem,"document");if(!isNonBlankIdentity(id)||!isRecord(source))continue;const documentId=readOwnDataValue(source,"id"),name=readOwnDataValue(source,"name");if(!isNonBlankIdentity(documentId)||typeof name!="string")continue;const document=Object.freeze(Object.fromEntries(["id","name","mimeType","uri","version"].map(key=>[key,readOwnDataValue(source,key)]).filter(([,field])=>field!==void 0))),fields=Object.fromEntries(["stage","progress","chunkCount","embeddedChunkCount","attempts"].map(key=>[key,readOwnDataValue(valueItem,key)]).filter(([,field])=>field!==void 0)),error=readOwnDataValue(valueItem,"error"),row=Object.freeze({...fields,id,document,...error===void 0?{}:{error:error===null||typeof error=="string"?error:this.localize("ingestionStageFailed")}});error!=null&&typeof error!="string"&&this.fallbackFailureItems.add(row),rows.push(row)}catch{continue}return firstByRetrievalIdentity(rows,item=>item.id)}get normalizedItems(){const cached=this.normalizedItemsCache;if(cached&&cached.source===this.items&&cached.locale===this.effectiveLocale&&cached.failureText===this.localize("ingestionStageFailed"))return cached.result;const result=this.normalizeItems(this.items);return this.normalizedItemsCache={source:this.items,locale:this.effectiveLocale,failureText:this.localize("ingestionStageFailed"),result},result}connectedCallback(){super.connectedCallback(),this.sink??=acquireAnnouncementSink("assertive",{document:this.ownerDocument,source:this})}disconnectedCallback(){super.disconnectedCallback(),this.failureLiveText="",this.sourceStatusInitialized=!1,this.previousSourceStatus="",this.isMounting=!0,this.sink?.release(),this.sink=void 0}willUpdate(changed){if(super.willUpdate(changed),this.syncSource(),this.sourceMode){this.acceptSourcePage(),this.failureLiveText="",this.isMounting=!0;return}const wasMounting=this.isMounting;if(this.isMounting=!1,wasMounting){this.announce&&!this.initialFailuresAnnounced&&(this.initialFailuresAnnounced=!0,this.announceFailures(this.normalizedItems.flatMap(item=>item.stage==="failed"&&item.error?[item.error]:[])));return}if(!changed.has("items"))return;const previousItems=this.normalizedItemsCache?.result??[],previousById=new Map(previousItems.map(item=>[item.id,item]));this.announceFailures(this.normalizedItems.flatMap(item=>{if(item.stage!=="failed"||!item.error)return[];const previous=previousById.get(item.id),previousError=previous&&this.fallbackFailureItems.has(previous)?this.localize("ingestionStageFailed"):previous?.error;return!previous||previous.stage!=="failed"||previousError!==item.error?[item.error]:[]}))}announceFailures(freshErrors){this.failureLiveText=freshErrors.length?getListFormat(this.effectiveLocale,{type:"conjunction"}).format(freshErrors):"",this.failureLiveText!==""&&this.sink?.announce(this.failureLiveText)}stageLabel(stage){switch(stage){case"queued":return this.localize("ingestionStageQueued");case"uploading":return this.localize("ingestionStageUploading");case"extracting":return this.localize("ingestionStageExtracting");case"chunking":return this.localize("ingestionStageChunking");case"embedding":return this.localize("ingestionStageEmbedding");case"indexing":return this.localize("ingestionStageIndexing");case"done":return this.localize("ingestionStageDone");case"failed":return this.localize("ingestionStageFailed");case"cancelled":return this.localize("ingestionStageCancelled");case"unknown":return this.localize("ingestionStageUnknown")}}chunkCountText(count){const safeCount=finiteCount(count);return this.localize("ingestionChunkCount",void 0,{count:getNumberFormat(this.effectiveLocale).format(safeCount),pluralCount:safeCount})}normalizedAttempts(item){return finiteCount(item.attempts??0,0,Number.MAX_SAFE_INTEGER-1)}onRetryClick(item){(this.sourceMode||this.sourceItemIdentities.has(item))&&(!this.sourceMode||this.sourceBlocked||!this.sourceRows.includes(item))||this.emit("lr-retry",{itemId:item.id,attempt:this.normalizedAttempts(item)+1})}onCancelClick(item){(this.sourceMode||this.sourceItemIdentities.has(item))&&(!this.sourceMode||this.sourceBlocked||!this.sourceRows.includes(item))||this.emit("lr-cancel",{itemId:item.id})}renderRows(items){return items.length>this.effectiveVirtualizeAt?html`<lr-virtual-list
64
64
  part="list"
65
65
  exportparts="item:item, item-header:item-header, item-name:item-name, item-stage:item-stage, item-progress:item-progress, item-meta:item-meta, item-chunk-count:item-chunk-count, item-embedding-status:item-embedding-status, item-attempts:item-attempts, item-error:item-error, item-actions:item-actions, retry-button:retry-button, cancel-button:cancel-button"
66
- .items=${guard([items],()=>items)}
66
+ .items=${items}
67
67
  .renderItem=${item=>this.itemTemplate(item,!1)}
68
68
  .keyFunction=${this.ingestionItemKey}
69
69
  @lr-virtual-scroll=${this.stopOwnedEvent}
@@ -1,4 +1,4 @@
1
- import type{GraphSource}from'../graph/graph.class.js';export type KnowledgeGraphExplorerSource=GraphSource;import type{LyraSearchChangeDetail}from'../../../internal/text-viewer-target.js';import type{LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraNodeTypeStyle}from'../../../internal/node-type-style.js';export type{LyraNodeTypeStyle}from'../../../internal/node-type-style.js';import type{LyraGraphCamera,LyraGraphView,LyraGraphCommunity,LyraGraphFit,LyraGraphNodeLabelsMode,LyraGraphRenderer,LyraGraphEdge,LyraGraphNode}from'../graph/graph.class.js';import type{LyraEntity}from'../entity-card/entity-card.class.js';import type{LyraPathElement}from'../path-strip/path-strip.class.js';export type{LyraPathElement}from'../path-strip/path-strip.class.js';import'../graph/graph.class.js';import'../graph-legend/graph-legend.class.js';import'../entity-card/entity-card.class.js';import'../neighbor-list/neighbor-list.class.js';import'../../overlays/overlay/popover.class.js';import'../../forms/input/input.class.js';import'../../forms/button/button.class.js';
1
+ import{type Engine3dPreference,type Engine3dFallbackDetail}from'../../../internal/engine-3d.js';import type{GraphSource}from'../graph/graph.class.js';export type KnowledgeGraphExplorerSource=GraphSource;import type{LyraSearchChangeDetail}from'../../../internal/text-viewer-target.js';import type{LyraEventDetailSnapshot}from'../../../internal/lyra-element.js';import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraNodeTypeStyle}from'../../../internal/node-type-style.js';export type{LyraNodeTypeStyle}from'../../../internal/node-type-style.js';import type{LyraGraphCamera,LyraGraphView,LyraGraphCommunity,LyraGraphFit,LyraGraphNodeLabelsMode,LyraGraphRenderer,LyraGraphEdge,LyraGraphNode}from'../graph/graph.class.js';import type{LyraEntity}from'../entity-card/entity-card.class.js';import type{LyraPathElement}from'../path-strip/path-strip.class.js';export type{LyraPathElement}from'../path-strip/path-strip.class.js';import'../graph/graph.class.js';import'../graph-legend/graph-legend.class.js';import'../entity-card/entity-card.class.js';import'../neighbor-list/neighbor-list.class.js';import'../../overlays/overlay/popover.class.js';import'../../forms/input/input.class.js';import'../../forms/button/button.class.js';
2
2
  /** Extra `LyraEntity` fields a plain `LyraGraphNode` doesn't carry -- merged in by node id to build
3
3
  * the entity shown in the details popover and neighbor rows. A node with no entry here still
4
4
  * renders fine: `degree` falls back to a live count derived from `edges`, `description`/
@@ -38,7 +38,7 @@ export type KnowledgeGraphHighlight='selection'|'hover'|'none';export interface
38
38
  * complete updated array. This component already applies it to its own `hiddenTypes` before
39
39
  * emitting, the same self-toggle-then-emit contract `lr-pin-change`/`lr-search-change` follow,
40
40
  * so reassigning it back is optional and a direct host assignment stays silent. */
41
- 'lr-hidden-types-change':CustomEvent<LyraEventDetailSnapshot<{hiddenTypes:string[];}>>;'lr-node-activate':CustomEvent<{nodeId:string;x:number;y:number;z?:number;}>;'lr-camera-change':CustomEvent<{camera:LyraGraphCamera;}>;'lr-view-change':CustomEvent<{view:LyraGraphView;}>;'lr-edge-activate':CustomEvent<{sourceNodeId:string;targetNodeId:string;edgeId?:string;}>;'lr-node-expand':CustomEvent<{nodeId:string;}>;
41
+ 'lr-hidden-types-change':CustomEvent<LyraEventDetailSnapshot<{hiddenTypes:string[];}>>;'lr-node-activate':CustomEvent<{nodeId:string;x:number;y:number;z?:number;}>;'lr-engine-fallback':CustomEvent<Engine3dFallbackDetail>;'lr-camera-change':CustomEvent<{camera:LyraGraphCamera;}>;'lr-view-change':CustomEvent<{view:LyraGraphView;}>;'lr-edge-activate':CustomEvent<{sourceNodeId:string;targetNodeId:string;edgeId?:string;}>;'lr-node-expand':CustomEvent<{nodeId:string;}>;
42
42
  /** Bubbles unchanged from the composed `lr-graph`. */
43
43
  'lr-community-activate':CustomEvent<{communityId:string;}>;'lr-relation-activate':CustomEvent<{relation:string;sourceNodeId?:string;targetNodeId?:string;occurrenceIndex:number;}>;}
44
44
  /**
@@ -121,6 +121,7 @@ export type KnowledgeGraphHighlight='selection'|'hover'|'none';export interface
121
121
  * `detail: { hiddenTypes }`. See the class doc above. Direct host assignments do not emit.
122
122
  * @event lr-node-activate - Bubbles unchanged with `{ nodeId, x, y, z? }`; spatial activation
123
123
  * includes world z, while 2D retains its existing local x/y coordinates.
124
+ * @event lr-engine-fallback - Bubbles unchanged from the composed graph with `{ from, to, reason }`.
124
125
  * @event lr-camera-change - Bubbles unchanged from the composed graph with `{ camera }`.
125
126
  * Spatial detail popovers follow the newly projected node position.
126
127
  * @event lr-view-change - Bubbles from the graph toolbar with `{ view }`; the explorer updates
@@ -211,7 +212,9 @@ renderer:LyraGraphRenderer;
211
212
  /** Forwarded to lr-graph.view. '2d' preserves the default; '3d' uses real x/y/z positions and
212
213
  * an orbit camera; 'list' exposes all graph items through visible pagination. Spatial/list
213
214
  * views work without optional d3 peers. Toolbar changes also update this property. */
214
- view:LyraGraphView;
215
+ view:LyraGraphView;private _engine;
216
+ /** Optional 3D graph renderer preference, forwarded to the composed graph. */
217
+ get engine():Engine3dPreference;set engine(value:Engine3dPreference);
215
218
  /** Optional orbit-camera input forwarded to lr-graph.camera; camera changes bubble as
216
219
  * lr-camera-change. Angles use radians, distance and target use graph units. */
217
220
  camera?:LyraGraphCamera;
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{ref}from"lit/directives/ref.js";import{setGraphSourceComposition,resolveGraphSourceComposition,focusGraphSourceComposition}from"../graph/graph-source-composition.js";const EMPTY_SOURCE_NODES=Object.freeze([]),EMPTY_SOURCE_EDGES=Object.freeze([]);import{collectionSupport,publicCollectionTruncation}from"../../../internal/collection-snapshot.js";import{tag}from"../../../internal/prefix.js";import{html,nothing}from"lit";import{property,state,query}from"lit/decorators.js";import{guard}from"lit/directives/guard.js";import{LyraElement}from"../../../internal/lyra-element.js";import{finiteInteger,finiteRange}from"../../../internal/numbers.js";import{srOnly}from"../../../internal/a11y.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{styles}from"./knowledge-graph-explorer.styles.js";import{retrievalSemanticLabel,retrievalSemanticRole}from"../retrieval-semantic-owner.js";import{graphLengthConverter,graphLinkIdentity,normalizeGraphModel}from"../graph/graph-model.js";import{canonicalIdentityList,isNonBlankIdentity}from"../retrieval-identity.js";import"../graph/graph.class.js";import"../graph-legend/graph-legend.class.js";import"../entity-card/entity-card.class.js";import"../neighbor-list/neighbor-list.class.js";import"../../overlays/overlay/popover.class.js";import"../../forms/input/input.class.js";import"../../forms/button/button.class.js";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{LYRA_DEFAULT_graphDataListLimit,LYRA_DEFAULT_graphEdgeLimit,LYRA_DEFAULT_graphExplorerAllTypesHidden,LYRA_DEFAULT_graphExplorerClearTypes,LYRA_DEFAULT_graphExplorerFindPath,LYRA_DEFAULT_graphExplorerLabel,LYRA_DEFAULT_graphExplorerPin,LYRA_DEFAULT_graphExplorerPinned,LYRA_DEFAULT_graphExplorerPinnedHeading,LYRA_DEFAULT_graphExplorerSearchLimit,LYRA_DEFAULT_graphExplorerSearchPlaceholder,LYRA_DEFAULT_graphExplorerSearchResultsLabel,LYRA_DEFAULT_graphExplorerUnpin,LYRA_DEFAULT_graphExplorerUnpinned,LYRA_DEFAULT_graphNodeLimit}from"../../../internal/default-strings/retrieval.generated.js";import{LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_loading,LYRA_DEFAULT_statusError,LYRA_DEFAULT_viewerSearchMatchCount,LYRA_DEFAULT_viewerSearchNoMatches}from"../../../internal/default-strings/shared.generated.js";const SEARCH_RESULT_LIMIT=50;function isElementNode(value){if(typeof value!="object"||value===null)return!1;const candidate=value;return candidate.nodeType===1&&typeof candidate.matches=="function"&&typeof candidate.getBoundingClientRect=="function"}class LyraKnowledgeGraphExplorer extends LyraElement{constructor(){super(...arguments),this.sourceEpoch=0,this.sourceSearchVersion=0,this.sourceAssigned=!1,this.sourceClosing=!1,this.sourceDetailsOpen=!1,this.sourcePaint=0,this._sourcePage=0,this._sourcePageSize=100,this.sourceAccepted=snapshot=>{if(!snapshot.current()||this.graphSource===void 0||this.sourceChild?.graphSource!==this.graphSource)return;this.sourcePage!==snapshot.page&&(this.sourcePage=snapshot.page),this.sourcePaint++;const intent=this.sourceSearchIntent;if(!this.sourceFilter.invalid&&intent&&intent.epoch===this.sourceEpoch&&intent.version===this.sourceSearchVersion&&intent.query===this.query&&snapshot.query.kind==="nodes"&&snapshot.query.centerKey===null&&snapshot.query.search===intent.query&&snapshot.total!==null&&snapshot.current()){this.sourceSearchIntent=void 0;const detail={query:intent.query,matchCount:intent.query.trim()?snapshot.total:0,matchCountExact:!0,activeIndex:-1};snapshot.current()&&this.emit("lr-search-change",detail)}snapshot.current()&&this.inspectSourceSelection()},this.bindSourceChild=element=>{const graph=element;if(!graph){this.sourceChild&&setGraphSourceComposition(this.sourceChild,void 0),this.sourceChild=void 0,this.sourceChildBinding=void 0;return}this.sourceChild=graph;const size=finiteInteger(this.sourcePageSize,100,1,500),page=finiteInteger(this.sourcePage,0,0,Math.floor(Number.MAX_SAFE_INTEGER/size));if(graph.sourcePageSize!==size&&(graph.sourcePageSize=size),graph.sourcePage!==page&&(graph.sourcePage=page),this.graphSource===void 0){setGraphSourceComposition(graph,void 0),graph.graphSource!==void 0&&(graph.graphSource=void 0),this.sourceChildBinding=void 0;return}const filter=this.sourceFilter;setGraphSourceComposition(graph,{search:(this.query??"").slice(0,65536),nodeTypes:filter.nodeTypes,empty:filter.empty,accepted:this.sourceAccepted});const binding=[graph,this.graphSource,this.sourceEpoch];(!this.sourceChildBinding||binding.some((value,index)=>value!==this.sourceChildBinding[index]))&&(this.sourceChildBinding=binding,graph.graphSource=this.graphSource),this.inspectSourceSelection()},this.nodes=[],this.edges=[],this.nodeTypes=[],this.communities=[],this.entityDetails={},this.pinnedNodeIds=[],this.path=[],this.hiddenTypes=[],this.selectedNodeId=null,this.renderer="svg",this.view="2d",this.fitTo="none",this.width=800,this.height=600,this.highlight="selection",this.query="",this.pinLiveText="",this.hoveredNodeId=null,this.activeResult=0,this.activationGeneration=0,this.nodeById=new Map,this.linksByNodeId=new Map,this.degreeByNodeId=new Map,this.communityLabelById=new Map,this.announcements=new AnnouncementSinkController(this,{eager:["polite"]}),this.optionalRequest=!1,this.optionalGeneration=0,this.pathReady=!1,this.optionalFailed=!1,this.onVisibilityChange=event=>{event.stopPropagation(),this.hiddenTypes=event.detail.hiddenTypes,this.emit("lr-hidden-types-change",{hiddenTypes:this.hiddenTypes})},this.onVisibilityChangeProposal=event=>{event.stopPropagation()},this.onSearchInput=event=>{event.stopPropagation();const value=event.detail.value;if(this.query!==value){if(this.query=value,this.graphSource!==void 0){this.sourceSearchIntent={query:value,version:this.sourceSearchVersion,epoch:this.sourceEpoch};return}this.emit("lr-search-change",{query:value,matchCount:this.matchingNodes()?.length??0,matchCountExact:!0,activeIndex:-1})}},this.onEntityActivate=event=>{event.stopPropagation(),this.activateEntity(event.detail.entityId)},this.onGraphNodeClick=event=>{const id=event.detail.nodeId;if(this.graphSource!==void 0){this.activateSourceEntity(id);return}if(!this.canActivateNode(id))return;const generation=this.invalidateActivation();if(this.setInternalSelectedNodeId(id),this.view==="3d"){const graph=this.graphEl,point=graph?.getNodeScreenPosition(id),bounds=graph?.getBoundingClientRect();if(point&&bounds){this.trackedNodeEl=void 0,this.openDetailAt(id,{x:bounds.left+point.x,y:bounds.top+point.y,width:0,height:0});return}}this.pendingNodeId=id;const ownerDocument=this.ownerDocument,ownerWindow=ownerDocument.defaultView;ownerWindow&&ownerWindow.queueMicrotask(()=>{generation===this.activationGeneration&&this.isConnected&&this.ownerDocument===ownerDocument&&this.pendingNodeId===id&&(this.pendingNodeId=void 0,this.selectedNodeId===id&&this.isVisibleNode(id)&&this.activateEntity(id))})},this.onGraphNativeClick=event=>{const id=this.pendingNodeId;id&&(this.pendingNodeId=void 0,this.openDetailAt(id,this.resolveDirectClickAnchor(event)))},this.onGraphViewportChange=()=>{const graph=this.graphEl;if(graph?.view==="3d"&&this.selectedNodeId&&this.popoverEl?.open){const point=graph.getNodeScreenPosition(this.selectedNodeId);if(point){const rect2=graph.getBoundingClientRect();this.popoverEl.showAt({x:rect2.left+point.x,y:rect2.top+point.y,width:0,height:0})}return}const el=this.trackedNodeEl,popover=this.popoverEl;if(!el?.isConnected||!popover?.open)return;const rect=el.getBoundingClientRect();popover.showAt({x:rect.left+rect.width/2,y:rect.top,width:rect.width,height:rect.height})},this.onGraphNodeEnter=event=>{this.highlight==="hover"&&(this.hoveredNodeId=event.detail.nodeId)},this.onGraphNodeLeave=event=>{this.highlight==="hover"&&this.hoveredNodeId===event.detail.nodeId&&(this.hoveredNodeId=null)},this.onResultKeyDown=event=>{const buttons=[...this.renderRoot.querySelectorAll('[part="search-result"] button')],index=buttons.indexOf(event.target),next={ArrowDown:index+1,ArrowUp:index-1,Home:0,End:buttons.length-1}[event.key];index<0||next===void 0||(event.preventDefault(),this.activeResult=Math.max(0,Math.min(buttons.length-1,next)),buttons[this.activeResult].focus())},this.onPopoverHide=()=>{if(this.graphSource!==void 0?this.closeSourceDetails(!1):this.sourceDetailsOpen=!1,this.sourceClosing){this.sourceClosing=!1;return}this.invalidateActivation(),this.trackedNodeEl=void 0,this.setInternalSelectedNodeId(null)}}static{this.defaultStrings={...super.defaultStrings,fieldRequired:LYRA_DEFAULT_fieldRequired,graphDataListLimit:LYRA_DEFAULT_graphDataListLimit,graphEdgeLimit:LYRA_DEFAULT_graphEdgeLimit,graphExplorerAllTypesHidden:LYRA_DEFAULT_graphExplorerAllTypesHidden,graphExplorerClearTypes:LYRA_DEFAULT_graphExplorerClearTypes,graphExplorerFindPath:LYRA_DEFAULT_graphExplorerFindPath,graphExplorerLabel:LYRA_DEFAULT_graphExplorerLabel,graphExplorerPin:LYRA_DEFAULT_graphExplorerPin,graphExplorerPinned:LYRA_DEFAULT_graphExplorerPinned,graphExplorerPinnedHeading:LYRA_DEFAULT_graphExplorerPinnedHeading,graphExplorerSearchLimit:LYRA_DEFAULT_graphExplorerSearchLimit,graphExplorerSearchPlaceholder:LYRA_DEFAULT_graphExplorerSearchPlaceholder,graphExplorerSearchResultsLabel:LYRA_DEFAULT_graphExplorerSearchResultsLabel,graphExplorerUnpin:LYRA_DEFAULT_graphExplorerUnpin,graphExplorerUnpinned:LYRA_DEFAULT_graphExplorerUnpinned,graphNodeLimit:LYRA_DEFAULT_graphNodeLimit,loading:LYRA_DEFAULT_loading,statusError:LYRA_DEFAULT_statusError,viewerSearchMatchCount:LYRA_DEFAULT_viewerSearchMatchCount,viewerSearchNoMatches:LYRA_DEFAULT_viewerSearchNoMatches}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["nodes","edges","nodeTypes","communities","entityDetails","pinnedNodeIds","path","hiddenTypes"])}static{this.styles=[LyraElement.styles,styles,srOnly]}static{this.immutableEventDetails=Object.freeze(["lr-selection-change","lr-pin-change","lr-hidden-types-change"])}get graphSource(){return this._graphSource}set graphSource(value){const previous=this._graphSource;this._graphSource=value,this.requestUpdate("graphSource",previous)}get sourcePage(){return this._sourcePage}set sourcePage(value){const old=this._sourcePage;this._sourcePage=value;const size=finiteInteger(this.sourcePageSize,100,1,500),page=finiteInteger(value,0,0,Math.floor(Number.MAX_SAFE_INTEGER/size));this.sourceChild&&this.sourceChild.sourcePage!==page&&(this.sourceChild.sourcePage=page),this.requestUpdate("sourcePage",old)}get sourcePageSize(){return this._sourcePageSize}set sourcePageSize(value){const old=this._sourcePageSize;this._sourcePageSize=value,Object.is(old,value)||(this.sourcePage=0);const size=finiteInteger(value,100,1,500);this.sourceChild&&this.sourceChild.sourcePageSize!==size&&(this.sourceChild.sourcePageSize=size),this.requestUpdate("sourcePageSize",old)}get sourceTotal(){return this.graphSource===void 0||this.sourceFilter.invalid?null:this.sourceFilter.empty?0:this.sourceChild?.graphSource===this.graphSource?this.sourceChild.sourceTotal:null}get sourceFilter(){const hidden=this.canonicalHiddenTypes;if(!hidden.length)return{nodeTypes:[],empty:!1,invalid:!1};const catalog=canonicalIdentityList(this.nodeTypes.map(type=>type.id));let units=0;if(catalog.length>500||catalog.some(type=>type.length>65536||(units+=type.length)>2e6))return{nodeTypes:[],empty:!0,invalid:!0};const types=catalog.filter(type=>!hidden.includes(type));return{nodeTypes:types,empty:types.length===0,invalid:!1}}sourceCurrent(){const source=this.graphSource,epoch=this.sourceEpoch,generation=this.activationGeneration,owner=this.ownerDocument;let revision;try{revision=source?.revision}catch{return()=>!1}return()=>{try{return source?.revision===revision&&this.graphSource===source&&this.sourceEpoch===epoch&&this.activationGeneration===generation&&this.isConnected&&this.ownerDocument===owner}catch{return!1}}}inspectSourceSelection(){const graph=this.sourceChild,id=this.selectedNodeId;if(!graph||this.graphSource===void 0||this.sourceFilter.empty||!id)return;const signature=[graph,this.graphSource,this.sourceEpoch,id];if(this.sourceInspect&&signature.every((value,index)=>value===this.sourceInspect[index]))return;this.sourceInspect=signature;const current=this.sourceCurrent();resolveGraphSourceComposition(graph,[`node:${id}`]).then(result=>{if(!result||!result.current()||!current()||this.selectedNodeId!==id){this.sourceInspect===signature&&(this.sourceInspect=void 0);return}const record=result.records.find(row=>row.key===`node:${id}`);if(!record||record.value.kind!=="node"){this.selectedNodeId=null;return}this.sourceEntity=record.value.value})}async revealSourceKey(key){if(this.graphSource===void 0)return!1;this.query="",this.hiddenTypes=[];const current=this.sourceCurrent();if(await this.updateComplete,!current())return!1;const revealed=await this.sourceChild?.revealSourceKey(key);return current()&&revealed===!0}closeSourceDetails(closePopover=!0){this.sourceDetailsOpen=!1;const neighbors=this.renderRoot?.querySelector('[part="detail-neighbors"]');neighbors?.graphSource!==void 0&&(neighbors.graphSource=void 0),closePopover&&this.popoverEl?.open&&(this.sourceClosing=!0,this.popoverEl.open=!1)}requestUpdate(...args){const name=args[0];this.sourceEpoch!==void 0&&(name==="graphSource"||name===void 0)&&(this.sourceEpoch++,this.sourceInspect=void 0,this.sourceEntity=void 0,this.closeSourceDetails(),this.sourceSearchIntent=void 0,this.internalSelectionAssignment=void 0,this.invalidateActivation(),this.sourceChild?.graphSource!==void 0&&(this.sourceChild.graphSource=void 0)),name==="query"&&(this.sourceSearchVersion=(this.sourceSearchVersion??0)+1,this.sourceSearchIntent=void 0),this.graphSource!==void 0&&(name==="hiddenTypes"||name==="nodeTypes"||name==="selectedNodeId"&&!this.sourceAssigned)&&(this.invalidateActivation(),this.sourceInspect=void 0,this.closeSourceDetails(),name==="selectedNodeId"&&(this.sourceEntity=void 0,this.internalSelectionAssignment=void 0)),this.graphSource!==void 0&&this.sourceChild&&["query","hiddenTypes","nodeTypes"].includes(String(name))&&this.bindSourceChild(this.sourceChild),super.requestUpdate(...args)}async activateSourceEntity(id){if(!isNonBlankIdentity(id)||id.length+5>65536||this.sourceFilter.empty)return;const graph=this.sourceChild;if(!graph)return;const mounted=graph.view==="list"&&[...graph.renderRoot.querySelectorAll("[data-source-key]")].some(row=>row.dataset.sourceKey===`node:${id}`);graph.view==="list"&&!mounted&&(this.query="",this.hiddenTypes=[]),this.invalidateActivation();const current=this.sourceCurrent();if(await this.updateComplete,!current()||this.sourceChild!==graph)return;const result=await resolveGraphSourceComposition(graph,[`node:${id}`]);if(!current()||!result?.current())return;const record=result.records.find(row=>row.key===`node:${id}`);if(!record||record.value.kind!=="node"||(this.sourceEntity=record.value.value,this.sourceInspect=[graph,this.graphSource,this.sourceEpoch,id],this.setInternalSelectedNodeId(id),!current()||this.selectedNodeId!==id))return;const focused=await focusGraphSourceComposition(graph,`node:${id}`);if(await graph.updateComplete,!current()||!focused?.()||this.selectedNodeId!==id)return;const target=graph.view==="list"?[...graph.renderRoot.querySelectorAll("[data-source-key]")].find(row=>row.dataset.sourceKey===`node:${id}`):void 0,position=graph.view!=="list"?graph.getNodeScreenPosition(id):void 0,bounds=target?.getBoundingClientRect()??graph.getBoundingClientRect();!current()||!focused()||(graph.view==="list"?!target:!position)||(this.openDetailAt(id,{x:bounds.left+(position?.x??bounds.width/2),y:bounds.top+(position?.y??bounds.height/2),width:0,height:0}),current()&&focused()&&this.popoverEl?.open&&(this.sourceDetailsOpen=!0))}get graphModel(){const nodes=this.graphSource===void 0?this.nodes:EMPTY_SOURCE_NODES,edges=this.graphSource===void 0?this.edges:EMPTY_SOURCE_EDGES,sources=this.normalizedGraphSources;return(!sources||sources[0]!==nodes||sources[1]!==edges||sources[2]!==this.nodeTypes||sources[3]!==this.communities)&&(this.normalizedGraphSources=[nodes,edges,this.nodeTypes,this.communities],this.normalizedGraphModel=normalizeGraphModel(nodes,edges,this.nodeTypes,this.communities)),this.normalizedGraphModel}get canonicalPinnedNodeIds(){return canonicalIdentityList(this.pinnedNodeIds)}get canonicalHiddenTypes(){return canonicalIdentityList(this.hiddenTypes)}async loadOptionalPath(){await import("../path-strip/path-strip.js")}ensureOptionalChildren(){const path=this.path.length>0,request=path;if(request===this.optionalRequest)return;this.optionalRequest=request;const generation=++this.optionalGeneration;if(this.optionalPending=void 0,this.optionalFailed=!1,!path||this.pathReady)return;this.hasUpdated&&this.announcements.announcePolite(this.localize("loading"));const pending=this.loadOptionalPath().then(()=>{!this.isConnected||generation!==this.optionalGeneration||(this.pathReady||=path)},()=>{!this.isConnected||generation!==this.optionalGeneration||(this.optionalFailed=!0,this.announcements.announcePolite(this.localize("statusError")))}).then(()=>{!this.isConnected||generation!==this.optionalGeneration||(this.optionalPending=void 0,this.requestUpdate())});this.optionalPending=pending}async getUpdateComplete(){const complete=await super.getUpdateComplete(),pending=this.optionalPending;return pending?(await pending,this.getUpdateComplete()):complete}connectedCallback(){super.connectedCallback(),this.hasUpdated&&(this.resumePresetActivation(),this.requestUpdate())}willUpdate(changed){if(super.willUpdate(changed),this.hasUpdated&&(changed.has("nodes")||changed.has("edges"))){const messages=this.inputLimitMessages(["nodes","edges"].filter(property2=>changed.has(property2)));messages.length&&this.announcements.announcePolite(messages.join(" "))}this.ensureOptionalChildren(),this.graphSource===void 0&&((changed.has("nodes")||changed.has("edges")||changed.has("communities")||changed.has("graphSource"))&&this.rebuildDerivedCollections(),this.hoveredNodeId&&!this.isVisibleNode(this.hoveredNodeId)&&(this.hoveredNodeId=null),(changed.has("nodes")||changed.has("hiddenTypes")||changed.has("graphSource"))&&this.selectedNodeId&&!this.isVisibleNode(this.selectedNodeId)&&(this.invalidateActivation(),this.setInternalSelectedNodeId(null),this.popoverEl&&(this.popoverEl.open=!1)),this.hasUpdated&&(this.query??"").trim()&&(changed.has("query")||changed.has("nodes")||changed.has("hiddenTypes")||changed.has("locale")||changed.has("strings"))&&this.announcements.announcePolite(this.searchResultAnnouncement()))}updated(changed){if(super.updated(changed),this.graphSource!==void 0){this.bindSourceChild(this.graphEl);return}if(changed.has("camera")&&this.view==="3d"&&this.graphEl&&this.reanchorAfterCameraUpdate(this.graphEl,this.camera),!changed.has("selectedNodeId"))return;const internallyAssigned=this.internalSelectionAssignment!==void 0&&Object.is(this.internalSelectionAssignment.value,this.selectedNodeId);if(this.internalSelectionAssignment=void 0,internallyAssigned)return;const generation=this.invalidateActivation(),id=this.selectedNodeId;if(!isNonBlankIdentity(id)){id!==null&&(this.selectedNodeId=null),this.popoverEl&&(this.popoverEl.open=!1);return}const graph=this.graphEl;graph&&this.isVisibleNode(id)&&this.activatePresetWhenGraphReady(id,graph,generation)}async reanchorAfterCameraUpdate(graph,camera){await graph.updateComplete,this.isConnected&&this.graphEl===graph&&this.camera===camera&&this.view==="3d"&&this.onGraphViewportChange()}async activatePresetWhenGraphReady(id,graph,generation){for(await graph.updateComplete;generation===this.activationGeneration&&this.isConnected&&graph.isConnected&&this.selectedNodeId===id&&graph.shadowRoot?.querySelector(tag("skeleton"));)if(!await this.waitForActivationFrame(generation))return;generation===this.activationGeneration&&this.isConnected&&this.selectedNodeId===id&&this.isVisibleNode(id)&&await this.activateEntity(id)}waitForActivationFrame(generation){this.cancelActivationFrame();const ownerDocument=this.ownerDocument,ownerWindow=ownerDocument.defaultView;return!ownerWindow||!this.isConnected||generation!==this.activationGeneration?Promise.resolve(!1):new Promise(resolve=>{let settled=!1;const settle=ready=>{settled||(settled=!0,resolve(ready))};let handle;const onPageHide=()=>{this.activationFrameOwner===ownerWindow&&this.activationFrameDocument===ownerDocument&&this.activationFrameResolve===settle&&this.cancelActivationFrame()};try{handle=ownerWindow.requestAnimationFrame(()=>{const current=this.activationFrameId===handle&&this.activationFrameOwner===ownerWindow&&this.activationFrameDocument===ownerDocument&&this.activationFrameResolve===settle&&generation===this.activationGeneration&&this.isConnected&&this.ownerDocument===ownerDocument;current&&this.clearActivationFrameRecord(),settle(current)})}catch{settle(!1);return}this.activationFrameId=handle,this.activationFrameOwner=ownerWindow,this.activationFrameDocument=ownerDocument,this.activationFrameResolve=settle,this.activationFramePageHide=onPageHide,ownerWindow.addEventListener("pagehide",onPageHide,{once:!0})})}clearActivationFrameRecord(){this.activationFramePageHide&&this.activationFrameOwner?.removeEventListener("pagehide",this.activationFramePageHide),this.activationFrameId=void 0,this.activationFrameOwner=void 0,this.activationFrameDocument=void 0,this.activationFrameResolve=void 0,this.activationFramePageHide=void 0}cancelActivationFrame(){const handle=this.activationFrameId,ownerWindow=this.activationFrameOwner,settle=this.activationFrameResolve;this.clearActivationFrameRecord();try{handle!==void 0&&ownerWindow?.cancelAnimationFrame(handle)}finally{settle?.(!1)}}invalidateActivation(){return this.activationGeneration+=1,this.cancelActivationFrame(),this.activationGeneration}resumePresetActivation(){if(this.graphSource!==void 0){this.sourceInspect=void 0;return}const id=this.selectedNodeId,graph=this.graphEl;if(!id||!graph||!this.isVisibleNode(id))return;const generation=this.invalidateActivation();this.activatePresetWhenGraphReady(id,graph,generation)}setInternalSelectedNodeId(value){Object.is(this.selectedNodeId,value)||(this.internalSelectionAssignment={value},this.sourceAssigned=!0,this.selectedNodeId=value,this.sourceAssigned=!1,this.emit("lr-selection-change",{selectedNodeId:value,selectedNodeIds:value?[value]:[],selectedEdgeIds:[]}))}disconnectedCallback(){this.sourceEpoch++,this.sourceInspect=void 0,this.sourceDetailsOpen=!1,this.sourceSearchIntent=void 0,this.internalSelectionAssignment=void 0,this.sourceChild&&setGraphSourceComposition(this.sourceChild,void 0),this.sourceChildBinding=void 0,++this.optionalGeneration,this.optionalRequest=!1,this.optionalPending=void 0,this.invalidateActivation(),this.pendingNodeId=void 0,this.trackedNodeEl=void 0,this.hoveredNodeId=null,super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),++this.optionalGeneration,this.optionalRequest=!1,this.optionalPending=void 0,this.invalidateActivation(),this.announcements.adopted(),this.sourceEpoch++,this.sourceInspect=void 0,this.sourceDetailsOpen=!1,this.sourceChildBinding=void 0,this.isConnected&&this.resumePresetActivation()}rebuildDerivedCollections(){const model=this.graphModel;this.nodeById=new Map(model.nodes.map(node=>[node.id,node])),this.communityLabelById=new Map(model.communities.map(community=>[community.id,community.label]));const linksByNodeId=new Map,degrees=new Map;for(const link of model.links)for(const id of new Set([link.source,link.target])){const adjacent=linksByNodeId.get(id);adjacent?adjacent.push(link):linksByNodeId.set(id,[link]),degrees.set(id,(degrees.get(id)??0)+1)}this.linksByNodeId=linksByNodeId,this.degreeByNodeId=degrees}isVisibleGraphNode(node){return node.type==null||!this.canonicalHiddenTypes.includes(node.type)}isVisibleNode(id){const node=this.nodeById.get(id);return!!node&&this.isVisibleGraphNode(node)}canActivateNode(id){const node=this.nodeById.get(id);return node?this.isVisibleGraphNode(node):!this.hasUpdated&&this.graphModel.nodes.length===0}nodeLabel(id){const node=this.graphSource!==void 0?this.sourceEntity?.id===id?this.sourceEntity:void 0:this.nodeById.get(id);return node?.label||node?.accessibleLabel||id}degreeOf(id){return this.degreeByNodeId.get(id)??0}entityFor(id){const node=this.graphSource!==void 0?this.sourceEntity?.id===id?this.sourceEntity:void 0:this.nodeById.get(id);if(!node)return;const details=this.entityDetails[id];return{id:node.id,label:node.label||node.accessibleLabel||node.id,type:node.type,communityId:node.communityId,description:details?.description,properties:details?.properties,degree:details?.degree??(this.graphSource===void 0?this.degreeOf(node.id):void 0)}}communityLabelFor(communityId){return communityId?this.communityLabelById.get(communityId)??communityId:""}neighborRowsFor(id){const rows=[];for(const link of this.linksByNodeId.get(id)??[])if(link.source===id){const node=this.entityFor(link.target);node&&this.isVisibleNode(link.target)&&rows.push({relation:link.label??"",direction:"out",node})}else if(link.target===id){const node=this.entityFor(link.source);node&&this.isVisibleNode(link.source)&&rows.push({relation:link.label??"",direction:"in",node})}return rows}searchableNamesOf(node){return[node.label,node.accessibleLabel,node.id].filter(name=>typeof name=="string"&&name!=="")}matchingNodes(){if(this.graphSource!==void 0)return;const query2=this.query??"",locale=this.effectiveLocale,model=this.graphModel,hidden=this.canonicalHiddenTypes,memo=this.matchesMemo;if(memo?.[0]===query2&&memo[1]===locale&&memo[2]===model&&memo[3]===hidden)return memo[4];const q=query2.trim().toLocaleLowerCase(locale);let matches;if(q){const hiddenTypes=new Set(hidden);matches=model.nodes.filter(node=>(node.type==null||!hiddenTypes.has(node.type))&&this.searchableNamesOf(node).some(name=>name.toLocaleLowerCase(locale).includes(q)))}return this.matchesMemo=[query2,locale,model,hidden,matches],matches}searchResultAnnouncement(matches=this.matchingNodes()){return matches?matches.length===0?this.localize("viewerSearchNoMatches"):this.localize("viewerSearchMatchCount",void 0,{count:getNumberFormat(this.effectiveLocale).format(matches.length),pluralCount:matches.length}):""}neighborIdsOf(id){const ids=new Set;for(const link of this.linksByNodeId.get(id)??[])link.source===id?ids.add(link.target):link.target===id&&ids.add(link.source);return ids}linkKey(link){return graphLinkIdentity(link)}dimmingProjection(){if(this.graphSource!==void 0)return{nodes:[],links:[]};const model=this.graphModel,matches=this.matchingNodes(),focus=matches?null:this.selectedNodeId??(this.highlight==="hover"?this.hoveredNodeId:null),key=[model,this.highlight,matches,focus];if(this.dimmingMemo&&key.every((value,index)=>value===this.dimmingMemo.key[index]))return this.dimmingMemo;let nodes=[];if(this.highlight!=="none"){const keep=matches?new Set(matches.map(node=>node.id)):focus?this.neighborIdsOf(focus):void 0;focus&&keep.add(focus),keep&&(nodes=model.nodes.filter(node=>!keep.has(node.id)).map(node=>node.id))}const dimmed=new Set(nodes),links=dimmed.size?model.links.filter(link=>dimmed.has(link.source)||dimmed.has(link.target)).map(link=>this.linkKey(link)):[];return this.dimmingMemo={key,nodes,links},this.dimmingMemo}get computedDimmedNodeIds(){return this.dimmingProjection().nodes}get computedDimmedLinkIds(){return this.dimmingProjection().links}togglePin(id){if(!isNonBlankIdentity(id))return;const pinnedNodeIds=this.canonicalPinnedNodeIds,wasPinned=pinnedNodeIds.includes(id),next=wasPinned?pinnedNodeIds.filter(existing=>existing!==id):[...pinnedNodeIds,id];this.pinnedNodeIds=next,this.pinLiveText=this.localize(wasPinned?"graphExplorerUnpinned":"graphExplorerPinned",void 0,{label:this.nodeLabel(id)}),this.announcements.announcePolite(this.pinLiveText),this.emit("lr-pin-change",{pinnedNodeIds:next})}requestPath(){const pinnedNodeIds=this.canonicalPinnedNodeIds;if(pinnedNodeIds.length!==2)return;const[sourceNodeId,targetNodeId]=pinnedNodeIds;this.emit("lr-path-request",{sourceNodeId,targetNodeId})}fit(options){this.graphEl?.fit(options)}resetView(){this.graphEl?.fit()}async focusNode(id,options){return this.graphSource===void 0&&!this.isVisibleNode(id)?!1:await this.graphEl?.focusNode(id,options)??!1}async activateEntity(id){if(this.graphSource!==void 0)return this.activateSourceEntity(id);if(!this.canActivateNode(id))return;const generation=this.invalidateActivation();this.setInternalSelectedNodeId(id),this.trackedNodeEl=void 0;const graph=this.graphEl,focused=graph?await graph.focusNode(id):!1;if(generation!==this.activationGeneration||!this.isConnected||this.selectedNodeId!==id||!this.isVisibleNode(id)||!focused)return;const rect=graph?.getBoundingClientRect();if(!rect)return;const projected=graph?.view==="3d"?graph.getNodeScreenPosition(id):void 0;this.openDetailAt(id,{x:rect.left+(projected?.x??rect.width/2),y:rect.top+(projected?.y??rect.height/2),width:0,height:0})}openDetailAt(id,rect){const popover=this.popoverEl;popover&&(popover.accessibleLabel=this.entityFor(id)?.label||"",popover.showAt(rect))}resolveDirectClickAnchor(event){if(this.view==="3d"){this.trackedNodeEl=void 0;const graph=this.graphEl,position=this.selectedNodeId?graph?.getNodeScreenPosition(this.selectedNodeId):void 0,rect2=graph?.getBoundingClientRect();if(position&&rect2)return{x:rect2.left+position.x,y:rect2.top+position.y,width:0,height:0}}if(this.renderer==="canvas")return this.trackedNodeEl=void 0,{x:event.clientX,y:event.clientY,width:0,height:0};const nodeEl=event.composedPath().find(el=>isElementNode(el)&&el.matches('[part="node"]'));if(!nodeEl)return this.trackedNodeEl=void 0,{x:event.clientX,y:event.clientY,width:0,height:0};this.trackedNodeEl=nodeEl;const rect=nodeEl.getBoundingClientRect();return{x:rect.left+rect.width/2,y:rect.top,width:rect.width,height:rect.height}}inputLimitMessages(properties=["nodes","edges"]){const messages=[],format=getNumberFormat(this.effectiveLocale);for(const property2 of properties){const loss=publicCollectionTruncation(this,property2);loss&&messages.push(this.localize(property2==="nodes"?"graphNodeLimit":"graphEdgeLimit",void 0,{shown:format.format(loss.retained),total:format.format(loss.source)}))}return messages}render(){const groupLabel=retrievalSemanticLabel(this,this.label==null?this.localize("graphExplorerLabel"):this.label),groupRole=retrievalSemanticRole(this,"group"),matches=this.matchingNodes(),detailsLimit=publicCollectionTruncation(this,"entityDetails"),model=this.graphModel,pinnedNodeIds=this.canonicalPinnedNodeIds,hiddenTypes=this.canonicalHiddenTypes,selectedEntity=this.graphSource!==void 0?this.sourceEntity:this.selectedNodeId?this.nodeById.get(this.selectedNodeId):void 0,isPinned=this.selectedNodeId!=null&&pinnedNodeIds.includes(this.selectedNodeId),dimmedDeps=[this.highlight,matches,this.selectedNodeId,this.hoveredNodeId,model],detailDeps=[this.selectedNodeId,model,hiddenTypes,this.entityDetails,this.sourceEntity],sourceFilter=this.sourceFilter,sourceCurrent=this.sourceCurrent(),renderedSource=this.graphSource,renderedEpoch=this.sourceEpoch,renderedOwner=this.ownerDocument,actionCurrent=renderedSource!==void 0?sourceCurrent:()=>this.graphSource===void 0&&this.sourceEpoch===renderedEpoch&&this.isConnected&&this.ownerDocument===renderedOwner;return html`
1
+ import{__decorate}from"tslib";import{ENGINE_3D_PREFERENCE}from"../../../internal/engine-3d.js";import{ref}from"lit/directives/ref.js";import{setGraphSourceComposition,resolveGraphSourceComposition,focusGraphSourceComposition}from"../graph/graph-source-composition.js";const EMPTY_SOURCE_NODES=Object.freeze([]),EMPTY_SOURCE_EDGES=Object.freeze([]);import{collectionSupport,publicCollectionTruncation}from"../../../internal/collection-snapshot.js";import{tag}from"../../../internal/prefix.js";import{html,nothing}from"lit";import{property,state,query}from"lit/decorators.js";import{guard}from"lit/directives/guard.js";import{LyraElement}from"../../../internal/lyra-element.js";import{finiteInteger,finiteRange}from"../../../internal/numbers.js";import{srOnly}from"../../../internal/a11y.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{styles}from"./knowledge-graph-explorer.styles.js";import{retrievalSemanticLabel,retrievalSemanticRole}from"../retrieval-semantic-owner.js";import{graphLengthConverter,graphLinkIdentity,normalizeGraphModel}from"../graph/graph-model.js";import{canonicalIdentityList,isNonBlankIdentity}from"../retrieval-identity.js";import"../graph/graph.class.js";import"../graph-legend/graph-legend.class.js";import"../entity-card/entity-card.class.js";import"../neighbor-list/neighbor-list.class.js";import"../../overlays/overlay/popover.class.js";import"../../forms/input/input.class.js";import"../../forms/button/button.class.js";import{AnnouncementSinkController}from"../../../internal/announcer.js";import{LYRA_DEFAULT_graphDataListLimit,LYRA_DEFAULT_graphEdgeLimit,LYRA_DEFAULT_graphExplorerAllTypesHidden,LYRA_DEFAULT_graphExplorerClearTypes,LYRA_DEFAULT_graphExplorerFindPath,LYRA_DEFAULT_graphExplorerLabel,LYRA_DEFAULT_graphExplorerPin,LYRA_DEFAULT_graphExplorerPinned,LYRA_DEFAULT_graphExplorerPinnedHeading,LYRA_DEFAULT_graphExplorerSearchLimit,LYRA_DEFAULT_graphExplorerSearchPlaceholder,LYRA_DEFAULT_graphExplorerSearchResultsLabel,LYRA_DEFAULT_graphExplorerUnpin,LYRA_DEFAULT_graphExplorerUnpinned,LYRA_DEFAULT_graphNodeLimit}from"../../../internal/default-strings/retrieval.generated.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_copy,LYRA_DEFAULT_date,LYRA_DEFAULT_details,LYRA_DEFAULT_engine3dContextLost,LYRA_DEFAULT_engine3dError,LYRA_DEFAULT_engine3dLoading,LYRA_DEFAULT_engine3dShowingBuiltin,LYRA_DEFAULT_engine3dShowingList,LYRA_DEFAULT_engine3dSoftwareRendering,LYRA_DEFAULT_engine3dUnavailable,LYRA_DEFAULT_engine3dUnsupported,LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_largeDataInvalid,LYRA_DEFAULT_largeDataLimit,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_progress,LYRA_DEFAULT_restore,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_statusError,LYRA_DEFAULT_viewerSearchMatchCount,LYRA_DEFAULT_viewerSearchNoMatches}from"../../../internal/default-strings/shared.generated.js";const SEARCH_RESULT_LIMIT=50;function isElementNode(value){if(typeof value!="object"||value===null)return!1;const candidate=value;return candidate.nodeType===1&&typeof candidate.matches=="function"&&typeof candidate.getBoundingClientRect=="function"}class LyraKnowledgeGraphExplorer extends LyraElement{constructor(){super(...arguments),this.sourceEpoch=0,this.sourceSearchVersion=0,this.sourceAssigned=!1,this.sourceClosing=!1,this.sourceDetailsOpen=!1,this.sourcePaint=0,this._sourcePage=0,this._sourcePageSize=100,this.sourceAccepted=snapshot=>{if(!snapshot.current()||this.graphSource===void 0||this.sourceChild?.graphSource!==this.graphSource)return;this.sourcePage!==snapshot.page&&(this.sourcePage=snapshot.page),this.sourcePaint++;const intent=this.sourceSearchIntent;if(!this.sourceFilter.invalid&&intent&&intent.epoch===this.sourceEpoch&&intent.version===this.sourceSearchVersion&&intent.query===this.query&&snapshot.query.kind==="nodes"&&snapshot.query.centerKey===null&&snapshot.query.search===intent.query&&snapshot.total!==null&&snapshot.current()){this.sourceSearchIntent=void 0;const detail={query:intent.query,matchCount:intent.query.trim()?snapshot.total:0,matchCountExact:!0,activeIndex:-1};snapshot.current()&&this.emit("lr-search-change",detail)}snapshot.current()&&this.inspectSourceSelection()},this.bindSourceChild=element=>{const graph=element;if(!graph){this.sourceChild&&setGraphSourceComposition(this.sourceChild,void 0),this.sourceChild=void 0,this.sourceChildBinding=void 0;return}this.sourceChild=graph;const size=finiteInteger(this.sourcePageSize,100,1,500),page=finiteInteger(this.sourcePage,0,0,Math.floor(Number.MAX_SAFE_INTEGER/size));if(graph.sourcePageSize!==size&&(graph.sourcePageSize=size),graph.sourcePage!==page&&(graph.sourcePage=page),this.graphSource===void 0){setGraphSourceComposition(graph,void 0),graph.graphSource!==void 0&&(graph.graphSource=void 0),this.sourceChildBinding=void 0;return}const filter=this.sourceFilter;setGraphSourceComposition(graph,{search:(this.query??"").slice(0,65536),nodeTypes:filter.nodeTypes,empty:filter.empty,accepted:this.sourceAccepted});const binding=[graph,this.graphSource,this.sourceEpoch];(!this.sourceChildBinding||binding.some((value,index)=>value!==this.sourceChildBinding[index]))&&(this.sourceChildBinding=binding,graph.graphSource=this.graphSource),this.inspectSourceSelection()},this.nodes=[],this.edges=[],this.nodeTypes=[],this.communities=[],this.entityDetails={},this.pinnedNodeIds=[],this.path=[],this.hiddenTypes=[],this.selectedNodeId=null,this.renderer="svg",this.view="2d",this._engine="builtin",this.fitTo="none",this.width=800,this.height=600,this.highlight="selection",this.query="",this.pinLiveText="",this.hoveredNodeId=null,this.activeResult=0,this.activationGeneration=0,this.nodeById=new Map,this.linksByNodeId=new Map,this.degreeByNodeId=new Map,this.communityLabelById=new Map,this.announcements=new AnnouncementSinkController(this,{eager:["polite"]}),this.optionalRequest=!1,this.optionalGeneration=0,this.pathReady=!1,this.optionalFailed=!1,this.onVisibilityChange=event=>{event.stopPropagation(),this.hiddenTypes=event.detail.hiddenTypes,this.emit("lr-hidden-types-change",{hiddenTypes:this.hiddenTypes})},this.onVisibilityChangeProposal=event=>{event.stopPropagation()},this.onSearchInput=event=>{event.stopPropagation();const value=event.detail.value;if(this.query!==value){if(this.query=value,this.graphSource!==void 0){this.sourceSearchIntent={query:value,version:this.sourceSearchVersion,epoch:this.sourceEpoch};return}this.emit("lr-search-change",{query:value,matchCount:this.matchingNodes()?.length??0,matchCountExact:!0,activeIndex:-1})}},this.onEntityActivate=event=>{event.stopPropagation(),this.activateEntity(event.detail.entityId)},this.onGraphNodeClick=event=>{const id=event.detail.nodeId;if(this.graphSource!==void 0){this.activateSourceEntity(id);return}if(!this.canActivateNode(id))return;const generation=this.invalidateActivation();if(this.setInternalSelectedNodeId(id),this.view==="3d"){const graph=this.graphEl,point=graph?.getNodeScreenPosition(id),bounds=graph?.getBoundingClientRect();if(point&&bounds){this.trackedNodeEl=void 0,this.openDetailAt(id,{x:bounds.left+point.x,y:bounds.top+point.y,width:0,height:0});return}}this.pendingNodeId=id;const ownerDocument=this.ownerDocument,ownerWindow=ownerDocument.defaultView;ownerWindow&&ownerWindow.queueMicrotask(()=>{generation===this.activationGeneration&&this.isConnected&&this.ownerDocument===ownerDocument&&this.pendingNodeId===id&&(this.pendingNodeId=void 0,this.selectedNodeId===id&&this.isVisibleNode(id)&&this.activateEntity(id))})},this.onGraphNativeClick=event=>{const id=this.pendingNodeId;id&&(this.pendingNodeId=void 0,this.openDetailAt(id,this.resolveDirectClickAnchor(event)))},this.onGraphViewportChange=()=>{const graph=this.graphEl;if(graph?.view==="3d"&&this.selectedNodeId&&this.popoverEl?.open){const point=graph.getNodeScreenPosition(this.selectedNodeId);if(point){const rect2=graph.getBoundingClientRect();this.popoverEl.showAt({x:rect2.left+point.x,y:rect2.top+point.y,width:0,height:0})}return}const el=this.trackedNodeEl,popover=this.popoverEl;if(!el?.isConnected||!popover?.open)return;const rect=el.getBoundingClientRect();popover.showAt({x:rect.left+rect.width/2,y:rect.top,width:rect.width,height:rect.height})},this.onGraphNodeEnter=event=>{this.highlight==="hover"&&(this.hoveredNodeId=event.detail.nodeId)},this.onGraphNodeLeave=event=>{this.highlight==="hover"&&this.hoveredNodeId===event.detail.nodeId&&(this.hoveredNodeId=null)},this.onResultKeyDown=event=>{const buttons=[...this.renderRoot.querySelectorAll('[part="search-result"] button')],index=buttons.indexOf(event.target),next={ArrowDown:index+1,ArrowUp:index-1,Home:0,End:buttons.length-1}[event.key];index<0||next===void 0||(event.preventDefault(),this.activeResult=Math.max(0,Math.min(buttons.length-1,next)),buttons[this.activeResult].focus())},this.onPopoverHide=()=>{if(this.graphSource!==void 0?this.closeSourceDetails(!1):this.sourceDetailsOpen=!1,this.sourceClosing){this.sourceClosing=!1;return}this.invalidateActivation(),this.trackedNodeEl=void 0,this.setInternalSelectedNodeId(null)}}static{this.defaultStrings={...super.defaultStrings,collapse:LYRA_DEFAULT_collapse,copy:LYRA_DEFAULT_copy,date:LYRA_DEFAULT_date,details:LYRA_DEFAULT_details,engine3dContextLost:LYRA_DEFAULT_engine3dContextLost,engine3dError:LYRA_DEFAULT_engine3dError,engine3dLoading:LYRA_DEFAULT_engine3dLoading,engine3dShowingBuiltin:LYRA_DEFAULT_engine3dShowingBuiltin,engine3dShowingList:LYRA_DEFAULT_engine3dShowingList,engine3dSoftwareRendering:LYRA_DEFAULT_engine3dSoftwareRendering,engine3dUnavailable:LYRA_DEFAULT_engine3dUnavailable,engine3dUnsupported:LYRA_DEFAULT_engine3dUnsupported,fieldRequired:LYRA_DEFAULT_fieldRequired,graphDataListLimit:LYRA_DEFAULT_graphDataListLimit,graphEdgeLimit:LYRA_DEFAULT_graphEdgeLimit,graphExplorerAllTypesHidden:LYRA_DEFAULT_graphExplorerAllTypesHidden,graphExplorerClearTypes:LYRA_DEFAULT_graphExplorerClearTypes,graphExplorerFindPath:LYRA_DEFAULT_graphExplorerFindPath,graphExplorerLabel:LYRA_DEFAULT_graphExplorerLabel,graphExplorerPin:LYRA_DEFAULT_graphExplorerPin,graphExplorerPinned:LYRA_DEFAULT_graphExplorerPinned,graphExplorerPinnedHeading:LYRA_DEFAULT_graphExplorerPinnedHeading,graphExplorerSearchLimit:LYRA_DEFAULT_graphExplorerSearchLimit,graphExplorerSearchPlaceholder:LYRA_DEFAULT_graphExplorerSearchPlaceholder,graphExplorerSearchResultsLabel:LYRA_DEFAULT_graphExplorerSearchResultsLabel,graphExplorerUnpin:LYRA_DEFAULT_graphExplorerUnpin,graphExplorerUnpinned:LYRA_DEFAULT_graphExplorerUnpinned,graphNodeLimit:LYRA_DEFAULT_graphNodeLimit,largeDataInvalid:LYRA_DEFAULT_largeDataInvalid,largeDataLimit:LYRA_DEFAULT_largeDataLimit,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,progress:LYRA_DEFAULT_progress,restore:LYRA_DEFAULT_restore,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,statusError:LYRA_DEFAULT_statusError,viewerSearchMatchCount:LYRA_DEFAULT_viewerSearchMatchCount,viewerSearchNoMatches:LYRA_DEFAULT_viewerSearchNoMatches}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["nodes","edges","nodeTypes","communities","entityDetails","pinnedNodeIds","path","hiddenTypes"])}static{this.styles=[LyraElement.styles,styles,srOnly]}static{this.immutableEventDetails=Object.freeze(["lr-selection-change","lr-pin-change","lr-hidden-types-change"])}get graphSource(){return this._graphSource}set graphSource(value){const previous=this._graphSource;this._graphSource=value,this.requestUpdate("graphSource",previous)}get sourcePage(){return this._sourcePage}set sourcePage(value){const old=this._sourcePage;this._sourcePage=value;const size=finiteInteger(this.sourcePageSize,100,1,500),page=finiteInteger(value,0,0,Math.floor(Number.MAX_SAFE_INTEGER/size));this.sourceChild&&this.sourceChild.sourcePage!==page&&(this.sourceChild.sourcePage=page),this.requestUpdate("sourcePage",old)}get sourcePageSize(){return this._sourcePageSize}set sourcePageSize(value){const old=this._sourcePageSize;this._sourcePageSize=value,Object.is(old,value)||(this.sourcePage=0);const size=finiteInteger(value,100,1,500);this.sourceChild&&this.sourceChild.sourcePageSize!==size&&(this.sourceChild.sourcePageSize=size),this.requestUpdate("sourcePageSize",old)}get sourceTotal(){return this.graphSource===void 0||this.sourceFilter.invalid?null:this.sourceFilter.empty?0:this.sourceChild?.graphSource===this.graphSource?this.sourceChild.sourceTotal:null}get sourceFilter(){const hidden=this.canonicalHiddenTypes;if(!hidden.length)return{nodeTypes:[],empty:!1,invalid:!1};const catalog=canonicalIdentityList(this.nodeTypes.map(type=>type.id));let units=0;if(catalog.length>500||catalog.some(type=>type.length>65536||(units+=type.length)>2e6))return{nodeTypes:[],empty:!0,invalid:!0};const types=catalog.filter(type=>!hidden.includes(type));return{nodeTypes:types,empty:types.length===0,invalid:!1}}sourceCurrent(){const source=this.graphSource,epoch=this.sourceEpoch,generation=this.activationGeneration,owner=this.ownerDocument;let revision;try{revision=source?.revision}catch{return()=>!1}return()=>{try{return source?.revision===revision&&this.graphSource===source&&this.sourceEpoch===epoch&&this.activationGeneration===generation&&this.isConnected&&this.ownerDocument===owner}catch{return!1}}}inspectSourceSelection(){const graph=this.sourceChild,id=this.selectedNodeId;if(!graph||this.graphSource===void 0||this.sourceFilter.empty||!id)return;const signature=[graph,this.graphSource,this.sourceEpoch,id];if(this.sourceInspect&&signature.every((value,index)=>value===this.sourceInspect[index]))return;this.sourceInspect=signature;const current=this.sourceCurrent();resolveGraphSourceComposition(graph,[`node:${id}`]).then(result=>{if(!result||!result.current()||!current()||this.selectedNodeId!==id){this.sourceInspect===signature&&(this.sourceInspect=void 0);return}const record=result.records.find(row=>row.key===`node:${id}`);if(!record||record.value.kind!=="node"){this.selectedNodeId=null;return}this.sourceEntity=record.value.value})}async revealSourceKey(key){if(this.graphSource===void 0)return!1;this.query="",this.hiddenTypes=[];const current=this.sourceCurrent();if(await this.updateComplete,!current())return!1;const revealed=await this.sourceChild?.revealSourceKey(key);return current()&&revealed===!0}closeSourceDetails(closePopover=!0){this.sourceDetailsOpen=!1;const neighbors=this.renderRoot?.querySelector('[part="detail-neighbors"]');neighbors?.graphSource!==void 0&&(neighbors.graphSource=void 0),closePopover&&this.popoverEl?.open&&(this.sourceClosing=!0,this.popoverEl.open=!1)}requestUpdate(...args){const name=args[0];this.sourceEpoch!==void 0&&(name==="graphSource"||name===void 0)&&(this.sourceEpoch++,this.sourceInspect=void 0,this.sourceEntity=void 0,this.closeSourceDetails(),this.sourceSearchIntent=void 0,this.internalSelectionAssignment=void 0,this.invalidateActivation(),this.sourceChild?.graphSource!==void 0&&(this.sourceChild.graphSource=void 0)),name==="query"&&(this.sourceSearchVersion=(this.sourceSearchVersion??0)+1,this.sourceSearchIntent=void 0),this.graphSource!==void 0&&(name==="hiddenTypes"||name==="nodeTypes"||name==="selectedNodeId"&&!this.sourceAssigned)&&(this.invalidateActivation(),this.sourceInspect=void 0,this.closeSourceDetails(),name==="selectedNodeId"&&(this.sourceEntity=void 0,this.internalSelectionAssignment=void 0)),this.graphSource!==void 0&&this.sourceChild&&["query","hiddenTypes","nodeTypes"].includes(String(name))&&this.bindSourceChild(this.sourceChild),super.requestUpdate(...args)}async activateSourceEntity(id){if(!isNonBlankIdentity(id)||id.length+5>65536||this.sourceFilter.empty)return;const graph=this.sourceChild;if(!graph)return;const mounted=graph.view==="list"&&[...graph.renderRoot.querySelectorAll("[data-source-key]")].some(row=>row.dataset.sourceKey===`node:${id}`);graph.view==="list"&&!mounted&&(this.query="",this.hiddenTypes=[]),this.invalidateActivation();const current=this.sourceCurrent();if(await this.updateComplete,!current()||this.sourceChild!==graph)return;const result=await resolveGraphSourceComposition(graph,[`node:${id}`]);if(!current()||!result?.current())return;const record=result.records.find(row=>row.key===`node:${id}`);if(!record||record.value.kind!=="node"||(this.sourceEntity=record.value.value,this.sourceInspect=[graph,this.graphSource,this.sourceEpoch,id],this.setInternalSelectedNodeId(id),!current()||this.selectedNodeId!==id))return;const focused=await focusGraphSourceComposition(graph,`node:${id}`);if(await graph.updateComplete,!current()||!focused?.()||this.selectedNodeId!==id)return;const target=graph.view==="list"?[...graph.renderRoot.querySelectorAll("[data-source-key]")].find(row=>row.dataset.sourceKey===`node:${id}`):void 0,position=graph.view!=="list"?graph.getNodeScreenPosition(id):void 0,bounds=target?.getBoundingClientRect()??graph.getBoundingClientRect();!current()||!focused()||(graph.view==="list"?!target:!position)||(this.openDetailAt(id,{x:bounds.left+(position?.x??bounds.width/2),y:bounds.top+(position?.y??bounds.height/2),width:0,height:0}),current()&&focused()&&this.popoverEl?.open&&(this.sourceDetailsOpen=!0))}get engine(){return this._engine}set engine(value){const old=this._engine;this._engine=ENGINE_3D_PREFERENCE.normalize(value),this.requestUpdate("engine",old)}get graphModel(){const nodes=this.graphSource===void 0?this.nodes:EMPTY_SOURCE_NODES,edges=this.graphSource===void 0?this.edges:EMPTY_SOURCE_EDGES,sources=this.normalizedGraphSources;return(!sources||sources[0]!==nodes||sources[1]!==edges||sources[2]!==this.nodeTypes||sources[3]!==this.communities)&&(this.normalizedGraphSources=[nodes,edges,this.nodeTypes,this.communities],this.normalizedGraphModel=normalizeGraphModel(nodes,edges,this.nodeTypes,this.communities)),this.normalizedGraphModel}get canonicalPinnedNodeIds(){return canonicalIdentityList(this.pinnedNodeIds)}get canonicalHiddenTypes(){return canonicalIdentityList(this.hiddenTypes)}async loadOptionalPath(){await import("../path-strip/path-strip.js")}ensureOptionalChildren(){const path=this.path.length>0,request=path;if(request===this.optionalRequest)return;this.optionalRequest=request;const generation=++this.optionalGeneration;if(this.optionalPending=void 0,this.optionalFailed=!1,!path||this.pathReady)return;this.hasUpdated&&this.announcements.announcePolite(this.localize("loading"));const pending=this.loadOptionalPath().then(()=>{!this.isConnected||generation!==this.optionalGeneration||(this.pathReady||=path)},()=>{!this.isConnected||generation!==this.optionalGeneration||(this.optionalFailed=!0,this.announcements.announcePolite(this.localize("statusError")))}).then(()=>{!this.isConnected||generation!==this.optionalGeneration||(this.optionalPending=void 0,this.requestUpdate())});this.optionalPending=pending}async getUpdateComplete(){const complete=await super.getUpdateComplete(),pending=this.optionalPending;return pending?(await pending,this.getUpdateComplete()):complete}connectedCallback(){super.connectedCallback(),this.hasUpdated&&(this.resumePresetActivation(),this.requestUpdate())}willUpdate(changed){if(super.willUpdate(changed),this.hasUpdated&&(changed.has("nodes")||changed.has("edges"))){const messages=this.inputLimitMessages(["nodes","edges"].filter(property2=>changed.has(property2)));messages.length&&this.announcements.announcePolite(messages.join(" "))}this.ensureOptionalChildren(),this.graphSource===void 0&&((changed.has("nodes")||changed.has("edges")||changed.has("communities")||changed.has("graphSource"))&&this.rebuildDerivedCollections(),this.hoveredNodeId&&!this.isVisibleNode(this.hoveredNodeId)&&(this.hoveredNodeId=null),(changed.has("nodes")||changed.has("hiddenTypes")||changed.has("graphSource"))&&this.selectedNodeId&&!this.isVisibleNode(this.selectedNodeId)&&(this.invalidateActivation(),this.setInternalSelectedNodeId(null),this.popoverEl&&(this.popoverEl.open=!1)),this.hasUpdated&&(this.query??"").trim()&&(changed.has("query")||changed.has("nodes")||changed.has("hiddenTypes")||changed.has("locale")||changed.has("strings"))&&this.announcements.announcePolite(this.searchResultAnnouncement()))}updated(changed){if(super.updated(changed),this.graphSource!==void 0){this.bindSourceChild(this.graphEl);return}if(changed.has("camera")&&this.view==="3d"&&this.graphEl&&this.reanchorAfterCameraUpdate(this.graphEl,this.camera),!changed.has("selectedNodeId"))return;const internallyAssigned=this.internalSelectionAssignment!==void 0&&Object.is(this.internalSelectionAssignment.value,this.selectedNodeId);if(this.internalSelectionAssignment=void 0,internallyAssigned)return;const generation=this.invalidateActivation(),id=this.selectedNodeId;if(!isNonBlankIdentity(id)){id!==null&&(this.selectedNodeId=null),this.popoverEl&&(this.popoverEl.open=!1);return}const graph=this.graphEl;graph&&this.isVisibleNode(id)&&this.activatePresetWhenGraphReady(id,graph,generation)}async reanchorAfterCameraUpdate(graph,camera){await graph.updateComplete,this.isConnected&&this.graphEl===graph&&this.camera===camera&&this.view==="3d"&&this.onGraphViewportChange()}async activatePresetWhenGraphReady(id,graph,generation){for(await graph.updateComplete;generation===this.activationGeneration&&this.isConnected&&graph.isConnected&&this.selectedNodeId===id&&graph.shadowRoot?.querySelector(tag("skeleton"));)if(!await this.waitForActivationFrame(generation))return;generation===this.activationGeneration&&this.isConnected&&this.selectedNodeId===id&&this.isVisibleNode(id)&&await this.activateEntity(id)}waitForActivationFrame(generation){this.cancelActivationFrame();const ownerDocument=this.ownerDocument,ownerWindow=ownerDocument.defaultView;return!ownerWindow||!this.isConnected||generation!==this.activationGeneration?Promise.resolve(!1):new Promise(resolve=>{let settled=!1;const settle=ready=>{settled||(settled=!0,resolve(ready))};let handle;const onPageHide=()=>{this.activationFrameOwner===ownerWindow&&this.activationFrameDocument===ownerDocument&&this.activationFrameResolve===settle&&this.cancelActivationFrame()};try{handle=ownerWindow.requestAnimationFrame(()=>{const current=this.activationFrameId===handle&&this.activationFrameOwner===ownerWindow&&this.activationFrameDocument===ownerDocument&&this.activationFrameResolve===settle&&generation===this.activationGeneration&&this.isConnected&&this.ownerDocument===ownerDocument;current&&this.clearActivationFrameRecord(),settle(current)})}catch{settle(!1);return}this.activationFrameId=handle,this.activationFrameOwner=ownerWindow,this.activationFrameDocument=ownerDocument,this.activationFrameResolve=settle,this.activationFramePageHide=onPageHide,ownerWindow.addEventListener("pagehide",onPageHide,{once:!0})})}clearActivationFrameRecord(){this.activationFramePageHide&&this.activationFrameOwner?.removeEventListener("pagehide",this.activationFramePageHide),this.activationFrameId=void 0,this.activationFrameOwner=void 0,this.activationFrameDocument=void 0,this.activationFrameResolve=void 0,this.activationFramePageHide=void 0}cancelActivationFrame(){const handle=this.activationFrameId,ownerWindow=this.activationFrameOwner,settle=this.activationFrameResolve;this.clearActivationFrameRecord();try{handle!==void 0&&ownerWindow?.cancelAnimationFrame(handle)}finally{settle?.(!1)}}invalidateActivation(){return this.activationGeneration+=1,this.cancelActivationFrame(),this.activationGeneration}resumePresetActivation(){if(this.graphSource!==void 0){this.sourceInspect=void 0;return}const id=this.selectedNodeId,graph=this.graphEl;if(!id||!graph||!this.isVisibleNode(id))return;const generation=this.invalidateActivation();this.activatePresetWhenGraphReady(id,graph,generation)}setInternalSelectedNodeId(value){Object.is(this.selectedNodeId,value)||(this.internalSelectionAssignment={value},this.sourceAssigned=!0,this.selectedNodeId=value,this.sourceAssigned=!1,this.emit("lr-selection-change",{selectedNodeId:value,selectedNodeIds:value?[value]:[],selectedEdgeIds:[]}))}disconnectedCallback(){this.sourceEpoch++,this.sourceInspect=void 0,this.sourceDetailsOpen=!1,this.sourceSearchIntent=void 0,this.internalSelectionAssignment=void 0,this.sourceChild&&setGraphSourceComposition(this.sourceChild,void 0),this.sourceChildBinding=void 0,++this.optionalGeneration,this.optionalRequest=!1,this.optionalPending=void 0,this.invalidateActivation(),this.pendingNodeId=void 0,this.trackedNodeEl=void 0,this.hoveredNodeId=null,super.disconnectedCallback()}adoptedCallback(){super.adoptedCallback(),++this.optionalGeneration,this.optionalRequest=!1,this.optionalPending=void 0,this.invalidateActivation(),this.announcements.adopted(),this.sourceEpoch++,this.sourceInspect=void 0,this.sourceDetailsOpen=!1,this.sourceChildBinding=void 0,this.isConnected&&this.resumePresetActivation()}rebuildDerivedCollections(){const model=this.graphModel;this.nodeById=new Map(model.nodes.map(node=>[node.id,node])),this.communityLabelById=new Map(model.communities.map(community=>[community.id,community.label]));const linksByNodeId=new Map,degrees=new Map;for(const link of model.links)for(const id of new Set([link.source,link.target])){const adjacent=linksByNodeId.get(id);adjacent?adjacent.push(link):linksByNodeId.set(id,[link]),degrees.set(id,(degrees.get(id)??0)+1)}this.linksByNodeId=linksByNodeId,this.degreeByNodeId=degrees}isVisibleGraphNode(node){return node.type==null||!this.canonicalHiddenTypes.includes(node.type)}isVisibleNode(id){const node=this.nodeById.get(id);return!!node&&this.isVisibleGraphNode(node)}canActivateNode(id){const node=this.nodeById.get(id);return node?this.isVisibleGraphNode(node):!this.hasUpdated&&this.graphModel.nodes.length===0}nodeLabel(id){const node=this.graphSource!==void 0?this.sourceEntity?.id===id?this.sourceEntity:void 0:this.nodeById.get(id);return node?.label||node?.accessibleLabel||id}degreeOf(id){return this.degreeByNodeId.get(id)??0}entityFor(id){const node=this.graphSource!==void 0?this.sourceEntity?.id===id?this.sourceEntity:void 0:this.nodeById.get(id);if(!node)return;const details=this.entityDetails[id];return{id:node.id,label:node.label||node.accessibleLabel||node.id,type:node.type,communityId:node.communityId,description:details?.description,properties:details?.properties,degree:details?.degree??(this.graphSource===void 0?this.degreeOf(node.id):void 0)}}communityLabelFor(communityId){return communityId?this.communityLabelById.get(communityId)??communityId:""}neighborRowsFor(id){const rows=[];for(const link of this.linksByNodeId.get(id)??[])if(link.source===id){const node=this.entityFor(link.target);node&&this.isVisibleNode(link.target)&&rows.push({relation:link.label??"",direction:"out",node})}else if(link.target===id){const node=this.entityFor(link.source);node&&this.isVisibleNode(link.source)&&rows.push({relation:link.label??"",direction:"in",node})}return rows}searchableNamesOf(node){return[node.label,node.accessibleLabel,node.id].filter(name=>typeof name=="string"&&name!=="")}matchingNodes(){if(this.graphSource!==void 0)return;const query2=this.query??"",locale=this.effectiveLocale,model=this.graphModel,hidden=this.canonicalHiddenTypes,memo=this.matchesMemo;if(memo?.[0]===query2&&memo[1]===locale&&memo[2]===model&&memo[3]===hidden)return memo[4];const q=query2.trim().toLocaleLowerCase(locale);let matches;if(q){const hiddenTypes=new Set(hidden);matches=model.nodes.filter(node=>(node.type==null||!hiddenTypes.has(node.type))&&this.searchableNamesOf(node).some(name=>name.toLocaleLowerCase(locale).includes(q)))}return this.matchesMemo=[query2,locale,model,hidden,matches],matches}searchResultAnnouncement(matches=this.matchingNodes()){return matches?matches.length===0?this.localize("viewerSearchNoMatches"):this.localize("viewerSearchMatchCount",void 0,{count:getNumberFormat(this.effectiveLocale).format(matches.length),pluralCount:matches.length}):""}neighborIdsOf(id){const ids=new Set;for(const link of this.linksByNodeId.get(id)??[])link.source===id?ids.add(link.target):link.target===id&&ids.add(link.source);return ids}linkKey(link){return graphLinkIdentity(link)}dimmingProjection(){if(this.graphSource!==void 0)return{nodes:[],links:[]};const model=this.graphModel,matches=this.matchingNodes(),focus=matches?null:this.selectedNodeId??(this.highlight==="hover"?this.hoveredNodeId:null),key=[model,this.highlight,matches,focus];if(this.dimmingMemo&&key.every((value,index)=>value===this.dimmingMemo.key[index]))return this.dimmingMemo;let nodes=[];if(this.highlight!=="none"){const keep=matches?new Set(matches.map(node=>node.id)):focus?this.neighborIdsOf(focus):void 0;focus&&keep.add(focus),keep&&(nodes=model.nodes.filter(node=>!keep.has(node.id)).map(node=>node.id))}const dimmed=new Set(nodes),links=dimmed.size?model.links.filter(link=>dimmed.has(link.source)||dimmed.has(link.target)).map(link=>this.linkKey(link)):[];return this.dimmingMemo={key,nodes,links},this.dimmingMemo}get computedDimmedNodeIds(){return this.dimmingProjection().nodes}get computedDimmedLinkIds(){return this.dimmingProjection().links}togglePin(id){if(!isNonBlankIdentity(id))return;const pinnedNodeIds=this.canonicalPinnedNodeIds,wasPinned=pinnedNodeIds.includes(id),next=wasPinned?pinnedNodeIds.filter(existing=>existing!==id):[...pinnedNodeIds,id];this.pinnedNodeIds=next,this.pinLiveText=this.localize(wasPinned?"graphExplorerUnpinned":"graphExplorerPinned",void 0,{label:this.nodeLabel(id)}),this.announcements.announcePolite(this.pinLiveText),this.emit("lr-pin-change",{pinnedNodeIds:next})}requestPath(){const pinnedNodeIds=this.canonicalPinnedNodeIds;if(pinnedNodeIds.length!==2)return;const[sourceNodeId,targetNodeId]=pinnedNodeIds;this.emit("lr-path-request",{sourceNodeId,targetNodeId})}fit(options){this.graphEl?.fit(options)}resetView(){this.graphEl?.fit()}async focusNode(id,options){return this.graphSource===void 0&&!this.isVisibleNode(id)?!1:await this.graphEl?.focusNode(id,options)??!1}async activateEntity(id){if(this.graphSource!==void 0)return this.activateSourceEntity(id);if(!this.canActivateNode(id))return;const generation=this.invalidateActivation();this.setInternalSelectedNodeId(id),this.trackedNodeEl=void 0;const graph=this.graphEl,focused=graph?await graph.focusNode(id):!1;if(generation!==this.activationGeneration||!this.isConnected||this.selectedNodeId!==id||!this.isVisibleNode(id)||!focused)return;const rect=graph?.getBoundingClientRect();if(!rect)return;const projected=graph?.view==="3d"?graph.getNodeScreenPosition(id):void 0;this.openDetailAt(id,{x:rect.left+(projected?.x??rect.width/2),y:rect.top+(projected?.y??rect.height/2),width:0,height:0})}openDetailAt(id,rect){const popover=this.popoverEl;popover&&(popover.accessibleLabel=this.entityFor(id)?.label||"",popover.showAt(rect))}resolveDirectClickAnchor(event){if(this.view==="3d"){this.trackedNodeEl=void 0;const graph=this.graphEl,position=this.selectedNodeId?graph?.getNodeScreenPosition(this.selectedNodeId):void 0,rect2=graph?.getBoundingClientRect();if(position&&rect2)return{x:rect2.left+position.x,y:rect2.top+position.y,width:0,height:0}}if(this.renderer==="canvas")return this.trackedNodeEl=void 0,{x:event.clientX,y:event.clientY,width:0,height:0};const nodeEl=event.composedPath().find(el=>isElementNode(el)&&el.matches('[part="node"]'));if(!nodeEl)return this.trackedNodeEl=void 0,{x:event.clientX,y:event.clientY,width:0,height:0};this.trackedNodeEl=nodeEl;const rect=nodeEl.getBoundingClientRect();return{x:rect.left+rect.width/2,y:rect.top,width:rect.width,height:rect.height}}inputLimitMessages(properties=["nodes","edges"]){const messages=[],format=getNumberFormat(this.effectiveLocale);for(const property2 of properties){const loss=publicCollectionTruncation(this,property2);loss&&messages.push(this.localize(property2==="nodes"?"graphNodeLimit":"graphEdgeLimit",void 0,{shown:format.format(loss.retained),total:format.format(loss.source)}))}return messages}render(){const groupLabel=retrievalSemanticLabel(this,this.label==null?this.localize("graphExplorerLabel"):this.label),groupRole=retrievalSemanticRole(this,"group"),matches=this.matchingNodes(),detailsLimit=publicCollectionTruncation(this,"entityDetails"),model=this.graphModel,pinnedNodeIds=this.canonicalPinnedNodeIds,hiddenTypes=this.canonicalHiddenTypes,selectedEntity=this.graphSource!==void 0?this.sourceEntity:this.selectedNodeId?this.nodeById.get(this.selectedNodeId):void 0,isPinned=this.selectedNodeId!=null&&pinnedNodeIds.includes(this.selectedNodeId),dimmedDeps=[this.highlight,matches,this.selectedNodeId,this.hoveredNodeId,model],detailDeps=[this.selectedNodeId,model,hiddenTypes,this.entityDetails,this.sourceEntity],sourceFilter=this.sourceFilter,sourceCurrent=this.sourceCurrent(),renderedSource=this.graphSource,renderedEpoch=this.sourceEpoch,renderedOwner=this.ownerDocument,actionCurrent=renderedSource!==void 0?sourceCurrent:()=>this.graphSource===void 0&&this.sourceEpoch===renderedEpoch&&this.isConnected&&this.ownerDocument===renderedOwner;return html`
2
2
  <div
3
3
  part="base"
4
4
  role=${groupRole??nothing}
@@ -69,7 +69,6 @@ import{__decorate}from"tslib";import{ref}from"lit/directives/ref.js";import{setG
69
69
  ${this.path.length?this.pathReady?html`<lr-path-strip
70
70
  part="path"
71
71
  .path=${this.path}
72
- @lr-entity-activate=${event=>event.stopPropagation()}
73
72
  ></lr-path-strip>`:html`<p part="path">${this.localize(this.optionalFailed?"statusError":"loading")}</p>`:nothing}
74
73
  <lr-graph
75
74
  part="graph"
@@ -83,6 +82,7 @@ import{__decorate}from"tslib";import{ref}from"lit/directives/ref.js";import{setG
83
82
  .dimmedEdgeIds=${guard(dimmedDeps,()=>this.computedDimmedLinkIds)}
84
83
  renderer=${this.renderer}
85
84
  .view=${this.view}
85
+ .engine=${this.engine}
86
86
  .camera=${this.camera}
87
87
  fit-to=${this.fitTo}
88
88
  node-labels=${this.nodeLabels??nothing}
@@ -133,4 +133,4 @@ import{__decorate}from"tslib";import{ref}from"lit/directives/ref.js";import{setG
133
133
  </slot>
134
134
  </lr-popover>
135
135
  </div>
136
- `}}__decorate([state()],LyraKnowledgeGraphExplorer.prototype,"sourceEntity",void 0),__decorate([state()],LyraKnowledgeGraphExplorer.prototype,"sourceDetailsOpen",void 0),__decorate([state()],LyraKnowledgeGraphExplorer.prototype,"sourcePaint",void 0),__decorate([property({attribute:!1,noAccessor:!0,hasChanged:()=>!0})],LyraKnowledgeGraphExplorer.prototype,"graphSource",null),__decorate([property({type:Number,attribute:"source-page",noAccessor:!0})],LyraKnowledgeGraphExplorer.prototype,"sourcePage",null),__decorate([property({type:Number,attribute:"source-page-size",noAccessor:!0})],LyraKnowledgeGraphExplorer.prototype,"sourcePageSize",null),__decorate([property({attribute:!1})],LyraKnowledgeGraphExplorer.prototype,"nodes",void 0),__decorate([property({attribute:!1})],LyraKnowledgeGraphExplorer.prototype,"edges",void 0),__decorate([property({attribute:!1})],LyraKnowledgeGraphExplorer.prototype,"nodeTypes",void 0),__decorate([property({attribute:!1})],LyraKnowledgeGraphExplorer.prototype,"communities",void 0),__decorate([property({attribute:!1})],LyraKnowledgeGraphExplorer.prototype,"entityDetails",void 0),__decorate([property({attribute:!1})],LyraKnowledgeGraphExplorer.prototype,"pinnedNodeIds",void 0),__decorate([property({attribute:!1})],LyraKnowledgeGraphExplorer.prototype,"path",void 0),__decorate([property({attribute:!1})],LyraKnowledgeGraphExplorer.prototype,"hiddenTypes",void 0),__decorate([property({attribute:"selected-node-id"})],LyraKnowledgeGraphExplorer.prototype,"selectedNodeId",void 0),__decorate([property()],LyraKnowledgeGraphExplorer.prototype,"renderer",void 0),__decorate([property()],LyraKnowledgeGraphExplorer.prototype,"view",void 0),__decorate([property({attribute:!1})],LyraKnowledgeGraphExplorer.prototype,"camera",void 0),__decorate([property({attribute:"node-labels"})],LyraKnowledgeGraphExplorer.prototype,"nodeLabels",void 0),__decorate([property({attribute:"fit-to"})],LyraKnowledgeGraphExplorer.prototype,"fitTo",void 0),__decorate([property({converter:graphLengthConverter})],LyraKnowledgeGraphExplorer.prototype,"width",void 0),__decorate([property({converter:graphLengthConverter})],LyraKnowledgeGraphExplorer.prototype,"height",void 0),__decorate([property()],LyraKnowledgeGraphExplorer.prototype,"label",void 0),__decorate([property()],LyraKnowledgeGraphExplorer.prototype,"highlight",void 0),__decorate([property()],LyraKnowledgeGraphExplorer.prototype,"query",void 0),__decorate([state()],LyraKnowledgeGraphExplorer.prototype,"pinLiveText",void 0),__decorate([state()],LyraKnowledgeGraphExplorer.prototype,"hoveredNodeId",void 0),__decorate([state()],LyraKnowledgeGraphExplorer.prototype,"activeResult",void 0),__decorate([query('[part="graph"]')],LyraKnowledgeGraphExplorer.prototype,"graphEl",void 0),__decorate([query('[part="detail-popover"]')],LyraKnowledgeGraphExplorer.prototype,"popoverEl",void 0);export{LyraKnowledgeGraphExplorer};
136
+ `}}__decorate([state()],LyraKnowledgeGraphExplorer.prototype,"sourceEntity",void 0),__decorate([state()],LyraKnowledgeGraphExplorer.prototype,"sourceDetailsOpen",void 0),__decorate([state()],LyraKnowledgeGraphExplorer.prototype,"sourcePaint",void 0),__decorate([property({attribute:!1,noAccessor:!0,hasChanged:()=>!0})],LyraKnowledgeGraphExplorer.prototype,"graphSource",null),__decorate([property({type:Number,attribute:"source-page",noAccessor:!0})],LyraKnowledgeGraphExplorer.prototype,"sourcePage",null),__decorate([property({type:Number,attribute:"source-page-size",noAccessor:!0})],LyraKnowledgeGraphExplorer.prototype,"sourcePageSize",null),__decorate([property({attribute:!1})],LyraKnowledgeGraphExplorer.prototype,"nodes",void 0),__decorate([property({attribute:!1})],LyraKnowledgeGraphExplorer.prototype,"edges",void 0),__decorate([property({attribute:!1})],LyraKnowledgeGraphExplorer.prototype,"nodeTypes",void 0),__decorate([property({attribute:!1})],LyraKnowledgeGraphExplorer.prototype,"communities",void 0),__decorate([property({attribute:!1})],LyraKnowledgeGraphExplorer.prototype,"entityDetails",void 0),__decorate([property({attribute:!1})],LyraKnowledgeGraphExplorer.prototype,"pinnedNodeIds",void 0),__decorate([property({attribute:!1})],LyraKnowledgeGraphExplorer.prototype,"path",void 0),__decorate([property({attribute:!1})],LyraKnowledgeGraphExplorer.prototype,"hiddenTypes",void 0),__decorate([property({attribute:"selected-node-id"})],LyraKnowledgeGraphExplorer.prototype,"selectedNodeId",void 0),__decorate([property()],LyraKnowledgeGraphExplorer.prototype,"renderer",void 0),__decorate([property()],LyraKnowledgeGraphExplorer.prototype,"view",void 0),__decorate([property({converter:ENGINE_3D_PREFERENCE})],LyraKnowledgeGraphExplorer.prototype,"engine",null),__decorate([property({attribute:!1})],LyraKnowledgeGraphExplorer.prototype,"camera",void 0),__decorate([property({attribute:"node-labels"})],LyraKnowledgeGraphExplorer.prototype,"nodeLabels",void 0),__decorate([property({attribute:"fit-to"})],LyraKnowledgeGraphExplorer.prototype,"fitTo",void 0),__decorate([property({converter:graphLengthConverter})],LyraKnowledgeGraphExplorer.prototype,"width",void 0),__decorate([property({converter:graphLengthConverter})],LyraKnowledgeGraphExplorer.prototype,"height",void 0),__decorate([property()],LyraKnowledgeGraphExplorer.prototype,"label",void 0),__decorate([property()],LyraKnowledgeGraphExplorer.prototype,"highlight",void 0),__decorate([property()],LyraKnowledgeGraphExplorer.prototype,"query",void 0),__decorate([state()],LyraKnowledgeGraphExplorer.prototype,"pinLiveText",void 0),__decorate([state()],LyraKnowledgeGraphExplorer.prototype,"hoveredNodeId",void 0),__decorate([state()],LyraKnowledgeGraphExplorer.prototype,"activeResult",void 0),__decorate([query('[part="graph"]')],LyraKnowledgeGraphExplorer.prototype,"graphEl",void 0),__decorate([query('[part="detail-popover"]')],LyraKnowledgeGraphExplorer.prototype,"popoverEl",void 0);export{LyraKnowledgeGraphExplorer};
@@ -17,9 +17,7 @@ confidence?:number;
17
17
  provenance?:LyraProvenance;}type MemoryScope='short-term'|'long-term';export interface LyraMemoryAddDetail{memory:LyraMemoryItem;}export interface LyraMemoryRemoveDetail{memoryId:string;scope:MemoryScope;}export interface LyraMemoryExpandDetail{memoryId:string;scope:MemoryScope;expanded:boolean;}
18
18
  /** The embedded provenance panel's non-toggle events cross this host unchanged; the owning
19
19
  * `[part="item"]` (`data-id`, `data-scope`) is on the event's `composedPath()`. */
20
- export interface LyraMemoryPanelEventMap extends Omit<LyraProvenancePanelEventMap,'lr-chunk-open'|'lr-toggle'>{'lr-chunk-open':CustomEvent<LyraEventDetailSnapshot<{memoryId:string;scope:MemoryScope;chunkId:string;sourceId:string;anchor?:NonNullable<LyraChunk['anchor']>;}>>;'lr-add':CustomEvent<LyraEventDetailSnapshot<LyraMemoryAddDetail>>;'lr-remove':CustomEvent<LyraMemoryRemoveDetail>;'lr-forget':CustomEvent<null>;
21
- /** @deprecated Use `lr-toggle` and read `itemId`; this alias remains during its deprecation window. */
22
- 'lr-memory-toggle':CustomEvent<LyraMemoryExpandDetail>;'lr-toggle':CustomEvent<{expanded:boolean;itemId?:string;memoryId?:string;scope?:MemoryScope;section?:'entities'|'relationships'|'communities'|'chunks';}>;}
20
+ export interface LyraMemoryPanelEventMap extends Omit<LyraProvenancePanelEventMap,'lr-chunk-open'|'lr-toggle'>{'lr-chunk-open':CustomEvent<LyraEventDetailSnapshot<{memoryId:string;scope:MemoryScope;chunkId:string;sourceId:string;anchor?:NonNullable<LyraChunk['anchor']>;}>>;'lr-add':CustomEvent<LyraEventDetailSnapshot<LyraMemoryAddDetail>>;'lr-remove':CustomEvent<LyraMemoryRemoveDetail>;'lr-forget':CustomEvent<null>;'lr-toggle':CustomEvent<{expanded:boolean;itemId?:string;memoryId?:string;scope?:MemoryScope;section?:'entities'|'relationships'|'communities'|'chunks';}>;}
23
21
  /**
24
22
  * `<lr-memory-panel>` — an agent's working memory surface: short-term context and long-term
25
23
  * memories, each item's confidence and (optional) grounding provenance, and add/remove/forget
@@ -73,21 +71,16 @@ export interface LyraMemoryPanelEventMap extends Omit<LyraProvenancePanelEventMa
73
71
  * the short-term item as-is; the host decides how/whether to persist it.
74
72
  * @event lr-remove - A pending "remove" action was approved. `detail: { memoryId, scope }`.
75
73
  * @event lr-forget - The pending "forget all long-term memories" action was approved. No detail.
76
- * @event lr-memory-toggle - A memory item's provenance disclosure was toggled, expanding or
77
- * collapsing it. `detail: { memoryId, scope, expanded }`.
78
74
  * @event lr-toggle - A memory item or one of its nested provenance disclosures changed.
79
75
  * Item changes carry `{ expanded, itemId, memoryId, scope }`; nested changes retain
80
76
  * their `section` and carry the owning `memoryId` and `scope`.
81
77
  * @event lr-entity-select - Surfaced unchanged from an expanded item's provenance panel.
82
78
  * `detail: { entityId, occurrenceIndex? }`.
83
- * @event lr-entity-activate - Deprecated alias of `lr-entity-select`, dispatched right after it.
84
79
  * @event lr-entity-open - Surfaced unchanged from the provenance panel. `detail: { entityId }`.
85
80
  * @event lr-drill - Surfaced unchanged from the provenance panel. `detail: { communityId }`.
86
81
  * @event lr-relation-activate - Surfaced unchanged from the provenance panel.
87
82
  * @event lr-chunk-open - A chunk of an expanded item's provenance was opened. `detail: { memoryId,
88
83
  * scope, chunkId, sourceId, anchor? }`.
89
- * @event lr-chunk-toggle - Surfaced unchanged from the provenance panel.
90
- * `detail: { chunkId, expanded }`.
91
84
  * @csspart base - The root wrapper.
92
85
  * @csspart empty - The all-empty `lr-empty` state, shown when both lists are empty.
93
86
  * @csspart section - One of the two (short-term/long-term) sections; carries `data-scope`.
@@ -128,9 +121,9 @@ export declare class LyraMemoryPanel extends LyraElement<LyraMemoryPanelEventMap
128
121
  protected static readonly identityCollectionProperties:readonly string[];static styles:import("lit").CSSResultGroup[];protected static readonly immutableEventDetails:readonly string[];
129
122
  /** The admitted memory is opaque caller state inside the otherwise frozen add envelope. */
130
123
  protected static readonly identityEventDetailProperties:Readonly<{'lr-add':readonly string[];}>;
131
- /** Ephemeral, working-context items. Controlled and never mutated by this component. */
124
+ /** Ephemeral, working-context items. Controlled and never mutated by this component. Assign a new array to update: mutating an array and assigning it again does not. */
132
125
  shortTerm:readonly LyraMemoryItem[];
133
- /** Persisted memories. Controlled and never mutated by this component. */
126
+ /** Persisted memories. Controlled and never mutated by this component. Assign a new array to update: mutating an array and assigning it again does not. */
134
127
  longTerm:readonly LyraMemoryItem[];
135
128
  /** `lr-provenance-panel` `types` pass-through, forwarded verbatim to every expanded item's panel. */
136
129
  types:readonly LyraNodeTypeStyle[];
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{tag}from"../../../internal/prefix.js";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{getOwnDataDescriptor,projectFrozenRows,MISSING_OWN_DATA_DESCRIPTOR,UNSAFE_OWN_DATA_DESCRIPTOR}from"../../../internal/data-descriptors.js";import{nextId}from"../../../internal/a11y.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{isRovingTargetAvailable,resolveListMove}from"../../../internal/list-navigation.js";import"../provenance-panel/provenance-panel.class.js";import"../../agent-tools/confirm-bar/confirm-bar.class.js";import"../../overlays/empty/empty.class.js";import{styles}from"./memory-panel.styles.js";import{retrievalSemanticLabel,retrievalSemanticRole}from"../retrieval-semantic-owner.js";import{shadowFocusTarget}from"../../../internal/active-element.js";import{resolveHeadingLevel}from"../../../internal/heading-level.js";import{resolveScoreTiers}from"../../../internal/score-tiers.js";import{LYRA_DEFAULT_citationHighConfidence,LYRA_DEFAULT_citationLowConfidence,LYRA_DEFAULT_citationMediumConfidence,LYRA_DEFAULT_memoryPanelAdd,LYRA_DEFAULT_memoryPanelAddWithContext,LYRA_DEFAULT_memoryPanelConfirmAddHeading,LYRA_DEFAULT_memoryPanelConfirmForgetBody,LYRA_DEFAULT_memoryPanelConfirmForgetHeading,LYRA_DEFAULT_memoryPanelConfirmRemoveHeading,LYRA_DEFAULT_memoryPanelForgetAll,LYRA_DEFAULT_memoryPanelItemsLimit,LYRA_DEFAULT_memoryPanelLabel,LYRA_DEFAULT_memoryPanelLongTermHeading,LYRA_DEFAULT_memoryPanelShortTermHeading,LYRA_DEFAULT_showMore}from"../../../internal/default-strings/retrieval.generated.js";import{LYRA_DEFAULT_approve,LYRA_DEFAULT_collapse,LYRA_DEFAULT_copy,LYRA_DEFAULT_date,LYRA_DEFAULT_deny,LYRA_DEFAULT_details,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_noData,LYRA_DEFAULT_open,LYRA_DEFAULT_progress,LYRA_DEFAULT_remove,LYRA_DEFAULT_removeWithContext,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_showLess,LYRA_DEFAULT_viewerSearchActiveMatch,LYRA_DEFAULT_viewerSearchMatchCount,LYRA_DEFAULT_viewerSearchNoMatches}from"../../../internal/default-strings/shared.generated.js";const MAX_PROJECTED_MEMORY_ITEMS=1e4,MAX_RENDERED_MEMORY_ITEMS=500,EMPTY_CANONICAL_MEMORIES=Object.freeze([]);function valueOfDescriptor(descriptor){return descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR?void 0:descriptor.value}function projectMemory(value){try{if(value===null||typeof value!="object"||Array.isArray(value))return;const idDescriptor=getOwnDataDescriptor(value,"id"),textDescriptor=getOwnDataDescriptor(value,"text"),confidenceDescriptor=getOwnDataDescriptor(value,"confidence"),provenanceDescriptor=getOwnDataDescriptor(value,"provenance");if([idDescriptor,textDescriptor,confidenceDescriptor,provenanceDescriptor].some(descriptor=>descriptor===UNSAFE_OWN_DATA_DESCRIPTOR))return;const id=valueOfDescriptor(idDescriptor),text=valueOfDescriptor(textDescriptor);if(typeof id!="string"||id.trim().length===0||typeof text!="string"||text.trim().length===0)return;const confidence=valueOfDescriptor(confidenceDescriptor),provenance=valueOfDescriptor(provenanceDescriptor);return Object.freeze({source:value,id,text,...typeof confidence=="number"&&Number.isFinite(confidence)?{confidence}:{},...provenance===void 0?{}:{provenance}})}catch{return}}function projectMemories(value){return projectFrozenRows(value,projectMemory,MAX_PROJECTED_MEMORY_ITEMS,EMPTY_CANONICAL_MEMORIES,item=>item.id)}const DEFAULT_TIERS={high:.75,medium:.5},CONFIRM_HEADING_KEY={add:"memoryPanelConfirmAddHeading",remove:"memoryPanelConfirmRemoveHeading","forget-all":"memoryPanelConfirmForgetHeading"},TIER_LABEL_KEY={high:"citationHighConfidence",medium:"citationMediumConfidence",low:"citationLowConfidence"},TIER_TONE={high:"success",medium:"warning",low:"danger"};class LyraMemoryPanel extends LyraElement{constructor(){super(...arguments),this.rovingActionByScope=new Map,this.shortTerm=[],this.longTerm=[],this.types=[],this.thresholds={high:.75,medium:.5},this.headingLevel="3",this.size="m",this.frame="card",this.expandedIds=new Set,this.pending=null,this.idBase=nextId("memory-panel"),this.canonicalMemoriesBySource=new WeakMap}static{this.defaultStrings={...super.defaultStrings,approve:LYRA_DEFAULT_approve,citationHighConfidence:LYRA_DEFAULT_citationHighConfidence,citationLowConfidence:LYRA_DEFAULT_citationLowConfidence,citationMediumConfidence:LYRA_DEFAULT_citationMediumConfidence,collapse:LYRA_DEFAULT_collapse,copy:LYRA_DEFAULT_copy,date:LYRA_DEFAULT_date,deny:LYRA_DEFAULT_deny,details:LYRA_DEFAULT_details,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,memoryPanelAdd:LYRA_DEFAULT_memoryPanelAdd,memoryPanelAddWithContext:LYRA_DEFAULT_memoryPanelAddWithContext,memoryPanelConfirmAddHeading:LYRA_DEFAULT_memoryPanelConfirmAddHeading,memoryPanelConfirmForgetBody:LYRA_DEFAULT_memoryPanelConfirmForgetBody,memoryPanelConfirmForgetHeading:LYRA_DEFAULT_memoryPanelConfirmForgetHeading,memoryPanelConfirmRemoveHeading:LYRA_DEFAULT_memoryPanelConfirmRemoveHeading,memoryPanelForgetAll:LYRA_DEFAULT_memoryPanelForgetAll,memoryPanelItemsLimit:LYRA_DEFAULT_memoryPanelItemsLimit,memoryPanelLabel:LYRA_DEFAULT_memoryPanelLabel,memoryPanelLongTermHeading:LYRA_DEFAULT_memoryPanelLongTermHeading,memoryPanelShortTermHeading:LYRA_DEFAULT_memoryPanelShortTermHeading,navigation:LYRA_DEFAULT_navigation,noData:LYRA_DEFAULT_noData,open:LYRA_DEFAULT_open,progress:LYRA_DEFAULT_progress,remove:LYRA_DEFAULT_remove,removeWithContext:LYRA_DEFAULT_removeWithContext,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,showLess:LYRA_DEFAULT_showLess,showMore:LYRA_DEFAULT_showMore,viewerSearchActiveMatch:LYRA_DEFAULT_viewerSearchActiveMatch,viewerSearchMatchCount:LYRA_DEFAULT_viewerSearchMatchCount,viewerSearchNoMatches:LYRA_DEFAULT_viewerSearchNoMatches}}onPrimaryKeyDown(event){const buttons=[...event.currentTarget.closest('[part="list"]')?.querySelectorAll("[data-roving-primary]")??[]],current=buttons.indexOf(event.currentTarget),next=resolveListMove(event,{count:buttons.length,current,orientation:"vertical",isAvailable:candidate=>!!(buttons[candidate]&&isRovingTargetAvailable(buttons[candidate]))});next!==null&&(event.preventDefault(),buttons[next]?.focus())}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["shortTerm","longTerm","types"])}static{this.identityCollectionProperties=Object.freeze(["shortTerm","longTerm"])}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-add","lr-chunk-open"])}static{this.identityEventDetailProperties=Object.freeze({"lr-add":Object.freeze(["memory"])})}willUpdate(changed){super.willUpdate(changed),this.captureControlledFocus(changed);const pending=this.pending;if(!pending)return;if(pending.kind==="forget-all"){changed.has("longTerm")&&(this.pending=null);return}if(!changed.has("shortTerm")&&!changed.has("longTerm"))return;const current=this.memoriesForScope(pending.scope).find(item=>item.source===pending.item.source);if(!current){this.pending=null;return}current!==pending.item&&(pending.item=current)}updated(changed){super.updated(changed);const pending=this.pendingControlledFocus;if(pending!==void 0){if(this.pendingControlledFocus=void 0,pending==="base"){this.renderRoot.querySelector('[part="base"]')?.focus();return}if(pending==="forget-all"){const button=this.renderRoot.querySelector('[part="forget-all-button"]');button?button.focus():this.renderRoot.querySelector('[part="base"]')?.focus();return}this.refocusItem(pending.scope,pending.index)}}captureControlledFocus(changed){if(!changed.has("shortTerm")&&!changed.has("longTerm"))return;const active=shadowFocusTarget(this);if(!active)return;const row=active.closest('[part="item"]');if(row){const scope=row.dataset.scope;if(!scope)return;const property2=scope==="short-term"?"shortTerm":"longTerm";if(!changed.has(property2))return;const oldIndex=[...this.renderRoot.querySelectorAll(`[part="section"][data-scope="${scope}"] [part="item"]`)].indexOf(row),focusedItem=this.cachedCanonicalMemoriesFor(changed.get(property2))[oldIndex],nextItems=this.memoriesForScope(scope),survivingIndex=focusedItem?nextItems.findIndex(item=>item.id===focusedItem.id):-1;if(survivingIndex===oldIndex)return;nextItems.length===0&&this.normalizedShortTerm.length===0&&this.normalizedLongTerm.length===0?this.pendingControlledFocus="base":this.pendingControlledFocus={scope,index:survivingIndex>=0?survivingIndex:Math.min(Math.max(oldIndex,0),Math.max(0,nextItems.length-1))};return}if(active.getAttribute("part")==="forget-all-confirm"&&changed.has("longTerm")){this.pendingControlledFocus=this.normalizedLongTerm.length===0?"base":"forget-all";return}active.getAttribute("part")==="forget-all-button"&&changed.has("longTerm")&&this.normalizedLongTerm.length===0&&(this.pendingControlledFocus="base")}canonicalMemoriesFor(source){if(source===null||typeof source!="object")return EMPTY_CANONICAL_MEMORIES;const cached=this.canonicalMemoriesBySource.get(source);if(cached)return cached;const memories=projectMemories(source);return this.canonicalMemoriesBySource.set(source,memories),memories}cachedCanonicalMemoriesFor(source){return source!==null&&typeof source=="object"?this.canonicalMemoriesBySource.get(source)??EMPTY_CANONICAL_MEMORIES:EMPTY_CANONICAL_MEMORIES}get normalizedShortTerm(){return this.canonicalMemoriesFor(this.shortTerm)}get normalizedLongTerm(){return this.canonicalMemoriesFor(this.longTerm)}memoriesForScope(scope){return scope==="short-term"?this.normalizedShortTerm:this.normalizedLongTerm}itemKey(item,scope){return`${scope}\0${item.id}`}itemBodyId(scope,index){return`${this.idBase}-${scope}-${index}`}tier(score){const{high,medium}=resolveScoreTiers(DEFAULT_TIERS,this.thresholds);return score>=high?"high":score>=medium?"medium":"low"}toggleExpand(item,scope){const key=this.itemKey(item,scope),next=new Set(this.expandedIds),expanded=!next.has(key);expanded?next.add(key):next.delete(key),this.expandedIds=next,this.emit("lr-memory-toggle",{memoryId:item.id,scope,expanded}),this.emit("lr-toggle",{itemId:item.id,memoryId:item.id,scope,expanded})}startItemPending(kind,item,scope){this.pending={kind,item,scope},this.focusPendingConfirmation()}startForgetAllPending(){this.pending={kind:"forget-all",longTerm:this.longTerm},this.focusPendingConfirmation()}focusPendingConfirmation(){const started=this.pending;this.updateComplete.then(async()=>{const bar=this.renderRoot.querySelector(tag("confirm-bar"));if(!bar)return;await bar.updateComplete;const deny=bar.shadowRoot?.querySelector('[part="deny-button"]');await deny?.updateComplete,!(this.pending!==started||!bar.isConnected)&&(deny??bar.shadowRoot?.querySelector('[part="status"]'))?.focus()})}onConfirmKeyDown(event,cancel){if(event.key!=="Escape")return;const before=this.pending;cancel(),this.pending!==before&&event.stopPropagation()}refocusItem(scope,index){this.updateComplete.then(()=>{const rows=[...this.renderRoot.querySelectorAll(`[part="section"][data-scope="${scope}"] [part="item"]`)];(rows[Math.min(index,rows.length-1)]??this.renderRoot.querySelector('[part="item"]')??this.renderRoot.querySelector('[part="base"]'))?.focus()})}resolveItemDecision(p,approved){if(this.pending!==p)return;const index=this.memoriesForScope(p.scope).indexOf(p.item);index<0||(this.pending=null,approved&&(p.kind==="add"?this.emit("lr-add",{memory:p.item.source}):this.emit("lr-remove",{memoryId:p.item.id,scope:p.scope})),this.refocusItem(p.scope,index))}resolveForgetAllDecision(pending,approved){this.pending!==pending||this.longTerm!==pending.longTerm||(this.pending=null,approved&&this.emit("lr-forget"),this.updateComplete.then(()=>{(this.renderRoot.querySelector('[part="forget-all-button"]')??this.renderRoot.querySelector('[part="item"]'))?.focus()}))}renderConfidence(item){if(item.confidence==null)return nothing;const tier=this.tier(item.confidence);return html`<span part="confidence" data-tone=${TIER_TONE[tier]}
1
+ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{tag}from"../../../internal/prefix.js";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{getOwnDataDescriptor,projectFrozenRows,MISSING_OWN_DATA_DESCRIPTOR,UNSAFE_OWN_DATA_DESCRIPTOR}from"../../../internal/data-descriptors.js";import{nextId}from"../../../internal/a11y.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{isRovingTargetAvailable,resolveListMove}from"../../../internal/list-navigation.js";import"../provenance-panel/provenance-panel.class.js";import"../../agent-tools/confirm-bar/confirm-bar.class.js";import"../../overlays/empty/empty.class.js";import{styles}from"./memory-panel.styles.js";import{retrievalSemanticLabel,retrievalSemanticRole}from"../retrieval-semantic-owner.js";import{shadowFocusTarget}from"../../../internal/active-element.js";import{resolveHeadingLevel}from"../../../internal/heading-level.js";import{resolveScoreTiers}from"../../../internal/score-tiers.js";import{LYRA_DEFAULT_citationHighConfidence,LYRA_DEFAULT_citationLowConfidence,LYRA_DEFAULT_citationMediumConfidence,LYRA_DEFAULT_memoryPanelAdd,LYRA_DEFAULT_memoryPanelAddWithContext,LYRA_DEFAULT_memoryPanelConfirmAddHeading,LYRA_DEFAULT_memoryPanelConfirmForgetBody,LYRA_DEFAULT_memoryPanelConfirmForgetHeading,LYRA_DEFAULT_memoryPanelConfirmRemoveHeading,LYRA_DEFAULT_memoryPanelForgetAll,LYRA_DEFAULT_memoryPanelItemsLimit,LYRA_DEFAULT_memoryPanelLabel,LYRA_DEFAULT_memoryPanelLongTermHeading,LYRA_DEFAULT_memoryPanelShortTermHeading,LYRA_DEFAULT_showMore}from"../../../internal/default-strings/retrieval.generated.js";import{LYRA_DEFAULT_approve,LYRA_DEFAULT_collapse,LYRA_DEFAULT_copy,LYRA_DEFAULT_date,LYRA_DEFAULT_deny,LYRA_DEFAULT_details,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_noData,LYRA_DEFAULT_open,LYRA_DEFAULT_progress,LYRA_DEFAULT_remove,LYRA_DEFAULT_removeWithContext,LYRA_DEFAULT_search,LYRA_DEFAULT_select,LYRA_DEFAULT_showLess,LYRA_DEFAULT_viewerSearchActiveMatch,LYRA_DEFAULT_viewerSearchMatchCount,LYRA_DEFAULT_viewerSearchNoMatches}from"../../../internal/default-strings/shared.generated.js";const MAX_PROJECTED_MEMORY_ITEMS=1e4,MAX_RENDERED_MEMORY_ITEMS=500,EMPTY_CANONICAL_MEMORIES=Object.freeze([]);function valueOfDescriptor(descriptor){return descriptor===MISSING_OWN_DATA_DESCRIPTOR||descriptor===UNSAFE_OWN_DATA_DESCRIPTOR?void 0:descriptor.value}function projectMemory(value){try{if(value===null||typeof value!="object"||Array.isArray(value))return;const idDescriptor=getOwnDataDescriptor(value,"id"),textDescriptor=getOwnDataDescriptor(value,"text"),confidenceDescriptor=getOwnDataDescriptor(value,"confidence"),provenanceDescriptor=getOwnDataDescriptor(value,"provenance");if([idDescriptor,textDescriptor,confidenceDescriptor,provenanceDescriptor].some(descriptor=>descriptor===UNSAFE_OWN_DATA_DESCRIPTOR))return;const id=valueOfDescriptor(idDescriptor),text=valueOfDescriptor(textDescriptor);if(typeof id!="string"||id.trim().length===0||typeof text!="string"||text.trim().length===0)return;const confidence=valueOfDescriptor(confidenceDescriptor),provenance=valueOfDescriptor(provenanceDescriptor);return Object.freeze({source:value,id,text,...typeof confidence=="number"&&Number.isFinite(confidence)?{confidence}:{},...provenance===void 0?{}:{provenance}})}catch{return}}function projectMemories(value){return projectFrozenRows(value,projectMemory,MAX_PROJECTED_MEMORY_ITEMS,EMPTY_CANONICAL_MEMORIES,item=>item.id)}const DEFAULT_TIERS={high:.75,medium:.5},CONFIRM_HEADING_KEY={add:"memoryPanelConfirmAddHeading",remove:"memoryPanelConfirmRemoveHeading","forget-all":"memoryPanelConfirmForgetHeading"},TIER_LABEL_KEY={high:"citationHighConfidence",medium:"citationMediumConfidence",low:"citationLowConfidence"},TIER_TONE={high:"success",medium:"warning",low:"danger"};class LyraMemoryPanel extends LyraElement{constructor(){super(...arguments),this.rovingActionByScope=new Map,this.shortTerm=[],this.longTerm=[],this.types=[],this.thresholds={high:.75,medium:.5},this.headingLevel="3",this.size="m",this.frame="card",this.expandedIds=new Set,this.pending=null,this.idBase=nextId("memory-panel"),this.canonicalMemoriesBySource=new WeakMap}static{this.defaultStrings={...super.defaultStrings,approve:LYRA_DEFAULT_approve,citationHighConfidence:LYRA_DEFAULT_citationHighConfidence,citationLowConfidence:LYRA_DEFAULT_citationLowConfidence,citationMediumConfidence:LYRA_DEFAULT_citationMediumConfidence,collapse:LYRA_DEFAULT_collapse,copy:LYRA_DEFAULT_copy,date:LYRA_DEFAULT_date,deny:LYRA_DEFAULT_deny,details:LYRA_DEFAULT_details,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,memoryPanelAdd:LYRA_DEFAULT_memoryPanelAdd,memoryPanelAddWithContext:LYRA_DEFAULT_memoryPanelAddWithContext,memoryPanelConfirmAddHeading:LYRA_DEFAULT_memoryPanelConfirmAddHeading,memoryPanelConfirmForgetBody:LYRA_DEFAULT_memoryPanelConfirmForgetBody,memoryPanelConfirmForgetHeading:LYRA_DEFAULT_memoryPanelConfirmForgetHeading,memoryPanelConfirmRemoveHeading:LYRA_DEFAULT_memoryPanelConfirmRemoveHeading,memoryPanelForgetAll:LYRA_DEFAULT_memoryPanelForgetAll,memoryPanelItemsLimit:LYRA_DEFAULT_memoryPanelItemsLimit,memoryPanelLabel:LYRA_DEFAULT_memoryPanelLabel,memoryPanelLongTermHeading:LYRA_DEFAULT_memoryPanelLongTermHeading,memoryPanelShortTermHeading:LYRA_DEFAULT_memoryPanelShortTermHeading,navigation:LYRA_DEFAULT_navigation,noData:LYRA_DEFAULT_noData,open:LYRA_DEFAULT_open,progress:LYRA_DEFAULT_progress,remove:LYRA_DEFAULT_remove,removeWithContext:LYRA_DEFAULT_removeWithContext,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select,showLess:LYRA_DEFAULT_showLess,showMore:LYRA_DEFAULT_showMore,viewerSearchActiveMatch:LYRA_DEFAULT_viewerSearchActiveMatch,viewerSearchMatchCount:LYRA_DEFAULT_viewerSearchMatchCount,viewerSearchNoMatches:LYRA_DEFAULT_viewerSearchNoMatches}}onPrimaryKeyDown(event){const buttons=[...event.currentTarget.closest('[part="list"]')?.querySelectorAll("[data-roving-primary]")??[]],current=buttons.indexOf(event.currentTarget),next=resolveListMove(event,{count:buttons.length,current,orientation:"vertical",isAvailable:candidate=>!!(buttons[candidate]&&isRovingTargetAvailable(buttons[candidate]))});next!==null&&(event.preventDefault(),buttons[next]?.focus())}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["shortTerm","longTerm","types"])}static{this.identityCollectionProperties=Object.freeze(["shortTerm","longTerm"])}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-add","lr-chunk-open"])}static{this.identityEventDetailProperties=Object.freeze({"lr-add":Object.freeze(["memory"])})}willUpdate(changed){super.willUpdate(changed),this.captureControlledFocus(changed);const pending=this.pending;if(!pending)return;if(pending.kind==="forget-all"){changed.has("longTerm")&&(this.pending=null);return}if(!changed.has("shortTerm")&&!changed.has("longTerm"))return;const current=this.memoriesForScope(pending.scope).find(item=>item.source===pending.item.source);if(!current){this.pending=null;return}current!==pending.item&&(pending.item=current)}updated(changed){super.updated(changed);const pending=this.pendingControlledFocus;if(pending!==void 0){if(this.pendingControlledFocus=void 0,pending==="base"){this.renderRoot.querySelector('[part="base"]')?.focus();return}if(pending==="forget-all"){const button=this.renderRoot.querySelector('[part="forget-all-button"]');button?button.focus():this.renderRoot.querySelector('[part="base"]')?.focus();return}this.refocusItem(pending.scope,pending.index)}}captureControlledFocus(changed){if(!changed.has("shortTerm")&&!changed.has("longTerm"))return;const active=shadowFocusTarget(this);if(!active)return;const row=active.closest('[part="item"]');if(row){const scope=row.dataset.scope;if(!scope)return;const property2=scope==="short-term"?"shortTerm":"longTerm";if(!changed.has(property2))return;const oldIndex=[...this.renderRoot.querySelectorAll(`[part="section"][data-scope="${scope}"] [part="item"]`)].indexOf(row),focusedItem=this.cachedCanonicalMemoriesFor(changed.get(property2))[oldIndex],nextItems=this.memoriesForScope(scope),survivingIndex=focusedItem?nextItems.findIndex(item=>item.id===focusedItem.id):-1;if(survivingIndex===oldIndex)return;nextItems.length===0&&this.normalizedShortTerm.length===0&&this.normalizedLongTerm.length===0?this.pendingControlledFocus="base":this.pendingControlledFocus={scope,index:survivingIndex>=0?survivingIndex:Math.min(Math.max(oldIndex,0),Math.max(0,nextItems.length-1))};return}if(active.getAttribute("part")==="forget-all-confirm"&&changed.has("longTerm")){this.pendingControlledFocus=this.normalizedLongTerm.length===0?"base":"forget-all";return}active.getAttribute("part")==="forget-all-button"&&changed.has("longTerm")&&this.normalizedLongTerm.length===0&&(this.pendingControlledFocus="base")}canonicalMemoriesFor(source){if(source===null||typeof source!="object")return EMPTY_CANONICAL_MEMORIES;const cached=this.canonicalMemoriesBySource.get(source);if(cached)return cached;const memories=projectMemories(source);return this.canonicalMemoriesBySource.set(source,memories),memories}cachedCanonicalMemoriesFor(source){return source!==null&&typeof source=="object"?this.canonicalMemoriesBySource.get(source)??EMPTY_CANONICAL_MEMORIES:EMPTY_CANONICAL_MEMORIES}get normalizedShortTerm(){return this.canonicalMemoriesFor(this.shortTerm)}get normalizedLongTerm(){return this.canonicalMemoriesFor(this.longTerm)}memoriesForScope(scope){return scope==="short-term"?this.normalizedShortTerm:this.normalizedLongTerm}itemKey(item,scope){return`${scope}\0${item.id}`}itemBodyId(scope,index){return`${this.idBase}-${scope}-${index}`}tier(score){const{high,medium}=resolveScoreTiers(DEFAULT_TIERS,this.thresholds);return score>=high?"high":score>=medium?"medium":"low"}toggleExpand(item,scope){const key=this.itemKey(item,scope),next=new Set(this.expandedIds),expanded=!next.has(key);expanded?next.add(key):next.delete(key),this.expandedIds=next,this.emit("lr-toggle",{itemId:item.id,memoryId:item.id,scope,expanded})}startItemPending(kind,item,scope){this.pending={kind,item,scope},this.focusPendingConfirmation()}startForgetAllPending(){this.pending={kind:"forget-all",longTerm:this.longTerm},this.focusPendingConfirmation()}focusPendingConfirmation(){const started=this.pending;this.updateComplete.then(async()=>{const bar=this.renderRoot.querySelector(tag("confirm-bar"));if(!bar)return;await bar.updateComplete;const deny=bar.shadowRoot?.querySelector('[part="deny-button"]');await deny?.updateComplete,!(this.pending!==started||!bar.isConnected)&&(deny??bar.shadowRoot?.querySelector('[part="status"]'))?.focus()})}onConfirmKeyDown(event,cancel){if(event.key!=="Escape")return;const before=this.pending;cancel(),this.pending!==before&&event.stopPropagation()}refocusItem(scope,index){this.updateComplete.then(()=>{const rows=[...this.renderRoot.querySelectorAll(`[part="section"][data-scope="${scope}"] [part="item"]`)];(rows[Math.min(index,rows.length-1)]??this.renderRoot.querySelector('[part="item"]')??this.renderRoot.querySelector('[part="base"]'))?.focus()})}resolveItemDecision(p,approved){if(this.pending!==p)return;const index=this.memoriesForScope(p.scope).indexOf(p.item);index<0||(this.pending=null,approved&&(p.kind==="add"?this.emit("lr-add",{memory:p.item.source}):this.emit("lr-remove",{memoryId:p.item.id,scope:p.scope})),this.refocusItem(p.scope,index))}resolveForgetAllDecision(pending,approved){this.pending!==pending||this.longTerm!==pending.longTerm||(this.pending=null,approved&&this.emit("lr-forget"),this.updateComplete.then(()=>{(this.renderRoot.querySelector('[part="forget-all-button"]')??this.renderRoot.querySelector('[part="item"]'))?.focus()}))}renderConfidence(item){if(item.confidence==null)return nothing;const tier=this.tier(item.confidence);return html`<span part="confidence" data-tone=${TIER_TONE[tier]}
2
2
  >${this.localize(TIER_LABEL_KEY[tier])}</span
3
3
  >`}renderItemConfirm(p){return html`
4
4
  <lr-confirm-bar
@@ -109,7 +109,7 @@ export declare class LyraNodePalette extends LyraElement<LyraNodePaletteEventMap
109
109
  protected static readonly identityCollectionProperties:readonly string[];protected static readonly identityEventDetailProperties:Readonly<{'lr-select':readonly string[];}>;static styles:import("lit").CSSResultGroup[];protected static readonly immutableEventDetails:readonly string[];
110
110
  /** Node templates available for filtering, activation, dragging, and optional reordering.
111
111
  * Accessor-backed or malformed rows are omitted; accepted fields are read once from own data
112
- * descriptors while the original item object stays available for documented identity contracts. */
112
+ * descriptors while the original item object stays available for documented identity contracts. Assign a new array to update: mutating an array and assigning it again does not. */
113
113
  items:readonly LyraPaletteItem[];
114
114
  /** Accessible name for the actual listbox; omitted, empty, or whitespace-only values use the
115
115
  * localized default while the public property's raw readback remains unchanged. */
@@ -1,6 +1,4 @@
1
- import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraEntity}from'../entity-card/entity-card.class.js';import'../../layout/scroller/scroller.class.js';export type LyraPathElement={kind:'node';node:LyraEntity;}|{kind:'edge';relation:string;directed?:boolean;reverse?:boolean;};export interface LyraPathStripEventMap{'lr-entity-select':CustomEvent<{entityId:string;occurrenceIndex?:number;}>;
2
- /** @deprecated Use `lr-entity-select`. */
3
- 'lr-entity-activate':CustomEvent<{entityId:string;occurrenceIndex:number;}>;'lr-relation-activate':CustomEvent<{relation:string;sourceNodeId?:string;targetNodeId?:string;occurrenceIndex:number;}>;}
1
+ import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraEntity}from'../entity-card/entity-card.class.js';import'../../layout/scroller/scroller.class.js';export type LyraPathElement={kind:'node';node:LyraEntity;}|{kind:'edge';relation:string;directed?:boolean;reverse?:boolean;};export interface LyraPathStripEventMap{'lr-entity-select':CustomEvent<{entityId:string;occurrenceIndex?:number;}>;'lr-relation-activate':CustomEvent<{relation:string;sourceNodeId?:string;targetNodeId?:string;occurrenceIndex:number;}>;}
4
2
  /**
5
3
  * `<lr-path-strip>` — a linear node -> relation -> node chain rendering "why A connects to B"
6
4
  * (GraphRAG local-search reasoning paths) as a compact, horizontally scrollable strip.
@@ -11,7 +9,6 @@ import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from
11
9
  *
12
10
  * @customElement lr-path-strip
13
11
  * @event lr-entity-select - A node element activated. `detail: { entityId, occurrenceIndex }`.
14
- * @event lr-entity-activate - Deprecated alias of `lr-entity-select`, dispatched right after it.
15
12
  * @event lr-relation-activate - An edge element activated. `detail: { relation, sourceNodeId?,
16
13
  * targetNodeId?, occurrenceIndex }` — source/target resolved from the adjacent retained node
17
14
  * elements, `undefined` when the path is malformed at that position. `occurrenceIndex` is the
@@ -1,4 +1,4 @@
1
- import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{isNonBlankIdentity}from"../retrieval-identity.js";import{srOnly}from"../../../internal/a11y.js";import{isRtl}from"../../../internal/rtl.js";import{prefersReducedMotion}from"../../../internal/motion.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import"../../layout/scroller/scroller.class.js";import{styles}from"./path-strip.styles.js";import{retrievalSemanticLabel,retrievalSemanticRole}from"../retrieval-semantic-owner.js";import{shadowFocusTarget}from"../../../internal/active-element.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{LYRA_DEFAULT_pathNodeStatus,LYRA_DEFAULT_pathRelationStatus,LYRA_DEFAULT_pathStripLabel}from"../../../internal/default-strings/retrieval.generated.js";import{LYRA_DEFAULT_noData}from"../../../internal/default-strings/shared.generated.js";class LyraPathStrip extends LyraElement{constructor(){super(...arguments),this.path=[],this.activeIndex=0,this.liveText="",this.restoreFocusAfterPathChange=!1,this.pathOccurrenceSnapshot=[],this.onKeyDown=e=>{const count=this.pathOccurrences.length;if(count===0)return;if(e.key==="Enter"||e.key===" "){e.preventDefault(),e.repeat||this.activate(this.activeIndex);return}const rtl=isRtl(this),forwardKey=rtl?"ArrowLeft":"ArrowRight",backwardKey=rtl?"ArrowRight":"ArrowLeft";let next=this.activeIndex;if(e.key===forwardKey)next=Math.min(count-1,this.activeIndex+1);else if(e.key===backwardKey)next=Math.max(0,this.activeIndex-1);else if(e.key==="Home")next=0;else if(e.key==="End")next=count-1;else return;e.preventDefault(),this.focusIndex(next)}}static{this.defaultStrings={...super.defaultStrings,noData:LYRA_DEFAULT_noData,pathNodeStatus:LYRA_DEFAULT_pathNodeStatus,pathRelationStatus:LYRA_DEFAULT_pathRelationStatus,pathStripLabel:LYRA_DEFAULT_pathStripLabel}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["path"])}static{this.styles=[LyraElement.styles,styles,srOnly]}get pathOccurrences(){if(this.pathOccurrenceSource===this.path)return this.pathOccurrenceSnapshot;this.pathOccurrenceSource=this.path;const source=Array.isArray(this.path)?this.path:[];return this.pathOccurrenceSnapshot=Object.freeze(source.flatMap((element,occurrenceIndex)=>element?.kind==="node"?isNonBlankIdentity(element.node?.id)?[{element,occurrenceIndex}]:[]:element?.kind==="edge"?isNonBlankIdentity(element.relation)?[{element,occurrenceIndex}]:[]:[])),this.pathOccurrenceSnapshot}connectedCallback(){super.connectedCallback(),this.announcementSink??=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this})}disconnectedCallback(){this.announcementSink?.release(),this.announcementSink=void 0,super.disconnectedCallback()}willUpdate(changed){super.willUpdate(changed),changed.has("path")&&(this.restoreFocusAfterPathChange=shadowFocusTarget(this)?.matches('[part="node"], [part="relation"]')??!1,this.activeIndex=Math.min(this.activeIndex,Math.max(0,this.pathOccurrences.length-1)))}updated(changed){super.updated(changed),!(!changed.has("path")||!this.restoreFocusAfterPathChange)&&(this.restoreFocusAfterPathChange=!1,this.scheduleAfterUpdate(()=>{if(this.pathOccurrences.length===0){this.shadowRoot?.querySelector('[part="base"]')?.focus();return}this.shadowRoot?.querySelectorAll('[part="node"], [part="relation"]')?.[this.activeIndex]?.focus()},"restore-path-focus"))}activate(index){const occurrence=this.pathOccurrences[index];if(!occurrence)return;const el=occurrence.element;if(el.kind==="node"){const detail={entityId:el.node.id,occurrenceIndex:occurrence.occurrenceIndex};this.emit("lr-entity-select",{...detail}),this.emit("lr-entity-activate",detail);return}const source=this.pathOccurrences[index-1]?.element,target=this.pathOccurrences[index+1]?.element;this.emit("lr-relation-activate",{relation:el.relation,sourceNodeId:source?.kind==="node"?source.node.id:void 0,targetNodeId:target?.kind==="node"?target.node.id:void 0,occurrenceIndex:occurrence.occurrenceIndex})}onElementFocus(index){this.activeIndex=index;const el=this.pathOccurrences[index]?.element,total=this.pathOccurrences.length,numberFormat=getNumberFormat(this.effectiveLocale);this.liveText=el?.kind==="node"?this.localize("pathNodeStatus",void 0,{label:el.node.label||el.node.id,position:numberFormat.format(index+1),total:numberFormat.format(total)}):el?this.localize("pathRelationStatus",void 0,{relation:el.relation}):"",this.announcementSink?.announce(this.liveText)}focusIndex(index){this.activeIndex=index,this.updateComplete.then(()=>{const el=this.renderRoot.querySelectorAll('[part="node"], [part="relation"]')[index];if(el?.focus(),el){const reducedMotion=!el.ownerDocument.defaultView||prefersReducedMotion(this);el.scrollIntoView({behavior:reducedMotion?"auto":"smooth",inline:"nearest",block:"nearest"})}})}renderNode(node,index){return html`<button
1
+ import{__decorate}from"tslib";import{collectionSupport}from"../../../internal/collection-snapshot.js";import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{isNonBlankIdentity}from"../retrieval-identity.js";import{srOnly}from"../../../internal/a11y.js";import{isRtl}from"../../../internal/rtl.js";import{prefersReducedMotion}from"../../../internal/motion.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import"../../layout/scroller/scroller.class.js";import{styles}from"./path-strip.styles.js";import{retrievalSemanticLabel,retrievalSemanticRole}from"../retrieval-semantic-owner.js";import{shadowFocusTarget}from"../../../internal/active-element.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{LYRA_DEFAULT_pathNodeStatus,LYRA_DEFAULT_pathRelationStatus,LYRA_DEFAULT_pathStripLabel}from"../../../internal/default-strings/retrieval.generated.js";import{LYRA_DEFAULT_noData}from"../../../internal/default-strings/shared.generated.js";class LyraPathStrip extends LyraElement{constructor(){super(...arguments),this.path=[],this.activeIndex=0,this.liveText="",this.restoreFocusAfterPathChange=!1,this.pathOccurrenceSnapshot=[],this.onKeyDown=e=>{const count=this.pathOccurrences.length;if(count===0)return;if(e.key==="Enter"||e.key===" "){e.preventDefault(),e.repeat||this.activate(this.activeIndex);return}const rtl=isRtl(this),forwardKey=rtl?"ArrowLeft":"ArrowRight",backwardKey=rtl?"ArrowRight":"ArrowLeft";let next=this.activeIndex;if(e.key===forwardKey)next=Math.min(count-1,this.activeIndex+1);else if(e.key===backwardKey)next=Math.max(0,this.activeIndex-1);else if(e.key==="Home")next=0;else if(e.key==="End")next=count-1;else return;e.preventDefault(),this.focusIndex(next)}}static{this.defaultStrings={...super.defaultStrings,noData:LYRA_DEFAULT_noData,pathNodeStatus:LYRA_DEFAULT_pathNodeStatus,pathRelationStatus:LYRA_DEFAULT_pathRelationStatus,pathStripLabel:LYRA_DEFAULT_pathStripLabel}}static{this.collectionSupport=collectionSupport}static{this.ownedCollectionProperties=Object.freeze(["path"])}static{this.styles=[LyraElement.styles,styles,srOnly]}get pathOccurrences(){if(this.pathOccurrenceSource===this.path)return this.pathOccurrenceSnapshot;this.pathOccurrenceSource=this.path;const source=Array.isArray(this.path)?this.path:[];return this.pathOccurrenceSnapshot=Object.freeze(source.flatMap((element,occurrenceIndex)=>element?.kind==="node"?isNonBlankIdentity(element.node?.id)?[{element,occurrenceIndex}]:[]:element?.kind==="edge"?isNonBlankIdentity(element.relation)?[{element,occurrenceIndex}]:[]:[])),this.pathOccurrenceSnapshot}connectedCallback(){super.connectedCallback(),this.announcementSink??=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this})}disconnectedCallback(){this.announcementSink?.release(),this.announcementSink=void 0,super.disconnectedCallback()}willUpdate(changed){super.willUpdate(changed),changed.has("path")&&(this.restoreFocusAfterPathChange=shadowFocusTarget(this)?.matches('[part="node"], [part="relation"]')??!1,this.activeIndex=Math.min(this.activeIndex,Math.max(0,this.pathOccurrences.length-1)))}updated(changed){super.updated(changed),!(!changed.has("path")||!this.restoreFocusAfterPathChange)&&(this.restoreFocusAfterPathChange=!1,this.scheduleAfterUpdate(()=>{if(this.pathOccurrences.length===0){this.shadowRoot?.querySelector('[part="base"]')?.focus();return}this.shadowRoot?.querySelectorAll('[part="node"], [part="relation"]')?.[this.activeIndex]?.focus()},"restore-path-focus"))}activate(index){const occurrence=this.pathOccurrences[index];if(!occurrence)return;const el=occurrence.element;if(el.kind==="node"){this.emit("lr-entity-select",{entityId:el.node.id,occurrenceIndex:occurrence.occurrenceIndex});return}const source=this.pathOccurrences[index-1]?.element,target=this.pathOccurrences[index+1]?.element;this.emit("lr-relation-activate",{relation:el.relation,sourceNodeId:source?.kind==="node"?source.node.id:void 0,targetNodeId:target?.kind==="node"?target.node.id:void 0,occurrenceIndex:occurrence.occurrenceIndex})}onElementFocus(index){this.activeIndex=index;const el=this.pathOccurrences[index]?.element,total=this.pathOccurrences.length,numberFormat=getNumberFormat(this.effectiveLocale);this.liveText=el?.kind==="node"?this.localize("pathNodeStatus",void 0,{label:el.node.label||el.node.id,position:numberFormat.format(index+1),total:numberFormat.format(total)}):el?this.localize("pathRelationStatus",void 0,{relation:el.relation}):"",this.announcementSink?.announce(this.liveText)}focusIndex(index){this.activeIndex=index,this.updateComplete.then(()=>{const el=this.renderRoot.querySelectorAll('[part="node"], [part="relation"]')[index];if(el?.focus(),el){const reducedMotion=!el.ownerDocument.defaultView||prefersReducedMotion(this);el.scrollIntoView({behavior:reducedMotion?"auto":"smooth",inline:"nearest",block:"nearest"})}})}renderNode(node,index){return html`<button
2
2
  part="node"
3
3
  type="button"
4
4
  tabindex=${this.activeIndex===index?"0":"-1"}