@aceshooting/lyra-ui 13.0.1 → 14.1.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 (723) hide show
  1. package/CHANGELOG.md +329 -0
  2. package/custom-elements.json +1 -1
  3. package/dist/cli/migration-contract.json +1 -1
  4. package/dist/components/agent-tools/activity-feed/activity-feed.class.d.ts +23 -15
  5. package/dist/components/agent-tools/activity-feed/activity-feed.class.js +9 -6
  6. package/dist/components/agent-tools/agent-trace/agent-trace.class.d.ts +12 -3
  7. package/dist/components/agent-tools/agent-trace/agent-trace.class.js +2 -1
  8. package/dist/components/agent-tools/approval-queue/approval-queue.class.d.ts +4 -2
  9. package/dist/components/agent-tools/approval-queue/approval-queue.class.js +1 -1
  10. package/dist/components/agent-tools/artifact-panel/artifact-panel.styles.js +1 -1
  11. package/dist/components/agent-tools/commit-card/commit-card.class.d.ts +3 -1
  12. package/dist/components/agent-tools/commit-card/commit-card.class.js +2 -2
  13. package/dist/components/agent-tools/compare-panel/compare-panel.class.d.ts +2 -1
  14. package/dist/components/agent-tools/compare-panel/compare-panel.styles.js +1 -1
  15. package/dist/components/agent-tools/prompt-studio/prompt-studio.class.d.ts +6 -2
  16. package/dist/components/agent-tools/prompt-studio/prompt-studio.class.js +8 -8
  17. package/dist/components/agent-tools/result-card/result-card.class.d.ts +1 -1
  18. package/dist/components/agent-tools/result-card/result-card.class.js +1 -1
  19. package/dist/components/agent-tools/result-card/result-field.class.d.ts +1 -1
  20. package/dist/components/agent-tools/result-card/result-field.class.js +1 -1
  21. package/dist/components/agent-tools/schema-viewer/schema-viewer.class.d.ts +5 -5
  22. package/dist/components/agent-tools/schema-viewer/schema-viewer.class.js +23 -10
  23. package/dist/components/agent-tools/span-waterfall/span-waterfall.class.d.ts +13 -6
  24. package/dist/components/agent-tools/span-waterfall/span-waterfall.class.js +3 -3
  25. package/dist/components/agent-tools/span-waterfall/span-waterfall.styles.js +1 -1
  26. package/dist/components/agent-tools/stack-trace/stack-trace-parse.js +3 -3
  27. package/dist/components/agent-tools/stack-trace/stack-trace.class.d.ts +1 -1
  28. package/dist/components/agent-tools/stack-trace/stack-trace.class.js +1 -1
  29. package/dist/components/agent-tools/subagent-panel/subagent-panel.class.js +1 -1
  30. package/dist/components/agent-tools/subagent-panel/subagent-panel.styles.js +1 -1
  31. package/dist/components/agent-tools/task-list/task-list.class.d.ts +1 -2
  32. package/dist/components/agent-tools/task-list/task-list.class.js +2 -2
  33. package/dist/components/agent-tools/terminal/terminal.class.d.ts +11 -2
  34. package/dist/components/agent-tools/terminal/terminal.class.js +5 -5
  35. package/dist/components/agent-tools/terminal/terminal.styles.js +1 -1
  36. package/dist/components/agent-tools/test-results/test-results.class.d.ts +4 -2
  37. package/dist/components/agent-tools/test-results/test-results.class.js +2 -2
  38. package/dist/components/agent-tools/thinking-panel/thinking-panel.class.d.ts +2 -0
  39. package/dist/components/agent-tools/thinking-panel/thinking-panel.styles.js +1 -1
  40. package/dist/components/agent-tools/tool-approval-dialog/tool-approval-dialog.class.js +1 -1
  41. package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.d.ts +2 -2
  42. package/dist/components/agent-tools/tool-call-chip/tool-call-chip.class.js +1 -1
  43. package/dist/components/agent-tools/tool-param-form/tool-param-form.class.js +3 -2
  44. package/dist/components/agent-tools/tool-param-form/tool-param-form.d.ts +1 -1
  45. package/dist/components/agent-tools/tool-param-form/tool-param-form.js +1 -1
  46. package/dist/components/agent-tools/tool-result-dialog/tool-result-dialog.class.js +2 -2
  47. package/dist/components/agent-tools/tool-result-dialog/tool-result-dialog.styles.js +1 -1
  48. package/dist/components/agent-tools/tool-result-view/registry.d.ts +2 -1
  49. package/dist/components/agent-tools/tool-result-view/tool-result-view.class.d.ts +1 -1
  50. package/dist/components/agent-tools/tool-result-view/tool-result-view.class.js +1 -1
  51. package/dist/components/agent-tools/tool-select-dialog/tool-select-dialog.class.d.ts +18 -12
  52. package/dist/components/agent-tools/tool-select-dialog/tool-select-dialog.class.js +7 -7
  53. package/dist/components/agent-tools/tool-timeline/tool-timeline.class.d.ts +9 -3
  54. package/dist/components/agent-tools/tool-timeline/tool-timeline.class.js +1 -1
  55. package/dist/components/agent-tools/trace-tree/span.d.ts +3 -1
  56. package/dist/components/agent-tools/trace-tree/span.js +1 -1
  57. package/dist/components/agent-tools/trace-tree/trace-tree.styles.js +1 -1
  58. package/dist/components/charts/chart/box-plot.class.d.ts +12 -3
  59. package/dist/components/charts/chart/box-plot.class.js +9 -9
  60. package/dist/components/charts/chart/box-plot.styles.js +1 -1
  61. package/dist/components/charts/chart/chart-core-loader.js +1 -1
  62. package/dist/components/charts/chart/chart-feature-loader.js +1 -1
  63. package/dist/components/charts/chart/chart-preload.d.ts +1 -1
  64. package/dist/components/charts/chart/chart-preload.js +1 -1
  65. package/dist/components/charts/chart/chart.class.d.ts +33 -10
  66. package/dist/components/charts/chart/chart.class.js +23 -14
  67. package/dist/components/charts/chart/chart.styles.js +1 -1
  68. package/dist/components/charts/chart/histogram-bin.js +1 -1
  69. package/dist/components/charts/chart/lite-chart.class.d.ts +20 -11
  70. package/dist/components/charts/chart/lite-chart.class.js +17 -11
  71. package/dist/components/charts/chart/lite-chart.styles.js +1 -1
  72. package/dist/components/conversation/agent-workspace/agent-workspace.class.d.ts +1 -1
  73. package/dist/components/conversation/agent-workspace/agent-workspace.class.js +2 -2
  74. package/dist/components/conversation/audio-visualizer/audio-visualizer.class.d.ts +10 -5
  75. package/dist/components/conversation/audio-visualizer/audio-visualizer.class.js +1 -1
  76. package/dist/components/conversation/branch-picker/branch-picker.class.d.ts +4 -2
  77. package/dist/components/conversation/branch-picker/branch-picker.class.js +1 -1
  78. package/dist/components/conversation/branch-picker/branch-picker.styles.js +1 -1
  79. package/dist/components/conversation/chat-composer/chat-composer.class.d.ts +6 -2
  80. package/dist/components/conversation/chat-composer/chat-composer.class.js +3 -3
  81. package/dist/components/conversation/chat-composer/chat-composer.styles.js +1 -1
  82. package/dist/components/conversation/chat-message/chat-message.class.d.ts +4 -3
  83. package/dist/components/conversation/chat-message/chat-message.class.js +2 -2
  84. package/dist/components/conversation/chat-message/chat-message.styles.js +1 -1
  85. package/dist/components/conversation/chat-viewport/chat-viewport.styles.js +1 -1
  86. package/dist/components/conversation/code-block/code-block-core.class.d.ts +4 -3
  87. package/dist/components/conversation/code-block/code-block-core.class.js +1 -1
  88. package/dist/components/conversation/code-block/code-block-shared.d.ts +3 -3
  89. package/dist/components/conversation/code-block/code-block-shared.js +2 -2
  90. package/dist/components/conversation/code-block/code-block.class.d.ts +4 -3
  91. package/dist/components/conversation/code-block/code-block.class.js +1 -1
  92. package/dist/components/conversation/code-block/code-block.styles.js +1 -1
  93. package/dist/components/conversation/code-block/code-loader.d.ts +1 -1
  94. package/dist/components/conversation/code-block/code-loader.js +1 -1
  95. package/dist/components/conversation/code-block/shiki-types.d.ts +2 -0
  96. package/dist/components/conversation/code-block/shiki-types.js +1 -1
  97. package/dist/components/conversation/conversation-item/conversation-item.class.js +1 -1
  98. package/dist/components/conversation/conversation-item/conversation-item.styles.js +1 -1
  99. package/dist/components/conversation/generation-metrics/generation-metrics.styles.js +1 -1
  100. package/dist/components/conversation/markdown/katex-loader.d.ts +4 -4
  101. package/dist/components/conversation/markdown/katex-loader.js +1 -1
  102. package/dist/components/conversation/markdown/markdown-base.class.js +1 -1
  103. package/dist/components/conversation/markdown/markdown-core.class.d.ts +1 -1
  104. package/dist/components/conversation/markdown/markdown-loader.d.ts +1 -1
  105. package/dist/components/conversation/markdown/markdown-loader.js +1 -1
  106. package/dist/components/conversation/markdown/markdown-shared.d.ts +6 -1
  107. package/dist/components/conversation/markdown/markdown-shared.js +5 -4
  108. package/dist/components/conversation/markdown/markdown.class.d.ts +1 -1
  109. package/dist/components/conversation/message-actions/message-actions.class.d.ts +18 -3
  110. package/dist/components/conversation/message-actions/message-actions.class.js +2 -2
  111. package/dist/components/conversation/message-actions/message-actions.styles.js +1 -1
  112. package/dist/components/conversation/message-actions/toolbar-actions.d.ts +3 -1
  113. package/dist/components/conversation/message-actions/toolbar-actions.js +1 -1
  114. package/dist/components/conversation/message-feedback/message-feedback.class.d.ts +40 -15
  115. package/dist/components/conversation/message-feedback/message-feedback.class.js +7 -3
  116. package/dist/components/conversation/message-feedback/message-feedback.styles.js +1 -1
  117. package/dist/components/conversation/message-parts/message-parts.class.d.ts +10 -4
  118. package/dist/components/conversation/message-parts/message-parts.class.js +2 -2
  119. package/dist/components/conversation/message-parts/message-parts.styles.js +1 -1
  120. package/dist/components/conversation/model-select/model-select.class.d.ts +5 -2
  121. package/dist/components/conversation/model-select/model-select.class.js +8 -5
  122. package/dist/components/conversation/model-settings-panel/model-settings-panel.class.d.ts +3 -5
  123. package/dist/components/conversation/model-settings-panel/model-settings-panel.class.js +2 -1
  124. package/dist/components/conversation/prompt-input/prompt-input.class.d.ts +9 -2
  125. package/dist/components/conversation/prompt-input/prompt-input.class.js +3 -3
  126. package/dist/components/conversation/prompt-input/prompt-input.styles.js +1 -1
  127. package/dist/components/conversation/prompt-queue/prompt-queue.class.d.ts +20 -4
  128. package/dist/components/conversation/prompt-queue/prompt-queue.class.js +1 -1
  129. package/dist/components/conversation/prompt-queue/prompt-queue.styles.js +1 -1
  130. package/dist/components/conversation/push-to-talk/push-to-talk.class.d.ts +17 -8
  131. package/dist/components/conversation/push-to-talk/push-to-talk.class.js +1 -1
  132. package/dist/components/conversation/push-to-talk/push-to-talk.styles.js +1 -1
  133. package/dist/components/conversation/selection-toolbar/selection-toolbar.class.d.ts +6 -3
  134. package/dist/components/conversation/selection-toolbar/selection-toolbar.class.js +1 -1
  135. package/dist/components/conversation/selection-toolbar/selection-toolbar.styles.js +1 -1
  136. package/dist/components/conversation/thread-list/thread-list.class.d.ts +14 -4
  137. package/dist/components/conversation/thread-list/thread-list.class.js +11 -11
  138. package/dist/components/conversation/thread-list/thread-list.styles.js +1 -1
  139. package/dist/components/conversation/transcript-feed/transcript-feed.class.d.ts +2 -0
  140. package/dist/components/conversation/transcript-feed/transcript-feed.class.js +1 -1
  141. package/dist/components/conversation/transcript-feed/transcript-feed.styles.js +1 -1
  142. package/dist/components/conversation/typing-indicator/typing-indicator.class.d.ts +2 -1
  143. package/dist/components/conversation/typing-indicator/typing-indicator.class.js +1 -1
  144. package/dist/components/conversation/usage-badge/usage-badge-overlay-runtime.d.ts +3 -0
  145. package/dist/components/conversation/usage-badge/usage-badge-overlay-runtime.js +1 -0
  146. package/dist/components/conversation/usage-badge/usage-badge.class.d.ts +4 -2
  147. package/dist/components/conversation/usage-badge/usage-badge.class.js +1 -1
  148. package/dist/components/conversation/voice-picker/voice-picker.class.d.ts +12 -4
  149. package/dist/components/conversation/voice-picker/voice-picker.class.js +8 -5
  150. package/dist/components/conversation/voice-picker/voice-picker.styles.js +1 -1
  151. package/dist/components/conversation/widget-renderer/resolve.d.ts +4 -6
  152. package/dist/components/conversation/widget-renderer/resolve.js +1 -1
  153. package/dist/components/data/calendar/calendar.class.d.ts +16 -5
  154. package/dist/components/data/calendar/calendar.class.js +2 -2
  155. package/dist/components/data/calendar/calendar.styles.js +1 -1
  156. package/dist/components/data/condition-builder/condition-builder.class.d.ts +3 -1
  157. package/dist/components/data/condition-builder/condition-builder.class.js +15 -1
  158. package/dist/components/data/context-meter/context-meter.class.d.ts +3 -1
  159. package/dist/components/data/context-meter/context-meter.class.js +4 -4
  160. package/dist/components/data/data-grid/data-grid.class.d.ts +51 -6
  161. package/dist/components/data/data-grid/data-grid.class.js +25 -11
  162. package/dist/components/data/data-grid/data-grid.styles.js +1 -1
  163. package/dist/components/data/document-library/document-library.class.d.ts +5 -2
  164. package/dist/components/data/document-library/document-library.class.js +1 -1
  165. package/dist/components/data/env-list/env-list.class.js +1 -1
  166. package/dist/components/data/file-tree/file-tree.class.d.ts +2 -1
  167. package/dist/components/data/file-tree/file-tree.class.js +1 -1
  168. package/dist/components/data/flow-canvas/flow-canvas.class.d.ts +24 -14
  169. package/dist/components/data/flow-canvas/flow-canvas.class.js +1 -2
  170. package/dist/components/data/flow-canvas/flow-canvas.styles.js +1 -1
  171. package/dist/components/data/flow-canvas/flow-model.js +1 -1
  172. package/dist/components/data/flow-canvas/flow-types.d.ts +2 -1
  173. package/dist/components/data/flow-controls/flow-controls.styles.js +1 -1
  174. package/dist/components/data/flow-run-status/flow-run-status.class.js +1 -1
  175. package/dist/components/data/funnel/funnel.class.d.ts +1 -0
  176. package/dist/components/data/funnel/funnel.class.js +1 -1
  177. package/dist/components/data/gauge/gauge.class.d.ts +4 -1
  178. package/dist/components/data/gauge/gauge.class.js +6 -6
  179. package/dist/components/data/graph-query-builder/graph-query-builder.class.d.ts +5 -2
  180. package/dist/components/data/graph-query-builder/graph-query-builder.class.js +15 -1
  181. package/dist/components/data/graph-query-builder/graph-query-builder.styles.js +1 -1
  182. package/dist/components/data/heatmap/heatmap.class.d.ts +7 -4
  183. package/dist/components/data/heatmap/heatmap.class.js +1 -1
  184. package/dist/components/data/sequence-strip/sequence-strip.class.js +1 -1
  185. package/dist/components/data/sparkline/sparkline.class.d.ts +2 -1
  186. package/dist/components/data/sparkline/sparkline.class.js +1 -1
  187. package/dist/components/data/stat/stat.class.d.ts +6 -2
  188. package/dist/components/data/stat/stat.class.js +1 -1
  189. package/dist/components/data/table/table.class.d.ts +15 -16
  190. package/dist/components/data/table/table.class.js +5 -4
  191. package/dist/components/data/table/table.styles.js +1 -1
  192. package/dist/components/data/timeline/timeline.class.d.ts +7 -2
  193. package/dist/components/data/timeline/timeline.class.js +1 -1
  194. package/dist/components/data/timeline/timeline.styles.js +1 -1
  195. package/dist/components/data/tree/tree-item.class.d.ts +3 -1
  196. package/dist/components/data/tree/tree-item.class.js +1 -1
  197. package/dist/components/data/tree/tree-item.styles.js +1 -1
  198. package/dist/components/data/tree/tree.class.d.ts +4 -1
  199. package/dist/components/data/tree/tree.class.js +1 -1
  200. package/dist/components/data/word-cloud/word-cloud-layout.d.ts +2 -1
  201. package/dist/components/data/word-cloud/word-cloud-layout.js +1 -1
  202. package/dist/components/data/word-cloud/word-cloud.class.d.ts +2 -1
  203. package/dist/components/data/word-cloud/word-cloud.class.js +1 -1
  204. package/dist/components/forms/button/button.class.d.ts +5 -3
  205. package/dist/components/forms/button/button.class.js +1 -1
  206. package/dist/components/forms/checkbox/checkbox.class.d.ts +3 -0
  207. package/dist/components/forms/checkbox/checkbox.class.js +1 -1
  208. package/dist/components/forms/checkbox-group/checkbox-group.class.d.ts +7 -2
  209. package/dist/components/forms/checkbox-group/checkbox-group.class.js +1 -1
  210. package/dist/components/forms/code-editor/code-editor.class.d.ts +16 -4
  211. package/dist/components/forms/code-editor/code-editor.class.js +19 -9
  212. package/dist/components/forms/code-editor/code-editor.styles.js +1 -1
  213. package/dist/components/forms/color-picker/color-picker.class.d.ts +6 -2
  214. package/dist/components/forms/color-picker/color-picker.class.js +4 -4
  215. package/dist/components/forms/combobox/combobox.class.d.ts +19 -8
  216. package/dist/components/forms/combobox/combobox.class.js +3 -3
  217. package/dist/components/forms/combobox/combobox.styles.js +1 -1
  218. package/dist/components/forms/combobox/option.class.d.ts +4 -0
  219. package/dist/components/forms/combobox/option.class.js +2 -2
  220. package/dist/components/forms/date-picker/calendar-core.d.ts +1 -1
  221. package/dist/components/forms/date-picker/calendar-core.js +1 -1
  222. package/dist/components/forms/date-picker/date-input.class.d.ts +20 -10
  223. package/dist/components/forms/date-picker/date-input.class.js +4 -4
  224. package/dist/components/forms/date-picker/date-picker.class.d.ts +33 -15
  225. package/dist/components/forms/date-picker/date-picker.class.js +8 -8
  226. package/dist/components/forms/date-picker/date-picker.styles.js +1 -1
  227. package/dist/components/forms/emoji-picker/emoji-data-loader.js +1 -1
  228. package/dist/components/forms/emoji-picker/emoji-picker.class.d.ts +11 -3
  229. package/dist/components/forms/emoji-picker/emoji-picker.class.js +3 -3
  230. package/dist/components/forms/emoji-picker/emoji-types.d.ts +2 -2
  231. package/dist/components/forms/icon-button/icon-button.class.d.ts +4 -2
  232. package/dist/components/forms/icon-button/icon-button.class.js +1 -1
  233. package/dist/components/forms/input/input.class.d.ts +16 -5
  234. package/dist/components/forms/input/input.class.js +7 -1
  235. package/dist/components/forms/input/native-time-input.class.d.ts +3 -0
  236. package/dist/components/forms/input/number-input.class.d.ts +3 -0
  237. package/dist/components/forms/input/time-input.class.d.ts +11 -2
  238. package/dist/components/forms/input/time-input.class.js +2 -2
  239. package/dist/components/forms/locale-picker/locale-picker.class.d.ts +22 -4
  240. package/dist/components/forms/locale-picker/locale-picker.class.js +2 -2
  241. package/dist/components/forms/locale-picker/locale-picker.styles.js +1 -1
  242. package/dist/components/forms/otp-input/otp-input.class.d.ts +5 -1
  243. package/dist/components/forms/otp-input/otp-input.class.js +1 -1
  244. package/dist/components/forms/phone-input/phone-input.class.d.ts +21 -8
  245. package/dist/components/forms/phone-input/phone-input.class.js +1 -1
  246. package/dist/components/forms/radio/radio-button.class.d.ts +4 -0
  247. package/dist/components/forms/radio/radio-group.class.d.ts +4 -1
  248. package/dist/components/forms/radio/radio-group.class.js +1 -1
  249. package/dist/components/forms/radio/radio.class.d.ts +6 -2
  250. package/dist/components/forms/radio/radio.class.js +1 -1
  251. package/dist/components/forms/rubric-form/rubric-form.class.d.ts +7 -1
  252. package/dist/components/forms/rubric-form/rubric-form.class.js +3 -3
  253. package/dist/components/forms/select/select.class.d.ts +8 -2
  254. package/dist/components/forms/select/select.class.js +2 -2
  255. package/dist/components/forms/select/select.styles.js +1 -1
  256. package/dist/components/forms/slider/slider.class.d.ts +12 -6
  257. package/dist/components/forms/slider/slider.class.js +2 -2
  258. package/dist/components/forms/swatch-picker/swatch-picker.class.d.ts +4 -0
  259. package/dist/components/forms/swatch-picker/swatch-picker.class.js +1 -1
  260. package/dist/components/forms/switch/switch.class.d.ts +5 -1
  261. package/dist/components/forms/switch/switch.class.js +1 -1
  262. package/dist/components/forms/textarea/textarea.class.d.ts +3 -0
  263. package/dist/components/forms/textarea/textarea.class.js +1 -1
  264. package/dist/components/forms/time-range/time-range.class.d.ts +3 -0
  265. package/dist/components/forms/time-range/time-range.class.js +1 -1
  266. package/dist/components/forms/token-input/token-input.class.d.ts +8 -2
  267. package/dist/components/forms/token-input/token-input.class.js +2 -2
  268. package/dist/components/forms/token-input/token-input.styles.js +1 -1
  269. package/dist/components/layout/app-rail/app-rail.class.d.ts +9 -5
  270. package/dist/components/layout/app-rail/app-rail.class.js +4 -3
  271. package/dist/components/layout/app-rail/app-rail.styles.js +1 -1
  272. package/dist/components/layout/carousel/carousel.class.d.ts +3 -2
  273. package/dist/components/layout/carousel/carousel.class.js +1 -1
  274. package/dist/components/layout/command-palette/command-palette.class.d.ts +2 -2
  275. package/dist/components/layout/command-palette/command-palette.class.js +1 -1
  276. package/dist/components/layout/command-palette/command-palette.styles.js +1 -1
  277. package/dist/components/layout/dashboard-grid/dashboard-grid.class.d.ts +2 -0
  278. package/dist/components/layout/dashboard-grid/dashboard-grid.class.js +1 -1
  279. package/dist/components/layout/details/details.class.d.ts +16 -15
  280. package/dist/components/layout/details/details.class.js +43 -34
  281. package/dist/components/layout/details/details.styles.js +1 -1
  282. package/dist/components/layout/dock-panel/dock-panel.class.d.ts +4 -3
  283. package/dist/components/layout/dock-panel/dock-panel.class.js +2 -1
  284. package/dist/components/layout/filter-bar/filter-bar.class.d.ts +3 -1
  285. package/dist/components/layout/filter-bar/filter-bar.class.js +2 -2
  286. package/dist/components/layout/menu/menu-item.class.js +2 -2
  287. package/dist/components/layout/menu/menu-label.class.d.ts +3 -3
  288. package/dist/components/layout/menu/menu.class.d.ts +4 -1
  289. package/dist/components/layout/menu/menu.class.js +1 -1
  290. package/dist/components/layout/multi-split/multi-split.class.d.ts +19 -8
  291. package/dist/components/layout/multi-split/multi-split.class.js +2 -1
  292. package/dist/components/layout/multi-split/multi-split.styles.js +1 -1
  293. package/dist/components/layout/reorder-list/reorder-item.class.d.ts +2 -1
  294. package/dist/components/layout/reorder-list/reorder-item.class.js +1 -1
  295. package/dist/components/layout/reorder-list/reorder-list.class.js +1 -1
  296. package/dist/components/layout/reorder-list/reorder-owner.js +1 -1
  297. package/dist/components/layout/scroller/scroller.class.d.ts +4 -4
  298. package/dist/components/layout/scroller/scroller.styles.js +1 -1
  299. package/dist/components/layout/split-panel/split-panel.class.d.ts +5 -3
  300. package/dist/components/layout/split-panel/split-panel.class.js +3 -2
  301. package/dist/components/layout/tab-group/tab-group.class.d.ts +3 -1
  302. package/dist/components/layout/tab-group/tab-group.class.js +1 -1
  303. package/dist/components/layout/tab-group/tab-group.styles.js +1 -1
  304. package/dist/components/layout/virtual-list/virtual-list.class.js +2 -2
  305. package/dist/components/layout/widget/widget.class.d.ts +6 -2
  306. package/dist/components/layout/widget/widget.class.js +1 -1
  307. package/dist/components/layout/widget/widget.styles.js +1 -1
  308. package/dist/components/media/animation/animation.class.d.ts +3 -2
  309. package/dist/components/media/animation/animation.class.js +1 -1
  310. package/dist/components/media/attachment-chip/attachment-chip.class.d.ts +4 -3
  311. package/dist/components/media/attachment-chip/attachment-chip.class.js +1 -1
  312. package/dist/components/media/av-player/av-metadata.d.ts +3 -2
  313. package/dist/components/media/av-player/av-player.class.d.ts +4 -3
  314. package/dist/components/media/av-player/av-player.class.js +3 -3
  315. package/dist/components/media/av-player/av-player.styles.js +1 -1
  316. package/dist/components/media/avatar/avatar.class.d.ts +2 -1
  317. package/dist/components/media/avatar/avatar.class.js +1 -1
  318. package/dist/components/media/file-input/file-input.class.d.ts +4 -2
  319. package/dist/components/media/file-input/file-input.class.js +1 -1
  320. package/dist/components/media/file-input/file-input.styles.js +1 -1
  321. package/dist/components/media/flag/flag.class.js +1 -1
  322. package/dist/components/media/image-viewer/image-viewer.class.d.ts +2 -1
  323. package/dist/components/media/image-viewer/image-viewer.class.js +1 -1
  324. package/dist/components/media/image-viewer/image-viewer.styles.js +1 -1
  325. package/dist/components/media/lightbox/lightbox.styles.js +1 -1
  326. package/dist/components/media/map/map-loader.js +1 -1
  327. package/dist/components/media/map/map.class.d.ts +22 -34
  328. package/dist/components/media/map/map.class.js +1 -1
  329. package/dist/components/media/map/map.styles.js +1 -1
  330. package/dist/components/media/media-card/media-card.class.d.ts +1 -1
  331. package/dist/components/media/media-card/media-card.class.js +1 -1
  332. package/dist/components/media/pan-zoom/pan-zoom.class.js +1 -1
  333. package/dist/components/media/qr-code/qr-code-loader.js +1 -1
  334. package/dist/components/media/qr-code/qr-code.class.d.ts +5 -2
  335. package/dist/components/media/qr-code/qr-code.class.js +2 -2
  336. package/dist/components/media/sequence-playback/sequence-playback.class.d.ts +3 -3
  337. package/dist/components/media/sequence-playback/sequence-playback.class.js +1 -1
  338. package/dist/components/media/sequence-playback/sequence-playback.styles.js +1 -1
  339. package/dist/components/media/video/video.class.d.ts +2 -1
  340. package/dist/components/media/video/video.styles.js +1 -1
  341. package/dist/components/media/zoomable-frame/zoomable-frame.class.d.ts +3 -2
  342. package/dist/components/media/zoomable-frame/zoomable-frame.class.js +2 -2
  343. package/dist/components/overlays/alert/alert.styles.js +1 -1
  344. package/dist/components/overlays/callout/callout.styles.js +1 -1
  345. package/dist/components/overlays/chip/chip-group.class.d.ts +2 -0
  346. package/dist/components/overlays/chip/chip-group.class.js +1 -1
  347. package/dist/components/overlays/dialog/dialog.class.d.ts +2 -0
  348. package/dist/components/overlays/dialog/dialog.class.js +1 -1
  349. package/dist/components/overlays/dialog/dialog.styles.js +1 -1
  350. package/dist/components/overlays/empty/empty.class.d.ts +2 -0
  351. package/dist/components/overlays/empty/empty.class.js +1 -1
  352. package/dist/components/overlays/kbd/kbd.class.d.ts +2 -0
  353. package/dist/components/overlays/kbd/kbd.class.js +1 -1
  354. package/dist/components/overlays/overlay/popover.class.d.ts +3 -1
  355. package/dist/components/overlays/overlay/popover.class.js +1 -1
  356. package/dist/components/overlays/overlay/tooltip.class.d.ts +3 -1
  357. package/dist/components/overlays/overlay/tooltip.class.js +1 -1
  358. package/dist/components/overlays/rating/rating.class.d.ts +2 -0
  359. package/dist/components/overlays/rating/rating.class.js +1 -1
  360. package/dist/components/overlays/toast/toast-item.class.js +1 -1
  361. package/dist/components/retrieval/claim-evidence/claim-evidence.class.d.ts +11 -5
  362. package/dist/components/retrieval/claim-evidence/claim-evidence.class.js +3 -3
  363. package/dist/components/retrieval/embedding-explorer/embedding-explorer.class.js +2 -2
  364. package/dist/components/retrieval/entity-card/entity-card.class.d.ts +5 -2
  365. package/dist/components/retrieval/entity-card/entity-card.class.js +1 -1
  366. package/dist/components/retrieval/entity-chip/entity-chip.class.d.ts +4 -2
  367. package/dist/components/retrieval/entity-chip/entity-chip.class.js +1 -1
  368. package/dist/components/retrieval/graph/graph-canvas.js +1 -1
  369. package/dist/components/retrieval/graph/graph-loader.js +1 -1
  370. package/dist/components/retrieval/graph/graph.class.d.ts +10 -8
  371. package/dist/components/retrieval/graph/graph.class.js +10 -10
  372. package/dist/components/retrieval/graph-legend/graph-legend.class.d.ts +4 -2
  373. package/dist/components/retrieval/graph-legend/graph-legend.class.js +1 -1
  374. package/dist/components/retrieval/grounding-summary/grounding-summary.class.d.ts +15 -9
  375. package/dist/components/retrieval/grounding-summary/grounding-summary.class.js +7 -5
  376. package/dist/components/retrieval/ingestion-queue/ingestion-queue.class.d.ts +2 -0
  377. package/dist/components/retrieval/ingestion-queue/ingestion-queue.class.js +1 -1
  378. package/dist/components/retrieval/knowledge-base/knowledge-base.class.d.ts +3 -2
  379. package/dist/components/retrieval/knowledge-base/knowledge-base.class.js +4 -3
  380. package/dist/components/retrieval/knowledge-base/knowledge-base.styles.js +1 -1
  381. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.d.ts +7 -3
  382. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.class.js +8 -3
  383. package/dist/components/retrieval/knowledge-graph-explorer/knowledge-graph-explorer.styles.js +1 -1
  384. package/dist/components/retrieval/memory-panel/memory-panel.class.d.ts +15 -6
  385. package/dist/components/retrieval/memory-panel/memory-panel.class.js +1 -1
  386. package/dist/components/retrieval/neighbor-list/neighbor-list.class.js +1 -1
  387. package/dist/components/retrieval/neighbor-list/neighbor-list.styles.js +1 -1
  388. package/dist/components/retrieval/node-palette/node-palette.class.d.ts +17 -12
  389. package/dist/components/retrieval/node-palette/node-palette.class.js +2 -2
  390. package/dist/components/retrieval/node-palette/node-palette.styles.js +1 -1
  391. package/dist/components/retrieval/path-strip/path-strip.class.js +1 -1
  392. package/dist/components/retrieval/provenance-panel/provenance-panel.class.d.ts +2 -1
  393. package/dist/components/retrieval/provenance-panel/provenance-panel.class.js +1 -1
  394. package/dist/components/retrieval/retrieval-results/retrieval-results.class.d.ts +1 -1
  395. package/dist/components/retrieval/retrieval-results/retrieval-results.class.js +5 -5
  396. package/dist/components/retrieval/retrieval-trace/retrieval-trace.class.js +1 -1
  397. package/dist/components/retrieval/source-picker/source-picker.class.d.ts +2 -1
  398. package/dist/components/retrieval/source-picker/source-picker.class.js +2 -2
  399. package/dist/components/utility/copy-button/copy-button.class.d.ts +2 -1
  400. package/dist/components/utility/copy-button/copy-button.class.js +1 -1
  401. package/dist/components/utility/diff-view/diff-view.class.d.ts +4 -1
  402. package/dist/components/utility/diff-view/diff-view.class.js +1 -1
  403. package/dist/components/utility/export-button/export-button.class.d.ts +2 -2
  404. package/dist/components/utility/export-button/export-button.class.js +1 -1
  405. package/dist/components/utility/export-button/export-button.styles.js +1 -1
  406. package/dist/components/utility/format/format-date.class.js +1 -1
  407. package/dist/components/utility/format/format-number.class.d.ts +3 -1
  408. package/dist/components/utility/format/format-options.js +1 -1
  409. package/dist/components/utility/format/relative-time.class.js +1 -1
  410. package/dist/components/utility/icon/dompurify-loader.js +1 -1
  411. package/dist/components/utility/icon/icon-library.js +1 -1
  412. package/dist/components/utility/intersection-observer/intersection-observer.class.js +1 -1
  413. package/dist/components/utility/json-viewer/json-viewer.class.d.ts +6 -3
  414. package/dist/components/utility/json-viewer/json-viewer.class.js +5 -5
  415. package/dist/components/utility/known-date/known-date.class.d.ts +9 -5
  416. package/dist/components/utility/known-date/known-date.class.js +2 -2
  417. package/dist/components/utility/known-date/known-date.styles.js +1 -1
  418. package/dist/components/utility/mention-popover/mention-popover.class.d.ts +32 -45
  419. package/dist/components/utility/mention-popover/mention-popover.class.js +1 -1
  420. package/dist/components/utility/mutation-observer/mutation-observer.class.js +1 -1
  421. package/dist/components/utility/poll-status/poll-status.class.d.ts +3 -0
  422. package/dist/components/utility/poll-status/poll-status.styles.js +1 -1
  423. package/dist/components/viewers/calendar-viewer/calendar-loader.js +1 -1
  424. package/dist/components/viewers/calendar-viewer/calendar-viewer.class.d.ts +1 -0
  425. package/dist/components/viewers/calendar-viewer/calendar-viewer.class.js +1 -1
  426. package/dist/components/viewers/dataset-viewer/dataset-viewer.class.d.ts +2 -1
  427. package/dist/components/viewers/dataset-viewer/dataset-viewer.styles.js +1 -1
  428. package/dist/components/viewers/document-compare/document-compare.class.d.ts +11 -8
  429. package/dist/components/viewers/document-compare/document-compare.class.js +2 -2
  430. package/dist/components/viewers/document-preview/document-preview.class.d.ts +8 -4
  431. package/dist/components/viewers/document-preview/document-preview.class.js +4 -4
  432. package/dist/components/viewers/document-preview/document-preview.styles.js +1 -1
  433. package/dist/components/viewers/document-viewer/document-viewer.class.d.ts +5 -2
  434. package/dist/components/viewers/document-viewer/document-viewer.class.js +2 -2
  435. package/dist/components/viewers/document-viewer/document-viewer.styles.js +1 -1
  436. package/dist/components/viewers/document-viewer/registry-ownership.d.ts +1 -0
  437. package/dist/components/viewers/document-viewer/registry-ownership.js +1 -0
  438. package/dist/components/viewers/document-viewer/registry.js +1 -1
  439. package/dist/components/viewers/docx-viewer/docx-loader.js +1 -1
  440. package/dist/components/viewers/docx-viewer/docx-viewer.class.js +1 -1
  441. package/dist/components/viewers/ebook-viewer/ebook-loader.d.ts +1 -1
  442. package/dist/components/viewers/ebook-viewer/ebook-viewer.class.d.ts +8 -2
  443. package/dist/components/viewers/ebook-viewer/ebook-viewer.class.js +1 -1
  444. package/dist/components/viewers/email-viewer/email-loader.js +1 -1
  445. package/dist/components/viewers/email-viewer/email-viewer.class.d.ts +3 -2
  446. package/dist/components/viewers/email-viewer/email-viewer.class.js +2 -2
  447. package/dist/components/viewers/html-viewer/dompurify-loader.js +1 -1
  448. package/dist/components/viewers/include/include-resource.js +1 -1
  449. package/dist/components/viewers/include/include.class.d.ts +3 -1
  450. package/dist/components/viewers/notebook-viewer/dompurify-loader.js +1 -1
  451. package/dist/components/viewers/notebook-viewer/notebook-viewer.class.d.ts +4 -2
  452. package/dist/components/viewers/notebook-viewer/notebook-viewer.class.js +4 -4
  453. package/dist/components/viewers/notebook-viewer/notebook-viewer.styles.js +1 -1
  454. package/dist/components/viewers/passive-markup.js +1 -1
  455. package/dist/components/viewers/pdf-viewer/pdf-loader.js +1 -1
  456. package/dist/components/viewers/pptx-viewer/pptx-loader.js +1 -1
  457. package/dist/components/viewers/spreadsheet-viewer/spreadsheet-loader.js +1 -1
  458. package/dist/components/viewers/svg-viewer/dompurify-loader.js +1 -1
  459. package/dist/components/viewers/svg-viewer/svg-viewer.class.d.ts +2 -1
  460. package/dist/components/viewers/svg-viewer/svg-viewer.styles.js +1 -1
  461. package/dist/components/viewers/viewer-loading.js +1 -1
  462. package/dist/components/viewers/viewer-search-limits.d.ts +2 -0
  463. package/dist/components/viewers/viewer-search-limits.js +1 -1
  464. package/dist/components/viewers/xml-viewer/xml-viewer.class.d.ts +2 -1
  465. package/dist/components/viewers/xml-viewer/xml-viewer.class.js +1 -1
  466. package/dist/components/viewers/xml-viewer/xml-viewer.js +1 -1
  467. package/dist/custom-elements-jsx.d.ts +1 -1
  468. package/dist/events.d.ts +13 -6
  469. package/dist/internal/aria-controls.d.ts +16 -13
  470. package/dist/internal/aria-controls.js +1 -1
  471. package/dist/internal/aria-reflection.js +1 -1
  472. package/dist/internal/catalog-picker.d.ts +2 -2
  473. package/dist/internal/catalog-picker.js +1 -1
  474. package/dist/internal/chart-annotation-registration.d.ts +1 -0
  475. package/dist/internal/chart-annotation-registration.js +1 -0
  476. package/dist/internal/data-descriptors.d.ts +13 -0
  477. package/dist/internal/data-descriptors.js +1 -0
  478. package/dist/internal/default-strings.generated.d.ts +1 -1
  479. package/dist/internal/default-strings.generated.js +2 -2
  480. package/dist/internal/dev-mode-attribute-warning.d.ts +3 -0
  481. package/dist/internal/dev-mode-attribute-warning.js +1 -1
  482. package/dist/internal/element-internals.d.ts +4 -3
  483. package/dist/internal/element-internals.js +1 -1
  484. package/dist/internal/form-associated.js +1 -1
  485. package/dist/internal/highlight-collection.d.ts +2 -0
  486. package/dist/internal/highlight-collection.js +1 -1
  487. package/dist/internal/localization-types.d.ts +1 -1
  488. package/dist/internal/localization.js +2 -2
  489. package/dist/internal/lyra-element.d.ts +10 -1
  490. package/dist/internal/lyra-element.js +2 -1
  491. package/dist/internal/native-control-description.d.ts +7 -0
  492. package/dist/internal/native-control-description.js +1 -0
  493. package/dist/internal/option-selection.js +1 -1
  494. package/dist/internal/overlay-order.d.ts +6 -0
  495. package/dist/internal/overlay-order.js +1 -0
  496. package/dist/internal/overlay-stack.d.ts +1 -1
  497. package/dist/internal/overlay-stack.js +1 -1
  498. package/dist/internal/package-metadata.d.ts +1 -1
  499. package/dist/internal/package-metadata.js +1 -1
  500. package/dist/internal/papaparse-loader.js +1 -1
  501. package/dist/internal/positioner.d.ts +5 -4
  502. package/dist/internal/pseudo-localization.js +1 -1
  503. package/dist/internal/reactive-property-writes.d.ts +1 -0
  504. package/dist/internal/reactive-property-writes.js +1 -0
  505. package/dist/internal/safe-css.js +1 -1
  506. package/dist/internal/step-value.d.ts +6 -0
  507. package/dist/internal/step-value.js +1 -0
  508. package/dist/internal/svg-title.d.ts +3 -0
  509. package/dist/internal/svg-title.js +1 -0
  510. package/dist/internal/text-quote.js +1 -1
  511. package/dist/lyra.d.ts +1 -1
  512. package/dist/svelte.d.ts +1 -1
  513. package/dist/translations/ar.js +2 -2
  514. package/dist/translations/de.js +2 -2
  515. package/dist/translations/es.js +2 -2
  516. package/dist/translations/fa.js +2 -2
  517. package/dist/translations/fr.js +2 -2
  518. package/dist/translations/he.js +2 -2
  519. package/dist/translations/ja.js +2 -2
  520. package/dist/translations/pseudo/ar-XB.js +1 -1
  521. package/dist/translations/pt-BR.js +2 -2
  522. package/dist/translations/ru.js +2 -2
  523. package/dist/translations/zh-CN.js +2 -2
  524. package/dist/vue.d.ts +1 -1
  525. package/llms/components/lr-accordion-item.md +10 -5
  526. package/llms/components/lr-accordion.md +10 -5
  527. package/llms/components/lr-activity-feed.md +6 -5
  528. package/llms/components/lr-agent-run.md +1 -1
  529. package/llms/components/lr-agent-trace.md +3 -0
  530. package/llms/components/lr-agent-workspace.md +3 -2
  531. package/llms/components/lr-animation.md +4 -0
  532. package/llms/components/lr-app-rail-item.md +4 -2
  533. package/llms/components/lr-app-rail.md +4 -2
  534. package/llms/components/lr-attachment-chip.md +8 -3
  535. package/llms/components/lr-audio-visualizer.md +9 -6
  536. package/llms/components/lr-av-player.md +14 -0
  537. package/llms/components/lr-avatar.md +4 -0
  538. package/llms/components/lr-bar-chart.md +2 -2
  539. package/llms/components/lr-box-plot.md +15 -6
  540. package/llms/components/lr-bubble-chart.md +2 -2
  541. package/llms/components/lr-button.md +11 -3
  542. package/llms/components/lr-calendar-viewer.md +4 -0
  543. package/llms/components/lr-calendar.md +15 -4
  544. package/llms/components/lr-carousel.md +5 -0
  545. package/llms/components/lr-chart.md +24 -9
  546. package/llms/components/lr-chat-composer.md +2 -1
  547. package/llms/components/lr-chat-message.md +4 -0
  548. package/llms/components/lr-checkbox.md +3 -0
  549. package/llms/components/lr-chip-group.md +3 -0
  550. package/llms/components/lr-chip.md +3 -0
  551. package/llms/components/lr-chunk-inspector.md +2 -2
  552. package/llms/components/lr-code-block-core.md +20 -8
  553. package/llms/components/lr-code-block.md +17 -14
  554. package/llms/components/lr-code-editor.md +20 -5
  555. package/llms/components/lr-color-picker.md +9 -0
  556. package/llms/components/lr-combobox.md +35 -4
  557. package/llms/components/lr-command-palette.md +4 -0
  558. package/llms/components/lr-commit-card.md +3 -0
  559. package/llms/components/lr-compare-panel.md +7 -0
  560. package/llms/components/lr-condition-builder.md +5 -0
  561. package/llms/components/lr-conversation-item.md +3 -0
  562. package/llms/components/lr-copy-button.md +10 -1
  563. package/llms/components/lr-dashboard-grid.md +5 -0
  564. package/llms/components/lr-data-grid.md +22 -3
  565. package/llms/components/lr-dataset-viewer.md +3 -2
  566. package/llms/components/lr-date-input.md +50 -6
  567. package/llms/components/lr-date-picker.md +51 -7
  568. package/llms/components/lr-details.md +10 -5
  569. package/llms/components/lr-dialog.md +4 -0
  570. package/llms/components/lr-diff-view.md +6 -0
  571. package/llms/components/lr-document-compare.md +6 -2
  572. package/llms/components/lr-document-library.md +4 -0
  573. package/llms/components/lr-document-preview.md +18 -4
  574. package/llms/components/lr-document-viewer.md +14 -4
  575. package/llms/components/lr-docx-viewer.md +6 -0
  576. package/llms/components/lr-doughnut-chart.md +2 -2
  577. package/llms/components/lr-dropdown-item.md +4 -0
  578. package/llms/components/lr-dropdown.md +3 -0
  579. package/llms/components/lr-ebook-viewer.md +12 -3
  580. package/llms/components/lr-email-viewer.md +10 -0
  581. package/llms/components/lr-emoji-picker.md +17 -3
  582. package/llms/components/lr-empty.md +3 -0
  583. package/llms/components/lr-entity-card.md +3 -0
  584. package/llms/components/lr-entity-chip.md +4 -0
  585. package/llms/components/lr-eval-dataset.md +2 -2
  586. package/llms/components/lr-export-button.md +9 -0
  587. package/llms/components/lr-file-input.md +12 -8
  588. package/llms/components/lr-file-tree.md +5 -1
  589. package/llms/components/lr-filter-bar.md +5 -0
  590. package/llms/components/lr-flow-canvas.md +8 -1
  591. package/llms/components/lr-flow-node.md +2 -1
  592. package/llms/components/lr-flow-run-status.md +1 -1
  593. package/llms/components/lr-format-date.md +3 -1
  594. package/llms/components/lr-format-number.md +4 -0
  595. package/llms/components/lr-funnel.md +4 -0
  596. package/llms/components/lr-gauge.md +4 -0
  597. package/llms/components/lr-generation-metrics.md +5 -0
  598. package/llms/components/lr-graph-legend.md +4 -2
  599. package/llms/components/lr-graph-query-builder.md +6 -0
  600. package/llms/components/lr-graph.md +8 -2
  601. package/llms/components/lr-grounding-summary.md +8 -8
  602. package/llms/components/lr-heatmap.md +13 -0
  603. package/llms/components/lr-histogram.md +2 -2
  604. package/llms/components/lr-icon-button.md +7 -0
  605. package/llms/components/lr-image-viewer.md +9 -0
  606. package/llms/components/lr-include.md +5 -0
  607. package/llms/components/lr-ingestion-queue.md +5 -1
  608. package/llms/components/lr-input.md +22 -8
  609. package/llms/components/lr-intersection-observer.md +9 -0
  610. package/llms/components/lr-json-viewer.md +10 -1
  611. package/llms/components/lr-kbd.md +3 -0
  612. package/llms/components/lr-knowledge-base.md +10 -1
  613. package/llms/components/lr-knowledge-graph-explorer.md +7 -0
  614. package/llms/components/lr-known-date.md +7 -0
  615. package/llms/components/lr-line-chart.md +2 -2
  616. package/llms/components/lr-lite-chart.md +29 -9
  617. package/llms/components/lr-live-region.md +3 -0
  618. package/llms/components/lr-locale-picker.md +12 -0
  619. package/llms/components/lr-map.md +23 -5
  620. package/llms/components/lr-markdown-core.md +4 -0
  621. package/llms/components/lr-markdown.md +15 -8
  622. package/llms/components/lr-media-card.md +5 -8
  623. package/llms/components/lr-mention-popover.md +17 -10
  624. package/llms/components/lr-menu-item.md +4 -0
  625. package/llms/components/lr-menu-label.md +4 -3
  626. package/llms/components/lr-menu.md +4 -0
  627. package/llms/components/lr-message-actions.md +13 -3
  628. package/llms/components/lr-message-feedback.md +24 -7
  629. package/llms/components/lr-message-parts.md +6 -3
  630. package/llms/components/lr-model-select.md +13 -2
  631. package/llms/components/lr-multi-split.md +20 -7
  632. package/llms/components/lr-mutation-observer.md +8 -0
  633. package/llms/components/lr-native-time-input.md +10 -0
  634. package/llms/components/lr-node-palette.md +8 -2
  635. package/llms/components/lr-notebook-viewer.md +4 -1
  636. package/llms/components/lr-number-input.md +12 -1
  637. package/llms/components/lr-option.md +35 -4
  638. package/llms/components/lr-otp-input.md +10 -0
  639. package/llms/components/lr-pan-zoom.md +1 -2
  640. package/llms/components/lr-phone-input.md +20 -5
  641. package/llms/components/lr-pie-chart.md +2 -2
  642. package/llms/components/lr-polar-area-chart.md +2 -2
  643. package/llms/components/lr-poll-status.md +4 -0
  644. package/llms/components/lr-popover.md +3 -0
  645. package/llms/components/lr-popup.md +3 -2
  646. package/llms/components/lr-prompt-input.md +7 -3
  647. package/llms/components/lr-prompt-queue.md +6 -0
  648. package/llms/components/lr-prompt-studio.md +7 -0
  649. package/llms/components/lr-provenance-panel.md +3 -0
  650. package/llms/components/lr-push-to-talk.md +8 -0
  651. package/llms/components/lr-qr-code.md +6 -0
  652. package/llms/components/lr-radar-chart.md +2 -2
  653. package/llms/components/lr-radio-button.md +13 -4
  654. package/llms/components/lr-radio-group.md +5 -0
  655. package/llms/components/lr-radio.md +9 -0
  656. package/llms/components/lr-rating.md +8 -0
  657. package/llms/components/lr-relative-time.md +2 -0
  658. package/llms/components/lr-reorder-item.md +6 -0
  659. package/llms/components/lr-reorder-list.md +6 -0
  660. package/llms/components/lr-result-card.md +6 -3
  661. package/llms/components/lr-result-field.md +6 -3
  662. package/llms/components/lr-retrieval-results.md +1 -1
  663. package/llms/components/lr-rubric-form.md +12 -0
  664. package/llms/components/lr-scatter-chart.md +2 -2
  665. package/llms/components/lr-scroller.md +5 -5
  666. package/llms/components/lr-select.md +9 -0
  667. package/llms/components/lr-sequence-playback.md +5 -2
  668. package/llms/components/lr-slider.md +19 -5
  669. package/llms/components/lr-source-picker.md +4 -0
  670. package/llms/components/lr-span-waterfall.md +3 -0
  671. package/llms/components/lr-sparkline.md +4 -0
  672. package/llms/components/lr-split-panel.md +4 -0
  673. package/llms/components/lr-stack-trace.md +3 -0
  674. package/llms/components/lr-stat.md +10 -0
  675. package/llms/components/lr-streaming-text.md +2 -3
  676. package/llms/components/lr-subagent-panel.md +3 -2
  677. package/llms/components/lr-svg-viewer.md +3 -0
  678. package/llms/components/lr-swatch-picker.md +4 -0
  679. package/llms/components/lr-switch.md +6 -0
  680. package/llms/components/lr-tab-group.md +4 -0
  681. package/llms/components/lr-table.md +10 -2
  682. package/llms/components/lr-terminal.md +17 -5
  683. package/llms/components/lr-textarea.md +9 -0
  684. package/llms/components/lr-thinking-panel.md +3 -1
  685. package/llms/components/lr-thread-list.md +26 -4
  686. package/llms/components/lr-time-input.md +3 -0
  687. package/llms/components/lr-time-range.md +5 -0
  688. package/llms/components/lr-timeline-item.md +6 -0
  689. package/llms/components/lr-timeline.md +6 -0
  690. package/llms/components/lr-token-input.md +14 -0
  691. package/llms/components/lr-tool-call-chip.md +7 -5
  692. package/llms/components/lr-tool-param-form.md +6 -2
  693. package/llms/components/lr-tool-result-dialog.md +4 -0
  694. package/llms/components/lr-tool-result-view.md +2 -3
  695. package/llms/components/lr-tool-select-dialog.md +6 -2
  696. package/llms/components/lr-tooltip.md +6 -0
  697. package/llms/components/lr-trace-tree.md +3 -0
  698. package/llms/components/lr-transcript-feed.md +3 -0
  699. package/llms/components/lr-tree-item.md +12 -5
  700. package/llms/components/lr-tree.md +12 -5
  701. package/llms/components/lr-typing-indicator.md +3 -0
  702. package/llms/components/lr-usage-badge.md +4 -0
  703. package/llms/components/lr-video.md +8 -2
  704. package/llms/components/lr-virtual-list.md +5 -3
  705. package/llms/components/lr-voice-picker.md +15 -2
  706. package/llms/components/lr-widget-renderer.md +21 -13
  707. package/llms/components/lr-widget.md +4 -2
  708. package/llms/components/lr-word-cloud.md +4 -0
  709. package/llms/components/lr-xml-viewer.md +9 -2
  710. package/llms/components/lr-zoomable-frame.md +6 -3
  711. package/llms/peers.md +5 -5
  712. package/llms/shared.md +74 -63
  713. package/llms-full.txt +4705 -2954
  714. package/package.json +19 -14
  715. package/vscode-css-data.json +1 -1
  716. package/vscode-html-data.json +1 -1
  717. package/web-types.json +1 -1
  718. package/dist/components/viewers/docx-viewer/fixtures/minimal-docx-fixture.d.ts +0 -1
  719. package/dist/components/viewers/docx-viewer/fixtures/minimal-docx-fixture.js +0 -1
  720. package/dist/components/viewers/ebook-viewer/fixtures/minimal-epub-fixture.d.ts +0 -1
  721. package/dist/components/viewers/ebook-viewer/fixtures/minimal-epub-fixture.js +0 -1
  722. package/dist/components/viewers/spreadsheet-viewer/fixtures/minimal-xlsx-fixture.d.ts +0 -1
  723. package/dist/components/viewers/spreadsheet-viewer/fixtures/minimal-xlsx-fixture.js +0 -1
