@perspective-dev/viewer 5.9.1 → 5.9.2

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 (55) hide show
  1. package/dist/cdn/perspective-viewer.js +8 -8
  2. package/dist/cdn/perspective-viewer.js.map +4 -4
  3. package/dist/css/blueprint.css +1 -1
  4. package/dist/css/botanical.css +1 -1
  5. package/dist/css/dracula.css +1 -1
  6. package/dist/css/eggplant.css +1 -1
  7. package/dist/css/gruvbox-dark.css +1 -1
  8. package/dist/css/gruvbox.css +1 -1
  9. package/dist/css/intl/ar.css +1 -1
  10. package/dist/css/intl/de.css +1 -1
  11. package/dist/css/intl/es.css +1 -1
  12. package/dist/css/intl/fr.css +1 -1
  13. package/dist/css/intl/ja.css +1 -1
  14. package/dist/css/intl/pt.css +1 -1
  15. package/dist/css/intl/zh.css +1 -1
  16. package/dist/css/intl.css +1 -1
  17. package/dist/css/ledger.css +1 -1
  18. package/dist/css/monokai.css +1 -1
  19. package/dist/css/nord.css +1 -1
  20. package/dist/css/phosphor.css +1 -1
  21. package/dist/css/pro-dark.css +1 -1
  22. package/dist/css/pro-light.css +1 -1
  23. package/dist/css/pro.css +1 -1
  24. package/dist/css/solarized-dark.css +1 -1
  25. package/dist/css/solarized.css +1 -1
  26. package/dist/css/themes.css +1 -1
  27. package/dist/css/vaporwave.css +1 -1
  28. package/dist/css/velvet.css +1 -1
  29. package/dist/custom-elements.json +234 -5
  30. package/dist/docs/perspective-docs.json +1 -1
  31. package/dist/esm/extensions.d.ts +11 -1
  32. package/dist/esm/perspective-viewer.d.ts +6 -0
  33. package/dist/esm/perspective-viewer.js +139 -127
  34. package/dist/esm/perspective-viewer.js.map +4 -4
  35. package/dist/esm/plugin.d.ts +7 -0
  36. package/dist/ts-rs/CommandLocation.d.ts +6 -0
  37. package/dist/ts-rs/CommandSchema.d.ts +7 -0
  38. package/dist/ts-rs/CommandSchemaOptions.d.ts +12 -0
  39. package/dist/ts-rs/CommandSpec.d.ts +10 -0
  40. package/dist/ts-rs/PerspectiveHit.d.ts +41 -0
  41. package/dist/ts-rs/PerspectiveHitKind.d.ts +6 -0
  42. package/dist/ts-rs/PerspectiveHitRef.d.ts +7 -0
  43. package/dist/ts-rs/ViewConfigUpdate.d.ts +111 -0
  44. package/dist/wasm/perspective-viewer.d.ts +197 -22
  45. package/dist/wasm/perspective-viewer.js +324 -132
  46. package/dist/wasm/perspective-viewer.wasm +0 -0
  47. package/dist/wasm/perspective-viewer.wasm.d.ts +20 -16
  48. package/dist/wasm/snippets/perspective-viewer-37c88b7aebc72452/inline3.js +8 -0
  49. package/package.json +8 -6
  50. package/dist/wasm/snippets/perspective-viewer-659c02666b5f5853/inline1.js +0 -1
  51. /package/dist/wasm/snippets/{perspective-viewer-659c02666b5f5853 → perspective-viewer-37c88b7aebc72452}/inline0.js +0 -0
  52. /package/dist/wasm/snippets/{perspective-viewer-659c02666b5f5853/inline2.js → perspective-viewer-37c88b7aebc72452/inline1.js} +0 -0
  53. /package/dist/wasm/snippets/{perspective-viewer-659c02666b5f5853/inline3.js → perspective-viewer-37c88b7aebc72452/inline2.js} +0 -0
  54. /package/dist/wasm/snippets/{perspective-viewer-659c02666b5f5853 → perspective-viewer-37c88b7aebc72452}/inline4.js +0 -0
  55. /package/dist/wasm/snippets/{perspective-viewer-659c02666b5f5853 → perspective-viewer-37c88b7aebc72452}/inline5.js +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../../node_modules/.pnpm/regular-layout@0.8.0/node_modules/regular-layout/src/core/types.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.0/node_modules/regular-layout/src/core/constants.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.0/node_modules/regular-layout/src/layout/generate_grid.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.0/node_modules/regular-layout/src/layout/calculate_intersect.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.0/node_modules/regular-layout/src/layout/remove_child.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.0/node_modules/regular-layout/src/layout/insert_child.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.0/node_modules/regular-layout/src/layout/redistribute_panel_sizes.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.0/node_modules/regular-layout/src/layout/generate_overlay.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.0/node_modules/regular-layout/src/layout/flatten.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.0/node_modules/regular-layout/src/layout/calculate_path.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.0/node_modules/regular-layout/src/layout/calculate_presize_paths.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.0/node_modules/regular-layout/src/model/presize_queue.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.0/node_modules/regular-layout/src/layout/calculate_edge.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.0/node_modules/regular-layout/src/model/overlay_controller.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.0/node_modules/regular-layout/src/regular-layout.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.0/node_modules/regular-layout/src/regular-layout-frame.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.0/node_modules/regular-layout/src/regular-layout-tab.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.0/node_modules/regular-layout/src/define.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.0/node_modules/regular-layout/src/index.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", "../../../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;flex-shrink:0;user-select:none;overflow:hidden}\n[part~=\"container\"]{flex:1 1 auto;min-height:0;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 { RegularLayoutTab } from \"./regular-layout-tab.ts\";\n\n/**\n * The custom elements this library provides, by tag name. The tag names are\n * fixed - `<regular-layout-frame>` renders a `<regular-layout-tab>` - so they\n * must be registered together.\n */\nconst ELEMENTS = [\n\t[\"regular-layout\", RegularLayout],\n\t[\"regular-layout-frame\", RegularLayoutFrame],\n\t[\"regular-layout-tab\", RegularLayoutTab],\n] as const;\n\n/**\n * Registers `<regular-layout>`, `<regular-layout-frame>` and\n * `<regular-layout-tab>` with `registry`.\n *\n * Idempotent: a tag name which is already defined is skipped rather than\n * throwing, so this is safe to call more than once, or when another copy of\n * this library has already registered these elements (in which case that\n * copy's classes are the ones in use).\n *\n * @param registry - The registry to define the elements in, defaults to the\n * global `customElements`.\n */\nexport function defineCustomElements(\n\tregistry: CustomElementRegistry = customElements,\n): void {\n\tfor (const [name, element] of ELEMENTS) {\n\t\tif (!registry.get(name)) {\n\t\t\tregistry.define(name, element);\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 * Regular Layout - Resizable Panel Layout System\n *\n * A Web Component library for creating resizable, re-arrangeable layouts using\n * CSS `grid`.\n *\n * ## Basic Usage\n *\n * ```html\n * <regular-layout>\n * <regular-layout-frame name=\"sidebar\">Sidebar content</regular-layout-frame>\n * <regular-layout-frame name=\"main\">Main content</regular-layout-frame>\n * </regular-layout>\n * ```\n *\n * ```typescript\n * import { RegularLayout } from 'regular-layout';\n *\n * const layout = document.querySelector('regular-layout');\n *\n * // Insert panels into the grid layout.\n * layout.insertPanel('sidebar', [0]);\n * layout.insertPanel('main', [1]);\n *\n * // Remove a panel (DOM child remains connected, but not slotted).\n * layout.removePanel('sidebar');\n *\n * // Save current layout state.\n * const state = layout.save();\n * localStorage.setItem('layout', JSON.stringify(state));\n *\n * // Restore layout later.\n * const savedState = JSON.parse(localStorage.getItem('layout'));\n * layout.restore(savedState);\n * ```\n *\n * Importing this module registers the custom elements (skipping any tag name\n * which is already defined). To register them yourself instead, import from\n * `regular-layout/components` and call {@link defineCustomElements}.\n *\n * ## Core Components\n *\n * - {@link RegularLayout}: The main `<regular-layout>` custom element.\n * - {@link RegularLayoutFrame}: Optional frame component with titlebar support.\n *\n * ## Type Definitions\n *\n * - {@link Layout}: The layout tree structure for panel configuration.\n * - {@link LayoutPath}: Information about a panel's position and viewport.\n * - {@link LayoutDivider}: Information about a resizable divider.\n *\n * @packageDocumentation\n */\n\nexport * from \"./components.ts\";\n\n// Side effects\nimport { defineCustomElements } from \"./define.ts\";\ndefineCustomElements();\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.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\n/**\n * Check that a config is valid for the current schema without migrating it,\n * where `strict` requires the complete `save()` form.\n * @param {string} kind\n * @param {any} value\n * @param {boolean | null} [strict]\n */\nexport function validate_config(kind, value, strict) {\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 wasm.validate_config(retptr, ptr0, len0, addHeapObject(value), isLikeNone(strict) ? 0xFFFFFF : strict ? 1 : 0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n if (r1) {\n throw takeObject(r0);\n }\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.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\";\n\n/**\n * The kind of persisted config `migrate()` upgrades: an engine `ViewConfig`,\n * a `<perspective-viewer>` `save()` token, one workspace panel, or a\n * `saveWorkspace()` token.\n */\nexport type MigrateKind = \"view\" | \"viewer\" | \"panel\" | \"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\n/**\n * Synchronous `migrate()` and `validate()` over an instantiated\n * `perspective-migrate` binary, from `create_validator()`.\n */\nexport interface Validator {\n /**\n * Upgrade a persisted config written by any Perspective release since\n * 2.0.0 to the current schema.\n *\n * # Arguments\n *\n * - `kind` - `\"view\"` for a `ViewConfig`, `\"viewer\"` for a `save()`\n * token, `\"panel\"` for one workspace panel, or `\"workspace\"` for a\n * `saveWorkspace()` token.\n * - `config` - The config to upgrade.\n * - `from_version` - The release which wrote `config`, used only when it\n * has no `version` field.\n */\n migrate<T = Record<string, unknown>>(\n kind: MigrateKind,\n config: unknown,\n from_version?: string,\n ): MigrateResult<T>;\n\n /**\n * Check that a config is valid for this release without migrating it,\n * throwing the offending JSON pointer and reason otherwise.\n *\n * # Arguments\n *\n * - `kind` - `\"view\"`, `\"viewer\"`, `\"panel\"` or `\"workspace\"`.\n * - `config` - The config to check.\n * - `options.strict` - Require the complete `save()` form rather than the\n * field-wise `restore()` update form.\n */\n validate(\n kind: MigrateKind,\n config: unknown,\n options?: { strict?: boolean },\n ): void;\n}\n\n/**\n * Instantiate the `perspective-migrate` binary and wrap its exports as a\n * `Validator`.\n */\nexport async function load_validator(\n binary: BufferSource | WebAssembly.Module,\n): Promise<Validator> {\n await migrate_wasm.default({ module_or_path: binary });\n return {\n migrate<T>(kind: MigrateKind, config: unknown, from_version?: string) {\n return migrate_wasm.migrate(\n kind,\n from_version,\n config,\n ) as MigrateResult<T>;\n },\n validate(kind, config, options) {\n migrate_wasm.validate_config(kind, config, options?.strict);\n },\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 { load_validator } from \"./migrate.ts\";\nimport type { Validator } from \"./migrate.ts\";\n\nexport type {\n MigrateKind,\n MigrateNotice,\n MigrateResult,\n Validator,\n} 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\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 warned_duplicates?: 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 validator?: Promise<Validator>;\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 const duplicates: WasmKey[] = [];\n for (const key of keys) {\n if (s.consumed.has(key)) {\n // A module which calls `init()` at module scope may be\n // evaluated more than once per page (anywidget evaluates a\n // widget's `_esm` once per widget model, each evaluation a\n // fresh module instance over the page-wide registry).\n // Re-registering a key whose runtime already exists then\n // resolves to that runtime instead of throwing, in `user`\n // mode only \u2014 `replace_server` (`init_server()`) still\n // throws, as replacing a consumed engine remains an error.\n if (mode === \"user\" && s.sources[key] !== undefined) {\n duplicates.push(key);\n continue;\n }\n\n throw new Error(`${key} wasm is already initialized`);\n }\n }\n\n if (duplicates.length > 0) {\n keys = keys.filter((key) => !duplicates.includes(key));\n s.warned_duplicates ??= new Set();\n const un_warned = duplicates.filter(\n (key) => !s.warned_duplicates!.has(key),\n );\n\n if (un_warned.length > 0) {\n for (const key of un_warned) {\n s.warned_duplicates!.add(key);\n }\n\n console.warn(\n `${un_warned.join(\", \")} wasm is already initialized; keeping the existing runtime (Perspective was loaded more than once on this page).`,\n );\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 * Re-registering a key whose runtime already exists (e.g. a second module\n * evaluation of the same bundle, as anywidget does per widget model) keeps\n * the existing runtime and resolves rather than throwing; `init_server()`'s\n * replacement mode still throws for a consumed key.\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.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.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 `Validator`, instantiated from the registered `migrate`\n * binary on the first call.\n */\nexport function shared_validator(): Promise<Validator> {\n const s = state();\n if (s.validator === undefined) {\n const validator = resolve_migrate().then(load_validator);\n validator.catch(() => {\n if (s.validator === validator) {\n s.validator = undefined;\n }\n });\n\n s.validator = validator;\n }\n\n return s.validator;\n}\n", "var St=Object.defineProperty;var Ct=(s,t)=>{for(var e in t)St(s,e,{get:t[e],enumerable:!0})};var X={};Ct(X,{Client:()=>F,GenericSQLVirtualServerModel:()=>V,PerspectiveDebugPluginElement:()=>$,PerspectiveViewerElement:()=>G,ProxySession:()=>j,Table:()=>z,View:()=>I,VirtualDataSlice:()=>q,VirtualServer:()=>J,default:()=>xt,getColumnConfigDefaults:()=>At,getPluginConfigDefaults:()=>Ft,get_wasm_module:()=>Rt,get_worker_url:()=>Et,init:()=>Tt,initSync:()=>ce,registerPlugin:()=>Pt,setColumnConfigDefaults:()=>Ot,setPluginConfigDefaults:()=>jt});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 g extends HTMLElement{constructor(){super(),this._instance=new r(this)}}let b=Object.getOwnPropertyNames(i);for(let w of b)\"get\"in Object.getOwnPropertyDescriptor(i,w)?Object.defineProperty(g.prototype,w,{get:function(){return this._instance[w]}}):Object.defineProperty(g.prototype,w,{value:function(...p){return this._instance[w].call(this._instance,...p)}});for(let w of n)Object.defineProperty(g,w,{value:function(...p){return s[w].call(s,...p)}});customElements.define(t,g)}var F=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),g=v,b=_.client_join(this.__wbg_ptr,c(t),c(e),i,g,d(r)?0:c(r));return u(b)}constructor(t,e){try{let g=_.__wbindgen_add_to_stack_pointer(-16);_.client_new(g,c(t),d(e)?0:c(e));var n=a().getInt32(g+0,!0),r=a().getInt32(g+4,!0),i=a().getInt32(g+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&&(F.prototype[Symbol.dispose]=F.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();_.__wbg_genericsqlvirtualservermodel_free(t,0)}expressionDescribe(t,e){try{let w=_.__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(w,this.__wbg_ptr,p,h,y,x);var n=a().getInt32(w+0,!0),r=a().getInt32(w+4,!0),i=a().getInt32(w+8,!0),g=a().getInt32(w+12,!0);if(g)throw u(i);var b=f(n,r);return n!==0&&_.__wbindgen_export4(n,r,1),b}finally{_.__wbindgen_add_to_stack_pointer(16)}}expressionsDescribe(t,e){try{let w=_.__wbindgen_add_to_stack_pointer(-16),p=m(t,_.__wbindgen_export,_.__wbindgen_export2),h=v;_.genericsqlvirtualservermodel_expressionsDescribe(w,this.__wbg_ptr,p,h,c(e));var n=a().getInt32(w+0,!0),r=a().getInt32(w+4,!0),i=a().getInt32(w+8,!0),g=a().getInt32(w+12,!0);if(g)throw u(i);var b=f(n,r);return n!==0&&_.__wbindgen_export4(n,r,1),b}finally{_.__wbindgen_add_to_stack_pointer(16)}}getHostedTables(){try{let g=_.__wbindgen_add_to_stack_pointer(-16);_.genericsqlvirtualservermodel_getHostedTables(g,this.__wbg_ptr);var t=a().getInt32(g+0,!0),e=a().getInt32(g+4,!0),n=a().getInt32(g+8,!0),r=a().getInt32(g+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)}}quoteEntity(t){try{let b=_.__wbindgen_add_to_stack_pointer(-16),w=m(t,_.__wbindgen_export,_.__wbindgen_export2),p=v;_.genericsqlvirtualservermodel_quoteEntity(b,this.__wbg_ptr,w,p);var e=a().getInt32(b+0,!0),n=a().getInt32(b+4,!0),r=a().getInt32(b+8,!0),i=a().getInt32(b+12,!0);if(i)throw u(r);var g=f(e,n);return e!==0&&_.__wbindgen_export4(e,n,1),g}finally{_.__wbindgen_add_to_stack_pointer(16)}}tableDescribe(t,e,n,r){try{let h=_.__wbindgen_add_to_stack_pointer(-16),y=m(t,_.__wbindgen_export,_.__wbindgen_export2),x=v;_.genericsqlvirtualservermodel_tableDescribe(h,this.__wbg_ptr,y,x,c(e),c(n),d(r)?16777215:r?1:0);var i=a().getInt32(h+0,!0),g=a().getInt32(h+4,!0),b=a().getInt32(h+8,!0),w=a().getInt32(h+12,!0);if(w)throw u(b);var p=f(i,g);return i!==0&&_.__wbindgen_export4(i,g,1),p}finally{_.__wbindgen_add_to_stack_pointer(16)}}tableMakeView(t,e,n,r,i){try{let y=_.__wbindgen_add_to_stack_pointer(-16),x=m(t,_.__wbindgen_export,_.__wbindgen_export2),C=v,M=m(e,_.__wbindgen_export,_.__wbindgen_export2),D=v;_.genericsqlvirtualservermodel_tableMakeView(y,this.__wbg_ptr,x,C,M,D,c(n),c(r),d(i)?16777215:i?1:0);var g=a().getInt32(y+0,!0),b=a().getInt32(y+4,!0),w=a().getInt32(y+8,!0),p=a().getInt32(y+12,!0);if(p)throw u(w);var h=f(g,b);return g!==0&&_.__wbindgen_export4(g,b,1),h}finally{_.__wbindgen_add_to_stack_pointer(16)}}tablePath(t){try{let b=_.__wbindgen_add_to_stack_pointer(-16),w=ht(t,_.__wbindgen_export),p=v;_.genericsqlvirtualservermodel_tablePath(b,this.__wbg_ptr,w,p);var e=a().getInt32(b+0,!0),n=a().getInt32(b+4,!0),r=a().getInt32(b+8,!0),i=a().getInt32(b+12,!0);if(i)throw u(r);var g=f(e,n);return e!==0&&_.__wbindgen_export4(e,n,1),g}finally{_.__wbindgen_add_to_stack_pointer(16)}}tableSchema(t){try{let b=_.__wbindgen_add_to_stack_pointer(-16),w=m(t,_.__wbindgen_export,_.__wbindgen_export2),p=v;_.genericsqlvirtualservermodel_tableSchema(b,this.__wbg_ptr,w,p);var e=a().getInt32(b+0,!0),n=a().getInt32(b+4,!0),r=a().getInt32(b+8,!0),i=a().getInt32(b+12,!0);if(i)throw u(r);var g=f(e,n);return e!==0&&_.__wbindgen_export4(e,n,1),g}finally{_.__wbindgen_add_to_stack_pointer(16)}}tableSize(t){try{let b=_.__wbindgen_add_to_stack_pointer(-16),w=m(t,_.__wbindgen_export,_.__wbindgen_export2),p=v;_.genericsqlvirtualservermodel_tableSize(b,this.__wbg_ptr,w,p);var e=a().getInt32(b+0,!0),n=a().getInt32(b+4,!0),r=a().getInt32(b+8,!0),i=a().getInt32(b+12,!0);if(i)throw u(r);var g=f(e,n);return e!==0&&_.__wbindgen_export4(e,n,1),g}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),g=a().getInt32(p+8,!0),b=a().getInt32(p+12,!0);if(b)throw u(g);var w=f(r,i);return r!==0&&_.__wbindgen_export4(r,i,1),w}finally{_.__wbindgen_add_to_stack_pointer(16)}}viewColumnSize(t){try{let b=_.__wbindgen_add_to_stack_pointer(-16),w=m(t,_.__wbindgen_export,_.__wbindgen_export2),p=v;_.genericsqlvirtualservermodel_viewColumnSize(b,this.__wbg_ptr,w,p);var e=a().getInt32(b+0,!0),n=a().getInt32(b+4,!0),r=a().getInt32(b+8,!0),i=a().getInt32(b+12,!0);if(i)throw u(r);var g=f(e,n);return e!==0&&_.__wbindgen_export4(e,n,1),g}finally{_.__wbindgen_add_to_stack_pointer(16)}}viewDelete(t){try{let b=_.__wbindgen_add_to_stack_pointer(-16),w=m(t,_.__wbindgen_export,_.__wbindgen_export2),p=v;_.genericsqlvirtualservermodel_viewDelete(b,this.__wbg_ptr,w,p);var e=a().getInt32(b+0,!0),n=a().getInt32(b+4,!0),r=a().getInt32(b+8,!0),i=a().getInt32(b+12,!0);if(i)throw u(r);var g=f(e,n);return e!==0&&_.__wbindgen_export4(e,n,1),g}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),g=a().getInt32(p+8,!0),b=a().getInt32(p+12,!0);if(b)throw u(g);var w=f(r,i);return r!==0&&_.__wbindgen_export4(r,i,1),w}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),g=a().getInt32(h+4,!0),b=a().getInt32(h+8,!0),w=a().getInt32(h+12,!0);if(w)throw u(b);var p=f(i,g);return i!==0&&_.__wbindgen_export4(i,g,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),g=a().getInt32(p+8,!0),b=a().getInt32(p+12,!0);if(b)throw u(g);var w=f(r,i);return r!==0&&_.__wbindgen_export4(r,i,1),w}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,M=m(e,_.__wbindgen_export,_.__wbindgen_export2),D=v;_.genericsqlvirtualservermodel_viewMakeTable(y,this.__wbg_ptr,x,C,M,D,c(n),c(r),c(i));var g=a().getInt32(y+0,!0),b=a().getInt32(y+4,!0),w=a().getInt32(y+8,!0),p=a().getInt32(y+12,!0);if(p)throw u(w);var h=f(g,b);return g!==0&&_.__wbindgen_export4(g,b,1),h}finally{_.__wbindgen_add_to_stack_pointer(16)}}viewSchema(t){try{let b=_.__wbindgen_add_to_stack_pointer(-16),w=m(t,_.__wbindgen_export,_.__wbindgen_export2),p=v;_.genericsqlvirtualservermodel_viewSchema(b,this.__wbg_ptr,w,p);var e=a().getInt32(b+0,!0),n=a().getInt32(b+4,!0),r=a().getInt32(b+8,!0),i=a().getInt32(b+12,!0);if(i)throw u(r);var g=f(e,n);return e!==0&&_.__wbindgen_export4(e,n,1),g}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),g=a().getInt32(p+8,!0),b=a().getInt32(p+12,!0);if(b)throw u(g);var w=f(r,i);return r!==0&&_.__wbindgen_export4(r,i,1),w}finally{_.__wbindgen_add_to_stack_pointer(16)}}viewSize(t){try{let b=_.__wbindgen_add_to_stack_pointer(-16),w=m(t,_.__wbindgen_export,_.__wbindgen_export2),p=v;_.genericsqlvirtualservermodel_viewSize(b,this.__wbg_ptr,w,p);var e=a().getInt32(b+0,!0),n=a().getInt32(b+4,!0),r=a().getInt32(b+8,!0),i=a().getInt32(b+12,!0);if(i)throw u(r);var g=f(e,n);return e!==0&&_.__wbindgen_export4(e,n,1),g}finally{_.__wbindgen_add_to_stack_pointer(16)}}};Symbol.dispose&&(V.prototype[Symbol.dispose]=V.prototype.free);var $=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){_t(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){_t(t,I);let e=_.perspectivedebugpluginelement_update(this.__wbg_ptr,t.__wbg_ptr);return u(e)}};Symbol.dispose&&($.prototype[Symbol.dispose]=$.prototype.free);var G=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 b=_.__wbindgen_add_to_stack_pointer(-16);var e=d(t)?0:m(t,_.__wbindgen_export,_.__wbindgen_export2),n=v;_.perspectiveviewerelement_getPlugin(b,this.__wbg_ptr,e,n);var r=a().getInt32(b+0,!0),i=a().getInt32(b+4,!0),g=a().getInt32(b+8,!0);if(g)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:ht(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&&(G.prototype[Symbol.dispose]=G.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{_t(t,F);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 q=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 b=_.__wbindgen_add_to_stack_pointer(-16),w=m(t,_.__wbindgen_export,_.__wbindgen_export2),p=v;_.virtualdataslice_setBooleanCol(b,this.__wbg_ptr,w,p,e,c(n),d(r)?4294967297:r>>>0);var i=a().getInt32(b+0,!0),g=a().getInt32(b+4,!0);if(g)throw u(i)}finally{_.__wbindgen_add_to_stack_pointer(16)}}setCol(t,e,n,r,i){try{let w=_.__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(w,this.__wbg_ptr,p,h,y,x,n,c(r),d(i)?4294967297:i>>>0);var g=a().getInt32(w+0,!0),b=a().getInt32(w+4,!0);if(b)throw u(g)}finally{_.__wbindgen_add_to_stack_pointer(16)}}setDatetimeCol(t,e,n,r){try{let b=_.__wbindgen_add_to_stack_pointer(-16),w=m(t,_.__wbindgen_export,_.__wbindgen_export2),p=v;_.virtualdataslice_setDatetimeCol(b,this.__wbg_ptr,w,p,e,c(n),d(r)?4294967297:r>>>0);var i=a().getInt32(b+0,!0),g=a().getInt32(b+4,!0);if(g)throw u(i)}finally{_.__wbindgen_add_to_stack_pointer(16)}}setFloatCol(t,e,n,r){try{let b=_.__wbindgen_add_to_stack_pointer(-16),w=m(t,_.__wbindgen_export,_.__wbindgen_export2),p=v;_.virtualdataslice_setFloatCol(b,this.__wbg_ptr,w,p,e,c(n),d(r)?4294967297:r>>>0);var i=a().getInt32(b+0,!0),g=a().getInt32(b+4,!0);if(g)throw u(i)}finally{_.__wbindgen_add_to_stack_pointer(16)}}setIntegerCol(t,e,n,r){try{let b=_.__wbindgen_add_to_stack_pointer(-16),w=m(t,_.__wbindgen_export,_.__wbindgen_export2),p=v;_.virtualdataslice_setIntegerCol(b,this.__wbg_ptr,w,p,e,c(n),d(r)?4294967297:r>>>0);var i=a().getInt32(b+0,!0),g=a().getInt32(b+4,!0);if(g)throw u(i)}finally{_.__wbindgen_add_to_stack_pointer(16)}}setStringCol(t,e,n,r){try{let b=_.__wbindgen_add_to_stack_pointer(-16),w=m(t,_.__wbindgen_export,_.__wbindgen_export2),p=v;_.virtualdataslice_setStringCol(b,this.__wbg_ptr,w,p,e,c(n),d(r)?4294967297:r>>>0);var i=a().getInt32(b+0,!0),g=a().getInt32(b+4,!0);if(g)throw u(i)}finally{_.__wbindgen_add_to_stack_pointer(16)}}};Symbol.dispose&&(q.prototype[Symbol.dispose]=q.prototype.free);var J=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=ee(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&&(J.prototype[Symbol.dispose]=J.prototype.free);function At(){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 Ft(){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 Pt(s){let t=m(s,_.__wbindgen_export,_.__wbindgen_export2),e=v;_.registerPlugin(t,e)}function Ot(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 jt(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=rt(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),g=v;a().setInt32(t+4,g,!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 l(function(t,e,n,r){var i=f(e,n);o(t).addEventListener(i,o(r))},arguments)},__wbg_addEventListener_5ef04ffb1d3af066:function(){return l(function(t,e,n,r,i){var g=f(e,n);o(t).addEventListener(g,o(r),i!==0)},arguments)},__wbg_addEventListener_c917b5aafbcf493f:function(){return l(function(t,e,n,r,i){var g=f(e,n);o(t).addEventListener(g,o(r),o(i))},arguments)},__wbg_add_2b0552fe2d2151c8:function(t,e){let n=o(t).add(o(e));return c(n)},__wbg_add_5be83378df680c25:function(){return l(function(t,e,n){var r=f(e,n);o(t).add(r)},arguments)},__wbg_adoptedStyleSheets_542d651fbb47685f:function(t){let e=o(t).adoptedStyleSheets;return c(e)},__wbg_adoptedStyleSheets_d149afb005470855:function(t){let e=o(t).adoptedStyleSheets;return c(e)},__wbg_appendChild_dea38765a26d346d:function(){return l(function(t,e){let n=o(t).appendChild(o(e));return c(n)},arguments)},__wbg_append_a992ccc37aa62dc4:function(){return l(function(t,e,n,r,i){var g=f(e,n),b=f(r,i);o(t).append(g,b)},arguments)},__wbg_apply_2e22c45cb4f12415:function(){return l(function(t,e,n){let r=Reflect.apply(o(t),o(e),o(n));return c(r)},arguments)},__wbg_apply_ada2ee1a60ac7b3c:function(){return l(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 l(function(t,e){let n=o(t).attachShadow(o(e));return c(n)},arguments)},__wbg_blur_07f34335e06e5234:function(){return l(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_382b986e1e31efbf:function(t,e,n,r,i,g){var b=f(e,n),w=f(r,i);let p=ut(o(t),b,w,u(g));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_0a072c9a23a43daa:function(t,e,n){var r=f(e,n);let i=o(t).calculatePath(r);return c(i)},__wbg_calculatePresizePaths_fa3995a71a662898:function(t){let e=o(t).calculatePresizePaths();return c(e)},__wbg_call_389efe28435a9388:function(){return l(function(t,e){let n=o(t).call(o(e));return c(n)},arguments)},__wbg_call_41bedb84c3e5c0c9:function(){return l(function(t,e,n,r,i,g){let b=o(t).call(o(e),o(n),o(r),o(i),o(g));return c(b)},arguments)},__wbg_call_4708e0c13bdc8e95:function(){return l(function(t,e,n){let r=o(t).call(o(e),o(n));return c(r)},arguments)},__wbg_call_812d25f1510c13c8:function(){return l(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_415b70bc7390fe71:function(){return l(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=F.__wrap(t);return c(e)},__wbg_clipboard_98c5a32249fa8416:function(t){let e=o(t).clipboard;return c(e)},__wbg_cloneNode_b85e9102a9a31b29:function(){return l(function(t,e){let n=o(t).cloneNode(e!==0);return c(n)},arguments)},__wbg_cloneNode_eaf4ea08ebf633a5:function(){return l(function(t){let e=o(t).cloneNode();return c(e)},arguments)},__wbg_closest_11206fe6e0fb4e4e:function(){return l(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_123797d92fc5d02e:function(){return l(function(t,e,n,r,i,g,b,w,p,h,y,x){var C=f(e,n),M=f(r,i),D=f(g,b),It=f(y,x);let kt=o(t).column_config_schema(C,M,D,o(w),o(p),o(h),It);return c(kt)},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_30aba4f21fe5367d:function(t){let e=o(t).contentRect;return c(e)},__wbg_createElementNS_ee00621496b30ec2:function(){return l(function(t,e,n,r,i){var g=f(e,n),b=f(r,i);let w=o(t).createElementNS(g,b);return c(w)},arguments)},__wbg_createElement_49f60fdcaae809c8:function(){return l(function(t,e,n){var r=f(e,n);let i=o(t).createElement(r);return c(i)},arguments)},__wbg_createObjectURL_918185db6a10a0c8:function(){return l(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 l(function(t){let e=o(t).cssRules;return c(e)},arguments)},__wbg_cssRules_85954e7c284ec53b:function(t){let e=o(t).cssRules;return c(e)},__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 l(function(t,e,n,r,i){let g=o(e).decode(E(n,r),o(i)),b=m(g,_.__wbindgen_export,_.__wbindgen_export2),w=v;a().setInt32(t+4,w,!0),a().setInt32(t+0,b,!0)},arguments)},__wbg_define_panel_tab_2bc1f3573e6b42f3: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_87659bc186749cfd:function(t){o(t).delete()},__wbg_deselect_1481e7f99212145c:function(){return l(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 l(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_c5e550a8b957a600:function(){return l(function(t,e,n,r,i){let g=o(t).draw(I.__wrap(e),n===4294967297?void 0:n,r===4294967297?void 0:r,i!==0);return c(g)},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 l(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 g=o(e).getAttribute(i);var b=d(g)?0:m(g,_.__wbindgen_export,_.__wbindgen_export2),w=v;a().setInt32(t+4,w,!0),a().setInt32(t+0,b,!0)},__wbg_getBoundingClientRect_b5c8c34d07878818:function(t){let e=o(t).getBoundingClientRect();return c(e)},__wbg_getComputedStyle_2d1f9dfe4ee7e0b9:function(){return l(function(t,e){let n=o(t).getComputedStyle(o(e));return d(n)?0:c(n)},arguments)},__wbg_getContext_2a5764d48600bc43:function(){return l(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 g=f(e,n),b=f(r,i);let w=o(t).getEntriesByName(g,b);return c(w)},__wbg_getPropertyValue_d6911b2a1f9acba9:function(){return l(function(t,e,n,r){var i=f(n,r);let g=o(e).getPropertyValue(i),b=m(g,_.__wbindgen_export,_.__wbindgen_export2),w=v;a().setInt32(t+4,w,!0),a().setInt32(t+0,b,!0)},arguments)},__wbg_getRandomValues_1c61fac11405ffdc:function(){return l(function(t,e){globalThis.crypto.getRandomValues(E(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 l(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 g=o(e)[i];var b=d(g)?0:m(g,_.__wbindgen_export,_.__wbindgen_export2),w=v;a().setInt32(t+4,w,!0),a().setInt32(t+0,b,!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 l(function(t,e,n,r){var i=f(n,r);let g=o(e).get(i);var b=d(g)?0:m(g,_.__wbindgen_export,_.__wbindgen_export2),w=v;a().setInt32(t+4,w,!0),a().setInt32(t+0,b,!0)},arguments)},__wbg_get_9b94d73e6221f75c:function(t,e){let n=o(t)[e>>>0];return c(n)},__wbg_get_b3ed3ad4be2bc8ac:function(){return l(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_4452769300e9cd96: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_991efccb5a701a27:function(t,e){return o(t).has(o(e))},__wbg_has_d4e53238966c12b6:function(){return l(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 l(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 l(function(t){let e=o(t).innerHeight;return c(e)},arguments)},__wbg_innerWidth_fa95c57321f4f033:function(){return l(function(t){let e=o(t).innerWidth;return c(e)},arguments)},__wbg_insertBefore_1468142836e61a51:function(){return l(function(t,e,n){let r=o(t).insertBefore(o(e),o(n));return c(r)},arguments)},__wbg_insertPanel_b7d65453e106a1b6:function(t,e,n,r,i){var g=f(e,n);let b=o(t).insertPanel(g,u(r),u(i));return c(b)},__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_CssGroupingRule_875241920a85dfd7:function(t){let e;try{e=o(t)instanceof CSSGroupingRule}catch{e=!1}return e},__wbg_instanceof_CssImportRule_21bd264cef048043:function(t){let e;try{e=o(t)instanceof CSSImportRule}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_CssStyleSheet_622aeba16e7e2d66:function(t){let e;try{e=o(t)instanceof CSSStyleSheet}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_dae52c84ba717c82: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_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_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 g=f(e,n),b=f(r,i);let w=o(t).load(g,b);return c(w)},__wbg_mark_3b530a64b09ba08a:function(){return l(function(t,e,n){var r=f(e,n);o(t).mark(r)},arguments)},__wbg_maximize_4d6d921c9301bee6:function(t,e,n){var r=f(e,n);o(t).maximize(r)},__wbg_measureText_9d64a92333bd05ee:function(){return l(function(t,e,n){var r=f(e,n);let i=o(t).measureText(r);return c(i)},arguments)},__wbg_measure_288b48c082eae0fe:function(){return l(function(t,e,n,r,i){var g=f(e,n),b=f(r,i);o(t).measure(g,b)},arguments)},__wbg_message_9ddc4b9a62a7c379:function(t){let e=o(t).message;return c(e)},__wbg_minimize_14ccc2ac809a7d39: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 l(function(t,e){var n=f(t,e);let r=new InputEvent(n);return c(r)},arguments)},__wbg_new_1d5bd472c706b768:function(){return l(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_2ec3ec8c398b20d2:function(){return l(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 l(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_406106b44b3d11fa:function(t){let e=new Set(o(t));return c(e)},__wbg_new_64284bd487f9d239:function(){return l(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=(g,b)=>{let w=n.a;n.a=0;try{return Bt(w,n.b,g,b)}finally{n.a=w}};let i=new Promise(r);return c(i)}finally{n.a=n.b=0}},__wbg_new_b949e7f56150a5d1:function(){return l(function(){let t=new AbortController;return c(t)},arguments)},__wbg_new_baaf0b3192575816:function(t){let e=new it(o(t));return c(e)},__wbg_new_c155239f1b113b68:function(t,e){let n=new Intl.DateTimeFormat(o(t),o(e));return c(n)},__wbg_new_cda4bf7a742e4f16: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_ead99299dcf0bd32:function(t){let e=new st(o(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=f(t,e);let r=new Function(n);return c(r)},__wbg_new_with_event_init_dict_48877e7ca125f3c1:function(){return l(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 l(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 l(function(t,e){let n=new Blob(o(t),o(e));return c(n)},arguments)},__wbg_new_with_u8_array_sequence_08b2096a9f3117c0:function(){return l(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 l(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_4888bc3caa75ffc3:function(t,e){o(t).observe(o(e))},__wbg_observe_8b166881309eef22: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 l(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_6131121a2c9b6b65:function(){return l(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 l(function(t,e){o(t).prepend(o(e))},arguments)},__wbg_presize_97ab9b7d339cb61d:function(){return l(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(E(t,e),o(n))},__wbg_push_8ffdcb2063340ba5:function(t,e){return o(t).push(o(e))},__wbg_querySelectorAll_1283aae52043a951:function(){return l(function(t,e,n){var r=f(e,n);let i=o(t).querySelectorAll(r);return c(i)},arguments)},__wbg_querySelectorAll_5875742f4e11f759:function(){return l(function(t,e,n){var r=f(e,n);let i=o(t).querySelectorAll(r);return c(i)},arguments)},__wbg_querySelector_1be4292f202b1597:function(){return l(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 l(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_d1650be98f8b05d5: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 l(function(t,e){o(t).releasePointerCapture(e)},arguments)},__wbg_removeAllRanges_39254b77dc6257ab:function(){return l(function(t){o(t).removeAllRanges()},arguments)},__wbg_removeAttribute_87259aab06d9f286:function(){return l(function(t,e,n){var r=f(e,n);o(t).removeAttribute(r)},arguments)},__wbg_removeChild_2f0b06213dbc49ca:function(){return l(function(t,e){let n=o(t).removeChild(o(e));return c(n)},arguments)},__wbg_removeEventListener_0c0902ed5009dd9f:function(){return l(function(t,e,n,r,i){var g=f(e,n);o(t).removeEventListener(g,o(r),i!==0)},arguments)},__wbg_removeEventListener_e63328781a5b9af9:function(){return l(function(t,e,n,r){var i=f(e,n);o(t).removeEventListener(i,o(r))},arguments)},__wbg_removePanel_d5a9f8e0fb202d12:function(t,e,n){var r=f(e,n);let i=o(t).removePanel(r);return c(i)},__wbg_removeProperty_a0d2ff8a76ffd2b1:function(){return l(function(t,e,n,r){var i=f(n,r);let g=o(e).removeProperty(i),b=m(g,_.__wbindgen_export,_.__wbindgen_export2),w=v;a().setInt32(t+4,w,!0),a().setInt32(t+0,b,!0)},arguments)},__wbg_remove_31c39325eee968fc:function(t){o(t).remove()},__wbg_remove_f9451697e0bc6ca0:function(){return l(function(t,e,n){var r=f(e,n);o(t).remove(r)},arguments)},__wbg_render_9e6659e05fa89e30:function(){return l(function(t,e,n){let r=o(t).render(I.__wrap(e),u(n));return c(r)},arguments)},__wbg_replaceSync_54e9ce897fe6ab6a:function(){return l(function(t,e,n){var r=f(e,n);o(t).replaceSync(r)},arguments)},__wbg_requestAnimationFrame_43682f8e1c5e5348:function(){return l(function(t,e){return o(t).requestAnimationFrame(o(e))},arguments)},__wbg_resize_9c80ee9a0b8cafff:function(){return l(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_50ba487c3890480a:function(t,e){o(t).restorePhysics(o(e))},__wbg_restoreSync_ff5b54866437011a:function(t,e){o(t).restoreSync(o(e))},__wbg_restore_a63b4e115bb34e8a:function(){return l(function(t,e,n){o(t).restore(o(e),o(n))},arguments)},__wbg_restyle_be2e9d88ea0d1bf8:function(t){o(t).restyle()},__wbg_resumeResize_7e3495c87e63afec:function(t){o(t).resumeResize()},__wbg_right_154af6c2b1bf0c89:function(t){return o(t).right},__wbg_run_748b6920eb34b566:function(){return l(function(t,e){let n=o(t).run(o(e));return c(n)},arguments)},__wbg_save_0ea3f47892e87cec: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_893978abf0e7c5f5: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 l(function(t){let e=o(t).selectionEnd;return d(e)?4294967297:e>>>0},arguments)},__wbg_selectionStart_9cd0aeff14a21252:function(){return l(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 l(function(t,e,n,r,i){var g=f(e,n),b=f(r,i);o(t).setAttribute(g,b)},arguments)},__wbg_setDragImage_76defbcc7ff30178:function(t,e,n,r){o(t).setDragImage(o(e),n,r)},__wbg_setPointerCapture_420db6f6826eb74b:function(){return l(function(t,e){o(t).setPointerCapture(e)},arguments)},__wbg_setProperty_cbb25c4e74285b39:function(){return l(function(t,e,n,r,i){var g=f(e,n),b=f(r,i);o(t).setProperty(g,b)},arguments)},__wbg_setSelectionRange_301eef1c51e01d2a:function(){return l(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 l(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 l(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 l(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 l(function(t,e,n,r,i){var g=f(e,n),b=f(r,i);o(t)[g]=b},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=Ut[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 l(function(t,e){o(t).selectionEnd=e===4294967297?void 0:e},arguments)},__wbg_set_selectionStart_d68d6955c07c2be1:function(){return l(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 l(function(t){o(t).showPicker()},arguments)},__wbg_showPopover_7166cd0808998024:function(){return l(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_687cd2148e9483ba:function(){return c(X)},__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 l(function(t,e,n){let r=JSON.stringify(o(t),o(e),o(n));return c(r)},arguments)},__wbg_stringify_8d1cc6ff383e8bae:function(){return l(function(t){let e=JSON.stringify(o(t));return c(e)},arguments)},__wbg_styleSheet_66d04471448b344e:function(t){let e=o(t).styleSheet;return d(e)?0:c(e)},__wbg_styleSheets_54de627270238f6f:function(t){let e=o(t).styleSheets;return c(e)},__wbg_styleSheets_f6881090d63936f3: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_e97790d81e5cc294: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 l(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 l(function(t,e,n,r){var i=f(e,n);return o(t).toggleAttribute(i,r!==0)},arguments)},__wbg_toggle_52417ca95b874e83:function(){return l(function(t,e,n){var r=f(e,n);return o(t).toggle(r)},arguments)},__wbg_toggle_b8e3ebf1a7aaeb11:function(){return l(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_38985a43e0654e89:function(t,e){o(t).unobserve(o(e))},__wbg_unobserve_4c496b8f980e02ff:function(t,e){o(t).unobserve(o(e))},__wbg_update_af83de031ac332a4:function(){return l(function(t,e,n,r,i){let g=o(t).update(I.__wrap(e),n===4294967297?void 0:n,r===4294967297?void 0:r,i!==0);return c(g)},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=q.__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=T(t,e,_.__wasm_bindgen_func_elem_7566,bt);return c(n)},__wbindgen_cast_0000000000000002:function(t,e){let n=S(t,e,_.__wasm_bindgen_func_elem_7566,R);return c(n)},__wbindgen_cast_0000000000000003:function(t,e){let n=S(t,e,_.__wasm_bindgen_func_elem_7566,R);return c(n)},__wbindgen_cast_0000000000000004:function(t,e){let n=S(t,e,_.__wasm_bindgen_func_elem_7566,R);return c(n)},__wbindgen_cast_0000000000000005:function(t,e){let n=S(t,e,_.__wasm_bindgen_func_elem_7566,R);return c(n)},__wbindgen_cast_0000000000000006:function(t,e){let n=T(t,e,_.__wasm_bindgen_func_elem_7566,bt);return c(n)},__wbindgen_cast_0000000000000007:function(t,e){let n=S(t,e,_.__wasm_bindgen_func_elem_7566,R);return c(n)},__wbindgen_cast_0000000000000008:function(t,e){let n=S(t,e,_.__wasm_bindgen_func_elem_7566,R);return c(n)},__wbindgen_cast_0000000000000009:function(t,e){let n=T(t,e,_.__wasm_bindgen_func_elem_7566,Dt);return c(n)},__wbindgen_cast_000000000000000a:function(t,e){let n=S(t,e,_.__wasm_bindgen_func_elem_7566,Lt);return c(n)},__wbindgen_cast_000000000000000b:function(t,e){let n=T(t,e,_.__wasm_bindgen_func_elem_20655,Nt);return c(n)},__wbindgen_cast_000000000000000c:function(t,e){let n=S(t,e,_.__wasm_bindgen_func_elem_21269,Wt);return c(n)},__wbindgen_cast_000000000000000d:function(t,e){let n=S(t,e,_.__wasm_bindgen_func_elem_21269,zt);return c(n)},__wbindgen_cast_000000000000000e:function(t,e){let n=T(t,e,_.__wasm_bindgen_func_elem_22680,Mt);return c(n)},__wbindgen_cast_000000000000000f:function(t,e){let n=T(t,e,_.__wasm_bindgen_func_elem_22680,qt);return c(n)},__wbindgen_cast_0000000000000010:function(t,e){let n=S(t,e,_.__wasm_bindgen_func_elem_27384,Ht);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=$t(t,e);return c(n)},__wbindgen_cast_0000000000000015:function(t,e){let n=Gt(t,e);return c(n)},__wbindgen_cast_0000000000000016:function(t,e){let n=Jt(t,e);return c(n)},__wbindgen_cast_0000000000000017:function(t,e){let n=Xt(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 _.__wbindgen_export4(t,e*4,4),c(n)},__wbindgen_cast_000000000000001b:function(t,e){var n=E(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 zt(s,t){_.__wasm_bindgen_func_elem_21272(s,t)}function qt(s,t){_.__wasm_bindgen_func_elem_23328(s,t)}function Mt(s,t){let e=_.__wasm_bindgen_func_elem_23327(s,t);return u(e)}function bt(s,t,e){_.__wasm_bindgen_func_elem_8643(s,t,c(e))}function R(s,t,e){_.__wasm_bindgen_func_elem_8644(s,t,c(e))}function Dt(s,t){try{let i=_.__wbindgen_add_to_stack_pointer(-16);_.__wasm_bindgen_func_elem_8645(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 Lt(s,t){try{let r=_.__wbindgen_add_to_stack_pointer(-16);_.__wasm_bindgen_func_elem_8641(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 Nt(s,t,e){try{_.__wasm_bindgen_func_elem_20678(s,t,ot(e))}finally{k[O++]=void 0}}function Wt(s,t,e){_.__wasm_bindgen_func_elem_21273(s,t,c(e))}function Ht(s,t,e){_.__wasm_bindgen_func_elem_27386(s,t,c(e))}function Bt(s,t,e,n){_.__wasm_bindgen_func_elem_36185(s,t,c(e),c(n))}var Ut=[\"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){U===k.length&&k.push(k.length+1);let t=U;return U=k[t],k[t]=s,t}function _t(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 K=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(s=>s.dtor(s.a,s.b));function rt(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+=rt(s[0]));for(let g=1;g<r;g++)i+=\", \"+rt(s[g]);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 Vt(s){s<132||(k[s]=U,U=s)}function $t(s,t){return s=s>>>0,Yt().subarray(s/4,s/4+t)}function Gt(s,t){return s=s>>>0,Kt().subarray(s/8,s/8+t)}function Jt(s,t){return s=s>>>0,Qt().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 Xt(s,t){return s=s>>>0,te().subarray(s/4,s/4+t)}function E(s,t){return s=s>>>0,P().subarray(s/1,s/1+t)}function f(s,t){return s===0?o(t):Zt(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 L=null;function Yt(){return(L===null||L.byteLength===0)&&(L=new Float32Array(_.memory.buffer)),L}var N=null;function Kt(){return(N===null||N.byteLength===0)&&(N=new Float64Array(_.memory.buffer)),N}var W=null;function Qt(){return(W===null||W.byteLength===0)&&(W=new Int32Array(_.memory.buffer)),W}function Zt(s,t){return s=s>>>0,_e(s,t)}var H=null;function te(){return(H===null||H.byteLength===0)&&(H=new Uint32Array(_.memory.buffer)),H}var B=null;function P(){return(B===null||B.byteLength===0)&&(B=new Uint8Array(_.memory.buffer)),B}function o(s){return k[s]}function l(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 U=k.length;function d(s){return s==null}function T(s,t,e,n){let r={a:s,b:t,cnt:1,dtor:e},i=(...g)=>{r.cnt++;try{return n(r.a,r.b,...g)}finally{i._wbg_cb_unref()}};return i._wbg_cb_unref=()=>{--r.cnt===0&&(r.dtor(r.a,r.b),r.a=0,K.unregister(r))},K.register(i,r,r),i}function S(s,t,e,n){let r={a:s,b:t,cnt:1,dtor:e},i=(...g)=>{r.cnt++;let b=r.a;r.a=0;try{return n(b,r.b,...g)}finally{r.a=b,i._wbg_cb_unref()}};return i._wbg_cb_unref=()=>{--r.cnt===0&&(r.dtor(r.a,r.b),r.a=0,K.unregister(r))},K.register(i,r,r),i}function ee(s,t){let e=t(s.length*1,1)>>>0;return P().set(s,e/1),v=s.length,e}function ht(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 b=vt.encode(s),w=t(b.length,1)>>>0;return P().subarray(w,w+b.length).set(b),v=b.length,w}let n=s.length,r=t(n,1)>>>0,i=P(),g=0;for(;g<n;g++){let b=s.charCodeAt(g);if(b>127)break;i[r+g]=b}if(g!==n){g!==0&&(s=s.slice(g)),r=e(r,n,n=g+s.length*3,1)>>>0;let b=P().subarray(r+g,r+n),w=vt.encodeInto(s,b);g+=w.written,r=e(r,n,g,1)>>>0}return v=g,r}var O=128;function u(s){let t=o(s);return Vt(s),t}var Y=new TextDecoder(\"utf-8\",{ignoreBOM:!0,fatal:!0});Y.decode();var ne=2146435072,nt=0;function _e(s,t){return nt+=t,nt>=ne&&(Y=new TextDecoder(\"utf-8\",{ignoreBOM:!0,fatal:!0}),Y.decode(),nt=t),Y.decode(P().subarray(s,s+t))}var vt=new TextEncoder,v=0,re,_;function yt(s,t){return _=s.exports,re=t,A=null,L=null,N=null,W=null,H=null,B=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 yt(e,s)}async function xt(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 yt(e,n)}export{F as Client,V as GenericSQLVirtualServerModel,$ as PerspectiveDebugPluginElement,G as PerspectiveViewerElement,j as ProxySession,z as Table,I as View,q as VirtualDataSlice,J as VirtualServer,xt as default,At as getColumnConfigDefaults,Ft as getPluginConfigDefaults,Rt as get_wasm_module,Et as get_worker_url,Tt as init,ce as initSync,Pt as registerPlugin,Ot as setColumnConfigDefaults,jt 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 provide_viewer_runtime,\n shared_validator,\n} from \"@perspective-dev/client/registry\";\nimport type {\n ClientRuntime,\n InitOptions,\n MigrateKind,\n MigrateResult,\n Validator,\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\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.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 * Load the `migrate` binary registered with `init()` and return synchronous\n * `migrate()` and `validate()` over it; the page shares one instance.\n *\n * # Examples\n *\n * ```javascript\n * const validator = await perspective_viewer.create_validator();\n * for (const token of tokens) {\n * validator.validate(\"viewer\", token, { strict: true });\n * }\n * ```\n */\nexport async function create_validator(): Promise<Validator> {\n return await shared_validator();\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,\n * `\"panel\"` for one workspace panel, or `\"workspace\"` for a\n * `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_validator()).migrate<T>(kind, config, from_version);\n}\n\n/**\n * Check that a config is valid for this release without migrating it,\n * rejecting with the offending JSON pointer and reason otherwise.\n *\n * # Arguments\n *\n * - `kind` - `\"view\"`, `\"viewer\"`, `\"panel\"` or `\"workspace\"`.\n * - `config` - The config to check.\n * - `options.strict` - Require the complete `save()` form rather than the\n * field-wise `restore()` update form.\n */\nexport async function validate(\n kind: MigrateKind,\n config: unknown,\n options?: { strict?: boolean },\n): Promise<void> {\n (await shared_validator()).validate(kind, config, options);\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 {\n create_validator,\n init,\n init_client,\n migrate,\n validate,\n} 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 Validator,\n} from \"@perspective-dev/client\";\nimport {\n create_validator,\n init,\n init_client,\n migrate,\n validate,\n} from \"./bootstrap.ts\";\n\nexport default { create_validator, init, init_client, migrate, validate };\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.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,ECnBaC,EAA2B,OAAO,OAAO,CACrD,yBAA0B,iBAC1B,qBAAsB,OACtB,kBAAmB,GACnB,aAAc,GACd,kBAAmB,UACnB,sCAAuC,IACvC,qBAAsB,IACtB,0BAA2B,IAC3B,8BAA+B,KAC/B,gBAAiB,WACjB,kBAAmB,EACnB,0BAA2B,EAC5B,CAAC,EC/FD,SAASC,GAAYC,EAAkBC,EAAkBC,EAAa,CACrE,OACCD,EAAO,SAAW,GAClB,KAAK,IAAIC,EAAMD,EAAOA,EAAO,OAAS,CAAC,CAAC,EACvCD,EAAQ,gCAETC,EAAO,KAAKC,CAAG,EAGTD,CACR,CAEA,SAASE,GAAiBH,EAAkBI,EAA+B,CAE1E,OADeA,EAAU,KAAK,CAACC,EAAGC,IAAMD,EAAIC,CAAC,EAC/B,OAAOP,GAAY,KAAK,OAAWC,CAAO,EAAG,CAAC,CAAC,CAC9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BAAAa,GAAkB,KAAAtB,GAAM,YAAAmB,GAAa,QAAAxH,GAAS,SAAA6H,EAAS,EC/ExEC,GAAiB,CACb,OAAQ,IACJ,MAAM,IAAI,IAAI,kCAAmC,YAAY,GAAG,CAAC,EACrE,QAAS,IACL,MACIC,GACI,YAAY,IACZ,SACA,SACA,0BACJ,CACJ,CACR,CAAC,EAED,MAAMC,GAAe,EAErB,IAAOC,GAAQnB",
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", "ELEMENTS", "defineCustomElements", "registry", "element", "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", "extract", "input", "bin", "inst", "payload", "raw_length_view", "raw_length", "ptr", "load_wasm_stage_0", "wasm", "MEMORY64_PROBE", "migrate", "kind", "retptr", "ptr0", "passStringToWasm0", "len0", "WASM_VECTOR_LEN", "ptr1", "isLikeNone", "len1", "addHeapObject", "r0", "getDataViewMemory0", "r1", "r2", "takeObject", "validate_config", "strict", "__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", "e", "arg", "malloc", "realloc", "buf", "cachedTextEncoder", "mem", "code", "cachedTextDecoder", "MAX_SAFARI_DECODE_BYTES", "numBytesDecoded", "wasmModule", "__wbg_finalize_init", "instance", "module", "__wbg_load", "imports", "expectedResponseType", "bytes", "__wbg_init", "module_or_path", "load_validator", "binary", "config", "from_version", "options", "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", "source", "disable_stage_0", "start_viewer", "runtime", "register", "unknown", "keys", "has_server", "duplicates", "un_warned", "servers", "init", "register_default", "provide_viewer_runtime", "provider", "resolve_viewer", "viewer", "resolve_migrate", "shared_validator", "validator", "perspective_viewer_default", "cached", "getWorkerURL", "blob", "be", "GLUE_OVERRIDE", "me", "url", "glue", "is_registration", "init_client", "wasm_module", "registration", "create_validator", "xe", "validate", "ge", "ne", "he", "perspective_viewer_cdn_default"]
3
+ "sources": ["../../../../node_modules/.pnpm/regular-layout@0.8.1/node_modules/regular-layout/src/core/types.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.1/node_modules/regular-layout/src/core/constants.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.1/node_modules/regular-layout/src/layout/generate_grid.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.1/node_modules/regular-layout/src/layout/calculate_intersect.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.1/node_modules/regular-layout/src/layout/remove_child.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.1/node_modules/regular-layout/src/layout/insert_child.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.1/node_modules/regular-layout/src/layout/redistribute_panel_sizes.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.1/node_modules/regular-layout/src/layout/generate_overlay.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.1/node_modules/regular-layout/src/layout/flatten.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.1/node_modules/regular-layout/src/layout/calculate_path.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.1/node_modules/regular-layout/src/layout/calculate_presize_paths.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.1/node_modules/regular-layout/src/model/presize_queue.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.1/node_modules/regular-layout/src/layout/calculate_edge.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.1/node_modules/regular-layout/src/model/overlay_controller.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.1/node_modules/regular-layout/src/regular-layout.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.1/node_modules/regular-layout/src/regular-layout-frame.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.1/node_modules/regular-layout/src/regular-layout-tab.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.1/node_modules/regular-layout/src/define.ts", "../../../../node_modules/.pnpm/regular-layout@0.8.1/node_modules/regular-layout/src/index.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", "../../../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\t/**\n\t * Whether a touch drag on a divider resizes it. Without this, the browser\n\t * claims the gesture as a pan and cancels the drag.\n\t */\n\tGRID_DIVIDER_TOUCH_RESIZE: 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\tGRID_DIVIDER_TOUCH_RESIZE?: 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\tGRID_DIVIDER_TOUCH_RESIZE: 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\t/**\n\t * Ends a drag. With an `event`, drops the dragged panel at those\n\t * coordinates; with `null`, cancels the drag and restores the layout as it\n\t * was before it began. Either way the overlay preview and `className` are\n\t * removed.\n\t */\n\tasync clear(\n\t\tevent: { clientX: number; clientY: number } | null,\n\t\t{ slot }: LayoutPath,\n\t\tclassName: string = this._host.physics.OVERLAY_CLASSNAME,\n\t): Promise<void> {\n\t\tconst host = this._host;\n\t\tconst query = `:scope > [${host.physics.CHILD_ATTRIBUTE_NAME}=\"${slot}\"]`;\n\t\tconst drag_element = host.querySelector(query);\n\n\t\tlet new_layout = host.panel;\n\t\tif (event !== null) {\n\t\t\tconst panel = remove_child(host.panel, slot);\n\t\t\tconst [col, row, box] = host.relativeCoordinates(event, false);\n\t\t\tconst hit = calculate_intersection(col, row, panel);\n\t\t\tif (hit) {\n\t\t\t\tconst drop_target = calculate_edge(\n\t\t\t\t\tcol,\n\t\t\t\t\trow,\n\t\t\t\t\tpanel,\n\t\t\t\t\tslot,\n\t\t\t\t\thit,\n\t\t\t\t\tbox,\n\t\t\t\t\thost.physics,\n\t\t\t\t);\n\n\t\t\t\tconst orientation = drop_target.is_edge\n\t\t\t\t\t? drop_target.orientation\n\t\t\t\t\t: undefined;\n\n\t\t\t\tnew_layout = insert_child(panel, slot, drop_target.path, orientation);\n\t\t\t}\n\t\t}\n\n\t\tawait host.restore(new_layout);\n\t\tdrag_element?.classList.remove(className);\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?: [\n\t\tdivider: LayoutDivider,\n\t\tcol: number,\n\t\trow: number,\n\t\tpointer_id: number,\n\t];\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\tthis.addEventListener(\"pointercancel\", this.onPointerCancel);\n\t\tthis.addEventListener(\"lostpointercapture\", this.onPointerCancel);\n\t\tthis.update_touch_listener();\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\tthis.removeEventListener(\"pointercancel\", this.onPointerCancel);\n\t\tthis.removeEventListener(\"lostpointercapture\", this.onPointerCancel);\n\t\tthis.update_touch_listener();\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, at which to drop the panel. Pass\n\t * `null` to cancel the drag instead, restoring the pre-drag layout.\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\n\t\tthis.update_touch_listener();\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 hit_divider(\n\t\tcoordinates: PointerEventCoordinates,\n\t\ttarget: EventTarget | null,\n\t): [LayoutDivider, number, number] | null {\n\t\tif (this._physics.GRID_DIVIDER_CHECK_TARGET && target !== this) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst [col, row, rect] = this.relativeCoordinates(coordinates);\n\t\tconst size = this._physics.GRID_DIVIDER_SIZE;\n\t\tconst hit = calculate_intersection(col, row, this._panel, { rect, size });\n\t\treturn hit && hit.type !== \"layout-path\" ? [hit, col, row] : null;\n\t}\n\n\tprivate update_touch_listener() {\n\t\tif (this.isConnected && this._physics.GRID_DIVIDER_TOUCH_RESIZE) {\n\t\t\tthis.addEventListener(\"touchstart\", this.onTouchStart, {\n\t\t\t\tpassive: false,\n\t\t\t});\n\t\t} else {\n\t\t\tthis.removeEventListener(\"touchstart\", this.onTouchStart);\n\t\t}\n\t}\n\n\tprivate onTouchStart = (event: TouchEvent) => {\n\t\tconst touch = event.changedTouches[0];\n\t\tif (event.cancelable && touch && this.hit_divider(touch, event.target)) {\n\t\t\tevent.preventDefault();\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\tconst hit = this.hit_divider(event, event.target);\n\t\tif (hit) {\n\t\t\tthis._drag_target = [...hit, event.pointerId];\n\t\t\tthis.setPointerCapture(event.pointerId);\n\t\t\tevent.preventDefault();\n\t\t}\n\t};\n\n\t/**\n\t * Abandons an in-progress divider drag, discarding its preview. Handles\n\t * both `pointercancel` and `lostpointercapture` without a preceding\n\t * `pointerup`. Ignores other pointers, since these events also bubble up\n\t * from children (e.g. a frame's tab drag).\n\t */\n\tprivate onPointerCancel = async (event: PointerEvent) => {\n\t\tif (this._drag_target?.[3] === event.pointerId) {\n\t\t\tthis._drag_target = undefined;\n\t\t\tawait this.restore(this._intended, true);\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\tconst drag_target = this._drag_target;\n\t\tif (drag_target) {\n\t\t\t// Cleared before `restore` so the `lostpointercapture` that follows\n\t\t\t// this event does not cancel the drag being committed.\n\t\t\tthis._drag_target = undefined;\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] = 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}\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;flex-shrink:0;user-select:none;overflow:hidden;touch-action:none}\n[part~=\"container\"]{flex:1 1 auto;min-height:0;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.onPointerCancel);\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.onPointerCancel);\n\t\tthis.removeEventListener(\"lostpointercapture\", this.onPointerCancel);\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\tconst drag = this._drag;\n\t\tthis._drag = null;\n\t\tif (drag?.moved) {\n\t\t\tthis._layout.clearOverlayState(event, drag.path);\n\t\t}\n\t};\n\n\t/**\n\t * Abandons an in-progress drag, restoring the pre-drag layout. Handles\n\t * both `pointercancel` (e.g. the browser claimed a touch gesture) and\n\t * `lostpointercapture` without a preceding `pointerup` (capture released\n\t * or stolen elsewhere). After a drop, `onPointerUp` has already cleared\n\t * `_drag`, so the trailing `lostpointercapture` is a no-op.\n\t */\n\tprivate onPointerCancel = (_: PointerEvent): void => {\n\t\tconst drag = this._drag;\n\t\tthis._drag = null;\n\t\tif (drag?.moved) {\n\t\t\tthis._layout.clearOverlayState(null, drag.path);\n\t\t}\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 { RegularLayoutTab } from \"./regular-layout-tab.ts\";\n\n/**\n * The custom elements this library provides, by tag name. The tag names are\n * fixed - `<regular-layout-frame>` renders a `<regular-layout-tab>` - so they\n * must be registered together.\n */\nconst ELEMENTS = [\n\t[\"regular-layout\", RegularLayout],\n\t[\"regular-layout-frame\", RegularLayoutFrame],\n\t[\"regular-layout-tab\", RegularLayoutTab],\n] as const;\n\n/**\n * Registers `<regular-layout>`, `<regular-layout-frame>` and\n * `<regular-layout-tab>` with `registry`.\n *\n * Idempotent: a tag name which is already defined is skipped rather than\n * throwing, so this is safe to call more than once, or when another copy of\n * this library has already registered these elements (in which case that\n * copy's classes are the ones in use).\n *\n * @param registry - The registry to define the elements in, defaults to the\n * global `customElements`.\n */\nexport function defineCustomElements(\n\tregistry: CustomElementRegistry = customElements,\n): void {\n\tfor (const [name, element] of ELEMENTS) {\n\t\tif (!registry.get(name)) {\n\t\t\tregistry.define(name, element);\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 * Regular Layout - Resizable Panel Layout System\n *\n * A Web Component library for creating resizable, re-arrangeable layouts using\n * CSS `grid`.\n *\n * ## Basic Usage\n *\n * ```html\n * <regular-layout>\n * <regular-layout-frame name=\"sidebar\">Sidebar content</regular-layout-frame>\n * <regular-layout-frame name=\"main\">Main content</regular-layout-frame>\n * </regular-layout>\n * ```\n *\n * ```typescript\n * import { RegularLayout } from 'regular-layout';\n *\n * const layout = document.querySelector('regular-layout');\n *\n * // Insert panels into the grid layout.\n * layout.insertPanel('sidebar', [0]);\n * layout.insertPanel('main', [1]);\n *\n * // Remove a panel (DOM child remains connected, but not slotted).\n * layout.removePanel('sidebar');\n *\n * // Save current layout state.\n * const state = layout.save();\n * localStorage.setItem('layout', JSON.stringify(state));\n *\n * // Restore layout later.\n * const savedState = JSON.parse(localStorage.getItem('layout'));\n * layout.restore(savedState);\n * ```\n *\n * Importing this module registers the custom elements (skipping any tag name\n * which is already defined). To register them yourself instead, import from\n * `regular-layout/components` and call {@link defineCustomElements}.\n *\n * ## Core Components\n *\n * - {@link RegularLayout}: The main `<regular-layout>` custom element.\n * - {@link RegularLayoutFrame}: Optional frame component with titlebar support.\n *\n * ## Type Definitions\n *\n * - {@link Layout}: The layout tree structure for panel configuration.\n * - {@link LayoutPath}: Information about a panel's position and viewport.\n * - {@link LayoutDivider}: Information about a resizable divider.\n *\n * @packageDocumentation\n */\n\nexport * from \"./components.ts\";\n\n// Side effects\nimport { defineCustomElements } from \"./define.ts\";\ndefineCustomElements();\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\";\nimport type {\n PerspectiveCommandContext,\n PerspectiveHitTest,\n} from \"../../dist/wasm/perspective-viewer.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 * OPTIONAL \u2014 the `{ frame, ref }` this plugin drew at the viewport point\n * `(x, y)`, or `undefined` over nothing; the viewer resolves it to a\n * `PerspectiveHit`.\n */\n hit_test?(x: number, y: number): Promise<PerspectiveHitTest | undefined>;\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.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\n/**\n * Check that a config is valid for the current schema without migrating it,\n * where `strict` requires the complete `save()` form.\n * @param {string} kind\n * @param {any} value\n * @param {boolean | null} [strict]\n */\nexport function validate_config(kind, value, strict) {\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 wasm.validate_config(retptr, ptr0, len0, addHeapObject(value), isLikeNone(strict) ? 0xFFFFFF : strict ? 1 : 0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n if (r1) {\n throw takeObject(r0);\n }\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.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\";\n\n/**\n * The kind of persisted config `migrate()` upgrades: an engine `ViewConfig`,\n * a `<perspective-viewer>` `save()` token, one workspace panel, or a\n * `saveWorkspace()` token.\n */\nexport type MigrateKind = \"view\" | \"viewer\" | \"panel\" | \"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\n/**\n * Synchronous `migrate()` and `validate()` over an instantiated\n * `perspective-migrate` binary, from `create_validator()`.\n */\nexport interface Validator {\n /**\n * Upgrade a persisted config written by any Perspective release since\n * 2.0.0 to the current schema.\n *\n * # Arguments\n *\n * - `kind` - `\"view\"` for a `ViewConfig`, `\"viewer\"` for a `save()`\n * token, `\"panel\"` for one workspace panel, or `\"workspace\"` for a\n * `saveWorkspace()` token.\n * - `config` - The config to upgrade.\n * - `from_version` - The release which wrote `config`, used only when it\n * has no `version` field.\n */\n migrate<T = Record<string, unknown>>(\n kind: MigrateKind,\n config: unknown,\n from_version?: string,\n ): MigrateResult<T>;\n\n /**\n * Check that a config is valid for this release without migrating it,\n * throwing the offending JSON pointer and reason otherwise.\n *\n * # Arguments\n *\n * - `kind` - `\"view\"`, `\"viewer\"`, `\"panel\"` or `\"workspace\"`.\n * - `config` - The config to check.\n * - `options.strict` - Require the complete `save()` form rather than the\n * field-wise `restore()` update form.\n */\n validate(\n kind: MigrateKind,\n config: unknown,\n options?: { strict?: boolean },\n ): void;\n}\n\n/**\n * Instantiate the `perspective-migrate` binary and wrap its exports as a\n * `Validator`.\n */\nexport async function load_validator(\n binary: BufferSource | WebAssembly.Module,\n): Promise<Validator> {\n await migrate_wasm.default({ module_or_path: binary });\n return {\n migrate<T>(kind: MigrateKind, config: unknown, from_version?: string) {\n return migrate_wasm.migrate(\n kind,\n from_version,\n config,\n ) as MigrateResult<T>;\n },\n validate(kind, config, options) {\n migrate_wasm.validate_config(kind, config, options?.strict);\n },\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 { load_validator } from \"./migrate.ts\";\nimport type { Validator } from \"./migrate.ts\";\n\nexport type {\n MigrateKind,\n MigrateNotice,\n MigrateResult,\n Validator,\n} 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\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 warned_duplicates?: 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 validator?: Promise<Validator>;\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 const duplicates: WasmKey[] = [];\n for (const key of keys) {\n if (s.consumed.has(key)) {\n // A module which calls `init()` at module scope may be\n // evaluated more than once per page (anywidget evaluates a\n // widget's `_esm` once per widget model, each evaluation a\n // fresh module instance over the page-wide registry).\n // Re-registering a key whose runtime already exists then\n // resolves to that runtime instead of throwing, in `user`\n // mode only \u2014 `replace_server` (`init_server()`) still\n // throws, as replacing a consumed engine remains an error.\n if (mode === \"user\" && s.sources[key] !== undefined) {\n duplicates.push(key);\n continue;\n }\n\n throw new Error(`${key} wasm is already initialized`);\n }\n }\n\n if (duplicates.length > 0) {\n keys = keys.filter((key) => !duplicates.includes(key));\n s.warned_duplicates ??= new Set();\n const un_warned = duplicates.filter(\n (key) => !s.warned_duplicates!.has(key),\n );\n\n if (un_warned.length > 0) {\n for (const key of un_warned) {\n s.warned_duplicates!.add(key);\n }\n\n console.warn(\n `${un_warned.join(\", \")} wasm is already initialized; keeping the existing runtime (Perspective was loaded more than once on this page).`,\n );\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 * Re-registering a key whose runtime already exists (e.g. a second module\n * evaluation of the same bundle, as anywidget does per widget model) keeps\n * the existing runtime and resolves rather than throwing; `init_server()`'s\n * replacement mode still throws for a consumed key.\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.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.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 `Validator`, instantiated from the registered `migrate`\n * binary on the first call.\n */\nexport function shared_validator(): Promise<Validator> {\n const s = state();\n if (s.validator === undefined) {\n const validator = resolve_migrate().then(load_validator);\n validator.catch(() => {\n if (s.validator === validator) {\n s.validator = undefined;\n }\n });\n\n s.validator = validator;\n }\n\n return s.validator;\n}\n", "var Ct=Object.defineProperty;var At=(a,t)=>{for(var e in t)Ct(a,e,{get:t[e],enumerable:!0})};var X={};At(X,{Client:()=>F,GenericSQLVirtualServerModel:()=>V,PerspectiveDebugPluginElement:()=>$,PerspectiveViewerElement:()=>G,ProxySession:()=>j,Table:()=>z,View:()=>I,VirtualDataSlice:()=>M,VirtualServer:()=>J,default:()=>It,getColumnConfigDefaults:()=>Ft,getPluginConfigDefaults:()=>Rt,get_wasm_module:()=>Et,get_worker_url:()=>Tt,init:()=>Pt,initSync:()=>oe,registerPlugin:()=>Ot,setColumnConfigDefaults:()=>jt,setPluginConfigDefaults:()=>zt});function ct(a){customElements.get(a)||customElements.define(a,class extends HTMLElement{})}var it=window.ResizeObserver;var st=window.IntersectionObserver;function at(a,t){if(!globalThis.ClipboardItem||!globalThis.navigator?.clipboard?.write)throw new Error(\"Clipboard API unavailable\");return navigator.clipboard.write([new ClipboardItem({[a]:t})])}function ut(a,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 _=a[e],i=_.prototype;class b extends HTMLElement{constructor(){super(),this._instance=new _(this)}}let g=Object.getOwnPropertyNames(i);for(let w of g)\"get\"in Object.getOwnPropertyDescriptor(i,w)?Object.defineProperty(b.prototype,w,{get:function(){return this._instance[w]}}):Object.defineProperty(b.prototype,w,{value:function(...v){return this._instance[w].call(this._instance,...v)}});for(let w of n)Object.defineProperty(b,w,{value:function(...v){return a[w].call(a,...v)}});customElements.define(t,b)}var F=class a{static __wrap(t){t=t>>>0;let e=Object.create(a.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();r.__wbg_client_free(t,0)}__getClassname(){try{let _=r.__wbindgen_add_to_stack_pointer(-16);r.client___getClassname(_,this.__wbg_ptr);var t=s().getInt32(_+0,!0),e=s().getInt32(_+4,!0),n=d(t,e);return t!==0&&r.__wbindgen_export4(t,e,1),n}finally{r.__wbindgen_add_to_stack_pointer(16)}}__unsafe_open_view(t){let e=m(t,r.__wbindgen_export,r.__wbindgen_export2),n=p,_=r.client___unsafe_open_view(this.__wbg_ptr,e,n);return I.__wrap(_)}get_hosted_table_names(){let t=r.client_get_hosted_table_names(this.__wbg_ptr);return u(t)}handle_error(t,e){let n=m(t,r.__wbindgen_export,r.__wbindgen_export2),_=p,i=r.client_handle_error(this.__wbg_ptr,n,_,f(e)?0:c(e));return u(i)}handle_response(t){let e=r.client_handle_response(this.__wbg_ptr,c(t));return u(e)}join(t,e,n,_){let i=m(n,r.__wbindgen_export,r.__wbindgen_export2),b=p,g=r.client_join(this.__wbg_ptr,c(t),c(e),i,b,f(_)?0:c(_));return u(g)}constructor(t,e){try{let b=r.__wbindgen_add_to_stack_pointer(-16);r.client_new(b,c(t),f(e)?0:c(e));var n=s().getInt32(b+0,!0),_=s().getInt32(b+4,!0),i=s().getInt32(b+8,!0);if(i)throw u(_);return this.__wbg_ptr=n>>>0,Q.register(this,this.__wbg_ptr,this),this}finally{r.__wbindgen_add_to_stack_pointer(16)}}new_proxy_session(t){try{let e=r.client_new_proxy_session(this.__wbg_ptr,ot(t));return j.__wrap(e)}finally{k[O++]=void 0}}on_error(t){let e=r.client_on_error(this.__wbg_ptr,c(t));return u(e)}on_hosted_tables_update(t){let e=r.client_on_hosted_tables_update(this.__wbg_ptr,c(t));return u(e)}open_table(t){let e=m(t,r.__wbindgen_export,r.__wbindgen_export2),n=p,_=r.client_open_table(this.__wbg_ptr,e,n);return u(_)}remove_hosted_tables_update(t){let e=r.client_remove_hosted_tables_update(this.__wbg_ptr,t);return u(e)}system_info(){let t=r.client_system_info(this.__wbg_ptr);return u(t)}table(t,e){let n=r.client_table(this.__wbg_ptr,c(t),f(e)?0:c(e));return u(n)}terminate(){try{let _=r.__wbindgen_add_to_stack_pointer(-16);r.client_terminate(_,this.__wbg_ptr);var t=s().getInt32(_+0,!0),e=s().getInt32(_+4,!0),n=s().getInt32(_+8,!0);if(n)throw u(e);return u(t)}finally{r.__wbindgen_add_to_stack_pointer(16)}}};Symbol.dispose&&(F.prototype[Symbol.dispose]=F.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();r.__wbg_genericsqlvirtualservermodel_free(t,0)}expressionDescribe(t,e){try{let w=r.__wbindgen_add_to_stack_pointer(-16),v=m(t,r.__wbindgen_export,r.__wbindgen_export2),h=p,y=m(e,r.__wbindgen_export,r.__wbindgen_export2),x=p;r.genericsqlvirtualservermodel_expressionDescribe(w,this.__wbg_ptr,v,h,y,x);var n=s().getInt32(w+0,!0),_=s().getInt32(w+4,!0),i=s().getInt32(w+8,!0),b=s().getInt32(w+12,!0);if(b)throw u(i);var g=d(n,_);return n!==0&&r.__wbindgen_export4(n,_,1),g}finally{r.__wbindgen_add_to_stack_pointer(16)}}expressionsDescribe(t,e){try{let w=r.__wbindgen_add_to_stack_pointer(-16),v=m(t,r.__wbindgen_export,r.__wbindgen_export2),h=p;r.genericsqlvirtualservermodel_expressionsDescribe(w,this.__wbg_ptr,v,h,c(e));var n=s().getInt32(w+0,!0),_=s().getInt32(w+4,!0),i=s().getInt32(w+8,!0),b=s().getInt32(w+12,!0);if(b)throw u(i);var g=d(n,_);return n!==0&&r.__wbindgen_export4(n,_,1),g}finally{r.__wbindgen_add_to_stack_pointer(16)}}getHostedTables(){try{let b=r.__wbindgen_add_to_stack_pointer(-16);r.genericsqlvirtualservermodel_getHostedTables(b,this.__wbg_ptr);var t=s().getInt32(b+0,!0),e=s().getInt32(b+4,!0),n=s().getInt32(b+8,!0),_=s().getInt32(b+12,!0);if(_)throw u(n);var i=d(t,e);return t!==0&&r.__wbindgen_export4(t,e,1),i}finally{r.__wbindgen_add_to_stack_pointer(16)}}constructor(t){try{let i=r.__wbindgen_add_to_stack_pointer(-16);r.genericsqlvirtualservermodel_new(i,f(t)?0:c(t));var e=s().getInt32(i+0,!0),n=s().getInt32(i+4,!0),_=s().getInt32(i+8,!0);if(_)throw u(n);return this.__wbg_ptr=e>>>0,ft.register(this,this.__wbg_ptr,this),this}finally{r.__wbindgen_add_to_stack_pointer(16)}}quoteEntity(t){try{let g=r.__wbindgen_add_to_stack_pointer(-16),w=m(t,r.__wbindgen_export,r.__wbindgen_export2),v=p;r.genericsqlvirtualservermodel_quoteEntity(g,this.__wbg_ptr,w,v);var e=s().getInt32(g+0,!0),n=s().getInt32(g+4,!0),_=s().getInt32(g+8,!0),i=s().getInt32(g+12,!0);if(i)throw u(_);var b=d(e,n);return e!==0&&r.__wbindgen_export4(e,n,1),b}finally{r.__wbindgen_add_to_stack_pointer(16)}}tableDescribe(t,e,n,_){try{let h=r.__wbindgen_add_to_stack_pointer(-16),y=m(t,r.__wbindgen_export,r.__wbindgen_export2),x=p;r.genericsqlvirtualservermodel_tableDescribe(h,this.__wbg_ptr,y,x,c(e),c(n),f(_)?16777215:_?1:0);var i=s().getInt32(h+0,!0),b=s().getInt32(h+4,!0),g=s().getInt32(h+8,!0),w=s().getInt32(h+12,!0);if(w)throw u(g);var v=d(i,b);return i!==0&&r.__wbindgen_export4(i,b,1),v}finally{r.__wbindgen_add_to_stack_pointer(16)}}tableMakeView(t,e,n,_,i){try{let y=r.__wbindgen_add_to_stack_pointer(-16),x=m(t,r.__wbindgen_export,r.__wbindgen_export2),C=p,q=m(e,r.__wbindgen_export,r.__wbindgen_export2),D=p;r.genericsqlvirtualservermodel_tableMakeView(y,this.__wbg_ptr,x,C,q,D,c(n),c(_),f(i)?16777215:i?1:0);var b=s().getInt32(y+0,!0),g=s().getInt32(y+4,!0),w=s().getInt32(y+8,!0),v=s().getInt32(y+12,!0);if(v)throw u(w);var h=d(b,g);return b!==0&&r.__wbindgen_export4(b,g,1),h}finally{r.__wbindgen_add_to_stack_pointer(16)}}tablePath(t){try{let g=r.__wbindgen_add_to_stack_pointer(-16),w=yt(t,r.__wbindgen_export),v=p;r.genericsqlvirtualservermodel_tablePath(g,this.__wbg_ptr,w,v);var e=s().getInt32(g+0,!0),n=s().getInt32(g+4,!0),_=s().getInt32(g+8,!0),i=s().getInt32(g+12,!0);if(i)throw u(_);var b=d(e,n);return e!==0&&r.__wbindgen_export4(e,n,1),b}finally{r.__wbindgen_add_to_stack_pointer(16)}}tableSchema(t){try{let g=r.__wbindgen_add_to_stack_pointer(-16),w=m(t,r.__wbindgen_export,r.__wbindgen_export2),v=p;r.genericsqlvirtualservermodel_tableSchema(g,this.__wbg_ptr,w,v);var e=s().getInt32(g+0,!0),n=s().getInt32(g+4,!0),_=s().getInt32(g+8,!0),i=s().getInt32(g+12,!0);if(i)throw u(_);var b=d(e,n);return e!==0&&r.__wbindgen_export4(e,n,1),b}finally{r.__wbindgen_add_to_stack_pointer(16)}}tableSize(t){try{let g=r.__wbindgen_add_to_stack_pointer(-16),w=m(t,r.__wbindgen_export,r.__wbindgen_export2),v=p;r.genericsqlvirtualservermodel_tableSize(g,this.__wbg_ptr,w,v);var e=s().getInt32(g+0,!0),n=s().getInt32(g+4,!0),_=s().getInt32(g+8,!0),i=s().getInt32(g+12,!0);if(i)throw u(_);var b=d(e,n);return e!==0&&r.__wbindgen_export4(e,n,1),b}finally{r.__wbindgen_add_to_stack_pointer(16)}}viewCollapse(t,e,n){try{let v=r.__wbindgen_add_to_stack_pointer(-16),h=m(t,r.__wbindgen_export,r.__wbindgen_export2),y=p;r.genericsqlvirtualservermodel_viewCollapse(v,this.__wbg_ptr,h,y,c(e),n);var _=s().getInt32(v+0,!0),i=s().getInt32(v+4,!0),b=s().getInt32(v+8,!0),g=s().getInt32(v+12,!0);if(g)throw u(b);var w=d(_,i);return _!==0&&r.__wbindgen_export4(_,i,1),w}finally{r.__wbindgen_add_to_stack_pointer(16)}}viewColumnSize(t){try{let g=r.__wbindgen_add_to_stack_pointer(-16),w=m(t,r.__wbindgen_export,r.__wbindgen_export2),v=p;r.genericsqlvirtualservermodel_viewColumnSize(g,this.__wbg_ptr,w,v);var e=s().getInt32(g+0,!0),n=s().getInt32(g+4,!0),_=s().getInt32(g+8,!0),i=s().getInt32(g+12,!0);if(i)throw u(_);var b=d(e,n);return e!==0&&r.__wbindgen_export4(e,n,1),b}finally{r.__wbindgen_add_to_stack_pointer(16)}}viewDelete(t){try{let g=r.__wbindgen_add_to_stack_pointer(-16),w=m(t,r.__wbindgen_export,r.__wbindgen_export2),v=p;r.genericsqlvirtualservermodel_viewDelete(g,this.__wbg_ptr,w,v);var e=s().getInt32(g+0,!0),n=s().getInt32(g+4,!0),_=s().getInt32(g+8,!0),i=s().getInt32(g+12,!0);if(i)throw u(_);var b=d(e,n);return e!==0&&r.__wbindgen_export4(e,n,1),b}finally{r.__wbindgen_add_to_stack_pointer(16)}}viewExpand(t,e,n){try{let v=r.__wbindgen_add_to_stack_pointer(-16),h=m(t,r.__wbindgen_export,r.__wbindgen_export2),y=p;r.genericsqlvirtualservermodel_viewExpand(v,this.__wbg_ptr,h,y,c(e),n);var _=s().getInt32(v+0,!0),i=s().getInt32(v+4,!0),b=s().getInt32(v+8,!0),g=s().getInt32(v+12,!0);if(g)throw u(b);var w=d(_,i);return _!==0&&r.__wbindgen_export4(_,i,1),w}finally{r.__wbindgen_add_to_stack_pointer(16)}}viewGetData(t,e,n,_){try{let h=r.__wbindgen_add_to_stack_pointer(-16),y=m(t,r.__wbindgen_export,r.__wbindgen_export2),x=p;r.genericsqlvirtualservermodel_viewGetData(h,this.__wbg_ptr,y,x,c(e),c(n),c(_));var i=s().getInt32(h+0,!0),b=s().getInt32(h+4,!0),g=s().getInt32(h+8,!0),w=s().getInt32(h+12,!0);if(w)throw u(g);var v=d(i,b);return i!==0&&r.__wbindgen_export4(i,b,1),v}finally{r.__wbindgen_add_to_stack_pointer(16)}}viewGetMinMax(t,e,n){try{let v=r.__wbindgen_add_to_stack_pointer(-16),h=m(t,r.__wbindgen_export,r.__wbindgen_export2),y=p,x=m(e,r.__wbindgen_export,r.__wbindgen_export2),C=p;r.genericsqlvirtualservermodel_viewGetMinMax(v,this.__wbg_ptr,h,y,x,C,c(n));var _=s().getInt32(v+0,!0),i=s().getInt32(v+4,!0),b=s().getInt32(v+8,!0),g=s().getInt32(v+12,!0);if(g)throw u(b);var w=d(_,i);return _!==0&&r.__wbindgen_export4(_,i,1),w}finally{r.__wbindgen_add_to_stack_pointer(16)}}viewMakeTable(t,e,n,_,i){try{let y=r.__wbindgen_add_to_stack_pointer(-16),x=m(t,r.__wbindgen_export,r.__wbindgen_export2),C=p,q=m(e,r.__wbindgen_export,r.__wbindgen_export2),D=p;r.genericsqlvirtualservermodel_viewMakeTable(y,this.__wbg_ptr,x,C,q,D,c(n),c(_),c(i));var b=s().getInt32(y+0,!0),g=s().getInt32(y+4,!0),w=s().getInt32(y+8,!0),v=s().getInt32(y+12,!0);if(v)throw u(w);var h=d(b,g);return b!==0&&r.__wbindgen_export4(b,g,1),h}finally{r.__wbindgen_add_to_stack_pointer(16)}}viewSchema(t){try{let g=r.__wbindgen_add_to_stack_pointer(-16),w=m(t,r.__wbindgen_export,r.__wbindgen_export2),v=p;r.genericsqlvirtualservermodel_viewSchema(g,this.__wbg_ptr,w,v);var e=s().getInt32(g+0,!0),n=s().getInt32(g+4,!0),_=s().getInt32(g+8,!0),i=s().getInt32(g+12,!0);if(i)throw u(_);var b=d(e,n);return e!==0&&r.__wbindgen_export4(e,n,1),b}finally{r.__wbindgen_add_to_stack_pointer(16)}}viewSetDepth(t,e,n){try{let v=r.__wbindgen_add_to_stack_pointer(-16),h=m(t,r.__wbindgen_export,r.__wbindgen_export2),y=p;r.genericsqlvirtualservermodel_viewSetDepth(v,this.__wbg_ptr,h,y,c(e),n);var _=s().getInt32(v+0,!0),i=s().getInt32(v+4,!0),b=s().getInt32(v+8,!0),g=s().getInt32(v+12,!0);if(g)throw u(b);var w=d(_,i);return _!==0&&r.__wbindgen_export4(_,i,1),w}finally{r.__wbindgen_add_to_stack_pointer(16)}}viewSize(t){try{let g=r.__wbindgen_add_to_stack_pointer(-16),w=m(t,r.__wbindgen_export,r.__wbindgen_export2),v=p;r.genericsqlvirtualservermodel_viewSize(g,this.__wbg_ptr,w,v);var e=s().getInt32(g+0,!0),n=s().getInt32(g+4,!0),_=s().getInt32(g+8,!0),i=s().getInt32(g+12,!0);if(i)throw u(_);var b=d(e,n);return e!==0&&r.__wbindgen_export4(e,n,1),b}finally{r.__wbindgen_add_to_stack_pointer(16)}}};Symbol.dispose&&(V.prototype[Symbol.dispose]=V.prototype.free);var $=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,dt.unregister(this),t}free(){let t=this.__destroy_into_raw();r.__wbg_perspectivedebugpluginelement_free(t,0)}clear(){let t=r.perspectivedebugpluginelement_clear(this.__wbg_ptr);return u(t)}get config_column_names(){let t=r.perspectivedebugpluginelement_config_column_names(this.__wbg_ptr);return u(t)}connectedCallback(){r.perspectivedebugpluginelement_connectedCallback(this.__wbg_ptr)}delete(){let t=r.perspectivedebugpluginelement_clear(this.__wbg_ptr);return u(t)}draw(t){rt(t,I);let e=r.perspectivedebugpluginelement_draw(this.__wbg_ptr,t.__wbg_ptr);return u(e)}get min_config_columns(){let t=r.perspectivedebugpluginelement_config_column_names(this.__wbg_ptr);return u(t)}get name(){try{let _=r.__wbindgen_add_to_stack_pointer(-16);r.perspectivedebugpluginelement_name(_,this.__wbg_ptr);var t=s().getInt32(_+0,!0),e=s().getInt32(_+4,!0),n=d(t,e);return t!==0&&r.__wbindgen_export4(t,e,1),n}finally{r.__wbindgen_add_to_stack_pointer(16)}}constructor(t){let e=r.perspectivedebugpluginelement_new(c(t));return this.__wbg_ptr=e>>>0,dt.register(this,this.__wbg_ptr,this),this}resize(){let t=r.perspectivedebugpluginelement_clear(this.__wbg_ptr);return u(t)}restore(t){try{let _=r.__wbindgen_add_to_stack_pointer(-16);r.perspectivedebugpluginelement_restore(_,this.__wbg_ptr,f(t)?0:c(t));var e=s().getInt32(_+0,!0),n=s().getInt32(_+4,!0);if(n)throw u(e)}finally{r.__wbindgen_add_to_stack_pointer(16)}}restyle(){r.perspectivedebugpluginelement_connectedCallback(this.__wbg_ptr)}save(){try{let _=r.__wbindgen_add_to_stack_pointer(-16);r.perspectivedebugpluginelement_save(_,this.__wbg_ptr);var t=s().getInt32(_+0,!0),e=s().getInt32(_+4,!0),n=s().getInt32(_+8,!0);if(n)throw u(e);return u(t)}finally{r.__wbindgen_add_to_stack_pointer(16)}}get select_mode(){try{let _=r.__wbindgen_add_to_stack_pointer(-16);r.perspectivedebugpluginelement_select_mode(_,this.__wbg_ptr);var t=s().getInt32(_+0,!0),e=s().getInt32(_+4,!0),n=d(t,e);return t!==0&&r.__wbindgen_export4(t,e,1),n}finally{r.__wbindgen_add_to_stack_pointer(16)}}update(t){rt(t,I);let e=r.perspectivedebugpluginelement_update(this.__wbg_ptr,t.__wbg_ptr);return u(e)}};Symbol.dispose&&($.prototype[Symbol.dispose]=$.prototype.free);var G=class a{static __wrap(t){t=t>>>0;let e=Object.create(a.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();r.__wbg_perspectiveviewerelement_free(t,0)}__get_model(){let t=r.perspectiveviewerelement___get_model(this.__wbg_ptr);return a.__wrap(t)}addPanel(t,e){let n=r.perspectiveviewerelement_addPanel(this.__wbg_ptr,c(t),f(e)?0:c(e));return u(n)}agentConfig(t){try{let _=r.__wbindgen_add_to_stack_pointer(-16);r.perspectiveviewerelement_agentConfig(_,this.__wbg_ptr,c(t));var e=s().getInt32(_+0,!0),n=s().getInt32(_+4,!0);if(n)throw u(e)}finally{r.__wbindgen_add_to_stack_pointer(16)}}agentPrompt(t){let e=m(t,r.__wbindgen_export,r.__wbindgen_export2),n=p,_=r.perspectiveviewerelement_agentPrompt(this.__wbg_ptr,e,n);return u(_)}agentReset(){let t=r.perspectiveviewerelement_agentReset(this.__wbg_ptr);return u(t)}connectedCallback(){try{let n=r.__wbindgen_add_to_stack_pointer(-16);r.perspectiveviewerelement_connectedCallback(n,this.__wbg_ptr);var t=s().getInt32(n+0,!0),e=s().getInt32(n+4,!0);if(e)throw u(t)}finally{r.__wbindgen_add_to_stack_pointer(16)}}copy(t){let e=r.perspectiveviewerelement_copy(this.__wbg_ptr,f(t)?0:c(t));return u(e)}delete(){let t=this.__destroy_into_raw(),e=r.perspectiveviewerelement_delete(t);return u(e)}download(t){let e=r.perspectiveviewerelement_download(this.__wbg_ptr,f(t)?0:c(t));return u(e)}eject(t){let e=r.perspectiveviewerelement_eject(this.__wbg_ptr,f(t)?0:c(t));return u(e)}export(t){let e=r.perspectiveviewerelement_export(this.__wbg_ptr,f(t)?0:c(t));return u(e)}flush(){let t=r.perspectiveviewerelement_flush(this.__wbg_ptr);return u(t)}getActivePanel(){let t=r.perspectiveviewerelement_getActivePanel(this.__wbg_ptr);return u(t)}getAllPlugins(){let t=r.perspectiveviewerelement_getAllPlugins(this.__wbg_ptr);return u(t)}getClient(t){let e=r.perspectiveviewerelement_getClient(this.__wbg_ptr,f(t)?0:c(t));return u(e)}getEditPort(t){try{let i=r.__wbindgen_add_to_stack_pointer(-16);r.perspectiveviewerelement_getEditPort(i,this.__wbg_ptr,f(t)?0:c(t));var e=s().getFloat64(i+0,!0),n=s().getInt32(i+8,!0),_=s().getInt32(i+12,!0);if(_)throw u(n);return e}finally{r.__wbindgen_add_to_stack_pointer(16)}}getPanelNames(){let t=r.perspectiveviewerelement_getPanelNames(this.__wbg_ptr);return u(t)}getPlugin(t){try{let g=r.__wbindgen_add_to_stack_pointer(-16);var e=f(t)?0:m(t,r.__wbindgen_export,r.__wbindgen_export2),n=p;r.perspectiveviewerelement_getPlugin(g,this.__wbg_ptr,e,n);var _=s().getInt32(g+0,!0),i=s().getInt32(g+4,!0),b=s().getInt32(g+8,!0);if(b)throw u(i);return u(_)}finally{r.__wbindgen_add_to_stack_pointer(16)}}getRenderStats(t){try{let i=r.__wbindgen_add_to_stack_pointer(-16);r.perspectiveviewerelement_getRenderStats(i,this.__wbg_ptr,f(t)?0:c(t));var e=s().getInt32(i+0,!0),n=s().getInt32(i+4,!0),_=s().getInt32(i+8,!0);if(_)throw u(n);return u(e)}finally{r.__wbindgen_add_to_stack_pointer(16)}}getSelection(t){try{let i=r.__wbindgen_add_to_stack_pointer(-16);r.perspectiveviewerelement_getSelection(i,this.__wbg_ptr,f(t)?0:c(t));var e=s().getInt32(i+0,!0),n=s().getInt32(i+4,!0),_=s().getInt32(i+8,!0);if(_)throw u(n);return u(e)}finally{r.__wbindgen_add_to_stack_pointer(16)}}getTable(t){let e=r.perspectiveviewerelement_getTable(this.__wbg_ptr,f(t)?0:c(t));return u(e)}getThemes(){let t=r.perspectiveviewerelement_getThemes(this.__wbg_ptr);return u(t)}getView(t){let e=r.perspectiveviewerelement_getView(this.__wbg_ptr,f(t)?0:c(t));return u(e)}getViewConfig(t){let e=r.perspectiveviewerelement_getViewConfig(this.__wbg_ptr,f(t)?0:c(t));return u(e)}invalidate(t){try{let i=r.__wbindgen_add_to_stack_pointer(-16);r.perspectiveviewerelement_invalidate(i,this.__wbg_ptr,f(t)?0:c(t));var e=s().getInt32(i+0,!0),n=s().getInt32(i+4,!0),_=s().getInt32(i+8,!0);if(_)throw u(n);return u(e)}finally{r.__wbindgen_add_to_stack_pointer(16)}}invokeCommand(t,e){try{let i=r.__wbindgen_add_to_stack_pointer(-16),b=m(t,r.__wbindgen_export,r.__wbindgen_export2),g=p;r.perspectiveviewerelement_invokeCommand(i,this.__wbg_ptr,b,g,c(e));var n=s().getInt32(i+0,!0),_=s().getInt32(i+4,!0);if(_)throw u(n)}finally{r.__wbindgen_add_to_stack_pointer(16)}}load(t){try{let i=r.__wbindgen_add_to_stack_pointer(-16);r.perspectiveviewerelement_load(i,this.__wbg_ptr,c(t));var e=s().getInt32(i+0,!0),n=s().getInt32(i+4,!0),_=s().getInt32(i+8,!0);if(_)throw u(n);return u(e)}finally{r.__wbindgen_add_to_stack_pointer(16)}}constructor(t){let e=r.perspectiveviewerelement_new(c(t));return this.__wbg_ptr=e>>>0,Z.register(this,this.__wbg_ptr,this),this}queryCommands(t,e,n,_){try{let w=r.__wbindgen_add_to_stack_pointer(-16);r.perspectiveviewerelement_queryCommands(w,this.__wbg_ptr,c(t),c(e),c(n),c(_));var i=s().getInt32(w+0,!0),b=s().getInt32(w+4,!0),g=s().getInt32(w+8,!0);if(g)throw u(b);return u(i)}finally{r.__wbindgen_add_to_stack_pointer(16)}}removePanel(t){let e=m(t,r.__wbindgen_export,r.__wbindgen_export2),n=p,_=r.perspectiveviewerelement_removePanel(this.__wbg_ptr,e,n);return u(_)}reset(t,e){let n=r.perspectiveviewerelement_reset(this.__wbg_ptr,f(t)?16777215:t?1:0,f(e)?0:c(e));return u(n)}resetError(){let t=r.perspectiveviewerelement_resetError(this.__wbg_ptr);return u(t)}resetThemes(t){var e=f(t)?0:yt(t,r.__wbindgen_export),n=p;let _=r.perspectiveviewerelement_resetThemes(this.__wbg_ptr,e,n);return u(_)}resize(t){let e=r.perspectiveviewerelement_resize(this.__wbg_ptr,f(t)?0:c(t));return u(e)}restore(t,e){let n=r.perspectiveviewerelement_restore(this.__wbg_ptr,c(t),f(e)?0:c(e));return u(n)}restoreWorkspace(t,e){let n=r.perspectiveviewerelement_restoreWorkspace(this.__wbg_ptr,c(t),f(e)?0:c(e));return u(n)}restyleElement(){let t=r.perspectiveviewerelement_restyleElement(this.__wbg_ptr);return u(t)}save(t){let e=r.perspectiveviewerelement_save(this.__wbg_ptr,f(t)?0:c(t));return u(e)}saveWorkspace(t){let e=r.perspectiveviewerelement_saveWorkspace(this.__wbg_ptr,f(t)?0:c(t));return u(e)}setActivePanel(t){let e=m(t,r.__wbindgen_export,r.__wbindgen_export2),n=p,_=r.perspectiveviewerelement_setActivePanel(this.__wbg_ptr,e,n);return u(_)}setAutoPause(t){let e=r.perspectiveviewerelement_setAutoPause(this.__wbg_ptr,t);return u(e)}setAutoSize(t){r.perspectiveviewerelement_setAutoSize(this.__wbg_ptr,t)}setCommandSchema(t,e){try{let b=r.__wbindgen_add_to_stack_pointer(-16);r.perspectiveviewerelement_setCommandSchema(b,this.__wbg_ptr,f(t)?0:c(t),f(e)?0:c(e));var n=s().getInt32(b+0,!0),_=s().getInt32(b+4,!0),i=s().getInt32(b+8,!0);if(i)throw u(_);return u(n)}finally{r.__wbindgen_add_to_stack_pointer(16)}}setSelection(t,e){try{let i=r.__wbindgen_add_to_stack_pointer(-16);r.perspectiveviewerelement_setSelection(i,this.__wbg_ptr,f(t)?0:c(t),f(e)?0:c(e));var n=s().getInt32(i+0,!0),_=s().getInt32(i+4,!0);if(_)throw u(n)}finally{r.__wbindgen_add_to_stack_pointer(16)}}setThrottle(t){r.perspectiveviewerelement_setThrottle(this.__wbg_ptr,!f(t),f(t)?0:t)}showCommandMenu(t,e,n){let _=r.perspectiveviewerelement_showCommandMenu(this.__wbg_ptr,c(t),c(e),c(n));return u(_)}toggleColumnSettings(t,e){let n=m(t,r.__wbindgen_export,r.__wbindgen_export2),_=p,i=r.perspectiveviewerelement_toggleColumnSettings(this.__wbg_ptr,n,_,f(e)?0:c(e));return u(i)}toggleConfig(t){let e=r.perspectiveviewerelement_toggleConfig(this.__wbg_ptr,f(t)?16777215:t?1:0);return u(e)}};Symbol.dispose&&(G.prototype[Symbol.dispose]=G.prototype.free);var j=class a{static __wrap(t){t=t>>>0;let e=Object.create(a.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();r.__wbg_proxysession_free(t,0)}close(){let t=this.__destroy_into_raw(),e=r.proxysession_close(t);return u(e)}handle_request(t){let e=r.proxysession_handle_request(this.__wbg_ptr,c(t));return u(e)}constructor(t,e){try{rt(t,F);let n=r.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 a{static __wrap(t){t=t>>>0;let e=Object.create(a.prototype);return e.__wbg_ptr=t,wt.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,wt.unregister(this),t}free(){let t=this.__destroy_into_raw();r.__wbg_table_free(t,0)}__getClassname(){try{let _=r.__wbindgen_add_to_stack_pointer(-16);r.table___getClassname(_,this.__wbg_ptr);var t=s().getInt32(_+0,!0),e=s().getInt32(_+4,!0),n=d(t,e);return t!==0&&r.__wbindgen_export4(t,e,1),n}finally{r.__wbindgen_add_to_stack_pointer(16)}}clear(){let t=r.table_clear(this.__wbg_ptr);return u(t)}columns(){let t=r.table_columns(this.__wbg_ptr);return u(t)}delete(t){let e=this.__destroy_into_raw(),n=r.table_delete(e,f(t)?0:c(t));return u(n)}describe(t){let e=r.table_describe(this.__wbg_ptr,f(t)?0:c(t));return u(e)}get_client(){let t=r.table_get_client(this.__wbg_ptr);return u(t)}get_features(){let t=r.table_get_features(this.__wbg_ptr);return u(t)}get_index(){let t=r.table_get_index(this.__wbg_ptr);return u(t)}get_limit(){let t=r.table_get_limit(this.__wbg_ptr);return u(t)}get_name(){let t=r.table_get_name(this.__wbg_ptr);return u(t)}make_port(){let t=r.table_make_port(this.__wbg_ptr);return u(t)}on_delete(t){let e=r.table_on_delete(this.__wbg_ptr,c(t));return u(e)}remove(t,e){let n=r.table_remove(this.__wbg_ptr,c(t),f(e)?0:c(e));return u(n)}remove_delete(t){let e=r.table_remove_delete(this.__wbg_ptr,t);return u(e)}replace(t,e){let n=r.table_replace(this.__wbg_ptr,c(t),f(e)?0:c(e));return u(n)}schema(){let t=r.table_schema(this.__wbg_ptr);return u(t)}size(){let t=r.table_size(this.__wbg_ptr);return u(t)}update(t,e){let n=r.table_update(this.__wbg_ptr,c(t),f(e)?0:c(e));return u(n)}validate_expressions(t){let e=r.table_validate_expressions(this.__wbg_ptr,c(t));return u(e)}view(t){let e=r.table_view(this.__wbg_ptr,f(t)?0:c(t));return u(e)}};Symbol.dispose&&(z.prototype[Symbol.dispose]=z.prototype.free);var I=class a{static __wrap(t){t=t>>>0;let e=Object.create(a.prototype);return e.__wbg_ptr=t,lt.register(e,e.__wbg_ptr,e),e}static __unwrap(t){return t instanceof a?t.__destroy_into_raw():0}__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,lt.unregister(this),t}free(){let t=this.__destroy_into_raw();r.__wbg_view_free(t,0)}__get_model(){let t=r.view___get_model(this.__wbg_ptr);return a.__wrap(t)}__unsafe_get_name(){try{let _=r.__wbindgen_add_to_stack_pointer(-16);r.view___unsafe_get_name(_,this.__wbg_ptr);var t=s().getInt32(_+0,!0),e=s().getInt32(_+4,!0),n=d(t,e);return t!==0&&r.__wbindgen_export4(t,e,1),n}finally{r.__wbindgen_add_to_stack_pointer(16)}}collapse(t){let e=r.view_collapse(this.__wbg_ptr,t);return u(e)}column_paths(t){let e=r.view_column_paths(this.__wbg_ptr,f(t)?0:c(t));return u(e)}delete(){let t=this.__destroy_into_raw(),e=r.view_delete(t);return u(e)}dimensions(){let t=r.view_dimensions(this.__wbg_ptr);return u(t)}expand(t){let e=r.view_expand(this.__wbg_ptr,t);return u(e)}expression_schema(){let t=r.view_expression_schema(this.__wbg_ptr);return u(t)}get_config(){let t=r.view_get_config(this.__wbg_ptr);return u(t)}get_min_max(t){let e=m(t,r.__wbindgen_export,r.__wbindgen_export2),n=p,_=r.view_get_min_max(this.__wbg_ptr,e,n);return u(_)}num_columns(){let t=r.view_num_columns(this.__wbg_ptr);return u(t)}num_rows(){let t=r.view_num_rows(this.__wbg_ptr);return u(t)}on_delete(t){let e=r.view_on_delete(this.__wbg_ptr,c(t));return u(e)}on_remove(t){let e=r.view_on_remove(this.__wbg_ptr,c(t));return u(e)}on_update(t,e){let n=r.view_on_update(this.__wbg_ptr,c(t),f(e)?0:c(e));return u(n)}remove_delete(t){let e=r.view_remove_delete(this.__wbg_ptr,t);return u(e)}remove_remove(t){let e=r.view_remove_remove(this.__wbg_ptr,t);return u(e)}remove_update(t){let e=r.view_remove_update(this.__wbg_ptr,t);return u(e)}schema(){let t=r.view_schema(this.__wbg_ptr);return u(t)}set_depth(t){let e=r.view_set_depth(this.__wbg_ptr,t);return u(e)}to_arrow(t){let e=r.view_to_arrow(this.__wbg_ptr,f(t)?0:c(t));return u(e)}to_columns(t){let e=r.view_to_columns(this.__wbg_ptr,f(t)?0:c(t));return u(e)}to_columns_string(t){let e=r.view_to_columns_string(this.__wbg_ptr,f(t)?0:c(t));return u(e)}to_csv(t){let e=r.view_to_csv(this.__wbg_ptr,f(t)?0:c(t));return u(e)}to_json(t){let e=r.view_to_json(this.__wbg_ptr,f(t)?0:c(t));return u(e)}to_json_string(t){let e=r.view_to_json_string(this.__wbg_ptr,f(t)?0:c(t));return u(e)}to_ndjson(t){let e=r.view_to_ndjson(this.__wbg_ptr,f(t)?0:c(t));return u(e)}with_typed_arrays(t,e){let n=r.view_with_typed_arrays(this.__wbg_ptr,f(t)?0:c(t),c(e));return u(n)}};Symbol.dispose&&(I.prototype[Symbol.dispose]=I.prototype.free);var M=class a{static __wrap(t){t=t>>>0;let e=Object.create(a.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();r.__wbg_virtualdataslice_free(t,0)}fromArrowIpc(t){try{let _=r.__wbindgen_add_to_stack_pointer(-16);r.virtualdataslice_fromArrowIpc(_,this.__wbg_ptr,c(t));var e=s().getInt32(_+0,!0),n=s().getInt32(_+4,!0);if(n)throw u(e)}finally{r.__wbindgen_add_to_stack_pointer(16)}}constructor(t){let e=r.virtualdataslice_new(c(t));return this.__wbg_ptr=e>>>0,et.register(this,this.__wbg_ptr,this),this}setBooleanCol(t,e,n,_){try{let g=r.__wbindgen_add_to_stack_pointer(-16),w=m(t,r.__wbindgen_export,r.__wbindgen_export2),v=p;r.virtualdataslice_setBooleanCol(g,this.__wbg_ptr,w,v,e,c(n),f(_)?4294967297:_>>>0);var i=s().getInt32(g+0,!0),b=s().getInt32(g+4,!0);if(b)throw u(i)}finally{r.__wbindgen_add_to_stack_pointer(16)}}setCol(t,e,n,_,i){try{let w=r.__wbindgen_add_to_stack_pointer(-16),v=m(t,r.__wbindgen_export,r.__wbindgen_export2),h=p,y=m(e,r.__wbindgen_export,r.__wbindgen_export2),x=p;r.virtualdataslice_setCol(w,this.__wbg_ptr,v,h,y,x,n,c(_),f(i)?4294967297:i>>>0);var b=s().getInt32(w+0,!0),g=s().getInt32(w+4,!0);if(g)throw u(b)}finally{r.__wbindgen_add_to_stack_pointer(16)}}setDatetimeCol(t,e,n,_){try{let g=r.__wbindgen_add_to_stack_pointer(-16),w=m(t,r.__wbindgen_export,r.__wbindgen_export2),v=p;r.virtualdataslice_setDatetimeCol(g,this.__wbg_ptr,w,v,e,c(n),f(_)?4294967297:_>>>0);var i=s().getInt32(g+0,!0),b=s().getInt32(g+4,!0);if(b)throw u(i)}finally{r.__wbindgen_add_to_stack_pointer(16)}}setFloatCol(t,e,n,_){try{let g=r.__wbindgen_add_to_stack_pointer(-16),w=m(t,r.__wbindgen_export,r.__wbindgen_export2),v=p;r.virtualdataslice_setFloatCol(g,this.__wbg_ptr,w,v,e,c(n),f(_)?4294967297:_>>>0);var i=s().getInt32(g+0,!0),b=s().getInt32(g+4,!0);if(b)throw u(i)}finally{r.__wbindgen_add_to_stack_pointer(16)}}setIntegerCol(t,e,n,_){try{let g=r.__wbindgen_add_to_stack_pointer(-16),w=m(t,r.__wbindgen_export,r.__wbindgen_export2),v=p;r.virtualdataslice_setIntegerCol(g,this.__wbg_ptr,w,v,e,c(n),f(_)?4294967297:_>>>0);var i=s().getInt32(g+0,!0),b=s().getInt32(g+4,!0);if(b)throw u(i)}finally{r.__wbindgen_add_to_stack_pointer(16)}}setStringCol(t,e,n,_){try{let g=r.__wbindgen_add_to_stack_pointer(-16),w=m(t,r.__wbindgen_export,r.__wbindgen_export2),v=p;r.virtualdataslice_setStringCol(g,this.__wbg_ptr,w,v,e,c(n),f(_)?4294967297:_>>>0);var i=s().getInt32(g+0,!0),b=s().getInt32(g+4,!0);if(b)throw u(i)}finally{r.__wbindgen_add_to_stack_pointer(16)}}};Symbol.dispose&&(M.prototype[Symbol.dispose]=M.prototype.free);var J=class{__destroy_into_raw(){let t=this.__wbg_ptr;return this.__wbg_ptr=0,pt.unregister(this),t}free(){let t=this.__destroy_into_raw();r.__wbg_virtualserver_free(t,0)}handleRequest(t){let e=te(t,r.__wbindgen_export),n=p,_=r.virtualserver_handleRequest(this.__wbg_ptr,e,n);return u(_)}constructor(t){try{let i=r.__wbindgen_add_to_stack_pointer(-16);r.virtualserver_new(i,c(t));var e=s().getInt32(i+0,!0),n=s().getInt32(i+4,!0),_=s().getInt32(i+8,!0);if(_)throw u(n);return this.__wbg_ptr=e>>>0,pt.register(this,this.__wbg_ptr,this),this}finally{r.__wbindgen_add_to_stack_pointer(16)}}};Symbol.dispose&&(J.prototype[Symbol.dispose]=J.prototype.free);function Ft(){try{let n=r.__wbindgen_add_to_stack_pointer(-16);r.getColumnConfigDefaults(n);var a=s().getInt32(n+0,!0),t=s().getInt32(n+4,!0),e=s().getInt32(n+8,!0);if(e)throw u(t);return u(a)}finally{r.__wbindgen_add_to_stack_pointer(16)}}function Rt(){try{let n=r.__wbindgen_add_to_stack_pointer(-16);r.getPluginConfigDefaults(n);var a=s().getInt32(n+0,!0),t=s().getInt32(n+4,!0),e=s().getInt32(n+8,!0);if(e)throw u(t);return u(a)}finally{r.__wbindgen_add_to_stack_pointer(16)}}function Et(){try{let n=r.__wbindgen_add_to_stack_pointer(-16);r.get_wasm_module(n);var a=s().getInt32(n+0,!0),t=s().getInt32(n+4,!0),e=s().getInt32(n+8,!0);if(e)throw u(t);return u(a)}finally{r.__wbindgen_add_to_stack_pointer(16)}}function Tt(){try{let n=r.__wbindgen_add_to_stack_pointer(-16);r.get_worker_url(n);var a=s().getInt32(n+0,!0),t=s().getInt32(n+4,!0),e=s().getInt32(n+8,!0);if(e)throw u(t);return u(a)}finally{r.__wbindgen_add_to_stack_pointer(16)}}function Pt(a,t){r.init(c(a),c(t))}function Ot(a){let t=m(a,r.__wbindgen_export,r.__wbindgen_export2),e=p;r.registerPlugin(t,e)}function jt(a,t){try{let _=r.__wbindgen_add_to_stack_pointer(-16);r.setColumnConfigDefaults(_,c(a),f(t)?0:c(t));var e=s().getInt32(_+0,!0),n=s().getInt32(_+4,!0);if(n)throw u(e)}finally{r.__wbindgen_add_to_stack_pointer(16)}}function zt(a,t){try{let _=r.__wbindgen_add_to_stack_pointer(-16);r.setPluginConfigDefaults(_,c(a),f(t)?0:c(t));var e=s().getInt32(_+0,!0),n=s().getInt32(_+4,!0);if(n)throw u(e)}finally{r.__wbindgen_add_to_stack_pointer(16)}}function ht(){return{__proto__:null,\"./perspective-viewer.wasm_bg.js\":{__proto__:null,__wbg_Error_8c4e43fe74559d73:function(t,e){var n=d(t,e);let _=Error(n);return c(_)},__wbg_Number_04624de7d0e8332d:function(t){return Number(o(t))},__wbg_String_8f0eb39a4a4c2f66:function(t,e){let n=String(o(e)),_=m(n,r.__wbindgen_export,r.__wbindgen_export2),i=p;s().setInt32(t+4,i,!0),s().setInt32(t+0,_,!0)},__wbg___wbindgen_bigint_get_as_i64_8fcf4ce7f1ca72a2:function(t,e){let n=o(e),_=typeof n==\"bigint\"?n:void 0;s().setBigInt64(t+8,f(_)?BigInt(0):_,!0),s().setInt32(t+0,!f(_),!0)},__wbg___wbindgen_boolean_get_bbbb1c18aa2f5e25:function(t){let e=o(t),n=typeof e==\"boolean\"?e:void 0;return f(n)?16777215:n?1:0},__wbg___wbindgen_debug_string_0bc8482c6e3508ae:function(t,e){let n=_t(o(e)),_=m(n,r.__wbindgen_export,r.__wbindgen_export2),i=p;s().setInt32(t+4,i,!0),s().setInt32(t+0,_,!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),_=typeof n==\"number\"?n:void 0;s().setFloat64(t+8,f(_)?0:_,!0),s().setInt32(t+0,!f(_),!0)},__wbg___wbindgen_string_get_72fb696202c56729:function(t,e){let n=o(e),_=typeof n==\"string\"?n:void 0;var i=f(_)?0:m(_,r.__wbindgen_export,r.__wbindgen_export2),b=p;s().setInt32(t+4,b,!0),s().setInt32(t+0,i,!0)},__wbg___wbindgen_throw_be289d5034ed271b:function(t,e){var n=d(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 l(function(t,e,n,_){var i=d(e,n);o(t).addEventListener(i,o(_))},arguments)},__wbg_addEventListener_5ef04ffb1d3af066:function(){return l(function(t,e,n,_,i){var b=d(e,n);o(t).addEventListener(b,o(_),i!==0)},arguments)},__wbg_addEventListener_c917b5aafbcf493f:function(){return l(function(t,e,n,_,i){var b=d(e,n);o(t).addEventListener(b,o(_),o(i))},arguments)},__wbg_add_2b0552fe2d2151c8:function(t,e){let n=o(t).add(o(e));return c(n)},__wbg_add_5be83378df680c25:function(){return l(function(t,e,n){var _=d(e,n);o(t).add(_)},arguments)},__wbg_adoptedStyleSheets_542d651fbb47685f:function(t){let e=o(t).adoptedStyleSheets;return c(e)},__wbg_adoptedStyleSheets_d149afb005470855:function(t){let e=o(t).adoptedStyleSheets;return c(e)},__wbg_appendChild_dea38765a26d346d:function(){return l(function(t,e){let n=o(t).appendChild(o(e));return c(n)},arguments)},__wbg_append_a992ccc37aa62dc4:function(){return l(function(t,e,n,_,i){var b=d(e,n),g=d(_,i);o(t).append(b,g)},arguments)},__wbg_apply_2e22c45cb4f12415:function(){return l(function(t,e,n){let _=Reflect.apply(o(t),o(e),o(n));return c(_)},arguments)},__wbg_apply_ada2ee1a60ac7b3c:function(){return l(function(t,e,n){let _=o(t).apply(o(e),o(n));return c(_)},arguments)},__wbg_assign_6170c0d04d5c26f4:function(t,e){let n=Object.assign(o(t),o(e));return c(n)},__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 l(function(t,e){let n=o(t).attachShadow(o(e));return c(n)},arguments)},__wbg_blur_07f34335e06e5234:function(){return l(function(t){o(t).blur()},arguments)},__wbg_body_3a0b4437dadea6bf:function(t){let e=o(t).body;return f(e)?0:c(e)},__wbg_body_f67922363a220026:function(t){let e=o(t).body;return f(e)?0:c(e)},__wbg_bootstrap_2a6d707d9930b176:function(t,e,n,_,i,b){var g=d(e,n),w=d(_,i);let v=ut(o(t),g,w,u(b));return c(v)},__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 f(e)?4294967297:e>>>0},__wbg_calculatePath_ec4e1b31c2e0e267:function(t,e,n){var _=d(e,n);let i=o(t).calculatePath(_);return c(i)},__wbg_calculatePresizePaths_74530e5aadce2dcf:function(t){let e=o(t).calculatePresizePaths();return c(e)},__wbg_call_389efe28435a9388:function(){return l(function(t,e){let n=o(t).call(o(e));return c(n)},arguments)},__wbg_call_41bedb84c3e5c0c9:function(){return l(function(t,e,n,_,i,b){let g=o(t).call(o(e),o(n),o(_),o(i),o(b));return c(g)},arguments)},__wbg_call_4708e0c13bdc8e95:function(){return l(function(t,e,n){let _=o(t).call(o(e),o(n));return c(_)},arguments)},__wbg_call_812d25f1510c13c8:function(){return l(function(t,e,n,_){let i=o(t).call(o(e),o(n),o(_));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,_=m(n,r.__wbindgen_export,r.__wbindgen_export2),i=p;s().setInt32(t+4,i,!0),s().setInt32(t+0,_,!0)},__wbg_clear_8acecf1cd271592d:function(){return l(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=F.__wrap(t);return c(e)},__wbg_clipboard_98c5a32249fa8416:function(t){let e=o(t).clipboard;return c(e)},__wbg_clipboard_write_635ef00ad4bb61ff:function(){return l(function(t,e,n){var _=d(t,e);let i=at(_,o(n));return c(i)},arguments)},__wbg_cloneNode_b85e9102a9a31b29:function(){return l(function(t,e){let n=o(t).cloneNode(e!==0);return c(n)},arguments)},__wbg_cloneNode_eaf4ea08ebf633a5:function(){return l(function(t){let e=o(t).cloneNode();return c(e)},arguments)},__wbg_close_fad2f0ee451926ed:function(t){o(t).close()},__wbg_closest_11206fe6e0fb4e4e:function(){return l(function(t,e,n){var _=d(e,n);let i=o(t).closest(_);return f(i)?0:c(i)},arguments)},__wbg_code_dee0dae4730408e1:function(t,e){let n=o(e).code,_=m(n,r.__wbindgen_export,r.__wbindgen_export2),i=p;s().setInt32(t+4,i,!0),s().setInt32(t+0,_,!0)},__wbg_column_config_schema_a1d05ccd83ffadb0:function(){return l(function(t,e,n,_,i,b,g,w,v,h,y,x){var C=d(e,n),q=d(_,i),D=d(b,g),kt=d(y,x);let St=o(t).column_config_schema(C,q,D,o(w),o(v),o(h),kt);return c(St)},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 _=d(e,n);return o(t).contains(_)},__wbg_contentRect_c33dd8c6c98c10ec:function(t){let e=o(t).contentRect;return c(e)},__wbg_contentWindow_9efd0073ff9fa45b:function(t){let e=o(t).contentWindow;return f(e)?0:c(e)},__wbg_createElementNS_ee00621496b30ec2:function(){return l(function(t,e,n,_,i){var b=d(e,n),g=d(_,i);let w=o(t).createElementNS(b,g);return c(w)},arguments)},__wbg_createElement_49f60fdcaae809c8:function(){return l(function(t,e,n){var _=d(e,n);let i=o(t).createElement(_);return c(i)},arguments)},__wbg_createObjectURL_918185db6a10a0c8:function(){return l(function(t,e){let n=URL.createObjectURL(o(e)),_=m(n,r.__wbindgen_export,r.__wbindgen_export2),i=p;s().setInt32(t+4,i,!0),s().setInt32(t+0,_,!0)},arguments)},__wbg_createTextNode_55029686c9591bf3:function(t,e,n){var _=d(e,n);let i=o(t).createTextNode(_);return c(i)},__wbg_cssRules_554f47f3049cf066:function(){return l(function(t){let e=o(t).cssRules;return c(e)},arguments)},__wbg_cssRules_85954e7c284ec53b:function(t){let e=o(t).cssRules;return c(e)},__wbg_cssText_8f3f27e60c824421:function(t,e){let n=o(e).cssText,_=m(n,r.__wbindgen_export,r.__wbindgen_export2),i=p;s().setInt32(t+4,i,!0),s().setInt32(t+0,_,!0)},__wbg_dataTransfer_d924a622fbe51b06:function(t){let e=o(t).dataTransfer;return f(e)?0:c(e)},__wbg_data_5330da50312d0bc1:function(t){let e=o(t).data;return c(e)},__wbg_dataset_20cb5c72458ae3fc:function(t){let e=o(t).dataset;return c(e)},__wbg_debug_46a93995fc6f8820:function(t,e,n,_){console.debug(o(t),o(e),o(n),o(_))},__wbg_debug_a4099fa12db6cd61:function(t){console.debug(o(t))},__wbg_decode_a28a47c6d83f2594:function(){return l(function(t,e,n,_,i){let b=o(e).decode(E(n,_),o(i)),g=m(b,r.__wbindgen_export,r.__wbindgen_export2),w=p;s().setInt32(t+4,w,!0),s().setInt32(t+0,g,!0)},arguments)},__wbg_define_panel_tab_a022a846f2f3f00c:function(t,e){var n=d(t,e);ct(n)},__wbg_delete_8318b529ff42aa20:function(t,e,n){var _=d(e,n);delete o(t)[_]},__wbg_delete_cb38d3df659ef700:function(t){o(t).delete()},__wbg_deselect_9a4eff6d68982366:function(){return l(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 l(function(t,e){return o(t).dispatchEvent(o(e))},arguments)},__wbg_document_ee35a3d3ae34ef6c:function(t){let e=o(t).document;return f(e)?0:c(e)},__wbg_done_57b39ecd9addfe81:function(t){return o(t).done},__wbg_draw_da6e3692781f246e:function(){return l(function(t,e,n,_,i){let b=o(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(o(t));return c(e)},__wbg_error_3c7d958458bf649b:function(t,e){var n=vt(t,e).slice();r.__wbindgen_export4(t,e*4,4),console.error(...n)},__wbg_error_7534b8e9a36f1ab4:function(t,e){var n=d(t,e);t!==0&&r.__wbindgen_export4(t,e,1),console.error(n)},__wbg_error_794d0ffc9d00d5c3:function(t,e,n,_){console.error(o(t),o(e),o(n),o(_))},__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 l(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,_){var i=d(n,_);let b=o(e).getAttribute(i);var g=f(b)?0:m(b,r.__wbindgen_export,r.__wbindgen_export2),w=p;s().setInt32(t+4,w,!0),s().setInt32(t+0,g,!0)},__wbg_getBoundingClientRect_b5c8c34d07878818:function(t){let e=o(t).getBoundingClientRect();return c(e)},__wbg_getComputedStyle_2d1f9dfe4ee7e0b9:function(){return l(function(t,e){let n=o(t).getComputedStyle(o(e));return f(n)?0:c(n)},arguments)},__wbg_getContext_2a5764d48600bc43:function(){return l(function(t,e,n){var _=d(e,n);let i=o(t).getContext(_);return f(i)?0:c(i)},arguments)},__wbg_getEntriesByName_02488cff0bc7581c:function(t,e,n,_,i){var b=d(e,n),g=d(_,i);let w=o(t).getEntriesByName(b,g);return c(w)},__wbg_getPropertyValue_d6911b2a1f9acba9:function(){return l(function(t,e,n,_){var i=d(n,_);let b=o(e).getPropertyValue(i),g=m(b,r.__wbindgen_export,r.__wbindgen_export2),w=p;s().setInt32(t+4,w,!0),s().setInt32(t+0,g,!0)},arguments)},__wbg_getRandomValues_1c61fac11405ffdc:function(){return l(function(t,e){globalThis.crypto.getRandomValues(E(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 l(function(t){let e=o(t).getSelection();return f(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_0bdeda968867e10e:function(){return l(function(t,e){let n=Reflect.get(o(t),e>>>0);return c(n)},arguments)},__wbg_get_5dd1ee4c9f462865:function(t,e,n,_){var i=d(n,_);let b=o(e)[i];var g=f(b)?0:m(b,r.__wbindgen_export,r.__wbindgen_export2),w=p;s().setInt32(t+4,w,!0),s().setInt32(t+0,g,!0)},__wbg_get_76e04509d1922a04:function(t,e,n){var _=d(e,n);let i=o(t)[_];return f(i)?0:c(i)},__wbg_get_941633a1d2f510cb:function(){return l(function(t,e,n,_){var i=d(n,_);let b=o(e).get(i);var g=f(b)?0:m(b,r.__wbindgen_export,r.__wbindgen_export2),w=p;s().setInt32(t+4,w,!0),s().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 l(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 f(n)?0:c(n)},__wbg_get_static_config_2fb609fb313e5ab8: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 f(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 _=d(e,n);return o(t).hasAttribute(_)},__wbg_has_991efccb5a701a27:function(t,e){return o(t).has(o(e))},__wbg_has_d4e53238966c12b6:function(){return l(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 l(function(t){o(t).hidePopover()},arguments)},__wbg_hit_test_318eb10b91417fe6:function(){return l(function(t,e,n){let _=o(t).hit_test(e,n);return c(_)},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,_){console.info(o(t),o(e),o(n),o(_))},__wbg_innerHeight_54aa104da08becd2:function(){return l(function(t){let e=o(t).innerHeight;return c(e)},arguments)},__wbg_innerWidth_fa95c57321f4f033:function(){return l(function(t){let e=o(t).innerWidth;return c(e)},arguments)},__wbg_insertBefore_1468142836e61a51:function(){return l(function(t,e,n){let _=o(t).insertBefore(o(e),o(n));return c(_)},arguments)},__wbg_insertPanel_f03a21e20c5921df:function(t,e,n,_,i){var b=d(e,n);let g=o(t).insertPanel(b,u(_),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_CssGroupingRule_875241920a85dfd7:function(t){let e;try{e=o(t)instanceof CSSGroupingRule}catch{e=!1}return e},__wbg_instanceof_CssImportRule_21bd264cef048043:function(t){let e;try{e=o(t)instanceof CSSImportRule}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_CssStyleSheet_622aeba16e7e2d66:function(t){let e;try{e=o(t)instanceof CSSStyleSheet}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_12e0d9feaf791ef9: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_48715d3212ed96cb:function(t,e){let n=o(t).item(e>>>0);return f(n)?0:c(n)},__wbg_item_5c82f52b014b3056:function(t,e){let n=o(t).item(e>>>0);return f(n)?0:c(n)},__wbg_item_64b77e6a26f7de76:function(t,e){let n=o(t).item(e>>>0);return f(n)?0:c(n)},__wbg_item_ca823df8214b9e2b:function(t,e){let n=o(t).item(e>>>0);return f(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,_=m(n,r.__wbindgen_export,r.__wbindgen_export2),i=p;s().setInt32(t+4,i,!0),s().setInt32(t+0,_,!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 f(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_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 f(e)?4294967297:e>>>0},__wbg_load_f8d29f3c1bda8dd1:function(t,e,n,_,i){var b=d(e,n),g=d(_,i);let w=o(t).load(b,g);return c(w)},__wbg_mark_3b530a64b09ba08a:function(){return l(function(t,e,n){var _=d(e,n);o(t).mark(_)},arguments)},__wbg_maximize_165146aae8127441:function(t,e,n){var _=d(e,n);o(t).maximize(_)},__wbg_measureText_9d64a92333bd05ee:function(){return l(function(t,e,n){var _=d(e,n);let i=o(t).measureText(_);return c(i)},arguments)},__wbg_measure_288b48c082eae0fe:function(){return l(function(t,e,n,_,i){var b=d(e,n),g=d(_,i);o(t).measure(b,g)},arguments)},__wbg_message_9ddc4b9a62a7c379:function(t){let e=o(t).message;return c(e)},__wbg_minimize_bcdf0c5bfe3a5cd6:function(t){o(t).minimize()},__wbg_namespaceURI_86e2062c65f0f341:function(t,e){let n=o(e).namespaceURI;var _=f(n)?0:m(n,r.__wbindgen_export,r.__wbindgen_export2),i=p;s().setInt32(t+4,i,!0),s().setInt32(t+0,_,!0)},__wbg_navigator_43be698ba96fc088:function(t){let e=o(t).navigator;return c(e)},__wbg_new_16c83877745f8d12:function(){return l(function(t,e){var n=d(t,e);let _=new InputEvent(n);return c(_)},arguments)},__wbg_new_1d5bd472c706b768:function(){return l(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_2ec3ec8c398b20d2:function(){return l(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 l(function(t,e){var n=d(t,e);let _=new CustomEvent(n);return c(_)},arguments)},__wbg_new_3eb36ae241fe6f44:function(){let t=new Array;return c(t)},__wbg_new_406106b44b3d11fa:function(t){let e=new Set(o(t));return c(e)},__wbg_new_64284bd487f9d239:function(){return l(function(){let t=new Headers;return c(t)},arguments)},__wbg_new_6f0524fbfa300c47:function(){return l(function(){let t=new MessageChannel;return c(t)},arguments)},__wbg_new_72b49615380db768:function(t,e){var n=d(t,e);let _=new Error(n);return c(_)},__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_8fec9586bfa334f1:function(t){let e=new st(o(t));return c(e)},__wbg_new_b5d9e2fb389fef91:function(t,e){try{var n={a:t,b:e},_=(b,g)=>{let w=n.a;n.a=0;try{return Ht(w,n.b,b,g)}finally{n.a=w}};let i=new Promise(_);return c(i)}finally{n.a=n.b=0}},__wbg_new_b949e7f56150a5d1:function(){return l(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_dca287b076112a51:function(){return c(new Map)},__wbg_new_dd2b680c8bf6ae29:function(t){let e=new Uint8Array(o(t));return c(e)},__wbg_new_f8e621849595859d:function(t){let e=new it(o(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=d(t,e);let _=new Function(n);return c(_)},__wbg_new_with_event_init_dict_48877e7ca125f3c1:function(){return l(function(t,e,n){var _=d(t,e);let i=new CustomEvent(_,o(n));return c(i)},arguments)},__wbg_new_with_str_and_init_a61cbc6bdef21614:function(){return l(function(t,e,n){var _=d(t,e);let i=new Request(_,o(n));return c(i)},arguments)},__wbg_new_with_str_sequence_and_options_9b8b0bee99ec6b0f:function(){return l(function(t,e){let n=new Blob(o(t),o(e));return c(n)},arguments)},__wbg_new_with_u8_array_sequence_08b2096a9f3117c0:function(){return l(function(t){let e=new Blob(o(t));return c(e)},arguments)},__wbg_nextSibling_2e988d9bbe3e06f0:function(t){let e=o(t).nextSibling;return f(e)?0:c(e)},__wbg_next_3482f54c49e8af19:function(){return l(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_30e2b1d1734b4f5b:function(t,e){o(t).observe(o(e))},__wbg_observe_9eeb06a51ff51720: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 f(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_overlay_f897d9506f79ff45:function(t){let e=o(t).overlay;return c(e)},__wbg_parentElement_75863410a8617953:function(t){let e=o(t).parentElement;return f(e)?0:c(e)},__wbg_parentNode_d44bd5ec58601e45:function(t){let e=o(t).parentNode;return f(e)?0:c(e)},__wbg_parse_708461a1feddfb38:function(){return l(function(t,e){var n=d(t,e);let _=JSON.parse(n);return c(_)},arguments)},__wbg_performance_06f12ba62483475d:function(t){let e=o(t).performance;return f(e)?0:c(e)},__wbg_plugin_config_schema_951aaf0c42ce4103:function(){return l(function(t,e,n){let _=o(t).plugin_config_schema(o(e),o(n));return c(_)},arguments)},__wbg_pointerId_466b1bdcaf2fe835:function(t){return o(t).pointerId},__wbg_pop_80fa29128215a463:function(t){let e=o(t).pop();return c(e)},__wbg_port1_6251ddc5cf5c9287:function(t){let e=o(t).port1;return c(e)},__wbg_port2_b2a294b0ede1e13c:function(t){let e=o(t).port2;return c(e)},__wbg_postMessage_99dab4742cd26c46:function(){return l(function(t,e,n,_,i){var b=d(n,_);o(t).postMessage(o(e),b,o(i))},arguments)},__wbg_prepend_12ed960547d9dfe1:function(){return l(function(t,e){o(t).prepend(o(e))},arguments)},__wbg_presize_fabbd48e8f9835bc:function(){return l(function(t,e,n){let _=o(t).presize(e,n);return c(_)},arguments)},__wbg_preventDefault_cdcfcd7e301b9702:function(t){o(t).preventDefault()},__wbg_prototypesetcall_bdcdcc5842e4d77d:function(t,e,n){Uint8Array.prototype.set.call(E(t,e),o(n))},__wbg_push_8ffdcb2063340ba5:function(t,e){return o(t).push(o(e))},__wbg_querySelectorAll_1283aae52043a951:function(){return l(function(t,e,n){var _=d(e,n);let i=o(t).querySelectorAll(_);return c(i)},arguments)},__wbg_querySelectorAll_5875742f4e11f759:function(){return l(function(t,e,n){var _=d(e,n);let i=o(t).querySelectorAll(_);return c(i)},arguments)},__wbg_querySelector_1be4292f202b1597:function(){return l(function(t,e,n){var _=d(e,n);let i=o(t).querySelector(_);return f(i)?0:c(i)},arguments)},__wbg_querySelector_4dc619d02f6cb079:function(){return l(function(t,e,n){var _=d(e,n);let i=o(t).querySelector(_);return f(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,_=m(n,r.__wbindgen_export,r.__wbindgen_export2),i=p;s().setInt32(t+4,i,!0),s().setInt32(t+0,_,!0)},__wbg_realCoordinates_78d80792fe45c1ac: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 f(e)?0:c(e)},__wbg_releasePointerCapture_420ef33c7c5fb6f4:function(){return l(function(t,e){o(t).releasePointerCapture(e)},arguments)},__wbg_removeAllRanges_39254b77dc6257ab:function(){return l(function(t){o(t).removeAllRanges()},arguments)},__wbg_removeAttribute_87259aab06d9f286:function(){return l(function(t,e,n){var _=d(e,n);o(t).removeAttribute(_)},arguments)},__wbg_removeChild_2f0b06213dbc49ca:function(){return l(function(t,e){let n=o(t).removeChild(o(e));return c(n)},arguments)},__wbg_removeEventListener_0c0902ed5009dd9f:function(){return l(function(t,e,n,_,i){var b=d(e,n);o(t).removeEventListener(b,o(_),i!==0)},arguments)},__wbg_removeEventListener_e63328781a5b9af9:function(){return l(function(t,e,n,_){var i=d(e,n);o(t).removeEventListener(i,o(_))},arguments)},__wbg_removePanel_abf8244e1d93ce46:function(t,e,n){var _=d(e,n);let i=o(t).removePanel(_);return c(i)},__wbg_removeProperty_a0d2ff8a76ffd2b1:function(){return l(function(t,e,n,_){var i=d(n,_);let b=o(e).removeProperty(i),g=m(b,r.__wbindgen_export,r.__wbindgen_export2),w=p;s().setInt32(t+4,w,!0),s().setInt32(t+0,g,!0)},arguments)},__wbg_remove_31c39325eee968fc:function(t){o(t).remove()},__wbg_remove_f9451697e0bc6ca0:function(){return l(function(t,e,n){var _=d(e,n);o(t).remove(_)},arguments)},__wbg_render_413dc7c2163aeef3:function(){return l(function(t,e,n){let _=o(t).render(I.__wrap(e),u(n));return c(_)},arguments)},__wbg_replaceSync_54e9ce897fe6ab6a:function(){return l(function(t,e,n){var _=d(e,n);o(t).replaceSync(_)},arguments)},__wbg_requestAnimationFrame_43682f8e1c5e5348:function(){return l(function(t,e){return o(t).requestAnimationFrame(o(e))},arguments)},__wbg_resize_9f691e7e5d903fd7:function(){return l(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_53be454c7b33c820:function(t,e){o(t).restorePhysics(o(e))},__wbg_restoreSync_a5d618560a9bbd86:function(t,e){o(t).restoreSync(o(e))},__wbg_restore_3de855f8648b36f3:function(){return l(function(t,e,n){o(t).restore(o(e),o(n))},arguments)},__wbg_restyle_3318980da178e2a7:function(t){o(t).restyle()},__wbg_resumeResize_ce0e9532052de7b5:function(t){o(t).resumeResize()},__wbg_right_154af6c2b1bf0c89:function(t){return o(t).right},__wbg_run_445af8472ad115ff:function(){return l(function(t,e){let n=o(t).run(o(e));return c(n)},arguments)},__wbg_save_05e0270a31077458: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_18abcadc37ebf538:function(t,e,n){var _=d(e,n);let i=o(t).select(_);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 l(function(t){let e=o(t).selectionEnd;return f(e)?4294967297:e>>>0},arguments)},__wbg_selectionStart_9cd0aeff14a21252:function(){return l(function(t){let e=o(t).selectionStart;return f(e)?4294967297:e>>>0},arguments)},__wbg_selectorText_4ebdf4f8074dafea:function(t,e){let n=o(e).selectorText,_=m(n,r.__wbindgen_export,r.__wbindgen_export2),i=p;s().setInt32(t+4,i,!0),s().setInt32(t+0,_,!0)},__wbg_setAttribute_cc8e4c8a2a008508:function(){return l(function(t,e,n,_,i){var b=d(e,n),g=d(_,i);o(t).setAttribute(b,g)},arguments)},__wbg_setDragImage_76defbcc7ff30178:function(t,e,n,_){o(t).setDragImage(o(e),n,_)},__wbg_setPointerCapture_420db6f6826eb74b:function(){return l(function(t,e){o(t).setPointerCapture(e)},arguments)},__wbg_setProperty_cbb25c4e74285b39:function(){return l(function(t,e,n,_,i){var b=d(e,n),g=d(_,i);o(t).setProperty(b,g)},arguments)},__wbg_setSelectionRange_301eef1c51e01d2a:function(){return l(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 l(function(t,e,n){return o(t).setTimeout(o(e),n)},arguments)},__wbg_set_1eb0999cf5d27fc8:function(t,e,n){let _=o(t).set(o(e),o(n));return c(_)},__wbg_set_3f1d0b984ed272ed:function(t,e,n){o(t)[u(e)]=u(n)},__wbg_set_6cb8631f80447a67:function(){return l(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 _=d(e,n);o(t).className=_},__wbg_set_composed_e4a9826a628ca7f8:function(t,e){o(t).composed=e!==0},__wbg_set_cssText_18380c97092caefa:function(t,e,n){var _=d(e,n);o(t).cssText=_},__wbg_set_defaultValue_ad528b0a65ceef4a:function(){return l(function(t,e,n){var _=d(e,n);o(t).defaultValue=_},arguments)},__wbg_set_detail_fa3b358526be3a85:function(t,e){o(t).detail=o(e)},__wbg_set_dropEffect_042402609f0b7c6b:function(t,e,n){var _=d(e,n);o(t).dropEffect=_},__wbg_set_f43e577aea94465b:function(t,e,n){o(t)[e>>>0]=u(n)},__wbg_set_fb27b296001e2de9:function(){return l(function(t,e,n,_,i){var b=d(e,n),g=d(_,i);o(t)[b]=g},arguments)},__wbg_set_font_575685c8f7e56957:function(t,e,n){var _=d(e,n);o(t).font=_},__wbg_set_headers_cfc5f4b2c1f20549:function(t,e){o(t).headers=o(e)},__wbg_set_innerHTML_edd39677e3460291:function(t,e,n){var _=d(e,n);o(t).innerHTML=_},__wbg_set_innerText_2f1502f2d0780499:function(t,e,n){var _=d(e,n);o(t).innerText=_},__wbg_set_listener_id_8b77f7eb9adb712b:function(t,e){o(t).__yew_listener_id=e>>>0},__wbg_set_method_c3e20375f5ae7fac:function(t,e,n){var _=d(e,n);o(t).method=_},__wbg_set_mode_6a55f972d62a3c88:function(t,e){o(t).mode=Bt[e]},__wbg_set_nodeValue_d947eb0a476b80d7:function(t,e,n){var _=d(e,n);o(t).nodeValue=_},__wbg_set_onload_7f48f88f0514211d:function(t,e){o(t).onload=o(e)},__wbg_set_onmessage_0e1ffb1c0d91d2ad:function(t,e){o(t).onmessage=o(e)},__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 l(function(t,e){o(t).selectionEnd=e===4294967297?void 0:e},arguments)},__wbg_set_selectionStart_d68d6955c07c2be1:function(){return l(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 _=d(e,n);o(t).type=_},__wbg_set_value_62a965e38b22b38c:function(t,e,n){var _=d(e,n);o(t).value=_},__wbg_set_value_c3556fce049236f0:function(t,e,n){var _=d(e,n);o(t).value=_},__wbg_set_value_ddc3bd01a8467bf1:function(t,e,n){var _=d(e,n);o(t).value=_},__wbg_shadowRoot_14828067c5922da7:function(t){let e=o(t).shadowRoot;return f(e)?0:c(e)},__wbg_sheet_38c9043b5f37d85d:function(t){let e=o(t).sheet;return f(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 l(function(t){o(t).showPicker()},arguments)},__wbg_showPopover_7166cd0808998024:function(){return l(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,_=m(n,r.__wbindgen_export,r.__wbindgen_export2),i=p;s().setInt32(t+4,i,!0),s().setInt32(t+0,_,!0)},__wbg_stack_0ed75d68575b0f3c:function(t,e){let n=o(e).stack,_=m(n,r.__wbindgen_export,r.__wbindgen_export2),i=p;s().setInt32(t+4,i,!0),s().setInt32(t+0,_,!0)},__wbg_startTime_248495bfbcb427d3:function(t){return o(t).startTime},__wbg_static_accessor_GLOBAL_12837167ad935116:function(){let t=typeof self>\"u\"?null:self;return f(t)?0:c(t)},__wbg_static_accessor_GLOBAL_THIS_e628e89ab3b1c95f:function(){let t=typeof globalThis>\"u\"?null:globalThis;return f(t)?0:c(t)},__wbg_static_accessor_PSP_ad579a92fa44eb52:function(){return c(X)},__wbg_static_accessor_SELF_a621d3dfbb60d0ce:function(){let t=typeof self>\"u\"?null:self;return f(t)?0:c(t)},__wbg_static_accessor_WINDOW_f8727f0cf888e0bd:function(){let t=typeof window>\"u\"?null:window;return f(t)?0:c(t)},__wbg_statusText_556131a02d60f5cd:function(t,e){let n=o(e).statusText,_=m(n,r.__wbindgen_export,r.__wbindgen_export2),i=p;s().setInt32(t+4,i,!0),s().setInt32(t+0,_,!0)},__wbg_status_89d7e803db911ee7:function(t){return o(t).status},__wbg_stopPropagation_6e5e2a085214ac63:function(t){o(t).stopPropagation()},__wbg_stringify_2fdc12d5545a89d9:function(){return l(function(t,e,n){let _=JSON.stringify(o(t),o(e),o(n));return c(_)},arguments)},__wbg_stringify_8d1cc6ff383e8bae:function(){return l(function(t){let e=JSON.stringify(o(t));return c(e)},arguments)},__wbg_styleSheet_66d04471448b344e:function(t){let e=o(t).styleSheet;return f(e)?0:c(e)},__wbg_styleSheets_54de627270238f6f:function(t){let e=o(t).styleSheets;return c(e)},__wbg_styleSheets_f6881090d63936f3: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 f(e)?4294967297:e>>>0},__wbg_supportedValuesOf_4ed4698dca0c6279: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,_=m(n,r.__wbindgen_export,r.__wbindgen_export2),i=p;s().setInt32(t+4,i,!0),s().setInt32(t+0,_,!0)},__wbg_target_521be630ab05b11e:function(t){let e=o(t).target;return f(e)?0:c(e)},__wbg_text_083b8727c990c8c0:function(){return l(function(t){let e=o(t).text();return c(e)},arguments)},__wbg_then_0d9fe2c7b1857d32:function(t,e,n){let _=o(t).then(o(e),o(n));return c(_)},__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 l(function(t,e,n,_){var i=d(e,n);return o(t).toggleAttribute(i,_!==0)},arguments)},__wbg_toggle_52417ca95b874e83:function(){return l(function(t,e,n){var _=d(e,n);return o(t).toggle(_)},arguments)},__wbg_toggle_b8e3ebf1a7aaeb11:function(){return l(function(t,e,n,_){var i=d(e,n);return o(t).toggle(i,_!==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,_){console.trace(o(t),o(e),o(n),o(_))},__wbg_type_4edffca24c42b74d:function(t,e){let n=o(e).type,_=m(n,r.__wbindgen_export,r.__wbindgen_export2),i=p;s().setInt32(t+4,i,!0),s().setInt32(t+0,_,!0)},__wbg_unobserve_1a7fcd1a65c1b4b7:function(t,e){o(t).unobserve(o(e))},__wbg_unobserve_f612621cc2288a56:function(t,e){o(t).unobserve(o(e))},__wbg_update_44a19267b9c75794:function(){return l(function(t,e,n,_,i){let b=o(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 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,_=m(n,r.__wbindgen_export,r.__wbindgen_export2),i=p;s().setInt32(t+4,i,!0),s().setInt32(t+0,_,!0)},__wbg_value_d402dce7dcb16251:function(t,e){let n=o(e).value,_=m(n,r.__wbindgen_export,r.__wbindgen_export2),i=p;s().setInt32(t+4,i,!0),s().setInt32(t+0,_,!0)},__wbg_value_e506a07878790ca0:function(t,e){let n=o(e).value,_=m(n,r.__wbindgen_export,r.__wbindgen_export2),i=p;s().setInt32(t+4,i,!0),s().setInt32(t+0,_,!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,_){console.warn(o(t),o(e),o(n),o(_))},__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},__wbindgen_cast_0000000000000001:function(t,e){let n=T(t,e,r.__wasm_bindgen_func_elem_7842,bt);return c(n)},__wbindgen_cast_0000000000000002:function(t,e){let n=S(t,e,r.__wasm_bindgen_func_elem_7842,R);return c(n)},__wbindgen_cast_0000000000000003:function(t,e){let n=S(t,e,r.__wasm_bindgen_func_elem_7842,R);return c(n)},__wbindgen_cast_0000000000000004:function(t,e){let n=S(t,e,r.__wasm_bindgen_func_elem_7842,R);return c(n)},__wbindgen_cast_0000000000000005:function(t,e){let n=S(t,e,r.__wasm_bindgen_func_elem_7842,R);return c(n)},__wbindgen_cast_0000000000000006:function(t,e){let n=T(t,e,r.__wasm_bindgen_func_elem_7842,bt);return c(n)},__wbindgen_cast_0000000000000007:function(t,e){let n=S(t,e,r.__wasm_bindgen_func_elem_7842,R);return c(n)},__wbindgen_cast_0000000000000008:function(t,e){let n=S(t,e,r.__wasm_bindgen_func_elem_7842,R);return c(n)},__wbindgen_cast_0000000000000009:function(t,e){let n=T(t,e,r.__wasm_bindgen_func_elem_7842,Lt);return c(n)},__wbindgen_cast_000000000000000a:function(t,e){let n=T(t,e,r.__wasm_bindgen_func_elem_21462,Nt);return c(n)},__wbindgen_cast_000000000000000b:function(t,e){let n=S(t,e,r.__wasm_bindgen_func_elem_22081,gt);return c(n)},__wbindgen_cast_000000000000000c:function(t,e){let n=S(t,e,r.__wasm_bindgen_func_elem_22081,gt);return c(n)},__wbindgen_cast_000000000000000d:function(t,e){let n=S(t,e,r.__wasm_bindgen_func_elem_22081,Mt);return c(n)},__wbindgen_cast_000000000000000e:function(t,e){let n=T(t,e,r.__wasm_bindgen_func_elem_23473,Dt);return c(n)},__wbindgen_cast_000000000000000f:function(t,e){let n=T(t,e,r.__wasm_bindgen_func_elem_23473,qt);return c(n)},__wbindgen_cast_0000000000000010:function(t,e){let n=S(t,e,r.__wasm_bindgen_func_elem_28172,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=d(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=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=vt(t,e).slice();return r.__wbindgen_export4(t,e*4,4),c(n)},__wbindgen_cast_000000000000001b:function(t,e){var n=E(t,e).slice();return r.__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 Mt(a,t){r.__wasm_bindgen_func_elem_22085(a,t)}function qt(a,t){r.__wasm_bindgen_func_elem_24097(a,t)}function Dt(a,t){let e=r.__wasm_bindgen_func_elem_24096(a,t);return u(e)}function bt(a,t,e){r.__wasm_bindgen_func_elem_8959(a,t,c(e))}function R(a,t,e){r.__wasm_bindgen_func_elem_8960(a,t,c(e))}function Lt(a,t){try{let i=r.__wbindgen_add_to_stack_pointer(-16);r.__wasm_bindgen_func_elem_8961(i,a,t);var e=s().getInt32(i+0,!0),n=s().getInt32(i+4,!0),_=s().getInt32(i+8,!0);if(_)throw u(n);return u(e)}finally{r.__wbindgen_add_to_stack_pointer(16)}}function Nt(a,t,e){try{r.__wasm_bindgen_func_elem_21486(a,t,ot(e))}finally{k[O++]=void 0}}function gt(a,t,e){r.__wasm_bindgen_func_elem_22086(a,t,c(e))}function Wt(a,t,e){r.__wasm_bindgen_func_elem_28174(a,t,c(e))}function Ht(a,t,e,n){r.__wasm_bindgen_func_elem_36995(a,t,c(e),c(n))}var Bt=[\"open\",\"closed\"],Q=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(a=>r.__wbg_client_free(a>>>0,1)),ft=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(a=>r.__wbg_genericsqlvirtualservermodel_free(a>>>0,1)),dt=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(a=>r.__wbg_perspectivedebugpluginelement_free(a>>>0,1)),Z=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(a=>r.__wbg_perspectiveviewerelement_free(a>>>0,1)),tt=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(a=>r.__wbg_proxysession_free(a>>>0,1)),wt=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(a=>r.__wbg_table_free(a>>>0,1)),lt=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(a=>r.__wbg_view_free(a>>>0,1)),et=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(a=>r.__wbg_virtualdataslice_free(a>>>0,1)),pt=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(a=>r.__wbg_virtualserver_free(a>>>0,1));function c(a){U===k.length&&k.push(k.length+1);let t=U;return U=k[t],k[t]=a,t}function rt(a,t){if(!(a instanceof t))throw new Error(`expected instance of ${t.name}`)}function ot(a){if(O==1)throw new Error(\"out of js stack\");return k[--O]=a,O}var K=typeof FinalizationRegistry>\"u\"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(a=>a.dtor(a.a,a.b));function _t(a){let t=typeof a;if(t==\"number\"||t==\"boolean\"||a==null)return`${a}`;if(t==\"string\")return`\"${a}\"`;if(t==\"symbol\"){let _=a.description;return _==null?\"Symbol\":`Symbol(${_})`}if(t==\"function\"){let _=a.name;return typeof _==\"string\"&&_.length>0?`Function(${_})`:\"Function\"}if(Array.isArray(a)){let _=a.length,i=\"[\";_>0&&(i+=_t(a[0]));for(let b=1;b<_;b++)i+=\", \"+_t(a[b]);return i+=\"]\",i}let e=/\\[object ([^\\]]+)\\]/.exec(toString.call(a)),n;if(e&&e.length>1)n=e[1];else return toString.call(a);if(n==\"Object\")try{return\"Object(\"+JSON.stringify(a)+\")\"}catch{return\"Object\"}return a instanceof Error?`${a.name}: ${a.message}\n${a.stack}`:n}function Ut(a){a<132||(k[a]=U,U=a)}function Vt(a,t){return a=a>>>0,Xt().subarray(a/4,a/4+t)}function $t(a,t){return a=a>>>0,Yt().subarray(a/8,a/8+t)}function Gt(a,t){return a=a>>>0,Kt().subarray(a/4,a/4+t)}function vt(a,t){a=a>>>0;let e=s(),n=[];for(let _=a;_<a+4*t;_+=4)n.push(u(e.getUint32(_,!0)));return n}function Jt(a,t){return a=a>>>0,Zt().subarray(a/4,a/4+t)}function E(a,t){return a=a>>>0,P().subarray(a/1,a/1+t)}function d(a,t){return a===0?o(t):Qt(a,t)}var A=null;function s(){return(A===null||A.buffer.detached===!0||A.buffer.detached===void 0&&A.buffer!==r.memory.buffer)&&(A=new DataView(r.memory.buffer)),A}var L=null;function Xt(){return(L===null||L.byteLength===0)&&(L=new Float32Array(r.memory.buffer)),L}var N=null;function Yt(){return(N===null||N.byteLength===0)&&(N=new Float64Array(r.memory.buffer)),N}var W=null;function Kt(){return(W===null||W.byteLength===0)&&(W=new Int32Array(r.memory.buffer)),W}function Qt(a,t){return a=a>>>0,ne(a,t)}var H=null;function Zt(){return(H===null||H.byteLength===0)&&(H=new Uint32Array(r.memory.buffer)),H}var B=null;function P(){return(B===null||B.byteLength===0)&&(B=new Uint8Array(r.memory.buffer)),B}function o(a){return k[a]}function l(a,t){try{return a.apply(this,t)}catch(e){r.__wbindgen_export3(c(e))}}var k=new Array(128).fill(void 0);k.push(void 0,null,!0,!1);var U=k.length;function f(a){return a==null}function T(a,t,e,n){let _={a,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,K.unregister(_))},K.register(i,_,_),i}function S(a,t,e,n){let _={a,b:t,cnt:1,dtor:e},i=(...b)=>{_.cnt++;let g=_.a;_.a=0;try{return n(g,_.b,...b)}finally{_.a=g,i._wbg_cb_unref()}};return i._wbg_cb_unref=()=>{--_.cnt===0&&(_.dtor(_.a,_.b),_.a=0,K.unregister(_))},K.register(i,_,_),i}function te(a,t){let e=t(a.length*1,1)>>>0;return P().set(a,e/1),p=a.length,e}function yt(a,t){let e=t(a.length*4,4)>>>0,n=s();for(let _=0;_<a.length;_++)n.setUint32(e+4*_,c(a[_]),!0);return p=a.length,e}function m(a,t,e){if(e===void 0){let g=mt.encode(a),w=t(g.length,1)>>>0;return P().subarray(w,w+g.length).set(g),p=g.length,w}let n=a.length,_=t(n,1)>>>0,i=P(),b=0;for(;b<n;b++){let g=a.charCodeAt(b);if(g>127)break;i[_+b]=g}if(b!==n){b!==0&&(a=a.slice(b)),_=e(_,n,n=b+a.length*3,1)>>>0;let g=P().subarray(_+b,_+n),w=mt.encodeInto(a,g);b+=w.written,_=e(_,n,b,1)>>>0}return p=b,_}var O=128;function u(a){let t=o(a);return Ut(a),t}var Y=new TextDecoder(\"utf-8\",{ignoreBOM:!0,fatal:!0});Y.decode();var ee=2146435072,nt=0;function ne(a,t){return nt+=t,nt>=ee&&(Y=new TextDecoder(\"utf-8\",{ignoreBOM:!0,fatal:!0}),Y.decode(),nt=t),Y.decode(P().subarray(a,a+t))}var mt=new TextEncoder,p=0,re,r;function xt(a,t){return r=a.exports,re=t,A=null,L=null,N=null,W=null,H=null,B=null,r}async function _e(a,t){if(typeof Response==\"function\"&&a instanceof Response){if(typeof WebAssembly.instantiateStreaming==\"function\")try{return await WebAssembly.instantiateStreaming(a,t)}catch(_){if(a.ok&&e(a.type)&&a.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 a.arrayBuffer();return await WebAssembly.instantiate(n,t)}else{let n=await WebAssembly.instantiate(a,t);return n instanceof WebAssembly.Instance?{instance:n,module:a}:n}function e(n){switch(n){case\"basic\":case\"cors\":case\"default\":return!0}return!1}}function oe(a){if(r!==void 0)return r;a!==void 0&&(Object.getPrototypeOf(a)===Object.prototype?{module:a}=a:console.warn(\"using deprecated parameters for `initSync()`; pass a single object instead\"));let t=ht();a instanceof WebAssembly.Module||(a=new WebAssembly.Module(a));let e=new WebAssembly.Instance(a,t);return xt(e,a)}async function It(a){if(r!==void 0)return r;a!==void 0&&(Object.getPrototypeOf(a)===Object.prototype?{module_or_path:a}=a:console.warn(\"using deprecated parameters for the initialization function; pass a single object instead\"));let t=ht();(typeof a==\"string\"||typeof Request==\"function\"&&a instanceof Request||typeof URL==\"function\"&&a instanceof URL)&&(a=fetch(a));let{instance:e,module:n}=await _e(await a,t);return xt(e,n)}export{F as Client,V as GenericSQLVirtualServerModel,$ as PerspectiveDebugPluginElement,G as PerspectiveViewerElement,j as ProxySession,z as Table,I as View,M as VirtualDataSlice,J as VirtualServer,It as default,Ft as getColumnConfigDefaults,Rt as getPluginConfigDefaults,Et as get_wasm_module,Tt as get_worker_url,Pt as init,oe as initSync,Ot as registerPlugin,jt as setColumnConfigDefaults,zt 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 provide_viewer_runtime,\n shared_validator,\n} from \"@perspective-dev/client/registry\";\nimport type {\n ClientRuntime,\n InitOptions,\n MigrateKind,\n MigrateResult,\n Validator,\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\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.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 * Load the `migrate` binary registered with `init()` and return synchronous\n * `migrate()` and `validate()` over it; the page shares one instance.\n *\n * # Examples\n *\n * ```javascript\n * const validator = await perspective_viewer.create_validator();\n * for (const token of tokens) {\n * validator.validate(\"viewer\", token, { strict: true });\n * }\n * ```\n */\nexport async function create_validator(): Promise<Validator> {\n return await shared_validator();\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,\n * `\"panel\"` for one workspace panel, or `\"workspace\"` for a\n * `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_validator()).migrate<T>(kind, config, from_version);\n}\n\n/**\n * Check that a config is valid for this release without migrating it,\n * rejecting with the offending JSON pointer and reason otherwise.\n *\n * # Arguments\n *\n * - `kind` - `\"view\"`, `\"viewer\"`, `\"panel\"` or `\"workspace\"`.\n * - `config` - The config to check.\n * - `options.strict` - Require the complete `save()` form rather than the\n * field-wise `restore()` update form.\n */\nexport async function validate(\n kind: MigrateKind,\n config: unknown,\n options?: { strict?: boolean },\n): Promise<void> {\n (await shared_validator()).validate(kind, config, options);\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\";\nexport type * from \"../../dist/ts-rs/CommandSchema.d.ts\";\nexport type * from \"../../dist/ts-rs/CommandSpec.d.ts\";\nexport type * from \"../../dist/ts-rs/CommandLocation.d.ts\";\nexport type * from \"../../dist/ts-rs/CommandSchemaOptions.d.ts\";\nexport type * from \"../../dist/ts-rs/PerspectiveHit.d.ts\";\nexport type * from \"../../dist/ts-rs/PerspectiveHitRef.d.ts\";\n\nexport {\n create_validator,\n init,\n init_client,\n migrate,\n validate,\n} 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 Validator,\n} from \"@perspective-dev/client\";\nimport {\n create_validator,\n init,\n init_client,\n migrate,\n validate,\n} from \"./bootstrap.ts\";\n\nexport default { create_validator, init, init_client, migrate, validate };\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.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,ECZaC,EAA2B,OAAO,OAAO,CACrD,yBAA0B,iBAC1B,qBAAsB,OACtB,kBAAmB,GACnB,aAAc,GACd,kBAAmB,UACnB,sCAAuC,IACvC,qBAAsB,IACtB,0BAA2B,IAC3B,8BAA+B,KAC/B,gBAAiB,WACjB,kBAAmB,EACnB,0BAA2B,GAC3B,0BAA2B,EAC5B,CAAC,ECvGD,SAASC,GAAYC,EAAkBC,EAAkBC,EAAa,CACrE,OACCD,EAAO,SAAW,GAClB,KAAK,IAAIC,EAAMD,EAAOA,EAAO,OAAS,CAAC,CAAC,EACvCD,EAAQ,gCAETC,EAAO,KAAKC,CAAG,EAGTD,CACR,CAEA,SAASE,GAAiBH,EAAkBI,EAA+B,CAE1E,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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", "hit", "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", "touch", "type", "old_col", "old_row", "CSS", "HTML_TEMPLATE", "css_string", "title_variable", "RegularLayoutFrame", "_container_sheet", "_tab_sheet", "_layout", "_header", "_default_tab", "_drag", "drag", "attr", "RegularLayoutTab", "_tab_panel", "_index", "parts", "ELEMENTS", "defineCustomElements", "registry", "element", "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", "extract", "input", "bin", "inst", "payload", "raw_length_view", "raw_length", "ptr", "load_wasm_stage_0", "wasm", "MEMORY64_PROBE", "migrate", "kind", "retptr", "ptr0", "passStringToWasm0", "len0", "WASM_VECTOR_LEN", "ptr1", "isLikeNone", "len1", "addHeapObject", "r0", "getDataViewMemory0", "r1", "r2", "takeObject", "validate_config", "strict", "__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", "e", "arg", "malloc", "realloc", "buf", "cachedTextEncoder", "mem", "code", "cachedTextDecoder", "MAX_SAFARI_DECODE_BYTES", "numBytesDecoded", "wasmModule", "__wbg_finalize_init", "instance", "module", "__wbg_load", "imports", "expectedResponseType", "bytes", "__wbg_init", "module_or_path", "load_validator", "binary", "config", "from_version", "options", "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", "source", "disable_stage_0", "start_viewer", "runtime", "register", "unknown", "keys", "has_server", "duplicates", "un_warned", "servers", "init", "register_default", "provide_viewer_runtime", "provider", "resolve_viewer", "viewer", "resolve_migrate", "shared_validator", "validator", "perspective_viewer_default", "cached", "getWorkerURL", "blob", "be", "GLUE_OVERRIDE", "me", "url", "glue", "is_registration", "init_client", "wasm_module", "registration", "create_validator", "xe", "validate", "ge", "ne", "he", "perspective_viewer_cdn_default"]
7
7
  }