@jimka/typescript-ui 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/README.md +4 -0
  2. package/THIRD-PARTY-NOTICES.md +7 -3
  3. package/dist/lib/{AbstractBooleanInput-BGesvIZy.js → AbstractBooleanInput-C3O4kv7_.js} +2 -2
  4. package/dist/lib/{AbstractBooleanInput-BGesvIZy.js.map → AbstractBooleanInput-C3O4kv7_.js.map} +1 -1
  5. package/dist/lib/{AbstractInput-BxOtFrER.js → AbstractInput-DFWniHqq.js} +2 -2
  6. package/dist/lib/{AbstractInput-BxOtFrER.js.map → AbstractInput-DFWniHqq.js.map} +1 -1
  7. package/dist/lib/AnchorConstraints-CSUcj8Wx.js +2 -0
  8. package/dist/lib/AnchorConstraints-CSUcj8Wx.js.map +1 -0
  9. package/dist/lib/{AnimatedDropdown-CZQEqQi-.js → AnimatedDropdown-e9urCXK1.js} +2 -2
  10. package/dist/lib/{AnimatedDropdown-CZQEqQi-.js.map → AnimatedDropdown-e9urCXK1.js.map} +1 -1
  11. package/dist/lib/Border-Dq6dXkmS.js +2 -0
  12. package/dist/lib/{Border-BgaZkc1R.js.map → Border-Dq6dXkmS.js.map} +1 -1
  13. package/dist/lib/{Button-U1rsP4v8.js → Button-B36rBMKC.js} +2 -2
  14. package/dist/lib/{Button-U1rsP4v8.js.map → Button-B36rBMKC.js.map} +1 -1
  15. package/dist/lib/{Card-BVwOS8AG.js → Card-P8iUH2-C.js} +2 -2
  16. package/dist/lib/{Card-BVwOS8AG.js.map → Card-P8iUH2-C.js.map} +1 -1
  17. package/dist/lib/{ComboBox-B9EDPu6T.js → ComboBox-BjAhXXkY.js} +2 -2
  18. package/dist/lib/{ComboBox-B9EDPu6T.js.map → ComboBox-BjAhXXkY.js.map} +1 -1
  19. package/dist/lib/Component-CHTzJxEf.js +2 -0
  20. package/dist/lib/Component-CHTzJxEf.js.map +1 -0
  21. package/dist/lib/Container-xUbHk6l_.js +2 -0
  22. package/dist/lib/{Container-D5H8VxJK.js.map → Container-xUbHk6l_.js.map} +1 -1
  23. package/dist/lib/DOM-BeR95tE8.js +2 -0
  24. package/dist/lib/DOM-BeR95tE8.js.map +1 -0
  25. package/dist/lib/{DragManager-CI4mZQFy.js → DragManager-T5Oljd0F.js} +2 -2
  26. package/dist/lib/{DragManager-CI4mZQFy.js.map → DragManager-T5Oljd0F.js.map} +1 -1
  27. package/dist/lib/{FieldDecorator-CJs9gwqH.js → FieldDecorator-BaTGfKiW.js} +2 -2
  28. package/dist/lib/{FieldDecorator-CJs9gwqH.js.map → FieldDecorator-BaTGfKiW.js.map} +1 -1
  29. package/dist/lib/{Fit-DjRsiwlg.js → Fit-E-EIZv1k.js} +2 -2
  30. package/dist/lib/{Fit-DjRsiwlg.js.map → Fit-E-EIZv1k.js.map} +1 -1
  31. package/dist/lib/{Glyph-KEf4nIv2.js → Glyph-CnNslL95.js} +2 -2
  32. package/dist/lib/{Glyph-KEf4nIv2.js.map → Glyph-CnNslL95.js.map} +1 -1
  33. package/dist/lib/{Grid-DdL9TVeJ.js → Grid-BXS2T8MT.js} +2 -2
  34. package/dist/lib/{Grid-DdL9TVeJ.js.map → Grid-BXS2T8MT.js.map} +1 -1
  35. package/dist/lib/{GridConstraints-DkLueyrf.js → GridConstraints-D_kbd-h2.js} +2 -2
  36. package/dist/lib/{GridConstraints-DkLueyrf.js.map → GridConstraints-D_kbd-h2.js.map} +1 -1
  37. package/dist/lib/HBox-Dm3xgsDE.js +2 -0
  38. package/dist/lib/{HBox-Ce0GTCJP.js.map → HBox-Dm3xgsDE.js.map} +1 -1
  39. package/dist/lib/{Header-BQIVpBte.js → Header-CqFc2OUx.js} +2 -2
  40. package/dist/lib/{Header-BQIVpBte.js.map → Header-CqFc2OUx.js.map} +1 -1
  41. package/dist/lib/{IconText-Bo4Qcnot.js → IconText-CTM2r0Tv.js} +2 -2
  42. package/dist/lib/{IconText-Bo4Qcnot.js.map → IconText-CTM2r0Tv.js.map} +1 -1
  43. package/dist/lib/{LayoutSerialization-BT66TY83.js → LayoutSerialization-D1OHmxSB.js} +2 -2
  44. package/dist/lib/{LayoutSerialization-BT66TY83.js.map → LayoutSerialization-D1OHmxSB.js.map} +1 -1
  45. package/dist/lib/LayoutSizes-CvMmMgHJ.js +2 -0
  46. package/dist/lib/LayoutSizes-CvMmMgHJ.js.map +1 -0
  47. package/dist/lib/List-DHeOPAK2.js +2 -0
  48. package/dist/lib/List-DHeOPAK2.js.map +1 -0
  49. package/dist/lib/MemoryStore-DT6iWWco.js +2 -0
  50. package/dist/lib/MemoryStore-DT6iWWco.js.map +1 -0
  51. package/dist/lib/{Menu-Dz4L7EKJ.js → Menu-B6ippw-p.js} +2 -2
  52. package/dist/lib/{Menu-Dz4L7EKJ.js.map → Menu-B6ippw-p.js.map} +1 -1
  53. package/dist/lib/{MenuButton-VJ5uC3c1.js → MenuButton-Bjm1OyB-.js} +2 -2
  54. package/dist/lib/{MenuButton-VJ5uC3c1.js.map → MenuButton-Bjm1OyB-.js.map} +1 -1
  55. package/dist/lib/{Panel-DzWdYwq1.js → Panel-D9lTLGqP.js} +2 -2
  56. package/dist/lib/{Panel-DzWdYwq1.js.map → Panel-D9lTLGqP.js.map} +1 -1
  57. package/dist/lib/Position-DRSlWn4Z.js +2 -0
  58. package/dist/lib/Position-DRSlWn4Z.js.map +1 -0
  59. package/dist/lib/{ProgressSpinner-zJKtGyNJ.js → ProgressSpinner-glv-29eK.js} +2 -2
  60. package/dist/lib/{ProgressSpinner-zJKtGyNJ.js.map → ProgressSpinner-glv-29eK.js.map} +1 -1
  61. package/dist/lib/{RadioButton-CYSSv4nV.js → RadioButton-R4S3c9WD.js} +2 -2
  62. package/dist/lib/{RadioButton-CYSSv4nV.js.map → RadioButton-R4S3c9WD.js.map} +1 -1
  63. package/dist/lib/{RovingTabIndex-BSZ31Vp5.js → RovingTabIndex-Dgt01LOE.js} +2 -2
  64. package/dist/lib/{RovingTabIndex-BSZ31Vp5.js.map → RovingTabIndex-Dgt01LOE.js.map} +1 -1
  65. package/dist/lib/{Scrollbar-BhtOjqkG.js → Scrollbar-CiVV3axj.js} +2 -2
  66. package/dist/lib/{Scrollbar-BhtOjqkG.js.map → Scrollbar-CiVV3axj.js.map} +1 -1
  67. package/dist/lib/{Slider-CdXm7E64.js → Slider-_JVvuQ8M.js} +2 -2
  68. package/dist/lib/{Slider-CdXm7E64.js.map → Slider-_JVvuQ8M.js.map} +1 -1
  69. package/dist/lib/{Spacer-D9NGW4QG.js → Spacer-B57i2-_G.js} +2 -2
  70. package/dist/lib/{Spacer-D9NGW4QG.js.map → Spacer-B57i2-_G.js.map} +1 -1
  71. package/dist/lib/{TabButton-CThevdY_.js → TabButton-DEypdlZf.js} +2 -2
  72. package/dist/lib/{TabButton-CThevdY_.js.map → TabButton-DEypdlZf.js.map} +1 -1
  73. package/dist/lib/Text-Bni4icFY.js +2 -0
  74. package/dist/lib/Text-Bni4icFY.js.map +1 -0
  75. package/dist/lib/{Tooltip-tkXDk5Bo.js → Tooltip-BUy6uFKN.js} +2 -2
  76. package/dist/lib/{Tooltip-tkXDk5Bo.js.map → Tooltip-BUy6uFKN.js.map} +1 -1
  77. package/dist/lib/VBox-Dr7Ge9M6.js +2 -0
  78. package/dist/lib/VBox-Dr7Ge9M6.js.map +1 -0
  79. package/dist/lib/{VirtualScroller-DwEEJE1_.js → VirtualScroller-BPy6KmSX.js} +2 -2
  80. package/dist/lib/{VirtualScroller-DwEEJE1_.js.map → VirtualScroller-BPy6KmSX.js.map} +1 -1
  81. package/dist/lib/component/button.es.js +1 -1
  82. package/dist/lib/component/chart.es.js +1 -1
  83. package/dist/lib/component/chart.es.js.map +1 -1
  84. package/dist/lib/component/container.es.js +1 -1
  85. package/dist/lib/component/diagram.es.js +1 -1
  86. package/dist/lib/component/diagram.es.js.map +1 -1
  87. package/dist/lib/component/display.es.js +1 -1
  88. package/dist/lib/component/editor.es.js +3 -3
  89. package/dist/lib/component/editor.es.js.map +1 -1
  90. package/dist/lib/component/input.es.js +1 -1
  91. package/dist/lib/component/input.es.js.map +1 -1
  92. package/dist/lib/component/list.es.js +1 -1
  93. package/dist/lib/component/menubar.es.js +1 -1
  94. package/dist/lib/component/table.es.js +2 -2
  95. package/dist/lib/component/table.es.js.map +1 -1
  96. package/dist/lib/component/tree.es.js +1 -1
  97. package/dist/lib/component/tree.es.js.map +1 -1
  98. package/dist/lib/core.es.js +1 -1
  99. package/dist/lib/core.es.js.map +1 -1
  100. package/dist/lib/data.es.js +1 -1
  101. package/dist/lib/data.es.js.map +1 -1
  102. package/dist/lib/glyphs/solid/index.es.js +1 -1
  103. package/dist/lib/layout.es.js +1 -1
  104. package/dist/lib/layout.es.js.map +1 -1
  105. package/dist/lib/overlay.es.js +1 -1
  106. package/dist/lib/overlay.es.js.map +1 -1
  107. package/dist/lib/primitive.es.js +1 -1
  108. package/dist/lib/router.es.js +1 -1
  109. package/dist/lib/router.es.js.map +1 -1
  110. package/dist/lib/{VirtualRowView-BxpHQ_u8.js → selectionsEqual-2PJrcimg.js} +2 -2
  111. package/dist/lib/{VirtualRowView-BxpHQ_u8.js.map → selectionsEqual-2PJrcimg.js.map} +1 -1
  112. package/dist/lib/types/component/diagram/DiagramEdgeLayer.d.ts +14 -1
  113. package/dist/lib/types/component/diagram/DiagramModel.d.ts +1 -0
  114. package/dist/lib/types/component/diagram/DiagramNode.d.ts +4 -0
  115. package/dist/lib/types/component/diagram/DiagramView.d.ts +76 -5
  116. package/dist/lib/types/component/diagram/ElkLayoutEngine.d.ts +14 -1
  117. package/dist/lib/types/component/diagram/index.d.ts +2 -2
  118. package/dist/lib/types/component/editor/CodeEditor.d.ts +3 -2
  119. package/dist/lib/types/component/input/Text.d.ts +3 -1
  120. package/dist/lib/types/component/shared/selectionsEqual.d.ts +1 -0
  121. package/dist/lib/types/component/table/Column.d.ts +2 -0
  122. package/dist/lib/types/component/table/ColumnConfig.d.ts +1 -0
  123. package/dist/lib/types/component/table/Header.d.ts +1 -0
  124. package/dist/lib/types/component/table/Table.d.ts +20 -0
  125. package/dist/lib/types/component/table/cell/Header.d.ts +1 -0
  126. package/dist/lib/types/component/table/index.d.ts +1 -1
  127. package/dist/lib/types/component/tree/Tree.d.ts +1 -0
  128. package/dist/lib/types/core/Aria.d.ts +0 -2
  129. package/dist/lib/types/core/Body.d.ts +1 -0
  130. package/dist/lib/types/core/ClassStyleRules.d.ts +17 -0
  131. package/dist/lib/types/core/Component.d.ts +10 -2
  132. package/dist/lib/types/core/ComponentDefaults.d.ts +1 -0
  133. package/dist/lib/types/core/DOM.d.ts +11 -2
  134. package/dist/lib/types/core/ElementAttributes.d.ts +15 -0
  135. package/dist/lib/types/core/PendingTransitions.d.ts +4 -0
  136. package/dist/lib/types/core/StyleTarget.d.ts +1 -0
  137. package/dist/lib/types/core/Util.d.ts +2 -0
  138. package/dist/lib/types/core/index.d.ts +1 -0
  139. package/dist/lib/types/layout/Border.d.ts +1 -0
  140. package/dist/lib/types/layout/Tab.d.ts +4 -1
  141. package/dist/lib/types/layout/Table.d.ts +1 -0
  142. package/dist/lib/types/overlay/AbstractWindow.d.ts +1 -0
  143. package/dist/lib/types/router/RoutePattern.d.ts +7 -0
  144. package/dist/lib/types/router/Router.d.ts +13 -2
  145. package/dist/lib/types/router/index.d.ts +1 -1
  146. package/dist/lib/validation.es.js +1 -1
  147. package/llms.txt +1 -1
  148. package/package.json +4 -8
  149. package/dist/lib/Border-BgaZkc1R.js +0 -2
  150. package/dist/lib/BoxLayout-DrKGfsup.js +0 -2
  151. package/dist/lib/BoxLayout-DrKGfsup.js.map +0 -1
  152. package/dist/lib/Component-DXf5a3g0.js +0 -2
  153. package/dist/lib/Component-DXf5a3g0.js.map +0 -1
  154. package/dist/lib/Container-D5H8VxJK.js +0 -2
  155. package/dist/lib/DOM-CGn7xyTw.js +0 -2
  156. package/dist/lib/DOM-CGn7xyTw.js.map +0 -1
  157. package/dist/lib/HBox-Ce0GTCJP.js +0 -2
  158. package/dist/lib/LayoutSizes-DU3qSq0w.js +0 -2
  159. package/dist/lib/LayoutSizes-DU3qSq0w.js.map +0 -1
  160. package/dist/lib/List-DtTVTyWW.js +0 -2
  161. package/dist/lib/List-DtTVTyWW.js.map +0 -1
  162. package/dist/lib/Position-A39T7-_1.js +0 -2
  163. package/dist/lib/Position-A39T7-_1.js.map +0 -1
  164. package/dist/lib/Text-gz6qjFfP.js +0 -2
  165. package/dist/lib/Text-gz6qjFfP.js.map +0 -1
  166. package/dist/lib/VBox-EIqw85Rh.js +0 -2
  167. package/dist/lib/VBox-EIqw85Rh.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Grid-DdL9TVeJ.js","names":[],"sources":["../../src/typescript/lib/layout/Grid.ts"],"sourcesContent":["// SPDX-License-Identifier: PolyForm-Noncommercial-1.0.0\n\nimport { LayoutManager, LayoutManagerOptions } from \"~/layout/LayoutManager.js\";\nimport { FillType } from \"~/layout/FillType.js\";\nimport { AnchorType } from \"~/layout/AnchorType.js\";\nimport { GridTrack } from \"~/layout/GridTrack.js\";\nimport { GridConstraints } from \"~/layout/GridConstraints.js\";\nimport { Size, UNBOUNDED, isUnbounded, saturate } from \"~/primitive/Size.js\";\nimport { Insets } from \"~/primitive/Insets.js\";\nimport { Component } from \"~/core/Component.js\";\nimport { Util } from \"~/core/Util.js\";\nimport { callable } from \"~/core/Callable.js\";\n\n/**\n * Construction-time options for {@link Grid}.\n *\n * @category Layouts\n */\nexport interface GridOptions extends LayoutManagerOptions {\n rows?: number;\n columns?: number;\n spacing?: number;\n\n /** Grid-wide fill applied to children that don't set their own `fill`. Default {@link FillType.BOTH}. */\n defaultFill?: FillType;\n\n /** Grid-wide anchor applied to non-filling children that don't set their own `anchor`. Default {@link AnchorType.CENTER}. */\n defaultAnchor?: AnchorType;\n\n /** When `true`, children are baseline-aligned per row (column/row tracks still apply; children use preferred height). Default `false`. */\n baselineAlign?: boolean;\n\n /** Per-column sizing tracks; see {@link GridTrack}. */\n columnTracks?: GridTrack[];\n\n /** Per-row sizing tracks; see {@link GridTrack}. */\n rowTracks?: GridTrack[];\n}\n\n/**\n * A layout manager that tiles children in a uniform grid of equal-sized cells.\n * Row and column counts can be configured explicitly or left at `0` for auto-calculation.\n *\n * @category Layouts\n */\nclass Grid extends LayoutManager {\n\n private _rows: number = 0;\n private _columns: number = 0;\n private _spacing: number = 5;\n private _defaultFill: FillType = FillType.BOTH;\n private _defaultAnchor: AnchorType = AnchorType.CENTER;\n private _baselineAlign: boolean = false;\n private _columnTracks: GridTrack[] = [];\n private _rowTracks: GridTrack[] = [];\n\n constructor(options?: GridOptions) {\n // LayoutManager's constructor takes no options; applied via applyOptions below.\n // eslint-disable-next-line local/forward-super-options\n super();\n\n if (options) {\n this.applyOptions(options);\n }\n }\n\n /**\n * Applies a {@link GridOptions} bag, dispatching grid dimensions, spacing,\n * default fill/anchor, and baseline alignment after the inherited\n * LayoutManager defaults.\n *\n * @param options - The options bag carrying the values to apply.\n */\n protected applyOptions(options: GridOptions): void {\n super.applyOptions(options);\n\n if (options.rows !== undefined) {\n this.setRows(options.rows);\n }\n\n if (options.columns !== undefined) {\n this.setColumns(options.columns);\n }\n\n if (options.spacing !== undefined) {\n this.setComponentSpacing(options.spacing);\n }\n\n if (options.defaultFill !== undefined) {\n this.setDefaultFill(options.defaultFill);\n }\n\n if (options.defaultAnchor !== undefined) {\n this.setDefaultAnchor(options.defaultAnchor);\n }\n\n if (options.baselineAlign !== undefined) {\n this.setBaselineAlign(options.baselineAlign);\n }\n\n if (options.columnTracks !== undefined) {\n this.setColumnTracks(options.columnTracks);\n }\n\n if (options.rowTracks !== undefined) {\n this.setRowTracks(options.rowTracks);\n }\n }\n\n /**\n * Returns the grid-wide default fill applied to children that don't set\n * their own `fill` constraint.\n *\n * @returns The default {@link FillType} (initially {@link FillType.BOTH}).\n */\n getDefaultFill(): FillType {\n return this._defaultFill;\n }\n\n /**\n * Sets the grid-wide default fill. Each child overrides this with its own\n * {@link GridConstraints} `fill`; otherwise this value drives whether the\n * child fills its cell.\n *\n * @param fill - The default fill strategy for children without their own `fill`.\n */\n setDefaultFill(fill: FillType): this {\n this._defaultFill = fill;\n\n return this;\n }\n\n /**\n * Returns the grid-wide default anchor applied to non-filling children that\n * don't set their own `anchor` constraint.\n *\n * @returns The default {@link AnchorType} (initially {@link AnchorType.CENTER}).\n */\n getDefaultAnchor(): AnchorType {\n return this._defaultAnchor;\n }\n\n /**\n * Sets the grid-wide default anchor. Each child overrides this with its own\n * {@link GridConstraints} `anchor`; otherwise this value positions a\n * non-filling child within its cell.\n *\n * @param anchor - The default anchor for children without their own `anchor`.\n */\n setDefaultAnchor(anchor: AnchorType): this {\n this._defaultAnchor = anchor;\n\n return this;\n }\n\n /**\n * Returns whether children are baseline-aligned per row.\n *\n * @returns `true` if per-row baseline alignment is enabled.\n */\n isBaselineAlign(): boolean {\n return this._baselineAlign;\n }\n\n /**\n * Sets whether children are baseline-aligned per row. When `true`, the\n * column/row tracks still size each cell (so a `\"content\"` column hugs its\n * content), each row uses the natural heights of its children, and\n * components are baseline-aligned within the row, mirroring\n * [`HBox`](/api/layout/classes/HBox)'s baseline-aware placement. Orthogonal\n * to {@link Grid.setDefaultFill} — baseline alignment owns the vertical axis\n * while fill/anchor still drive the horizontal axis.\n *\n * @param baselineAlign - Pass `true` to enable per-row baseline alignment.\n */\n setBaselineAlign(baselineAlign: boolean): this {\n this._baselineAlign = baselineAlign;\n\n return this;\n }\n\n /**\n * Returns the configured number of rows, or `0` if the grid auto-calculates row count.\n *\n * @returns The row count.\n */\n getRows() {\n return this._rows;\n }\n\n /**\n * Sets the number of rows. Pass `0` to let the grid auto-calculate.\n *\n * @param rows - The desired row count, or `0` for automatic.\n */\n setRows(rows: number) : this {\n this._rows = rows;\n\n return this;\n }\n\n /**\n * Returns the gap, in pixels, between adjacent cells (horizontally and vertically).\n *\n * @returns The current spacing in pixels.\n */\n getComponentSpacing() {\n return this._spacing || 0;\n }\n\n /**\n * Sets the gap, in pixels, between adjacent cells. Applied both horizontally\n * (between columns) and vertically (between rows).\n *\n * @param spacing - Spacing in pixels. Falsy values are treated as `0`.\n */\n setComponentSpacing(spacing: number) : this {\n this._spacing = spacing || 0;\n\n return this;\n }\n\n /**\n * Returns the configured number of columns, or `0` if the grid auto-calculates column count.\n *\n * @returns The column count.\n */\n getColumns() {\n return this._columns;\n }\n\n /**\n * Sets the number of columns. Pass `0` to let the grid auto-calculate.\n *\n * @param columns - The desired column count, or `0` for automatic.\n */\n setColumns(columns: number) : this {\n this._columns = columns;\n\n return this;\n }\n\n /**\n * Returns the per-column sizing tracks.\n *\n * @returns The configured column tracks; empty when columns size uniformly.\n */\n getColumnTracks(): GridTrack[] {\n return this._columnTracks;\n }\n\n /**\n * Sets the per-column sizing tracks. When fewer tracks are supplied than the\n * grid has columns, the missing tracks default to `{ mode: \"weight\", value: 1 }`.\n *\n * @param tracks - The column tracks; see {@link GridTrack}.\n */\n setColumnTracks(tracks: GridTrack[]): this {\n this._columnTracks = tracks;\n\n return this;\n }\n\n /**\n * Returns the per-row sizing tracks.\n *\n * @returns The configured row tracks; empty when rows size uniformly.\n */\n getRowTracks(): GridTrack[] {\n return this._rowTracks;\n }\n\n /**\n * Sets the per-row sizing tracks. When fewer tracks are supplied than the\n * grid has rows, the missing tracks default to `{ mode: \"weight\", value: 1 }`.\n *\n * @param tracks - The row tracks; see {@link GridTrack}.\n */\n setRowTracks(tracks: GridTrack[]): this {\n this._rowTracks = tracks;\n\n return this;\n }\n\n /**\n * Returns the computed cell count for the current component list as `{width: rows, height: columns}`.\n *\n * @returns An object with `width` (row count) and `height` (column count), or `undefined` if no container is attached.\n *\n * @remarks The property names `width` and `height` are repurposed here to\n * carry column and row counts rather than pixel dimensions —\n * `result.width` is the column count, `result.height` is the row count.\n */\n getColRowCount() {\n let container = this.getContainer();\n if (!container) {\n return;\n }\n\n let components = container.getLaidOutComponents();\n let componentCount = components.length;\n\n let rows = 0;\n let columns = 0;\n\n if (!this._rows && !this._columns) {\n columns = Math.floor(Math.sqrt(componentCount));\n rows = Math.ceil(componentCount / columns);\n } else if (this._rows && this._columns) {\n rows = this._rows;\n columns = this._columns;\n } else if (this._columns) {\n columns = this._columns;\n rows = Math.ceil(componentCount / columns);\n } else {\n rows = this._rows;\n columns = Math.ceil(componentCount / rows);\n }\n\n return {\n width: columns,\n height: rows\n };\n }\n\n /**\n * Returns the preferred size. With tracks declared, this is the sum of the\n * per-track preferred extents (fixed tracks their value, content *and*\n * weight tracks their measured content — wide/tall enough to show every\n * cell at its natural size) plus spacing. Track-less grids keep the uniform\n * `maxChildPreferred * count` estimate.\n *\n * @returns The preferred `{width, height}`, or `null` if no container is attached.\n */\n getPreferredSize(): Size | null {\n let container = this.getContainer();\n if (!container) {\n return null;\n }\n\n let perimeterSize = container.getPerimeterSize();\n\n let outerWidth = perimeterSize.left + perimeterSize.right;\n let outerHeight = perimeterSize.top + perimeterSize.bottom;\n\n let components = container.getLaidOutComponents();\n\n let maxCellWidth = 0;\n let maxCellHeight = 0;\n\n for (const component of components) {\n let size = component.getPreferredSize();\n\n if (size) {\n maxCellWidth = Math.max(maxCellWidth, size.width);\n maxCellHeight = Math.max(maxCellHeight, size.height);\n }\n }\n\n let colRowCount = this.getColRowCount();\n let cols = colRowCount ? colRowCount.width : 1;\n let rows = colRowCount ? colRowCount.height : 1;\n let spacing = this.getComponentSpacing();\n\n const content = this.measureContent(components, cols, rows);\n\n let innerWidth = this._columnTracks.length > 0\n ? this.trackAxisExtent(this._columnTracks, cols, content.columns, true)\n : maxCellWidth * cols;\n\n let innerHeight = this._rowTracks.length > 0\n ? this.trackAxisExtent(this._rowTracks, rows, content.rows, true)\n : maxCellHeight * rows;\n\n innerWidth += Math.max(0, cols - 1) * spacing;\n innerHeight += Math.max(0, rows - 1) * spacing;\n\n return {\n width: innerWidth + outerWidth,\n height: innerHeight + outerHeight\n };\n }\n\n /**\n * Returns the minimum size. With tracks declared, this is the sum of the\n * per-track minima (fixed tracks their value, content tracks their measured\n * content, weight tracks `0`) plus spacing — matching what `doLayout`\n * actually lays out, so a host no longer over-reserves space the way the\n * uniform `maxChildMin * count` estimate did. Track-less grids keep that\n * uniform estimate.\n *\n * @returns The minimum `{width, height}`, or `null` if no container is attached.\n */\n getMinSize(): Size | null {\n let container = this.getContainer();\n if (!container) {\n return null;\n }\n\n let perimeterSize = container.getPerimeterSize();\n\n let outerWidth = perimeterSize.left + perimeterSize.right;\n let outerHeight = perimeterSize.top + perimeterSize.bottom;\n\n let components = container.getLaidOutComponents();\n\n let maxCellWidth = 0;\n let maxCellHeight = 0;\n\n for (const component of components) {\n let size = component.getMinSize();\n\n if (size) {\n maxCellWidth = Math.max(maxCellWidth, size.width);\n maxCellHeight = Math.max(maxCellHeight, size.height);\n }\n }\n\n let colRowCount = this.getColRowCount();\n let cols = colRowCount ? colRowCount.width : 1;\n let rows = colRowCount ? colRowCount.height : 1;\n let spacing = this.getComponentSpacing();\n\n const content = this.measureContent(components, cols, rows);\n\n let innerWidth = this._columnTracks.length > 0\n ? this.trackAxisExtent(this._columnTracks, cols, content.columns, false)\n : maxCellWidth * cols;\n\n let innerHeight = this._rowTracks.length > 0\n ? this.trackAxisExtent(this._rowTracks, rows, content.rows, false)\n : maxCellHeight * rows;\n\n innerWidth += Math.max(0, cols - 1) * spacing;\n innerHeight += Math.max(0, rows - 1) * spacing;\n\n return {\n width: innerWidth + outerWidth,\n height: innerHeight + outerHeight\n };\n }\n\n /**\n * Returns the maximum size the grid can usefully occupy: the sum of the\n * per-track maxima plus inter-cell spacing and the container perimeter. A\n * `fixed` track contributes its pixel value, a `content` track its measured\n * content, and a `weight` track is unbounded — so any weight track makes the\n * whole axis unbounded (the grid can absorb arbitrary slack there). With no\n * tracks on an axis the fallback is `cols * maxChildMax` (the uniform-cell\n * estimate), where a child's `null`/sentinel maximum counts as unbounded.\n *\n * @returns The maximum `{width, height}`, or `null` if no container is attached.\n */\n getMaxSize(): Size | null {\n let container = this.getContainer();\n if (!container) {\n return null;\n }\n\n let perimeterSize = container.getPerimeterSize();\n\n let outerWidth = perimeterSize.left + perimeterSize.right;\n let outerHeight = perimeterSize.top + perimeterSize.bottom;\n\n let components = container.getLaidOutComponents();\n\n let colRowCount = this.getColRowCount();\n let cols = colRowCount ? colRowCount.width : 1;\n let rows = colRowCount ? colRowCount.height : 1;\n let spacing = this.getComponentSpacing();\n\n const content = this.measureContent(components, cols, rows);\n\n const innerWidth = this._columnTracks.length > 0\n ? this.trackAxisMax(this._columnTracks, cols, content.columns)\n : cols * this.maxChildExtent(components, true);\n\n const innerHeight = this._rowTracks.length > 0\n ? this.trackAxisMax(this._rowTracks, rows, content.rows)\n : rows * this.maxChildExtent(components, false);\n\n return {\n width: saturate(innerWidth + Math.max(0, cols - 1) * spacing + outerWidth),\n height: saturate(innerHeight + Math.max(0, rows - 1) * spacing + outerHeight)\n };\n }\n\n /**\n * Sums the per-track maxima along one axis: a `fixed` track contributes its\n * pixel value, a `content` track its measured content size, and a `weight`\n * track is unbounded — the first weight track saturates the axis to the\n * unbounded sentinel, since a flex track can grow without limit. A\n * missing track defaults to `weight`, matching {@link trackAxisExtent}.\n *\n * @param tracks - The declared tracks for this axis.\n * @param count - The number of columns (or rows) to size.\n * @param contentSizes - Measured content maxima per track.\n * @returns The summed maximum extent for the axis, excluding spacing.\n */\n private trackAxisMax(tracks: GridTrack[], count: number, contentSizes: number[]): number {\n let total = 0;\n\n for (let i = 0; i < count; i += 1) {\n const track = tracks[i] ?? { mode: \"weight\" as const, value: 1 };\n\n if (track.mode === \"fixed\") {\n total += track.value ?? 0;\n } else if (track.mode === \"content\") {\n total += contentSizes[i] ?? 0;\n } else {\n return UNBOUNDED;\n }\n }\n\n return total;\n }\n\n /**\n * Returns the largest per-child maximum extent across all children on one\n * axis, for the uniform-cell (no-track) fallback. A child whose maximum is\n * `null` or at the unbounded sentinel makes the whole axis unbounded, so the\n * result saturates to the unbounded sentinel.\n *\n * @param components - The grid's children.\n * @param horizontal - `true` to read each child's max width, `false` for height.\n * @returns The largest child maximum, or the unbounded sentinel when any\n * child is unbounded.\n */\n private maxChildExtent(components: Component[], horizontal: boolean): number {\n let largest = 0;\n\n for (const component of components) {\n const max = component.getMaxSize();\n\n if (!max) {\n return UNBOUNDED;\n }\n\n const extent = horizontal ? max.width : max.height;\n\n if (isUnbounded(extent)) {\n return UNBOUNDED;\n }\n\n largest = Math.max(largest, extent);\n }\n\n return largest;\n }\n\n /**\n * Computes the children's combined minSize along this manager's geometry:\n * width is `cols * maxChildMinWidth + (cols-1) * spacing`; height is\n * `rows * maxChildMinHeight + (rows-1) * spacing`. Used by `doLayout` to\n * inflate the working size when the host has opted into `setOverflowing`.\n *\n * @returns The total min-size; `{ width: 0, height: 0 }` when the\n * container is absent or has no children.\n */\n protected computeTotalMinSize(): Size {\n const container = this.getContainer();\n if (!container) {\n return { width: 0, height: 0 };\n }\n\n const components = container.getLaidOutComponents();\n if (components.length === 0) {\n return { width: 0, height: 0 };\n }\n\n const colRowCount = this.getColRowCount();\n const cols = colRowCount ? colRowCount.width : 1;\n const rows = colRowCount ? colRowCount.height : 1;\n const spacing = this.getComponentSpacing();\n\n let maxCellWidth = 0;\n let maxCellHeight = 0;\n\n for (const component of components) {\n const min = component.getMinSize();\n if (min) {\n maxCellWidth = Math.max(maxCellWidth, min.width);\n maxCellHeight = Math.max(maxCellHeight, min.height);\n }\n }\n\n const content = this.measureContent(components, cols, rows);\n\n // When tracks are declared, the axis minimum is the sum of per-track\n // minima — a `fixed` track needs its fixed value, a `content` track its\n // measured content, and a `weight` track nothing (it flexes to fill\n // slack and clips oversized children, so it imposes no intrinsic floor).\n // This keeps a child that the grid is meant to *clip* (e.g. an oversized\n // child in a fixed column) from inflating the whole grid's min width.\n // With no tracks on an axis, fall back to the uniform `maxChild*count`\n // estimate so non-track grids still drive universal scroll unchanged.\n const widthMin = this._columnTracks.length > 0\n ? this.trackAxisExtent(this._columnTracks, cols, content.columns, false)\n : cols * maxCellWidth;\n\n const heightMin = this._rowTracks.length > 0\n ? this.trackAxisExtent(this._rowTracks, rows, content.rows, false)\n : rows * maxCellHeight;\n\n return {\n width: widthMin + Math.max(0, cols - 1) * spacing,\n height: heightMin + Math.max(0, rows - 1) * spacing,\n };\n }\n\n /**\n * Sums the per-track extents along one axis: a `fixed` track contributes its\n * pixel value and a `content` track its measured content size. A `weight`\n * track contributes its measured content when `includeWeightContent` is\n * `true` (the *preferred* extent — wide enough to show its content at\n * natural size) and `0` otherwise (the *minimum* extent — a flex track can\n * shrink to nothing). A missing track (when the list is shorter than\n * `count`) defaults to `weight`, matching `resolveTracks`' weight default.\n *\n * @param tracks - The declared tracks for this axis.\n * @param count - The number of columns (or rows) to size.\n * @param contentSizes - Measured content maxima per track.\n * @param includeWeightContent - Whether weight tracks contribute their\n * measured content (preferred extent) rather than `0` (minimum extent).\n * @returns The summed extent for the axis, excluding spacing.\n */\n private trackAxisExtent(tracks: GridTrack[], count: number, contentSizes: number[], includeWeightContent: boolean): number {\n let total = 0;\n\n for (let i = 0; i < count; i += 1) {\n const track = tracks[i] ?? { mode: \"weight\" as const, value: 1 };\n\n if (track.mode === \"fixed\") {\n total += track.value ?? 0;\n } else if (track.mode === \"content\") {\n total += contentSizes[i] ?? 0;\n } else if (includeWeightContent) {\n total += contentSizes[i] ?? 0;\n }\n }\n\n return total;\n }\n\n /**\n * Tiles all children in a grid of equal-sized cells, left-to-right then top-to-bottom.\n *\n * @remarks Each cell is sized by the column/row tracks; how a child sits\n * inside its cell is driven by the child's own `fill`/`anchor`\n * ([`GridConstraints`](/api/layout/classes/GridConstraints)) falling back to\n * the grid's {@link Grid.setDefaultFill}/{@link Grid.setDefaultAnchor}\n * (default {@link FillType.BOTH}, so children fill their cells out of the\n * box). When {@link Grid.setBaselineAlign} is enabled, the column/row tracks\n * still size each cell (a `\"content\"` column hugs its content), each row\n * uses the natural heights of its children, and components are\n * baseline-aligned within their row, mirroring\n * [`HBox`](/api/layout/classes/HBox)'s baseline-aware placement. Baseline\n * mode auto-flows by `colSpan`; explicit `col`/`row` and `rowSpan > 1` are\n * not supported.\n */\n doLayout() {\n let container = this.getContainer();\n if (!container) {\n return;\n }\n\n let components = container.getLaidOutComponents();\n let containerInsets = container.getContentInsets();\n let containerSize = container.getInnerSize();\n if (!containerSize) {\n return;\n }\n\n let colRowCount = this.getColRowCount();\n let cols = colRowCount ? colRowCount.width : 1;\n let rows = colRowCount ? colRowCount.height : 1;\n let spacing = this.getComponentSpacing();\n\n // Universal scroll: see HBox.doLayout for the rationale. Inflates the\n // working size to the children's combined minSize on the axes the\n // host has marked as overflowing.\n containerSize = this.inflateForOverflow(containerSize);\n\n if (!this._baselineAlign) {\n this.layoutOccupancy(components, cols, rows, containerSize, containerInsets, spacing);\n\n return;\n }\n\n // Baseline mode honours the same per-track column/row sizing as the\n // occupancy path — so a \"content\" column hugs its titles instead of\n // taking a uniform 1/cols share — plus colSpan auto-flow, then\n // baseline-aligns each row's children within the row (mirroring HBox).\n // Explicit col/row placement and rowSpan > 1 are not supported here.\n const content = this.measureContent(components, cols, rows);\n const colExtents = this.resolveTracks(this._columnTracks, cols, containerSize.width, spacing, content.columns);\n const rowExtents = this.resolveTracks(this._rowTracks, rows, containerSize.height, spacing, content.rows);\n\n type BaselineCell = {\n component: Component;\n col: number;\n colSpan: number;\n height: number;\n baseline: number | null;\n };\n\n const perRow: BaselineCell[][] = Array.from({ length: rows }, () => []);\n\n let flowCol = 0;\n let flowRow = 0;\n\n for (const component of components) {\n if (flowRow >= rows) {\n break;\n }\n\n const cons = this.getLayoutConstraints(component) as GridConstraints | undefined;\n const colSpan = Util.clamp(cons?.colSpan ?? 1, 1, cols);\n const size = component.getPreferredSize();\n\n perRow[flowRow].push({\n component,\n col: flowCol,\n colSpan,\n height: size ? size.height : 0,\n baseline: component.getBaseline(),\n });\n\n flowCol += colSpan;\n\n if (flowCol >= cols) {\n flowCol = 0;\n flowRow += 1;\n }\n }\n\n let y = containerInsets.getTop();\n\n for (let row = 0; row < rows; row += 1) {\n const rowCells = perRow[row];\n\n const { rowAscent, rowDescent } = this.computeRowMetrics(\n rowCells.map(cell => cell.height),\n rowCells.map(cell => cell.baseline),\n );\n\n for (const cell of rowCells) {\n let x = containerInsets.getLeft();\n for (let i = 0; i < cell.col; i += 1) {\n x += (colExtents[i] ?? 0) + spacing;\n }\n\n let width = (cell.colSpan - 1) * spacing;\n for (let i = cell.col; i < cell.col + cell.colSpan; i += 1) {\n width += colExtents[i] ?? 0;\n }\n\n let cellY: number;\n\n if (rowAscent !== null) {\n cellY = cell.baseline !== null\n ? y + (rowAscent - cell.baseline)\n : y + this.nullChildY(cell.height, rowAscent, rowDescent);\n } else {\n cellY = y;\n }\n\n this.placeComponent(\n cell.component,\n x,\n cellY,\n width,\n cell.height,\n this._defaultFill,\n this._defaultAnchor\n );\n }\n\n const baselineHeight = rowAscent !== null ? rowAscent + rowDescent : 0;\n\n y += Math.max(rowExtents[row] ?? 0, baselineHeight) + spacing;\n }\n }\n\n /**\n * Resolves a track list into per-track pixel extents along one axis.\n *\n * @param tracks - The declared tracks; missing tracks (when shorter than\n * `count`) default to `{ mode: \"weight\", value: 1 }`.\n * @param count - The number of columns (or rows) to size.\n * @param available - The inner extent of the container along this axis.\n * @param spacing - The inter-cell gap, in pixels.\n * @param contentSizes - Measured content maxima per track, used for `\"content\"` tracks.\n * @returns A `number[count]` of pixel extents.\n *\n * @remarks Fixed tracks keep their `value`; content tracks keep their measured\n * size; the remaining space is split among weight tracks in proportion to their\n * weights. When no weight track exists the remaining space is left unused.\n */\n private resolveTracks(tracks: GridTrack[], count: number, available: number, spacing: number, contentSizes: number[]): number[] {\n const inner = available - Math.max(0, count - 1) * spacing;\n\n const resolved: number[] = new Array(count).fill(0);\n\n let fixedSum = 0;\n let contentSum = 0;\n let weightSum = 0;\n\n for (let i = 0; i < count; i += 1) {\n const track = tracks[i] ?? { mode: \"weight\" as const, value: 1 };\n\n if (track.mode === \"fixed\") {\n resolved[i] = track.value ?? 0;\n fixedSum += resolved[i];\n } else if (track.mode === \"content\") {\n resolved[i] = contentSizes[i] ?? 0;\n contentSum += resolved[i];\n } else {\n weightSum += Math.max(0, track.value ?? 1);\n }\n }\n\n const remaining = Math.max(0, inner - fixedSum - contentSum);\n\n if (weightSum > 0) {\n for (let i = 0; i < count; i += 1) {\n const track = tracks[i] ?? { mode: \"weight\" as const, value: 1 };\n\n if (track.mode === \"weight\") {\n resolved[i] = remaining * (Math.max(0, track.value ?? 1) / weightSum);\n }\n }\n }\n\n return resolved;\n }\n\n /**\n * Measures the content maxima of single-track-spanning children, per column\n * and per row, for `\"content\"` track sizing.\n *\n * @param components - The container's children.\n * @param cols - The column count.\n * @param rows - The row count.\n * @returns `{ columns, rows }` arrays of per-track content maxima.\n *\n * @remarks Each child contributes `max(preferred, min)` so a child that only\n * set a min size still widens (or heightens) its track. A child contributes to\n * a column only when its `colSpan` is `1`, and to a row only when its `rowSpan`\n * is `1` — multi-track spanners are not distributed in v1. Because content\n * measurement is independent of cell placement, the maxima are folded by\n * explicit-or-flow position when known, else by document-order column/row.\n */\n private measureContent(components: Component[], cols: number, rows: number): { columns: number[]; rows: number[] } {\n const columns: number[] = new Array(cols).fill(0);\n const rowSizes: number[] = new Array(rows).fill(0);\n\n // Baseline mode only: per-row preferred heights + baselines, so the row\n // content size can fold in the baseline spread `doLayout` reserves (see\n // below). Left empty when `baselineAlign` is off.\n const rowHeights: number[][] = this._baselineAlign ? Array.from({ length: rows }, () => []) : [];\n const rowBaselines: Array<Array<number | null>> = this._baselineAlign ? Array.from({ length: rows }, () => []) : [];\n\n let flowCol = 0;\n let flowRow = 0;\n\n for (const component of components) {\n const cons = this.getLayoutConstraints(component) as GridConstraints | undefined;\n const preferred = component.getPreferredSize();\n const min = component.getMinSize();\n\n const w = Math.max(preferred ? preferred.width : 0, min ? min.width : 0);\n const h = Math.max(preferred ? preferred.height : 0, min ? min.height : 0);\n\n const colSpan = Math.max(1, cons?.colSpan ?? 1);\n const rowSpan = Math.max(1, cons?.rowSpan ?? 1);\n\n let c: number;\n let r: number;\n\n if (cons && (cons.col != null || cons.row != null)) {\n c = Util.clamp(cons.col ?? 0, 0, Math.max(0, cols - 1));\n r = Util.clamp(cons.row ?? 0, 0, Math.max(0, rows - 1));\n } else {\n c = flowCol;\n r = flowRow;\n\n flowCol += colSpan;\n\n if (flowCol >= cols) {\n flowCol = 0;\n flowRow += rowSpan;\n }\n }\n\n if (colSpan === 1 && c < cols) {\n columns[c] = Math.max(columns[c], w);\n }\n\n if (rowSpan === 1 && r < rows) {\n rowSizes[r] = Math.max(rowSizes[r], h);\n\n if (this._baselineAlign) {\n // Pair the preferred height with the baseline, exactly as\n // `doLayout` does — the cell's placed height and baseline\n // together set the row's ascent/descent.\n rowHeights[r].push(preferred ? preferred.height : 0);\n rowBaselines[r].push(component.getBaseline());\n }\n }\n }\n\n // A baseline-aligned row is `max(tallestCell, rowAscent + rowDescent)`\n // (see `doLayout`): cells on mismatched baselines need the highest ascent\n // plus the deepest descent, which can exceed the tallest cell. Fold that\n // spread into the measured row size so `getPreferredSize` / `getMinSize`\n // reserve what `doLayout` actually lays out, rather than under-reporting\n // and letting the content overflow the box the parent sized from it.\n if (this._baselineAlign) {\n for (let r = 0; r < rows; r += 1) {\n const { rowAscent, rowDescent } = this.computeRowMetrics(rowHeights[r], rowBaselines[r]);\n\n if (rowAscent !== null) {\n rowSizes[r] = Math.max(rowSizes[r], rowAscent + rowDescent);\n }\n }\n }\n\n return { columns, rows: rowSizes };\n }\n\n /**\n * Tiles children using the occupancy-grid algorithm: explicitly-placed\n * children are reserved first, then the remaining children auto-flow into the\n * free cells, with per-track sizing and per-cell clip-vs-place.\n *\n * @param components - The container's children.\n * @param cols - The column count.\n * @param rows - The row count.\n * @param containerSize - The container's (possibly overflow-inflated) inner size.\n * @param insets - The container's insets, supplying the cell origin offset.\n * @param spacing - The inter-cell gap, in pixels.\n */\n private layoutOccupancy(components: Component[], cols: number, rows: number, containerSize: Size, insets: Insets, spacing: number): void {\n const content = this.measureContent(components, cols, rows);\n\n const colExtents = this.resolveTracks(this._columnTracks, cols, containerSize.width, spacing, content.columns);\n const rowExtents = this.resolveTracks(this._rowTracks, rows, containerSize.height, spacing, content.rows);\n\n const occupancy: boolean[][] = [];\n\n for (let r = 0; r < rows; r += 1) {\n occupancy.push(new Array(cols).fill(false));\n }\n\n const owners: Array<Array<string | null>> = [];\n\n for (let r = 0; r < rows; r += 1) {\n owners.push(new Array(cols).fill(null));\n }\n\n const placeAt = (component: Component, r: number, c: number, rowSpan: number, colSpan: number): void => {\n let x = insets.getLeft();\n\n for (let i = 0; i < c; i += 1) {\n x += colExtents[i] + spacing;\n }\n\n let y = insets.getTop();\n\n for (let i = 0; i < r; i += 1) {\n y += rowExtents[i] + spacing;\n }\n\n let w = (colSpan - 1) * spacing;\n\n for (let i = c; i < c + colSpan; i += 1) {\n w += colExtents[i] ?? 0;\n }\n\n let h = (rowSpan - 1) * spacing;\n\n for (let i = r; i < r + rowSpan; i += 1) {\n h += rowExtents[i] ?? 0;\n }\n\n const min = component.getMinSize();\n\n if (min && (min.width > w || min.height > h)) {\n // The child's own `min-width` / `min-height` keep its box from\n // shrinking to the cell on the overflowing axis, so clip it with\n // a cell-sized frame. Honour the grid's fill/anchor on whichever\n // axis the child *does* fit — `resolveBounds` yields the\n // fill/anchor-placed box — and override only the overflowing axis\n // to the child's natural extent (its preferred size, falling back\n // to min) so the content renders at full size up to the clip edge\n // rather than at a cramped preferred that drops fill. The frame is\n // anchored at the cell; the child commits at the resolved offset\n // within it (0 on an overflowing axis, since `resolveBounds`\n // applies no anchor displacement when the child exceeds the cell).\n const resolved = this.resolveBounds(component, x, y, w, h, this._defaultFill, this._defaultAnchor);\n const pref = component.getPreferredSize();\n\n const childWidth = min.width > w ? (pref ? pref.width : min.width) : resolved.width;\n const childHeight = min.height > h ? (pref ? pref.height : min.height) : resolved.height;\n\n component.setClipFrame(x, y, w, h);\n this.commitBounds(component, resolved.x - x, resolved.y - y, childWidth, childHeight);\n } else {\n // The child fits: resolve its bounds honouring its own\n // fill/anchor over the grid defaults, then commit the result so\n // a non-filling child shrinks and anchors within its cell.\n const resolved = this.resolveBounds(component, x, y, w, h, this._defaultFill, this._defaultAnchor);\n\n component.clearClipFrame();\n this.commitBounds(component, resolved.x, resolved.y, resolved.width, resolved.height);\n }\n };\n\n // Pass 1 — reserve explicitly-positioned children.\n for (const component of components) {\n const cons = this.getLayoutConstraints(component) as GridConstraints | undefined;\n\n if (!cons || (cons.col == null && cons.row == null)) {\n continue;\n }\n\n const c = Util.clamp(cons.col ?? 0, 0, Math.max(0, cols - 1));\n const r = Util.clamp(cons.row ?? 0, 0, Math.max(0, rows - 1));\n const colSpan = Util.clamp(cons.colSpan ?? 1, 1, cols - c);\n const rowSpan = Util.clamp(cons.rowSpan ?? 1, 1, rows - r);\n\n for (let rr = r; rr < r + rowSpan; rr += 1) {\n for (let cc = c; cc < c + colSpan; cc += 1) {\n if (occupancy[rr][cc]) {\n console.warn(`Grid: ${component.getId()} overlaps ${owners[rr][cc]} at cell (${rr},${cc})`);\n }\n\n occupancy[rr][cc] = true;\n owners[rr][cc] = component.getId();\n }\n }\n\n placeAt(component, r, c, rowSpan, colSpan);\n }\n\n // Pass 2 — auto-flow the remaining children into free cells.\n for (const component of components) {\n const cons = this.getLayoutConstraints(component) as GridConstraints | undefined;\n\n if (cons && (cons.col != null || cons.row != null)) {\n continue;\n }\n\n const colSpan = Util.clamp(cons?.colSpan ?? 1, 1, cols);\n const rowSpan = Util.clamp(cons?.rowSpan ?? 1, 1, rows);\n\n const slot = this.findFreeCell(occupancy, rows, cols, rowSpan, colSpan);\n\n if (!slot) {\n continue;\n }\n\n for (let rr = slot.r; rr < slot.r + rowSpan; rr += 1) {\n for (let cc = slot.c; cc < slot.c + colSpan; cc += 1) {\n occupancy[rr][cc] = true;\n owners[rr][cc] = component.getId();\n }\n }\n\n placeAt(component, slot.r, slot.c, rowSpan, colSpan);\n }\n }\n\n /**\n * Scans the occupancy grid in row-major order for the first top-left cell\n * whose `rowSpan`×`colSpan` block is entirely free.\n *\n * @param occupancy - The `boolean[rows][cols]` occupancy map.\n * @param rows - The row count.\n * @param cols - The column count.\n * @param rowSpan - The block height to fit.\n * @param colSpan - The block width to fit.\n * @returns The free block's top-left `{ r, c }`, or `null` if none fits.\n */\n private findFreeCell(occupancy: boolean[][], rows: number, cols: number, rowSpan: number, colSpan: number): { r: number; c: number } | null {\n for (let r = 0; r + rowSpan <= rows; r += 1) {\n for (let c = 0; c + colSpan <= cols; c += 1) {\n let free = true;\n\n for (let rr = r; rr < r + rowSpan && free; rr += 1) {\n for (let cc = c; cc < c + colSpan; cc += 1) {\n if (occupancy[rr][cc]) {\n free = false;\n\n break;\n }\n }\n }\n\n if (free) {\n return { r, c };\n }\n }\n }\n\n return null;\n }\n}\n\nconst GridCallable = callable(Grid);\ntype GridCallable = Grid;\nexport {\n Grid as _Grid,\n GridCallable as Grid\n};\n"],"mappings":"iIA6CA,IAAM,KAAN,cAAmB,CAAc,CAE7B,MAAwB,EACxB,SAA2B,EAC3B,SAA2B,EAC3B,aAAiC,EAAS,KAC1C,eAAqC,EAAW,OAChD,eAAkC,GAClC,cAAqC,CAAC,EACtC,WAAkC,CAAC,EAEnC,YAAY,EAAuB,CAG/B,MAAM,EAEF,GACA,KAAK,aAAa,CAAO,CAEjC,CASA,aAAuB,EAA4B,CAC/C,MAAM,aAAa,CAAO,EAEtB,EAAQ,OAAS,IAAA,IACjB,KAAK,QAAQ,EAAQ,IAAI,EAGzB,EAAQ,UAAY,IAAA,IACpB,KAAK,WAAW,EAAQ,OAAO,EAG/B,EAAQ,UAAY,IAAA,IACpB,KAAK,oBAAoB,EAAQ,OAAO,EAGxC,EAAQ,cAAgB,IAAA,IACxB,KAAK,eAAe,EAAQ,WAAW,EAGvC,EAAQ,gBAAkB,IAAA,IAC1B,KAAK,iBAAiB,EAAQ,aAAa,EAG3C,EAAQ,gBAAkB,IAAA,IAC1B,KAAK,iBAAiB,EAAQ,aAAa,EAG3C,EA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Form-Noncommercial-1.0.0\n\nimport { LayoutManager, LayoutManagerOptions } from \"~/layout/LayoutManager.js\";\nimport { FillType } from \"~/layout/FillType.js\";\nimport { AnchorType } from \"~/layout/AnchorType.js\";\nimport { GridTrack } from \"~/layout/GridTrack.js\";\nimport { GridConstraints } from \"~/layout/GridConstraints.js\";\nimport { Size, UNBOUNDED, isUnbounded, saturate } from \"~/primitive/Size.js\";\nimport { Insets } from \"~/primitive/Insets.js\";\nimport { Component } from \"~/core/Component.js\";\nimport { Util } from \"~/core/Util.js\";\nimport { callable } from \"~/core/Callable.js\";\n\n/**\n * Construction-time options for {@link Grid}.\n *\n * @category Layouts\n */\nexport interface GridOptions extends LayoutManagerOptions {\n rows?: number;\n columns?: number;\n spacing?: number;\n\n /** Grid-wide fill applied to children that don't set their own `fill`. Default {@link FillType.BOTH}. */\n defaultFill?: FillType;\n\n /** Grid-wide anchor applied to non-filling children that don't set their own `anchor`. Default {@link AnchorType.CENTER}. */\n defaultAnchor?: AnchorType;\n\n /** When `true`, children are baseline-aligned per row (column/row tracks still apply; children use preferred height). Default `false`. */\n baselineAlign?: boolean;\n\n /** Per-column sizing tracks; see {@link GridTrack}. */\n columnTracks?: GridTrack[];\n\n /** Per-row sizing tracks; see {@link GridTrack}. */\n rowTracks?: GridTrack[];\n}\n\n/**\n * A layout manager that tiles children in a uniform grid of equal-sized cells.\n * Row and column counts can be configured explicitly or left at `0` for auto-calculation.\n *\n * @category Layouts\n */\nclass Grid extends LayoutManager {\n\n private _rows: number = 0;\n private _columns: number = 0;\n private _spacing: number = 5;\n private _defaultFill: FillType = FillType.BOTH;\n private _defaultAnchor: AnchorType = AnchorType.CENTER;\n private _baselineAlign: boolean = false;\n private _columnTracks: GridTrack[] = [];\n private _rowTracks: GridTrack[] = [];\n\n constructor(options?: GridOptions) {\n // LayoutManager's constructor takes no options; applied via applyOptions below.\n // eslint-disable-next-line local/forward-super-options\n super();\n\n if (options) {\n this.applyOptions(options);\n }\n }\n\n /**\n * Applies a {@link GridOptions} bag, dispatching grid dimensions, spacing,\n * default fill/anchor, and baseline alignment after the inherited\n * LayoutManager defaults.\n *\n * @param options - The options bag carrying the values to apply.\n */\n protected applyOptions(options: GridOptions): void {\n super.applyOptions(options);\n\n if (options.rows !== undefined) {\n this.setRows(options.rows);\n }\n\n if (options.columns !== undefined) {\n this.setColumns(options.columns);\n }\n\n if (options.spacing !== undefined) {\n this.setComponentSpacing(options.spacing);\n }\n\n if (options.defaultFill !== undefined) {\n this.setDefaultFill(options.defaultFill);\n }\n\n if (options.defaultAnchor !== undefined) {\n this.setDefaultAnchor(options.defaultAnchor);\n }\n\n if (options.baselineAlign !== undefined) {\n this.setBaselineAlign(options.baselineAlign);\n }\n\n if (options.columnTracks !== undefined) {\n this.setColumnTracks(options.columnTracks);\n }\n\n if (options.rowTracks !== undefined) {\n this.setRowTracks(options.rowTracks);\n }\n }\n\n /**\n * Returns the grid-wide default fill applied to children that don't set\n * their own `fill` constraint.\n *\n * @returns The default {@link FillType} (initially {@link FillType.BOTH}).\n */\n getDefaultFill(): FillType {\n return this._defaultFill;\n }\n\n /**\n * Sets the grid-wide default fill. Each child overrides this with its own\n * {@link GridConstraints} `fill`; otherwise this value drives whether the\n * child fills its cell.\n *\n * @param fill - The default fill strategy for children without their own `fill`.\n */\n setDefaultFill(fill: FillType): this {\n this._defaultFill = fill;\n\n return this;\n }\n\n /**\n * Returns the grid-wide default anchor applied to non-filling children that\n * don't set their own `anchor` constraint.\n *\n * @returns The default {@link AnchorType} (initially {@link AnchorType.CENTER}).\n */\n getDefaultAnchor(): AnchorType {\n return this._defaultAnchor;\n }\n\n /**\n * Sets the grid-wide default anchor. Each child overrides this with its own\n * {@link GridConstraints} `anchor`; otherwise this value positions a\n * non-filling child within its cell.\n *\n * @param anchor - The default anchor for children without their own `anchor`.\n */\n setDefaultAnchor(anchor: AnchorType): this {\n this._defaultAnchor = anchor;\n\n return this;\n }\n\n /**\n * Returns whether children are baseline-aligned per row.\n *\n * @returns `true` if per-row baseline alignment is enabled.\n */\n isBaselineAlign(): boolean {\n return this._baselineAlign;\n }\n\n /**\n * Sets whether children are baseline-aligned per row. When `true`, the\n * column/row tracks still size each cell (so a `\"content\"` column hugs its\n * content), each row uses the natural heights of its children, and\n * components are baseline-aligned within the row, mirroring\n * [`HBox`](/api/layout/classes/HBox)'s baseline-aware placement. Orthogonal\n * to {@link Grid.setDefaultFill} — baseline alignment owns the vertical axis\n * while fill/anchor still drive the horizontal axis.\n *\n * @param baselineAlign - Pass `true` to enable per-row baseline alignment.\n */\n setBaselineAlign(baselineAlign: boolean): this {\n this._baselineAlign = baselineAlign;\n\n return this;\n }\n\n /**\n * Returns the configured number of rows, or `0` if the grid auto-calculates row count.\n *\n * @returns The row count.\n */\n getRows() {\n return this._rows;\n }\n\n /**\n * Sets the number of rows. Pass `0` to let the grid auto-calculate.\n *\n * @param rows - The desired row count, or `0` for automatic.\n */\n setRows(rows: number) : this {\n this._rows = rows;\n\n return this;\n }\n\n /**\n * Returns the gap, in pixels, between adjacent cells (horizontally and vertically).\n *\n * @returns The current spacing in pixels.\n */\n getComponentSpacing() {\n return this._spacing || 0;\n }\n\n /**\n * Sets the gap, in pixels, between adjacent cells. Applied both horizontally\n * (between columns) and vertically (between rows).\n *\n * @param spacing - Spacing in pixels. Falsy values are treated as `0`.\n */\n setComponentSpacing(spacing: number) : this {\n this._spacing = spacing || 0;\n\n return this;\n }\n\n /**\n * Returns the configured number of columns, or `0` if the grid auto-calculates column count.\n *\n * @returns The column count.\n */\n getColumns() {\n return this._columns;\n }\n\n /**\n * Sets the number of columns. Pass `0` to let the grid auto-calculate.\n *\n * @param columns - The desired column count, or `0` for automatic.\n */\n setColumns(columns: number) : this {\n this._columns = columns;\n\n return this;\n }\n\n /**\n * Returns the per-column sizing tracks.\n *\n * @returns The configured column tracks; empty when columns size uniformly.\n */\n getColumnTracks(): GridTrack[] {\n return this._columnTracks;\n }\n\n /**\n * Sets the per-column sizing tracks. When fewer tracks are supplied than the\n * grid has columns, the missing tracks default to `{ mode: \"weight\", value: 1 }`.\n *\n * @param tracks - The column tracks; see {@link GridTrack}.\n */\n setColumnTracks(tracks: GridTrack[]): this {\n this._columnTracks = tracks;\n\n return this;\n }\n\n /**\n * Returns the per-row sizing tracks.\n *\n * @returns The configured row tracks; empty when rows size uniformly.\n */\n getRowTracks(): GridTrack[] {\n return this._rowTracks;\n }\n\n /**\n * Sets the per-row sizing tracks. When fewer tracks are supplied than the\n * grid has rows, the missing tracks default to `{ mode: \"weight\", value: 1 }`.\n *\n * @param tracks - The row tracks; see {@link GridTrack}.\n */\n setRowTracks(tracks: GridTrack[]): this {\n this._rowTracks = tracks;\n\n return this;\n }\n\n /**\n * Returns the computed cell count for the current component list as `{width: rows, height: columns}`.\n *\n * @returns An object with `width` (row count) and `height` (column count), or `undefined` if no container is attached.\n *\n * @remarks The property names `width` and `height` are repurposed here to\n * carry column and row counts rather than pixel dimensions —\n * `result.width` is the column count, `result.height` is the row count.\n */\n getColRowCount() {\n let container = this.getContainer();\n if (!container) {\n return;\n }\n\n let components = container.getLaidOutComponents();\n let componentCount = components.length;\n\n let rows = 0;\n let columns = 0;\n\n if (!this._rows && !this._columns) {\n columns = Math.floor(Math.sqrt(componentCount));\n rows = Math.ceil(componentCount / columns);\n } else if (this._rows && this._columns) {\n rows = this._rows;\n columns = this._columns;\n } else if (this._columns) {\n columns = this._columns;\n rows = Math.ceil(componentCount / columns);\n } else {\n rows = this._rows;\n columns = Math.ceil(componentCount / rows);\n }\n\n return {\n width: columns,\n height: rows\n };\n }\n\n /**\n * Returns the preferred size. With tracks declared, this is the sum of the\n * per-track preferred extents (fixed tracks their value, content *and*\n * weight tracks their measured content — wide/tall enough to show every\n * cell at its natural size) plus spacing. Track-less grids keep the uniform\n * `maxChildPreferred * count` estimate.\n *\n * @returns The preferred `{width, height}`, or `null` if no container is attached.\n */\n getPreferredSize(): Size | null {\n let container = this.getContainer();\n if (!container) {\n return null;\n }\n\n let perimeterSize = container.getPerimeterSize();\n\n let outerWidth = perimeterSize.left + perimeterSize.right;\n let outerHeight = perimeterSize.top + perimeterSize.bottom;\n\n let components = container.getLaidOutComponents();\n\n let maxCellWidth = 0;\n let maxCellHeight = 0;\n\n for (const component of components) {\n let size = component.getPreferredSize();\n\n if (size) {\n maxCellWidth = Math.max(maxCellWidth, size.width);\n maxCellHeight = Math.max(maxCellHeight, size.height);\n }\n }\n\n let colRowCount = this.getColRowCount();\n let cols = colRowCount ? colRowCount.width : 1;\n let rows = colRowCount ? colRowCount.height : 1;\n let spacing = this.getComponentSpacing();\n\n const content = this.measureContent(components, cols, rows);\n\n let innerWidth = this._columnTracks.length > 0\n ? this.trackAxisExtent(this._columnTracks, cols, content.columns, true)\n : maxCellWidth * cols;\n\n let innerHeight = this._rowTracks.length > 0\n ? this.trackAxisExtent(this._rowTracks, rows, content.rows, true)\n : maxCellHeight * rows;\n\n innerWidth += Math.max(0, cols - 1) * spacing;\n innerHeight += Math.max(0, rows - 1) * spacing;\n\n return {\n width: innerWidth + outerWidth,\n height: innerHeight + outerHeight\n };\n }\n\n /**\n * Returns the minimum size. With tracks declared, this is the sum of the\n * per-track minima (fixed tracks their value, content tracks their measured\n * content, weight tracks `0`) plus spacing — matching what `doLayout`\n * actually lays out, so a host no longer over-reserves space the way the\n * uniform `maxChildMin * count` estimate did. Track-less grids keep that\n * uniform estimate.\n *\n * @returns The minimum `{width, height}`, or `null` if no container is attached.\n */\n getMinSize(): Size | null {\n let container = this.getContainer();\n if (!container) {\n return null;\n }\n\n let perimeterSize = container.getPerimeterSize();\n\n let outerWidth = perimeterSize.left + perimeterSize.right;\n let outerHeight = perimeterSize.top + perimeterSize.bottom;\n\n let components = container.getLaidOutComponents();\n\n let maxCellWidth = 0;\n let maxCellHeight = 0;\n\n for (const component of components) {\n let size = component.getMinSize();\n\n if (size) {\n maxCellWidth = Math.max(maxCellWidth, size.width);\n maxCellHeight = Math.max(maxCellHeight, size.height);\n }\n }\n\n let colRowCount = this.getColRowCount();\n let cols = colRowCount ? colRowCount.width : 1;\n let rows = colRowCount ? colRowCount.height : 1;\n let spacing = this.getComponentSpacing();\n\n const content = this.measureContent(components, cols, rows);\n\n let innerWidth = this._columnTracks.length > 0\n ? this.trackAxisExtent(this._columnTracks, cols, content.columns, false)\n : maxCellWidth * cols;\n\n let innerHeight = this._rowTracks.length > 0\n ? this.trackAxisExtent(this._rowTracks, rows, content.rows, false)\n : maxCellHeight * rows;\n\n innerWidth += Math.max(0, cols - 1) * spacing;\n innerHeight += Math.max(0, rows - 1) * spacing;\n\n return {\n width: innerWidth + outerWidth,\n height: innerHeight + outerHeight\n };\n }\n\n /**\n * Returns the maximum size the grid can usefully occupy: the sum of the\n * per-track maxima plus inter-cell spacing and the container perimeter. A\n * `fixed` track contributes its pixel value, a `content` track its measured\n * content, and a `weight` track is unbounded — so any weight track makes the\n * whole axis unbounded (the grid can absorb arbitrary slack there). With no\n * tracks on an axis the fallback is `cols * maxChildMax` (the uniform-cell\n * estimate), where a child's `null`/sentinel maximum counts as unbounded.\n *\n * @returns The maximum `{width, height}`, or `null` if no container is attached.\n */\n getMaxSize(): Size | null {\n let container = this.getContainer();\n if (!container) {\n return null;\n }\n\n let perimeterSize = container.getPerimeterSize();\n\n let outerWidth = perimeterSize.left + perimeterSize.right;\n let outerHeight = perimeterSize.top + perimeterSize.bottom;\n\n let components = container.getLaidOutComponents();\n\n let colRowCount = this.getColRowCount();\n let cols = colRowCount ? colRowCount.width : 1;\n let rows = colRowCount ? colRowCount.height : 1;\n let spacing = this.getComponentSpacing();\n\n const content = this.measureContent(components, cols, rows);\n\n const innerWidth = this._columnTracks.length > 0\n ? this.trackAxisMax(this._columnTracks, cols, content.columns)\n : cols * this.maxChildExtent(components, true);\n\n const innerHeight = this._rowTracks.length > 0\n ? this.trackAxisMax(this._rowTracks, rows, content.rows)\n : rows * this.maxChildExtent(components, false);\n\n return {\n width: saturate(innerWidth + Math.max(0, cols - 1) * spacing + outerWidth),\n height: saturate(innerHeight + Math.max(0, rows - 1) * spacing + outerHeight)\n };\n }\n\n /**\n * Sums the per-track maxima along one axis: a `fixed` track contributes its\n * pixel value, a `content` track its measured content size, and a `weight`\n * track is unbounded — the first weight track saturates the axis to the\n * unbounded sentinel, since a flex track can grow without limit. A\n * missing track defaults to `weight`, matching {@link trackAxisExtent}.\n *\n * @param tracks - The declared tracks for this axis.\n * @param count - The number of columns (or rows) to size.\n * @param contentSizes - Measured content maxima per track.\n * @returns The summed maximum extent for the axis, excluding spacing.\n */\n private trackAxisMax(tracks: GridTrack[], count: number, contentSizes: number[]): number {\n let total = 0;\n\n for (let i = 0; i < count; i += 1) {\n const track = tracks[i] ?? { mode: \"weight\" as const, value: 1 };\n\n if (track.mode === \"fixed\") {\n total += track.value ?? 0;\n } else if (track.mode === \"content\") {\n total += contentSizes[i] ?? 0;\n } else {\n return UNBOUNDED;\n }\n }\n\n return total;\n }\n\n /**\n * Returns the largest per-child maximum extent across all children on one\n * axis, for the uniform-cell (no-track) fallback. A child whose maximum is\n * `null` or at the unbounded sentinel makes the whole axis unbounded, so the\n * result saturates to the unbounded sentinel.\n *\n * @param components - The grid's children.\n * @param horizontal - `true` to read each child's max width, `false` for height.\n * @returns The largest child maximum, or the unbounded sentinel when any\n * child is unbounded.\n */\n private maxChildExtent(components: Component[], horizontal: boolean): number {\n let largest = 0;\n\n for (const component of components) {\n const max = component.getMaxSize();\n\n if (!max) {\n return UNBOUNDED;\n }\n\n const extent = horizontal ? max.width : max.height;\n\n if (isUnbounded(extent)) {\n return UNBOUNDED;\n }\n\n largest = Math.max(largest, extent);\n }\n\n return largest;\n }\n\n /**\n * Computes the children's combined minSize along this manager's geometry:\n * width is `cols * maxChildMinWidth + (cols-1) * spacing`; height is\n * `rows * maxChildMinHeight + (rows-1) * spacing`. Used by `doLayout` to\n * inflate the working size when the host has opted into `setOverflowing`.\n *\n * @returns The total min-size; `{ width: 0, height: 0 }` when the\n * container is absent or has no children.\n */\n protected computeTotalMinSize(): Size {\n const container = this.getContainer();\n if (!container) {\n return { width: 0, height: 0 };\n }\n\n const components = container.getLaidOutComponents();\n if (components.length === 0) {\n return { width: 0, height: 0 };\n }\n\n const colRowCount = this.getColRowCount();\n const cols = colRowCount ? colRowCount.width : 1;\n const rows = colRowCount ? colRowCount.height : 1;\n const spacing = this.getComponentSpacing();\n\n let maxCellWidth = 0;\n let maxCellHeight = 0;\n\n for (const component of components) {\n const min = component.getMinSize();\n if (min) {\n maxCellWidth = Math.max(maxCellWidth, min.width);\n maxCellHeight = Math.max(maxCellHeight, min.height);\n }\n }\n\n const content = this.measureContent(components, cols, rows);\n\n // When tracks are declared, the axis minimum is the sum of per-track\n // minima — a `fixed` track needs its fixed value, a `content` track its\n // measured content, and a `weight` track nothing (it flexes to fill\n // slack and clips oversized children, so it imposes no intrinsic floor).\n // This keeps a child that the grid is meant to *clip* (e.g. an oversized\n // child in a fixed column) from inflating the whole grid's min width.\n // With no tracks on an axis, fall back to the uniform `maxChild*count`\n // estimate so non-track grids still drive universal scroll unchanged.\n const widthMin = this._columnTracks.length > 0\n ? this.trackAxisExtent(this._columnTracks, cols, content.columns, false)\n : cols * maxCellWidth;\n\n const heightMin = this._rowTracks.length > 0\n ? this.trackAxisExtent(this._rowTracks, rows, content.rows, false)\n : rows * maxCellHeight;\n\n return {\n width: widthMin + Math.max(0, cols - 1) * spacing,\n height: heightMin + Math.max(0, rows - 1) * spacing,\n };\n }\n\n /**\n * Sums the per-track extents along one axis: a `fixed` track contributes its\n * pixel value and a `content` track its measured content size. A `weight`\n * track contributes its measured content when `includeWeightContent` is\n * `true` (the *preferred* extent — wide enough to show its content at\n * natural size) and `0` otherwise (the *minimum* extent — a flex track can\n * shrink to nothing). A missing track (when the list is shorter than\n * `count`) defaults to `weight`, matching `resolveTracks`' weight default.\n *\n * @param tracks - The declared tracks for this axis.\n * @param count - The number of columns (or rows) to size.\n * @param contentSizes - Measured content maxima per track.\n * @param includeWeightContent - Whether weight tracks contribute their\n * measured content (preferred extent) rather than `0` (minimum extent).\n * @returns The summed extent for the axis, excluding spacing.\n */\n private trackAxisExtent(tracks: GridTrack[], count: number, contentSizes: number[], includeWeightContent: boolean): number {\n let total = 0;\n\n for (let i = 0; i < count; i += 1) {\n const track = tracks[i] ?? { mode: \"weight\" as const, value: 1 };\n\n if (track.mode === \"fixed\") {\n total += track.value ?? 0;\n } else if (track.mode === \"content\") {\n total += contentSizes[i] ?? 0;\n } else if (includeWeightContent) {\n total += contentSizes[i] ?? 0;\n }\n }\n\n return total;\n }\n\n /**\n * Tiles all children in a grid of equal-sized cells, left-to-right then top-to-bottom.\n *\n * @remarks Each cell is sized by the column/row tracks; how a child sits\n * inside its cell is driven by the child's own `fill`/`anchor`\n * ([`GridConstraints`](/api/layout/classes/GridConstraints)) falling back to\n * the grid's {@link Grid.setDefaultFill}/{@link Grid.setDefaultAnchor}\n * (default {@link FillType.BOTH}, so children fill their cells out of the\n * box). When {@link Grid.setBaselineAlign} is enabled, the column/row tracks\n * still size each cell (a `\"content\"` column hugs its content), each row\n * uses the natural heights of its children, and components are\n * baseline-aligned within their row, mirroring\n * [`HBox`](/api/layout/classes/HBox)'s baseline-aware placement. Baseline\n * mode auto-flows by `colSpan`; explicit `col`/`row` and `rowSpan > 1` are\n * not supported.\n */\n doLayout() {\n let container = this.getContainer();\n if (!container) {\n return;\n }\n\n let components = container.getLaidOutComponents();\n let containerInsets = container.getContentInsets();\n let containerSize = container.getInnerSize();\n if (!containerSize) {\n return;\n }\n\n let colRowCount = this.getColRowCount();\n let cols = colRowCount ? colRowCount.width : 1;\n let rows = colRowCount ? colRowCount.height : 1;\n let spacing = this.getComponentSpacing();\n\n // Universal scroll: see HBox.doLayout for the rationale. Inflates the\n // working size to the children's combined minSize on the axes the\n // host has marked as overflowing.\n containerSize = this.inflateForOverflow(containerSize);\n\n if (!this._baselineAlign) {\n this.layoutOccupancy(components, cols, rows, containerSize, containerInsets, spacing);\n\n return;\n }\n\n // Baseline mode honours the same per-track column/row sizing as the\n // occupancy path — so a \"content\" column hugs its titles instead of\n // taking a uniform 1/cols share — plus colSpan auto-flow, then\n // baseline-aligns each row's children within the row (mirroring HBox).\n // Explicit col/row placement and rowSpan > 1 are not supported here.\n const content = this.measureContent(components, cols, rows);\n const colExtents = this.resolveTracks(this._columnTracks, cols, containerSize.width, spacing, content.columns);\n const rowExtents = this.resolveTracks(this._rowTracks, rows, containerSize.height, spacing, content.rows);\n\n type BaselineCell = {\n component: Component;\n col: number;\n colSpan: number;\n height: number;\n baseline: number | null;\n };\n\n const perRow: BaselineCell[][] = Array.from({ length: rows }, () => []);\n\n let flowCol = 0;\n let flowRow = 0;\n\n for (const component of components) {\n if (flowRow >= rows) {\n break;\n }\n\n const cons = this.getLayoutConstraints(component) as GridConstraints | undefined;\n const colSpan = Util.clamp(cons?.colSpan ?? 1, 1, cols);\n const size = component.getPreferredSize();\n\n perRow[flowRow].push({\n component,\n col: flowCol,\n colSpan,\n height: size ? size.height : 0,\n baseline: component.getBaseline(),\n });\n\n flowCol += colSpan;\n\n if (flowCol >= cols) {\n flowCol = 0;\n flowRow += 1;\n }\n }\n\n let y = containerInsets.getTop();\n\n for (let row = 0; row < rows; row += 1) {\n const rowCells = perRow[row];\n\n const { rowAscent, rowDescent } = this.computeRowMetrics(\n rowCells.map(cell => cell.height),\n rowCells.map(cell => cell.baseline),\n );\n\n for (const cell of rowCells) {\n let x = containerInsets.getLeft();\n for (let i = 0; i < cell.col; i += 1) {\n x += (colExtents[i] ?? 0) + spacing;\n }\n\n let width = (cell.colSpan - 1) * spacing;\n for (let i = cell.col; i < cell.col + cell.colSpan; i += 1) {\n width += colExtents[i] ?? 0;\n }\n\n let cellY: number;\n\n if (rowAscent !== null) {\n cellY = cell.baseline !== null\n ? y + (rowAscent - cell.baseline)\n : y + this.nullChildY(cell.height, rowAscent, rowDescent);\n } else {\n cellY = y;\n }\n\n this.placeComponent(\n cell.component,\n x,\n cellY,\n width,\n cell.height,\n this._defaultFill,\n this._defaultAnchor\n );\n }\n\n const baselineHeight = rowAscent !== null ? rowAscent + rowDescent : 0;\n\n y += Math.max(rowExtents[row] ?? 0, baselineHeight) + spacing;\n }\n }\n\n /**\n * Resolves a track list into per-track pixel extents along one axis.\n *\n * @param tracks - The declared tracks; missing tracks (when shorter than\n * `count`) default to `{ mode: \"weight\", value: 1 }`.\n * @param count - The number of columns (or rows) to size.\n * @param available - The inner extent of the container along this axis.\n * @param spacing - The inter-cell gap, in pixels.\n * @param contentSizes - Measured content maxima per track, used for `\"content\"` tracks.\n * @returns A `number[count]` of pixel extents.\n *\n * @remarks Fixed tracks keep their `value`; content tracks keep their measured\n * size; the remaining space is split among weight tracks in proportion to their\n * weights. When no weight track exists the remaining space is left unused.\n */\n private resolveTracks(tracks: GridTrack[], count: number, available: number, spacing: number, contentSizes: number[]): number[] {\n const inner = available - Math.max(0, count - 1) * spacing;\n\n const resolved: number[] = new Array(count).fill(0);\n\n let fixedSum = 0;\n let contentSum = 0;\n let weightSum = 0;\n\n for (let i = 0; i < count; i += 1) {\n const track = tracks[i] ?? { mode: \"weight\" as const, value: 1 };\n\n if (track.mode === \"fixed\") {\n resolved[i] = track.value ?? 0;\n fixedSum += resolved[i];\n } else if (track.mode === \"content\") {\n resolved[i] = contentSizes[i] ?? 0;\n contentSum += resolved[i];\n } else {\n weightSum += Math.max(0, track.value ?? 1);\n }\n }\n\n const remaining = Math.max(0, inner - fixedSum - contentSum);\n\n if (weightSum > 0) {\n for (let i = 0; i < count; i += 1) {\n const track = tracks[i] ?? { mode: \"weight\" as const, value: 1 };\n\n if (track.mode === \"weight\") {\n resolved[i] = remaining * (Math.max(0, track.value ?? 1) / weightSum);\n }\n }\n }\n\n return resolved;\n }\n\n /**\n * Measures the content maxima of single-track-spanning children, per column\n * and per row, for `\"content\"` track sizing.\n *\n * @param components - The container's children.\n * @param cols - The column count.\n * @param rows - The row count.\n * @returns `{ columns, rows }` arrays of per-track content maxima.\n *\n * @remarks Each child contributes `max(preferred, min)` so a child that only\n * set a min size still widens (or heightens) its track. A child contributes to\n * a column only when its `colSpan` is `1`, and to a row only when its `rowSpan`\n * is `1` — multi-track spanners are not distributed in v1. Because content\n * measurement is independent of cell placement, the maxima are folded by\n * explicit-or-flow position when known, else by document-order column/row.\n */\n private measureContent(components: Component[], cols: number, rows: number): { columns: number[]; rows: number[] } {\n const columns: number[] = new Array(cols).fill(0);\n const rowSizes: number[] = new Array(rows).fill(0);\n\n // Baseline mode only: per-row preferred heights + baselines, so the row\n // content size can fold in the baseline spread `doLayout` reserves (see\n // below). Left empty when `baselineAlign` is off.\n const rowHeights: number[][] = this._baselineAlign ? Array.from({ length: rows }, () => []) : [];\n const rowBaselines: Array<Array<number | null>> = this._baselineAlign ? Array.from({ length: rows }, () => []) : [];\n\n let flowCol = 0;\n let flowRow = 0;\n\n for (const component of components) {\n const cons = this.getLayoutConstraints(component) as GridConstraints | undefined;\n const preferred = component.getPreferredSize();\n const min = component.getMinSize();\n\n const w = Math.max(preferred ? preferred.width : 0, min ? min.width : 0);\n const h = Math.max(preferred ? preferred.height : 0, min ? min.height : 0);\n\n const colSpan = Math.max(1, cons?.colSpan ?? 1);\n const rowSpan = Math.max(1, cons?.rowSpan ?? 1);\n\n let c: number;\n let r: number;\n\n if (cons && (cons.col != null || cons.row != null)) {\n c = Util.clamp(cons.col ?? 0, 0, Math.max(0, cols - 1));\n r = Util.clamp(cons.row ?? 0, 0, Math.max(0, rows - 1));\n } else {\n c = flowCol;\n r = flowRow;\n\n flowCol += colSpan;\n\n if (flowCol >= cols) {\n flowCol = 0;\n flowRow += rowSpan;\n }\n }\n\n if (colSpan === 1 && c < cols) {\n columns[c] = Math.max(columns[c], w);\n }\n\n if (rowSpan === 1 && r < rows) {\n rowSizes[r] = Math.max(rowSizes[r], h);\n\n if (this._baselineAlign) {\n // Pair the preferred height with the baseline, exactly as\n // `doLayout` does — the cell's placed height and baseline\n // together set the row's ascent/descent.\n rowHeights[r].push(preferred ? preferred.height : 0);\n rowBaselines[r].push(component.getBaseline());\n }\n }\n }\n\n // A baseline-aligned row is `max(tallestCell, rowAscent + rowDescent)`\n // (see `doLayout`): cells on mismatched baselines need the highest ascent\n // plus the deepest descent, which can exceed the tallest cell. Fold that\n // spread into the measured row size so `getPreferredSize` / `getMinSize`\n // reserve what `doLayout` actually lays out, rather than under-reporting\n // and letting the content overflow the box the parent sized from it.\n if (this._baselineAlign) {\n for (let r = 0; r < rows; r += 1) {\n const { rowAscent, rowDescent } = this.computeRowMetrics(rowHeights[r], rowBaselines[r]);\n\n if (rowAscent !== null) {\n rowSizes[r] = Math.max(rowSizes[r], rowAscent + rowDescent);\n }\n }\n }\n\n return { columns, rows: rowSizes };\n }\n\n /**\n * Tiles children using the occupancy-grid algorithm: explicitly-placed\n * children are reserved first, then the remaining children auto-flow into the\n * free cells, with per-track sizing and per-cell clip-vs-place.\n *\n * @param components - The container's children.\n * @param cols - The column count.\n * @param rows - The row count.\n * @param containerSize - The container's (possibly overflow-inflated) inner size.\n * @param insets - The container's insets, supplying the cell origin offset.\n * @param spacing - The inter-cell gap, in pixels.\n */\n private layoutOccupancy(components: Component[], cols: number, rows: number, containerSize: Size, insets: Insets, spacing: number): void {\n const content = this.measureContent(components, cols, rows);\n\n const colExtents = this.resolveTracks(this._columnTracks, cols, containerSize.width, spacing, content.columns);\n const rowExtents = this.resolveTracks(this._rowTracks, rows, containerSize.height, spacing, content.rows);\n\n const occupancy: boolean[][] = [];\n\n for (let r = 0; r < rows; r += 1) {\n occupancy.push(new Array(cols).fill(false));\n }\n\n const owners: Array<Array<string | null>> = [];\n\n for (let r = 0; r < rows; r += 1) {\n owners.push(new Array(cols).fill(null));\n }\n\n const placeAt = (component: Component, r: number, c: number, rowSpan: number, colSpan: number): void => {\n let x = insets.getLeft();\n\n for (let i = 0; i < c; i += 1) {\n x += colExtents[i] + spacing;\n }\n\n let y = insets.getTop();\n\n for (let i = 0; i < r; i += 1) {\n y += rowExtents[i] + spacing;\n }\n\n let w = (colSpan - 1) * spacing;\n\n for (let i = c; i < c + colSpan; i += 1) {\n w += colExtents[i] ?? 0;\n }\n\n let h = (rowSpan - 1) * spacing;\n\n for (let i = r; i < r + rowSpan; i += 1) {\n h += rowExtents[i] ?? 0;\n }\n\n const min = component.getMinSize();\n\n if (min && (min.width > w || min.height > h)) {\n // The child's own `min-width` / `min-height` keep its box from\n // shrinking to the cell on the overflowing axis, so clip it with\n // a cell-sized frame. Honour the grid's fill/anchor on whichever\n // axis the child *does* fit — `resolveBounds` yields the\n // fill/anchor-placed box — and override only the overflowing axis\n // to the child's natural extent (its preferred size, falling back\n // to min) so the content renders at full size up to the clip edge\n // rather than at a cramped preferred that drops fill. The frame is\n // anchored at the cell; the child commits at the resolved offset\n // within it (0 on an overflowing axis, since `resolveBounds`\n // applies no anchor displacement when the child exceeds the cell).\n const resolved = this.resolveBounds(component, x, y, w, h, this._defaultFill, this._defaultAnchor);\n const pref = component.getPreferredSize();\n\n const childWidth = min.width > w ? (pref ? pref.width : min.width) : resolved.width;\n const childHeight = min.height > h ? (pref ? pref.height : min.height) : resolved.height;\n\n component.setClipFrame(x, y, w, h);\n this.commitBounds(component, resolved.x - x, resolved.y - y, childWidth, childHeight);\n } else {\n // The child fits: resolve its bounds honouring its own\n // fill/anchor over the grid defaults, then commit the result so\n // a non-filling child shrinks and anchors within its cell.\n const resolved = this.resolveBounds(component, x, y, w, h, this._defaultFill, this._defaultAnchor);\n\n component.clearClipFrame();\n this.commitBounds(component, resolved.x, resolved.y, resolved.width, resolved.height);\n }\n };\n\n // Pass 1 — reserve explicitly-positioned children.\n for (const component of components) {\n const cons = this.getLayoutConstraints(component) as GridConstraints | undefined;\n\n if (!cons || (cons.col == null && cons.row == null)) {\n continue;\n }\n\n const c = Util.clamp(cons.col ?? 0, 0, Math.max(0, cols - 1));\n const r = Util.clamp(cons.row ?? 0, 0, Math.max(0, rows - 1));\n const colSpan = Util.clamp(cons.colSpan ?? 1, 1, cols - c);\n const rowSpan = Util.clamp(cons.rowSpan ?? 1, 1, rows - r);\n\n for (let rr = r; rr < r + rowSpan; rr += 1) {\n for (let cc = c; cc < c + colSpan; cc += 1) {\n if (occupancy[rr][cc]) {\n console.warn(`Grid: ${component.getId()} overlaps ${owners[rr][cc]} at cell (${rr},${cc})`);\n }\n\n occupancy[rr][cc] = true;\n owners[rr][cc] = component.getId();\n }\n }\n\n placeAt(component, r, c, rowSpan, colSpan);\n }\n\n // Pass 2 — auto-flow the remaining children into free cells.\n for (const component of components) {\n const cons = this.getLayoutConstraints(component) as GridConstraints | undefined;\n\n if (cons && (cons.col != null || cons.row != null)) {\n continue;\n }\n\n const colSpan = Util.clamp(cons?.colSpan ?? 1, 1, cols);\n const rowSpan = Util.clamp(cons?.rowSpan ?? 1, 1, rows);\n\n const slot = this.findFreeCell(occupancy, rows, cols, rowSpan, colSpan);\n\n if (!slot) {\n continue;\n }\n\n for (let rr = slot.r; rr < slot.r + rowSpan; rr += 1) {\n for (let cc = slot.c; cc < slot.c + colSpan; cc += 1) {\n occupancy[rr][cc] = true;\n owners[rr][cc] = component.getId();\n }\n }\n\n placeAt(component, slot.r, slot.c, rowSpan, colSpan);\n }\n }\n\n /**\n * Scans the occupancy grid in row-major order for the first top-left cell\n * whose `rowSpan`×`colSpan` block is entirely free.\n *\n * @param occupancy - The `boolean[rows][cols]` occupancy map.\n * @param rows - The row count.\n * @param cols - The column count.\n * @param rowSpan - The block height to fit.\n * @param colSpan - The block width to fit.\n * @returns The free block's top-left `{ r, c }`, or `null` if none fits.\n */\n private findFreeCell(occupancy: boolean[][], rows: number, cols: number, rowSpan: number, colSpan: number): { r: number; c: number } | null {\n for (let r = 0; r + rowSpan <= rows; r += 1) {\n for (let c = 0; c + colSpan <= cols; c += 1) {\n let free = true;\n\n for (let rr = r; rr < r + rowSpan && free; rr += 1) {\n for (let cc = c; cc < c + colSpan; cc += 1) {\n if (occupancy[rr][cc]) {\n free = false;\n\n break;\n }\n }\n }\n\n if (free) {\n return { r, c };\n }\n }\n }\n\n return null;\n }\n}\n\nconst GridCallable = callable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AK,EAAI,EAAS,GAAM,EAC/C,EAAU,EAAG,CAAC,GAAM,GACpB,EAAO,EAAG,CAAC,GAAM,EAAU,MAAM,EAIzC,QAAQ,EAAW,EAAK,EAAG,EAAK,EAAG,EAAS,CAAO,CAH/C,CAIR,CACJ,CAaA,aAAqB,EAAwB,EAAc,EAAc,EAAiB,EAAkD,CACxI,IAAK,IAAI,EAAI,EAAG,EAAI,GAAW,EAAM,GAAK,EACtC,IAAK,IAAI,EAAI,EAAG,EAAI,GAAW,EAAM,GAAK,EAAG,CACzC,IAAI,EAAO,GAEX,IAAK,IAAI,EAAK,EAAG,EAAK,EAAI,GAAW,EAAM,GAAM,EAC7C,IAAK,IAAI,EAAK,EAAG,EAAK,EAAI,EAAS,GAAM,EACrC,GAAI,EAAU,EAAG,CAAC,GAAK,CACnB,EAAO,GAEP,KACJ,CAIR,GAAI,EACA,MAAO,CAAE,IAAG,GAAE,CAEtB,CAGJ,OAAO,IACX,CACJ,EAEM,EAAe,EAAS,IAAI"}