@@ -1,4 +1,4 @@
1
- var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{hostAriaLabel}from"../../../internal/a11y.js";import{getDateTimeFormat,getNumberFormat}from"../../../internal/intl-cache.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{styles}from"./document-library.styles.js";import{LYRA_DEFAULT_documentLibraryClearSelection,LYRA_DEFAULT_documentLibraryEmptyHeading,LYRA_DEFAULT_documentLibraryFilterByTag,LYRA_DEFAULT_documentLibraryFreshnessAging,LYRA_DEFAULT_documentLibraryFreshnessColumn,LYRA_DEFAULT_documentLibraryFreshnessFresh,LYRA_DEFAULT_documentLibraryFreshnessStale,LYRA_DEFAULT_documentLibraryLabel,LYRA_DEFAULT_documentLibraryNameColumn,LYRA_DEFAULT_documentLibraryNoMatchesHeading,LYRA_DEFAULT_documentLibraryOwnerColumn,LYRA_DEFAULT_documentLibrarySearchPlaceholder,LYRA_DEFAULT_documentLibrarySelectAll,LYRA_DEFAULT_documentLibrarySelectColumn,LYRA_DEFAULT_documentLibrarySelectDocument,LYRA_DEFAULT_documentLibrarySelectedCount,LYRA_DEFAULT_documentLibraryTagsColumn,LYRA_DEFAULT_documentLibraryTypeColumn,LYRA_DEFAULT_documentLibraryUpdatedColumn,LYRA_DEFAULT_documentLibraryVersionColumn}from"../../../internal/default-strings.generated.js";const FRESHNESS_RANK={fresh:0,aging:1,stale:2},MAX_LIBRARY_COLLECTION_ENTRIES=1e4,FRESHNESS_TONE={fresh:"success",aging:"warning",stale:"danger"};class LyraDocumentLibrary extends LyraElement{constructor(){super(...arguments),this._documents=Object.freeze([]),this._selectedDocumentIds=Object.freeze([]),this._tagFilter=Object.freeze([]),this.sortKey="name",this.sortDir="asc",this.searchTerm="",this.loading=!1,this.isMounting=!0,this.defaultFilter=(document,query)=>{const locale=this.effectiveLocale;return[document.name,document.owner??"",...document.tags??[]].some(value=>value.toLocaleLowerCase(locale).includes(query))},this.compareDocuments=(a,b)=>{const locale=this.effectiveLocale,dir=this.sortDir==="asc"?1:-1;let result=0;switch(this.sortKey){case"name":result=a.name.localeCompare(b.name,locale,{numeric:!0});break;case"version":result=(a.version??"").localeCompare(b.version??"",locale,{numeric:!0});break;case"owner":result=(a.owner??"").localeCompare(b.owner??"",locale,{numeric:!0});break;case"freshness":result=(a.freshness?FRESHNESS_RANK[a.freshness]:3)-(b.freshness?FRESHNESS_RANK[b.freshness]:3);break;case"updatedAt":result=(this.normalizeDate(a.updatedAt)?.getTime()??0)-(this.normalizeDate(b.updatedAt)?.getTime()??0);break}return result*dir},this.onSearchInput=event=>{event.stopPropagation(),this.searchTerm=event.detail.value,this.emitFilterChange()},this.onTagFilterChange=event=>{event.stopPropagation();const combobox=event.target;this.tagFilter=Array.isArray(combobox.value)?combobox.value:[],this.emitFilterChange()},this.onTableSortRequest=event=>{if(event.stopPropagation(),!this.isSortKey(event.detail.sortKey)){event.preventDefault();return}const detail=Object.freeze({phase:"request",sortKey:event.detail.sortKey,sortDir:event.detail.sortDir});this.emit("lr-sort-request",detail,{cancelable:!0}).defaultPrevented&&event.preventDefault()},this.onTableSortCommit=event=>{event.stopPropagation(),this.isSortKey(event.detail.sortKey)&&(this.sortKey=event.detail.sortKey,this.sortDir=event.detail.sortDir,this.emit("lr-sort",Object.freeze({phase:"commit",sortKey:this.sortKey,sortDir:this.sortDir})))},this.stopOwnedEvent=event=>{event.stopPropagation()},this.onTableSelectionChange=event=>{event.stopPropagation();const table=event.currentTarget;table.selectedRowKeys=new Set(this.selectedDocumentIds)},this.clearSelection=()=>{this.setSelected([])}}static{this.defaultStrings={...super.defaultStrings,documentLibraryClearSelection:LYRA_DEFAULT_documentLibraryClearSelection,documentLibraryEmptyHeading:LYRA_DEFAULT_documentLibraryEmptyHeading,documentLibraryFilterByTag:LYRA_DEFAULT_documentLibraryFilterByTag,documentLibraryFreshnessAging:LYRA_DEFAULT_documentLibraryFreshnessAging,documentLibraryFreshnessColumn:LYRA_DEFAULT_documentLibraryFreshnessColumn,documentLibraryFreshnessFresh:LYRA_DEFAULT_documentLibraryFreshnessFresh,documentLibraryFreshnessStale:LYRA_DEFAULT_documentLibraryFreshnessStale,documentLibraryLabel:LYRA_DEFAULT_documentLibraryLabel,documentLibraryNameColumn:LYRA_DEFAULT_documentLibraryNameColumn,documentLibraryNoMatchesHeading:LYRA_DEFAULT_documentLibraryNoMatchesHeading,documentLibraryOwnerColumn:LYRA_DEFAULT_documentLibraryOwnerColumn,documentLibrarySearchPlaceholder:LYRA_DEFAULT_documentLibrarySearchPlaceholder,documentLibrarySelectAll:LYRA_DEFAULT_documentLibrarySelectAll,documentLibrarySelectColumn:LYRA_DEFAULT_documentLibrarySelectColumn,documentLibrarySelectDocument:LYRA_DEFAULT_documentLibrarySelectDocument,documentLibrarySelectedCount:LYRA_DEFAULT_documentLibrarySelectedCount,documentLibraryTagsColumn:LYRA_DEFAULT_documentLibraryTagsColumn,documentLibraryTypeColumn:LYRA_DEFAULT_documentLibraryTypeColumn,documentLibraryUpdatedColumn:LYRA_DEFAULT_documentLibraryUpdatedColumn,documentLibraryVersionColumn:LYRA_DEFAULT_documentLibraryVersionColumn}}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-filter-change","lr-selection-change"])}get documents(){return this.snapshotDocuments(this._documents)}set documents(value){const previous=this._documents;this._documents=this.snapshotDocuments(Array.isArray(value)?value:[]),this.requestUpdate("documents",previous)}get selectedDocumentIds(){return this._selectedDocumentIds}set selectedDocumentIds(value){const previous=this._selectedDocumentIds;this._selectedDocumentIds=this.snapshotIds(Array.isArray(value)?value:[]),this.requestUpdate("selectedDocumentIds",previous)}get tagFilter(){return this._tagFilter}set tagFilter(value){const previous=this._tagFilter;this._tagFilter=this.snapshotIds(Array.isArray(value)?value:[]),this.requestUpdate("tagFilter",previous)}connectedCallback(){super.connectedCallback(),this.syncAnnouncementSink()}disconnectedCallback(){super.disconnectedCallback(),this.releaseAnnouncementSink()}releaseAnnouncementSink(){this.announcementSink?.release(),this.announcementSink=void 0}syncAnnouncementSink(){if(!this.isConnected){this.releaseAnnouncementSink();return}this.announcementSink?.element.ownerDocument!==this.ownerDocument&&(this.releaseAnnouncementSink(),this.announcementSink=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}))}snapshotDocuments(documents){const snapshot=[],seen=new Set;for(const document of documents.slice(0,MAX_LIBRARY_COLLECTION_ENTRIES))try{const id=document?.id;if(typeof id!="string"||id.trim().length===0||seen.has(id)||typeof document.name!="string"||document.tags!==void 0&&(!Array.isArray(document.tags)||document.tags.some(tag=>typeof tag!="string")))continue;const updatedAt=document.updatedAt instanceof Date?new Date(document.updatedAt.getTime()):document.updatedAt,tags=document.tags===void 0?void 0:Object.freeze(document.tags.slice(0,MAX_LIBRARY_COLLECTION_ENTRIES)),retained=Object.freeze({...document,id,updatedAt,tags});seen.add(id),snapshot.push(retained)}catch{}return Object.freeze(snapshot)}snapshotIds(ids){const snapshot=[],seen=new Set;try{for(const id of ids)if(!seen.has(id)&&(seen.add(id),snapshot.push(id),snapshot.length>=MAX_LIBRARY_COLLECTION_ENTRIES))break}catch{}return Object.freeze(snapshot)}willUpdate(changed){if(super.willUpdate(changed),(changed.has("documents")||changed.has("selectedDocumentIds"))&&this.selectedDocumentIds.length>0){const existing=new Set(this._documents.map(doc=>doc.id)),normalized=this.snapshotIds(this.selectedDocumentIds.filter(id=>existing.has(id)));(normalized.length!==this.selectedDocumentIds.length||normalized.some((id,index)=>id!==this.selectedDocumentIds[index]))&&(this.selectedDocumentIds=normalized)}if((changed.has("documents")||changed.has("tagFilter"))&&this.tagFilter.length>0){const availableTags=new Set(this._documents.flatMap(document=>document.tags??[])),normalized=this.snapshotIds(this.tagFilter.filter(tag=>availableTags.has(tag)));(normalized.length!==this.tagFilter.length||normalized.some((tag,index)=>tag!==this.tagFilter[index]))&&(this.tagFilter=normalized)}}updated(changed){super.updated(changed),!this.isMounting&&changed.has("selectedDocumentIds")&&this.announcementSink?.announce(this.selectionCountText()),this.isMounting=!1}selectionCountText(){return this.localize("documentLibrarySelectedCount",void 0,{count:getNumberFormat(this.effectiveLocale).format(this.selectedDocumentIds.length)})}normalizeDate(value){if(value===void 0)return;const date=value instanceof Date?value:new Date(value);return Number.isNaN(date.getTime())?void 0:date}matchesTagFilter(document){if(this.tagFilter.length===0)return!0;const tags=new Set(document.tags??[]);return this.tagFilter.every(tag=>tags.has(tag))}get visibleDocuments(){const query=this.searchTerm.trim().toLocaleLowerCase(this.effectiveLocale),matchFn=this.filter??this.defaultFilter;return[...this._documents.filter(document=>(query===""||matchFn(document,query))&&this.matchesTagFilter(document))].sort(this.compareDocuments)}get allTags(){const tags=new Set;for(const document of this._documents)for(const tag of document.tags??[])tags.add(tag);return[...tags].sort((a,b)=>a.localeCompare(b,this.effectiveLocale))}emitFilterChange(){const tags=Object.freeze([...this.tagFilter]);this.emit("lr-filter-change",Object.freeze({searchTerm:this.searchTerm,tags,matchCount:this.visibleDocuments.length}))}isSortKey(value){return value==="name"||value==="version"||value==="owner"||value==="freshness"||value==="updatedAt"}openDocument(document){this.emit("lr-open",Object.freeze({documentId:document.id}))}setSelected(ids){this.selectedDocumentIds=[...ids];const eventIds=Object.freeze([...this.selectedDocumentIds]);this.emit("lr-selection-change",Object.freeze({documentIds:eventIds}))}toggleSelection(document,checked){const next=new Set(this.selectedDocumentIds);checked?next.add(document.id):next.delete(document.id),this.setSelected(next)}toggleSelectAll(checked,visible){const next=new Set(this.selectedDocumentIds);for(const document of visible)checked?next.add(document.id):next.delete(document.id);this.setSelected(next)}freshnessLabel(freshness){switch(freshness){case"fresh":return this.localize("documentLibraryFreshnessFresh");case"aging":return this.localize("documentLibraryFreshnessAging");case"stale":return this.localize("documentLibraryFreshnessStale")}}renderSelectAllCheckbox(visible){const allSelected=visible.length>0&&visible.every(document=>this.selectedDocumentIds.includes(document.id)),someSelected=!allSelected&&visible.some(document=>this.selectedDocumentIds.includes(document.id));return html`<lr-checkbox
1
+ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{hostAriaLabel}from"../../../internal/a11y.js";import{getDateTimeFormat,getNumberFormat}from"../../../internal/intl-cache.js";import{getOwnDataDescriptor,MISSING_OWN_DATA_DESCRIPTOR,UNSAFE_OWN_DATA_DESCRIPTOR}from"../../../internal/data-descriptors.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{styles}from"./document-library.styles.js";import{LYRA_DEFAULT_documentLibraryClearSelection,LYRA_DEFAULT_documentLibraryEmptyHeading,LYRA_DEFAULT_documentLibraryFilterByTag,LYRA_DEFAULT_documentLibraryFreshnessAging,LYRA_DEFAULT_documentLibraryFreshnessColumn,LYRA_DEFAULT_documentLibraryFreshnessFresh,LYRA_DEFAULT_documentLibraryFreshnessStale,LYRA_DEFAULT_documentLibraryLabel,LYRA_DEFAULT_documentLibraryNameColumn,LYRA_DEFAULT_documentLibraryNoMatchesHeading,LYRA_DEFAULT_documentLibraryOwnerColumn,LYRA_DEFAULT_documentLibrarySearchPlaceholder,LYRA_DEFAULT_documentLibrarySelectAll,LYRA_DEFAULT_documentLibrarySelectColumn,LYRA_DEFAULT_documentLibrarySelectDocument,LYRA_DEFAULT_documentLibrarySelectedCount,LYRA_DEFAULT_documentLibraryTagsColumn,LYRA_DEFAULT_documentLibraryTypeColumn,LYRA_DEFAULT_documentLibraryUpdatedColumn,LYRA_DEFAULT_documentLibraryVersionColumn}from"../../../internal/default-strings.generated.js";const FRESHNESS_RANK={fresh:0,aging:1,stale:2},MAX_LIBRARY_COLLECTION_ENTRIES=1e4,INVALID_DOCUMENT_DATE=Symbol("invalid-document-date"),FRESHNESS_TONE={fresh:"success",aging:"warning",stale:"danger"};function projectLibraryStringArray(value){try{if(!Array.isArray(value))return;const length=getOwnDataDescriptor(value,"length");if(length===MISSING_OWN_DATA_DESCRIPTOR||length===UNSAFE_OWN_DATA_DESCRIPTOR||typeof length.value!="number"||!Number.isSafeInteger(length.value)||length.value<0)return;const tags=[];for(let index=0;index<Math.min(length.value,MAX_LIBRARY_COLLECTION_ENTRIES);index+=1){const entry=getOwnDataDescriptor(value,String(index));if(entry===MISSING_OWN_DATA_DESCRIPTOR||entry===UNSAFE_OWN_DATA_DESCRIPTOR||typeof entry.value!="string")return;tags.push(entry.value)}return Object.freeze(tags)}catch{return}}function projectLibraryDate(value){if(typeof value=="string")return value;if(typeof value=="number")return new Date(value);try{return new Date(Date.prototype.getTime.call(value))}catch{return INVALID_DOCUMENT_DATE}}function projectLibraryDocument(candidate){try{if(candidate===null||typeof candidate!="object"||Array.isArray(candidate))return;const id=getOwnDataDescriptor(candidate,"id"),name=getOwnDataDescriptor(candidate,"name"),mimeType=getOwnDataDescriptor(candidate,"mimeType"),uri=getOwnDataDescriptor(candidate,"uri"),version=getOwnDataDescriptor(candidate,"version"),tags=getOwnDataDescriptor(candidate,"tags"),owner=getOwnDataDescriptor(candidate,"owner"),updatedAt=getOwnDataDescriptor(candidate,"updatedAt"),freshness=getOwnDataDescriptor(candidate,"freshness");if(id===MISSING_OWN_DATA_DESCRIPTOR||id===UNSAFE_OWN_DATA_DESCRIPTOR||name===MISSING_OWN_DATA_DESCRIPTOR||name===UNSAFE_OWN_DATA_DESCRIPTOR||mimeType===UNSAFE_OWN_DATA_DESCRIPTOR||uri===UNSAFE_OWN_DATA_DESCRIPTOR||version===UNSAFE_OWN_DATA_DESCRIPTOR||tags===UNSAFE_OWN_DATA_DESCRIPTOR||owner===UNSAFE_OWN_DATA_DESCRIPTOR||updatedAt===UNSAFE_OWN_DATA_DESCRIPTOR||freshness===UNSAFE_OWN_DATA_DESCRIPTOR||typeof id.value!="string"||id.value.trim().length===0||typeof name.value!="string")return;const mimeTypeValue=mimeType===MISSING_OWN_DATA_DESCRIPTOR?void 0:mimeType.value,uriValue=uri===MISSING_OWN_DATA_DESCRIPTOR?void 0:uri.value,versionValue=version===MISSING_OWN_DATA_DESCRIPTOR?void 0:version.value,ownerValue=owner===MISSING_OWN_DATA_DESCRIPTOR?void 0:owner.value,freshnessValue=freshness===MISSING_OWN_DATA_DESCRIPTOR?void 0:freshness.value;if(mimeTypeValue!==void 0&&typeof mimeTypeValue!="string"||uriValue!==void 0&&typeof uriValue!="string"||versionValue!==void 0&&typeof versionValue!="string"||ownerValue!==void 0&&typeof ownerValue!="string"||freshnessValue!==void 0&&freshnessValue!=="fresh"&&freshnessValue!=="aging"&&freshnessValue!=="stale")return;const tagsValue=tags===MISSING_OWN_DATA_DESCRIPTOR?void 0:tags.value,tagValues=tagsValue===void 0?void 0:projectLibraryStringArray(tagsValue);if(tagsValue!==void 0&&!tagValues)return;const updatedAtValue=updatedAt===MISSING_OWN_DATA_DESCRIPTOR||updatedAt.value===void 0?void 0:projectLibraryDate(updatedAt.value);return updatedAtValue===INVALID_DOCUMENT_DATE?void 0:Object.freeze({id:id.value,name:name.value,...mimeTypeValue===void 0?{}:{mimeType:mimeTypeValue},...uriValue===void 0?{}:{uri:uriValue},...versionValue===void 0?{}:{version:versionValue},...tagValues===void 0?{}:{tags:tagValues},...ownerValue===void 0?{}:{owner:ownerValue},...updatedAtValue===void 0?{}:{updatedAt:updatedAtValue},...freshnessValue===void 0?{}:{freshness:freshnessValue}})}catch{return}}class LyraDocumentLibrary extends LyraElement{constructor(){super(...arguments),this._documents=Object.freeze([]),this._selectedDocumentIds=Object.freeze([]),this._tagFilter=Object.freeze([]),this.sortKey="name",this.sortDir="asc",this.searchTerm="",this.loading=!1,this.isMounting=!0,this.defaultFilter=(document,query)=>{const locale=this.effectiveLocale;return[document.name,document.owner??"",...document.tags??[]].some(value=>value.toLocaleLowerCase(locale).includes(query))},this.compareDocuments=(a,b)=>{const locale=this.effectiveLocale,dir=this.sortDir==="asc"?1:-1;let result=0;switch(this.sortKey){case"name":result=a.name.localeCompare(b.name,locale,{numeric:!0});break;case"version":result=(a.version??"").localeCompare(b.version??"",locale,{numeric:!0});break;case"owner":result=(a.owner??"").localeCompare(b.owner??"",locale,{numeric:!0});break;case"freshness":result=(a.freshness?FRESHNESS_RANK[a.freshness]:3)-(b.freshness?FRESHNESS_RANK[b.freshness]:3);break;case"updatedAt":result=(this.normalizeDate(a.updatedAt)?.getTime()??0)-(this.normalizeDate(b.updatedAt)?.getTime()??0);break}return result*dir},this.onSearchInput=event=>{event.stopPropagation(),this.searchTerm=event.detail.value,this.emitFilterChange()},this.onTagFilterChange=event=>{event.stopPropagation();const combobox=event.target;this.tagFilter=Array.isArray(combobox.value)?combobox.value:[],this.emitFilterChange()},this.onTableSortRequest=event=>{if(event.stopPropagation(),!this.isSortKey(event.detail.sortKey)){event.preventDefault();return}const detail=Object.freeze({phase:"request",sortKey:event.detail.sortKey,sortDir:event.detail.sortDir});this.emit("lr-sort-request",detail,{cancelable:!0}).defaultPrevented&&event.preventDefault()},this.onTableSortCommit=event=>{event.stopPropagation(),this.isSortKey(event.detail.sortKey)&&(this.sortKey=event.detail.sortKey,this.sortDir=event.detail.sortDir,this.emit("lr-sort",Object.freeze({phase:"commit",sortKey:this.sortKey,sortDir:this.sortDir})))},this.stopOwnedEvent=event=>{event.stopPropagation()},this.onTableSelectionChange=event=>{event.stopPropagation();const table=event.currentTarget;table.selectedRowKeys=new Set(this.selectedDocumentIds)},this.clearSelection=()=>{this.setSelected([])}}static{this.defaultStrings={...super.defaultStrings,documentLibraryClearSelection:LYRA_DEFAULT_documentLibraryClearSelection,documentLibraryEmptyHeading:LYRA_DEFAULT_documentLibraryEmptyHeading,documentLibraryFilterByTag:LYRA_DEFAULT_documentLibraryFilterByTag,documentLibraryFreshnessAging:LYRA_DEFAULT_documentLibraryFreshnessAging,documentLibraryFreshnessColumn:LYRA_DEFAULT_documentLibraryFreshnessColumn,documentLibraryFreshnessFresh:LYRA_DEFAULT_documentLibraryFreshnessFresh,documentLibraryFreshnessStale:LYRA_DEFAULT_documentLibraryFreshnessStale,documentLibraryLabel:LYRA_DEFAULT_documentLibraryLabel,documentLibraryNameColumn:LYRA_DEFAULT_documentLibraryNameColumn,documentLibraryNoMatchesHeading:LYRA_DEFAULT_documentLibraryNoMatchesHeading,documentLibraryOwnerColumn:LYRA_DEFAULT_documentLibraryOwnerColumn,documentLibrarySearchPlaceholder:LYRA_DEFAULT_documentLibrarySearchPlaceholder,documentLibrarySelectAll:LYRA_DEFAULT_documentLibrarySelectAll,documentLibrarySelectColumn:LYRA_DEFAULT_documentLibrarySelectColumn,documentLibrarySelectDocument:LYRA_DEFAULT_documentLibrarySelectDocument,documentLibrarySelectedCount:LYRA_DEFAULT_documentLibrarySelectedCount,documentLibraryTagsColumn:LYRA_DEFAULT_documentLibraryTagsColumn,documentLibraryTypeColumn:LYRA_DEFAULT_documentLibraryTypeColumn,documentLibraryUpdatedColumn:LYRA_DEFAULT_documentLibraryUpdatedColumn,documentLibraryVersionColumn:LYRA_DEFAULT_documentLibraryVersionColumn}}static{this.styles=[LyraElement.styles,styles]}static{this.immutableEventDetails=Object.freeze(["lr-filter-change","lr-selection-change"])}get documents(){return this.snapshotDocuments(this._documents)}set documents(value){const previous=this._documents;this._documents=this.snapshotDocuments(value),this.requestUpdate("documents",previous)}get selectedDocumentIds(){return this._selectedDocumentIds}set selectedDocumentIds(value){const previous=this._selectedDocumentIds;this._selectedDocumentIds=this.snapshotIds(Array.isArray(value)?value:[]),this.requestUpdate("selectedDocumentIds",previous)}get tagFilter(){return this._tagFilter}set tagFilter(value){const previous=this._tagFilter;this._tagFilter=this.snapshotIds(Array.isArray(value)?value:[]),this.requestUpdate("tagFilter",previous)}connectedCallback(){super.connectedCallback(),this.syncAnnouncementSink()}disconnectedCallback(){super.disconnectedCallback(),this.releaseAnnouncementSink()}releaseAnnouncementSink(){this.announcementSink?.release(),this.announcementSink=void 0}syncAnnouncementSink(){if(!this.isConnected){this.releaseAnnouncementSink();return}this.announcementSink?.element.ownerDocument!==this.ownerDocument&&(this.releaseAnnouncementSink(),this.announcementSink=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}))}snapshotDocuments(documents){const snapshot=[],seen=new Set;try{if(!Array.isArray(documents))return Object.freeze(snapshot);const length=getOwnDataDescriptor(documents,"length");if(length===MISSING_OWN_DATA_DESCRIPTOR||length===UNSAFE_OWN_DATA_DESCRIPTOR||typeof length.value!="number"||!Number.isSafeInteger(length.value)||length.value<0)return Object.freeze(snapshot);for(let index=0;index<Math.min(length.value,MAX_LIBRARY_COLLECTION_ENTRIES);index+=1){const entry=getOwnDataDescriptor(documents,String(index));if(entry===MISSING_OWN_DATA_DESCRIPTOR||entry===UNSAFE_OWN_DATA_DESCRIPTOR)continue;const document=projectLibraryDocument(entry.value);!document||seen.has(document.id)||(seen.add(document.id),snapshot.push(document))}}catch{}return Object.freeze(snapshot)}snapshotIds(ids){const snapshot=[],seen=new Set;try{for(const id of ids)if(!seen.has(id)&&(seen.add(id),snapshot.push(id),snapshot.length>=MAX_LIBRARY_COLLECTION_ENTRIES))break}catch{}return Object.freeze(snapshot)}willUpdate(changed){if(super.willUpdate(changed),(changed.has("documents")||changed.has("selectedDocumentIds"))&&this.selectedDocumentIds.length>0){const existing=new Set(this._documents.map(doc=>doc.id)),normalized=this.snapshotIds(this.selectedDocumentIds.filter(id=>existing.has(id)));(normalized.length!==this.selectedDocumentIds.length||normalized.some((id,index)=>id!==this.selectedDocumentIds[index]))&&(this.selectedDocumentIds=normalized)}if((changed.has("documents")||changed.has("tagFilter"))&&this.tagFilter.length>0){const availableTags=new Set(this._documents.flatMap(document=>document.tags??[])),normalized=this.snapshotIds(this.tagFilter.filter(tag=>availableTags.has(tag)));(normalized.length!==this.tagFilter.length||normalized.some((tag,index)=>tag!==this.tagFilter[index]))&&(this.tagFilter=normalized)}}updated(changed){super.updated(changed),!this.isMounting&&changed.has("selectedDocumentIds")&&this.announcementSink?.announce(this.selectionCountText()),this.isMounting=!1}selectionCountText(){return this.localize("documentLibrarySelectedCount",void 0,{count:getNumberFormat(this.effectiveLocale).format(this.selectedDocumentIds.length)})}normalizeDate(value){if(value===void 0)return;const date=value instanceof Date?value:new Date(value);return Number.isNaN(date.getTime())?void 0:date}matchesTagFilter(document){if(this.tagFilter.length===0)return!0;const tags=new Set(document.tags??[]);return this.tagFilter.every(tag=>tags.has(tag))}get visibleDocuments(){const query=(this.searchTerm??"").trim().toLocaleLowerCase(this.effectiveLocale),matchFn=this.filter??this.defaultFilter;return[...this._documents.filter(document=>(query===""||matchFn(document,query))&&this.matchesTagFilter(document))].sort(this.compareDocuments)}get allTags(){const tags=new Set;for(const document of this._documents)for(const tag of document.tags??[])tags.add(tag);return[...tags].sort((a,b)=>a.localeCompare(b,this.effectiveLocale))}emitFilterChange(){const tags=Object.freeze([...this.tagFilter]);this.emit("lr-filter-change",Object.freeze({searchTerm:this.searchTerm,tags,matchCount:this.visibleDocuments.length}))}isSortKey(value){return value==="name"||value==="version"||value==="owner"||value==="freshness"||value==="updatedAt"}openDocument(document){this.emit("lr-open",Object.freeze({documentId:document.id}))}setSelected(ids){this.selectedDocumentIds=[...ids];const eventIds=Object.freeze([...this.selectedDocumentIds]);this.emit("lr-selection-change",Object.freeze({documentIds:eventIds}))}toggleSelection(document,checked){const next=new Set(this.selectedDocumentIds);checked?next.add(document.id):next.delete(document.id),this.setSelected(next)}toggleSelectAll(checked,visible){const next=new Set(this.selectedDocumentIds);for(const document of visible)checked?next.add(document.id):next.delete(document.id);this.setSelected(next)}freshnessLabel(freshness){switch(freshness){case"fresh":return this.localize("documentLibraryFreshnessFresh");case"aging":return this.localize("documentLibraryFreshnessAging");case"stale":return this.localize("documentLibraryFreshnessStale")}}renderSelectAllCheckbox(visible){const allSelected=visible.length>0&&visible.every(document=>this.selectedDocumentIds.includes(document.id)),someSelected=!allSelected&&visible.some(document=>this.selectedDocumentIds.includes(document.id));return html`<lr-checkbox
2
2
  .checked=${allSelected}
3
3
  .indeterminate=${someSelected}
4
4
  aria-label=${this.localize("documentLibrarySelectAll")}
@@ -1,4 +1,4 @@
1
- var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{hostAriaLabel,srOnly}from"../../../internal/a11y.js";import{styles}from"./env-list.styles.js";import{trueDefaultBooleanConverter}from"../../../internal/converters.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{writeClipboardText}from"../../../internal/clipboard.js";import{LYRA_DEFAULT_copied,LYRA_DEFAULT_copy,LYRA_DEFAULT_copyFailed,LYRA_DEFAULT_envListCopy,LYRA_DEFAULT_envListHide,LYRA_DEFAULT_envListLabel,LYRA_DEFAULT_envListReveal,LYRA_DEFAULT_envListValueHidden,LYRA_DEFAULT_noData}from"../../../internal/default-strings.generated.js";const MASK="\u2022".repeat(8),MAX_ENV_ENTRIES=1e4;class LyraEnvList extends LyraElement{constructor(){super(...arguments),this._entries=[],this.revealable=!0,this.copyable=!0,this.revealed=new Map}static{this.defaultStrings={...super.defaultStrings,copied:LYRA_DEFAULT_copied,copy:LYRA_DEFAULT_copy,copyFailed:LYRA_DEFAULT_copyFailed,envListCopy:LYRA_DEFAULT_envListCopy,envListHide:LYRA_DEFAULT_envListHide,envListLabel:LYRA_DEFAULT_envListLabel,envListReveal:LYRA_DEFAULT_envListReveal,envListValueHidden:LYRA_DEFAULT_envListValueHidden,noData:LYRA_DEFAULT_noData}}static{this.styles=[LyraElement.styles,styles,srOnly]}get entries(){return this._entries}set entries(value){const previous=this._entries,next=[],seen=new Set;if(Array.isArray(value))for(const candidate of value.slice(0,MAX_ENV_ENTRIES))try{if(!candidate||typeof candidate.name!="string"||typeof candidate.value!="string")continue;const name=candidate.name;if(name.trim().length===0||seen.has(name))continue;next.push(Object.freeze({name,value:candidate.value,...candidate.secret===void 0?{}:{secret:!!candidate.secret}})),seen.add(name)}catch{}this._entries=Object.freeze(next),this.requestUpdate("entries",previous)}connectedCallback(){super.connectedCallback(),this.syncAnnouncementSink()}disconnectedCallback(){super.disconnectedCallback(),this.releaseAnnouncementSink()}releaseAnnouncementSink(){this.announcementSink?.release(),this.announcementSink=void 0}syncAnnouncementSink(){if(!this.isConnected){this.releaseAnnouncementSink();return}this.announcementSink?.element.ownerDocument!==this.ownerDocument&&(this.releaseAnnouncementSink(),this.announcementSink=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}))}willUpdate(changed){if(super.willUpdate(changed),changed.has("revealable")&&!this.revealable&&this.revealed.size>0&&(this.revealed=new Map),changed.has("entries")){const previous=changed.get("entries")??[],next=new Map;this.entries.forEach((entry,index)=>{if(previous[index]?.name!==entry.name)return;const wasRevealed=this.revealed.get(entry.name);wasRevealed!==void 0&&next.set(entry.name,wasRevealed)}),this.revealed=next}}toggleReveal(envName){const isRevealed=!(this.revealed.get(envName)??!1),next=new Map(this.revealed);next.set(envName,isRevealed),this.revealed=next,this.emit("lr-reveal-change",Object.freeze({envName,revealed:isRevealed}))}async copy(entry){const text=entry.value,owner=this.isConnected?this.ownerDocument.defaultView:null,outcome=await writeClipboardText(owner,text);if(!(!this.isConnected||this.ownerDocument.defaultView!==owner)){if(outcome.ok){this.announcementSink?.announce(this.localize("copied")),this.emit("lr-copy",outcome);return}this.announcementSink?.announce(this.localize("copyFailed")),this.emit("lr-error"),this.emit("lr-copy-error",outcome)}}get accessibleLabel(){return hostAriaLabel(this)?.trim()??(this.label==null?this.localize("envListLabel"):this.label)}render(){return this.entries.length===0?html`
1
+ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html,nothing}from"lit";import{property,state}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{hostAriaLabel,srOnly}from"../../../internal/a11y.js";import{styles}from"./env-list.styles.js";import{trueDefaultBooleanConverter}from"../../../internal/converters.js";import{acquireAnnouncementSink}from"../../../internal/announcer.js";import{writeClipboardText}from"../../../internal/clipboard.js";import{LYRA_DEFAULT_copied,LYRA_DEFAULT_copy,LYRA_DEFAULT_copyFailed,LYRA_DEFAULT_envListCopy,LYRA_DEFAULT_envListHide,LYRA_DEFAULT_envListLabel,LYRA_DEFAULT_envListReveal,LYRA_DEFAULT_envListValueHidden,LYRA_DEFAULT_noData}from"../../../internal/default-strings.generated.js";const MASK="".repeat(8),MAX_ENV_ENTRIES=1e4;class LyraEnvList extends LyraElement{constructor(){super(...arguments),this._entries=[],this.revealable=!0,this.copyable=!0,this.revealed=new Map}static{this.defaultStrings={...super.defaultStrings,copied:LYRA_DEFAULT_copied,copy:LYRA_DEFAULT_copy,copyFailed:LYRA_DEFAULT_copyFailed,envListCopy:LYRA_DEFAULT_envListCopy,envListHide:LYRA_DEFAULT_envListHide,envListLabel:LYRA_DEFAULT_envListLabel,envListReveal:LYRA_DEFAULT_envListReveal,envListValueHidden:LYRA_DEFAULT_envListValueHidden,noData:LYRA_DEFAULT_noData}}static{this.styles=[LyraElement.styles,styles,srOnly]}get entries(){return this._entries}set entries(value){const previous=this._entries,next=[],seen=new Set;if(Array.isArray(value))for(const candidate of value.slice(0,MAX_ENV_ENTRIES))try{if(!candidate||typeof candidate.name!="string"||typeof candidate.value!="string")continue;const name=candidate.name;if(name.trim().length===0||seen.has(name))continue;next.push(Object.freeze({name,value:candidate.value,...candidate.secret===void 0?{}:{secret:!!candidate.secret}})),seen.add(name)}catch{}this._entries=Object.freeze(next),this.requestUpdate("entries",previous)}connectedCallback(){super.connectedCallback(),this.syncAnnouncementSink()}disconnectedCallback(){super.disconnectedCallback(),this.releaseAnnouncementSink()}releaseAnnouncementSink(){this.announcementSink?.release(),this.announcementSink=void 0}syncAnnouncementSink(){if(!this.isConnected){this.releaseAnnouncementSink();return}this.announcementSink?.element.ownerDocument!==this.ownerDocument&&(this.releaseAnnouncementSink(),this.announcementSink=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}))}willUpdate(changed){if(super.willUpdate(changed),changed.has("revealable")&&!this.revealable&&this.revealed.size>0&&(this.revealed=new Map),changed.has("entries")){const previous=changed.get("entries")??[],next=new Map;this.entries.forEach((entry,index)=>{if(previous[index]?.name!==entry.name)return;const wasRevealed=this.revealed.get(entry.name);wasRevealed!==void 0&&next.set(entry.name,wasRevealed)}),this.revealed=next}}toggleReveal(envName){const isRevealed=!(this.revealed.get(envName)??!1),next=new Map(this.revealed);next.set(envName,isRevealed),this.revealed=next,this.emit("lr-reveal-change",Object.freeze({envName,revealed:isRevealed}))}async copy(entry){const text=entry.value,owner=this.isConnected?this.ownerDocument.defaultView:null,outcome=await writeClipboardText(owner,text);if(!(!this.isConnected||this.ownerDocument.defaultView!==owner)){if(outcome.ok){this.announcementSink?.announce(this.localize("copied")),this.emit("lr-copy",outcome);return}this.announcementSink?.announce(this.localize("copyFailed")),this.emit("lr-error"),this.emit("lr-copy-error",outcome)}}get accessibleLabel(){return hostAriaLabel(this)?.trim()??(this.label==null?this.localize("envListLabel"):this.label)}render(){return this.entries.length===0?html`
2
2
  <div part="base" data-empty role="group" aria-label=${this.accessibleLabel}>
3
3
  <lr-empty heading=${this.localize("noData")}></lr-empty>
4
4
  </div>
@@ -27,7 +27,8 @@ import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from
27
27
  export declare class LyraFileTree extends LyraElement<LyraFileTreeEventMap>{static styles:import("lit").CSSResultGroup[];private _nodes;
28
28
  /** Clone-owned, cycle-safe readonly node snapshot. Empty/blank paths are omitted and duplicate
29
29
  * paths use the first valid node; projection inspects at most 10,000 source positions across 64
30
- * descendant levels. Reassign after changes. */
30
+ * descendant levels. An unreadable optional field rejects only its node, without reserving the
31
+ * path against a later valid occurrence. Reassign after changes. */
31
32
  get nodes():readonly FileTreeNode[];set nodes(value:readonly FileTreeNode[]);selectedPath:string|null;
32
33
  /** Accessible-name override for the internal `<lr-tree>`; falls back to the localized default
33
34
  * when unset. An explicitly empty string renders as an empty label rather than falling back. */
@@ -1,4 +1,4 @@
1
- var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html}from"lit";import{property}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{finiteCount}from"../../../internal/numbers.js";import{tag}from"../../../internal/prefix.js";import{styles}from"./file-tree.styles.js";import{LyraTreeItem}from"../tree/tree-item.class.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_fileTreeDiffSummary,LYRA_DEFAULT_fileTreeLabel,LYRA_DEFAULT_gitStatusAdded,LYRA_DEFAULT_gitStatusConflicted,LYRA_DEFAULT_gitStatusDeleted,LYRA_DEFAULT_gitStatusIgnored,LYRA_DEFAULT_gitStatusModified,LYRA_DEFAULT_gitStatusRenamed,LYRA_DEFAULT_gitStatusUntracked,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_progress,LYRA_DEFAULT_restore,LYRA_DEFAULT_search,LYRA_DEFAULT_select}from"../../../internal/default-strings.generated.js";const MAX_FILE_TREE_NODES=1e4,MAX_FILE_TREE_DEPTH=64,GIT_STATUSES=new Set(["added","modified","deleted","renamed","untracked","conflicted","ignored"]);function boundedArrayShape(value){try{if(!Array.isArray(value))return{isArray:!1,length:0};const descriptor=Object.getOwnPropertyDescriptor(value,"length"),length=descriptor&&"value"in descriptor?descriptor.value:0;return{isArray:!0,length:typeof length=="number"&&Number.isSafeInteger(length)&&length>=0?Math.min(length,MAX_FILE_TREE_NODES):0}}catch{return{isArray:!1,length:0}}}function normalizeFileTreeNodes(value){const rootShape=boundedArrayShape(value),roots=rootShape.isArray?value:[],drafts=[],rootDrafts=[],seenObjects=new WeakSet,seenPaths=new Set,stack=[{input:roots,output:rootDrafts,depth:0,index:0,length:rootShape.length}];let inspected=0;for(;stack.length>0&&drafts.length<MAX_FILE_TREE_NODES&&inspected<MAX_FILE_TREE_NODES;){const frame=stack[stack.length-1];if(frame.index>=frame.length){stack.pop();continue}const sourceIndex=frame.index++;inspected+=1;let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(frame.input,String(sourceIndex))}catch{continue}if(!descriptor||!("value"in descriptor))continue;const candidate=descriptor.value;if(!(typeof candidate!="object"||candidate===null||seenObjects.has(candidate))){seenObjects.add(candidate);try{const record=candidate,path=record.path;if(typeof path!="string"||path.trim().length===0||seenPaths.has(path))continue;seenPaths.add(path);const name=record.name,kind=record.kind,mimeType=record.mimeType,gitStatus=record.gitStatus,additions=record.additions,deletions=record.deletions,hasChildren=record.hasChildren,rawChildren=record.children,fields={path,...typeof name=="string"?{name}:{},...kind==="file"||kind==="directory"?{kind}:{},...typeof mimeType=="string"?{mimeType}:{},...typeof gitStatus=="string"&&GIT_STATUSES.has(gitStatus)?{gitStatus}:{},...additions===void 0?{}:{additions:finiteCount(typeof additions=="number"?additions:0)},...deletions===void 0?{}:{deletions:finiteCount(typeof deletions=="number"?deletions:0)},...hasChildren===void 0?{}:{hasChildren:!!hasChildren}},childShape=boundedArrayShape(rawChildren),childrenProvided=childShape.isArray,draft={fields,children:[],childrenProvided};frame.output.push(draft),drafts.push(draft),childrenProvided&&frame.depth<MAX_FILE_TREE_DEPTH&&stack.push({input:rawChildren,output:draft.children,depth:frame.depth+1,index:0,length:childShape.length})}catch{}}}for(let index=drafts.length-1;index>=0;index--){const draft=drafts[index];draft.normalized=Object.freeze({...draft.fields,...draft.childrenProvided?{children:Object.freeze(draft.children.map(child=>child.normalized))}:{}})}return Object.freeze(rootDrafts.map(draft=>draft.normalized))}const GIT_STATUS_LETTER={added:"A",modified:"M",deleted:"D",renamed:"R",untracked:"U",conflicted:"C",ignored:"!"},GIT_STATUS_TONE={added:"success",untracked:"success",modified:"brand",renamed:"brand",deleted:"danger",conflicted:"danger",ignored:"neutral"},GIT_STATUS_KEY={added:"gitStatusAdded",modified:"gitStatusModified",deleted:"gitStatusDeleted",renamed:"gitStatusRenamed",untracked:"gitStatusUntracked",conflicted:"gitStatusConflicted",ignored:"gitStatusIgnored"};function baseName(path){const segments=path.split("/").filter(Boolean);return segments[segments.length-1]??path}function isDirectory(node){return node.kind==="directory"||node.children!==void 0||node.hasChildren===!0}function isLazyUnloaded(node){return isDirectory(node)&&node.hasChildren===!0&&node.children===void 0}class LyraFileTree extends LyraElement{constructor(){super(...arguments),this._nodes=[],this.selectedPath=null,this.nodesByPath=new Map,this.parentPathByPath=new Map,this.onNodeSelect=e=>{e.stopPropagation();const{nodeId}=e.detail,node=this.nodesByPath.get(nodeId);if(!node)return;const wasSelected=this.selectedPath===nodeId;this.selectedPath=nodeId,this.emit("lr-file-select",Object.freeze({filePath:nodeId,node})),!isDirectory(node)&&wasSelected&&this.emit("lr-file-open",Object.freeze({filePath:nodeId,node}))},this.onNodeToggle=e=>{e.stopPropagation();const{nodeId,expanded}=e.detail;if(!expanded)return;const node=this.nodesByPath.get(nodeId);node&&isLazyUnloaded(node)&&this.emit("lr-load-children",Object.freeze({filePath:nodeId}))}}static{this.defaultStrings={...super.defaultStrings,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,fieldRequired:LYRA_DEFAULT_fieldRequired,fileTreeDiffSummary:LYRA_DEFAULT_fileTreeDiffSummary,fileTreeLabel:LYRA_DEFAULT_fileTreeLabel,gitStatusAdded:LYRA_DEFAULT_gitStatusAdded,gitStatusConflicted:LYRA_DEFAULT_gitStatusConflicted,gitStatusDeleted:LYRA_DEFAULT_gitStatusDeleted,gitStatusIgnored:LYRA_DEFAULT_gitStatusIgnored,gitStatusModified:LYRA_DEFAULT_gitStatusModified,gitStatusRenamed:LYRA_DEFAULT_gitStatusRenamed,gitStatusUntracked:LYRA_DEFAULT_gitStatusUntracked,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,progress:LYRA_DEFAULT_progress,restore:LYRA_DEFAULT_restore,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select}}static{this.styles=[LyraElement.styles,styles]}get nodes(){return this._nodes}set nodes(value){const previous=this._nodes;this._nodes=normalizeFileTreeNodes(value),this.requestUpdate("nodes",previous)}willUpdate(changed){if(super.willUpdate(changed),changed.has("nodes")){this.nodesByPath=new Map,this.parentPathByPath=new Map;const stack=[...this.nodes].reverse().map(node=>({node,parentPath:void 0}));for(;stack.length>0;){const{node,parentPath}=stack.pop();if(this.nodesByPath.set(node.path,node),parentPath!==void 0&&this.parentPathByPath.set(node.path,parentPath),node.children)for(let index=node.children.length-1;index>=0;index--)stack.push({node:node.children[index],parentPath:node.path})}}}toTreeItem(node){const badges=[];node.gitStatus&&badges.push({text:GIT_STATUS_LETTER[node.gitStatus],tone:GIT_STATUS_TONE[node.gitStatus],label:this.localize(GIT_STATUS_KEY[node.gitStatus])});const description=node.additions!==void 0||node.deletions!==void 0?this.localize("fileTreeDiffSummary",void 0,{additions:getNumberFormat(this.effectiveLocale).format(node.additions??0),deletions:getNumberFormat(this.effectiveLocale).format(node.deletions??0)}):void 0;let children;return isLazyUnloaded(node)?children=[{id:`${node.path} loading`,label:this.localize("loading"),disabled:!0}]:node.children&&(children=node.children.map(c=>this.toTreeItem(c))),{id:node.path,label:node.name??baseName(node.path),selected:this.selectedPath===node.path,children,badges:badges.length>0?badges:void 0,description,icon:isDirectory(node)?void 0:html`<lr-file-icon
1
+ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};import{html}from"lit";import{property}from"lit/decorators.js";import{LyraElement}from"../../../internal/lyra-element.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{finiteCount}from"../../../internal/numbers.js";import{tag}from"../../../internal/prefix.js";import{styles}from"./file-tree.styles.js";import{LyraTreeItem}from"../tree/tree-item.class.js";import{LYRA_DEFAULT_collapse,LYRA_DEFAULT_details,LYRA_DEFAULT_fieldRequired,LYRA_DEFAULT_fileTreeDiffSummary,LYRA_DEFAULT_fileTreeLabel,LYRA_DEFAULT_gitStatusAdded,LYRA_DEFAULT_gitStatusConflicted,LYRA_DEFAULT_gitStatusDeleted,LYRA_DEFAULT_gitStatusIgnored,LYRA_DEFAULT_gitStatusModified,LYRA_DEFAULT_gitStatusRenamed,LYRA_DEFAULT_gitStatusUntracked,LYRA_DEFAULT_loading,LYRA_DEFAULT_map,LYRA_DEFAULT_navigation,LYRA_DEFAULT_open,LYRA_DEFAULT_popover,LYRA_DEFAULT_progress,LYRA_DEFAULT_restore,LYRA_DEFAULT_search,LYRA_DEFAULT_select}from"../../../internal/default-strings.generated.js";const MAX_FILE_TREE_NODES=1e4,MAX_FILE_TREE_DEPTH=64,GIT_STATUSES=new Set(["added","modified","deleted","renamed","untracked","conflicted","ignored"]);function boundedArrayShape(value){try{if(!Array.isArray(value))return{isArray:!1,length:0};const descriptor=Object.getOwnPropertyDescriptor(value,"length"),length=descriptor&&"value"in descriptor?descriptor.value:0;return{isArray:!0,length:typeof length=="number"&&Number.isSafeInteger(length)&&length>=0?Math.min(length,MAX_FILE_TREE_NODES):0}}catch{return{isArray:!1,length:0}}}function normalizeFileTreeNodes(value){const rootShape=boundedArrayShape(value),roots=rootShape.isArray?value:[],drafts=[],rootDrafts=[],seenObjects=new WeakSet,seenPaths=new Set,stack=[{input:roots,output:rootDrafts,depth:0,index:0,length:rootShape.length}];let inspected=0;for(;stack.length>0&&drafts.length<MAX_FILE_TREE_NODES&&inspected<MAX_FILE_TREE_NODES;){const frame=stack[stack.length-1];if(frame.index>=frame.length){stack.pop();continue}const sourceIndex=frame.index++;inspected+=1;let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(frame.input,String(sourceIndex))}catch{continue}if(!descriptor||!("value"in descriptor))continue;const candidate=descriptor.value;if(!(typeof candidate!="object"||candidate===null||seenObjects.has(candidate)))try{const record=candidate,path=record.path;if(typeof path!="string"||path.trim().length===0||seenPaths.has(path))continue;const name=record.name,kind=record.kind,mimeType=record.mimeType,gitStatus=record.gitStatus,additions=record.additions,deletions=record.deletions,hasChildren=record.hasChildren,rawChildren=record.children,fields={path,...typeof name=="string"?{name}:{},...kind==="file"||kind==="directory"?{kind}:{},...typeof mimeType=="string"?{mimeType}:{},...typeof gitStatus=="string"&&GIT_STATUSES.has(gitStatus)?{gitStatus}:{},...additions===void 0?{}:{additions:finiteCount(typeof additions=="number"?additions:0)},...deletions===void 0?{}:{deletions:finiteCount(typeof deletions=="number"?deletions:0)},...hasChildren===void 0?{}:{hasChildren:!!hasChildren}},childShape=boundedArrayShape(rawChildren),childrenProvided=childShape.isArray,draft={fields,children:[],childrenProvided};seenObjects.add(candidate),seenPaths.add(path),frame.output.push(draft),drafts.push(draft),childrenProvided&&frame.depth<MAX_FILE_TREE_DEPTH&&stack.push({input:rawChildren,output:draft.children,depth:frame.depth+1,index:0,length:childShape.length})}catch{}}for(let index=drafts.length-1;index>=0;index--){const draft=drafts[index];draft.normalized=Object.freeze({...draft.fields,...draft.childrenProvided?{children:Object.freeze(draft.children.map(child=>child.normalized))}:{}})}return Object.freeze(rootDrafts.map(draft=>draft.normalized))}const GIT_STATUS_LETTER={added:"A",modified:"M",deleted:"D",renamed:"R",untracked:"U",conflicted:"C",ignored:"!"},GIT_STATUS_TONE={added:"success",untracked:"success",modified:"brand",renamed:"brand",deleted:"danger",conflicted:"danger",ignored:"neutral"},GIT_STATUS_KEY={added:"gitStatusAdded",modified:"gitStatusModified",deleted:"gitStatusDeleted",renamed:"gitStatusRenamed",untracked:"gitStatusUntracked",conflicted:"gitStatusConflicted",ignored:"gitStatusIgnored"};function baseName(path){const segments=path.split("/").filter(Boolean);return segments[segments.length-1]??path}function isDirectory(node){return node.kind==="directory"||node.children!==void 0||node.hasChildren===!0}function isLazyUnloaded(node){return isDirectory(node)&&node.hasChildren===!0&&node.children===void 0}class LyraFileTree extends LyraElement{constructor(){super(...arguments),this._nodes=[],this.selectedPath=null,this.nodesByPath=new Map,this.parentPathByPath=new Map,this.onNodeSelect=e=>{e.stopPropagation();const{nodeId}=e.detail,node=this.nodesByPath.get(nodeId);if(!node)return;const wasSelected=this.selectedPath===nodeId;this.selectedPath=nodeId,this.emit("lr-file-select",Object.freeze({filePath:nodeId,node})),!isDirectory(node)&&wasSelected&&this.emit("lr-file-open",Object.freeze({filePath:nodeId,node}))},this.onNodeToggle=e=>{e.stopPropagation();const{nodeId,expanded}=e.detail;if(!expanded)return;const node=this.nodesByPath.get(nodeId);node&&isLazyUnloaded(node)&&this.emit("lr-load-children",Object.freeze({filePath:nodeId}))}}static{this.defaultStrings={...super.defaultStrings,collapse:LYRA_DEFAULT_collapse,details:LYRA_DEFAULT_details,fieldRequired:LYRA_DEFAULT_fieldRequired,fileTreeDiffSummary:LYRA_DEFAULT_fileTreeDiffSummary,fileTreeLabel:LYRA_DEFAULT_fileTreeLabel,gitStatusAdded:LYRA_DEFAULT_gitStatusAdded,gitStatusConflicted:LYRA_DEFAULT_gitStatusConflicted,gitStatusDeleted:LYRA_DEFAULT_gitStatusDeleted,gitStatusIgnored:LYRA_DEFAULT_gitStatusIgnored,gitStatusModified:LYRA_DEFAULT_gitStatusModified,gitStatusRenamed:LYRA_DEFAULT_gitStatusRenamed,gitStatusUntracked:LYRA_DEFAULT_gitStatusUntracked,loading:LYRA_DEFAULT_loading,map:LYRA_DEFAULT_map,navigation:LYRA_DEFAULT_navigation,open:LYRA_DEFAULT_open,popover:LYRA_DEFAULT_popover,progress:LYRA_DEFAULT_progress,restore:LYRA_DEFAULT_restore,search:LYRA_DEFAULT_search,select:LYRA_DEFAULT_select}}static{this.styles=[LyraElement.styles,styles]}get nodes(){return this._nodes}set nodes(value){const previous=this._nodes;this._nodes=normalizeFileTreeNodes(value),this.requestUpdate("nodes",previous)}willUpdate(changed){if(super.willUpdate(changed),changed.has("nodes")){this.nodesByPath=new Map,this.parentPathByPath=new Map;const stack=[...this.nodes].reverse().map(node=>({node,parentPath:void 0}));for(;stack.length>0;){const{node,parentPath}=stack.pop();if(this.nodesByPath.set(node.path,node),parentPath!==void 0&&this.parentPathByPath.set(node.path,parentPath),node.children)for(let index=node.children.length-1;index>=0;index--)stack.push({node:node.children[index],parentPath:node.path})}}}toTreeItem(node){const badges=[];node.gitStatus&&badges.push({text:GIT_STATUS_LETTER[node.gitStatus],tone:GIT_STATUS_TONE[node.gitStatus],label:this.localize(GIT_STATUS_KEY[node.gitStatus])});const description=node.additions!==void 0||node.deletions!==void 0?this.localize("fileTreeDiffSummary",void 0,{additions:getNumberFormat(this.effectiveLocale).format(node.additions??0),deletions:getNumberFormat(this.effectiveLocale).format(node.deletions??0)}):void 0;let children;return isLazyUnloaded(node)?children=[{id:`${node.path} loading`,label:this.localize("loading"),disabled:!0}]:node.children&&(children=node.children.map(c=>this.toTreeItem(c))),{id:node.path,label:node.name??baseName(node.path),selected:this.selectedPath===node.path,children,badges:badges.length>0?badges:void 0,description,icon:isDirectory(node)?void 0:html`<lr-file-icon
2
2
  mime-type=${node.mimeType??""}
