@akohn/dashql-react 0.0.0-stage → 0.0.20-dev.1001.g5e5121808

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 (356) hide show
  1. package/LICENSE +373 -0
  2. package/NOTICE +118 -0
  3. package/README.md +133 -2
  4. package/dist/_virtual/_vite/preload-helper.js +100 -0
  5. package/dist/brand/brand.d.ts +13 -0
  6. package/dist/brand/brand.js +14 -0
  7. package/dist/brand/landing_backdrop.d.ts +56 -0
  8. package/dist/brand/landing_backdrop.js +1019 -0
  9. package/dist/brand/wobble_morph.d.ts +54 -0
  10. package/dist/brand/wobble_morph.js +439 -0
  11. package/dist/components/action_list.d.ts +31 -0
  12. package/dist/components/action_list.js +63 -0
  13. package/dist/components/action_list.module.js +11 -0
  14. package/dist/components/anchored_overlay.d.ts +28 -0
  15. package/dist/components/anchored_overlay.js +93 -0
  16. package/dist/components/button.d.ts +42 -0
  17. package/dist/components/button.js +97 -0
  18. package/dist/components/button.module.js +20 -0
  19. package/dist/components/button_group.d.ts +7 -0
  20. package/dist/components/button_group.js +18 -0
  21. package/dist/components/button_group.module.js +3 -0
  22. package/dist/components/card_placeholder.d.ts +9 -0
  23. package/dist/components/card_placeholder.js +39 -0
  24. package/dist/components/card_placeholder.module.js +6 -0
  25. package/dist/components/clipboard.d.ts +19 -0
  26. package/dist/components/clipboard.js +54 -0
  27. package/dist/components/data_table/computation_tables.d.ts +12 -0
  28. package/dist/components/data_table/computation_tables.js +42 -0
  29. package/dist/components/data_table/data_table.d.ts +39 -0
  30. package/dist/components/data_table/data_table.js +415 -0
  31. package/dist/components/data_table/data_table.module.js +41 -0
  32. package/dist/components/data_table/data_table_cell.d.ts +7 -0
  33. package/dist/components/data_table/data_table_cell.js +9 -0
  34. package/dist/components/data_table/data_table_cell_data.d.ts +22 -0
  35. package/dist/components/data_table/data_table_cell_data.js +103 -0
  36. package/dist/components/data_table/data_table_cell_header_name.d.ts +17 -0
  37. package/dist/components/data_table/data_table_cell_header_name.js +73 -0
  38. package/dist/components/data_table/data_table_cell_header_plots.d.ts +29 -0
  39. package/dist/components/data_table/data_table_cell_header_plots.js +120 -0
  40. package/dist/components/data_table/data_table_colors.d.ts +19 -0
  41. package/dist/components/data_table/data_table_colors.js +27 -0
  42. package/dist/components/data_table/data_table_column_resize.d.ts +21 -0
  43. package/dist/components/data_table/data_table_column_resize.js +121 -0
  44. package/dist/components/data_table/data_table_focus.d.ts +15 -0
  45. package/dist/components/data_table/data_table_focus.js +53 -0
  46. package/dist/components/data_table/data_table_layout.d.ts +18 -0
  47. package/dist/components/data_table/data_table_layout.js +103 -0
  48. package/dist/components/data_table/data_table_ordering.d.ts +9 -0
  49. package/dist/components/data_table/data_table_ordering.js +39 -0
  50. package/dist/components/data_table/data_table_portals.d.ts +9 -0
  51. package/dist/components/data_table/data_table_portals.js +29 -0
  52. package/dist/components/data_table/data_table_row_detail.d.ts +22 -0
  53. package/dist/components/data_table/data_table_row_detail.js +68 -0
  54. package/dist/components/data_table/data_table_row_detail.module.js +7 -0
  55. package/dist/components/data_table/data_table_sticky_views.d.ts +35 -0
  56. package/dist/components/data_table/data_table_sticky_views.js +161 -0
  57. package/dist/components/data_table/data_table_window.d.ts +18 -0
  58. package/dist/components/data_table/data_table_window.js +118 -0
  59. package/dist/components/data_table/format_peek.d.ts +2 -0
  60. package/dist/components/data_table/format_peek.js +17 -0
  61. package/dist/components/data_table/histogram_bars.d.ts +36 -0
  62. package/dist/components/data_table/histogram_bars.js +100 -0
  63. package/dist/components/data_table/histogram_brush.d.ts +22 -0
  64. package/dist/components/data_table/histogram_brush.js +105 -0
  65. package/dist/components/data_table/histogram_cell.d.ts +17 -0
  66. package/dist/components/data_table/histogram_cell.js +324 -0
  67. package/dist/components/data_table/histogram_cell.module.js +9 -0
  68. package/dist/components/data_table/histogram_label.d.ts +1 -0
  69. package/dist/components/data_table/histogram_label.js +7 -0
  70. package/dist/components/data_table/memo_props.d.ts +1 -0
  71. package/dist/components/data_table/memo_props.js +17 -0
  72. package/dist/components/data_table/mostfrequent_cell.d.ts +17 -0
  73. package/dist/components/data_table/mostfrequent_cell.js +316 -0
  74. package/dist/components/data_table/mostfrequent_cell.module.js +10 -0
  75. package/dist/components/data_table/use_cross_filters.d.ts +14 -0
  76. package/dist/components/data_table/use_cross_filters.js +47 -0
  77. package/dist/components/deferred.d.ts +11 -0
  78. package/dist/components/deferred.js +41 -0
  79. package/dist/components/deferred.module.js +5 -0
  80. package/dist/components/error_boundary.d.ts +18 -0
  81. package/dist/components/error_boundary.js +15 -0
  82. package/dist/components/graph.module.js +15 -0
  83. package/dist/components/graph_port.d.ts +10 -0
  84. package/dist/components/graph_port.js +34 -0
  85. package/dist/components/inspector_overlay.d.ts +32 -0
  86. package/dist/components/inspector_overlay.js +72 -0
  87. package/dist/components/inspector_overlay.module.js +18 -0
  88. package/dist/components/json/json_arrow_symbol.d.ts +4 -0
  89. package/dist/components/json/json_arrow_symbol.js +25 -0
  90. package/dist/components/json/json_copy_button.d.ts +11 -0
  91. package/dist/components/json/json_copy_button.js +61 -0
  92. package/dist/components/json/json_ellipsis_symbol.d.ts +7 -0
  93. package/dist/components/json/json_ellipsis_symbol.js +11 -0
  94. package/dist/components/json/json_item_count.d.ts +5 -0
  95. package/dist/components/json/json_item_count.js +12 -0
  96. package/dist/components/json/json_key_name.d.ts +6 -0
  97. package/dist/components/json/json_key_name.js +40 -0
  98. package/dist/components/json/json_key_values.d.ts +12 -0
  99. package/dist/components/json/json_key_values.js +99 -0
  100. package/dist/components/json/json_literal.d.ts +8 -0
  101. package/dist/components/json/json_literal.js +140 -0
  102. package/dist/components/json/json_nested_close.d.ts +11 -0
  103. package/dist/components/json/json_nested_close.js +31 -0
  104. package/dist/components/json/json_nested_open.d.ts +18 -0
  105. package/dist/components/json/json_nested_open.js +150 -0
  106. package/dist/components/json/json_nested_state.d.ts +14 -0
  107. package/dist/components/json/json_nested_state.js +28 -0
  108. package/dist/components/json/json_tool_state.d.ts +18 -0
  109. package/dist/components/json/json_tool_state.js +46 -0
  110. package/dist/components/json/json_value.d.ts +10 -0
  111. package/dist/components/json/json_value.js +46 -0
  112. package/dist/components/json/json_view.d.ts +14 -0
  113. package/dist/components/json/json_view.js +37 -0
  114. package/dist/components/json/json_view.module.js +41 -0
  115. package/dist/components/json/json_view_state.d.ts +14 -0
  116. package/dist/components/json/json_view_state.js +32 -0
  117. package/dist/components/json/unique_key.d.ts +1 -0
  118. package/dist/components/json/unique_key.js +8 -0
  119. package/dist/components/keyvalue_list.d.ts +25 -0
  120. package/dist/components/keyvalue_list.js +106 -0
  121. package/dist/components/keyvalue_list.module.js +15 -0
  122. package/dist/components/name_input.d.ts +12 -0
  123. package/dist/components/name_input.js +63 -0
  124. package/dist/components/overlay.d.ts +53 -0
  125. package/dist/components/overlay.js +183 -0
  126. package/dist/components/overlay.module.js +32 -0
  127. package/dist/components/panel_resize_handle.d.ts +12 -0
  128. package/dist/components/panel_resize_handle.js +39 -0
  129. package/dist/components/portal.d.ts +8 -0
  130. package/dist/components/portal.js +53 -0
  131. package/dist/components/progress_bar.d.ts +7 -0
  132. package/dist/components/progress_bar.js +21 -0
  133. package/dist/components/progress_bar.module.js +3 -0
  134. package/dist/components/query_history_viewer.d.ts +31 -0
  135. package/dist/components/query_history_viewer.js +271 -0
  136. package/dist/components/query_history_viewer.module.js +7 -0
  137. package/dist/components/query_profile/engine_profile_view.d.ts +19 -0
  138. package/dist/components/query_profile/engine_profile_view.js +94 -0
  139. package/dist/components/query_profile/numeric_limits.d.ts +1 -0
  140. package/dist/components/query_profile/numeric_limits.js +2 -0
  141. package/dist/components/query_profile/profile_execution_controller.d.ts +12 -0
  142. package/dist/components/query_profile/profile_execution_controller.js +44 -0
  143. package/dist/components/query_profile/profile_fit.d.ts +24 -0
  144. package/dist/components/query_profile/profile_fit.js +22 -0
  145. package/dist/components/query_profile/profile_navigation.d.ts +3 -0
  146. package/dist/components/query_profile/profile_navigation.js +34 -0
  147. package/dist/components/query_profile/profile_scene.d.ts +64 -0
  148. package/dist/components/query_profile/profile_scene.js +422 -0
  149. package/dist/components/query_profile/query_profile_view.d.ts +36 -0
  150. package/dist/components/query_profile/query_profile_view.js +953 -0
  151. package/dist/components/query_profile/query_profile_view.module.js +23 -0
  152. package/dist/components/query_progress/query_profile_overlay.d.ts +7 -0
  153. package/dist/components/query_progress/query_profile_overlay.js +67 -0
  154. package/dist/components/query_progress/query_profile_overlay.module.js +6 -0
  155. package/dist/components/query_progress/query_progress_panel.d.ts +14 -0
  156. package/dist/components/query_progress/query_progress_panel.js +255 -0
  157. package/dist/components/query_progress/query_progress_panel.module.js +10 -0
  158. package/dist/components/query_result/cell_detail_overlay.d.ts +34 -0
  159. package/dist/components/query_result/cell_detail_overlay.js +277 -0
  160. package/dist/components/query_result/cell_detail_overlay.module.js +21 -0
  161. package/dist/components/query_result/query_result_action_menu.d.ts +12 -0
  162. package/dist/components/query_result/query_result_action_menu.js +62 -0
  163. package/dist/components/query_result/query_result_action_menu.module.js +2 -0
  164. package/dist/components/query_result/query_result_details.d.ts +17 -0
  165. package/dist/components/query_result/query_result_details.js +46 -0
  166. package/dist/components/query_result/query_result_details.module.js +5 -0
  167. package/dist/components/query_result/query_result_download_button.d.ts +8 -0
  168. package/dist/components/query_result/query_result_download_button.js +38 -0
  169. package/dist/components/query_result/query_result_header.d.ts +21 -0
  170. package/dist/components/query_result/query_result_header.js +72 -0
  171. package/dist/components/query_result/query_result_header.module.js +3 -0
  172. package/dist/components/query_result/query_result_search_controls.d.ts +12 -0
  173. package/dist/components/query_result/query_result_search_controls.js +141 -0
  174. package/dist/components/query_result/query_result_search_controls.module.js +7 -0
  175. package/dist/components/query_result/query_result_toolbar.d.ts +21 -0
  176. package/dist/components/query_result/query_result_toolbar.js +74 -0
  177. package/dist/components/query_result/result_table_overlay.d.ts +9 -0
  178. package/dist/components/query_result/result_table_overlay.js +73 -0
  179. package/dist/components/query_result/result_table_overlay.module.js +6 -0
  180. package/dist/components/query_result/use_query_result_search.d.ts +8 -0
  181. package/dist/components/query_result/use_query_result_search.js +28 -0
  182. package/dist/components/segmented_control.d.ts +58 -0
  183. package/dist/components/segmented_control.js +116 -0
  184. package/dist/components/segmented_control.module.js +17 -0
  185. package/dist/components/separator.d.ts +21 -0
  186. package/dist/components/separator.js +79 -0
  187. package/dist/components/separator.module.js +7 -0
  188. package/dist/components/sheet.d.ts +11 -0
  189. package/dist/components/sheet.js +65 -0
  190. package/dist/components/sheet.module.js +7 -0
  191. package/dist/components/size_observer.d.ts +7 -0
  192. package/dist/components/size_observer.js +57 -0
  193. package/dist/components/skeleton.d.ts +2 -0
  194. package/dist/components/skeleton.js +14 -0
  195. package/dist/components/skeleton.module.js +2 -0
  196. package/dist/components/spinners.d.ts +8 -0
  197. package/dist/components/spinners.js +33 -0
  198. package/dist/components/spinners.module.js +8 -0
  199. package/dist/components/status_indicator.d.ts +36 -0
  200. package/dist/components/status_indicator.js +182 -0
  201. package/dist/components/status_indicator.module.js +3 -0
  202. package/dist/components/symbol_icon.d.ts +65 -0
  203. package/dist/components/symbol_icon.js +213 -0
  204. package/dist/components/tab_header.d.ts +11 -0
  205. package/dist/components/tab_header.js +55 -0
  206. package/dist/components/tab_header.module.js +7 -0
  207. package/dist/components/tag.d.ts +10 -0
  208. package/dist/components/tag.js +17 -0
  209. package/dist/components/tag.module.js +4 -0
  210. package/dist/components/text_field.d.ts +44 -0
  211. package/dist/components/text_field.js +159 -0
  212. package/dist/components/text_field.module.js +15 -0
  213. package/dist/components/text_input.d.ts +25 -0
  214. package/dist/components/text_input.js +90 -0
  215. package/dist/components/text_input.module.js +13 -0
  216. package/dist/components/text_input_action.d.ts +19 -0
  217. package/dist/components/text_input_action.js +33 -0
  218. package/dist/components/text_input_action.module.js +2 -0
  219. package/dist/components/toggle_switch.d.ts +7 -0
  220. package/dist/components/toggle_switch.js +22 -0
  221. package/dist/components/toggle_switch.module.js +6 -0
  222. package/dist/components/tooltip.d.ts +22 -0
  223. package/dist/components/tooltip.js +139 -0
  224. package/dist/components/tooltip.module.js +2 -0
  225. package/dist/components/tree_entry.d.ts +17 -0
  226. package/dist/components/tree_entry.js +48 -0
  227. package/dist/components/tree_entry.module.js +9 -0
  228. package/dist/components/value_list.d.ts +17 -0
  229. package/dist/components/value_list.js +70 -0
  230. package/dist/components/value_list.module.js +8 -0
  231. package/dist/components/vegalite_chart.d.ts +16 -0
  232. package/dist/components/vegalite_chart.js +149 -0
  233. package/dist/components/vegalite_chart.module.js +3 -0
  234. package/dist/components/vegalite_view.d.ts +26 -0
  235. package/dist/components/vegalite_view.js +239 -0
  236. package/dist/components/vegalite_view.module.js +5 -0
  237. package/dist/components/vertical_scroll_shadows.d.ts +14 -0
  238. package/dist/components/vertical_scroll_shadows.js +55 -0
  239. package/dist/components/vertical_scroll_shadows.module.js +5 -0
  240. package/dist/components/vertical_split.d.ts +15 -0
  241. package/dist/components/vertical_split.js +112 -0
  242. package/dist/components/vertical_split.module.js +5 -0
  243. package/dist/components/vertical_tabs.d.ts +36 -0
  244. package/dist/components/vertical_tabs.js +169 -0
  245. package/dist/components/vertical_tabs.module.js +23 -0
  246. package/dist/components/visualization/capped_rows.d.ts +9 -0
  247. package/dist/components/visualization/capped_rows.js +23 -0
  248. package/dist/components/visualization/capped_rows.module.js +3 -0
  249. package/dist/components/visualization/chart_download_button.d.ts +12 -0
  250. package/dist/components/visualization/chart_download_button.js +41 -0
  251. package/dist/components/visualization/kpi_view.d.ts +10 -0
  252. package/dist/components/visualization/kpi_view.js +215 -0
  253. package/dist/components/visualization/kpi_view.module.js +17 -0
  254. package/dist/components/visualization/markdown_view.d.ts +17 -0
  255. package/dist/components/visualization/markdown_view.js +154 -0
  256. package/dist/components/visualization/markdown_view.module.js +4 -0
  257. package/dist/components/visualization/result_rows.d.ts +17 -0
  258. package/dist/components/visualization/result_rows.js +82 -0
  259. package/dist/components/visualization/vegalite_preview.d.ts +8 -0
  260. package/dist/components/visualization/vegalite_preview.js +17 -0
  261. package/dist/components/visualization/vegalite_preview.module.js +2 -0
  262. package/dist/components/visualization/visualization_dispatch.d.ts +13 -0
  263. package/dist/components/visualization/visualization_dispatch.js +40 -0
  264. package/dist/components/visualization/visualization_panel.d.ts +10 -0
  265. package/dist/components/visualization/visualization_panel.js +36 -0
  266. package/dist/components/visualization/visualization_panel.module.js +3 -0
  267. package/dist/dom/anchored_position.d.ts +42 -0
  268. package/dist/dom/anchored_position.js +255 -0
  269. package/dist/dom/app_host.d.ts +2 -0
  270. package/dist/dom/app_host.js +7 -0
  271. package/dist/dom/calm_frames.d.ts +29 -0
  272. package/dist/dom/calm_frames.js +120 -0
  273. package/dist/dom/classnames.d.ts +8 -0
  274. package/dist/dom/classnames.js +20 -0
  275. package/dist/dom/download_file.d.ts +1 -0
  276. package/dist/dom/download_file.js +12 -0
  277. package/dist/dom/focus.d.ts +29 -0
  278. package/dist/dom/focus.js +84 -0
  279. package/dist/dom/graph_edges.d.ts +53 -0
  280. package/dist/dom/graph_edges.js +450 -0
  281. package/dist/dom/key_events.d.ts +9 -0
  282. package/dist/dom/key_events.js +33 -0
  283. package/dist/dom/media_query.d.ts +5 -0
  284. package/dist/dom/media_query.js +18 -0
  285. package/dist/dom/outside_click.d.ts +8 -0
  286. package/dist/dom/outside_click.js +32 -0
  287. package/dist/dom/rerender_ref.d.ts +2 -0
  288. package/dist/dom/rerender_ref.js +11 -0
  289. package/dist/dom/row_context_menu.d.ts +7 -0
  290. package/dist/dom/row_context_menu.js +32 -0
  291. package/dist/dom/scrollbar.d.ts +3 -0
  292. package/dist/dom/scrollbar.js +23 -0
  293. package/dist/format/format.d.ts +11 -0
  294. package/dist/format/format.js +72 -0
  295. package/dist/format/query_progress_format.d.ts +17 -0
  296. package/dist/format/query_progress_format.js +69 -0
  297. package/dist/format/time_format.d.ts +5 -0
  298. package/dist/format/time_format.js +45 -0
  299. package/dist/hooks.d.ts +72 -0
  300. package/dist/hooks.js +305 -0
  301. package/dist/host.d.ts +10 -0
  302. package/dist/host.js +12 -0
  303. package/dist/logger.d.ts +4 -0
  304. package/dist/logger.js +13 -0
  305. package/dist/models/computation_model.d.ts +14 -0
  306. package/dist/models/computation_model.js +27 -0
  307. package/dist/models/query_model.d.ts +12 -0
  308. package/dist/models/query_model.js +27 -0
  309. package/dist/models/script_model.d.ts +17 -0
  310. package/dist/models/script_model.js +59 -0
  311. package/dist/platform/content_length.d.ts +1 -0
  312. package/dist/platform/content_length.js +7 -0
  313. package/dist/platform/core_provider.d.ts +18 -0
  314. package/dist/platform/core_provider.js +106 -0
  315. package/dist/platform/embedded_database_provider.d.ts +19 -0
  316. package/dist/platform/embedded_database_provider.js +53 -0
  317. package/dist/platform/page_runtime.d.ts +3 -0
  318. package/dist/platform/page_runtime.js +29 -0
  319. package/dist/style.css +4386 -0
  320. package/dist/svg_symbols.d.ts +2 -0
  321. package/dist/svg_symbols.js +2 -0
  322. package/dist/symbols.svg +1197 -0
  323. package/dist/theme/color_scheme.d.ts +4 -0
  324. package/dist/theme/color_scheme.js +28 -0
  325. package/dist/theme/xcode_palette.d.ts +22 -0
  326. package/dist/theme/xcode_palette.js +4 -0
  327. package/dist/theme/xcode_palettes.js +41 -0
  328. package/dist/utils/plan_engine.d.ts +2 -0
  329. package/dist/utils/plan_engine.js +13 -0
  330. package/dist/vegalite/vegalite_check.d.ts +1 -0
  331. package/dist/vegalite/vegalite_check.js +7 -0
  332. package/dist/vegalite/vegalite_crossfilter.d.ts +54 -0
  333. package/dist/vegalite/vegalite_crossfilter.js +187 -0
  334. package/dist/vegalite/vegalite_image.d.ts +14 -0
  335. package/dist/vegalite/vegalite_image.js +28 -0
  336. package/dist/vegalite/vegalite_loader.d.ts +7 -0
  337. package/dist/vegalite/vegalite_loader.js +15 -0
  338. package/dist/vegalite/vegalite_rows.d.ts +3 -0
  339. package/dist/vegalite/vegalite_rows.js +23 -0
  340. package/dist/vegalite/vegalite_theme.d.ts +13 -0
  341. package/dist/vegalite/vegalite_theme.js +141 -0
  342. package/fonts/InstrumentSans-Bold.ttf +0 -0
  343. package/fonts/InstrumentSans-Medium.ttf +0 -0
  344. package/fonts/InstrumentSans-OFL.txt +93 -0
  345. package/fonts/InstrumentSans-Regular.ttf +0 -0
  346. package/fonts/InstrumentSans-SemiBold.ttf +0 -0
  347. package/fonts/JetBrainsMono-Bold.ttf +0 -0
  348. package/fonts/JetBrainsMono-Medium.ttf +0 -0
  349. package/fonts/JetBrainsMono-OFL.txt +93 -0
  350. package/fonts/JetBrainsMono-Regular.ttf +0 -0
  351. package/fonts/JetBrainsMono-SemiBold.ttf +0 -0
  352. package/fonts/fonts.css +61 -0
  353. package/package.json +403 -4
  354. package/styles/colors.css +110 -0
  355. package/styles/flavors/dbcom.css +48 -0
  356. package/styles/tokens.css +192 -0