@@ -1,2 +1,2 @@
1
- import{t as e}from"./DOM-CGn7xyTw.js";import{a as t,l as n,n as r}from"./Position-A39T7-_1.js";import{_ as i,f as a,h as o,l as s,t as c,u as l,y as u}from"./Component-DXf5a3g0.js";import{t as d}from"./ListenerBag-WPdKuuds.js";import{t as f}from"./HBox-Ce0GTCJP.js";import{i as p,n as m,t as h}from"./LayoutSizes-DU3qSq0w.js";import{n as g}from"./Border-BgaZkc1R.js";import{t as _}from"./LayoutConstraints-DkctJZXB.js";import{t as v}from"./Button-U1rsP4v8.js";var y=14,b=`▶`,x=null;function ensureAccordionIndicatorClassRule(){x||=new i({scope:`class`,name:`AccordionIndicator`,styles:{textAlign:`center`,pointerEvents:`none`,fontSize:`10px`,color:`var(--ts-ui-accordion-indicator-color, rgb(100,100,100))`,transition:`transform 200ms ease`}})}var AccordionIndicator=class extends c{_lineHeight=null;constructor(e){ensureAccordionIndicatorClassRule(),super({tag:`span`,preferredSize:{width:y,height:y},...e??{}}),this._expanded??=!1,this._character??=b,this.createStyleRule(`.expanded`).set(`transform`,`rotate(90deg)`)}setLineHeight(e){return this._lineHeight===e?this:(this._lineHeight=e,this.setElementCSSRule(`lineHeight`,e+`px`),this)}setHeight(e){return super.setHeight(e),this.setLineHeight(e),this}applyOptions(e){return super.applyOptions(e),e.expanded!==void 0&&this.setExpanded(e.expanded),e.character!==void 0&&this.setCharacter(e.character),this}getCharacter(){return this._character??b}setCharacter(t){this._character=t;let n=this.getElement();return n&&e.sink.apply(n,{text:t}),this}render(){let t=super.render();return e.sink.apply(t,{text:this._character??b}),this._expanded&&e.sink.apply(t,{addClass:[`expanded`]}),t}getExpanded(){return this._expanded}setExpanded(t){this._expanded=t;let n=this.getElement();return n&&e.sink.apply(n,{toggleClass:{expanded:t}}),this}clearExpanded(){return this.setExpanded(!1)}setAnimationTiming(e,t){return this.setTransition(`transform ${e}ms ${t}`),this}},S=a(AccordionIndicator),C=8,w=10,T=4,E=6,D=6,O=2,AccordionHeader=class extends c{_tools=[];_chevronSide=`end`;constructor(e,t){super({tag:`div`,...t}),this._indicator=new S({character:t?.chevronGlyph}),this._title=new v(e,{chromeless:!0,anchor:l.WEST,glyph:t?.glyph}),this._toolGroup=new c,this._toolGroup.setLayoutManager(new f({spacing:T,stretching:!0})),this._toolGroup.setBackgroundColor(`transparent`),this.setLayoutManager(new f({spacing:T,stretching:!0}));let n=new _;n.weight=1,this.addComponent(this._title,n),this.addComponent(this._toolGroup),this._chevronSide=t?.chevronSide??`end`,this.placeIndicator(),this.setExpanded(t?.expanded??!1),this.setCompact(t?.compact??!1)}setCompact(e){let t=e?E:C,n=e?D:w;return this.setInsets(new r(0,n,0,t)),this.getLayoutManager().setComponentSpacing(e?O:T),this._title?.setCompact(e),this.scheduleLayout(),this}placeIndicator(){this.getComponents().includes(this._indicator)&&this.removeComponent(this._indicator),this._chevronSide===`start`?this.insertComponent(this._indicator,0):this.addComponent(this._indicator)}getTitleButton(){return this._title}setExpanded(e){return this._indicator?.setExpanded(e),this._title?.getAria().setExpanded(e),this}isExpanded(){return this._indicator?.getExpanded()??!1}setChevronSide(e){return this._chevronSide===e?this:(this._chevronSide=e,this.placeIndicator(),this.scheduleLayout(),this)}getChevronSide(){return this._chevronSide}setChevronGlyph(e){return this._indicator?.setCharacter(e),this}addTool(e){return e instanceof v&&e.setFlat(!0),this._tools.includes(e)?this:(this._tools.push(e),this._toolGroup.addComponent(e),this.scheduleLayout(),this)}removeTool(e){let t=this._tools.indexOf(e);return t===-1?this:(this._tools.splice(t,1),this._toolGroup.removeComponent(e),this.scheduleLayout(),this)}setToolsRevealed(e){return this._toolGroup.setDisplayed(e),this}setAnimationTiming(e,t){return this._indicator?.setAnimationTiming(e,t),this}},k=a(AccordionHeader),A=`cubic-bezier(0.4, 0, 0.6, 1)`,j=22,M=6,N=1e-6,P=`var(--ts-ui-accordion-header-bg, rgb(243,244,246))`,F=`var(--ts-ui-accordion-header-border, 1px solid rgb(214,217,222))`,I=`var(--ts-ui-accordion-header-color, inherit)`,L=`var(--ts-ui-accordion-border, 1px solid rgb(214,217,222))`,Accordion=class extends s{_headers=[];_panelWrappers=[];_openState=[];_singleOpen=!1;_headerHeight=28;_headerHeightExplicit=!1;_compact=!1;_animationDuration=200;_chevronSide=`end`;_chevronGlyph=null;_spacing=0;_themed=!0;_fillHeight=!1;_tools=[];_toolsVisibility=`hover`;_hoveredHeader=-1;_listeners=new d;_resizable=!1;_resizeSizes=new Map;_pendingSectionSizes=null;_resizeFactor=1;_resizePinned=new Set;_resizeGutters=[];_gutterPairs=[];_dragUpper=null;_dragLower=null;_dragLastPointer=0;_dragOpenIndices=[];_dragGutterUpperPos=0;_toggleAnimations=0;_shrinkAnimations=new Map;_wrapperAnimations=new Map;_boundOnGutterDragEnd=()=>this.onGutterDragEnd();constructor(e){super(),e&&this.applyOptions(e)}applyOptions(e){if(super.applyOptions(e),e.headerHeight!==void 0&&this.setHeaderHeight(e.headerHeight),e.animationDuration!==void 0&&this.setAnimationDuration(e.animationDuration),e.chevronSide!==void 0&&this.setChevronSide(e.chevronSide),e.toolsVisibility!==void 0&&this.setToolsVisibility(e.toolsVisibility),e.compact!==void 0&&this.setCompact(e.compact),e.chevronGlyph!==void 0&&this.setChevronGlyph(e.chevronGlyph),e.spacing!==void 0&&this.setSpacing(e.spacing),e.themed!==void 0&&this.setThemed(e.themed),e.fillHeight!==void 0&&this.setFillHeight(e.fillHeight),e.resizable!==void 0&&this.setResizable(e.resizable),e.sectionSizes!==void 0&&(this._pendingSectionSizes=e.sectionSizes.map(e=>({...e}))),e.listeners!==void 0){let t=e.listeners;for(let e of Object.keys(t)){let n=t[e];n!==void 0&&this.on(e,n)}}e.singleOpen!==void 0&&this.setSingleOpen(e.singleOpen)}isSingleOpen(){return this._singleOpen}setSingleOpen(e){if(this._singleOpen=e,!e)return this;let t=!1;for(let e=0;e<this._openState.length;e++)this._openState[e]&&(t?(this.primeWrapper(e),this._openState[e]=!1,this._headers[e].setExpanded(!1),this.emit(`sectiontoggle`,e,!1)):t=!0);return this.relayoutHost(),this}getHeaderHeight(){return this._headerHeight}setHeaderHeight(e){return this._headerHeight=e,this._headerHeightExplicit=!0,this}effectiveHeaderHeight(){return this._compact&&!this._headerHeightExplicit?j:this._headerHeight}isCompact(){return this._compact}setCompact(e){this._compact=e;for(let t of this._headers)t.setCompact(e);return this.relayoutHost(),this}getAnimationDuration(){return this._animationDuration}setAnimationDuration(e){return this._animationDuration=e,this}getChevronSide(){return this._chevronSide}setChevronSide(e){this._chevronSide=e;for(let t of this._headers)t.setChevronSide(e);return this.getContainer()?.scheduleLayout(),this}getChevronGlyph(){return this._chevronGlyph}setChevronGlyph(e){this._chevronGlyph=e;for(let t of this._headers)t.setChevronGlyph(e);return this.getContainer()?.scheduleLayout(),this}getSpacing(){return this._spacing}setSpacing(e){return this._spacing=e,this.relayoutHost(),this}isFillHeight(){return this._fillHeight}setFillHeight(e){return this._fillHeight=e,this.getContainer()?.scheduleLayout(),this}isResizable(){return this._resizable}setResizable(e){return this._resizable=e,this.getContainer()?.scheduleLayout(),this}isThemed(){return this._themed}setThemed(e){this._themed=e,this.applyContainerTheming();for(let e=0;e<this._headers.length;e++)this.applySectionTheming(e);return this.getContainer()?.scheduleLayout(),this}applyContainerTheming(){let e=this.getContainer();e&&(this._themed?e.setBorder({border:L}):e.clearBorder())}applySectionTheming(e){let t=this._headers[e];if(t){if(!this._themed){t.clearBackground(),t.clearForegroundColor(),t.clearBorder();return}t.setBackground(P),t.setForegroundColor(I),t.setBorder({border:`none`,borderBottom:F})}}getToolsVisibility(){return this._toolsVisibility}setToolsVisibility(e){this._toolsVisibility=e;for(let t of this._headers)t.setToolsRevealed(e===`always`);return this}addTool(e){return this._tools.includes(e)?this:(this._tools.push(e),this._hoveredHeader!==-1&&this._headers[this._hoveredHeader]?.addTool(e),this.getContainer()?.scheduleLayout(),this)}removeTool(e){let t=this._tools.indexOf(e);return t===-1?this:(this._tools.splice(t,1),this._hoveredHeader!==-1&&this._headers[this._hoveredHeader]?.removeTool(e),this.getContainer()?.scheduleLayout(),this)}revealHeaderTools(e){let t=this._headers[e];if(t){for(let e of this._tools)t.addTool(e);this._toolsVisibility===`hover`&&t.setToolsRevealed(!0)}}hideHeaderTools(e){let t=this._headers[e];if(t){for(let e of this._tools)t.removeTool(e);this._toolsVisibility===`hover`&&t.setToolsRevealed(!1)}}onHeaderHoverEnter(t,n){let r=this._headers[t]?.getElement();r&&e.source.isNode(n.relatedTarget)&&e.source.contains(r,e.source.intern(n.relatedTarget))||this._hoveredHeader!==t&&(this._hoveredHeader!==-1&&this.hideHeaderTools(this._hoveredHeader),this._hoveredHeader=t,this.revealHeaderTools(t))}onHeaderHoverLeave(t,n){let r=this._headers[t]?.getElement();r&&e.source.isNode(n.relatedTarget)&&e.source.contains(r,e.source.intern(n.relatedTarget))||this._hoveredHeader===t&&(this.hideHeaderTools(t),this._hoveredHeader=-1)}relayoutHost(){let e=this.getContainer();e?.scheduleLayout(),e?.notifyIntrinsicSizeChanged()}openSection(e){if(e<0||e>=this._openState.length)return this;if(this._singleOpen)for(let t=0;t<this._openState.length;t++)t!==e&&this._openState[t]&&(this.primeWrapper(t),this._openState[t]=!1,this._headers[t].setExpanded(!1),this.emit(`sectiontoggle`,t,!1));return this.primeWrapper(e),this._openState[e]=!0,this._headers[e].setExpanded(!0),this.emit(`sectiontoggle`,e,!0),this.relayoutHost(),this}closeSection(e){return e<0||e>=this._openState.length?this:(this.primeWrapper(e),this._openState[e]=!1,this._headers[e].setExpanded(!1),this.emit(`sectiontoggle`,e,!1),this.relayoutHost(),this)}expandAll(){if(this._singleOpen)return this.openSection(0),this;for(let e=0;e<this._openState.length;e++)this.openSection(e);return this}collapseAll(){for(let e=0;e<this._openState.length;e++)this.closeSection(e);return this}isSectionOpen(e){return this._openState[e]??!1}sectionSizeUnits(e){return e.map(e=>this.effectiveWeight(e)===0?`px`:`ratio`)}getSectionSizes(){let e=this.getContainer();if(!e)return[];let t=e.getComponents();if(t.length===0)return[];let n=this.sectionSizeUnits(t);return this._pendingSectionSizes!==null&&m(this._pendingSectionSizes,n)?this._pendingSectionSizes.map(e=>({...e})):p(n,t.map(e=>this._resizeSizes.get(e)??0))}applySectionSizes(e){return this._pendingSectionSizes=e.map(e=>({...e})),this.getContainer()?.scheduleLayout(),this}on(e,t){return this._listeners.add(e,t),this}off(e,t){return this._listeners.remove(e,t),this}emit(e,...t){this._listeners.fire(e,...t)}attach(e){return super.attach(e),this}detach(){let t=this.getContainer();for(let e of this._shrinkAnimations.values())e.cancel();this._shrinkAnimations.clear();for(let e of this._wrapperAnimations.values())e.cancel();this._wrapperAnimations.clear(),this._toggleAnimations>0&&(this._toggleAnimations=0,this.setSectionTransitions(!1),t?.setTransition(null)),this._dragUpper&&this.onGutterDragEnd();for(let n=0;n<this._headers.length;n++){let r=(t?t.getComponents():[])[n];r&&t&&e.sink.appendChild(t.getElement(),r.getElement()),e.sink.removeElement(this._headers[n].getElement()),e.sink.removeElement(this._panelWrappers[n].getElement())}this._headers=[],this._panelWrappers=[],this._openState=[];for(let t of this._resizeGutters)e.sink.removeElement(t.getElement()),t.destroy();return this._resizeGutters=[],this._resizeSizes.clear(),this._gutterPairs=[],super.detach(),this}getPreferredSize(){let e=this.getContainer();if(!e)return null;let t=e.getPerimeterSize(),n=e.getComponents(),r=t.top+t.bottom,i=0,a=0;for(let e=0;e<n.length;e++)if(n[e].isDisplayed()&&(a>0&&(r+=this._spacing),a+=1,r+=this.effectiveHeaderHeight(),e<this._openState.length?this._openState[e]:this.getLayoutConstraints(n[e])?.initiallyOpen??!1)){let t=n[e].getPreferredSize();t&&(r+=t.height,t.width>i&&(i=t.width))}return{width:i+t.left+t.right,height:r}}getMinSize(){let e=this.getContainer();if(!e)return null;let t=e.getPerimeterSize(),n=e.getComponents(),r=t.top+t.bottom,i=0,a=0;for(let e=0;e<n.length;e++)if(n[e].isDisplayed()&&(a>0&&(r+=this._spacing),a+=1,r+=this.effectiveHeaderHeight(),e<this._openState.length?this._openState[e]:this.getLayoutConstraints(n[e])?.initiallyOpen??!1)){let t=n[e].getMinSize();t&&(r+=t.height,t.width>i&&(i=t.width))}return{width:i+t.left+t.right,height:r}}getMaxSize(){return{width:t,height:t}}createSection(t,n){let r=this.getContainer(),i=this.getLayoutConstraints(t),a=i?.label??t.getId(),o=i?.initiallyOpen??!1,s=new k(a,{chevronSide:this._chevronSide,glyph:i?.glyph??void 0,compact:this._compact,chevronGlyph:this._chevronGlyph??void 0});s.setAnimationTiming(this._animationDuration,A),s.setTransition(`none`);let l=s.getTitleButton();l.on(`action`,()=>this.onHeaderClicked(n)),u.addListener(s,`click`,()=>this.onHeaderClicked(n)),u.addListener(l,`keydown`,e=>this.onHeaderKeyDown(e,n)),u.addSubtreeListener(s,`mouseover`,e=>this.onHeaderHoverEnter(n,e)),u.addSubtreeListener(s,`mouseout`,e=>this.onHeaderHoverLeave(n,e));let d=new c;d.setOverflow(`hidden`),d.setContain(`layout paint`),d.setTransition(`none`),e.sink.appendChild(r.getElement(),s.getElement(!0)),e.sink.appendChild(r.getElement(),d.getElement(!0)),e.sink.appendChild(d.getElement(),t.getElement()),t.setTransition(`none`),this._openState.push(o),this._headers.push(s),this._panelWrappers.push(d),s.setExpanded(o),l.getAria().setControls(d.getId()),d.getAria().setRole(`region`),d.getAria().setLabelledBy(l.getId());for(let e of i?.tools??[])s.addTool(e);this._toolsVisibility===`hover`&&s.setToolsRevealed(!1),this.applySectionTheming(n)}computeTotalMinSize(){let e=this.getContainer();if(!e)return{width:0,height:0};let t=0;for(let n of e.getComponents()){if(!n.isDisplayed())continue;let e=n.getMinSize();e&&(t=Math.max(t,e.width))}return{width:t,height:0}}placeSection(e,t,n,r,i,a,o){let s=this._headers[e],c=this._panelWrappers[e],l=this.effectiveHeaderHeight();s.setX(o),s.setY(n),s.setWidth(a),s.setHeight(l),s.doLayout();let u=n+l;return c.setX(o),c.setY(u),c.setWidth(a),c.setHeight(r),t.setX(0),t.setY(0),t.setWidth(a),t.setHeight(i),u+r}doLayout(){let e=this.getContainer();if(!e)return;let t=e.getComponents();for(let e=this._headers.length;e<t.length;e++)this.createSection(t[e],e);this.applyContainerTheming();let n=e.getInnerSize(),r=e.getContentInsets(),i=n?n.width:0;if(this.isOverflowingX()){let e=this.computeTotalMinSize();i=Math.max(i,e.width)}let a=this.computeShrinkRatio(t,n),o=this.computeFill(t,n,a),s=this.computeResizableHeights(t,n,a,o);this.layoutSections(t,i,r.getLeft(),r.getTop(),s!==null,(e,n)=>{if(n)return s?.get(e)??this.openContentHeight(t[e],a)+(o.get(e)??0);let r=t[e].getPreferredSize();return r?r.height:100},!0,!0)}layoutSections(e,t,n,r,i,a,s,c){let l=r,u=0,d=null,f=0,p=0;for(let r=0;r<e.length;r++){let m=e[r],h=this._headers[r],g=this._panelWrappers[r],_=this._openState[r];if(!m.isDisplayed()){h.setDisplayed(!1),g.setDisplayed(!1);continue}h.setDisplayed(!0),g.setDisplayed(!0),u>0&&(l+=this._spacing),u+=1;let v=a(r,_),y=_?v:0;_&&i&&d!==null&&(this.placeGutter(p,f,t,n),this._gutterPairs[p]={upper:d,lower:m},p+=1);let b=m.getHeight(),x=_&&s&&!o.isReducedMotion()&&v<b,S=this.placeSection(r,m,l,y,v,t,n);(c||v!==b)&&(x?(this._shrinkAnimations.get(r)?.cancel(),this._shrinkAnimations.set(r,o.afterTransition({component:g,property:`height`,durationMs:this._animationDuration,fallbackBufferMs:40,onComplete:()=>{this._shrinkAnimations.delete(r),m.doLayout()}}))):m.doLayout()),_&&i&&(d=m,f=S),l=S}this._gutterPairs.length=p;for(let e=p;e<this._resizeGutters.length;e++)this._resizeGutters[e].setVisible(!1)}getOrCreateResizeGutter(t){let n=this._resizeGutters[t];if(n)return n;let r=this.getContainer(),i=new g(`vertical`,{collapsible:!1,expandedBackground:`transparent`});return i.setTransition(`none`),i.on(`dragstart`,e=>this.onGutterDragStart(t,e)),i.on(`drag`,e=>this.onGutterDrag(t,e)),e.sink.appendChild(r.getElement(),i.getElement(!0)),this._resizeGutters.push(i),i}placeGutter(e,t,n,r){let i=this.getOrCreateResizeGutter(e);i.setX(r),i.setY(t-M),i.setWidth(n),i.setHeight(M),i.setVisible(!0)}onGutterDragStart(e,t){let n=this._gutterPairs[e];if(!n)return;let r=this.getContainer()?.getComponents()??[];this._dragOpenIndices=[];for(let e=0;e<r.length;e++)r[e].isDisplayed()&&this._openState[e]&&this._dragOpenIndices.push(e);if(this._dragGutterUpperPos=this._dragOpenIndices.indexOf(r.indexOf(n.upper)),this._dragGutterUpperPos===-1)return;this._dragUpper=n.upper,this._dragLower=n.lower,this._dragLastPointer=t;let i=this.getContainer();i&&(u.addViewportListener(i,`mouseup`,this._boundOnGutterDragEnd),u.addViewportListener(i,`touchend`,this._boundOnGutterDragEnd),u.addViewportListener(i,`touchcancel`,this._boundOnGutterDragEnd))}onGutterDrag(e,t){let n=this._gutterPairs[e],r=this.getContainer();if(!n||n.upper!==this._dragUpper||n.lower!==this._dragLower||!r)return;let i=r.getComponents(),a=this._dragOpenIndices,o=this._dragGutterUpperPos,s=t-this._dragLastPointer,c=a.map(e=>i[e].getHeight()),l=a.map(e=>{let t=i[e].getMinSize();return t?t.height:0}),u=a.map(e=>{let t=i[e].getMaxSize();return t?t.height:1/0}),d=[],f=[];for(let e=o;e>=0;e--)d.push(e);for(let e=o+1;e<a.length;e++)f.push(e);let p=s>=0?d:f,m=s>=0?f:d,h=0,g=0;for(let e of p)h+=Math.max(0,u[e]-c[e]);for(let e of m)g+=Math.max(0,c[e]-l[e]);let _=Math.max(0,Math.min(Math.abs(s),h,g));this._dragLastPointer+=Math.sign(s)*_;let v=c.slice();this.distributeDragChain(p,c,_,1,l,u,v),this.distributeDragChain(m,c,_,-1,l,u,v);let y=new Map;for(let e=0;e<a.length;e++){let t=i[a[e]],n=this._resizePinned.has(t)?1:this._resizeFactor;y.set(a[e],v[e]),this._resizeSizes.set(t,v[e]/n)}let b=r.getContentInsets(),x=this._panelWrappers[a[0]].getWidth();this.layoutSections(i,x,b.getLeft(),b.getTop(),!0,(e,t)=>t?y.get(e)??i[e].getHeight():i[e].getHeight(),!1,!1)}distributeDragChain(e,t,n,r,i,a,o){let room=e=>r>0?Math.max(0,a[e]-t[e]):Math.max(0,t[e]-i[e]),s=n;for(let t of e){if(s<=N)return;let e=Math.min(s,room(t));o[t]+=r*e,s-=e}}onGutterDragEnd(){let e=this._dragUpper!==null,t=this.getContainer();return t&&(u.removeViewportListener(t,`mouseup`,this._boundOnGutterDragEnd),u.removeViewportListener(t,`touchend`,this._boundOnGutterDragEnd),u.removeViewportListener(t,`touchcancel`,this._boundOnGutterDragEnd)),this._dragUpper=null,this._dragLower=null,e&&this.emit(`sectionresize`,this.getSectionSizes()),!0}computeShrinkRatio(e,t){if(!t)return 0;let n=0,r=0,i=0,a=0;for(let t=0;t<e.length;t++){if(!e[t].isDisplayed()||(a>0&&(n+=this._spacing),a+=1,n+=this.effectiveHeaderHeight(),!this._openState[t]))continue;let o=e[t].getPreferredSize(),s=e[t].getMinSize();r+=o?o.height:100,i+=s?s.height:0}let o=n+r,s=n+i,c=t.height;if(o<=c||s>c)return 0;let l=o-s;return l>0?(o-c)/l:0}openContentHeight(e,t){let n=e.getPreferredSize(),r=n?n.height:100,i=e.getMinSize(),a=i?i.height:0,o=r-t*(r-a),s=e.getMaxSize(),c=s?Math.min(o,s.height):o;return Math.max(c,a)}computeFill(e,t,n){let r=new Map;if(!t)return r;let i=0,a=0,o=[],s=0;for(let t=0;t<e.length;t++)if(e[t].isDisplayed()&&(a>0&&(i+=this._spacing),a+=1,i+=this.effectiveHeaderHeight(),this._openState[t])){let r=this.openContentHeight(e[t],n);i+=r;let a=this.effectiveWeight(e[t]);a>0&&(o.push({index:t,weight:a,headroom:this.fillHeadroom(e[t],r)}),s+=a)}let c=t.height-i;return c<=0||s<=0?r:this.distributeFillWithinMax(o,c)}effectiveWeight(e){let t=this.getLayoutConstraints(e)?.weight??0;return t>0?t:+!!this._fillHeight}resizePinnedSections(e,t,n){let r=[],i=0,a=0;for(let n of t)this.effectiveWeight(e[n])>0?i+=1:(r.push(n),a+=this.clampSectionHeight(e[n],this._resizeSizes.get(e[n])??0));return i===0||a>n?[]:r}clampSectionHeight(e,t){let r=e.getMinSize(),i=e.getMaxSize();return n.clamp(t,r?r.height:0,i?i.height:1/0)}fillHeadroom(e,t){let n=e.getMaxSize();return n?Math.max(0,n.height-t):1/0}distributeFillWithinMax(e,t){let n=new Map,r=new Set(e),i=t;for(;;){let e=0;for(let t of r)e+=t.weight;if(e<=0)break;let t=i/e,a=!1;for(let e of r)if(e.weight*t>e.headroom){n.set(e.index,e.headroom),i-=e.headroom,r.delete(e),a=!0;break}if(!a){for(let e of r)n.set(e.index,e.weight*t);break}if(r.size===0)break}return n}computeResizableHeights(e,t,n,r){if(!this._resizable||!t)return null;for(let t of[...this._resizeSizes.keys()])e.includes(t)||this._resizeSizes.delete(t);let i=0,a=0,o=[];for(let t=0;t<e.length;t++)e[t].isDisplayed()&&(a>0&&(i+=this._spacing),a+=1,i+=this.effectiveHeaderHeight(),this._openState[t]&&o.push(t));if(o.length===0)return null;let s=t.height-i;this.applyPendingSectionSizes(e,s);for(let t of o){let i=e[t];this._resizeSizes.has(i)||this._resizeSizes.set(i,this.openContentHeight(i,n)+(r.get(t)??0))}return this.distributeWithinConstraints(e,o,s)}applyPendingSectionSizes(e,t){let n=this._pendingSectionSizes;if(n===null||(this._pendingSectionSizes=null,!m(n,this.sectionSizeUnits(e))))return;let r=h(n,t);for(let t=0;t<e.length;t+=1)r[t]>0?this._resizeSizes.set(e[t],r[t]):this._resizeSizes.delete(e[t])}distributeWithinConstraints(e,t,n){let r=new Map,i=new Set(t),a=n,o=1;this._resizePinned.clear();for(let o of this.resizePinnedSections(e,t,n)){let t=this.clampSectionHeight(e[o],this._resizeSizes.get(e[o])??0);r.set(o,t),a-=t,i.delete(o),this._resizePinned.add(e[o])}for(;;){let t=0;for(let n of i)t+=this._resizeSizes.get(e[n])??0;o=t>0?a/t:0;let n=!1;for(let t of i){let s=e[t],c=(this._resizeSizes.get(s)??0)*o,l=s.getMinSize(),u=s.getMaxSize(),d=l?l.height:0,f=u?u.height:1/0;if(c<d){r.set(t,d),a-=d,i.delete(t),n=!0;break}if(c>f){r.set(t,f),a-=f,i.delete(t),n=!0;break}}if(!n){for(let t of i)r.set(t,(this._resizeSizes.get(e[t])??0)*o);break}if(i.size===0)break}return this._resizeFactor=o>0?o:1,r}onHeaderKeyDown(e,t){let n=this._headers.length;if(n===0)return;let r;switch(e.key){case`ArrowDown`:r=(t+1)%n;break;case`ArrowUp`:r=(t-1+n)%n;break;case`Home`:r=0;break;case`End`:r=n-1;break;default:return}e.preventDefault(),this._headers[r].getTitleButton().focus()}onHeaderClicked(e){let t=this._openState[e];if(this._singleOpen&&!t)for(let t=0;t<this._openState.length;t++)t!==e&&this._openState[t]&&(this.primeWrapper(t),this._openState[t]=!1,this._headers[t].setExpanded(!1),this.emit(`sectiontoggle`,t,!1));let n=!t;this.primeWrapper(e),this._openState[e]=n,this._headers[e].setExpanded(n),this.emit(`sectiontoggle`,e,n),this.relayoutHost()}primeWrapper(t){if(o.isReducedMotion())return;let n=this._panelWrappers[t],r=this.getContainer();this.setSectionTransitions(!0),r?.setTransition(`height ${this._animationDuration}ms ${A}`),n.setWillChange(`height`);let i=r?.getElement();i&&e.source.getElementRect(i);let a=this._wrapperAnimations.get(t);a?(a.cancel(),this._wrapperAnimations.delete(t)):this._toggleAnimations+=1,this._wrapperAnimations.set(t,o.afterTransition({component:n,property:`height`,durationMs:this._animationDuration,fallbackBufferMs:40,onComplete:()=>{this._wrapperAnimations.delete(t),n.setWillChange(null),--this._toggleAnimations,this._toggleAnimations<=0&&(this._toggleAnimations=0,this.setSectionTransitions(!1),r?.setTransition(null),this.relayoutHost())}}))}setSectionTransitions(e){let t=this.getContainer()?.getComponents()??[];for(let n=0;n<this._headers.length;n++)this._headers[n].setTransition(e?this.buildHeaderTransition():`none`),this._panelWrappers[n].setTransition(e?this.buildWrapperTransition():`none`),t[n]?.setTransition(e?this.buildContentTransition():`none`);for(let t of this._resizeGutters)t.setTransition(e?this.buildHeaderTransition():`none`)}buildHeaderTransition(){return`top ${this._animationDuration}ms ${A}`}buildWrapperTransition(){return`height ${this._animationDuration}ms ${A}, top ${this._animationDuration}ms ${A}`}buildContentTransition(){return`height ${this._animationDuration}ms ${A}`}},R=a(Accordion),AccordionConstraints=class extends _{label;initiallyOpen;tools;constructor(e,t,n,r){super(),this.label=e,this.initiallyOpen=t,this.glyph=n??null,this.tools=r}},GridConstraints=class extends _{col;row;rowSpan;colSpan;constructor(){super()}};export{S as a,k as i,AccordionConstraints as n,R as r,GridConstraints as t};
2
- //# sourceMappingURL=GridConstraints-DkLueyrf.js.map
1
+ import{t as e}from"./DOM-BeR95tE8.js";import{a as t,l as n,n as r}from"./Position-DRSlWn4Z.js";import{_ as i,d as a,f as o,m as s,t as c,x as l,y as u}from"./Component-CHTzJxEf.js";import{t as d}from"./ListenerBag-WPdKuuds.js";import{t as f}from"./HBox-Dm3xgsDE.js";import{i as p,n as m,t as h}from"./LayoutSizes-CvMmMgHJ.js";import{n as g}from"./Border-Dq6dXkmS.js";import{t as _}from"./LayoutConstraints-DkctJZXB.js";import{t as v}from"./Button-B36rBMKC.js";var y=14,b=`▶`,x=null;function ensureAccordionIndicatorClassRule(){x||=new u({scope:`class`,name:`AccordionIndicator`,styles:{textAlign:`center`,pointerEvents:`none`,fontSize:`10px`,color:`var(--ts-ui-accordion-indicator-color, rgb(100,100,100))`,transition:`transform 200ms ease`}})}var AccordionIndicator=class extends c{_lineHeight=null;constructor(e){ensureAccordionIndicatorClassRule(),super({tag:`span`,preferredSize:{width:y,height:y},...e??{}}),this._expanded??=!1,this._character??=b,this.createStyleRule(`.expanded`).set(`transform`,`rotate(90deg)`)}setLineHeight(e){return this._lineHeight===e?this:(this._lineHeight=e,this.setElementCSSRule(`lineHeight`,e+`px`),this)}setHeight(e){return super.setHeight(e),this.setLineHeight(e),this}applyOptions(e){return super.applyOptions(e),e.expanded!==void 0&&this.setExpanded(e.expanded),e.character!==void 0&&this.setCharacter(e.character),this}getCharacter(){return this._character??b}setCharacter(t){this._character=t;let n=this.getElement();return n&&e.sink.apply(n,{text:t}),this}render(){let t=super.render();return e.sink.apply(t,{text:this._character??b}),this._expanded&&e.sink.apply(t,{addClass:[`expanded`]}),t}getExpanded(){return this._expanded}setExpanded(t){this._expanded=t;let n=this.getElement();return n&&e.sink.apply(n,{toggleClass:{expanded:t}}),this}clearExpanded(){return this.setExpanded(!1)}setAnimationTiming(e,t){return this.setTransition(`transform ${e}ms ${t}`),this}},S=s(AccordionIndicator),C=8,w=10,T=4,E=6,D=6,O=2,AccordionHeader=class extends c{_tools=[];_chevronSide=`end`;constructor(e,t){super({tag:`div`,...t}),this._indicator=new S({character:t?.chevronGlyph}),this._title=new v(e,{chromeless:!0,anchor:o.WEST,glyph:t?.glyph}),this._toolGroup=new c,this._toolGroup.setLayoutManager(new f({spacing:T,stretching:!0})),this._toolGroup.setBackgroundColor(`transparent`),this.setLayoutManager(new f({spacing:T,stretching:!0}));let n=new _;n.weight=1,this.addComponent(this._title,n),this.addComponent(this._toolGroup),this._chevronSide=t?.chevronSide??`end`,this.placeIndicator(),this.setExpanded(t?.expanded??!1),this.setCompact(t?.compact??!1)}setCompact(e){let t=e?E:C,n=e?D:w;return this.setInsets(new r(0,n,0,t)),this.getLayoutManager().setComponentSpacing(e?O:T),this._title?.setCompact(e),this.scheduleLayout(),this}placeIndicator(){this.getComponents().includes(this._indicator)&&this.removeComponent(this._indicator),this._chevronSide===`start`?this.insertComponent(this._indicator,0):this.addComponent(this._indicator)}getTitleButton(){return this._title}setExpanded(e){return this._indicator?.setExpanded(e),this._title?.getAria().setExpanded(e),this}isExpanded(){return this._indicator?.getExpanded()??!1}setChevronSide(e){return this._chevronSide===e?this:(this._chevronSide=e,this.placeIndicator(),this.scheduleLayout(),this)}getChevronSide(){return this._chevronSide}setChevronGlyph(e){return this._indicator?.setCharacter(e),this}addTool(e){return e instanceof v&&e.setFlat(!0),this._tools.includes(e)?this:(this._tools.push(e),this._toolGroup.addComponent(e),this.scheduleLayout(),this)}removeTool(e){let t=this._tools.indexOf(e);return t===-1?this:(this._tools.splice(t,1),this._toolGroup.removeComponent(e),this.scheduleLayout(),this)}setToolsRevealed(e){return this._toolGroup.setDisplayed(e),this}setAnimationTiming(e,t){return this._indicator?.setAnimationTiming(e,t),this}},k=s(AccordionHeader),A=`cubic-bezier(0.4, 0, 0.6, 1)`,j=22,M=6,N=1e-6,P=`var(--ts-ui-accordion-header-bg, rgb(243,244,246))`,F=`var(--ts-ui-accordion-header-border, 1px solid rgb(214,217,222))`,I=`var(--ts-ui-accordion-header-color, inherit)`,L=`var(--ts-ui-accordion-border, 1px solid rgb(214,217,222))`,Accordion=class extends a{_headers=[];_panelWrappers=[];_openState=[];_singleOpen=!1;_headerHeight=28;_headerHeightExplicit=!1;_compact=!1;_animationDuration=200;_chevronSide=`end`;_chevronGlyph=null;_spacing=0;_themed=!0;_fillHeight=!1;_tools=[];_toolsVisibility=`hover`;_hoveredHeader=-1;_listeners=new d;_resizable=!1;_resizeSizes=new Map;_pendingSectionSizes=null;_resizeFactor=1;_resizePinned=new Set;_resizeGutters=[];_gutterPairs=[];_dragUpper=null;_dragLower=null;_dragLastPointer=0;_dragOpenIndices=[];_dragGutterUpperPos=0;_toggleAnimations=0;_shrinkAnimations=new Map;_wrapperAnimations=new Map;_boundOnGutterDragEnd=()=>this.onGutterDragEnd();constructor(e){super(),e&&this.applyOptions(e)}applyOptions(e){if(super.applyOptions(e),e.headerHeight!==void 0&&this.setHeaderHeight(e.headerHeight),e.animationDuration!==void 0&&this.setAnimationDuration(e.animationDuration),e.chevronSide!==void 0&&this.setChevronSide(e.chevronSide),e.toolsVisibility!==void 0&&this.setToolsVisibility(e.toolsVisibility),e.compact!==void 0&&this.setCompact(e.compact),e.chevronGlyph!==void 0&&this.setChevronGlyph(e.chevronGlyph),e.spacing!==void 0&&this.setSpacing(e.spacing),e.themed!==void 0&&this.setThemed(e.themed),e.fillHeight!==void 0&&this.setFillHeight(e.fillHeight),e.resizable!==void 0&&this.setResizable(e.resizable),e.sectionSizes!==void 0&&(this._pendingSectionSizes=e.sectionSizes.map(e=>({...e}))),e.listeners!==void 0){let t=e.listeners;for(let e of Object.keys(t)){let n=t[e];n!==void 0&&this.on(e,n)}}e.singleOpen!==void 0&&this.setSingleOpen(e.singleOpen)}isSingleOpen(){return this._singleOpen}setSingleOpen(e){if(this._singleOpen=e,!e)return this;let t=!1;for(let e=0;e<this._openState.length;e++)this._openState[e]&&(t?(this.primeWrapper(e),this._openState[e]=!1,this._headers[e].setExpanded(!1),this.emit(`sectiontoggle`,e,!1)):t=!0);return this.relayoutHost(),this}getHeaderHeight(){return this._headerHeight}setHeaderHeight(e){return this._headerHeight=e,this._headerHeightExplicit=!0,this}effectiveHeaderHeight(){return this._compact&&!this._headerHeightExplicit?j:this._headerHeight}isCompact(){return this._compact}setCompact(e){this._compact=e;for(let t of this._headers)t.setCompact(e);return this.relayoutHost(),this}getAnimationDuration(){return this._animationDuration}setAnimationDuration(e){return this._animationDuration=e,this}getChevronSide(){return this._chevronSide}setChevronSide(e){this._chevronSide=e;for(let t of this._headers)t.setChevronSide(e);return this.getContainer()?.scheduleLayout(),this}getChevronGlyph(){return this._chevronGlyph}setChevronGlyph(e){this._chevronGlyph=e;for(let t of this._headers)t.setChevronGlyph(e);return this.getContainer()?.scheduleLayout(),this}getSpacing(){return this._spacing}setSpacing(e){return this._spacing=e,this.relayoutHost(),this}isFillHeight(){return this._fillHeight}setFillHeight(e){return this._fillHeight=e,this.getContainer()?.scheduleLayout(),this}isResizable(){return this._resizable}setResizable(e){return this._resizable=e,this.getContainer()?.scheduleLayout(),this}isThemed(){return this._themed}setThemed(e){this._themed=e,this.applyContainerTheming();for(let e=0;e<this._headers.length;e++)this.applySectionTheming(e);return this.getContainer()?.scheduleLayout(),this}applyContainerTheming(){let e=this.getContainer();e&&(this._themed?e.setBorder({border:L}):e.clearBorder())}applySectionTheming(e){let t=this._headers[e];if(t){if(!this._themed){t.clearBackground(),t.clearForegroundColor(),t.clearBorder();return}t.setBackground(P),t.setForegroundColor(I),t.setBorder({border:`none`,borderBottom:F})}}getToolsVisibility(){return this._toolsVisibility}setToolsVisibility(e){this._toolsVisibility=e;for(let t of this._headers)t.setToolsRevealed(e===`always`);return this}addTool(e){return this._tools.includes(e)?this:(this._tools.push(e),this._hoveredHeader!==-1&&this._headers[this._hoveredHeader]?.addTool(e),this.getContainer()?.scheduleLayout(),this)}removeTool(e){let t=this._tools.indexOf(e);return t===-1?this:(this._tools.splice(t,1),this._hoveredHeader!==-1&&this._headers[this._hoveredHeader]?.removeTool(e),this.getContainer()?.scheduleLayout(),this)}revealHeaderTools(e){let t=this._headers[e];if(t){for(let e of this._tools)t.addTool(e);this._toolsVisibility===`hover`&&t.setToolsRevealed(!0)}}hideHeaderTools(e){let t=this._headers[e];if(t){for(let e of this._tools)t.removeTool(e);this._toolsVisibility===`hover`&&t.setToolsRevealed(!1)}}onHeaderHoverEnter(t,n){let r=this._headers[t]?.getElement();r&&e.source.isNode(n.relatedTarget)&&e.source.contains(r,e.source.intern(n.relatedTarget))||this._hoveredHeader!==t&&(this._hoveredHeader!==-1&&this.hideHeaderTools(this._hoveredHeader),this._hoveredHeader=t,this.revealHeaderTools(t))}onHeaderHoverLeave(t,n){let r=this._headers[t]?.getElement();r&&e.source.isNode(n.relatedTarget)&&e.source.contains(r,e.source.intern(n.relatedTarget))||this._hoveredHeader===t&&(this.hideHeaderTools(t),this._hoveredHeader=-1)}relayoutHost(){let e=this.getContainer();e?.scheduleLayout(),e?.notifyIntrinsicSizeChanged()}openSection(e){if(e<0||e>=this._openState.length)return this;if(this._singleOpen)for(let t=0;t<this._openState.length;t++)t!==e&&this._openState[t]&&(this.primeWrapper(t),this._openState[t]=!1,this._headers[t].setExpanded(!1),this.emit(`sectiontoggle`,t,!1));return this.primeWrapper(e),this._openState[e]=!0,this._headers[e].setExpanded(!0),this.emit(`sectiontoggle`,e,!0),this.relayoutHost(),this}closeSection(e){return e<0||e>=this._openState.length?this:(this.primeWrapper(e),this._openState[e]=!1,this._headers[e].setExpanded(!1),this.emit(`sectiontoggle`,e,!1),this.relayoutHost(),this)}expandAll(){if(this._singleOpen)return this.openSection(0),this;for(let e=0;e<this._openState.length;e++)this.openSection(e);return this}collapseAll(){for(let e=0;e<this._openState.length;e++)this.closeSection(e);return this}isSectionOpen(e){return this._openState[e]??!1}sectionSizeUnits(e){return e.map(e=>this.effectiveWeight(e)===0?`px`:`ratio`)}getSectionSizes(){let e=this.getContainer();if(!e)return[];let t=e.getComponents();if(t.length===0)return[];let n=this.sectionSizeUnits(t);return this._pendingSectionSizes!==null&&m(this._pendingSectionSizes,n)?this._pendingSectionSizes.map(e=>({...e})):p(n,t.map(e=>this._resizeSizes.get(e)??0))}applySectionSizes(e){return this._pendingSectionSizes=e.map(e=>({...e})),this.getContainer()?.scheduleLayout(),this}on(e,t){return this._listeners.add(e,t),this}off(e,t){return this._listeners.remove(e,t),this}emit(e,...t){this._listeners.fire(e,...t)}attach(e){return super.attach(e),this}detach(){let t=this.getContainer();for(let e of this._shrinkAnimations.values())e.cancel();this._shrinkAnimations.clear();for(let e of this._wrapperAnimations.values())e.cancel();this._wrapperAnimations.clear(),this._toggleAnimations>0&&(this._toggleAnimations=0,this.setSectionTransitions(!1),t?.setTransition(null)),this._dragUpper&&this.onGutterDragEnd();for(let n=0;n<this._headers.length;n++){let r=(t?t.getComponents():[])[n];r&&t&&e.sink.appendChild(t.getElement(),r.getElement()),e.sink.removeElement(this._headers[n].getElement()),e.sink.removeElement(this._panelWrappers[n].getElement())}this._headers=[],this._panelWrappers=[],this._openState=[];for(let t of this._resizeGutters)e.sink.removeElement(t.getElement()),t.destroy();return this._resizeGutters=[],this._resizeSizes.clear(),this._gutterPairs=[],super.detach(),this}getPreferredSize(){let e=this.getContainer();if(!e)return null;let t=e.getPerimeterSize(),n=e.getComponents(),r=t.top+t.bottom,i=0,a=0;for(let e=0;e<n.length;e++)if(n[e].isDisplayed()&&(a>0&&(r+=this._spacing),a+=1,r+=this.effectiveHeaderHeight(),e<this._openState.length?this._openState[e]:this.getLayoutConstraints(n[e])?.initiallyOpen??!1)){let t=n[e].getPreferredSize();t&&(r+=t.height,t.width>i&&(i=t.width))}return{width:i+t.left+t.right,height:r}}getMinSize(){let e=this.getContainer();if(!e)return null;let t=e.getPerimeterSize(),n=e.getComponents(),r=t.top+t.bottom,i=0,a=0;for(let e=0;e<n.length;e++)if(n[e].isDisplayed()&&(a>0&&(r+=this._spacing),a+=1,r+=this.effectiveHeaderHeight(),e<this._openState.length?this._openState[e]:this.getLayoutConstraints(n[e])?.initiallyOpen??!1)){let t=n[e].getMinSize();t&&(r+=t.height,t.width>i&&(i=t.width))}return{width:i+t.left+t.right,height:r}}getMaxSize(){return{width:t,height:t}}createSection(t,n){let r=this.getContainer(),i=this.getLayoutConstraints(t),a=i?.label??t.getId(),o=i?.initiallyOpen??!1,s=new k(a,{chevronSide:this._chevronSide,glyph:i?.glyph??void 0,compact:this._compact,chevronGlyph:this._chevronGlyph??void 0});s.setAnimationTiming(this._animationDuration,A),s.setTransition(`none`);let u=s.getTitleButton();u.on(`action`,()=>this.onHeaderClicked(n)),l.addListener(s,`click`,()=>this.onHeaderClicked(n)),l.addListener(u,`keydown`,e=>this.onHeaderKeyDown(e,n)),l.addSubtreeListener(s,`mouseover`,e=>this.onHeaderHoverEnter(n,e)),l.addSubtreeListener(s,`mouseout`,e=>this.onHeaderHoverLeave(n,e));let d=new c;d.setOverflow(`hidden`),d.setContain(`layout paint`),d.setTransition(`none`),e.sink.appendChild(r.getElement(),s.getElement(!0)),e.sink.appendChild(r.getElement(),d.getElement(!0)),e.sink.appendChild(d.getElement(),t.getElement()),t.setTransition(`none`),this._openState.push(o),this._headers.push(s),this._panelWrappers.push(d),s.setExpanded(o),u.getAria().setControls(d.getId()),d.getAria().setRole(`region`),d.getAria().setLabelledBy(u.getId());for(let e of i?.tools??[])s.addTool(e);this._toolsVisibility===`hover`&&s.setToolsRevealed(!1),this.applySectionTheming(n)}computeTotalMinSize(){let e=this.getContainer();if(!e)return{width:0,height:0};let t=0;for(let n of e.getComponents()){if(!n.isDisplayed())continue;let e=n.getMinSize();e&&(t=Math.max(t,e.width))}return{width:t,height:0}}placeSection(e,t,n,r,i,a,o){let s=this._headers[e],c=this._panelWrappers[e],l=this.effectiveHeaderHeight();s.setX(o),s.setY(n),s.setWidth(a),s.setHeight(l),s.doLayout();let u=n+l;return c.setX(o),c.setY(u),c.setWidth(a),c.setHeight(r),t.setX(0),t.setY(0),t.setWidth(a),t.setHeight(i),u+r}doLayout(){let e=this.getContainer();if(!e)return;let t=e.getComponents();for(let e=this._headers.length;e<t.length;e++)this.createSection(t[e],e);this.applyContainerTheming();let n=e.getInnerSize(),r=e.getContentInsets(),i=n?n.width:0;if(this.isOverflowingX()){let e=this.computeTotalMinSize();i=Math.max(i,e.width)}let a=this.computeShrinkRatio(t,n),o=this.computeFill(t,n,a),s=this.computeResizableHeights(t,n,a,o);this.layoutSections(t,i,r.getLeft(),r.getTop(),s!==null,(e,n)=>{if(n)return s?.get(e)??this.openContentHeight(t[e],a)+(o.get(e)??0);let r=t[e].getPreferredSize();return r?r.height:100},!0,!0)}layoutSections(e,t,n,r,a,o,s,c){let l=r,u=0,d=null,f=0,p=0;for(let r=0;r<e.length;r++){let m=e[r],h=this._headers[r],g=this._panelWrappers[r],_=this._openState[r];if(!m.isDisplayed()){h.setDisplayed(!1),g.setDisplayed(!1);continue}h.setDisplayed(!0),g.setDisplayed(!0),u>0&&(l+=this._spacing),u+=1;let v=o(r,_),y=_?v:0;_&&a&&d!==null&&(this.placeGutter(p,f,t,n),this._gutterPairs[p]={upper:d,lower:m},p+=1);let b=m.getHeight(),x=_&&s&&!i.isReducedMotion()&&v<b,S=this.placeSection(r,m,l,y,v,t,n);(c||v!==b)&&(x?(this._shrinkAnimations.get(r)?.cancel(),this._shrinkAnimations.set(r,i.afterTransition({component:g,property:`height`,durationMs:this._animationDuration,fallbackBufferMs:40,onComplete:()=>{this._shrinkAnimations.delete(r),m.doLayout()}}))):m.doLayout()),_&&a&&(d=m,f=S),l=S}this._gutterPairs.length=p;for(let e=p;e<this._resizeGutters.length;e++)this._resizeGutters[e].setVisible(!1)}getOrCreateResizeGutter(t){let n=this._resizeGutters[t];if(n)return n;let r=this.getContainer(),i=new g(`vertical`,{collapsible:!1,expandedBackground:`transparent`});return i.setTransition(`none`),i.on(`dragstart`,e=>this.onGutterDragStart(t,e)),i.on(`drag`,e=>this.onGutterDrag(t,e)),e.sink.appendChild(r.getElement(),i.getElement(!0)),this._resizeGutters.push(i),i}placeGutter(e,t,n,r){let i=this.getOrCreateResizeGutter(e);i.setX(r),i.setY(t-M),i.setWidth(n),i.setHeight(M),i.setVisible(!0)}onGutterDragStart(e,t){let n=this._gutterPairs[e];if(!n)return;let r=this.getContainer()?.getComponents()??[];this._dragOpenIndices=[];for(let e=0;e<r.length;e++)r[e].isDisplayed()&&this._openState[e]&&this._dragOpenIndices.push(e);if(this._dragGutterUpperPos=this._dragOpenIndices.indexOf(r.indexOf(n.upper)),this._dragGutterUpperPos===-1)return;this._dragUpper=n.upper,this._dragLower=n.lower,this._dragLastPointer=t;let i=this.getContainer();i&&(l.addViewportListener(i,`mouseup`,this._boundOnGutterDragEnd),l.addViewportListener(i,`touchend`,this._boundOnGutterDragEnd),l.addViewportListener(i,`touchcancel`,this._boundOnGutterDragEnd))}onGutterDrag(e,t){let n=this._gutterPairs[e],r=this.getContainer();if(!n||n.upper!==this._dragUpper||n.lower!==this._dragLower||!r)return;let i=r.getComponents(),a=this._dragOpenIndices,o=this._dragGutterUpperPos,s=t-this._dragLastPointer,c=a.map(e=>i[e].getHeight()),l=a.map(e=>{let t=i[e].getMinSize();return t?t.height:0}),u=a.map(e=>{let t=i[e].getMaxSize();return t?t.height:1/0}),d=[],f=[];for(let e=o;e>=0;e--)d.push(e);for(let e=o+1;e<a.length;e++)f.push(e);let p=s>=0?d:f,m=s>=0?f:d,h=0,g=0;for(let e of p)h+=Math.max(0,u[e]-c[e]);for(let e of m)g+=Math.max(0,c[e]-l[e]);let _=Math.max(0,Math.min(Math.abs(s),h,g));this._dragLastPointer+=Math.sign(s)*_;let v=c.slice();this.distributeDragChain(p,c,_,1,l,u,v),this.distributeDragChain(m,c,_,-1,l,u,v);let y=new Map;for(let e=0;e<a.length;e++){let t=i[a[e]],n=this._resizePinned.has(t)?1:this._resizeFactor;y.set(a[e],v[e]),this._resizeSizes.set(t,v[e]/n)}let b=r.getContentInsets(),x=this._panelWrappers[a[0]].getWidth();this.layoutSections(i,x,b.getLeft(),b.getTop(),!0,(e,t)=>t?y.get(e)??i[e].getHeight():i[e].getHeight(),!1,!1)}distributeDragChain(e,t,n,r,i,a,o){let room=e=>r>0?Math.max(0,a[e]-t[e]):Math.max(0,t[e]-i[e]),s=n;for(let t of e){if(s<=N)return;let e=Math.min(s,room(t));o[t]+=r*e,s-=e}}onGutterDragEnd(){let e=this._dragUpper!==null,t=this.getContainer();return t&&(l.removeViewportListener(t,`mouseup`,this._boundOnGutterDragEnd),l.removeViewportListener(t,`touchend`,this._boundOnGutterDragEnd),l.removeViewportListener(t,`touchcancel`,this._boundOnGutterDragEnd)),this._dragUpper=null,this._dragLower=null,e&&this.emit(`sectionresize`,this.getSectionSizes()),!0}computeShrinkRatio(e,t){if(!t)return 0;let n=0,r=0,i=0,a=0;for(let t=0;t<e.length;t++){if(!e[t].isDisplayed()||(a>0&&(n+=this._spacing),a+=1,n+=this.effectiveHeaderHeight(),!this._openState[t]))continue;let o=e[t].getPreferredSize(),s=e[t].getMinSize();r+=o?o.height:100,i+=s?s.height:0}let o=n+r,s=n+i,c=t.height;if(o<=c||s>c)return 0;let l=o-s;return l>0?(o-c)/l:0}openContentHeight(e,t){let n=e.getPreferredSize(),r=n?n.height:100,i=e.getMinSize(),a=i?i.height:0,o=r-t*(r-a),s=e.getMaxSize(),c=s?Math.min(o,s.height):o;return Math.max(c,a)}computeFill(e,t,n){let r=new Map;if(!t)return r;let i=0,a=0,o=[],s=0;for(let t=0;t<e.length;t++)if(e[t].isDisplayed()&&(a>0&&(i+=this._spacing),a+=1,i+=this.effectiveHeaderHeight(),this._openState[t])){let r=this.openContentHeight(e[t],n);i+=r;let a=this.effectiveWeight(e[t]);a>0&&(o.push({index:t,weight:a,headroom:this.fillHeadroom(e[t],r)}),s+=a)}let c=t.height-i;return c<=0||s<=0?r:this.distributeFillWithinMax(o,c)}effectiveWeight(e){let t=this.getLayoutConstraints(e)?.weight??0;return t>0?t:+!!this._fillHeight}resizePinnedSections(e,t,n){let r=[],i=0,a=0;for(let n of t)this.effectiveWeight(e[n])>0?i+=1:(r.push(n),a+=this.clampSectionHeight(e[n],this._resizeSizes.get(e[n])??0));return i===0||a>n?[]:r}clampSectionHeight(e,t){let r=e.getMinSize(),i=e.getMaxSize();return n.clamp(t,r?r.height:0,i?i.height:1/0)}fillHeadroom(e,t){let n=e.getMaxSize();return n?Math.max(0,n.height-t):1/0}distributeFillWithinMax(e,t){let n=new Map,r=new Set(e),i=t;for(;;){let e=0;for(let t of r)e+=t.weight;if(e<=0)break;let t=i/e,a=!1;for(let e of r)if(e.weight*t>e.headroom){n.set(e.index,e.headroom),i-=e.headroom,r.delete(e),a=!0;break}if(!a){for(let e of r)n.set(e.index,e.weight*t);break}if(r.size===0)break}return n}computeResizableHeights(e,t,n,r){if(!this._resizable||!t)return null;for(let t of[...this._resizeSizes.keys()])e.includes(t)||this._resizeSizes.delete(t);let i=0,a=0,o=[];for(let t=0;t<e.length;t++)e[t].isDisplayed()&&(a>0&&(i+=this._spacing),a+=1,i+=this.effectiveHeaderHeight(),this._openState[t]&&o.push(t));if(o.length===0)return null;let s=t.height-i;this.applyPendingSectionSizes(e,s);for(let t of o){let i=e[t];this._resizeSizes.has(i)||this._resizeSizes.set(i,this.openContentHeight(i,n)+(r.get(t)??0))}return this.distributeWithinConstraints(e,o,s)}applyPendingSectionSizes(e,t){let n=this._pendingSectionSizes;if(n===null||(this._pendingSectionSizes=null,!m(n,this.sectionSizeUnits(e))))return;let r=h(n,t);for(let t=0;t<e.length;t+=1)r[t]>0?this._resizeSizes.set(e[t],r[t]):this._resizeSizes.delete(e[t])}distributeWithinConstraints(e,t,n){let r=new Map,i=new Set(t),a=n,o=1;this._resizePinned.clear();for(let o of this.resizePinnedSections(e,t,n)){let t=this.clampSectionHeight(e[o],this._resizeSizes.get(e[o])??0);r.set(o,t),a-=t,i.delete(o),this._resizePinned.add(e[o])}for(;;){let t=0;for(let n of i)t+=this._resizeSizes.get(e[n])??0;o=t>0?a/t:0;let n=!1;for(let t of i){let s=e[t],c=(this._resizeSizes.get(s)??0)*o,l=s.getMinSize(),u=s.getMaxSize(),d=l?l.height:0,f=u?u.height:1/0;if(c<d){r.set(t,d),a-=d,i.delete(t),n=!0;break}if(c>f){r.set(t,f),a-=f,i.delete(t),n=!0;break}}if(!n){for(let t of i)r.set(t,(this._resizeSizes.get(e[t])??0)*o);break}if(i.size===0)break}return this._resizeFactor=o>0?o:1,r}onHeaderKeyDown(e,t){let n=this._headers.length;if(n===0)return;let r;switch(e.key){case`ArrowDown`:r=(t+1)%n;break;case`ArrowUp`:r=(t-1+n)%n;break;case`Home`:r=0;break;case`End`:r=n-1;break;default:return}e.preventDefault(),this._headers[r].getTitleButton().focus()}onHeaderClicked(e){let t=this._openState[e];if(this._singleOpen&&!t)for(let t=0;t<this._openState.length;t++)t!==e&&this._openState[t]&&(this.primeWrapper(t),this._openState[t]=!1,this._headers[t].setExpanded(!1),this.emit(`sectiontoggle`,t,!1));let n=!t;this.primeWrapper(e),this._openState[e]=n,this._headers[e].setExpanded(n),this.emit(`sectiontoggle`,e,n),this.relayoutHost()}primeWrapper(t){if(i.isReducedMotion())return;let n=this._panelWrappers[t],r=this.getContainer();this.setSectionTransitions(!0),r?.setTransition(`height ${this._animationDuration}ms ${A}`),n.setWillChange(`height`);let a=r?.getElement();a&&e.source.getElementRect(a);let o=this._wrapperAnimations.get(t);o?(o.cancel(),this._wrapperAnimations.delete(t)):this._toggleAnimations+=1,this._wrapperAnimations.set(t,i.afterTransition({component:n,property:`height`,durationMs:this._animationDuration,fallbackBufferMs:40,onComplete:()=>{this._wrapperAnimations.delete(t),n.setWillChange(null),--this._toggleAnimations,this._toggleAnimations<=0&&(this._toggleAnimations=0,this.setSectionTransitions(!1),r?.setTransition(null),this.relayoutHost())}}))}setSectionTransitions(e){let t=this.getContainer()?.getComponents()??[];for(let n=0;n<this._headers.length;n++)this._headers[n].setTransition(e?this.buildHeaderTransition():`none`),this._panelWrappers[n].setTransition(e?this.buildWrapperTransition():`none`),t[n]?.setTransition(e?this.buildContentTransition():`none`);for(let t of this._resizeGutters)t.setTransition(e?this.buildHeaderTransition():`none`)}buildHeaderTransition(){return`top ${this._animationDuration}ms ${A}`}buildWrapperTransition(){return`height ${this._animationDuration}ms ${A}, top ${this._animationDuration}ms ${A}`}buildContentTransition(){return`height ${this._animationDuration}ms ${A}`}},R=s(Accordion),AccordionConstraints=class extends _{label;initiallyOpen;tools;constructor(e,t,n,r){super(),this.label=e,this.initiallyOpen=t,this.glyph=n??null,this.tools=r}},GridConstraints=class extends _{col;row;rowSpan;colSpan;constructor(){super()}};export{S as a,k as i,AccordionConstraints as n,R as r,GridConstraints as t};
2
+ //# sourceMappingURL=GridConstraints-D_kbd-h2.js.map