@perspective-dev/viewer 5.6.1 → 5.7.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 (568) hide show
  1. package/README.md +4 -4
  2. package/dist/cdn/perspective-viewer.js +10 -9
  3. package/dist/cdn/perspective-viewer.js.map +4 -4
  4. package/dist/custom-elements.json +3955 -0
  5. package/dist/docs/perspective-docs.json +1 -1
  6. package/dist/esm/bootstrap.d.ts +48 -1
  7. package/dist/esm/column-format.d.ts +27 -18
  8. package/dist/esm/column-format.js +1 -1
  9. package/dist/esm/column-format.js.map +3 -3
  10. package/dist/esm/extensions.d.ts +127 -10
  11. package/dist/esm/perspective-viewer.d.ts +30 -25
  12. package/dist/esm/perspective-viewer.js +869 -9
  13. package/dist/esm/perspective-viewer.js.map +4 -4
  14. package/dist/esm/plugin.d.ts +1 -1
  15. package/dist/ts-rs/ColumnConfigDefaultsOptions.d.ts +15 -0
  16. package/dist/ts-rs/ColumnType.d.ts +6 -0
  17. package/dist/ts-rs/ConfigDefaultsOptions.d.ts +10 -0
  18. package/{src/ts/ts-rs/CurrencyNumberFormatStyle.ts → dist/ts-rs/CurrencyNumberFormatStyle.d.ts} +3 -3
  19. package/{src/ts/ts-rs/CustomNumberFormatConfig.ts → dist/ts-rs/CustomNumberFormatConfig.d.ts} +5 -5
  20. package/dist/ts-rs/DatetimeFormat.d.ts +61 -0
  21. package/dist/ts-rs/DatetimeMonthPart.d.ts +6 -0
  22. package/dist/ts-rs/DatetimeNumericPart.d.ts +6 -0
  23. package/dist/ts-rs/DatetimeTextPart.d.ts +6 -0
  24. package/{src/ts/ts-rs/DerivedTableConfig.ts → dist/ts-rs/DerivedTableConfig.d.ts} +8 -8
  25. package/{src/ts/ts-rs/ExportOptions.ts → dist/ts-rs/ExportOptions.d.ts} +1 -1
  26. package/{src/ts/ts-rs/Filter.ts → dist/ts-rs/Filter.d.ts} +1 -1
  27. package/{src/ts/ts-rs/FilterTerm.ts → dist/ts-rs/FilterTerm.d.ts} +1 -1
  28. package/dist/ts-rs/FractionalSecondDigits.d.ts +6 -0
  29. package/{src/ts/ts-rs/GetViewOptions.ts → dist/ts-rs/GetViewOptions.d.ts} +1 -1
  30. package/{src/ts/ts-rs/Layout.ts → dist/ts-rs/Layout.d.ts} +2 -2
  31. package/{src/ts/ts-rs/Notation.ts → dist/ts-rs/Notation.d.ts} +1 -1
  32. package/{src/ts/ts-rs/NumberFormatStyle.ts → dist/ts-rs/NumberFormatStyle.d.ts} +2 -2
  33. package/{src/ts/ts-rs/OnUpdateData.ts → dist/ts-rs/OnUpdateData.d.ts} +1 -1
  34. package/{src/ts/ts-rs/PanelViewerConfig.ts → dist/ts-rs/PanelViewerConfig.d.ts} +12 -12
  35. package/{src/ts/ts-rs/PluginStaticConfig.ts → dist/ts-rs/PluginStaticConfig.d.ts} +3 -3
  36. package/{src/ts/ts-rs/SimpleDatetimeFormat.ts → dist/ts-rs/SimpleDatetimeFormat.d.ts} +4 -1
  37. package/{src/ts/ts-rs/Sort.ts → dist/ts-rs/Sort.d.ts} +1 -1
  38. package/{src/ts/ts-rs/SplitLayout.ts → dist/ts-rs/SplitLayout.d.ts} +2 -2
  39. package/{src/ts/ts-rs/TableRef.ts → dist/ts-rs/TableRef.d.ts} +1 -1
  40. package/{src/ts/ts-rs/Unit.ts → dist/ts-rs/Unit.d.ts} +1 -1
  41. package/{src/ts/ts-rs/UnitNumberFormatStyle.ts → dist/ts-rs/UnitNumberFormatStyle.d.ts} +2 -2
  42. package/{src/ts/ts-rs/ViewerConfig.ts → dist/ts-rs/ViewerConfig.d.ts} +12 -12
  43. package/{src/ts/ts-rs/ViewerConfigInitial.ts → dist/ts-rs/ViewerConfigInitial.d.ts} +9 -9
  44. package/{src/ts/ts-rs/ViewerConfigUpdate.ts → dist/ts-rs/ViewerConfigUpdate.d.ts} +13 -13
  45. package/{src/ts/ts-rs/WindowSort.ts → dist/ts-rs/WindowSort.d.ts} +1 -1
  46. package/{src/ts/ts-rs/WindowSpec.ts → dist/ts-rs/WindowSpec.d.ts} +1 -1
  47. package/{src/ts/ts-rs/Windows.ts → dist/ts-rs/Windows.d.ts} +1 -1
  48. package/{src/ts/ts-rs/WorkspaceConfig.ts → dist/ts-rs/WorkspaceConfig.d.ts} +5 -5
  49. package/{src/ts/ts-rs/WorkspaceConfigUpdate.ts → dist/ts-rs/WorkspaceConfigUpdate.d.ts} +10 -5
  50. package/dist/wasm/perspective-viewer.d.ts +192 -65
  51. package/dist/wasm/perspective-viewer.js +331 -118
  52. package/dist/wasm/perspective-viewer.wasm +0 -0
  53. package/dist/wasm/perspective-viewer.wasm.d.ts +24 -16
  54. package/dist/wasm/snippets/{perspective-viewer-7fc45549159e01e4 → perspective-viewer-c26bfdc60d367a99}/inline4.js +0 -6
  55. package/package.json +11 -15
  56. package/dist/esm/ts-rs/AddPanelOptions.d.ts +0 -9
  57. package/dist/esm/ts-rs/Aggregate.d.ts +0 -1
  58. package/dist/esm/ts-rs/ClientOptions.d.ts +0 -7
  59. package/dist/esm/ts-rs/ColumnSelectMode.d.ts +0 -1
  60. package/dist/esm/ts-rs/CompactDisplay.d.ts +0 -5
  61. package/dist/esm/ts-rs/CurrencyCode.d.ts +0 -1
  62. package/dist/esm/ts-rs/CurrencyDisplay.d.ts +0 -1
  63. package/dist/esm/ts-rs/CurrencyNumberFormatStyle.d.ts +0 -8
  64. package/dist/esm/ts-rs/CurrencySign.d.ts +0 -1
  65. package/dist/esm/ts-rs/CustomDatetimeFormat.d.ts +0 -1
  66. package/dist/esm/ts-rs/CustomDatetimeStyleConfig.d.ts +0 -54
  67. package/dist/esm/ts-rs/CustomNumberFormatConfig.d.ts +0 -34
  68. package/dist/esm/ts-rs/DatetimeFormatType.d.ts +0 -6
  69. package/dist/esm/ts-rs/DerivedTableConfig.d.ts +0 -35
  70. package/dist/esm/ts-rs/ExportMethod.d.ts +0 -1
  71. package/dist/esm/ts-rs/ExportOptions.d.ts +0 -9
  72. package/dist/esm/ts-rs/Expressions.d.ts +0 -3
  73. package/dist/esm/ts-rs/Filter.d.ts +0 -2
  74. package/dist/esm/ts-rs/FilterReducer.d.ts +0 -1
  75. package/dist/esm/ts-rs/FilterTerm.d.ts +0 -2
  76. package/dist/esm/ts-rs/FormatUnit.d.ts +0 -1
  77. package/dist/esm/ts-rs/GetClientOptions.d.ts +0 -8
  78. package/dist/esm/ts-rs/GetTableOptions.d.ts +0 -8
  79. package/dist/esm/ts-rs/GetViewMode.d.ts +0 -4
  80. package/dist/esm/ts-rs/GetViewOptions.d.ts +0 -8
  81. package/dist/esm/ts-rs/GroupRollupMode.d.ts +0 -1
  82. package/dist/esm/ts-rs/Layout.d.ts +0 -11
  83. package/dist/esm/ts-rs/Notation.d.ts +0 -17
  84. package/dist/esm/ts-rs/NumberFormatStyle.d.ts +0 -18
  85. package/dist/esm/ts-rs/OnUpdateData.d.ts +0 -6
  86. package/dist/esm/ts-rs/OptionalUpdate.d.ts +0 -1
  87. package/dist/esm/ts-rs/Orientation.d.ts +0 -5
  88. package/dist/esm/ts-rs/PanelOptions.d.ts +0 -7
  89. package/dist/esm/ts-rs/PanelViewerConfig.d.ts +0 -82
  90. package/dist/esm/ts-rs/PluginStaticConfig.d.ts +0 -112
  91. package/dist/esm/ts-rs/RestoreOptions.d.ts +0 -21
  92. package/dist/esm/ts-rs/RestoreWorkspaceOptions.d.ts +0 -9
  93. package/dist/esm/ts-rs/RoundingMode.d.ts +0 -1
  94. package/dist/esm/ts-rs/RoundingPriority.d.ts +0 -1
  95. package/dist/esm/ts-rs/SaveWorkspaceOptions.d.ts +0 -10
  96. package/dist/esm/ts-rs/Scalar.d.ts +0 -5
  97. package/dist/esm/ts-rs/SignDisplay.d.ts +0 -1
  98. package/dist/esm/ts-rs/SimpleDatetimeFormat.d.ts +0 -1
  99. package/dist/esm/ts-rs/SimpleDatetimeStyleConfig.d.ts +0 -24
  100. package/dist/esm/ts-rs/Sort.d.ts +0 -2
  101. package/dist/esm/ts-rs/SortDir.d.ts +0 -1
  102. package/dist/esm/ts-rs/SplitLayout.d.ts +0 -20
  103. package/dist/esm/ts-rs/SplitRollupMode.d.ts +0 -9
  104. package/dist/esm/ts-rs/TabLayout.d.ts +0 -13
  105. package/dist/esm/ts-rs/TableRef.d.ts +0 -9
  106. package/dist/esm/ts-rs/TrailingZeroDisplay.d.ts +0 -1
  107. package/dist/esm/ts-rs/Unit.d.ts +0 -1
  108. package/dist/esm/ts-rs/UnitDisplay.d.ts +0 -1
  109. package/dist/esm/ts-rs/UnitNumberFormatStyle.d.ts +0 -6
  110. package/dist/esm/ts-rs/UseGrouping.d.ts +0 -1
  111. package/dist/esm/ts-rs/ViewOnUpdateResp.d.ts +0 -4
  112. package/dist/esm/ts-rs/ViewerConfig.d.ts +0 -86
  113. package/dist/esm/ts-rs/ViewerConfigInitial.d.ts +0 -175
  114. package/dist/esm/ts-rs/ViewerConfigUpdate.d.ts +0 -182
  115. package/dist/esm/ts-rs/WindowSort.d.ts +0 -7
  116. package/dist/esm/ts-rs/WindowSortDir.d.ts +0 -6
  117. package/dist/esm/ts-rs/WindowSpec.d.ts +0 -47
  118. package/dist/esm/ts-rs/Windows.d.ts +0 -10
  119. package/dist/esm/ts-rs/WorkspaceConfig.d.ts +0 -56
  120. package/dist/esm/ts-rs/WorkspaceConfigUpdate.d.ts +0 -57
  121. package/dist/esm/ts-rs/serde_json/JsonValue.d.ts +0 -3
  122. package/src/css/_column_dropdown.css +0 -14
  123. package/src/css/_context_menu.css +0 -14
  124. package/src/css/_dropdown_menu.css +0 -14
  125. package/src/css/_filter_dropdown.css +0 -14
  126. package/src/css/_function_dropdown.css +0 -14
  127. package/src/css/_viewer_bundle.css +0 -41
  128. package/src/css/aggregate-selector.css +0 -75
  129. package/src/css/column-dropdown.css +0 -106
  130. package/src/css/column-selector.css +0 -729
  131. package/src/css/column-settings-panel.css +0 -164
  132. package/src/css/column-style.css +0 -774
  133. package/src/css/column-symbol-attributes.css +0 -74
  134. package/src/css/config-selector.css +0 -505
  135. package/src/css/containers/pairs-list.css +0 -47
  136. package/src/css/empty-column.css +0 -73
  137. package/src/css/expression-editor.css +0 -153
  138. package/src/css/filter-dropdown.css +0 -54
  139. package/src/css/filter-item.css +0 -127
  140. package/src/css/form/code-editor.css +0 -133
  141. package/src/css/form/debug.css +0 -115
  142. package/src/css/function-dropdown.css +0 -46
  143. package/src/css/panel-tab.css +0 -216
  144. package/src/css/plugin-selector.css +0 -292
  145. package/src/css/render-warning.css +0 -82
  146. package/src/css/status-bar.css +0 -647
  147. package/src/css/type-icon.css +0 -114
  148. package/src/css/ui/containers/context-menu.css +0 -124
  149. package/src/css/ui/containers/dropdown-menu-items.css +0 -95
  150. package/src/css/ui/containers/dropdown-menu.css +0 -50
  151. package/src/css/ui/containers/scroll-panel.css +0 -31
  152. package/src/css/ui/containers/split-panel.css +0 -81
  153. package/src/css/ui/containers/tabs.css +0 -55
  154. package/src/css/ui/dom/checkbox.css +0 -98
  155. package/src/css/ui/dom/scrollbar.css +0 -35
  156. package/src/css/ui/dom/select.css +0 -74
  157. package/src/css/ui/form/mirrored-textarea.css +0 -81
  158. package/src/css/viewer.css +0 -1003
  159. package/src/rust/agent/client/mod.rs +0 -19
  160. package/src/rust/agent/client/protocol.rs +0 -231
  161. package/src/rust/agent/client/transport.rs +0 -287
  162. package/src/rust/agent/client/turn.rs +0 -174
  163. package/src/rust/agent/config.rs +0 -159
  164. package/src/rust/agent/docs.rs +0 -293
  165. package/src/rust/agent/markdown/block.rs +0 -509
  166. package/src/rust/agent/markdown/entity.rs +0 -52
  167. package/src/rust/agent/markdown/events.rs +0 -71
  168. package/src/rust/agent/markdown/inline.rs +0 -497
  169. package/src/rust/agent/markdown/mod.rs +0 -228
  170. package/src/rust/agent/mod.rs +0 -23
  171. package/src/rust/agent/preamble.md +0 -19
  172. package/src/rust/agent/runtime.rs +0 -201
  173. package/src/rust/agent/slot.rs +0 -236
  174. package/src/rust/agent/tools.rs +0 -1482
  175. package/src/rust/components/chat_panel.rs +0 -289
  176. package/src/rust/components/code_editor/highlight.rs +0 -52
  177. package/src/rust/components/code_editor.rs +0 -302
  178. package/src/rust/components/column_dropdown.rs +0 -284
  179. package/src/rust/components/column_selector/active_column.rs +0 -497
  180. package/src/rust/components/column_selector/add_expression_button.rs +0 -48
  181. package/src/rust/components/column_selector/aggregate_selector.rs +0 -193
  182. package/src/rust/components/column_selector/column_selector_column_row.rs +0 -73
  183. package/src/rust/components/column_selector/config_selector.rs +0 -932
  184. package/src/rust/components/column_selector/derived_control.rs +0 -229
  185. package/src/rust/components/column_selector/empty_column.rs +0 -136
  186. package/src/rust/components/column_selector/expr_edit_button.rs +0 -59
  187. package/src/rust/components/column_selector/filter_column.rs +0 -530
  188. package/src/rust/components/column_selector/inactive_column.rs +0 -246
  189. package/src/rust/components/column_selector/invalid_column.rs +0 -22
  190. package/src/rust/components/column_selector/pivot_column.rs +0 -130
  191. package/src/rust/components/column_selector/sort_column.rs +0 -148
  192. package/src/rust/components/column_selector.rs +0 -628
  193. package/src/rust/components/column_settings_sidebar/attributes_tab.rs +0 -34
  194. package/src/rust/components/column_settings_sidebar/save_settings.rs +0 -72
  195. package/src/rust/components/column_settings_sidebar/style_tab/agg_depth_selector.rs +0 -66
  196. package/src/rust/components/column_settings_sidebar/style_tab/alignment_field.rs +0 -90
  197. package/src/rust/components/column_settings_sidebar/style_tab/font_field.rs +0 -267
  198. package/src/rust/components/column_settings_sidebar/style_tab/primitive_field.rs +0 -560
  199. package/src/rust/components/column_settings_sidebar/style_tab/symbol/row_selector.rs +0 -101
  200. package/src/rust/components/column_settings_sidebar/style_tab/symbol/symbol_pairs.rs +0 -91
  201. package/src/rust/components/column_settings_sidebar/style_tab/symbol/symbol_pairs_item.rs +0 -112
  202. package/src/rust/components/column_settings_sidebar/style_tab/symbol/symbol_selector.rs +0 -54
  203. package/src/rust/components/column_settings_sidebar/style_tab/symbol.rs +0 -143
  204. package/src/rust/components/column_settings_sidebar/style_tab.rs +0 -499
  205. package/src/rust/components/column_settings_sidebar/window_tab.rs +0 -34
  206. package/src/rust/components/column_settings_sidebar.rs +0 -622
  207. package/src/rust/components/copy_dropdown.rs +0 -111
  208. package/src/rust/components/datetime_column_style/custom.rs +0 -220
  209. package/src/rust/components/datetime_column_style/simple.rs +0 -131
  210. package/src/rust/components/datetime_column_style.rs +0 -259
  211. package/src/rust/components/debug_panel.rs +0 -350
  212. package/src/rust/components/dragdrop_list.rs +0 -473
  213. package/src/rust/components/editable_header.rs +0 -147
  214. package/src/rust/components/empty_row.rs +0 -166
  215. package/src/rust/components/export_dropdown.rs +0 -132
  216. package/src/rust/components/expression_editor.rs +0 -172
  217. package/src/rust/components/filter_dropdown.rs +0 -288
  218. package/src/rust/components/function_dropdown.rs +0 -224
  219. package/src/rust/components/global_filter_bar.rs +0 -76
  220. package/src/rust/components/main_panel/frame_theme.rs +0 -130
  221. package/src/rust/components/main_panel/msg.rs +0 -68
  222. package/src/rust/components/main_panel/presize.rs +0 -220
  223. package/src/rust/components/main_panel/reconcile.rs +0 -271
  224. package/src/rust/components/main_panel/render.rs +0 -455
  225. package/src/rust/components/main_panel/update.rs +0 -212
  226. package/src/rust/components/main_panel.rs +0 -470
  227. package/src/rust/components/mod.rs +0 -50
  228. package/src/rust/components/new_panel_menu.rs +0 -165
  229. package/src/rust/components/number_series_style.rs +0 -157
  230. package/src/rust/components/panel_menu.rs +0 -518
  231. package/src/rust/components/panel_tab.rs +0 -567
  232. package/src/rust/components/plugin_selector.rs +0 -132
  233. package/src/rust/components/plugin_tab.rs +0 -285
  234. package/src/rust/components/render_warning.rs +0 -128
  235. package/src/rust/components/rows_counter.rs +0 -124
  236. package/src/rust/components/settings_panel.rs +0 -406
  237. package/src/rust/components/status_bar.rs +0 -595
  238. package/src/rust/components/status_indicator.rs +0 -125
  239. package/src/rust/components/style.rs +0 -107
  240. package/src/rust/components/style_controls/mod.rs +0 -15
  241. package/src/rust/components/style_controls/number_string_format/digits_section.rs +0 -150
  242. package/src/rust/components/style_controls/number_string_format/misc_section.rs +0 -60
  243. package/src/rust/components/style_controls/number_string_format/style_section.rs +0 -70
  244. package/src/rust/components/style_controls/number_string_format/types.rs +0 -55
  245. package/src/rust/components/style_controls/number_string_format.rs +0 -258
  246. package/src/rust/components/type_icon.rs +0 -53
  247. package/src/rust/components/viewer/filters.rs +0 -145
  248. package/src/rust/components/viewer/msg.rs +0 -242
  249. package/src/rust/components/viewer/panels.rs +0 -397
  250. package/src/rust/components/viewer/render.rs +0 -266
  251. package/src/rust/components/viewer/settings.rs +0 -621
  252. package/src/rust/components/viewer/snapshots.rs +0 -154
  253. package/src/rust/components/viewer/wiring.rs +0 -500
  254. package/src/rust/components/viewer.rs +0 -429
  255. package/src/rust/components/window_editor.rs +0 -985
  256. package/src/rust/config/column_config_schema.rs +0 -525
  257. package/src/rust/config/columns_config.rs +0 -39
  258. package/src/rust/config/datetime_column_style/custom.rs +0 -138
  259. package/src/rust/config/datetime_column_style/custom_format.rs +0 -90
  260. package/src/rust/config/datetime_column_style/simple.rs +0 -65
  261. package/src/rust/config/datetime_column_style/simple_format.rs +0 -86
  262. package/src/rust/config/datetime_column_style.rs +0 -66
  263. package/src/rust/config/export_method.rs +0 -175
  264. package/src/rust/config/kvpair.rs +0 -47
  265. package/src/rust/config/mod.rs +0 -39
  266. package/src/rust/config/number_series_style.rs +0 -79
  267. package/src/rust/config/number_string_format/enums.rs +0 -298
  268. package/src/rust/config/number_string_format.rs +0 -424
  269. package/src/rust/config/options.rs +0 -145
  270. package/src/rust/config/plugin_static_config.rs +0 -217
  271. package/src/rust/config/view_config.rs +0 -24
  272. package/src/rust/config/viewer_config.rs +0 -461
  273. package/src/rust/config/workspace_config.rs +0 -297
  274. package/src/rust/custom_elements/debug_plugin.rs +0 -122
  275. package/src/rust/custom_elements/mod.rs +0 -17
  276. package/src/rust/custom_elements/viewer.rs +0 -2255
  277. package/src/rust/custom_events.rs +0 -423
  278. package/src/rust/derived.rs +0 -266
  279. package/src/rust/exprtk/cursor.rs +0 -90
  280. package/src/rust/exprtk/mod.rs +0 -19
  281. package/src/rust/exprtk/tokenize/comment.rs +0 -21
  282. package/src/rust/exprtk/tokenize/number.rs +0 -44
  283. package/src/rust/exprtk/tokenize/string.rs +0 -98
  284. package/src/rust/exprtk/tokenize/symbol.rs +0 -26
  285. package/src/rust/exprtk/tokenize.rs +0 -153
  286. package/src/rust/js/clipboard.rs +0 -77
  287. package/src/rust/js/clipboard_item.rs +0 -21
  288. package/src/rust/js/intersection_observer.rs +0 -32
  289. package/src/rust/js/mimetype.rs +0 -37
  290. package/src/rust/js/mod.rs +0 -30
  291. package/src/rust/js/plugin.rs +0 -324
  292. package/src/rust/js/regular_layout.rs +0 -480
  293. package/src/rust/js/resize_observer.rs +0 -37
  294. package/src/rust/lib.rs +0 -204
  295. package/src/rust/presentation/column_locator.rs +0 -115
  296. package/src/rust/presentation/props.rs +0 -47
  297. package/src/rust/presentation/sheets.rs +0 -78
  298. package/src/rust/presentation.rs +0 -825
  299. package/src/rust/queries/column_locator.rs +0 -114
  300. package/src/rust/queries/column_values.rs +0 -59
  301. package/src/rust/queries/columns_iter_set.rs +0 -331
  302. package/src/rust/queries/export_app.rs +0 -59
  303. package/src/rust/queries/exports.rs +0 -96
  304. package/src/rust/queries/fetch_column_stats.rs +0 -94
  305. package/src/rust/queries/get_viewer_config.rs +0 -73
  306. package/src/rust/queries/hosted_tables.rs +0 -38
  307. package/src/rust/queries/is_invalid_drop.rs +0 -36
  308. package/src/rust/queries/mod.rs +0 -48
  309. package/src/rust/queries/palette_set.rs +0 -82
  310. package/src/rust/queries/plugin_column_styles.rs +0 -105
  311. package/src/rust/queries/validate_expression.rs +0 -39
  312. package/src/rust/renderer/activate.rs +0 -90
  313. package/src/rust/renderer/dispatch.rs +0 -564
  314. package/src/rust/renderer/limits.rs +0 -104
  315. package/src/rust/renderer/plugin_config.rs +0 -1129
  316. package/src/rust/renderer/plugin_store.rs +0 -58
  317. package/src/rust/renderer/props.rs +0 -69
  318. package/src/rust/renderer/registry.rs +0 -175
  319. package/src/rust/renderer/render_timer.rs +0 -204
  320. package/src/rust/renderer/state.rs +0 -205
  321. package/src/rust/renderer.rs +0 -868
  322. package/src/rust/root.rs +0 -50
  323. package/src/rust/session/column_defaults_update.rs +0 -194
  324. package/src/rust/session/drag_drop_update.rs +0 -197
  325. package/src/rust/session/metadata.rs +0 -415
  326. package/src/rust/session/op_queue.rs +0 -430
  327. package/src/rust/session/panel_state.rs +0 -327
  328. package/src/rust/session/props.rs +0 -193
  329. package/src/rust/session/replace_expression_update.rs +0 -133
  330. package/src/rust/session/view_subscription.rs +0 -266
  331. package/src/rust/session.rs +0 -1901
  332. package/src/rust/tasks/apply_global_filters.rs +0 -103
  333. package/src/rust/tasks/auto_pause.rs +0 -181
  334. package/src/rust/tasks/copy_export.rs +0 -296
  335. package/src/rust/tasks/create_panel.rs +0 -268
  336. package/src/rust/tasks/derive.rs +0 -312
  337. package/src/rust/tasks/dismiss_render_warning.rs +0 -35
  338. package/src/rust/tasks/edit_expression.rs +0 -92
  339. package/src/rust/tasks/edit_window.rs +0 -153
  340. package/src/rust/tasks/eject.rs +0 -89
  341. package/src/rust/tasks/mod.rs +0 -80
  342. package/src/rust/tasks/pipeline.rs +0 -425
  343. package/src/rust/tasks/presize_panels.rs +0 -386
  344. package/src/rust/tasks/reset_all.rs +0 -119
  345. package/src/rust/tasks/resize_observer.rs +0 -173
  346. package/src/rust/tasks/restore_derived.rs +0 -200
  347. package/src/rust/tasks/restore_panel.rs +0 -271
  348. package/src/rust/tasks/send_column_config.rs +0 -87
  349. package/src/rust/tasks/send_plugin_config.rs +0 -83
  350. package/src/rust/tasks/set_edit_mode.rs +0 -69
  351. package/src/rust/tasks/sync_update_panels.rs +0 -244
  352. package/src/rust/tasks/table_lifecycle.rs +0 -200
  353. package/src/rust/tasks/transactional_restore.rs +0 -387
  354. package/src/rust/tasks/update_theme.rs +0 -139
  355. package/src/rust/tasks/validate_expression.rs +0 -61
  356. package/src/rust/ui/containers/control_group.rs +0 -113
  357. package/src/rust/ui/containers/dropdown_menu.rs +0 -103
  358. package/src/rust/ui/containers/mod.rs +0 -21
  359. package/src/rust/ui/containers/scroll_panel.rs +0 -315
  360. package/src/rust/ui/containers/scroll_panel_item.rs +0 -98
  361. package/src/rust/ui/containers/select.rs +0 -271
  362. package/src/rust/ui/containers/sidebar.rs +0 -125
  363. package/src/rust/ui/containers/sidebar_close_button.rs +0 -30
  364. package/src/rust/ui/containers/split_panel.rs +0 -498
  365. package/src/rust/ui/containers/tab_list.rs +0 -101
  366. package/src/rust/ui/context_menu.rs +0 -264
  367. package/src/rust/ui/dragdrop.rs +0 -201
  368. package/src/rust/ui/font_loader.rs +0 -201
  369. package/src/rust/ui/form/color_selector.rs +0 -58
  370. package/src/rust/ui/form/intl_label.rs +0 -62
  371. package/src/rust/ui/form/mirrored_textarea.rs +0 -100
  372. package/src/rust/ui/form/mod.rs +0 -24
  373. package/src/rust/ui/form/multi_stop_gradient_selector.rs +0 -386
  374. package/src/rust/ui/form/named_value_picker.rs +0 -81
  375. package/src/rust/ui/form/number_field.rs +0 -72
  376. package/src/rust/ui/form/number_input.rs +0 -45
  377. package/src/rust/ui/form/number_range_field.rs +0 -77
  378. package/src/rust/ui/form/optional_field.rs +0 -55
  379. package/src/rust/ui/form/palette_selector.rs +0 -388
  380. package/src/rust/ui/form/select_enum_field.rs +0 -59
  381. package/src/rust/ui/form/select_value_field.rs +0 -64
  382. package/src/rust/ui/mod.rs +0 -56
  383. package/src/rust/ui/modal.rs +0 -61
  384. package/src/rust/ui/portal.rs +0 -374
  385. package/src/rust/ui/style.rs +0 -56
  386. package/src/rust/utils/browser/blob.rs +0 -63
  387. package/src/rust/utils/browser/download.rs +0 -27
  388. package/src/rust/utils/browser/dragdrop.rs +0 -38
  389. package/src/rust/utils/browser/mod.rs +0 -27
  390. package/src/rust/utils/browser/mouse.rs +0 -24
  391. package/src/rust/utils/browser/request_animation_frame.rs +0 -95
  392. package/src/rust/utils/browser/selection.rs +0 -84
  393. package/src/rust/utils/completion.rs +0 -50
  394. package/src/rust/utils/css.rs +0 -525
  395. package/src/rust/utils/css_vars.rs +0 -39
  396. package/src/rust/utils/custom_element.rs +0 -105
  397. package/src/rust/utils/datetime.rs +0 -54
  398. package/src/rust/utils/debounce.rs +0 -232
  399. package/src/rust/utils/hooks/mod.rs +0 -15
  400. package/src/rust/utils/hooks/use_async_callback.rs +0 -43
  401. package/src/rust/utils/in_flight.rs +0 -74
  402. package/src/rust/utils/local_fonts.rs +0 -359
  403. package/src/rust/utils/mod.rs +0 -56
  404. package/src/rust/utils/modal_position.rs +0 -104
  405. package/src/rust/utils/number_format.rs +0 -49
  406. package/src/rust/utils/pending_effects.rs +0 -38
  407. package/src/rust/utils/plugin_host_state.rs +0 -43
  408. package/src/rust/utils/ptr_eq_rc.rs +0 -74
  409. package/src/rust/utils/pubsub.rs +0 -236
  410. package/src/rust/utils/spawn.rs +0 -33
  411. package/src/rust/utils/weak_scope.rs +0 -39
  412. package/src/rust/workspace.rs +0 -1195
  413. package/src/svg/active-indicator.svg +0 -3
  414. package/src/svg/align-scroll-icon.svg +0 -7
  415. package/src/svg/bg-pattern.png +0 -0
  416. package/src/svg/bookmark-icon.svg +0 -4
  417. package/src/svg/boolean-type.svg +0 -4
  418. package/src/svg/checkbox-checked-icon.svg +0 -4
  419. package/src/svg/checkbox-hover.svg +0 -4
  420. package/src/svg/checkbox-off.svg +0 -3
  421. package/src/svg/checkbox-on.svg +0 -4
  422. package/src/svg/checkbox-unchecked-icon.svg +0 -3
  423. package/src/svg/close-icon.svg +0 -6
  424. package/src/svg/column-settings-icon.svg +0 -6
  425. package/src/svg/datagrid-select-column.svg +0 -8
  426. package/src/svg/datagrid-select-region.svg +0 -8
  427. package/src/svg/datagrid-select-row-tree.svg +0 -8
  428. package/src/svg/datagrid-select-row.svg +0 -8
  429. package/src/svg/datagrid.svg +0 -13
  430. package/src/svg/date-type.svg +0 -4
  431. package/src/svg/derived.svg +0 -6
  432. package/src/svg/downloading.gif +0 -0
  433. package/src/svg/drag-handle copy.svg +0 -10
  434. package/src/svg/drag-handle.svg +0 -10
  435. package/src/svg/drawer-bg-pattern-hidpi.png +0 -0
  436. package/src/svg/drawer-tab-hover.svg +0 -4
  437. package/src/svg/drawer-tab-invert-hover.svg +0 -5
  438. package/src/svg/drawer-tab-invert.svg +0 -3
  439. package/src/svg/drawer-tab.svg +0 -5
  440. package/src/svg/dropdown-selector.svg +0 -3
  441. package/src/svg/duplicate-icon.svg +0 -4
  442. package/src/svg/editable-icon.svg +0 -5
  443. package/src/svg/export-icon.svg +0 -4
  444. package/src/svg/expression.svg +0 -10
  445. package/src/svg/free-scroll-icon.svg +0 -5
  446. package/src/svg/inactive-mouseover.svg +0 -4
  447. package/src/svg/lock.svg +0 -7
  448. package/src/svg/mega-menu-icons-candlestick.svg +0 -6
  449. package/src/svg/mega-menu-icons-datagrid.svg +0 -37
  450. package/src/svg/mega-menu-icons-density.svg +0 -23
  451. package/src/svg/mega-menu-icons-heatmap.svg +0 -60
  452. package/src/svg/mega-menu-icons-map-density.svg +0 -24
  453. package/src/svg/mega-menu-icons-map-line.svg +0 -19
  454. package/src/svg/mega-menu-icons-map-scatter.svg +0 -43
  455. package/src/svg/mega-menu-icons-ohlc.svg +0 -5
  456. package/src/svg/mega-menu-icons-sunburst.svg +0 -5
  457. package/src/svg/mega-menu-icons-treemap.svg +0 -4
  458. package/src/svg/mega-menu-icons-x-bar.svg +0 -36
  459. package/src/svg/mega-menu-icons-x-y-line.svg +0 -38
  460. package/src/svg/mega-menu-icons-x-y-scatter.svg +0 -72
  461. package/src/svg/mega-menu-icons-y-area.svg +0 -73
  462. package/src/svg/mega-menu-icons-y-bar.svg +0 -36
  463. package/src/svg/mega-menu-icons-y-line.svg +0 -36
  464. package/src/svg/mega-menu-icons-y-scatter.svg +0 -12
  465. package/src/svg/new-panel-icon.svg +0 -4
  466. package/src/svg/number-type.svg +0 -4
  467. package/src/svg/pin-icon.svg +0 -5
  468. package/src/svg/radio-hover.svg +0 -4
  469. package/src/svg/radio-off.svg +0 -3
  470. package/src/svg/radio-on.svg +0 -4
  471. package/src/svg/read-only-icon.svg +0 -6
  472. package/src/svg/revert-icon.svg +0 -4
  473. package/src/svg/sort-abs-asc-icon.svg +0 -3
  474. package/src/svg/sort-abs-col-asc-icon.svg +0 -3
  475. package/src/svg/sort-abs-col-desc-icon.svg +0 -3
  476. package/src/svg/sort-abs-desc-icon.svg +0 -3
  477. package/src/svg/sort-asc-icon.svg +0 -4
  478. package/src/svg/sort-col-asc-icon.svg +0 -4
  479. package/src/svg/sort-col-desc-icon.svg +0 -4
  480. package/src/svg/sort-desc-icon.svg +0 -4
  481. package/src/svg/sort-none-icon.svg +0 -3
  482. package/src/svg/status_error.svg +0 -70
  483. package/src/svg/status_ok.svg +0 -3
  484. package/src/svg/status_pending.svg +0 -3
  485. package/src/svg/string-type.svg +0 -4
  486. package/src/svg/theme-icon.svg +0 -5
  487. package/src/svg/updating.gif +0 -0
  488. package/src/themes/blueprint.css +0 -133
  489. package/src/themes/botanical.css +0 -97
  490. package/src/themes/defaults.css +0 -68
  491. package/src/themes/dracula.css +0 -167
  492. package/src/themes/eggplant.css +0 -131
  493. package/src/themes/gruvbox-dark.css +0 -183
  494. package/src/themes/gruvbox.css +0 -97
  495. package/src/themes/icons.css +0 -110
  496. package/src/themes/intl/ar.css +0 -209
  497. package/src/themes/intl/de.css +0 -218
  498. package/src/themes/intl/es.css +0 -218
  499. package/src/themes/intl/fr.css +0 -218
  500. package/src/themes/intl/ja.css +0 -218
  501. package/src/themes/intl/pt.css +0 -218
  502. package/src/themes/intl/zh.css +0 -218
  503. package/src/themes/intl.css +0 -220
  504. package/src/themes/ledger.css +0 -137
  505. package/src/themes/monokai.css +0 -181
  506. package/src/themes/nord.css +0 -131
  507. package/src/themes/phosphor.css +0 -125
  508. package/src/themes/pro-dark.css +0 -113
  509. package/src/themes/pro.css +0 -117
  510. package/src/themes/solarized-dark.css +0 -85
  511. package/src/themes/solarized.css +0 -72
  512. package/src/themes/themes.css +0 -28
  513. package/src/themes/vaporwave.css +0 -191
  514. package/src/themes/velvet.css +0 -132
  515. package/src/ts/bootstrap.ts +0 -38
  516. package/src/ts/column-format.ts +0 -233
  517. package/src/ts/extensions.ts +0 -236
  518. package/src/ts/perspective-viewer.cdn.ts +0 -19
  519. package/src/ts/perspective-viewer.ts +0 -72
  520. package/src/ts/perspective-viewer.worker.ts +0 -14
  521. package/src/ts/plugin.ts +0 -296
  522. package/src/ts/providers.ts +0 -96
  523. package/src/ts/select-detail.ts +0 -48
  524. package/src/ts/ts-rs/CustomDatetimeFormat.ts +0 -3
  525. package/src/ts/ts-rs/CustomDatetimeStyleConfig.ts +0 -54
  526. package/src/ts/ts-rs/DatetimeFormatType.ts +0 -8
  527. package/src/ts/ts-rs/FormatUnit.ts +0 -3
  528. package/src/ts/ts-rs/SimpleDatetimeStyleConfig.ts +0 -25
  529. package/tsconfig.json +0 -16
  530. /package/{src/ts/ts-rs/AddPanelOptions.ts → dist/ts-rs/AddPanelOptions.d.ts} +0 -0
  531. /package/{src/ts/ts-rs/Aggregate.ts → dist/ts-rs/Aggregate.d.ts} +0 -0
  532. /package/{src/ts/ts-rs/ClientOptions.ts → dist/ts-rs/ClientOptions.d.ts} +0 -0
  533. /package/{src/ts/ts-rs/ColumnSelectMode.ts → dist/ts-rs/ColumnSelectMode.d.ts} +0 -0
  534. /package/{src/ts/ts-rs/CompactDisplay.ts → dist/ts-rs/CompactDisplay.d.ts} +0 -0
  535. /package/{src/ts/ts-rs/CurrencyCode.ts → dist/ts-rs/CurrencyCode.d.ts} +0 -0
  536. /package/{src/ts/ts-rs/CurrencyDisplay.ts → dist/ts-rs/CurrencyDisplay.d.ts} +0 -0
  537. /package/{src/ts/ts-rs/CurrencySign.ts → dist/ts-rs/CurrencySign.d.ts} +0 -0
  538. /package/{src/ts/ts-rs/ExportMethod.ts → dist/ts-rs/ExportMethod.d.ts} +0 -0
  539. /package/{src/ts/ts-rs/Expressions.ts → dist/ts-rs/Expressions.d.ts} +0 -0
  540. /package/{src/ts/ts-rs/FilterReducer.ts → dist/ts-rs/FilterReducer.d.ts} +0 -0
  541. /package/{src/ts/ts-rs/GetClientOptions.ts → dist/ts-rs/GetClientOptions.d.ts} +0 -0
  542. /package/{src/ts/ts-rs/GetTableOptions.ts → dist/ts-rs/GetTableOptions.d.ts} +0 -0
  543. /package/{src/ts/ts-rs/GetViewMode.ts → dist/ts-rs/GetViewMode.d.ts} +0 -0
  544. /package/{src/ts/ts-rs/GroupRollupMode.ts → dist/ts-rs/GroupRollupMode.d.ts} +0 -0
  545. /package/{src/ts/ts-rs/OptionalUpdate.ts → dist/ts-rs/OptionalUpdate.d.ts} +0 -0
  546. /package/{src/ts/ts-rs/Orientation.ts → dist/ts-rs/Orientation.d.ts} +0 -0
  547. /package/{src/ts/ts-rs/PanelOptions.ts → dist/ts-rs/PanelOptions.d.ts} +0 -0
  548. /package/{src/ts/ts-rs/RestoreOptions.ts → dist/ts-rs/RestoreOptions.d.ts} +0 -0
  549. /package/{src/ts/ts-rs/RestoreWorkspaceOptions.ts → dist/ts-rs/RestoreWorkspaceOptions.d.ts} +0 -0
  550. /package/{src/ts/ts-rs/RoundingMode.ts → dist/ts-rs/RoundingMode.d.ts} +0 -0
  551. /package/{src/ts/ts-rs/RoundingPriority.ts → dist/ts-rs/RoundingPriority.d.ts} +0 -0
  552. /package/{src/ts/ts-rs/SaveWorkspaceOptions.ts → dist/ts-rs/SaveWorkspaceOptions.d.ts} +0 -0
  553. /package/{src/ts/ts-rs/Scalar.ts → dist/ts-rs/Scalar.d.ts} +0 -0
  554. /package/{src/ts/ts-rs/SignDisplay.ts → dist/ts-rs/SignDisplay.d.ts} +0 -0
  555. /package/{src/ts/ts-rs/SortDir.ts → dist/ts-rs/SortDir.d.ts} +0 -0
  556. /package/{src/ts/ts-rs/SplitRollupMode.ts → dist/ts-rs/SplitRollupMode.d.ts} +0 -0
  557. /package/{src/ts/ts-rs/TabLayout.ts → dist/ts-rs/TabLayout.d.ts} +0 -0
  558. /package/{src/ts/ts-rs/TrailingZeroDisplay.ts → dist/ts-rs/TrailingZeroDisplay.d.ts} +0 -0
  559. /package/{src/ts/ts-rs/UnitDisplay.ts → dist/ts-rs/UnitDisplay.d.ts} +0 -0
  560. /package/{src/ts/ts-rs/UseGrouping.ts → dist/ts-rs/UseGrouping.d.ts} +0 -0
  561. /package/{src/ts/ts-rs/ViewOnUpdateResp.ts → dist/ts-rs/ViewOnUpdateResp.d.ts} +0 -0
  562. /package/{src/ts/ts-rs/WindowSortDir.ts → dist/ts-rs/WindowSortDir.d.ts} +0 -0
  563. /package/{src/ts/ts-rs/serde_json/JsonValue.ts → dist/ts-rs/serde_json/JsonValue.d.ts} +0 -0
  564. /package/dist/wasm/snippets/{perspective-viewer-7fc45549159e01e4 → perspective-viewer-c26bfdc60d367a99}/inline0.js +0 -0
  565. /package/dist/wasm/snippets/{perspective-viewer-7fc45549159e01e4 → perspective-viewer-c26bfdc60d367a99}/inline1.js +0 -0
  566. /package/dist/wasm/snippets/{perspective-viewer-7fc45549159e01e4 → perspective-viewer-c26bfdc60d367a99}/inline2.js +0 -0
  567. /package/dist/wasm/snippets/{perspective-viewer-7fc45549159e01e4 → perspective-viewer-c26bfdc60d367a99}/inline3.js +0 -0
  568. /package/dist/wasm/snippets/{perspective-viewer-7fc45549159e01e4 → perspective-viewer-c26bfdc60d367a99}/inline5.js +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/core/types.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/core/constants.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/layout/generate_grid.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/layout/calculate_intersect.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/layout/remove_child.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/layout/insert_child.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/layout/redistribute_panel_sizes.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/layout/generate_overlay.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/layout/flatten.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/layout/calculate_path.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/layout/calculate_presize_paths.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/model/presize_queue.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/layout/calculate_edge.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/model/overlay_controller.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/regular-layout.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/regular-layout-frame.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/regular-layout-tab.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/extensions.ts", "../../src/ts/plugin.ts", "../../src/ts/providers.ts", "../../src/ts/column-format.ts", "../../src/ts/select-detail.ts", "../../../perspective-js/src/ts/wasm/decompress.ts", "worker:./perspective-viewer", "worker-stub:./perspective-viewer.worker", "../../src/ts/bootstrap.ts", "../../src/ts/perspective-viewer.ts", "../../src/ts/perspective-viewer.cdn.ts"],
4
- "sourcesContent": ["// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\n/**\n * The overlay behavior type.\n */\nexport type OverlayMode = \"grid\" | \"absolute\";\n\n/**\n * The representation of a CSS grid, in JSON form.\n */\nexport type Layout = SplitLayout | TabLayout;\n\n/**\n * The orientation (of a `SplitPanel`).\n */\nexport type Orientation = \"horizontal\" | \"vertical\";\n\n/**\n * A logical rectange in percent-coordinates (of a (1, 1) square).\n */\nexport interface ViewWindow {\n\trow_start: number;\n\trow_end: number;\n\tcol_start: number;\n\tcol_end: number;\n}\n\n/**\n * A split panel that divides space among multiple child layouts\n * .\n * Child panels are arranged either horizontally (side by side) or vertically\n * (stacked), via the `orientation` property `\"horizzontal\"` and `\"vertical\"`\n * (respectively).\n *\n * While the type structure of `SplitLayout` allows nesting levels with the same\n * `orientation`, calling `RegularLayout.restore` with such a `Layout` will be\n * flattened to the equivalent layout with every child guaranteed to have the\n * opposite `orientation` as its parent.\n */\nexport interface SplitLayout {\n\ttype: \"split-layout\";\n\tchildren: Layout[];\n\tsizes: number[];\n\torientation: Orientation;\n}\n\n/**\n * A leaf panel node that contains a single named child element.\n */\nexport interface TabLayout {\n\ttype: \"tab-layout\";\n\ttabs: string[];\n\tselected?: number;\n}\n\n/**\n * Represents a panel location relative to a `Layout` struct.\n */\nexport type LayoutPathTraversal = number[];\n\n/**\n * Represents a draggable divider between two panels in the layout.\n *\n * Used for hit detection.\n */\nexport interface LayoutDivider {\n\tpath: LayoutPathTraversal;\n\tview_window: ViewWindow;\n\ttype: Orientation;\n}\n\n/**\n * Represents a panel location result from hit detection.\n */\nexport interface LayoutPath {\n\ttype: \"layout-path\";\n\tslot: string;\n\tpath: LayoutPathTraversal;\n\tview_window: ViewWindow;\n\tcolumn: number;\n\trow: number;\n\tcolumn_offset: number;\n\trow_offset: number;\n\torientation: Orientation;\n\tis_edge: boolean;\n\tlayout: Layout;\n}\n\n/**\n * The detail payload of the `regular-layout-before-resize` event.\n */\nexport interface PresizeDetail {\n\tcalculatePresizePaths(): Record<string, LayoutPath>;\n\n\t/**\n\t * When the transition is a drag preview, the dragged panel's name and the\n\t * {@link LayoutPath} of its preview box. The dragged panel is removed from\n\t * the layout tree during a drag (so it is absent from\n\t * {@link PresizeDetail.calculatePresizePaths}), but `path.view_window` here\n\t * is exactly where the overlay renders it, letting consumers presize the\n\t * dragged panel like any other. `null` when the pointer is outside every\n\t * drop target (the dragged panel is hidden), `undefined` for non-drag\n\t * transitions.\n\t */\n\toverlay?: { slot: string; path: LayoutPath } | null;\n}\n\n/**\n * An empty `Layout` with no panels.\n */\nexport const EMPTY_PANEL: Layout = {\n\ttype: \"split-layout\",\n\torientation: \"horizontal\",\n\tsizes: [],\n\tchildren: [],\n};\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport type { OverlayMode } from \"./types\";\n\n/**\n * Instance-specific constants which define the behavior and rendering details\n * of a `<regular-layout>`.\n */\nexport interface Physics {\n\t/**\n\t * The prefix to use for `CustomEvent`s generated by `regular-layout`, e.g.\n\t * `\"regular-layout-before-update\"`.\n\t */\n\tCUSTOM_EVENT_NAME_PREFIX: string;\n\n\t/**\n\t * The attribute name to use for matching child `Element`s to grid\n\t * positions.\n\t */\n\tCHILD_ATTRIBUTE_NAME: string;\n\n\t/**\n\t * The minimum number of pixels the mouse must move to be considered a drag.\n\t */\n\tMIN_DRAG_DISTANCE: number;\n\n\t/**\n\t * Should floating point pixel calculations be rounded. Useful for testing.\n\t */\n\tSHOULD_ROUND: boolean;\n\n\t/**\n\t * Class name to use for child elements in overlay position (dragging).\n\t */\n\tOVERLAY_CLASSNAME: string;\n\n\t/**\n\t * The percentage of the maximum resize distance that will be clamped.\n\t */\n\tMINIMUM_REDISTRIBUTION_SIZE_THRESHOLD: number;\n\n\t/**\n\t * Threshold from panel edge that is considered a split vs drop action.\n\t */\n\tSPLIT_EDGE_TOLERANCE: number;\n\n\t/**\n\t * Threshold from _container_ edge that is considered a split action on the root\n\t * node.\n\t */\n\tSPLIT_ROOT_EDGE_TOLERANCE: number;\n\n\t/**\n\t * Tolerance threshold for considering two grid track positions as identical.\n\t *\n\t * When collecting and deduplicating track positions, any positions closer than\n\t * this value are treated as the same position to avoid redundant grid tracks.\n\t */\n\tGRID_TRACK_COLLAPSE_TOLERANCE: number;\n\n\t/**\n\t * The overlay default behavior.\n\t */\n\tOVERLAY_DEFAULT: OverlayMode;\n\n\t/**\n\t * Width of split panel dividers in pixels (for hit-test purposes).\n\t */\n\tGRID_DIVIDER_SIZE: number;\n\n\t/**\n\t * Whether the grid should trigger column resize if the grid itself is not\n\t * the `event.target`.\n\t */\n\tGRID_DIVIDER_CHECK_TARGET: boolean;\n}\n\n/**\n * Like `GlobalPhysics`, but suitable for partial definition for incremental\n * updates.\n */\nexport interface PhysicsUpdate {\n\tCUSTOM_EVENT_NAME_PREFIX?: string;\n\tCHILD_ATTRIBUTE_NAME?: string;\n\tMIN_DRAG_DISTANCE?: number;\n\tSHOULD_ROUND?: boolean;\n\tOVERLAY_CLASSNAME?: string;\n\tMINIMUM_REDISTRIBUTION_SIZE_THRESHOLD?: number;\n\tSPLIT_EDGE_TOLERANCE?: number;\n\tSPLIT_ROOT_EDGE_TOLERANCE?: number;\n\tGRID_TRACK_COLLAPSE_TOLERANCE?: number;\n\tOVERLAY_DEFAULT?: OverlayMode;\n\tGRID_DIVIDER_SIZE?: number;\n\tGRID_DIVIDER_CHECK_TARGET?: boolean;\n}\n\nexport const DEFAULT_PHYSICS: Physics = Object.freeze({\n\tCUSTOM_EVENT_NAME_PREFIX: \"regular-layout\",\n\tCHILD_ATTRIBUTE_NAME: \"name\",\n\tMIN_DRAG_DISTANCE: 10,\n\tSHOULD_ROUND: false,\n\tOVERLAY_CLASSNAME: \"overlay\",\n\tMINIMUM_REDISTRIBUTION_SIZE_THRESHOLD: 0.15,\n\tSPLIT_EDGE_TOLERANCE: 0.33,\n\tSPLIT_ROOT_EDGE_TOLERANCE: 0.03,\n\tGRID_TRACK_COLLAPSE_TOLERANCE: 0.001,\n\tOVERLAY_DEFAULT: \"absolute\",\n\tGRID_DIVIDER_SIZE: 6,\n\tGRID_DIVIDER_CHECK_TARGET: true,\n});\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport { DEFAULT_PHYSICS, type Physics } from \"../core/constants.ts\";\nimport type { Layout } from \"../core/types.ts\";\n\ninterface GridCell {\n\tchild: string;\n\tcolStart: number;\n\tcolEnd: number;\n\trowStart: number;\n\trowEnd: number;\n\tzIndex?: number;\n}\n\nfunction dedupe_sort(physics: Physics, result: number[], pos: number) {\n\tif (\n\t\tresult.length === 0 ||\n\t\tMath.abs(pos - result[result.length - 1]) >\n\t\t\tphysics.GRID_TRACK_COLLAPSE_TOLERANCE\n\t) {\n\t\tresult.push(pos);\n\t}\n\n\treturn result;\n}\n\nfunction dedupe_positions(physics: Physics, positions: number[]): number[] {\n\tconst sorted = positions.sort((a, b) => a - b);\n\treturn sorted.reduce(dedupe_sort.bind(undefined, physics), []);\n}\n\nfunction collect_track_positions(\n\tpanel: Layout,\n\torientation: \"horizontal\" | \"vertical\",\n\tstart: number,\n\tend: number,\n\tphysics: Physics,\n): number[] {\n\tif (panel.type === \"tab-layout\") {\n\t\treturn [start, end];\n\t}\n\n\tconst positions: number[] = [start, end];\n\tif (panel.orientation === orientation) {\n\t\tlet current = start;\n\t\tconst range = end - start;\n\t\tfor (let i = 0; i < panel.children.length; i++) {\n\t\t\tconst size = panel.sizes[i];\n\t\t\tconst next = current + size * range;\n\t\t\tpositions.push(\n\t\t\t\t...collect_track_positions(\n\t\t\t\t\tpanel.children[i],\n\t\t\t\t\torientation,\n\t\t\t\t\tcurrent,\n\t\t\t\t\tnext,\n\t\t\t\t\tphysics,\n\t\t\t\t),\n\t\t\t);\n\n\t\t\tcurrent = next;\n\t\t}\n\t} else {\n\t\tfor (const child of panel.children) {\n\t\t\tpositions.push(\n\t\t\t\t...collect_track_positions(child, orientation, start, end, physics),\n\t\t\t);\n\t\t}\n\t}\n\n\treturn dedupe_positions(physics, positions);\n}\n\nfunction find_track_index(\n\tphysics: Physics,\n\tpositions: number[],\n\tvalue: number,\n): number {\n\tconst index = positions.findIndex(\n\t\t(pos) => Math.abs(pos - value) < physics.GRID_TRACK_COLLAPSE_TOLERANCE,\n\t);\n\n\treturn index === -1 ? 0 : index;\n}\n\nfunction build_cells(\n\tpanel: Layout,\n\tcolPositions: number[],\n\trowPositions: number[],\n\tcolStart: number,\n\tcolEnd: number,\n\trowStart: number,\n\trowEnd: number,\n\tphysics: Physics,\n): GridCell[] {\n\tif (panel.type === \"tab-layout\") {\n\t\tconst selected = panel.selected ?? 0;\n\t\tconst col_start = find_track_index(physics, colPositions, colStart);\n\t\tconst col_end = find_track_index(physics, colPositions, colEnd);\n\t\tconst row_start = find_track_index(physics, rowPositions, rowStart);\n\t\tconst row_end = find_track_index(physics, rowPositions, rowEnd);\n\n\t\t// Stacked tabs all occupy the same cell, overlapping. Only the selected\n\t\t// frame is lifted (`z-index:1`) so its content sits on top; the rest\n\t\t// self-hide their content and just contribute their tab. Keeping the\n\t\t// max frame `z-index` at 1 lets the drag overlay sit above any stack\n\t\t// with a small constant (2). A single-tab stack\n\t\t// emits one placement with no `z-index`, so non-stacked output is\n\t\t// unchanged.\n\t\treturn panel.tabs.map((child, i) => ({\n\t\t\tchild,\n\t\t\tcolStart: col_start,\n\t\t\tcolEnd: col_end,\n\t\t\trowStart: row_start,\n\t\t\trowEnd: row_end,\n\t\t\tzIndex: panel.tabs.length > 1 && i === selected ? 1 : undefined,\n\t\t}));\n\t}\n\n\tconst { children, sizes, orientation } = panel;\n\tconst isHorizontal = orientation === \"horizontal\";\n\tlet current = isHorizontal ? colStart : rowStart;\n\tconst range = isHorizontal ? colEnd - colStart : rowEnd - rowStart;\n\tconst cells: GridCell[] = [];\n\tfor (let i = 0; i < children.length; i++) {\n\t\tconst next = current + sizes[i] * range;\n\t\tif (isHorizontal) {\n\t\t\tcells.push(\n\t\t\t\t...build_cells(\n\t\t\t\t\tchildren[i],\n\t\t\t\t\tcolPositions,\n\t\t\t\t\trowPositions,\n\t\t\t\t\tcurrent,\n\t\t\t\t\tnext,\n\t\t\t\t\trowStart,\n\t\t\t\t\trowEnd,\n\t\t\t\t\tphysics,\n\t\t\t\t),\n\t\t\t);\n\t\t} else {\n\t\t\tcells.push(\n\t\t\t\t...build_cells(\n\t\t\t\t\tchildren[i],\n\t\t\t\t\tcolPositions,\n\t\t\t\t\trowPositions,\n\t\t\t\t\tcolStart,\n\t\t\t\t\tcolEnd,\n\t\t\t\t\tcurrent,\n\t\t\t\t\tnext,\n\t\t\t\t\tphysics,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\tcurrent = next;\n\t}\n\n\treturn cells;\n}\n\nconst host_template = (rowTemplate: string, colTemplate: string) =>\n\t`:host ::slotted(*){display:none}:host{display:grid;grid-template-rows:${rowTemplate};grid-template-columns:${colTemplate}}`;\n\nconst child_template = (\n\tphysics: Physics,\n\tslot: string,\n\trowPart: string,\n\tcolPart: string,\n\tzIndex?: number,\n) =>\n\t`:host ::slotted([${physics.CHILD_ATTRIBUTE_NAME}=\"${slot}\"]){display:flex;grid-column:${colPart};grid-row:${rowPart}${\n\t\tzIndex === undefined ? \"\" : `;z-index:${zIndex}`\n\t}}`;\n\n/**\n * Generates CSS Grid styles to render a layout tree.\n * Creates grid-template-rows, grid-template-columns, and positioning rules for\n * all child panels.\n *\n * @param layout - The layout tree to convert to CSS\n * @param round - If true, rounds percentages to whole numbers. Useful for\n * avoiding sub-pixel rendering issues. Defaults to false.\n * @returns CSS string containing :host and ::slotted rules implementing the\n * layout.\n *\n * @example\n * ```typescript\n * const layout = {\n * type: \"split-layout\",\n * orientation: \"horizontal\",\n * children: [\n * { type: \"tab-layout\", tabs: \"sidebar\" },\n * { type: \"tab-layout\", tabs: \"main\" }\n * ],\n * sizes: [0.25, 0.75]\n * };\n *\n * const css = create_css_grid_layout(layout);\n * // Returns CSS like:\n * // :host { display: grid; grid-template-columns: 25% 75%; ... }\n * // :host ::slotted([name=sidebar]) { grid-column: 1; grid-row: 1; }\n * // :host ::slotted([name=main]) { grid-column: 2; grid-row: 1; }\n * ```\n */\nexport function create_css_grid_layout(\n\tlayout: Layout,\n\toverlay?: [string, string],\n\tphysics: Physics = DEFAULT_PHYSICS,\n): string {\n\tif (layout.type === \"tab-layout\") {\n\t\tconst selected = layout.selected ?? 0;\n\t\tconst stacked = layout.tabs.length > 1;\n\t\treturn [\n\t\t\thost_template(\"100%\", \"100%\"),\n\t\t\t...layout.tabs.map((tab, i) =>\n\t\t\t\tchild_template(\n\t\t\t\t\tphysics,\n\t\t\t\t\ttab,\n\t\t\t\t\t\"1\",\n\t\t\t\t\t\"1\",\n\t\t\t\t\tstacked && i === selected ? 1 : undefined,\n\t\t\t\t),\n\t\t\t),\n\t\t].join(\"\\n\");\n\t}\n\n\tconst createTemplate = (positions: number[]) => {\n\t\tconst sizes = positions\n\t\t\t.slice(0, -1)\n\t\t\t.map((pos, i) => positions[i + 1] - pos);\n\t\treturn sizes\n\t\t\t.map((s) => `${physics.SHOULD_ROUND ? Math.round(s * 100) : s * 100}fr`)\n\t\t\t.join(\" \");\n\t};\n\n\tconst colPositions = collect_track_positions(\n\t\tlayout,\n\t\t\"horizontal\",\n\t\t0,\n\t\t1,\n\t\tphysics,\n\t);\n\n\tconst colTemplate = createTemplate(colPositions);\n\tconst rowPositions = collect_track_positions(\n\t\tlayout,\n\t\t\"vertical\",\n\t\t0,\n\t\t1,\n\t\tphysics,\n\t);\n\n\tconst rowTemplate = createTemplate(rowPositions);\n\tconst formatGridLine = (start: number, end: number) =>\n\t\tend - start === 1 ? `${start + 1}` : `${start + 1} / ${end + 1}`;\n\n\tconst cells = build_cells(\n\t\tlayout,\n\t\tcolPositions,\n\t\trowPositions,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\tphysics,\n\t);\n\n\tconst css = [host_template(rowTemplate, colTemplate)];\n\tfor (const cell of cells) {\n\t\tconst colPart = formatGridLine(cell.colStart, cell.colEnd);\n\t\tconst rowPart = formatGridLine(cell.rowStart, cell.rowEnd);\n\t\tcss.push(\n\t\t\tchild_template(physics, cell.child, rowPart, colPart, cell.zIndex),\n\t\t);\n\t\tif (cell.child === overlay?.[1]) {\n\t\t\tcss.push(child_template(physics, overlay[0], rowPart, colPart));\n\t\t\tcss.push(\n\t\t\t\t`:host ::slotted([${physics.CHILD_ATTRIBUTE_NAME}=${overlay[0]}]){z-index:2}`,\n\t\t\t);\n\t\t}\n\t}\n\n\treturn css.join(\"\\n\");\n}\n\n/**\n * Generates CSS Grid styles that render a single panel maximized to fill the\n * entire layout, hiding all other slotted children.\n *\n * @param name - The name of the panel to maximize.\n * @param physics - Instance constants (defaults to {@link DEFAULT_PHYSICS}).\n * @returns CSS string showing only `name`, full-size.\n */\nexport function create_css_maximize_layout(\n\tname: string,\n\tphysics: Physics = DEFAULT_PHYSICS,\n): string {\n\treturn [\n\t\thost_template(\"100%\", \"100%\"),\n\t\tchild_template(physics, name, \"1\", \"1\"),\n\t].join(\"\\n\");\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport type {\n\tLayoutPath,\n\tLayoutDivider,\n\tLayout,\n\tViewWindow,\n\tLayoutPathTraversal,\n} from \"../core/types.ts\";\n\nconst VIEW_WINDOW = {\n\trow_start: 0,\n\trow_end: 1,\n\tcol_start: 0,\n\tcol_end: 1,\n};\n\n/**\n * Determines which panel or divider is located at a given position in the\n * layout.\n *\n * @param column - Horizontal position as a fraction (0-1) of the container width\n * @param row - Vertical position as a fraction (0-1) of the container height\n * @param layout - The layout tree to search\n * @param check_dividers - Whether `LayoutDivider` intersection should be\n * checked, which you may not want for e.g. `drop` actions.\n * @returns The panel path if over a panel, a divider if over a resizable\n * boundary, or null if outside all panels\n */\nexport function calculate_intersection(\n\tcolumn: number,\n\trow: number,\n\tlayout: Layout,\n\tcheck_dividers?: null,\n): LayoutPath | null;\n\nexport function calculate_intersection(\n\tcolumn: number,\n\trow: number,\n\tlayout: Layout,\n\tcheck_dividers?: { rect: DOMRect; size: number },\n): LayoutPath | null | LayoutDivider;\n\nexport function calculate_intersection(\n\tcolumn: number,\n\trow: number,\n\tlayout: Layout,\n\tcheck_dividers?: { rect: DOMRect; size: number } | null,\n): LayoutPath | null | LayoutDivider;\n\nexport function calculate_intersection(\n\tcolumn: number,\n\trow: number,\n\tlayout: Layout,\n\tcheck_dividers: { rect: DOMRect; size: number } | null = null,\n): LayoutPath | null | LayoutDivider {\n\treturn calculate_intersection_recursive(column, row, layout, check_dividers);\n}\n\nfunction calculate_intersection_recursive(\n\tcolumn: number,\n\trow: number,\n\tpanel: Layout,\n\tcheck_dividers: { rect: DOMRect; size: number } | null,\n\tparent_orientation: \"horizontal\" | \"vertical\" | null = null,\n\tview_window: ViewWindow = structuredClone(VIEW_WINDOW),\n\tpath: LayoutPathTraversal = [],\n): LayoutPath | null | LayoutDivider {\n\tif (column < 0 || row < 0 || column > 1 || row > 1) {\n\t\treturn null;\n\t}\n\n\t// Base case: if this is a child panel, return its name\n\tif (panel.type === \"tab-layout\") {\n\t\tconst selected = panel.selected ?? 0;\n\t\tconst col_width = view_window.col_end - view_window.col_start;\n\t\tconst row_height = view_window.row_end - view_window.row_start;\n\t\treturn {\n\t\t\ttype: \"layout-path\",\n\t\t\tlayout: panel,\n\t\t\tslot: panel.tabs[selected],\n\t\t\tpath,\n\t\t\tview_window,\n\t\t\tis_edge: false,\n\t\t\tcolumn,\n\t\t\trow,\n\t\t\tcolumn_offset: (column - view_window.col_start) / col_width,\n\t\t\trow_offset: (row - view_window.row_start) / row_height,\n\t\t\torientation: parent_orientation || \"horizontal\",\n\t\t};\n\t}\n\n\t// For split panels, determine which child was hit\n\tconst is_vertical = panel.orientation === \"vertical\";\n\tconst position = is_vertical ? row : column;\n\tconst start_key = is_vertical ? \"row_start\" : \"col_start\";\n\tconst end_key = is_vertical ? \"row_end\" : \"col_end\";\n\tconst rect_dim = is_vertical\n\t\t? check_dividers?.rect?.height\n\t\t: check_dividers?.rect?.width;\n\n\tlet current_pos = view_window[start_key];\n\tconst total_size = view_window[end_key] - view_window[start_key];\n\tfor (let i = 0; i < panel.children.length; i++) {\n\t\tconst next_pos = current_pos + total_size * panel.sizes[i];\n\n\t\t// Check if position is on a divider\n\t\tif (check_dividers && rect_dim) {\n\t\t\tconst divider_threshold = check_dividers.size / rect_dim;\n\t\t\tif (Math.abs(position - next_pos) < divider_threshold) {\n\t\t\t\treturn {\n\t\t\t\t\tpath: [...path, i],\n\t\t\t\t\ttype: panel.orientation,\n\t\t\t\t\tview_window: {\n\t\t\t\t\t\t...view_window,\n\t\t\t\t\t\t[start_key]: current_pos,\n\t\t\t\t\t\t[end_key]: next_pos,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\t// Check if position falls within this child's bounds\n\t\tif (\n\t\t\tposition >= current_pos &&\n\t\t\t(position < next_pos || i === panel.children.length - 1)\n\t\t) {\n\t\t\treturn calculate_intersection_recursive(\n\t\t\t\tcolumn,\n\t\t\t\trow,\n\t\t\t\tpanel.children[i],\n\t\t\t\tcheck_dividers,\n\t\t\t\tpanel.orientation,\n\t\t\t\t{\n\t\t\t\t\t...view_window,\n\t\t\t\t\t[start_key]: current_pos,\n\t\t\t\t\t[end_key]: next_pos,\n\t\t\t\t},\n\t\t\t\t[...path, i],\n\t\t\t);\n\t\t}\n\n\t\tcurrent_pos = next_pos;\n\t}\n\n\t// If we get here, the hit was outside all children (possibly in a gap or\n\t// boundary).\n\treturn null;\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport type { Layout, TabLayout } from \"../core/types.ts\";\nimport { EMPTY_PANEL } from \"../core/types.ts\";\n\n/**\n * Removes a child panel from the layout tree by its name.\n *\n * Redistributes the removed panel's space proportionally among remaining\n * siblings. Automatically collapses split panels when only one child remains.\n *\n * @param panel - The root layout tree to remove from.\n * @param child - Name of the child panel to remove.\n * @returns A new layout tree with the child removed (original is not mutated).\n * Returns `EMPTY_PANEL` if the last panel is removed.\n */\nexport function remove_child(panel: Layout, child: string): Layout {\n\t// If this is a child panel, handle tab removal\n\tif (panel.type === \"tab-layout\") {\n\t\tif (panel.tabs.includes(child)) {\n\t\t\tconst newChild = panel.tabs.filter((c) => c !== child);\n\t\t\tif (newChild.length === 0) {\n\t\t\t\treturn structuredClone(EMPTY_PANEL);\n\t\t\t}\n\t\t\treturn {\n\t\t\t\ttype: \"tab-layout\",\n\t\t\t\ttabs: newChild,\n\t\t\t};\n\t\t}\n\n\t\treturn structuredClone(panel);\n\t}\n\n\t// Clone the panel structure\n\tconst result = structuredClone(panel);\n\n\t// Try to remove the child from this split panel's children\n\tconst index = result.children.findIndex((p) => {\n\t\tif (p.type === \"tab-layout\") {\n\t\t\treturn p.tabs.includes(child);\n\t\t}\n\n\t\treturn false;\n\t});\n\n\tif (index !== -1) {\n\t\tconst tab_layout = result.children[index] as TabLayout;\n\t\tif (tab_layout.tabs.length === 1) {\n\t\t\t// Found the child at this level - remove it\n\t\t\tconst newChildren = result.children.filter((_, i) => i !== index);\n\t\t\tconst newSizes = remove_and_redistribute(result.sizes, index);\n\n\t\t\t// If only one child remains, collapse the split panel\n\t\t\tif (newChildren.length === 1) {\n\t\t\t\treturn newChildren[0];\n\t\t\t}\n\n\t\t\tresult.children = newChildren;\n\t\t\tresult.sizes = newSizes;\n\t\t} else {\n\t\t\ttab_layout.tabs.splice(tab_layout.tabs.indexOf(child), 1);\n\t\t\tif (\n\t\t\t\ttab_layout.selected &&\n\t\t\t\ttab_layout.selected >= tab_layout.tabs.length\n\t\t\t) {\n\t\t\t\ttab_layout.selected--;\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t// Child not found at this level - recursively search children\n\tlet modified = false;\n\tconst newChildren = result.children.map((p) => {\n\t\tif (p.type === \"split-layout\") {\n\t\t\tconst updated = remove_child(p, child);\n\t\t\tif (updated !== p) {\n\t\t\t\tmodified = true;\n\t\t\t}\n\n\t\t\treturn updated;\n\t\t}\n\n\t\treturn p;\n\t});\n\n\tif (modified) {\n\t\tresult.children = newChildren;\n\t}\n\n\treturn result;\n}\n\nfunction remove_and_redistribute(arr: number[], index: number): number[] {\n\tconst result = [];\n\n\t// Get the size of the element being removed\n\tconst removed_size = arr[index];\n\n\t// Calculate the total of remaining elements\n\tlet remaining_total = 0;\n\tfor (let i = 0; i < arr.length; i++) {\n\t\tif (i !== index) {\n\t\t\tremaining_total += arr[i];\n\t\t}\n\t}\n\n\t// Distribute the removed size proportionally to remaining elements\n\tfor (let i = 0; i < arr.length; i++) {\n\t\tif (i !== index) {\n\t\t\tconst proportion = arr[i] / remaining_total;\n\t\t\tresult.push(arr[i] + removed_size * proportion);\n\t\t}\n\t}\n\n\treturn result;\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport type { Layout, LayoutPathTraversal } from \"../core/types.ts\";\n\n/**\n * Inserts a new child panel into the layout tree at a specified location.\n * Creates a split panel if necessary and redistributes sizes equally among all\n * children.\n *\n * @param panel - The root layout tree to insert into\n * @param child - Unique identifier for the new child panel\n * @param path - Array of indices defining where to insert. Empty array inserts\n * at root level.\n * @param orientation - Orientation for newly created split panels. Defaults to\n * \"horizontal\".\n * @param is_edge - If true, create the split at the parent level.\n * @returns A new layout tree with the child inserted (original is not mutated).\n */\nexport function insert_child(\n\tpanel: Layout,\n\tchild: string,\n\tpath: LayoutPathTraversal,\n\torientation?: \"horizontal\" | \"vertical\",\n): Layout {\n\tconst createChildPanel = (childId: string): Layout => ({\n\t\ttype: \"tab-layout\",\n\t\ttabs: [childId],\n\t});\n\n\tif (path.length === 0) {\n\t\t// Insert at root level\n\t\tif (panel.type === \"tab-layout\") {\n\t\t\t// Add to existing tab-layout as a tab\n\t\t\treturn {\n\t\t\t\ttype: \"tab-layout\",\n\t\t\t\ttabs: [child, ...panel.tabs],\n\t\t\t};\n\t\t} else if (orientation) {\n\t\t\t// When inserting at edge of root, wrap the entire panel in a new split\n\t\t\treturn {\n\t\t\t\ttype: \"split-layout\",\n\t\t\t\torientation: orientation,\n\t\t\t\tchildren: [createChildPanel(child), panel],\n\t\t\t\tsizes: [0.5, 0.5],\n\t\t\t};\n\t\t} else {\n\t\t\t// Append to existing split-layout\n\t\t\tconst newChildren = [...panel.children, createChildPanel(child)];\n\t\t\tconst newSizes = [...panel.sizes, equal_share(newChildren.length)];\n\t\t\treturn {\n\t\t\t\t...panel,\n\t\t\t\tchildren: newChildren,\n\t\t\t\tsizes: redistribute(newSizes),\n\t\t\t};\n\t\t}\n\t}\n\n\t// Navigate down the path\n\tconst [index, ...restPath] = path;\n\n\t// Special case: when orientation is provided and restPath is empty, handle edge insertion\n\tif (orientation && restPath.length === 0) {\n\t\t// If panel is a split-layout with the same orientation, insert into its children\n\t\tif (panel.type === \"split-layout\" && panel.orientation === orientation) {\n\t\t\tconst newChildren = [...panel.children];\n\t\t\tnewChildren.splice(index, 0, createChildPanel(child));\n\t\t\tconst newSizes = [...panel.sizes];\n\t\t\tnewSizes.splice(index, 0, equal_share(newChildren.length));\n\t\t\treturn {\n\t\t\t\t...panel,\n\t\t\t\tchildren: newChildren,\n\t\t\t\tsizes: redistribute(newSizes),\n\t\t\t};\n\t\t}\n\n\t\t// Otherwise, wrap the entire panel in a new split at the edge\n\t\tconst children =\n\t\t\tindex === 0\n\t\t\t\t? [createChildPanel(child), panel]\n\t\t\t\t: [panel, createChildPanel(child)];\n\n\t\treturn {\n\t\t\ttype: \"split-layout\",\n\t\t\torientation: orientation,\n\t\t\tchildren,\n\t\t\tsizes: [0.5, 0.5],\n\t\t};\n\t}\n\n\tif (panel.type === \"tab-layout\") {\n\t\t// Stack into child array only when ALL of these conditions are met:\n\t\t// 1. Path has exactly one element (restPath is empty)\n\t\t// 2. Orientation was NOT explicitly provided (orientation is undefined)\n\t\t// 3. Index is within the valid stacking range [0, child.length]\n\t\tif (\n\t\t\trestPath.length === 0 &&\n\t\t\torientation === undefined &&\n\t\t\tindex >= 0 &&\n\t\t\tindex <= panel.tabs.length\n\t\t) {\n\t\t\tconst newChild = [...panel.tabs];\n\t\t\tnewChild.splice(index, 0, child);\n\t\t\treturn {\n\t\t\t\t...panel,\n\t\t\t\ttabs: newChild,\n\t\t\t};\n\t\t}\n\n\t\t// Otherwise, wrap in a split panel and recurse\n\t\tconst newPanel: Layout = {\n\t\t\ttype: \"split-layout\",\n\t\t\torientation: orientation || \"horizontal\",\n\t\t\tchildren: [panel],\n\t\t\tsizes: [1],\n\t\t};\n\n\t\treturn insert_child(newPanel, child, path, orientation);\n\t}\n\n\tif (restPath.length === 0 || index === panel.children.length) {\n\t\tif (orientation && panel.children[index]) {\n\t\t\t// When inserting at an edge, create a split panel with the new child and existing child\n\t\t\tconst newSplitPanel: Layout = {\n\t\t\t\ttype: \"split-layout\",\n\t\t\t\torientation: orientation,\n\t\t\t\tchildren: [createChildPanel(child), panel.children[index]],\n\t\t\t\tsizes: [0.5, 0.5],\n\t\t\t};\n\n\t\t\tconst newChildren = [...panel.children];\n\t\t\tnewChildren[index] = newSplitPanel;\n\t\t\treturn {\n\t\t\t\t...panel,\n\t\t\t\tchildren: newChildren,\n\t\t\t\tsizes: redistribute(panel.sizes),\n\t\t\t};\n\t\t}\n\n\t\t// Insert at this level at the specified index\n\t\tconst newChildren = [...panel.children];\n\t\tnewChildren.splice(index, 0, createChildPanel(child));\n\t\tconst newSizes = [...panel.sizes];\n\t\tnewSizes.splice(index, 0, equal_share(newChildren.length));\n\t\treturn {\n\t\t\t...panel,\n\t\t\tchildren: newChildren,\n\t\t\tsizes: redistribute(newSizes),\n\t\t};\n\t}\n\n\tconst targetChild = panel.children[index];\n\n\t// Determine the orientation to pass down when navigating into a tab-layout\n\tconst childOrientation =\n\t\ttargetChild.type === \"tab-layout\" &&\n\t\trestPath.length > 0 &&\n\t\torientation !== undefined\n\t\t\t? panel.orientation === \"horizontal\"\n\t\t\t\t? \"vertical\"\n\t\t\t\t: \"horizontal\"\n\t\t\t: orientation;\n\n\tconst updatedChild = insert_child(\n\t\ttargetChild,\n\t\tchild,\n\t\trestPath,\n\t\tchildOrientation,\n\t);\n\n\tconst newChildren = [...panel.children];\n\tnewChildren[index] = updatedChild;\n\treturn {\n\t\t...panel,\n\t\tchildren: newChildren,\n\t};\n}\n\n/**\n * The un-normalized share for a child newly spliced into a sibling list of\n * `count` (post-insert). Existing siblings' sizes sum to 1, so `1 / (count -\n * 1)` \u2014 \"one old sibling's worth\" \u2014 normalizes to an equal `1 / count` split\n * via {@link redistribute}. Inserting into a previously EMPTY split\n * (`count === 1`) has no old siblings to take a share of; the divisor floors\n * at 1 so the sole child gets the whole axis (`1 / 0` is `Infinity`, which\n * {@link redistribute} would smear into `NaN` sizes \u2014 an invisibly corrupt\n * tree whose grid drops every subsequent insert into column 1).\n */\nfunction equal_share(count: number): number {\n\treturn 1 / Math.max(1, count - 1);\n}\n\nfunction redistribute(arr: number[]): number[] {\n\tconst total = arr.reduce((sum, val) => sum + val, 0);\n\tif (!Number.isFinite(total) || total <= 0) {\n\t\t// A non-finite or degenerate total would propagate to EVERY size (`x /\n\t\t// NaN`), silently corrupting the tree for all future layouts - fall\n\t\t// back to an equal split instead of normalizing.\n\t\treturn arr.map(() => 1 / arr.length);\n\t}\n\n\treturn arr.map((val) => val / total);\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport { DEFAULT_PHYSICS } from \"../core/constants.ts\";\nimport type { Layout, LayoutPathTraversal } from \"../core/types.ts\";\n\n/**\n * Adjusts panel sizes during a drag operation on a divider.\n *\n * The `delta` is distributed proportionally among affected panels, maintaining\n * the sum:\n *\n * - Panels before and including the path index shrink by delta.\n * - Panels after the path index grow by delta.\n *\n * @param panel - The root layout tree to modify.\n * @param path - Path to the divider being dragged (identifies which split panel\n * to resize).\n * @param delta - Amount to resize, as a fraction (0-1). Positive values grow\n * panels before the divider, negative values shrink them.\n * @returns A new layout tree with updated sizes (original is not mutated).\n * ```\n */\nexport function redistribute_panel_sizes(\n\tpanel: Layout,\n\tpath: LayoutPathTraversal,\n\tdelta: number | undefined,\n\tphysics = DEFAULT_PHYSICS,\n): Layout {\n\t// Clone the entire panel structure\n\tconst result = structuredClone(panel);\n\n\t// Find the orientation of the insertion panel,\n\t// and scale the delta on the respective axis if aligned.\n\tlet current: Layout = result;\n\tconst deltas = { horizontal: delta || 0, vertical: delta || 0 };\n\tfor (let i = 0; i < path.length - 1; i++) {\n\t\tif (current.type === \"split-layout\") {\n\t\t\tdeltas[current.orientation] /= current.sizes[path[i]];\n\t\t\tcurrent = current.children[path[i]];\n\t\t}\n\t}\n\n\t// Apply the redistribution at the final path index\n\tif (current.type === \"split-layout\") {\n\t\tif (delta === undefined) {\n\t\t\tcurrent.sizes = current.sizes.map((_) => 1 / current.sizes.length);\n\t\t} else {\n\t\t\tconst delta = deltas[current.orientation];\n\t\t\tconst index = path[path.length - 1];\n\n\t\t\t// It would be fun to remove this condition.\n\t\t\tif (index < current.sizes.length - 1) {\n\t\t\t\tcurrent.sizes = add_and_redistribute(\n\t\t\t\t\tphysics,\n\t\t\t\t\tcurrent.sizes,\n\t\t\t\t\tindex,\n\t\t\t\t\tdelta,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result;\n}\n\nfunction add_and_redistribute(\n\tphysics: typeof DEFAULT_PHYSICS,\n\tarr: number[],\n\tindex: number,\n\tdelta: number,\n): number[] {\n\tconst result = [...arr];\n\tlet before_total = 0;\n\tfor (let i = 0; i <= index; i++) {\n\t\tbefore_total += arr[i];\n\t}\n\n\tlet after_total = 0;\n\tfor (let i = index + 1; i < arr.length; i++) {\n\t\tafter_total += arr[i];\n\t}\n\n\t// Clamp `delta` to prevent redistributing either side to 0.\n\tdelta =\n\t\tMath.sign(delta) *\n\t\tMath.min(\n\t\t\tMath.abs(delta),\n\t\t\t(1 - physics.MINIMUM_REDISTRIBUTION_SIZE_THRESHOLD) *\n\t\t\t\t(delta > 0 ? before_total : after_total),\n\t\t);\n\n\t// Redistribute elements\n\tfor (let i = 0; i <= index; i++) {\n\t\tconst proportion = arr[i] / before_total;\n\t\tresult[i] = arr[i] - delta * proportion;\n\t}\n\n\tfor (let i = index + 1; i < arr.length; i++) {\n\t\tconst proportion = arr[i] / after_total;\n\t\tresult[i] = arr[i] + delta * proportion;\n\t}\n\n\treturn result;\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport { DEFAULT_PHYSICS } from \"../core/constants\";\nimport type { LayoutPath, ViewWindow } from \"../core/types\";\n\n/**\n * Converts a {@link ViewWindow} to element-relative pixel coordinates,\n * accounting for padding and optionally CSS `gap` and child `margin`.\n *\n * @param window - The view window in normalized 0\u20131 coordinates.\n * @param box - The element's bounding client rect.\n * @param style - The element's computed style (for padding).\n * @param margin - Optional child element's computed style (for margin inset).\n * @returns Pixel coordinates relative to the element's border-box origin.\n */\nexport function viewWindowToLocalRect(\n\twindow: ViewWindow,\n\tbox: DOMRect,\n\tstyle: CSSStyleDeclaration,\n\tmargin?: CSSStyleDeclaration,\n): { x: number; y: number; width: number; height: number } {\n\tconst paddingLeft = parseFloat(style.paddingLeft);\n\tconst paddingTop = parseFloat(style.paddingTop);\n\tconst contentWidth = box.width - paddingLeft - parseFloat(style.paddingRight);\n\tconst contentHeight =\n\t\tbox.height - paddingTop - parseFloat(style.paddingBottom);\n\n\tconst x = paddingLeft + window.col_start * contentWidth;\n\tconst y = paddingTop + window.row_start * contentHeight;\n\tlet width = (window.col_end - window.col_start) * contentWidth;\n\tlet height = (window.row_end - window.row_start) * contentHeight;\n\tif (margin) {\n\t\tconst marginTop = parseFloat(margin.marginTop);\n\t\tconst marginRight = parseFloat(margin.marginRight);\n\t\tconst marginBottom = parseFloat(margin.marginBottom);\n\t\tconst marginLeft = parseFloat(margin.marginLeft);\n\t\twidth -= marginLeft + marginRight;\n\t\theight -= marginTop + marginBottom;\n\t}\n\n\treturn { x, y, width, height };\n}\n\nexport function updateOverlaySheet(\n\tslot: string,\n\tbox: DOMRect,\n\tstyle: CSSStyleDeclaration,\n\tdrag_target: LayoutPath | null,\n\tphysics = DEFAULT_PHYSICS,\n\tmargin?: CSSStyleDeclaration,\n) {\n\tif (!drag_target) {\n\t\treturn `:host ::slotted([${physics.CHILD_ATTRIBUTE_NAME}=\"${slot}\"]){display:none;}`;\n\t}\n\n\tconst local = viewWindowToLocalRect(\n\t\tdrag_target.view_window,\n\t\tbox,\n\t\tstyle,\n\t\tmargin,\n\t);\n\n\tconst css = `display:flex;position:absolute!important;z-index:2;top:${local.y}px;left:${local.x}px;height:${local.height}px;width:${local.width}px;`;\n\treturn `::slotted([${physics.CHILD_ATTRIBUTE_NAME}=\"${slot}\"]){${css}}`;\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport type { Layout } from \"../core/types.ts\";\n\n/**\n * Flattens the layout tree by merging parent and child split panels that have\n * the same orientation and type.\n *\n * When a split panel contains a child split panel with the same orientation,\n * they are merged into a single split panel. The sizes array is scaled\n * correctly to maintain proportions.\n *\n * @param layout - The layout tree to flatten\n * @returns A new flattened layout tree (original is not mutated).\n */\nexport function flatten(layout: Layout): Layout {\n\tif (layout.type === \"tab-layout\") {\n\t\tlayout.selected = layout.selected || 0;\n\t\treturn layout;\n\t}\n\n\tconst flattenedChildren: Layout[] = [];\n\tconst flattenedSizes: number[] = [];\n\tfor (let i = 0; i < layout.children.length; i++) {\n\t\tconst child = layout.children[i];\n\t\tconst childSize = layout.sizes[i];\n\t\tconst flattenedChild = flatten(child);\n\n\t\tif (\n\t\t\tflattenedChild.type === \"split-layout\" &&\n\t\t\tflattenedChild.orientation === layout.orientation\n\t\t) {\n\t\t\tfor (let j = 0; j < flattenedChild.children.length; j++) {\n\t\t\t\tflattenedChildren.push(flattenedChild.children[j]);\n\t\t\t\tflattenedSizes.push(flattenedChild.sizes[j] * childSize);\n\t\t\t}\n\t\t} else {\n\t\t\tflattenedChildren.push(flattenedChild);\n\t\t\tflattenedSizes.push(childSize);\n\t\t}\n\t}\n\n\tif (flattenedChildren.length === 1) {\n\t\treturn flattenedChildren[0];\n\t}\n\n\treturn {\n\t\ttype: \"split-layout\",\n\t\torientation: layout.orientation,\n\t\tchildren: flattenedChildren,\n\t\tsizes: flattenedSizes,\n\t};\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport type { Layout, LayoutPathTraversal } from \"../core/types.ts\";\n\n/**\n * Calculates the index path for a panel with the given name.\n *\n * Traverses the layout tree to find the named panel and returns the\n * index path describing its position in the tree.\n *\n * @param name - The name of the panel to find.\n * @param layout - The layout tree to search.\n * @returns The panel's index path if found, `null` otherwise.\n */\nexport function calculate_path(name: string, layout: Layout): number[] | null {\n\treturn calculate_path_recursive(name, layout, []);\n}\n\nfunction calculate_path_recursive(\n\tname: string,\n\tpanel: Layout,\n\tpath: LayoutPathTraversal,\n): number[] | null {\n\tif (panel.type === \"tab-layout\") {\n\t\tif (!panel.tabs.includes(name)) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn path;\n\t}\n\n\tfor (let i = 0; i < panel.children.length; i++) {\n\t\tconst result = calculate_path_recursive(name, panel.children[i], [\n\t\t\t...path,\n\t\t\ti,\n\t\t]);\n\n\t\tif (result) {\n\t\t\treturn result;\n\t\t}\n\t}\n\n\treturn null;\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport type {\n\tLayout,\n\tLayoutPath,\n\tOrientation,\n\tViewWindow,\n} from \"../core/types.ts\";\n\n/**\n * Walks a layout tree and returns a {@link LayoutPath} for every visible\n * panel, keyed by panel name. Each path's `column`/`row` are set to the\n * center of the panel's view window, with offsets of 0.5.\n *\n * @param layout - The layout tree to walk.\n * @returns A record mapping panel names to their layout paths.\n */\nexport function calculate_presize_paths(\n\tlayout: Layout,\n): Record<string, LayoutPath> {\n\tconst result: Record<string, LayoutPath> = {};\n\twalk_layout(layout, result, [], null, {\n\t\trow_start: 0,\n\t\trow_end: 1,\n\t\tcol_start: 0,\n\t\tcol_end: 1,\n\t});\n\n\treturn result;\n}\n\nfunction walk_layout(\n\tlayout: Layout,\n\tresult: Record<string, LayoutPath>,\n\tpath: number[],\n\tparentOrientation: Orientation | null,\n\tviewWindow: ViewWindow,\n): void {\n\tif (layout.type === \"tab-layout\") {\n\t\tconst selected = layout.selected ?? 0;\n\t\tconst slot = layout.tabs[selected];\n\t\tconst col = (viewWindow.col_start + viewWindow.col_end) / 2;\n\t\tconst row = (viewWindow.row_start + viewWindow.row_end) / 2;\n\t\tresult[slot] = {\n\t\t\ttype: \"layout-path\",\n\t\t\tlayout,\n\t\t\tslot,\n\t\t\tpath,\n\t\t\tview_window: viewWindow,\n\t\t\tis_edge: false,\n\t\t\tcolumn: col,\n\t\t\trow: row,\n\t\t\tcolumn_offset: 0.5,\n\t\t\trow_offset: 0.5,\n\t\t\torientation: parentOrientation || \"horizontal\",\n\t\t};\n\n\t\treturn;\n\t}\n\n\tconst isVertical = layout.orientation === \"vertical\";\n\tconst startKey = isVertical ? \"row_start\" : \"col_start\";\n\tconst endKey = isVertical ? \"row_end\" : \"col_end\";\n\tlet currentPos = viewWindow[startKey];\n\tconst totalSize = viewWindow[endKey] - viewWindow[startKey];\n\tfor (let i = 0; i < layout.children.length; i++) {\n\t\tconst nextPos = currentPos + totalSize * layout.sizes[i];\n\t\tconst childWindow: ViewWindow = {\n\t\t\t...viewWindow,\n\t\t\t[startKey]: currentPos,\n\t\t\t[endKey]: nextPos,\n\t\t};\n\n\t\twalk_layout(\n\t\t\tlayout.children[i],\n\t\t\tresult,\n\t\t\t[...path, i],\n\t\t\tlayout.orientation,\n\t\t\tchildWindow,\n\t\t);\n\n\t\tcurrentPos = nextPos;\n\t}\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport type { Layout, LayoutPath, PresizeDetail } from \"../core/types.ts\";\nimport { calculate_presize_paths } from \"../layout/calculate_presize_paths.ts\";\n\n/**\n * The dragged panel's preview geometry during a drag transition - see\n * {@link PresizeDetail.overlay}.\n */\nexport type PresizeOverlay = { slot: string; path: LayoutPath } | null;\n\ntype Entry = {\n\tlayout: Layout;\n\tfn: () => void;\n\toverlay?: PresizeOverlay;\n\tresolve: () => void;\n\treject: (error: unknown) => void;\n};\n\n/**\n * Manages cancelable pre-resize gating for layout updates.\n *\n * Before each layout change, a cancelable `resize-before` event is dispatched\n * on the target. If the event is cancelled via `preventDefault()`, the update\n * is suspended until {@link resume} is called.\n *\n * Updates requested while one is suspended are queued, never dropped. When\n * the suspended update lands, the whole queue is drained as one batch: a\n * single `resize-before` is dispatched for the batch's final geometry (the\n * last entry's `layout`), then every entry's `fn` runs in order. Each\n * {@link run} promise resolves only once its own `fn` has run (or was\n * discarded by {@link cancelPending}).\n */\nexport class PresizeQueue {\n\t#resizing = false;\n\t#queued: Entry[] = [];\n\t#pending: (() => void) | null = null;\n\t#generation = 0;\n\n\tconstructor(\n\t\tprivate _target: EventTarget,\n\t\tprivate _eventName: string,\n\t\tprivate _onDispatch?: () => void,\n\t) {}\n\n\trun(layout: Layout, fn: () => void, overlay?: PresizeOverlay): Promise<void> {\n\t\treturn new Promise<void>((resolve, reject) => {\n\t\t\tthis.#queued.push({ layout, fn, overlay, resolve, reject });\n\t\t\tif (!this.#resizing) {\n\t\t\t\tvoid this.#drain();\n\t\t\t}\n\t\t});\n\t}\n\n\tresume(): void {\n\t\tif (this.#pending) {\n\t\t\tconst resolve = this.#pending;\n\t\t\tthis.#pending = null;\n\t\t\tresolve();\n\t\t}\n\t}\n\n\t/**\n\t * Discards every queued update and the suspended one, if any, resolving\n\t * their {@link run} promises without running their `fn`. A suspended\n\t * transition still waits for {@link resume}, so a consumer mid-presize is\n\t * never resumed out from under it, but its `fn` is skipped when it lands.\n\t */\n\tcancelPending(): void {\n\t\tthis.#generation++;\n\t\tconst queued = this.#queued;\n\t\tthis.#queued = [];\n\t\tfor (const entry of queued) {\n\t\t\tentry.resolve();\n\t\t}\n\t}\n\n\tasync #drain(): Promise<void> {\n\t\tthis.#resizing = true;\n\t\ttry {\n\t\t\twhile (this.#queued.length > 0) {\n\t\t\t\tconst batch = this.#queued;\n\t\t\t\tthis.#queued = [];\n\t\t\t\tconst generation = this.#generation;\n\t\t\t\tconst last = batch[batch.length - 1];\n\t\t\t\tif (!this.#dispatch(last.layout, last.overlay)) {\n\t\t\t\t\tawait new Promise<void>((resolve) => {\n\t\t\t\t\t\tthis.#pending = resolve;\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tconst cancelled = generation !== this.#generation;\n\t\t\t\tfor (const entry of batch) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (!cancelled) {\n\t\t\t\t\t\t\tentry.fn();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tentry.resolve();\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tentry.reject(error);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tthis.#resizing = false;\n\t\t}\n\t}\n\n\t#dispatch(layout: Layout, overlay?: PresizeOverlay): boolean {\n\t\tthis._onDispatch?.();\n\t\tconst detail: PresizeDetail = {\n\t\t\tcalculatePresizePaths: () => calculate_presize_paths(layout),\n\t\t\toverlay,\n\t\t};\n\n\t\tconst event = new CustomEvent(this._eventName, {\n\t\t\tcancelable: true,\n\t\t\tdetail,\n\t\t});\n\n\t\treturn this._target.dispatchEvent(event);\n\t}\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport { DEFAULT_PHYSICS, type Physics } from \"../core/constants\";\nimport { insert_child } from \"./insert_child\";\nimport type {\n\tLayout,\n\tLayoutPath,\n\tLayoutPathTraversal,\n\tOrientation,\n\tViewWindow,\n} from \"../core/types\";\n\n/**\n * Calculates an insertion point (which may involve splitting a single\n * `\"tab-layout\"` into a new `\"split-layout\"`), based on the cursor position.\n * *\n * @param col - The cursor column.\n * @param row - The cursor row.\n * @param panel - The `Layout` to insert into.\n * @param slot - The slot identifier where the insert should occur\n * @param drop_target - The `LayoutPath` (from `calculateIntersect`) of the\n * panel to either insert next to, or split by.\n * @returns A new `LayoutPath` reflecting the updated (maybe) `\"split-layout\"`,\n * which is enough to draw the overlay.\n */\nexport function calculate_edge(\n\tcol: number,\n\trow: number,\n\tpanel: Layout,\n\tslot: string,\n\tdrop_target: LayoutPath,\n\tbox?: DOMRect,\n\tphysics: Physics = DEFAULT_PHYSICS,\n): LayoutPath {\n\t// Check root edges first\n\tif (col < physics.SPLIT_ROOT_EDGE_TOLERANCE) {\n\t\treturn insert_root_edge(panel, slot, drop_target, [0], true, \"horizontal\");\n\t}\n\n\tif (col > 1 - physics.SPLIT_ROOT_EDGE_TOLERANCE) {\n\t\treturn insert_root_edge(\n\t\t\tpanel,\n\t\t\tslot,\n\t\t\tdrop_target,\n\t\t\tdrop_target.path.length > 0 ? drop_target.path : [1],\n\t\t\tfalse,\n\t\t\t\"horizontal\",\n\t\t);\n\t}\n\n\tif (row < physics.SPLIT_ROOT_EDGE_TOLERANCE) {\n\t\treturn insert_root_edge(panel, slot, drop_target, [0], true, \"vertical\");\n\t}\n\n\tif (row > 1 - physics.SPLIT_ROOT_EDGE_TOLERANCE) {\n\t\treturn insert_root_edge(\n\t\t\tpanel,\n\t\t\tslot,\n\t\t\tdrop_target,\n\t\t\tdrop_target.path.length > 0 ? drop_target.path : [1],\n\t\t\tfalse,\n\t\t\t\"vertical\",\n\t\t);\n\t}\n\n\t// Check panel edges\n\tconst is_column_edge =\n\t\tdrop_target.column_offset < physics.SPLIT_EDGE_TOLERANCE ||\n\t\tdrop_target.column_offset > 1 - physics.SPLIT_EDGE_TOLERANCE;\n\n\tconst is_row_edge =\n\t\tdrop_target.row_offset < physics.SPLIT_EDGE_TOLERANCE ||\n\t\tdrop_target.row_offset > 1 - physics.SPLIT_EDGE_TOLERANCE;\n\n\t// If both edges triggered, choose closer axis\n\tif (is_column_edge && is_row_edge) {\n\t\tconst col_distance = Math.abs(drop_target.column_offset - 0.5);\n\t\tconst row_distance = Math.abs(drop_target.row_offset - 0.5);\n\t\tconst col_scale =\n\t\t\t(box?.width || 1) *\n\t\t\t(drop_target.view_window.col_end - drop_target.view_window.col_start);\n\n\t\tconst row_scale =\n\t\t\t(box?.height || 1) *\n\t\t\t(drop_target.view_window.row_end - drop_target.view_window.row_start);\n\n\t\tconst use_column =\n\t\t\tcol_scale / 2 - col_distance * col_scale <\n\t\t\trow_scale / 2 - row_distance * row_scale;\n\n\t\treturn insert_axis(\n\t\t\tpanel,\n\t\t\tslot,\n\t\t\tdrop_target,\n\t\t\tuse_column\n\t\t\t\t? drop_target.column_offset < physics.SPLIT_EDGE_TOLERANCE\n\t\t\t\t: drop_target.row_offset < physics.SPLIT_EDGE_TOLERANCE,\n\t\t\tuse_column ? \"horizontal\" : \"vertical\",\n\t\t);\n\t}\n\n\tif (is_column_edge) {\n\t\treturn insert_axis(\n\t\t\tpanel,\n\t\t\tslot,\n\t\t\tdrop_target,\n\t\t\tdrop_target.column_offset < physics.SPLIT_EDGE_TOLERANCE,\n\t\t\t\"horizontal\",\n\t\t);\n\t}\n\n\tif (is_row_edge) {\n\t\treturn insert_axis(\n\t\t\tpanel,\n\t\t\tslot,\n\t\t\tdrop_target,\n\t\t\tdrop_target.row_offset < physics.SPLIT_EDGE_TOLERANCE,\n\t\t\t\"vertical\",\n\t\t);\n\t}\n\n\t// Not at an edge - insert as a tab\n\treturn {\n\t\t...drop_target,\n\t\tpath: [...drop_target.path, 0],\n\t};\n}\n\nfunction insert_root_edge(\n\tpanel: Layout,\n\tslot: string,\n\tdrop_target: LayoutPath,\n\tpath: LayoutPathTraversal,\n\tis_before: boolean,\n\torientation: Orientation,\n): LayoutPath {\n\treturn insert_axis(\n\t\tpanel,\n\t\tslot,\n\t\t{ ...drop_target, path, orientation },\n\t\tis_before,\n\t\torientation,\n\t);\n}\n\nfunction insert_axis(\n\tpanel: Layout,\n\tslot: string,\n\tdrop_target: LayoutPath,\n\tis_before: boolean,\n\taxis_orientation: Orientation,\n): LayoutPath {\n\tlet result_path: LayoutPathTraversal;\n\n\tif (drop_target.orientation === axis_orientation) {\n\t\t// Same orientation - insert into existing split\n\t\tif (drop_target.path.length === 0) {\n\t\t\tresult_path = [is_before ? 0 : 1];\n\t\t} else {\n\t\t\tconst last_index = drop_target.path[drop_target.path.length - 1];\n\t\t\tresult_path = [\n\t\t\t\t...drop_target.path.slice(0, -1),\n\t\t\t\tis_before ? last_index : last_index + 1,\n\t\t\t];\n\t\t}\n\t} else {\n\t\t// Different orientation - split the child panel\n\t\tresult_path = [...drop_target.path, is_before ? 0 : 1];\n\t}\n\n\tconst new_panel = insert_child(panel, slot, result_path, axis_orientation);\n\tconst view_window = calculate_view_window(new_panel, result_path);\n\treturn {\n\t\t...drop_target,\n\t\tpath: result_path,\n\t\tslot: drop_target.slot,\n\t\tis_edge: true,\n\t\torientation: axis_orientation,\n\t\tview_window,\n\t};\n}\n\nfunction calculate_view_window(\n\tpanel: Layout,\n\tpath: LayoutPathTraversal,\n): ViewWindow {\n\tlet view_window: ViewWindow = {\n\t\trow_start: 0,\n\t\trow_end: 1,\n\t\tcol_start: 0,\n\t\tcol_end: 1,\n\t};\n\n\tlet current_panel = panel;\n\tfor (const step of path) {\n\t\tif (current_panel.type === \"tab-layout\") {\n\t\t\tbreak;\n\t\t}\n\n\t\tconst index = Math.min(step, current_panel.children.length - 1);\n\t\tconst is_vertical = current_panel.orientation === \"vertical\";\n\t\tconst start_key = is_vertical ? \"row_start\" : \"col_start\";\n\t\tconst end_key = is_vertical ? \"row_end\" : \"col_end\";\n\t\tconst total_size = view_window[end_key] - view_window[start_key];\n\t\tconst offset = current_panel.sizes\n\t\t\t.slice(0, index)\n\t\t\t.reduce((sum, size) => sum + size * total_size, view_window[start_key]);\n\n\t\tview_window = {\n\t\t\t...view_window,\n\t\t\t[start_key]: offset,\n\t\t\t[end_key]: offset + total_size * current_panel.sizes[index],\n\t\t};\n\n\t\tcurrent_panel = current_panel.children[index];\n\t}\n\n\treturn view_window;\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport type { Layout, LayoutPath, OverlayMode } from \"../core/types.ts\";\nimport type { Physics } from \"../core/constants.ts\";\nimport type { PresizeQueue } from \"./presize_queue.ts\";\nimport { calculate_intersection } from \"../layout/calculate_intersect.ts\";\nimport { calculate_edge } from \"../layout/calculate_edge.ts\";\nimport { create_css_grid_layout } from \"../layout/generate_grid.ts\";\nimport { updateOverlaySheet } from \"../layout/generate_overlay.ts\";\nimport { remove_child } from \"../layout/remove_child.ts\";\nimport { insert_child } from \"../layout/insert_child.ts\";\n\nexport interface OverlayHost {\n\t/** The latest intended layout tree, which mutations build on. */\n\treadonly panel: Layout;\n\treadonly physics: Physics;\n\treadonly stylesheet: CSSStyleSheet;\n\treadonly presizeQueue: PresizeQueue;\n\trelativeCoordinates(\n\t\tevent: { clientX: number; clientY: number },\n\t\trecalculate: boolean,\n\t): [number, number, DOMRect, CSSStyleDeclaration];\n\trestore(layout: Layout, isFlattened?: boolean): Promise<void>;\n\tquerySelector(selectors: string): Element | null;\n\tdispatchEvent(event: Event): boolean;\n}\n\n/**\n * Manages overlay state during drag-and-drop panel rearrangement.\n *\n * Handles rendering a preview of where a dragged panel would land,\n * and committing or cancelling the placement when the drag ends.\n */\nexport class OverlayController {\n\tconstructor(private _host: OverlayHost) {}\n\n\tasync set(\n\t\tevent: { clientX: number; clientY: number },\n\t\t{ slot }: LayoutPath,\n\t\tclassName: string = this._host.physics.OVERLAY_CLASSNAME,\n\t\tmode: OverlayMode = this._host.physics.OVERLAY_DEFAULT,\n\t): Promise<void> {\n\t\tconst host = this._host;\n\t\tconst panel = remove_child(host.panel, slot);\n\t\tconst query = `:scope > [${host.physics.CHILD_ATTRIBUTE_NAME}=\"${slot}\"]`;\n\t\tlet drag_element = host.querySelector(query);\n\t\tif (drag_element) {\n\t\t\tdrag_element.classList.add(className);\n\t\t}\n\n\t\tconst [col, row, box, style] = host.relativeCoordinates(event, true);\n\t\tlet drop_target = calculate_intersection(col, row, panel);\n\t\tif (drop_target) {\n\t\t\tdrop_target = calculate_edge(\n\t\t\t\tcol,\n\t\t\t\trow,\n\t\t\t\tpanel,\n\t\t\t\tslot,\n\t\t\t\tdrop_target,\n\t\t\t\tbox,\n\t\t\t\thost.physics,\n\t\t\t);\n\t\t}\n\n\t\t// The dragged panel is removed from `panel` above, so it is absent from\n\t\t// the presize paths - `drop_target` carries its preview box instead\n\t\t// (null when the pointer is outside every drop target and the dragged\n\t\t// panel is hidden).\n\t\tconst overlay = drop_target ? { slot, path: drop_target } : null;\n\t\tawait host.presizeQueue.run(\n\t\t\tpanel,\n\t\t\t() => {\n\t\t\t\tif (mode === \"grid\" && drop_target) {\n\t\t\t\t\tconst path: [string, string] = [slot, drop_target?.slot];\n\t\t\t\t\tconst css = create_css_grid_layout(panel, path, host.physics);\n\t\t\t\t\thost.stylesheet.replaceSync(css);\n\t\t\t\t} else if (mode === \"absolute\") {\n\t\t\t\t\tconst grid_css = create_css_grid_layout(\n\t\t\t\t\t\tpanel,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\thost.physics,\n\t\t\t\t\t);\n\n\t\t\t\t\twhile (drag_element?.tagName === \"SLOT\" && drag_element) {\n\t\t\t\t\t\tdrag_element = (\n\t\t\t\t\t\t\tdrag_element as HTMLSlotElement\n\t\t\t\t\t\t).assignedElements()[0];\n\t\t\t\t\t}\n\n\t\t\t\t\tconst margin = drag_element\n\t\t\t\t\t\t? getComputedStyle(drag_element)\n\t\t\t\t\t\t: undefined;\n\n\t\t\t\t\tconst overlay_css = updateOverlaySheet(\n\t\t\t\t\t\tslot,\n\t\t\t\t\t\tbox,\n\t\t\t\t\t\tstyle,\n\t\t\t\t\t\tdrop_target,\n\t\t\t\t\t\thost.physics,\n\t\t\t\t\t\tmargin,\n\t\t\t\t\t);\n\n\t\t\t\t\thost.stylesheet.replaceSync([grid_css, overlay_css].join(\"\\n\"));\n\t\t\t\t}\n\t\t\t},\n\t\t\toverlay,\n\t\t);\n\n\t\tconst event_name = `${host.physics.CUSTOM_EVENT_NAME_PREFIX}-before-update`;\n\t\tconst custom_event = new CustomEvent<Layout>(event_name, {\n\t\t\tdetail: panel,\n\t\t});\n\t\thost.dispatchEvent(custom_event);\n\t}\n\n\tasync clear(\n\t\tevent: { clientX: number; clientY: number } | null,\n\t\t{ slot, layout }: LayoutPath,\n\t\tclassName: string = this._host.physics.OVERLAY_CLASSNAME,\n\t): Promise<void> {\n\t\tconst host = this._host;\n\t\tconst panel = remove_child(host.panel, slot);\n\t\tconst query = `:scope > [${host.physics.CHILD_ATTRIBUTE_NAME}=\"${slot}\"]`;\n\t\tconst drag_element = host.querySelector(query);\n\n\t\tif (event === null) {\n\t\t\tawait host.restore(layout);\n\t\t\treturn;\n\t\t}\n\n\t\tconst [col, row, box] = host.relativeCoordinates(event, false);\n\t\tlet drop_target = calculate_intersection(col, row, panel);\n\t\tif (drop_target) {\n\t\t\tdrop_target = calculate_edge(\n\t\t\t\tcol,\n\t\t\t\trow,\n\t\t\t\tpanel,\n\t\t\t\tslot,\n\t\t\t\tdrop_target,\n\t\t\t\tbox,\n\t\t\t\thost.physics,\n\t\t\t);\n\t\t}\n\n\t\tif (drop_target) {\n\t\t\tconst orientation = drop_target?.is_edge\n\t\t\t\t? drop_target.orientation\n\t\t\t\t: undefined;\n\n\t\t\tconst new_layout = insert_child(\n\t\t\t\tpanel,\n\t\t\t\tslot,\n\t\t\t\tdrop_target.path,\n\t\t\t\torientation,\n\t\t\t);\n\n\t\t\tawait host.restore(new_layout);\n\t\t} else {\n\t\t\tawait host.restore(layout);\n\t\t}\n\n\t\tif (drag_element) {\n\t\t\tdrag_element.classList.remove(className);\n\t\t}\n\t}\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\n/**\n * This module defines the `<regular-layout>` custom element for browser\n * environments.\n *\n * @packageDocumentation\n */\n\nimport { EMPTY_PANEL } from \"./core/types.ts\";\nimport {\n\tcreate_css_grid_layout,\n\tcreate_css_maximize_layout,\n} from \"./layout/generate_grid.ts\";\nimport type {\n\tLayoutPath,\n\tLayout,\n\tLayoutDivider,\n\tTabLayout,\n\tOverlayMode,\n\tOrientation,\n\tLayoutPathTraversal,\n\tViewWindow,\n} from \"./core/types.ts\";\n\nimport { calculate_intersection } from \"./layout/calculate_intersect.ts\";\nimport { remove_child } from \"./layout/remove_child.ts\";\nimport { insert_child } from \"./layout/insert_child.ts\";\nimport { redistribute_panel_sizes } from \"./layout/redistribute_panel_sizes.ts\";\nimport { viewWindowToLocalRect } from \"./layout/generate_overlay.ts\";\nimport { flatten } from \"./layout/flatten.ts\";\nimport { calculate_path } from \"./layout/calculate_path.ts\";\nimport { PresizeQueue } from \"./model/presize_queue.ts\";\nimport {\n\tOverlayController,\n\ttype OverlayHost,\n} from \"./model/overlay_controller.ts\";\n\nimport {\n\tDEFAULT_PHYSICS,\n\ttype PhysicsUpdate,\n\ttype Physics,\n} from \"./core/constants.ts\";\n\n/**\n * An interface which models the fields of `PointerEvent` that\n * `<regular-layour>` actually uses, making it easier to sub out with an\n * JavaScript object lieral when you don't have a `PointerEvent` handy.\n */\nexport interface PointerEventCoordinates {\n\tclientX: number;\n\tclientY: number;\n}\n\n/**\n * A Web Component that provides a resizable panel layout system.\n * Panels are arranged using CSS Grid and can be resized by dragging dividers.\n *\n * The component uses Shadow DOM and CSS Grid to manage layout.\n *\n * @example\n * ```html\n * <regular-layout>\n * <div name=\"sidebar\">Sidebar content</div>\n * <div name=\"main\">Main content</div>\n * </regular-layout>\n * ```\n *\n * @example\n * ```typescript\n * const layout = document.querySelector('regular-layout');\n *\n * // Insert panels into the grid layout\n * layout.insertPanel('main');\n * layout.insertPanel('sidebar');\n *\n * // Remove a panel (DOM child is still connected, but not slotted)\n * layout.removePanel('sidebar');\n *\n * // Save current layout\n * const state = layout.save();\n *\n * // Restore layout later\n * layout.restore(state);\n * ```\n *\n * @remarks\n *\n * Why does this implementation use a `<slot>` at all? We must use\n * `<slot>` and the Shadow DOM to scope the grid CSS rules to each\n * instance of `<regular-layout>` (without e.g. giving them unique\n * `\"id\"` and injecting into `document,head`), and we can only select\n * `::slotted` light DOM children from `adoptedStyleSheets` on the\n * `ShadowRoot`.\n *\n * Why does this implementation use a single `<slot>` and the child\n * `\"name\"` attribute, as opposed to a named `<slot name=\"my_slot\">`\n * and the built-in `\"slot\"` child attribute? Children with a `\"slot\"`\n * attribute don't fallback to the un-named `<slot>`, so using the\n * latter implementation would require synchronizing the light DOM\n * and shadow DOM slots/slotted children continuously.\n *\n * Note that `::slotted()` only matches *directly* slotted nodes - it\n * does not pierce a slotted `<slot>`. A consumer that wants to forward\n * its own light-DOM content through `<regular-layout>` therefore cannot\n * place a bare `<slot name=\"X\">` as a layout child and expect it to be\n * grid-positioned; instead, wrap the forwarding slot in a concrete\n * `<regular-layout-frame name=\"X\">` (which *is* directly slotted and so\n * matched by the generated `::slotted([name=\"X\"])` rules).\n *\n */\nexport class RegularLayout extends HTMLElement {\n\tprivate _shadowRoot: ShadowRoot;\n\t/** The committed layout tree - what is on screen. */\n\tprivate _panel: Layout;\n\n\t/**\n\t * The latest layout tree requested by a committing mutation, which may\n\t * still be suspended or queued behind a `before-resize`. Mutations build on\n\t * this rather than `_panel` so concurrent updates compose instead of each\n\t * clobbering the in-flight one.\n\t */\n\tprivate _intended: Layout;\n\tprivate _stylesheet: CSSStyleSheet;\n\tprivate _cursor_stylesheet: CSSStyleSheet;\n\tprivate _drag_target?: [LayoutDivider, number, number];\n\tprivate _cursor_override: boolean;\n\tprivate _dimensions?: { box: DOMRect; style: CSSStyleDeclaration };\n\tprivate _physics: Physics;\n\tprivate _presizeQueue: PresizeQueue;\n\tprivate _overlayController: OverlayController;\n\tprivate _maximized?: string;\n\tprivate _resize_observer?: ResizeObserver;\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis._physics = DEFAULT_PHYSICS;\n\t\tthis._panel = structuredClone(EMPTY_PANEL);\n\t\tthis._intended = this._panel;\n\t\tthis._shadowRoot = this.attachShadow({ mode: \"open\" });\n\t\tthis._shadowRoot.innerHTML = `<slot></slot>`;\n\t\tthis._stylesheet = new CSSStyleSheet();\n\t\tthis._cursor_stylesheet = new CSSStyleSheet();\n\t\tthis._cursor_override = false;\n\t\tconst event_name = `${this._physics.CUSTOM_EVENT_NAME_PREFIX}-before-resize`;\n\t\tthis._presizeQueue = new PresizeQueue(this, event_name, () => {\n\t\t\tthis._dimensions = undefined;\n\t\t});\n\n\t\tthis._overlayController = new OverlayController(this.create_overlay_host());\n\t\tthis._shadowRoot.adoptedStyleSheets = [\n\t\t\tthis._stylesheet,\n\t\t\tthis._cursor_stylesheet,\n\t\t];\n\t}\n\n\tconnectedCallback() {\n\t\tthis._resize_observer ??= new ResizeObserver(() => {\n\t\t\tthis._dimensions = undefined;\n\t\t});\n\n\t\tthis._resize_observer.observe(this);\n\t\tthis.addEventListener(\"dblclick\", this.onDblClick);\n\t\tthis.addEventListener(\"pointerdown\", this.onPointerDown);\n\t\tthis.addEventListener(\"pointerup\", this.onPointerUp);\n\t\tthis.addEventListener(\"pointermove\", this.onPointerMove);\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis._resize_observer?.disconnect();\n\t\tthis.removeEventListener(\"dblclick\", this.onDblClick);\n\t\tthis.removeEventListener(\"pointerdown\", this.onPointerDown);\n\t\tthis.removeEventListener(\"pointerup\", this.onPointerUp);\n\t\tthis.removeEventListener(\"pointermove\", this.onPointerMove);\n\t}\n\n\t/**\n\t * Determines which panel is at a given screen coordinate.\n\t *\n\t * @param coordinates - `PointerEvent`, `MouseEvent`, or just X and Y\n\t * coordinates in screen pixels.\n\t * @returns Panel information if a panel is at that position, null otherwise.\n\t */\n\tcalculateIntersect = (\n\t\tcoordinates: PointerEventCoordinates,\n\t): LayoutPath | null => {\n\t\tconst [col, row, _] = this.relativeCoordinates(coordinates, false);\n\t\treturn calculate_intersection(col, row, this._panel);\n\t};\n\n\t/**\n\t * Calculates the index path for a panel with the given name.\n\t *\n\t * @param name - The name of the panel to find.\n\t * @returns The panel's index path if found, `null` otherwise.\n\t */\n\tcalculatePath = (name: string): number[] | null => {\n\t\treturn calculate_path(name, this._panel);\n\t};\n\n\t/**\n\t * Sets the visual overlay state during drag-and-drop operations.\n\t * Displays a preview of where a panel would be placed at the given coordinates.\n\t *\n\t * @param event - `PointerEvent`, `MouseEvent`, or just X and Y\n\t * coordinates in screen pixels.\n\t * @param dragTarget - A `LayoutPath` (presumably from `calculateIntersect`)\n\t * which points to the drag element in the current layout.\n\t * @param className - The CSS class name to use for the overlay panel\n\t * (defaults to \"overlay\").\n\t * @param mode - Overlay rendering mode: \"grid\" uses CSS grid to position\n\t * the target, \"absolute\" positions the panel absolutely. Defaults to\n\t * \"absolute\".\n\t */\n\tsetOverlayState = async (\n\t\tevent: PointerEventCoordinates,\n\t\ttarget: LayoutPath,\n\t\tclassName?: string,\n\t\tmode?: OverlayMode,\n\t) => {\n\t\tawait this._overlayController.set(event, target, className, mode);\n\t};\n\n\t/**\n\t * Clears the overlay state and commits the panel placement.\n\t *\n\t * @param event - `PointerEvent`, `MouseEvent`, or just X and Y\n\t * coordinates in screen pixels.\n\t * @param dragTarget - A `LayoutPath` (presumably from `calculateIntersect`)\n\t * which points to the drag element in the current layout.\n\t * @param className - The CSS class name to use for the overlay panel\n\t * (defaults to \"overlay\").\n\t * @param mode - Overlay rendering mode that was used, must match the mode\n\t * passed to `setOverlayState`. Defaults to \"absolute\".\n\t */\n\tclearOverlayState = async (\n\t\tevent: PointerEventCoordinates | null,\n\t\ttarget: LayoutPath,\n\t\tclassName?: string,\n\t) => {\n\t\tawait this._overlayController.clear(event, target, className);\n\t};\n\n\t/**\n\t * Inserts a new panel into the layout at a specified path.\n\t *\n\t * @param name - Unique identifier for the new panel.\n\t * @param path - Index path defining where to insert.\n\t * @param split - Force a split in the layout at the end of `path`\n\t * regardless if there is a leaf at this position or not. Optionally,\n\t *. `split` may be your preferred `Orientation`, which will be used by\n\t * the new `SplitPanel` _if_ there is an option of orientation (e.g. if\n\t * the layout had no pre-existing `SplitPanel`)\n\t */\n\tinsertPanel = async (\n\t\tname: string,\n\t\tpath: LayoutPathTraversal = [],\n\t\tsplit?: boolean | Orientation,\n\t) => {\n\t\tlet orientation: Orientation | undefined;\n\t\tif (typeof split === \"boolean\" && split) {\n\t\t\torientation = \"horizontal\";\n\t\t} else if (typeof split === \"string\") {\n\t\t\torientation = split;\n\t\t}\n\n\t\tawait this.restore(insert_child(this._intended, name, path, orientation));\n\t};\n\n\t/**\n\t * Removes a panel from the layout by name.\n\t *\n\t * @param name - Name of the panel to remove\n\t */\n\tremovePanel = async (name: string) => {\n\t\tawait this.restore(remove_child(this._intended, name));\n\t};\n\n\t/**\n\t * Selects a panel by `name`, making it the front-most tab within its\n\t * containing stack, then dispatches a `<prefix>-select` event with\n\t * `detail: { name }`.\n\t *\n\t * The event fires whenever a tab is selected - including re-selecting the\n\t * already-active tab, or selecting the sole tab of a single-element stack -\n\t * so consumers can always map a tab interaction to an \"active panel\". When\n\t * the selection actually changes, a `<prefix>-update` event is dispatched\n\t * first (via {@link restore}).\n\t *\n\t * @param name - The name of the panel to select.\n\t */\n\tselect = async (name: string) => {\n\t\tconst layout = structuredClone(this._intended);\n\t\tconst tab_panel = this.getPanel(name, layout);\n\t\tif (!tab_panel) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst index = tab_panel.tabs.indexOf(name);\n\t\tif (index !== -1 && tab_panel.selected !== index) {\n\t\t\ttab_panel.selected = index;\n\t\t\tawait this.restore(layout);\n\t\t}\n\n\t\tconst event_name = `${this._physics.CUSTOM_EVENT_NAME_PREFIX}-select`;\n\t\tthis.dispatchEvent(new CustomEvent(event_name, { detail: { name } }));\n\t};\n\n\t/**\n\t * Retrieves a panel by name from the layout tree.\n\t *\n\t * @param name - Name of the panel to find.\n\t * @param layout - Optional layout tree to search in (defaults to current layout).\n\t * @returns The TabLayout containing the panel if found, null otherwise.\n\t */\n\tgetPanel = (name: string, layout: Layout = this._panel): TabLayout | null => {\n\t\tif (layout.type === \"tab-layout\") {\n\t\t\tif (layout.tabs.includes(name)) {\n\t\t\t\treturn layout;\n\t\t\t}\n\n\t\t\treturn null;\n\t\t}\n\n\t\tfor (const child of layout.children) {\n\t\t\tconst found = this.getPanel(name, child);\n\t\t\tif (found) {\n\t\t\t\treturn found;\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t};\n\n\t/**\n\t * Clears the entire layout, unslotting all panels.\n\t */\n\tclear = async () => {\n\t\tawait this.restore(EMPTY_PANEL);\n\t};\n\n\t/**\n\t * Maximizes a panel by `name`, rendering it full-size and hiding every\n\t * other panel. This is transient display state - it is **not** persisted by\n\t * {@link save}, and any subsequent {@link restore} resets the layout to the\n\t * minimized (normal, multi-panel) view.\n\t *\n\t * Before applying, dispatches a cancelable `regular-layout-before-resize`\n\t * event (as {@link restore} does) whose paths describe the post-maximize\n\t * geometry - a single full-window entry for `name`. If the event is\n\t * cancelled via `preventDefault()`, the update is suspended until\n\t * {@link resumeResize} is called.\n\t *\n\t * Has no effect if `name` is not present in the current layout.\n\t *\n\t * @param name - The name of the panel to maximize.\n\t */\n\tmaximize = async (name: string) => {\n\t\tif (!this.getPanel(name, this._intended)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// The post-maximize geometry as a `Layout`: `name` alone, full-window.\n\t\t// Panels hidden by the maximize are absent from the presize paths,\n\t\t// consistent with `calculate_presize_paths`' visible-panels-only\n\t\t// semantics.\n\t\tconst layout: Layout = { type: \"tab-layout\", tabs: [name], selected: 0 };\n\t\tawait this._presizeQueue.run(layout, () => {\n\t\t\tthis._maximized = name;\n\t\t\tthis._stylesheet.replaceSync(\n\t\t\t\tcreate_css_maximize_layout(name, this._physics),\n\t\t\t);\n\t\t});\n\t};\n\n\t/**\n\t * Restores the normal multi-panel view after a {@link maximize}, without\n\t * altering the layout tree. No-op if no panel is currently maximized.\n\t *\n\t * Before applying, dispatches a cancelable `regular-layout-before-resize`\n\t * event (as {@link restore} does) with paths for the restored multi-panel\n\t * geometry. If the event is cancelled via `preventDefault()`, the update\n\t * is suspended until {@link resumeResize} is called.\n\t */\n\tminimize = async () => {\n\t\tif (this._maximized === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tawait this._presizeQueue.run(this._intended, () => {\n\t\t\tthis._maximized = undefined;\n\t\t\tthis._stylesheet.replaceSync(\n\t\t\t\tcreate_css_grid_layout(this._panel, undefined, this._physics),\n\t\t\t);\n\t\t});\n\t};\n\n\t/**\n\t * Restores the layout from a saved state synchronously, without\n\t * dispatching the `regular-layout-before-resize` event.\n\t *\n\t * Supersedes any update still suspended or queued behind a\n\t * `regular-layout-before-resize`: those are discarded (their promises\n\t * resolve without applying). A suspended transition must still be\n\t * released via {@link resumeResize}.\n\t *\n\t * @param layout - The layout tree to restore\n\t */\n\trestoreSync = (layout: Layout, _is_flattened: boolean = false) => {\n\t\tthis._presizeQueue.cancelPending();\n\t\tthis._dimensions = undefined;\n\t\tthis._maximized = undefined;\n\t\tthis._panel = !_is_flattened ? flatten(layout) : layout;\n\t\tthis._intended = this._panel;\n\t\tconst css = create_css_grid_layout(this._panel, undefined, this._physics);\n\t\tthis._stylesheet.replaceSync(css);\n\t\tconst event_name = `${this._physics.CUSTOM_EVENT_NAME_PREFIX}-update`;\n\t\tconst event = new CustomEvent<Layout>(event_name, { detail: this._panel });\n\t\tthis.dispatchEvent(event);\n\t};\n\n\t/**\n\t * Restores the layout from a saved state.\n\t *\n\t * Before applying, dispatches a cancelable `regular-layout-before-resize`\n\t * event. If the event is cancelled via `preventDefault()`, the layout\n\t * update is suspended until {@link resumeResize} is called. Updates made\n\t * while one is suspended are queued and applied in order once it lands,\n\t * under a single further `regular-layout-before-resize`; the returned\n\t * promise resolves when this update has been applied.\n\t *\n\t * @param layout - The layout tree to restore\n\t *\n\t * @example\n\t * ```typescript\n\t * const layout = document.querySelector('regular-layout');\n\t * const savedState = JSON.parse(localStorage.getItem('layout'));\n\t * await layout.restore(savedState);\n\t * ```\n\t */\n\trestore = async (layout: Layout, _is_flattened: boolean = false) => {\n\t\tconst panel = !_is_flattened ? flatten(layout) : layout;\n\t\tthis._intended = panel;\n\t\tawait this._presizeQueue.run(panel, () => {\n\t\t\tthis._maximized = undefined;\n\t\t\tthis._panel = panel;\n\t\t\tconst css = create_css_grid_layout(this._panel, undefined, this._physics);\n\t\t\tthis._stylesheet.replaceSync(css);\n\t\t\tconst event_name = `${this._physics.CUSTOM_EVENT_NAME_PREFIX}-update`;\n\t\t\tconst event = new CustomEvent<Layout>(event_name, {\n\t\t\t\tdetail: this._panel,\n\t\t\t});\n\n\t\t\tthis.dispatchEvent(event);\n\t\t});\n\t};\n\n\t/**\n\t * Resumes a layout update that was suspended by cancelling the\n\t * `regular-layout-before-resize` event.\n\t */\n\tresumeResize = () => {\n\t\tthis._presizeQueue.resume();\n\t};\n\n\t/**\n\t * Serializes the current layout state, which can be restored via `restore`.\n\t * This is the committed (on-screen) tree; updates still suspended behind a\n\t * `regular-layout-before-resize` are not included.\n\t *\n\t * @returns The current layout tree\n\t *\n\t * @example\n\t * ```typescript\n\t * const layout = document.querySelector('regular-layout');\n\t * const state = layout.save();\n\t * localStorage.setItem('layout', JSON.stringify(state));\n\t * ```\n\t */\n\tsave = (): Layout => {\n\t\treturn structuredClone(this._panel);\n\t};\n\n\t/**\n\t * Override this instance's global constants.\n\t *\n\t * @param physics\n\t */\n\trestorePhysics(physics: PhysicsUpdate) {\n\t\tthis._physics = Object.freeze({\n\t\t\t...this._physics,\n\t\t\t...physics,\n\t\t});\n\t}\n\n\t/**\n\t * Get this instance's constants.\n\t *\n\t * @returns The current constants\n\t */\n\tsavePhysics(): Physics {\n\t\treturn this._physics;\n\t}\n\n\t/**\n\t * Converts screen coordinates to relative layout coordinates.\n\t *\n\t * Transforms absolute pixel positions into normalized coordinates (0-1 range)\n\t * relative to the layout's bounding box.\n\t *\n\t * @param coordinates - `PointerEvent`, `MouseEvent`, or just X and Y\n\t * coordinates in screen pixels.\n\t * @returns A tuple containing:\n\t * - col: Normalized X coordinate (0 = left edge, 1 = right edge)\n\t * - row: Normalized Y coordinate (0 = top edge, 1 = bottom edge)\n\t * - box: The layout element's bounding rectangle\n\t */\n\trelativeCoordinates = (\n\t\tevent: PointerEventCoordinates,\n\t\trecalculate_bounds: boolean = true,\n\t): [number, number, DOMRect, CSSStyleDeclaration] => {\n\t\tif (recalculate_bounds || !this._dimensions) {\n\t\t\tthis._dimensions = {\n\t\t\t\tbox: this.getBoundingClientRect(),\n\t\t\t\tstyle: getComputedStyle(this),\n\t\t\t};\n\t\t}\n\n\t\tconst box = this._dimensions.box;\n\t\tconst style = this._dimensions.style;\n\t\tconst paddingLeft = parseFloat(style.paddingLeft);\n\t\tconst paddingTop = parseFloat(style.paddingTop);\n\t\tconst contentWidth =\n\t\t\tbox.width - paddingLeft - parseFloat(style.paddingRight);\n\n\t\tconst contentHeight =\n\t\t\tbox.height - paddingTop - parseFloat(style.paddingBottom);\n\n\t\tconst localX = event.clientX - box.left - paddingLeft;\n\t\tconst localY = event.clientY - box.top - paddingTop;\n\t\tconst col = Math.max(0, Math.min(1, localX / contentWidth));\n\t\tconst row = Math.max(0, Math.min(1, localY / contentHeight));\n\t\treturn [col, row, box, style];\n\t};\n\n\t/**\n\t * Converts a {@link ViewWindow} (normalized 0\u20131 coordinates) to a\n\t * `DOMRect` in screen pixels, accounting for padding and optionally\n\t * CSS `gap` and child `margin`.\n\t *\n\t * @param window - The view window to convert.\n\t * @returns A `DOMRect` representing the window in screen coordinates.\n\t */\n\trealCoordinates = (window: ViewWindow, child?: HTMLElement): DOMRect => {\n\t\tif (!this._dimensions) {\n\t\t\tthis._dimensions = {\n\t\t\t\tbox: this.getBoundingClientRect(),\n\t\t\t\tstyle: getComputedStyle(this),\n\t\t\t};\n\t\t}\n\n\t\tconst box = this._dimensions.box;\n\t\tconst style = this._dimensions.style;\n\t\tlet childStyle: CSSStyleDeclaration | undefined;\n\t\tif (child) {\n\t\t\tchildStyle = getComputedStyle(child);\n\t\t}\n\n\t\tconst local = viewWindowToLocalRect(window, box, style, childStyle);\n\t\treturn new DOMRect(\n\t\t\tbox.left + local.x,\n\t\t\tbox.top + local.y,\n\t\t\tlocal.width,\n\t\t\tlocal.height,\n\t\t);\n\t};\n\n\t/**\n\t * Calculates the Euclidean distance in pixels between the current pointer\n\t * coordinates and a drag target's position within the layout.\n\t *\n\t * @param coordinates - The current pointer event coordinates.\n\t * @param drag_target - The layout path representing the drag target\n\t * \t position.\n\t * @returns The distance in pixels between the coordinates and the drag\n\t * target.\n\t */\n\tdiffCoordinates = (\n\t\tevent: PointerEventCoordinates,\n\t\tdrag_target: LayoutPath,\n\t): number => {\n\t\tconst [column, row, box] = this.relativeCoordinates(event, false);\n\t\tconst dx = (column - drag_target.column) * box.width;\n\t\tconst dy = (row - drag_target.row) * box.height;\n\t\treturn Math.sqrt(dx ** 2 + dy ** 2);\n\t};\n\n\t// \u2587\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u25A0\u25A0\u25A0\u25A0\u023A\u023A\u023A\u023A\u023A\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u023A\u023A\u023A\u023A\u023A\u25A0\u25A0\u25A0\u25A0\u25A0\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\n\t// \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u259B\u2580\u2580\u2588\u2583\u2584\u2584\u2585\u2586\u2586\u2586\u2587\u2587\u2587\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2587\u2587\u2587\u2586\u2586\u2586\u2585\u2585\u2584\u2583\u2588\u2580\u2580\u259C\u2588\u2588\u2588\u2588\u2588\u2588\u2588\n\t// \u2588\u2588\u2588\u2588\u259B\u259A\u2585\u2587\u2588\u2588\u2588\u258D \u2597\u2584\u2583\u00AF\"\u259C\u2588\u2588\u2598 \u259C\u2588\u2588\u258D \u2580\u2588\u258B \u2590\u2588\u2580\u2594\u2582\u2584\u2583 \u2594\u259C\u2588 \u2597\u2583\u2583\u2583\u2584\u258A \u2584\u2584\u2583 \u2594\u259C\u2588\u2588\u2587\u2585\u2583\u2580\u2588\u2588\u2588\u2588\n\t// \u2588\u2588\u2588\u258B\u257A\u2588\u2588\u2588\u2588\u2588\u2588\u258D \u2590\u2588\u2588\u258B \u2588\u2598 \u25E8\u023D \"\u2588\u2588\u258D \u2599\u2581 \u2580 \u2590\u258B \u2588\u259B\u2580\u2580\u2580\u259C\u2588 \u00B4\u2582\u2582\u014A\u2588\u258A \u00B0\"\u2594 \u2583\u2588\u2588\u2588\u2588\u2588\u2588\u258D\u2590\u2588\u2588\u2588\n\t// \u2588\u2588\u2588\u2588\u2584\u259D\u259C\u2588\u2588\u2588\u2588\u258D \u259D\u2580\u2580 \u2582\u259F\u2598 \u2584\u2584\u2584\u2584 \"\u2588\u258D \u2588\u2588\u2584 \u2590\u2588\u2583 \u259D\u2580\u2580 \u2590\u2588 \u259D\u2580\u2580\u2580\u2580\u258A \u2588\u2588\u2596 \u259D\u2588\u2588\u2588\u2588\u259B\u2580\u2584\u2588\u2588\u2588\u2588\n\t// \u2588\u2588\u2588\u2588\u2588\u2588\u2587\u2586\u2584\u2583\u2588\u2580\u2580\u023A\u25BC\u25A0\u2588\u2588\u2588\u2587\u2587\u2588\u2588\u2588\u2588\u2587\u2587\u2588\u2587\u2587\u2588\u2588\u2588\u2588\u2587\u2588\u2588\u2588\u2588\u2587\u2587\u2587\u2588\u2588\u2588\u2588\u2587\u2587\u2587\u2587\u2587\u2587\u2587\u2588\u2587\u25A0\u25D8\u2580\u2580\u2580\u2580\u2582\u2583\u2584\u2585\u2587\u2588\u2588\u2588\u2588\u2588\u2588\n\t// \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2587\u2587\u2586\u2586\u2586\u2585\u2585\u2585\u2585\u2585\u2585\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2585\u2585\u2585\u2585\u2585\u2585\u2586\u2586\u2586\u2587\u2587\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\n\t//\n\t//\n\t// \u250F\u2585\u2585\u2596 \u2597\u2585\u2585\u25B6 \u2585\u2585\u2585\u2585\u2585\u2585\u2585 \u2597\u2585\u2585\u2585\u2585\u2585\u2585\u2596 \u2585\u2585\u2585\u2585\u2585\u2584\u2584\u2582 \u2583\u2585\u2586\u2586\u2586\u2584\u2581 \u250F\u2585\u2585\u2596 \u2585\u2585\u2596\u2585\u2585\u2585\u2585\u2585\u2585\u2585\u2585\u2585\n\t// \u2523\u2588\u2588\u258C\u2597\u2588\u2588\u259B \u2588\u2588\u258A\u2594\u2594\u2594\u2594 \u2590\u2588\u2588\u258B\u2594\u2594\u2594` \u2588\u2588\u2588\u258D\"\u259C\u2588\u2588\u2599 \u259F\u2588\u2588\u2598\u2594\u2588\u2588\u2588\u2596 \u2590\u2588\u2588\u258C \u2588\u2588\u258C^\u2594\u2594\u2588\u2588\u2588^\u2594^\n\t// \u2523\u2588\u2588\u2599\u2588\u2588\u258B \u2588\u2588\u258A\u2582\u2582\u2582 \u2590\u2588\u2588\u258B\u2582\u2582\u2582 \u2588\u2588\u2588\u258D \u2590\u2588\u2588\u258B \u2590\u2588\u2588\u2588 \u2590\u2588\u2588\u258B \u2590\u2588\u2588\u258C \u2588\u2588\u258C \u2588\u2588\u2588\u258E\n\t// \u2523\u2588\u2588\u2588\u2588\u2588\u2588\u258C \u2588\u2588\u2588\u2580\u2580\u2580 \u2590\u2588\u2588\u2588\u2580\u2580\u2598 \u2588\u2588\u2588\u2588\u2588\u2588\u259B\u2580 \u2590\u2588\u2588\u2588 \u2590\u2588\u2588\u258B \u2590\u2588\u2588\u258C \u2588\u2588\u258C \u2588\u2588\u2588\u258E\n\t// \u2523\u2588\u2588\u259B \u259C\u2588\u2588\u2596 \u2588\u2588\u258A \u2590\u2588\u2588\u258B \u2588\u2588\u2588\u258D \u259D\u2588\u2588\u2588 \u259F\u2588\u2588\u258C \u2590\u2588\u2588\u258C \u2588\u2588\u258C \u2588\u2588\u2588\u258E\n\t// \u2523\u2588\u2588\u258C \u2588\u2588\u2588 \u2588\u2588\u2588\u2586\u2586\u2586\u2586\u258E\u2590\u2588\u2588\u2588\u2586\u2586\u2586\u2585 \u2588\u2588\u2588\u258D \u2580\u2588\u2588\u2599\u2585\u2588\u2588\u259B \u259D\u2588\u2588\u2588\u2585\u2586\u2588\u2588\u2598 \u2588\u2588\u2588\u258E\n\t// \u2594\u2594\u2594` \u00B4\u2594\u2594` \u2594\u2594\u2594\u2594\u2594\u2594\u2594 \u00B4\u2594\u2594\u2594\u2594\u2594\u2594\u2594 \u2594\u2594\u2594 \u2594\"\"\u2594\u00AF \u2594\"\"^\u2594 \u2594\u2594\u2594\n\n\tprivate create_overlay_host(): OverlayHost {\n\t\tconst self = this;\n\t\treturn {\n\t\t\tget panel() {\n\t\t\t\treturn self._intended;\n\t\t\t},\n\t\t\tget physics() {\n\t\t\t\treturn self._physics;\n\t\t\t},\n\t\t\tget stylesheet() {\n\t\t\t\treturn self._stylesheet;\n\t\t\t},\n\t\t\tget presizeQueue() {\n\t\t\t\treturn self._presizeQueue;\n\t\t\t},\n\t\t\trelativeCoordinates: (event, recalculate) =>\n\t\t\t\tself.relativeCoordinates(event, recalculate),\n\t\t\trestore: (layout, isFlattened) => self.restore(layout, isFlattened),\n\t\t\tquerySelector: (selectors) => self.querySelector(selectors),\n\t\t\tdispatchEvent: (event) => self.dispatchEvent(event),\n\t\t};\n\t}\n\n\tprivate onDblClick = async (event: MouseEvent) => {\n\t\tconst [col, row, rect] = this.relativeCoordinates(event, false);\n\t\tconst divider = calculate_intersection(col, row, this._panel, {\n\t\t\trect,\n\t\t\tsize: this._physics.GRID_DIVIDER_SIZE,\n\t\t});\n\n\t\tif (divider?.type === \"horizontal\" || divider?.type === \"vertical\") {\n\t\t\tconst panel = redistribute_panel_sizes(\n\t\t\t\tthis._intended,\n\t\t\t\tdivider.path,\n\t\t\t\tundefined,\n\t\t\t);\n\n\t\t\tawait this.restore(panel, true);\n\t\t}\n\t};\n\n\tprivate onPointerDown = (event: PointerEvent) => {\n\t\tif (event.button !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this._physics.GRID_DIVIDER_CHECK_TARGET || event.target === this) {\n\t\t\tconst [col, row, rect] = this.relativeCoordinates(event);\n\t\t\tconst size = this._physics.GRID_DIVIDER_SIZE;\n\t\t\tconst hit = calculate_intersection(col, row, this._panel, { rect, size });\n\t\t\tif (hit && hit.type !== \"layout-path\") {\n\t\t\t\tthis._drag_target = [hit, col, row];\n\t\t\t\tthis.setPointerCapture(event.pointerId);\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t}\n\t};\n\n\tprivate onPointerMove = async (event: PointerEvent) => {\n\t\tif (this._drag_target) {\n\t\t\tconst [col, row] = this.relativeCoordinates(event, false);\n\t\t\tconst [{ path, type }, old_col, old_row] = this._drag_target;\n\t\t\tconst offset = type === \"horizontal\" ? old_col - col : old_row - row;\n\t\t\tconst panel = redistribute_panel_sizes(this._panel, path, offset);\n\t\t\tawait this._presizeQueue.run(panel, () => {\n\t\t\t\tthis._stylesheet.replaceSync(\n\t\t\t\t\tcreate_css_grid_layout(panel, undefined, this._physics),\n\t\t\t\t);\n\t\t\t});\n\t\t}\n\n\t\tif (this._physics.GRID_DIVIDER_CHECK_TARGET && event.target !== this) {\n\t\t\tif (this._cursor_override) {\n\t\t\t\tthis._cursor_override = false;\n\t\t\t\tthis._cursor_stylesheet.replaceSync(\"\");\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst [col, row, rect] = this.relativeCoordinates(event, false);\n\t\tconst divider = calculate_intersection(col, row, this._panel, {\n\t\t\trect,\n\t\t\tsize: this._physics.GRID_DIVIDER_SIZE,\n\t\t});\n\n\t\tif (divider?.type === \"vertical\") {\n\t\t\tthis._cursor_stylesheet.replaceSync(\":host{cursor:row-resize\");\n\t\t\tthis._cursor_override = true;\n\t\t} else if (divider?.type === \"horizontal\") {\n\t\t\tthis._cursor_stylesheet.replaceSync(\":host{cursor:col-resize\");\n\t\t\tthis._cursor_override = true;\n\t\t} else if (this._cursor_override) {\n\t\t\tthis._cursor_override = false;\n\t\t\tthis._cursor_stylesheet.replaceSync(\"\");\n\t\t}\n\t};\n\n\tprivate onPointerUp = async (event: PointerEvent) => {\n\t\tif (this._drag_target) {\n\t\t\tthis.releasePointerCapture(event.pointerId);\n\t\t\tconst [col, row] = this.relativeCoordinates(event, false);\n\t\t\tconst [{ path, type }, old_col, old_row] = this._drag_target;\n\t\t\tconst offset = type === \"horizontal\" ? old_col - col : old_row - row;\n\t\t\tconst panel = redistribute_panel_sizes(this._intended, path, offset);\n\t\t\tawait this.restore(panel, true);\n\t\t\tthis._drag_target = undefined;\n\t\t}\n\t};\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport type { LayoutPath } from \"./core/types.ts\";\nimport type { RegularLayoutEvent } from \"./extensions.ts\";\nimport type { RegularLayout } from \"./regular-layout.ts\";\nimport type { RegularLayoutTab } from \"./regular-layout-tab.ts\";\n\nconst CSS = `\n:host{box-sizing:border-box;flex-direction:column;pointer-events:none}\n[part~=\"titlebar\"]{height:24px;user-select:none;overflow:hidden}\n[part~=\"container\"]{flex:1 1 auto;pointer-events:auto}\n[part~=\"title\"]{flex:1 1 auto;pointer-events:none}\n[part~=\"close\"]{align-self:stretch}\n:host([inactive]) [part~=\"container\"]{display:none}\n.tabs{display:grid;width:100%;height:100%}\n.tabs slot[name=\"tab\"]{display:grid;grid-row:1;pointer-events:auto}\n.tabs regular-layout-tab{display:flex;overflow:hidden}\n`;\n\nconst HTML_TEMPLATE = `\n\t<div part=\"titlebar\"><div class=\"tabs\" part=\"titlebar-track\"><slot name=\"tab\"><regular-layout-tab></regular-layout-tab></slot></div></div>\n\t<div part=\"container\"><slot></slot></div>\n`;\n\ntype DragState = { moved?: boolean; path: LayoutPath };\n\n/**\n * Escapes a string for safe use as a CSS `<string>` token (the `content`\n * fallback), handling backslashes, double-quotes, and newlines.\n */\nconst css_string = (value: string): string =>\n\t`\"${value.replace(/[\\\\\"\\n]/g, (c) => (c === \"\\n\" ? \"\\\\A \" : `\\\\${c}`))}\"`;\n\n/**\n * The per-slot CSS custom property a consumer sets to override a tab's label,\n * e.g. `regular-layout { --regular-layout-my-panel--title: \"My Panel\"; }`.\n */\nconst title_variable = (slot: string): string =>\n\t`--regular-layout-${globalThis.CSS.escape(slot)}--title`;\n\n/**\n * A custom element that represents a draggable panel within a\n * `<regular-layout>`.\n *\n * `<regular-layout-frame>` is optional - you may also use a `<regular-layout>`\n * with just plain `<div>` children (for example), but panels will not be\n * moveable within the layout unless you manually call `setOverlayState` and\n * `clearOverlayState` (or otherwise impement panel moving via the\n * `<regular-layout>` API).\n *\n * `<regular-layout-frame>` simple and highly customizable implementations\n * based on [CSS `part`](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Selectors/::part)\n * for custom styling, and symmetric\n * [named `slot`s](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_templates_and_slots)\n * for wholesale replacement of the underlying Shadow DOM.\n *\n * The `name` attribute identifies the panel within the layout. The tab label\n * defaults to `name`, but can be overridden with pure CSS by setting the\n * `--regular-layout-<name>--title` custom property to a CSS string - the label\n * is rendered via the tab title's `::before` `content`, so the override\n * applies reactively with no JavaScript.\n *\n * @example\n * ```html\n * <style>\n * regular-layout { --regular-layout-panel-1--title: \"Panel 1\"; }\n * </style>\n * <regular-layout>\n * <regular-layout-frame name=\"panel-1\">\n * <!-- Panel content here -->\n * </regular-layout-frame>\n * </regular-layout>\n * ```\n */\nexport class RegularLayoutFrame extends HTMLElement {\n\tprivate _shadowRoot!: ShadowRoot;\n\tprivate _container_sheet!: CSSStyleSheet;\n\tprivate _tab_sheet!: CSSStyleSheet;\n\tprivate _layout!: RegularLayout;\n\tprivate _header!: HTMLElement;\n\tprivate _default_tab!: RegularLayoutTab;\n\tprivate _drag: DragState | null = null;\n\n\t/**\n\t * Initializes this elements. Override this method and\n\t * `disconnectedCallback` to modify how this subclass renders the Shadow\n\t * DOM and registers events.\n\t */\n\tconnectedCallback() {\n\t\tthis._container_sheet ??= new CSSStyleSheet();\n\t\tthis._container_sheet.replaceSync(CSS);\n\t\tthis._tab_sheet ??= new CSSStyleSheet();\n\t\tthis._shadowRoot ??= this.attachShadow({ mode: \"open\" });\n\t\tthis._shadowRoot.adoptedStyleSheets = [\n\t\t\tthis._container_sheet,\n\t\t\tthis._tab_sheet,\n\t\t];\n\t\tthis._shadowRoot.innerHTML = HTML_TEMPLATE;\n\t\tthis._layout = this.parentElement as RegularLayout;\n\t\tthis._header = this._shadowRoot.children[0] as HTMLElement;\n\t\t// The built-in tab is the `slot=\"tab\"` fallback; a consumer-supplied\n\t\t// `slot=\"tab\"` child replaces it.\n\t\tthis._default_tab = this._header.querySelector(\n\t\t\t\"regular-layout-tab\",\n\t\t) as RegularLayoutTab;\n\t\tthis._header.addEventListener(\"pointerdown\", this.onPointerDown);\n\t\tthis.addEventListener(\"pointermove\", this.onPointerMove);\n\t\tthis.addEventListener(\"pointerup\", this.onPointerUp);\n\t\tthis.addEventListener(\"pointercancel\", this.onPointerCancel);\n\t\tthis.addEventListener(\"lostpointercapture\", this.onPointerLost);\n\t\tthis._layout.addEventListener(\"regular-layout-update\", this.drawTabs);\n\t\tthis._layout.addEventListener(\n\t\t\t\"regular-layout-before-update\",\n\t\t\tthis.drawTabs,\n\t\t);\n\t}\n\n\t/**\n\t * Destroys this element.\n\t */\n\tdisconnectedCallback() {\n\t\tthis._header.removeEventListener(\"pointerdown\", this.onPointerDown);\n\t\tthis.removeEventListener(\"pointermove\", this.onPointerMove);\n\t\tthis.removeEventListener(\"pointerup\", this.onPointerUp);\n\t\tthis.removeEventListener(\"pointercancel\", this.onPointerUp);\n\t\tthis.removeEventListener(\"lostpointercapture\", this.onPointerLost);\n\t\tthis._layout.removeEventListener(\"regular-layout-update\", this.drawTabs);\n\t\tthis._layout.removeEventListener(\n\t\t\t\"regular-layout-before-update\",\n\t\t\tthis.drawTabs,\n\t\t);\n\t}\n\n\tprivate onPointerDown = (event: PointerEvent): void => {\n\t\tif (event.button !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst elem = event.target as RegularLayoutTab;\n\t\tif (elem.part.contains(\"tab\")) {\n\t\t\tconst slot = this.getAttribute(\n\t\t\t\tthis._layout.savePhysics().CHILD_ATTRIBUTE_NAME,\n\t\t\t);\n\n\t\t\tconst path = this._layout.calculateIntersect(event);\n\t\t\tif (path && slot) {\n\t\t\t\t// Drag *this frame's* panel, not whichever panel is front-most at\n\t\t\t\t// the pointer (which is what `calculateIntersect` resolves to in a\n\t\t\t\t// stack). The overlapping stack shares geometry, so only the slot\n\t\t\t\t// needs overriding.\n\t\t\t\tthis._drag = { path: { ...path, slot } };\n\t\t\t\tthis.setPointerCapture(event.pointerId);\n\t\t\t\tevent.preventDefault();\n\t\t\t} else {\n\t\t\t\tthis._drag = null;\n\t\t\t}\n\t\t}\n\t};\n\n\tprivate onPointerMove = (event: PointerEvent): void => {\n\t\tif (this._drag) {\n\t\t\tconst physics = this._layout.savePhysics();\n\t\t\tif (!this._drag.moved) {\n\t\t\t\tconst diff = this._layout.diffCoordinates(event, this._drag.path);\n\t\t\t\tif (diff <= physics.MIN_DRAG_DISTANCE) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis._drag.moved = true;\n\t\t\tthis._layout.setOverlayState(event, this._drag.path);\n\t\t}\n\t};\n\n\tprivate onPointerUp = (event: PointerEvent): void => {\n\t\tif (this._drag?.moved) {\n\t\t\tthis._layout.clearOverlayState(event, this._drag.path);\n\t\t}\n\t};\n\n\tprivate onPointerCancel = (_: PointerEvent): void => {\n\t\tif (this._drag?.moved) {\n\t\t\tthis._layout.clearOverlayState(null, this._drag.path);\n\t\t}\n\t};\n\n\tprivate onPointerLost = (event: PointerEvent): void => {\n\t\tthis.releasePointerCapture(event.pointerId);\n\t\tthis._drag = null;\n\t};\n\n\tprivate drawTabs = (event: RegularLayoutEvent) => {\n\t\tconst attr = this._layout.savePhysics().CHILD_ATTRIBUTE_NAME;\n\t\tconst slot = this.getAttribute(attr);\n\t\tif (!slot) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet tab_panel = this._layout.getPanel(slot, event.detail);\n\t\tif (!tab_panel) {\n\t\t\ttab_panel = { type: \"tab-layout\", tabs: [slot], selected: 0 };\n\t\t}\n\n\t\t// Each frame renders only its *own* tab. Frames in a stack overlap (see\n\t\t// `create_css_grid_layout`); the tabs tile because every frame derives\n\t\t// the same column template and places its tab in its own column. Only\n\t\t// the selected frame shows its content; the rest keep just their tab.\n\t\tconst index = tab_panel.tabs.indexOf(slot);\n\t\tconst selected = (tab_panel.selected ?? 0) === index;\n\t\tthis.toggleAttribute(\"inactive\", !selected);\n\t\tthis._default_tab.populate(this._layout, tab_panel, index);\n\t\tthis.drawTab(slot, index, tab_panel.tabs.length);\n\t};\n\n\t/**\n\t * Regenerates this frame's tab stylesheet: the shared titlebar grid template\n\t * (so every frame in the stack aligns), the column this frame's tab occupies,\n\t * and the tab label. The label renders via the title's `::before` `content`,\n\t * reading the slot's `--regular-layout-<slot>--title` override variable with\n\t * the slot name as the fallback - so a consumer can relabel a tab purely in\n\t * CSS and the change applies reactively.\n\t *\n\t * @param slot - This frame's panel name.\n\t * @param index - This frame's column (zero-based) within the stack.\n\t * @param count - The number of tabs in the stack.\n\t */\n\tprivate drawTab = (slot: string, index: number, count: number) => {\n\t\tthis._tab_sheet.replaceSync(\n\t\t\t[\n\t\t\t\t`.tabs{grid-template-columns:repeat(${count},var(--rl-tab-width,1fr))}`,\n\t\t\t\t`.tabs slot[name=\"tab\"]{grid-column:${index + 1}}`,\n\t\t\t\t`[part~=\"title\"]::before{content:var(${title_variable(slot)}, ${css_string(slot)})}`,\n\t\t\t].join(\"\\n\"),\n\t\t);\n\t};\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport type { TabLayout } from \"./core/types.ts\";\nimport type { RegularLayout } from \"./regular-layout.ts\";\n\n/**\n * A custom HTML element representing an individual tab in a tab panel.\n *\n * This element manages the visual representation and interactions for a single tab,\n * including selection state, close functionality, and content display.\n */\nexport class RegularLayoutTab extends HTMLElement {\n\tprivate _layout?: RegularLayout;\n\tprivate _tab_panel?: TabLayout;\n\tprivate _index?: number;\n\n\t/**\n\t * Populates or updates the tab with layout information.\n\t *\n\t * This method initializes the tab's content and event listeners on first call,\n\t * and efficiently updates only the changed properties on subsequent calls.\n\t *\n\t * @param layout - The parent RegularLayout instance managing this tab.\n\t * @param tab_panel - The tab panel layout containing this tab.\n\t * @param index - The index of this tab within the tab panel.\n\t */\n\tpopulate = (layout: RegularLayout, tab_panel: TabLayout, index: number) => {\n\t\t// Stamp the slot onto the tab so its title can be styled by name (see\n\t\t// `RegularLayoutFrame#drawTitles`). Tag-qualified selectors keep this\n\t\t// distinct from the panel `name` on `<regular-layout-frame>`.\n\t\tthis.setAttribute(\n\t\t\tlayout.savePhysics().CHILD_ATTRIBUTE_NAME,\n\t\t\ttab_panel.tabs[index],\n\t\t);\n\n\t\tif (this._tab_panel) {\n\t\t\tconst tab_changed =\n\t\t\t\t(index === tab_panel.selected) !==\n\t\t\t\t(index === this._tab_panel?.selected);\n\n\t\t\tconst index_changed =\n\t\t\t\ttab_changed || this._tab_panel?.tabs[index] !== tab_panel.tabs[index];\n\n\t\t\tif (index_changed) {\n\t\t\t\tconst selected = tab_panel.selected === index;\n\t\t\t\tif (selected) {\n\t\t\t\t\tthis.children[1].part.add(\"active-close\");\n\t\t\t\t\tthis.part.add(\"active-tab\");\n\t\t\t\t} else {\n\t\t\t\t\tthis.children[1].part.remove(\"active-close\");\n\t\t\t\t\tthis.part.remove(\"active-tab\");\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconst selected = tab_panel.selected === index;\n\t\t\tconst parts = selected ? \"active-close close\" : \"close\";\n\t\t\tthis.innerHTML = `<div part=\"title\"></div><button part=\"${parts}\"></button>`;\n\t\t\tif (selected) {\n\t\t\t\tthis.part.add(\"tab\", \"active-tab\");\n\t\t\t} else {\n\t\t\t\tthis.part.add(\"tab\");\n\t\t\t}\n\n\t\t\tthis.addEventListener(\"pointerdown\", this.onTabClick);\n\t\t\tthis.children[1].addEventListener(\"pointerdown\", this.onTabClose);\n\t\t}\n\n\t\tthis._tab_panel = tab_panel;\n\t\tthis._layout = layout;\n\t\tthis._index = index;\n\t};\n\n\tprivate onTabClose = (event: Event) => {\n\t\tif (event instanceof PointerEvent && event?.button !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._tab_panel !== undefined && this._index !== undefined) {\n\t\t\tthis._layout?.removePanel(this._tab_panel.tabs[this._index]);\n\t\t}\n\t};\n\n\tprivate onTabClick = (event: PointerEvent) => {\n\t\tif (event.button !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._tab_panel !== undefined && this._index !== undefined) {\n\t\t\tthis._layout?.select(this._tab_panel.tabs[this._index]);\n\t\t}\n\t};\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport { RegularLayout } from \"./regular-layout.ts\";\nimport { RegularLayoutFrame } from \"./regular-layout-frame.ts\";\nimport type { Layout, PresizeDetail } from \"./core/types.ts\";\nimport { RegularLayoutTab } from \"./regular-layout-tab.ts\";\n\ncustomElements.define(\"regular-layout\", RegularLayout);\ncustomElements.define(\"regular-layout-frame\", RegularLayoutFrame);\ncustomElements.define(\"regular-layout-tab\", RegularLayoutTab);\n\ndeclare global {\n\tinterface Document {\n\t\tcreateElement(\n\t\t\ttagName: \"regular-layout\",\n\t\t\toptions?: ElementCreationOptions,\n\t\t): RegularLayout;\n\n\t\tcreateElement(\n\t\t\ttagName: \"regular-layout-frame\",\n\t\t\toptions?: ElementCreationOptions,\n\t\t): RegularLayoutFrame;\n\n\t\tcreateElement(\n\t\t\ttagName: \"regular-layout-tab\",\n\t\t\toptions?: ElementCreationOptions,\n\t\t): RegularLayoutTab;\n\n\t\tquerySelector<E extends Element = Element>(selectors: string): E | null;\n\t\tquerySelector(selectors: \"regular-layout\"): RegularLayout | null;\n\t\tquerySelector(selectors: \"regular-layout-frame\"): RegularLayoutFrame | null;\n\t\tquerySelector(selectors: \"regular-layout-tab\"): RegularLayoutTab | null;\n\t}\n\n\tinterface CustomElementRegistry {\n\t\tget(tagName: \"regular-layout\"): typeof RegularLayout;\n\t\tget(tagName: \"regular-layout-frame\"): typeof RegularLayoutFrame;\n\t}\n\n\tinterface HTMLElement {\n\t\taddEventListener(\n\t\t\tname: \"regular-layout-update\",\n\t\t\tcb: (e: RegularLayoutEvent) => void,\n\t\t\toptions?: { signal: AbortSignal },\n\t\t): void;\n\n\t\taddEventListener(\n\t\t\tname: \"regular-layout-before-update\",\n\t\t\tcb: (e: RegularLayoutEvent) => void,\n\t\t\toptions?: { signal: AbortSignal },\n\t\t): void;\n\n\t\taddEventListener(\n\t\t\tname: \"regular-layout-before-resize\",\n\t\t\tcb: (e: RegularLayoutPresizeEvent) => void,\n\t\t\toptions?: { signal: AbortSignal },\n\t\t): void;\n\n\t\taddEventListener(\n\t\t\tname: \"regular-layout-select\",\n\t\t\tcb: (e: RegularLayoutSelectEvent) => void,\n\t\t\toptions?: { signal: AbortSignal },\n\t\t): void;\n\n\t\tremoveEventListener(\n\t\t\tname: \"regular-layout-update\",\n\t\t\tcb: (e: RegularLayoutEvent) => void,\n\t\t): void;\n\n\t\tremoveEventListener(\n\t\t\tname: \"regular-layout-before-update\",\n\t\t\tcb: (e: RegularLayoutEvent) => void,\n\t\t): void;\n\n\t\tremoveEventListener(\n\t\t\tname: \"regular-layout-before-resize\",\n\t\t\tcb: (e: RegularLayoutPresizeEvent) => void,\n\t\t): void;\n\n\t\tremoveEventListener(\n\t\t\tname: \"regular-layout-select\",\n\t\t\tcb: (e: RegularLayoutSelectEvent) => void,\n\t\t): void;\n\t}\n}\n\nexport type RegularLayoutEvent = CustomEvent<Layout>;\nexport type RegularLayoutPresizeEvent = CustomEvent<PresizeDetail>;\nexport type RegularLayoutSelectEvent = CustomEvent<{ name: string }>;\n", "// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport type { View } from \"@perspective-dev/client\";\nimport { PluginStaticConfig } from \"./ts-rs/PluginStaticConfig.js\";\n\n/**\n * The `IPerspectiveViewerPlugin` interface defines the necessary API for a\n * `<perspective-viewer>` plugin, which also must be an `HTMLElement` via the\n * Custom Elements API or otherwise. Rather than implement this API from\n * scratch however, the simplest way is to inherit from\n * `<perspective-viewer-plugin>`, which implements `IPerspectiveViewerPlugin`\n * with non-offensive default implementations, where only the `draw()` and\n * `get_static_config()` methods need be overridden to get started with a\n * simple plugin.\n *\n * Note that plugins are frozen once a `<perspective-viewer>` has been\n * instantiated, so generally new plugin code must be executed at the module\n * level (if packaged as a library), or during application init to ensure global\n * availability of a plugin.\n *\n * ## Dispatch contract\n *\n * The host dispatches each method for exactly one reason, and never\n * defensively \u2014 implementations may rely on these meanings:\n *\n * - `draw(view)` \u2014 `view` is NEW to this plugin: a new engine `View` was\n * constructed, or this plugin was freshly selected and owes its first\n * render. Safe to reset zoom/scroll/selection state.\n * - `update(view)` \u2014 same `View`, but a plugin-visible input genuinely\n * changed: new data (`View.on_update`), an effective view-config delta\n * without a rebuild, a *changed* plugin/columns config just delivered\n * via `restore()`, changed CSS just applied via `restyle()`, a\n * render-limits change, or an explicit public `viewer.restore()` call\n * (the no-op-restore refresh affordance). Host-internal operations that\n * change none of these dispatch nothing.\n * - `resize(view)` \u2014 geometry or visibility changed (including panel\n * activation); repaint from retained state, no data or CSS re-read.\n * - `restyle()` \u2014 the effective theme genuinely changed; when a\n * `draw`/`update` is part of the same operation, `restyle()` is called\n * immediately BEFORE it, so one render pass paints in the new theme.\n * - `restore()`/`save()` \u2014 state transfer only. Plugins must NOT render\n * from `restore()` (a changed restore is always followed by exactly one\n * `update`) and must NOT call host APIs from inside it \u2014 a\n * `restore()` echo re-enters the host's public surface and forces\n * a redundant render (the classic double-render-on-load bug).\n *\n * Rendering methods (`draw`, `update`, `resize`, `render`, `clear`) and\n * `delete` are serialized per element \u2014 the host never overlaps them, and\n * each call runs to completion before the next begins.\n *\n * @example\n * ```javascript\n * const BasePlugin = customElements.get(\"perspective-viewer-plugin\");\n * class MyPlugin extends BasePlugin {\n * get_static_config() {\n * return { name: \"My Plugin\", config_column_names: [] };\n * }\n * async draw(view) {\n * const count = await view.num_rows();\n * this.innerHTML = `View has ${count} rows`;\n * }\n * }\n *\n * customElements.define(\"my-plugin\", MyPlugin);\n * const Viewer = customElements.get(\"perspective-viewer\");\n * Viewer.registerPlugin(\"my-plugin\");\n * ```\n * @noInheritDoc\n */\nexport interface IPerspectiveViewerPlugin {\n /**\n * Static plugin configuration. Called exactly once per plugin at\n * registration time and cached; the result must be stable for the\n * lifetime of the application.\n */\n get_static_config(): PluginStaticConfig;\n\n /**\n * Determines which column configuration controls are populated in the viewer.\n * Corresponds to the data the plugin will recieve on save. Only\n * invoked when `can_render_column_styles` is `true` in the static\n * config.\n */\n column_style_config?: (view_type: string, group: string) => any;\n\n /**\n * The per-column Style-tab schema: the controls the viewer renders\n * for one column, re-queried on every field edit so the field set\n * may depend on `current_value`.\n *\n * Must be a function of its arguments alone, never of what this element\n * last drew or was last `restore`d with.\n */\n column_config_schema?(\n view_type: string,\n group: string | undefined,\n column_name: string,\n current_value: Record<string, unknown> | null,\n viewer_config?: Record<string, unknown>,\n plugin_config?: Record<string, unknown> | null,\n ): { fields: Array<Record<string, unknown> & { kind: string }> };\n\n /**\n * The plugin-level settings schema as it applies to `current_value`, the\n * `plugin_config` state the schema should describe.\n */\n plugin_config_schema?(\n view_config?: Record<string, unknown>,\n current_value?: Record<string, unknown> | null,\n ): { fields: Array<Record<string, unknown> & { kind: string }> };\n\n /**\n * Render this plugin using the provided `View`. While there is no\n * provision to cancel a render in progress per se, calling a method on\n * a `View` which has been deleted will throw an exception.\n *\n * The host invokes `draw` ONLY when `view` is NEW to this plugin \u2014 a\n * new engine `View` was constructed for a config change, or this plugin\n * element was freshly selected and owes its first render of the bound\n * `View` \u2014 so implementations may treat it as \"new data shape\" and\n * reset zoom/scroll/selection-domain state. Repaints of the same\n * `View` arrive as `update()` (data or style refresh) or `resize()`\n * (geometry/chrome), never `draw()`.\n *\n * @example\n * ```\n * async draw(view: perspective.View): Promise<void> {\n * const csv = await view.to_csv();\n * this.innerHTML = `<pre>${csv}</pre>`;\n * }\n * ```\n */\n draw(view: View): Promise<void>;\n\n /**\n * Draw under the assumption that the `View` has not changed since the\n * previous call to `draw()`, but some plugin-visible input has.\n * Defaults to dispatch to `draw()`.\n *\n * @example\n * ```javascript\n * async update(view: perspective.View): Promise<void> {\n * return this.draw(view);\n * }\n * ```\n */\n update(view: View): Promise<void>;\n\n /**\n * Clear this plugin, though it is up to the discretion of the plugin\n * author to determine what this means. Defaults to resetting this\n * element's `innerHTML`, so be sure to override if you want custom\n * behavior.\n *\n * @example\n * ```javascript\n * async clear(): Promise<void> {\n * this.innerHTML = \"\";\n * }\n * ```\n */\n clear(): Promise<void>;\n\n /**\n * Like `update()`, but for when the dimensions of the plugin have changed\n * and the underlying data has not \u2014 a repaint from retained state,\n * invoked ONLY when geometry or visibility changed: box resizes,\n * presize sweeps, and the panel-ACTIVATION chrome nudge (multi-panel),\n * so implementations should repaint activation-dependent chrome here\n * and no-op while hidden (`offsetParent == null`).\n */\n resize(view: View): Promise<void>;\n\n /**\n * Notify the plugin that the style environment has changed. Useful for\n * plugins which read CSS styles via `window.getComputedStyle()` \u2014 this\n * is the ONLY point at which a plugin is expected to (re-)read them\n * (besides its first `draw()`), so implementations may cache computed\n * styles between `restyle()` calls.\n */\n restyle(): void;\n\n /**\n * Restore this plugin to a state previously returned by `save()`.\n *\n * State transfer ONLY \u2014 implementations must not render from\n * `restore()` (the host follows a restore that genuinely changed\n * plugin state with exactly one `update()` in the same serialized\n * sequence), and must not call host `<perspective-viewer>` APIs from\n * inside it: an echoed `restore()` re-enters the host's public\n * surface where it is indistinguishable from a user call and forces a\n * redundant render. Host API calls to persist plugin state belong to\n * genuine user-gesture handlers (e.g. a toolbar click), never to the\n * `restore()` delivery path.\n */\n restore(config: any): void;\n\n /**\n * OPTIONAL \u2014 clear any visible user selection state (highlighted rows,\n * pinned tooltips) WITHOUT emitting selection events. The host\n * `<perspective-viewer>` invokes this when an element-level global\n * filter contributed by this plugin's selection is removed from the\n * global filter bar, so the selection visual can't outlive the filter\n * it produced. Called under the host's per-panel render serialization\n * (like `draw`), so implementations may redraw. Plugins without a\n * selection UI may omit it.\n */\n deselect?(): Promise<void>;\n\n /**\n * Free any resources acquired by this plugin and prepare to be deleted.\n */\n delete(): void;\n}\n\n/**\n * The `<perspective-viewer-plugin>` element, the default perspective plugin\n * which is registered and activated automcatically when a\n * `<perspective-viewer>` is loaded without plugins. While you will not\n * typically instantiate this class directly, it is simple enough to function\n * as a good \"default\" plugin implementation which can be extended to create\n * custom plugins.\n *\n * @example\n * ```javascript\n * class MyPlugin extends customElements.get(\"perspective-viewer-plugin\") {\n * // Custom plugin overrides\n * }\n * ```\n * @noInheritDoc\n */\nexport class HTMLPerspectiveViewerPluginElement\n extends HTMLElement\n implements IPerspectiveViewerPlugin\n{\n constructor() {\n super();\n }\n\n get_static_config(): PluginStaticConfig {\n return {\n name: \"Debug\",\n select_mode: \"select\",\n config_column_names: [],\n };\n }\n\n column_style_config(): any {\n return {};\n }\n\n async update(view: View): Promise<void> {\n return this.draw(view);\n }\n\n async draw(view: View): Promise<void> {\n this.style.backgroundColor = \"#fff\";\n const csv = await view.to_csv();\n const css = `margin:0;overflow:scroll;position:absolute;width:100%;height:100%`;\n this.innerHTML = `<pre style='${css}'>${csv}</pre>`;\n }\n\n async clear(): Promise<void> {\n this.innerHTML = \"\";\n }\n\n async resize(view: View): Promise<void> {\n // Not Implemented\n }\n\n restyle() {\n // Not Implemented\n }\n\n restore(): void {\n // Not Implemented\n }\n\n async delete(): Promise<void> {\n // Not Implemented\n }\n\n get supports_streaming(): boolean {\n return false;\n }\n}\n", "// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\n/**\n * LLM provider presets for `viewer.agentConfig()`. These are plain data \u2014\n * the agent core is provider-agnostic (one OpenAI-chat-completions protocol\n * over primitive `url`/`headers`/`apiKey` connection fields), so a\n * \"provider\" is just a spreadable collection of those fields:\n *\n * ```javascript\n * import { providers } from \"@perspective-dev/viewer\";\n * viewer.agentConfig({\n * ...providers.anthropic,\n * apiKey: \"sk-ant-...\",\n * model: \"claude-haiku-4-5\", // spread order = override order\n * });\n * ```\n *\n * Any OpenAI-compatible service works without a preset \u2014 pass its full\n * chat-completions `url` (and `apiKey`/`headers` as needed) directly.\n * Cloud presets call the provider from the browser tab; suitable for local\n * development, or route `url` through your own proxy for production.\n */\n\n/**\n * A spreadable connection preset for `viewer.agentConfig()`.\n */\nexport interface AgentProviderPreset {\n name: string;\n url: string;\n headers?: Record<string, string>;\n model?: string;\n}\n\nexport const providers = {\n /**\n * Anthropic's OpenAI-compatibility endpoint. `apiKey` required.\n */\n anthropic: {\n name: \"anthropic\",\n url: \"https://api.anthropic.com/v1/chat/completions\",\n headers: { \"anthropic-dangerous-direct-browser-access\": \"true\" },\n model: \"claude-opus-5\",\n },\n\n /**\n * Google Gemini's OpenAI-compatibility endpoint. `apiKey` required.\n */\n gemini: {\n name: \"gemini\",\n url: \"https://generativelanguage.googleapis.com/v1beta/openai/chat/completions\",\n model: \"gemini-2.5-flash\",\n },\n\n /**\n * LM Studio's local developer server (enable CORS in its settings).\n */\n lmstudio: {\n name: \"lmstudio\",\n url: \"http://localhost:1234/v1/chat/completions\",\n },\n\n /**\n * Local Ollama (set `OLLAMA_ORIGINS` for CORS).\n */\n ollama: {\n name: \"ollama\",\n url: \"http://localhost:11434/v1/chat/completions\",\n },\n\n /**\n * OpenRouter. `apiKey` required.\n */\n openrouter: {\n name: \"openrouter\",\n url: \"https://openrouter.ai/api/v1/chat/completions\",\n },\n\n /**\n * OpenAI. `apiKey` required.\n */\n openai: {\n name: \"openai\",\n url: \"https://api.openai.com/v1/chat/completions\",\n model: \"gpt-5.2\",\n },\n} as const satisfies Record<string, AgentProviderPreset>;\n", "// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\n/**\n * Cross-package helpers for per-column value formatting. Used by both\n * `viewer-datagrid` (cell formatting) and `viewer-charts` (axis ticks,\n * tooltips, legends) so a column's `number_format` / `date_format`\n * configuration produces identical output across plugins.\n *\n * The format configs mirror the `Intl.NumberFormatOptions` /\n * `Intl.DateTimeFormatOptions` shapes one-for-one \u2014 they're written\n * straight into the respective constructors. The `date_format.format`\n * discriminator (\"simple\" | \"custom\") selects between two derivation\n * paths: simple uses `dateStyle` / `timeStyle`, custom uses the\n * per-field overrides (year / month / day / ...).\n */\n\nimport type { CustomNumberFormatConfig } from \"./ts-rs/CustomNumberFormatConfig.d.ts\";\nimport type { NumberFormatStyle } from \"./ts-rs/NumberFormatStyle.d.ts\";\nimport type { Notation } from \"./ts-rs/Notation.d.ts\";\nimport type { DatetimeFormatType } from \"./ts-rs/DatetimeFormatType.d.ts\";\nimport type { SimpleDatetimeStyleConfig } from \"./ts-rs/SimpleDatetimeStyleConfig.d.ts\";\n\n/**\n * A numeric column's `number_format` (`columns_config` value), exactly as\n * the Style tab's editor WRITES it \u2014 the ts-rs projection of the Rust\n * `CustomNumberFormatConfig`, re-composed with its serde-flattened\n * `style` and `notation` families (ts-rs cannot flatten `Option<enum>`,\n * so the Rust type `#[ts(skip)]`s them and they export separately).\n */\nexport type NumberFormatConfig = CustomNumberFormatConfig &\n Partial<NumberFormatStyle> &\n Partial<Notation>;\n\n/**\n * A datetime column's `date_format` (`columns_config` value) \u2014 the Rust\n * `DatetimeFormatType` union: a `Simple` preset (`dateStyle` /\n * `timeStyle`), or per-part custom fields discriminated by\n * `format: \"custom\"`.\n */\nexport type DateFormatConfig = DatetimeFormatType;\n\n/** Narrow a [`DateFormatConfig`] to its `Simple` arm, if it is one. */\nfunction simple_config(\n cfg?: DateFormatConfig,\n): SimpleDatetimeStyleConfig | undefined {\n return cfg && !(\"format\" in cfg) ? cfg : undefined;\n}\n\n/**\n * Default `Intl.NumberFormatOptions` applied when a numeric column has no\n * `number_format` configured. Float columns get two fractional digits to\n * match the legacy datagrid behavior; integer columns get an empty\n * options bag (locale-default integer rendering).\n */\nconst NUMERIC_LEGACY_DEFAULTS: Record<string, Intl.NumberFormatOptions> = {\n float: {\n style: \"decimal\",\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n },\n};\n\n/**\n * Default `Intl.DateTimeFormatOptions` applied when a datetime column has\n * no `date_format` configured.\n */\nconst DATETIME_LEGACY_DEFAULTS: Intl.DateTimeFormatOptions = {\n dateStyle: \"short\",\n timeStyle: \"medium\",\n};\n\nconst DATE_LEGACY_DEFAULTS: Intl.DateTimeFormatOptions = {\n dateStyle: \"short\",\n};\n\nfunction mergeNumberOptions(\n base: Intl.NumberFormatOptions,\n cfg?: NumberFormatConfig,\n): Intl.NumberFormatOptions {\n const explicit: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(cfg ?? {})) {\n if (v !== undefined && v !== null) {\n explicit[k] = v;\n }\n }\n\n const merged: Record<string, unknown> = { ...base };\n if (\n \"minimumFractionDigits\" in explicit ||\n \"maximumFractionDigits\" in explicit\n ) {\n delete merged.minimumFractionDigits;\n delete merged.maximumFractionDigits;\n }\n\n if (\n \"minimumSignificantDigits\" in explicit ||\n \"maximumSignificantDigits\" in explicit\n ) {\n delete merged.minimumSignificantDigits;\n delete merged.maximumSignificantDigits;\n }\n\n return Object.assign(merged, explicit) as Intl.NumberFormatOptions;\n}\n\n/**\n * `defaults` is the calling plugin's declared default format, filling in\n * the fields `cfg` leaves unset.\n */\nexport function createNumberFormatter(\n type: string,\n cfg?: NumberFormatConfig,\n defaults?: NumberFormatConfig,\n): Intl.NumberFormat {\n // ts-rs renders serde-absent keys as `T | null`; the wire never\n // carries an explicit `null` (`skip_serializing_if`), and\n // `Intl.NumberFormat` treats both absent and `undefined` the same, so\n // the cast is presentation-only.\n const base = ((defaults as Intl.NumberFormatOptions | undefined) ??\n NUMERIC_LEGACY_DEFAULTS[type] ??\n {}) as Intl.NumberFormatOptions;\n\n const opts = cfg ? mergeNumberOptions(base, cfg) : base;\n return new Intl.NumberFormat(navigator.languages as string[], opts);\n}\n\n/**\n * `defaults` is the calling plugin's declared default `date_format`,\n * applied only when `cfg` is wholly absent.\n */\nexport function createDatetimeFormatter(\n cfg?: DateFormatConfig,\n defaults?: DateFormatConfig,\n): Intl.DateTimeFormat {\n cfg = cfg ?? defaults;\n if (!cfg || !(\"format\" in cfg)) {\n const preset = simple_config(cfg);\n const opts: Intl.DateTimeFormatOptions = {\n timeZone: preset?.timeZone ?? undefined,\n dateStyle:\n preset?.dateStyle === \"disabled\"\n ? undefined\n : (preset?.dateStyle ?? DATETIME_LEGACY_DEFAULTS.dateStyle),\n timeStyle:\n preset?.timeStyle === \"disabled\"\n ? undefined\n : (preset?.timeStyle ?? DATETIME_LEGACY_DEFAULTS.timeStyle),\n };\n\n return new Intl.DateTimeFormat(navigator.languages as string[], opts);\n }\n\n // Per-part fields are the shared `CustomDatetimeFormat` enum; the\n // editor only writes each part's `Intl`-valid subset, so the\n // narrowing casts below are presentation-only.\n const opts: Intl.DateTimeFormatOptions = {\n timeZone: cfg.timeZone ?? undefined,\n hour12: cfg.hour12 ?? true,\n fractionalSecondDigits: cfg.fractionalSecondDigits as\n | 1\n | 2\n | 3\n | undefined,\n };\n if (cfg.year !== \"disabled\") {\n opts.year = (cfg.year ??\n \"2-digit\") as Intl.DateTimeFormatOptions[\"year\"];\n }\n if (cfg.month !== \"disabled\") {\n opts.month = (cfg.month ??\n \"numeric\") as Intl.DateTimeFormatOptions[\"month\"];\n }\n if (cfg.day !== \"disabled\") {\n opts.day = (cfg.day ?? \"numeric\") as Intl.DateTimeFormatOptions[\"day\"];\n }\n if (cfg.weekday && cfg.weekday !== \"disabled\") {\n opts.weekday = cfg.weekday as Intl.DateTimeFormatOptions[\"weekday\"];\n }\n if (cfg.hour !== \"disabled\") {\n opts.hour = (cfg.hour ??\n \"numeric\") as Intl.DateTimeFormatOptions[\"hour\"];\n }\n if (cfg.minute !== \"disabled\") {\n opts.minute = (cfg.minute ??\n \"numeric\") as Intl.DateTimeFormatOptions[\"minute\"];\n }\n if (cfg.second !== \"disabled\") {\n opts.second = (cfg.second ??\n \"numeric\") as Intl.DateTimeFormatOptions[\"second\"];\n }\n return new Intl.DateTimeFormat(navigator.languages as string[], opts);\n}\n\n/**\n * `defaults` follows the same contract as\n * [`createDatetimeFormatter`]: the plugin's declared default\n * `date_format`, applied only when `cfg` is wholly absent.\n */\nexport function createDateFormatter(\n cfg?: DateFormatConfig,\n defaults?: DateFormatConfig,\n): Intl.DateTimeFormat {\n const preset = simple_config(cfg ?? defaults);\n const opts: Intl.DateTimeFormatOptions = {\n timeZone: \"utc\",\n dateStyle:\n preset?.dateStyle === \"disabled\"\n ? undefined\n : (preset?.dateStyle ?? DATE_LEGACY_DEFAULTS.dateStyle),\n };\n return new Intl.DateTimeFormat(navigator.languages as string[], opts);\n}\n\n/**\n * Recover the source column name from a synthetic split-by path. Split\n * pivoting produces paths of the form `<split_val_1>|...|<source_col>`;\n * per-column config (formatters, aggregate styling, \u2026) is always keyed\n * on the trailing source column.\n */\nexport function sourceColumn(path: string): string {\n return path.split(\"|\").at(-1) ?? path;\n}\n", "// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport type { ViewConfigUpdate, Filter } from \"@perspective-dev/client\";\n\n/**\n * The `detail` of a `perspective-global-filter` event.\n */\nexport class PerspectiveSelectDetail {\n selected: boolean;\n row: Record<string, unknown>;\n column_names?: string[];\n removeConfigs: ViewConfigUpdate[];\n insertConfigs: ViewConfigUpdate[];\n panel?: string;\n constructor(\n selected: boolean,\n row: Record<string, unknown>,\n column_names: string[],\n removeConfigs: ViewConfigUpdate[],\n insertConfigs: ViewConfigUpdate[],\n panel?: string,\n ) {\n this.selected = selected;\n this.row = row;\n this.column_names = column_names;\n this.removeConfigs = removeConfigs;\n this.insertConfigs = insertConfigs;\n this.panel = panel;\n }\n\n get removeFilters(): Filter[] {\n return this.removeConfigs.flatMap((x) => x.filter ?? []);\n }\n\n get insertFilters(): Filter[] {\n return this.insertConfigs.flatMap((x) => x.filter ?? []);\n }\n}\n", "// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\ntype ModType = {\n resize: (x: number) => number;\n memory: WebAssembly.Memory;\n compile: (x: number, y: number) => number;\n};\n\nexport async function extract(input: any) {\n let bin: WebAssembly.WebAssemblyInstantiatedSource;\n if (input instanceof Response) {\n bin = await WebAssembly.instantiateStreaming(input);\n } else if (typeof input === \"string\") {\n bin = await WebAssembly.instantiateStreaming(fetch(input));\n } else if (input instanceof ArrayBuffer) {\n bin = await WebAssembly.instantiate(input);\n } else {\n bin = input;\n }\n\n const inst = bin.instance.exports as ModType;\n const [payload] = WebAssembly.Module.customSections(\n bin.module,\n \"psp-runtime\",\n );\n\n const [raw_length_view] = WebAssembly.Module.customSections(\n bin.module,\n \"psp-len\",\n );\n\n const raw_length = new DataView(raw_length_view).getUint32(0, true);\n const ptr = inst.resize(payload.byteLength);\n new Uint8Array(inst.memory.buffer).set(new Uint8Array(payload), ptr);\n const offset = inst.compile(payload.byteLength, raw_length);\n return new Uint8Array(inst.memory.buffer).slice(\n offset,\n raw_length + offset,\n );\n}\n\nif (typeof WebAssembly === \"undefined\") {\n throw new Error(\"WebAssembly not supported.\");\n}\n\ninterface Module extends WebAssembly.Exports {\n size(): number;\n offset(): number;\n memory: WebAssembly.Memory;\n}\n\nexport async function load_wasm_stage_0(\n wasm:\n | ArrayBuffer\n | Response\n | WebAssembly.Module\n | (() => Promise<ArrayBuffer>),\n): Promise<Uint8Array> {\n if (wasm instanceof Function) {\n wasm = await wasm();\n }\n\n if (wasm instanceof Promise) {\n wasm = await wasm;\n }\n\n try {\n return await extract(wasm as ArrayBuffer);\n } catch (e) {\n console.warn(\"Stage 0 wasm loading failed, skipping\");\n return new Uint8Array(wasm as ArrayBuffer);\n }\n}\n", "var kt=Object.defineProperty;var St=(s,t)=>{for(var e in t)kt(s,e,{get:t[e],enumerable:!0})};var J={};St(J,{Client:()=>R,GenericSQLVirtualServerModel:()=>U,PerspectiveDebugPluginElement:()=>V,PerspectiveViewerElement:()=>$,ProxySession:()=>j,Table:()=>z,View:()=>I,VirtualDataSlice:()=>M,VirtualServer:()=>G,default:()=>yt,get_wasm_module:()=>At,get_worker_url:()=>Ct,init:()=>Rt,initSync:()=>ne,registerPlugin:()=>Tt});function ct(s){customElements.get(s)||customElements.define(s,class extends HTMLElement{})}var it=window.ClipboardItem;var st=window.ResizeObserver;var ut=window.IntersectionObserver;function at(s,t,e,n){if(customElements.get(t)){console.warn(`Custom element \"${t}\" is already registered; skipping duplicate registration (Perspective was loaded more than once on this page).`);return}let _=s[e],i=_.prototype;class b extends HTMLElement{constructor(){super(),this._instance=new _(this)}}let f=Object.getOwnPropertyNames(i);for(let l of f)\"get\"in Object.getOwnPropertyDescriptor(i,l)?Object.defineProperty(b.prototype,l,{get:function(){return this._instance[l]}}):Object.defineProperty(b.prototype,l,{value:function(...m){return this._instance[l].call(this._instance,...m)}});for(let l of n)Object.defineProperty(b,l,{value:function(...m){return s[l].call(s,...m)}});Object.defineProperty(b,\"__wasm_module__\",{get(){return s}}),customElements.define(t,b)}var R=class s{static __wrap(t){t=t>>>0;let e=Object.create(s.prototype);return e.__wbg_ptr=t,Q.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,Q.unregister(this),t}free(){let t=this.__destroy_into_raw();o.__wbg_client_free(t,0)}__getClassname(){try{let _=o.__wbindgen_add_to_stack_pointer(-16);o.client___getClassname(_,this.__wbg_ptr);var t=u().getInt32(_+0,!0),e=u().getInt32(_+4,!0),n=g(t,e);return t!==0&&o.__wbindgen_export4(t,e,1),n}finally{o.__wbindgen_add_to_stack_pointer(16)}}__unsafe_open_view(t){let e=v(t,o.__wbindgen_export,o.__wbindgen_export2),n=p,_=o.client___unsafe_open_view(this.__wbg_ptr,e,n);return I.__wrap(_)}get_hosted_table_names(){let t=o.client_get_hosted_table_names(this.__wbg_ptr);return a(t)}handle_error(t,e){let n=v(t,o.__wbindgen_export,o.__wbindgen_export2),_=p,i=o.client_handle_error(this.__wbg_ptr,n,_,d(e)?0:c(e));return a(i)}handle_response(t){let e=o.client_handle_response(this.__wbg_ptr,c(t));return a(e)}join(t,e,n,_){let i=v(n,o.__wbindgen_export,o.__wbindgen_export2),b=p,f=o.client_join(this.__wbg_ptr,c(t),c(e),i,b,d(_)?0:c(_));return a(f)}constructor(t,e){try{let b=o.__wbindgen_add_to_stack_pointer(-16);o.client_new(b,c(t),d(e)?0:c(e));var n=u().getInt32(b+0,!0),_=u().getInt32(b+4,!0),i=u().getInt32(b+8,!0);if(i)throw a(_);return this.__wbg_ptr=n>>>0,Q.register(this,this.__wbg_ptr,this),this}finally{o.__wbindgen_add_to_stack_pointer(16)}}new_proxy_session(t){try{let e=o.client_new_proxy_session(this.__wbg_ptr,ot(t));return j.__wrap(e)}finally{k[O++]=void 0}}on_error(t){let e=o.client_on_error(this.__wbg_ptr,c(t));return a(e)}on_hosted_tables_update(t){let e=o.client_on_hosted_tables_update(this.__wbg_ptr,c(t));return a(e)}open_table(t){let e=v(t,o.__wbindgen_export,o.__wbindgen_export2),n=p,_=o.client_open_table(this.__wbg_ptr,e,n);return a(_)}remove_hosted_tables_update(t){let e=o.client_remove_hosted_tables_update(this.__wbg_ptr,t);return a(e)}system_info(){let t=o.client_system_info(this.__wbg_ptr);return a(t)}table(t,e){let n=o.client_table(this.__wbg_ptr,c(t),d(e)?0:c(e));return a(n)}terminate(){try{let _=o.__wbindgen_add_to_stack_pointer(-16);o.client_terminate(_,this.__wbg_ptr);var t=u().getInt32(_+0,!0),e=u().getInt32(_+4,!0),n=u().getInt32(_+8,!0);if(n)throw a(e);return a(t)}finally{o.__wbindgen_add_to_stack_pointer(16)}}};Symbol.dispose&&(R.prototype[Symbol.dispose]=R.prototype.free);var U=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,ft.unregister(this),t}free(){let t=this.__destroy_into_raw();o.__wbg_genericsqlvirtualservermodel_free(t,0)}expressionDescribe(t,e){try{let l=o.__wbindgen_add_to_stack_pointer(-16),m=v(t,o.__wbindgen_export,o.__wbindgen_export2),h=p,y=v(e,o.__wbindgen_export,o.__wbindgen_export2),x=p;o.genericsqlvirtualservermodel_expressionDescribe(l,this.__wbg_ptr,m,h,y,x);var n=u().getInt32(l+0,!0),_=u().getInt32(l+4,!0),i=u().getInt32(l+8,!0),b=u().getInt32(l+12,!0);if(b)throw a(i);var f=g(n,_);return n!==0&&o.__wbindgen_export4(n,_,1),f}finally{o.__wbindgen_add_to_stack_pointer(16)}}expressionsDescribe(t,e){try{let l=o.__wbindgen_add_to_stack_pointer(-16),m=v(t,o.__wbindgen_export,o.__wbindgen_export2),h=p;o.genericsqlvirtualservermodel_expressionsDescribe(l,this.__wbg_ptr,m,h,c(e));var n=u().getInt32(l+0,!0),_=u().getInt32(l+4,!0),i=u().getInt32(l+8,!0),b=u().getInt32(l+12,!0);if(b)throw a(i);var f=g(n,_);return n!==0&&o.__wbindgen_export4(n,_,1),f}finally{o.__wbindgen_add_to_stack_pointer(16)}}getHostedTables(){try{let b=o.__wbindgen_add_to_stack_pointer(-16);o.genericsqlvirtualservermodel_getHostedTables(b,this.__wbg_ptr);var t=u().getInt32(b+0,!0),e=u().getInt32(b+4,!0),n=u().getInt32(b+8,!0),_=u().getInt32(b+12,!0);if(_)throw a(n);var i=g(t,e);return t!==0&&o.__wbindgen_export4(t,e,1),i}finally{o.__wbindgen_add_to_stack_pointer(16)}}constructor(t){try{let i=o.__wbindgen_add_to_stack_pointer(-16);o.genericsqlvirtualservermodel_new(i,d(t)?0:c(t));var e=u().getInt32(i+0,!0),n=u().getInt32(i+4,!0),_=u().getInt32(i+8,!0);if(_)throw a(n);return this.__wbg_ptr=e>>>0,ft.register(this,this.__wbg_ptr,this),this}finally{o.__wbindgen_add_to_stack_pointer(16)}}tableDescribe(t,e,n){try{let m=o.__wbindgen_add_to_stack_pointer(-16),h=v(t,o.__wbindgen_export,o.__wbindgen_export2),y=p;o.genericsqlvirtualservermodel_tableDescribe(m,this.__wbg_ptr,h,y,c(e),c(n));var _=u().getInt32(m+0,!0),i=u().getInt32(m+4,!0),b=u().getInt32(m+8,!0),f=u().getInt32(m+12,!0);if(f)throw a(b);var l=g(_,i);return _!==0&&o.__wbindgen_export4(_,i,1),l}finally{o.__wbindgen_add_to_stack_pointer(16)}}tableMakeView(t,e,n,_){try{let h=o.__wbindgen_add_to_stack_pointer(-16),y=v(t,o.__wbindgen_export,o.__wbindgen_export2),x=p,A=v(e,o.__wbindgen_export,o.__wbindgen_export2),L=p;o.genericsqlvirtualservermodel_tableMakeView(h,this.__wbg_ptr,y,x,A,L,c(n),c(_));var i=u().getInt32(h+0,!0),b=u().getInt32(h+4,!0),f=u().getInt32(h+8,!0),l=u().getInt32(h+12,!0);if(l)throw a(f);var m=g(i,b);return i!==0&&o.__wbindgen_export4(i,b,1),m}finally{o.__wbindgen_add_to_stack_pointer(16)}}tableSchema(t){try{let f=o.__wbindgen_add_to_stack_pointer(-16),l=v(t,o.__wbindgen_export,o.__wbindgen_export2),m=p;o.genericsqlvirtualservermodel_tableSchema(f,this.__wbg_ptr,l,m);var e=u().getInt32(f+0,!0),n=u().getInt32(f+4,!0),_=u().getInt32(f+8,!0),i=u().getInt32(f+12,!0);if(i)throw a(_);var b=g(e,n);return e!==0&&o.__wbindgen_export4(e,n,1),b}finally{o.__wbindgen_add_to_stack_pointer(16)}}tableSize(t){try{let f=o.__wbindgen_add_to_stack_pointer(-16),l=v(t,o.__wbindgen_export,o.__wbindgen_export2),m=p;o.genericsqlvirtualservermodel_tableSize(f,this.__wbg_ptr,l,m);var e=u().getInt32(f+0,!0),n=u().getInt32(f+4,!0),_=u().getInt32(f+8,!0),i=u().getInt32(f+12,!0);if(i)throw a(_);var b=g(e,n);return e!==0&&o.__wbindgen_export4(e,n,1),b}finally{o.__wbindgen_add_to_stack_pointer(16)}}viewColumnSize(t){try{let f=o.__wbindgen_add_to_stack_pointer(-16),l=v(t,o.__wbindgen_export,o.__wbindgen_export2),m=p;o.genericsqlvirtualservermodel_viewColumnSize(f,this.__wbg_ptr,l,m);var e=u().getInt32(f+0,!0),n=u().getInt32(f+4,!0),_=u().getInt32(f+8,!0),i=u().getInt32(f+12,!0);if(i)throw a(_);var b=g(e,n);return e!==0&&o.__wbindgen_export4(e,n,1),b}finally{o.__wbindgen_add_to_stack_pointer(16)}}viewDelete(t){try{let f=o.__wbindgen_add_to_stack_pointer(-16),l=v(t,o.__wbindgen_export,o.__wbindgen_export2),m=p;o.genericsqlvirtualservermodel_viewDelete(f,this.__wbg_ptr,l,m);var e=u().getInt32(f+0,!0),n=u().getInt32(f+4,!0),_=u().getInt32(f+8,!0),i=u().getInt32(f+12,!0);if(i)throw a(_);var b=g(e,n);return e!==0&&o.__wbindgen_export4(e,n,1),b}finally{o.__wbindgen_add_to_stack_pointer(16)}}viewGetData(t,e,n,_){try{let h=o.__wbindgen_add_to_stack_pointer(-16),y=v(t,o.__wbindgen_export,o.__wbindgen_export2),x=p;o.genericsqlvirtualservermodel_viewGetData(h,this.__wbg_ptr,y,x,c(e),c(n),c(_));var i=u().getInt32(h+0,!0),b=u().getInt32(h+4,!0),f=u().getInt32(h+8,!0),l=u().getInt32(h+12,!0);if(l)throw a(f);var m=g(i,b);return i!==0&&o.__wbindgen_export4(i,b,1),m}finally{o.__wbindgen_add_to_stack_pointer(16)}}viewGetMinMax(t,e,n){try{let m=o.__wbindgen_add_to_stack_pointer(-16),h=v(t,o.__wbindgen_export,o.__wbindgen_export2),y=p,x=v(e,o.__wbindgen_export,o.__wbindgen_export2),A=p;o.genericsqlvirtualservermodel_viewGetMinMax(m,this.__wbg_ptr,h,y,x,A,c(n));var _=u().getInt32(m+0,!0),i=u().getInt32(m+4,!0),b=u().getInt32(m+8,!0),f=u().getInt32(m+12,!0);if(f)throw a(b);var l=g(_,i);return _!==0&&o.__wbindgen_export4(_,i,1),l}finally{o.__wbindgen_add_to_stack_pointer(16)}}viewMakeTable(t,e,n,_,i){try{let y=o.__wbindgen_add_to_stack_pointer(-16),x=v(t,o.__wbindgen_export,o.__wbindgen_export2),A=p,L=v(e,o.__wbindgen_export,o.__wbindgen_export2),K=p;o.genericsqlvirtualservermodel_viewMakeTable(y,this.__wbg_ptr,x,A,L,K,c(n),c(_),c(i));var b=u().getInt32(y+0,!0),f=u().getInt32(y+4,!0),l=u().getInt32(y+8,!0),m=u().getInt32(y+12,!0);if(m)throw a(l);var h=g(b,f);return b!==0&&o.__wbindgen_export4(b,f,1),h}finally{o.__wbindgen_add_to_stack_pointer(16)}}viewSchema(t){try{let f=o.__wbindgen_add_to_stack_pointer(-16),l=v(t,o.__wbindgen_export,o.__wbindgen_export2),m=p;o.genericsqlvirtualservermodel_viewSchema(f,this.__wbg_ptr,l,m);var e=u().getInt32(f+0,!0),n=u().getInt32(f+4,!0),_=u().getInt32(f+8,!0),i=u().getInt32(f+12,!0);if(i)throw a(_);var b=g(e,n);return e!==0&&o.__wbindgen_export4(e,n,1),b}finally{o.__wbindgen_add_to_stack_pointer(16)}}viewSize(t){try{let f=o.__wbindgen_add_to_stack_pointer(-16),l=v(t,o.__wbindgen_export,o.__wbindgen_export2),m=p;o.genericsqlvirtualservermodel_viewSize(f,this.__wbg_ptr,l,m);var e=u().getInt32(f+0,!0),n=u().getInt32(f+4,!0),_=u().getInt32(f+8,!0),i=u().getInt32(f+12,!0);if(i)throw a(_);var b=g(e,n);return e!==0&&o.__wbindgen_export4(e,n,1),b}finally{o.__wbindgen_add_to_stack_pointer(16)}}};Symbol.dispose&&(U.prototype[Symbol.dispose]=U.prototype.free);var V=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,gt.unregister(this),t}free(){let t=this.__destroy_into_raw();o.__wbg_perspectivedebugpluginelement_free(t,0)}clear(){let t=o.perspectivedebugpluginelement_clear(this.__wbg_ptr);return a(t)}get config_column_names(){let t=o.perspectivedebugpluginelement_config_column_names(this.__wbg_ptr);return a(t)}connectedCallback(){o.perspectivedebugpluginelement_connectedCallback(this.__wbg_ptr)}delete(){let t=o.perspectivedebugpluginelement_clear(this.__wbg_ptr);return a(t)}draw(t){rt(t,I);let e=o.perspectivedebugpluginelement_draw(this.__wbg_ptr,t.__wbg_ptr);return a(e)}get min_config_columns(){let t=o.perspectivedebugpluginelement_config_column_names(this.__wbg_ptr);return a(t)}get name(){try{let _=o.__wbindgen_add_to_stack_pointer(-16);o.perspectivedebugpluginelement_name(_,this.__wbg_ptr);var t=u().getInt32(_+0,!0),e=u().getInt32(_+4,!0),n=g(t,e);return t!==0&&o.__wbindgen_export4(t,e,1),n}finally{o.__wbindgen_add_to_stack_pointer(16)}}constructor(t){let e=o.perspectivedebugpluginelement_new(c(t));return this.__wbg_ptr=e>>>0,gt.register(this,this.__wbg_ptr,this),this}resize(){let t=o.perspectivedebugpluginelement_clear(this.__wbg_ptr);return a(t)}restore(t){try{let _=o.__wbindgen_add_to_stack_pointer(-16);o.perspectivedebugpluginelement_restore(_,this.__wbg_ptr,d(t)?0:c(t));var e=u().getInt32(_+0,!0),n=u().getInt32(_+4,!0);if(n)throw a(e)}finally{o.__wbindgen_add_to_stack_pointer(16)}}restyle(){o.perspectivedebugpluginelement_connectedCallback(this.__wbg_ptr)}save(){try{let _=o.__wbindgen_add_to_stack_pointer(-16);o.perspectivedebugpluginelement_save(_,this.__wbg_ptr);var t=u().getInt32(_+0,!0),e=u().getInt32(_+4,!0),n=u().getInt32(_+8,!0);if(n)throw a(e);return a(t)}finally{o.__wbindgen_add_to_stack_pointer(16)}}get select_mode(){try{let _=o.__wbindgen_add_to_stack_pointer(-16);o.perspectivedebugpluginelement_select_mode(_,this.__wbg_ptr);var t=u().getInt32(_+0,!0),e=u().getInt32(_+4,!0),n=g(t,e);return t!==0&&o.__wbindgen_export4(t,e,1),n}finally{o.__wbindgen_add_to_stack_pointer(16)}}update(t){rt(t,I);let e=o.perspectivedebugpluginelement_update(this.__wbg_ptr,t.__wbg_ptr);return a(e)}};Symbol.dispose&&(V.prototype[Symbol.dispose]=V.prototype.free);var $=class s{static __wrap(t){t=t>>>0;let e=Object.create(s.prototype);return e.__wbg_ptr=t,Z.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,Z.unregister(this),t}free(){let t=this.__destroy_into_raw();o.__wbg_perspectiveviewerelement_free(t,0)}__get_model(){let t=o.perspectiveviewerelement___get_model(this.__wbg_ptr);return s.__wrap(t)}addPanel(t,e){let n=o.perspectiveviewerelement_addPanel(this.__wbg_ptr,c(t),d(e)?0:c(e));return a(n)}agentConfig(t){try{let _=o.__wbindgen_add_to_stack_pointer(-16);o.perspectiveviewerelement_agentConfig(_,this.__wbg_ptr,c(t));var e=u().getInt32(_+0,!0),n=u().getInt32(_+4,!0);if(n)throw a(e)}finally{o.__wbindgen_add_to_stack_pointer(16)}}agentPrompt(t){let e=v(t,o.__wbindgen_export,o.__wbindgen_export2),n=p,_=o.perspectiveviewerelement_agentPrompt(this.__wbg_ptr,e,n);return a(_)}agentReset(){let t=o.perspectiveviewerelement_agentReset(this.__wbg_ptr);return a(t)}connectedCallback(){try{let n=o.__wbindgen_add_to_stack_pointer(-16);o.perspectiveviewerelement_connectedCallback(n,this.__wbg_ptr);var t=u().getInt32(n+0,!0),e=u().getInt32(n+4,!0);if(e)throw a(t)}finally{o.__wbindgen_add_to_stack_pointer(16)}}copy(t){let e=o.perspectiveviewerelement_copy(this.__wbg_ptr,d(t)?0:c(t));return a(e)}delete(){let t=this.__destroy_into_raw(),e=o.perspectiveviewerelement_delete(t);return a(e)}download(t){let e=o.perspectiveviewerelement_download(this.__wbg_ptr,d(t)?0:c(t));return a(e)}eject(t){let e=o.perspectiveviewerelement_eject(this.__wbg_ptr,d(t)?0:c(t));return a(e)}export(t){let e=o.perspectiveviewerelement_export(this.__wbg_ptr,d(t)?0:c(t));return a(e)}flush(){let t=o.perspectiveviewerelement_flush(this.__wbg_ptr);return a(t)}getActivePanel(){let t=o.perspectiveviewerelement_getActivePanel(this.__wbg_ptr);return a(t)}getAllPlugins(){let t=o.perspectiveviewerelement_getAllPlugins(this.__wbg_ptr);return a(t)}getClient(t){let e=o.perspectiveviewerelement_getClient(this.__wbg_ptr,d(t)?0:c(t));return a(e)}getEditPort(t){try{let i=o.__wbindgen_add_to_stack_pointer(-16);o.perspectiveviewerelement_getEditPort(i,this.__wbg_ptr,d(t)?0:c(t));var e=u().getFloat64(i+0,!0),n=u().getInt32(i+8,!0),_=u().getInt32(i+12,!0);if(_)throw a(n);return e}finally{o.__wbindgen_add_to_stack_pointer(16)}}getPanelNames(){let t=o.perspectiveviewerelement_getPanelNames(this.__wbg_ptr);return a(t)}getPlugin(t){try{let f=o.__wbindgen_add_to_stack_pointer(-16);var e=d(t)?0:v(t,o.__wbindgen_export,o.__wbindgen_export2),n=p;o.perspectiveviewerelement_getPlugin(f,this.__wbg_ptr,e,n);var _=u().getInt32(f+0,!0),i=u().getInt32(f+4,!0),b=u().getInt32(f+8,!0);if(b)throw a(i);return a(_)}finally{o.__wbindgen_add_to_stack_pointer(16)}}getRenderStats(t){try{let i=o.__wbindgen_add_to_stack_pointer(-16);o.perspectiveviewerelement_getRenderStats(i,this.__wbg_ptr,d(t)?0:c(t));var e=u().getInt32(i+0,!0),n=u().getInt32(i+4,!0),_=u().getInt32(i+8,!0);if(_)throw a(n);return a(e)}finally{o.__wbindgen_add_to_stack_pointer(16)}}getSelection(t){try{let i=o.__wbindgen_add_to_stack_pointer(-16);o.perspectiveviewerelement_getSelection(i,this.__wbg_ptr,d(t)?0:c(t));var e=u().getInt32(i+0,!0),n=u().getInt32(i+4,!0),_=u().getInt32(i+8,!0);if(_)throw a(n);return a(e)}finally{o.__wbindgen_add_to_stack_pointer(16)}}getTable(t){let e=o.perspectiveviewerelement_getTable(this.__wbg_ptr,d(t)?0:c(t));return a(e)}getThemes(){let t=o.perspectiveviewerelement_getThemes(this.__wbg_ptr);return a(t)}getView(t){let e=o.perspectiveviewerelement_getView(this.__wbg_ptr,d(t)?0:c(t));return a(e)}getViewConfig(t){let e=o.perspectiveviewerelement_getViewConfig(this.__wbg_ptr,d(t)?0:c(t));return a(e)}load(t){try{let i=o.__wbindgen_add_to_stack_pointer(-16);o.perspectiveviewerelement_load(i,this.__wbg_ptr,c(t));var e=u().getInt32(i+0,!0),n=u().getInt32(i+4,!0),_=u().getInt32(i+8,!0);if(_)throw a(n);return a(e)}finally{o.__wbindgen_add_to_stack_pointer(16)}}constructor(t){let e=o.perspectiveviewerelement_new(c(t));return this.__wbg_ptr=e>>>0,Z.register(this,this.__wbg_ptr,this),this}removePanel(t){let e=v(t,o.__wbindgen_export,o.__wbindgen_export2),n=p,_=o.perspectiveviewerelement_removePanel(this.__wbg_ptr,e,n);return a(_)}reset(t,e){let n=o.perspectiveviewerelement_reset(this.__wbg_ptr,d(t)?16777215:t?1:0,d(e)?0:c(e));return a(n)}resetError(){let t=o.perspectiveviewerelement_resetError(this.__wbg_ptr);return a(t)}resetThemes(t){var e=d(t)?0:Kt(t,o.__wbindgen_export),n=p;let _=o.perspectiveviewerelement_resetThemes(this.__wbg_ptr,e,n);return a(_)}resize(t){let e=o.perspectiveviewerelement_resize(this.__wbg_ptr,d(t)?0:c(t));return a(e)}restore(t,e){let n=o.perspectiveviewerelement_restore(this.__wbg_ptr,c(t),d(e)?0:c(e));return a(n)}restoreWorkspace(t,e){let n=o.perspectiveviewerelement_restoreWorkspace(this.__wbg_ptr,c(t),d(e)?0:c(e));return a(n)}restyleElement(){let t=o.perspectiveviewerelement_restyleElement(this.__wbg_ptr);return a(t)}save(t){let e=o.perspectiveviewerelement_save(this.__wbg_ptr,d(t)?0:c(t));return a(e)}saveWorkspace(t){let e=o.perspectiveviewerelement_saveWorkspace(this.__wbg_ptr,d(t)?0:c(t));return a(e)}setActivePanel(t){let e=v(t,o.__wbindgen_export,o.__wbindgen_export2),n=p,_=o.perspectiveviewerelement_setActivePanel(this.__wbg_ptr,e,n);return a(_)}setAutoPause(t){let e=o.perspectiveviewerelement_setAutoPause(this.__wbg_ptr,t);return a(e)}setAutoSize(t){o.perspectiveviewerelement_setAutoSize(this.__wbg_ptr,t)}setSelection(t,e){try{let i=o.__wbindgen_add_to_stack_pointer(-16);o.perspectiveviewerelement_setSelection(i,this.__wbg_ptr,d(t)?0:c(t),d(e)?0:c(e));var n=u().getInt32(i+0,!0),_=u().getInt32(i+4,!0);if(_)throw a(n)}finally{o.__wbindgen_add_to_stack_pointer(16)}}setThrottle(t){o.perspectiveviewerelement_setThrottle(this.__wbg_ptr,!d(t),d(t)?0:t)}toggleColumnSettings(t,e){let n=v(t,o.__wbindgen_export,o.__wbindgen_export2),_=p,i=o.perspectiveviewerelement_toggleColumnSettings(this.__wbg_ptr,n,_,d(e)?0:c(e));return a(i)}toggleConfig(t){let e=o.perspectiveviewerelement_toggleConfig(this.__wbg_ptr,d(t)?16777215:t?1:0);return a(e)}};Symbol.dispose&&($.prototype[Symbol.dispose]=$.prototype.free);var j=class s{static __wrap(t){t=t>>>0;let e=Object.create(s.prototype);return e.__wbg_ptr=t,tt.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,tt.unregister(this),t}free(){let t=this.__destroy_into_raw();o.__wbg_proxysession_free(t,0)}close(){let t=this.__destroy_into_raw(),e=o.proxysession_close(t);return a(e)}handle_request(t){let e=o.proxysession_handle_request(this.__wbg_ptr,c(t));return a(e)}constructor(t,e){try{rt(t,R);let n=o.proxysession_new(t.__wbg_ptr,ot(e));return this.__wbg_ptr=n>>>0,tt.register(this,this.__wbg_ptr,this),this}finally{k[O++]=void 0}}};Symbol.dispose&&(j.prototype[Symbol.dispose]=j.prototype.free);var z=class s{static __wrap(t){t=t>>>0;let e=Object.create(s.prototype);return e.__wbg_ptr=t,dt.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,dt.unregister(this),t}free(){let t=this.__destroy_into_raw();o.__wbg_table_free(t,0)}__getClassname(){try{let _=o.__wbindgen_add_to_stack_pointer(-16);o.table___getClassname(_,this.__wbg_ptr);var t=u().getInt32(_+0,!0),e=u().getInt32(_+4,!0),n=g(t,e);return t!==0&&o.__wbindgen_export4(t,e,1),n}finally{o.__wbindgen_add_to_stack_pointer(16)}}clear(){let t=o.table_clear(this.__wbg_ptr);return a(t)}columns(){let t=o.table_columns(this.__wbg_ptr);return a(t)}delete(t){let e=this.__destroy_into_raw(),n=o.table_delete(e,d(t)?0:c(t));return a(n)}describe(t){let e=o.table_describe(this.__wbg_ptr,d(t)?0:c(t));return a(e)}get_client(){let t=o.table_get_client(this.__wbg_ptr);return a(t)}get_index(){let t=o.table_get_index(this.__wbg_ptr);return a(t)}get_limit(){let t=o.table_get_limit(this.__wbg_ptr);return a(t)}get_name(){let t=o.table_get_name(this.__wbg_ptr);return a(t)}make_port(){let t=o.table_make_port(this.__wbg_ptr);return a(t)}on_delete(t){let e=o.table_on_delete(this.__wbg_ptr,c(t));return a(e)}remove(t,e){let n=o.table_remove(this.__wbg_ptr,c(t),d(e)?0:c(e));return a(n)}remove_delete(t){let e=o.table_remove_delete(this.__wbg_ptr,t);return a(e)}replace(t,e){let n=o.table_replace(this.__wbg_ptr,c(t),d(e)?0:c(e));return a(n)}schema(){let t=o.table_schema(this.__wbg_ptr);return a(t)}size(){let t=o.table_size(this.__wbg_ptr);return a(t)}update(t,e){let n=o.table_update(this.__wbg_ptr,c(t),d(e)?0:c(e));return a(n)}validate_expressions(t){let e=o.table_validate_expressions(this.__wbg_ptr,c(t));return a(e)}view(t){let e=o.table_view(this.__wbg_ptr,d(t)?0:c(t));return a(e)}};Symbol.dispose&&(z.prototype[Symbol.dispose]=z.prototype.free);var I=class s{static __wrap(t){t=t>>>0;let e=Object.create(s.prototype);return e.__wbg_ptr=t,wt.register(e,e.__wbg_ptr,e),e}static __unwrap(t){return t instanceof s?t.__destroy_into_raw():0}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,wt.unregister(this),t}free(){let t=this.__destroy_into_raw();o.__wbg_view_free(t,0)}__get_model(){let t=o.view___get_model(this.__wbg_ptr);return s.__wrap(t)}__unsafe_get_name(){try{let _=o.__wbindgen_add_to_stack_pointer(-16);o.view___unsafe_get_name(_,this.__wbg_ptr);var t=u().getInt32(_+0,!0),e=u().getInt32(_+4,!0),n=g(t,e);return t!==0&&o.__wbindgen_export4(t,e,1),n}finally{o.__wbindgen_add_to_stack_pointer(16)}}collapse(t){let e=o.view_collapse(this.__wbg_ptr,t);return a(e)}column_paths(t){let e=o.view_column_paths(this.__wbg_ptr,d(t)?0:c(t));return a(e)}delete(){let t=this.__destroy_into_raw(),e=o.view_delete(t);return a(e)}dimensions(){let t=o.view_dimensions(this.__wbg_ptr);return a(t)}expand(t){let e=o.view_expand(this.__wbg_ptr,t);return a(e)}expression_schema(){let t=o.view_expression_schema(this.__wbg_ptr);return a(t)}get_config(){let t=o.view_get_config(this.__wbg_ptr);return a(t)}get_min_max(t){let e=v(t,o.__wbindgen_export,o.__wbindgen_export2),n=p,_=o.view_get_min_max(this.__wbg_ptr,e,n);return a(_)}num_columns(){let t=o.view_num_columns(this.__wbg_ptr);return a(t)}num_rows(){let t=o.view_num_rows(this.__wbg_ptr);return a(t)}on_delete(t){let e=o.view_on_delete(this.__wbg_ptr,c(t));return a(e)}on_remove(t){let e=o.view_on_remove(this.__wbg_ptr,c(t));return a(e)}on_update(t,e){let n=o.view_on_update(this.__wbg_ptr,c(t),d(e)?0:c(e));return a(n)}remove_delete(t){let e=o.view_remove_delete(this.__wbg_ptr,t);return a(e)}remove_remove(t){let e=o.view_remove_remove(this.__wbg_ptr,t);return a(e)}remove_update(t){let e=o.view_remove_update(this.__wbg_ptr,t);return a(e)}schema(){let t=o.view_schema(this.__wbg_ptr);return a(t)}set_depth(t){let e=o.view_set_depth(this.__wbg_ptr,t);return a(e)}to_arrow(t){let e=o.view_to_arrow(this.__wbg_ptr,d(t)?0:c(t));return a(e)}to_columns(t){let e=o.view_to_columns(this.__wbg_ptr,d(t)?0:c(t));return a(e)}to_columns_string(t){let e=o.view_to_columns_string(this.__wbg_ptr,d(t)?0:c(t));return a(e)}to_csv(t){let e=o.view_to_csv(this.__wbg_ptr,d(t)?0:c(t));return a(e)}to_json(t){let e=o.view_to_json(this.__wbg_ptr,d(t)?0:c(t));return a(e)}to_json_string(t){let e=o.view_to_json_string(this.__wbg_ptr,d(t)?0:c(t));return a(e)}to_ndjson(t){let e=o.view_to_ndjson(this.__wbg_ptr,d(t)?0:c(t));return a(e)}with_typed_arrays(t,e){let n=o.view_with_typed_arrays(this.__wbg_ptr,d(t)?0:c(t),c(e));return a(n)}};Symbol.dispose&&(I.prototype[Symbol.dispose]=I.prototype.free);var M=class s{static __wrap(t){t=t>>>0;let e=Object.create(s.prototype);return e.__wbg_ptr=t,et.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,et.unregister(this),t}free(){let t=this.__destroy_into_raw();o.__wbg_virtualdataslice_free(t,0)}fromArrowIpc(t){try{let _=o.__wbindgen_add_to_stack_pointer(-16);o.virtualdataslice_fromArrowIpc(_,this.__wbg_ptr,c(t));var e=u().getInt32(_+0,!0),n=u().getInt32(_+4,!0);if(n)throw a(e)}finally{o.__wbindgen_add_to_stack_pointer(16)}}constructor(t){let e=o.virtualdataslice_new(c(t));return this.__wbg_ptr=e>>>0,et.register(this,this.__wbg_ptr,this),this}setBooleanCol(t,e,n,_){try{let f=o.__wbindgen_add_to_stack_pointer(-16),l=v(t,o.__wbindgen_export,o.__wbindgen_export2),m=p;o.virtualdataslice_setBooleanCol(f,this.__wbg_ptr,l,m,e,c(n),d(_)?4294967297:_>>>0);var i=u().getInt32(f+0,!0),b=u().getInt32(f+4,!0);if(b)throw a(i)}finally{o.__wbindgen_add_to_stack_pointer(16)}}setCol(t,e,n,_,i){try{let l=o.__wbindgen_add_to_stack_pointer(-16),m=v(t,o.__wbindgen_export,o.__wbindgen_export2),h=p,y=v(e,o.__wbindgen_export,o.__wbindgen_export2),x=p;o.virtualdataslice_setCol(l,this.__wbg_ptr,m,h,y,x,n,c(_),d(i)?4294967297:i>>>0);var b=u().getInt32(l+0,!0),f=u().getInt32(l+4,!0);if(f)throw a(b)}finally{o.__wbindgen_add_to_stack_pointer(16)}}setDatetimeCol(t,e,n,_){try{let f=o.__wbindgen_add_to_stack_pointer(-16),l=v(t,o.__wbindgen_export,o.__wbindgen_export2),m=p;o.virtualdataslice_setDatetimeCol(f,this.__wbg_ptr,l,m,e,c(n),d(_)?4294967297:_>>>0);var i=u().getInt32(f+0,!0),b=u().getInt32(f+4,!0);if(b)throw a(i)}finally{o.__wbindgen_add_to_stack_pointer(16)}}setFloatCol(t,e,n,_){try{let f=o.__wbindgen_add_to_stack_pointer(-16),l=v(t,o.__wbindgen_export,o.__wbindgen_export2),m=p;o.virtualdataslice_setFloatCol(f,this.__wbg_ptr,l,m,e,c(n),d(_)?4294967297:_>>>0);var i=u().getInt32(f+0,!0),b=u().getInt32(f+4,!0);if(b)throw a(i)}finally{o.__wbindgen_add_to_stack_pointer(16)}}setIntegerCol(t,e,n,_){try{let f=o.__wbindgen_add_to_stack_pointer(-16),l=v(t,o.__wbindgen_export,o.__wbindgen_export2),m=p;o.virtualdataslice_setIntegerCol(f,this.__wbg_ptr,l,m,e,c(n),d(_)?4294967297:_>>>0);var i=u().getInt32(f+0,!0),b=u().getInt32(f+4,!0);if(b)throw a(i)}finally{o.__wbindgen_add_to_stack_pointer(16)}}setStringCol(t,e,n,_){try{let f=o.__wbindgen_add_to_stack_pointer(-16),l=v(t,o.__wbindgen_export,o.__wbindgen_export2),m=p;o.virtualdataslice_setStringCol(f,this.__wbg_ptr,l,m,e,c(n),d(_)?4294967297:_>>>0);var i=u().getInt32(f+0,!0),b=u().getInt32(f+4,!0);if(b)throw a(i)}finally{o.__wbindgen_add_to_stack_pointer(16)}}};Symbol.dispose&&(M.prototype[Symbol.dispose]=M.prototype.free);var G=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,lt.unregister(this),t}free(){let t=this.__destroy_into_raw();o.__wbg_virtualserver_free(t,0)}handleRequest(t){let e=Yt(t,o.__wbindgen_export),n=p,_=o.virtualserver_handleRequest(this.__wbg_ptr,e,n);return a(_)}constructor(t){try{let i=o.__wbindgen_add_to_stack_pointer(-16);o.virtualserver_new(i,c(t));var e=u().getInt32(i+0,!0),n=u().getInt32(i+4,!0),_=u().getInt32(i+8,!0);if(_)throw a(n);return this.__wbg_ptr=e>>>0,lt.register(this,this.__wbg_ptr,this),this}finally{o.__wbindgen_add_to_stack_pointer(16)}}};Symbol.dispose&&(G.prototype[Symbol.dispose]=G.prototype.free);function At(){try{let n=o.__wbindgen_add_to_stack_pointer(-16);o.get_wasm_module(n);var s=u().getInt32(n+0,!0),t=u().getInt32(n+4,!0),e=u().getInt32(n+8,!0);if(e)throw a(t);return a(s)}finally{o.__wbindgen_add_to_stack_pointer(16)}}function Ct(){try{let n=o.__wbindgen_add_to_stack_pointer(-16);o.get_worker_url(n);var s=u().getInt32(n+0,!0),t=u().getInt32(n+4,!0),e=u().getInt32(n+8,!0);if(e)throw a(t);return a(s)}finally{o.__wbindgen_add_to_stack_pointer(16)}}function Rt(s,t){o.init(c(s),c(t))}function Tt(s){let t=v(s,o.__wbindgen_export,o.__wbindgen_export2),e=p;o.registerPlugin(t,e)}function mt(){return{__proto__:null,\"./perspective-viewer.wasm_bg.js\":{__proto__:null,__wbg_Error_8c4e43fe74559d73:function(t,e){var n=g(t,e);let _=Error(n);return c(_)},__wbg_Number_04624de7d0e8332d:function(t){return Number(r(t))},__wbg_String_8f0eb39a4a4c2f66:function(t,e){let n=String(r(e)),_=v(n,o.__wbindgen_export,o.__wbindgen_export2),i=p;u().setInt32(t+4,i,!0),u().setInt32(t+0,_,!0)},__wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2:function(t,e){let n=r(e),_=typeof n==\"bigint\"?n:void 0;u().setBigInt64(t+8,d(_)?BigInt(0):_,!0),u().setInt32(t+0,!d(_),!0)},__wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25:function(t){let e=r(t),n=typeof e==\"boolean\"?e:void 0;return d(n)?16777215:n?1:0},__wbg___wbindgen_debug_string_0bc8482c6e3508ae:function(t,e){let n=_t(r(e)),_=v(n,o.__wbindgen_export,o.__wbindgen_export2),i=p;u().setInt32(t+4,i,!0),u().setInt32(t+0,_,!0)},__wbg___wbindgen_in_47fa6863be6f2f25:function(t,e){return r(t)in r(e)},__wbg___wbindgen_is_bigint_31b12575b56f32fc:function(t){return typeof r(t)==\"bigint\"},__wbg___wbindgen_is_function_0095a73b8b156f76:function(t){return typeof r(t)==\"function\"},__wbg___wbindgen_is_null_ac34f5003991759a:function(t){return r(t)===null},__wbg___wbindgen_is_object_5ae8e5880f2c1fbd:function(t){let e=r(t);return typeof e==\"object\"&&e!==null},__wbg___wbindgen_is_string_cd444516edc5b180:function(t){return typeof r(t)==\"string\"},__wbg___wbindgen_is_undefined_9e4d92534c42d778:function(t){return r(t)===void 0},__wbg___wbindgen_jsval_eq_11888390b0186270:function(t,e){return r(t)===r(e)},__wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811:function(t,e){return r(t)==r(e)},__wbg___wbindgen_number_get_8ff4255516ccad3e:function(t,e){let n=r(e),_=typeof n==\"number\"?n:void 0;u().setFloat64(t+8,d(_)?0:_,!0),u().setInt32(t+0,!d(_),!0)},__wbg___wbindgen_string_get_72fb696202c56729:function(t,e){let n=r(e),_=typeof n==\"string\"?n:void 0;var i=d(_)?0:v(_,o.__wbindgen_export,o.__wbindgen_export2),b=p;u().setInt32(t+4,b,!0),u().setInt32(t+0,i,!0)},__wbg___wbindgen_throw_be289d5034ed271b:function(t,e){var n=g(t,e);throw new Error(n)},__wbg__wbg_cb_unref_d9b87ff7982e3b21:function(t){r(t)._wbg_cb_unref()},__wbg_abort_2f0584e03e8e3950:function(t){r(t).abort()},__wbg_addEventListener_3acb0aad4483804c:function(){return w(function(t,e,n,_){var i=g(e,n);r(t).addEventListener(i,r(_))},arguments)},__wbg_addEventListener_5ef04ffb1d3af066:function(){return w(function(t,e,n,_,i){var b=g(e,n);r(t).addEventListener(b,r(_),i!==0)},arguments)},__wbg_addEventListener_c917b5aafbcf493f:function(){return w(function(t,e,n,_,i){var b=g(e,n);r(t).addEventListener(b,r(_),r(i))},arguments)},__wbg_add_5be83378df680c25:function(){return w(function(t,e,n){var _=g(e,n);r(t).add(_)},arguments)},__wbg_appendChild_dea38765a26d346d:function(){return w(function(t,e){let n=r(t).appendChild(r(e));return c(n)},arguments)},__wbg_append_a992ccc37aa62dc4:function(){return w(function(t,e,n,_,i){var b=g(e,n),f=g(_,i);r(t).append(b,f)},arguments)},__wbg_apply_2e22c45cb4f12415:function(){return w(function(t,e,n){let _=Reflect.apply(r(t),r(e),r(n));return c(_)},arguments)},__wbg_apply_ada2ee1a60ac7b3c:function(){return w(function(t,e,n){let _=r(t).apply(r(e),r(n));return c(_)},arguments)},__wbg_asyncIterator_58dd45e58aa3721e:function(){return c(Symbol.asyncIterator)},__wbg_at_dfc235641cc0e40c:function(t,e){let n=r(t).at(e);return c(n)},__wbg_attachShadow_d31cd520620b24d6:function(){return w(function(t,e){let n=r(t).attachShadow(r(e));return c(n)},arguments)},__wbg_blur_07f34335e06e5234:function(){return w(function(t){r(t).blur()},arguments)},__wbg_body_3a0b4437dadea6bf:function(t){let e=r(t).body;return d(e)?0:c(e)},__wbg_body_f67922363a220026:function(t){let e=r(t).body;return d(e)?0:c(e)},__wbg_bootstrap_223cbf0f268c0d89:function(t,e,n,_,i,b){var f=g(e,n),l=g(_,i);let m=at(r(t),f,l,a(b));return c(m)},__wbg_bottom_c7ec510a18034add:function(t){return r(t).bottom},__wbg_bubbles_ad88192d3c29e6f9:function(t){return r(t).bubbles},__wbg_buffer_26d0910f3a5bc899:function(t){let e=r(t).buffer;return c(e)},__wbg_button_d86841d0a03adc44:function(t){return r(t).button},__wbg_cache_key_b02185c5bc89ef2a:function(t){let e=r(t).__yew_subtree_cache_key;return d(e)?4294967297:e>>>0},__wbg_calculatePath_253e618302c0346b:function(t,e,n){var _=g(e,n);let i=r(t).calculatePath(_);return c(i)},__wbg_calculatePresizePaths_9c6f40fa04f5b58e:function(t){let e=r(t).calculatePresizePaths();return c(e)},__wbg_call_389efe28435a9388:function(){return w(function(t,e){let n=r(t).call(r(e));return c(n)},arguments)},__wbg_call_41bedb84c3e5c0c9:function(){return w(function(t,e,n,_,i,b){let f=r(t).call(r(e),r(n),r(_),r(i),r(b));return c(f)},arguments)},__wbg_call_4708e0c13bdc8e95:function(){return w(function(t,e,n){let _=r(t).call(r(e),r(n));return c(_)},arguments)},__wbg_call_812d25f1510c13c8:function(){return w(function(t,e,n,_){let i=r(t).call(r(e),r(n),r(_));return c(i)},arguments)},__wbg_cancelBubble_d93ec09e9c46cd6f:function(t){return r(t).cancelBubble},__wbg_checked_04db83ac6810bc82:function(t){return r(t).checked},__wbg_childNodes_75d35de33c9f6fbb:function(t){let e=r(t).childNodes;return c(e)},__wbg_children_54099e7692eefa29:function(t){let e=r(t).children;return c(e)},__wbg_classList_1a87c34c6d81421e:function(t){let e=r(t).classList;return c(e)},__wbg_className_2a1be685f5d518d5:function(t,e){let n=r(e).className,_=v(n,o.__wbindgen_export,o.__wbindgen_export2),i=p;u().setInt32(t+4,i,!0),u().setInt32(t+0,_,!0)},__wbg_clear_fcee7408bb3b9f2b:function(){return w(function(t){let e=r(t).clear();return c(e)},arguments)},__wbg_click_0e9c20848b655ed3:function(t){r(t).click()},__wbg_clientHeight_6432ff0d61ccfe7d:function(t){return r(t).clientHeight},__wbg_clientX_a3c5f4ff30e91264:function(t){return r(t).clientX},__wbg_clientY_e28509acb9b4a42a:function(t){return r(t).clientY},__wbg_client_new:function(t){let e=R.__wrap(t);return c(e)},__wbg_clipboard_98c5a32249fa8416:function(t){let e=r(t).clipboard;return c(e)},__wbg_cloneNode_b85e9102a9a31b29:function(){return w(function(t,e){let n=r(t).cloneNode(e!==0);return c(n)},arguments)},__wbg_cloneNode_eaf4ea08ebf633a5:function(){return w(function(t){let e=r(t).cloneNode();return c(e)},arguments)},__wbg_closest_11206fe6e0fb4e4e:function(){return w(function(t,e,n){var _=g(e,n);let i=r(t).closest(_);return d(i)?0:c(i)},arguments)},__wbg_code_dee0dae4730408e1:function(t,e){let n=r(e).code,_=v(n,o.__wbindgen_export,o.__wbindgen_export2),i=p;u().setInt32(t+4,i,!0),u().setInt32(t+0,_,!0)},__wbg_column_config_schema_24f5f1e56d1f719e:function(){return w(function(t,e,n,_,i,b,f,l,m,h,y,x){var A=g(e,n),L=g(_,i),K=g(b,f),xt=g(y,x);let It=r(t).column_config_schema(A,L,K,r(l),r(m),r(h),xt);return c(It)},arguments)},__wbg_composedPath_9154ab2547c668d5:function(t){let e=r(t).composedPath();return c(e)},__wbg_contains_1056459c33f961e8:function(t,e){return r(t).contains(r(e))},__wbg_contains_6f4d5df35ef8a13a:function(t,e,n){var _=g(e,n);return r(t).contains(_)},__wbg_contentRect_aa7672315cbaa252:function(t){let e=r(t).contentRect;return c(e)},__wbg_createElementNS_ee00621496b30ec2:function(){return w(function(t,e,n,_,i){var b=g(e,n),f=g(_,i);let l=r(t).createElementNS(b,f);return c(l)},arguments)},__wbg_createElement_49f60fdcaae809c8:function(){return w(function(t,e,n){var _=g(e,n);let i=r(t).createElement(_);return c(i)},arguments)},__wbg_createObjectURL_918185db6a10a0c8:function(){return w(function(t,e){let n=URL.createObjectURL(r(e)),_=v(n,o.__wbindgen_export,o.__wbindgen_export2),i=p;u().setInt32(t+4,i,!0),u().setInt32(t+0,_,!0)},arguments)},__wbg_createTextNode_55029686c9591bf3:function(t,e,n){var _=g(e,n);let i=r(t).createTextNode(_);return c(i)},__wbg_cssRules_554f47f3049cf066:function(){return w(function(t){let e=r(t).cssRules;return c(e)},arguments)},__wbg_cssText_8f3f27e60c824421:function(t,e){let n=r(e).cssText,_=v(n,o.__wbindgen_export,o.__wbindgen_export2),i=p;u().setInt32(t+4,i,!0),u().setInt32(t+0,_,!0)},__wbg_dataTransfer_d924a622fbe51b06:function(t){let e=r(t).dataTransfer;return d(e)?0:c(e)},__wbg_dataset_20cb5c72458ae3fc:function(t){let e=r(t).dataset;return c(e)},__wbg_debug_46a93995fc6f8820:function(t,e,n,_){console.debug(r(t),r(e),r(n),r(_))},__wbg_debug_a4099fa12db6cd61:function(t){console.debug(r(t))},__wbg_decode_a28a47c6d83f2594:function(){return w(function(t,e,n,_,i){let b=r(e).decode(E(n,_),r(i)),f=v(b,o.__wbindgen_export,o.__wbindgen_export2),l=p;u().setInt32(t+4,l,!0),u().setInt32(t+0,f,!0)},arguments)},__wbg_define_panel_tab_4f5969f0c832ef92:function(t,e){var n=g(t,e);ct(n)},__wbg_delete_2384fa08d9528c36:function(t){r(t).delete()},__wbg_delete_8318b529ff42aa20:function(t,e,n){var _=g(e,n);delete r(t)[_]},__wbg_deselect_fd7b9be8eb9eeb14:function(){return w(function(t){let e=r(t).deselect();return c(e)},arguments)},__wbg_detail_934cf9545e3214d3:function(t){let e=r(t).detail;return c(e)},__wbg_dispatchEvent_dc8dcc7ddca11378:function(){return w(function(t,e){return r(t).dispatchEvent(r(e))},arguments)},__wbg_document_ee35a3d3ae34ef6c:function(t){let e=r(t).document;return d(e)?0:c(e)},__wbg_done_57b39ecd9addfe81:function(t){return r(t).done},__wbg_draw_feea604973653dfc:function(){return w(function(t,e,n,_,i){let b=r(t).draw(I.__wrap(e),n===4294967297?void 0:n,_===4294967297?void 0:_,i!==0);return c(b)},arguments)},__wbg_entries_58c7934c745daac7:function(t){let e=Object.entries(r(t));return c(e)},__wbg_error_3c7d958458bf649b:function(t,e){var n=pt(t,e).slice();o.__wbindgen_export4(t,e*4,4),console.error(...n)},__wbg_error_7534b8e9a36f1ab4:function(t,e){var n=g(t,e);t!==0&&o.__wbindgen_export4(t,e,1),console.error(n)},__wbg_error_794d0ffc9d00d5c3:function(t,e,n,_){console.error(r(t),r(e),r(n),r(_))},__wbg_error_9a7fe3f932034cde:function(t){console.error(r(t))},__wbg_error_f852e41c69b0bd84:function(t,e){console.error(r(t),r(e))},__wbg_fetch_e6e8e0a221783759:function(t,e){let n=r(t).fetch(r(e));return c(n)},__wbg_focus_128ff465f65677cc:function(){return w(function(t){r(t).focus()},arguments)},__wbg_fonts_ba4bc521c555025e:function(t){let e=r(t).fonts;return c(e)},__wbg_format_7c97ddc401dae52f:function(t){let e=r(t).format;return c(e)},__wbg_from_bddd64e7d5ff6941:function(t){let e=Array.from(r(t));return c(e)},__wbg_getAttribute_b9f6fc4b689c71b0:function(t,e,n,_){var i=g(n,_);let b=r(e).getAttribute(i);var f=d(b)?0:v(b,o.__wbindgen_export,o.__wbindgen_export2),l=p;u().setInt32(t+4,l,!0),u().setInt32(t+0,f,!0)},__wbg_getBoundingClientRect_b5c8c34d07878818:function(t){let e=r(t).getBoundingClientRect();return c(e)},__wbg_getComputedStyle_2d1f9dfe4ee7e0b9:function(){return w(function(t,e){let n=r(t).getComputedStyle(r(e));return d(n)?0:c(n)},arguments)},__wbg_getContext_2a5764d48600bc43:function(){return w(function(t,e,n){var _=g(e,n);let i=r(t).getContext(_);return d(i)?0:c(i)},arguments)},__wbg_getEntriesByName_02488cff0bc7581c:function(t,e,n,_,i){var b=g(e,n),f=g(_,i);let l=r(t).getEntriesByName(b,f);return c(l)},__wbg_getPropertyValue_d6911b2a1f9acba9:function(){return w(function(t,e,n,_){var i=g(n,_);let b=r(e).getPropertyValue(i),f=v(b,o.__wbindgen_export,o.__wbindgen_export2),l=p;u().setInt32(t+4,l,!0),u().setInt32(t+0,f,!0)},arguments)},__wbg_getRandomValues_1c61fac11405ffdc:function(){return w(function(t,e){globalThis.crypto.getRandomValues(E(t,e))},arguments)},__wbg_getReader_804829cfb24eb4dd:function(t){let e=r(t).getReader();return c(e)},__wbg_getRootNode_193e544ed534e810:function(t){let e=r(t).getRootNode();return c(e)},__wbg_getSelection_d345357cda220f17:function(){return w(function(t){let e=r(t).getSelection();return d(e)?0:c(e)},arguments)},__wbg_getTime_1e3cd1391c5c3995:function(t){return r(t).getTime()},__wbg_getTimezoneOffset_81776d10a4ec18a8:function(t){return r(t).getTimezoneOffset()},__wbg_get_5dd1ee4c9f462865:function(t,e,n,_){var i=g(n,_);let b=r(e)[i];var f=d(b)?0:v(b,o.__wbindgen_export,o.__wbindgen_export2),l=p;u().setInt32(t+4,l,!0),u().setInt32(t+0,f,!0)},__wbg_get_76e04509d1922a04:function(t,e,n){var _=g(e,n);let i=r(t)[_];return d(i)?0:c(i)},__wbg_get_941633a1d2f510cb:function(){return w(function(t,e,n,_){var i=g(n,_);let b=r(e).get(i);var f=d(b)?0:v(b,o.__wbindgen_export,o.__wbindgen_export2),l=p;u().setInt32(t+4,l,!0),u().setInt32(t+0,f,!0)},arguments)},__wbg_get_9b94d73e6221f75c:function(t,e){let n=r(t)[e>>>0];return c(n)},__wbg_get_b3ed3ad4be2bc8ac:function(){return w(function(t,e){let n=Reflect.get(r(t),r(e));return c(n)},arguments)},__wbg_get_d8db2ad31d529ff8:function(t,e){let n=r(t)[e>>>0];return d(n)?0:c(n)},__wbg_get_static_config_6a583ea70a73b29b:function(t){let e=r(t).get_static_config();return c(e)},__wbg_get_with_index_d26da38d2c038e1a:function(t,e){let n=r(t)[e>>>0];return d(n)?0:c(n)},__wbg_get_with_ref_key_1dc361bd10053bfe:function(t,e){let n=r(t)[r(e)];return c(n)},__wbg_hasAttribute_5d8f52cb4c739280:function(t,e,n){var _=g(e,n);return r(t).hasAttribute(_)},__wbg_has_d4e53238966c12b6:function(){return w(function(t,e){return Reflect.has(r(t),r(e))},arguments)},__wbg_headers_59a2938db9f80985:function(t){let e=r(t).headers;return c(e)},__wbg_height_45209601b4c4ede6:function(t){return r(t).height},__wbg_height_c2027cf67d1c9b11:function(t){return r(t).height},__wbg_hidden_8ce6a98b8c12451c:function(t){return r(t).hidden},__wbg_hidePopover_f52b72171825485d:function(){return w(function(t){r(t).hidePopover()},arguments)},__wbg_host_fb29f8be35c2517d:function(t){let e=r(t).host;return c(e)},__wbg_includes_32215c836f1cd3fb:function(t,e,n){return r(t).includes(r(e),n)},__wbg_indexOf_e5f91887d9e5023e:function(t,e,n){return r(t).indexOf(r(e),n)},__wbg_info_148d043840582012:function(t){console.info(r(t))},__wbg_info_9e602cf10c5c690b:function(t,e,n,_){console.info(r(t),r(e),r(n),r(_))},__wbg_innerHeight_54aa104da08becd2:function(){return w(function(t){let e=r(t).innerHeight;return c(e)},arguments)},__wbg_innerWidth_fa95c57321f4f033:function(){return w(function(t){let e=r(t).innerWidth;return c(e)},arguments)},__wbg_insertBefore_1468142836e61a51:function(){return w(function(t,e,n){let _=r(t).insertBefore(r(e),r(n));return c(_)},arguments)},__wbg_insertPanel_d2de6cb8f50d06b5:function(t,e,n,_,i){var b=g(e,n);let f=r(t).insertPanel(b,a(_),a(i));return c(f)},__wbg_instanceof_ArrayBuffer_c367199e2fa2aa04:function(t){let e;try{e=r(t)instanceof ArrayBuffer}catch{e=!1}return e},__wbg_instanceof_Array_d9eac779cd191cbc:function(t){let e;try{e=r(t)instanceof Array}catch{e=!1}return e},__wbg_instanceof_CanvasRenderingContext2d_4bb052fd1c3d134d:function(t){let e;try{e=r(t)instanceof CanvasRenderingContext2D}catch{e=!1}return e},__wbg_instanceof_CssStyleRule_23e59108346af0df:function(t){let e;try{e=r(t)instanceof CSSStyleRule}catch{e=!1}return e},__wbg_instanceof_CustomEvent_7dc010f377596c94:function(t){let e;try{e=r(t)instanceof CustomEvent}catch{e=!1}return e},__wbg_instanceof_Date_1b9f15b87f10aa4c:function(t){let e;try{e=r(t)instanceof Date}catch{e=!1}return e},__wbg_instanceof_Element_9e662f49ab6c6beb:function(t){let e;try{e=r(t)instanceof Element}catch{e=!1}return e},__wbg_instanceof_Error_8573fe0b0b480f46:function(t){let e;try{e=r(t)instanceof Error}catch{e=!1}return e},__wbg_instanceof_HtmlCanvasElement_3f2f6e1edb1c9792:function(t){let e;try{e=r(t)instanceof HTMLCanvasElement}catch{e=!1}return e},__wbg_instanceof_HtmlElement_5abfac207260fd6f:function(t){let e;try{e=r(t)instanceof HTMLElement}catch{e=!1}return e},__wbg_instanceof_HtmlInputElement_c10b7260b4e0710a:function(t){let e;try{e=r(t)instanceof HTMLInputElement}catch{e=!1}return e},__wbg_instanceof_HtmlLinkElement_5eb5b0855a17d0fc:function(t){let e;try{e=r(t)instanceof HTMLLinkElement}catch{e=!1}return e},__wbg_instanceof_HtmlSelectElement_a1820832b22b0d1e:function(t){let e;try{e=r(t)instanceof HTMLSelectElement}catch{e=!1}return e},__wbg_instanceof_Map_53af74335dec57f4:function(t){let e;try{e=r(t)instanceof Map}catch{e=!1}return e},__wbg_instanceof_Node_da04bd8df43deba3:function(t){let e;try{e=r(t)instanceof Node}catch{e=!1}return e},__wbg_instanceof_Object_1c6af87502b733ed:function(t){let e;try{e=r(t)instanceof Object}catch{e=!1}return e},__wbg_instanceof_Promise_0094681e3519d6ec:function(t){let e;try{e=r(t)instanceof Promise}catch{e=!1}return e},__wbg_instanceof_Response_ee1d54d79ae41977:function(t){let e;try{e=r(t)instanceof Response}catch{e=!1}return e},__wbg_instanceof_ShadowRoot_5285adde3587c73e:function(t){let e;try{e=r(t)instanceof ShadowRoot}catch{e=!1}return e},__wbg_instanceof_Uint8Array_9b9075935c74707c:function(t){let e;try{e=r(t)instanceof Uint8Array}catch{e=!1}return e},__wbg_instanceof_Window_ed49b2db8df90359:function(t){let e;try{e=r(t)instanceof Window}catch{e=!1}return e},__wbg_isArray_d314bb98fcf08331:function(t){return Array.isArray(r(t))},__wbg_isCollapsed_617e9be3f62f5a25:function(t){return r(t).isCollapsed},__wbg_isConnected_6110bc2c5462f90e:function(t){return r(t).isConnected},__wbg_isContentEditable_f5b0ce009dbd035b:function(t){return r(t).isContentEditable},__wbg_isIntersecting_4dfad8b68450ba8c:function(t){return r(t).isIntersecting},__wbg_isSafeInteger_bfbc7332a9768d2a:function(t){return Number.isSafeInteger(r(t))},__wbg_isSameNode_3caa48d6eb3c880e:function(t,e){return r(t).isSameNode(r(e))},__wbg_is_f29129f676e5410c:function(t,e){return Object.is(r(t),r(e))},__wbg_item_00ae26320b80a11f:function(t,e,n){let _=r(e).item(n>>>0),i=v(_,o.__wbindgen_export,o.__wbindgen_export2),b=p;u().setInt32(t+4,b,!0),u().setInt32(t+0,i,!0)},__wbg_item_48715d3212ed96cb:function(t,e){let n=r(t).item(e>>>0);return d(n)?0:c(n)},__wbg_item_5c82f52b014b3056:function(t,e){let n=r(t).item(e>>>0);return d(n)?0:c(n)},__wbg_item_64b77e6a26f7de76:function(t,e){let n=r(t).item(e>>>0);return d(n)?0:c(n)},__wbg_item_ca823df8214b9e2b:function(t,e){let n=r(t).item(e>>>0);return d(n)?0:c(n)},__wbg_iterator_6ff6560ca1568e55:function(){return c(Symbol.iterator)},__wbg_keyCode_155291a11654466e:function(t){return r(t).keyCode},__wbg_key_d41e8e825e6bb0e9:function(t,e){let n=r(e).key,_=v(n,o.__wbindgen_export,o.__wbindgen_export2),i=p;u().setInt32(t+4,i,!0),u().setInt32(t+0,_,!0)},__wbg_keys_b50a709a76add04e:function(t){let e=Object.keys(r(t));return c(e)},__wbg_languages_5a69df7551d1a803:function(t){let e=r(t).languages;return c(e)},__wbg_lastChild_132d67597d5e4aef:function(t){let e=r(t).lastChild;return d(e)?0:c(e)},__wbg_left_3b7c3c1030d5ca7a:function(t){return r(t).left},__wbg_length_25851a48867b2afc:function(t){return r(t).length},__wbg_length_32ed9a279acd054c:function(t){return r(t).length},__wbg_length_35a7bace40f36eac:function(t){return r(t).length},__wbg_length_3f12bc1cab862cc3:function(t){return r(t).length},__wbg_length_b5aa6c69c842d6a6:function(t){return r(t).length},__wbg_length_e455564ce5cbf46e:function(t){return r(t).length},__wbg_length_edae0cd13a8d3b71:function(t){return r(t).length},__wbg_listener_id_3f13203bf7de1e4d:function(t){let e=r(t).__yew_listener_id;return d(e)?4294967297:e>>>0},__wbg_load_f8d29f3c1bda8dd1:function(t,e,n,_,i){var b=g(e,n),f=g(_,i);let l=r(t).load(b,f);return c(l)},__wbg_mark_3b530a64b09ba08a:function(){return w(function(t,e,n){var _=g(e,n);r(t).mark(_)},arguments)},__wbg_matches_852ba8b2b4592069:function(){return w(function(t,e,n){var _=g(e,n);return r(t).matches(_)},arguments)},__wbg_maximize_3c53254239b60c69:function(t,e,n){var _=g(e,n);r(t).maximize(_)},__wbg_measureText_9d64a92333bd05ee:function(){return w(function(t,e,n){var _=g(e,n);let i=r(t).measureText(_);return c(i)},arguments)},__wbg_measure_288b48c082eae0fe:function(){return w(function(t,e,n,_,i){var b=g(e,n),f=g(_,i);r(t).measure(b,f)},arguments)},__wbg_message_9ddc4b9a62a7c379:function(t){let e=r(t).message;return c(e)},__wbg_minimize_6621ccd9edc3d6fb:function(t){r(t).minimize()},__wbg_namespaceURI_86e2062c65f0f341:function(t,e){let n=r(e).namespaceURI;var _=d(n)?0:v(n,o.__wbindgen_export,o.__wbindgen_export2),i=p;u().setInt32(t+4,i,!0),u().setInt32(t+0,_,!0)},__wbg_navigator_43be698ba96fc088:function(t){let e=r(t).navigator;return c(e)},__wbg_new_0bc67582d663afe8:function(t){let e=new st(r(t));return c(e)},__wbg_new_16c83877745f8d12:function(){return w(function(t,e){var n=g(t,e);let _=new InputEvent(n);return c(_)},arguments)},__wbg_new_1d5bd472c706b768:function(){return w(function(){let t=new CSSStyleSheet;return c(t)},arguments)},__wbg_new_1f98d9d640247121:function(t){let e=new it(r(t));return c(e)},__wbg_new_245cd5c49157e602:function(t){let e=new Date(r(t));return c(e)},__wbg_new_2689e4136213b5bd:function(t){let e=new ut(r(t));return c(e)},__wbg_new_2ec3ec8c398b20d2:function(){return w(function(){let t=new TextDecoder;return c(t)},arguments)},__wbg_new_361308b2356cecd0:function(){let t=new Object;return c(t)},__wbg_new_384a230f8673183c:function(){return w(function(t,e){var n=g(t,e);let _=new CustomEvent(n);return c(_)},arguments)},__wbg_new_3eb36ae241fe6f44:function(){let t=new Array;return c(t)},__wbg_new_64284bd487f9d239:function(){return w(function(){let t=new Headers;return c(t)},arguments)},__wbg_new_72b49615380db768:function(t,e){var n=g(t,e);let _=new Error(n);return c(_)},__wbg_new_86c8f0b79e48927d:function(t,e){let n=new Intl.NumberFormat(r(t),r(e));return c(n)},__wbg_new_8a6f238a6ece86ea:function(){let t=new Error;return c(t)},__wbg_new_b5d9e2fb389fef91:function(t,e){try{var n={a:t,b:e},_=(b,f)=>{let l=n.a;n.a=0;try{return Nt(l,n.b,b,f)}finally{n.a=l}};let i=new Promise(_);return c(i)}finally{n.a=n.b=0}},__wbg_new_b949e7f56150a5d1:function(){return w(function(){let t=new AbortController;return c(t)},arguments)},__wbg_new_c155239f1b113b68:function(t,e){let n=new Intl.DateTimeFormat(r(t),r(e));return c(n)},__wbg_new_dca287b076112a51:function(){return c(new Map)},__wbg_new_dd2b680c8bf6ae29:function(t){let e=new Uint8Array(r(t));return c(e)},__wbg_new_from_slice_a3d2629dc1826784:function(t,e){let n=new Uint8Array(E(t,e));return c(n)},__wbg_new_no_args_1c7c842f08d00ebb:function(t,e){var n=g(t,e);let _=new Function(n);return c(_)},__wbg_new_with_event_init_dict_48877e7ca125f3c1:function(){return w(function(t,e,n){var _=g(t,e);let i=new CustomEvent(_,r(n));return c(i)},arguments)},__wbg_new_with_length_1763c527b2923202:function(t){let e=new Array(t>>>0);return c(e)},__wbg_new_with_str_and_init_a61cbc6bdef21614:function(){return w(function(t,e,n){var _=g(t,e);let i=new Request(_,r(n));return c(i)},arguments)},__wbg_new_with_str_sequence_and_options_9b8b0bee99ec6b0f:function(){return w(function(t,e){let n=new Blob(r(t),r(e));return c(n)},arguments)},__wbg_new_with_u8_array_sequence_08b2096a9f3117c0:function(){return w(function(t){let e=new Blob(r(t));return c(e)},arguments)},__wbg_nextSibling_2e988d9bbe3e06f0:function(t){let e=r(t).nextSibling;return d(e)?0:c(e)},__wbg_next_3482f54c49e8af19:function(){return w(function(t){let e=r(t).next();return c(e)},arguments)},__wbg_next_418f80d8f5303233:function(t){let e=r(t).next;return c(e)},__wbg_now_a3af9a2f4bbaa4d1:function(){return Date.now()},__wbg_now_ebffdf7e580f210d:function(t){return r(t).now()},__wbg_observe_0570c4c517cbf6cc:function(t,e){r(t).observe(r(e))},__wbg_observe_936f956a7d402e6b:function(t,e){r(t).observe(r(e))},__wbg_of_f915f7cd925b21a5:function(t){let e=Array.of(r(t));return c(e)},__wbg_offsetHeight_34f7abc1686733cc:function(t){return r(t).offsetHeight},__wbg_offsetParent_9627ebca6b03e8b2:function(t){let e=r(t).offsetParent;return d(e)?0:c(e)},__wbg_offsetWidth_f37b33a53e513101:function(t){return r(t).offsetWidth},__wbg_offsetX_b76b9bb1f9235de9:function(t){return r(t).offsetX},__wbg_offsetY_db5c1ddb866e1b82:function(t){return r(t).offsetY},__wbg_ok_87f537440a0acf85:function(t){return r(t).ok},__wbg_parentElement_75863410a8617953:function(t){let e=r(t).parentElement;return d(e)?0:c(e)},__wbg_parentNode_d44bd5ec58601e45:function(t){let e=r(t).parentNode;return d(e)?0:c(e)},__wbg_parse_708461a1feddfb38:function(){return w(function(t,e){var n=g(t,e);let _=JSON.parse(n);return c(_)},arguments)},__wbg_performance_06f12ba62483475d:function(t){let e=r(t).performance;return d(e)?0:c(e)},__wbg_plugin_config_schema_f811074e0a5e37ec:function(){return w(function(t,e,n){let _=r(t).plugin_config_schema(r(e),r(n));return c(_)},arguments)},__wbg_pointerId_466b1bdcaf2fe835:function(t){return r(t).pointerId},__wbg_pop_80fa29128215a463:function(t){let e=r(t).pop();return c(e)},__wbg_prepend_12ed960547d9dfe1:function(){return w(function(t,e){r(t).prepend(r(e))},arguments)},__wbg_presize_64e91044393c1556:function(){return w(function(t,e,n){let _=r(t).presize(e,n);return c(_)},arguments)},__wbg_preventDefault_cdcfcd7e301b9702:function(t){r(t).preventDefault()},__wbg_prototypesetcall_bdcdcc5842e4d77d:function(t,e,n){Uint8Array.prototype.set.call(E(t,e),r(n))},__wbg_push_8ffdcb2063340ba5:function(t,e){return r(t).push(r(e))},__wbg_querySelectorAll_1283aae52043a951:function(){return w(function(t,e,n){var _=g(e,n);let i=r(t).querySelectorAll(_);return c(i)},arguments)},__wbg_querySelectorAll_5875742f4e11f759:function(){return w(function(t,e,n){var _=g(e,n);let i=r(t).querySelectorAll(_);return c(i)},arguments)},__wbg_querySelector_1be4292f202b1597:function(){return w(function(t,e,n){var _=g(e,n);let i=r(t).querySelector(_);return d(i)?0:c(i)},arguments)},__wbg_querySelector_4dc619d02f6cb079:function(){return w(function(t,e,n){var _=g(e,n);let i=r(t).querySelector(_);return d(i)?0:c(i)},arguments)},__wbg_queueMicrotask_0aa0a927f78f5d98:function(t){let e=r(t).queueMicrotask;return c(e)},__wbg_queueMicrotask_5bb536982f78a56f:function(t){queueMicrotask(r(t))},__wbg_readText_b9ac81623f153a62:function(t){let e=r(t).readText();return c(e)},__wbg_read_68fd377df67e19b0:function(t){let e=r(t).read();return c(e)},__wbg_readyState_cf11f0728fc7b46c:function(t,e){let n=r(e).readyState,_=v(n,o.__wbindgen_export,o.__wbindgen_export2),i=p;u().setInt32(t+4,i,!0),u().setInt32(t+0,_,!0)},__wbg_realCoordinates_1c25b4edd0cbc5c0:function(t,e){let n=r(t).realCoordinates(r(e));return c(n)},__wbg_reject_a2176de7f1212be5:function(t){let e=Promise.reject(r(t));return c(e)},__wbg_relatedTarget_1557cded94b97af2:function(t){let e=r(t).relatedTarget;return d(e)?0:c(e)},__wbg_releasePointerCapture_420ef33c7c5fb6f4:function(){return w(function(t,e){r(t).releasePointerCapture(e)},arguments)},__wbg_removeAllRanges_39254b77dc6257ab:function(){return w(function(t){r(t).removeAllRanges()},arguments)},__wbg_removeAttribute_87259aab06d9f286:function(){return w(function(t,e,n){var _=g(e,n);r(t).removeAttribute(_)},arguments)},__wbg_removeChild_2f0b06213dbc49ca:function(){return w(function(t,e){let n=r(t).removeChild(r(e));return c(n)},arguments)},__wbg_removeEventListener_0c0902ed5009dd9f:function(){return w(function(t,e,n,_,i){var b=g(e,n);r(t).removeEventListener(b,r(_),i!==0)},arguments)},__wbg_removeEventListener_e63328781a5b9af9:function(){return w(function(t,e,n,_){var i=g(e,n);r(t).removeEventListener(i,r(_))},arguments)},__wbg_removePanel_fd5afd12baea1143:function(t,e,n){var _=g(e,n);let i=r(t).removePanel(_);return c(i)},__wbg_removeProperty_a0d2ff8a76ffd2b1:function(){return w(function(t,e,n,_){var i=g(n,_);let b=r(e).removeProperty(i),f=v(b,o.__wbindgen_export,o.__wbindgen_export2),l=p;u().setInt32(t+4,l,!0),u().setInt32(t+0,f,!0)},arguments)},__wbg_remove_31c39325eee968fc:function(t){r(t).remove()},__wbg_remove_f9451697e0bc6ca0:function(){return w(function(t,e,n){var _=g(e,n);r(t).remove(_)},arguments)},__wbg_render_a1086390dd793b1e:function(){return w(function(t,e,n){let _=r(t).render(I.__wrap(e),a(n));return c(_)},arguments)},__wbg_replaceSync_54e9ce897fe6ab6a:function(){return w(function(t,e,n){var _=g(e,n);r(t).replaceSync(_)},arguments)},__wbg_requestAnimationFrame_43682f8e1c5e5348:function(){return w(function(t,e){return r(t).requestAnimationFrame(r(e))},arguments)},__wbg_resize_6deb7779fad8eb4c:function(){return w(function(t){let e=r(t).resize();return c(e)},arguments)},__wbg_resolve_002c4b7d9d8f6b64:function(t){let e=Promise.resolve(r(t));return c(e)},__wbg_resolvedOptions_4c36dbfa1c4ba2bf:function(t){let e=r(t).resolvedOptions();return c(e)},__wbg_restorePhysics_1e1b0076809d3573:function(t,e){r(t).restorePhysics(r(e))},__wbg_restoreSync_dc2781a47594a917:function(t,e){r(t).restoreSync(r(e))},__wbg_restore_c9c154aa82f7c8f2:function(){return w(function(t,e,n){r(t).restore(r(e),r(n))},arguments)},__wbg_restyle_232c34f484e3dd76:function(t){r(t).restyle()},__wbg_resumeResize_87ed599dd90f99b8:function(t){r(t).resumeResize()},__wbg_right_154af6c2b1bf0c89:function(t){return r(t).right},__wbg_run_312def04b15a0d44:function(){return w(function(t,e){let n=r(t).run(r(e));return c(n)},arguments)},__wbg_save_78ff836f15a73ce5:function(t){let e=r(t).save();return c(e)},__wbg_scrollHeight_25e40881bfad55b6:function(t){return r(t).scrollHeight},__wbg_scrollLeft_2b817c7719d17438:function(t){return r(t).scrollLeft},__wbg_scrollTop_0a3a77f9fcbe038e:function(t){return r(t).scrollTop},__wbg_scrollTop_4161d2a08060cb06:function(t){return r(t).scrollTop},__wbg_select_5b3952fc144129b6:function(t,e,n){var _=g(e,n);let i=r(t).select(_);return c(i)},__wbg_select_f96715f412d93f23:function(t){r(t).select()},__wbg_selectedIndex_b1465d243fcb7142:function(t){return r(t).selectedIndex},__wbg_selectionEnd_f3cba543517b4aa8:function(){return w(function(t){let e=r(t).selectionEnd;return d(e)?4294967297:e>>>0},arguments)},__wbg_selectionStart_9cd0aeff14a21252:function(){return w(function(t){let e=r(t).selectionStart;return d(e)?4294967297:e>>>0},arguments)},__wbg_selectorText_4ebdf4f8074dafea:function(t,e){let n=r(e).selectorText,_=v(n,o.__wbindgen_export,o.__wbindgen_export2),i=p;u().setInt32(t+4,i,!0),u().setInt32(t+0,_,!0)},__wbg_setAttribute_cc8e4c8a2a008508:function(){return w(function(t,e,n,_,i){var b=g(e,n),f=g(_,i);r(t).setAttribute(b,f)},arguments)},__wbg_setDragImage_76defbcc7ff30178:function(t,e,n,_){r(t).setDragImage(r(e),n,_)},__wbg_setPointerCapture_420db6f6826eb74b:function(){return w(function(t,e){r(t).setPointerCapture(e)},arguments)},__wbg_setProperty_cbb25c4e74285b39:function(){return w(function(t,e,n,_,i){var b=g(e,n),f=g(_,i);r(t).setProperty(b,f)},arguments)},__wbg_setSelectionRange_301eef1c51e01d2a:function(){return w(function(t,e,n){r(t).setSelectionRange(e>>>0,n>>>0)},arguments)},__wbg_setTimeout_21d8cc2869b34c58:function(t,e){return setTimeout(r(t),e)},__wbg_setTimeout_eff32631ea138533:function(){return w(function(t,e,n){return r(t).setTimeout(r(e),n)},arguments)},__wbg_set_1eb0999cf5d27fc8:function(t,e,n){let _=r(t).set(r(e),r(n));return c(_)},__wbg_set_3f1d0b984ed272ed:function(t,e,n){r(t)[a(e)]=a(n)},__wbg_set_6cb8631f80447a67:function(){return w(function(t,e,n){return Reflect.set(r(t),r(e),r(n))},arguments)},__wbg_set_body_9a7e00afe3cfe244:function(t,e){r(t).body=r(e)},__wbg_set_bubbles_739f291693b2bbec:function(t,e){r(t).bubbles=e!==0},__wbg_set_cache_key_ace1fa875f02b7cd:function(t,e){r(t).__yew_subtree_cache_key=e>>>0},__wbg_set_capture_d52e7a585f2933c8:function(t,e){r(t).capture=e!==0},__wbg_set_checked_4b2468680005fbf7:function(t,e){r(t).checked=e!==0},__wbg_set_className_c1d9e7362164af61:function(t,e,n){var _=g(e,n);r(t).className=_},__wbg_set_composed_e4a9826a628ca7f8:function(t,e){r(t).composed=e!==0},__wbg_set_cssText_18380c97092caefa:function(t,e,n){var _=g(e,n);r(t).cssText=_},__wbg_set_defaultValue_ad528b0a65ceef4a:function(){return w(function(t,e,n){var _=g(e,n);r(t).defaultValue=_},arguments)},__wbg_set_detail_fa3b358526be3a85:function(t,e){r(t).detail=r(e)},__wbg_set_dropEffect_042402609f0b7c6b:function(t,e,n){var _=g(e,n);r(t).dropEffect=_},__wbg_set_f43e577aea94465b:function(t,e,n){r(t)[e>>>0]=a(n)},__wbg_set_fb27b296001e2de9:function(){return w(function(t,e,n,_,i){var b=g(e,n),f=g(_,i);r(t)[b]=f},arguments)},__wbg_set_font_575685c8f7e56957:function(t,e,n){var _=g(e,n);r(t).font=_},__wbg_set_headers_cfc5f4b2c1f20549:function(t,e){r(t).headers=r(e)},__wbg_set_innerHTML_edd39677e3460291:function(t,e,n){var _=g(e,n);r(t).innerHTML=_},__wbg_set_innerText_2f1502f2d0780499:function(t,e,n){var _=g(e,n);r(t).innerText=_},__wbg_set_listener_id_8b77f7eb9adb712b:function(t,e){r(t).__yew_listener_id=e>>>0},__wbg_set_method_c3e20375f5ae7fac:function(t,e,n){var _=g(e,n);r(t).method=_},__wbg_set_mode_6a55f972d62a3c88:function(t,e){r(t).mode=qt[e]},__wbg_set_nodeValue_d947eb0a476b80d7:function(t,e,n){var _=g(e,n);r(t).nodeValue=_},__wbg_set_passive_f411e67e6f28687b:function(t,e){r(t).passive=e!==0},__wbg_set_scrollLeft_8de8fc187e3a6808:function(t,e){r(t).scrollLeft=e},__wbg_set_scrollTop_bebe746cd217a3d1:function(t,e){r(t).scrollTop=e},__wbg_set_scrollTop_fb454582dda63417:function(t,e){r(t).scrollTop=e},__wbg_set_selectionEnd_01e3269db03d5d2e:function(){return w(function(t,e){r(t).selectionEnd=e===4294967297?void 0:e},arguments)},__wbg_set_selectionStart_d68d6955c07c2be1:function(){return w(function(t,e){r(t).selectionStart=e===4294967297?void 0:e},arguments)},__wbg_set_signal_f2d3f8599248896d:function(t,e){r(t).signal=r(e)},__wbg_set_stream_8a7c5f563fa185b4:function(t,e){r(t).stream=e!==0},__wbg_set_subtree_id_8be88ea477740786:function(t,e){r(t).__yew_subtree_id=e>>>0},__wbg_set_type_148de20768639245:function(t,e,n){var _=g(e,n);r(t).type=_},__wbg_set_value_62a965e38b22b38c:function(t,e,n){var _=g(e,n);r(t).value=_},__wbg_set_value_c3556fce049236f0:function(t,e,n){var _=g(e,n);r(t).value=_},__wbg_set_value_ddc3bd01a8467bf1:function(t,e,n){var _=g(e,n);r(t).value=_},__wbg_shadowRoot_14828067c5922da7:function(t){let e=r(t).shadowRoot;return d(e)?0:c(e)},__wbg_sheet_38c9043b5f37d85d:function(t){let e=r(t).sheet;return d(e)?0:c(e)},__wbg_shiftKey_5558a3288542c985:function(t){return r(t).shiftKey},__wbg_shiftKey_564be91ec842bcc4:function(t){return r(t).shiftKey},__wbg_showPicker_ba1d36381dae3011:function(){return w(function(t){r(t).showPicker()},arguments)},__wbg_showPopover_7166cd0808998024:function(){return w(function(t){r(t).showPopover()},arguments)},__wbg_signal_d1285ecab4ebc5ad:function(t){let e=r(t).signal;return c(e)},__wbg_slot_7d421d6c9d6c8352:function(t,e){let n=r(e).slot,_=v(n,o.__wbindgen_export,o.__wbindgen_export2),i=p;u().setInt32(t+4,i,!0),u().setInt32(t+0,_,!0)},__wbg_stack_0ed75d68575b0f3c:function(t,e){let n=r(e).stack,_=v(n,o.__wbindgen_export,o.__wbindgen_export2),i=p;u().setInt32(t+4,i,!0),u().setInt32(t+0,_,!0)},__wbg_startTime_248495bfbcb427d3:function(t){return r(t).startTime},__wbg_static_accessor_GLOBAL_12837167ad935116:function(){let t=typeof self>\"u\"?null:self;return d(t)?0:c(t)},__wbg_static_accessor_GLOBAL_THIS_e628e89ab3b1c95f:function(){let t=typeof globalThis>\"u\"?null:globalThis;return d(t)?0:c(t)},__wbg_static_accessor_PSP_14b4b1db692e4309:function(){return c(J)},__wbg_static_accessor_SELF_a621d3dfbb60d0ce:function(){let t=typeof self>\"u\"?null:self;return d(t)?0:c(t)},__wbg_static_accessor_WINDOW_f8727f0cf888e0bd:function(){let t=typeof window>\"u\"?null:window;return d(t)?0:c(t)},__wbg_statusText_556131a02d60f5cd:function(t,e){let n=r(e).statusText,_=v(n,o.__wbindgen_export,o.__wbindgen_export2),i=p;u().setInt32(t+4,i,!0),u().setInt32(t+0,_,!0)},__wbg_status_89d7e803db911ee7:function(t){return r(t).status},__wbg_stopPropagation_6e5e2a085214ac63:function(t){r(t).stopPropagation()},__wbg_stringify_2fdc12d5545a89d9:function(){return w(function(t,e,n){let _=JSON.stringify(r(t),r(e),r(n));return c(_)},arguments)},__wbg_stringify_8d1cc6ff383e8bae:function(){return w(function(t){let e=JSON.stringify(r(t));return c(e)},arguments)},__wbg_styleSheets_54de627270238f6f:function(t){let e=r(t).styleSheets;return c(e)},__wbg_style_0b7c9bd318f8b807:function(t){let e=r(t).style;return c(e)},__wbg_style_fa56cf251a93275a:function(t){let e=r(t).style;return c(e)},__wbg_subtree_id_1739fcadc43deeca:function(t){let e=r(t).__yew_subtree_id;return d(e)?4294967297:e>>>0},__wbg_supportedValuesOf_0cdf8201dfb5269d:function(t){let e=Intl.supportedValuesOf(r(t));return c(e)},__wbg_table_new:function(t){let e=z.__wrap(t);return c(e)},__wbg_tagName_0cf6d7b647352f04:function(t,e){let n=r(e).tagName,_=v(n,o.__wbindgen_export,o.__wbindgen_export2),i=p;u().setInt32(t+4,i,!0),u().setInt32(t+0,_,!0)},__wbg_target_521be630ab05b11e:function(t){let e=r(t).target;return d(e)?0:c(e)},__wbg_text_083b8727c990c8c0:function(){return w(function(t){let e=r(t).text();return c(e)},arguments)},__wbg_then_0d9fe2c7b1857d32:function(t,e,n){let _=r(t).then(r(e),r(n));return c(_)},__wbg_then_b9e7b3b5f1a9e1b5:function(t,e){let n=r(t).then(r(e));return c(n)},__wbg_timeStamp_ddfe1bf5c2346d68:function(t){return r(t).timeStamp},__wbg_toString_964ff7fe6eca8362:function(t){let e=r(t).toString();return c(e)},__wbg_toggleAttribute_d89e5c9e9053c9c4:function(){return w(function(t,e,n,_){var i=g(e,n);return r(t).toggleAttribute(i,_!==0)},arguments)},__wbg_toggle_52417ca95b874e83:function(){return w(function(t,e,n){var _=g(e,n);return r(t).toggle(_)},arguments)},__wbg_toggle_b8e3ebf1a7aaeb11:function(){return w(function(t,e,n,_){var i=g(e,n);return r(t).toggle(i,_!==0)},arguments)},__wbg_top_3d27ff6f468cf3fc:function(t){return r(t).top},__wbg_trace_9007714a6fbee374:function(t){console.trace(r(t))},__wbg_trace_bd16b570941b54fb:function(t,e,n,_){console.trace(r(t),r(e),r(n),r(_))},__wbg_type_4edffca24c42b74d:function(t,e){let n=r(e).type,_=v(n,o.__wbindgen_export,o.__wbindgen_export2),i=p;u().setInt32(t+4,i,!0),u().setInt32(t+0,_,!0)},__wbg_unobserve_c23b6b6fd23b6251:function(t,e){r(t).unobserve(r(e))},__wbg_unobserve_c905fe17aeafb972:function(t,e){r(t).unobserve(r(e))},__wbg_update_c8680f1980e5fd30:function(){return w(function(t,e,n,_,i){let b=r(t).update(I.__wrap(e),n===4294967297?void 0:n,_===4294967297?void 0:_,i!==0);return c(b)},arguments)},__wbg_valueAsNumber_5292e7ed56db5658:function(t){return r(t).valueAsNumber},__wbg_value_0546255b415e96c1:function(t){let e=r(t).value;return c(e)},__wbg_value_15684899da869c95:function(t,e){let n=r(e).value,_=v(n,o.__wbindgen_export,o.__wbindgen_export2),i=p;u().setInt32(t+4,i,!0),u().setInt32(t+0,_,!0)},__wbg_value_d402dce7dcb16251:function(t,e){let n=r(e).value,_=v(n,o.__wbindgen_export,o.__wbindgen_export2),i=p;u().setInt32(t+4,i,!0),u().setInt32(t+0,_,!0)},__wbg_value_e506a07878790ca0:function(t,e){let n=r(e).value,_=v(n,o.__wbindgen_export,o.__wbindgen_export2),i=p;u().setInt32(t+4,i,!0),u().setInt32(t+0,_,!0)},__wbg_values_5da93bc719d272cf:function(t){let e=Object.values(r(t));return c(e)},__wbg_view_new:function(t){let e=I.__wrap(t);return c(e)},__wbg_view_unwrap:function(t){return I.__unwrap(r(t))},__wbg_virtualdataslice_new:function(t){let e=M.__wrap(t);return c(e)},__wbg_warn_a40b971467b219c7:function(t,e,n,_){console.warn(r(t),r(e),r(n),r(_))},__wbg_warn_f7ae1b2e66ccb930:function(t){console.warn(r(t))},__wbg_which_78ecd90ab7c6bdd6:function(t){return r(t).which},__wbg_width_7444cca5dfea0645:function(t){return r(t).width},__wbg_width_9bbf873307a2ac4e:function(t){return r(t).width},__wbg_width_ae46cb8e98ee102f:function(t){return r(t).width},__wbg_write_d429ce72e918e180:function(t,e){let n=r(t).write(r(e));return c(n)},__wbindgen_cast_0000000000000001:function(t,e){let n=F(t,e,o.__wasm_bindgen_func_elem_7445,bt);return c(n)},__wbindgen_cast_0000000000000002:function(t,e){let n=S(t,e,o.__wasm_bindgen_func_elem_7445,T);return c(n)},__wbindgen_cast_0000000000000003:function(t,e){let n=S(t,e,o.__wasm_bindgen_func_elem_7445,T);return c(n)},__wbindgen_cast_0000000000000004:function(t,e){let n=S(t,e,o.__wasm_bindgen_func_elem_7445,T);return c(n)},__wbindgen_cast_0000000000000005:function(t,e){let n=S(t,e,o.__wasm_bindgen_func_elem_7445,T);return c(n)},__wbindgen_cast_0000000000000006:function(t,e){let n=F(t,e,o.__wasm_bindgen_func_elem_7445,bt);return c(n)},__wbindgen_cast_0000000000000007:function(t,e){let n=S(t,e,o.__wasm_bindgen_func_elem_7445,T);return c(n)},__wbindgen_cast_0000000000000008:function(t,e){let n=S(t,e,o.__wasm_bindgen_func_elem_7445,T);return c(n)},__wbindgen_cast_0000000000000009:function(t,e){let n=F(t,e,o.__wasm_bindgen_func_elem_7445,Ot);return c(n)},__wbindgen_cast_000000000000000a:function(t,e){let n=S(t,e,o.__wasm_bindgen_func_elem_7445,jt);return c(n)},__wbindgen_cast_000000000000000b:function(t,e){let n=F(t,e,o.__wasm_bindgen_func_elem_20199,zt);return c(n)},__wbindgen_cast_000000000000000c:function(t,e){let n=S(t,e,o.__wasm_bindgen_func_elem_20815,Mt);return c(n)},__wbindgen_cast_000000000000000d:function(t,e){let n=S(t,e,o.__wasm_bindgen_func_elem_20815,Et);return c(n)},__wbindgen_cast_000000000000000e:function(t,e){let n=F(t,e,o.__wasm_bindgen_func_elem_22212,Pt);return c(n)},__wbindgen_cast_000000000000000f:function(t,e){let n=F(t,e,o.__wasm_bindgen_func_elem_22212,Ft);return c(n)},__wbindgen_cast_0000000000000010:function(t,e){let n=S(t,e,o.__wasm_bindgen_func_elem_26797,Lt);return c(n)},__wbindgen_cast_0000000000000011:function(t){return c(t)},__wbindgen_cast_0000000000000012:function(t){return c(t)},__wbindgen_cast_0000000000000013:function(t,e){var n=g(t,e);return c(n)},__wbindgen_cast_0000000000000014:function(t,e){let n=Wt(t,e);return c(n)},__wbindgen_cast_0000000000000015:function(t,e){let n=Ht(t,e);return c(n)},__wbindgen_cast_0000000000000016:function(t,e){let n=Bt(t,e);return c(n)},__wbindgen_cast_0000000000000017:function(t,e){let n=Ut(t,e);return c(n)},__wbindgen_cast_0000000000000018:function(t,e){let n=E(t,e);return c(n)},__wbindgen_cast_0000000000000019:function(t){let e=BigInt.asUintN(64,t);return c(e)},__wbindgen_cast_000000000000001a:function(t,e){var n=pt(t,e).slice();return o.__wbindgen_export4(t,e*4,4),c(n)},__wbindgen_cast_000000000000001b:function(t,e){var n=E(t,e).slice();return o.__wbindgen_export4(t,e*1,1),c(n)},__wbindgen_object_clone_ref:function(t){let e=r(t);return c(e)},__wbindgen_object_drop_ref:function(t){a(t)},__wbindgen_object_is_undefined:function(t){return r(t)===void 0}}}}function Et(s,t){o.__wasm_bindgen_func_elem_20818(s,t)}function Ft(s,t){o.__wasm_bindgen_func_elem_22862(s,t)}function Pt(s,t){let e=o.__wasm_bindgen_func_elem_22861(s,t);return a(e)}function bt(s,t,e){o.__wasm_bindgen_func_elem_8486(s,t,c(e))}function T(s,t,e){o.__wasm_bindgen_func_elem_8487(s,t,c(e))}function Ot(s,t){try{let i=o.__wbindgen_add_to_stack_pointer(-16);o.__wasm_bindgen_func_elem_8488(i,s,t);var e=u().getInt32(i+0,!0),n=u().getInt32(i+4,!0),_=u().getInt32(i+8,!0);if(_)throw a(n);return a(e)}finally{o.__wbindgen_add_to_stack_pointer(16)}}function jt(s,t){try{let _=o.__wbindgen_add_to_stack_pointer(-16);o.__wasm_bindgen_func_elem_8484(_,s,t);var e=u().getInt32(_+0,!0),n=u().getInt32(_+4,!0);if(n)throw a(e)}finally{o.__wbindgen_add_to_stack_pointer(16)}}function zt(s,t,e){try{o.__wasm_bindgen_func_elem_20222(s,t,ot(e))}finally{k[O++]=void 0}}function Mt(s,t,e){o.__wasm_bindgen_func_elem_20819(s,t,c(e))}function Lt(s,t,e){o.__wasm_bindgen_func_elem_26799(s,t,c(e))}function Nt(s,t,e,n){o.__wasm_bindgen_func_elem_35131(s,t,c(e),c(n))}var qt=[\"open\",\"closed\"],Q=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>o.__wbg_client_free(s>>>0,1)),ft=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>o.__wbg_genericsqlvirtualservermodel_free(s>>>0,1)),gt=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>o.__wbg_perspectivedebugpluginelement_free(s>>>0,1)),Z=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>o.__wbg_perspectiveviewerelement_free(s>>>0,1)),tt=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>o.__wbg_proxysession_free(s>>>0,1)),dt=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>o.__wbg_table_free(s>>>0,1)),wt=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>o.__wbg_view_free(s>>>0,1)),et=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>o.__wbg_virtualdataslice_free(s>>>0,1)),lt=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>o.__wbg_virtualserver_free(s>>>0,1));function c(s){B===k.length&&k.push(k.length+1);let t=B;return B=k[t],k[t]=s,t}function rt(s,t){if(!(s instanceof t))throw new Error(`expected instance of ${t.name}`)}function ot(s){if(O==1)throw new Error(\"out of js stack\");return k[--O]=s,O}var Y=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>s.dtor(s.a,s.b));function _t(s){let t=typeof s;if(t==\"number\"||t==\"boolean\"||s==null)return`${s}`;if(t==\"string\")return`\"${s}\"`;if(t==\"symbol\"){let _=s.description;return _==null?\"Symbol\":`Symbol(${_})`}if(t==\"function\"){let _=s.name;return typeof _==\"string\"&&_.length>0?`Function(${_})`:\"Function\"}if(Array.isArray(s)){let _=s.length,i=\"[\";_>0&&(i+=_t(s[0]));for(let b=1;b<_;b++)i+=\", \"+_t(s[b]);return i+=\"]\",i}let e=/\\[object ([^\\]]+)\\]/.exec(toString.call(s)),n;if(e&&e.length>1)n=e[1];else return toString.call(s);if(n==\"Object\")try{return\"Object(\"+JSON.stringify(s)+\")\"}catch{return\"Object\"}return s instanceof Error?`${s.name}: ${s.message}\n${s.stack}`:n}function Dt(s){s<132||(k[s]=B,B=s)}function Wt(s,t){return s=s>>>0,Vt().subarray(s/4,s/4+t)}function Ht(s,t){return s=s>>>0,$t().subarray(s/8,s/8+t)}function Bt(s,t){return s=s>>>0,Gt().subarray(s/4,s/4+t)}function pt(s,t){s=s>>>0;let e=u(),n=[];for(let _=s;_<s+4*t;_+=4)n.push(a(e.getUint32(_,!0)));return n}function Ut(s,t){return s=s>>>0,Xt().subarray(s/4,s/4+t)}function E(s,t){return s=s>>>0,P().subarray(s/1,s/1+t)}function g(s,t){return s===0?r(t):Jt(s,t)}var C=null;function u(){return(C===null||C.buffer.detached===!0||C.buffer.detached===void 0&&C.buffer!==o.memory.buffer)&&(C=new DataView(o.memory.buffer)),C}var N=null;function Vt(){return(N===null||N.byteLength===0)&&(N=new Float32Array(o.memory.buffer)),N}var q=null;function $t(){return(q===null||q.byteLength===0)&&(q=new Float64Array(o.memory.buffer)),q}var D=null;function Gt(){return(D===null||D.byteLength===0)&&(D=new Int32Array(o.memory.buffer)),D}function Jt(s,t){return s=s>>>0,Zt(s,t)}var W=null;function Xt(){return(W===null||W.byteLength===0)&&(W=new Uint32Array(o.memory.buffer)),W}var H=null;function P(){return(H===null||H.byteLength===0)&&(H=new Uint8Array(o.memory.buffer)),H}function r(s){return k[s]}function w(s,t){try{return s.apply(this,t)}catch(e){o.__wbindgen_export3(c(e))}}var k=new Array(128).fill(void 0);k.push(void 0,null,!0,!1);var B=k.length;function d(s){return s==null}function F(s,t,e,n){let _={a:s,b:t,cnt:1,dtor:e},i=(...b)=>{_.cnt++;try{return n(_.a,_.b,...b)}finally{i._wbg_cb_unref()}};return i._wbg_cb_unref=()=>{--_.cnt===0&&(_.dtor(_.a,_.b),_.a=0,Y.unregister(_))},Y.register(i,_,_),i}function S(s,t,e,n){let _={a:s,b:t,cnt:1,dtor:e},i=(...b)=>{_.cnt++;let f=_.a;_.a=0;try{return n(f,_.b,...b)}finally{_.a=f,i._wbg_cb_unref()}};return i._wbg_cb_unref=()=>{--_.cnt===0&&(_.dtor(_.a,_.b),_.a=0,Y.unregister(_))},Y.register(i,_,_),i}function Yt(s,t){let e=t(s.length*1,1)>>>0;return P().set(s,e/1),p=s.length,e}function Kt(s,t){let e=t(s.length*4,4)>>>0,n=u();for(let _=0;_<s.length;_++)n.setUint32(e+4*_,c(s[_]),!0);return p=s.length,e}function v(s,t,e){if(e===void 0){let f=vt.encode(s),l=t(f.length,1)>>>0;return P().subarray(l,l+f.length).set(f),p=f.length,l}let n=s.length,_=t(n,1)>>>0,i=P(),b=0;for(;b<n;b++){let f=s.charCodeAt(b);if(f>127)break;i[_+b]=f}if(b!==n){b!==0&&(s=s.slice(b)),_=e(_,n,n=b+s.length*3,1)>>>0;let f=P().subarray(_+b,_+n),l=vt.encodeInto(s,f);b+=l.written,_=e(_,n,b,1)>>>0}return p=b,_}var O=128;function a(s){let t=r(s);return Dt(s),t}var X=new TextDecoder(\"utf-8\",{ignoreBOM:!0,fatal:!0});X.decode();var Qt=2146435072,nt=0;function Zt(s,t){return nt+=t,nt>=Qt&&(X=new TextDecoder(\"utf-8\",{ignoreBOM:!0,fatal:!0}),X.decode(),nt=t),X.decode(P().subarray(s,s+t))}var vt=new TextEncoder,p=0,te,o;function ht(s,t){return o=s.exports,te=t,C=null,N=null,q=null,D=null,W=null,H=null,o}async function ee(s,t){if(typeof Response==\"function\"&&s instanceof Response){if(typeof WebAssembly.instantiateStreaming==\"function\")try{return await WebAssembly.instantiateStreaming(s,t)}catch(_){if(s.ok&&e(s.type)&&s.headers.get(\"Content-Type\")!==\"application/wasm\")console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\",_);else throw _}let n=await s.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{let n=await WebAssembly.instantiate(s,t);return n instanceof WebAssembly.Instance?{instance:n,module:s}:n}function e(n){switch(n){case\"basic\":case\"cors\":case\"default\":return!0}return!1}}function ne(s){if(o!==void 0)return o;s!==void 0&&(Object.getPrototypeOf(s)===Object.prototype?{module:s}=s:console.warn(\"using deprecated parameters for `initSync()`; pass a single object instead\"));let t=mt();s instanceof WebAssembly.Module||(s=new WebAssembly.Module(s));let e=new WebAssembly.Instance(s,t);return ht(e,s)}async function yt(s){if(o!==void 0)return o;s!==void 0&&(Object.getPrototypeOf(s)===Object.prototype?{module_or_path:s}=s:console.warn(\"using deprecated parameters for the initialization function; pass a single object instead\"));let t=mt();(typeof s==\"string\"||typeof Request==\"function\"&&s instanceof Request||typeof URL==\"function\"&&s instanceof URL)&&(s=fetch(s));let{instance:e,module:n}=await ee(await s,t);return ht(e,n)}export{R as Client,U as GenericSQLVirtualServerModel,V as PerspectiveDebugPluginElement,$ as PerspectiveViewerElement,j as ProxySession,z as Table,I as View,M as VirtualDataSlice,G as VirtualServer,yt as default,At as get_wasm_module,Ct as get_worker_url,Rt as init,ne as initSync,Tt as registerPlugin};\n", "\n import workerSource from \"./perspective-viewer.worker\";\n let cached = null;\n export async function getWorkerURL() {\n if (cached) return cached;\n const blob = new Blob([workerSource], {\n type: \"application/javascript\",\n });\n cached = URL.createObjectURL(blob);\n return cached;\n }\n\n async function getWorkerSource() {\n return workerSource;\n }\n\n \n function run_single_threaded(workerSource) {\n console.warn(\"Running perspective in single-threaded mode\");\n const channel = new MessageChannel();\n const f = Function(\"const self = arguments[0];\" + workerSource);\n f(channel.port2);\n channel.port2.start();\n return channel.port1;\n }\n\n export async function initialize(opts) {\n const workerOpts = opts || { type: \"module\" };\n try {\n if (\n typeof window !== \"undefined\" &&\n window.location &&\n window.location.protocol &&\n window.location.protocol.startsWith(\"file\")\n ) {\n console.warn(\n \"file:// protocol does not reliably support Web Workers\"\n );\n\n return run_single_threaded(await getWorkerSource());\n }\n\n const url = await getWorkerURL();\n return new Worker(url, workerOpts);\n } catch (e) {\n console.error(\n \"Error instantiating worker; falling back to single-threaded mode\",\n e\n );\n\n return run_single_threaded(await getWorkerSource());\n }\n }\n\n\n export default getWorkerURL;\n ", "// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport type * as wasm_module_type from \"../../dist/wasm/perspective-viewer.js\";\nimport { load_wasm_stage_0 } from \"@perspective-dev/client/src/ts/wasm/decompress.ts\";\n\n// @ts-ignore\nimport * as worker_url from \"./perspective-viewer.worker\";\n\nexport async function init_client(\n wasm_binary:\n | Promise<Response | ArrayBuffer | Uint8Array>\n | Response\n | ArrayBuffer\n | Uint8Array,\n wasm_module?: typeof wasm_module_type,\n) {\n // @ts-ignore\n const url = await worker_url.getWorkerURL();\n const [wasm_module2, module_or_path] = await Promise.all([\n wasm_module === undefined ? import(url) : wasm_module,\n load_wasm_stage_0(wasm_binary).then((unzipped) =>\n WebAssembly.compile(unzipped as BufferSource),\n ),\n ]);\n\n await wasm_module2.default({ module_or_path });\n await wasm_module2.init(module_or_path, url);\n}\n", "// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\n/**\n * Module for the `<perspective-viewer>` custom element. This module has no\n * (real) exports, but importing it has a side effect: the\n * `PerspectiveViewerElement` class is registered as a custom element, after\n * which it can be used as a standard DOM element.\n *\n * Though `<perspective-viewer>` is written mostly in Rust, the nature\n * of WebAssembly's compilation makes it a dynamic module; in order to\n * guarantee that the Custom Elements extension methods are registered\n * synchronously with this package's import, we need perform said registration\n * within this wrapper module. As a result, the API methods of the Custom\n * Elements are all `async` (as they must await the wasm module instance).\n *\n * The documentation in this module defines the instance structure of a\n * `<perspective-viewer>` DOM object instantiated typically, through HTML or any\n * relevent DOM method e.g. `document.createElement(\"perspective-viewer\")` or\n * `document.getElementsByTagName(\"perspective-viewer\")`.\n *\n * @module perspective-viewer\n */\n\nimport \"regular-layout\";\n\nexport { IPerspectiveViewerPlugin } from \"./plugin\";\nexport { HTMLPerspectiveViewerPluginElement } from \"./plugin\";\nexport { providers } from \"./providers\";\nexport type { AgentProviderPreset } from \"./providers\";\n\nexport {\n createNumberFormatter,\n createDatetimeFormatter,\n createDateFormatter,\n sourceColumn,\n} from \"./column-format\";\nexport type { NumberFormatConfig, DateFormatConfig } from \"./column-format\";\n\nexport type * from \"./extensions.ts\";\nexport { PerspectiveSelectDetail } from \"./select-detail.ts\";\nexport type * from \"./ts-rs/ViewerConfigUpdate.d.ts\";\nexport type * from \"./ts-rs/ViewerConfig.d.ts\";\nexport type * from \"./ts-rs/WorkspaceConfigUpdate.d.ts\";\nexport type * from \"./ts-rs/WorkspaceConfig.d.ts\";\nexport type * from \"./ts-rs/Filter.d.ts\";\nexport type * from \"./ts-rs/FilterTerm.d.ts\";\nexport type * from \"./ts-rs/FilterReducer.d.ts\";\nexport type * from \"./ts-rs/PluginStaticConfig.ts\";\nexport type * from \"./ts-rs/ExportMethod.d.ts\";\nexport type * from \"./ts-rs/PanelOptions.d.ts\";\nexport type * from \"./ts-rs/SaveWorkspaceOptions.d.ts\";\nexport type * from \"./ts-rs/ClientOptions.d.ts\";\nexport type * from \"./ts-rs/ExportOptions.d.ts\";\nexport type * from \"./ts-rs/GetTableOptions.d.ts\";\nexport type * from \"./ts-rs/GetClientOptions.d.ts\";\nexport type * from \"./ts-rs/GetViewOptions.d.ts\";\nexport type * from \"./ts-rs/GetViewMode.d.ts\";\n\nexport { init_client } from \"./bootstrap\";\nimport { init_client } from \"./bootstrap\";\n\nexport default { init_client };\n", "// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport perspective_viewer from \"./perspective-viewer.ts\";\nexport * from \"./perspective-viewer.ts\";\n\nconst url = new URL(\"../wasm/perspective-viewer.wasm\", import.meta.url);\nawait perspective_viewer.init_client(fetch(url));\n\nexport default perspective_viewer;\n"],
5
- "mappings": "AAuHO,IAAMA,EAAsB,CAClC,KAAM,eACN,YAAa,aACb,MAAO,CAAC,EACR,SAAU,CAAC,CACZ,ECnBaC,EAA2B,OAAO,OA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",
6
- "names": ["EMPTY_PANEL", "DEFAULT_PHYSICS", "dedupe_sort", "physics", "result", "pos", "dedupe_positions", "positions", "a", "b", "collect_track_positions", "panel", "orientation", "start", "end", "current", "range", "i", "size", "next", "child", "find_track_index", "value", "index", "build_cells", "colPositions", "rowPositions", "colStart", "colEnd", "rowStart", "rowEnd", "selected", "col_start", "col_end", "row_start", "row_end", "children", "sizes", "isHorizontal", "cells", "host_template", "rowTemplate", "colTemplate", "child_template", "slot", "rowPart", "colPart", "zIndex", "create_css_grid_layout", "layout", "overlay", "stacked", "tab", "createTemplate", "s", "formatGridLine", "css", "cell", "create_css_maximize_layout", "name", "VIEW_WINDOW", "calculate_intersection", "column", "row", "check_dividers", "calculate_intersection_recursive", "parent_orientation", "view_window", "path", "col_width", "row_height", "is_vertical", "position", "start_key", "end_key", "rect_dim", "current_pos", "total_size", "next_pos", "divider_threshold", "remove_child", "newChild", "c", "p", "tab_layout", "newChildren", "_", "newSizes", "remove_and_redistribute", "modified", "updated", "arr", "removed_size", "remaining_total", "proportion", "insert_child", "createChildPanel", "childId", "equal_share", "redistribute", "restPath", "newSplitPanel", "targetChild", "childOrientation", "updatedChild", "count", "total", "sum", "val", "redistribute_panel_sizes", "delta", "deltas", "add_and_redistribute", "before_total", "after_total", "viewWindowToLocalRect", "window", "box", "style", "margin", "paddingLeft", "paddingTop", "contentWidth", "contentHeight", "x", "y", "width", "height", "marginTop", "marginRight", "marginBottom", "marginLeft", "updateOverlaySheet", "drag_target", "local", "flatten", "flattenedChildren", "flattenedSizes", "childSize", "flattenedChild", "j", "calculate_path", "calculate_path_recursive", "calculate_presize_paths", "walk_layout", "parentOrientation", "viewWindow", "col", "isVertical", "startKey", "endKey", "currentPos", "totalSize", "nextPos", "childWindow", "PresizeQueue", "_target", "_eventName", "_onDispatch", "#resizing", "#queued", "#pending", "#generation", "fn", "resolve", "reject", "#drain", "queued", "entry", "batch", "generation", "last", "#dispatch", "cancelled", "error", "detail", "event", "calculate_edge", "drop_target", "insert_root_edge", "is_column_edge", "is_row_edge", "col_distance", "row_distance", "col_scale", "row_scale", "use_column", "insert_axis", "is_before", "axis_orientation", "result_path", "last_index", "new_panel", "calculate_view_window", "current_panel", "step", "offset", "OverlayController", "_host", "className", "mode", "host", "query", "drag_element", "grid_css", "overlay_css", "event_name", "custom_event", "new_layout", "RegularLayout", "_shadowRoot", "_panel", "_intended", "_stylesheet", "_cursor_stylesheet", "_drag_target", "_cursor_override", "_dimensions", "_physics", "_presizeQueue", "_overlayController", "_maximized", "_resize_observer", "coordinates", "target", "split", "tab_panel", "found", "_is_flattened", "recalculate_bounds", "localX", "localY", "childStyle", "dx", "dy", "self", "recalculate", "isFlattened", "selectors", "rect", "divider", "hit", "type", "old_col", "old_row", "CSS", "HTML_TEMPLATE", "css_string", "title_variable", "RegularLayoutFrame", "_container_sheet", "_tab_sheet", "_layout", "_header", "_default_tab", "_drag", "attr", "RegularLayoutTab", "_tab_panel", "_index", "parts", "HTMLPerspectiveViewerPluginElement", "view", "csv", "providers", "simple_config", "cfg", "NUMERIC_LEGACY_DEFAULTS", "DATETIME_LEGACY_DEFAULTS", "DATE_LEGACY_DEFAULTS", "mergeNumberOptions", "base", "explicit", "k", "v", "merged", "createNumberFormatter", "defaults", "opts", "createDatetimeFormatter", "preset", "createDateFormatter", "sourceColumn", "PerspectiveSelectDetail", "column_names", "removeConfigs", "insertConfigs", "extract", "input", "bin", "inst", "payload", "raw_length_view", "raw_length", "ptr", "load_wasm_stage_0", "wasm", "perspective_viewer_default", "cached", "getWorkerURL", "blob", "init_client", "wasm_binary", "wasm_module", "url", "wasm_module2", "module_or_path", "unzipped", "perspective_viewer_cdn_default"]
3
+ "sources": ["../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/core/types.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/core/constants.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/layout/generate_grid.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/layout/calculate_intersect.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/layout/remove_child.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/layout/insert_child.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/layout/redistribute_panel_sizes.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/layout/generate_overlay.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/layout/flatten.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/layout/calculate_path.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/layout/calculate_presize_paths.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/model/presize_queue.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/layout/calculate_edge.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/model/overlay_controller.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/regular-layout.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/regular-layout-frame.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/regular-layout-tab.ts", "../../../../node_modules/.pnpm/regular-layout@0.7.0/node_modules/regular-layout/src/extensions.ts", "../../src/ts/plugin.ts", "../../src/ts/providers.ts", "../../src/ts/column-format.ts", "../../src/ts/select-detail.ts", "../../../perspective-js/src/ts/wasm/decompress.ts", "../../../perspective-js/src/ts/wasm/features.ts", "../../../perspective-js/dist/wasm/perspective-migrate-js.js", "../../../perspective-js/src/ts/wasm/migrate.ts", "../../../perspective-js/src/ts/wasm/cdn.ts", "../../../perspective-js/src/ts/wasm/registry.ts", "worker:./perspective-viewer.ts", "worker-stub:./perspective-viewer.worker.ts", "../../src/ts/bootstrap.ts", "../../src/ts/perspective-viewer.ts", "../../src/ts/perspective-viewer.cdn.ts"],
4
+ "sourcesContent": ["// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\n/**\n * The overlay behavior type.\n */\nexport type OverlayMode = \"grid\" | \"absolute\";\n\n/**\n * The representation of a CSS grid, in JSON form.\n */\nexport type Layout = SplitLayout | TabLayout;\n\n/**\n * The orientation (of a `SplitPanel`).\n */\nexport type Orientation = \"horizontal\" | \"vertical\";\n\n/**\n * A logical rectange in percent-coordinates (of a (1, 1) square).\n */\nexport interface ViewWindow {\n\trow_start: number;\n\trow_end: number;\n\tcol_start: number;\n\tcol_end: number;\n}\n\n/**\n * A split panel that divides space among multiple child layouts\n * .\n * Child panels are arranged either horizontally (side by side) or vertically\n * (stacked), via the `orientation` property `\"horizzontal\"` and `\"vertical\"`\n * (respectively).\n *\n * While the type structure of `SplitLayout` allows nesting levels with the same\n * `orientation`, calling `RegularLayout.restore` with such a `Layout` will be\n * flattened to the equivalent layout with every child guaranteed to have the\n * opposite `orientation` as its parent.\n */\nexport interface SplitLayout {\n\ttype: \"split-layout\";\n\tchildren: Layout[];\n\tsizes: number[];\n\torientation: Orientation;\n}\n\n/**\n * A leaf panel node that contains a single named child element.\n */\nexport interface TabLayout {\n\ttype: \"tab-layout\";\n\ttabs: string[];\n\tselected?: number;\n}\n\n/**\n * Represents a panel location relative to a `Layout` struct.\n */\nexport type LayoutPathTraversal = number[];\n\n/**\n * Represents a draggable divider between two panels in the layout.\n *\n * Used for hit detection.\n */\nexport interface LayoutDivider {\n\tpath: LayoutPathTraversal;\n\tview_window: ViewWindow;\n\ttype: Orientation;\n}\n\n/**\n * Represents a panel location result from hit detection.\n */\nexport interface LayoutPath {\n\ttype: \"layout-path\";\n\tslot: string;\n\tpath: LayoutPathTraversal;\n\tview_window: ViewWindow;\n\tcolumn: number;\n\trow: number;\n\tcolumn_offset: number;\n\trow_offset: number;\n\torientation: Orientation;\n\tis_edge: boolean;\n\tlayout: Layout;\n}\n\n/**\n * The detail payload of the `regular-layout-before-resize` event.\n */\nexport interface PresizeDetail {\n\tcalculatePresizePaths(): Record<string, LayoutPath>;\n\n\t/**\n\t * When the transition is a drag preview, the dragged panel's name and the\n\t * {@link LayoutPath} of its preview box. The dragged panel is removed from\n\t * the layout tree during a drag (so it is absent from\n\t * {@link PresizeDetail.calculatePresizePaths}), but `path.view_window` here\n\t * is exactly where the overlay renders it, letting consumers presize the\n\t * dragged panel like any other. `null` when the pointer is outside every\n\t * drop target (the dragged panel is hidden), `undefined` for non-drag\n\t * transitions.\n\t */\n\toverlay?: { slot: string; path: LayoutPath } | null;\n}\n\n/**\n * An empty `Layout` with no panels.\n */\nexport const EMPTY_PANEL: Layout = {\n\ttype: \"split-layout\",\n\torientation: \"horizontal\",\n\tsizes: [],\n\tchildren: [],\n};\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport type { OverlayMode } from \"./types\";\n\n/**\n * Instance-specific constants which define the behavior and rendering details\n * of a `<regular-layout>`.\n */\nexport interface Physics {\n\t/**\n\t * The prefix to use for `CustomEvent`s generated by `regular-layout`, e.g.\n\t * `\"regular-layout-before-update\"`.\n\t */\n\tCUSTOM_EVENT_NAME_PREFIX: string;\n\n\t/**\n\t * The attribute name to use for matching child `Element`s to grid\n\t * positions.\n\t */\n\tCHILD_ATTRIBUTE_NAME: string;\n\n\t/**\n\t * The minimum number of pixels the mouse must move to be considered a drag.\n\t */\n\tMIN_DRAG_DISTANCE: number;\n\n\t/**\n\t * Should floating point pixel calculations be rounded. Useful for testing.\n\t */\n\tSHOULD_ROUND: boolean;\n\n\t/**\n\t * Class name to use for child elements in overlay position (dragging).\n\t */\n\tOVERLAY_CLASSNAME: string;\n\n\t/**\n\t * The percentage of the maximum resize distance that will be clamped.\n\t */\n\tMINIMUM_REDISTRIBUTION_SIZE_THRESHOLD: number;\n\n\t/**\n\t * Threshold from panel edge that is considered a split vs drop action.\n\t */\n\tSPLIT_EDGE_TOLERANCE: number;\n\n\t/**\n\t * Threshold from _container_ edge that is considered a split action on the root\n\t * node.\n\t */\n\tSPLIT_ROOT_EDGE_TOLERANCE: number;\n\n\t/**\n\t * Tolerance threshold for considering two grid track positions as identical.\n\t *\n\t * When collecting and deduplicating track positions, any positions closer than\n\t * this value are treated as the same position to avoid redundant grid tracks.\n\t */\n\tGRID_TRACK_COLLAPSE_TOLERANCE: number;\n\n\t/**\n\t * The overlay default behavior.\n\t */\n\tOVERLAY_DEFAULT: OverlayMode;\n\n\t/**\n\t * Width of split panel dividers in pixels (for hit-test purposes).\n\t */\n\tGRID_DIVIDER_SIZE: number;\n\n\t/**\n\t * Whether the grid should trigger column resize if the grid itself is not\n\t * the `event.target`.\n\t */\n\tGRID_DIVIDER_CHECK_TARGET: boolean;\n}\n\n/**\n * Like `GlobalPhysics`, but suitable for partial definition for incremental\n * updates.\n */\nexport interface PhysicsUpdate {\n\tCUSTOM_EVENT_NAME_PREFIX?: string;\n\tCHILD_ATTRIBUTE_NAME?: string;\n\tMIN_DRAG_DISTANCE?: number;\n\tSHOULD_ROUND?: boolean;\n\tOVERLAY_CLASSNAME?: string;\n\tMINIMUM_REDISTRIBUTION_SIZE_THRESHOLD?: number;\n\tSPLIT_EDGE_TOLERANCE?: number;\n\tSPLIT_ROOT_EDGE_TOLERANCE?: number;\n\tGRID_TRACK_COLLAPSE_TOLERANCE?: number;\n\tOVERLAY_DEFAULT?: OverlayMode;\n\tGRID_DIVIDER_SIZE?: number;\n\tGRID_DIVIDER_CHECK_TARGET?: boolean;\n}\n\nexport const DEFAULT_PHYSICS: Physics = Object.freeze({\n\tCUSTOM_EVENT_NAME_PREFIX: \"regular-layout\",\n\tCHILD_ATTRIBUTE_NAME: \"name\",\n\tMIN_DRAG_DISTANCE: 10,\n\tSHOULD_ROUND: false,\n\tOVERLAY_CLASSNAME: \"overlay\",\n\tMINIMUM_REDISTRIBUTION_SIZE_THRESHOLD: 0.15,\n\tSPLIT_EDGE_TOLERANCE: 0.33,\n\tSPLIT_ROOT_EDGE_TOLERANCE: 0.03,\n\tGRID_TRACK_COLLAPSE_TOLERANCE: 0.001,\n\tOVERLAY_DEFAULT: \"absolute\",\n\tGRID_DIVIDER_SIZE: 6,\n\tGRID_DIVIDER_CHECK_TARGET: true,\n});\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport { DEFAULT_PHYSICS, type Physics } from \"../core/constants.ts\";\nimport type { Layout } from \"../core/types.ts\";\n\ninterface GridCell {\n\tchild: string;\n\tcolStart: number;\n\tcolEnd: number;\n\trowStart: number;\n\trowEnd: number;\n\tzIndex?: number;\n}\n\nfunction dedupe_sort(physics: Physics, result: number[], pos: number) {\n\tif (\n\t\tresult.length === 0 ||\n\t\tMath.abs(pos - result[result.length - 1]) >\n\t\t\tphysics.GRID_TRACK_COLLAPSE_TOLERANCE\n\t) {\n\t\tresult.push(pos);\n\t}\n\n\treturn result;\n}\n\nfunction dedupe_positions(physics: Physics, positions: number[]): number[] {\n\tconst sorted = positions.sort((a, b) => a - b);\n\treturn sorted.reduce(dedupe_sort.bind(undefined, physics), []);\n}\n\nfunction collect_track_positions(\n\tpanel: Layout,\n\torientation: \"horizontal\" | \"vertical\",\n\tstart: number,\n\tend: number,\n\tphysics: Physics,\n): number[] {\n\tif (panel.type === \"tab-layout\") {\n\t\treturn [start, end];\n\t}\n\n\tconst positions: number[] = [start, end];\n\tif (panel.orientation === orientation) {\n\t\tlet current = start;\n\t\tconst range = end - start;\n\t\tfor (let i = 0; i < panel.children.length; i++) {\n\t\t\tconst size = panel.sizes[i];\n\t\t\tconst next = current + size * range;\n\t\t\tpositions.push(\n\t\t\t\t...collect_track_positions(\n\t\t\t\t\tpanel.children[i],\n\t\t\t\t\torientation,\n\t\t\t\t\tcurrent,\n\t\t\t\t\tnext,\n\t\t\t\t\tphysics,\n\t\t\t\t),\n\t\t\t);\n\n\t\t\tcurrent = next;\n\t\t}\n\t} else {\n\t\tfor (const child of panel.children) {\n\t\t\tpositions.push(\n\t\t\t\t...collect_track_positions(child, orientation, start, end, physics),\n\t\t\t);\n\t\t}\n\t}\n\n\treturn dedupe_positions(physics, positions);\n}\n\nfunction find_track_index(\n\tphysics: Physics,\n\tpositions: number[],\n\tvalue: number,\n): number {\n\tconst index = positions.findIndex(\n\t\t(pos) => Math.abs(pos - value) < physics.GRID_TRACK_COLLAPSE_TOLERANCE,\n\t);\n\n\treturn index === -1 ? 0 : index;\n}\n\nfunction build_cells(\n\tpanel: Layout,\n\tcolPositions: number[],\n\trowPositions: number[],\n\tcolStart: number,\n\tcolEnd: number,\n\trowStart: number,\n\trowEnd: number,\n\tphysics: Physics,\n): GridCell[] {\n\tif (panel.type === \"tab-layout\") {\n\t\tconst selected = panel.selected ?? 0;\n\t\tconst col_start = find_track_index(physics, colPositions, colStart);\n\t\tconst col_end = find_track_index(physics, colPositions, colEnd);\n\t\tconst row_start = find_track_index(physics, rowPositions, rowStart);\n\t\tconst row_end = find_track_index(physics, rowPositions, rowEnd);\n\n\t\t// Stacked tabs all occupy the same cell, overlapping. Only the selected\n\t\t// frame is lifted (`z-index:1`) so its content sits on top; the rest\n\t\t// self-hide their content and just contribute their tab. Keeping the\n\t\t// max frame `z-index` at 1 lets the drag overlay sit above any stack\n\t\t// with a small constant (2). A single-tab stack\n\t\t// emits one placement with no `z-index`, so non-stacked output is\n\t\t// unchanged.\n\t\treturn panel.tabs.map((child, i) => ({\n\t\t\tchild,\n\t\t\tcolStart: col_start,\n\t\t\tcolEnd: col_end,\n\t\t\trowStart: row_start,\n\t\t\trowEnd: row_end,\n\t\t\tzIndex: panel.tabs.length > 1 && i === selected ? 1 : undefined,\n\t\t}));\n\t}\n\n\tconst { children, sizes, orientation } = panel;\n\tconst isHorizontal = orientation === \"horizontal\";\n\tlet current = isHorizontal ? colStart : rowStart;\n\tconst range = isHorizontal ? colEnd - colStart : rowEnd - rowStart;\n\tconst cells: GridCell[] = [];\n\tfor (let i = 0; i < children.length; i++) {\n\t\tconst next = current + sizes[i] * range;\n\t\tif (isHorizontal) {\n\t\t\tcells.push(\n\t\t\t\t...build_cells(\n\t\t\t\t\tchildren[i],\n\t\t\t\t\tcolPositions,\n\t\t\t\t\trowPositions,\n\t\t\t\t\tcurrent,\n\t\t\t\t\tnext,\n\t\t\t\t\trowStart,\n\t\t\t\t\trowEnd,\n\t\t\t\t\tphysics,\n\t\t\t\t),\n\t\t\t);\n\t\t} else {\n\t\t\tcells.push(\n\t\t\t\t...build_cells(\n\t\t\t\t\tchildren[i],\n\t\t\t\t\tcolPositions,\n\t\t\t\t\trowPositions,\n\t\t\t\t\tcolStart,\n\t\t\t\t\tcolEnd,\n\t\t\t\t\tcurrent,\n\t\t\t\t\tnext,\n\t\t\t\t\tphysics,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\tcurrent = next;\n\t}\n\n\treturn cells;\n}\n\nconst host_template = (rowTemplate: string, colTemplate: string) =>\n\t`:host ::slotted(*){display:none}:host{display:grid;grid-template-rows:${rowTemplate};grid-template-columns:${colTemplate}}`;\n\nconst child_template = (\n\tphysics: Physics,\n\tslot: string,\n\trowPart: string,\n\tcolPart: string,\n\tzIndex?: number,\n) =>\n\t`:host ::slotted([${physics.CHILD_ATTRIBUTE_NAME}=\"${slot}\"]){display:flex;grid-column:${colPart};grid-row:${rowPart}${\n\t\tzIndex === undefined ? \"\" : `;z-index:${zIndex}`\n\t}}`;\n\n/**\n * Generates CSS Grid styles to render a layout tree.\n * Creates grid-template-rows, grid-template-columns, and positioning rules for\n * all child panels.\n *\n * @param layout - The layout tree to convert to CSS\n * @param round - If true, rounds percentages to whole numbers. Useful for\n * avoiding sub-pixel rendering issues. Defaults to false.\n * @returns CSS string containing :host and ::slotted rules implementing the\n * layout.\n *\n * @example\n * ```typescript\n * const layout = {\n * type: \"split-layout\",\n * orientation: \"horizontal\",\n * children: [\n * { type: \"tab-layout\", tabs: \"sidebar\" },\n * { type: \"tab-layout\", tabs: \"main\" }\n * ],\n * sizes: [0.25, 0.75]\n * };\n *\n * const css = create_css_grid_layout(layout);\n * // Returns CSS like:\n * // :host { display: grid; grid-template-columns: 25% 75%; ... }\n * // :host ::slotted([name=sidebar]) { grid-column: 1; grid-row: 1; }\n * // :host ::slotted([name=main]) { grid-column: 2; grid-row: 1; }\n * ```\n */\nexport function create_css_grid_layout(\n\tlayout: Layout,\n\toverlay?: [string, string],\n\tphysics: Physics = DEFAULT_PHYSICS,\n): string {\n\tif (layout.type === \"tab-layout\") {\n\t\tconst selected = layout.selected ?? 0;\n\t\tconst stacked = layout.tabs.length > 1;\n\t\treturn [\n\t\t\thost_template(\"100%\", \"100%\"),\n\t\t\t...layout.tabs.map((tab, i) =>\n\t\t\t\tchild_template(\n\t\t\t\t\tphysics,\n\t\t\t\t\ttab,\n\t\t\t\t\t\"1\",\n\t\t\t\t\t\"1\",\n\t\t\t\t\tstacked && i === selected ? 1 : undefined,\n\t\t\t\t),\n\t\t\t),\n\t\t].join(\"\\n\");\n\t}\n\n\tconst createTemplate = (positions: number[]) => {\n\t\tconst sizes = positions\n\t\t\t.slice(0, -1)\n\t\t\t.map((pos, i) => positions[i + 1] - pos);\n\t\treturn sizes\n\t\t\t.map((s) => `${physics.SHOULD_ROUND ? Math.round(s * 100) : s * 100}fr`)\n\t\t\t.join(\" \");\n\t};\n\n\tconst colPositions = collect_track_positions(\n\t\tlayout,\n\t\t\"horizontal\",\n\t\t0,\n\t\t1,\n\t\tphysics,\n\t);\n\n\tconst colTemplate = createTemplate(colPositions);\n\tconst rowPositions = collect_track_positions(\n\t\tlayout,\n\t\t\"vertical\",\n\t\t0,\n\t\t1,\n\t\tphysics,\n\t);\n\n\tconst rowTemplate = createTemplate(rowPositions);\n\tconst formatGridLine = (start: number, end: number) =>\n\t\tend - start === 1 ? `${start + 1}` : `${start + 1} / ${end + 1}`;\n\n\tconst cells = build_cells(\n\t\tlayout,\n\t\tcolPositions,\n\t\trowPositions,\n\t\t0,\n\t\t1,\n\t\t0,\n\t\t1,\n\t\tphysics,\n\t);\n\n\tconst css = [host_template(rowTemplate, colTemplate)];\n\tfor (const cell of cells) {\n\t\tconst colPart = formatGridLine(cell.colStart, cell.colEnd);\n\t\tconst rowPart = formatGridLine(cell.rowStart, cell.rowEnd);\n\t\tcss.push(\n\t\t\tchild_template(physics, cell.child, rowPart, colPart, cell.zIndex),\n\t\t);\n\t\tif (cell.child === overlay?.[1]) {\n\t\t\tcss.push(child_template(physics, overlay[0], rowPart, colPart));\n\t\t\tcss.push(\n\t\t\t\t`:host ::slotted([${physics.CHILD_ATTRIBUTE_NAME}=${overlay[0]}]){z-index:2}`,\n\t\t\t);\n\t\t}\n\t}\n\n\treturn css.join(\"\\n\");\n}\n\n/**\n * Generates CSS Grid styles that render a single panel maximized to fill the\n * entire layout, hiding all other slotted children.\n *\n * @param name - The name of the panel to maximize.\n * @param physics - Instance constants (defaults to {@link DEFAULT_PHYSICS}).\n * @returns CSS string showing only `name`, full-size.\n */\nexport function create_css_maximize_layout(\n\tname: string,\n\tphysics: Physics = DEFAULT_PHYSICS,\n): string {\n\treturn [\n\t\thost_template(\"100%\", \"100%\"),\n\t\tchild_template(physics, name, \"1\", \"1\"),\n\t].join(\"\\n\");\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport type {\n\tLayoutPath,\n\tLayoutDivider,\n\tLayout,\n\tViewWindow,\n\tLayoutPathTraversal,\n} from \"../core/types.ts\";\n\nconst VIEW_WINDOW = {\n\trow_start: 0,\n\trow_end: 1,\n\tcol_start: 0,\n\tcol_end: 1,\n};\n\n/**\n * Determines which panel or divider is located at a given position in the\n * layout.\n *\n * @param column - Horizontal position as a fraction (0-1) of the container width\n * @param row - Vertical position as a fraction (0-1) of the container height\n * @param layout - The layout tree to search\n * @param check_dividers - Whether `LayoutDivider` intersection should be\n * checked, which you may not want for e.g. `drop` actions.\n * @returns The panel path if over a panel, a divider if over a resizable\n * boundary, or null if outside all panels\n */\nexport function calculate_intersection(\n\tcolumn: number,\n\trow: number,\n\tlayout: Layout,\n\tcheck_dividers?: null,\n): LayoutPath | null;\n\nexport function calculate_intersection(\n\tcolumn: number,\n\trow: number,\n\tlayout: Layout,\n\tcheck_dividers?: { rect: DOMRect; size: number },\n): LayoutPath | null | LayoutDivider;\n\nexport function calculate_intersection(\n\tcolumn: number,\n\trow: number,\n\tlayout: Layout,\n\tcheck_dividers?: { rect: DOMRect; size: number } | null,\n): LayoutPath | null | LayoutDivider;\n\nexport function calculate_intersection(\n\tcolumn: number,\n\trow: number,\n\tlayout: Layout,\n\tcheck_dividers: { rect: DOMRect; size: number } | null = null,\n): LayoutPath | null | LayoutDivider {\n\treturn calculate_intersection_recursive(column, row, layout, check_dividers);\n}\n\nfunction calculate_intersection_recursive(\n\tcolumn: number,\n\trow: number,\n\tpanel: Layout,\n\tcheck_dividers: { rect: DOMRect; size: number } | null,\n\tparent_orientation: \"horizontal\" | \"vertical\" | null = null,\n\tview_window: ViewWindow = structuredClone(VIEW_WINDOW),\n\tpath: LayoutPathTraversal = [],\n): LayoutPath | null | LayoutDivider {\n\tif (column < 0 || row < 0 || column > 1 || row > 1) {\n\t\treturn null;\n\t}\n\n\t// Base case: if this is a child panel, return its name\n\tif (panel.type === \"tab-layout\") {\n\t\tconst selected = panel.selected ?? 0;\n\t\tconst col_width = view_window.col_end - view_window.col_start;\n\t\tconst row_height = view_window.row_end - view_window.row_start;\n\t\treturn {\n\t\t\ttype: \"layout-path\",\n\t\t\tlayout: panel,\n\t\t\tslot: panel.tabs[selected],\n\t\t\tpath,\n\t\t\tview_window,\n\t\t\tis_edge: false,\n\t\t\tcolumn,\n\t\t\trow,\n\t\t\tcolumn_offset: (column - view_window.col_start) / col_width,\n\t\t\trow_offset: (row - view_window.row_start) / row_height,\n\t\t\torientation: parent_orientation || \"horizontal\",\n\t\t};\n\t}\n\n\t// For split panels, determine which child was hit\n\tconst is_vertical = panel.orientation === \"vertical\";\n\tconst position = is_vertical ? row : column;\n\tconst start_key = is_vertical ? \"row_start\" : \"col_start\";\n\tconst end_key = is_vertical ? \"row_end\" : \"col_end\";\n\tconst rect_dim = is_vertical\n\t\t? check_dividers?.rect?.height\n\t\t: check_dividers?.rect?.width;\n\n\tlet current_pos = view_window[start_key];\n\tconst total_size = view_window[end_key] - view_window[start_key];\n\tfor (let i = 0; i < panel.children.length; i++) {\n\t\tconst next_pos = current_pos + total_size * panel.sizes[i];\n\n\t\t// Check if position is on a divider\n\t\tif (check_dividers && rect_dim) {\n\t\t\tconst divider_threshold = check_dividers.size / rect_dim;\n\t\t\tif (Math.abs(position - next_pos) < divider_threshold) {\n\t\t\t\treturn {\n\t\t\t\t\tpath: [...path, i],\n\t\t\t\t\ttype: panel.orientation,\n\t\t\t\t\tview_window: {\n\t\t\t\t\t\t...view_window,\n\t\t\t\t\t\t[start_key]: current_pos,\n\t\t\t\t\t\t[end_key]: next_pos,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\n\t\t// Check if position falls within this child's bounds\n\t\tif (\n\t\t\tposition >= current_pos &&\n\t\t\t(position < next_pos || i === panel.children.length - 1)\n\t\t) {\n\t\t\treturn calculate_intersection_recursive(\n\t\t\t\tcolumn,\n\t\t\t\trow,\n\t\t\t\tpanel.children[i],\n\t\t\t\tcheck_dividers,\n\t\t\t\tpanel.orientation,\n\t\t\t\t{\n\t\t\t\t\t...view_window,\n\t\t\t\t\t[start_key]: current_pos,\n\t\t\t\t\t[end_key]: next_pos,\n\t\t\t\t},\n\t\t\t\t[...path, i],\n\t\t\t);\n\t\t}\n\n\t\tcurrent_pos = next_pos;\n\t}\n\n\t// If we get here, the hit was outside all children (possibly in a gap or\n\t// boundary).\n\treturn null;\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport type { Layout, TabLayout } from \"../core/types.ts\";\nimport { EMPTY_PANEL } from \"../core/types.ts\";\n\n/**\n * Removes a child panel from the layout tree by its name.\n *\n * Redistributes the removed panel's space proportionally among remaining\n * siblings. Automatically collapses split panels when only one child remains.\n *\n * @param panel - The root layout tree to remove from.\n * @param child - Name of the child panel to remove.\n * @returns A new layout tree with the child removed (original is not mutated).\n * Returns `EMPTY_PANEL` if the last panel is removed.\n */\nexport function remove_child(panel: Layout, child: string): Layout {\n\t// If this is a child panel, handle tab removal\n\tif (panel.type === \"tab-layout\") {\n\t\tif (panel.tabs.includes(child)) {\n\t\t\tconst newChild = panel.tabs.filter((c) => c !== child);\n\t\t\tif (newChild.length === 0) {\n\t\t\t\treturn structuredClone(EMPTY_PANEL);\n\t\t\t}\n\t\t\treturn {\n\t\t\t\ttype: \"tab-layout\",\n\t\t\t\ttabs: newChild,\n\t\t\t};\n\t\t}\n\n\t\treturn structuredClone(panel);\n\t}\n\n\t// Clone the panel structure\n\tconst result = structuredClone(panel);\n\n\t// Try to remove the child from this split panel's children\n\tconst index = result.children.findIndex((p) => {\n\t\tif (p.type === \"tab-layout\") {\n\t\t\treturn p.tabs.includes(child);\n\t\t}\n\n\t\treturn false;\n\t});\n\n\tif (index !== -1) {\n\t\tconst tab_layout = result.children[index] as TabLayout;\n\t\tif (tab_layout.tabs.length === 1) {\n\t\t\t// Found the child at this level - remove it\n\t\t\tconst newChildren = result.children.filter((_, i) => i !== index);\n\t\t\tconst newSizes = remove_and_redistribute(result.sizes, index);\n\n\t\t\t// If only one child remains, collapse the split panel\n\t\t\tif (newChildren.length === 1) {\n\t\t\t\treturn newChildren[0];\n\t\t\t}\n\n\t\t\tresult.children = newChildren;\n\t\t\tresult.sizes = newSizes;\n\t\t} else {\n\t\t\ttab_layout.tabs.splice(tab_layout.tabs.indexOf(child), 1);\n\t\t\tif (\n\t\t\t\ttab_layout.selected &&\n\t\t\t\ttab_layout.selected >= tab_layout.tabs.length\n\t\t\t) {\n\t\t\t\ttab_layout.selected--;\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t// Child not found at this level - recursively search children\n\tlet modified = false;\n\tconst newChildren = result.children.map((p) => {\n\t\tif (p.type === \"split-layout\") {\n\t\t\tconst updated = remove_child(p, child);\n\t\t\tif (updated !== p) {\n\t\t\t\tmodified = true;\n\t\t\t}\n\n\t\t\treturn updated;\n\t\t}\n\n\t\treturn p;\n\t});\n\n\tif (modified) {\n\t\tresult.children = newChildren;\n\t}\n\n\treturn result;\n}\n\nfunction remove_and_redistribute(arr: number[], index: number): number[] {\n\tconst result = [];\n\n\t// Get the size of the element being removed\n\tconst removed_size = arr[index];\n\n\t// Calculate the total of remaining elements\n\tlet remaining_total = 0;\n\tfor (let i = 0; i < arr.length; i++) {\n\t\tif (i !== index) {\n\t\t\tremaining_total += arr[i];\n\t\t}\n\t}\n\n\t// Distribute the removed size proportionally to remaining elements\n\tfor (let i = 0; i < arr.length; i++) {\n\t\tif (i !== index) {\n\t\t\tconst proportion = arr[i] / remaining_total;\n\t\t\tresult.push(arr[i] + removed_size * proportion);\n\t\t}\n\t}\n\n\treturn result;\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport type { Layout, LayoutPathTraversal } from \"../core/types.ts\";\n\n/**\n * Inserts a new child panel into the layout tree at a specified location.\n * Creates a split panel if necessary and redistributes sizes equally among all\n * children.\n *\n * @param panel - The root layout tree to insert into\n * @param child - Unique identifier for the new child panel\n * @param path - Array of indices defining where to insert. Empty array inserts\n * at root level.\n * @param orientation - Orientation for newly created split panels. Defaults to\n * \"horizontal\".\n * @param is_edge - If true, create the split at the parent level.\n * @returns A new layout tree with the child inserted (original is not mutated).\n */\nexport function insert_child(\n\tpanel: Layout,\n\tchild: string,\n\tpath: LayoutPathTraversal,\n\torientation?: \"horizontal\" | \"vertical\",\n): Layout {\n\tconst createChildPanel = (childId: string): Layout => ({\n\t\ttype: \"tab-layout\",\n\t\ttabs: [childId],\n\t});\n\n\tif (path.length === 0) {\n\t\t// Insert at root level\n\t\tif (panel.type === \"tab-layout\") {\n\t\t\t// Add to existing tab-layout as a tab\n\t\t\treturn {\n\t\t\t\ttype: \"tab-layout\",\n\t\t\t\ttabs: [child, ...panel.tabs],\n\t\t\t};\n\t\t} else if (orientation) {\n\t\t\t// When inserting at edge of root, wrap the entire panel in a new split\n\t\t\treturn {\n\t\t\t\ttype: \"split-layout\",\n\t\t\t\torientation: orientation,\n\t\t\t\tchildren: [createChildPanel(child), panel],\n\t\t\t\tsizes: [0.5, 0.5],\n\t\t\t};\n\t\t} else {\n\t\t\t// Append to existing split-layout\n\t\t\tconst newChildren = [...panel.children, createChildPanel(child)];\n\t\t\tconst newSizes = [...panel.sizes, equal_share(newChildren.length)];\n\t\t\treturn {\n\t\t\t\t...panel,\n\t\t\t\tchildren: newChildren,\n\t\t\t\tsizes: redistribute(newSizes),\n\t\t\t};\n\t\t}\n\t}\n\n\t// Navigate down the path\n\tconst [index, ...restPath] = path;\n\n\t// Special case: when orientation is provided and restPath is empty, handle edge insertion\n\tif (orientation && restPath.length === 0) {\n\t\t// If panel is a split-layout with the same orientation, insert into its children\n\t\tif (panel.type === \"split-layout\" && panel.orientation === orientation) {\n\t\t\tconst newChildren = [...panel.children];\n\t\t\tnewChildren.splice(index, 0, createChildPanel(child));\n\t\t\tconst newSizes = [...panel.sizes];\n\t\t\tnewSizes.splice(index, 0, equal_share(newChildren.length));\n\t\t\treturn {\n\t\t\t\t...panel,\n\t\t\t\tchildren: newChildren,\n\t\t\t\tsizes: redistribute(newSizes),\n\t\t\t};\n\t\t}\n\n\t\t// Otherwise, wrap the entire panel in a new split at the edge\n\t\tconst children =\n\t\t\tindex === 0\n\t\t\t\t? [createChildPanel(child), panel]\n\t\t\t\t: [panel, createChildPanel(child)];\n\n\t\treturn {\n\t\t\ttype: \"split-layout\",\n\t\t\torientation: orientation,\n\t\t\tchildren,\n\t\t\tsizes: [0.5, 0.5],\n\t\t};\n\t}\n\n\tif (panel.type === \"tab-layout\") {\n\t\t// Stack into child array only when ALL of these conditions are met:\n\t\t// 1. Path has exactly one element (restPath is empty)\n\t\t// 2. Orientation was NOT explicitly provided (orientation is undefined)\n\t\t// 3. Index is within the valid stacking range [0, child.length]\n\t\tif (\n\t\t\trestPath.length === 0 &&\n\t\t\torientation === undefined &&\n\t\t\tindex >= 0 &&\n\t\t\tindex <= panel.tabs.length\n\t\t) {\n\t\t\tconst newChild = [...panel.tabs];\n\t\t\tnewChild.splice(index, 0, child);\n\t\t\treturn {\n\t\t\t\t...panel,\n\t\t\t\ttabs: newChild,\n\t\t\t};\n\t\t}\n\n\t\t// Otherwise, wrap in a split panel and recurse\n\t\tconst newPanel: Layout = {\n\t\t\ttype: \"split-layout\",\n\t\t\torientation: orientation || \"horizontal\",\n\t\t\tchildren: [panel],\n\t\t\tsizes: [1],\n\t\t};\n\n\t\treturn insert_child(newPanel, child, path, orientation);\n\t}\n\n\tif (restPath.length === 0 || index === panel.children.length) {\n\t\tif (orientation && panel.children[index]) {\n\t\t\t// When inserting at an edge, create a split panel with the new child and existing child\n\t\t\tconst newSplitPanel: Layout = {\n\t\t\t\ttype: \"split-layout\",\n\t\t\t\torientation: orientation,\n\t\t\t\tchildren: [createChildPanel(child), panel.children[index]],\n\t\t\t\tsizes: [0.5, 0.5],\n\t\t\t};\n\n\t\t\tconst newChildren = [...panel.children];\n\t\t\tnewChildren[index] = newSplitPanel;\n\t\t\treturn {\n\t\t\t\t...panel,\n\t\t\t\tchildren: newChildren,\n\t\t\t\tsizes: redistribute(panel.sizes),\n\t\t\t};\n\t\t}\n\n\t\t// Insert at this level at the specified index\n\t\tconst newChildren = [...panel.children];\n\t\tnewChildren.splice(index, 0, createChildPanel(child));\n\t\tconst newSizes = [...panel.sizes];\n\t\tnewSizes.splice(index, 0, equal_share(newChildren.length));\n\t\treturn {\n\t\t\t...panel,\n\t\t\tchildren: newChildren,\n\t\t\tsizes: redistribute(newSizes),\n\t\t};\n\t}\n\n\tconst targetChild = panel.children[index];\n\n\t// Determine the orientation to pass down when navigating into a tab-layout\n\tconst childOrientation =\n\t\ttargetChild.type === \"tab-layout\" &&\n\t\trestPath.length > 0 &&\n\t\torientation !== undefined\n\t\t\t? panel.orientation === \"horizontal\"\n\t\t\t\t? \"vertical\"\n\t\t\t\t: \"horizontal\"\n\t\t\t: orientation;\n\n\tconst updatedChild = insert_child(\n\t\ttargetChild,\n\t\tchild,\n\t\trestPath,\n\t\tchildOrientation,\n\t);\n\n\tconst newChildren = [...panel.children];\n\tnewChildren[index] = updatedChild;\n\treturn {\n\t\t...panel,\n\t\tchildren: newChildren,\n\t};\n}\n\n/**\n * The un-normalized share for a child newly spliced into a sibling list of\n * `count` (post-insert). Existing siblings' sizes sum to 1, so `1 / (count -\n * 1)` \u2014 \"one old sibling's worth\" \u2014 normalizes to an equal `1 / count` split\n * via {@link redistribute}. Inserting into a previously EMPTY split\n * (`count === 1`) has no old siblings to take a share of; the divisor floors\n * at 1 so the sole child gets the whole axis (`1 / 0` is `Infinity`, which\n * {@link redistribute} would smear into `NaN` sizes \u2014 an invisibly corrupt\n * tree whose grid drops every subsequent insert into column 1).\n */\nfunction equal_share(count: number): number {\n\treturn 1 / Math.max(1, count - 1);\n}\n\nfunction redistribute(arr: number[]): number[] {\n\tconst total = arr.reduce((sum, val) => sum + val, 0);\n\tif (!Number.isFinite(total) || total <= 0) {\n\t\t// A non-finite or degenerate total would propagate to EVERY size (`x /\n\t\t// NaN`), silently corrupting the tree for all future layouts - fall\n\t\t// back to an equal split instead of normalizing.\n\t\treturn arr.map(() => 1 / arr.length);\n\t}\n\n\treturn arr.map((val) => val / total);\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport { DEFAULT_PHYSICS } from \"../core/constants.ts\";\nimport type { Layout, LayoutPathTraversal } from \"../core/types.ts\";\n\n/**\n * Adjusts panel sizes during a drag operation on a divider.\n *\n * The `delta` is distributed proportionally among affected panels, maintaining\n * the sum:\n *\n * - Panels before and including the path index shrink by delta.\n * - Panels after the path index grow by delta.\n *\n * @param panel - The root layout tree to modify.\n * @param path - Path to the divider being dragged (identifies which split panel\n * to resize).\n * @param delta - Amount to resize, as a fraction (0-1). Positive values grow\n * panels before the divider, negative values shrink them.\n * @returns A new layout tree with updated sizes (original is not mutated).\n * ```\n */\nexport function redistribute_panel_sizes(\n\tpanel: Layout,\n\tpath: LayoutPathTraversal,\n\tdelta: number | undefined,\n\tphysics = DEFAULT_PHYSICS,\n): Layout {\n\t// Clone the entire panel structure\n\tconst result = structuredClone(panel);\n\n\t// Find the orientation of the insertion panel,\n\t// and scale the delta on the respective axis if aligned.\n\tlet current: Layout = result;\n\tconst deltas = { horizontal: delta || 0, vertical: delta || 0 };\n\tfor (let i = 0; i < path.length - 1; i++) {\n\t\tif (current.type === \"split-layout\") {\n\t\t\tdeltas[current.orientation] /= current.sizes[path[i]];\n\t\t\tcurrent = current.children[path[i]];\n\t\t}\n\t}\n\n\t// Apply the redistribution at the final path index\n\tif (current.type === \"split-layout\") {\n\t\tif (delta === undefined) {\n\t\t\tcurrent.sizes = current.sizes.map((_) => 1 / current.sizes.length);\n\t\t} else {\n\t\t\tconst delta = deltas[current.orientation];\n\t\t\tconst index = path[path.length - 1];\n\n\t\t\t// It would be fun to remove this condition.\n\t\t\tif (index < current.sizes.length - 1) {\n\t\t\t\tcurrent.sizes = add_and_redistribute(\n\t\t\t\t\tphysics,\n\t\t\t\t\tcurrent.sizes,\n\t\t\t\t\tindex,\n\t\t\t\t\tdelta,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result;\n}\n\nfunction add_and_redistribute(\n\tphysics: typeof DEFAULT_PHYSICS,\n\tarr: number[],\n\tindex: number,\n\tdelta: number,\n): number[] {\n\tconst result = [...arr];\n\tlet before_total = 0;\n\tfor (let i = 0; i <= index; i++) {\n\t\tbefore_total += arr[i];\n\t}\n\n\tlet after_total = 0;\n\tfor (let i = index + 1; i < arr.length; i++) {\n\t\tafter_total += arr[i];\n\t}\n\n\t// Clamp `delta` to prevent redistributing either side to 0.\n\tdelta =\n\t\tMath.sign(delta) *\n\t\tMath.min(\n\t\t\tMath.abs(delta),\n\t\t\t(1 - physics.MINIMUM_REDISTRIBUTION_SIZE_THRESHOLD) *\n\t\t\t\t(delta > 0 ? before_total : after_total),\n\t\t);\n\n\t// Redistribute elements\n\tfor (let i = 0; i <= index; i++) {\n\t\tconst proportion = arr[i] / before_total;\n\t\tresult[i] = arr[i] - delta * proportion;\n\t}\n\n\tfor (let i = index + 1; i < arr.length; i++) {\n\t\tconst proportion = arr[i] / after_total;\n\t\tresult[i] = arr[i] + delta * proportion;\n\t}\n\n\treturn result;\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport { DEFAULT_PHYSICS } from \"../core/constants\";\nimport type { LayoutPath, ViewWindow } from \"../core/types\";\n\n/**\n * Converts a {@link ViewWindow} to element-relative pixel coordinates,\n * accounting for padding and optionally CSS `gap` and child `margin`.\n *\n * @param window - The view window in normalized 0\u20131 coordinates.\n * @param box - The element's bounding client rect.\n * @param style - The element's computed style (for padding).\n * @param margin - Optional child element's computed style (for margin inset).\n * @returns Pixel coordinates relative to the element's border-box origin.\n */\nexport function viewWindowToLocalRect(\n\twindow: ViewWindow,\n\tbox: DOMRect,\n\tstyle: CSSStyleDeclaration,\n\tmargin?: CSSStyleDeclaration,\n): { x: number; y: number; width: number; height: number } {\n\tconst paddingLeft = parseFloat(style.paddingLeft);\n\tconst paddingTop = parseFloat(style.paddingTop);\n\tconst contentWidth = box.width - paddingLeft - parseFloat(style.paddingRight);\n\tconst contentHeight =\n\t\tbox.height - paddingTop - parseFloat(style.paddingBottom);\n\n\tconst x = paddingLeft + window.col_start * contentWidth;\n\tconst y = paddingTop + window.row_start * contentHeight;\n\tlet width = (window.col_end - window.col_start) * contentWidth;\n\tlet height = (window.row_end - window.row_start) * contentHeight;\n\tif (margin) {\n\t\tconst marginTop = parseFloat(margin.marginTop);\n\t\tconst marginRight = parseFloat(margin.marginRight);\n\t\tconst marginBottom = parseFloat(margin.marginBottom);\n\t\tconst marginLeft = parseFloat(margin.marginLeft);\n\t\twidth -= marginLeft + marginRight;\n\t\theight -= marginTop + marginBottom;\n\t}\n\n\treturn { x, y, width, height };\n}\n\nexport function updateOverlaySheet(\n\tslot: string,\n\tbox: DOMRect,\n\tstyle: CSSStyleDeclaration,\n\tdrag_target: LayoutPath | null,\n\tphysics = DEFAULT_PHYSICS,\n\tmargin?: CSSStyleDeclaration,\n) {\n\tif (!drag_target) {\n\t\treturn `:host ::slotted([${physics.CHILD_ATTRIBUTE_NAME}=\"${slot}\"]){display:none;}`;\n\t}\n\n\tconst local = viewWindowToLocalRect(\n\t\tdrag_target.view_window,\n\t\tbox,\n\t\tstyle,\n\t\tmargin,\n\t);\n\n\tconst css = `display:flex;position:absolute!important;z-index:2;top:${local.y}px;left:${local.x}px;height:${local.height}px;width:${local.width}px;`;\n\treturn `::slotted([${physics.CHILD_ATTRIBUTE_NAME}=\"${slot}\"]){${css}}`;\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport type { Layout } from \"../core/types.ts\";\n\n/**\n * Flattens the layout tree by merging parent and child split panels that have\n * the same orientation and type.\n *\n * When a split panel contains a child split panel with the same orientation,\n * they are merged into a single split panel. The sizes array is scaled\n * correctly to maintain proportions.\n *\n * @param layout - The layout tree to flatten\n * @returns A new flattened layout tree (original is not mutated).\n */\nexport function flatten(layout: Layout): Layout {\n\tif (layout.type === \"tab-layout\") {\n\t\tlayout.selected = layout.selected || 0;\n\t\treturn layout;\n\t}\n\n\tconst flattenedChildren: Layout[] = [];\n\tconst flattenedSizes: number[] = [];\n\tfor (let i = 0; i < layout.children.length; i++) {\n\t\tconst child = layout.children[i];\n\t\tconst childSize = layout.sizes[i];\n\t\tconst flattenedChild = flatten(child);\n\n\t\tif (\n\t\t\tflattenedChild.type === \"split-layout\" &&\n\t\t\tflattenedChild.orientation === layout.orientation\n\t\t) {\n\t\t\tfor (let j = 0; j < flattenedChild.children.length; j++) {\n\t\t\t\tflattenedChildren.push(flattenedChild.children[j]);\n\t\t\t\tflattenedSizes.push(flattenedChild.sizes[j] * childSize);\n\t\t\t}\n\t\t} else {\n\t\t\tflattenedChildren.push(flattenedChild);\n\t\t\tflattenedSizes.push(childSize);\n\t\t}\n\t}\n\n\tif (flattenedChildren.length === 1) {\n\t\treturn flattenedChildren[0];\n\t}\n\n\treturn {\n\t\ttype: \"split-layout\",\n\t\torientation: layout.orientation,\n\t\tchildren: flattenedChildren,\n\t\tsizes: flattenedSizes,\n\t};\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport type { Layout, LayoutPathTraversal } from \"../core/types.ts\";\n\n/**\n * Calculates the index path for a panel with the given name.\n *\n * Traverses the layout tree to find the named panel and returns the\n * index path describing its position in the tree.\n *\n * @param name - The name of the panel to find.\n * @param layout - The layout tree to search.\n * @returns The panel's index path if found, `null` otherwise.\n */\nexport function calculate_path(name: string, layout: Layout): number[] | null {\n\treturn calculate_path_recursive(name, layout, []);\n}\n\nfunction calculate_path_recursive(\n\tname: string,\n\tpanel: Layout,\n\tpath: LayoutPathTraversal,\n): number[] | null {\n\tif (panel.type === \"tab-layout\") {\n\t\tif (!panel.tabs.includes(name)) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn path;\n\t}\n\n\tfor (let i = 0; i < panel.children.length; i++) {\n\t\tconst result = calculate_path_recursive(name, panel.children[i], [\n\t\t\t...path,\n\t\t\ti,\n\t\t]);\n\n\t\tif (result) {\n\t\t\treturn result;\n\t\t}\n\t}\n\n\treturn null;\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport type {\n\tLayout,\n\tLayoutPath,\n\tOrientation,\n\tViewWindow,\n} from \"../core/types.ts\";\n\n/**\n * Walks a layout tree and returns a {@link LayoutPath} for every visible\n * panel, keyed by panel name. Each path's `column`/`row` are set to the\n * center of the panel's view window, with offsets of 0.5.\n *\n * @param layout - The layout tree to walk.\n * @returns A record mapping panel names to their layout paths.\n */\nexport function calculate_presize_paths(\n\tlayout: Layout,\n): Record<string, LayoutPath> {\n\tconst result: Record<string, LayoutPath> = {};\n\twalk_layout(layout, result, [], null, {\n\t\trow_start: 0,\n\t\trow_end: 1,\n\t\tcol_start: 0,\n\t\tcol_end: 1,\n\t});\n\n\treturn result;\n}\n\nfunction walk_layout(\n\tlayout: Layout,\n\tresult: Record<string, LayoutPath>,\n\tpath: number[],\n\tparentOrientation: Orientation | null,\n\tviewWindow: ViewWindow,\n): void {\n\tif (layout.type === \"tab-layout\") {\n\t\tconst selected = layout.selected ?? 0;\n\t\tconst slot = layout.tabs[selected];\n\t\tconst col = (viewWindow.col_start + viewWindow.col_end) / 2;\n\t\tconst row = (viewWindow.row_start + viewWindow.row_end) / 2;\n\t\tresult[slot] = {\n\t\t\ttype: \"layout-path\",\n\t\t\tlayout,\n\t\t\tslot,\n\t\t\tpath,\n\t\t\tview_window: viewWindow,\n\t\t\tis_edge: false,\n\t\t\tcolumn: col,\n\t\t\trow: row,\n\t\t\tcolumn_offset: 0.5,\n\t\t\trow_offset: 0.5,\n\t\t\torientation: parentOrientation || \"horizontal\",\n\t\t};\n\n\t\treturn;\n\t}\n\n\tconst isVertical = layout.orientation === \"vertical\";\n\tconst startKey = isVertical ? \"row_start\" : \"col_start\";\n\tconst endKey = isVertical ? \"row_end\" : \"col_end\";\n\tlet currentPos = viewWindow[startKey];\n\tconst totalSize = viewWindow[endKey] - viewWindow[startKey];\n\tfor (let i = 0; i < layout.children.length; i++) {\n\t\tconst nextPos = currentPos + totalSize * layout.sizes[i];\n\t\tconst childWindow: ViewWindow = {\n\t\t\t...viewWindow,\n\t\t\t[startKey]: currentPos,\n\t\t\t[endKey]: nextPos,\n\t\t};\n\n\t\twalk_layout(\n\t\t\tlayout.children[i],\n\t\t\tresult,\n\t\t\t[...path, i],\n\t\t\tlayout.orientation,\n\t\t\tchildWindow,\n\t\t);\n\n\t\tcurrentPos = nextPos;\n\t}\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport type { Layout, LayoutPath, PresizeDetail } from \"../core/types.ts\";\nimport { calculate_presize_paths } from \"../layout/calculate_presize_paths.ts\";\n\n/**\n * The dragged panel's preview geometry during a drag transition - see\n * {@link PresizeDetail.overlay}.\n */\nexport type PresizeOverlay = { slot: string; path: LayoutPath } | null;\n\ntype Entry = {\n\tlayout: Layout;\n\tfn: () => void;\n\toverlay?: PresizeOverlay;\n\tresolve: () => void;\n\treject: (error: unknown) => void;\n};\n\n/**\n * Manages cancelable pre-resize gating for layout updates.\n *\n * Before each layout change, a cancelable `resize-before` event is dispatched\n * on the target. If the event is cancelled via `preventDefault()`, the update\n * is suspended until {@link resume} is called.\n *\n * Updates requested while one is suspended are queued, never dropped. When\n * the suspended update lands, the whole queue is drained as one batch: a\n * single `resize-before` is dispatched for the batch's final geometry (the\n * last entry's `layout`), then every entry's `fn` runs in order. Each\n * {@link run} promise resolves only once its own `fn` has run (or was\n * discarded by {@link cancelPending}).\n */\nexport class PresizeQueue {\n\t#resizing = false;\n\t#queued: Entry[] = [];\n\t#pending: (() => void) | null = null;\n\t#generation = 0;\n\n\tconstructor(\n\t\tprivate _target: EventTarget,\n\t\tprivate _eventName: string,\n\t\tprivate _onDispatch?: () => void,\n\t) {}\n\n\trun(layout: Layout, fn: () => void, overlay?: PresizeOverlay): Promise<void> {\n\t\treturn new Promise<void>((resolve, reject) => {\n\t\t\tthis.#queued.push({ layout, fn, overlay, resolve, reject });\n\t\t\tif (!this.#resizing) {\n\t\t\t\tvoid this.#drain();\n\t\t\t}\n\t\t});\n\t}\n\n\tresume(): void {\n\t\tif (this.#pending) {\n\t\t\tconst resolve = this.#pending;\n\t\t\tthis.#pending = null;\n\t\t\tresolve();\n\t\t}\n\t}\n\n\t/**\n\t * Discards every queued update and the suspended one, if any, resolving\n\t * their {@link run} promises without running their `fn`. A suspended\n\t * transition still waits for {@link resume}, so a consumer mid-presize is\n\t * never resumed out from under it, but its `fn` is skipped when it lands.\n\t */\n\tcancelPending(): void {\n\t\tthis.#generation++;\n\t\tconst queued = this.#queued;\n\t\tthis.#queued = [];\n\t\tfor (const entry of queued) {\n\t\t\tentry.resolve();\n\t\t}\n\t}\n\n\tasync #drain(): Promise<void> {\n\t\tthis.#resizing = true;\n\t\ttry {\n\t\t\twhile (this.#queued.length > 0) {\n\t\t\t\tconst batch = this.#queued;\n\t\t\t\tthis.#queued = [];\n\t\t\t\tconst generation = this.#generation;\n\t\t\t\tconst last = batch[batch.length - 1];\n\t\t\t\tif (!this.#dispatch(last.layout, last.overlay)) {\n\t\t\t\t\tawait new Promise<void>((resolve) => {\n\t\t\t\t\t\tthis.#pending = resolve;\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tconst cancelled = generation !== this.#generation;\n\t\t\t\tfor (const entry of batch) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (!cancelled) {\n\t\t\t\t\t\t\tentry.fn();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tentry.resolve();\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tentry.reject(error);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tthis.#resizing = false;\n\t\t}\n\t}\n\n\t#dispatch(layout: Layout, overlay?: PresizeOverlay): boolean {\n\t\tthis._onDispatch?.();\n\t\tconst detail: PresizeDetail = {\n\t\t\tcalculatePresizePaths: () => calculate_presize_paths(layout),\n\t\t\toverlay,\n\t\t};\n\n\t\tconst event = new CustomEvent(this._eventName, {\n\t\t\tcancelable: true,\n\t\t\tdetail,\n\t\t});\n\n\t\treturn this._target.dispatchEvent(event);\n\t}\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport { DEFAULT_PHYSICS, type Physics } from \"../core/constants\";\nimport { insert_child } from \"./insert_child\";\nimport type {\n\tLayout,\n\tLayoutPath,\n\tLayoutPathTraversal,\n\tOrientation,\n\tViewWindow,\n} from \"../core/types\";\n\n/**\n * Calculates an insertion point (which may involve splitting a single\n * `\"tab-layout\"` into a new `\"split-layout\"`), based on the cursor position.\n * *\n * @param col - The cursor column.\n * @param row - The cursor row.\n * @param panel - The `Layout` to insert into.\n * @param slot - The slot identifier where the insert should occur\n * @param drop_target - The `LayoutPath` (from `calculateIntersect`) of the\n * panel to either insert next to, or split by.\n * @returns A new `LayoutPath` reflecting the updated (maybe) `\"split-layout\"`,\n * which is enough to draw the overlay.\n */\nexport function calculate_edge(\n\tcol: number,\n\trow: number,\n\tpanel: Layout,\n\tslot: string,\n\tdrop_target: LayoutPath,\n\tbox?: DOMRect,\n\tphysics: Physics = DEFAULT_PHYSICS,\n): LayoutPath {\n\t// Check root edges first\n\tif (col < physics.SPLIT_ROOT_EDGE_TOLERANCE) {\n\t\treturn insert_root_edge(panel, slot, drop_target, [0], true, \"horizontal\");\n\t}\n\n\tif (col > 1 - physics.SPLIT_ROOT_EDGE_TOLERANCE) {\n\t\treturn insert_root_edge(\n\t\t\tpanel,\n\t\t\tslot,\n\t\t\tdrop_target,\n\t\t\tdrop_target.path.length > 0 ? drop_target.path : [1],\n\t\t\tfalse,\n\t\t\t\"horizontal\",\n\t\t);\n\t}\n\n\tif (row < physics.SPLIT_ROOT_EDGE_TOLERANCE) {\n\t\treturn insert_root_edge(panel, slot, drop_target, [0], true, \"vertical\");\n\t}\n\n\tif (row > 1 - physics.SPLIT_ROOT_EDGE_TOLERANCE) {\n\t\treturn insert_root_edge(\n\t\t\tpanel,\n\t\t\tslot,\n\t\t\tdrop_target,\n\t\t\tdrop_target.path.length > 0 ? drop_target.path : [1],\n\t\t\tfalse,\n\t\t\t\"vertical\",\n\t\t);\n\t}\n\n\t// Check panel edges\n\tconst is_column_edge =\n\t\tdrop_target.column_offset < physics.SPLIT_EDGE_TOLERANCE ||\n\t\tdrop_target.column_offset > 1 - physics.SPLIT_EDGE_TOLERANCE;\n\n\tconst is_row_edge =\n\t\tdrop_target.row_offset < physics.SPLIT_EDGE_TOLERANCE ||\n\t\tdrop_target.row_offset > 1 - physics.SPLIT_EDGE_TOLERANCE;\n\n\t// If both edges triggered, choose closer axis\n\tif (is_column_edge && is_row_edge) {\n\t\tconst col_distance = Math.abs(drop_target.column_offset - 0.5);\n\t\tconst row_distance = Math.abs(drop_target.row_offset - 0.5);\n\t\tconst col_scale =\n\t\t\t(box?.width || 1) *\n\t\t\t(drop_target.view_window.col_end - drop_target.view_window.col_start);\n\n\t\tconst row_scale =\n\t\t\t(box?.height || 1) *\n\t\t\t(drop_target.view_window.row_end - drop_target.view_window.row_start);\n\n\t\tconst use_column =\n\t\t\tcol_scale / 2 - col_distance * col_scale <\n\t\t\trow_scale / 2 - row_distance * row_scale;\n\n\t\treturn insert_axis(\n\t\t\tpanel,\n\t\t\tslot,\n\t\t\tdrop_target,\n\t\t\tuse_column\n\t\t\t\t? drop_target.column_offset < physics.SPLIT_EDGE_TOLERANCE\n\t\t\t\t: drop_target.row_offset < physics.SPLIT_EDGE_TOLERANCE,\n\t\t\tuse_column ? \"horizontal\" : \"vertical\",\n\t\t);\n\t}\n\n\tif (is_column_edge) {\n\t\treturn insert_axis(\n\t\t\tpanel,\n\t\t\tslot,\n\t\t\tdrop_target,\n\t\t\tdrop_target.column_offset < physics.SPLIT_EDGE_TOLERANCE,\n\t\t\t\"horizontal\",\n\t\t);\n\t}\n\n\tif (is_row_edge) {\n\t\treturn insert_axis(\n\t\t\tpanel,\n\t\t\tslot,\n\t\t\tdrop_target,\n\t\t\tdrop_target.row_offset < physics.SPLIT_EDGE_TOLERANCE,\n\t\t\t\"vertical\",\n\t\t);\n\t}\n\n\t// Not at an edge - insert as a tab\n\treturn {\n\t\t...drop_target,\n\t\tpath: [...drop_target.path, 0],\n\t};\n}\n\nfunction insert_root_edge(\n\tpanel: Layout,\n\tslot: string,\n\tdrop_target: LayoutPath,\n\tpath: LayoutPathTraversal,\n\tis_before: boolean,\n\torientation: Orientation,\n): LayoutPath {\n\treturn insert_axis(\n\t\tpanel,\n\t\tslot,\n\t\t{ ...drop_target, path, orientation },\n\t\tis_before,\n\t\torientation,\n\t);\n}\n\nfunction insert_axis(\n\tpanel: Layout,\n\tslot: string,\n\tdrop_target: LayoutPath,\n\tis_before: boolean,\n\taxis_orientation: Orientation,\n): LayoutPath {\n\tlet result_path: LayoutPathTraversal;\n\n\tif (drop_target.orientation === axis_orientation) {\n\t\t// Same orientation - insert into existing split\n\t\tif (drop_target.path.length === 0) {\n\t\t\tresult_path = [is_before ? 0 : 1];\n\t\t} else {\n\t\t\tconst last_index = drop_target.path[drop_target.path.length - 1];\n\t\t\tresult_path = [\n\t\t\t\t...drop_target.path.slice(0, -1),\n\t\t\t\tis_before ? last_index : last_index + 1,\n\t\t\t];\n\t\t}\n\t} else {\n\t\t// Different orientation - split the child panel\n\t\tresult_path = [...drop_target.path, is_before ? 0 : 1];\n\t}\n\n\tconst new_panel = insert_child(panel, slot, result_path, axis_orientation);\n\tconst view_window = calculate_view_window(new_panel, result_path);\n\treturn {\n\t\t...drop_target,\n\t\tpath: result_path,\n\t\tslot: drop_target.slot,\n\t\tis_edge: true,\n\t\torientation: axis_orientation,\n\t\tview_window,\n\t};\n}\n\nfunction calculate_view_window(\n\tpanel: Layout,\n\tpath: LayoutPathTraversal,\n): ViewWindow {\n\tlet view_window: ViewWindow = {\n\t\trow_start: 0,\n\t\trow_end: 1,\n\t\tcol_start: 0,\n\t\tcol_end: 1,\n\t};\n\n\tlet current_panel = panel;\n\tfor (const step of path) {\n\t\tif (current_panel.type === \"tab-layout\") {\n\t\t\tbreak;\n\t\t}\n\n\t\tconst index = Math.min(step, current_panel.children.length - 1);\n\t\tconst is_vertical = current_panel.orientation === \"vertical\";\n\t\tconst start_key = is_vertical ? \"row_start\" : \"col_start\";\n\t\tconst end_key = is_vertical ? \"row_end\" : \"col_end\";\n\t\tconst total_size = view_window[end_key] - view_window[start_key];\n\t\tconst offset = current_panel.sizes\n\t\t\t.slice(0, index)\n\t\t\t.reduce((sum, size) => sum + size * total_size, view_window[start_key]);\n\n\t\tview_window = {\n\t\t\t...view_window,\n\t\t\t[start_key]: offset,\n\t\t\t[end_key]: offset + total_size * current_panel.sizes[index],\n\t\t};\n\n\t\tcurrent_panel = current_panel.children[index];\n\t}\n\n\treturn view_window;\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport type { Layout, LayoutPath, OverlayMode } from \"../core/types.ts\";\nimport type { Physics } from \"../core/constants.ts\";\nimport type { PresizeQueue } from \"./presize_queue.ts\";\nimport { calculate_intersection } from \"../layout/calculate_intersect.ts\";\nimport { calculate_edge } from \"../layout/calculate_edge.ts\";\nimport { create_css_grid_layout } from \"../layout/generate_grid.ts\";\nimport { updateOverlaySheet } from \"../layout/generate_overlay.ts\";\nimport { remove_child } from \"../layout/remove_child.ts\";\nimport { insert_child } from \"../layout/insert_child.ts\";\n\nexport interface OverlayHost {\n\t/** The latest intended layout tree, which mutations build on. */\n\treadonly panel: Layout;\n\treadonly physics: Physics;\n\treadonly stylesheet: CSSStyleSheet;\n\treadonly presizeQueue: PresizeQueue;\n\trelativeCoordinates(\n\t\tevent: { clientX: number; clientY: number },\n\t\trecalculate: boolean,\n\t): [number, number, DOMRect, CSSStyleDeclaration];\n\trestore(layout: Layout, isFlattened?: boolean): Promise<void>;\n\tquerySelector(selectors: string): Element | null;\n\tdispatchEvent(event: Event): boolean;\n}\n\n/**\n * Manages overlay state during drag-and-drop panel rearrangement.\n *\n * Handles rendering a preview of where a dragged panel would land,\n * and committing or cancelling the placement when the drag ends.\n */\nexport class OverlayController {\n\tconstructor(private _host: OverlayHost) {}\n\n\tasync set(\n\t\tevent: { clientX: number; clientY: number },\n\t\t{ slot }: LayoutPath,\n\t\tclassName: string = this._host.physics.OVERLAY_CLASSNAME,\n\t\tmode: OverlayMode = this._host.physics.OVERLAY_DEFAULT,\n\t): Promise<void> {\n\t\tconst host = this._host;\n\t\tconst panel = remove_child(host.panel, slot);\n\t\tconst query = `:scope > [${host.physics.CHILD_ATTRIBUTE_NAME}=\"${slot}\"]`;\n\t\tlet drag_element = host.querySelector(query);\n\t\tif (drag_element) {\n\t\t\tdrag_element.classList.add(className);\n\t\t}\n\n\t\tconst [col, row, box, style] = host.relativeCoordinates(event, true);\n\t\tlet drop_target = calculate_intersection(col, row, panel);\n\t\tif (drop_target) {\n\t\t\tdrop_target = calculate_edge(\n\t\t\t\tcol,\n\t\t\t\trow,\n\t\t\t\tpanel,\n\t\t\t\tslot,\n\t\t\t\tdrop_target,\n\t\t\t\tbox,\n\t\t\t\thost.physics,\n\t\t\t);\n\t\t}\n\n\t\t// The dragged panel is removed from `panel` above, so it is absent from\n\t\t// the presize paths - `drop_target` carries its preview box instead\n\t\t// (null when the pointer is outside every drop target and the dragged\n\t\t// panel is hidden).\n\t\tconst overlay = drop_target ? { slot, path: drop_target } : null;\n\t\tawait host.presizeQueue.run(\n\t\t\tpanel,\n\t\t\t() => {\n\t\t\t\tif (mode === \"grid\" && drop_target) {\n\t\t\t\t\tconst path: [string, string] = [slot, drop_target?.slot];\n\t\t\t\t\tconst css = create_css_grid_layout(panel, path, host.physics);\n\t\t\t\t\thost.stylesheet.replaceSync(css);\n\t\t\t\t} else if (mode === \"absolute\") {\n\t\t\t\t\tconst grid_css = create_css_grid_layout(\n\t\t\t\t\t\tpanel,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\thost.physics,\n\t\t\t\t\t);\n\n\t\t\t\t\twhile (drag_element?.tagName === \"SLOT\" && drag_element) {\n\t\t\t\t\t\tdrag_element = (\n\t\t\t\t\t\t\tdrag_element as HTMLSlotElement\n\t\t\t\t\t\t).assignedElements()[0];\n\t\t\t\t\t}\n\n\t\t\t\t\tconst margin = drag_element\n\t\t\t\t\t\t? getComputedStyle(drag_element)\n\t\t\t\t\t\t: undefined;\n\n\t\t\t\t\tconst overlay_css = updateOverlaySheet(\n\t\t\t\t\t\tslot,\n\t\t\t\t\t\tbox,\n\t\t\t\t\t\tstyle,\n\t\t\t\t\t\tdrop_target,\n\t\t\t\t\t\thost.physics,\n\t\t\t\t\t\tmargin,\n\t\t\t\t\t);\n\n\t\t\t\t\thost.stylesheet.replaceSync([grid_css, overlay_css].join(\"\\n\"));\n\t\t\t\t}\n\t\t\t},\n\t\t\toverlay,\n\t\t);\n\n\t\tconst event_name = `${host.physics.CUSTOM_EVENT_NAME_PREFIX}-before-update`;\n\t\tconst custom_event = new CustomEvent<Layout>(event_name, {\n\t\t\tdetail: panel,\n\t\t});\n\t\thost.dispatchEvent(custom_event);\n\t}\n\n\tasync clear(\n\t\tevent: { clientX: number; clientY: number } | null,\n\t\t{ slot, layout }: LayoutPath,\n\t\tclassName: string = this._host.physics.OVERLAY_CLASSNAME,\n\t): Promise<void> {\n\t\tconst host = this._host;\n\t\tconst panel = remove_child(host.panel, slot);\n\t\tconst query = `:scope > [${host.physics.CHILD_ATTRIBUTE_NAME}=\"${slot}\"]`;\n\t\tconst drag_element = host.querySelector(query);\n\n\t\tif (event === null) {\n\t\t\tawait host.restore(layout);\n\t\t\treturn;\n\t\t}\n\n\t\tconst [col, row, box] = host.relativeCoordinates(event, false);\n\t\tlet drop_target = calculate_intersection(col, row, panel);\n\t\tif (drop_target) {\n\t\t\tdrop_target = calculate_edge(\n\t\t\t\tcol,\n\t\t\t\trow,\n\t\t\t\tpanel,\n\t\t\t\tslot,\n\t\t\t\tdrop_target,\n\t\t\t\tbox,\n\t\t\t\thost.physics,\n\t\t\t);\n\t\t}\n\n\t\tif (drop_target) {\n\t\t\tconst orientation = drop_target?.is_edge\n\t\t\t\t? drop_target.orientation\n\t\t\t\t: undefined;\n\n\t\t\tconst new_layout = insert_child(\n\t\t\t\tpanel,\n\t\t\t\tslot,\n\t\t\t\tdrop_target.path,\n\t\t\t\torientation,\n\t\t\t);\n\n\t\t\tawait host.restore(new_layout);\n\t\t} else {\n\t\t\tawait host.restore(layout);\n\t\t}\n\n\t\tif (drag_element) {\n\t\t\tdrag_element.classList.remove(className);\n\t\t}\n\t}\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\n/**\n * This module defines the `<regular-layout>` custom element for browser\n * environments.\n *\n * @packageDocumentation\n */\n\nimport { EMPTY_PANEL } from \"./core/types.ts\";\nimport {\n\tcreate_css_grid_layout,\n\tcreate_css_maximize_layout,\n} from \"./layout/generate_grid.ts\";\nimport type {\n\tLayoutPath,\n\tLayout,\n\tLayoutDivider,\n\tTabLayout,\n\tOverlayMode,\n\tOrientation,\n\tLayoutPathTraversal,\n\tViewWindow,\n} from \"./core/types.ts\";\n\nimport { calculate_intersection } from \"./layout/calculate_intersect.ts\";\nimport { remove_child } from \"./layout/remove_child.ts\";\nimport { insert_child } from \"./layout/insert_child.ts\";\nimport { redistribute_panel_sizes } from \"./layout/redistribute_panel_sizes.ts\";\nimport { viewWindowToLocalRect } from \"./layout/generate_overlay.ts\";\nimport { flatten } from \"./layout/flatten.ts\";\nimport { calculate_path } from \"./layout/calculate_path.ts\";\nimport { PresizeQueue } from \"./model/presize_queue.ts\";\nimport {\n\tOverlayController,\n\ttype OverlayHost,\n} from \"./model/overlay_controller.ts\";\n\nimport {\n\tDEFAULT_PHYSICS,\n\ttype PhysicsUpdate,\n\ttype Physics,\n} from \"./core/constants.ts\";\n\n/**\n * An interface which models the fields of `PointerEvent` that\n * `<regular-layour>` actually uses, making it easier to sub out with an\n * JavaScript object lieral when you don't have a `PointerEvent` handy.\n */\nexport interface PointerEventCoordinates {\n\tclientX: number;\n\tclientY: number;\n}\n\n/**\n * A Web Component that provides a resizable panel layout system.\n * Panels are arranged using CSS Grid and can be resized by dragging dividers.\n *\n * The component uses Shadow DOM and CSS Grid to manage layout.\n *\n * @example\n * ```html\n * <regular-layout>\n * <div name=\"sidebar\">Sidebar content</div>\n * <div name=\"main\">Main content</div>\n * </regular-layout>\n * ```\n *\n * @example\n * ```typescript\n * const layout = document.querySelector('regular-layout');\n *\n * // Insert panels into the grid layout\n * layout.insertPanel('main');\n * layout.insertPanel('sidebar');\n *\n * // Remove a panel (DOM child is still connected, but not slotted)\n * layout.removePanel('sidebar');\n *\n * // Save current layout\n * const state = layout.save();\n *\n * // Restore layout later\n * layout.restore(state);\n * ```\n *\n * @remarks\n *\n * Why does this implementation use a `<slot>` at all? We must use\n * `<slot>` and the Shadow DOM to scope the grid CSS rules to each\n * instance of `<regular-layout>` (without e.g. giving them unique\n * `\"id\"` and injecting into `document,head`), and we can only select\n * `::slotted` light DOM children from `adoptedStyleSheets` on the\n * `ShadowRoot`.\n *\n * Why does this implementation use a single `<slot>` and the child\n * `\"name\"` attribute, as opposed to a named `<slot name=\"my_slot\">`\n * and the built-in `\"slot\"` child attribute? Children with a `\"slot\"`\n * attribute don't fallback to the un-named `<slot>`, so using the\n * latter implementation would require synchronizing the light DOM\n * and shadow DOM slots/slotted children continuously.\n *\n * Note that `::slotted()` only matches *directly* slotted nodes - it\n * does not pierce a slotted `<slot>`. A consumer that wants to forward\n * its own light-DOM content through `<regular-layout>` therefore cannot\n * place a bare `<slot name=\"X\">` as a layout child and expect it to be\n * grid-positioned; instead, wrap the forwarding slot in a concrete\n * `<regular-layout-frame name=\"X\">` (which *is* directly slotted and so\n * matched by the generated `::slotted([name=\"X\"])` rules).\n *\n */\nexport class RegularLayout extends HTMLElement {\n\tprivate _shadowRoot: ShadowRoot;\n\t/** The committed layout tree - what is on screen. */\n\tprivate _panel: Layout;\n\n\t/**\n\t * The latest layout tree requested by a committing mutation, which may\n\t * still be suspended or queued behind a `before-resize`. Mutations build on\n\t * this rather than `_panel` so concurrent updates compose instead of each\n\t * clobbering the in-flight one.\n\t */\n\tprivate _intended: Layout;\n\tprivate _stylesheet: CSSStyleSheet;\n\tprivate _cursor_stylesheet: CSSStyleSheet;\n\tprivate _drag_target?: [LayoutDivider, number, number];\n\tprivate _cursor_override: boolean;\n\tprivate _dimensions?: { box: DOMRect; style: CSSStyleDeclaration };\n\tprivate _physics: Physics;\n\tprivate _presizeQueue: PresizeQueue;\n\tprivate _overlayController: OverlayController;\n\tprivate _maximized?: string;\n\tprivate _resize_observer?: ResizeObserver;\n\n\tconstructor() {\n\t\tsuper();\n\t\tthis._physics = DEFAULT_PHYSICS;\n\t\tthis._panel = structuredClone(EMPTY_PANEL);\n\t\tthis._intended = this._panel;\n\t\tthis._shadowRoot = this.attachShadow({ mode: \"open\" });\n\t\tthis._shadowRoot.innerHTML = `<slot></slot>`;\n\t\tthis._stylesheet = new CSSStyleSheet();\n\t\tthis._cursor_stylesheet = new CSSStyleSheet();\n\t\tthis._cursor_override = false;\n\t\tconst event_name = `${this._physics.CUSTOM_EVENT_NAME_PREFIX}-before-resize`;\n\t\tthis._presizeQueue = new PresizeQueue(this, event_name, () => {\n\t\t\tthis._dimensions = undefined;\n\t\t});\n\n\t\tthis._overlayController = new OverlayController(this.create_overlay_host());\n\t\tthis._shadowRoot.adoptedStyleSheets = [\n\t\t\tthis._stylesheet,\n\t\t\tthis._cursor_stylesheet,\n\t\t];\n\t}\n\n\tconnectedCallback() {\n\t\tthis._resize_observer ??= new ResizeObserver(() => {\n\t\t\tthis._dimensions = undefined;\n\t\t});\n\n\t\tthis._resize_observer.observe(this);\n\t\tthis.addEventListener(\"dblclick\", this.onDblClick);\n\t\tthis.addEventListener(\"pointerdown\", this.onPointerDown);\n\t\tthis.addEventListener(\"pointerup\", this.onPointerUp);\n\t\tthis.addEventListener(\"pointermove\", this.onPointerMove);\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis._resize_observer?.disconnect();\n\t\tthis.removeEventListener(\"dblclick\", this.onDblClick);\n\t\tthis.removeEventListener(\"pointerdown\", this.onPointerDown);\n\t\tthis.removeEventListener(\"pointerup\", this.onPointerUp);\n\t\tthis.removeEventListener(\"pointermove\", this.onPointerMove);\n\t}\n\n\t/**\n\t * Determines which panel is at a given screen coordinate.\n\t *\n\t * @param coordinates - `PointerEvent`, `MouseEvent`, or just X and Y\n\t * coordinates in screen pixels.\n\t * @returns Panel information if a panel is at that position, null otherwise.\n\t */\n\tcalculateIntersect = (\n\t\tcoordinates: PointerEventCoordinates,\n\t): LayoutPath | null => {\n\t\tconst [col, row, _] = this.relativeCoordinates(coordinates, false);\n\t\treturn calculate_intersection(col, row, this._panel);\n\t};\n\n\t/**\n\t * Calculates the index path for a panel with the given name.\n\t *\n\t * @param name - The name of the panel to find.\n\t * @returns The panel's index path if found, `null` otherwise.\n\t */\n\tcalculatePath = (name: string): number[] | null => {\n\t\treturn calculate_path(name, this._panel);\n\t};\n\n\t/**\n\t * Sets the visual overlay state during drag-and-drop operations.\n\t * Displays a preview of where a panel would be placed at the given coordinates.\n\t *\n\t * @param event - `PointerEvent`, `MouseEvent`, or just X and Y\n\t * coordinates in screen pixels.\n\t * @param dragTarget - A `LayoutPath` (presumably from `calculateIntersect`)\n\t * which points to the drag element in the current layout.\n\t * @param className - The CSS class name to use for the overlay panel\n\t * (defaults to \"overlay\").\n\t * @param mode - Overlay rendering mode: \"grid\" uses CSS grid to position\n\t * the target, \"absolute\" positions the panel absolutely. Defaults to\n\t * \"absolute\".\n\t */\n\tsetOverlayState = async (\n\t\tevent: PointerEventCoordinates,\n\t\ttarget: LayoutPath,\n\t\tclassName?: string,\n\t\tmode?: OverlayMode,\n\t) => {\n\t\tawait this._overlayController.set(event, target, className, mode);\n\t};\n\n\t/**\n\t * Clears the overlay state and commits the panel placement.\n\t *\n\t * @param event - `PointerEvent`, `MouseEvent`, or just X and Y\n\t * coordinates in screen pixels.\n\t * @param dragTarget - A `LayoutPath` (presumably from `calculateIntersect`)\n\t * which points to the drag element in the current layout.\n\t * @param className - The CSS class name to use for the overlay panel\n\t * (defaults to \"overlay\").\n\t * @param mode - Overlay rendering mode that was used, must match the mode\n\t * passed to `setOverlayState`. Defaults to \"absolute\".\n\t */\n\tclearOverlayState = async (\n\t\tevent: PointerEventCoordinates | null,\n\t\ttarget: LayoutPath,\n\t\tclassName?: string,\n\t) => {\n\t\tawait this._overlayController.clear(event, target, className);\n\t};\n\n\t/**\n\t * Inserts a new panel into the layout at a specified path.\n\t *\n\t * @param name - Unique identifier for the new panel.\n\t * @param path - Index path defining where to insert.\n\t * @param split - Force a split in the layout at the end of `path`\n\t * regardless if there is a leaf at this position or not. Optionally,\n\t *. `split` may be your preferred `Orientation`, which will be used by\n\t * the new `SplitPanel` _if_ there is an option of orientation (e.g. if\n\t * the layout had no pre-existing `SplitPanel`)\n\t */\n\tinsertPanel = async (\n\t\tname: string,\n\t\tpath: LayoutPathTraversal = [],\n\t\tsplit?: boolean | Orientation,\n\t) => {\n\t\tlet orientation: Orientation | undefined;\n\t\tif (typeof split === \"boolean\" && split) {\n\t\t\torientation = \"horizontal\";\n\t\t} else if (typeof split === \"string\") {\n\t\t\torientation = split;\n\t\t}\n\n\t\tawait this.restore(insert_child(this._intended, name, path, orientation));\n\t};\n\n\t/**\n\t * Removes a panel from the layout by name.\n\t *\n\t * @param name - Name of the panel to remove\n\t */\n\tremovePanel = async (name: string) => {\n\t\tawait this.restore(remove_child(this._intended, name));\n\t};\n\n\t/**\n\t * Selects a panel by `name`, making it the front-most tab within its\n\t * containing stack, then dispatches a `<prefix>-select` event with\n\t * `detail: { name }`.\n\t *\n\t * The event fires whenever a tab is selected - including re-selecting the\n\t * already-active tab, or selecting the sole tab of a single-element stack -\n\t * so consumers can always map a tab interaction to an \"active panel\". When\n\t * the selection actually changes, a `<prefix>-update` event is dispatched\n\t * first (via {@link restore}).\n\t *\n\t * @param name - The name of the panel to select.\n\t */\n\tselect = async (name: string) => {\n\t\tconst layout = structuredClone(this._intended);\n\t\tconst tab_panel = this.getPanel(name, layout);\n\t\tif (!tab_panel) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst index = tab_panel.tabs.indexOf(name);\n\t\tif (index !== -1 && tab_panel.selected !== index) {\n\t\t\ttab_panel.selected = index;\n\t\t\tawait this.restore(layout);\n\t\t}\n\n\t\tconst event_name = `${this._physics.CUSTOM_EVENT_NAME_PREFIX}-select`;\n\t\tthis.dispatchEvent(new CustomEvent(event_name, { detail: { name } }));\n\t};\n\n\t/**\n\t * Retrieves a panel by name from the layout tree.\n\t *\n\t * @param name - Name of the panel to find.\n\t * @param layout - Optional layout tree to search in (defaults to current layout).\n\t * @returns The TabLayout containing the panel if found, null otherwise.\n\t */\n\tgetPanel = (name: string, layout: Layout = this._panel): TabLayout | null => {\n\t\tif (layout.type === \"tab-layout\") {\n\t\t\tif (layout.tabs.includes(name)) {\n\t\t\t\treturn layout;\n\t\t\t}\n\n\t\t\treturn null;\n\t\t}\n\n\t\tfor (const child of layout.children) {\n\t\t\tconst found = this.getPanel(name, child);\n\t\t\tif (found) {\n\t\t\t\treturn found;\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t};\n\n\t/**\n\t * Clears the entire layout, unslotting all panels.\n\t */\n\tclear = async () => {\n\t\tawait this.restore(EMPTY_PANEL);\n\t};\n\n\t/**\n\t * Maximizes a panel by `name`, rendering it full-size and hiding every\n\t * other panel. This is transient display state - it is **not** persisted by\n\t * {@link save}, and any subsequent {@link restore} resets the layout to the\n\t * minimized (normal, multi-panel) view.\n\t *\n\t * Before applying, dispatches a cancelable `regular-layout-before-resize`\n\t * event (as {@link restore} does) whose paths describe the post-maximize\n\t * geometry - a single full-window entry for `name`. If the event is\n\t * cancelled via `preventDefault()`, the update is suspended until\n\t * {@link resumeResize} is called.\n\t *\n\t * Has no effect if `name` is not present in the current layout.\n\t *\n\t * @param name - The name of the panel to maximize.\n\t */\n\tmaximize = async (name: string) => {\n\t\tif (!this.getPanel(name, this._intended)) {\n\t\t\treturn;\n\t\t}\n\n\t\t// The post-maximize geometry as a `Layout`: `name` alone, full-window.\n\t\t// Panels hidden by the maximize are absent from the presize paths,\n\t\t// consistent with `calculate_presize_paths`' visible-panels-only\n\t\t// semantics.\n\t\tconst layout: Layout = { type: \"tab-layout\", tabs: [name], selected: 0 };\n\t\tawait this._presizeQueue.run(layout, () => {\n\t\t\tthis._maximized = name;\n\t\t\tthis._stylesheet.replaceSync(\n\t\t\t\tcreate_css_maximize_layout(name, this._physics),\n\t\t\t);\n\t\t});\n\t};\n\n\t/**\n\t * Restores the normal multi-panel view after a {@link maximize}, without\n\t * altering the layout tree. No-op if no panel is currently maximized.\n\t *\n\t * Before applying, dispatches a cancelable `regular-layout-before-resize`\n\t * event (as {@link restore} does) with paths for the restored multi-panel\n\t * geometry. If the event is cancelled via `preventDefault()`, the update\n\t * is suspended until {@link resumeResize} is called.\n\t */\n\tminimize = async () => {\n\t\tif (this._maximized === undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tawait this._presizeQueue.run(this._intended, () => {\n\t\t\tthis._maximized = undefined;\n\t\t\tthis._stylesheet.replaceSync(\n\t\t\t\tcreate_css_grid_layout(this._panel, undefined, this._physics),\n\t\t\t);\n\t\t});\n\t};\n\n\t/**\n\t * Restores the layout from a saved state synchronously, without\n\t * dispatching the `regular-layout-before-resize` event.\n\t *\n\t * Supersedes any update still suspended or queued behind a\n\t * `regular-layout-before-resize`: those are discarded (their promises\n\t * resolve without applying). A suspended transition must still be\n\t * released via {@link resumeResize}.\n\t *\n\t * @param layout - The layout tree to restore\n\t */\n\trestoreSync = (layout: Layout, _is_flattened: boolean = false) => {\n\t\tthis._presizeQueue.cancelPending();\n\t\tthis._dimensions = undefined;\n\t\tthis._maximized = undefined;\n\t\tthis._panel = !_is_flattened ? flatten(layout) : layout;\n\t\tthis._intended = this._panel;\n\t\tconst css = create_css_grid_layout(this._panel, undefined, this._physics);\n\t\tthis._stylesheet.replaceSync(css);\n\t\tconst event_name = `${this._physics.CUSTOM_EVENT_NAME_PREFIX}-update`;\n\t\tconst event = new CustomEvent<Layout>(event_name, { detail: this._panel });\n\t\tthis.dispatchEvent(event);\n\t};\n\n\t/**\n\t * Restores the layout from a saved state.\n\t *\n\t * Before applying, dispatches a cancelable `regular-layout-before-resize`\n\t * event. If the event is cancelled via `preventDefault()`, the layout\n\t * update is suspended until {@link resumeResize} is called. Updates made\n\t * while one is suspended are queued and applied in order once it lands,\n\t * under a single further `regular-layout-before-resize`; the returned\n\t * promise resolves when this update has been applied.\n\t *\n\t * @param layout - The layout tree to restore\n\t *\n\t * @example\n\t * ```typescript\n\t * const layout = document.querySelector('regular-layout');\n\t * const savedState = JSON.parse(localStorage.getItem('layout'));\n\t * await layout.restore(savedState);\n\t * ```\n\t */\n\trestore = async (layout: Layout, _is_flattened: boolean = false) => {\n\t\tconst panel = !_is_flattened ? flatten(layout) : layout;\n\t\tthis._intended = panel;\n\t\tawait this._presizeQueue.run(panel, () => {\n\t\t\tthis._maximized = undefined;\n\t\t\tthis._panel = panel;\n\t\t\tconst css = create_css_grid_layout(this._panel, undefined, this._physics);\n\t\t\tthis._stylesheet.replaceSync(css);\n\t\t\tconst event_name = `${this._physics.CUSTOM_EVENT_NAME_PREFIX}-update`;\n\t\t\tconst event = new CustomEvent<Layout>(event_name, {\n\t\t\t\tdetail: this._panel,\n\t\t\t});\n\n\t\t\tthis.dispatchEvent(event);\n\t\t});\n\t};\n\n\t/**\n\t * Resumes a layout update that was suspended by cancelling the\n\t * `regular-layout-before-resize` event.\n\t */\n\tresumeResize = () => {\n\t\tthis._presizeQueue.resume();\n\t};\n\n\t/**\n\t * Serializes the current layout state, which can be restored via `restore`.\n\t * This is the committed (on-screen) tree; updates still suspended behind a\n\t * `regular-layout-before-resize` are not included.\n\t *\n\t * @returns The current layout tree\n\t *\n\t * @example\n\t * ```typescript\n\t * const layout = document.querySelector('regular-layout');\n\t * const state = layout.save();\n\t * localStorage.setItem('layout', JSON.stringify(state));\n\t * ```\n\t */\n\tsave = (): Layout => {\n\t\treturn structuredClone(this._panel);\n\t};\n\n\t/**\n\t * Override this instance's global constants.\n\t *\n\t * @param physics\n\t */\n\trestorePhysics(physics: PhysicsUpdate) {\n\t\tthis._physics = Object.freeze({\n\t\t\t...this._physics,\n\t\t\t...physics,\n\t\t});\n\t}\n\n\t/**\n\t * Get this instance's constants.\n\t *\n\t * @returns The current constants\n\t */\n\tsavePhysics(): Physics {\n\t\treturn this._physics;\n\t}\n\n\t/**\n\t * Converts screen coordinates to relative layout coordinates.\n\t *\n\t * Transforms absolute pixel positions into normalized coordinates (0-1 range)\n\t * relative to the layout's bounding box.\n\t *\n\t * @param coordinates - `PointerEvent`, `MouseEvent`, or just X and Y\n\t * coordinates in screen pixels.\n\t * @returns A tuple containing:\n\t * - col: Normalized X coordinate (0 = left edge, 1 = right edge)\n\t * - row: Normalized Y coordinate (0 = top edge, 1 = bottom edge)\n\t * - box: The layout element's bounding rectangle\n\t */\n\trelativeCoordinates = (\n\t\tevent: PointerEventCoordinates,\n\t\trecalculate_bounds: boolean = true,\n\t): [number, number, DOMRect, CSSStyleDeclaration] => {\n\t\tif (recalculate_bounds || !this._dimensions) {\n\t\t\tthis._dimensions = {\n\t\t\t\tbox: this.getBoundingClientRect(),\n\t\t\t\tstyle: getComputedStyle(this),\n\t\t\t};\n\t\t}\n\n\t\tconst box = this._dimensions.box;\n\t\tconst style = this._dimensions.style;\n\t\tconst paddingLeft = parseFloat(style.paddingLeft);\n\t\tconst paddingTop = parseFloat(style.paddingTop);\n\t\tconst contentWidth =\n\t\t\tbox.width - paddingLeft - parseFloat(style.paddingRight);\n\n\t\tconst contentHeight =\n\t\t\tbox.height - paddingTop - parseFloat(style.paddingBottom);\n\n\t\tconst localX = event.clientX - box.left - paddingLeft;\n\t\tconst localY = event.clientY - box.top - paddingTop;\n\t\tconst col = Math.max(0, Math.min(1, localX / contentWidth));\n\t\tconst row = Math.max(0, Math.min(1, localY / contentHeight));\n\t\treturn [col, row, box, style];\n\t};\n\n\t/**\n\t * Converts a {@link ViewWindow} (normalized 0\u20131 coordinates) to a\n\t * `DOMRect` in screen pixels, accounting for padding and optionally\n\t * CSS `gap` and child `margin`.\n\t *\n\t * @param window - The view window to convert.\n\t * @returns A `DOMRect` representing the window in screen coordinates.\n\t */\n\trealCoordinates = (window: ViewWindow, child?: HTMLElement): DOMRect => {\n\t\tif (!this._dimensions) {\n\t\t\tthis._dimensions = {\n\t\t\t\tbox: this.getBoundingClientRect(),\n\t\t\t\tstyle: getComputedStyle(this),\n\t\t\t};\n\t\t}\n\n\t\tconst box = this._dimensions.box;\n\t\tconst style = this._dimensions.style;\n\t\tlet childStyle: CSSStyleDeclaration | undefined;\n\t\tif (child) {\n\t\t\tchildStyle = getComputedStyle(child);\n\t\t}\n\n\t\tconst local = viewWindowToLocalRect(window, box, style, childStyle);\n\t\treturn new DOMRect(\n\t\t\tbox.left + local.x,\n\t\t\tbox.top + local.y,\n\t\t\tlocal.width,\n\t\t\tlocal.height,\n\t\t);\n\t};\n\n\t/**\n\t * Calculates the Euclidean distance in pixels between the current pointer\n\t * coordinates and a drag target's position within the layout.\n\t *\n\t * @param coordinates - The current pointer event coordinates.\n\t * @param drag_target - The layout path representing the drag target\n\t * \t position.\n\t * @returns The distance in pixels between the coordinates and the drag\n\t * target.\n\t */\n\tdiffCoordinates = (\n\t\tevent: PointerEventCoordinates,\n\t\tdrag_target: LayoutPath,\n\t): number => {\n\t\tconst [column, row, box] = this.relativeCoordinates(event, false);\n\t\tconst dx = (column - drag_target.column) * box.width;\n\t\tconst dy = (row - drag_target.row) * box.height;\n\t\treturn Math.sqrt(dx ** 2 + dy ** 2);\n\t};\n\n\t// \u2587\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u25A0\u25A0\u25A0\u25A0\u023A\u023A\u023A\u023A\u023A\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u2580\u023A\u023A\u023A\u023A\u023A\u25A0\u25A0\u25A0\u25A0\u25A0\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\n\t// \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u259B\u2580\u2580\u2588\u2583\u2584\u2584\u2585\u2586\u2586\u2586\u2587\u2587\u2587\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2587\u2587\u2587\u2586\u2586\u2586\u2585\u2585\u2584\u2583\u2588\u2580\u2580\u259C\u2588\u2588\u2588\u2588\u2588\u2588\u2588\n\t// \u2588\u2588\u2588\u2588\u259B\u259A\u2585\u2587\u2588\u2588\u2588\u258D \u2597\u2584\u2583\u00AF\"\u259C\u2588\u2588\u2598 \u259C\u2588\u2588\u258D \u2580\u2588\u258B \u2590\u2588\u2580\u2594\u2582\u2584\u2583 \u2594\u259C\u2588 \u2597\u2583\u2583\u2583\u2584\u258A \u2584\u2584\u2583 \u2594\u259C\u2588\u2588\u2587\u2585\u2583\u2580\u2588\u2588\u2588\u2588\n\t// \u2588\u2588\u2588\u258B\u257A\u2588\u2588\u2588\u2588\u2588\u2588\u258D \u2590\u2588\u2588\u258B \u2588\u2598 \u25E8\u023D \"\u2588\u2588\u258D \u2599\u2581 \u2580 \u2590\u258B \u2588\u259B\u2580\u2580\u2580\u259C\u2588 \u00B4\u2582\u2582\u014A\u2588\u258A \u00B0\"\u2594 \u2583\u2588\u2588\u2588\u2588\u2588\u2588\u258D\u2590\u2588\u2588\u2588\n\t// \u2588\u2588\u2588\u2588\u2584\u259D\u259C\u2588\u2588\u2588\u2588\u258D \u259D\u2580\u2580 \u2582\u259F\u2598 \u2584\u2584\u2584\u2584 \"\u2588\u258D \u2588\u2588\u2584 \u2590\u2588\u2583 \u259D\u2580\u2580 \u2590\u2588 \u259D\u2580\u2580\u2580\u2580\u258A \u2588\u2588\u2596 \u259D\u2588\u2588\u2588\u2588\u259B\u2580\u2584\u2588\u2588\u2588\u2588\n\t// \u2588\u2588\u2588\u2588\u2588\u2588\u2587\u2586\u2584\u2583\u2588\u2580\u2580\u023A\u25BC\u25A0\u2588\u2588\u2588\u2587\u2587\u2588\u2588\u2588\u2588\u2587\u2587\u2588\u2587\u2587\u2588\u2588\u2588\u2588\u2587\u2588\u2588\u2588\u2588\u2587\u2587\u2587\u2588\u2588\u2588\u2588\u2587\u2587\u2587\u2587\u2587\u2587\u2587\u2588\u2587\u25A0\u25D8\u2580\u2580\u2580\u2580\u2582\u2583\u2584\u2585\u2587\u2588\u2588\u2588\u2588\u2588\u2588\n\t// \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2587\u2587\u2586\u2586\u2586\u2585\u2585\u2585\u2585\u2585\u2585\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2584\u2585\u2585\u2585\u2585\u2585\u2585\u2586\u2586\u2586\u2587\u2587\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\n\t//\n\t//\n\t// \u250F\u2585\u2585\u2596 \u2597\u2585\u2585\u25B6 \u2585\u2585\u2585\u2585\u2585\u2585\u2585 \u2597\u2585\u2585\u2585\u2585\u2585\u2585\u2596 \u2585\u2585\u2585\u2585\u2585\u2584\u2584\u2582 \u2583\u2585\u2586\u2586\u2586\u2584\u2581 \u250F\u2585\u2585\u2596 \u2585\u2585\u2596\u2585\u2585\u2585\u2585\u2585\u2585\u2585\u2585\u2585\n\t// \u2523\u2588\u2588\u258C\u2597\u2588\u2588\u259B \u2588\u2588\u258A\u2594\u2594\u2594\u2594 \u2590\u2588\u2588\u258B\u2594\u2594\u2594` \u2588\u2588\u2588\u258D\"\u259C\u2588\u2588\u2599 \u259F\u2588\u2588\u2598\u2594\u2588\u2588\u2588\u2596 \u2590\u2588\u2588\u258C \u2588\u2588\u258C^\u2594\u2594\u2588\u2588\u2588^\u2594^\n\t// \u2523\u2588\u2588\u2599\u2588\u2588\u258B \u2588\u2588\u258A\u2582\u2582\u2582 \u2590\u2588\u2588\u258B\u2582\u2582\u2582 \u2588\u2588\u2588\u258D \u2590\u2588\u2588\u258B \u2590\u2588\u2588\u2588 \u2590\u2588\u2588\u258B \u2590\u2588\u2588\u258C \u2588\u2588\u258C \u2588\u2588\u2588\u258E\n\t// \u2523\u2588\u2588\u2588\u2588\u2588\u2588\u258C \u2588\u2588\u2588\u2580\u2580\u2580 \u2590\u2588\u2588\u2588\u2580\u2580\u2598 \u2588\u2588\u2588\u2588\u2588\u2588\u259B\u2580 \u2590\u2588\u2588\u2588 \u2590\u2588\u2588\u258B \u2590\u2588\u2588\u258C \u2588\u2588\u258C \u2588\u2588\u2588\u258E\n\t// \u2523\u2588\u2588\u259B \u259C\u2588\u2588\u2596 \u2588\u2588\u258A \u2590\u2588\u2588\u258B \u2588\u2588\u2588\u258D \u259D\u2588\u2588\u2588 \u259F\u2588\u2588\u258C \u2590\u2588\u2588\u258C \u2588\u2588\u258C \u2588\u2588\u2588\u258E\n\t// \u2523\u2588\u2588\u258C \u2588\u2588\u2588 \u2588\u2588\u2588\u2586\u2586\u2586\u2586\u258E\u2590\u2588\u2588\u2588\u2586\u2586\u2586\u2585 \u2588\u2588\u2588\u258D \u2580\u2588\u2588\u2599\u2585\u2588\u2588\u259B \u259D\u2588\u2588\u2588\u2585\u2586\u2588\u2588\u2598 \u2588\u2588\u2588\u258E\n\t// \u2594\u2594\u2594` \u00B4\u2594\u2594` \u2594\u2594\u2594\u2594\u2594\u2594\u2594 \u00B4\u2594\u2594\u2594\u2594\u2594\u2594\u2594 \u2594\u2594\u2594 \u2594\"\"\u2594\u00AF \u2594\"\"^\u2594 \u2594\u2594\u2594\n\n\tprivate create_overlay_host(): OverlayHost {\n\t\tconst self = this;\n\t\treturn {\n\t\t\tget panel() {\n\t\t\t\treturn self._intended;\n\t\t\t},\n\t\t\tget physics() {\n\t\t\t\treturn self._physics;\n\t\t\t},\n\t\t\tget stylesheet() {\n\t\t\t\treturn self._stylesheet;\n\t\t\t},\n\t\t\tget presizeQueue() {\n\t\t\t\treturn self._presizeQueue;\n\t\t\t},\n\t\t\trelativeCoordinates: (event, recalculate) =>\n\t\t\t\tself.relativeCoordinates(event, recalculate),\n\t\t\trestore: (layout, isFlattened) => self.restore(layout, isFlattened),\n\t\t\tquerySelector: (selectors) => self.querySelector(selectors),\n\t\t\tdispatchEvent: (event) => self.dispatchEvent(event),\n\t\t};\n\t}\n\n\tprivate onDblClick = async (event: MouseEvent) => {\n\t\tconst [col, row, rect] = this.relativeCoordinates(event, false);\n\t\tconst divider = calculate_intersection(col, row, this._panel, {\n\t\t\trect,\n\t\t\tsize: this._physics.GRID_DIVIDER_SIZE,\n\t\t});\n\n\t\tif (divider?.type === \"horizontal\" || divider?.type === \"vertical\") {\n\t\t\tconst panel = redistribute_panel_sizes(\n\t\t\t\tthis._intended,\n\t\t\t\tdivider.path,\n\t\t\t\tundefined,\n\t\t\t);\n\n\t\t\tawait this.restore(panel, true);\n\t\t}\n\t};\n\n\tprivate onPointerDown = (event: PointerEvent) => {\n\t\tif (event.button !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this._physics.GRID_DIVIDER_CHECK_TARGET || event.target === this) {\n\t\t\tconst [col, row, rect] = this.relativeCoordinates(event);\n\t\t\tconst size = this._physics.GRID_DIVIDER_SIZE;\n\t\t\tconst hit = calculate_intersection(col, row, this._panel, { rect, size });\n\t\t\tif (hit && hit.type !== \"layout-path\") {\n\t\t\t\tthis._drag_target = [hit, col, row];\n\t\t\t\tthis.setPointerCapture(event.pointerId);\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t}\n\t};\n\n\tprivate onPointerMove = async (event: PointerEvent) => {\n\t\tif (this._drag_target) {\n\t\t\tconst [col, row] = this.relativeCoordinates(event, false);\n\t\t\tconst [{ path, type }, old_col, old_row] = this._drag_target;\n\t\t\tconst offset = type === \"horizontal\" ? old_col - col : old_row - row;\n\t\t\tconst panel = redistribute_panel_sizes(this._panel, path, offset);\n\t\t\tawait this._presizeQueue.run(panel, () => {\n\t\t\t\tthis._stylesheet.replaceSync(\n\t\t\t\t\tcreate_css_grid_layout(panel, undefined, this._physics),\n\t\t\t\t);\n\t\t\t});\n\t\t}\n\n\t\tif (this._physics.GRID_DIVIDER_CHECK_TARGET && event.target !== this) {\n\t\t\tif (this._cursor_override) {\n\t\t\t\tthis._cursor_override = false;\n\t\t\t\tthis._cursor_stylesheet.replaceSync(\"\");\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst [col, row, rect] = this.relativeCoordinates(event, false);\n\t\tconst divider = calculate_intersection(col, row, this._panel, {\n\t\t\trect,\n\t\t\tsize: this._physics.GRID_DIVIDER_SIZE,\n\t\t});\n\n\t\tif (divider?.type === \"vertical\") {\n\t\t\tthis._cursor_stylesheet.replaceSync(\":host{cursor:row-resize\");\n\t\t\tthis._cursor_override = true;\n\t\t} else if (divider?.type === \"horizontal\") {\n\t\t\tthis._cursor_stylesheet.replaceSync(\":host{cursor:col-resize\");\n\t\t\tthis._cursor_override = true;\n\t\t} else if (this._cursor_override) {\n\t\t\tthis._cursor_override = false;\n\t\t\tthis._cursor_stylesheet.replaceSync(\"\");\n\t\t}\n\t};\n\n\tprivate onPointerUp = async (event: PointerEvent) => {\n\t\tif (this._drag_target) {\n\t\t\tthis.releasePointerCapture(event.pointerId);\n\t\t\tconst [col, row] = this.relativeCoordinates(event, false);\n\t\t\tconst [{ path, type }, old_col, old_row] = this._drag_target;\n\t\t\tconst offset = type === \"horizontal\" ? old_col - col : old_row - row;\n\t\t\tconst panel = redistribute_panel_sizes(this._intended, path, offset);\n\t\t\tawait this.restore(panel, true);\n\t\t\tthis._drag_target = undefined;\n\t\t}\n\t};\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport type { LayoutPath } from \"./core/types.ts\";\nimport type { RegularLayoutEvent } from \"./extensions.ts\";\nimport type { RegularLayout } from \"./regular-layout.ts\";\nimport type { RegularLayoutTab } from \"./regular-layout-tab.ts\";\n\nconst CSS = `\n:host{box-sizing:border-box;flex-direction:column;pointer-events:none}\n[part~=\"titlebar\"]{height:24px;user-select:none;overflow:hidden}\n[part~=\"container\"]{flex:1 1 auto;pointer-events:auto}\n[part~=\"title\"]{flex:1 1 auto;pointer-events:none}\n[part~=\"close\"]{align-self:stretch}\n:host([inactive]) [part~=\"container\"]{display:none}\n.tabs{display:grid;width:100%;height:100%}\n.tabs slot[name=\"tab\"]{display:grid;grid-row:1;pointer-events:auto}\n.tabs regular-layout-tab{display:flex;overflow:hidden}\n`;\n\nconst HTML_TEMPLATE = `\n\t<div part=\"titlebar\"><div class=\"tabs\" part=\"titlebar-track\"><slot name=\"tab\"><regular-layout-tab></regular-layout-tab></slot></div></div>\n\t<div part=\"container\"><slot></slot></div>\n`;\n\ntype DragState = { moved?: boolean; path: LayoutPath };\n\n/**\n * Escapes a string for safe use as a CSS `<string>` token (the `content`\n * fallback), handling backslashes, double-quotes, and newlines.\n */\nconst css_string = (value: string): string =>\n\t`\"${value.replace(/[\\\\\"\\n]/g, (c) => (c === \"\\n\" ? \"\\\\A \" : `\\\\${c}`))}\"`;\n\n/**\n * The per-slot CSS custom property a consumer sets to override a tab's label,\n * e.g. `regular-layout { --regular-layout-my-panel--title: \"My Panel\"; }`.\n */\nconst title_variable = (slot: string): string =>\n\t`--regular-layout-${globalThis.CSS.escape(slot)}--title`;\n\n/**\n * A custom element that represents a draggable panel within a\n * `<regular-layout>`.\n *\n * `<regular-layout-frame>` is optional - you may also use a `<regular-layout>`\n * with just plain `<div>` children (for example), but panels will not be\n * moveable within the layout unless you manually call `setOverlayState` and\n * `clearOverlayState` (or otherwise impement panel moving via the\n * `<regular-layout>` API).\n *\n * `<regular-layout-frame>` simple and highly customizable implementations\n * based on [CSS `part`](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Selectors/::part)\n * for custom styling, and symmetric\n * [named `slot`s](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_templates_and_slots)\n * for wholesale replacement of the underlying Shadow DOM.\n *\n * The `name` attribute identifies the panel within the layout. The tab label\n * defaults to `name`, but can be overridden with pure CSS by setting the\n * `--regular-layout-<name>--title` custom property to a CSS string - the label\n * is rendered via the tab title's `::before` `content`, so the override\n * applies reactively with no JavaScript.\n *\n * @example\n * ```html\n * <style>\n * regular-layout { --regular-layout-panel-1--title: \"Panel 1\"; }\n * </style>\n * <regular-layout>\n * <regular-layout-frame name=\"panel-1\">\n * <!-- Panel content here -->\n * </regular-layout-frame>\n * </regular-layout>\n * ```\n */\nexport class RegularLayoutFrame extends HTMLElement {\n\tprivate _shadowRoot!: ShadowRoot;\n\tprivate _container_sheet!: CSSStyleSheet;\n\tprivate _tab_sheet!: CSSStyleSheet;\n\tprivate _layout!: RegularLayout;\n\tprivate _header!: HTMLElement;\n\tprivate _default_tab!: RegularLayoutTab;\n\tprivate _drag: DragState | null = null;\n\n\t/**\n\t * Initializes this elements. Override this method and\n\t * `disconnectedCallback` to modify how this subclass renders the Shadow\n\t * DOM and registers events.\n\t */\n\tconnectedCallback() {\n\t\tthis._container_sheet ??= new CSSStyleSheet();\n\t\tthis._container_sheet.replaceSync(CSS);\n\t\tthis._tab_sheet ??= new CSSStyleSheet();\n\t\tthis._shadowRoot ??= this.attachShadow({ mode: \"open\" });\n\t\tthis._shadowRoot.adoptedStyleSheets = [\n\t\t\tthis._container_sheet,\n\t\t\tthis._tab_sheet,\n\t\t];\n\t\tthis._shadowRoot.innerHTML = HTML_TEMPLATE;\n\t\tthis._layout = this.parentElement as RegularLayout;\n\t\tthis._header = this._shadowRoot.children[0] as HTMLElement;\n\t\t// The built-in tab is the `slot=\"tab\"` fallback; a consumer-supplied\n\t\t// `slot=\"tab\"` child replaces it.\n\t\tthis._default_tab = this._header.querySelector(\n\t\t\t\"regular-layout-tab\",\n\t\t) as RegularLayoutTab;\n\t\tthis._header.addEventListener(\"pointerdown\", this.onPointerDown);\n\t\tthis.addEventListener(\"pointermove\", this.onPointerMove);\n\t\tthis.addEventListener(\"pointerup\", this.onPointerUp);\n\t\tthis.addEventListener(\"pointercancel\", this.onPointerCancel);\n\t\tthis.addEventListener(\"lostpointercapture\", this.onPointerLost);\n\t\tthis._layout.addEventListener(\"regular-layout-update\", this.drawTabs);\n\t\tthis._layout.addEventListener(\n\t\t\t\"regular-layout-before-update\",\n\t\t\tthis.drawTabs,\n\t\t);\n\t}\n\n\t/**\n\t * Destroys this element.\n\t */\n\tdisconnectedCallback() {\n\t\tthis._header.removeEventListener(\"pointerdown\", this.onPointerDown);\n\t\tthis.removeEventListener(\"pointermove\", this.onPointerMove);\n\t\tthis.removeEventListener(\"pointerup\", this.onPointerUp);\n\t\tthis.removeEventListener(\"pointercancel\", this.onPointerUp);\n\t\tthis.removeEventListener(\"lostpointercapture\", this.onPointerLost);\n\t\tthis._layout.removeEventListener(\"regular-layout-update\", this.drawTabs);\n\t\tthis._layout.removeEventListener(\n\t\t\t\"regular-layout-before-update\",\n\t\t\tthis.drawTabs,\n\t\t);\n\t}\n\n\tprivate onPointerDown = (event: PointerEvent): void => {\n\t\tif (event.button !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst elem = event.target as RegularLayoutTab;\n\t\tif (elem.part.contains(\"tab\")) {\n\t\t\tconst slot = this.getAttribute(\n\t\t\t\tthis._layout.savePhysics().CHILD_ATTRIBUTE_NAME,\n\t\t\t);\n\n\t\t\tconst path = this._layout.calculateIntersect(event);\n\t\t\tif (path && slot) {\n\t\t\t\t// Drag *this frame's* panel, not whichever panel is front-most at\n\t\t\t\t// the pointer (which is what `calculateIntersect` resolves to in a\n\t\t\t\t// stack). The overlapping stack shares geometry, so only the slot\n\t\t\t\t// needs overriding.\n\t\t\t\tthis._drag = { path: { ...path, slot } };\n\t\t\t\tthis.setPointerCapture(event.pointerId);\n\t\t\t\tevent.preventDefault();\n\t\t\t} else {\n\t\t\t\tthis._drag = null;\n\t\t\t}\n\t\t}\n\t};\n\n\tprivate onPointerMove = (event: PointerEvent): void => {\n\t\tif (this._drag) {\n\t\t\tconst physics = this._layout.savePhysics();\n\t\t\tif (!this._drag.moved) {\n\t\t\t\tconst diff = this._layout.diffCoordinates(event, this._drag.path);\n\t\t\t\tif (diff <= physics.MIN_DRAG_DISTANCE) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis._drag.moved = true;\n\t\t\tthis._layout.setOverlayState(event, this._drag.path);\n\t\t}\n\t};\n\n\tprivate onPointerUp = (event: PointerEvent): void => {\n\t\tif (this._drag?.moved) {\n\t\t\tthis._layout.clearOverlayState(event, this._drag.path);\n\t\t}\n\t};\n\n\tprivate onPointerCancel = (_: PointerEvent): void => {\n\t\tif (this._drag?.moved) {\n\t\t\tthis._layout.clearOverlayState(null, this._drag.path);\n\t\t}\n\t};\n\n\tprivate onPointerLost = (event: PointerEvent): void => {\n\t\tthis.releasePointerCapture(event.pointerId);\n\t\tthis._drag = null;\n\t};\n\n\tprivate drawTabs = (event: RegularLayoutEvent) => {\n\t\tconst attr = this._layout.savePhysics().CHILD_ATTRIBUTE_NAME;\n\t\tconst slot = this.getAttribute(attr);\n\t\tif (!slot) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet tab_panel = this._layout.getPanel(slot, event.detail);\n\t\tif (!tab_panel) {\n\t\t\ttab_panel = { type: \"tab-layout\", tabs: [slot], selected: 0 };\n\t\t}\n\n\t\t// Each frame renders only its *own* tab. Frames in a stack overlap (see\n\t\t// `create_css_grid_layout`); the tabs tile because every frame derives\n\t\t// the same column template and places its tab in its own column. Only\n\t\t// the selected frame shows its content; the rest keep just their tab.\n\t\tconst index = tab_panel.tabs.indexOf(slot);\n\t\tconst selected = (tab_panel.selected ?? 0) === index;\n\t\tthis.toggleAttribute(\"inactive\", !selected);\n\t\tthis._default_tab.populate(this._layout, tab_panel, index);\n\t\tthis.drawTab(slot, index, tab_panel.tabs.length);\n\t};\n\n\t/**\n\t * Regenerates this frame's tab stylesheet: the shared titlebar grid template\n\t * (so every frame in the stack aligns), the column this frame's tab occupies,\n\t * and the tab label. The label renders via the title's `::before` `content`,\n\t * reading the slot's `--regular-layout-<slot>--title` override variable with\n\t * the slot name as the fallback - so a consumer can relabel a tab purely in\n\t * CSS and the change applies reactively.\n\t *\n\t * @param slot - This frame's panel name.\n\t * @param index - This frame's column (zero-based) within the stack.\n\t * @param count - The number of tabs in the stack.\n\t */\n\tprivate drawTab = (slot: string, index: number, count: number) => {\n\t\tthis._tab_sheet.replaceSync(\n\t\t\t[\n\t\t\t\t`.tabs{grid-template-columns:repeat(${count},var(--rl-tab-width,1fr))}`,\n\t\t\t\t`.tabs slot[name=\"tab\"]{grid-column:${index + 1}}`,\n\t\t\t\t`[part~=\"title\"]::before{content:var(${title_variable(slot)}, ${css_string(slot)})}`,\n\t\t\t].join(\"\\n\"),\n\t\t);\n\t};\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport type { TabLayout } from \"./core/types.ts\";\nimport type { RegularLayout } from \"./regular-layout.ts\";\n\n/**\n * A custom HTML element representing an individual tab in a tab panel.\n *\n * This element manages the visual representation and interactions for a single tab,\n * including selection state, close functionality, and content display.\n */\nexport class RegularLayoutTab extends HTMLElement {\n\tprivate _layout?: RegularLayout;\n\tprivate _tab_panel?: TabLayout;\n\tprivate _index?: number;\n\n\t/**\n\t * Populates or updates the tab with layout information.\n\t *\n\t * This method initializes the tab's content and event listeners on first call,\n\t * and efficiently updates only the changed properties on subsequent calls.\n\t *\n\t * @param layout - The parent RegularLayout instance managing this tab.\n\t * @param tab_panel - The tab panel layout containing this tab.\n\t * @param index - The index of this tab within the tab panel.\n\t */\n\tpopulate = (layout: RegularLayout, tab_panel: TabLayout, index: number) => {\n\t\t// Stamp the slot onto the tab so its title can be styled by name (see\n\t\t// `RegularLayoutFrame#drawTitles`). Tag-qualified selectors keep this\n\t\t// distinct from the panel `name` on `<regular-layout-frame>`.\n\t\tthis.setAttribute(\n\t\t\tlayout.savePhysics().CHILD_ATTRIBUTE_NAME,\n\t\t\ttab_panel.tabs[index],\n\t\t);\n\n\t\tif (this._tab_panel) {\n\t\t\tconst tab_changed =\n\t\t\t\t(index === tab_panel.selected) !==\n\t\t\t\t(index === this._tab_panel?.selected);\n\n\t\t\tconst index_changed =\n\t\t\t\ttab_changed || this._tab_panel?.tabs[index] !== tab_panel.tabs[index];\n\n\t\t\tif (index_changed) {\n\t\t\t\tconst selected = tab_panel.selected === index;\n\t\t\t\tif (selected) {\n\t\t\t\t\tthis.children[1].part.add(\"active-close\");\n\t\t\t\t\tthis.part.add(\"active-tab\");\n\t\t\t\t} else {\n\t\t\t\t\tthis.children[1].part.remove(\"active-close\");\n\t\t\t\t\tthis.part.remove(\"active-tab\");\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconst selected = tab_panel.selected === index;\n\t\t\tconst parts = selected ? \"active-close close\" : \"close\";\n\t\t\tthis.innerHTML = `<div part=\"title\"></div><button part=\"${parts}\"></button>`;\n\t\t\tif (selected) {\n\t\t\t\tthis.part.add(\"tab\", \"active-tab\");\n\t\t\t} else {\n\t\t\t\tthis.part.add(\"tab\");\n\t\t\t}\n\n\t\t\tthis.addEventListener(\"pointerdown\", this.onTabClick);\n\t\t\tthis.children[1].addEventListener(\"pointerdown\", this.onTabClose);\n\t\t}\n\n\t\tthis._tab_panel = tab_panel;\n\t\tthis._layout = layout;\n\t\tthis._index = index;\n\t};\n\n\tprivate onTabClose = (event: Event) => {\n\t\tif (event instanceof PointerEvent && event?.button !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._tab_panel !== undefined && this._index !== undefined) {\n\t\t\tthis._layout?.removePanel(this._tab_panel.tabs[this._index]);\n\t\t}\n\t};\n\n\tprivate onTabClick = (event: PointerEvent) => {\n\t\tif (event.button !== 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._tab_panel !== undefined && this._index !== undefined) {\n\t\t\tthis._layout?.select(this._tab_panel.tabs[this._index]);\n\t\t}\n\t};\n}\n", "// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2584\u2580\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2580\u2588\u2591\u2588\u2591\u2588\u2591\u2580\u2588\u2580\u2591\u2580\u2584\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2584\u2591\u2591\u2588\u2580\u2584\u2591\u2588\u2580\u2580\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2588\u2580\u2584\u2591\u2580\u2580\u2580\u2591\u2588\u2591\u2591\u2591\u2588\u2580\u2588\u2591\u2591\u2588\u2591\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2588\u2591\u2591\u2588\u2591\u2591\u2591\u2584\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2580\u2580\u2591\u2580\u2580\u2580\u2591\u2591\u2580\u2591\u2591\u2580\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\n// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 * Copyright (c) 2026, the Regular Layout Authors. This file is part * \u2503\n// \u2503 * of the Regular Layout library, distributed under the terms of the * \u2503\n// \u2503 * [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). * \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport { RegularLayout } from \"./regular-layout.ts\";\nimport { RegularLayoutFrame } from \"./regular-layout-frame.ts\";\nimport type { Layout, PresizeDetail } from \"./core/types.ts\";\nimport { RegularLayoutTab } from \"./regular-layout-tab.ts\";\n\ncustomElements.define(\"regular-layout\", RegularLayout);\ncustomElements.define(\"regular-layout-frame\", RegularLayoutFrame);\ncustomElements.define(\"regular-layout-tab\", RegularLayoutTab);\n\ndeclare global {\n\tinterface Document {\n\t\tcreateElement(\n\t\t\ttagName: \"regular-layout\",\n\t\t\toptions?: ElementCreationOptions,\n\t\t): RegularLayout;\n\n\t\tcreateElement(\n\t\t\ttagName: \"regular-layout-frame\",\n\t\t\toptions?: ElementCreationOptions,\n\t\t): RegularLayoutFrame;\n\n\t\tcreateElement(\n\t\t\ttagName: \"regular-layout-tab\",\n\t\t\toptions?: ElementCreationOptions,\n\t\t): RegularLayoutTab;\n\n\t\tquerySelector<E extends Element = Element>(selectors: string): E | null;\n\t\tquerySelector(selectors: \"regular-layout\"): RegularLayout | null;\n\t\tquerySelector(selectors: \"regular-layout-frame\"): RegularLayoutFrame | null;\n\t\tquerySelector(selectors: \"regular-layout-tab\"): RegularLayoutTab | null;\n\t}\n\n\tinterface CustomElementRegistry {\n\t\tget(tagName: \"regular-layout\"): typeof RegularLayout;\n\t\tget(tagName: \"regular-layout-frame\"): typeof RegularLayoutFrame;\n\t}\n\n\tinterface HTMLElement {\n\t\taddEventListener(\n\t\t\tname: \"regular-layout-update\",\n\t\t\tcb: (e: RegularLayoutEvent) => void,\n\t\t\toptions?: { signal: AbortSignal },\n\t\t): void;\n\n\t\taddEventListener(\n\t\t\tname: \"regular-layout-before-update\",\n\t\t\tcb: (e: RegularLayoutEvent) => void,\n\t\t\toptions?: { signal: AbortSignal },\n\t\t): void;\n\n\t\taddEventListener(\n\t\t\tname: \"regular-layout-before-resize\",\n\t\t\tcb: (e: RegularLayoutPresizeEvent) => void,\n\t\t\toptions?: { signal: AbortSignal },\n\t\t): void;\n\n\t\taddEventListener(\n\t\t\tname: \"regular-layout-select\",\n\t\t\tcb: (e: RegularLayoutSelectEvent) => void,\n\t\t\toptions?: { signal: AbortSignal },\n\t\t): void;\n\n\t\tremoveEventListener(\n\t\t\tname: \"regular-layout-update\",\n\t\t\tcb: (e: RegularLayoutEvent) => void,\n\t\t): void;\n\n\t\tremoveEventListener(\n\t\t\tname: \"regular-layout-before-update\",\n\t\t\tcb: (e: RegularLayoutEvent) => void,\n\t\t): void;\n\n\t\tremoveEventListener(\n\t\t\tname: \"regular-layout-before-resize\",\n\t\t\tcb: (e: RegularLayoutPresizeEvent) => void,\n\t\t): void;\n\n\t\tremoveEventListener(\n\t\t\tname: \"regular-layout-select\",\n\t\t\tcb: (e: RegularLayoutSelectEvent) => void,\n\t\t): void;\n\t}\n}\n\nexport type RegularLayoutEvent = CustomEvent<Layout>;\nexport type RegularLayoutPresizeEvent = CustomEvent<PresizeDetail>;\nexport type RegularLayoutSelectEvent = CustomEvent<{ name: string }>;\n", "// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport type { View } from \"@perspective-dev/client\";\nimport type { PluginStaticConfig } from \"../../dist/ts-rs/PluginStaticConfig.d.ts\";\n\n/**\n * The `IPerspectiveViewerPlugin` interface defines the necessary API for a\n * `<perspective-viewer>` plugin, which also must be an `HTMLElement` via the\n * Custom Elements API or otherwise. Rather than implement this API from\n * scratch however, the simplest way is to inherit from\n * `<perspective-viewer-plugin>`, which implements `IPerspectiveViewerPlugin`\n * with non-offensive default implementations, where only the `draw()` and\n * `get_static_config()` methods need be overridden to get started with a\n * simple plugin.\n *\n * Note that plugins are frozen once a `<perspective-viewer>` has been\n * instantiated, so generally new plugin code must be executed at the module\n * level (if packaged as a library), or during application init to ensure global\n * availability of a plugin.\n *\n * ## Dispatch contract\n *\n * The host dispatches each method for exactly one reason, and never\n * defensively \u2014 implementations may rely on these meanings:\n *\n * - `draw(view)` \u2014 `view` is NEW to this plugin: a new engine `View` was\n * constructed, or this plugin was freshly selected and owes its first\n * render. Safe to reset zoom/scroll/selection state.\n * - `update(view)` \u2014 same `View`, but a plugin-visible input genuinely\n * changed: new data (`View.on_update`), an effective view-config delta\n * without a rebuild, a *changed* plugin/columns config just delivered\n * via `restore()`, changed CSS just applied via `restyle()`, a\n * render-limits change, or an explicit public `viewer.restore()` call\n * (the no-op-restore refresh affordance). Host-internal operations that\n * change none of these dispatch nothing.\n * - `resize(view)` \u2014 geometry or visibility changed (including panel\n * activation); repaint from retained state, no data or CSS re-read.\n * - `restyle()` \u2014 the effective theme genuinely changed; when a\n * `draw`/`update` is part of the same operation, `restyle()` is called\n * immediately BEFORE it, so one render pass paints in the new theme.\n * - `restore()`/`save()` \u2014 state transfer only. Plugins must NOT render\n * from `restore()` (a changed restore is always followed by exactly one\n * `update`) and must NOT call host APIs from inside it \u2014 a\n * `restore()` echo re-enters the host's public surface and forces\n * a redundant render (the classic double-render-on-load bug).\n *\n * Rendering methods (`draw`, `update`, `resize`, `render`, `clear`) and\n * `delete` are serialized per element \u2014 the host never overlaps them, and\n * each call runs to completion before the next begins.\n *\n * @example\n * ```javascript\n * const BasePlugin = customElements.get(\"perspective-viewer-plugin\");\n * class MyPlugin extends BasePlugin {\n * get_static_config() {\n * return { name: \"My Plugin\", config_column_names: [] };\n * }\n * async draw(view) {\n * const count = await view.num_rows();\n * this.innerHTML = `View has ${count} rows`;\n * }\n * }\n *\n * customElements.define(\"my-plugin\", MyPlugin);\n * const Viewer = customElements.get(\"perspective-viewer\");\n * Viewer.registerPlugin(\"my-plugin\");\n * ```\n * @noInheritDoc\n */\nexport interface IPerspectiveViewerPlugin {\n /**\n * Static plugin configuration. Called exactly once per plugin at\n * registration time and cached; the result must be stable for the\n * lifetime of the application.\n */\n get_static_config(): PluginStaticConfig;\n\n /**\n * Determines which column configuration controls are populated in the viewer.\n * Corresponds to the data the plugin will recieve on save. Only\n * invoked when `can_render_column_styles` is `true` in the static\n * config.\n */\n column_style_config?: (view_type: string, group: string) => any;\n\n /**\n * The per-column Style-tab schema: the controls the viewer renders\n * for one column, re-queried on every field edit so the field set\n * may depend on `current_value`.\n *\n * Must be a function of its arguments alone, never of what this element\n * last drew or was last `restore`d with.\n */\n column_config_schema?(\n view_type: string,\n group: string | undefined,\n column_name: string,\n current_value: Record<string, unknown> | null,\n viewer_config?: Record<string, unknown>,\n plugin_config?: Record<string, unknown> | null,\n ): { fields: Array<Record<string, unknown> & { kind: string }> };\n\n /**\n * The plugin-level settings schema as it applies to `current_value`, the\n * `plugin_config` state the schema should describe.\n */\n plugin_config_schema?(\n view_config?: Record<string, unknown>,\n current_value?: Record<string, unknown> | null,\n ): { fields: Array<Record<string, unknown> & { kind: string }> };\n\n /**\n * Render this plugin using the provided `View`. While there is no\n * provision to cancel a render in progress per se, calling a method on\n * a `View` which has been deleted will throw an exception.\n *\n * The host invokes `draw` ONLY when `view` is NEW to this plugin \u2014 a\n * new engine `View` was constructed for a config change, or this plugin\n * element was freshly selected and owes its first render of the bound\n * `View` \u2014 so implementations may treat it as \"new data shape\" and\n * reset zoom/scroll/selection-domain state. Repaints of the same\n * `View` arrive as `update()` (data or style refresh) or `resize()`\n * (geometry/chrome), never `draw()`.\n *\n * @example\n * ```\n * async draw(view: perspective.View): Promise<void> {\n * const csv = await view.to_csv();\n * this.innerHTML = `<pre>${csv}</pre>`;\n * }\n * ```\n */\n draw(view: View): Promise<void>;\n\n /**\n * Draw under the assumption that the `View` has not changed since the\n * previous call to `draw()`, but some plugin-visible input has.\n * Defaults to dispatch to `draw()`.\n *\n * @example\n * ```javascript\n * async update(view: perspective.View): Promise<void> {\n * return this.draw(view);\n * }\n * ```\n */\n update(view: View): Promise<void>;\n\n /**\n * Clear this plugin, though it is up to the discretion of the plugin\n * author to determine what this means. Defaults to resetting this\n * element's `innerHTML`, so be sure to override if you want custom\n * behavior.\n *\n * @example\n * ```javascript\n * async clear(): Promise<void> {\n * this.innerHTML = \"\";\n * }\n * ```\n */\n clear(): Promise<void>;\n\n /**\n * Like `update()`, but for when the dimensions of the plugin have changed\n * and the underlying data has not \u2014 a repaint from retained state,\n * invoked ONLY when geometry or visibility changed: box resizes,\n * presize sweeps, and the panel-ACTIVATION chrome nudge (multi-panel),\n * so implementations should repaint activation-dependent chrome here\n * and no-op while hidden (`offsetParent == null`).\n */\n resize(view: View): Promise<void>;\n\n /**\n * Notify the plugin that the style environment has changed. Useful for\n * plugins which read CSS styles via `window.getComputedStyle()` \u2014 this\n * is the ONLY point at which a plugin is expected to (re-)read them\n * (besides its first `draw()`), so implementations may cache computed\n * styles between `restyle()` calls.\n */\n restyle(): void;\n\n /**\n * Restore this plugin to a state previously returned by `save()`.\n *\n * State transfer ONLY \u2014 implementations must not render from\n * `restore()` (the host follows a restore that genuinely changed\n * plugin state with exactly one `update()` in the same serialized\n * sequence), and must not call host `<perspective-viewer>` APIs from\n * inside it: an echoed `restore()` re-enters the host's public\n * surface where it is indistinguishable from a user call and forces a\n * redundant render. Host API calls to persist plugin state belong to\n * genuine user-gesture handlers (e.g. a toolbar click), never to the\n * `restore()` delivery path.\n */\n restore(config: any): void;\n\n /**\n * OPTIONAL \u2014 clear any visible user selection state (highlighted rows,\n * pinned tooltips) WITHOUT emitting selection events. The host\n * `<perspective-viewer>` invokes this when an element-level global\n * filter contributed by this plugin's selection is removed from the\n * global filter bar, so the selection visual can't outlive the filter\n * it produced. Called under the host's per-panel render serialization\n * (like `draw`), so implementations may redraw. Plugins without a\n * selection UI may omit it.\n */\n deselect?(): Promise<void>;\n\n /**\n * Free any resources acquired by this plugin and prepare to be deleted.\n */\n delete(): void;\n}\n\n/**\n * The `<perspective-viewer-plugin>` element, the default perspective plugin\n * which is registered and activated automcatically when a\n * `<perspective-viewer>` is loaded without plugins. While you will not\n * typically instantiate this class directly, it is simple enough to function\n * as a good \"default\" plugin implementation which can be extended to create\n * custom plugins.\n *\n * @example\n * ```javascript\n * class MyPlugin extends customElements.get(\"perspective-viewer-plugin\") {\n * // Custom plugin overrides\n * }\n * ```\n * @noInheritDoc\n */\nexport class HTMLPerspectiveViewerPluginElement\n extends HTMLElement\n implements IPerspectiveViewerPlugin\n{\n constructor() {\n super();\n }\n\n get_static_config(): PluginStaticConfig {\n return {\n name: \"Debug\",\n select_mode: \"select\",\n config_column_names: [],\n };\n }\n\n column_style_config(): any {\n return {};\n }\n\n async update(view: View): Promise<void> {\n return this.draw(view);\n }\n\n async draw(view: View): Promise<void> {\n this.style.backgroundColor = \"#fff\";\n const csv = await view.to_csv();\n const css = `margin:0;overflow:scroll;position:absolute;width:100%;height:100%`;\n this.innerHTML = `<pre style='${css}'>${csv}</pre>`;\n }\n\n async clear(): Promise<void> {\n this.innerHTML = \"\";\n }\n\n async resize(view: View): Promise<void> {\n // Not Implemented\n }\n\n restyle() {\n // Not Implemented\n }\n\n restore(): void {\n // Not Implemented\n }\n\n async delete(): Promise<void> {\n // Not Implemented\n }\n\n get supports_streaming(): boolean {\n return false;\n }\n}\n", "// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\n/**\n * LLM provider presets for `viewer.agentConfig()`. These are plain data \u2014\n * the agent core is provider-agnostic (one OpenAI-chat-completions protocol\n * over primitive `url`/`headers`/`apiKey` connection fields), so a\n * \"provider\" is just a spreadable collection of those fields:\n *\n * ```javascript\n * import { providers } from \"@perspective-dev/viewer\";\n * viewer.agentConfig({\n * ...providers.anthropic,\n * apiKey: \"sk-ant-...\",\n * model: \"claude-haiku-4-5\", // spread order = override order\n * });\n * ```\n *\n * Any OpenAI-compatible service works without a preset \u2014 pass its full\n * chat-completions `url` (and `apiKey`/`headers` as needed) directly.\n * Cloud presets call the provider from the browser tab; suitable for local\n * development, or route `url` through your own proxy for production.\n */\n\n/**\n * A spreadable connection preset for `viewer.agentConfig()`.\n */\nexport interface AgentProviderPreset {\n name: string;\n url: string;\n headers?: Record<string, string>;\n model?: string;\n}\n\nexport const providers = {\n /**\n * Anthropic's OpenAI-compatibility endpoint. `apiKey` required.\n */\n anthropic: {\n name: \"anthropic\",\n url: \"https://api.anthropic.com/v1/chat/completions\",\n headers: { \"anthropic-dangerous-direct-browser-access\": \"true\" },\n model: \"claude-opus-5\",\n },\n\n /**\n * Google Gemini's OpenAI-compatibility endpoint. `apiKey` required.\n */\n gemini: {\n name: \"gemini\",\n url: \"https://generativelanguage.googleapis.com/v1beta/openai/chat/completions\",\n model: \"gemini-2.5-flash\",\n },\n\n /**\n * LM Studio's local developer server (enable CORS in its settings).\n */\n lmstudio: {\n name: \"lmstudio\",\n url: \"http://localhost:1234/v1/chat/completions\",\n },\n\n /**\n * Local Ollama (set `OLLAMA_ORIGINS` for CORS).\n */\n ollama: {\n name: \"ollama\",\n url: \"http://localhost:11434/v1/chat/completions\",\n },\n\n /**\n * OpenRouter. `apiKey` required.\n */\n openrouter: {\n name: \"openrouter\",\n url: \"https://openrouter.ai/api/v1/chat/completions\",\n },\n\n /**\n * OpenAI. `apiKey` required.\n */\n openai: {\n name: \"openai\",\n url: \"https://api.openai.com/v1/chat/completions\",\n model: \"gpt-5.2\",\n },\n} as const satisfies Record<string, AgentProviderPreset>;\n", "// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\n/**\n * Cross-package helpers for per-column value formatting. Used by both\n * `viewer-datagrid` (cell formatting) and `viewer-charts` (axis ticks,\n * tooltips, legends) so a column's `number_format` / `date_format`\n * configuration produces identical output across plugins.\n *\n * The format configs mirror the `Intl.NumberFormatOptions` /\n * `Intl.DateTimeFormatOptions` shapes one-for-one \u2014 they're written\n * straight into the respective constructors.\n */\n\nimport type { CustomNumberFormatConfig } from \"../../dist/ts-rs/CustomNumberFormatConfig.d.ts\";\nimport type { NumberFormatStyle } from \"../../dist/ts-rs/NumberFormatStyle.d.ts\";\nimport type { Notation } from \"../../dist/ts-rs/Notation.d.ts\";\nimport type { DatetimeFormat } from \"../../dist/ts-rs/DatetimeFormat.d.ts\";\n\n/**\n * A numeric column's `number_format` (`columns_config` value), exactly as\n * the Style tab's editor WRITES it \u2014 the ts-rs projection of the Rust\n * `CustomNumberFormatConfig`, re-composed with its serde-flattened\n * `style` and `notation` families (ts-rs cannot flatten `Option<enum>`,\n * so the Rust type `#[ts(skip)]`s them and they export separately).\n */\nexport type NumberFormatConfig = CustomNumberFormatConfig &\n Partial<NumberFormatStyle> &\n Partial<Notation>;\n\n/**\n * A datetime column's `date_format` (`columns_config` value), a subset of\n * `Intl.DateTimeFormatOptions`.\n */\nexport type DateFormatConfig = DatetimeFormat;\n\n/** The `date_format` keys that apply as one group. */\nexport const DATE_FORMAT_SHAPE_KEYS = [\n \"dateStyle\",\n \"timeStyle\",\n \"weekday\",\n \"year\",\n \"month\",\n \"day\",\n \"hour\",\n \"minute\",\n \"second\",\n \"fractionalSecondDigits\",\n] as const satisfies readonly (keyof DateFormatConfig)[];\n\n/** The `date_format` keys that apply individually. */\nexport const DATE_FORMAT_MODIFIER_KEYS = [\n \"timeZone\",\n \"hour12\",\n] as const satisfies readonly (keyof DateFormatConfig)[];\n\n/** Whether `cfg` sets any of the `date_format` keys that apply as one group. */\nexport function hasDateFormatShape(\n cfg: DateFormatConfig | undefined,\n): cfg is DateFormatConfig {\n return DATE_FORMAT_SHAPE_KEYS.some((key) => cfg?.[key] !== undefined);\n}\n\n/** The `date_format` options that apply individually. */\nexport type DateFormatModifiers = Pick<\n Intl.DateTimeFormatOptions,\n \"timeZone\" | \"hour12\"\n>;\n\n/** The `date_format` keys of `cfg` that apply individually, if it sets any. */\nexport function dateFormatModifiers(\n cfg: DateFormatConfig | undefined,\n): DateFormatModifiers | undefined {\n const out: DateFormatModifiers = {};\n if (cfg?.timeZone !== undefined) {\n out.timeZone = cfg.timeZone;\n }\n\n if (cfg?.hour12 !== undefined) {\n out.hour12 = cfg.hour12;\n }\n\n return Object.keys(out).length > 0 ? out : undefined;\n}\n\n/**\n * Default `Intl.NumberFormatOptions` applied when a numeric column has no\n * `number_format` configured. Float columns get two fractional digits to\n * match the legacy datagrid behavior; integer columns get an empty\n * options bag (locale-default integer rendering).\n */\nconst NUMERIC_LEGACY_DEFAULTS: Record<string, Intl.NumberFormatOptions> = {\n float: {\n style: \"decimal\",\n minimumFractionDigits: 2,\n maximumFractionDigits: 2,\n },\n};\n\n/**\n * The viewer's own `date_format` for a datetime column, below every plugin\n * and override layer.\n */\nconst DATETIME_BASE: DateFormatConfig = {\n dateStyle: \"short\",\n timeStyle: \"medium\",\n};\n\nconst DATE_BASE: DateFormatConfig & { dateStyle: \"short\" } = {\n dateStyle: \"short\",\n};\n\nconst NUMBER_FORMAT_GROUPS: readonly (readonly string[])[] = [\n [\n \"style\",\n \"currency\",\n \"currencyDisplay\",\n \"currencySign\",\n \"unit\",\n \"unitDisplay\",\n ],\n [\"notation\", \"compactDisplay\"],\n [\"minimumFractionDigits\", \"maximumFractionDigits\"],\n [\"minimumSignificantDigits\", \"maximumSignificantDigits\"],\n];\n\nfunction mergeNumberOptions(\n base: Intl.NumberFormatOptions,\n cfg?: NumberFormatConfig,\n): Intl.NumberFormatOptions {\n const explicit: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(cfg ?? {})) {\n if (v !== undefined && v !== null) {\n explicit[k] = v;\n }\n }\n\n const merged: Record<string, unknown> = { ...base };\n for (const group of NUMBER_FORMAT_GROUPS) {\n if (group.some((key) => key in explicit)) {\n for (const key of group) {\n delete merged[key];\n }\n }\n }\n\n return Object.assign(merged, explicit) as Intl.NumberFormatOptions;\n}\n\n/**\n * `defaults` is the calling plugin's declared default format, filling in\n * the fields `cfg` leaves unset.\n */\nexport function createNumberFormatter(\n type: string,\n cfg?: NumberFormatConfig,\n defaults?: NumberFormatConfig,\n): Intl.NumberFormat {\n // ts-rs renders serde-absent keys as `T | null`; the wire never\n // carries an explicit `null` (`skip_serializing_if`), and\n // `Intl.NumberFormat` treats both absent and `undefined` the same, so\n // the cast is presentation-only.\n const base = ((defaults as Intl.NumberFormatOptions | undefined) ??\n NUMERIC_LEGACY_DEFAULTS[type] ??\n {}) as Intl.NumberFormatOptions;\n\n const opts = cfg ? mergeNumberOptions(base, cfg) : base;\n return new Intl.NumberFormat(navigator.languages as string[], opts);\n}\n\n/**\n * `cfg` layered over `defaults`, then over `base`, by the `date_format`\n * group rule, as `Intl.DateTimeFormat` options.\n */\nexport function resolveDateFormat(\n cfg: DateFormatConfig | undefined,\n defaults: DateFormatConfig | undefined,\n base: DateFormatConfig,\n): Intl.DateTimeFormatOptions {\n const layers = [cfg, defaults, base];\n const shape: DateFormatConfig = layers.find(hasDateFormatShape) ?? {};\n const opts: DateFormatConfig = {};\n const copy = <K extends keyof DateFormatConfig>(\n key: K,\n from: DateFormatConfig | undefined,\n ) => {\n if (from !== undefined && from[key] !== undefined) {\n opts[key] = from[key];\n }\n };\n\n for (const key of DATE_FORMAT_SHAPE_KEYS) {\n copy(key, shape);\n }\n\n for (const key of DATE_FORMAT_MODIFIER_KEYS) {\n copy(\n key,\n layers.find((layer) => layer?.[key] !== undefined),\n );\n }\n\n return opts;\n}\n\n/**\n * `defaults` is the calling plugin's declared default `date_format`, which\n * `cfg` overrides by the `date_format` group rule.\n */\nexport function createDatetimeFormatter(\n cfg?: DateFormatConfig,\n defaults?: DateFormatConfig,\n): Intl.DateTimeFormat {\n return new Intl.DateTimeFormat(\n navigator.languages as string[],\n resolveDateFormat(cfg, defaults, DATETIME_BASE),\n );\n}\n\n/**\n * `defaults` follows the same contract as [`createDatetimeFormatter`];\n * only `dateStyle` applies, in UTC.\n */\nexport function createDateFormatter(\n cfg?: DateFormatConfig,\n defaults?: DateFormatConfig,\n): Intl.DateTimeFormat {\n const { dateStyle } = resolveDateFormat(cfg, defaults, DATE_BASE);\n return new Intl.DateTimeFormat(navigator.languages as string[], {\n timeZone: \"utc\",\n dateStyle: dateStyle ?? DATE_BASE.dateStyle,\n });\n}\n\n/**\n * Recover the source column name from a synthetic split-by path. Split\n * pivoting produces paths of the form `<split_val_1>|...|<source_col>`;\n * per-column config (formatters, aggregate styling, \u2026) is always keyed\n * on the trailing source column.\n */\nexport function sourceColumn(path: string): string {\n return path.split(\"|\").at(-1) ?? path;\n}\n", "// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport type { ViewConfigUpdate, Filter } from \"@perspective-dev/client\";\n\n/**\n * The `detail` of a `perspective-global-filter` event.\n */\nexport class PerspectiveSelectDetail {\n selected: boolean;\n row: Record<string, unknown>;\n column_names?: string[];\n removeConfigs: ViewConfigUpdate[];\n insertConfigs: ViewConfigUpdate[];\n panel?: string;\n constructor(\n selected: boolean,\n row: Record<string, unknown>,\n column_names: string[],\n removeConfigs: ViewConfigUpdate[],\n insertConfigs: ViewConfigUpdate[],\n panel?: string,\n ) {\n this.selected = selected;\n this.row = row;\n this.column_names = column_names;\n this.removeConfigs = removeConfigs;\n this.insertConfigs = insertConfigs;\n this.panel = panel;\n }\n\n get removeFilters(): Filter[] {\n return this.removeConfigs.flatMap((x) => x.filter ?? []);\n }\n\n get insertFilters(): Filter[] {\n return this.insertConfigs.flatMap((x) => x.filter ?? []);\n }\n}\n", "// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\ntype ModType = {\n resize: (x: number) => number;\n memory: WebAssembly.Memory;\n compile: (x: number, y: number) => number;\n};\n\nexport async function extract(input: any) {\n let bin: WebAssembly.WebAssemblyInstantiatedSource;\n if (input instanceof Response) {\n bin = await WebAssembly.instantiateStreaming(input);\n } else if (typeof input === \"string\") {\n bin = await WebAssembly.instantiateStreaming(fetch(input));\n } else if (input instanceof ArrayBuffer) {\n bin = await WebAssembly.instantiate(input);\n } else {\n bin = input;\n }\n\n const inst = bin.instance.exports as ModType;\n const [payload] = WebAssembly.Module.customSections(\n bin.module,\n \"psp-runtime\",\n );\n\n const [raw_length_view] = WebAssembly.Module.customSections(\n bin.module,\n \"psp-len\",\n );\n\n const raw_length = new DataView(raw_length_view).getUint32(0, true);\n const ptr = inst.resize(payload.byteLength);\n new Uint8Array(inst.memory.buffer).set(new Uint8Array(payload), ptr);\n const offset = inst.compile(payload.byteLength, raw_length);\n return new Uint8Array(inst.memory.buffer).slice(\n offset,\n raw_length + offset,\n );\n}\n\nif (typeof WebAssembly === \"undefined\") {\n throw new Error(\"WebAssembly not supported.\");\n}\n\ninterface Module extends WebAssembly.Exports {\n size(): number;\n offset(): number;\n memory: WebAssembly.Memory;\n}\n\nexport async function load_wasm_stage_0(\n wasm:\n | ArrayBuffer\n | Response\n | WebAssembly.Module\n | (() => Promise<ArrayBuffer>),\n): Promise<Uint8Array> {\n if (wasm instanceof Function) {\n wasm = await wasm();\n }\n\n if (wasm instanceof Promise) {\n wasm = await wasm;\n }\n\n try {\n return await extract(wasm as ArrayBuffer);\n } catch (e) {\n console.warn(\"Stage 0 wasm loading failed, skipping\");\n return new Uint8Array(wasm as ArrayBuffer);\n }\n}\n", "// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\n// The encoding of `(module (memory i64 1))` \u2014 validates only on hosts with\n// WebAssembly Memory64 support (the same probe `wasm-feature-detect` uses).\nconst MEMORY64_PROBE = new Uint8Array([\n 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x05, 0x03, 0x01, 0x04,\n 0x01,\n]);\n\nlet MEMORY64_SUPPORTED: boolean | undefined;\n\n/**\n * Does this JavaScript host support WebAssembly Memory64 (wasm64)?\n */\nexport function host_supports_memory64(): boolean {\n if (MEMORY64_SUPPORTED === undefined) {\n MEMORY64_SUPPORTED = WebAssembly.validate(MEMORY64_PROBE);\n }\n\n return MEMORY64_SUPPORTED;\n}\n", "/* @ts-self-types=\"./perspective-migrate-js.wasm.d.ts\" */\n\n/**\n * Upgrade a persisted Perspective config to the current schema, returning\n * `{value, notices, steps}`.\n * @param {string} kind\n * @param {string | null | undefined} from\n * @param {any} value\n * @returns {any}\n */\nexport function migrate(kind, from, value) {\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(kind, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len0 = WASM_VECTOR_LEN;\n var ptr1 = isLikeNone(from) ? 0 : passStringToWasm0(from, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n var len1 = WASM_VECTOR_LEN;\n wasm.migrate(retptr, ptr0, len0, ptr1, len1, addHeapObject(value));\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n if (r2) {\n throw takeObject(r1);\n }\n return takeObject(r0);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n }\n}\n\nfunction __wbg_get_imports() {\n const import0 = {\n __proto__: null,\n __wbg_Error_8c4e43fe74559d73: function(arg0, arg1) {\n const ret = Error(getStringFromWasm0(arg0, arg1));\n return addHeapObject(ret);\n },\n __wbg_String_8f0eb39a4a4c2f66: function(arg0, arg1) {\n const ret = String(getObject(arg1));\n const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len1 = WASM_VECTOR_LEN;\n getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n },\n __wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2: function(arg0, arg1) {\n const v = getObject(arg1);\n const ret = typeof(v) === 'bigint' ? v : undefined;\n getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);\n },\n __wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25: function(arg0) {\n const v = getObject(arg0);\n const ret = typeof(v) === 'boolean' ? v : undefined;\n return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;\n },\n __wbg___wbindgen_debug_string_0bc8482c6e3508ae: function(arg0, arg1) {\n const ret = debugString(getObject(arg1));\n const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len1 = WASM_VECTOR_LEN;\n getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n },\n __wbg___wbindgen_in_47fa6863be6f2f25: function(arg0, arg1) {\n const ret = getObject(arg0) in getObject(arg1);\n return ret;\n },\n __wbg___wbindgen_is_bigint_31b12575b56f32fc: function(arg0) {\n const ret = typeof(getObject(arg0)) === 'bigint';\n return ret;\n },\n __wbg___wbindgen_is_function_0095a73b8b156f76: function(arg0) {\n const ret = typeof(getObject(arg0)) === 'function';\n return ret;\n },\n __wbg___wbindgen_is_object_5ae8e5880f2c1fbd: function(arg0) {\n const val = getObject(arg0);\n const ret = typeof(val) === 'object' && val !== null;\n return ret;\n },\n __wbg___wbindgen_is_string_cd444516edc5b180: function(arg0) {\n const ret = typeof(getObject(arg0)) === 'string';\n return ret;\n },\n __wbg___wbindgen_jsval_eq_11888390b0186270: function(arg0, arg1) {\n const ret = getObject(arg0) === getObject(arg1);\n return ret;\n },\n __wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811: function(arg0, arg1) {\n const ret = getObject(arg0) == getObject(arg1);\n return ret;\n },\n __wbg___wbindgen_number_get_8ff4255516ccad3e: function(arg0, arg1) {\n const obj = getObject(arg1);\n const ret = typeof(obj) === 'number' ? obj : undefined;\n getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);\n },\n __wbg___wbindgen_string_get_72fb696202c56729: function(arg0, arg1) {\n const obj = getObject(arg1);\n const ret = typeof(obj) === 'string' ? obj : undefined;\n var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n var len1 = WASM_VECTOR_LEN;\n getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);\n getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);\n },\n __wbg___wbindgen_throw_be289d5034ed271b: function(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n },\n __wbg_call_389efe28435a9388: function() { return handleError(function (arg0, arg1) {\n const ret = getObject(arg0).call(getObject(arg1));\n return addHeapObject(ret);\n }, arguments); },\n __wbg_done_57b39ecd9addfe81: function(arg0) {\n const ret = getObject(arg0).done;\n return ret;\n },\n __wbg_entries_58c7934c745daac7: function(arg0) {\n const ret = Object.entries(getObject(arg0));\n return addHeapObject(ret);\n },\n __wbg_get_9b94d73e6221f75c: function(arg0, arg1) {\n const ret = getObject(arg0)[arg1 >>> 0];\n return addHeapObject(ret);\n },\n __wbg_get_b3ed3ad4be2bc8ac: function() { return handleError(function (arg0, arg1) {\n const ret = Reflect.get(getObject(arg0), getObject(arg1));\n return addHeapObject(ret);\n }, arguments); },\n __wbg_instanceof_ArrayBuffer_c367199e2fa2aa04: function(arg0) {\n let result;\n try {\n result = getObject(arg0) instanceof ArrayBuffer;\n } catch (_) {\n result = false;\n }\n const ret = result;\n return ret;\n },\n __wbg_instanceof_Map_53af74335dec57f4: function(arg0) {\n let result;\n try {\n result = getObject(arg0) instanceof Map;\n } catch (_) {\n result = false;\n }\n const ret = result;\n return ret;\n },\n __wbg_instanceof_Uint8Array_9b9075935c74707c: function(arg0) {\n let result;\n try {\n result = getObject(arg0) instanceof Uint8Array;\n } catch (_) {\n result = false;\n }\n const ret = result;\n return ret;\n },\n __wbg_isArray_d314bb98fcf08331: function(arg0) {\n const ret = Array.isArray(getObject(arg0));\n return ret;\n },\n __wbg_isSafeInteger_bfbc7332a9768d2a: function(arg0) {\n const ret = Number.isSafeInteger(getObject(arg0));\n return ret;\n },\n __wbg_iterator_6ff6560ca1568e55: function() {\n const ret = Symbol.iterator;\n return addHeapObject(ret);\n },\n __wbg_length_32ed9a279acd054c: function(arg0) {\n const ret = getObject(arg0).length;\n return ret;\n },\n __wbg_length_35a7bace40f36eac: function(arg0) {\n const ret = getObject(arg0).length;\n return ret;\n },\n __wbg_new_361308b2356cecd0: function() {\n const ret = new Object();\n return addHeapObject(ret);\n },\n __wbg_new_3eb36ae241fe6f44: function() {\n const ret = new Array();\n return addHeapObject(ret);\n },\n __wbg_new_dca287b076112a51: function() {\n const ret = new Map();\n return addHeapObject(ret);\n },\n __wbg_new_dd2b680c8bf6ae29: function(arg0) {\n const ret = new Uint8Array(getObject(arg0));\n return addHeapObject(ret);\n },\n __wbg_next_3482f54c49e8af19: function() { return handleError(function (arg0) {\n const ret = getObject(arg0).next();\n return addHeapObject(ret);\n }, arguments); },\n __wbg_next_418f80d8f5303233: function(arg0) {\n const ret = getObject(arg0).next;\n return addHeapObject(ret);\n },\n __wbg_prototypesetcall_bdcdcc5842e4d77d: function(arg0, arg1, arg2) {\n Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));\n },\n __wbg_set_1eb0999cf5d27fc8: function(arg0, arg1, arg2) {\n const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));\n return addHeapObject(ret);\n },\n __wbg_set_3f1d0b984ed272ed: function(arg0, arg1, arg2) {\n getObject(arg0)[takeObject(arg1)] = takeObject(arg2);\n },\n __wbg_set_f43e577aea94465b: function(arg0, arg1, arg2) {\n getObject(arg0)[arg1 >>> 0] = takeObject(arg2);\n },\n __wbg_value_0546255b415e96c1: function(arg0) {\n const ret = getObject(arg0).value;\n return addHeapObject(ret);\n },\n __wbindgen_cast_0000000000000001: function(arg0) {\n // Cast intrinsic for `F64 -> Externref`.\n const ret = arg0;\n return addHeapObject(ret);\n },\n __wbindgen_cast_0000000000000002: function(arg0) {\n // Cast intrinsic for `I64 -> Externref`.\n const ret = arg0;\n return addHeapObject(ret);\n },\n __wbindgen_cast_0000000000000003: function(arg0, arg1) {\n // Cast intrinsic for `Ref(String) -> Externref`.\n const ret = getStringFromWasm0(arg0, arg1);\n return addHeapObject(ret);\n },\n __wbindgen_cast_0000000000000004: function(arg0) {\n // Cast intrinsic for `U64 -> Externref`.\n const ret = BigInt.asUintN(64, arg0);\n return addHeapObject(ret);\n },\n __wbindgen_object_drop_ref: function(arg0) {\n takeObject(arg0);\n },\n };\n return {\n __proto__: null,\n \"./perspective-migrate-js.wasm_bg.js\": import0,\n };\n}\n\nfunction addHeapObject(obj) {\n if (heap_next === heap.length) heap.push(heap.length + 1);\n const idx = heap_next;\n heap_next = heap[idx];\n\n heap[idx] = obj;\n return idx;\n}\n\nfunction debugString(val) {\n // primitive types\n const type = typeof val;\n if (type == 'number' || type == 'boolean' || val == null) {\n return `${val}`;\n }\n if (type == 'string') {\n return `\"${val}\"`;\n }\n if (type == 'symbol') {\n const description = val.description;\n if (description == null) {\n return 'Symbol';\n } else {\n return `Symbol(${description})`;\n }\n }\n if (type == 'function') {\n const name = val.name;\n if (typeof name == 'string' && name.length > 0) {\n return `Function(${name})`;\n } else {\n return 'Function';\n }\n }\n // objects\n if (Array.isArray(val)) {\n const length = val.length;\n let debug = '[';\n if (length > 0) {\n debug += debugString(val[0]);\n }\n for(let i = 1; i < length; i++) {\n debug += ', ' + debugString(val[i]);\n }\n debug += ']';\n return debug;\n }\n // Test for built-in\n const builtInMatches = /\\[object ([^\\]]+)\\]/.exec(toString.call(val));\n let className;\n if (builtInMatches && builtInMatches.length > 1) {\n className = builtInMatches[1];\n } else {\n // Failed to match the standard '[object ClassName]'\n return toString.call(val);\n }\n if (className == 'Object') {\n // we're a user defined class or Object\n // JSON.stringify avoids problems with cycles, and is generally much\n // easier than looping through ownProperties of `val`.\n try {\n return 'Object(' + JSON.stringify(val) + ')';\n } catch (_) {\n return 'Object';\n }\n }\n // errors\n if (val instanceof Error) {\n return `${val.name}: ${val.message}\\n${val.stack}`;\n }\n // TODO we could test for more things here, like `Set`s and `Map`s.\n return className;\n}\n\nfunction dropObject(idx) {\n if (idx < 132) return;\n heap[idx] = heap_next;\n heap_next = idx;\n}\n\nfunction getArrayU8FromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);\n}\n\nlet cachedDataViewMemory0 = null;\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return decodeText(ptr, len);\n}\n\nlet cachedUint8ArrayMemory0 = null;\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nfunction getObject(idx) { return heap[idx]; }\n\nfunction handleError(f, args) {\n try {\n return f.apply(this, args);\n } catch (e) {\n wasm.__wbindgen_export3(addHeapObject(e));\n }\n}\n\nlet heap = new Array(128).fill(undefined);\nheap.push(undefined, null, true, false);\n\nlet heap_next = heap.length;\n\nfunction isLikeNone(x) {\n return x === undefined || x === null;\n}\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = cachedTextEncoder.encodeInto(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nfunction takeObject(idx) {\n const ret = getObject(idx);\n dropObject(idx);\n return ret;\n}\n\nlet cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\ncachedTextDecoder.decode();\nconst MAX_SAFARI_DECODE_BYTES = 2146435072;\nlet numBytesDecoded = 0;\nfunction decodeText(ptr, len) {\n numBytesDecoded += len;\n if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {\n cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\n cachedTextDecoder.decode();\n numBytesDecoded = len;\n }\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n\nconst cachedTextEncoder = new TextEncoder();\n\nlet WASM_VECTOR_LEN = 0;\n\nlet wasmModule, wasm;\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n wasmModule = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n return wasm;\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n } catch (e) {\n const validResponse = module.ok && expectedResponseType(module.type);\n\n if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else { throw e; }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n } else {\n return instance;\n }\n }\n\n function expectedResponseType(type) {\n switch (type) {\n case 'basic': case 'cors': case 'default': return true;\n }\n return false;\n }\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (module !== undefined) {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n const instance = new WebAssembly.Instance(module, imports);\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (module_or_path !== undefined) {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync, __wbg_init as default };\n", "// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport * as migrate_wasm from \"../../../dist/wasm/perspective-migrate-js.js\";\n\n/**\n * The kind of persisted config `migrate()` upgrades: an engine `ViewConfig`,\n * a `<perspective-viewer>` `save()` token, or a `saveWorkspace()` token.\n */\nexport type MigrateKind = \"view\" | \"viewer\" | \"workspace\";\n\n/**\n * Information `migrate()` could not carry into the current schema exactly.\n */\nexport type MigrateNotice =\n | { kind: \"Dropped\"; step: string; pointer: string; value: unknown }\n | { kind: \"Approximated\"; step: string; pointer: string; reason: string };\n\n/**\n * A config upgraded by `migrate()`, with what the upgrade dropped or\n * approximated and the ids of the schema changes it applied.\n */\nexport interface MigrateResult<T = Record<string, unknown>> {\n value: T;\n notices: MigrateNotice[];\n steps: string[];\n}\n\ntype MigrateBinary = BufferSource | WebAssembly.Module;\n\n/**\n * Instantiates the `perspective-migrate` WebAssembly module from its\n * registered source on the first `migrate()` call.\n */\nexport class MigrateLoader {\n private source?: () => Promise<MigrateBinary>;\n private module?: Promise<typeof migrate_wasm>;\n\n register(source: () => Promise<MigrateBinary>) {\n this.source = source;\n this.module = undefined;\n }\n\n async migrate<T = Record<string, unknown>>(\n kind: MigrateKind,\n config: unknown,\n from_version?: string,\n ): Promise<MigrateResult<T>> {\n if (this.module === undefined) {\n if (this.source === undefined) {\n throw new Error(\"Missing perspective-migrate-js.wasm\");\n }\n\n const source = this.source;\n const module = source().then(async (module_or_path) => {\n await migrate_wasm.default({ module_or_path });\n return migrate_wasm;\n });\n\n this.module = module;\n module.catch(() => {\n if (this.module === module) {\n this.module = undefined;\n }\n });\n }\n\n const wasm = await this.module;\n return wasm.migrate(kind, from_version, config) as MigrateResult<T>;\n }\n}\n", "// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\n/**\n * Resolve the URL of a WASM binary shipped in the `wasm_package` Perspective\n * package, relative to the URL of the `bundle_package` CDN bundle which loads\n * it.\n */\nexport function resolve_package_wasm_url(\n bundle_url: string,\n bundle_package: string,\n wasm_package: string,\n filename: string,\n): string {\n const pattern = new RegExp(\n `/${bundle_package}(@[^/]+)?/dist/cdn/[^/?#]*([?#].*)?$`,\n );\n\n const rewritten = bundle_url.replace(\n pattern,\n (_, tag) => `/${wasm_package}${tag ?? \"\"}/dist/wasm/${filename}`,\n );\n\n if (rewritten !== bundle_url) {\n return rewritten;\n }\n\n return new URL(`../../../${wasm_package}/dist/wasm/${filename}`, bundle_url)\n .href;\n}\n\n/**\n * Resolve the URL of one of `@perspective-dev/server`'s engine WASM binaries\n * relative to the URL of the `@perspective-dev/client` CDN bundle which loads\n * it.\n */\nexport function resolve_server_wasm_url(\n client_url: string,\n filename: string = \"perspective-server.wasm\",\n): string {\n return resolve_package_wasm_url(client_url, \"client\", \"server\", filename);\n}\n", "// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\n/**\n * The page-wide WebAssembly registry shared by Perspective's packages, an\n * internal contract between them rather than a public API.\n *\n * @module\n */\n\nimport type * as psp from \"../../../dist/wasm/perspective-js.d.ts\";\nimport { load_wasm_stage_0 } from \"./decompress.ts\";\nimport { host_supports_memory64 } from \"./features.ts\";\nimport type { MigrateKind, MigrateResult } from \"./migrate.ts\";\n\nexport { MigrateLoader } from \"./migrate.ts\";\nexport type { MigrateKind, MigrateNotice, MigrateResult } from \"./migrate.ts\";\nexport { resolve_package_wasm_url } from \"./cdn.ts\";\n\ndeclare const __PSP_VERSION__: string;\n\n/**\n * A WebAssembly binary in a form `init()` accepts.\n */\nexport type WasmBinary =\n | Uint8Array\n | ArrayBuffer\n | Response\n | WebAssembly.Module;\n\n/**\n * A WebAssembly binary, a promise of one, or a thunk which is only invoked\n * when the binary is first needed.\n */\nexport type WasmSource =\n | WasmBinary\n | Promise<WasmBinary>\n | (() => Promise<WasmBinary>);\n\n/**\n * The WebAssembly binaries to register with `init()`, by role.\n */\nexport interface WasmRegistration {\n client?: WasmSource;\n viewer?: WasmSource;\n server?: WasmSource;\n server32?: WasmSource;\n server64?: WasmSource;\n migrate?: WasmSource;\n}\n\n/**\n * Options for `init()`, applied to the sources registered by that call.\n */\nexport interface InitOptions {\n disable_stage_0?: boolean;\n}\n\n/**\n * The initialized wasm-bindgen module backing every `Client` on the page.\n */\nexport interface ClientRuntime {\n glue: typeof psp;\n module?: WebAssembly.Module;\n}\n\n/**\n * Instantiates a package's wasm-bindgen module from its extracted binary.\n */\nexport type RuntimeProvider = (\n wasm: ArrayBuffer | WebAssembly.Module,\n) => Promise<ClientRuntime>;\n\n/**\n * A loader which runs `perspective-migrate` for `migrate()`.\n */\nexport interface MigrateHost {\n migrate<T = Record<string, unknown>>(\n kind: MigrateKind,\n config: unknown,\n from_version?: string,\n ): Promise<MigrateResult<T>>;\n}\n\ntype WasmKey = keyof WasmRegistration;\n\ntype ServerKey = \"server\" | \"server32\" | \"server64\";\n\ntype RegisterMode = \"user\" | \"default\" | \"replace_server\";\n\ninterface Entry {\n source: WasmSource;\n disable_stage_0: boolean;\n is_default: boolean;\n}\n\ninterface RegistryState {\n sources: Partial<Record<WasmKey, Entry>>;\n consumed: Set<WasmKey>;\n client_provider?: RuntimeProvider;\n viewer_provider?: RuntimeProvider;\n client?: Promise<ClientRuntime>;\n client_origin?: \"client\" | \"viewer\" | \"glue\";\n client_runtime?: ClientRuntime;\n viewer?: Promise<ClientRuntime>;\n server?: Promise<ArrayBuffer | WebAssembly.Module>;\n migrate_binary?: Promise<ArrayBuffer | WebAssembly.Module>;\n migrate?: MigrateHost;\n}\n\nconst STATE_KEY = Symbol.for(\"@perspective-dev/wasm\");\n\nconst WASM_KEYS: WasmKey[] = [\n \"client\",\n \"viewer\",\n \"server\",\n \"server32\",\n \"server64\",\n \"migrate\",\n];\n\nconst SERVER_KEYS: ServerKey[] = [\"server\", \"server32\", \"server64\"];\n\nfunction is_server_key(key: WasmKey): key is ServerKey {\n return (SERVER_KEYS as WasmKey[]).includes(key);\n}\n\nfunction states(): Map<string, RegistryState> {\n const global = globalThis as any;\n global[STATE_KEY] ??= new Map();\n return global[STATE_KEY];\n}\n\nfunction state(): RegistryState {\n const all = states();\n let s = all.get(__PSP_VERSION__);\n if (s === undefined) {\n s = { sources: {}, consumed: new Set() };\n all.set(__PSP_VERSION__, s);\n }\n\n return s;\n}\n\nfunction assert_single_version() {\n const others = [...states().keys()].filter(\n (version) => version !== __PSP_VERSION__,\n );\n\n if (others.length > 0) {\n throw new Error(\n `Perspective ${__PSP_VERSION__} cannot share a page with Perspective ${others.join(\", \")}`,\n );\n }\n}\n\nasync function materialize({\n source,\n disable_stage_0,\n}: Entry): Promise<ArrayBuffer | WebAssembly.Module> {\n let wasm = typeof source === \"function\" ? await source() : await source;\n if (wasm instanceof WebAssembly.Module) {\n return wasm;\n }\n\n if (wasm instanceof Uint8Array) {\n wasm = wasm.slice().buffer as ArrayBuffer;\n }\n\n if (typeof Response !== \"undefined\" && wasm instanceof Response) {\n if (!wasm.ok) {\n throw new Error(\n `Failed to fetch perspective wasm (HTTP ${wasm.status} \"${wasm.url}\")`,\n );\n }\n\n if (disable_stage_0) {\n return await wasm.arrayBuffer();\n }\n }\n\n if (disable_stage_0) {\n return wasm as ArrayBuffer;\n }\n\n const bytes = await load_wasm_stage_0(wasm as ArrayBuffer | Response);\n return bytes.buffer as ArrayBuffer;\n}\n\nasync function select_server(\n sources: RegistryState[\"sources\"],\n): Promise<ArrayBuffer | WebAssembly.Module> {\n if (sources.server !== undefined) {\n return await materialize(sources.server);\n }\n\n const { server32, server64 } = sources;\n if (\n server64 !== undefined &&\n (server32 === undefined || host_supports_memory64())\n ) {\n try {\n return await materialize(server64);\n } catch (e) {\n if (server32 === undefined) {\n throw e;\n }\n\n console.warn(\n \"Memory64 perspective server wasm failed to load, falling back to wasm32\",\n e,\n );\n }\n }\n\n return await materialize(server32!);\n}\n\nfunction start_viewer(s: RegistryState) {\n s.consumed.add(\"viewer\");\n s.viewer = materialize(s.sources.viewer!).then(s.viewer_provider!);\n if (s.client === undefined) {\n s.client = s.viewer;\n s.client_origin = \"viewer\";\n s.viewer.then(\n (runtime) => {\n s.client_runtime = runtime;\n },\n () => undefined,\n );\n }\n}\n\n/**\n * Registers sources with the page-wide registry under the given mode.\n */\nexport function register(\n wasm: WasmRegistration,\n options: InitOptions = {},\n mode: RegisterMode = \"user\",\n) {\n if (mode !== \"default\") {\n assert_single_version();\n }\n\n const s = state();\n const unknown = Object.keys(wasm).filter(\n (key) => !WASM_KEYS.includes(key as WasmKey),\n );\n\n if (unknown.length > 0) {\n throw new Error(\n `Unknown perspective wasm key(s) ${unknown.join(\", \")}; expected ${WASM_KEYS.join(\", \")}`,\n );\n }\n\n let keys = WASM_KEYS.filter((key) => wasm[key] !== undefined);\n if (mode === \"default\") {\n const has_server = SERVER_KEYS.some(\n (key) => s.sources[key] !== undefined,\n );\n\n keys = keys.filter(\n (key) =>\n s.sources[key] === undefined &&\n !s.consumed.has(key) &&\n !(has_server && is_server_key(key)),\n );\n } else {\n if (keys.length === 0) {\n throw new Error(\n `init() requires at least one of ${WASM_KEYS.join(\", \")}`,\n );\n }\n\n for (const key of keys) {\n if (s.consumed.has(key)) {\n throw new Error(`${key} wasm is already initialized`);\n }\n }\n\n if (keys.some(is_server_key)) {\n for (const key of SERVER_KEYS) {\n if (mode === \"replace_server\" || s.sources[key]?.is_default) {\n delete s.sources[key];\n }\n }\n }\n }\n\n if (keys.includes(\"viewer\")) {\n if (s.client !== undefined) {\n throw new Error(\n \"viewer wasm must be registered before any Client is created from client wasm\",\n );\n }\n\n if (s.viewer_provider === undefined) {\n throw new Error(\n \"viewer wasm was registered, but @perspective-dev/viewer is not loaded\",\n );\n }\n }\n\n const servers = SERVER_KEYS.filter(\n (key) => keys.includes(key) || s.sources[key] !== undefined,\n );\n\n if (servers.includes(\"server\") && servers.length > 1) {\n throw new Error(\n \"`server` cannot be combined with `server32` or `server64`\",\n );\n }\n\n const disable_stage_0 = !!options.disable_stage_0;\n for (const key of keys) {\n s.sources[key] = {\n source: wasm[key]!,\n disable_stage_0,\n is_default: mode === \"default\",\n };\n }\n\n if (keys.includes(\"viewer\")) {\n start_viewer(s);\n }\n}\n\n/**\n * Register Perspective's WebAssembly binaries for this page, shared by every\n * copy of `@perspective-dev/client` and `@perspective-dev/viewer`, throwing if\n * another Perspective version has loaded on this page.\n *\n * # Arguments\n *\n * - `wasm` - Binaries by role: `client` (`perspective-js.wasm`), `viewer`\n * (`perspective-viewer.wasm`, which also backs every `Client`), `server`\n * (one engine build) or `server32` / `server64` (selected by Memory64\n * support), and `migrate` (`perspective-migrate-js.wasm`).\n * - `options` - `disable_stage_0` skips decompression for these sources.\n *\n * # Examples\n *\n * ```javascript\n * await perspective.init({\n * server32: () => fetch(SERVER_WASM),\n * server64: () => fetch(SERVER_MEMORY64_WASM),\n * viewer: fetch(VIEWER_WASM),\n * });\n * ```\n */\nexport async function init(\n wasm: WasmRegistration,\n options: InitOptions = {},\n): Promise<void> {\n register(wasm, options);\n if (wasm.viewer !== undefined) {\n await state().viewer;\n }\n}\n\n/**\n * Registers sources only for roles the page has not registered yet.\n */\nexport function register_default(wasm: WasmRegistration) {\n register(wasm, {}, \"default\");\n}\n\n/**\n * Installs the `client` role's runtime provider if none is installed.\n */\nexport function provide_client_runtime(provider: RuntimeProvider) {\n const s = state();\n s.client_provider ??= provider;\n}\n\n/**\n * Installs the `viewer` role's runtime provider if none is installed.\n */\nexport function provide_viewer_runtime(provider: RuntimeProvider) {\n const s = state();\n s.viewer_provider ??= provider;\n}\n\n/**\n * Backs every `Client` with an already-initialized wasm-bindgen module.\n */\nexport function provide_client_glue(glue: typeof psp) {\n const s = state();\n if (s.client !== undefined) {\n throw new Error(\"client wasm is already initialized\");\n }\n\n s.consumed.add(\"client\");\n s.client_origin = \"glue\";\n s.client_runtime = { glue };\n s.client = Promise.resolve(s.client_runtime);\n}\n\n/**\n * Resolves the runtime backing every `Client`, instantiating it on first use.\n */\nexport function resolve_client(): Promise<ClientRuntime> {\n const s = state();\n if (s.client === undefined) {\n const entry = s.sources.client;\n if (entry === undefined) {\n return Promise.reject(\n new Error(\n \"Missing perspective-js.wasm: register `client` or `viewer` with init()\",\n ),\n );\n }\n\n if (s.client_provider === undefined) {\n return Promise.reject(\n new Error(\n \"client wasm was registered, but @perspective-dev/client is not loaded\",\n ),\n );\n }\n\n s.consumed.add(\"client\");\n s.client_origin = \"client\";\n s.client = materialize(entry).then(s.client_provider);\n s.client.then(\n (runtime) => {\n s.client_runtime = runtime;\n },\n () => undefined,\n );\n }\n\n return s.client;\n}\n\n/**\n * The runtime backing every `Client`, if it has finished initializing.\n */\nexport function client_runtime(): ClientRuntime | undefined {\n return (globalThis as any)[STATE_KEY]?.get(__PSP_VERSION__)?.client_runtime;\n}\n\n/**\n * Resolves once `<perspective-viewer>` is defined.\n */\nexport async function resolve_viewer(): Promise<void> {\n const viewer = state().viewer;\n if (viewer === undefined) {\n throw new Error(\n \"Missing perspective-viewer.wasm: register `viewer` with init()\",\n );\n }\n\n await viewer;\n}\n\n/**\n * Resolves the selected engine binary, a fresh copy per call.\n */\nexport function resolve_server(): Promise<ArrayBuffer | WebAssembly.Module> {\n const s = state();\n if (s.server === undefined) {\n if (!SERVER_KEYS.some((key) => s.sources[key] !== undefined)) {\n return Promise.reject(\n new Error(\n \"Missing perspective-server.wasm: register `server` (or `server32` / `server64`) with init()\",\n ),\n );\n }\n\n for (const key of SERVER_KEYS) {\n s.consumed.add(key);\n }\n\n s.server = select_server(s.sources);\n }\n\n return s.server.then((wasm) =>\n wasm instanceof WebAssembly.Module ? wasm : wasm.slice(0),\n );\n}\n\n/**\n * Resolves the extracted `perspective-migrate` binary.\n */\nexport function resolve_migrate(): Promise<ArrayBuffer | WebAssembly.Module> {\n const s = state();\n if (s.migrate_binary === undefined) {\n const entry = s.sources.migrate;\n if (entry === undefined) {\n return Promise.reject(\n new Error(\n \"Missing perspective-migrate-js.wasm: register `migrate` with init()\",\n ),\n );\n }\n\n s.consumed.add(\"migrate\");\n s.migrate_binary = materialize(entry);\n }\n\n return s.migrate_binary;\n}\n\n/**\n * The page's one `migrate()` loader, installing `local` if there is none.\n */\nexport function shared_migrate(local: MigrateHost): MigrateHost {\n const s = state();\n s.migrate ??= local;\n return s.migrate;\n}\n", "var kt=Object.defineProperty;var St=(s,t)=>{for(var e in t)kt(s,e,{get:t[e],enumerable:!0})};var J={};St(J,{Client:()=>R,GenericSQLVirtualServerModel:()=>U,PerspectiveDebugPluginElement:()=>V,PerspectiveViewerElement:()=>$,ProxySession:()=>j,Table:()=>z,View:()=>I,VirtualDataSlice:()=>M,VirtualServer:()=>G,default:()=>yt,getColumnConfigDefaults:()=>Ct,getPluginConfigDefaults:()=>At,get_wasm_module:()=>Rt,get_worker_url:()=>Et,init:()=>Tt,initSync:()=>ce,registerPlugin:()=>Ft,setColumnConfigDefaults:()=>Pt,setPluginConfigDefaults:()=>Ot});function ct(s){customElements.get(s)||customElements.define(s,class extends HTMLElement{})}var it=window.ClipboardItem;var st=window.ResizeObserver;var at=window.IntersectionObserver;function ut(s,t,e,n){if(customElements.get(t)){console.warn(`Custom element \"${t}\" is already registered; skipping duplicate registration (Perspective was loaded more than once on this page).`);return}let r=s[e],i=r.prototype;class b extends HTMLElement{constructor(){super(),this._instance=new r(this)}}let g=Object.getOwnPropertyNames(i);for(let l of g)\"get\"in Object.getOwnPropertyDescriptor(i,l)?Object.defineProperty(b.prototype,l,{get:function(){return this._instance[l]}}):Object.defineProperty(b.prototype,l,{value:function(...p){return this._instance[l].call(this._instance,...p)}});for(let l of n)Object.defineProperty(b,l,{value:function(...p){return s[l].call(s,...p)}});customElements.define(t,b)}var R=class s{static __wrap(t){t=t>>>0;let e=Object.create(s.prototype);return e.__wbg_ptr=t,Q.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,Q.unregister(this),t}free(){let t=this.__destroy_into_raw();_.__wbg_client_free(t,0)}__getClassname(){try{let r=_.__wbindgen_add_to_stack_pointer(-16);_.client___getClassname(r,this.__wbg_ptr);var t=a().getInt32(r+0,!0),e=a().getInt32(r+4,!0),n=f(t,e);return t!==0&&_.__wbindgen_export4(t,e,1),n}finally{_.__wbindgen_add_to_stack_pointer(16)}}__unsafe_open_view(t){let e=m(t,_.__wbindgen_export,_.__wbindgen_export2),n=v,r=_.client___unsafe_open_view(this.__wbg_ptr,e,n);return I.__wrap(r)}get_hosted_table_names(){let t=_.client_get_hosted_table_names(this.__wbg_ptr);return u(t)}handle_error(t,e){let n=m(t,_.__wbindgen_export,_.__wbindgen_export2),r=v,i=_.client_handle_error(this.__wbg_ptr,n,r,d(e)?0:c(e));return u(i)}handle_response(t){let e=_.client_handle_response(this.__wbg_ptr,c(t));return u(e)}join(t,e,n,r){let i=m(n,_.__wbindgen_export,_.__wbindgen_export2),b=v,g=_.client_join(this.__wbg_ptr,c(t),c(e),i,b,d(r)?0:c(r));return u(g)}constructor(t,e){try{let b=_.__wbindgen_add_to_stack_pointer(-16);_.client_new(b,c(t),d(e)?0:c(e));var n=a().getInt32(b+0,!0),r=a().getInt32(b+4,!0),i=a().getInt32(b+8,!0);if(i)throw u(r);return this.__wbg_ptr=n>>>0,Q.register(this,this.__wbg_ptr,this),this}finally{_.__wbindgen_add_to_stack_pointer(16)}}new_proxy_session(t){try{let e=_.client_new_proxy_session(this.__wbg_ptr,ot(t));return j.__wrap(e)}finally{k[O++]=void 0}}on_error(t){let e=_.client_on_error(this.__wbg_ptr,c(t));return u(e)}on_hosted_tables_update(t){let e=_.client_on_hosted_tables_update(this.__wbg_ptr,c(t));return u(e)}open_table(t){let e=m(t,_.__wbindgen_export,_.__wbindgen_export2),n=v,r=_.client_open_table(this.__wbg_ptr,e,n);return u(r)}remove_hosted_tables_update(t){let e=_.client_remove_hosted_tables_update(this.__wbg_ptr,t);return u(e)}system_info(){let t=_.client_system_info(this.__wbg_ptr);return u(t)}table(t,e){let n=_.client_table(this.__wbg_ptr,c(t),d(e)?0:c(e));return u(n)}terminate(){try{let r=_.__wbindgen_add_to_stack_pointer(-16);_.client_terminate(r,this.__wbg_ptr);var t=a().getInt32(r+0,!0),e=a().getInt32(r+4,!0),n=a().getInt32(r+8,!0);if(n)throw u(e);return u(t)}finally{_.__wbindgen_add_to_stack_pointer(16)}}};Symbol.dispose&&(R.prototype[Symbol.dispose]=R.prototype.free);var U=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,gt.unregister(this),t}free(){let t=this.__destroy_into_raw();_.__wbg_genericsqlvirtualservermodel_free(t,0)}expressionDescribe(t,e){try{let l=_.__wbindgen_add_to_stack_pointer(-16),p=m(t,_.__wbindgen_export,_.__wbindgen_export2),h=v,y=m(e,_.__wbindgen_export,_.__wbindgen_export2),x=v;_.genericsqlvirtualservermodel_expressionDescribe(l,this.__wbg_ptr,p,h,y,x);var n=a().getInt32(l+0,!0),r=a().getInt32(l+4,!0),i=a().getInt32(l+8,!0),b=a().getInt32(l+12,!0);if(b)throw u(i);var g=f(n,r);return n!==0&&_.__wbindgen_export4(n,r,1),g}finally{_.__wbindgen_add_to_stack_pointer(16)}}expressionsDescribe(t,e){try{let l=_.__wbindgen_add_to_stack_pointer(-16),p=m(t,_.__wbindgen_export,_.__wbindgen_export2),h=v;_.genericsqlvirtualservermodel_expressionsDescribe(l,this.__wbg_ptr,p,h,c(e));var n=a().getInt32(l+0,!0),r=a().getInt32(l+4,!0),i=a().getInt32(l+8,!0),b=a().getInt32(l+12,!0);if(b)throw u(i);var g=f(n,r);return n!==0&&_.__wbindgen_export4(n,r,1),g}finally{_.__wbindgen_add_to_stack_pointer(16)}}getHostedTables(){try{let b=_.__wbindgen_add_to_stack_pointer(-16);_.genericsqlvirtualservermodel_getHostedTables(b,this.__wbg_ptr);var t=a().getInt32(b+0,!0),e=a().getInt32(b+4,!0),n=a().getInt32(b+8,!0),r=a().getInt32(b+12,!0);if(r)throw u(n);var i=f(t,e);return t!==0&&_.__wbindgen_export4(t,e,1),i}finally{_.__wbindgen_add_to_stack_pointer(16)}}constructor(t){try{let i=_.__wbindgen_add_to_stack_pointer(-16);_.genericsqlvirtualservermodel_new(i,d(t)?0:c(t));var e=a().getInt32(i+0,!0),n=a().getInt32(i+4,!0),r=a().getInt32(i+8,!0);if(r)throw u(n);return this.__wbg_ptr=e>>>0,gt.register(this,this.__wbg_ptr,this),this}finally{_.__wbindgen_add_to_stack_pointer(16)}}tableDescribe(t,e,n){try{let p=_.__wbindgen_add_to_stack_pointer(-16),h=m(t,_.__wbindgen_export,_.__wbindgen_export2),y=v;_.genericsqlvirtualservermodel_tableDescribe(p,this.__wbg_ptr,h,y,c(e),c(n));var r=a().getInt32(p+0,!0),i=a().getInt32(p+4,!0),b=a().getInt32(p+8,!0),g=a().getInt32(p+12,!0);if(g)throw u(b);var l=f(r,i);return r!==0&&_.__wbindgen_export4(r,i,1),l}finally{_.__wbindgen_add_to_stack_pointer(16)}}tableMakeView(t,e,n,r){try{let h=_.__wbindgen_add_to_stack_pointer(-16),y=m(t,_.__wbindgen_export,_.__wbindgen_export2),x=v,C=m(e,_.__wbindgen_export,_.__wbindgen_export2),q=v;_.genericsqlvirtualservermodel_tableMakeView(h,this.__wbg_ptr,y,x,C,q,c(n),c(r));var i=a().getInt32(h+0,!0),b=a().getInt32(h+4,!0),g=a().getInt32(h+8,!0),l=a().getInt32(h+12,!0);if(l)throw u(g);var p=f(i,b);return i!==0&&_.__wbindgen_export4(i,b,1),p}finally{_.__wbindgen_add_to_stack_pointer(16)}}tableSchema(t){try{let g=_.__wbindgen_add_to_stack_pointer(-16),l=m(t,_.__wbindgen_export,_.__wbindgen_export2),p=v;_.genericsqlvirtualservermodel_tableSchema(g,this.__wbg_ptr,l,p);var e=a().getInt32(g+0,!0),n=a().getInt32(g+4,!0),r=a().getInt32(g+8,!0),i=a().getInt32(g+12,!0);if(i)throw u(r);var b=f(e,n);return e!==0&&_.__wbindgen_export4(e,n,1),b}finally{_.__wbindgen_add_to_stack_pointer(16)}}tableSize(t){try{let g=_.__wbindgen_add_to_stack_pointer(-16),l=m(t,_.__wbindgen_export,_.__wbindgen_export2),p=v;_.genericsqlvirtualservermodel_tableSize(g,this.__wbg_ptr,l,p);var e=a().getInt32(g+0,!0),n=a().getInt32(g+4,!0),r=a().getInt32(g+8,!0),i=a().getInt32(g+12,!0);if(i)throw u(r);var b=f(e,n);return e!==0&&_.__wbindgen_export4(e,n,1),b}finally{_.__wbindgen_add_to_stack_pointer(16)}}viewCollapse(t,e,n){try{let p=_.__wbindgen_add_to_stack_pointer(-16),h=m(t,_.__wbindgen_export,_.__wbindgen_export2),y=v;_.genericsqlvirtualservermodel_viewCollapse(p,this.__wbg_ptr,h,y,c(e),n);var r=a().getInt32(p+0,!0),i=a().getInt32(p+4,!0),b=a().getInt32(p+8,!0),g=a().getInt32(p+12,!0);if(g)throw u(b);var l=f(r,i);return r!==0&&_.__wbindgen_export4(r,i,1),l}finally{_.__wbindgen_add_to_stack_pointer(16)}}viewColumnSize(t){try{let g=_.__wbindgen_add_to_stack_pointer(-16),l=m(t,_.__wbindgen_export,_.__wbindgen_export2),p=v;_.genericsqlvirtualservermodel_viewColumnSize(g,this.__wbg_ptr,l,p);var e=a().getInt32(g+0,!0),n=a().getInt32(g+4,!0),r=a().getInt32(g+8,!0),i=a().getInt32(g+12,!0);if(i)throw u(r);var b=f(e,n);return e!==0&&_.__wbindgen_export4(e,n,1),b}finally{_.__wbindgen_add_to_stack_pointer(16)}}viewDelete(t){try{let g=_.__wbindgen_add_to_stack_pointer(-16),l=m(t,_.__wbindgen_export,_.__wbindgen_export2),p=v;_.genericsqlvirtualservermodel_viewDelete(g,this.__wbg_ptr,l,p);var e=a().getInt32(g+0,!0),n=a().getInt32(g+4,!0),r=a().getInt32(g+8,!0),i=a().getInt32(g+12,!0);if(i)throw u(r);var b=f(e,n);return e!==0&&_.__wbindgen_export4(e,n,1),b}finally{_.__wbindgen_add_to_stack_pointer(16)}}viewExpand(t,e,n){try{let p=_.__wbindgen_add_to_stack_pointer(-16),h=m(t,_.__wbindgen_export,_.__wbindgen_export2),y=v;_.genericsqlvirtualservermodel_viewExpand(p,this.__wbg_ptr,h,y,c(e),n);var r=a().getInt32(p+0,!0),i=a().getInt32(p+4,!0),b=a().getInt32(p+8,!0),g=a().getInt32(p+12,!0);if(g)throw u(b);var l=f(r,i);return r!==0&&_.__wbindgen_export4(r,i,1),l}finally{_.__wbindgen_add_to_stack_pointer(16)}}viewGetData(t,e,n,r){try{let h=_.__wbindgen_add_to_stack_pointer(-16),y=m(t,_.__wbindgen_export,_.__wbindgen_export2),x=v;_.genericsqlvirtualservermodel_viewGetData(h,this.__wbg_ptr,y,x,c(e),c(n),c(r));var i=a().getInt32(h+0,!0),b=a().getInt32(h+4,!0),g=a().getInt32(h+8,!0),l=a().getInt32(h+12,!0);if(l)throw u(g);var p=f(i,b);return i!==0&&_.__wbindgen_export4(i,b,1),p}finally{_.__wbindgen_add_to_stack_pointer(16)}}viewGetMinMax(t,e,n){try{let p=_.__wbindgen_add_to_stack_pointer(-16),h=m(t,_.__wbindgen_export,_.__wbindgen_export2),y=v,x=m(e,_.__wbindgen_export,_.__wbindgen_export2),C=v;_.genericsqlvirtualservermodel_viewGetMinMax(p,this.__wbg_ptr,h,y,x,C,c(n));var r=a().getInt32(p+0,!0),i=a().getInt32(p+4,!0),b=a().getInt32(p+8,!0),g=a().getInt32(p+12,!0);if(g)throw u(b);var l=f(r,i);return r!==0&&_.__wbindgen_export4(r,i,1),l}finally{_.__wbindgen_add_to_stack_pointer(16)}}viewMakeTable(t,e,n,r,i){try{let y=_.__wbindgen_add_to_stack_pointer(-16),x=m(t,_.__wbindgen_export,_.__wbindgen_export2),C=v,q=m(e,_.__wbindgen_export,_.__wbindgen_export2),K=v;_.genericsqlvirtualservermodel_viewMakeTable(y,this.__wbg_ptr,x,C,q,K,c(n),c(r),c(i));var b=a().getInt32(y+0,!0),g=a().getInt32(y+4,!0),l=a().getInt32(y+8,!0),p=a().getInt32(y+12,!0);if(p)throw u(l);var h=f(b,g);return b!==0&&_.__wbindgen_export4(b,g,1),h}finally{_.__wbindgen_add_to_stack_pointer(16)}}viewSchema(t){try{let g=_.__wbindgen_add_to_stack_pointer(-16),l=m(t,_.__wbindgen_export,_.__wbindgen_export2),p=v;_.genericsqlvirtualservermodel_viewSchema(g,this.__wbg_ptr,l,p);var e=a().getInt32(g+0,!0),n=a().getInt32(g+4,!0),r=a().getInt32(g+8,!0),i=a().getInt32(g+12,!0);if(i)throw u(r);var b=f(e,n);return e!==0&&_.__wbindgen_export4(e,n,1),b}finally{_.__wbindgen_add_to_stack_pointer(16)}}viewSetDepth(t,e,n){try{let p=_.__wbindgen_add_to_stack_pointer(-16),h=m(t,_.__wbindgen_export,_.__wbindgen_export2),y=v;_.genericsqlvirtualservermodel_viewSetDepth(p,this.__wbg_ptr,h,y,c(e),n);var r=a().getInt32(p+0,!0),i=a().getInt32(p+4,!0),b=a().getInt32(p+8,!0),g=a().getInt32(p+12,!0);if(g)throw u(b);var l=f(r,i);return r!==0&&_.__wbindgen_export4(r,i,1),l}finally{_.__wbindgen_add_to_stack_pointer(16)}}viewSize(t){try{let g=_.__wbindgen_add_to_stack_pointer(-16),l=m(t,_.__wbindgen_export,_.__wbindgen_export2),p=v;_.genericsqlvirtualservermodel_viewSize(g,this.__wbg_ptr,l,p);var e=a().getInt32(g+0,!0),n=a().getInt32(g+4,!0),r=a().getInt32(g+8,!0),i=a().getInt32(g+12,!0);if(i)throw u(r);var b=f(e,n);return e!==0&&_.__wbindgen_export4(e,n,1),b}finally{_.__wbindgen_add_to_stack_pointer(16)}}};Symbol.dispose&&(U.prototype[Symbol.dispose]=U.prototype.free);var V=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,ft.unregister(this),t}free(){let t=this.__destroy_into_raw();_.__wbg_perspectivedebugpluginelement_free(t,0)}clear(){let t=_.perspectivedebugpluginelement_clear(this.__wbg_ptr);return u(t)}get config_column_names(){let t=_.perspectivedebugpluginelement_config_column_names(this.__wbg_ptr);return u(t)}connectedCallback(){_.perspectivedebugpluginelement_connectedCallback(this.__wbg_ptr)}delete(){let t=_.perspectivedebugpluginelement_clear(this.__wbg_ptr);return u(t)}draw(t){rt(t,I);let e=_.perspectivedebugpluginelement_draw(this.__wbg_ptr,t.__wbg_ptr);return u(e)}get min_config_columns(){let t=_.perspectivedebugpluginelement_config_column_names(this.__wbg_ptr);return u(t)}get name(){try{let r=_.__wbindgen_add_to_stack_pointer(-16);_.perspectivedebugpluginelement_name(r,this.__wbg_ptr);var t=a().getInt32(r+0,!0),e=a().getInt32(r+4,!0),n=f(t,e);return t!==0&&_.__wbindgen_export4(t,e,1),n}finally{_.__wbindgen_add_to_stack_pointer(16)}}constructor(t){let e=_.perspectivedebugpluginelement_new(c(t));return this.__wbg_ptr=e>>>0,ft.register(this,this.__wbg_ptr,this),this}resize(){let t=_.perspectivedebugpluginelement_clear(this.__wbg_ptr);return u(t)}restore(t){try{let r=_.__wbindgen_add_to_stack_pointer(-16);_.perspectivedebugpluginelement_restore(r,this.__wbg_ptr,d(t)?0:c(t));var e=a().getInt32(r+0,!0),n=a().getInt32(r+4,!0);if(n)throw u(e)}finally{_.__wbindgen_add_to_stack_pointer(16)}}restyle(){_.perspectivedebugpluginelement_connectedCallback(this.__wbg_ptr)}save(){try{let r=_.__wbindgen_add_to_stack_pointer(-16);_.perspectivedebugpluginelement_save(r,this.__wbg_ptr);var t=a().getInt32(r+0,!0),e=a().getInt32(r+4,!0),n=a().getInt32(r+8,!0);if(n)throw u(e);return u(t)}finally{_.__wbindgen_add_to_stack_pointer(16)}}get select_mode(){try{let r=_.__wbindgen_add_to_stack_pointer(-16);_.perspectivedebugpluginelement_select_mode(r,this.__wbg_ptr);var t=a().getInt32(r+0,!0),e=a().getInt32(r+4,!0),n=f(t,e);return t!==0&&_.__wbindgen_export4(t,e,1),n}finally{_.__wbindgen_add_to_stack_pointer(16)}}update(t){rt(t,I);let e=_.perspectivedebugpluginelement_update(this.__wbg_ptr,t.__wbg_ptr);return u(e)}};Symbol.dispose&&(V.prototype[Symbol.dispose]=V.prototype.free);var $=class s{static __wrap(t){t=t>>>0;let e=Object.create(s.prototype);return e.__wbg_ptr=t,Z.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,Z.unregister(this),t}free(){let t=this.__destroy_into_raw();_.__wbg_perspectiveviewerelement_free(t,0)}__get_model(){let t=_.perspectiveviewerelement___get_model(this.__wbg_ptr);return s.__wrap(t)}addPanel(t,e){let n=_.perspectiveviewerelement_addPanel(this.__wbg_ptr,c(t),d(e)?0:c(e));return u(n)}agentConfig(t){try{let r=_.__wbindgen_add_to_stack_pointer(-16);_.perspectiveviewerelement_agentConfig(r,this.__wbg_ptr,c(t));var e=a().getInt32(r+0,!0),n=a().getInt32(r+4,!0);if(n)throw u(e)}finally{_.__wbindgen_add_to_stack_pointer(16)}}agentPrompt(t){let e=m(t,_.__wbindgen_export,_.__wbindgen_export2),n=v,r=_.perspectiveviewerelement_agentPrompt(this.__wbg_ptr,e,n);return u(r)}agentReset(){let t=_.perspectiveviewerelement_agentReset(this.__wbg_ptr);return u(t)}connectedCallback(){try{let n=_.__wbindgen_add_to_stack_pointer(-16);_.perspectiveviewerelement_connectedCallback(n,this.__wbg_ptr);var t=a().getInt32(n+0,!0),e=a().getInt32(n+4,!0);if(e)throw u(t)}finally{_.__wbindgen_add_to_stack_pointer(16)}}copy(t){let e=_.perspectiveviewerelement_copy(this.__wbg_ptr,d(t)?0:c(t));return u(e)}delete(){let t=this.__destroy_into_raw(),e=_.perspectiveviewerelement_delete(t);return u(e)}download(t){let e=_.perspectiveviewerelement_download(this.__wbg_ptr,d(t)?0:c(t));return u(e)}eject(t){let e=_.perspectiveviewerelement_eject(this.__wbg_ptr,d(t)?0:c(t));return u(e)}export(t){let e=_.perspectiveviewerelement_export(this.__wbg_ptr,d(t)?0:c(t));return u(e)}flush(){let t=_.perspectiveviewerelement_flush(this.__wbg_ptr);return u(t)}getActivePanel(){let t=_.perspectiveviewerelement_getActivePanel(this.__wbg_ptr);return u(t)}getAllPlugins(){let t=_.perspectiveviewerelement_getAllPlugins(this.__wbg_ptr);return u(t)}getClient(t){let e=_.perspectiveviewerelement_getClient(this.__wbg_ptr,d(t)?0:c(t));return u(e)}getEditPort(t){try{let i=_.__wbindgen_add_to_stack_pointer(-16);_.perspectiveviewerelement_getEditPort(i,this.__wbg_ptr,d(t)?0:c(t));var e=a().getFloat64(i+0,!0),n=a().getInt32(i+8,!0),r=a().getInt32(i+12,!0);if(r)throw u(n);return e}finally{_.__wbindgen_add_to_stack_pointer(16)}}getPanelNames(){let t=_.perspectiveviewerelement_getPanelNames(this.__wbg_ptr);return u(t)}getPlugin(t){try{let g=_.__wbindgen_add_to_stack_pointer(-16);var e=d(t)?0:m(t,_.__wbindgen_export,_.__wbindgen_export2),n=v;_.perspectiveviewerelement_getPlugin(g,this.__wbg_ptr,e,n);var r=a().getInt32(g+0,!0),i=a().getInt32(g+4,!0),b=a().getInt32(g+8,!0);if(b)throw u(i);return u(r)}finally{_.__wbindgen_add_to_stack_pointer(16)}}getRenderStats(t){try{let i=_.__wbindgen_add_to_stack_pointer(-16);_.perspectiveviewerelement_getRenderStats(i,this.__wbg_ptr,d(t)?0:c(t));var e=a().getInt32(i+0,!0),n=a().getInt32(i+4,!0),r=a().getInt32(i+8,!0);if(r)throw u(n);return u(e)}finally{_.__wbindgen_add_to_stack_pointer(16)}}getSelection(t){try{let i=_.__wbindgen_add_to_stack_pointer(-16);_.perspectiveviewerelement_getSelection(i,this.__wbg_ptr,d(t)?0:c(t));var e=a().getInt32(i+0,!0),n=a().getInt32(i+4,!0),r=a().getInt32(i+8,!0);if(r)throw u(n);return u(e)}finally{_.__wbindgen_add_to_stack_pointer(16)}}getTable(t){let e=_.perspectiveviewerelement_getTable(this.__wbg_ptr,d(t)?0:c(t));return u(e)}getThemes(){let t=_.perspectiveviewerelement_getThemes(this.__wbg_ptr);return u(t)}getView(t){let e=_.perspectiveviewerelement_getView(this.__wbg_ptr,d(t)?0:c(t));return u(e)}getViewConfig(t){let e=_.perspectiveviewerelement_getViewConfig(this.__wbg_ptr,d(t)?0:c(t));return u(e)}load(t){try{let i=_.__wbindgen_add_to_stack_pointer(-16);_.perspectiveviewerelement_load(i,this.__wbg_ptr,c(t));var e=a().getInt32(i+0,!0),n=a().getInt32(i+4,!0),r=a().getInt32(i+8,!0);if(r)throw u(n);return u(e)}finally{_.__wbindgen_add_to_stack_pointer(16)}}constructor(t){let e=_.perspectiveviewerelement_new(c(t));return this.__wbg_ptr=e>>>0,Z.register(this,this.__wbg_ptr,this),this}removePanel(t){let e=m(t,_.__wbindgen_export,_.__wbindgen_export2),n=v,r=_.perspectiveviewerelement_removePanel(this.__wbg_ptr,e,n);return u(r)}reset(t,e){let n=_.perspectiveviewerelement_reset(this.__wbg_ptr,d(t)?16777215:t?1:0,d(e)?0:c(e));return u(n)}resetError(){let t=_.perspectiveviewerelement_resetError(this.__wbg_ptr);return u(t)}resetThemes(t){var e=d(t)?0:ee(t,_.__wbindgen_export),n=v;let r=_.perspectiveviewerelement_resetThemes(this.__wbg_ptr,e,n);return u(r)}resize(t){let e=_.perspectiveviewerelement_resize(this.__wbg_ptr,d(t)?0:c(t));return u(e)}restore(t,e){let n=_.perspectiveviewerelement_restore(this.__wbg_ptr,c(t),d(e)?0:c(e));return u(n)}restoreWorkspace(t,e){let n=_.perspectiveviewerelement_restoreWorkspace(this.__wbg_ptr,c(t),d(e)?0:c(e));return u(n)}restyleElement(){let t=_.perspectiveviewerelement_restyleElement(this.__wbg_ptr);return u(t)}save(t){let e=_.perspectiveviewerelement_save(this.__wbg_ptr,d(t)?0:c(t));return u(e)}saveWorkspace(t){let e=_.perspectiveviewerelement_saveWorkspace(this.__wbg_ptr,d(t)?0:c(t));return u(e)}setActivePanel(t){let e=m(t,_.__wbindgen_export,_.__wbindgen_export2),n=v,r=_.perspectiveviewerelement_setActivePanel(this.__wbg_ptr,e,n);return u(r)}setAutoPause(t){let e=_.perspectiveviewerelement_setAutoPause(this.__wbg_ptr,t);return u(e)}setAutoSize(t){_.perspectiveviewerelement_setAutoSize(this.__wbg_ptr,t)}setSelection(t,e){try{let i=_.__wbindgen_add_to_stack_pointer(-16);_.perspectiveviewerelement_setSelection(i,this.__wbg_ptr,d(t)?0:c(t),d(e)?0:c(e));var n=a().getInt32(i+0,!0),r=a().getInt32(i+4,!0);if(r)throw u(n)}finally{_.__wbindgen_add_to_stack_pointer(16)}}setThrottle(t){_.perspectiveviewerelement_setThrottle(this.__wbg_ptr,!d(t),d(t)?0:t)}toggleColumnSettings(t,e){let n=m(t,_.__wbindgen_export,_.__wbindgen_export2),r=v,i=_.perspectiveviewerelement_toggleColumnSettings(this.__wbg_ptr,n,r,d(e)?0:c(e));return u(i)}toggleConfig(t){let e=_.perspectiveviewerelement_toggleConfig(this.__wbg_ptr,d(t)?16777215:t?1:0);return u(e)}};Symbol.dispose&&($.prototype[Symbol.dispose]=$.prototype.free);var j=class s{static __wrap(t){t=t>>>0;let e=Object.create(s.prototype);return e.__wbg_ptr=t,tt.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,tt.unregister(this),t}free(){let t=this.__destroy_into_raw();_.__wbg_proxysession_free(t,0)}close(){let t=this.__destroy_into_raw(),e=_.proxysession_close(t);return u(e)}handle_request(t){let e=_.proxysession_handle_request(this.__wbg_ptr,c(t));return u(e)}constructor(t,e){try{rt(t,R);let n=_.proxysession_new(t.__wbg_ptr,ot(e));return this.__wbg_ptr=n>>>0,tt.register(this,this.__wbg_ptr,this),this}finally{k[O++]=void 0}}};Symbol.dispose&&(j.prototype[Symbol.dispose]=j.prototype.free);var z=class s{static __wrap(t){t=t>>>0;let e=Object.create(s.prototype);return e.__wbg_ptr=t,dt.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,dt.unregister(this),t}free(){let t=this.__destroy_into_raw();_.__wbg_table_free(t,0)}__getClassname(){try{let r=_.__wbindgen_add_to_stack_pointer(-16);_.table___getClassname(r,this.__wbg_ptr);var t=a().getInt32(r+0,!0),e=a().getInt32(r+4,!0),n=f(t,e);return t!==0&&_.__wbindgen_export4(t,e,1),n}finally{_.__wbindgen_add_to_stack_pointer(16)}}clear(){let t=_.table_clear(this.__wbg_ptr);return u(t)}columns(){let t=_.table_columns(this.__wbg_ptr);return u(t)}delete(t){let e=this.__destroy_into_raw(),n=_.table_delete(e,d(t)?0:c(t));return u(n)}describe(t){let e=_.table_describe(this.__wbg_ptr,d(t)?0:c(t));return u(e)}get_client(){let t=_.table_get_client(this.__wbg_ptr);return u(t)}get_features(){let t=_.table_get_features(this.__wbg_ptr);return u(t)}get_index(){let t=_.table_get_index(this.__wbg_ptr);return u(t)}get_limit(){let t=_.table_get_limit(this.__wbg_ptr);return u(t)}get_name(){let t=_.table_get_name(this.__wbg_ptr);return u(t)}make_port(){let t=_.table_make_port(this.__wbg_ptr);return u(t)}on_delete(t){let e=_.table_on_delete(this.__wbg_ptr,c(t));return u(e)}remove(t,e){let n=_.table_remove(this.__wbg_ptr,c(t),d(e)?0:c(e));return u(n)}remove_delete(t){let e=_.table_remove_delete(this.__wbg_ptr,t);return u(e)}replace(t,e){let n=_.table_replace(this.__wbg_ptr,c(t),d(e)?0:c(e));return u(n)}schema(){let t=_.table_schema(this.__wbg_ptr);return u(t)}size(){let t=_.table_size(this.__wbg_ptr);return u(t)}update(t,e){let n=_.table_update(this.__wbg_ptr,c(t),d(e)?0:c(e));return u(n)}validate_expressions(t){let e=_.table_validate_expressions(this.__wbg_ptr,c(t));return u(e)}view(t){let e=_.table_view(this.__wbg_ptr,d(t)?0:c(t));return u(e)}};Symbol.dispose&&(z.prototype[Symbol.dispose]=z.prototype.free);var I=class s{static __wrap(t){t=t>>>0;let e=Object.create(s.prototype);return e.__wbg_ptr=t,wt.register(e,e.__wbg_ptr,e),e}static __unwrap(t){return t instanceof s?t.__destroy_into_raw():0}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,wt.unregister(this),t}free(){let t=this.__destroy_into_raw();_.__wbg_view_free(t,0)}__get_model(){let t=_.view___get_model(this.__wbg_ptr);return s.__wrap(t)}__unsafe_get_name(){try{let r=_.__wbindgen_add_to_stack_pointer(-16);_.view___unsafe_get_name(r,this.__wbg_ptr);var t=a().getInt32(r+0,!0),e=a().getInt32(r+4,!0),n=f(t,e);return t!==0&&_.__wbindgen_export4(t,e,1),n}finally{_.__wbindgen_add_to_stack_pointer(16)}}collapse(t){let e=_.view_collapse(this.__wbg_ptr,t);return u(e)}column_paths(t){let e=_.view_column_paths(this.__wbg_ptr,d(t)?0:c(t));return u(e)}delete(){let t=this.__destroy_into_raw(),e=_.view_delete(t);return u(e)}dimensions(){let t=_.view_dimensions(this.__wbg_ptr);return u(t)}expand(t){let e=_.view_expand(this.__wbg_ptr,t);return u(e)}expression_schema(){let t=_.view_expression_schema(this.__wbg_ptr);return u(t)}get_config(){let t=_.view_get_config(this.__wbg_ptr);return u(t)}get_min_max(t){let e=m(t,_.__wbindgen_export,_.__wbindgen_export2),n=v,r=_.view_get_min_max(this.__wbg_ptr,e,n);return u(r)}num_columns(){let t=_.view_num_columns(this.__wbg_ptr);return u(t)}num_rows(){let t=_.view_num_rows(this.__wbg_ptr);return u(t)}on_delete(t){let e=_.view_on_delete(this.__wbg_ptr,c(t));return u(e)}on_remove(t){let e=_.view_on_remove(this.__wbg_ptr,c(t));return u(e)}on_update(t,e){let n=_.view_on_update(this.__wbg_ptr,c(t),d(e)?0:c(e));return u(n)}remove_delete(t){let e=_.view_remove_delete(this.__wbg_ptr,t);return u(e)}remove_remove(t){let e=_.view_remove_remove(this.__wbg_ptr,t);return u(e)}remove_update(t){let e=_.view_remove_update(this.__wbg_ptr,t);return u(e)}schema(){let t=_.view_schema(this.__wbg_ptr);return u(t)}set_depth(t){let e=_.view_set_depth(this.__wbg_ptr,t);return u(e)}to_arrow(t){let e=_.view_to_arrow(this.__wbg_ptr,d(t)?0:c(t));return u(e)}to_columns(t){let e=_.view_to_columns(this.__wbg_ptr,d(t)?0:c(t));return u(e)}to_columns_string(t){let e=_.view_to_columns_string(this.__wbg_ptr,d(t)?0:c(t));return u(e)}to_csv(t){let e=_.view_to_csv(this.__wbg_ptr,d(t)?0:c(t));return u(e)}to_json(t){let e=_.view_to_json(this.__wbg_ptr,d(t)?0:c(t));return u(e)}to_json_string(t){let e=_.view_to_json_string(this.__wbg_ptr,d(t)?0:c(t));return u(e)}to_ndjson(t){let e=_.view_to_ndjson(this.__wbg_ptr,d(t)?0:c(t));return u(e)}with_typed_arrays(t,e){let n=_.view_with_typed_arrays(this.__wbg_ptr,d(t)?0:c(t),c(e));return u(n)}};Symbol.dispose&&(I.prototype[Symbol.dispose]=I.prototype.free);var M=class s{static __wrap(t){t=t>>>0;let e=Object.create(s.prototype);return e.__wbg_ptr=t,et.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,et.unregister(this),t}free(){let t=this.__destroy_into_raw();_.__wbg_virtualdataslice_free(t,0)}fromArrowIpc(t){try{let r=_.__wbindgen_add_to_stack_pointer(-16);_.virtualdataslice_fromArrowIpc(r,this.__wbg_ptr,c(t));var e=a().getInt32(r+0,!0),n=a().getInt32(r+4,!0);if(n)throw u(e)}finally{_.__wbindgen_add_to_stack_pointer(16)}}constructor(t){let e=_.virtualdataslice_new(c(t));return this.__wbg_ptr=e>>>0,et.register(this,this.__wbg_ptr,this),this}setBooleanCol(t,e,n,r){try{let g=_.__wbindgen_add_to_stack_pointer(-16),l=m(t,_.__wbindgen_export,_.__wbindgen_export2),p=v;_.virtualdataslice_setBooleanCol(g,this.__wbg_ptr,l,p,e,c(n),d(r)?4294967297:r>>>0);var i=a().getInt32(g+0,!0),b=a().getInt32(g+4,!0);if(b)throw u(i)}finally{_.__wbindgen_add_to_stack_pointer(16)}}setCol(t,e,n,r,i){try{let l=_.__wbindgen_add_to_stack_pointer(-16),p=m(t,_.__wbindgen_export,_.__wbindgen_export2),h=v,y=m(e,_.__wbindgen_export,_.__wbindgen_export2),x=v;_.virtualdataslice_setCol(l,this.__wbg_ptr,p,h,y,x,n,c(r),d(i)?4294967297:i>>>0);var b=a().getInt32(l+0,!0),g=a().getInt32(l+4,!0);if(g)throw u(b)}finally{_.__wbindgen_add_to_stack_pointer(16)}}setDatetimeCol(t,e,n,r){try{let g=_.__wbindgen_add_to_stack_pointer(-16),l=m(t,_.__wbindgen_export,_.__wbindgen_export2),p=v;_.virtualdataslice_setDatetimeCol(g,this.__wbg_ptr,l,p,e,c(n),d(r)?4294967297:r>>>0);var i=a().getInt32(g+0,!0),b=a().getInt32(g+4,!0);if(b)throw u(i)}finally{_.__wbindgen_add_to_stack_pointer(16)}}setFloatCol(t,e,n,r){try{let g=_.__wbindgen_add_to_stack_pointer(-16),l=m(t,_.__wbindgen_export,_.__wbindgen_export2),p=v;_.virtualdataslice_setFloatCol(g,this.__wbg_ptr,l,p,e,c(n),d(r)?4294967297:r>>>0);var i=a().getInt32(g+0,!0),b=a().getInt32(g+4,!0);if(b)throw u(i)}finally{_.__wbindgen_add_to_stack_pointer(16)}}setIntegerCol(t,e,n,r){try{let g=_.__wbindgen_add_to_stack_pointer(-16),l=m(t,_.__wbindgen_export,_.__wbindgen_export2),p=v;_.virtualdataslice_setIntegerCol(g,this.__wbg_ptr,l,p,e,c(n),d(r)?4294967297:r>>>0);var i=a().getInt32(g+0,!0),b=a().getInt32(g+4,!0);if(b)throw u(i)}finally{_.__wbindgen_add_to_stack_pointer(16)}}setStringCol(t,e,n,r){try{let g=_.__wbindgen_add_to_stack_pointer(-16),l=m(t,_.__wbindgen_export,_.__wbindgen_export2),p=v;_.virtualdataslice_setStringCol(g,this.__wbg_ptr,l,p,e,c(n),d(r)?4294967297:r>>>0);var i=a().getInt32(g+0,!0),b=a().getInt32(g+4,!0);if(b)throw u(i)}finally{_.__wbindgen_add_to_stack_pointer(16)}}};Symbol.dispose&&(M.prototype[Symbol.dispose]=M.prototype.free);var G=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,lt.unregister(this),t}free(){let t=this.__destroy_into_raw();_.__wbg_virtualserver_free(t,0)}handleRequest(t){let e=te(t,_.__wbindgen_export),n=v,r=_.virtualserver_handleRequest(this.__wbg_ptr,e,n);return u(r)}constructor(t){try{let i=_.__wbindgen_add_to_stack_pointer(-16);_.virtualserver_new(i,c(t));var e=a().getInt32(i+0,!0),n=a().getInt32(i+4,!0),r=a().getInt32(i+8,!0);if(r)throw u(n);return this.__wbg_ptr=e>>>0,lt.register(this,this.__wbg_ptr,this),this}finally{_.__wbindgen_add_to_stack_pointer(16)}}};Symbol.dispose&&(G.prototype[Symbol.dispose]=G.prototype.free);function Ct(){try{let n=_.__wbindgen_add_to_stack_pointer(-16);_.getColumnConfigDefaults(n);var s=a().getInt32(n+0,!0),t=a().getInt32(n+4,!0),e=a().getInt32(n+8,!0);if(e)throw u(t);return u(s)}finally{_.__wbindgen_add_to_stack_pointer(16)}}function At(){try{let n=_.__wbindgen_add_to_stack_pointer(-16);_.getPluginConfigDefaults(n);var s=a().getInt32(n+0,!0),t=a().getInt32(n+4,!0),e=a().getInt32(n+8,!0);if(e)throw u(t);return u(s)}finally{_.__wbindgen_add_to_stack_pointer(16)}}function Rt(){try{let n=_.__wbindgen_add_to_stack_pointer(-16);_.get_wasm_module(n);var s=a().getInt32(n+0,!0),t=a().getInt32(n+4,!0),e=a().getInt32(n+8,!0);if(e)throw u(t);return u(s)}finally{_.__wbindgen_add_to_stack_pointer(16)}}function Et(){try{let n=_.__wbindgen_add_to_stack_pointer(-16);_.get_worker_url(n);var s=a().getInt32(n+0,!0),t=a().getInt32(n+4,!0),e=a().getInt32(n+8,!0);if(e)throw u(t);return u(s)}finally{_.__wbindgen_add_to_stack_pointer(16)}}function Tt(s,t){_.init(c(s),c(t))}function Ft(s){let t=m(s,_.__wbindgen_export,_.__wbindgen_export2),e=v;_.registerPlugin(t,e)}function Pt(s,t){try{let r=_.__wbindgen_add_to_stack_pointer(-16);_.setColumnConfigDefaults(r,c(s),d(t)?0:c(t));var e=a().getInt32(r+0,!0),n=a().getInt32(r+4,!0);if(n)throw u(e)}finally{_.__wbindgen_add_to_stack_pointer(16)}}function Ot(s,t){try{let r=_.__wbindgen_add_to_stack_pointer(-16);_.setPluginConfigDefaults(r,c(s),d(t)?0:c(t));var e=a().getInt32(r+0,!0),n=a().getInt32(r+4,!0);if(n)throw u(e)}finally{_.__wbindgen_add_to_stack_pointer(16)}}function mt(){return{__proto__:null,\"./perspective-viewer.wasm_bg.js\":{__proto__:null,__wbg_Error_8c4e43fe74559d73:function(t,e){var n=f(t,e);let r=Error(n);return c(r)},__wbg_Number_04624de7d0e8332d:function(t){return Number(o(t))},__wbg_String_8f0eb39a4a4c2f66:function(t,e){let n=String(o(e)),r=m(n,_.__wbindgen_export,_.__wbindgen_export2),i=v;a().setInt32(t+4,i,!0),a().setInt32(t+0,r,!0)},__wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2:function(t,e){let n=o(e),r=typeof n==\"bigint\"?n:void 0;a().setBigInt64(t+8,d(r)?BigInt(0):r,!0),a().setInt32(t+0,!d(r),!0)},__wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25:function(t){let e=o(t),n=typeof e==\"boolean\"?e:void 0;return d(n)?16777215:n?1:0},__wbg___wbindgen_debug_string_0bc8482c6e3508ae:function(t,e){let n=_t(o(e)),r=m(n,_.__wbindgen_export,_.__wbindgen_export2),i=v;a().setInt32(t+4,i,!0),a().setInt32(t+0,r,!0)},__wbg___wbindgen_in_47fa6863be6f2f25:function(t,e){return o(t)in o(e)},__wbg___wbindgen_is_bigint_31b12575b56f32fc:function(t){return typeof o(t)==\"bigint\"},__wbg___wbindgen_is_function_0095a73b8b156f76:function(t){return typeof o(t)==\"function\"},__wbg___wbindgen_is_null_ac34f5003991759a:function(t){return o(t)===null},__wbg___wbindgen_is_object_5ae8e5880f2c1fbd:function(t){let e=o(t);return typeof e==\"object\"&&e!==null},__wbg___wbindgen_is_string_cd444516edc5b180:function(t){return typeof o(t)==\"string\"},__wbg___wbindgen_is_undefined_9e4d92534c42d778:function(t){return o(t)===void 0},__wbg___wbindgen_jsval_eq_11888390b0186270:function(t,e){return o(t)===o(e)},__wbg___wbindgen_jsval_loose_eq_9dd77d8cd6671811:function(t,e){return o(t)==o(e)},__wbg___wbindgen_number_get_8ff4255516ccad3e:function(t,e){let n=o(e),r=typeof n==\"number\"?n:void 0;a().setFloat64(t+8,d(r)?0:r,!0),a().setInt32(t+0,!d(r),!0)},__wbg___wbindgen_string_get_72fb696202c56729:function(t,e){let n=o(e),r=typeof n==\"string\"?n:void 0;var i=d(r)?0:m(r,_.__wbindgen_export,_.__wbindgen_export2),b=v;a().setInt32(t+4,b,!0),a().setInt32(t+0,i,!0)},__wbg___wbindgen_throw_be289d5034ed271b:function(t,e){var n=f(t,e);throw new Error(n)},__wbg__wbg_cb_unref_d9b87ff7982e3b21:function(t){o(t)._wbg_cb_unref()},__wbg_abort_2f0584e03e8e3950:function(t){o(t).abort()},__wbg_addEventListener_3acb0aad4483804c:function(){return w(function(t,e,n,r){var i=f(e,n);o(t).addEventListener(i,o(r))},arguments)},__wbg_addEventListener_5ef04ffb1d3af066:function(){return w(function(t,e,n,r,i){var b=f(e,n);o(t).addEventListener(b,o(r),i!==0)},arguments)},__wbg_addEventListener_c917b5aafbcf493f:function(){return w(function(t,e,n,r,i){var b=f(e,n);o(t).addEventListener(b,o(r),o(i))},arguments)},__wbg_add_5be83378df680c25:function(){return w(function(t,e,n){var r=f(e,n);o(t).add(r)},arguments)},__wbg_appendChild_dea38765a26d346d:function(){return w(function(t,e){let n=o(t).appendChild(o(e));return c(n)},arguments)},__wbg_append_a992ccc37aa62dc4:function(){return w(function(t,e,n,r,i){var b=f(e,n),g=f(r,i);o(t).append(b,g)},arguments)},__wbg_apply_2e22c45cb4f12415:function(){return w(function(t,e,n){let r=Reflect.apply(o(t),o(e),o(n));return c(r)},arguments)},__wbg_apply_ada2ee1a60ac7b3c:function(){return w(function(t,e,n){let r=o(t).apply(o(e),o(n));return c(r)},arguments)},__wbg_asyncIterator_58dd45e58aa3721e:function(){return c(Symbol.asyncIterator)},__wbg_at_dfc235641cc0e40c:function(t,e){let n=o(t).at(e);return c(n)},__wbg_attachShadow_d31cd520620b24d6:function(){return w(function(t,e){let n=o(t).attachShadow(o(e));return c(n)},arguments)},__wbg_blur_07f34335e06e5234:function(){return w(function(t){o(t).blur()},arguments)},__wbg_body_3a0b4437dadea6bf:function(t){let e=o(t).body;return d(e)?0:c(e)},__wbg_body_f67922363a220026:function(t){let e=o(t).body;return d(e)?0:c(e)},__wbg_bootstrap_5f8da5e393411eb3:function(t,e,n,r,i,b){var g=f(e,n),l=f(r,i);let p=ut(o(t),g,l,u(b));return c(p)},__wbg_bottom_c7ec510a18034add:function(t){return o(t).bottom},__wbg_bubbles_ad88192d3c29e6f9:function(t){return o(t).bubbles},__wbg_buffer_26d0910f3a5bc899:function(t){let e=o(t).buffer;return c(e)},__wbg_button_d86841d0a03adc44:function(t){return o(t).button},__wbg_cache_key_b02185c5bc89ef2a:function(t){let e=o(t).__yew_subtree_cache_key;return d(e)?4294967297:e>>>0},__wbg_calculatePath_bce0314ec7da4d5e:function(t,e,n){var r=f(e,n);let i=o(t).calculatePath(r);return c(i)},__wbg_calculatePresizePaths_5d784e617dac5361:function(t){let e=o(t).calculatePresizePaths();return c(e)},__wbg_call_389efe28435a9388:function(){return w(function(t,e){let n=o(t).call(o(e));return c(n)},arguments)},__wbg_call_41bedb84c3e5c0c9:function(){return w(function(t,e,n,r,i,b){let g=o(t).call(o(e),o(n),o(r),o(i),o(b));return c(g)},arguments)},__wbg_call_4708e0c13bdc8e95:function(){return w(function(t,e,n){let r=o(t).call(o(e),o(n));return c(r)},arguments)},__wbg_call_812d25f1510c13c8:function(){return w(function(t,e,n,r){let i=o(t).call(o(e),o(n),o(r));return c(i)},arguments)},__wbg_cancelBubble_d93ec09e9c46cd6f:function(t){return o(t).cancelBubble},__wbg_checked_04db83ac6810bc82:function(t){return o(t).checked},__wbg_childNodes_75d35de33c9f6fbb:function(t){let e=o(t).childNodes;return c(e)},__wbg_children_54099e7692eefa29:function(t){let e=o(t).children;return c(e)},__wbg_classList_1a87c34c6d81421e:function(t){let e=o(t).classList;return c(e)},__wbg_className_2a1be685f5d518d5:function(t,e){let n=o(e).className,r=m(n,_.__wbindgen_export,_.__wbindgen_export2),i=v;a().setInt32(t+4,i,!0),a().setInt32(t+0,r,!0)},__wbg_clear_5301a838a4bcc784:function(){return w(function(t){let e=o(t).clear();return c(e)},arguments)},__wbg_click_0e9c20848b655ed3:function(t){o(t).click()},__wbg_clientHeight_6432ff0d61ccfe7d:function(t){return o(t).clientHeight},__wbg_clientX_a3c5f4ff30e91264:function(t){return o(t).clientX},__wbg_clientY_e28509acb9b4a42a:function(t){return o(t).clientY},__wbg_client_new:function(t){let e=R.__wrap(t);return c(e)},__wbg_clipboard_98c5a32249fa8416:function(t){let e=o(t).clipboard;return c(e)},__wbg_cloneNode_b85e9102a9a31b29:function(){return w(function(t,e){let n=o(t).cloneNode(e!==0);return c(n)},arguments)},__wbg_cloneNode_eaf4ea08ebf633a5:function(){return w(function(t){let e=o(t).cloneNode();return c(e)},arguments)},__wbg_closest_11206fe6e0fb4e4e:function(){return w(function(t,e,n){var r=f(e,n);let i=o(t).closest(r);return d(i)?0:c(i)},arguments)},__wbg_code_dee0dae4730408e1:function(t,e){let n=o(e).code,r=m(n,_.__wbindgen_export,_.__wbindgen_export2),i=v;a().setInt32(t+4,i,!0),a().setInt32(t+0,r,!0)},__wbg_column_config_schema_446450f842240e18:function(){return w(function(t,e,n,r,i,b,g,l,p,h,y,x){var C=f(e,n),q=f(r,i),K=f(b,g),xt=f(y,x);let It=o(t).column_config_schema(C,q,K,o(l),o(p),o(h),xt);return c(It)},arguments)},__wbg_composedPath_9154ab2547c668d5:function(t){let e=o(t).composedPath();return c(e)},__wbg_contains_1056459c33f961e8:function(t,e){return o(t).contains(o(e))},__wbg_contains_6f4d5df35ef8a13a:function(t,e,n){var r=f(e,n);return o(t).contains(r)},__wbg_contentRect_86aa0db907b4dbb1:function(t){let e=o(t).contentRect;return c(e)},__wbg_createElementNS_ee00621496b30ec2:function(){return w(function(t,e,n,r,i){var b=f(e,n),g=f(r,i);let l=o(t).createElementNS(b,g);return c(l)},arguments)},__wbg_createElement_49f60fdcaae809c8:function(){return w(function(t,e,n){var r=f(e,n);let i=o(t).createElement(r);return c(i)},arguments)},__wbg_createObjectURL_918185db6a10a0c8:function(){return w(function(t,e){let n=URL.createObjectURL(o(e)),r=m(n,_.__wbindgen_export,_.__wbindgen_export2),i=v;a().setInt32(t+4,i,!0),a().setInt32(t+0,r,!0)},arguments)},__wbg_createTextNode_55029686c9591bf3:function(t,e,n){var r=f(e,n);let i=o(t).createTextNode(r);return c(i)},__wbg_cssRules_554f47f3049cf066:function(){return w(function(t){let e=o(t).cssRules;return c(e)},arguments)},__wbg_cssText_8f3f27e60c824421:function(t,e){let n=o(e).cssText,r=m(n,_.__wbindgen_export,_.__wbindgen_export2),i=v;a().setInt32(t+4,i,!0),a().setInt32(t+0,r,!0)},__wbg_dataTransfer_d924a622fbe51b06:function(t){let e=o(t).dataTransfer;return d(e)?0:c(e)},__wbg_dataset_20cb5c72458ae3fc:function(t){let e=o(t).dataset;return c(e)},__wbg_debug_46a93995fc6f8820:function(t,e,n,r){console.debug(o(t),o(e),o(n),o(r))},__wbg_debug_a4099fa12db6cd61:function(t){console.debug(o(t))},__wbg_decode_a28a47c6d83f2594:function(){return w(function(t,e,n,r,i){let b=o(e).decode(T(n,r),o(i)),g=m(b,_.__wbindgen_export,_.__wbindgen_export2),l=v;a().setInt32(t+4,l,!0),a().setInt32(t+0,g,!0)},arguments)},__wbg_define_panel_tab_5fdfe07ef6a3dd88:function(t,e){var n=f(t,e);ct(n)},__wbg_delete_8318b529ff42aa20:function(t,e,n){var r=f(e,n);delete o(t)[r]},__wbg_delete_aaa486df627ae05f:function(t){o(t).delete()},__wbg_deselect_45a4ba952ce38816:function(){return w(function(t){let e=o(t).deselect();return c(e)},arguments)},__wbg_detail_934cf9545e3214d3:function(t){let e=o(t).detail;return c(e)},__wbg_dispatchEvent_dc8dcc7ddca11378:function(){return w(function(t,e){return o(t).dispatchEvent(o(e))},arguments)},__wbg_document_ee35a3d3ae34ef6c:function(t){let e=o(t).document;return d(e)?0:c(e)},__wbg_done_57b39ecd9addfe81:function(t){return o(t).done},__wbg_draw_5e75ffb45e14ad2e:function(){return w(function(t,e,n,r,i){let b=o(t).draw(I.__wrap(e),n===4294967297?void 0:n,r===4294967297?void 0:r,i!==0);return c(b)},arguments)},__wbg_entries_58c7934c745daac7:function(t){let e=Object.entries(o(t));return c(e)},__wbg_error_3c7d958458bf649b:function(t,e){var n=pt(t,e).slice();_.__wbindgen_export4(t,e*4,4),console.error(...n)},__wbg_error_7534b8e9a36f1ab4:function(t,e){var n=f(t,e);t!==0&&_.__wbindgen_export4(t,e,1),console.error(n)},__wbg_error_794d0ffc9d00d5c3:function(t,e,n,r){console.error(o(t),o(e),o(n),o(r))},__wbg_error_9a7fe3f932034cde:function(t){console.error(o(t))},__wbg_error_f852e41c69b0bd84:function(t,e){console.error(o(t),o(e))},__wbg_fetch_e6e8e0a221783759:function(t,e){let n=o(t).fetch(o(e));return c(n)},__wbg_focus_128ff465f65677cc:function(){return w(function(t){o(t).focus()},arguments)},__wbg_fonts_ba4bc521c555025e:function(t){let e=o(t).fonts;return c(e)},__wbg_format_7c97ddc401dae52f:function(t){let e=o(t).format;return c(e)},__wbg_from_bddd64e7d5ff6941:function(t){let e=Array.from(o(t));return c(e)},__wbg_getAttribute_b9f6fc4b689c71b0:function(t,e,n,r){var i=f(n,r);let b=o(e).getAttribute(i);var g=d(b)?0:m(b,_.__wbindgen_export,_.__wbindgen_export2),l=v;a().setInt32(t+4,l,!0),a().setInt32(t+0,g,!0)},__wbg_getBoundingClientRect_b5c8c34d07878818:function(t){let e=o(t).getBoundingClientRect();return c(e)},__wbg_getComputedStyle_2d1f9dfe4ee7e0b9:function(){return w(function(t,e){let n=o(t).getComputedStyle(o(e));return d(n)?0:c(n)},arguments)},__wbg_getContext_2a5764d48600bc43:function(){return w(function(t,e,n){var r=f(e,n);let i=o(t).getContext(r);return d(i)?0:c(i)},arguments)},__wbg_getEntriesByName_02488cff0bc7581c:function(t,e,n,r,i){var b=f(e,n),g=f(r,i);let l=o(t).getEntriesByName(b,g);return c(l)},__wbg_getPropertyValue_d6911b2a1f9acba9:function(){return w(function(t,e,n,r){var i=f(n,r);let b=o(e).getPropertyValue(i),g=m(b,_.__wbindgen_export,_.__wbindgen_export2),l=v;a().setInt32(t+4,l,!0),a().setInt32(t+0,g,!0)},arguments)},__wbg_getRandomValues_1c61fac11405ffdc:function(){return w(function(t,e){globalThis.crypto.getRandomValues(T(t,e))},arguments)},__wbg_getReader_804829cfb24eb4dd:function(t){let e=o(t).getReader();return c(e)},__wbg_getRootNode_193e544ed534e810:function(t){let e=o(t).getRootNode();return c(e)},__wbg_getSelection_d345357cda220f17:function(){return w(function(t){let e=o(t).getSelection();return d(e)?0:c(e)},arguments)},__wbg_getTime_1e3cd1391c5c3995:function(t){return o(t).getTime()},__wbg_getTimezoneOffset_81776d10a4ec18a8:function(t){return o(t).getTimezoneOffset()},__wbg_get_5dd1ee4c9f462865:function(t,e,n,r){var i=f(n,r);let b=o(e)[i];var g=d(b)?0:m(b,_.__wbindgen_export,_.__wbindgen_export2),l=v;a().setInt32(t+4,l,!0),a().setInt32(t+0,g,!0)},__wbg_get_76e04509d1922a04:function(t,e,n){var r=f(e,n);let i=o(t)[r];return d(i)?0:c(i)},__wbg_get_941633a1d2f510cb:function(){return w(function(t,e,n,r){var i=f(n,r);let b=o(e).get(i);var g=d(b)?0:m(b,_.__wbindgen_export,_.__wbindgen_export2),l=v;a().setInt32(t+4,l,!0),a().setInt32(t+0,g,!0)},arguments)},__wbg_get_9b94d73e6221f75c:function(t,e){let n=o(t)[e>>>0];return c(n)},__wbg_get_b3ed3ad4be2bc8ac:function(){return w(function(t,e){let n=Reflect.get(o(t),o(e));return c(n)},arguments)},__wbg_get_d8db2ad31d529ff8:function(t,e){let n=o(t)[e>>>0];return d(n)?0:c(n)},__wbg_get_static_config_ffdaec396809a82f:function(t){let e=o(t).get_static_config();return c(e)},__wbg_get_with_index_d26da38d2c038e1a:function(t,e){let n=o(t)[e>>>0];return d(n)?0:c(n)},__wbg_get_with_ref_key_1dc361bd10053bfe:function(t,e){let n=o(t)[o(e)];return c(n)},__wbg_hasAttribute_5d8f52cb4c739280:function(t,e,n){var r=f(e,n);return o(t).hasAttribute(r)},__wbg_has_d4e53238966c12b6:function(){return w(function(t,e){return Reflect.has(o(t),o(e))},arguments)},__wbg_headers_59a2938db9f80985:function(t){let e=o(t).headers;return c(e)},__wbg_height_45209601b4c4ede6:function(t){return o(t).height},__wbg_height_c2027cf67d1c9b11:function(t){return o(t).height},__wbg_hidden_8ce6a98b8c12451c:function(t){return o(t).hidden},__wbg_hidePopover_f52b72171825485d:function(){return w(function(t){o(t).hidePopover()},arguments)},__wbg_host_fb29f8be35c2517d:function(t){let e=o(t).host;return c(e)},__wbg_includes_32215c836f1cd3fb:function(t,e,n){return o(t).includes(o(e),n)},__wbg_indexOf_e5f91887d9e5023e:function(t,e,n){return o(t).indexOf(o(e),n)},__wbg_info_148d043840582012:function(t){console.info(o(t))},__wbg_info_9e602cf10c5c690b:function(t,e,n,r){console.info(o(t),o(e),o(n),o(r))},__wbg_innerHeight_54aa104da08becd2:function(){return w(function(t){let e=o(t).innerHeight;return c(e)},arguments)},__wbg_innerWidth_fa95c57321f4f033:function(){return w(function(t){let e=o(t).innerWidth;return c(e)},arguments)},__wbg_insertBefore_1468142836e61a51:function(){return w(function(t,e,n){let r=o(t).insertBefore(o(e),o(n));return c(r)},arguments)},__wbg_insertPanel_821bc235e324526c:function(t,e,n,r,i){var b=f(e,n);let g=o(t).insertPanel(b,u(r),u(i));return c(g)},__wbg_instanceof_ArrayBuffer_c367199e2fa2aa04:function(t){let e;try{e=o(t)instanceof ArrayBuffer}catch{e=!1}return e},__wbg_instanceof_Array_d9eac779cd191cbc:function(t){let e;try{e=o(t)instanceof Array}catch{e=!1}return e},__wbg_instanceof_CanvasRenderingContext2d_4bb052fd1c3d134d:function(t){let e;try{e=o(t)instanceof CanvasRenderingContext2D}catch{e=!1}return e},__wbg_instanceof_CssStyleRule_23e59108346af0df:function(t){let e;try{e=o(t)instanceof CSSStyleRule}catch{e=!1}return e},__wbg_instanceof_CustomEvent_7dc010f377596c94:function(t){let e;try{e=o(t)instanceof CustomEvent}catch{e=!1}return e},__wbg_instanceof_Date_1b9f15b87f10aa4c:function(t){let e;try{e=o(t)instanceof Date}catch{e=!1}return e},__wbg_instanceof_Element_9e662f49ab6c6beb:function(t){let e;try{e=o(t)instanceof Element}catch{e=!1}return e},__wbg_instanceof_Error_8573fe0b0b480f46:function(t){let e;try{e=o(t)instanceof Error}catch{e=!1}return e},__wbg_instanceof_HtmlCanvasElement_3f2f6e1edb1c9792:function(t){let e;try{e=o(t)instanceof HTMLCanvasElement}catch{e=!1}return e},__wbg_instanceof_HtmlElement_5abfac207260fd6f:function(t){let e;try{e=o(t)instanceof HTMLElement}catch{e=!1}return e},__wbg_instanceof_HtmlInputElement_c10b7260b4e0710a:function(t){let e;try{e=o(t)instanceof HTMLInputElement}catch{e=!1}return e},__wbg_instanceof_HtmlLinkElement_5eb5b0855a17d0fc:function(t){let e;try{e=o(t)instanceof HTMLLinkElement}catch{e=!1}return e},__wbg_instanceof_HtmlSelectElement_a1820832b22b0d1e:function(t){let e;try{e=o(t)instanceof HTMLSelectElement}catch{e=!1}return e},__wbg_instanceof_Map_53af74335dec57f4:function(t){let e;try{e=o(t)instanceof Map}catch{e=!1}return e},__wbg_instanceof_Node_da04bd8df43deba3:function(t){let e;try{e=o(t)instanceof Node}catch{e=!1}return e},__wbg_instanceof_Object_1c6af87502b733ed:function(t){let e;try{e=o(t)instanceof Object}catch{e=!1}return e},__wbg_instanceof_Promise_0094681e3519d6ec:function(t){let e;try{e=o(t)instanceof Promise}catch{e=!1}return e},__wbg_instanceof_Response_ee1d54d79ae41977:function(t){let e;try{e=o(t)instanceof Response}catch{e=!1}return e},__wbg_instanceof_ShadowRoot_5285adde3587c73e:function(t){let e;try{e=o(t)instanceof ShadowRoot}catch{e=!1}return e},__wbg_instanceof_Uint8Array_9b9075935c74707c:function(t){let e;try{e=o(t)instanceof Uint8Array}catch{e=!1}return e},__wbg_instanceof_Window_ed49b2db8df90359:function(t){let e;try{e=o(t)instanceof Window}catch{e=!1}return e},__wbg_isArray_d314bb98fcf08331:function(t){return Array.isArray(o(t))},__wbg_isCollapsed_617e9be3f62f5a25:function(t){return o(t).isCollapsed},__wbg_isConnected_6110bc2c5462f90e:function(t){return o(t).isConnected},__wbg_isContentEditable_f5b0ce009dbd035b:function(t){return o(t).isContentEditable},__wbg_isIntersecting_04185f7554a64e9e:function(t){return o(t).isIntersecting},__wbg_isSafeInteger_bfbc7332a9768d2a:function(t){return Number.isSafeInteger(o(t))},__wbg_isSameNode_3caa48d6eb3c880e:function(t,e){return o(t).isSameNode(o(e))},__wbg_is_f29129f676e5410c:function(t,e){return Object.is(o(t),o(e))},__wbg_item_00ae26320b80a11f:function(t,e,n){let r=o(e).item(n>>>0),i=m(r,_.__wbindgen_export,_.__wbindgen_export2),b=v;a().setInt32(t+4,b,!0),a().setInt32(t+0,i,!0)},__wbg_item_48715d3212ed96cb:function(t,e){let n=o(t).item(e>>>0);return d(n)?0:c(n)},__wbg_item_5c82f52b014b3056:function(t,e){let n=o(t).item(e>>>0);return d(n)?0:c(n)},__wbg_item_64b77e6a26f7de76:function(t,e){let n=o(t).item(e>>>0);return d(n)?0:c(n)},__wbg_item_ca823df8214b9e2b:function(t,e){let n=o(t).item(e>>>0);return d(n)?0:c(n)},__wbg_iterator_6ff6560ca1568e55:function(){return c(Symbol.iterator)},__wbg_keyCode_155291a11654466e:function(t){return o(t).keyCode},__wbg_key_d41e8e825e6bb0e9:function(t,e){let n=o(e).key,r=m(n,_.__wbindgen_export,_.__wbindgen_export2),i=v;a().setInt32(t+4,i,!0),a().setInt32(t+0,r,!0)},__wbg_keys_b50a709a76add04e:function(t){let e=Object.keys(o(t));return c(e)},__wbg_languages_5a69df7551d1a803:function(t){let e=o(t).languages;return c(e)},__wbg_lastChild_132d67597d5e4aef:function(t){let e=o(t).lastChild;return d(e)?0:c(e)},__wbg_left_3b7c3c1030d5ca7a:function(t){return o(t).left},__wbg_length_25851a48867b2afc:function(t){return o(t).length},__wbg_length_32ed9a279acd054c:function(t){return o(t).length},__wbg_length_35a7bace40f36eac:function(t){return o(t).length},__wbg_length_3f12bc1cab862cc3:function(t){return o(t).length},__wbg_length_b5aa6c69c842d6a6:function(t){return o(t).length},__wbg_length_e455564ce5cbf46e:function(t){return o(t).length},__wbg_length_edae0cd13a8d3b71:function(t){return o(t).length},__wbg_listener_id_3f13203bf7de1e4d:function(t){let e=o(t).__yew_listener_id;return d(e)?4294967297:e>>>0},__wbg_load_f8d29f3c1bda8dd1:function(t,e,n,r,i){var b=f(e,n),g=f(r,i);let l=o(t).load(b,g);return c(l)},__wbg_mark_3b530a64b09ba08a:function(){return w(function(t,e,n){var r=f(e,n);o(t).mark(r)},arguments)},__wbg_matches_852ba8b2b4592069:function(){return w(function(t,e,n){var r=f(e,n);return o(t).matches(r)},arguments)},__wbg_maximize_6375cac5f5786a03:function(t,e,n){var r=f(e,n);o(t).maximize(r)},__wbg_measureText_9d64a92333bd05ee:function(){return w(function(t,e,n){var r=f(e,n);let i=o(t).measureText(r);return c(i)},arguments)},__wbg_measure_288b48c082eae0fe:function(){return w(function(t,e,n,r,i){var b=f(e,n),g=f(r,i);o(t).measure(b,g)},arguments)},__wbg_message_9ddc4b9a62a7c379:function(t){let e=o(t).message;return c(e)},__wbg_minimize_d4f1de6054e9fb62:function(t){o(t).minimize()},__wbg_namespaceURI_86e2062c65f0f341:function(t,e){let n=o(e).namespaceURI;var r=d(n)?0:m(n,_.__wbindgen_export,_.__wbindgen_export2),i=v;a().setInt32(t+4,i,!0),a().setInt32(t+0,r,!0)},__wbg_navigator_43be698ba96fc088:function(t){let e=o(t).navigator;return c(e)},__wbg_new_16c83877745f8d12:function(){return w(function(t,e){var n=f(t,e);let r=new InputEvent(n);return c(r)},arguments)},__wbg_new_1d5bd472c706b768:function(){return w(function(){let t=new CSSStyleSheet;return c(t)},arguments)},__wbg_new_245cd5c49157e602:function(t){let e=new Date(o(t));return c(e)},__wbg_new_29d3c8d664bb4b7a:function(t){let e=new st(o(t));return c(e)},__wbg_new_2ec3ec8c398b20d2:function(){return w(function(){let t=new TextDecoder;return c(t)},arguments)},__wbg_new_361308b2356cecd0:function(){let t=new Object;return c(t)},__wbg_new_370927df1846ff23:function(t){let e=new it(o(t));return c(e)},__wbg_new_384a230f8673183c:function(){return w(function(t,e){var n=f(t,e);let r=new CustomEvent(n);return c(r)},arguments)},__wbg_new_3eb36ae241fe6f44:function(){let t=new Array;return c(t)},__wbg_new_64284bd487f9d239:function(){return w(function(){let t=new Headers;return c(t)},arguments)},__wbg_new_72b49615380db768:function(t,e){var n=f(t,e);let r=new Error(n);return c(r)},__wbg_new_86c8f0b79e48927d:function(t,e){let n=new Intl.NumberFormat(o(t),o(e));return c(n)},__wbg_new_8a6f238a6ece86ea:function(){let t=new Error;return c(t)},__wbg_new_b5d9e2fb389fef91:function(t,e){try{var n={a:t,b:e},r=(b,g)=>{let l=n.a;n.a=0;try{return Ht(l,n.b,b,g)}finally{n.a=l}};let i=new Promise(r);return c(i)}finally{n.a=n.b=0}},__wbg_new_b949e7f56150a5d1:function(){return w(function(){let t=new AbortController;return c(t)},arguments)},__wbg_new_c155239f1b113b68:function(t,e){let n=new Intl.DateTimeFormat(o(t),o(e));return c(n)},__wbg_new_d031a10fb1b11855:function(t){let e=new at(o(t));return c(e)},__wbg_new_dca287b076112a51:function(){return c(new Map)},__wbg_new_dd2b680c8bf6ae29:function(t){let e=new Uint8Array(o(t));return c(e)},__wbg_new_from_slice_a3d2629dc1826784:function(t,e){let n=new Uint8Array(T(t,e));return c(n)},__wbg_new_no_args_1c7c842f08d00ebb:function(t,e){var n=f(t,e);let r=new Function(n);return c(r)},__wbg_new_with_event_init_dict_48877e7ca125f3c1:function(){return w(function(t,e,n){var r=f(t,e);let i=new CustomEvent(r,o(n));return c(i)},arguments)},__wbg_new_with_length_1763c527b2923202:function(t){let e=new Array(t>>>0);return c(e)},__wbg_new_with_str_and_init_a61cbc6bdef21614:function(){return w(function(t,e,n){var r=f(t,e);let i=new Request(r,o(n));return c(i)},arguments)},__wbg_new_with_str_sequence_and_options_9b8b0bee99ec6b0f:function(){return w(function(t,e){let n=new Blob(o(t),o(e));return c(n)},arguments)},__wbg_new_with_u8_array_sequence_08b2096a9f3117c0:function(){return w(function(t){let e=new Blob(o(t));return c(e)},arguments)},__wbg_nextSibling_2e988d9bbe3e06f0:function(t){let e=o(t).nextSibling;return d(e)?0:c(e)},__wbg_next_3482f54c49e8af19:function(){return w(function(t){let e=o(t).next();return c(e)},arguments)},__wbg_next_418f80d8f5303233:function(t){let e=o(t).next;return c(e)},__wbg_now_a3af9a2f4bbaa4d1:function(){return Date.now()},__wbg_now_ebffdf7e580f210d:function(t){return o(t).now()},__wbg_observe_321679415e4d0e42:function(t,e){o(t).observe(o(e))},__wbg_observe_de2f1bd9f200cf03:function(t,e){o(t).observe(o(e))},__wbg_of_f915f7cd925b21a5:function(t){let e=Array.of(o(t));return c(e)},__wbg_offsetHeight_34f7abc1686733cc:function(t){return o(t).offsetHeight},__wbg_offsetParent_9627ebca6b03e8b2:function(t){let e=o(t).offsetParent;return d(e)?0:c(e)},__wbg_offsetWidth_f37b33a53e513101:function(t){return o(t).offsetWidth},__wbg_offsetX_b76b9bb1f9235de9:function(t){return o(t).offsetX},__wbg_offsetY_db5c1ddb866e1b82:function(t){return o(t).offsetY},__wbg_ok_87f537440a0acf85:function(t){return o(t).ok},__wbg_parentElement_75863410a8617953:function(t){let e=o(t).parentElement;return d(e)?0:c(e)},__wbg_parentNode_d44bd5ec58601e45:function(t){let e=o(t).parentNode;return d(e)?0:c(e)},__wbg_parse_708461a1feddfb38:function(){return w(function(t,e){var n=f(t,e);let r=JSON.parse(n);return c(r)},arguments)},__wbg_performance_06f12ba62483475d:function(t){let e=o(t).performance;return d(e)?0:c(e)},__wbg_plugin_config_schema_646d865e94b55004:function(){return w(function(t,e,n){let r=o(t).plugin_config_schema(o(e),o(n));return c(r)},arguments)},__wbg_pointerId_466b1bdcaf2fe835:function(t){return o(t).pointerId},__wbg_pop_80fa29128215a463:function(t){let e=o(t).pop();return c(e)},__wbg_prepend_12ed960547d9dfe1:function(){return w(function(t,e){o(t).prepend(o(e))},arguments)},__wbg_presize_137c0c00a4fc218e:function(){return w(function(t,e,n){let r=o(t).presize(e,n);return c(r)},arguments)},__wbg_preventDefault_cdcfcd7e301b9702:function(t){o(t).preventDefault()},__wbg_prototypesetcall_bdcdcc5842e4d77d:function(t,e,n){Uint8Array.prototype.set.call(T(t,e),o(n))},__wbg_push_8ffdcb2063340ba5:function(t,e){return o(t).push(o(e))},__wbg_querySelectorAll_1283aae52043a951:function(){return w(function(t,e,n){var r=f(e,n);let i=o(t).querySelectorAll(r);return c(i)},arguments)},__wbg_querySelectorAll_5875742f4e11f759:function(){return w(function(t,e,n){var r=f(e,n);let i=o(t).querySelectorAll(r);return c(i)},arguments)},__wbg_querySelector_1be4292f202b1597:function(){return w(function(t,e,n){var r=f(e,n);let i=o(t).querySelector(r);return d(i)?0:c(i)},arguments)},__wbg_querySelector_4dc619d02f6cb079:function(){return w(function(t,e,n){var r=f(e,n);let i=o(t).querySelector(r);return d(i)?0:c(i)},arguments)},__wbg_queueMicrotask_0aa0a927f78f5d98:function(t){let e=o(t).queueMicrotask;return c(e)},__wbg_queueMicrotask_5bb536982f78a56f:function(t){queueMicrotask(o(t))},__wbg_readText_b9ac81623f153a62:function(t){let e=o(t).readText();return c(e)},__wbg_read_68fd377df67e19b0:function(t){let e=o(t).read();return c(e)},__wbg_readyState_cf11f0728fc7b46c:function(t,e){let n=o(e).readyState,r=m(n,_.__wbindgen_export,_.__wbindgen_export2),i=v;a().setInt32(t+4,i,!0),a().setInt32(t+0,r,!0)},__wbg_realCoordinates_66406d615ad29374:function(t,e){let n=o(t).realCoordinates(o(e));return c(n)},__wbg_reject_a2176de7f1212be5:function(t){let e=Promise.reject(o(t));return c(e)},__wbg_relatedTarget_1557cded94b97af2:function(t){let e=o(t).relatedTarget;return d(e)?0:c(e)},__wbg_releasePointerCapture_420ef33c7c5fb6f4:function(){return w(function(t,e){o(t).releasePointerCapture(e)},arguments)},__wbg_removeAllRanges_39254b77dc6257ab:function(){return w(function(t){o(t).removeAllRanges()},arguments)},__wbg_removeAttribute_87259aab06d9f286:function(){return w(function(t,e,n){var r=f(e,n);o(t).removeAttribute(r)},arguments)},__wbg_removeChild_2f0b06213dbc49ca:function(){return w(function(t,e){let n=o(t).removeChild(o(e));return c(n)},arguments)},__wbg_removeEventListener_0c0902ed5009dd9f:function(){return w(function(t,e,n,r,i){var b=f(e,n);o(t).removeEventListener(b,o(r),i!==0)},arguments)},__wbg_removeEventListener_e63328781a5b9af9:function(){return w(function(t,e,n,r){var i=f(e,n);o(t).removeEventListener(i,o(r))},arguments)},__wbg_removePanel_10735acd8d7b1f83:function(t,e,n){var r=f(e,n);let i=o(t).removePanel(r);return c(i)},__wbg_removeProperty_a0d2ff8a76ffd2b1:function(){return w(function(t,e,n,r){var i=f(n,r);let b=o(e).removeProperty(i),g=m(b,_.__wbindgen_export,_.__wbindgen_export2),l=v;a().setInt32(t+4,l,!0),a().setInt32(t+0,g,!0)},arguments)},__wbg_remove_31c39325eee968fc:function(t){o(t).remove()},__wbg_remove_f9451697e0bc6ca0:function(){return w(function(t,e,n){var r=f(e,n);o(t).remove(r)},arguments)},__wbg_render_83e4fcba7324f48e:function(){return w(function(t,e,n){let r=o(t).render(I.__wrap(e),u(n));return c(r)},arguments)},__wbg_replaceSync_54e9ce897fe6ab6a:function(){return w(function(t,e,n){var r=f(e,n);o(t).replaceSync(r)},arguments)},__wbg_requestAnimationFrame_43682f8e1c5e5348:function(){return w(function(t,e){return o(t).requestAnimationFrame(o(e))},arguments)},__wbg_resize_a410d9c5559119ee:function(){return w(function(t){let e=o(t).resize();return c(e)},arguments)},__wbg_resolve_002c4b7d9d8f6b64:function(t){let e=Promise.resolve(o(t));return c(e)},__wbg_resolvedOptions_4c36dbfa1c4ba2bf:function(t){let e=o(t).resolvedOptions();return c(e)},__wbg_restorePhysics_e199448211a7c472:function(t,e){o(t).restorePhysics(o(e))},__wbg_restoreSync_f694e486ffc2460c:function(t,e){o(t).restoreSync(o(e))},__wbg_restore_f66bd8563e487a4e:function(){return w(function(t,e,n){o(t).restore(o(e),o(n))},arguments)},__wbg_restyle_d59c669358a98ead:function(t){o(t).restyle()},__wbg_resumeResize_e8296b3d5d6b0488:function(t){o(t).resumeResize()},__wbg_right_154af6c2b1bf0c89:function(t){return o(t).right},__wbg_run_2bb852e2dc558431:function(){return w(function(t,e){let n=o(t).run(o(e));return c(n)},arguments)},__wbg_save_a481acc855aefe70:function(t){let e=o(t).save();return c(e)},__wbg_scrollHeight_25e40881bfad55b6:function(t){return o(t).scrollHeight},__wbg_scrollLeft_2b817c7719d17438:function(t){return o(t).scrollLeft},__wbg_scrollTop_0a3a77f9fcbe038e:function(t){return o(t).scrollTop},__wbg_scrollTop_4161d2a08060cb06:function(t){return o(t).scrollTop},__wbg_select_48c82c2de92fc898:function(t,e,n){var r=f(e,n);let i=o(t).select(r);return c(i)},__wbg_select_f96715f412d93f23:function(t){o(t).select()},__wbg_selectedIndex_b1465d243fcb7142:function(t){return o(t).selectedIndex},__wbg_selectionEnd_f3cba543517b4aa8:function(){return w(function(t){let e=o(t).selectionEnd;return d(e)?4294967297:e>>>0},arguments)},__wbg_selectionStart_9cd0aeff14a21252:function(){return w(function(t){let e=o(t).selectionStart;return d(e)?4294967297:e>>>0},arguments)},__wbg_selectorText_4ebdf4f8074dafea:function(t,e){let n=o(e).selectorText,r=m(n,_.__wbindgen_export,_.__wbindgen_export2),i=v;a().setInt32(t+4,i,!0),a().setInt32(t+0,r,!0)},__wbg_setAttribute_cc8e4c8a2a008508:function(){return w(function(t,e,n,r,i){var b=f(e,n),g=f(r,i);o(t).setAttribute(b,g)},arguments)},__wbg_setDragImage_76defbcc7ff30178:function(t,e,n,r){o(t).setDragImage(o(e),n,r)},__wbg_setPointerCapture_420db6f6826eb74b:function(){return w(function(t,e){o(t).setPointerCapture(e)},arguments)},__wbg_setProperty_cbb25c4e74285b39:function(){return w(function(t,e,n,r,i){var b=f(e,n),g=f(r,i);o(t).setProperty(b,g)},arguments)},__wbg_setSelectionRange_301eef1c51e01d2a:function(){return w(function(t,e,n){o(t).setSelectionRange(e>>>0,n>>>0)},arguments)},__wbg_setTimeout_21d8cc2869b34c58:function(t,e){return setTimeout(o(t),e)},__wbg_setTimeout_eff32631ea138533:function(){return w(function(t,e,n){return o(t).setTimeout(o(e),n)},arguments)},__wbg_set_1eb0999cf5d27fc8:function(t,e,n){let r=o(t).set(o(e),o(n));return c(r)},__wbg_set_3f1d0b984ed272ed:function(t,e,n){o(t)[u(e)]=u(n)},__wbg_set_6cb8631f80447a67:function(){return w(function(t,e,n){return Reflect.set(o(t),o(e),o(n))},arguments)},__wbg_set_body_9a7e00afe3cfe244:function(t,e){o(t).body=o(e)},__wbg_set_bubbles_739f291693b2bbec:function(t,e){o(t).bubbles=e!==0},__wbg_set_cache_key_ace1fa875f02b7cd:function(t,e){o(t).__yew_subtree_cache_key=e>>>0},__wbg_set_capture_d52e7a585f2933c8:function(t,e){o(t).capture=e!==0},__wbg_set_checked_4b2468680005fbf7:function(t,e){o(t).checked=e!==0},__wbg_set_className_c1d9e7362164af61:function(t,e,n){var r=f(e,n);o(t).className=r},__wbg_set_composed_e4a9826a628ca7f8:function(t,e){o(t).composed=e!==0},__wbg_set_cssText_18380c97092caefa:function(t,e,n){var r=f(e,n);o(t).cssText=r},__wbg_set_defaultValue_ad528b0a65ceef4a:function(){return w(function(t,e,n){var r=f(e,n);o(t).defaultValue=r},arguments)},__wbg_set_detail_fa3b358526be3a85:function(t,e){o(t).detail=o(e)},__wbg_set_dropEffect_042402609f0b7c6b:function(t,e,n){var r=f(e,n);o(t).dropEffect=r},__wbg_set_f43e577aea94465b:function(t,e,n){o(t)[e>>>0]=u(n)},__wbg_set_fb27b296001e2de9:function(){return w(function(t,e,n,r,i){var b=f(e,n),g=f(r,i);o(t)[b]=g},arguments)},__wbg_set_font_575685c8f7e56957:function(t,e,n){var r=f(e,n);o(t).font=r},__wbg_set_headers_cfc5f4b2c1f20549:function(t,e){o(t).headers=o(e)},__wbg_set_innerHTML_edd39677e3460291:function(t,e,n){var r=f(e,n);o(t).innerHTML=r},__wbg_set_innerText_2f1502f2d0780499:function(t,e,n){var r=f(e,n);o(t).innerText=r},__wbg_set_listener_id_8b77f7eb9adb712b:function(t,e){o(t).__yew_listener_id=e>>>0},__wbg_set_method_c3e20375f5ae7fac:function(t,e,n){var r=f(e,n);o(t).method=r},__wbg_set_mode_6a55f972d62a3c88:function(t,e){o(t).mode=Bt[e]},__wbg_set_nodeValue_d947eb0a476b80d7:function(t,e,n){var r=f(e,n);o(t).nodeValue=r},__wbg_set_passive_f411e67e6f28687b:function(t,e){o(t).passive=e!==0},__wbg_set_scrollLeft_8de8fc187e3a6808:function(t,e){o(t).scrollLeft=e},__wbg_set_scrollTop_bebe746cd217a3d1:function(t,e){o(t).scrollTop=e},__wbg_set_scrollTop_fb454582dda63417:function(t,e){o(t).scrollTop=e},__wbg_set_selectionEnd_01e3269db03d5d2e:function(){return w(function(t,e){o(t).selectionEnd=e===4294967297?void 0:e},arguments)},__wbg_set_selectionStart_d68d6955c07c2be1:function(){return w(function(t,e){o(t).selectionStart=e===4294967297?void 0:e},arguments)},__wbg_set_signal_f2d3f8599248896d:function(t,e){o(t).signal=o(e)},__wbg_set_stream_8a7c5f563fa185b4:function(t,e){o(t).stream=e!==0},__wbg_set_subtree_id_8be88ea477740786:function(t,e){o(t).__yew_subtree_id=e>>>0},__wbg_set_type_148de20768639245:function(t,e,n){var r=f(e,n);o(t).type=r},__wbg_set_value_62a965e38b22b38c:function(t,e,n){var r=f(e,n);o(t).value=r},__wbg_set_value_c3556fce049236f0:function(t,e,n){var r=f(e,n);o(t).value=r},__wbg_set_value_ddc3bd01a8467bf1:function(t,e,n){var r=f(e,n);o(t).value=r},__wbg_shadowRoot_14828067c5922da7:function(t){let e=o(t).shadowRoot;return d(e)?0:c(e)},__wbg_sheet_38c9043b5f37d85d:function(t){let e=o(t).sheet;return d(e)?0:c(e)},__wbg_shiftKey_5558a3288542c985:function(t){return o(t).shiftKey},__wbg_shiftKey_564be91ec842bcc4:function(t){return o(t).shiftKey},__wbg_showPicker_ba1d36381dae3011:function(){return w(function(t){o(t).showPicker()},arguments)},__wbg_showPopover_7166cd0808998024:function(){return w(function(t){o(t).showPopover()},arguments)},__wbg_signal_d1285ecab4ebc5ad:function(t){let e=o(t).signal;return c(e)},__wbg_slot_7d421d6c9d6c8352:function(t,e){let n=o(e).slot,r=m(n,_.__wbindgen_export,_.__wbindgen_export2),i=v;a().setInt32(t+4,i,!0),a().setInt32(t+0,r,!0)},__wbg_stack_0ed75d68575b0f3c:function(t,e){let n=o(e).stack,r=m(n,_.__wbindgen_export,_.__wbindgen_export2),i=v;a().setInt32(t+4,i,!0),a().setInt32(t+0,r,!0)},__wbg_startTime_248495bfbcb427d3:function(t){return o(t).startTime},__wbg_static_accessor_GLOBAL_12837167ad935116:function(){let t=typeof self>\"u\"?null:self;return d(t)?0:c(t)},__wbg_static_accessor_GLOBAL_THIS_e628e89ab3b1c95f:function(){let t=typeof globalThis>\"u\"?null:globalThis;return d(t)?0:c(t)},__wbg_static_accessor_PSP_ec0d91ec58af3fc5:function(){return c(J)},__wbg_static_accessor_SELF_a621d3dfbb60d0ce:function(){let t=typeof self>\"u\"?null:self;return d(t)?0:c(t)},__wbg_static_accessor_WINDOW_f8727f0cf888e0bd:function(){let t=typeof window>\"u\"?null:window;return d(t)?0:c(t)},__wbg_statusText_556131a02d60f5cd:function(t,e){let n=o(e).statusText,r=m(n,_.__wbindgen_export,_.__wbindgen_export2),i=v;a().setInt32(t+4,i,!0),a().setInt32(t+0,r,!0)},__wbg_status_89d7e803db911ee7:function(t){return o(t).status},__wbg_stopPropagation_6e5e2a085214ac63:function(t){o(t).stopPropagation()},__wbg_stringify_2fdc12d5545a89d9:function(){return w(function(t,e,n){let r=JSON.stringify(o(t),o(e),o(n));return c(r)},arguments)},__wbg_stringify_8d1cc6ff383e8bae:function(){return w(function(t){let e=JSON.stringify(o(t));return c(e)},arguments)},__wbg_styleSheets_54de627270238f6f:function(t){let e=o(t).styleSheets;return c(e)},__wbg_style_0b7c9bd318f8b807:function(t){let e=o(t).style;return c(e)},__wbg_style_fa56cf251a93275a:function(t){let e=o(t).style;return c(e)},__wbg_subtree_id_1739fcadc43deeca:function(t){let e=o(t).__yew_subtree_id;return d(e)?4294967297:e>>>0},__wbg_supportedValuesOf_f5bfa0b7982be194:function(t){let e=Intl.supportedValuesOf(o(t));return c(e)},__wbg_table_new:function(t){let e=z.__wrap(t);return c(e)},__wbg_tagName_0cf6d7b647352f04:function(t,e){let n=o(e).tagName,r=m(n,_.__wbindgen_export,_.__wbindgen_export2),i=v;a().setInt32(t+4,i,!0),a().setInt32(t+0,r,!0)},__wbg_target_521be630ab05b11e:function(t){let e=o(t).target;return d(e)?0:c(e)},__wbg_text_083b8727c990c8c0:function(){return w(function(t){let e=o(t).text();return c(e)},arguments)},__wbg_then_0d9fe2c7b1857d32:function(t,e,n){let r=o(t).then(o(e),o(n));return c(r)},__wbg_then_b9e7b3b5f1a9e1b5:function(t,e){let n=o(t).then(o(e));return c(n)},__wbg_timeStamp_ddfe1bf5c2346d68:function(t){return o(t).timeStamp},__wbg_toString_964ff7fe6eca8362:function(t){let e=o(t).toString();return c(e)},__wbg_toggleAttribute_d89e5c9e9053c9c4:function(){return w(function(t,e,n,r){var i=f(e,n);return o(t).toggleAttribute(i,r!==0)},arguments)},__wbg_toggle_52417ca95b874e83:function(){return w(function(t,e,n){var r=f(e,n);return o(t).toggle(r)},arguments)},__wbg_toggle_b8e3ebf1a7aaeb11:function(){return w(function(t,e,n,r){var i=f(e,n);return o(t).toggle(i,r!==0)},arguments)},__wbg_top_3d27ff6f468cf3fc:function(t){return o(t).top},__wbg_trace_9007714a6fbee374:function(t){console.trace(o(t))},__wbg_trace_bd16b570941b54fb:function(t,e,n,r){console.trace(o(t),o(e),o(n),o(r))},__wbg_type_4edffca24c42b74d:function(t,e){let n=o(e).type,r=m(n,_.__wbindgen_export,_.__wbindgen_export2),i=v;a().setInt32(t+4,i,!0),a().setInt32(t+0,r,!0)},__wbg_unobserve_91c41e2f484c0a6b:function(t,e){o(t).unobserve(o(e))},__wbg_unobserve_96aa5061c3bb9a60:function(t,e){o(t).unobserve(o(e))},__wbg_update_12b3a6d9ce307218:function(){return w(function(t,e,n,r,i){let b=o(t).update(I.__wrap(e),n===4294967297?void 0:n,r===4294967297?void 0:r,i!==0);return c(b)},arguments)},__wbg_valueAsNumber_5292e7ed56db5658:function(t){return o(t).valueAsNumber},__wbg_value_0546255b415e96c1:function(t){let e=o(t).value;return c(e)},__wbg_value_15684899da869c95:function(t,e){let n=o(e).value,r=m(n,_.__wbindgen_export,_.__wbindgen_export2),i=v;a().setInt32(t+4,i,!0),a().setInt32(t+0,r,!0)},__wbg_value_d402dce7dcb16251:function(t,e){let n=o(e).value,r=m(n,_.__wbindgen_export,_.__wbindgen_export2),i=v;a().setInt32(t+4,i,!0),a().setInt32(t+0,r,!0)},__wbg_value_e506a07878790ca0:function(t,e){let n=o(e).value,r=m(n,_.__wbindgen_export,_.__wbindgen_export2),i=v;a().setInt32(t+4,i,!0),a().setInt32(t+0,r,!0)},__wbg_values_5da93bc719d272cf:function(t){let e=Object.values(o(t));return c(e)},__wbg_view_new:function(t){let e=I.__wrap(t);return c(e)},__wbg_view_unwrap:function(t){return I.__unwrap(o(t))},__wbg_virtualdataslice_new:function(t){let e=M.__wrap(t);return c(e)},__wbg_warn_a40b971467b219c7:function(t,e,n,r){console.warn(o(t),o(e),o(n),o(r))},__wbg_warn_f7ae1b2e66ccb930:function(t){console.warn(o(t))},__wbg_which_78ecd90ab7c6bdd6:function(t){return o(t).which},__wbg_width_7444cca5dfea0645:function(t){return o(t).width},__wbg_width_9bbf873307a2ac4e:function(t){return o(t).width},__wbg_width_ae46cb8e98ee102f:function(t){return o(t).width},__wbg_write_d429ce72e918e180:function(t,e){let n=o(t).write(o(e));return c(n)},__wbindgen_cast_0000000000000001:function(t,e){let n=F(t,e,_.__wasm_bindgen_func_elem_7606,bt);return c(n)},__wbindgen_cast_0000000000000002:function(t,e){let n=S(t,e,_.__wasm_bindgen_func_elem_7606,E);return c(n)},__wbindgen_cast_0000000000000003:function(t,e){let n=S(t,e,_.__wasm_bindgen_func_elem_7606,E);return c(n)},__wbindgen_cast_0000000000000004:function(t,e){let n=S(t,e,_.__wasm_bindgen_func_elem_7606,E);return c(n)},__wbindgen_cast_0000000000000005:function(t,e){let n=S(t,e,_.__wasm_bindgen_func_elem_7606,E);return c(n)},__wbindgen_cast_0000000000000006:function(t,e){let n=F(t,e,_.__wasm_bindgen_func_elem_7606,bt);return c(n)},__wbindgen_cast_0000000000000007:function(t,e){let n=S(t,e,_.__wasm_bindgen_func_elem_7606,E);return c(n)},__wbindgen_cast_0000000000000008:function(t,e){let n=S(t,e,_.__wasm_bindgen_func_elem_7606,E);return c(n)},__wbindgen_cast_0000000000000009:function(t,e){let n=F(t,e,_.__wasm_bindgen_func_elem_7606,qt);return c(n)},__wbindgen_cast_000000000000000a:function(t,e){let n=S(t,e,_.__wasm_bindgen_func_elem_7606,Dt);return c(n)},__wbindgen_cast_000000000000000b:function(t,e){let n=F(t,e,_.__wasm_bindgen_func_elem_20715,Lt);return c(n)},__wbindgen_cast_000000000000000c:function(t,e){let n=S(t,e,_.__wasm_bindgen_func_elem_21331,Nt);return c(n)},__wbindgen_cast_000000000000000d:function(t,e){let n=S(t,e,_.__wasm_bindgen_func_elem_21331,jt);return c(n)},__wbindgen_cast_000000000000000e:function(t,e){let n=F(t,e,_.__wasm_bindgen_func_elem_22750,Mt);return c(n)},__wbindgen_cast_000000000000000f:function(t,e){let n=F(t,e,_.__wasm_bindgen_func_elem_22750,zt);return c(n)},__wbindgen_cast_0000000000000010:function(t,e){let n=S(t,e,_.__wasm_bindgen_func_elem_27432,Wt);return c(n)},__wbindgen_cast_0000000000000011:function(t){return c(t)},__wbindgen_cast_0000000000000012:function(t){return c(t)},__wbindgen_cast_0000000000000013:function(t,e){var n=f(t,e);return c(n)},__wbindgen_cast_0000000000000014:function(t,e){let n=Vt(t,e);return c(n)},__wbindgen_cast_0000000000000015:function(t,e){let n=$t(t,e);return c(n)},__wbindgen_cast_0000000000000016:function(t,e){let n=Gt(t,e);return c(n)},__wbindgen_cast_0000000000000017:function(t,e){let n=Jt(t,e);return c(n)},__wbindgen_cast_0000000000000018:function(t,e){let n=T(t,e);return c(n)},__wbindgen_cast_0000000000000019:function(t){let e=BigInt.asUintN(64,t);return c(e)},__wbindgen_cast_000000000000001a:function(t,e){var n=pt(t,e).slice();return _.__wbindgen_export4(t,e*4,4),c(n)},__wbindgen_cast_000000000000001b:function(t,e){var n=T(t,e).slice();return _.__wbindgen_export4(t,e*1,1),c(n)},__wbindgen_object_clone_ref:function(t){let e=o(t);return c(e)},__wbindgen_object_drop_ref:function(t){u(t)},__wbindgen_object_is_undefined:function(t){return o(t)===void 0}}}}function jt(s,t){_.__wasm_bindgen_func_elem_21334(s,t)}function zt(s,t){_.__wasm_bindgen_func_elem_23403(s,t)}function Mt(s,t){let e=_.__wasm_bindgen_func_elem_23402(s,t);return u(e)}function bt(s,t,e){_.__wasm_bindgen_func_elem_8701(s,t,c(e))}function E(s,t,e){_.__wasm_bindgen_func_elem_8702(s,t,c(e))}function qt(s,t){try{let i=_.__wbindgen_add_to_stack_pointer(-16);_.__wasm_bindgen_func_elem_8703(i,s,t);var e=a().getInt32(i+0,!0),n=a().getInt32(i+4,!0),r=a().getInt32(i+8,!0);if(r)throw u(n);return u(e)}finally{_.__wbindgen_add_to_stack_pointer(16)}}function Dt(s,t){try{let r=_.__wbindgen_add_to_stack_pointer(-16);_.__wasm_bindgen_func_elem_8699(r,s,t);var e=a().getInt32(r+0,!0),n=a().getInt32(r+4,!0);if(n)throw u(e)}finally{_.__wbindgen_add_to_stack_pointer(16)}}function Lt(s,t,e){try{_.__wasm_bindgen_func_elem_20738(s,t,ot(e))}finally{k[O++]=void 0}}function Nt(s,t,e){_.__wasm_bindgen_func_elem_21335(s,t,c(e))}function Wt(s,t,e){_.__wasm_bindgen_func_elem_27434(s,t,c(e))}function Ht(s,t,e,n){_.__wasm_bindgen_func_elem_35898(s,t,c(e),c(n))}var Bt=[\"open\",\"closed\"],Q=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>_.__wbg_client_free(s>>>0,1)),gt=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>_.__wbg_genericsqlvirtualservermodel_free(s>>>0,1)),ft=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>_.__wbg_perspectivedebugpluginelement_free(s>>>0,1)),Z=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>_.__wbg_perspectiveviewerelement_free(s>>>0,1)),tt=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>_.__wbg_proxysession_free(s>>>0,1)),dt=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>_.__wbg_table_free(s>>>0,1)),wt=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>_.__wbg_view_free(s>>>0,1)),et=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>_.__wbg_virtualdataslice_free(s>>>0,1)),lt=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>_.__wbg_virtualserver_free(s>>>0,1));function c(s){B===k.length&&k.push(k.length+1);let t=B;return B=k[t],k[t]=s,t}function rt(s,t){if(!(s instanceof t))throw new Error(`expected instance of ${t.name}`)}function ot(s){if(O==1)throw new Error(\"out of js stack\");return k[--O]=s,O}var Y=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>s.dtor(s.a,s.b));function _t(s){let t=typeof s;if(t==\"number\"||t==\"boolean\"||s==null)return`${s}`;if(t==\"string\")return`\"${s}\"`;if(t==\"symbol\"){let r=s.description;return r==null?\"Symbol\":`Symbol(${r})`}if(t==\"function\"){let r=s.name;return typeof r==\"string\"&&r.length>0?`Function(${r})`:\"Function\"}if(Array.isArray(s)){let r=s.length,i=\"[\";r>0&&(i+=_t(s[0]));for(let b=1;b<r;b++)i+=\", \"+_t(s[b]);return i+=\"]\",i}let e=/\\[object ([^\\]]+)\\]/.exec(toString.call(s)),n;if(e&&e.length>1)n=e[1];else return toString.call(s);if(n==\"Object\")try{return\"Object(\"+JSON.stringify(s)+\")\"}catch{return\"Object\"}return s instanceof Error?`${s.name}: ${s.message}\n${s.stack}`:n}function Ut(s){s<132||(k[s]=B,B=s)}function Vt(s,t){return s=s>>>0,Xt().subarray(s/4,s/4+t)}function $t(s,t){return s=s>>>0,Yt().subarray(s/8,s/8+t)}function Gt(s,t){return s=s>>>0,Kt().subarray(s/4,s/4+t)}function pt(s,t){s=s>>>0;let e=a(),n=[];for(let r=s;r<s+4*t;r+=4)n.push(u(e.getUint32(r,!0)));return n}function Jt(s,t){return s=s>>>0,Zt().subarray(s/4,s/4+t)}function T(s,t){return s=s>>>0,P().subarray(s/1,s/1+t)}function f(s,t){return s===0?o(t):Qt(s,t)}var A=null;function a(){return(A===null||A.buffer.detached===!0||A.buffer.detached===void 0&&A.buffer!==_.memory.buffer)&&(A=new DataView(_.memory.buffer)),A}var D=null;function Xt(){return(D===null||D.byteLength===0)&&(D=new Float32Array(_.memory.buffer)),D}var L=null;function Yt(){return(L===null||L.byteLength===0)&&(L=new Float64Array(_.memory.buffer)),L}var N=null;function Kt(){return(N===null||N.byteLength===0)&&(N=new Int32Array(_.memory.buffer)),N}function Qt(s,t){return s=s>>>0,re(s,t)}var W=null;function Zt(){return(W===null||W.byteLength===0)&&(W=new Uint32Array(_.memory.buffer)),W}var H=null;function P(){return(H===null||H.byteLength===0)&&(H=new Uint8Array(_.memory.buffer)),H}function o(s){return k[s]}function w(s,t){try{return s.apply(this,t)}catch(e){_.__wbindgen_export3(c(e))}}var k=new Array(128).fill(void 0);k.push(void 0,null,!0,!1);var B=k.length;function d(s){return s==null}function F(s,t,e,n){let r={a:s,b:t,cnt:1,dtor:e},i=(...b)=>{r.cnt++;try{return n(r.a,r.b,...b)}finally{i._wbg_cb_unref()}};return i._wbg_cb_unref=()=>{--r.cnt===0&&(r.dtor(r.a,r.b),r.a=0,Y.unregister(r))},Y.register(i,r,r),i}function S(s,t,e,n){let r={a:s,b:t,cnt:1,dtor:e},i=(...b)=>{r.cnt++;let g=r.a;r.a=0;try{return n(g,r.b,...b)}finally{r.a=g,i._wbg_cb_unref()}};return i._wbg_cb_unref=()=>{--r.cnt===0&&(r.dtor(r.a,r.b),r.a=0,Y.unregister(r))},Y.register(i,r,r),i}function te(s,t){let e=t(s.length*1,1)>>>0;return P().set(s,e/1),v=s.length,e}function ee(s,t){let e=t(s.length*4,4)>>>0,n=a();for(let r=0;r<s.length;r++)n.setUint32(e+4*r,c(s[r]),!0);return v=s.length,e}function m(s,t,e){if(e===void 0){let g=vt.encode(s),l=t(g.length,1)>>>0;return P().subarray(l,l+g.length).set(g),v=g.length,l}let n=s.length,r=t(n,1)>>>0,i=P(),b=0;for(;b<n;b++){let g=s.charCodeAt(b);if(g>127)break;i[r+b]=g}if(b!==n){b!==0&&(s=s.slice(b)),r=e(r,n,n=b+s.length*3,1)>>>0;let g=P().subarray(r+b,r+n),l=vt.encodeInto(s,g);b+=l.written,r=e(r,n,b,1)>>>0}return v=b,r}var O=128;function u(s){let t=o(s);return Ut(s),t}var X=new TextDecoder(\"utf-8\",{ignoreBOM:!0,fatal:!0});X.decode();var ne=2146435072,nt=0;function re(s,t){return nt+=t,nt>=ne&&(X=new TextDecoder(\"utf-8\",{ignoreBOM:!0,fatal:!0}),X.decode(),nt=t),X.decode(P().subarray(s,s+t))}var vt=new TextEncoder,v=0,_e,_;function ht(s,t){return _=s.exports,_e=t,A=null,D=null,L=null,N=null,W=null,H=null,_}async function oe(s,t){if(typeof Response==\"function\"&&s instanceof Response){if(typeof WebAssembly.instantiateStreaming==\"function\")try{return await WebAssembly.instantiateStreaming(s,t)}catch(r){if(s.ok&&e(s.type)&&s.headers.get(\"Content-Type\")!==\"application/wasm\")console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\",r);else throw r}let n=await s.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{let n=await WebAssembly.instantiate(s,t);return n instanceof WebAssembly.Instance?{instance:n,module:s}:n}function e(n){switch(n){case\"basic\":case\"cors\":case\"default\":return!0}return!1}}function ce(s){if(_!==void 0)return _;s!==void 0&&(Object.getPrototypeOf(s)===Object.prototype?{module:s}=s:console.warn(\"using deprecated parameters for `initSync()`; pass a single object instead\"));let t=mt();s instanceof WebAssembly.Module||(s=new WebAssembly.Module(s));let e=new WebAssembly.Instance(s,t);return ht(e,s)}async function yt(s){if(_!==void 0)return _;s!==void 0&&(Object.getPrototypeOf(s)===Object.prototype?{module_or_path:s}=s:console.warn(\"using deprecated parameters for the initialization function; pass a single object instead\"));let t=mt();(typeof s==\"string\"||typeof Request==\"function\"&&s instanceof Request||typeof URL==\"function\"&&s instanceof URL)&&(s=fetch(s));let{instance:e,module:n}=await oe(await s,t);return ht(e,n)}export{R as Client,U as GenericSQLVirtualServerModel,V as PerspectiveDebugPluginElement,$ as PerspectiveViewerElement,j as ProxySession,z as Table,I as View,M as VirtualDataSlice,G as VirtualServer,yt as default,Ct as getColumnConfigDefaults,At as getPluginConfigDefaults,Rt as get_wasm_module,Et as get_worker_url,Tt as init,ce as initSync,Ft as registerPlugin,Pt as setColumnConfigDefaults,Ot as setPluginConfigDefaults};\n", "\n import workerSource from \"./perspective-viewer.worker.ts\";\n let cached = null;\n export async function getWorkerURL() {\n if (cached) return cached;\n const blob = new Blob([workerSource], {\n type: \"application/javascript\",\n });\n cached = URL.createObjectURL(blob);\n return cached;\n }\n\n async function getWorkerSource() {\n return workerSource;\n }\n\n \n function run_single_threaded(workerSource) {\n console.warn(\"Running perspective in single-threaded mode\");\n const channel = new MessageChannel();\n const f = Function(\"const self = arguments[0];\" + workerSource);\n f(channel.port2);\n channel.port2.start();\n return channel.port1;\n }\n\n export async function initialize(opts) {\n const workerOpts = opts || { type: \"module\" };\n try {\n if (\n typeof window !== \"undefined\" &&\n window.location &&\n window.location.protocol &&\n window.location.protocol.startsWith(\"file\")\n ) {\n console.warn(\n \"file:// protocol does not reliably support Web Workers\"\n );\n\n return run_single_threaded(await getWorkerSource());\n }\n\n const url = await getWorkerURL();\n return new Worker(url, workerOpts);\n } catch (e) {\n console.error(\n \"Error instantiating worker; falling back to single-threaded mode\",\n e\n );\n\n return run_single_threaded(await getWorkerSource());\n }\n }\n\n\n export default getWorkerURL;\n ", "// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport type * as wasm_module_type from \"../../dist/wasm/perspective-viewer.js\";\nimport {\n init as registry_init,\n MigrateLoader,\n provide_viewer_runtime,\n resolve_migrate,\n shared_migrate,\n} from \"@perspective-dev/client/registry\";\nimport type {\n ClientRuntime,\n InitOptions,\n MigrateKind,\n MigrateResult,\n WasmRegistration,\n} from \"@perspective-dev/client/registry\";\n\n// @ts-ignore\nimport * as worker_url from \"./perspective-viewer.worker.ts\";\n\nexport type {\n InitOptions,\n WasmBinary,\n WasmRegistration,\n WasmSource,\n} from \"@perspective-dev/client/registry\";\n\n/**\n * Register Perspective's WebAssembly binaries for this page; the same function\n * as `@perspective-dev/client`'s `init()`.\n */\nexport async function init(\n wasm: WasmRegistration,\n options?: InitOptions,\n): Promise<void> {\n await registry_init(wasm, options);\n}\n\n/**\n * A WebAssembly binary in any form `init_client` accepts; thunks are only\n * invoked when the binary is needed.\n */\nexport type ViewerWasmSource =\n | Promise<Response | ArrayBuffer | Uint8Array>\n | Response\n | ArrayBuffer\n | Uint8Array\n | (() => Promise<Response | ArrayBuffer | Uint8Array>);\n\n/**\n * The `<perspective-viewer>` binary, and the `perspective-migrate` binary\n * behind `migrate()`.\n */\nexport interface ViewerWasmRegistration {\n viewer?: ViewerWasmSource;\n migrate?: ViewerWasmSource;\n}\n\nlet GLUE_OVERRIDE: typeof wasm_module_type | undefined;\n\nprovide_viewer_runtime(async (wasm) => {\n // @ts-ignore\n const url = await worker_url.getWorkerURL();\n const [glue, module] = await Promise.all([\n GLUE_OVERRIDE === undefined\n ? import(/* webpackIgnore: true */ /* @vite-ignore */ url)\n : GLUE_OVERRIDE,\n wasm instanceof WebAssembly.Module ? wasm : WebAssembly.compile(wasm),\n ]);\n\n await glue.default({ module_or_path: module });\n await glue.init(module, url);\n return { glue: glue as ClientRuntime[\"glue\"], module };\n});\n\nconst MIGRATE = new MigrateLoader();\nMIGRATE.register(resolve_migrate);\n\nfunction is_registration(\n wasm: ViewerWasmSource | ViewerWasmRegistration,\n): wasm is ViewerWasmRegistration {\n return (\n typeof wasm === \"object\" &&\n !(wasm instanceof Promise) &&\n !(wasm instanceof Response) &&\n !(wasm instanceof ArrayBuffer) &&\n !ArrayBuffer.isView(wasm)\n );\n}\n\n/**\n * Initialize `<perspective-viewer>` from its WebAssembly binary, and register\n * the `perspective-migrate` binary which `migrate()` downloads on first use;\n * a wrapper over `init()`'s `viewer` and `migrate` roles.\n *\n * # Examples\n *\n * ```javascript\n * await init_client({\n * viewer: () => fetch(\"perspective-viewer.wasm\"),\n * migrate: () => fetch(\"perspective-migrate-js.wasm\"),\n * });\n * ```\n */\nexport async function init_client(\n wasm: ViewerWasmSource | ViewerWasmRegistration,\n wasm_module?: typeof wasm_module_type,\n) {\n const registration = is_registration(wasm) ? wasm : { viewer: wasm };\n const { viewer, migrate } = registration;\n if (viewer === undefined && migrate === undefined) {\n throw new Error(\n \"init_client requires a wasm source or a {viewer, migrate} registration\",\n );\n }\n\n if (wasm_module !== undefined) {\n GLUE_OVERRIDE = wasm_module;\n }\n\n await init({ viewer, migrate });\n}\n\n/**\n * Upgrade a persisted config written by any Perspective release since 2.0.0\n * to the current schema, using the `migrate` binary registered with `init()`.\n *\n * # Arguments\n *\n * - `kind` - `\"view\"` for a `ViewConfig`, `\"viewer\"` for a `save()` token, or\n * `\"workspace\"` for a `saveWorkspace()` token.\n * - `config` - The config to upgrade.\n * - `from_version` - The release which wrote `config`, used only when it has\n * no `version` field.\n */\nexport async function migrate<T = Record<string, unknown>>(\n kind: MigrateKind,\n config: unknown,\n from_version?: string,\n): Promise<MigrateResult<T>> {\n return await shared_migrate(MIGRATE).migrate<T>(kind, config, from_version);\n}\n", "// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\n/**\n * Module for the `<perspective-viewer>` custom element. This module has no\n * (real) exports, but importing it has a side effect: the\n * `PerspectiveViewerElement` class is registered as a custom element, after\n * which it can be used as a standard DOM element.\n *\n * Though `<perspective-viewer>` is written mostly in Rust, the nature\n * of WebAssembly's compilation makes it a dynamic module; in order to\n * guarantee that the Custom Elements extension methods are registered\n * synchronously with this package's import, we need perform said registration\n * within this wrapper module. As a result, the API methods of the Custom\n * Elements are all `async` (as they must await the wasm module instance).\n *\n * The documentation in this module defines the instance structure of a\n * `<perspective-viewer>` DOM object instantiated typically, through HTML or any\n * relevent DOM method e.g. `document.createElement(\"perspective-viewer\")` or\n * `document.getElementsByTagName(\"perspective-viewer\")`.\n *\n * @module perspective-viewer\n */\n\n/// <reference lib=\"esnext.disposable\" preserve=\"true\" />\n\nimport \"regular-layout\";\n\nexport type { IPerspectiveViewerPlugin } from \"./plugin.ts\";\nexport { HTMLPerspectiveViewerPluginElement } from \"./plugin.ts\";\nexport { providers } from \"./providers.ts\";\nexport type { AgentProviderPreset } from \"./providers.ts\";\n\nexport {\n createNumberFormatter,\n createDatetimeFormatter,\n createDateFormatter,\n sourceColumn,\n} from \"./column-format.ts\";\nexport type { NumberFormatConfig, DateFormatConfig } from \"./column-format.ts\";\n\nexport type * from \"./extensions.ts\";\nexport { PerspectiveSelectDetail } from \"./select-detail.ts\";\nexport type * from \"../../dist/ts-rs/ViewerConfigUpdate.d.ts\";\nexport type * from \"../../dist/ts-rs/ViewerConfig.d.ts\";\nexport type * from \"../../dist/ts-rs/WorkspaceConfigUpdate.d.ts\";\nexport type * from \"../../dist/ts-rs/WorkspaceConfig.d.ts\";\nexport type * from \"../../dist/ts-rs/Filter.d.ts\";\nexport type * from \"../../dist/ts-rs/FilterTerm.d.ts\";\nexport type * from \"../../dist/ts-rs/FilterReducer.d.ts\";\nexport type * from \"../../dist/ts-rs/PluginStaticConfig.d.ts\";\nexport type * from \"../../dist/ts-rs/ExportMethod.d.ts\";\nexport type * from \"../../dist/ts-rs/PanelOptions.d.ts\";\nexport type * from \"../../dist/ts-rs/SaveWorkspaceOptions.d.ts\";\nexport type * from \"../../dist/ts-rs/ClientOptions.d.ts\";\nexport type * from \"../../dist/ts-rs/ExportOptions.d.ts\";\nexport type * from \"../../dist/ts-rs/GetTableOptions.d.ts\";\nexport type * from \"../../dist/ts-rs/GetClientOptions.d.ts\";\nexport type * from \"../../dist/ts-rs/GetViewOptions.d.ts\";\nexport type * from \"../../dist/ts-rs/GetViewMode.d.ts\";\n\nexport { init, init_client, migrate } from \"./bootstrap.ts\";\nexport type {\n InitOptions,\n ViewerWasmRegistration,\n ViewerWasmSource,\n WasmBinary,\n WasmRegistration,\n WasmSource,\n} from \"./bootstrap.ts\";\nexport type {\n MigrateKind,\n MigrateNotice,\n MigrateResult,\n} from \"@perspective-dev/client\";\nimport { init, init_client, migrate } from \"./bootstrap.ts\";\n\nexport default { init, init_client, migrate };\n", "// \u250F\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2513\n// \u2503 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588 \u2588 \u2588 \u2588 \u2588\u2584 \u2580\u2588\u2588\u2588 \u2588 \u2503\n// \u2503 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2584\u2584\u2584\u2584\u2584 \u2584\u2584\u2584\u2584\u2584\u2588 \u2580\u2580\u2580\u2580\u2580\u2588\u2580\u2580\u2580\u2580\u2580 \u2588 \u2580\u2580\u2580\u2580\u2580\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2584 \u2580\u2588 \u2588 \u2580\u2580\u2580\u2580\u2580 \u2503\n// \u2503 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2580\u2580\u2580\u2580 \u2588\u2580\u2588\u2588\u2580\u2580 \u2584\u2584\u2584\u2584\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2584\u2584\u2584\u2584\u2584\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2584\u2584\u2584\u2584\u2584 \u2503\n// \u2503 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2580\u2588\u2584 \u2588 \u2588\u2588\u2588\u2588\u2588\u2588 \u2588 \u2588\u2588\u2588\u258C\u2590\u2588\u2588\u2588 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2584 \u2588 \u2503\n// \u2523\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u252B\n// \u2503 Copyright (c) 2017, the Perspective Authors. \u2503\n// \u2503 \u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C\u254C \u2503\n// \u2503 This file is part of the Perspective library, distributed under the terms \u2503\n// \u2503 of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). \u2503\n// \u2517\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u251B\n\nimport perspective_viewer from \"./perspective-viewer.ts\";\nimport {\n register_default,\n resolve_package_wasm_url,\n resolve_viewer,\n} from \"@perspective-dev/client/registry\";\nexport * from \"./perspective-viewer.ts\";\n\nregister_default({\n viewer: () =>\n fetch(new URL(\"../wasm/perspective-viewer.wasm\", import.meta.url)),\n migrate: () =>\n fetch(\n resolve_package_wasm_url(\n import.meta.url,\n \"viewer\",\n \"client\",\n \"perspective-migrate-js.wasm\",\n ),\n ),\n});\n\nawait resolve_viewer();\n\nexport default perspective_viewer;\n"],
5
+ "mappings": "AAuHO,IAAMA,EAAsB,CAClC,KAAM,eACN,YAAa,aACb,MAAO,CAAC,EACR,SAAU,CAAC,CACZ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E,KAAAR,GAAM,YAAAqB,GAAa,QAAAnH,EAAQ,EClE5CuH,GAAiB,CACb,OAAQ,IACJ,MAAM,IAAI,IAAI,kCAAmC,YAAY,GAAG,CAAC,EACrE,QAAS,IACL,MACIC,GACI,YAAY,IACZ,SACA,SACA,6BACJ,CACJ,CACR,CAAC,EAED,MAAMC,GAAe,EAErB,IAAOC,GAAQpB",
6
+ "names": ["EMPTY_PANEL", "DEFAULT_PHYSICS", "dedupe_sort", "physics", "result", "pos", "dedupe_positions", "positions", "a", "b", "collect_track_positions", "panel", "orientation", "start", "end", "current", "range", "i", "size", "next", "child", "find_track_index", "value", "index", "build_cells", "colPositions", "rowPositions", "colStart", "colEnd", "rowStart", "rowEnd", "selected", "col_start", "col_end", "row_start", "row_end", "children", "sizes", "isHorizontal", "cells", "host_template", "rowTemplate", "colTemplate", "child_template", "slot", "rowPart", "colPart", "zIndex", "create_css_grid_layout", "layout", "overlay", "stacked", "tab", "createTemplate", "s", "formatGridLine", "css", "cell", "create_css_maximize_layout", "name", "VIEW_WINDOW", "calculate_intersection", "column", "row", "check_dividers", "calculate_intersection_recursive", "parent_orientation", "view_window", "path", "col_width", "row_height", "is_vertical", "position", "start_key", "end_key", "rect_dim", "current_pos", "total_size", "next_pos", "divider_threshold", "remove_child", "newChild", "c", "p", "tab_layout", "newChildren", "_", "newSizes", "remove_and_redistribute", "modified", "updated", "arr", "removed_size", "remaining_total", "proportion", "insert_child", "createChildPanel", "childId", "equal_share", "redistribute", "restPath", "newSplitPanel", "targetChild", "childOrientation", "updatedChild", "count", "total", "sum", "val", "redistribute_panel_sizes", "delta", "deltas", "add_and_redistribute", "before_total", "after_total", "viewWindowToLocalRect", "window", "box", "style", "margin", "paddingLeft", "paddingTop", "contentWidth", "contentHeight", "x", "y", "width", "height", "marginTop", "marginRight", "marginBottom", "marginLeft", "updateOverlaySheet", "drag_target", "local", "flatten", "flattenedChildren", "flattenedSizes", "childSize", "flattenedChild", "j", "calculate_path", "calculate_path_recursive", "calculate_presize_paths", "walk_layout", "parentOrientation", "viewWindow", "col", "isVertical", "startKey", "endKey", "currentPos", "totalSize", "nextPos", "childWindow", "PresizeQueue", "_target", "_eventName", "_onDispatch", "#resizing", "#queued", "#pending", "#generation", "fn", "resolve", "reject", "#drain", "queued", "entry", "batch", "generation", "last", "#dispatch", "cancelled", "error", "detail", "event", "calculate_edge", "drop_target", "insert_root_edge", "is_column_edge", "is_row_edge", "col_distance", "row_distance", "col_scale", "row_scale", "use_column", "insert_axis", "is_before", "axis_orientation", "result_path", "last_index", "new_panel", "calculate_view_window", "current_panel", "step", "offset", "OverlayController", "_host", "className", "mode", "host", "query", "drag_element", "grid_css", "overlay_css", "event_name", "custom_event", "new_layout", "RegularLayout", "_shadowRoot", "_panel", "_intended", "_stylesheet", "_cursor_stylesheet", "_drag_target", "_cursor_override", "_dimensions", "_physics", "_presizeQueue", "_overlayController", "_maximized", "_resize_observer", "coordinates", "target", "split", "tab_panel", "found", "_is_flattened", "recalculate_bounds", "localX", "localY", "childStyle", "dx", "dy", "self", "recalculate", "isFlattened", "selectors", "rect", "divider", "hit", "type", "old_col", "old_row", "CSS", "HTML_TEMPLATE", "css_string", "title_variable", "RegularLayoutFrame", "_container_sheet", "_tab_sheet", "_layout", "_header", "_default_tab", "_drag", "attr", "RegularLayoutTab", "_tab_panel", "_index", "parts", "HTMLPerspectiveViewerPluginElement", "view", "csv", "providers", "DATE_FORMAT_SHAPE_KEYS", "DATE_FORMAT_MODIFIER_KEYS", "hasDateFormatShape", "cfg", "key", "NUMERIC_LEGACY_DEFAULTS", "DATETIME_BASE", "DATE_BASE", "NUMBER_FORMAT_GROUPS", "mergeNumberOptions", "base", "explicit", "k", "v", "merged", "group", "createNumberFormatter", "defaults", "opts", "resolveDateFormat", "layers", "shape", "copy", "from", "layer", "createDatetimeFormatter", "createDateFormatter", "dateStyle", "sourceColumn", "PerspectiveSelectDetail", "column_names", "removeConfigs", "insertConfigs", "mt", "vt", "e", "t", "extract", "input", "bin", "inst", "payload", "raw_length_view", "raw_length", "ptr", "load_wasm_stage_0", "wasm", "MEMORY64_PROBE", "perspective_migrate_js_exports", "__export", "__wbg_init", "initSync", "migrate", "kind", "retptr", "ptr0", "passStringToWasm0", "len0", "WASM_VECTOR_LEN", "ptr1", "isLikeNone", "len1", "addHeapObject", "r0", "getDataViewMemory0", "r1", "r2", "takeObject", "__wbg_get_imports", "arg0", "arg1", "ret", "getStringFromWasm0", "getObject", "debugString", "obj", "handleError", "arg2", "getArrayU8FromWasm0", "heap_next", "heap", "idx", "description", "length", "debug", "builtInMatches", "dropObject", "len", "getUint8ArrayMemory0", "cachedDataViewMemory0", "decodeText", "cachedUint8ArrayMemory0", "f", "args", "arg", "malloc", "realloc", "buf", "cachedTextEncoder", "mem", "code", "cachedTextDecoder", "MAX_SAFARI_DECODE_BYTES", "numBytesDecoded", "wasmModule", "__wbg_finalize_init", "instance", "module", "__wbg_load", "imports", "expectedResponseType", "bytes", "module_or_path", "MigrateLoader", "source", "config", "from_version", "resolve_package_wasm_url", "bundle_url", "bundle_package", "wasm_package", "filename", "pattern", "rewritten", "tag", "STATE_KEY", "WASM_KEYS", "SERVER_KEYS", "is_server_key", "states", "global", "state", "all", "assert_single_version", "others", "version", "materialize", "disable_stage_0", "start_viewer", "runtime", "register", "options", "unknown", "keys", "has_server", "servers", "init", "register_default", "provide_viewer_runtime", "provider", "resolve_viewer", "viewer", "resolve_migrate", "shared_migrate", "perspective_viewer_default", "cached", "getWorkerURL", "blob", "ge", "GLUE_OVERRIDE", "ye", "url", "glue", "MIGRATE", "T", "Me", "is_registration", "init_client", "wasm_module", "registration", "Re", "we", "ie", "Ae", "perspective_viewer_cdn_default"]
7
7
  }