3
3
  name=${node.name??baseName(node.path)}
4
4
  decorative
@@ -107,7 +107,9 @@ get nodes():readonly FlowNode[];set nodes(value:readonly FlowNode[]);private _ed
107
107
  * first-wins before every render, action, focus, selection, snapshot, and event path. Reassign
108
108
  * the collection to update. */
109
109
  get edges():readonly FlowEdge[];set edges(value:readonly FlowEdge[]);private _orientation;
110
- /** Downstream layout and handle axis. Invalid runtime/attribute values normalize to horizontal. */
110
+ /** Downstream layout and handle axis. Horizontal RTL reflects model coordinates while authored,
111
+ * generated and portable fallback cards retain readable content. Invalid runtime/attribute
112
+ * values normalize to horizontal. */
111
113
  get orientation():LyraOrientation;set orientation(value:LyraOrientation);nodesDraggable:boolean;connectable:boolean;droppable:boolean;
112
114
  /** Freezes pan/zoom/edit gestures and viewport-mutating methods. Enabling it live cancels and
113
115
  * rolls back every active gesture before retiring its global listeners. */
@@ -120,7 +122,8 @@ get selectedEdgeIds():readonly string[];set selectedEdgeIds(value:readonly strin
120
122
  * dotted background's base spacing. */
121
123
  grid:number;layerGap:number;nodeGap:number;private _decorations;
122
124
  /** Deeply snapshotted, frozen run decorations, bounded to 10,000 keys and a finite nested-data
123
- * budget. Reassign the record to update. */
125
+ * budget. Invalid statuses and records with unreadable nested fields are omitted independently,
126
+ * retaining valid neighbors. Reassign the record to update. */
124
127
  get decorations():FlowRunDecorations|null;set decorations(value:FlowRunDecorations|null);accessibleLabel:string|null;
125
128
  /** `minZoom`/`maxZoom` normalized to finite, positive scale bounds before ever reaching
126
129
  * `clampZoom()`'s `Math.min`/`Math.max` — an invalid attribute value would otherwise poison
@@ -135,31 +138,34 @@ private get safeGrid();
135
138
  * `layeredLayout()`'s `gapY`/`gapX` — an invalid value would otherwise flow into every
136
139
  * auto-laid-out node's computed position, producing a `NaN` `translate(...)` that silently
137
140
  * renders the card nowhere instead of at a real position. */
138
- private get safeLayerGap();private get safeNodeGap();private readonly arrowMarkerIds;private readonly liveRegionId;private announcementSink?;private readonly announcer;private liveText;private activeItemIndex;private connecting;private layoutTruncated;private keyboardConnectSourceId;private keyboardConnectTargetIndex;
141
+ private get safeLayerGap();private get safeNodeGap();private readonly arrowMarkerIds;private readonly liveRegionId;private announcementSink?;private readonly announcer;private liveText;private activeItemIndex;private connecting;private layoutTruncated;private hasConnectedLayoutBaseline;private layoutLimitAnnouncementPending;private keyboardConnectSourceId;private keyboardConnectTargetIndex;
139
142
  /** Auto-layout-assigned positions for nodes lacking an explicit `position`. Empty until the first
140
143
  * layout pass runs; `nodePosition()` reads from it. */
141
144
  private autoPositions;
142
145
  /** Per-node measured wrapper size (`ResizeObserver`-driven) — plain map, not reactive state, read
143
146
  * by every geometry helper below. */
144
- private measuredSizes;private resizeObserver?;private readonly observedNodeEls;private layoutRaf;private connectedWindow?;private panX;private panY;private zoomLevel;private viewportEl?;private worldEl?;private viewportChangeRaf;private hasFitOnce;private wheelMeasure;private wheelMeasureRaf;private panDrag?;private nodeDrag?;private nodeIncidentEdges;
147
+ private measuredSizes;private resizeObserver?;private readonly observedNodeEls;private authoredCardObserver?;private authoredCardObserverDocument?;private authoredCardObserverGeneration;private authoredCardSyncQueued;private readonly authoredCardSlotLeases;private layoutRaf;private connectedWindow?;private panX;private panY;private zoomLevel;private viewportEl?;private worldEl?;private viewportChangeRaf;private hasFitOnce;private wheelMeasure;private wheelMeasureRaf;private panDrag?;private nodeDrag?;private nodeIncidentEdges;
145
148
  /** Per-drag snapshot of the dragged node's incident edges -- edge/node records and shadow-DOM
146
149
  * element refs resolved once at drag start, so the per-pointermove path rewrite does no
147
150
  * per-edge array scans or shadow-root-wide `querySelector` calls. */
148
- private dragEdgeRefs?;private connectState?;private connectionLineEl?;private connectInvalidNodeId;private companionCallbacks;private companionRaf;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;private requestOwnerAnimationFrame;private cancelOwnerAnimationFrame;private releaseAnnouncementSink;private syncAnnouncementSink;
151
+ private dragEdgeRefs?;private connectState?;private connectionLineEl?;private connectInvalidNodeId;private companionCallbacks;private companionRaf;connectedCallback():void;disconnectedCallback():void;adoptedCallback():void;private requestOwnerAnimationFrame;private cancelOwnerAnimationFrame;private releaseAnnouncementSink;private syncAnnouncementSink;private resetAuthoredCardObserver;
152
+ /** Direct-child insertion/removal and direct `node-id` changes are the only light-DOM changes
153
+ * that can alter card ownership. The observer is constructed from the element's owner realm so
154
+ * adoption does not retain an old document's callback. */
155
+ private bindAuthoredCardObserver;private scheduleAuthoredCardReconciliation;
149
156
  /** Observes every node wrapper not yet tracked by the current `ResizeObserver` instance. The
150
157
  * tracking set is cleared alongside the observer itself in `disconnectedCallback()`, so a
151
158
  * reconnect re-observes each wrapper with the freshly created observer instead of treating it
152
159
  * as already watched. */
153
160
  private observeNodeWrappers;protected willUpdate(changed:PropertyValues):void;private pruneNodeCaches;protected updated(changed:PropertyValues):void;
154
- /** Reconciles only consumer-authored light-DOM cards. Default cards are declarative slot fallback
155
- * content in `renderNodes()`, so SSR and hydration share the same owned DOM and no append/remove
156
- * churn can leak into the consumer's light DOM. */
157
- private syncAuthoredCards;
158
- /** Pushes changed node/selection/decoration state onto every currently-adopted card (default or
159
- * user-authored) so handles and run paint always match the model, regardless of which slot
160
- * mechanism produced the card. Indexing the direct children once avoids a full descendant
161
- * selector scan for every node in large flows. */
162
- private pushCardPropsAll;private nodePosition;private nodeSize;private resolvedNode;
161
+ /** Reconciles only consumer-authored direct children. Default cards remain declarative named-slot
162
+ * fallback content in `renderNodes()`, so SSR and hydration never synthesize or remove light-DOM
163
+ * cards. A lease restores the last author-owned slot only if the canvas still owns its last
164
+ * assignment; a later author write always wins. */
165
+ private syncAuthoredCards;private leaseAuthoredCardSlot;private releaseAuthoredCardSlot;private restoreAuthoredCardSlots;
166
+ /** Pushes changed node/selection/decoration state onto every currently leased direct card. A
167
+ * card's property setter is consumer code, so one rejected projection cannot stop later cards. */
168
+ private pushCardPropsAll;private setCardProperty;private nodePosition;private nodeSize;private resolvedNode;
163
169
  /** Evenly distributes `count` handles along a `span`-px edge (index 0-based) — matches
164
170
  * `justify-content: space-around` so `lr-flow-node`'s handle-column CSS lines up with this
165
171
  * exactly. */
@@ -167,6 +173,10 @@ private handleOffset;private handlePoint;private edgePathD;private nodeAccessibl
167
173
  /** Captures rendered wrapper boxes before the first layout request. This is also the no-
168
174
  * ResizeObserver path, so a controlled host never receives a preliminary 16px-assumed layout. */
169
175
  private measureNodeWrappers;private scheduleLayoutPass;
176
+ /** The first completed connected layout establishes the live-region baseline. A visible limit
177
+ * notice and `lr-layout-change` still report that result; only subsequent false-to-true changes
178
+ * are announcements. */
179
+ private setLayoutTruncated;
170
180
  /** Lays out every node currently missing an explicit `position`, leaving explicitly-positioned
171
181
  * nodes exactly as given (routed through as `fixedPositions` so the shared util lays out around
172
182
  * them). A no-op when every node already has a `position`.
@@ -1,4 +1,4 @@
1
- var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};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{nextId,srOnly}from"../../../internal/a11y.js";import{acquireAnnouncementSink,Announcer}from"../../../internal/announcer.js";import{isRtl}from"../../../internal/rtl.js";import{prefersReducedMotion}from"../../../internal/motion.js";import{layeredLayout}from"../../../internal/layered-layout.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{finiteNumber,finiteRange}from"../../../internal/numbers.js";import{isActionableElement}from"../../../internal/focus-navigation.js";import{resolveCssLength}from"../../../internal/css-length.js";import{tag}from"../../../internal/prefix.js";import{snapshotFlowDecorations,snapshotFlowEdges,snapshotFlowNodes,MAX_FLOW_COLLECTION_ENTRIES}from"./flow-model.js";import{FLOW_PALETTE_MIME_TYPE}from"./flow-types.js";import{styles}from"./flow-canvas.styles.js";import{LYRA_DEFAULT_flowCanvasLabel,LYRA_DEFAULT_flowCanvasLayoutLimit,LYRA_DEFAULT_flowCanvasSummary,LYRA_DEFAULT_flowConnectCancelled,LYRA_DEFAULT_flowConnectCommitted,LYRA_DEFAULT_flowConnectStarted,LYRA_DEFAULT_flowConnectTarget,LYRA_DEFAULT_flowEdge,LYRA_DEFAULT_flowEdgeList,LYRA_DEFAULT_flowEdgeWithLabel,LYRA_DEFAULT_flowItemAnnouncement,LYRA_DEFAULT_flowNode,LYRA_DEFAULT_flowNodeDeselected,LYRA_DEFAULT_flowNodeMoved,LYRA_DEFAULT_flowNodeSelected,LYRA_DEFAULT_flowSelectionCleared,LYRA_DEFAULT_noData}from"../../../internal/default-strings.generated.js";export*from"./flow-types.js";const FLOW_EDGE_TONES=["neutral","brand","success","warning","danger"],CONNECT_OFFSET_MIN=24,CONNECT_OFFSET_MAX=120,ZOOM_MULTIPLIER=1.2,DEFAULT_FIT_PADDING=24,KEYBOARD_PAN_STEP=32;function toggledSelection(list,id){return list.includes(id)?list.filter(x=>x!==id):[...list,id]}function nodeTypePart(type){if(!type)return null;const normalized=type.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"");return normalized?`node-type-${/^\d/.test(normalized)?`type-${normalized}`:normalized}`:null}function isHtmlElement(value){if(typeof value!="object"||value===null)return!1;const element=value;return element.nodeType===1&&element.namespaceURI==="http://www.w3.org/1999/xhtml"}class LyraFlowCanvas extends LyraElement{constructor(){super(...arguments),this._nodes=Object.freeze([]),this._edges=Object.freeze([]),this._orientation="horizontal",this.nodesDraggable=!1,this.connectable=!1,this.droppable=!1,this.locked=!1,this._selectedNodeIds=Object.freeze([]),this._selectedEdgeIds=Object.freeze([]),this.minZoom=.25,this.maxZoom=2,this.grid=8,this.layerGap=64,this.nodeGap=24,this._decorations=null,this.accessibleLabel=null,this.arrowMarkerIds={neutral:nextId("flow-canvas-arrow-neutral"),brand:nextId("flow-canvas-arrow-brand"),success:nextId("flow-canvas-arrow-success"),warning:nextId("flow-canvas-arrow-warning"),danger:nextId("flow-canvas-arrow-danger")},this.liveRegionId=nextId("flow-canvas-live"),this.announcer=new Announcer({onFlush:text=>{this.liveText=text,this.announcementSink?.announce(text)}}),this.liveText="",this.activeItemIndex=0,this.connecting=!1,this.layoutTruncated=!1,this.keyboardConnectSourceId=null,this.keyboardConnectTargetIndex=0,this.autoPositions=new Map,this.measuredSizes=new Map,this.observedNodeEls=new Set,this.layoutRaf=null,this.panX=0,this.panY=0,this.zoomLevel=1,this.viewportChangeRaf=null,this.hasFitOnce=!1,this.wheelMeasure=null,this.wheelMeasureRaf=null,this.nodeIncidentEdges=new Map,this.connectInvalidNodeId=null,this.companionCallbacks=new Set,this.companionRaf=null,this.onWheel=e=>{if(this.locked||!this.viewportEl)return;e.preventDefault(),this.wheelMeasure||(this.wheelMeasure={rect:this.viewportEl.getBoundingClientRect(),rtl:isRtl(this)},this.wheelMeasureRaf=this.requestOwnerAnimationFrame(()=>{this.wheelMeasure=null,this.wheelMeasureRaf=null}));const{rect,rtl}=this.wheelMeasure,localX=this.localWorldX(e.clientX,rect,rtl),localY=e.clientY-rect.top,factor=e.deltaY<0?ZOOM_MULTIPLIER:1/ZOOM_MULTIPLIER;this.zoomAtPoint(localX,localY,this.zoomLevel*factor)},this.onBackgroundPointerDown=e=>{this.locked||(this.panDrag={pointerId:e.pointerId,startClientX:e.clientX,startClientY:e.clientY,startPanX:this.panX,startPanY:this.panY,rtlFlip:this.orientation==="horizontal"&&isRtl(this)?-1:1},e.target.setPointerCapture?.(e.pointerId),this.viewportEl?.setAttribute("data-panning",""),this.connectedWindow?.addEventListener("pointermove",this.onBackgroundPointerMove),this.connectedWindow?.addEventListener("pointerup",this.onBackgroundPointerUp),this.connectedWindow?.addEventListener("pointercancel",this.onBackgroundPointerUp),this.connectedWindow?.addEventListener("lostpointercapture",this.onBackgroundPointerUp))},this.onBackgroundPointerMove=e=>{const drag=this.panDrag;if(!(!drag||e.pointerId!==drag.pointerId)){if(this.locked){this.endBackgroundPan(!0);return}this.panX=drag.startPanX+(e.clientX-drag.startClientX)*drag.rtlFlip,this.panY=drag.startPanY+(e.clientY-drag.startClientY),this.applyWorldTransform(),this.scheduleViewportChange()}},this.onBackgroundPointerUp=e=>{!this.panDrag||e.pointerId!==this.panDrag.pointerId||this.endBackgroundPan(this.locked||e.type!=="pointerup")},this.onViewportKeyDown=e=>{if(!(e.target!==this.viewportEl||this.locked))if(e.key==="+"||e.key==="=")e.preventDefault(),this.zoomIn();else if(e.key==="-"||e.key==="_")e.preventDefault(),this.zoomOut();else if(e.key==="0")e.preventDefault(),this.resetZoom();else if(e.key==="ArrowRight"){e.preventDefault();const rtlFlip=this.orientation==="horizontal"&&isRtl(this)?-1:1;this.panBy(-KEYBOARD_PAN_STEP*rtlFlip,0)}else if(e.key==="ArrowLeft"){e.preventDefault();const rtlFlip=this.orientation==="horizontal"&&isRtl(this)?-1:1;this.panBy(KEYBOARD_PAN_STEP*rtlFlip,0)}else e.key==="ArrowDown"?(e.preventDefault(),this.panBy(0,-KEYBOARD_PAN_STEP)):e.key==="ArrowUp"&&(e.preventDefault(),this.panBy(0,KEYBOARD_PAN_STEP))},this.onViewportDragOver=e=>{!this.droppable||this.locked||e.dataTransfer?.types.includes(FLOW_PALETTE_MIME_TYPE)&&(e.preventDefault(),e.dataTransfer.dropEffect="copy",this.viewportEl?.setAttribute("data-drop-active",""))},this.onViewportDragLeave=()=>{this.viewportEl?.removeAttribute("data-drop-active")},this.onViewportDrop=e=>{if(this.viewportEl?.removeAttribute("data-drop-active"),!this.droppable||this.locked)return;const raw=e.dataTransfer?.getData(FLOW_PALETTE_MIME_TYPE);if(!raw)return;e.preventDefault();const maxPayloadBytes=4096;if(raw.length>maxPayloadBytes)return;const TextEncoderCtor=this.ownerDocument.defaultView?.TextEncoder??globalThis.TextEncoder;if(TextEncoderCtor&&new TextEncoderCtor().encode(raw).byteLength>maxPayloadBytes)return;let payload;try{payload=JSON.parse(raw)}catch{return}if(typeof payload!="object"||payload===null||Array.isArray(payload)||Object.getPrototypeOf(payload)!==Object.prototype&&Object.getPrototypeOf(payload)!==null)return;const rawType=payload.type;if(typeof rawType!="string")return;const type=rawType.trim();if(!type||type.length>128)return;const contentPoint=this.toContentPoint(e.clientX,e.clientY);this.emit("lr-node-add",Object.freeze({type,position:Object.freeze({x:this.snap(contentPoint.x),y:this.snap(contentPoint.y)})}))},this.onNodePointerMove=e=>{const drag=this.nodeDrag;if(!drag||e.pointerId!==drag.pointerId)return;if(this.locked||!this.nodesDraggable){this.endNodeDrag(!1);return}const dx=(e.clientX-drag.startClientX)*drag.rtlFlip/this.zoomLevel,dy=(e.clientY-drag.startClientY)/this.zoomLevel,x=this.snap(drag.startX+dx),y=this.snap(drag.startY+dy);drag.wrapper.style.transform=`translate(${x}px, ${y}px)`,this.updateIncidentEdges(drag.nodeId,x,y),drag.currentX=x,drag.currentY=y},this.onNodePointerUp=e=>{const drag=this.nodeDrag;!drag||e.pointerId!==drag.pointerId||this.endNodeDrag(!this.locked&&e.type==="pointerup")},this.onWorldPointerDown=e=>{if(!this.connectable||this.locked||this.connectState)return;const path=e.composedPath(),handleEl=path.find(el=>isHtmlElement(el)&&el.dataset.handleKind==="output");if(!handleEl)return;const nodeId=this.nodeIdFromComposedPath(path),handleId=handleEl.dataset.handleId;!nodeId||!handleId||(e.stopPropagation(),this.startConnectGesture(nodeId,handleId,e.clientX,e.clientY))},this.onConnectPointerMove=e=>{if(!this.connectState)return;if(this.locked||!this.connectable){this.onConnectPointerCancel();return}const targetPt=this.connectContentPoint(e.clientX,e.clientY);this.connectionLineEl?.setAttribute("d",this.edgePathD(this.connectState.startPt,targetPt));const hoveredId=this.nodeIdFromComposedPath(e.composedPath()),invalid=hoveredId!=null&&this.isInvalidConnectTarget(hoveredId);this.connectInvalidNodeId&&this.connectInvalidNodeId!==(invalid?hoveredId:null)&&this.renderedNodeById(this.connectInvalidNodeId)?.removeAttribute("data-connect-invalid"),this.connectInvalidNodeId=invalid?hoveredId:null,invalid&&this.renderedNodeById(hoveredId)?.setAttribute("data-connect-invalid","")},this.onConnectPointerUp=e=>{if(!this.connectState)return;if(this.locked||!this.connectable){this.onConnectPointerCancel();return}const state2=this.connectState,path=e.composedPath(),targetNodeId=this.nodeIdFromComposedPath(path);if(this.endConnectGesture(),!targetNodeId||this.isInvalidConnectTargetFor(state2,targetNodeId)){this.announcer.announce(this.localize("flowConnectCancelled"));return}const targetHandle=path.find(el=>isHtmlElement(el)&&el.dataset.handleKind==="input")?.dataset.handleId??"in";this.emit("lr-connect",Object.freeze({source:state2.sourceId,target:targetNodeId,sourceHandle:state2.sourceHandle,targetHandle}));const sourceNode=this.nodes.find(node=>node.id===state2.sourceId),targetNode=this.nodes.find(node=>node.id===targetNodeId);this.announcer.announce(this.localize("flowConnectCommitted",void 0,{source:sourceNode?this.nodeAccessibleText(sourceNode):state2.sourceId,target:targetNode?this.nodeAccessibleText(targetNode):targetNodeId}))},this.onConnectPointerCancel=()=>{this.connectState&&(this.endConnectGesture(),this.announcer.announce(this.localize("flowConnectCancelled")))}}static{this.defaultStrings={...super.defaultStrings,flowCanvasLabel:LYRA_DEFAULT_flowCanvasLabel,flowCanvasLayoutLimit:LYRA_DEFAULT_flowCanvasLayoutLimit,flowCanvasSummary:LYRA_DEFAULT_flowCanvasSummary,flowConnectCancelled:LYRA_DEFAULT_flowConnectCancelled,flowConnectCommitted:LYRA_DEFAULT_flowConnectCommitted,flowConnectStarted:LYRA_DEFAULT_flowConnectStarted,flowConnectTarget:LYRA_DEFAULT_flowConnectTarget,flowEdge:LYRA_DEFAULT_flowEdge,flowEdgeList:LYRA_DEFAULT_flowEdgeList,flowEdgeWithLabel:LYRA_DEFAULT_flowEdgeWithLabel,flowItemAnnouncement:LYRA_DEFAULT_flowItemAnnouncement,flowNode:LYRA_DEFAULT_flowNode,flowNodeDeselected:LYRA_DEFAULT_flowNodeDeselected,flowNodeMoved:LYRA_DEFAULT_flowNodeMoved,flowNodeSelected:LYRA_DEFAULT_flowNodeSelected,flowSelectionCleared:LYRA_DEFAULT_flowSelectionCleared,noData:LYRA_DEFAULT_noData}}static{this.styles=[LyraElement.styles,styles,srOnly]}get nodes(){return this._nodes}set nodes(value){const previous=this._nodes;this._nodes=snapshotFlowNodes(value),this.requestUpdate("nodes",previous)}get edges(){return this._edges}set edges(value){const previous=this._edges;this._edges=snapshotFlowEdges(value),this.requestUpdate("edges",previous)}get orientation(){return this._orientation}set orientation(value){const previous=this._orientation,next=value==="vertical"?"vertical":"horizontal";this._orientation=next,(next!==previous||value!==next)&&this.requestUpdate("orientation",previous)}get selectedNodeIds(){return this._selectedNodeIds}set selectedNodeIds(value){const previous=this._selectedNodeIds;this._selectedNodeIds=this.snapshotSelectedIds(value,new Set(this.nodes.map(node=>node.id))),this.requestUpdate("selectedNodeIds",previous)}get selectedEdgeIds(){return this._selectedEdgeIds}set selectedEdgeIds(value){const previous=this._selectedEdgeIds;this._selectedEdgeIds=this.snapshotSelectedIds(value,new Set(this.edges.map(edge=>edge.id))),this.requestUpdate("selectedEdgeIds",previous)}snapshotSelectedIds(value,validIds){if(!Array.isArray(value))return Object.freeze([]);const selected=[],seen=new Set;for(const candidate of value.slice(0,MAX_FLOW_COLLECTION_ENTRIES))typeof candidate!="string"||candidate.trim().length===0||!validIds.has(candidate)||seen.has(candidate)||(seen.add(candidate),selected.push(candidate));return Object.freeze(selected)}get decorations(){return this._decorations}set decorations(value){const previous=this._decorations;this._decorations=value==null?null:snapshotFlowDecorations(value),this.requestUpdate("decorations",previous)}get safeMinZoom(){return finiteRange(this.minZoom,.25,.001,1e3)}get safeMaxZoom(){return finiteRange(this.maxZoom,2,.001,1e3)}get effectiveZoomBounds(){return{min:Math.min(this.safeMinZoom,this.safeMaxZoom),max:Math.max(this.safeMinZoom,this.safeMaxZoom)}}get safeGrid(){return finiteRange(this.grid,8,0)}get safeLayerGap(){return finiteRange(this.layerGap,64,0)}get safeNodeGap(){return finiteRange(this.nodeGap,24,0)}connectedCallback(){super.connectedCallback();const ownerWindow=this.ownerDocument.defaultView;this.connectedWindow=ownerWindow??void 0,ownerWindow&&this.announcer.setTimerHost(ownerWindow),this.syncAnnouncementSink();const ResizeObserverCtor=ownerWindow?.ResizeObserver;this.resizeObserver=ResizeObserverCtor?new ResizeObserverCtor(entries=>this.onNodesResized(entries)):void 0,this.hasUpdated&&this.observeNodeWrappers()}disconnectedCallback(){super.disconnectedCallback(),this.announcer.cancel(),this.releaseAnnouncementSink(),this.liveText="",this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.observedNodeEls.clear(),this.layoutRaf!=null&&(this.cancelOwnerAnimationFrame(this.layoutRaf),this.layoutRaf=null),this.companionRaf!=null&&(this.cancelOwnerAnimationFrame(this.companionRaf),this.companionRaf=null),this.viewportChangeRaf!=null&&(this.cancelOwnerAnimationFrame(this.viewportChangeRaf),this.viewportChangeRaf=null),this.wheelMeasureRaf!=null&&(this.cancelOwnerAnimationFrame(this.wheelMeasureRaf),this.wheelMeasureRaf=null,this.wheelMeasure=null),this.panDrag=void 0,this.connectedWindow?.removeEventListener("pointermove",this.onBackgroundPointerMove),this.connectedWindow?.removeEventListener("pointerup",this.onBackgroundPointerUp),this.connectedWindow?.removeEventListener("pointercancel",this.onBackgroundPointerUp),this.connectedWindow?.removeEventListener("lostpointercapture",this.onBackgroundPointerUp),this.nodeDrag=void 0,this.dragEdgeRefs=void 0,this.connectedWindow?.removeEventListener("pointermove",this.onNodePointerMove),this.connectedWindow?.removeEventListener("pointerup",this.onNodePointerUp),this.connectedWindow?.removeEventListener("pointercancel",this.onNodePointerUp),this.connectedWindow?.removeEventListener("lostpointercapture",this.onNodePointerUp),this.connectState=void 0,this.connecting=!1,this.connectInvalidNodeId=null,this.keyboardConnectSourceId=null,this.keyboardConnectTargetIndex=0,this.connectedWindow?.removeEventListener("pointermove",this.onConnectPointerMove),this.connectedWindow?.removeEventListener("pointerup",this.onConnectPointerUp),this.connectedWindow?.removeEventListener("pointercancel",this.onConnectPointerCancel),this.connectedWindow?.removeEventListener("lostpointercapture",this.onConnectPointerCancel),this.connectedWindow=void 0}adoptedCallback(){super.adoptedCallback();const ownerWindow=this.ownerDocument.defaultView;ownerWindow&&this.announcer.setTimerHost(ownerWindow)}requestOwnerAnimationFrame(callback){const owner=this.ownerDocument.defaultView;return owner?{owner,handle:owner.requestAnimationFrame(callback)}:null}cancelOwnerAnimationFrame(frame){frame.owner.cancelAnimationFrame(frame.handle)}releaseAnnouncementSink(){this.announcementSink?.release(),this.announcementSink=void 0}syncAnnouncementSink(){if(!this.isConnected){this.releaseAnnouncementSink();return}this.announcementSink?.element.ownerDocument!==this.ownerDocument&&(this.releaseAnnouncementSink(),this.announcementSink=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}))}observeNodeWrappers(){for(const el of Array.from(this.renderRoot.querySelectorAll('[part="node"]')))this.observedNodeEls.has(el)||(this.observedNodeEls.add(el),this.resizeObserver?.observe(el))}willUpdate(changed){if(super.willUpdate(changed),changed.has("nodes")){this.cancelModelBoundGestures(),this.pruneNodeCaches(),this.syncAuthoredCards();const nodeIds=new Set(this.nodes.map(node=>node.id));this._selectedNodeIds=this.snapshotSelectedIds(this.selectedNodeIds,nodeIds)}if(changed.has("edges")){this.cancelModelBoundGestures();const edgeIds=new Set(this.edges.map(edge=>edge.id));this._selectedEdgeIds=this.snapshotSelectedIds(this.selectedEdgeIds,edgeIds)}if((changed.has("locked")&&this.locked||changed.has("orientation"))&&this.cancelActiveGestures(),changed.has("nodesDraggable")&&!this.nodesDraggable&&this.endNodeDrag(!1),changed.has("connectable")&&!this.connectable&&(this.onConnectPointerCancel(),this.keyboardConnectSourceId=null,this.keyboardConnectTargetIndex=0),changed.has("droppable")&&!this.droppable&&this.viewportEl?.removeAttribute("data-drop-active"),changed.has("grid")&&this.endNodeDrag(!1),changed.has("nodes")||changed.has("edges")||changed.has("orientation")||changed.has("layerGap")||changed.has("nodeGap"))for(const node of this.nodes)node.position||this.autoPositions.delete(node.id);(changed.has("nodes")||changed.has("selectedNodeIds")||changed.has("decorations")||changed.has("orientation"))&&this.pushCardPropsAll(changed)}pruneNodeCaches(){const nodeIds=new Set(this.nodes.map(node=>node.id));for(const id of this.autoPositions.keys())nodeIds.has(id)||this.autoPositions.delete(id);for(const id of this.measuredSizes.keys())nodeIds.has(id)||this.measuredSizes.delete(id);for(const element of this.observedNodeEls){const id=element.dataset.nodeId;id&&nodeIds.has(id)||(this.resizeObserver?.unobserve(element),this.observedNodeEls.delete(element))}}updated(changed){super.updated(changed),changed.has("edges")&&this.rebuildIncidentEdgesIndex(),changed.has("layoutTruncated")&&this.layoutTruncated&&this.announcer.announce(this.localize("flowCanvasLayoutLimit")),this.observeNodeWrappers(),(changed.has("nodes")||changed.has("edges")||changed.has("orientation")||changed.has("layerGap")||changed.has("nodeGap"))&&this.scheduleLayoutPass(),(changed.has("nodes")||changed.has("edges")||changed.has("decorations")||changed.has("minZoom")||changed.has("maxZoom")||changed.has("locked")||changed.has("orientation")||changed.has("layerGap")||changed.has("nodeGap"))&&this.scheduleCompanionNotify();const viewportEl=this.renderRoot.querySelector('[part="viewport"]');viewportEl&&viewportEl!==this.viewportEl&&(this.viewportEl=viewportEl,this.worldEl=this.renderRoot.querySelector(".world"),viewportEl.addEventListener("wheel",this.onWheel,{passive:!1}),viewportEl.addEventListener("keydown",this.onViewportKeyDown),viewportEl.addEventListener("dragover",this.onViewportDragOver),viewportEl.addEventListener("dragleave",this.onViewportDragLeave),viewportEl.addEventListener("drop",this.onViewportDrop),this.applyWorldTransform())}syncAuthoredCards(){const ids=new Set(this.nodes.map(n=>n.id)),children=this.children;for(const child of Array.from(children??[])){const nodeId=child.getAttribute("node-id");nodeId&&(ids.has(nodeId)?child.setAttribute("slot",`node-${nodeId}`):(child.removeAttribute("slot"),console.warn(`<lr-flow-canvas> a child with node-id="${nodeId}" matches no entry in \`nodes\`; it will not render.`)))}}pushCardPropsAll(changed){const nodesChanged=changed.has("nodes"),selectionChanged=nodesChanged||changed.has("selectedNodeIds"),decorationsChanged=nodesChanged||changed.has("decorations"),orientationChanged=nodesChanged||changed.has("orientation"),cardsByNodeId=new Map,children=this.children;for(const child of Array.from(children??[])){const nodeId=child.getAttribute("node-id");nodeId&&cardsByNodeId.set(nodeId,child)}const selectedNodeIds=selectionChanged?new Set(this.selectedNodeIds):null;for(const node of this.nodes){const el=cardsByNodeId.get(node.id);if(el&&(nodesChanged&&(el.inputs=node.inputs??[{id:"in"}],el.outputs=node.outputs??[{id:"out"}],el.flowType=node.type??""),orientationChanged&&(el.orientation=this.orientation),selectedNodeIds&&(el.selected=selectedNodeIds.has(node.id)),decorationsChanged)){const decoration=this.decorations?.[node.id];el.status=decoration?.status??null,el.progress=decoration?.progress??null,el.statusDetail=decoration?.detail??"",el.durationMs=decoration?.durationMs??null}}}nodePosition(node){const position=node.position??this.autoPositions.get(node.id)??{x:0,y:0};return{x:finiteNumber(position.x,0),y:finiteNumber(position.y,0)}}nodeSize(id){const measured=this.measuredSizes.get(id);if(measured)return measured;const ownerWindow=this.ownerDocument?.defaultView,host=this.renderedNodeById(id)??this,computed=ownerWindow?.getComputedStyle(host),customWidth=resolveCssLength(computed?.getPropertyValue("--lr-flow-canvas-node-fallback-inline-size").trim(),{host}),customHeight=resolveCssLength(computed?.getPropertyValue("--lr-flow-canvas-node-fallback-block-size").trim(),{host}),width=customWidth??(resolveCssLength(computed?.getPropertyValue("--lr-size-10rem").trim()||"10rem",{host})??0)+(resolveCssLength(computed?.getPropertyValue("--lr-size-1rem").trim()||"1rem",{host})??0),height=customHeight??resolveCssLength(computed?.getPropertyValue("--lr-size-4rem").trim()||"4rem",{host})??0;return{width,height}}resolvedNode(node){const pos=this.nodePosition(node),size=this.nodeSize(node.id);return{node,x:pos.x,y:pos.y,width:size.width,height:size.height}}handleOffset(count,index,span){return count<=1?span/2:span*(index+.5)/count}handlePoint(resolved,kind,handleId){const handles=kind==="input"?resolved.node.inputs??[{id:"in"}]:resolved.node.outputs??[{id:"out"}],index=handles.findIndex(h=>h.id===handleId),horizontal=this.orientation==="horizontal",edgeSpan=horizontal?resolved.height:resolved.width,offset=index>=0?this.handleOffset(handles.length,index,edgeSpan):edgeSpan/2;if(horizontal)return{x:kind==="input"?resolved.x:resolved.x+resolved.width,y:resolved.y+offset};const y=kind==="input"?resolved.y:resolved.y+resolved.height;return{x:resolved.x+offset,y}}edgePathD(sourcePt,targetPt){const dx=targetPt.x-sourcePt.x,dy=targetPt.y-sourcePt.y,distance=Math.hypot(dx,dy),offset=Math.min(CONNECT_OFFSET_MAX,Math.max(CONNECT_OFFSET_MIN,distance/2)),horizontal=this.orientation==="horizontal",c1x=sourcePt.x+(horizontal?offset:0),c1y=sourcePt.y+(horizontal?0:offset),c2x=targetPt.x-(horizontal?offset:0),c2y=targetPt.y-(horizontal?0:offset);return`M ${sourcePt.x} ${sourcePt.y} C ${c1x} ${c1y}, ${c2x} ${c2y}, ${targetPt.x} ${targetPt.y}`}nodeAccessibleText(node){if(node.accessibleLabel)return node.accessibleLabel;const label=typeof node.data?.label=="string"?node.data.label:node.id;return this.localize("flowNode",void 0,{label})}edgeAccessibleText(edge){const sourceNode=this.nodes.find(n=>n.id===edge.source),targetNode=this.nodes.find(n=>n.id===edge.target),source=sourceNode?this.nodeAccessibleText(sourceNode):edge.source,target=targetNode?this.nodeAccessibleText(targetNode):edge.target;return edge.label?this.localize("flowEdgeWithLabel",void 0,{label:edge.label,source,target}):this.localize("flowEdge",void 0,{source,target})}onNodesResized(entries){let changedAny=!1;for(const entry of entries){const id=entry.target.dataset.nodeId;if(!id)continue;const box=entry.borderBoxSize?.[0],width=box?box.inlineSize:entry.contentRect.width,height=box?box.blockSize:entry.contentRect.height,prev=this.measuredSizes.get(id);(!prev||prev.width!==width||prev.height!==height)&&(this.measuredSizes.set(id,{width,height}),changedAny=!0)}changedAny&&(this.scheduleLayoutPass(),this.scheduleCompanionNotify())}measureNodeWrappers(){for(const wrapper of Array.from(this.renderRoot.querySelectorAll('[part="node"]'))){const id=wrapper.dataset.nodeId;if(!id)continue;const rect=wrapper.getBoundingClientRect(),width=wrapper.offsetWidth||rect.width/Math.max(this.zoomLevel,Number.EPSILON),height=wrapper.offsetHeight||rect.height/Math.max(this.zoomLevel,Number.EPSILON);Number.isFinite(width)&&Number.isFinite(height)&&width>0&&height>0&&this.measuredSizes.set(id,{width,height})}}scheduleLayoutPass(){this.layoutRaf==null&&(this.layoutRaf=this.requestOwnerAnimationFrame(()=>{this.layoutRaf=null,this.measureNodeWrappers(),this.runAutoLayoutIfNeeded(),this.requestUpdate(),!this.hasFitOnce&&this.nodes.length>0&&(this.hasFitOnce=!0,this.fit())}))}runAutoLayoutIfNeeded(){const unpositioned=this.nodes.filter(n=>!n.position);if(unpositioned.length===0){this.layoutTruncated=!1;return}const swap=this.orientation==="horizontal",graphNodes=this.nodes.map(n=>{const size=this.nodeSize(n.id);return{id:n.id,width:swap?size.height:size.width,height:swap?size.width:size.height}}),nodeIds=new Set(this.nodes.map(n=>n.id)),graphEdges=this.edges.filter(e=>nodeIds.has(e.source)&&nodeIds.has(e.target)).map(e=>({source:e.source,target:e.target})),fixedPositions=new Map;for(const n of this.nodes){if(!n.position||n.position.x<0||n.position.y<0)continue;const size=this.nodeSize(n.id),center={x:n.position.x+size.width/2,y:n.position.y+size.height/2};!Number.isSafeInteger(Math.trunc(center.x))||!Number.isSafeInteger(Math.trunc(center.y))||fixedPositions.set(n.id,swap?{x:center.y,y:center.x}:center)}const result=layeredLayout({nodes:graphNodes,edges:graphEdges,options:{gapX:this.safeNodeGap,gapY:this.safeLayerGap,fixedPositions}}),positions={};for(const n of unpositioned){const raw=result.positions.get(n.id);if(!raw)continue;const center=swap?{x:raw.y,y:raw.x}:{x:raw.x,y:raw.y},size=this.nodeSize(n.id),resolved={x:center.x-size.width/2,y:center.y-size.height/2};this.autoPositions.set(n.id,resolved),positions[n.id]=Object.freeze(resolved)}this.layoutTruncated=result.truncated,Object.keys(positions).length>0&&this.emit("lr-layout-change",Object.freeze({positions:Object.freeze(positions),truncated:result.truncated}))}get viewport(){return Object.freeze({x:this.panX,y:this.panY,zoom:this.zoomLevel})}setViewport(next){this.locked||(this.panX=finiteNumber(next.x,this.panX),this.panY=finiteNumber(next.y,this.panY),this.zoomLevel=this.clampZoom(next.zoom),this.applyWorldTransform(),this.emit("lr-viewport-change",Object.freeze({x:this.panX,y:this.panY,zoom:this.zoomLevel})))}zoomIn(){this.locked||this.zoomAtCenter(this.zoomLevel*ZOOM_MULTIPLIER)}zoomOut(){this.locked||this.zoomAtCenter(this.zoomLevel/ZOOM_MULTIPLIER)}resetZoom(){this.locked||this.setViewport({x:this.panX,y:this.panY,zoom:1})}fit(options){if(this.locked||this.nodes.length===0)return;const padding=finiteRange(options?.padding??DEFAULT_FIT_PADDING,DEFAULT_FIT_PADDING,0);let minX=1/0,minY=1/0,maxX=-1/0,maxY=-1/0;for(const node of this.nodes){const resolved=this.resolvedNode(node);minX=Math.min(minX,resolved.x),minY=Math.min(minY,resolved.y),maxX=Math.max(maxX,resolved.x+resolved.width),maxY=Math.max(maxY,resolved.y+resolved.height)}const rect=this.viewportEl?.getBoundingClientRect(),viewW=rect?.width??0,viewH=rect?.height??0,contentW=Math.max(1,maxX-minX),contentH=Math.max(1,maxY-minY),fitZoom=Math.min((viewW-padding*2)/contentW,(viewH-padding*2)/contentH),zoom=this.clampZoom(Number.isFinite(fitZoom)&&fitZoom>0?fitZoom:1);this.panX=viewW/2-(minX+contentW/2)*zoom,this.panY=viewH/2-(minY+contentH/2)*zoom,this.zoomLevel=zoom,this.applyWorldTransform(),this.scheduleViewportChange()}focusNode(id,options){if(this.locked)return;const node=this.nodes.find(n=>n.id===id);if(!node)return;const resolved=this.resolvedNode(node),rect=this.viewportEl?.getBoundingClientRect(),viewW=rect?.width??0,viewH=rect?.height??0,zoom=options?.zoom!=null?this.clampZoom(options.zoom):this.zoomLevel;this.panX=viewW/2-(resolved.x+resolved.width/2)*zoom,this.panY=viewH/2-(resolved.y+resolved.height/2)*zoom,this.zoomLevel=zoom,this.applyWorldTransform(),this.scheduleViewportChange(),this.focusActiveItem(this.spatialItemIndex("node",id))}toContentPoint(clientX,clientY){const rect=this.viewportEl?.getBoundingClientRect();if(!rect)return{x:0,y:0};const localX=this.localWorldX(clientX,rect),localY=clientY-rect.top;return{x:(localX-this.panX)/this.zoomLevel,y:(localY-this.panY)/this.zoomLevel}}registerCompanion(cb){return this.companionCallbacks.add(cb),this.scheduleCompanionNotify(),()=>{this.companionCallbacks.delete(cb)}}scheduleCompanionNotify(){this.companionRaf!=null||this.companionCallbacks.size===0||(this.companionRaf=this.requestOwnerAnimationFrame(()=>{this.companionRaf=null;for(const cb of this.companionCallbacks)cb(this.buildSnapshot())}))}buildSnapshot(){const rect=this.viewportEl?.getBoundingClientRect(),bounds=this.effectiveZoomBounds;return Object.freeze({nodes:Object.freeze(this.nodes.map(n=>{const resolved=this.resolvedNode(n);return Object.freeze({id:n.id,x:resolved.x,y:resolved.y,width:resolved.width,height:resolved.height,status:this.decorations?.[n.id]?.status})})),edges:Object.freeze(this.edges.map(e=>Object.freeze({id:e.id,source:e.source,target:e.target,status:this.decorations?.[e.id]?.status}))),viewport:Object.freeze({x:this.panX,y:this.panY,zoom:this.zoomLevel,width:rect?.width??0,height:rect?.height??0,minZoom:bounds.min,maxZoom:bounds.max}),locked:this.locked,orientation:this.orientation,layerGap:this.safeLayerGap,nodeGap:this.safeNodeGap})}clampZoom(z){const{min,max}=this.effectiveZoomBounds;return finiteRange(z,1,min,max)}applyWorldTransform(){this.worldEl&&(this.worldEl.style.transform=`translate(${this.panX}px, ${this.panY}px) scale(${this.zoomLevel})`),this.scheduleCompanionNotify()}scheduleViewportChange(){this.viewportChangeRaf==null&&(this.viewportChangeRaf=this.requestOwnerAnimationFrame(()=>{this.viewportChangeRaf=null,this.emit("lr-viewport-change",Object.freeze({x:this.panX,y:this.panY,zoom:this.zoomLevel}))}))}zoomAtCenter(nextZoom){const rect=this.viewportEl?.getBoundingClientRect();this.zoomAtPoint(rect?rect.width/2:0,rect?rect.height/2:0,nextZoom)}zoomAtPoint(localX,localY,nextZoom){const clamped=this.clampZoom(nextZoom);if(clamped===this.zoomLevel)return;const contentX=(localX-this.panX)/this.zoomLevel,contentY=(localY-this.panY)/this.zoomLevel;this.panX=localX-contentX*clamped,this.panY=localY-contentY*clamped,this.zoomLevel=clamped,this.applyWorldTransform(),this.scheduleViewportChange()}localWorldX(clientX,rect,rtl=isRtl(this)){const local=clientX-rect.left;return this.orientation==="horizontal"&&rtl?rect.width-local:local}endBackgroundPan(rollback){const drag=this.panDrag;drag&&(this.panDrag=void 0,this.viewportEl?.removeAttribute("data-panning"),this.connectedWindow?.removeEventListener("pointermove",this.onBackgroundPointerMove),this.connectedWindow?.removeEventListener("pointerup",this.onBackgroundPointerUp),this.connectedWindow?.removeEventListener("pointercancel",this.onBackgroundPointerUp),this.connectedWindow?.removeEventListener("lostpointercapture",this.onBackgroundPointerUp),rollback&&(this.panX!==drag.startPanX||this.panY!==drag.startPanY)&&(this.panX=drag.startPanX,this.panY=drag.startPanY,this.applyWorldTransform(),this.scheduleViewportChange()))}panBy(dx,dy){this.panX+=dx,this.panY+=dy,this.applyWorldTransform(),this.scheduleViewportChange()}spatialNodeOrder(){const horizontal=this.orientation==="horizontal";return[...this.nodes].sort((a,b)=>{const pa=this.resolvedNode(a),pb=this.resolvedNode(b),mainA=horizontal?pa.x:pa.y,mainB=horizontal?pb.x:pb.y;if(mainA!==mainB)return mainA-mainB;const crossA=horizontal?pa.y:pa.x,crossB=horizontal?pb.y:pb.x;return crossA-crossB})}focusableEdges(){const nodeIds=new Set(this.nodes.map(n=>n.id));return this.edges.filter(e=>nodeIds.has(e.source)&&nodeIds.has(e.target))}rovingItems(){return[...this.spatialNodeOrder().map(n=>({kind:"node",id:n.id})),...this.focusableEdges().map(e=>({kind:"edge",id:e.id}))]}itemCount(){return this.nodes.length+this.focusableEdges().length}normalizedItemIndex(index=this.activeItemIndex){const count=this.itemCount();return count?Math.min(Math.max(index,0),count-1):-1}itemAccessibleText(item){if(item.kind==="node"){const node=this.nodes.find(n=>n.id===item.id);return node?this.nodeAccessibleText(node):""}const edge=this.edges.find(e=>e.id===item.id);return edge?this.edgeAccessibleText(edge):""}spatialItemIndex(kind,id){return this.rovingItems().findIndex(it=>it.kind===kind&&it.id===id)}announceItem(index){const item=this.rovingItems()[index];item&&this.announcer.announce(this.localize("flowItemAnnouncement",void 0,{item:this.itemAccessibleText(item),index:this.formatNumber(index+1),total:this.formatNumber(this.itemCount())}))}formatNumber(value){return getNumberFormat(this.effectiveLocale).format(value)}onItemFocus(index){this.normalizedItemIndex(index)<0||(this.activeItemIndex=index,this.announceItem(index))}renderedElementByDataId(attribute,id){const renderRoot=this.renderRoot;if(!renderRoot)return null;const ownerCss=this.ownerDocument?.defaultView?.CSS,escape=ownerCss?.escape;if(typeof escape=="function")try{const match=renderRoot.querySelector(`[${attribute}="${escape.call(ownerCss,id)}"]`);if(match)return match}catch{}return[...renderRoot.querySelectorAll(`[${attribute}]`)].find(candidate=>candidate.getAttribute(attribute)===id)??null}renderedNodeById(id){return this.renderedElementByDataId("data-node-id",id)}renderedEdgeById(id){return this.renderedElementByDataId("data-edge-id",id)}focusActiveItem(index=this.activeItemIndex){const normalized=this.normalizedItemIndex(index);if(normalized<0)return;this.activeItemIndex=normalized,this.announceItem(normalized);const item=this.rovingItems()[normalized];item&&this.updateComplete.then(()=>{(item.kind==="node"?this.renderedNodeById(item.id)?.querySelector('[part="node-control"]'):this.renderedEdgeById(item.id)?.querySelector('[part="edge"]'))?.focus()})}applySelection(kind,id,additive){kind==="node"?(this.selectedNodeIds=additive?toggledSelection(this.selectedNodeIds,id):[id],additive||(this.selectedEdgeIds=[])):(this.selectedEdgeIds=additive?toggledSelection(this.selectedEdgeIds,id):[id],additive||(this.selectedNodeIds=[])),this.emit("lr-selection-change",Object.freeze({nodeIds:Object.freeze([...this.selectedNodeIds]),edgeIds:Object.freeze([...this.selectedEdgeIds])}));const selected=kind==="node"?this.selectedNodeIds.includes(id):this.selectedEdgeIds.includes(id),label=this.itemAccessibleText({kind,id});this.announcer.announce(this.localize(selected?"flowNodeSelected":"flowNodeDeselected",void 0,{label}))}clearSelection(){this.selectedNodeIds.length===0&&this.selectedEdgeIds.length===0||(this.selectedNodeIds=[],this.selectedEdgeIds=[],this.emit("lr-selection-change",Object.freeze({nodeIds:Object.freeze([]),edgeIds:Object.freeze([])})),this.announcer.announce(this.localize("flowSelectionCleared")))}deleteSelection(){!this.nodesDraggable&&!this.connectable&&!this.droppable||this.selectedNodeIds.length===0&&this.selectedEdgeIds.length===0||this.emit("lr-selection-delete",Object.freeze({nodeIds:Object.freeze([...this.selectedNodeIds]),edgeIds:Object.freeze([...this.selectedEdgeIds])}))}onNodeActivate(node,additive){this.emit("lr-node-activate",Object.freeze({nodeId:node.id})),this.applySelection("node",node.id,additive)}onNodeClick(event,node){const currentTarget=event.currentTarget;for(const entry of event.composedPath()){if(entry===currentTarget)break;if(entry&&typeof entry=="object"&&entry.nodeType===1&&isActionableElement(entry)){event.stopPropagation();return}}this.onNodeActivate(node,event.ctrlKey||event.metaKey)}onEdgeActivate(edge,additive){this.emit("lr-edge-activate",Object.freeze({edgeId:edge.id,source:edge.source,target:edge.target})),this.applySelection("edge",edge.id,additive)}onItemKeyDown(e,index,activate){const arrowKeys=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"];if(this.nodesDraggable&&!this.locked&&(e.ctrlKey||e.metaKey)&&arrowKeys.includes(e.key)){const item=this.rovingItems()[index];if(item?.kind==="node"){e.preventDefault(),this.nudgeNode(item.id,e.key);return}}if(this.keyboardConnectSourceId){if(e.key==="Escape"){e.preventDefault(),this.cancelKeyboardConnect();return}if(e.key==="Enter"){e.preventDefault(),this.commitKeyboardConnect();return}const rtlForConnect=isRtl(this),forwardConnectKey=rtlForConnect?"ArrowLeft":"ArrowRight",backwardConnectKey=rtlForConnect?"ArrowRight":"ArrowLeft";if(e.key===forwardConnectKey||e.key==="ArrowDown"){e.preventDefault(),this.cycleKeyboardConnectTarget(1);return}if(e.key===backwardConnectKey||e.key==="ArrowUp"){e.preventDefault(),this.cycleKeyboardConnectTarget(-1);return}return}if(this.connectable&&!this.locked&&e.key==="c"&&e.target===e.currentTarget){const item=this.rovingItems()[index];if(item?.kind==="node"){e.preventDefault(),this.startKeyboardConnect(item.id);return}}if(e.key==="Enter"||e.key===" "){e.preventDefault(),this.setActiveItemQuiet(index),activate(e.ctrlKey||e.metaKey);return}if(e.key==="Escape"){e.preventDefault(),e.target!==e.currentTarget?e.currentTarget.focus():this.clearSelection();return}if((e.key==="Delete"||e.key==="Backspace")&&e.target===e.currentTarget){e.preventDefault(),this.deleteSelection();return}const count=this.itemCount();if(!count)return;const rtl=isRtl(this),forwardKey=rtl?"ArrowLeft":"ArrowRight",backwardKey=rtl?"ArrowRight":"ArrowLeft";let next=index;if(e.key===forwardKey||e.key==="ArrowDown")next=Math.min(count-1,index+1);else if(e.key===backwardKey||e.key==="ArrowUp")next=Math.max(0,index-1);else if(e.key==="Home")next=0;else if(e.key==="End")next=count-1;else return;e.preventDefault(),this.focusActiveItem(next)}setActiveItemQuiet(index){const normalized=this.normalizedItemIndex(index);normalized>=0&&(this.activeItemIndex=normalized)}itemIndexMaps(){const items=this.rovingItems(),nodeIndex=new Map,edgeIndex=new Map;return items.forEach((item,i)=>{item.kind==="node"?nodeIndex.set(item.id,i):edgeIndex.set(item.id,i-nodeIndex.size)}),{nodeIndex,edgeIndex}}snap(value){const grid=this.safeGrid;return grid>0?Math.round(value/grid)*grid:value}rebuildIncidentEdgesIndex(){const map=new Map;for(const edge of this.edges)(map.get(edge.source)??map.set(edge.source,[]).get(edge.source)).push(edge.id),edge.target!==edge.source&&(map.get(edge.target)??map.set(edge.target,[]).get(edge.target)).push(edge.id);this.nodeIncidentEdges=map}buildDragEdgeRefs(nodeId){const refs=[];for(const edgeId of this.nodeIncidentEdges.get(nodeId)??[]){const edge=this.edges.find(e=>e.id===edgeId),sourceNode=edge&&this.nodes.find(n=>n.id===edge.source),targetNode=edge&&this.nodes.find(n=>n.id===edge.target);if(!edge||!sourceNode||!targetNode)continue;const group=this.renderedEdgeById(edgeId);refs.push({edge,sourceNode,targetNode,pathEl:group?.querySelector('[part="edge"]')??null,labelEl:group?.querySelector('[part="edge-label"]')??null})}return refs}updateIncidentEdges(nodeId,x,y){for(const{edge,sourceNode,targetNode,pathEl,labelEl}of this.dragEdgeRefs??[]){const sourceResolved=edge.source===nodeId?{...this.resolvedNode(sourceNode),x,y}:this.resolvedNode(sourceNode),targetResolved=edge.target===nodeId?{...this.resolvedNode(targetNode),x,y}:this.resolvedNode(targetNode),sourcePt=this.handlePoint(sourceResolved,"output",edge.sourceHandle??"out"),targetPt=this.handlePoint(targetResolved,"input",edge.targetHandle??"in");if(pathEl?.setAttribute("d",this.edgePathD(sourcePt,targetPt)),labelEl){const midX=(sourcePt.x+targetPt.x)/2;labelEl.setAttribute("x",String(midX)),labelEl.setAttribute("y",String((sourcePt.y+targetPt.y)/2)),this.orientation==="horizontal"&&isRtl(this)?labelEl.setAttribute("transform",`translate(${2*midX} 0) scale(-1 1)`):labelEl.removeAttribute("transform")}}}onNodePointerDown(e,node){if(!this.nodesDraggable||this.locked)return;const wrapper=e.currentTarget,interactive=e.target.closest('button, a[href], input, select, textarea, [role="button"], [tabindex]:not([part="node"])');if(interactive&&interactive!==wrapper&&wrapper.contains(interactive))return;e.stopPropagation();const start=this.nodePosition(node);this.nodeDrag={pointerId:e.pointerId,nodeId:node.id,startClientX:e.clientX,startClientY:e.clientY,startX:start.x,startY:start.y,wrapper,rtlFlip:this.orientation==="horizontal"&&isRtl(this)?-1:1},this.dragEdgeRefs=this.buildDragEdgeRefs(node.id),wrapper.setPointerCapture?.(e.pointerId),this.connectedWindow?.addEventListener("pointermove",this.onNodePointerMove),this.connectedWindow?.addEventListener("pointerup",this.onNodePointerUp),this.connectedWindow?.addEventListener("pointercancel",this.onNodePointerUp),this.connectedWindow?.addEventListener("lostpointercapture",this.onNodePointerUp)}endNodeDrag(commit){const drag=this.nodeDrag;if(!drag)return;this.nodeDrag=void 0,this.connectedWindow?.removeEventListener("pointermove",this.onNodePointerMove),this.connectedWindow?.removeEventListener("pointerup",this.onNodePointerUp),this.connectedWindow?.removeEventListener("pointercancel",this.onNodePointerUp),this.connectedWindow?.removeEventListener("lostpointercapture",this.onNodePointerUp);const previous={x:drag.startX,y:drag.startY},position={x:drag.currentX??drag.startX,y:drag.currentY??drag.startY};commit&&this.nodesDraggable&&this.nodes.some(node=>node.id===drag.nodeId)&&(position.x!==previous.x||position.y!==previous.y)&&this.emit("lr-node-move",Object.freeze({nodeId:drag.nodeId,position:Object.freeze(position),previous:Object.freeze(previous)}));const resetNode=this.nodes.find(n=>n.id===drag.nodeId),resetPos=resetNode?this.nodePosition(resetNode):previous;drag.wrapper.style.transform=`translate(${resetPos.x}px, ${resetPos.y}px)`,this.updateIncidentEdges(drag.nodeId,resetPos.x,resetPos.y),this.dragEdgeRefs=void 0,this.requestUpdate()}nudgeNode(nodeId,key){const node=this.nodes.find(n=>n.id===nodeId);if(!node)return;const current=this.nodePosition(node),step=this.safeGrid>0?this.safeGrid:1,rtlFlip=this.orientation==="horizontal"&&isRtl(this)?-1:1;let dx=0,dy=0;key==="ArrowRight"?dx=step*rtlFlip:key==="ArrowLeft"?dx=-step*rtlFlip:key==="ArrowDown"?dy=step:key==="ArrowUp"&&(dy=-step);const position={x:current.x+dx,y:current.y+dy};this.emit("lr-node-move",Object.freeze({nodeId,position:Object.freeze(position),previous:Object.freeze(current)})),this.announcer.announce(this.localize("flowNodeMoved",void 0,{label:this.nodeAccessibleText(node),x:this.formatNumber(position.x),y:this.formatNumber(position.y)})),this.requestUpdate()}nodeIdFromComposedPath(path){for(const el of path)if(isHtmlElement(el)&&el.getAttribute("part")==="node"&&el.dataset.nodeId)return el.dataset.nodeId;return null}isInvalidConnectTarget(hoveredId){return this.connectState?hoveredId===this.connectState.sourceId?!0:this.edges.some(e=>e.source===this.connectState.sourceId&&e.target===hoveredId):!1}startConnectGesture(nodeId,handleId,clientX,clientY){const sourceNode=this.nodes.find(n=>n.id===nodeId);if(!sourceNode)return;const startPt=this.handlePoint(this.resolvedNode(sourceNode),"output",handleId);this.connectState={sourceId:nodeId,sourceHandle:handleId,startPt,rect:this.viewportEl?.getBoundingClientRect()??null,rtl:isRtl(this)},this.connecting=!0,this.announcer.announce(this.localize("flowConnectStarted",void 0,{label:this.nodeAccessibleText(sourceNode)})),this.updateComplete.then(()=>{this.connectionLineEl=this.renderRoot.querySelector('[part="connection-line"]')??void 0,this.connectionLineEl?.setAttribute("d",this.edgePathD(startPt,this.connectContentPoint(clientX,clientY)))}),this.connectedWindow?.addEventListener("pointermove",this.onConnectPointerMove),this.connectedWindow?.addEventListener("pointerup",this.onConnectPointerUp),this.connectedWindow?.addEventListener("pointercancel",this.onConnectPointerCancel),this.connectedWindow?.addEventListener("lostpointercapture",this.onConnectPointerCancel)}connectContentPoint(clientX,clientY){const state2=this.connectState;if(!state2?.rect)return{x:0,y:0};const localX=this.localWorldX(clientX,state2.rect,state2.rtl),localY=clientY-state2.rect.top;return{x:(localX-this.panX)/this.zoomLevel,y:(localY-this.panY)/this.zoomLevel}}isInvalidConnectTargetFor(state2,hoveredId){return hoveredId===state2.sourceId?!0:this.edges.some(e=>e.source===state2.sourceId&&e.target===hoveredId)}endConnectGesture(){this.connectInvalidNodeId&&(this.renderedNodeById(this.connectInvalidNodeId)?.removeAttribute("data-connect-invalid"),this.connectInvalidNodeId=null),this.connectState=void 0,this.connecting=!1,this.connectedWindow?.removeEventListener("pointermove",this.onConnectPointerMove),this.connectedWindow?.removeEventListener("pointerup",this.onConnectPointerUp),this.connectedWindow?.removeEventListener("pointercancel",this.onConnectPointerCancel),this.connectedWindow?.removeEventListener("lostpointercapture",this.onConnectPointerCancel)}cancelActiveGestures(){this.endBackgroundPan(!0),this.cancelModelBoundGestures(),this.viewportEl?.removeAttribute("data-drop-active")}cancelModelBoundGestures(){this.endNodeDrag(!1),this.onConnectPointerCancel(),this.keyboardConnectSourceId=null,this.keyboardConnectTargetIndex=0}eligibleConnectTargets(sourceId){return this.nodes.filter(n=>n.id!==sourceId&&!this.edges.some(e=>e.source===sourceId&&e.target===n.id))}startKeyboardConnect(sourceId){if(this.eligibleConnectTargets(sourceId).length===0)return;const sourceNode=this.nodes.find(n=>n.id===sourceId);this.keyboardConnectSourceId=sourceId,this.keyboardConnectTargetIndex=0,sourceNode&&this.announceKeyboardConnectTarget()}cycleKeyboardConnectTarget(direction){if(!this.keyboardConnectSourceId)return;const targets=this.eligibleConnectTargets(this.keyboardConnectSourceId);targets.length!==0&&(this.keyboardConnectTargetIndex=(this.keyboardConnectTargetIndex+direction+targets.length)%targets.length,this.announceKeyboardConnectTarget())}announceKeyboardConnectTarget(){const sourceId=this.keyboardConnectSourceId;if(!sourceId)return;const source=this.nodes.find(node=>node.id===sourceId),targets=this.eligibleConnectTargets(sourceId),target=targets[this.keyboardConnectTargetIndex];!source||!target||this.announcer.announce(this.localize("flowConnectTarget",void 0,{source:this.nodeAccessibleText(source),target:this.nodeAccessibleText(target),index:this.formatNumber(this.keyboardConnectTargetIndex+1),total:this.formatNumber(targets.length)}))}isKeyboardConnectTarget(nodeId){return this.keyboardConnectSourceId?this.eligibleConnectTargets(this.keyboardConnectSourceId)[this.keyboardConnectTargetIndex]?.id===nodeId:!1}commitKeyboardConnect(){const sourceId=this.keyboardConnectSourceId;if(!sourceId)return;const target=this.eligibleConnectTargets(sourceId)[this.keyboardConnectTargetIndex];if(this.keyboardConnectSourceId=null,!target)return;const sourceOutputs=this.nodes.find(n=>n.id===sourceId)?.outputs??[{id:"out"}],targetInputs=target.inputs??[{id:"in"}];if(!this.connectable||this.locked)return;this.emit("lr-connect",Object.freeze({source:sourceId,target:target.id,sourceHandle:sourceOutputs[0]?.id??"out",targetHandle:targetInputs[0]?.id??"in"}));const source=this.nodes.find(node=>node.id===sourceId);this.announcer.announce(this.localize("flowConnectCommitted",void 0,{source:source?this.nodeAccessibleText(source):sourceId,target:this.nodeAccessibleText(target)}))}cancelKeyboardConnect(){this.keyboardConnectSourceId&&(this.keyboardConnectSourceId=null,this.announcer.announce(this.localize("flowConnectCancelled")))}statusTone(status){return status==="running"?"brand":status==="success"?"success":status==="error"?"danger":status==="denied"?"warning":"neutral"}edgeTone(edge){const decoration=this.decorations?.[edge.id];return decoration?this.statusTone(decoration.status):edge.tone??"neutral"}edgeIsRunning(edge){return this.decorations?.[edge.id]?.status==="running"}renderEdges(nodeIndex,edgeIndex){const resolvedById=new Map(this.nodes.map(n=>[n.id,this.resolvedNode(n)])),items=[],ownerWindow=this.ownerDocument?.defaultView,reducedMotion=!ownerWindow||prefersReducedMotion(ownerWindow),counterMirrorLabels=this.orientation==="horizontal"&&!!this.ownerDocument?.defaultView&&isRtl(this);for(const edge of this.edges){const sourceResolved=resolvedById.get(edge.source);if(!sourceResolved)continue;const targetResolved=resolvedById.get(edge.target),sourcePt=this.handlePoint(sourceResolved,"output",edge.sourceHandle??"out");if(!targetResolved){const stubPt={x:sourcePt.x+14,y:sourcePt.y+14};items.push(svg`<line
1
+ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3?target:desc===null?desc=Object.getOwnPropertyDescriptor(target,key):desc,d;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;i>=0;i--)(d=decorators[i])&&(r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r);return c>3&&r&&Object.defineProperty(target,key,r),r};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{nextId,srOnly}from"../../../internal/a11y.js";import{acquireAnnouncementSink,Announcer}from"../../../internal/announcer.js";import{isRtl}from"../../../internal/rtl.js";import{prefersReducedMotion}from"../../../internal/motion.js";import{layeredLayout}from"../../../internal/layered-layout.js";import{getNumberFormat}from"../../../internal/intl-cache.js";import{finiteNumber,finiteRange}from"../../../internal/numbers.js";import{isActionableElement}from"../../../internal/focus-navigation.js";import{resolveCssLength}from"../../../internal/css-length.js";import{devWarnOnce}from"../../../internal/dev-mode-attribute-warning.js";import{tag}from"../../../internal/prefix.js";import{snapshotFlowDecorations,snapshotFlowEdges,snapshotFlowNodes,MAX_FLOW_COLLECTION_ENTRIES}from"./flow-model.js";import{FLOW_PALETTE_MIME_TYPE}from"./flow-types.js";import{styles}from"./flow-canvas.styles.js";import{LYRA_DEFAULT_flowCanvasLabel,LYRA_DEFAULT_flowCanvasLayoutLimit,LYRA_DEFAULT_flowCanvasSummary,LYRA_DEFAULT_flowConnectCancelled,LYRA_DEFAULT_flowConnectCommitted,LYRA_DEFAULT_flowConnectStarted,LYRA_DEFAULT_flowConnectTarget,LYRA_DEFAULT_flowEdge,LYRA_DEFAULT_flowEdgeList,LYRA_DEFAULT_flowEdgeWithLabel,LYRA_DEFAULT_flowItemAnnouncement,LYRA_DEFAULT_flowNode,LYRA_DEFAULT_flowNodeDeselected,LYRA_DEFAULT_flowNodeMoved,LYRA_DEFAULT_flowNodeSelected,LYRA_DEFAULT_flowSelectionCleared,LYRA_DEFAULT_noData}from"../../../internal/default-strings.generated.js";export*from"./flow-types.js";const FLOW_EDGE_TONES=["neutral","brand","success","warning","danger"],CONNECT_OFFSET_MIN=24,CONNECT_OFFSET_MAX=120,ZOOM_MULTIPLIER=1.2,DEFAULT_FIT_PADDING=24,KEYBOARD_PAN_STEP=32,UNMATCHED_AUTHORED_CARD_WARNING="lyra-flow-canvas-unmatched-authored-card";function toggledSelection(list,id){return list.includes(id)?list.filter(x=>x!==id):[...list,id]}function nodeTypePart(type){if(!type)return null;const normalized=type.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"");return normalized?`node-type-${/^\d/.test(normalized)?`type-${normalized}`:normalized}`:null}function isHtmlElement(value){if(typeof value!="object"||value===null)return!1;const element=value;return element.nodeType===1&&element.namespaceURI==="http://www.w3.org/1999/xhtml"}class LyraFlowCanvas extends LyraElement{constructor(){super(...arguments),this._nodes=Object.freeze([]),this._edges=Object.freeze([]),this._orientation="horizontal",this.nodesDraggable=!1,this.connectable=!1,this.droppable=!1,this.locked=!1,this._selectedNodeIds=Object.freeze([]),this._selectedEdgeIds=Object.freeze([]),this.minZoom=.25,this.maxZoom=2,this.grid=8,this.layerGap=64,this.nodeGap=24,this._decorations=null,this.accessibleLabel=null,this.arrowMarkerIds={neutral:nextId("flow-canvas-arrow-neutral"),brand:nextId("flow-canvas-arrow-brand"),success:nextId("flow-canvas-arrow-success"),warning:nextId("flow-canvas-arrow-warning"),danger:nextId("flow-canvas-arrow-danger")},this.liveRegionId=nextId("flow-canvas-live"),this.announcer=new Announcer({onFlush:text=>{this.liveText=text,this.announcementSink?.announce(text)}}),this.liveText="",this.activeItemIndex=0,this.connecting=!1,this.layoutTruncated=!1,this.hasConnectedLayoutBaseline=!1,this.layoutLimitAnnouncementPending=!1,this.keyboardConnectSourceId=null,this.keyboardConnectTargetIndex=0,this.autoPositions=new Map,this.measuredSizes=new Map,this.observedNodeEls=new Set,this.authoredCardObserverGeneration=0,this.authoredCardSyncQueued=!1,this.authoredCardSlotLeases=new Map,this.layoutRaf=null,this.panX=0,this.panY=0,this.zoomLevel=1,this.viewportChangeRaf=null,this.hasFitOnce=!1,this.wheelMeasure=null,this.wheelMeasureRaf=null,this.nodeIncidentEdges=new Map,this.connectInvalidNodeId=null,this.companionCallbacks=new Set,this.companionRaf=null,this.onWheel=e=>{if(this.locked||!this.viewportEl)return;e.preventDefault(),this.wheelMeasure||(this.wheelMeasure={rect:this.viewportEl.getBoundingClientRect(),rtl:isRtl(this)},this.wheelMeasureRaf=this.requestOwnerAnimationFrame(()=>{this.wheelMeasure=null,this.wheelMeasureRaf=null}));const{rect,rtl}=this.wheelMeasure,localX=this.localWorldX(e.clientX,rect,rtl),localY=e.clientY-rect.top,factor=e.deltaY<0?ZOOM_MULTIPLIER:1/ZOOM_MULTIPLIER;this.zoomAtPoint(localX,localY,this.zoomLevel*factor)},this.onBackgroundPointerDown=e=>{this.locked||(this.panDrag={pointerId:e.pointerId,startClientX:e.clientX,startClientY:e.clientY,startPanX:this.panX,startPanY:this.panY,rtlFlip:this.orientation==="horizontal"&&isRtl(this)?-1:1},e.target.setPointerCapture?.(e.pointerId),this.viewportEl?.setAttribute("data-panning",""),this.connectedWindow?.addEventListener("pointermove",this.onBackgroundPointerMove),this.connectedWindow?.addEventListener("pointerup",this.onBackgroundPointerUp),this.connectedWindow?.addEventListener("pointercancel",this.onBackgroundPointerUp),this.connectedWindow?.addEventListener("lostpointercapture",this.onBackgroundPointerUp))},this.onBackgroundPointerMove=e=>{const drag=this.panDrag;if(!(!drag||e.pointerId!==drag.pointerId)){if(this.locked){this.endBackgroundPan(!0);return}this.panX=drag.startPanX+(e.clientX-drag.startClientX)*drag.rtlFlip,this.panY=drag.startPanY+(e.clientY-drag.startClientY),this.applyWorldTransform(),this.scheduleViewportChange()}},this.onBackgroundPointerUp=e=>{!this.panDrag||e.pointerId!==this.panDrag.pointerId||this.endBackgroundPan(this.locked||e.type!=="pointerup")},this.onViewportKeyDown=e=>{if(!(e.target!==this.viewportEl||this.locked))if(e.key==="+"||e.key==="=")e.preventDefault(),this.zoomIn();else if(e.key==="-"||e.key==="_")e.preventDefault(),this.zoomOut();else if(e.key==="0")e.preventDefault(),this.resetZoom();else if(e.key==="ArrowRight"){e.preventDefault();const rtlFlip=this.orientation==="horizontal"&&isRtl(this)?-1:1;this.panBy(-KEYBOARD_PAN_STEP*rtlFlip,0)}else if(e.key==="ArrowLeft"){e.preventDefault();const rtlFlip=this.orientation==="horizontal"&&isRtl(this)?-1:1;this.panBy(KEYBOARD_PAN_STEP*rtlFlip,0)}else e.key==="ArrowDown"?(e.preventDefault(),this.panBy(0,-KEYBOARD_PAN_STEP)):e.key==="ArrowUp"&&(e.preventDefault(),this.panBy(0,KEYBOARD_PAN_STEP))},this.onViewportDragOver=e=>{!this.droppable||this.locked||e.dataTransfer?.types.includes(FLOW_PALETTE_MIME_TYPE)&&(e.preventDefault(),e.dataTransfer.dropEffect="copy",this.viewportEl?.setAttribute("data-drop-active",""))},this.onViewportDragLeave=()=>{this.viewportEl?.removeAttribute("data-drop-active")},this.onViewportDrop=e=>{if(this.viewportEl?.removeAttribute("data-drop-active"),!this.droppable||this.locked)return;const raw=e.dataTransfer?.getData(FLOW_PALETTE_MIME_TYPE);if(!raw)return;e.preventDefault();const maxPayloadBytes=4096;if(raw.length>maxPayloadBytes)return;const TextEncoderCtor=this.ownerDocument.defaultView?.TextEncoder??globalThis.TextEncoder;if(TextEncoderCtor&&new TextEncoderCtor().encode(raw).byteLength>maxPayloadBytes)return;let payload;try{payload=JSON.parse(raw)}catch{return}if(typeof payload!="object"||payload===null||Array.isArray(payload)||Object.getPrototypeOf(payload)!==Object.prototype&&Object.getPrototypeOf(payload)!==null)return;const rawType=payload.type;if(typeof rawType!="string")return;const type=rawType.trim();if(!type||type.length>128)return;const contentPoint=this.toContentPoint(e.clientX,e.clientY);this.emit("lr-node-add",Object.freeze({type,position:Object.freeze({x:this.snap(contentPoint.x),y:this.snap(contentPoint.y)})}))},this.onNodePointerMove=e=>{const drag=this.nodeDrag;if(!drag||e.pointerId!==drag.pointerId)return;if(this.locked||!this.nodesDraggable){this.endNodeDrag(!1);return}const dx=(e.clientX-drag.startClientX)*drag.rtlFlip/this.zoomLevel,dy=(e.clientY-drag.startClientY)/this.zoomLevel,x=this.snap(drag.startX+dx),y=this.snap(drag.startY+dy);drag.wrapper.style.transform=`translate(${x}px, ${y}px)`,this.updateIncidentEdges(drag.nodeId,x,y),drag.currentX=x,drag.currentY=y},this.onNodePointerUp=e=>{const drag=this.nodeDrag;!drag||e.pointerId!==drag.pointerId||this.endNodeDrag(!this.locked&&e.type==="pointerup")},this.onWorldPointerDown=e=>{if(!this.connectable||this.locked||this.connectState)return;const path=e.composedPath(),handleEl=path.find(el=>isHtmlElement(el)&&el.dataset.handleKind==="output");if(!handleEl)return;const nodeId=this.nodeIdFromComposedPath(path),handleId=handleEl.dataset.handleId;!nodeId||!handleId||(e.stopPropagation(),this.startConnectGesture(nodeId,handleId,e.clientX,e.clientY))},this.onConnectPointerMove=e=>{if(!this.connectState)return;if(this.locked||!this.connectable){this.onConnectPointerCancel();return}const targetPt=this.connectContentPoint(e.clientX,e.clientY);this.connectionLineEl?.setAttribute("d",this.edgePathD(this.connectState.startPt,targetPt));const hoveredId=this.nodeIdFromComposedPath(e.composedPath()),invalid=hoveredId!=null&&this.isInvalidConnectTarget(hoveredId);this.connectInvalidNodeId&&this.connectInvalidNodeId!==(invalid?hoveredId:null)&&this.renderedNodeById(this.connectInvalidNodeId)?.removeAttribute("data-connect-invalid"),this.connectInvalidNodeId=invalid?hoveredId:null,invalid&&this.renderedNodeById(hoveredId)?.setAttribute("data-connect-invalid","")},this.onConnectPointerUp=e=>{if(!this.connectState)return;if(this.locked||!this.connectable){this.onConnectPointerCancel();return}const state2=this.connectState,path=e.composedPath(),targetNodeId=this.nodeIdFromComposedPath(path);if(this.endConnectGesture(),!targetNodeId||this.isInvalidConnectTargetFor(state2,targetNodeId)){this.announcer.announce(this.localize("flowConnectCancelled"));return}const targetHandle=path.find(el=>isHtmlElement(el)&&el.dataset.handleKind==="input")?.dataset.handleId??"in";this.emit("lr-connect",Object.freeze({source:state2.sourceId,target:targetNodeId,sourceHandle:state2.sourceHandle,targetHandle}));const sourceNode=this.nodes.find(node=>node.id===state2.sourceId),targetNode=this.nodes.find(node=>node.id===targetNodeId);this.announcer.announce(this.localize("flowConnectCommitted",void 0,{source:sourceNode?this.nodeAccessibleText(sourceNode):state2.sourceId,target:targetNode?this.nodeAccessibleText(targetNode):targetNodeId}))},this.onConnectPointerCancel=()=>{this.connectState&&(this.endConnectGesture(),this.announcer.announce(this.localize("flowConnectCancelled")))}}static{this.defaultStrings={...super.defaultStrings,flowCanvasLabel:LYRA_DEFAULT_flowCanvasLabel,flowCanvasLayoutLimit:LYRA_DEFAULT_flowCanvasLayoutLimit,flowCanvasSummary:LYRA_DEFAULT_flowCanvasSummary,flowConnectCancelled:LYRA_DEFAULT_flowConnectCancelled,flowConnectCommitted:LYRA_DEFAULT_flowConnectCommitted,flowConnectStarted:LYRA_DEFAULT_flowConnectStarted,flowConnectTarget:LYRA_DEFAULT_flowConnectTarget,flowEdge:LYRA_DEFAULT_flowEdge,flowEdgeList:LYRA_DEFAULT_flowEdgeList,flowEdgeWithLabel:LYRA_DEFAULT_flowEdgeWithLabel,flowItemAnnouncement:LYRA_DEFAULT_flowItemAnnouncement,flowNode:LYRA_DEFAULT_flowNode,flowNodeDeselected:LYRA_DEFAULT_flowNodeDeselected,flowNodeMoved:LYRA_DEFAULT_flowNodeMoved,flowNodeSelected:LYRA_DEFAULT_flowNodeSelected,flowSelectionCleared:LYRA_DEFAULT_flowSelectionCleared,noData:LYRA_DEFAULT_noData}}static{this.styles=[LyraElement.styles,styles,srOnly]}get nodes(){return this._nodes}set nodes(value){const previous=this._nodes;this._nodes=snapshotFlowNodes(value),this.requestUpdate("nodes",previous)}get edges(){return this._edges}set edges(value){const previous=this._edges;this._edges=snapshotFlowEdges(value),this.requestUpdate("edges",previous)}get orientation(){return this._orientation}set orientation(value){const previous=this._orientation,next=value==="vertical"?"vertical":"horizontal";this._orientation=next,(next!==previous||value!==next)&&this.requestUpdate("orientation",previous)}get selectedNodeIds(){return this._selectedNodeIds}set selectedNodeIds(value){const previous=this._selectedNodeIds;this._selectedNodeIds=this.snapshotSelectedIds(value,new Set(this.nodes.map(node=>node.id))),this.requestUpdate("selectedNodeIds",previous)}get selectedEdgeIds(){return this._selectedEdgeIds}set selectedEdgeIds(value){const previous=this._selectedEdgeIds;this._selectedEdgeIds=this.snapshotSelectedIds(value,new Set(this.edges.map(edge=>edge.id))),this.requestUpdate("selectedEdgeIds",previous)}snapshotSelectedIds(value,validIds){if(!Array.isArray(value))return Object.freeze([]);const selected=[],seen=new Set;for(const candidate of value.slice(0,MAX_FLOW_COLLECTION_ENTRIES))typeof candidate!="string"||candidate.trim().length===0||!validIds.has(candidate)||seen.has(candidate)||(seen.add(candidate),selected.push(candidate));return Object.freeze(selected)}get decorations(){return this._decorations}set decorations(value){const previous=this._decorations;this._decorations=value==null?null:snapshotFlowDecorations(value),this.requestUpdate("decorations",previous)}get safeMinZoom(){return finiteRange(this.minZoom,.25,.001,1e3)}get safeMaxZoom(){return finiteRange(this.maxZoom,2,.001,1e3)}get effectiveZoomBounds(){return{min:Math.min(this.safeMinZoom,this.safeMaxZoom),max:Math.max(this.safeMinZoom,this.safeMaxZoom)}}get safeGrid(){return finiteRange(this.grid,8,0)}get safeLayerGap(){return finiteRange(this.layerGap,64,0)}get safeNodeGap(){return finiteRange(this.nodeGap,24,0)}connectedCallback(){super.connectedCallback();const ownerWindow=this.ownerDocument.defaultView;this.connectedWindow=ownerWindow??void 0,ownerWindow&&this.announcer.setTimerHost(ownerWindow),this.syncAnnouncementSink();const ResizeObserverCtor=ownerWindow?.ResizeObserver;this.resizeObserver=ResizeObserverCtor?new ResizeObserverCtor(entries=>this.onNodesResized(entries)):void 0,this.bindAuthoredCardObserver(),this.syncAuthoredCards(),this.pushCardPropsAll(),this.hasUpdated&&(this.observeNodeWrappers(),this.nodes.length>0&&this.scheduleLayoutPass())}disconnectedCallback(){super.disconnectedCallback(),this.resetAuthoredCardObserver(),this.restoreAuthoredCardSlots(),this.hasConnectedLayoutBaseline=!1,this.layoutLimitAnnouncementPending=!1,this.announcer.cancel(),this.releaseAnnouncementSink(),this.liveText="",this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.observedNodeEls.clear(),this.layoutRaf!=null&&(this.cancelOwnerAnimationFrame(this.layoutRaf),this.layoutRaf=null),this.companionRaf!=null&&(this.cancelOwnerAnimationFrame(this.companionRaf),this.companionRaf=null),this.viewportChangeRaf!=null&&(this.cancelOwnerAnimationFrame(this.viewportChangeRaf),this.viewportChangeRaf=null),this.wheelMeasureRaf!=null&&(this.cancelOwnerAnimationFrame(this.wheelMeasureRaf),this.wheelMeasureRaf=null,this.wheelMeasure=null),this.panDrag=void 0,this.connectedWindow?.removeEventListener("pointermove",this.onBackgroundPointerMove),this.connectedWindow?.removeEventListener("pointerup",this.onBackgroundPointerUp),this.connectedWindow?.removeEventListener("pointercancel",this.onBackgroundPointerUp),this.connectedWindow?.removeEventListener("lostpointercapture",this.onBackgroundPointerUp),this.nodeDrag=void 0,this.dragEdgeRefs=void 0,this.connectedWindow?.removeEventListener("pointermove",this.onNodePointerMove),this.connectedWindow?.removeEventListener("pointerup",this.onNodePointerUp),this.connectedWindow?.removeEventListener("pointercancel",this.onNodePointerUp),this.connectedWindow?.removeEventListener("lostpointercapture",this.onNodePointerUp),this.connectState=void 0,this.connecting=!1,this.connectInvalidNodeId=null,this.keyboardConnectSourceId=null,this.keyboardConnectTargetIndex=0,this.connectedWindow?.removeEventListener("pointermove",this.onConnectPointerMove),this.connectedWindow?.removeEventListener("pointerup",this.onConnectPointerUp),this.connectedWindow?.removeEventListener("pointercancel",this.onConnectPointerCancel),this.connectedWindow?.removeEventListener("lostpointercapture",this.onConnectPointerCancel),this.connectedWindow=void 0}adoptedCallback(){super.adoptedCallback(),this.resetAuthoredCardObserver(),this.restoreAuthoredCardSlots(),this.hasConnectedLayoutBaseline=!1,this.layoutLimitAnnouncementPending=!1;const ownerWindow=this.ownerDocument.defaultView;ownerWindow&&this.announcer.setTimerHost(ownerWindow),this.isConnected&&(this.bindAuthoredCardObserver(),this.scheduleAuthoredCardReconciliation(),this.nodes.length>0&&this.scheduleLayoutPass())}requestOwnerAnimationFrame(callback){const owner=this.ownerDocument.defaultView;return owner?{owner,handle:owner.requestAnimationFrame(callback)}:null}cancelOwnerAnimationFrame(frame){frame.owner.cancelAnimationFrame(frame.handle)}releaseAnnouncementSink(){this.announcementSink?.release(),this.announcementSink=void 0}syncAnnouncementSink(){if(!this.isConnected){this.releaseAnnouncementSink();return}this.announcementSink?.element.ownerDocument!==this.ownerDocument&&(this.releaseAnnouncementSink(),this.announcementSink=acquireAnnouncementSink("polite",{document:this.ownerDocument,source:this}))}resetAuthoredCardObserver(){this.authoredCardObserverGeneration+=1,this.authoredCardObserver?.disconnect(),this.authoredCardObserver=void 0,this.authoredCardObserverDocument=void 0,this.authoredCardSyncQueued=!1}bindAuthoredCardObserver(){const ownerDocument=this.ownerDocument;if(!this.isConnected||this.authoredCardObserver&&this.authoredCardObserverDocument===ownerDocument)return;this.resetAuthoredCardObserver();const MutationObserverCtor=ownerDocument.defaultView?.MutationObserver;if(!MutationObserverCtor)return;const generation=this.authoredCardObserverGeneration,observer=new MutationObserverCtor(records=>{if(this.authoredCardObserver!==observer||this.authoredCardObserverDocument!==ownerDocument||this.authoredCardObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument)return;records.some(record=>record.type==="childList"?record.target===this:record.type==="attributes"&&record.attributeName==="node-id"&&record.target.parentNode===this)&&this.scheduleAuthoredCardReconciliation()});observer.observe(this,{childList:!0,attributes:!0,attributeFilter:["node-id"],subtree:!0}),this.authoredCardObserver=observer,this.authoredCardObserverDocument=ownerDocument}scheduleAuthoredCardReconciliation(){const generation=this.authoredCardObserverGeneration,ownerDocument=this.authoredCardObserverDocument??this.ownerDocument;!this.isConnected||this.authoredCardSyncQueued||(this.authoredCardSyncQueued=!0,queueMicrotask(()=>{this.authoredCardObserverGeneration!==generation||!this.isConnected||this.ownerDocument!==ownerDocument||(this.authoredCardSyncQueued=!1,this.syncAuthoredCards(),this.pushCardPropsAll())}))}observeNodeWrappers(){for(const el of Array.from(this.renderRoot.querySelectorAll('[part="node"]')))this.observedNodeEls.has(el)||(this.observedNodeEls.add(el),this.resizeObserver?.observe(el))}willUpdate(changed){if(super.willUpdate(changed),changed.has("nodes")){this.cancelModelBoundGestures(),this.pruneNodeCaches(),this.syncAuthoredCards();const nodeIds=new Set(this.nodes.map(node=>node.id));this._selectedNodeIds=this.snapshotSelectedIds(this.selectedNodeIds,nodeIds)}if(changed.has("edges")){this.cancelModelBoundGestures();const edgeIds=new Set(this.edges.map(edge=>edge.id));this._selectedEdgeIds=this.snapshotSelectedIds(this.selectedEdgeIds,edgeIds)}if((changed.has("locked")&&this.locked||changed.has("orientation"))&&this.cancelActiveGestures(),changed.has("nodesDraggable")&&!this.nodesDraggable&&this.endNodeDrag(!1),changed.has("connectable")&&!this.connectable&&(this.onConnectPointerCancel(),this.keyboardConnectSourceId=null,this.keyboardConnectTargetIndex=0),changed.has("droppable")&&!this.droppable&&this.viewportEl?.removeAttribute("data-drop-active"),changed.has("grid")&&this.endNodeDrag(!1),changed.has("nodes")||changed.has("edges")||changed.has("orientation")||changed.has("layerGap")||changed.has("nodeGap"))for(const node of this.nodes)node.position||this.autoPositions.delete(node.id);(changed.has("nodes")||changed.has("selectedNodeIds")||changed.has("decorations")||changed.has("orientation"))&&this.pushCardPropsAll(changed)}pruneNodeCaches(){const nodeIds=new Set(this.nodes.map(node=>node.id));for(const id of this.autoPositions.keys())nodeIds.has(id)||this.autoPositions.delete(id);for(const id of this.measuredSizes.keys())nodeIds.has(id)||this.measuredSizes.delete(id);for(const element of this.observedNodeEls){const id=element.dataset.nodeId;id&&nodeIds.has(id)||(this.resizeObserver?.unobserve(element),this.observedNodeEls.delete(element))}}updated(changed){super.updated(changed),changed.has("edges")&&this.rebuildIncidentEdgesIndex(),changed.has("layoutTruncated")&&this.layoutLimitAnnouncementPending&&(this.layoutLimitAnnouncementPending=!1,this.isConnected&&this.layoutTruncated&&this.announcer.announce(this.localize("flowCanvasLayoutLimit"))),this.observeNodeWrappers(),(changed.has("nodes")||changed.has("edges")||changed.has("orientation")||changed.has("layerGap")||changed.has("nodeGap"))&&this.scheduleLayoutPass(),(changed.has("nodes")||changed.has("edges")||changed.has("decorations")||changed.has("minZoom")||changed.has("maxZoom")||changed.has("locked")||changed.has("orientation")||changed.has("layerGap")||changed.has("nodeGap"))&&this.scheduleCompanionNotify();const viewportEl=this.renderRoot.querySelector('[part="viewport"]');viewportEl&&viewportEl!==this.viewportEl&&(this.viewportEl=viewportEl,this.worldEl=this.renderRoot.querySelector(".world"),viewportEl.addEventListener("wheel",this.onWheel,{passive:!1}),viewportEl.addEventListener("keydown",this.onViewportKeyDown),viewportEl.addEventListener("dragover",this.onViewportDragOver),viewportEl.addEventListener("dragleave",this.onViewportDragLeave),viewportEl.addEventListener("drop",this.onViewportDrop),this.applyWorldTransform())}syncAuthoredCards(){const ids=new Set(this.nodes.map(node=>node.id)),adopted=new Set;for(const child of Array.from(this.children)){const nodeId=child.getAttribute("node-id");if(nodeId&&ids.has(nodeId)){this.leaseAuthoredCardSlot(child,nodeId),adopted.add(child);continue}this.releaseAuthoredCardSlot(child),nodeId&&devWarnOnce(UNMATCHED_AUTHORED_CARD_WARNING,"<lr-flow-canvas> has a direct child with a node-id that matches no node; it will not render.")}for(const child of[...this.authoredCardSlotLeases.keys()])adopted.has(child)||this.releaseAuthoredCardSlot(child)}leaseAuthoredCardSlot(child,nodeId){let lease=this.authoredCardSlotLeases.get(child);if(!lease){const slot2=child.getAttribute("slot");lease={authoredSlot:slot2,appliedSlot:slot2,authorOwnsSlot:!1},this.authoredCardSlotLeases.set(child,lease)}if(lease.authorOwnsSlot||child.getAttribute("slot")!==lease.appliedSlot){lease.authorOwnsSlot=!0;return}const slot=`node-${nodeId}`;child.getAttribute("slot")!==slot&&child.setAttribute("slot",slot),lease.appliedSlot=child.getAttribute("slot")}releaseAuthoredCardSlot(child){const lease=this.authoredCardSlotLeases.get(child);lease&&(!lease.authorOwnsSlot&&child.getAttribute("slot")===lease.appliedSlot&&(lease.authoredSlot===null?child.removeAttribute("slot"):child.setAttribute("slot",lease.authoredSlot)),this.authoredCardSlotLeases.delete(child))}restoreAuthoredCardSlots(){for(const child of[...this.authoredCardSlotLeases.keys()])this.releaseAuthoredCardSlot(child)}pushCardPropsAll(changed){const nodesChanged=changed?.has("nodes")??!0,selectionChanged=nodesChanged||changed?.has("selectedNodeIds")===!0,decorationsChanged=nodesChanged||changed?.has("decorations")===!0,orientationChanged=nodesChanged||changed?.has("orientation")===!0,cardsByNodeId=new Map;for(const child of Array.from(this.children)){const nodeId=child.getAttribute("node-id");nodeId&&this.authoredCardSlotLeases.has(child)&&cardsByNodeId.set(nodeId,child)}const selectedNodeIds=selectionChanged?new Set(this.selectedNodeIds):null;for(const node of this.nodes){const card=cardsByNodeId.get(node.id);if(card&&(nodesChanged&&(this.setCardProperty(card,"inputs",node.inputs??[{id:"in"}]),this.setCardProperty(card,"outputs",node.outputs??[{id:"out"}]),this.setCardProperty(card,"flowType",node.type??"")),orientationChanged&&this.setCardProperty(card,"orientation",this.orientation),selectedNodeIds&&this.setCardProperty(card,"selected",selectedNodeIds.has(node.id)),decorationsChanged)){const decoration=this.decorations?.[node.id];this.setCardProperty(card,"status",decoration?.status??null),this.setCardProperty(card,"progress",decoration?.progress??null),this.setCardProperty(card,"statusDetail",decoration?.detail??""),this.setCardProperty(card,"durationMs",decoration?.durationMs??null)}}}setCardProperty(card,property2,value){try{card[property2]=value}catch{}}nodePosition(node){const position=node.position??this.autoPositions.get(node.id)??{x:0,y:0};return{x:finiteNumber(position.x,0),y:finiteNumber(position.y,0)}}nodeSize(id){const measured=this.measuredSizes.get(id);if(measured)return measured;const ownerWindow=this.ownerDocument?.defaultView,host=this.renderedNodeById(id)??this,computed=ownerWindow?.getComputedStyle(host),customWidth=resolveCssLength(computed?.getPropertyValue("--lr-flow-canvas-node-fallback-inline-size").trim(),{host}),customHeight=resolveCssLength(computed?.getPropertyValue("--lr-flow-canvas-node-fallback-block-size").trim(),{host}),width=customWidth??(resolveCssLength(computed?.getPropertyValue("--lr-size-10rem").trim()||"10rem",{host})??0)+(resolveCssLength(computed?.getPropertyValue("--lr-size-1rem").trim()||"1rem",{host})??0),height=customHeight??resolveCssLength(computed?.getPropertyValue("--lr-size-4rem").trim()||"4rem",{host})??0;return{width,height}}resolvedNode(node){const pos=this.nodePosition(node),size=this.nodeSize(node.id);return{node,x:pos.x,y:pos.y,width:size.width,height:size.height}}handleOffset(count,index,span){return count<=1?span/2:span*(index+.5)/count}handlePoint(resolved,kind,handleId){const handles=kind==="input"?resolved.node.inputs??[{id:"in"}]:resolved.node.outputs??[{id:"out"}],index=handles.findIndex(h=>h.id===handleId),horizontal=this.orientation==="horizontal",edgeSpan=horizontal?resolved.height:resolved.width,offset=index>=0?this.handleOffset(handles.length,index,edgeSpan):edgeSpan/2;if(horizontal)return{x:kind==="input"?resolved.x:resolved.x+resolved.width,y:resolved.y+offset};const y=kind==="input"?resolved.y:resolved.y+resolved.height;return{x:resolved.x+offset,y}}edgePathD(sourcePt,targetPt){const dx=targetPt.x-sourcePt.x,dy=targetPt.y-sourcePt.y,distance=Math.hypot(dx,dy),offset=Math.min(CONNECT_OFFSET_MAX,Math.max(CONNECT_OFFSET_MIN,distance/2)),horizontal=this.orientation==="horizontal",c1x=sourcePt.x+(horizontal?offset:0),c1y=sourcePt.y+(horizontal?0:offset),c2x=targetPt.x-(horizontal?offset:0),c2y=targetPt.y-(horizontal?0:offset);return`M ${sourcePt.x} ${sourcePt.y} C ${c1x} ${c1y}, ${c2x} ${c2y}, ${targetPt.x} ${targetPt.y}`}nodeAccessibleText(node){if(node.accessibleLabel)return node.accessibleLabel;const label=typeof node.data?.label=="string"?node.data.label:node.id;return this.localize("flowNode",void 0,{label})}edgeAccessibleText(edge){const sourceNode=this.nodes.find(n=>n.id===edge.source),targetNode=this.nodes.find(n=>n.id===edge.target),source=sourceNode?this.nodeAccessibleText(sourceNode):edge.source,target=targetNode?this.nodeAccessibleText(targetNode):edge.target;return edge.label?this.localize("flowEdgeWithLabel",void 0,{label:edge.label,source,target}):this.localize("flowEdge",void 0,{source,target})}onNodesResized(entries){let changedAny=!1;for(const entry of entries){const id=entry.target.dataset.nodeId;if(!id)continue;const box=entry.borderBoxSize?.[0],width=box?box.inlineSize:entry.contentRect.width,height=box?box.blockSize:entry.contentRect.height,prev=this.measuredSizes.get(id);(!prev||prev.width!==width||prev.height!==height)&&(this.measuredSizes.set(id,{width,height}),changedAny=!0)}changedAny&&(this.scheduleLayoutPass(),this.scheduleCompanionNotify())}measureNodeWrappers(){for(const wrapper of Array.from(this.renderRoot.querySelectorAll('[part="node"]'))){const id=wrapper.dataset.nodeId;if(!id)continue;const rect=wrapper.getBoundingClientRect(),width=wrapper.offsetWidth||rect.width/Math.max(this.zoomLevel,Number.EPSILON),height=wrapper.offsetHeight||rect.height/Math.max(this.zoomLevel,Number.EPSILON);Number.isFinite(width)&&Number.isFinite(height)&&width>0&&height>0&&this.measuredSizes.set(id,{width,height})}}scheduleLayoutPass(){!this.isConnected||this.layoutRaf!=null||(this.layoutRaf=this.requestOwnerAnimationFrame(()=>{this.layoutRaf=null,this.isConnected&&(this.measureNodeWrappers(),this.runAutoLayoutIfNeeded(),this.requestUpdate(),!this.hasFitOnce&&this.nodes.length>0&&(this.hasFitOnce=!0,this.fit()))}))}setLayoutTruncated(truncated){const previous=this.layoutTruncated;if(this.layoutTruncated=truncated,truncated||(this.layoutLimitAnnouncementPending=!1),!(!this.isConnected||this.nodes.length===0)){if(!this.hasConnectedLayoutBaseline){this.hasConnectedLayoutBaseline=!0;return}!previous&&truncated&&(this.layoutLimitAnnouncementPending=!0)}}runAutoLayoutIfNeeded(){const unpositioned=this.nodes.filter(n=>!n.position);if(unpositioned.length===0){this.setLayoutTruncated(!1);return}const swap=this.orientation==="horizontal",graphNodes=this.nodes.map(n=>{const size=this.nodeSize(n.id);return{id:n.id,width:swap?size.height:size.width,height:swap?size.width:size.height}}),nodeIds=new Set(this.nodes.map(n=>n.id)),graphEdges=this.edges.filter(e=>nodeIds.has(e.source)&&nodeIds.has(e.target)).map(e=>({source:e.source,target:e.target})),fixedPositions=new Map;for(const n of this.nodes){if(!n.position||n.position.x<0||n.position.y<0)continue;const size=this.nodeSize(n.id),center={x:n.position.x+size.width/2,y:n.position.y+size.height/2};!Number.isSafeInteger(Math.trunc(center.x))||!Number.isSafeInteger(Math.trunc(center.y))||fixedPositions.set(n.id,swap?{x:center.y,y:center.x}:center)}const result=layeredLayout({nodes:graphNodes,edges:graphEdges,options:{gapX:this.safeNodeGap,gapY:this.safeLayerGap,fixedPositions}}),positions={};for(const n of unpositioned){const raw=result.positions.get(n.id);if(!raw)continue;const center=swap?{x:raw.y,y:raw.x}:{x:raw.x,y:raw.y},size=this.nodeSize(n.id),resolved={x:center.x-size.width/2,y:center.y-size.height/2};this.autoPositions.set(n.id,resolved),positions[n.id]=Object.freeze(resolved)}this.setLayoutTruncated(result.truncated),Object.keys(positions).length>0&&this.emit("lr-layout-change",Object.freeze({positions:Object.freeze(positions),truncated:result.truncated}))}get viewport(){return Object.freeze({x:this.panX,y:this.panY,zoom:this.zoomLevel})}setViewport(next){this.locked||(this.panX=finiteNumber(next.x,this.panX),this.panY=finiteNumber(next.y,this.panY),this.zoomLevel=this.clampZoom(next.zoom),this.applyWorldTransform(),this.emit("lr-viewport-change",Object.freeze({x:this.panX,y:this.panY,zoom:this.zoomLevel})))}zoomIn(){this.locked||this.zoomAtCenter(this.zoomLevel*ZOOM_MULTIPLIER)}zoomOut(){this.locked||this.zoomAtCenter(this.zoomLevel/ZOOM_MULTIPLIER)}resetZoom(){this.locked||this.setViewport({x:this.panX,y:this.panY,zoom:1})}fit(options){if(this.locked||this.nodes.length===0)return;const padding=finiteRange(options?.padding??DEFAULT_FIT_PADDING,DEFAULT_FIT_PADDING,0);let minX=1/0,minY=1/0,maxX=-1/0,maxY=-1/0;for(const node of this.nodes){const resolved=this.resolvedNode(node);minX=Math.min(minX,resolved.x),minY=Math.min(minY,resolved.y),maxX=Math.max(maxX,resolved.x+resolved.width),maxY=Math.max(maxY,resolved.y+resolved.height)}const rect=this.viewportEl?.getBoundingClientRect(),viewW=rect?.width??0,viewH=rect?.height??0,contentW=Math.max(1,maxX-minX),contentH=Math.max(1,maxY-minY),fitZoom=Math.min((viewW-padding*2)/contentW,(viewH-padding*2)/contentH),zoom=this.clampZoom(Number.isFinite(fitZoom)&&fitZoom>0?fitZoom:1);this.panX=viewW/2-(minX+contentW/2)*zoom,this.panY=viewH/2-(minY+contentH/2)*zoom,this.zoomLevel=zoom,this.applyWorldTransform(),this.scheduleViewportChange()}focusNode(id,options){if(this.locked)return;const node=this.nodes.find(n=>n.id===id);if(!node)return;const resolved=this.resolvedNode(node),rect=this.viewportEl?.getBoundingClientRect(),viewW=rect?.width??0,viewH=rect?.height??0,zoom=options?.zoom!=null?this.clampZoom(options.zoom):this.zoomLevel;this.panX=viewW/2-(resolved.x+resolved.width/2)*zoom,this.panY=viewH/2-(resolved.y+resolved.height/2)*zoom,this.zoomLevel=zoom,this.applyWorldTransform(),this.scheduleViewportChange(),this.focusActiveItem(this.spatialItemIndex("node",id))}toContentPoint(clientX,clientY){const rect=this.viewportEl?.getBoundingClientRect();if(!rect)return{x:0,y:0};const localX=this.localWorldX(clientX,rect),localY=clientY-rect.top;return{x:(localX-this.panX)/this.zoomLevel,y:(localY-this.panY)/this.zoomLevel}}registerCompanion(cb){return this.companionCallbacks.add(cb),this.scheduleCompanionNotify(),()=>{this.companionCallbacks.delete(cb)}}scheduleCompanionNotify(){this.companionRaf!=null||this.companionCallbacks.size===0||(this.companionRaf=this.requestOwnerAnimationFrame(()=>{this.companionRaf=null;for(const cb of this.companionCallbacks)cb(this.buildSnapshot())}))}buildSnapshot(){const rect=this.viewportEl?.getBoundingClientRect(),bounds=this.effectiveZoomBounds;return Object.freeze({nodes:Object.freeze(this.nodes.map(n=>{const resolved=this.resolvedNode(n);return Object.freeze({id:n.id,x:resolved.x,y:resolved.y,width:resolved.width,height:resolved.height,status:this.decorations?.[n.id]?.status})})),edges:Object.freeze(this.edges.map(e=>Object.freeze({id:e.id,source:e.source,target:e.target,status:this.decorations?.[e.id]?.status}))),viewport:Object.freeze({x:this.panX,y:this.panY,zoom:this.zoomLevel,width:rect?.width??0,height:rect?.height??0,minZoom:bounds.min,maxZoom:bounds.max}),locked:this.locked,orientation:this.orientation,layerGap:this.safeLayerGap,nodeGap:this.safeNodeGap})}clampZoom(z){const{min,max}=this.effectiveZoomBounds;return finiteRange(z,1,min,max)}applyWorldTransform(){this.worldEl&&(this.worldEl.style.transform=`translate(${this.panX}px, ${this.panY}px) scale(${this.zoomLevel})`),this.scheduleCompanionNotify()}scheduleViewportChange(){this.viewportChangeRaf==null&&(this.viewportChangeRaf=this.requestOwnerAnimationFrame(()=>{this.viewportChangeRaf=null,this.emit("lr-viewport-change",Object.freeze({x:this.panX,y:this.panY,zoom:this.zoomLevel}))}))}zoomAtCenter(nextZoom){const rect=this.viewportEl?.getBoundingClientRect();this.zoomAtPoint(rect?rect.width/2:0,rect?rect.height/2:0,nextZoom)}zoomAtPoint(localX,localY,nextZoom){const clamped=this.clampZoom(nextZoom);if(clamped===this.zoomLevel)return;const contentX=(localX-this.panX)/this.zoomLevel,contentY=(localY-this.panY)/this.zoomLevel;this.panX=localX-contentX*clamped,this.panY=localY-contentY*clamped,this.zoomLevel=clamped,this.applyWorldTransform(),this.scheduleViewportChange()}localWorldX(clientX,rect,rtl=isRtl(this)){const local=clientX-rect.left;return this.orientation==="horizontal"&&rtl?rect.width-local:local}endBackgroundPan(rollback){const drag=this.panDrag;drag&&(this.panDrag=void 0,this.viewportEl?.removeAttribute("data-panning"),this.connectedWindow?.removeEventListener("pointermove",this.onBackgroundPointerMove),this.connectedWindow?.removeEventListener("pointerup",this.onBackgroundPointerUp),this.connectedWindow?.removeEventListener("pointercancel",this.onBackgroundPointerUp),this.connectedWindow?.removeEventListener("lostpointercapture",this.onBackgroundPointerUp),rollback&&(this.panX!==drag.startPanX||this.panY!==drag.startPanY)&&(this.panX=drag.startPanX,this.panY=drag.startPanY,this.applyWorldTransform(),this.scheduleViewportChange()))}panBy(dx,dy){this.panX+=dx,this.panY+=dy,this.applyWorldTransform(),this.scheduleViewportChange()}spatialNodeOrder(){const horizontal=this.orientation==="horizontal";return[...this.nodes].sort((a,b)=>{const pa=this.resolvedNode(a),pb=this.resolvedNode(b),mainA=horizontal?pa.x:pa.y,mainB=horizontal?pb.x:pb.y;if(mainA!==mainB)return mainA-mainB;const crossA=horizontal?pa.y:pa.x,crossB=horizontal?pb.y:pb.x;return crossA-crossB})}focusableEdges(){const nodeIds=new Set(this.nodes.map(n=>n.id));return this.edges.filter(e=>nodeIds.has(e.source)&&nodeIds.has(e.target))}rovingItems(){return[...this.spatialNodeOrder().map(n=>({kind:"node",id:n.id})),...this.focusableEdges().map(e=>({kind:"edge",id:e.id}))]}itemCount(){return this.nodes.length+this.focusableEdges().length}normalizedItemIndex(index=this.activeItemIndex){const count=this.itemCount();return count?Math.min(Math.max(index,0),count-1):-1}itemAccessibleText(item){if(item.kind==="node"){const node=this.nodes.find(n=>n.id===item.id);return node?this.nodeAccessibleText(node):""}const edge=this.edges.find(e=>e.id===item.id);return edge?this.edgeAccessibleText(edge):""}spatialItemIndex(kind,id){return this.rovingItems().findIndex(it=>it.kind===kind&&it.id===id)}announceItem(index){const item=this.rovingItems()[index];item&&this.announcer.announce(this.localize("flowItemAnnouncement",void 0,{item:this.itemAccessibleText(item),index:this.formatNumber(index+1),total:this.formatNumber(this.itemCount())}))}formatNumber(value){return getNumberFormat(this.effectiveLocale).format(value)}onItemFocus(index){this.normalizedItemIndex(index)<0||(this.activeItemIndex=index,this.announceItem(index))}renderedElementByDataId(attribute,id){const renderRoot=this.renderRoot;if(!renderRoot)return null;const ownerCss=this.ownerDocument?.defaultView?.CSS,escape=ownerCss?.escape;if(typeof escape=="function")try{const match=renderRoot.querySelector(`[${attribute}="${escape.call(ownerCss,id)}"]`);if(match)return match}catch{}return[...renderRoot.querySelectorAll(`[${attribute}]`)].find(candidate=>candidate.getAttribute(attribute)===id)??null}renderedNodeById(id){return this.renderedElementByDataId("data-node-id",id)}renderedEdgeById(id){return this.renderedElementByDataId("data-edge-id",id)}focusActiveItem(index=this.activeItemIndex){const normalized=this.normalizedItemIndex(index);if(normalized<0)return;this.activeItemIndex=normalized,this.announceItem(normalized);const item=this.rovingItems()[normalized];item&&this.updateComplete.then(()=>{(item.kind==="node"?this.renderedNodeById(item.id)?.querySelector('[part="node-control"]'):this.renderedEdgeById(item.id)?.querySelector('[part="edge"]'))?.focus()})}applySelection(kind,id,additive){kind==="node"?(this.selectedNodeIds=additive?toggledSelection(this.selectedNodeIds,id):[id],additive||(this.selectedEdgeIds=[])):(this.selectedEdgeIds=additive?toggledSelection(this.selectedEdgeIds,id):[id],additive||(this.selectedNodeIds=[])),this.emit("lr-selection-change",Object.freeze({nodeIds:Object.freeze([...this.selectedNodeIds]),edgeIds:Object.freeze([...this.selectedEdgeIds])}));const selected=kind==="node"?this.selectedNodeIds.includes(id):this.selectedEdgeIds.includes(id),label=this.itemAccessibleText({kind,id});this.announcer.announce(this.localize(selected?"flowNodeSelected":"flowNodeDeselected",void 0,{label}))}clearSelection(){this.selectedNodeIds.length===0&&this.selectedEdgeIds.length===0||(this.selectedNodeIds=[],this.selectedEdgeIds=[],this.emit("lr-selection-change",Object.freeze({nodeIds:Object.freeze([]),edgeIds:Object.freeze([])})),this.announcer.announce(this.localize("flowSelectionCleared")))}deleteSelection(){!this.nodesDraggable&&!this.connectable&&!this.droppable||this.selectedNodeIds.length===0&&this.selectedEdgeIds.length===0||this.emit("lr-selection-delete",Object.freeze({nodeIds:Object.freeze([...this.selectedNodeIds]),edgeIds:Object.freeze([...this.selectedEdgeIds])}))}onNodeActivate(node,additive){this.emit("lr-node-activate",Object.freeze({nodeId:node.id})),this.applySelection("node",node.id,additive)}onNodeClick(event,node){const currentTarget=event.currentTarget;for(const entry of event.composedPath()){if(entry===currentTarget)break;if(entry&&typeof entry=="object"&&entry.nodeType===1&&isActionableElement(entry)){event.stopPropagation();return}}this.onNodeActivate(node,event.ctrlKey||event.metaKey)}onEdgeActivate(edge,additive){this.emit("lr-edge-activate",Object.freeze({edgeId:edge.id,source:edge.source,target:edge.target})),this.applySelection("edge",edge.id,additive)}onItemKeyDown(e,index,activate){const arrowKeys=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"];if(this.nodesDraggable&&!this.locked&&(e.ctrlKey||e.metaKey)&&arrowKeys.includes(e.key)){const item=this.rovingItems()[index];if(item?.kind==="node"){e.preventDefault(),this.nudgeNode(item.id,e.key);return}}if(this.keyboardConnectSourceId){if(e.key==="Escape"){e.preventDefault(),this.cancelKeyboardConnect();return}if(e.key==="Enter"){e.preventDefault(),this.commitKeyboardConnect();return}const rtlForConnect=isRtl(this),forwardConnectKey=rtlForConnect?"ArrowLeft":"ArrowRight",backwardConnectKey=rtlForConnect?"ArrowRight":"ArrowLeft";if(e.key===forwardConnectKey||e.key==="ArrowDown"){e.preventDefault(),this.cycleKeyboardConnectTarget(1);return}if(e.key===backwardConnectKey||e.key==="ArrowUp"){e.preventDefault(),this.cycleKeyboardConnectTarget(-1);return}return}if(this.connectable&&!this.locked&&e.key==="c"&&e.target===e.currentTarget){const item=this.rovingItems()[index];if(item?.kind==="node"){e.preventDefault(),this.startKeyboardConnect(item.id);return}}if(e.key==="Enter"||e.key===" "){e.preventDefault(),this.setActiveItemQuiet(index),activate(e.ctrlKey||e.metaKey);return}if(e.key==="Escape"){e.preventDefault(),e.target!==e.currentTarget?e.currentTarget.focus():this.clearSelection();return}if((e.key==="Delete"||e.key==="Backspace")&&e.target===e.currentTarget){e.preventDefault(),this.deleteSelection();return}const count=this.itemCount();if(!count)return;const rtl=isRtl(this),forwardKey=rtl?"ArrowLeft":"ArrowRight",backwardKey=rtl?"ArrowRight":"ArrowLeft";let next=index;if(e.key===forwardKey||e.key==="ArrowDown")next=Math.min(count-1,index+1);else if(e.key===backwardKey||e.key==="ArrowUp")next=Math.max(0,index-1);else if(e.key==="Home")next=0;else if(e.key==="End")next=count-1;else return;e.preventDefault(),this.focusActiveItem(next)}setActiveItemQuiet(index){const normalized=this.normalizedItemIndex(index);normalized>=0&&(this.activeItemIndex=normalized)}itemIndexMaps(){const items=this.rovingItems(),nodeIndex=new Map,edgeIndex=new Map;return items.forEach((item,i)=>{item.kind==="node"?nodeIndex.set(item.id,i):edgeIndex.set(item.id,i-nodeIndex.size)}),{nodeIndex,edgeIndex}}snap(value){const grid=this.safeGrid;return grid>0?Math.round(value/grid)*grid:value}rebuildIncidentEdgesIndex(){const map=new Map;for(const edge of this.edges)(map.get(edge.source)??map.set(edge.source,[]).get(edge.source)).push(edge.id),edge.target!==edge.source&&(map.get(edge.target)??map.set(edge.target,[]).get(edge.target)).push(edge.id);this.nodeIncidentEdges=map}buildDragEdgeRefs(nodeId){const refs=[];for(const edgeId of this.nodeIncidentEdges.get(nodeId)??[]){const edge=this.edges.find(e=>e.id===edgeId),sourceNode=edge&&this.nodes.find(n=>n.id===edge.source),targetNode=edge&&this.nodes.find(n=>n.id===edge.target);if(!edge||!sourceNode||!targetNode)continue;const group=this.renderedEdgeById(edgeId);refs.push({edge,sourceNode,targetNode,pathEl:group?.querySelector('[part="edge"]')??null,labelEl:group?.querySelector('[part="edge-label"]')??null})}return refs}updateIncidentEdges(nodeId,x,y){for(const{edge,sourceNode,targetNode,pathEl,labelEl}of this.dragEdgeRefs??[]){const sourceResolved=edge.source===nodeId?{...this.resolvedNode(sourceNode),x,y}:this.resolvedNode(sourceNode),targetResolved=edge.target===nodeId?{...this.resolvedNode(targetNode),x,y}:this.resolvedNode(targetNode),sourcePt=this.handlePoint(sourceResolved,"output",edge.sourceHandle??"out"),targetPt=this.handlePoint(targetResolved,"input",edge.targetHandle??"in");if(pathEl?.setAttribute("d",this.edgePathD(sourcePt,targetPt)),labelEl){const midX=(sourcePt.x+targetPt.x)/2;labelEl.setAttribute("x",String(midX)),labelEl.setAttribute("y",String((sourcePt.y+targetPt.y)/2)),this.orientation==="horizontal"&&isRtl(this)?labelEl.setAttribute("transform",`translate(${2*midX} 0) scale(-1 1)`):labelEl.removeAttribute("transform")}}}onNodePointerDown(e,node){if(!this.nodesDraggable||this.locked)return;const wrapper=e.currentTarget,interactive=e.target.closest('button, a[href], input, select, textarea, [role="button"], [tabindex]:not([part="node"])');if(interactive&&interactive!==wrapper&&wrapper.contains(interactive))return;e.stopPropagation();const start=this.nodePosition(node);this.nodeDrag={pointerId:e.pointerId,nodeId:node.id,startClientX:e.clientX,startClientY:e.clientY,startX:start.x,startY:start.y,wrapper,rtlFlip:this.orientation==="horizontal"&&isRtl(this)?-1:1},this.dragEdgeRefs=this.buildDragEdgeRefs(node.id),wrapper.setPointerCapture?.(e.pointerId),this.connectedWindow?.addEventListener("pointermove",this.onNodePointerMove),this.connectedWindow?.addEventListener("pointerup",this.onNodePointerUp),this.connectedWindow?.addEventListener("pointercancel",this.onNodePointerUp),this.connectedWindow?.addEventListener("lostpointercapture",this.onNodePointerUp)}endNodeDrag(commit){const drag=this.nodeDrag;if(!drag)return;this.nodeDrag=void 0,this.connectedWindow?.removeEventListener("pointermove",this.onNodePointerMove),this.connectedWindow?.removeEventListener("pointerup",this.onNodePointerUp),this.connectedWindow?.removeEventListener("pointercancel",this.onNodePointerUp),this.connectedWindow?.removeEventListener("lostpointercapture",this.onNodePointerUp);const previous={x:drag.startX,y:drag.startY},position={x:drag.currentX??drag.startX,y:drag.currentY??drag.startY};commit&&this.nodesDraggable&&this.nodes.some(node=>node.id===drag.nodeId)&&(position.x!==previous.x||position.y!==previous.y)&&this.emit("lr-node-move",Object.freeze({nodeId:drag.nodeId,position:Object.freeze(position),previous:Object.freeze(previous)}));const resetNode=this.nodes.find(n=>n.id===drag.nodeId),resetPos=resetNode?this.nodePosition(resetNode):previous;drag.wrapper.style.transform=`translate(${resetPos.x}px, ${resetPos.y}px)`,this.updateIncidentEdges(drag.nodeId,resetPos.x,resetPos.y),this.dragEdgeRefs=void 0,this.requestUpdate()}nudgeNode(nodeId,key){const node=this.nodes.find(n=>n.id===nodeId);if(!node)return;const current=this.nodePosition(node),step=this.safeGrid>0?this.safeGrid:1,rtlFlip=this.orientation==="horizontal"&&isRtl(this)?-1:1;let dx=0,dy=0;key==="ArrowRight"?dx=step*rtlFlip:key==="ArrowLeft"?dx=-step*rtlFlip:key==="ArrowDown"?dy=step:key==="ArrowUp"&&(dy=-step);const position={x:current.x+dx,y:current.y+dy};this.emit("lr-node-move",Object.freeze({nodeId,position:Object.freeze(position),previous:Object.freeze(current)})),this.announcer.announce(this.localize("flowNodeMoved",void 0,{label:this.nodeAccessibleText(node),x:this.formatNumber(position.x),y:this.formatNumber(position.y)})),this.requestUpdate()}nodeIdFromComposedPath(path){for(const el of path)if(isHtmlElement(el)&&el.getAttribute("part")==="node"&&el.dataset.nodeId)return el.dataset.nodeId;return null}isInvalidConnectTarget(hoveredId){return this.connectState?hoveredId===this.connectState.sourceId?!0:this.edges.some(e=>e.source===this.connectState.sourceId&&e.target===hoveredId):!1}startConnectGesture(nodeId,handleId,clientX,clientY){const sourceNode=this.nodes.find(n=>n.id===nodeId);if(!sourceNode)return;const startPt=this.handlePoint(this.resolvedNode(sourceNode),"output",handleId);this.connectState={sourceId:nodeId,sourceHandle:handleId,startPt,rect:this.viewportEl?.getBoundingClientRect()??null,rtl:isRtl(this)},this.connecting=!0,this.announcer.announce(this.localize("flowConnectStarted",void 0,{label:this.nodeAccessibleText(sourceNode)})),this.updateComplete.then(()=>{this.connectionLineEl=this.renderRoot.querySelector('[part="connection-line"]')??void 0,this.connectionLineEl?.setAttribute("d",this.edgePathD(startPt,this.connectContentPoint(clientX,clientY)))}),this.connectedWindow?.addEventListener("pointermove",this.onConnectPointerMove),this.connectedWindow?.addEventListener("pointerup",this.onConnectPointerUp),this.connectedWindow?.addEventListener("pointercancel",this.onConnectPointerCancel),this.connectedWindow?.addEventListener("lostpointercapture",this.onConnectPointerCancel)}connectContentPoint(clientX,clientY){const state2=this.connectState;if(!state2?.rect)return{x:0,y:0};const localX=this.localWorldX(clientX,state2.rect,state2.rtl),localY=clientY-state2.rect.top;return{x:(localX-this.panX)/this.zoomLevel,y:(localY-this.panY)/this.zoomLevel}}isInvalidConnectTargetFor(state2,hoveredId){return hoveredId===state2.sourceId?!0:this.edges.some(e=>e.source===state2.sourceId&&e.target===hoveredId)}endConnectGesture(){this.connectInvalidNodeId&&(this.renderedNodeById(this.connectInvalidNodeId)?.removeAttribute("data-connect-invalid"),this.connectInvalidNodeId=null),this.connectState=void 0,this.connecting=!1,this.connectedWindow?.removeEventListener("pointermove",this.onConnectPointerMove),this.connectedWindow?.removeEventListener("pointerup",this.onConnectPointerUp),this.connectedWindow?.removeEventListener("pointercancel",this.onConnectPointerCancel),this.connectedWindow?.removeEventListener("lostpointercapture",this.onConnectPointerCancel)}cancelActiveGestures(){this.endBackgroundPan(!0),this.cancelModelBoundGestures(),this.viewportEl?.removeAttribute("data-drop-active")}cancelModelBoundGestures(){this.endNodeDrag(!1),this.onConnectPointerCancel(),this.keyboardConnectSourceId=null,this.keyboardConnectTargetIndex=0}eligibleConnectTargets(sourceId){return this.nodes.filter(n=>n.id!==sourceId&&!this.edges.some(e=>e.source===sourceId&&e.target===n.id))}startKeyboardConnect(sourceId){if(this.eligibleConnectTargets(sourceId).length===0)return;const sourceNode=this.nodes.find(n=>n.id===sourceId);this.keyboardConnectSourceId=sourceId,this.keyboardConnectTargetIndex=0,sourceNode&&this.announceKeyboardConnectTarget()}cycleKeyboardConnectTarget(direction){if(!this.keyboardConnectSourceId)return;const targets=this.eligibleConnectTargets(this.keyboardConnectSourceId);targets.length!==0&&(this.keyboardConnectTargetIndex=(this.keyboardConnectTargetIndex+direction+targets.length)%targets.length,this.announceKeyboardConnectTarget())}announceKeyboardConnectTarget(){const sourceId=this.keyboardConnectSourceId;if(!sourceId)return;const source=this.nodes.find(node=>node.id===sourceId),targets=this.eligibleConnectTargets(sourceId),target=targets[this.keyboardConnectTargetIndex];!source||!target||this.announcer.announce(this.localize("flowConnectTarget",void 0,{source:this.nodeAccessibleText(source),target:this.nodeAccessibleText(target),index:this.formatNumber(this.keyboardConnectTargetIndex+1),total:this.formatNumber(targets.length)}))}isKeyboardConnectTarget(nodeId){return this.keyboardConnectSourceId?this.eligibleConnectTargets(this.keyboardConnectSourceId)[this.keyboardConnectTargetIndex]?.id===nodeId:!1}commitKeyboardConnect(){const sourceId=this.keyboardConnectSourceId;if(!sourceId)return;const target=this.eligibleConnectTargets(sourceId)[this.keyboardConnectTargetIndex];if(this.keyboardConnectSourceId=null,!target)return;const sourceOutputs=this.nodes.find(n=>n.id===sourceId)?.outputs??[{id:"out"}],targetInputs=target.inputs??[{id:"in"}];if(!this.connectable||this.locked)return;this.emit("lr-connect",Object.freeze({source:sourceId,target:target.id,sourceHandle:sourceOutputs[0]?.id??"out",targetHandle:targetInputs[0]?.id??"in"}));const source=this.nodes.find(node=>node.id===sourceId);this.announcer.announce(this.localize("flowConnectCommitted",void 0,{source:source?this.nodeAccessibleText(source):sourceId,target:this.nodeAccessibleText(target)}))}cancelKeyboardConnect(){this.keyboardConnectSourceId&&(this.keyboardConnectSourceId=null,this.announcer.announce(this.localize("flowConnectCancelled")))}statusTone(status){return status==="running"?"brand":status==="success"?"success":status==="error"?"danger":status==="denied"?"warning":"neutral"}edgeTone(edge){const decoration=this.decorations?.[edge.id];return decoration?this.statusTone(decoration.status):edge.tone??"neutral"}edgeIsRunning(edge){return this.decorations?.[edge.id]?.status==="running"}renderEdges(nodeIndex,edgeIndex){const resolvedById=new Map(this.nodes.map(n=>[n.id,this.resolvedNode(n)])),items=[],ownerWindow=this.ownerDocument?.defaultView,reducedMotion=!ownerWindow||prefersReducedMotion(ownerWindow),counterMirrorLabels=this.orientation==="horizontal"&&!!this.ownerDocument?.defaultView&&isRtl(this);for(const edge of this.edges){const sourceResolved=resolvedById.get(edge.source);if(!sourceResolved)continue;const targetResolved=resolvedById.get(edge.target),sourcePt=this.handlePoint(sourceResolved,"output",edge.sourceHandle??"out");if(!targetResolved){const stubPt={x:sourcePt.x+14,y:sourcePt.y+14};items.push(svg`<line
2
2
  part="stub"
3
3
  aria-hidden="true"
4
4
  x1=${sourcePt.x} y1=${sourcePt.y}
@@ -147,7 +147,6 @@ var __decorate=function(decorators,target,key,desc){var c=arguments.length,r=c<3
147
147
  ${fallbackEdges.length>0?html`<ul part="edge-list" class="sr-only" aria-label=${this.localize("flowEdgeList")}>
148
148
  ${fallbackEdges.map(edge=>html`<li>${this.edgeAccessibleText(edge)}</li>`)}
149
149
  </ul>`:nothing}
150
- <slot></slot>
151
150
  `}
152
151
  <div part="overlay-rail" data-edge="top">
153
152
  <div class="overlay-group" data-align="start"><slot name="top-start"></slot></div>
@@ -1 +1 @@
1
- import{css}from"lit";const styles=css`:host{inline-size:100%;block-size:var(--lr-canvas-reserved-height,var(--lr-size-24rem));min-block-size:0;min-inline-size:0;display:block;position:relative;overflow:hidden}[part=base]{block-size:100%;inline-size:100%;position:relative}[part=viewport]{touch-action:none;cursor:grab;outline:none;block-size:100%;inline-size:100%;position:relative;overflow:hidden}[part=viewport]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:calc(-1 * var(--lr-focus-ring-width))}[part=background],[part=edges]{position:absolute;inset:0}[part=edges]{pointer-events:none;block-size:100%;inline-size:100%;overflow:visible}[part=empty]{pointer-events:none;block-size:100%;inline-size:100%}[part=overlay-rail]{inset-inline:var(--lr-space-s);z-index:var(--lr-layer-content);align-items:flex-end;gap:var(--lr-space-s);pointer-events:none;flex-wrap:wrap;display:flex;position:absolute}[part=overlay-rail][data-edge=top]{inset-block-start:var(--lr-space-s)}[part=overlay-rail][data-edge=bottom]{inset-block-end:var(--lr-space-s)}.overlay-group{gap:var(--lr-space-s);pointer-events:auto;flex-wrap:wrap;max-inline-size:100%;display:flex}.overlay-group[data-align=end]{margin-inline-start:auto}[part=node]{will-change:transform;min-inline-size:var(--lr-size-1-5rem);min-block-size:var(--lr-size-1-5rem);position:absolute;inset-block-start:0;inset-inline-start:0}[part=node-control]{min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size)}.portable-node-card{align-items:stretch;gap:var(--lr-space-xs);min-inline-size:calc(var(--lr-size-10rem) + var(--lr-size-1rem));padding:var(--lr-space-s);border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius);background:var(--lr-color-surface);box-shadow:var(--lr-shadow-s);display:flex}.portable-node-content{overflow-wrap:anywhere;flex-direction:column;flex:auto;min-inline-size:0;display:flex}.portable-handles{flex-direction:column;justify-content:space-around;display:flex}.portable-handles>span{inline-size:var(--lr-size-0-5rem);block-size:var(--lr-size-0-5rem);border-radius:var(--lr-radius-pill);background:var(--lr-color-border-strong)}[part=node]:focus-within{z-index:var(--lr-layer-content)}[part=edge]{fill:none;stroke:var(--lr-flow-canvas-edge-neutral-color,var(--lr-color-border));stroke-width:1.5px;pointer-events:stroke;cursor:pointer}[part=edge-hit-area]{fill:none;stroke:#0000;stroke-width:var(--lr-icon-button-size);pointer-events:stroke;cursor:pointer}[part=edge][data-tone=brand]{stroke:var(--lr-flow-canvas-edge-brand-color,var(--lr-color-brand))}[part=edge][data-tone=success]{stroke:var(--lr-flow-canvas-edge-success-color,var(--lr-color-success))}[part=edge][data-tone=warning]{stroke:var(--lr-flow-canvas-edge-warning-color,var(--lr-color-warning))}[part=edge][data-tone=danger]{stroke:var(--lr-flow-canvas-edge-danger-color,var(--lr-color-danger))}[part=arrowhead]{fill:var(--lr-flow-canvas-edge-neutral-color,var(--lr-color-border))}[part=arrowhead][data-tone=brand]{fill:var(--lr-flow-canvas-edge-brand-color,var(--lr-color-brand))}[part=arrowhead][data-tone=success]{fill:var(--lr-flow-canvas-edge-success-color,var(--lr-color-success))}[part=arrowhead][data-tone=warning]{fill:var(--lr-flow-canvas-edge-warning-color,var(--lr-color-warning))}[part=arrowhead][data-tone=danger]{fill:var(--lr-flow-canvas-edge-danger-color,var(--lr-color-danger))}[part=stub]{stroke:var(--lr-color-border);stroke-width:1.5px;stroke-dasharray:3 3;opacity:.6}[part=edge-label]{fill:var(--lr-color-text);font:var(--lr-font-size-xs) / 1 var(--lr-font);text-anchor:middle;stroke:var(--lr-color-surface);stroke-width:var(--lr-size-3px)}[part=layout-limit]{inset-inline:var(--lr-space-s);z-index:var(--lr-layer-content);max-inline-size:calc(100% - 2 * var(--lr-space-s));padding:var(--lr-space-2xs) var(--lr-space-s);border:var(--lr-border-width-thin) solid var(--lr-color-warning);border-radius:var(--lr-radius);background:var(--lr-color-surface);color:var(--lr-color-text);font-size:var(--lr-font-size-xs);overflow-wrap:anywhere;position:absolute;inset-block-end:var(--lr-space-s)}.world{transform-origin:0 0;will-change:transform;block-size:100%;inline-size:100%;position:absolute;inset-block-start:0;inset-inline-start:0}[part=background]{background-image:radial-gradient(circle, var(--lr-color-border) var(--lr-size-1px), transparent var(--lr-size-1px));background-size:var(--lr-flow-canvas-grid-size,var(--_lr-flow-canvas-grid-size,var(--lr-size-0-5rem))) var(--lr-flow-canvas-grid-size,var(--_lr-flow-canvas-grid-size,var(--lr-size-0-5rem)));cursor:grab;block-size:500%;inline-size:500%;position:absolute;inset-block-start:-200%;inset-inline-start:-200%}[part=viewport][data-panning] [part=background]{cursor:grabbing}[part=viewport][data-empty] .world{pointer-events:none}:host([locked]) [part=background]{cursor:default}:host([orientation=horizontal]:dir(rtl)) [part=viewport],:host([orientation=horizontal]:dir(rtl)) [part=node] ::slotted(*){transform:scaleX(-1)}[part=node][data-selected]{outline:var(--lr-size-2px) solid var(--lr-flow-canvas-node-selected-outline-color,var(--lr-color-brand));outline-offset:var(--lr-size-2px);border-radius:var(--lr-radius)}[part=node]:hover{outline:var(--lr-size-1px) solid var(--lr-flow-canvas-node-hover-outline-color,var(--lr-color-border-strong));outline-offset:var(--lr-size-2px)}[part=node]:active{outline:var(--lr-size-2px) solid var(--lr-flow-canvas-node-hover-outline-color,var(--lr-color-border-strong));outline-offset:var(--lr-size-2px)}[part=edge][aria-pressed=true],[part=edge]:hover,[part=edge-hit-area]:hover+[part=edge]{stroke-width:2.5px}[part=edge]:active,[part=edge-hit-area]:active+[part=edge]{stroke-width:3.5px}[part=node]:has([part=node-control]:focus-visible),[part=edge]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part=connection-line]{fill:none;stroke:var(--lr-color-brand);stroke-width:1.5px;stroke-dasharray:4 4;pointer-events:none}[part=node][data-connect-invalid]{outline:var(--lr-size-2px) solid var(--lr-flow-canvas-node-connect-invalid-outline-color,var(--lr-color-danger));outline-offset:var(--lr-size-2px)}[part=node][data-connect-target]{outline:var(--lr-size-2px) dashed var(--lr-flow-canvas-node-connect-target-outline-color,var(--lr-color-brand));outline-offset:var(--lr-size-2px)}[part=viewport][data-drop-active]{outline:var(--lr-size-2px) dashed var(--lr-flow-canvas-drop-active-outline-color,var(--lr-color-brand));outline-offset:calc(-1 * var(--lr-size-2px))}[part=viewport][data-drop-active]:focus-visible{box-shadow:inset 0 0 0 var(--lr-focus-ring-width) var(--lr-focus-ring-color)}[part=edge][data-running]{stroke-dasharray:6 4;animation:lr-flow-canvas-march var(--lr-flow-canvas-march-duration,var(--lr-duration-ambient)) linear infinite}[part=edge][data-running-static]{stroke-dasharray:6 4}@media (prefers-reduced-motion:reduce){[part=edge][data-running]{animation:none}}@keyframes lr-flow-canvas-march{to{stroke-dashoffset:-20px}}`;export{styles};
1
+ import{css}from"lit";const styles=css`:host{inline-size:100%;block-size:var(--lr-canvas-reserved-height,var(--lr-size-24rem));min-block-size:0;min-inline-size:0;display:block;position:relative;overflow:hidden}[part=base]{block-size:100%;inline-size:100%;position:relative}[part=viewport]{touch-action:none;cursor:grab;outline:none;block-size:100%;inline-size:100%;position:relative;overflow:hidden}[part=viewport]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:calc(-1 * var(--lr-focus-ring-width))}[part=background],[part=edges]{position:absolute;inset:0}[part=edges]{pointer-events:none;block-size:100%;inline-size:100%;overflow:visible}[part=empty]{pointer-events:none;block-size:100%;inline-size:100%}[part=overlay-rail]{inset-inline:var(--lr-space-s);z-index:var(--lr-layer-content);align-items:flex-end;gap:var(--lr-space-s);pointer-events:none;flex-wrap:wrap;display:flex;position:absolute}[part=overlay-rail][data-edge=top]{inset-block-start:var(--lr-space-s)}[part=overlay-rail][data-edge=bottom]{inset-block-end:var(--lr-space-s)}.overlay-group{gap:var(--lr-space-s);pointer-events:auto;flex-wrap:wrap;max-inline-size:100%;display:flex}.overlay-group[data-align=end]{margin-inline-start:auto}[part=node]{will-change:transform;min-inline-size:var(--lr-size-1-5rem);min-block-size:var(--lr-size-1-5rem);position:absolute;inset-block-start:0;inset-inline-start:0}[part=node-control]{min-inline-size:var(--lr-icon-button-size);min-block-size:var(--lr-icon-button-size)}.portable-node-card{align-items:stretch;gap:var(--lr-space-xs);min-inline-size:calc(var(--lr-size-10rem) + var(--lr-size-1rem));padding:var(--lr-space-s);border:var(--lr-border-width-thin) solid var(--lr-color-border);border-radius:var(--lr-radius);background:var(--lr-color-surface);box-shadow:var(--lr-shadow-s);display:flex}.portable-node-content{overflow-wrap:anywhere;flex-direction:column;flex:auto;min-inline-size:0;display:flex}.portable-handles{flex-direction:column;justify-content:space-around;display:flex}.portable-handles>span{inline-size:var(--lr-size-0-5rem);block-size:var(--lr-size-0-5rem);border-radius:var(--lr-radius-pill);background:var(--lr-color-border-strong)}[part=node]:focus-within{z-index:var(--lr-layer-content)}[part=edge]{fill:none;stroke:var(--lr-flow-canvas-edge-neutral-color,var(--lr-color-border));stroke-width:1.5px;pointer-events:stroke;cursor:pointer}[part=edge-hit-area]{fill:none;stroke:#0000;stroke-width:var(--lr-icon-button-size);pointer-events:stroke;cursor:pointer}[part=edge][data-tone=brand]{stroke:var(--lr-flow-canvas-edge-brand-color,var(--lr-color-brand))}[part=edge][data-tone=success]{stroke:var(--lr-flow-canvas-edge-success-color,var(--lr-color-success))}[part=edge][data-tone=warning]{stroke:var(--lr-flow-canvas-edge-warning-color,var(--lr-color-warning))}[part=edge][data-tone=danger]{stroke:var(--lr-flow-canvas-edge-danger-color,var(--lr-color-danger))}[part=arrowhead]{fill:var(--lr-flow-canvas-edge-neutral-color,var(--lr-color-border))}[part=arrowhead][data-tone=brand]{fill:var(--lr-flow-canvas-edge-brand-color,var(--lr-color-brand))}[part=arrowhead][data-tone=success]{fill:var(--lr-flow-canvas-edge-success-color,var(--lr-color-success))}[part=arrowhead][data-tone=warning]{fill:var(--lr-flow-canvas-edge-warning-color,var(--lr-color-warning))}[part=arrowhead][data-tone=danger]{fill:var(--lr-flow-canvas-edge-danger-color,var(--lr-color-danger))}[part=stub]{stroke:var(--lr-color-border);stroke-width:1.5px;stroke-dasharray:3 3;opacity:.6}[part=edge-label]{fill:var(--lr-color-text);font:var(--lr-font-size-xs) / 1 var(--lr-font);text-anchor:middle;stroke:var(--lr-color-surface);stroke-width:var(--lr-size-3px)}[part=layout-limit]{inset-inline:var(--lr-space-s);z-index:var(--lr-layer-content);max-inline-size:calc(100% - 2 * var(--lr-space-s));padding:var(--lr-space-2xs) var(--lr-space-s);border:var(--lr-border-width-thin) solid var(--lr-color-warning);border-radius:var(--lr-radius);background:var(--lr-color-surface);color:var(--lr-color-text);font-size:var(--lr-font-size-xs);overflow-wrap:anywhere;position:absolute;inset-block-end:var(--lr-space-s)}.world{transform-origin:0 0;will-change:transform;block-size:100%;inline-size:100%;position:absolute;inset-block-start:0;inset-inline-start:0}[part=background]{background-image:radial-gradient(circle, var(--lr-color-border) var(--lr-size-1px), transparent var(--lr-size-1px));background-size:var(--lr-flow-canvas-grid-size,var(--_lr-flow-canvas-grid-size,var(--lr-size-0-5rem))) var(--lr-flow-canvas-grid-size,var(--_lr-flow-canvas-grid-size,var(--lr-size-0-5rem)));cursor:grab;block-size:500%;inline-size:500%;position:absolute;inset-block-start:-200%;inset-inline-start:-200%}[part=viewport][data-panning] [part=background]{cursor:grabbing}[part=viewport][data-empty] .world{pointer-events:none}:host([locked]) [part=background]{cursor:default}:host([orientation=horizontal]:dir(rtl)) [part=viewport],:host([orientation=horizontal]:dir(rtl)) [part=node] ::slotted(*),:host([orientation=horizontal]:dir(rtl)) [part=node] [data-flow-canvas-default-card]{transform:scaleX(-1)}[part=node][data-selected]{outline:var(--lr-size-2px) solid var(--lr-flow-canvas-node-selected-outline-color,var(--lr-color-brand));outline-offset:var(--lr-size-2px);border-radius:var(--lr-radius)}[part=node]:hover{outline:var(--lr-size-1px) solid var(--lr-flow-canvas-node-hover-outline-color,var(--lr-color-border-strong));outline-offset:var(--lr-size-2px)}[part=node]:active{outline:var(--lr-size-2px) solid var(--lr-flow-canvas-node-hover-outline-color,var(--lr-color-border-strong));outline-offset:var(--lr-size-2px)}[part=edge][aria-pressed=true],[part=edge]:hover,[part=edge-hit-area]:hover+[part=edge]{stroke-width:2.5px}[part=edge]:active,[part=edge-hit-area]:active+[part=edge]{stroke-width:3.5px}[part=node]:has([part=node-control]:focus-visible),[part=edge]:focus-visible{outline:var(--lr-focus-ring-width) solid var(--lr-focus-ring-color);outline-offset:var(--lr-focus-ring-offset)}[part=connection-line]{fill:none;stroke:var(--lr-color-brand);stroke-width:1.5px;stroke-dasharray:4 4;pointer-events:none}[part=node][data-connect-invalid]{outline:var(--lr-size-2px) solid var(--lr-flow-canvas-node-connect-invalid-outline-color,var(--lr-color-danger));outline-offset:var(--lr-size-2px)}[part=node][data-connect-target]{outline:var(--lr-size-2px) dashed var(--lr-flow-canvas-node-connect-target-outline-color,var(--lr-color-brand));outline-offset:var(--lr-size-2px)}[part=viewport][data-drop-active]{outline:var(--lr-size-2px) dashed var(--lr-flow-canvas-drop-active-outline-color,var(--lr-color-brand));outline-offset:calc(-1 * var(--lr-size-2px))}[part=viewport][data-drop-active]:focus-visible{box-shadow:inset 0 0 0 var(--lr-focus-ring-width) var(--lr-focus-ring-color)}[part=edge][data-running]{stroke-dasharray:6 4;animation:lr-flow-canvas-march var(--lr-flow-canvas-march-duration,var(--lr-duration-ambient)) linear infinite}[part=edge][data-running-static]{stroke-dasharray:6 4}@media (prefers-reduced-motion:reduce){[part=edge][data-running]{animation:none}}@keyframes lr-flow-canvas-march{to{stroke-dashoffset:-20px}}`;export{styles};
@@ -1 +1 @@
1
- const FLOW_STATUSES=new Set(["pending","running","success","error","denied"]),FLOW_VARIANTS=new Set(["neutral","brand","success","warning","danger"]),MAX_FLOW_COLLECTION_ENTRIES=1e4,MAX_FLOW_COLLECTION_NODES=5e4,MAX_FLOW_COLLECTION_DEPTH=16;function isRecord(value){if(typeof value!="object"||value===null||Array.isArray(value))return!1;try{const prototype=Object.getPrototypeOf(value);return prototype===Object.prototype||prototype===null}catch{return!1}}function snapshotFlowPosition(value){if(!isRecord(value))return;const x=value.x,y=value.y;if(!(typeof x!="number"||typeof y!="number"||!Number.isFinite(x)||!Number.isFinite(y)))return Object.freeze({x,y})}function snapshotFlowData(value){const root={},seen=new WeakMap,work=[{source:value,target:root,depth:0}],owned=[root];seen.set(value,root);let remaining=MAX_FLOW_COLLECTION_NODES;for(;work.length>0&&remaining>0;){const{source,target,depth}=work.pop();let descriptors;try{descriptors=Object.getOwnPropertyDescriptors(source)}catch{continue}let retainedEntries=0;for(const[key,descriptor]of Object.entries(descriptors)){if(!descriptor.enumerable||!("value"in descriptor))continue;if(retainedEntries>=MAX_FLOW_COLLECTION_ENTRIES||remaining<=0)break;retainedEntries+=1,remaining-=1;const item=descriptor.value;if(Array.isArray(item)||isRecord(item)){if(depth>=MAX_FLOW_COLLECTION_DEPTH)continue;let clone=seen.get(item);clone||(clone=Array.isArray(item)?[]:{},seen.set(item,clone),owned.push(clone),work.push({source:item,target:clone,depth:depth+1})),target[key]=clone}else target[key]=item}}for(let index=owned.length-1;index>=0;index--)Object.freeze(owned[index]);return root}function normalizeFlowStatus(value){return typeof value=="string"&&FLOW_STATUSES.has(value)?value:null}function normalizeFlowVariant(value){return typeof value=="string"&&FLOW_VARIANTS.has(value)?value:void 0}function snapshotFlowHandles(value){if(!Array.isArray(value))return;const result=[],seen=new Set;for(const handle of value.slice(0,MAX_FLOW_COLLECTION_ENTRIES))try{const id=handle?.id;if(typeof id!="string"||id.trim()===""||seen.has(id))continue;seen.add(id),result.push(Object.freeze({id,...typeof handle?.label=="string"?{label:handle.label}:{}}))}catch{}return Object.freeze(result)}function snapshotFlowNodes(value){if(!Array.isArray(value))return Object.freeze([]);const nodes=[],seen=new Set;for(const node of value.slice(0,MAX_FLOW_COLLECTION_ENTRIES))try{const id=node?.id;if(typeof id!="string"||id.trim().length===0||seen.has(id))continue;const data=isRecord(node?.data)?snapshotFlowData(node.data):void 0,position=snapshotFlowPosition(node?.position),inputs=snapshotFlowHandles(node?.inputs),outputs=snapshotFlowHandles(node?.outputs),snapshot=Object.freeze({id,...typeof node?.type=="string"?{type:node.type}:{},...position?{position}:{},...data?{data}:{},...typeof node?.accessibleLabel=="string"?{accessibleLabel:node.accessibleLabel}:{},...inputs?{inputs}:{},...outputs?{outputs}:{}});seen.add(id),nodes.push(snapshot)}catch{}return Object.freeze(nodes)}function snapshotFlowEdges(value){if(!Array.isArray(value))return Object.freeze([]);const edges=[],seen=new Set;for(const edge of value.slice(0,MAX_FLOW_COLLECTION_ENTRIES))try{const id=edge?.id;if(typeof id!="string"||id.trim().length===0||seen.has(id))continue;const tone=normalizeFlowVariant(edge?.tone),snapshot=Object.freeze({id,source:typeof edge?.source=="string"?edge.source:"",target:typeof edge?.target=="string"?edge.target:"",...typeof edge?.sourceHandle=="string"?{sourceHandle:edge.sourceHandle}:{},...typeof edge?.targetHandle=="string"?{targetHandle:edge.targetHandle}:{},...typeof edge?.label=="string"?{label:edge.label}:{},...tone?{tone}:{}});seen.add(id),edges.push(snapshot)}catch{}return Object.freeze(edges)}function snapshotFlowDecorations(value){if(!isRecord(value))return Object.freeze({});const entries=[];let keys;try{keys=Object.keys(value).slice(0,MAX_FLOW_COLLECTION_ENTRIES)}catch{return Object.freeze({})}for(const id of keys){let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,id)}catch{continue}if(!descriptor||!("value"in descriptor))continue;const candidate=descriptor.value;if(!isRecord(candidate))continue;const status=normalizeFlowStatus(candidate.status);status&&entries.push([id,Object.freeze({status,...typeof candidate.progress=="number"?{progress:candidate.progress}:{},...typeof candidate.durationMs=="number"?{durationMs:candidate.durationMs}:{},...typeof candidate.detail=="string"?{detail:candidate.detail}:{}})])}return Object.freeze(Object.fromEntries(entries))}export{MAX_FLOW_COLLECTION_ENTRIES,normalizeFlowStatus,normalizeFlowVariant,snapshotFlowDecorations,snapshotFlowEdges,snapshotFlowHandles,snapshotFlowNodes};
1
+ const FLOW_STATUSES=new Set(["pending","running","success","error","denied"]),FLOW_VARIANTS=new Set(["neutral","brand","success","warning","danger"]),MAX_FLOW_COLLECTION_ENTRIES=1e4,MAX_FLOW_COLLECTION_NODES=5e4,MAX_FLOW_COLLECTION_DEPTH=16;function isRecord(value){if(typeof value!="object"||value===null||Array.isArray(value))return!1;try{const prototype=Object.getPrototypeOf(value);return prototype===Object.prototype||prototype===null}catch{return!1}}function snapshotFlowPosition(value){if(!isRecord(value))return;const x=value.x,y=value.y;if(!(typeof x!="number"||typeof y!="number"||!Number.isFinite(x)||!Number.isFinite(y)))return Object.freeze({x,y})}function snapshotFlowData(value){const root={},seen=new WeakMap,work=[{source:value,target:root,depth:0}],owned=[root];seen.set(value,root);let remaining=MAX_FLOW_COLLECTION_NODES;for(;work.length>0&&remaining>0;){const{source,target,depth}=work.pop();let descriptors;try{descriptors=Object.getOwnPropertyDescriptors(source)}catch{continue}let retainedEntries=0;for(const[key,descriptor]of Object.entries(descriptors)){if(!descriptor.enumerable||!("value"in descriptor))continue;if(retainedEntries>=MAX_FLOW_COLLECTION_ENTRIES||remaining<=0)break;retainedEntries+=1,remaining-=1;const item=descriptor.value;if(Array.isArray(item)||isRecord(item)){if(depth>=MAX_FLOW_COLLECTION_DEPTH)continue;let clone=seen.get(item);clone||(clone=Array.isArray(item)?[]:{},seen.set(item,clone),owned.push(clone),work.push({source:item,target:clone,depth:depth+1})),target[key]=clone}else target[key]=item}}for(let index=owned.length-1;index>=0;index--)Object.freeze(owned[index]);return root}function normalizeFlowStatus(value){return typeof value=="string"&&FLOW_STATUSES.has(value)?value:null}function normalizeFlowVariant(value){return typeof value=="string"&&FLOW_VARIANTS.has(value)?value:void 0}function snapshotFlowHandles(value){if(!Array.isArray(value))return;const result=[],seen=new Set;for(const handle of value.slice(0,MAX_FLOW_COLLECTION_ENTRIES))try{const id=handle?.id;if(typeof id!="string"||id.trim()===""||seen.has(id))continue;const label=handle?.label;result.push(Object.freeze({id,...typeof label=="string"?{label}:{}})),seen.add(id)}catch{}return Object.freeze(result)}function snapshotFlowNodes(value){if(!Array.isArray(value))return Object.freeze([]);const nodes=[],seen=new Set;for(const node of value.slice(0,MAX_FLOW_COLLECTION_ENTRIES))try{const id=node?.id;if(typeof id!="string"||id.trim().length===0||seen.has(id))continue;const data=isRecord(node?.data)?snapshotFlowData(node.data):void 0,position=snapshotFlowPosition(node?.position),inputs=snapshotFlowHandles(node?.inputs),outputs=snapshotFlowHandles(node?.outputs),snapshot=Object.freeze({id,...typeof node?.type=="string"?{type:node.type}:{},...position?{position}:{},...data?{data}:{},...typeof node?.accessibleLabel=="string"?{accessibleLabel:node.accessibleLabel}:{},...inputs?{inputs}:{},...outputs?{outputs}:{}});seen.add(id),nodes.push(snapshot)}catch{}return Object.freeze(nodes)}function snapshotFlowEdges(value){if(!Array.isArray(value))return Object.freeze([]);const edges=[],seen=new Set;for(const edge of value.slice(0,MAX_FLOW_COLLECTION_ENTRIES))try{const id=edge?.id;if(typeof id!="string"||id.trim().length===0||seen.has(id))continue;const tone=normalizeFlowVariant(edge?.tone),snapshot=Object.freeze({id,source:typeof edge?.source=="string"?edge.source:"",target:typeof edge?.target=="string"?edge.target:"",...typeof edge?.sourceHandle=="string"?{sourceHandle:edge.sourceHandle}:{},...typeof edge?.targetHandle=="string"?{targetHandle:edge.targetHandle}:{},...typeof edge?.label=="string"?{label:edge.label}:{},...tone?{tone}:{}});seen.add(id),edges.push(snapshot)}catch{}return Object.freeze(edges)}function snapshotFlowDecorations(value){if(!isRecord(value))return Object.freeze({});const entries=[];let keys;try{keys=Object.keys(value).slice(0,MAX_FLOW_COLLECTION_ENTRIES)}catch{return Object.freeze({})}for(const id of keys){let descriptor;try{descriptor=Object.getOwnPropertyDescriptor(value,id)}catch{continue}if(!descriptor||!("value"in descriptor))continue;const candidate=descriptor.value;try{if(!isRecord(candidate))continue;const status=normalizeFlowStatus(candidate.status);if(!status)continue;const progress=candidate.progress,durationMs=candidate.durationMs,detail=candidate.detail;entries.push([id,Object.freeze({status,...typeof progress=="number"?{progress}:{},...typeof durationMs=="number"?{durationMs}:{},...typeof detail=="string"?{detail}:{}})])}catch{}}return Object.freeze(Object.fromEntries(entries))}export{MAX_FLOW_COLLECTION_ENTRIES,normalizeFlowStatus,normalizeFlowVariant,snapshotFlowDecorations,snapshotFlowEdges,snapshotFlowHandles,snapshotFlowNodes};
@@ -1,5 +1,6 @@
1
1
  import type{LyraOrientation,LyraToolStatus}from'../../../internal/shared-unions.js';import type{LyraVariant}from'../../../internal/variants.js';
2
- /** A named input/output connection point on a flow node. */
2
+ /** A named input/output connection point on a flow node. Collections retain the first valid
3
+ * occurrence of each id; an unreadable optional label does not reserve that id. */
3
4
  export interface FlowHandle{readonly id:string;readonly label?:string;}
4
5
  /** A controlled node in a flow canvas. `id` must be nonempty and unique within `nodes`; the
5
6
  * first valid occurrence wins. Reassign the collection to publish model changes. */