@@ -0,0 +1,953 @@
1
+ import { SymbolIcon, ZoomInIcon, ZoomOutIcon } from "../symbol_icon.js";
2
+ import { JsonView } from "../json/json_view.js";
3
+ import { ButtonSize, ButtonVariant, IconButton } from "../button.js";
4
+ import { ButtonGroup } from "../button_group.js";
5
+ import { SegmentedControl, SegmentedControlSize } from "../segmented_control.js";
6
+ import { AnchoredOverlay } from "../anchored_overlay.js";
7
+ import { AnchorAlignment, AnchorSide } from "../../dom/anchored_position.js";
8
+ import { OverlaySize } from "../overlay.js";
9
+ import { computeProfileFitTransform } from "./profile_fit.js";
10
+ import { ProfileExecutionController } from "./profile_execution_controller.js";
11
+ import { formatCompactBytes, formatCompactCount, formatElapsed, stat, workOf } from "../../format/query_progress_format.js";
12
+ import { findProfileOperatorInDirection } from "./profile_navigation.js";
13
+ import { PROFILE_OPERATOR_PORT_INPUT, PROFILE_OPERATOR_PORT_OUTPUT, estimateRelativeDifference, materializeProfileScene } from "./profile_scene.js";
14
+ import { controls, edge_legend, edge_legend_matched, edge_legend_scale, fragment, inspector, inspector_header, metric_controls, operator, operator_symbol, pipeline, status_progress, status_spinner, status_track, svg, view_buttons, view_controls, viewport } from "./query_profile_view.module.js";
15
+ import { crossEdge, crossEdgeHighlight, edge, edgeBadge, edgeBadgeLayer, edgeHighlight, edgeHighlightLayer, fragment as fragment$1, fragment_colors, node_frame } from "../graph.module.js";
16
+ import { GraphPort } from "../graph_port.js";
17
+ import * as React from "react";
18
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
19
+ import { color, interpolateOrRd, interpolateRdBu, interpolateRdPu, select, zoom, zoomIdentity } from "d3";
20
+ import * as dashql from "@akohn/dashql";
21
+ import { ProfileExecutionState, isStatReported } from "@akohn/dashql/platform/query/profile_execution_state";
22
+ import { PROFILE_OPERATOR_ANNOTATION_WIDTH, createProfileLayoutConfig } from "@akohn/dashql/platform/query/profile_layout_config";
23
+ import { PROFILE_OPERATOR_SYMBOL_SIZE, getProfileOperatorSymbol, shouldRenderProfileOperatorSymbol } from "@akohn/dashql/platform/query/profile_operator_symbol";
24
+ /** The default zoom limits of the plan, a fit of a large plan lowers the minimum */
25
+ var PROFILE_MIN_ZOOM = .1;
26
+ var PROFILE_MAX_ZOOM = 4;
27
+ var FitIcon = SymbolIcon("focus_center_16");
28
+ var RotateIcon = SymbolIcon("rotate_16");
29
+ var PaintbrushIcon = SymbolIcon("paintbrush_16");
30
+ /**
31
+ * Measure the drawn plan in scene coordinates. Operators drawn as symbols are narrower than their layout, and the
32
+ * fragment contours and badges reach beyond it, so the layout bounds are only the fallback when nothing is drawn.
33
+ * The bounding box of the scene group excludes its own zoom transform.
34
+ */
35
+ function measurePlanBounds(group, scene) {
36
+ try {
37
+ const box = group?.getBBox();
38
+ if (box != null && box.width > 0 && box.height > 0) return {
39
+ left: box.x,
40
+ top: box.y,
41
+ width: box.width,
42
+ height: box.height
43
+ };
44
+ } catch {}
45
+ return {
46
+ left: 0,
47
+ top: 0,
48
+ width: scene.width,
49
+ height: scene.height
50
+ };
51
+ }
52
+ var EDGE_WIDTH = 2;
53
+ var STATUS_ICON_SIZE = 14;
54
+ var OPERATOR_ANNOTATION_MIN_WIDTH = 20;
55
+ var OPERATOR_ANNOTATION_HEIGHT = 16;
56
+ var OPERATOR_ANNOTATION_CHAR_WIDTH = 5.5;
57
+ var OPERATOR_ANNOTATION_PADDING = 8;
58
+ var ESTIMATE_APPROXIMATE_ROW_THRESHOLD = 100;
59
+ var EDGE_BADGE_BORDER = "var(--color_border_strong)";
60
+ var EDGE_HIGHLIGHT_COLOR = "var(--color_accent_emphasis)";
61
+ var EDGE_HIGHLIGHT_TEXT_COLOR = "var(--color_fg_on_emphasis)";
62
+ var PROFILE_ANNOTATION_MODES = [
63
+ {
64
+ mode: "status",
65
+ label: "Status"
66
+ },
67
+ {
68
+ mode: "plain",
69
+ label: "Plain"
70
+ },
71
+ {
72
+ mode: "rows",
73
+ label: "Rows"
74
+ },
75
+ {
76
+ mode: "estimates",
77
+ label: "Estimates"
78
+ },
79
+ {
80
+ mode: "accuracy",
81
+ label: "Accuracy"
82
+ },
83
+ {
84
+ mode: "cpu",
85
+ label: "CPU"
86
+ },
87
+ {
88
+ mode: "memory",
89
+ label: "Memory"
90
+ }
91
+ ];
92
+ var SPILLED_BADGE_BORDER = "var(--color_attention_fg)";
93
+ function StatusIcons(props) {
94
+ const status = dashql.buffers.profile.ProfileExecutionStatus;
95
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
96
+ /* @__PURE__ */ jsx("g", {
97
+ "data-status-icon": status.UNKNOWN,
98
+ children: /* @__PURE__ */ jsx("circle", {
99
+ cx: 8,
100
+ cy: 8,
101
+ r: 3.5
102
+ })
103
+ }),
104
+ /* @__PURE__ */ jsx("g", {
105
+ "data-status-icon": status.PENDING,
106
+ children: /* @__PURE__ */ jsx("circle", {
107
+ cx: 8,
108
+ cy: 8,
109
+ r: 3.5
110
+ })
111
+ }),
112
+ /* @__PURE__ */ jsxs("g", {
113
+ "data-status-icon": status.RUNNING,
114
+ children: [
115
+ /* @__PURE__ */ jsx("circle", {
116
+ className: status_track,
117
+ cx: 8,
118
+ cy: 8,
119
+ r: 6.5
120
+ }),
121
+ /* @__PURE__ */ jsx("circle", {
122
+ cx: 8,
123
+ cy: 8,
124
+ r: 3.5
125
+ }),
126
+ props.progress == null ? /* @__PURE__ */ jsx("circle", {
127
+ className: status_spinner,
128
+ cx: 8,
129
+ cy: 8,
130
+ r: 6.5,
131
+ strokeDasharray: "12 88",
132
+ pathLength: 100
133
+ }) : /* @__PURE__ */ jsx("circle", {
134
+ className: status_progress,
135
+ cx: 8,
136
+ cy: 8,
137
+ r: 6.5,
138
+ pathLength: 100,
139
+ strokeDasharray: `${props.progress} 100`,
140
+ transform: "rotate(-90 8 8)",
141
+ "data-testid": "operator-progress"
142
+ })
143
+ ]
144
+ }),
145
+ /* @__PURE__ */ jsx("g", {
146
+ "data-status-icon": status.SUCCEEDED,
147
+ children: /* @__PURE__ */ jsx("path", {
148
+ fillRule: "evenodd",
149
+ d: "M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16Zm3.78-9.72a.75.75 0 0 0-1.06-1.06L6.75 9.19 5.28 7.72a.75.75 0 0 0-1.06 1.06l2 2a.75.75 0 0 0 1.06 0l4.5-4.5Z"
150
+ })
151
+ }),
152
+ /* @__PURE__ */ jsx("g", {
153
+ "data-status-icon": status.FAILED,
154
+ children: /* @__PURE__ */ jsx("path", {
155
+ fillRule: "evenodd",
156
+ d: "M2.343 13.657A8 8 0 1 1 13.657 2.343 8 8 0 0 1 2.343 13.657ZM6.03 4.97a.75.75 0 0 0-1.06 1.06L6.94 8 4.97 9.97a.75.75 0 1 0 1.06 1.06L8 9.06l1.97 1.97a.75.75 0 1 0 1.06-1.06L9.06 8l1.97-1.97a.75.75 0 1 0-1.06-1.06L8 6.94 6.03 4.97Z"
157
+ })
158
+ }),
159
+ /* @__PURE__ */ jsx("g", {
160
+ "data-status-icon": status.SKIPPED,
161
+ children: /* @__PURE__ */ jsx("path", {
162
+ fillRule: "evenodd",
163
+ d: "M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm11.333-2.167a.825.825 0 0 0-1.166-1.166l-5.5 5.5a.825.825 0 0 0 1.166 1.166Z"
164
+ })
165
+ })
166
+ ] });
167
+ }
168
+ function fragmentProgress(execution, fragment) {
169
+ const state = execution.fragments[fragment];
170
+ const work = workOf(state);
171
+ if (state == null || work == null) return null;
172
+ return { percent: state.status === dashql.buffers.profile.ProfileExecutionStatus.RUNNING ? Math.round(work.done / work.total * 100) : null };
173
+ }
174
+ function formatFragmentMetrics(state) {
175
+ if (state == null) return null;
176
+ const field = dashql.buffers.profile.ProfileStatsField;
177
+ const succeeded = state.status === dashql.buffers.profile.ProfileExecutionStatus.SUCCEEDED;
178
+ const text = [];
179
+ const description = [];
180
+ const rows = stat(state, field.TUPLES_IN, (s) => s.tuplesIn);
181
+ if (rows != null && (rows > 0 || succeeded)) {
182
+ text.push(`${formatCompactCount(rows)} rows`);
183
+ description.push(`${rows} rows`);
184
+ }
185
+ const bytes = stat(state, field.BYTES_IN, (s) => s.bytesIn);
186
+ if (bytes != null && bytes > 0) {
187
+ text.push(formatCompactBytes(bytes));
188
+ description.push(formatCompactBytes(bytes));
189
+ }
190
+ const cpu = stat(state, field.CPU_TIME, (s) => s.cpuTimeUs);
191
+ if (cpu != null && cpu > 0) {
192
+ text.push(`${formatElapsed(cpu / 1e3)} CPU`);
193
+ description.push(`${formatElapsed(cpu / 1e3)} CPU time`);
194
+ }
195
+ const work = workOf(state);
196
+ if (work != null && !succeeded) {
197
+ text.push(`${formatCompactCount(work.done)}/${formatCompactCount(work.total)} splits`);
198
+ description.push(`${work.done} of ${work.total} splits`);
199
+ }
200
+ return text.length === 0 ? null : {
201
+ text: text.join(" · "),
202
+ description: description.join(", ")
203
+ };
204
+ }
205
+ function operatorProgress(execution, fragment) {
206
+ const percent = fragmentProgress(execution, fragment)?.percent ?? null;
207
+ return percent == null || percent === 0 ? null : percent;
208
+ }
209
+ function fragmentStatus(execution, fragment) {
210
+ switch (execution.fragments[fragment]?.status) {
211
+ case dashql.buffers.profile.ProfileExecutionStatus.PENDING: return "pending";
212
+ case dashql.buffers.profile.ProfileExecutionStatus.RUNNING: return "running";
213
+ case dashql.buffers.profile.ProfileExecutionStatus.SUCCEEDED: return "succeeded";
214
+ case dashql.buffers.profile.ProfileExecutionStatus.FAILED: return "failed";
215
+ case dashql.buffers.profile.ProfileExecutionStatus.SKIPPED: return "skipped";
216
+ default: return;
217
+ }
218
+ }
219
+ var DEFAULT_DEPENDENCIES = { materializeProfileScene };
220
+ var PROFILE_EDGE_COLOR_SCHEME_RD_BU = (value) => interpolateRdBu(1 - value);
221
+ var PROFILE_EDGE_COLOR_SCHEME_RD_PU = interpolateRdPu;
222
+ var PROFILE_COST_COLOR_SCHEME_OR_RD = interpolateOrRd;
223
+ function edgeDifferenceColor(difference) {
224
+ return PROFILE_EDGE_COLOR_SCHEME_RD_BU(difference < 0 ? Math.max(0, (difference + 1) / 2) : Math.min(1, .5 + difference / 4));
225
+ }
226
+ var legendGradient = (color) => Array.from({ length: 11 }, (_, index) => color(index / 10)).join(", ");
227
+ var ESTIMATE_LEGEND_GRADIENT = legendGradient((value) => PROFILE_EDGE_COLOR_SCHEME_RD_BU(1 - value));
228
+ var ROW_LEGEND_GRADIENT = legendGradient(PROFILE_EDGE_COLOR_SCHEME_RD_PU);
229
+ var COST_LEGEND_GRADIENT = legendGradient(PROFILE_COST_COLOR_SCHEME_OR_RD);
230
+ function contrastingTextColor(background) {
231
+ const rgb = color(background)?.rgb();
232
+ if (rgb == null) return "#000000";
233
+ const linear = [
234
+ rgb.r,
235
+ rgb.g,
236
+ rgb.b
237
+ ].map((channel) => {
238
+ const value = channel / 255;
239
+ return value <= .04045 ? value / 12.92 : Math.pow((value + .055) / 1.055, 2.4);
240
+ });
241
+ return .2126 * linear[0] + .7152 * linear[1] + .0722 * linear[2] > .179 ? "#000000" : "#ffffff";
242
+ }
243
+ function formatRelativeDifference(difference) {
244
+ const percentage = Math.round(difference * 100);
245
+ if (percentage > 200) return ">200%";
246
+ if (percentage < -200) return "<-200%";
247
+ return `${percentage > 0 ? "+" : ""}${percentage}%`;
248
+ }
249
+ function formatEstimateSymbol(difference, absoluteDifference = Number.POSITIVE_INFINITY) {
250
+ if (difference === 0) return "=";
251
+ if (absoluteDifference <= ESTIMATE_APPROXIMATE_ROW_THRESHOLD) return "~";
252
+ if (difference <= -.5) return ">>";
253
+ if (difference <= -.1) return ">";
254
+ if (difference < 0) return "~";
255
+ if (difference < .1) return "~";
256
+ if (difference < .5) return "<";
257
+ return "<<";
258
+ }
259
+ function formatCpuShare(share) {
260
+ if (share === 0) return "0%";
261
+ if (share < .01) return "<1%";
262
+ return `${Math.round(share * 100)}%`;
263
+ }
264
+ function formatShortBytes(bytes) {
265
+ if (bytes < 1e3) return `${Math.round(bytes)}B`;
266
+ const units = [
267
+ "K",
268
+ "M",
269
+ "G",
270
+ "T",
271
+ "P"
272
+ ];
273
+ let value = bytes / 1e3;
274
+ let unit = 0;
275
+ while (Number(value.toPrecision(2)) >= 1e3 && unit < units.length - 1) {
276
+ value /= 1e3;
277
+ unit += 1;
278
+ }
279
+ return `${Number(value.toPrecision(2))}${units[unit]}`;
280
+ }
281
+ var ROW_COUNT_FORMAT = new Intl.NumberFormat("en-US");
282
+ function formatRowCount(value) {
283
+ return ROW_COUNT_FORMAT.format(value);
284
+ }
285
+ function placeOperatorAnnotation(operator, input) {
286
+ return {
287
+ x: operator.rect.x - operator.rect.width / 2 + input.nodePaddingLeft,
288
+ y: operator.rect.y
289
+ };
290
+ }
291
+ function QueryProfileView({ plan, execution = ProfileExecutionState.EMPTY, showProgress = false, autoFocus = false, fill = false, onRotate, dependencies = DEFAULT_DEPENDENCIES }) {
292
+ const scene = React.useMemo(() => dependencies.materializeProfileScene(plan), [dependencies, plan]);
293
+ const controllerRef = React.useRef(null);
294
+ controllerRef.current ??= new ProfileExecutionController();
295
+ const controller = controllerRef.current;
296
+ const viewportRef = React.useRef(null);
297
+ const svgRef = React.useRef(null);
298
+ const sceneRef = React.useRef(null);
299
+ const zoomRef = React.useRef(null);
300
+ const transformRef = React.useRef(zoomIdentity);
301
+ const [selection, setSelection] = React.useState(null);
302
+ const [inspectorOpen, setInspectorOpen] = React.useState(false);
303
+ const [selectedAnnotationMode, setAnnotationMode] = React.useState(null);
304
+ const [fragmentColors, setFragmentColors] = React.useState(false);
305
+ const operatorRefs = React.useRef(/* @__PURE__ */ new Map());
306
+ const [positionRevision, setPositionRevision] = React.useState(0);
307
+ const actualRows = React.useMemo(() => scene.edges.map((edge) => {
308
+ const rows = execution.edgeRows(edge.slot, edge.childOperator);
309
+ return rows == null ? null : Number(rows);
310
+ }), [scene, execution]);
311
+ const annotationModes = React.useMemo(() => {
312
+ const field = dashql.buffers.profile.ProfileStatsField;
313
+ const hasActual = actualRows.some((rows) => rows != null);
314
+ const hasEstimate = scene.edges.some((edge) => edge.outputCardinalityEstimated != null);
315
+ const hasBoth = scene.edges.some((edge, index) => edge.outputCardinalityEstimated != null && actualRows[index] != null);
316
+ const reports = (stat) => scene.operators.some((operator) => {
317
+ const state = execution.operators[operator.id];
318
+ return state != null && isStatReported(state.stats, stat);
319
+ });
320
+ const available = {
321
+ status: showProgress,
322
+ plain: true,
323
+ rows: hasActual,
324
+ estimates: hasEstimate,
325
+ accuracy: hasBoth,
326
+ cpu: reports(field.CPU_TIME),
327
+ memory: reports(field.MEMORY_BYTES)
328
+ };
329
+ return PROFILE_ANNOTATION_MODES.filter(({ mode }) => available[mode]);
330
+ }, [
331
+ scene,
332
+ execution,
333
+ actualRows,
334
+ showProgress
335
+ ]);
336
+ const offered = (mode) => annotationModes.some((m) => m.mode === mode);
337
+ const annotationMode = selectedAnnotationMode != null && offered(selectedAnnotationMode) ? selectedAnnotationMode : [
338
+ "status",
339
+ "rows",
340
+ "estimates"
341
+ ].find(offered) ?? "plain";
342
+ const annotations = React.useMemo(() => {
343
+ const field = dashql.buffers.profile.ProfileStatsField;
344
+ const badge = (operator, text, background, description, border = null) => ({
345
+ ...placeOperatorAnnotation(operator, scene.layoutConfig.input),
346
+ width: Math.min(PROFILE_OPERATOR_ANNOTATION_WIDTH, Math.max(OPERATOR_ANNOTATION_MIN_WIDTH, text.length * OPERATOR_ANNOTATION_CHAR_WIDTH + OPERATOR_ANNOTATION_PADDING)),
347
+ text,
348
+ background,
349
+ foreground: contrastingTextColor(background),
350
+ border,
351
+ description
352
+ });
353
+ switch (annotationMode) {
354
+ case "rows":
355
+ case "estimates":
356
+ case "accuracy": break;
357
+ case "cpu": {
358
+ const cpu = scene.operators.map((operator) => stat(execution.operators[operator.id], field.CPU_TIME, (s) => s.cpuTimeUs));
359
+ const total = cpu.reduce((sum, value) => sum + (value ?? 0), 0);
360
+ const max = cpu.reduce((maximum, value) => Math.max(maximum, value ?? 0), 0);
361
+ return scene.operators.flatMap((operator, index) => {
362
+ const value = cpu[index];
363
+ if (value == null) return [];
364
+ const share = total === 0 ? 0 : value / total;
365
+ return [{
366
+ operator: operator.id,
367
+ edge: null,
368
+ badge: badge(operator, formatCpuShare(share), PROFILE_COST_COLOR_SCHEME_OR_RD(max === 0 ? 0 : value / max), `CPU ${formatElapsed(value / 1e3)}, ${formatCpuShare(share)} of the CPU time of all operators`)
369
+ }];
370
+ });
371
+ }
372
+ case "memory": {
373
+ const memory = scene.operators.map((operator) => stat(execution.operators[operator.id], field.MEMORY_BYTES, (s) => s.memoryBytes));
374
+ const max = memory.reduce((maximum, value) => Math.max(maximum, value ?? 0), 0);
375
+ return scene.operators.flatMap((operator, index) => {
376
+ const value = memory[index];
377
+ if (value == null) return [];
378
+ const spilledBytes = stat(execution.operators[operator.id], field.SPILLED_BYTES, (s) => s.spilledBytes) ?? 0;
379
+ return [{
380
+ operator: operator.id,
381
+ edge: null,
382
+ badge: badge(operator, formatShortBytes(value), PROFILE_COST_COLOR_SCHEME_OR_RD(max === 0 ? 0 : value / max), `Memory ${formatCompactBytes(value)}${spilledBytes > 0 ? `, spilled ${formatCompactBytes(spilledBytes)} to disk` : ""}`, spilledBytes > 0 ? SPILLED_BADGE_BORDER : null)
383
+ }];
384
+ });
385
+ }
386
+ default: return [];
387
+ }
388
+ const maxRowValue = scene.edges.reduce((maximum, edge, edgeIndex) => Math.max(maximum, actualRows[edgeIndex] ?? 0, edge.outputCardinalityEstimated ?? 0), 0);
389
+ const rowScale = (rows) => maxRowValue === 0 ? 0 : Math.log1p(rows) / Math.log1p(maxRowValue);
390
+ return scene.edges.flatMap((edge, edgeIndex) => {
391
+ const child = scene.operators[edge.childOperator];
392
+ if (child == null || scene.operators[edge.parentOperator] == null) return [];
393
+ const actual = actualRows[edgeIndex];
394
+ const estimated = edge.outputCardinalityEstimated;
395
+ let annotation = null;
396
+ if (annotationMode === "rows" && actual != null) annotation = badge(child, formatCompactCount(actual), PROFILE_EDGE_COLOR_SCHEME_RD_PU(rowScale(actual)), `Actual rows ${formatRowCount(actual)}`);
397
+ else if (annotationMode === "estimates" && estimated != null) annotation = badge(child, formatCompactCount(estimated), PROFILE_EDGE_COLOR_SCHEME_RD_PU(rowScale(estimated)), `Estimated rows ${formatRowCount(Math.round(estimated))}`);
398
+ else if (annotationMode === "accuracy" && actual != null && estimated != null) {
399
+ const difference = estimateRelativeDifference(estimated, actual);
400
+ annotation = badge(child, formatEstimateSymbol(difference, Math.abs(actual - estimated)), edgeDifferenceColor(difference), `Actual rows ${formatRowCount(actual)}, estimated rows ${formatRowCount(Math.round(estimated))}, difference ${formatRelativeDifference(difference)}`);
401
+ }
402
+ return annotation == null ? [] : [{
403
+ operator: child.id,
404
+ edge,
405
+ badge: annotation
406
+ }];
407
+ });
408
+ }, [
409
+ scene,
410
+ execution,
411
+ actualRows,
412
+ annotationMode
413
+ ]);
414
+ const spilled = React.useMemo(() => annotationMode === "memory" && annotations.some((annotation) => annotation.badge.border != null), [annotationMode, annotations]);
415
+ const annotationWidths = React.useMemo(() => {
416
+ const widths = /* @__PURE__ */ new Map();
417
+ for (const annotation of annotations) widths.set(annotation.operator, annotation.badge.width);
418
+ return widths;
419
+ }, [annotations]);
420
+ const highlightedEdges = React.useMemo(() => {
421
+ const operatorId = selection?.operator.id;
422
+ return operatorId == null ? [] : scene.edges.filter((edge) => edge.childOperator === operatorId || edge.parentOperator === operatorId);
423
+ }, [scene.edges, selection?.operator.id]);
424
+ const highlightedEdgeSet = React.useMemo(() => new Set(highlightedEdges), [highlightedEdges]);
425
+ const highlightedCrossEdges = React.useMemo(() => {
426
+ const operatorId = selection?.operator.id;
427
+ return operatorId == null ? [] : scene.crossEdges.filter((edge) => edge.sourceOperator === operatorId || edge.targetOperator === operatorId);
428
+ }, [scene.crossEdges, selection?.operator.id]);
429
+ const highlightedOutputPortOperatorIds = React.useMemo(() => /* @__PURE__ */ new Set([...highlightedEdges.map((edge) => edge.childOperator), ...highlightedCrossEdges.map((edge) => edge.sourceOperator)]), [highlightedCrossEdges, highlightedEdges]);
430
+ const highlightedInputPortOperatorIds = React.useMemo(() => /* @__PURE__ */ new Set([...highlightedEdges.map((edge) => edge.parentOperator), ...highlightedCrossEdges.map((edge) => edge.targetOperator)]), [highlightedCrossEdges, highlightedEdges]);
431
+ const crossEdgeDescriptions = React.useMemo(() => {
432
+ const relationships = /* @__PURE__ */ new Map();
433
+ const add = (operatorId, relationship) => {
434
+ const existing = relationships.get(operatorId);
435
+ if (existing == null) relationships.set(operatorId, [relationship]);
436
+ else existing.push(relationship);
437
+ };
438
+ for (const edge of scene.crossEdges) {
439
+ add(edge.sourceOperator, `provides ${edge.kind} to ${scene.operators[edge.targetOperator]?.label ?? "operator"}`);
440
+ if (edge.targetOperator !== edge.sourceOperator) add(edge.targetOperator, `uses ${edge.kind} from ${scene.operators[edge.sourceOperator]?.label ?? "operator"}`);
441
+ }
442
+ const descriptions = /* @__PURE__ */ new Map();
443
+ for (const [operatorId, operatorRelationships] of relationships) descriptions.set(operatorId, `; ${operatorRelationships.join("; ")}`);
444
+ return descriptions;
445
+ }, [scene.crossEdges, scene.operators]);
446
+ React.useLayoutEffect(() => {
447
+ controller.reset(scene.operators.length, scene.pipelines.length);
448
+ controller.applyState(execution, scene.operators.map((operator) => operator.fragment));
449
+ }, [
450
+ controller,
451
+ scene,
452
+ execution
453
+ ]);
454
+ React.useLayoutEffect(() => {
455
+ if (autoFocus) viewportRef.current?.focus();
456
+ }, [autoFocus]);
457
+ const fit = React.useCallback((animate = false) => {
458
+ const viewport = viewportRef.current;
459
+ const svg = svgRef.current;
460
+ const behavior = zoomRef.current;
461
+ if (viewport == null || svg == null || behavior == null) return;
462
+ const bounds = measurePlanBounds(sceneRef.current, scene);
463
+ if (bounds.width <= 0 || bounds.height <= 0) return;
464
+ const { x, y, scale } = computeProfileFitTransform(bounds, viewport.clientWidth, viewport.clientHeight);
465
+ behavior.scaleExtent([Math.min(PROFILE_MIN_ZOOM, scale), PROFILE_MAX_ZOOM]);
466
+ const target = zoomIdentity.translate(x, y).scale(scale);
467
+ if (animate) select(svg).transition().duration(160).call(behavior.transform, target);
468
+ else select(svg).call(behavior.transform, target);
469
+ }, [scene]);
470
+ const inspectorVisibleRef = React.useRef(false);
471
+ inspectorVisibleRef.current = selection != null && inspectorOpen;
472
+ const positionRevisionFrame = React.useRef(null);
473
+ const schedulePositionRevision = React.useCallback(() => {
474
+ if (positionRevisionFrame.current != null) return;
475
+ positionRevisionFrame.current = requestAnimationFrame(() => {
476
+ positionRevisionFrame.current = null;
477
+ setPositionRevision((value) => value + 1);
478
+ });
479
+ }, []);
480
+ React.useEffect(() => () => {
481
+ if (positionRevisionFrame.current != null) {
482
+ cancelAnimationFrame(positionRevisionFrame.current);
483
+ positionRevisionFrame.current = null;
484
+ }
485
+ }, []);
486
+ React.useLayoutEffect(() => {
487
+ const svg = svgRef.current;
488
+ const viewport = viewportRef.current;
489
+ if (svg == null || viewport == null) return;
490
+ const behavior = zoom().extent(() => [[0, 0], [viewport.clientWidth, viewport.clientHeight]]).scaleExtent([PROFILE_MIN_ZOOM, PROFILE_MAX_ZOOM]).clickDistance(4).filter((event) => !event.button && !(event.target instanceof Element && event.target.closest("button"))).on("zoom", (event) => {
491
+ transformRef.current = event.transform;
492
+ sceneRef.current?.setAttribute("transform", event.transform.toString());
493
+ if (inspectorVisibleRef.current) schedulePositionRevision();
494
+ });
495
+ zoomRef.current = behavior;
496
+ select(svg).call(behavior).on("dblclick.zoom", null);
497
+ const observer = new ResizeObserver(() => fit());
498
+ observer.observe(viewport);
499
+ fit();
500
+ return () => {
501
+ observer.disconnect();
502
+ select(svg).on(".zoom", null);
503
+ zoomRef.current = null;
504
+ };
505
+ }, [fit, schedulePositionRevision]);
506
+ const zoomBy = React.useCallback((factor) => {
507
+ const svg = svgRef.current;
508
+ const behavior = zoomRef.current;
509
+ if (svg != null && behavior != null) select(svg).transition().duration(120).call(behavior.scaleBy, factor);
510
+ }, []);
511
+ const rotate = React.useMemo(() => onRotate == null ? null : () => {
512
+ setInspectorOpen(false);
513
+ setSelection(null);
514
+ onRotate();
515
+ }, [onRotate]);
516
+ const onKeyDown = React.useCallback((event) => {
517
+ if (event.key === "Escape" && inspectorOpen) {
518
+ setInspectorOpen(false);
519
+ event.preventDefault();
520
+ event.stopPropagation();
521
+ return;
522
+ }
523
+ const targetIsViewport = event.target === viewportRef.current;
524
+ const targetIsOperator = event.target instanceof Element && event.target.matches("[data-plan-operator-id]");
525
+ if (!targetIsViewport && !targetIsOperator) return;
526
+ const direction = event.key === "ArrowLeft" ? "left" : event.key === "ArrowRight" ? "right" : event.key === "ArrowUp" ? "up" : event.key === "ArrowDown" ? "down" : null;
527
+ if (direction != null) {
528
+ const targetOperatorId = targetIsOperator ? Number(event.target.getAttribute("data-plan-operator-id")) : null;
529
+ const current = targetOperatorId == null ? selection?.operator ?? null : scene.operators.find((operator) => operator.id === targetOperatorId) ?? null;
530
+ const next = findProfileOperatorInDirection(scene.operators, scene.edges, current, direction, scene.leftToRight);
531
+ const anchor = next == null ? null : operatorRefs.current.get(next.id) ?? null;
532
+ if (next != null && anchor != null) {
533
+ setSelection({
534
+ operator: next,
535
+ anchor
536
+ });
537
+ setPositionRevision((value) => value + 1);
538
+ anchor.focus();
539
+ }
540
+ } else if (event.key === "+" || event.key === "=") zoomBy(1.25);
541
+ else if (event.key === "-") zoomBy(.8);
542
+ else if (event.key === "f") fit(true);
543
+ else if (event.key === "r" && rotate != null) rotate();
544
+ else return;
545
+ event.preventDefault();
546
+ event.stopPropagation();
547
+ }, [
548
+ fit,
549
+ inspectorOpen,
550
+ rotate,
551
+ scene.operators,
552
+ scene.edges,
553
+ scene.leftToRight,
554
+ selection?.operator,
555
+ zoomBy
556
+ ]);
557
+ const selectionRef = React.useRef(selection);
558
+ selectionRef.current = selection;
559
+ const setOperatorAnchor = React.useCallback((operatorId, anchor) => {
560
+ if (anchor == null) operatorRefs.current.delete(operatorId);
561
+ else operatorRefs.current.set(operatorId, anchor);
562
+ }, []);
563
+ const onFocusOperator = React.useCallback((selected, anchor) => {
564
+ setSelection({
565
+ operator: selected,
566
+ anchor
567
+ });
568
+ }, []);
569
+ const onSelectOperator = React.useCallback((selected, anchor, toggle) => {
570
+ const previous = selectionRef.current;
571
+ setSelection({
572
+ operator: selected,
573
+ anchor
574
+ });
575
+ setPositionRevision((value) => value + 1);
576
+ setInspectorOpen((open) => toggle && previous?.operator.id === selected.id ? !open : true);
577
+ }, []);
578
+ const anchorRef = React.useMemo(() => ({ current: selection?.anchor ?? null }), [selection?.anchor]);
579
+ const legend = annotationMode === "rows" || annotationMode === "estimates" ? /* @__PURE__ */ jsx("div", {
580
+ className: edge_legend,
581
+ role: "img",
582
+ "data-testid": "plan-rows-legend",
583
+ "aria-label": "Badge color encodes row count from fewer rows on the left to more rows on the right",
584
+ children: /* @__PURE__ */ jsxs("div", {
585
+ className: edge_legend_scale,
586
+ children: [
587
+ /* @__PURE__ */ jsx("span", { children: "Fewer rows" }),
588
+ /* @__PURE__ */ jsx("span", { children: "More rows" }),
589
+ /* @__PURE__ */ jsx("i", {
590
+ "aria-hidden": "true",
591
+ style: { backgroundImage: `linear-gradient(to right, ${ROW_LEGEND_GRADIENT})` }
592
+ })
593
+ ]
594
+ })
595
+ }) : annotationMode === "cpu" || annotationMode === "memory" ? /* @__PURE__ */ jsx("div", {
596
+ className: edge_legend,
597
+ role: "img",
598
+ "data-testid": `plan-${annotationMode}-legend`,
599
+ "aria-label": annotationMode === "cpu" ? "Badges show the share of the CPU time of all operators, the color goes from none on the left to the operator with the most CPU time on the right" : `Badges show the memory of an operator, the color goes from none on the left to the operator with the most memory on the right${spilled ? ", an orange border marks an operator that spilled to disk" : ""}`,
600
+ children: /* @__PURE__ */ jsxs("div", {
601
+ className: edge_legend_scale,
602
+ children: [
603
+ /* @__PURE__ */ jsx("span", { children: annotationMode === "cpu" ? "Less CPU" : "Less memory" }),
604
+ /* @__PURE__ */ jsx("span", { children: annotationMode === "cpu" ? "More CPU" : "More memory" }),
605
+ /* @__PURE__ */ jsx("i", {
606
+ "aria-hidden": "true",
607
+ style: { backgroundImage: `linear-gradient(to right, ${COST_LEGEND_GRADIENT})` }
608
+ }),
609
+ spilled && /* @__PURE__ */ jsx("span", {
610
+ className: "dashql_edge_legend_note_IVlaV2",
611
+ style: { borderColor: SPILLED_BADGE_BORDER },
612
+ children: "Spilled to disk"
613
+ })
614
+ ]
615
+ })
616
+ }) : annotationMode === "accuracy" ? /* @__PURE__ */ jsx("div", {
617
+ className: edge_legend,
618
+ role: "img",
619
+ "data-testid": "plan-accuracy-legend",
620
+ "aria-label": "Badge color compares actual rows with estimates: red on the left means underestimated, the center means matched, and blue on the right means overestimated; differences are capped at 200 percent",
621
+ children: /* @__PURE__ */ jsxs("div", {
622
+ className: edge_legend_scale,
623
+ children: [
624
+ /* @__PURE__ */ jsx("span", { children: "Underestimated" }),
625
+ /* @__PURE__ */ jsx("span", { children: "Overestimated" }),
626
+ /* @__PURE__ */ jsx("i", {
627
+ "aria-hidden": "true",
628
+ "data-testid": "plan-legend-gradient",
629
+ style: { backgroundImage: `linear-gradient(to right, ${ESTIMATE_LEGEND_GRADIENT})` }
630
+ }),
631
+ /* @__PURE__ */ jsx("span", {
632
+ className: edge_legend_matched,
633
+ children: "Matched"
634
+ })
635
+ ]
636
+ })
637
+ }) : null;
638
+ return /* @__PURE__ */ jsxs("div", {
639
+ ref: viewportRef,
640
+ className: viewport,
641
+ "data-fill": fill || void 0,
642
+ role: "region",
643
+ "aria-label": `Query execution plan with ${scene.operators.length} operators`,
644
+ tabIndex: 0,
645
+ onKeyDown,
646
+ "data-electron-drag-region": "false",
647
+ children: [
648
+ /* @__PURE__ */ jsx("svg", {
649
+ ref: svgRef,
650
+ className: svg,
651
+ onClick: (event) => {
652
+ if (event.target === svgRef.current) {
653
+ setSelection(null);
654
+ setInspectorOpen(false);
655
+ }
656
+ },
657
+ children: /* @__PURE__ */ jsxs("g", {
658
+ ref: sceneRef,
659
+ children: [
660
+ /* @__PURE__ */ jsx("g", { children: scene.fragments.map((fragment$2, fragmentIndex) => {
661
+ const progress = showProgress ? fragmentProgress(execution, fragment$2.id) : null;
662
+ const metrics = showProgress ? formatFragmentMetrics(execution.fragments[fragment$2.id]) : null;
663
+ return /* @__PURE__ */ jsxs("g", {
664
+ className: fragment_colors,
665
+ "data-color": fragmentColors ? fragmentIndex % 6 : "neutral",
666
+ role: "img",
667
+ "aria-label": `Fragment ${fragment$2.id + 1}${metrics == null ? "" : `, ${metrics.description}`}, containing operators: ${fragment$2.operatorIds.map((operatorId) => scene.operators[operatorId]?.label).filter((label) => label != null).join(", ")}`,
668
+ children: [/* @__PURE__ */ jsx("path", {
669
+ className: `${fragment$1} ${fragment}`,
670
+ d: fragment$2.path,
671
+ "data-status": fragmentStatus(execution, fragment$2.id)
672
+ }), progress?.percent != null && /* @__PURE__ */ jsx("path", {
673
+ className: "dashql_fragment_progress_vdNNB-",
674
+ d: fragment$2.path,
675
+ pathLength: 100,
676
+ strokeDasharray: `${progress.percent} 100`,
677
+ "data-testid": "fragment-progress"
678
+ })]
679
+ }, fragment$2.id);
680
+ }) }),
681
+ /* @__PURE__ */ jsx("g", { children: scene.pipelines.map((pipeline$1) => /* @__PURE__ */ jsx("path", {
682
+ ref: (path) => controller.registerPipeline(pipeline$1.id, path),
683
+ className: pipeline,
684
+ d: pipeline$1.path,
685
+ "aria-hidden": "true"
686
+ }, pipeline$1.id)) }),
687
+ /* @__PURE__ */ jsx("g", {
688
+ "aria-hidden": "true",
689
+ children: scene.edges.map((edge$1) => /* @__PURE__ */ jsx("path", {
690
+ className: edge,
691
+ d: edge$1.path,
692
+ style: { strokeWidth: EDGE_WIDTH },
693
+ "data-plan-edge-id": edge$1.id.toString()
694
+ }, edge$1.id.toString()))
695
+ }),
696
+ /* @__PURE__ */ jsx("g", {
697
+ "aria-hidden": "true",
698
+ children: scene.crossEdges.map((edge) => /* @__PURE__ */ jsx("path", {
699
+ className: crossEdge,
700
+ "data-kind": edge.kind,
701
+ d: edge.path
702
+ }, edge.id.toString()))
703
+ }),
704
+ /* @__PURE__ */ jsxs("g", {
705
+ className: edgeHighlightLayer,
706
+ "aria-hidden": "true",
707
+ children: [highlightedEdges.map((edge) => /* @__PURE__ */ jsx("path", {
708
+ className: edgeHighlight,
709
+ d: edge.path,
710
+ style: { strokeWidth: EDGE_WIDTH },
711
+ "data-plan-edge-highlight-id": edge.id.toString()
712
+ }, `edge-${edge.id}`)), highlightedCrossEdges.map((edge) => /* @__PURE__ */ jsx("path", {
713
+ className: crossEdgeHighlight,
714
+ d: edge.path,
715
+ "data-plan-cross-edge-highlight-id": edge.id.toString()
716
+ }, `cross-edge-${edge.id}`))]
717
+ }),
718
+ /* @__PURE__ */ jsx("g", { children: scene.operators.map((operator) => /* @__PURE__ */ jsx(ProfileOperatorNode, {
719
+ operator,
720
+ scene,
721
+ showStatus: showProgress && annotationMode === "status",
722
+ annotationWidth: showProgress && annotationMode === "status" ? STATUS_ICON_SIZE : annotationWidths.get(operator.id) ?? 0,
723
+ progress: showProgress ? operatorProgress(execution, operator.fragment) : null,
724
+ selected: selection?.operator.id === operator.id,
725
+ highlightedOutputPort: highlightedOutputPortOperatorIds.has(operator.id),
726
+ highlightedInputPort: highlightedInputPortOperatorIds.has(operator.id),
727
+ expanded: inspectorOpen && selection?.operator.id === operator.id,
728
+ controller,
729
+ relationshipDescription: crossEdgeDescriptions.get(operator.id) ?? "",
730
+ setAnchor: setOperatorAnchor,
731
+ onFocus: onFocusOperator,
732
+ onSelect: onSelectOperator
733
+ }, operator.id)) }),
734
+ /* @__PURE__ */ jsx("g", {
735
+ className: edgeBadgeLayer,
736
+ children: annotations.map(({ operator, edge, badge }) => {
737
+ const highlighted = edge != null ? highlightedEdgeSet.has(edge) : selection?.operator.id === operator;
738
+ return /* @__PURE__ */ jsxs("g", {
739
+ className: edgeBadge,
740
+ transform: `translate(${badge.x}, ${badge.y})`,
741
+ role: "img",
742
+ "aria-label": badge.description,
743
+ "data-plan-edge-badge-id": edge?.id.toString(),
744
+ "data-plan-operator-badge-id": edge == null ? operator.toString() : void 0,
745
+ "data-spilled": badge.border != null || void 0,
746
+ "data-highlighted": highlighted || void 0,
747
+ children: [/* @__PURE__ */ jsx("rect", {
748
+ x: 0,
749
+ y: -8,
750
+ width: badge.width,
751
+ height: OPERATOR_ANNOTATION_HEIGHT,
752
+ rx: OPERATOR_ANNOTATION_HEIGHT / 2,
753
+ fill: badge.background,
754
+ strokeWidth: badge.border != null ? 1.5 : void 0,
755
+ style: {
756
+ fill: highlighted ? EDGE_HIGHLIGHT_COLOR : void 0,
757
+ stroke: highlighted ? EDGE_HIGHLIGHT_COLOR : badge.border ?? EDGE_BADGE_BORDER
758
+ }
759
+ }), /* @__PURE__ */ jsx("text", {
760
+ x: badge.width / 2,
761
+ fill: badge.foreground,
762
+ style: highlighted ? { fill: EDGE_HIGHLIGHT_TEXT_COLOR } : void 0,
763
+ children: badge.text
764
+ })]
765
+ }, edge != null ? `edge-${edge.id}` : `operator-${operator}`);
766
+ })
767
+ })
768
+ ]
769
+ })
770
+ }),
771
+ /* @__PURE__ */ jsxs("div", {
772
+ className: metric_controls,
773
+ children: [scene.leftToRight && legend, /* @__PURE__ */ jsxs("div", {
774
+ className: view_controls,
775
+ children: [/* @__PURE__ */ jsx(SegmentedControl, {
776
+ "aria-label": "Plan annotations",
777
+ size: SegmentedControlSize.Tiny,
778
+ onChange: (index) => setAnnotationMode(annotationModes[index].mode),
779
+ children: annotationModes.map(({ mode, label }) => /* @__PURE__ */ jsx(SegmentedControl.Button, {
780
+ "data-testid": `plan-annotation-${mode}`,
781
+ selected: annotationMode === mode,
782
+ children: label
783
+ }, mode))
784
+ }), /* @__PURE__ */ jsxs(ButtonGroup, {
785
+ className: view_buttons,
786
+ "aria-label": "Plan view controls",
787
+ children: [rotate != null && /* @__PURE__ */ jsx(IconButton, {
788
+ variant: ButtonVariant.Default,
789
+ size: ButtonSize.Tiny,
790
+ "aria-label": scene.leftToRight ? "Rotate plan to top-down" : "Rotate plan to left-to-right",
791
+ "data-testid": "plan-rotate",
792
+ onClick: rotate,
793
+ children: /* @__PURE__ */ jsx(RotateIcon, { size: 12 })
794
+ }), /* @__PURE__ */ jsx(IconButton, {
795
+ variant: ButtonVariant.Default,
796
+ size: ButtonSize.Tiny,
797
+ "aria-label": "Color the fragments",
798
+ "aria-pressed": fragmentColors,
799
+ "data-testid": "plan-fragment-colors",
800
+ onClick: () => setFragmentColors((value) => !value),
801
+ children: /* @__PURE__ */ jsx(PaintbrushIcon, { size: 12 })
802
+ })]
803
+ })]
804
+ })]
805
+ }),
806
+ !scene.leftToRight && legend,
807
+ /* @__PURE__ */ jsxs(ButtonGroup, {
808
+ className: controls,
809
+ "aria-label": "Plan zoom controls",
810
+ children: [
811
+ /* @__PURE__ */ jsx(IconButton, {
812
+ variant: ButtonVariant.Default,
813
+ size: ButtonSize.Small,
814
+ "aria-label": "Zoom in",
815
+ onClick: () => zoomBy(1.25),
816
+ children: /* @__PURE__ */ jsx(ZoomInIcon, { size: 12 })
817
+ }),
818
+ /* @__PURE__ */ jsx(IconButton, {
819
+ variant: ButtonVariant.Default,
820
+ size: ButtonSize.Small,
821
+ "aria-label": "Zoom out",
822
+ onClick: () => zoomBy(.8),
823
+ children: /* @__PURE__ */ jsx(ZoomOutIcon, { size: 12 })
824
+ }),
825
+ /* @__PURE__ */ jsx(IconButton, {
826
+ variant: ButtonVariant.Default,
827
+ size: ButtonSize.Small,
828
+ "aria-label": "Fit plan",
829
+ onClick: () => fit(true),
830
+ children: /* @__PURE__ */ jsx(FitIcon, { size: 12 })
831
+ })
832
+ ]
833
+ }),
834
+ /* @__PURE__ */ jsx(AnchoredOverlay, {
835
+ renderAnchor: null,
836
+ anchorRef,
837
+ open: selection != null && inspectorOpen,
838
+ onClose: () => setInspectorOpen(false),
839
+ side: scene.leftToRight ? AnchorSide.OutsideTop : AnchorSide.OutsideRight,
840
+ align: AnchorAlignment.Center,
841
+ anchorOffset: 8,
842
+ width: OverlaySize.L,
843
+ maxHeight: OverlaySize.L,
844
+ positionRevision,
845
+ children: /* @__PURE__ */ jsxs("section", {
846
+ className: inspector,
847
+ "data-testid": "plan-operator-inspector",
848
+ "aria-label": `${selection?.operator.label ?? "Operator"} properties`,
849
+ children: [/* @__PURE__ */ jsxs("header", {
850
+ className: inspector_header,
851
+ "data-single-line": selection?.operator.typeName == null || selection.operator.typeName === selection.operator.label,
852
+ children: [/* @__PURE__ */ jsx("strong", { children: selection?.operator.label }), selection?.operator.typeName != null && selection.operator.typeName !== selection.operator.label && /* @__PURE__ */ jsx("span", { children: selection.operator.typeName })]
853
+ }), selection != null && /* @__PURE__ */ jsx(JsonView, {
854
+ className: "dashql_inspector_json_R3jZmm",
855
+ value: selection.operator.properties,
856
+ collapsed: 2,
857
+ shortenTextAfterLength: 100
858
+ })]
859
+ })
860
+ })
861
+ ]
862
+ });
863
+ }
864
+ var ProfileOperatorNode = React.memo(function ProfileOperatorNode(props) {
865
+ const { operator: operator$1, scene, setAnchor: setOperatorAnchor } = props;
866
+ const setAnchor = React.useCallback((anchor) => setOperatorAnchor(operator$1.id, anchor), [setOperatorAnchor, operator$1.id]);
867
+ const x = operator$1.rect.x - operator$1.rect.width / 2;
868
+ const y = operator$1.rect.y - operator$1.rect.height / 2;
869
+ const input = scene.layoutConfig.input;
870
+ const regionStart = input.nodePaddingLeft + (props.annotationWidth > 0 ? props.annotationWidth + input.iconMarginRight : 0);
871
+ const regionEnd = operator$1.rect.width - input.nodePaddingRight;
872
+ const symbolName = shouldRenderProfileOperatorSymbol(operator$1.kind, operator$1.typeName, operator$1.label) ? getProfileOperatorSymbol(operator$1.kind) : null;
873
+ const OperatorSymbol = symbolName != null ? SymbolIcon(symbolName) : null;
874
+ const activate = (event) => {
875
+ if ("key" in event && event.key !== "Enter" && event.key !== " ") return;
876
+ if ("key" in event) event.preventDefault();
877
+ event.stopPropagation();
878
+ props.onSelect(operator$1, event.currentTarget, "key" in event);
879
+ };
880
+ return /* @__PURE__ */ jsxs("g", {
881
+ ref: setAnchor,
882
+ className: operator,
883
+ "data-selected": props.selected,
884
+ "data-highlighted-output-port": props.highlightedOutputPort,
885
+ "data-highlighted-input-port": props.highlightedInputPort,
886
+ "data-plan-operator-id": operator$1.id,
887
+ transform: `translate(${x}, ${y})`,
888
+ role: "button",
889
+ tabIndex: 0,
890
+ "aria-label": `${operator$1.label}${props.relationshipDescription}, show properties`,
891
+ "aria-expanded": props.expanded,
892
+ onClick: activate,
893
+ onFocus: (event) => props.onFocus(operator$1, event.currentTarget),
894
+ onKeyDown: activate,
895
+ children: [
896
+ /* @__PURE__ */ jsx("rect", {
897
+ className: node_frame,
898
+ width: operator$1.rect.width,
899
+ height: operator$1.rect.height,
900
+ rx: 6,
901
+ ry: 6,
902
+ "data-plan-operator-frame": true
903
+ }),
904
+ props.showStatus && /* @__PURE__ */ jsx("g", {
905
+ ref: (slot) => props.controller.registerOperator(operator$1.id, slot),
906
+ className: "dashql_status_0_ceA-",
907
+ transform: `translate(${input.nodePaddingLeft}, ${(input.nodeHeight - STATUS_ICON_SIZE) / 2})`,
908
+ "aria-hidden": "true",
909
+ children: /* @__PURE__ */ jsx("g", {
910
+ transform: `scale(${STATUS_ICON_SIZE / 16})`,
911
+ children: /* @__PURE__ */ jsx(StatusIcons, { progress: props.progress })
912
+ })
913
+ }),
914
+ OperatorSymbol != null ? /* @__PURE__ */ jsx("g", {
915
+ className: operator_symbol,
916
+ transform: `translate(${(regionStart + regionEnd - PROFILE_OPERATOR_SYMBOL_SIZE) / 2}, ${(input.nodeHeight - PROFILE_OPERATOR_SYMBOL_SIZE) / 2})`,
917
+ "aria-hidden": "true",
918
+ children: /* @__PURE__ */ jsx(OperatorSymbol, { size: PROFILE_OPERATOR_SYMBOL_SIZE })
919
+ }) : /* @__PURE__ */ jsx("text", {
920
+ x: (regionStart + regionEnd) / 2,
921
+ y: input.nodeHeight / 2 + 5,
922
+ children: operator$1.displayLabel
923
+ }),
924
+ (operator$1.ports & 1) !== 0 && (scene.leftToRight ? /* @__PURE__ */ jsx(GraphPort, {
925
+ x: 0,
926
+ y: operator$1.rect.height / 2,
927
+ side: "left",
928
+ highlighted: props.highlightedOutputPort,
929
+ "data-plan-port": "output"
930
+ }) : /* @__PURE__ */ jsx(GraphPort, {
931
+ x: operator$1.rect.width / 2,
932
+ y: 0,
933
+ side: "top",
934
+ highlighted: props.highlightedOutputPort,
935
+ "data-plan-port": "output"
936
+ })),
937
+ (operator$1.ports & 2) !== 0 && (scene.leftToRight ? /* @__PURE__ */ jsx(GraphPort, {
938
+ x: operator$1.rect.width,
939
+ y: operator$1.rect.height / 2,
940
+ side: "right",
941
+ highlighted: props.highlightedInputPort,
942
+ "data-plan-port": "input"
943
+ }) : /* @__PURE__ */ jsx(GraphPort, {
944
+ x: operator$1.rect.width / 2,
945
+ y: operator$1.rect.height,
946
+ side: "bottom",
947
+ highlighted: props.highlightedInputPort,
948
+ "data-plan-port": "input"
949
+ }))
950
+ ]
951
+ });
952
+ });
953
+ export { PROFILE_COST_COLOR_SCHEME_OR_RD, PROFILE_EDGE_COLOR_SCHEME_RD_BU, PROFILE_EDGE_COLOR_SCHEME_RD_PU, PROFILE_OPERATOR_PORT_INPUT, PROFILE_OPERATOR_PORT_OUTPUT, QueryProfileView, computeProfileFitTransform, createProfileLayoutConfig, formatCpuShare, formatEstimateSymbol, formatFragmentMetrics, formatShortBytes, materializeProfileScene, placeOperatorAnnotation };