@md-code/sections 0.0.0-stage → 0.0.1

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 (229) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +19 -2
  3. package/dist/board-D3Xh9LzU.js +2042 -0
  4. package/dist/code-diff-board.js +1 -0
  5. package/dist/code-diff-interface.js +0 -0
  6. package/dist/code-diff-model.js +538 -0
  7. package/dist/code-diff.js +284 -0
  8. package/dist/connections-graph-model.js +1 -0
  9. package/dist/connections-graph.js +683 -0
  10. package/dist/folder-structure.js +213 -0
  11. package/dist/gap-DiNGdMzF.js +112 -0
  12. package/dist/hamburger-menu.js +52 -0
  13. package/dist/model-CPYzATkg.js +469 -0
  14. package/dist/not-found-section.js +37 -0
  15. package/dist/types/default/data-display/CodeDiff/board/chrome.d.ts +40 -0
  16. package/dist/types/default/data-display/CodeDiff/board/chrome.d.ts.map +1 -0
  17. package/dist/types/default/data-display/CodeDiff/board/columns.d.ts +21 -0
  18. package/dist/types/default/data-display/CodeDiff/board/columns.d.ts.map +1 -0
  19. package/dist/types/default/data-display/CodeDiff/board/events.d.ts +157 -0
  20. package/dist/types/default/data-display/CodeDiff/board/events.d.ts.map +1 -0
  21. package/dist/types/default/data-display/CodeDiff/board/hooks/focus.d.ts +30 -0
  22. package/dist/types/default/data-display/CodeDiff/board/hooks/focus.d.ts.map +1 -0
  23. package/dist/types/default/data-display/CodeDiff/board/hooks/pointer.d.ts +28 -0
  24. package/dist/types/default/data-display/CodeDiff/board/hooks/pointer.d.ts.map +1 -0
  25. package/dist/types/default/data-display/CodeDiff/board/hooks/state.d.ts +21 -0
  26. package/dist/types/default/data-display/CodeDiff/board/hooks/state.d.ts.map +1 -0
  27. package/dist/types/default/data-display/CodeDiff/board/index.d.ts +7 -0
  28. package/dist/types/default/data-display/CodeDiff/board/index.d.ts.map +1 -0
  29. package/dist/types/default/data-display/CodeDiff/board/layout.d.ts +29 -0
  30. package/dist/types/default/data-display/CodeDiff/board/layout.d.ts.map +1 -0
  31. package/dist/types/default/data-display/CodeDiff/board/legacy.d.ts +85 -0
  32. package/dist/types/default/data-display/CodeDiff/board/legacy.d.ts.map +1 -0
  33. package/dist/types/default/data-display/CodeDiff/board/provider.d.ts +33 -0
  34. package/dist/types/default/data-display/CodeDiff/board/provider.d.ts.map +1 -0
  35. package/dist/types/default/data-display/CodeDiff/board/types.d.ts +85 -0
  36. package/dist/types/default/data-display/CodeDiff/board/types.d.ts.map +1 -0
  37. package/dist/types/default/data-display/CodeDiff/columns/decide.d.ts +16 -0
  38. package/dist/types/default/data-display/CodeDiff/columns/decide.d.ts.map +1 -0
  39. package/dist/types/default/data-display/CodeDiff/columns/fold.d.ts +18 -0
  40. package/dist/types/default/data-display/CodeDiff/columns/fold.d.ts.map +1 -0
  41. package/dist/types/default/data-display/CodeDiff/columns/hooks/slot-heights.d.ts +13 -0
  42. package/dist/types/default/data-display/CodeDiff/columns/hooks/slot-heights.d.ts.map +1 -0
  43. package/dist/types/default/data-display/CodeDiff/columns/hooks/virtual-list.d.ts +25 -0
  44. package/dist/types/default/data-display/CodeDiff/columns/hooks/virtual-list.d.ts.map +1 -0
  45. package/dist/types/default/data-display/CodeDiff/columns/index.d.ts +18 -0
  46. package/dist/types/default/data-display/CodeDiff/columns/index.d.ts.map +1 -0
  47. package/dist/types/default/data-display/CodeDiff/columns/paint.d.ts +28 -0
  48. package/dist/types/default/data-display/CodeDiff/columns/paint.d.ts.map +1 -0
  49. package/dist/types/default/data-display/CodeDiff/columns/row.d.ts +20 -0
  50. package/dist/types/default/data-display/CodeDiff/columns/row.d.ts.map +1 -0
  51. package/dist/types/default/data-display/CodeDiff/columns/slot-heights.d.ts +8 -0
  52. package/dist/types/default/data-display/CodeDiff/columns/slot-heights.d.ts.map +1 -0
  53. package/dist/types/default/data-display/CodeDiff/columns/styles.d.ts +37 -0
  54. package/dist/types/default/data-display/CodeDiff/columns/styles.d.ts.map +1 -0
  55. package/dist/types/default/data-display/CodeDiff/columns/types.d.ts +42 -0
  56. package/dist/types/default/data-display/CodeDiff/columns/types.d.ts.map +1 -0
  57. package/dist/types/default/data-display/CodeDiff/columns/virtual-list.d.ts +18 -0
  58. package/dist/types/default/data-display/CodeDiff/columns/virtual-list.d.ts.map +1 -0
  59. package/dist/types/default/data-display/CodeDiff/columns/window.d.ts +21 -0
  60. package/dist/types/default/data-display/CodeDiff/columns/window.d.ts.map +1 -0
  61. package/dist/types/default/data-display/CodeDiff/components/Actions.d.ts +7 -0
  62. package/dist/types/default/data-display/CodeDiff/components/Actions.d.ts.map +1 -0
  63. package/dist/types/default/data-display/CodeDiff/components/atoms.d.ts +22 -0
  64. package/dist/types/default/data-display/CodeDiff/components/atoms.d.ts.map +1 -0
  65. package/dist/types/default/data-display/CodeDiff/components/hooks/use-actions.d.ts +10 -0
  66. package/dist/types/default/data-display/CodeDiff/components/hooks/use-actions.d.ts.map +1 -0
  67. package/dist/types/default/data-display/CodeDiff/components/resolve.d.ts +22 -0
  68. package/dist/types/default/data-display/CodeDiff/components/resolve.d.ts.map +1 -0
  69. package/dist/types/default/data-display/CodeDiff/components/styles.d.ts +72 -0
  70. package/dist/types/default/data-display/CodeDiff/components/styles.d.ts.map +1 -0
  71. package/dist/types/default/data-display/CodeDiff/components/types.d.ts +50 -0
  72. package/dist/types/default/data-display/CodeDiff/components/types.d.ts.map +1 -0
  73. package/dist/types/default/data-display/CodeDiff/config.d.ts +11 -0
  74. package/dist/types/default/data-display/CodeDiff/config.d.ts.map +1 -0
  75. package/dist/types/default/data-display/CodeDiff/constants.d.ts +97 -0
  76. package/dist/types/default/data-display/CodeDiff/constants.d.ts.map +1 -0
  77. package/dist/types/default/data-display/CodeDiff/index.d.ts +22 -0
  78. package/dist/types/default/data-display/CodeDiff/index.d.ts.map +1 -0
  79. package/dist/types/default/data-display/CodeDiff/interface/index.d.ts +10 -0
  80. package/dist/types/default/data-display/CodeDiff/interface/index.d.ts.map +1 -0
  81. package/dist/types/default/data-display/CodeDiff/model/index.d.ts +19 -0
  82. package/dist/types/default/data-display/CodeDiff/model/index.d.ts.map +1 -0
  83. package/dist/types/default/data-display/CodeDiff/ribbon/connector.d.ts +16 -0
  84. package/dist/types/default/data-display/CodeDiff/ribbon/connector.d.ts.map +1 -0
  85. package/dist/types/default/data-display/CodeDiff/ribbon/context.d.ts +29 -0
  86. package/dist/types/default/data-display/CodeDiff/ribbon/context.d.ts.map +1 -0
  87. package/dist/types/default/data-display/CodeDiff/ribbon/gap.d.ts +49 -0
  88. package/dist/types/default/data-display/CodeDiff/ribbon/gap.d.ts.map +1 -0
  89. package/dist/types/default/data-display/CodeDiff/ribbon/geometry.d.ts +27 -0
  90. package/dist/types/default/data-display/CodeDiff/ribbon/geometry.d.ts.map +1 -0
  91. package/dist/types/default/data-display/CodeDiff/ribbon/group.d.ts +15 -0
  92. package/dist/types/default/data-display/CodeDiff/ribbon/group.d.ts.map +1 -0
  93. package/dist/types/default/data-display/CodeDiff/ribbon/hooks/chain.d.ts +34 -0
  94. package/dist/types/default/data-display/CodeDiff/ribbon/hooks/chain.d.ts.map +1 -0
  95. package/dist/types/default/data-display/CodeDiff/ribbon/hooks/events.d.ts +13 -0
  96. package/dist/types/default/data-display/CodeDiff/ribbon/hooks/events.d.ts.map +1 -0
  97. package/dist/types/default/data-display/CodeDiff/ribbon/hooks/geometry.d.ts +9 -0
  98. package/dist/types/default/data-display/CodeDiff/ribbon/hooks/geometry.d.ts.map +1 -0
  99. package/dist/types/default/data-display/CodeDiff/ribbon/hooks/paint.d.ts +24 -0
  100. package/dist/types/default/data-display/CodeDiff/ribbon/hooks/paint.d.ts.map +1 -0
  101. package/dist/types/default/data-display/CodeDiff/ribbon/hooks/position.d.ts +51 -0
  102. package/dist/types/default/data-display/CodeDiff/ribbon/hooks/position.d.ts.map +1 -0
  103. package/dist/types/default/data-display/CodeDiff/ribbon/hooks/tone.d.ts +45 -0
  104. package/dist/types/default/data-display/CodeDiff/ribbon/hooks/tone.d.ts.map +1 -0
  105. package/dist/types/default/data-display/CodeDiff/ribbon/measure.d.ts +41 -0
  106. package/dist/types/default/data-display/CodeDiff/ribbon/measure.d.ts.map +1 -0
  107. package/dist/types/default/data-display/CodeDiff/ribbon/model.d.ts +106 -0
  108. package/dist/types/default/data-display/CodeDiff/ribbon/model.d.ts.map +1 -0
  109. package/dist/types/default/data-display/CodeDiff/ribbon/scene.d.ts +25 -0
  110. package/dist/types/default/data-display/CodeDiff/ribbon/scene.d.ts.map +1 -0
  111. package/dist/types/default/data-display/CodeDiff/ribbon/styles.d.ts +11 -0
  112. package/dist/types/default/data-display/CodeDiff/ribbon/styles.d.ts.map +1 -0
  113. package/dist/types/default/data-display/CodeDiff/ribbon/svg.d.ts +48 -0
  114. package/dist/types/default/data-display/CodeDiff/ribbon/svg.d.ts.map +1 -0
  115. package/dist/types/default/data-display/CodeDiff/ribbon/types.d.ts +109 -0
  116. package/dist/types/default/data-display/CodeDiff/ribbon/types.d.ts.map +1 -0
  117. package/dist/types/default/data-display/CodeDiff/ribbon/waist.d.ts +36 -0
  118. package/dist/types/default/data-display/CodeDiff/ribbon/waist.d.ts.map +1 -0
  119. package/dist/types/default/data-display/CodeDiff/rows/caret.d.ts +8 -0
  120. package/dist/types/default/data-display/CodeDiff/rows/caret.d.ts.map +1 -0
  121. package/dist/types/default/data-display/CodeDiff/rows/diff.d.ts +41 -0
  122. package/dist/types/default/data-display/CodeDiff/rows/diff.d.ts.map +1 -0
  123. package/dist/types/default/data-display/CodeDiff/rows/hooks/events.d.ts +15 -0
  124. package/dist/types/default/data-display/CodeDiff/rows/hooks/events.d.ts.map +1 -0
  125. package/dist/types/default/data-display/CodeDiff/rows/hooks/fold.d.ts +26 -0
  126. package/dist/types/default/data-display/CodeDiff/rows/hooks/fold.d.ts.map +1 -0
  127. package/dist/types/default/data-display/CodeDiff/rows/hooks/groups.d.ts +15 -0
  128. package/dist/types/default/data-display/CodeDiff/rows/hooks/groups.d.ts.map +1 -0
  129. package/dist/types/default/data-display/CodeDiff/rows/index.d.ts +25 -0
  130. package/dist/types/default/data-display/CodeDiff/rows/index.d.ts.map +1 -0
  131. package/dist/types/default/data-display/CodeDiff/rows/lcs.d.ts +12 -0
  132. package/dist/types/default/data-display/CodeDiff/rows/lcs.d.ts.map +1 -0
  133. package/dist/types/default/data-display/CodeDiff/rows/paint.d.ts +3 -0
  134. package/dist/types/default/data-display/CodeDiff/rows/paint.d.ts.map +1 -0
  135. package/dist/types/default/data-display/CodeDiff/rows/styles.d.ts +86 -0
  136. package/dist/types/default/data-display/CodeDiff/rows/styles.d.ts.map +1 -0
  137. package/dist/types/default/data-display/CodeDiff/rows/text.d.ts +9 -0
  138. package/dist/types/default/data-display/CodeDiff/rows/text.d.ts.map +1 -0
  139. package/dist/types/default/data-display/CodeDiff/rows/types.d.ts +87 -0
  140. package/dist/types/default/data-display/CodeDiff/rows/types.d.ts.map +1 -0
  141. package/dist/types/default/data-display/CodeDiff/surface/commit.d.ts +15 -0
  142. package/dist/types/default/data-display/CodeDiff/surface/commit.d.ts.map +1 -0
  143. package/dist/types/default/data-display/CodeDiff/surface/dom.d.ts +12 -0
  144. package/dist/types/default/data-display/CodeDiff/surface/dom.d.ts.map +1 -0
  145. package/dist/types/default/data-display/CodeDiff/surface/gate.d.ts +17 -0
  146. package/dist/types/default/data-display/CodeDiff/surface/gate.d.ts.map +1 -0
  147. package/dist/types/default/data-display/CodeDiff/surface/hooks/layout-state.d.ts +14 -0
  148. package/dist/types/default/data-display/CodeDiff/surface/hooks/layout-state.d.ts.map +1 -0
  149. package/dist/types/default/data-display/CodeDiff/surface/hooks/measure.d.ts +11 -0
  150. package/dist/types/default/data-display/CodeDiff/surface/hooks/measure.d.ts.map +1 -0
  151. package/dist/types/default/data-display/CodeDiff/surface/hooks/observer.d.ts +17 -0
  152. package/dist/types/default/data-display/CodeDiff/surface/hooks/observer.d.ts.map +1 -0
  153. package/dist/types/default/data-display/CodeDiff/surface/hooks/scroll.d.ts +12 -0
  154. package/dist/types/default/data-display/CodeDiff/surface/hooks/scroll.d.ts.map +1 -0
  155. package/dist/types/default/data-display/CodeDiff/surface/index.d.ts +16 -0
  156. package/dist/types/default/data-display/CodeDiff/surface/index.d.ts.map +1 -0
  157. package/dist/types/default/data-display/CodeDiff/surface/measure.d.ts +17 -0
  158. package/dist/types/default/data-display/CodeDiff/surface/measure.d.ts.map +1 -0
  159. package/dist/types/default/data-display/CodeDiff/surface/scroll.d.ts +11 -0
  160. package/dist/types/default/data-display/CodeDiff/surface/scroll.d.ts.map +1 -0
  161. package/dist/types/default/data-display/CodeDiff/surface/settle.d.ts +8 -0
  162. package/dist/types/default/data-display/CodeDiff/surface/settle.d.ts.map +1 -0
  163. package/dist/types/default/data-display/CodeDiff/surface/styles.d.ts +9 -0
  164. package/dist/types/default/data-display/CodeDiff/surface/styles.d.ts.map +1 -0
  165. package/dist/types/default/data-display/CodeDiff/surface/types.d.ts +23 -0
  166. package/dist/types/default/data-display/CodeDiff/surface/types.d.ts.map +1 -0
  167. package/dist/types/default/data-display/ConnectionsGraph/board/Drawing.d.ts +38 -0
  168. package/dist/types/default/data-display/ConnectionsGraph/board/Drawing.d.ts.map +1 -0
  169. package/dist/types/default/data-display/ConnectionsGraph/board/EdgeLayer.d.ts +21 -0
  170. package/dist/types/default/data-display/ConnectionsGraph/board/EdgeLayer.d.ts.map +1 -0
  171. package/dist/types/default/data-display/ConnectionsGraph/board/NodeBox.d.ts +20 -0
  172. package/dist/types/default/data-display/ConnectionsGraph/board/NodeBox.d.ts.map +1 -0
  173. package/dist/types/default/data-display/ConnectionsGraph/board/Overlays.d.ts +19 -0
  174. package/dist/types/default/data-display/ConnectionsGraph/board/Overlays.d.ts.map +1 -0
  175. package/dist/types/default/data-display/ConnectionsGraph/board/index.d.ts +46 -0
  176. package/dist/types/default/data-display/ConnectionsGraph/board/index.d.ts.map +1 -0
  177. package/dist/types/default/data-display/ConnectionsGraph/board/styles.d.ts +51 -0
  178. package/dist/types/default/data-display/ConnectionsGraph/board/styles.d.ts.map +1 -0
  179. package/dist/types/default/data-display/ConnectionsGraph/board/theme.d.ts +67 -0
  180. package/dist/types/default/data-display/ConnectionsGraph/board/theme.d.ts.map +1 -0
  181. package/dist/types/default/data-display/ConnectionsGraph/board/useZoomPan.d.ts +32 -0
  182. package/dist/types/default/data-display/ConnectionsGraph/board/useZoomPan.d.ts.map +1 -0
  183. package/dist/types/default/data-display/ConnectionsGraph/index.d.ts +7 -0
  184. package/dist/types/default/data-display/ConnectionsGraph/index.d.ts.map +1 -0
  185. package/dist/types/default/data-display/ConnectionsGraph/model/graph.d.ts +23 -0
  186. package/dist/types/default/data-display/ConnectionsGraph/model/graph.d.ts.map +1 -0
  187. package/dist/types/default/data-display/ConnectionsGraph/model/index.d.ts +19 -0
  188. package/dist/types/default/data-display/ConnectionsGraph/model/index.d.ts.map +1 -0
  189. package/dist/types/default/data-display/ConnectionsGraph/model/layout/columns.d.ts +10 -0
  190. package/dist/types/default/data-display/ConnectionsGraph/model/layout/columns.d.ts.map +1 -0
  191. package/dist/types/default/data-display/ConnectionsGraph/model/layout/edge-lines.d.ts +11 -0
  192. package/dist/types/default/data-display/ConnectionsGraph/model/layout/edge-lines.d.ts.map +1 -0
  193. package/dist/types/default/data-display/ConnectionsGraph/model/layout/geometry.d.ts +18 -0
  194. package/dist/types/default/data-display/ConnectionsGraph/model/layout/geometry.d.ts.map +1 -0
  195. package/dist/types/default/data-display/ConnectionsGraph/model/layout/label-search.d.ts +18 -0
  196. package/dist/types/default/data-display/ConnectionsGraph/model/layout/label-search.d.ts.map +1 -0
  197. package/dist/types/default/data-display/ConnectionsGraph/model/layout/lanes.d.ts +7 -0
  198. package/dist/types/default/data-display/ConnectionsGraph/model/layout/lanes.d.ts.map +1 -0
  199. package/dist/types/default/data-display/ConnectionsGraph/model/layout/occupancy.d.ts +25 -0
  200. package/dist/types/default/data-display/ConnectionsGraph/model/layout/occupancy.d.ts.map +1 -0
  201. package/dist/types/default/data-display/ConnectionsGraph/model/layout/routing.d.ts +39 -0
  202. package/dist/types/default/data-display/ConnectionsGraph/model/layout/routing.d.ts.map +1 -0
  203. package/dist/types/default/data-display/ConnectionsGraph/model/layout/text-flow.d.ts +19 -0
  204. package/dist/types/default/data-display/ConnectionsGraph/model/layout/text-flow.d.ts.map +1 -0
  205. package/dist/types/default/data-display/ConnectionsGraph/model/layout/types.d.ts +76 -0
  206. package/dist/types/default/data-display/ConnectionsGraph/model/layout/types.d.ts.map +1 -0
  207. package/dist/types/default/data-display/ConnectionsGraph/model/loops.d.ts +10 -0
  208. package/dist/types/default/data-display/ConnectionsGraph/model/loops.d.ts.map +1 -0
  209. package/dist/types/default/data-display/FolderStructure/index.d.ts +25 -0
  210. package/dist/types/default/data-display/FolderStructure/index.d.ts.map +1 -0
  211. package/dist/types/default/data-display/FolderStructure/model.d.ts +35 -0
  212. package/dist/types/default/data-display/FolderStructure/model.d.ts.map +1 -0
  213. package/dist/types/default/data-display/FolderStructure/styles.d.ts +97 -0
  214. package/dist/types/default/data-display/FolderStructure/styles.d.ts.map +1 -0
  215. package/dist/types/default/data-display/FolderStructure/theme.d.ts +31 -0
  216. package/dist/types/default/data-display/FolderStructure/theme.d.ts.map +1 -0
  217. package/dist/types/default/data-display/FolderStructure/types.d.ts +89 -0
  218. package/dist/types/default/data-display/FolderStructure/types.d.ts.map +1 -0
  219. package/dist/types/default/feedback/NotFoundSection/index.d.ts +12 -0
  220. package/dist/types/default/feedback/NotFoundSection/index.d.ts.map +1 -0
  221. package/dist/types/default/feedback/NotFoundSection/styles.d.ts +9 -0
  222. package/dist/types/default/feedback/NotFoundSection/styles.d.ts.map +1 -0
  223. package/dist/types/default/index.d.ts +2 -0
  224. package/dist/types/default/index.d.ts.map +1 -0
  225. package/dist/types/default/navigation/HamburgerMenu/index.d.ts +8 -0
  226. package/dist/types/default/navigation/HamburgerMenu/index.d.ts.map +1 -0
  227. package/dist/types/default/navigation/HamburgerMenu/styles.d.ts +17 -0
  228. package/dist/types/default/navigation/HamburgerMenu/styles.d.ts.map +1 -0
  229. package/package.json +133 -4
@@ -0,0 +1,2042 @@
1
+ import { a as e, c as t, i as n, o as r, t as i } from "./gap-DiNGdMzF.js";
2
+ import { createContext as a, forwardRef as o, useCallback as s, useContext as c, useLayoutEffect as l, useMemo as u, useRef as d, useState as f } from "react";
3
+ import p, { useTheme as m } from "styled-components";
4
+ import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
5
+ // default/data-display/CodeDiff/board/events.ts
6
+ var v = () => ({
7
+ defaultPrevented: !1,
8
+ preventDefault() {
9
+ this.defaultPrevented = !0;
10
+ }
11
+ }), y = (e, t) => {
12
+ let n = e?.[t];
13
+ return n === void 0 ? [] : Array.isArray(n) ? n : [n];
14
+ }, b = (e) => ({ emit(t, n) {
15
+ return y(e, t).reduce((e, t) => (t(n, e), e), v());
16
+ } }), x = {
17
+ revealed: !1,
18
+ focusedRibbon: null,
19
+ selected: [],
20
+ sort: {},
21
+ filter: {}
22
+ }, S = (e) => `${e.column}::${String(e.row)}`, C = (e, t, n) => {
23
+ let [r, i] = f({
24
+ ...x,
25
+ revealed: t
26
+ }), a = u(() => ({
27
+ ...r,
28
+ ...e ?? {}
29
+ }), [r, e]), o = s((e) => {
30
+ i(e), n("board:stateChange", { state: e });
31
+ }, [n]);
32
+ return {
33
+ state: a,
34
+ setRevealed: (e) => {
35
+ o({
36
+ ...a,
37
+ revealed: e
38
+ }), n("board:revealChange", { revealed: e });
39
+ },
40
+ setFocused: (e) => o({
41
+ ...a,
42
+ focusedRibbon: e
43
+ }),
44
+ setSelected: (e) => {
45
+ o({
46
+ ...a,
47
+ selected: e
48
+ }), n("row:selectionChange", { selected: e });
49
+ },
50
+ toggleSelect: (e) => {
51
+ let t = S(e), r = a.selected.some((e) => S(e) === t), i = r ? a.selected.filter((e) => S(e) !== t) : [...a.selected, e];
52
+ o({
53
+ ...a,
54
+ selected: i
55
+ }), n("row:select", {
56
+ row: e,
57
+ selected: !r
58
+ }), n("row:selectionChange", { selected: i });
59
+ },
60
+ setSort: (e, t) => {
61
+ o({
62
+ ...a,
63
+ sort: {
64
+ ...a.sort,
65
+ [e]: t
66
+ }
67
+ }), n("column:sort", {
68
+ column: e,
69
+ direction: t
70
+ });
71
+ },
72
+ setFilter: (e, t) => {
73
+ o({
74
+ ...a,
75
+ filter: {
76
+ ...a.filter,
77
+ [e]: t
78
+ }
79
+ }), n("column:filter", {
80
+ column: e,
81
+ value: t
82
+ });
83
+ }
84
+ };
85
+ }, w = (e, t) => e.zIndex[t] ?? e.zIndex.content, T = (e) => ({
86
+ edge: e.colors.status?.edge?.background ?? e.colors.section,
87
+ dim: e.colors.status?.dim?.content ?? e.colors.sectionContent,
88
+ faint: e.colors.status?.faint?.content ?? e.colors.sectionContent,
89
+ ribbon: e.colors.status?.ribbon?.background ?? "transparent",
90
+ zSurface: w(e, "boardSurface"),
91
+ zPlate: w(e, "boardPlate"),
92
+ zBadge: w(e, "boardBadge"),
93
+ zAbove: w(e, "boardAbove")
94
+ }), E = {}, D = a(null), O = () => {
95
+ let e = c(D);
96
+ if (e === null) throw Error("code-diff: useBoard must be used inside <Board>");
97
+ return e;
98
+ }, k = ({ props: e, children: n }) => {
99
+ let r = u(() => t(e.config), [e.config]), i = m(), a = e.tones ?? E, o = u(() => T(i), [i]), s = u(() => b(e.events), [e.events]), c = C(e.state, e.reveal ?? !1, s.emit), l = u(() => ({
100
+ config: r,
101
+ theme: i,
102
+ tones: a,
103
+ chrome: o,
104
+ state: c,
105
+ emit: s.emit,
106
+ props: e
107
+ }), [
108
+ r,
109
+ i,
110
+ a,
111
+ o,
112
+ c,
113
+ s,
114
+ e
115
+ ]);
116
+ return /* @__PURE__ */ g(D.Provider, {
117
+ value: l,
118
+ children: n
119
+ });
120
+ }, ee = p.div`
121
+ position: relative;
122
+ display: grid;
123
+ grid-template-columns: ${({ $template: e }) => e};
124
+ grid-template-rows: ${({ $height: e }) => e === void 0 ? "auto" : "minmax(0, 1fr)"};
125
+ align-items: ${({ $height: e }) => e === void 0 ? "start" : "stretch"};
126
+ width: 100%;
127
+ min-width: 0;
128
+ ${({ $height: e }) => e === void 0 ? "" : `height: ${e};`}
129
+ /* The board CONTAINS its painted extent: the frame never ends above a ribbon
130
+ or caption (the grown packing band is data the surface consumes). */
131
+ ${({ $minHeight: e }) => e === void 0 ? "" : `min-height: ${e};`}
132
+ overflow: hidden;
133
+ font-family: ${({ theme: e }) => e.font.family.text};
134
+ font-size: ${({ theme: e }) => e.font.sizes.regular};
135
+ background: ${({ theme: e }) => e.colors.section};
136
+ `, te = p.div`
137
+ position: relative;
138
+ z-index: ${({ $zPlate: e }) => e};
139
+ min-width: 0;
140
+ ${({ $bounded: e }) => e ? "height: 100%; min-height: 0; overflow: hidden;" : ""}
141
+ ${({ $cap: e, $bounded: t }) => e && !t ? "height: 0; min-height: 100%;" : ""}
142
+ `, ne = p.div`
143
+ min-width: 0;
144
+ position: relative;
145
+ /* The corridor must NOT block the ribbon beneath it: the SVG layer (z-index 1)
146
+ owns hover/click on the band. Only the action holders inside re-enable
147
+ pointer events, so the ribbon stays interactive everywhere else. */
148
+ pointer-events: none;
149
+ `, re = (e) => e.ratio === void 0 ? e.width === void 0 ? "minmax(0, 1fr)" : `${e.width}px` : `${e.ratio}fr`, ie = (e) => e.columns.map((t, n) => {
150
+ let r = re(t), i = e.corridors?.[n];
151
+ return i === void 0 ? r : e.fit === "rubber" ? `${r} minmax(0, ${i}px)` : `${r} ${i}px`;
152
+ }).join(" "), ae = (e, t, n, r) => u(() => {
153
+ let i = e.rows ?? [], a = r && (e.fold ?? !0), o = (e) => n || !a || t === void 0 || t.has(e.id), s = [], c = [], l = (e) => {
154
+ c.length !== 0 && (s.push({
155
+ kind: "fold",
156
+ count: c.length,
157
+ ids: c,
158
+ index: e
159
+ }), c = []);
160
+ };
161
+ return i.forEach((e, t) => {
162
+ o(e) ? (l(t), s.push({
163
+ kind: "row",
164
+ row: e,
165
+ index: t
166
+ })) : c.push(e.id);
167
+ }), l(i.length), s;
168
+ }, [
169
+ e,
170
+ t,
171
+ n,
172
+ r
173
+ ]), oe = (e, t) => {
174
+ let n = /* @__PURE__ */ new Map();
175
+ for (let e of t) {
176
+ let t = n.get(e.column) ?? /* @__PURE__ */ new Set();
177
+ for (let n of e.rows) t.add(n);
178
+ n.set(e.column, t);
179
+ }
180
+ return n;
181
+ }, se = (e, t, n) => {
182
+ let r = Array(e + 1);
183
+ r[0] = 0;
184
+ for (let i = 0; i < e; i += 1) r[i + 1] = (r[i] ?? 0) + (t.get(i) ?? n);
185
+ return r;
186
+ }, ce = (e, t, n) => {
187
+ let r = 0, i = t;
188
+ for (; r < i;) {
189
+ let t = r + i >> 1;
190
+ (e[t + 1] ?? 0) <= n ? r = t + 1 : i = t;
191
+ }
192
+ return Math.max(0, r);
193
+ }, le = ({ sums: e, count: t, top: n, height: r, headroom: i }) => {
194
+ let a = ce(e, t, n - i), o = a;
195
+ for (; o < t && (e[o] ?? 0) < n + r + i;) o += 1;
196
+ return {
197
+ start: a,
198
+ end: Math.max(o, Math.min(t, a + 1))
199
+ };
200
+ }, ue = ({ element: e, count: t, fullMount: n, overscan: r, sums: i }) => {
201
+ if (t <= n) return {
202
+ start: 0,
203
+ end: t
204
+ };
205
+ let a = e.clientHeight;
206
+ return le({
207
+ sums: i,
208
+ count: t,
209
+ top: e.scrollTop,
210
+ height: a,
211
+ headroom: a * r
212
+ });
213
+ }, de = (e, t) => {
214
+ let n = d(/* @__PURE__ */ new Map()), r = d([]), i = d(-1);
215
+ return i.current !== e && (i.current = e, n.current.clear()), r.current = se(e, n.current, t), {
216
+ sums: () => r.current,
217
+ observe: (i, a) => a <= 0 || n.current.get(i) === a ? !1 : (n.current.set(i, a), r.current = se(e, n.current, t), !0)
218
+ };
219
+ }, A = ({ root: e, onChange: t, selector: n, scroll: r = !1 }) => {
220
+ l(() => {
221
+ let i = e.current;
222
+ if (i === null) return;
223
+ let a = new ResizeObserver(t);
224
+ if (a.observe(i), n !== void 0) for (let e of i.querySelectorAll(n)) a.observe(e);
225
+ return r && i.addEventListener("scroll", t, { passive: !0 }), () => {
226
+ a.disconnect(), r && i.removeEventListener("scroll", t);
227
+ };
228
+ }, [
229
+ e,
230
+ t,
231
+ n,
232
+ r
233
+ ]);
234
+ }, fe = ({ next: e, last: t, same: n, commit: r }) => {
235
+ n(e, t.current) || (t.current = e, r(e));
236
+ }, pe = (e, t, n) => (r) => {
237
+ fe({
238
+ next: r,
239
+ last: e,
240
+ same: (e, t) => e.start === t.start && e.end === t.end,
241
+ commit: (e) => {
242
+ t(e), n?.();
243
+ }
244
+ });
245
+ }, me = ({ count: e, rowHeight: t, overscan: n, fullMount: r, onWindow: i }) => {
246
+ let a = d(null), o = d(null), [c, l] = f({
247
+ start: 0,
248
+ end: Math.min(e, 60)
249
+ }), u = d({
250
+ start: -1,
251
+ end: -1
252
+ }), p = de(e, t), m = pe(u, l, i), h = s(() => {
253
+ let t = a.current;
254
+ t !== null && m(ue({
255
+ element: t,
256
+ count: e,
257
+ fullMount: r,
258
+ overscan: n,
259
+ sums: p.sums()
260
+ }));
261
+ }, [
262
+ e,
263
+ r,
264
+ n,
265
+ m,
266
+ p
267
+ ]), g = d(-1);
268
+ return g.current !== e && (g.current = e, u.current = {
269
+ start: -1,
270
+ end: -1
271
+ }), A({
272
+ root: a,
273
+ onChange: h,
274
+ scroll: !0
275
+ }), {
276
+ range: c,
277
+ offsets: p.sums(),
278
+ scroller: a,
279
+ content: o,
280
+ observeSlot: (t, n) => {
281
+ p.observe(t, n) && (e <= r ? i?.() : h());
282
+ }
283
+ };
284
+ }, he = (e) => e instanceof Element ? e : null, j = (e) => e instanceof HTMLElement ? e : null, ge = (e) => e instanceof HTMLElement ? e : null, _e = (e, t) => {
285
+ for (let n of e.querySelectorAll("[data-slot]")) {
286
+ let e = ge(n)?.dataset.slot;
287
+ e !== void 0 && t(Number(e), n.getBoundingClientRect().height);
288
+ }
289
+ }, ve = p.button`
290
+ position: relative;
291
+ width: 100%;
292
+ height: ${({ $rowHeight: e }) => e}px;
293
+ line-height: ${({ $rowHeight: e }) => e}px;
294
+ padding: 0;
295
+ text-align: left;
296
+ border: 0;
297
+ border-top: ${({ theme: e }) => e.border.size} dashed ${({ $edge: e }) => e};
298
+ border-bottom: ${({ theme: e }) => e.border.size} dashed ${({ $edge: e }) => e};
299
+ background: ${({ theme: e }) => e.colors.section};
300
+ color: ${({ $faint: e }) => e};
301
+ font-style: italic;
302
+ font-size: ${({ theme: e }) => e.font.sizes.small};
303
+ font-family: ${({ theme: e }) => e.font.family.text};
304
+ white-space: nowrap;
305
+ cursor: pointer;
306
+ `, ye = p.span`
307
+ position: sticky;
308
+ left: 0;
309
+ display: inline-block;
310
+ padding: 0 ${({ theme: e }) => e.offsets.elementContent};
311
+ `, be = p.div`
312
+ overflow-x: ${({ $rubber: e }) => e ? "hidden" : "auto"};
313
+ overflow-y: auto;
314
+ height: ${({ $bounded: e }) => e ? "100%" : "auto"};
315
+ max-height: ${({ $cap: e, $bounded: t, $maxHeight: n }) => e || t ? "100%" : n};
316
+ scrollbar-width: thin;
317
+ scrollbar-color: ${({ $edge: e }) => e} transparent;
318
+ &::-webkit-scrollbar { width: ${({ $scroll: e }) => e}px; height: ${({ $scroll: e }) => e}px; }
319
+ &::-webkit-scrollbar-track { background: transparent; }
320
+ &::-webkit-scrollbar-thumb { background: ${({ $edge: e }) => e}; border-radius: ${({ $thumbRadius: e }) => e}px; border: ${({ $thumbBorder: e }) => e}px solid ${({ theme: e }) => e.colors.section}; }
321
+ &::-webkit-scrollbar-thumb:hover { background: ${({ $faint: e }) => e}; }
322
+ &::-webkit-scrollbar-corner { background: transparent; }
323
+ `, xe = p.div`
324
+ width: ${({ $rubber: e }) => e ? "100%" : "max-content"};
325
+ min-width: 100%;
326
+ `, Se = p.div`
327
+ width: 100%;
328
+ `, Ce = 10, we = 6, Te = 2, Ee = ({ count: e, rowHeight: t, overscan: n, fullMount: r, maxHeight: i, rubber: a, cap: o, bounded: c, renderRow: l, onWindow: u }) => {
329
+ let { range: d, offsets: f, scroller: p, content: m, observeSlot: h } = me({
330
+ count: e,
331
+ rowHeight: t,
332
+ overscan: n,
333
+ fullMount: r,
334
+ onWindow: u
335
+ }), { chrome: v } = O();
336
+ A({
337
+ root: m,
338
+ selector: "[data-slot]",
339
+ onChange: s(() => {
340
+ m.current !== null && _e(m.current, h);
341
+ }, [
342
+ m,
343
+ h,
344
+ d.start,
345
+ d.end,
346
+ e
347
+ ])
348
+ });
349
+ let y = [];
350
+ for (let e = d.start; e < d.end; e += 1) y.push(/* @__PURE__ */ g(Se, {
351
+ "data-slot": e,
352
+ children: l(e)
353
+ }, e));
354
+ let b = f[d.start] ?? 0, x = Math.max(0, (f[e] ?? 0) - (f[d.end] ?? 0));
355
+ return /* @__PURE__ */ g(be, {
356
+ ref: p,
357
+ $rubber: a,
358
+ $cap: o,
359
+ $maxHeight: i,
360
+ $bounded: c,
361
+ $scroll: Ce,
362
+ $thumbRadius: we,
363
+ $thumbBorder: Te,
364
+ $edge: v.edge,
365
+ $faint: v.faint,
366
+ children: /* @__PURE__ */ _(xe, {
367
+ ref: m,
368
+ $rubber: a,
369
+ children: [
370
+ /* @__PURE__ */ g("div", { style: { height: b } }),
371
+ y,
372
+ /* @__PURE__ */ g("div", { style: { height: x } })
373
+ ]
374
+ })
375
+ });
376
+ }, De = p.div`
377
+ width: 100%;
378
+ position: relative;
379
+ /* Rows carry NO background wash: the comparison is shown by ribbons and
380
+ word marks only. A tinted rectangle behind half the code is noise. */
381
+ ${({ $selected: e, theme: t }) => e === !0 ? `box-shadow: inset ${r.SelectionBarWidth}px 0 0 ${t.colors.sectionContent};` : ""}
382
+ `, Oe = p.div`
383
+ display: flex;
384
+ width: 100%;
385
+ min-width: ${({ $rubber: e }) => e ? "0" : "max-content"};
386
+ overflow: ${({ $rubber: e }) => e ? "hidden" : "visible"};
387
+ white-space: pre;
388
+ tab-size: ${({ $tabSize: e }) => e};
389
+ font-family: ${({ theme: e }) => e.font.family.text};
390
+ font-size: ${({ theme: e }) => e.font.sizes.regular};
391
+ line-height: ${({ $rowHeight: e }) => e}px;
392
+ padding-left: ${({ $indent: e }) => e * r.IndentSize}px;
393
+ `, ke = p.span`
394
+ position: sticky;
395
+ left: ${({ $mirrored: e }) => e ? "auto" : 0};
396
+ right: ${({ $mirrored: e }) => e ? 0 : "auto"};
397
+ flex: 0 0 ${({ $plate: e }) => e}px;
398
+ padding: 0 ${({ theme: e }) => e.offsets.elementContent};
399
+ text-align: right;
400
+ order: ${({ $mirrored: e }) => e ? 2 : 0};
401
+ background: ${({ theme: e }) => e.colors.overlay};
402
+ color: ${({ $faint: e }) => e};
403
+ z-index: ${({ $zPlate: e }) => e};
404
+ border-right: ${({ $mirrored: e, $edge: t, theme: n }) => e ? "0" : `${n.border.size} solid ${t}`};
405
+ border-left: ${({ $mirrored: e, $edge: t, theme: n }) => e ? `${n.border.size} solid ${t}` : "0"};
406
+ `, Ae = p.span`
407
+ display: inline-block;
408
+ position: relative;
409
+ flex: 1 1 auto;
410
+ min-width: 0;
411
+ padding: 0 ${({ theme: e }) => e.offsets.elementContent};
412
+ font-weight: ${({ $header: e, theme: t }) => e === !0 ? t.font.weight.title : t.font.weight.text};
413
+ text-shadow: ${({ theme: e }) => e.shadows.content};
414
+ ${({ $rubber: e }) => e ? "overflow: hidden; text-overflow: ellipsis; white-space: nowrap;" : ""}
415
+ `, je = p.span`
416
+ position: absolute;
417
+ top: 0;
418
+ width: 0;
419
+ height: 0;
420
+ `, Me = p.span`
421
+ position: absolute;
422
+ left: 0;
423
+ top: 0;
424
+ transform: ${({ $center: e }) => e};
425
+ z-index: ${({ $zBadge: e }) => e};
426
+ padding: 0 ${({ $pad: e }) => e}px;
427
+ border: ${({ theme: e }) => e.border.size} solid ${({ $edge: e }) => e};
428
+ border-radius: ${({ theme: e }) => e.border.radius};
429
+ background: ${({ theme: e }) => e.colors.overlay};
430
+ color: ${({ theme: e }) => e.colors.sectionContent};
431
+ font-weight: ${({ theme: e }) => e.font.weight.title};
432
+ font-size: calc(${({ theme: e }) => e.font.sizes.small} - 1px);
433
+ line-height: ${({ theme: e }) => e.font.sizes.large};
434
+ font-family: ${({ theme: e }) => e.font.family.text};
435
+ white-space: nowrap;
436
+ `, Ne = p.div`
437
+ padding: 0 ${({ theme: e }) => e.offsets.elementContent} ${({ theme: e }) => e.offsets.betweenElements} calc(${({ $plate: e }) => e}px + ${({ theme: e }) => e.offsets.elementContent});
438
+ font-style: italic;
439
+ font-size: ${({ theme: e }) => e.font.sizes.small};
440
+ line-height: ${({ $lineHeight: e }) => e}px;
441
+ font-family: ${({ theme: e }) => e.font.family.text};
442
+ color: ${({ $ink: e }) => e};
443
+ white-space: pre-wrap;
444
+ word-break: break-word;
445
+ `, Pe = p.button`
446
+ position: absolute;
447
+ top: ${({ theme: e }) => e.offsets.betweenElements};
448
+ left: ${({ theme: e }) => e.offsets.betweenElements};
449
+ width: ${({ $size: e }) => e}px;
450
+ height: ${({ $size: e }) => e}px;
451
+ padding: 0;
452
+ border: ${({ theme: e }) => e.border.size} solid ${({ $on: e, $edge: t, theme: n }) => e === !0 ? n.colors.sectionContent : t};
453
+ border-radius: ${({ theme: e }) => e.border.radius};
454
+ background: ${({ $on: e, theme: t }) => e === !0 ? t.colors.sectionContent : "transparent"};
455
+ color: ${({ $checkInk: e }) => e};
456
+ font-size: ${({ $fontSize: e }) => e}px;
457
+ line-height: ${({ $lineHeight: e }) => e};
458
+ font-family: ${({ theme: e }) => e.font.family.text};
459
+ cursor: pointer;
460
+ z-index: ${({ $zBadge: e }) => e};
461
+ `, Fe = p.div`
462
+ position: absolute;
463
+ top: 0;
464
+ /* The action lives in the NUMBER GUTTER of its own row — it never covers
465
+ code, neither its own line nor the neighbour's. */
466
+ left: ${({ $mirrored: e, theme: t }) => e ? "auto" : t.offsets.betweenElements};
467
+ right: ${({ $mirrored: e, theme: t }) => e ? t.offsets.betweenElements : "auto"};
468
+ z-index: ${({ $zAbove: e }) => e};
469
+ display: inline-flex;
470
+ gap: ${({ theme: e }) => e.offsets.betweenElements};
471
+ `, Ie = p.span`
472
+ position: absolute;
473
+ top: 0;
474
+ right: 0;
475
+ display: inline-flex;
476
+ align-items: center;
477
+ gap: ${({ theme: e }) => e.offsets.betweenElements};
478
+ height: 100%;
479
+ padding: 0 ${({ theme: e }) => e.offsets.betweenElements};
480
+ z-index: ${({ $zBadge: e }) => e};
481
+ `, Le = p.span`
482
+ background: ${({ $paint: e, theme: t }) => e ?? t.colors.highlighted};
483
+ border-radius: calc(${({ theme: e }) => e.border.radius} - 1px);
484
+ text-decoration: underline;
485
+ box-decoration-break: clone;
486
+ text-shadow: ${({ theme: e }) => e.shadows.content};
487
+ ${({ $strong: e, theme: t }) => e === !0 ? `outline: ${t.border.size} solid currentColor;` : ""}
488
+ `;
489
+ // default/data-display/CodeDiff/rows/text.tsx
490
+ function Re({ spans: e, paint: t }) {
491
+ return /* @__PURE__ */ g(h, { children: e.map((e, n) => {
492
+ let r = e.ink === void 0 ? void 0 : { color: e.ink };
493
+ return e.paint === !0 ? /* @__PURE__ */ g(Le, {
494
+ $strong: e.strong === !0,
495
+ ...t === void 0 ? {} : { $paint: t },
496
+ style: r,
497
+ children: e.text
498
+ }, n) : /* @__PURE__ */ g("span", {
499
+ style: r,
500
+ children: e.text
501
+ }, n);
502
+ }) });
503
+ }
504
+ // default/data-display/CodeDiff/rows/index.tsx
505
+ var M = r.PlateWidth, ze = r.CounterBadgePadding, Be = r.ExplanationLineHeight, Ve = r.SelectSize, He = r.SelectFontSize, Ue = r.SelectLineHeight, We = r.TabSize, Ge = "translate(-50%, -50%)", Ke = ({ row: e, spans: t, paint: n, mirrored: r, rubber: i, rowHeight: a }) => {
506
+ let { chrome: o } = O();
507
+ return /* @__PURE__ */ _(Oe, {
508
+ $rubber: i,
509
+ $rowHeight: a,
510
+ $mirrored: r,
511
+ $indent: e.indent ?? 0,
512
+ $tabSize: We,
513
+ "data-anchor": String(e.id),
514
+ children: [e.plate === void 0 ? null : /* @__PURE__ */ g(ke, {
515
+ $mirrored: r,
516
+ $plate: M,
517
+ $faint: o.faint,
518
+ $edge: o.edge,
519
+ $zPlate: o.zPlate,
520
+ "data-plate": !0,
521
+ children: e.plate
522
+ }), /* @__PURE__ */ _(Ae, {
523
+ $rubber: i,
524
+ $header: e.groupHeader === !0,
525
+ children: [/* @__PURE__ */ g(Re, {
526
+ spans: t,
527
+ ...n === void 0 ? {} : { paint: n }
528
+ }), (e.counters ?? []).map((e, t) => /* @__PURE__ */ g(je, {
529
+ style: { left: `${e.from}ch` },
530
+ children: /* @__PURE__ */ g(Me, {
531
+ title: e.title,
532
+ $pad: ze,
533
+ $edge: o.edge,
534
+ $zBadge: o.zBadge,
535
+ $center: Ge,
536
+ children: e.text
537
+ })
538
+ }, t))]
539
+ })]
540
+ });
541
+ }, qe = ({ row: e, spans: t, paint: n, explanationInk: r, mirrored: i, rubber: a, rowHeight: o, selected: s, onToggleSelect: c, aboveActions: l, insideActions: u, renderCustom: d }) => {
542
+ let { chrome: f, theme: p } = O(), m = r ?? f.dim;
543
+ return /* @__PURE__ */ _(De, {
544
+ "data-item": String(e.id),
545
+ "data-actions-host": !0,
546
+ $selected: s,
547
+ children: [
548
+ c === void 0 ? null : /* @__PURE__ */ g(Pe, {
549
+ type: "button",
550
+ $on: s === !0,
551
+ $size: Ve,
552
+ $fontSize: He,
553
+ $lineHeight: Ue,
554
+ $edge: f.edge,
555
+ $zBadge: f.zBadge,
556
+ $checkInk: p.colors.section,
557
+ "data-action": "select",
558
+ title: s === !0 ? "deselect row" : "select row",
559
+ onClick: (e) => {
560
+ e.stopPropagation(), c();
561
+ },
562
+ children: s === !0 ? "✓" : ""
563
+ }),
564
+ l === void 0 ? null : /* @__PURE__ */ g(Fe, {
565
+ $mirrored: i,
566
+ $zAbove: f.zAbove,
567
+ children: l
568
+ }),
569
+ d ?? /* @__PURE__ */ g(Ke, {
570
+ row: e,
571
+ spans: t,
572
+ paint: n,
573
+ mirrored: i,
574
+ rubber: a,
575
+ rowHeight: o
576
+ }),
577
+ e.explanation === void 0 ? null : /* @__PURE__ */ g(Ne, {
578
+ $lineHeight: Be,
579
+ $plate: M,
580
+ $ink: m,
581
+ children: e.explanation.text
582
+ }),
583
+ u === void 0 ? null : /* @__PURE__ */ g(Ie, {
584
+ $zBadge: f.zBadge,
585
+ children: u
586
+ })
587
+ ]
588
+ });
589
+ }, Je = (e, t) => {
590
+ let n = null;
591
+ for (let r of e) if (!(t < r.from || t >= r.to)) {
592
+ if (r.strong === !0) return r;
593
+ n === null && (n = r);
594
+ }
595
+ return n;
596
+ }, Ye = (e, t, n) => {
597
+ let r = [], i = 0, a = "", o, s = !1, c = !1, l = () => {
598
+ if (a === "") return;
599
+ let e = { text: a };
600
+ s && (e.paint = !0), c && (e.strong = !0), o !== void 0 && (e.ink = o), r.push(e), a = "";
601
+ }, u = t.length > 0 ? t : [{ text: e }];
602
+ for (let e of u) for (let t of e.text) {
603
+ let r = Je(n, i), u = r?.ink ?? e.ink, d = r !== null, f = r?.strong === !0;
604
+ (u !== o || d !== s || f !== c) && (l(), o = u, s = d, c = f), a += t, i += 1;
605
+ }
606
+ return l(), r;
607
+ }, Xe = (e, t, n, r) => {
608
+ if (e.spans !== void 0) return e.spans;
609
+ if (e.text === void 0) return [{ text: String(e.id) }];
610
+ let i = n.length === 0 ? e.marks ?? [] : [...e.marks ?? [], ...n], a = r?.(e.text, t.id) ?? [{ text: e.text }];
611
+ return Ye(e.text, a, i);
612
+ }, Ze = ({ row: e, column: t, focus: n, theme: r, tones: i, tokenize: a }) => {
613
+ let o = (e) => r.colors.status?.[i[e] ?? e], s = e.explanation?.tone ?? e.tone;
614
+ return {
615
+ spans: Xe(e, t, n, a),
616
+ paint: e.tone === void 0 ? void 0 : o(e.tone)?.paint ?? r.colors.highlighted,
617
+ explanationInk: s === void 0 ? void 0 : o(s)?.content
618
+ };
619
+ }, Qe = (e, t, n, r) => {
620
+ if (e.disabled?.(t) === !0) return;
621
+ e.onClick?.(t);
622
+ let i = {
623
+ ...t,
624
+ actionId: e.id
625
+ };
626
+ r(n === "row" ? "row:action" : n === "column" ? "column:action" : "ribbon:action", i);
627
+ }, $e = ({ actions: e, entity: t, placement: n, params: r, emit: i }) => {
628
+ let a = Array.isArray(n) ? n : [n], o = {
629
+ entity: t,
630
+ ...r
631
+ };
632
+ return {
633
+ visible: e.filter((e) => e.entity === t && a.includes(e.placement) && e.hidden?.(o) !== !0),
634
+ isDisabled: (e) => e.disabled?.(o) === !0,
635
+ run: (e) => Qe(e, o, t, i)
636
+ };
637
+ }, et = (e) => u(() => $e(e), [
638
+ e.actions,
639
+ e.entity,
640
+ e.placement,
641
+ e.params,
642
+ e.emit
643
+ ]), tt = p.span`
644
+ font-family: ${({ theme: e }) => e.font.family.text};
645
+ font-size: ${({ $size: e }) => e ?? n.TypographySize}px;
646
+ color: ${({ $ink: e, theme: t }) => e ?? t.colors.sectionContent};
647
+ `, nt = p.button`
648
+ padding: ${({ $padY: e }) => e}px ${({ $padX: e }) => e}px;
649
+ border-radius: ${({ $radius: e }) => e}px;
650
+ border: ${({ theme: e }) => e.border.size} solid ${({ $on: e, $edge: t, theme: n }) => e === !0 ? n.colors.sectionContent : t};
651
+ background: ${({ $on: e, theme: t }) => e === !0 ? t.colors.overlay : "transparent"};
652
+ color: ${({ $ink: e }) => e};
653
+ font-size: ${({ theme: e }) => e.font.sizes.small};
654
+ line-height: ${({ $lineHeight: e }) => e}px;
655
+ font-family: ${({ theme: e }) => e.font.family.text};
656
+ cursor: pointer;
657
+ &:hover { border-color: ${({ theme: e }) => e.colors.sectionContent}; }
658
+ `, rt = p.div`
659
+ display: flex;
660
+ flex-wrap: wrap;
661
+ align-items: center;
662
+ gap: ${({ $gap: e }) => e}px;
663
+ padding: ${({ $padY: e }) => e}px ${({ $padX: e }) => e}px;
664
+ border-bottom: ${({ theme: e }) => e.border.size} solid ${({ $edge: e }) => e};
665
+ background: ${({ theme: e }) => e.colors.overlay};
666
+ font-family: ${({ theme: e }) => e.font.family.text};
667
+ font-size: ${({ theme: e }) => e.font.sizes.large};
668
+ `, it = p.div`
669
+ display: flex;
670
+ flex-wrap: wrap;
671
+ gap: ${({ $gap: e }) => e}px;
672
+ align-items: center;
673
+ padding: ${({ $padY: e }) => e}px ${({ $padX: e }) => e}px;
674
+ border-bottom: ${({ theme: e }) => e.border.size} solid ${({ $edge: e }) => e};
675
+ background: ${({ theme: e }) => e.colors.overlay};
676
+ font-size: ${({ theme: e }) => e.font.sizes.large};
677
+ font-family: ${({ theme: e }) => e.font.family.text};
678
+ color: ${({ $ink: e }) => e};
679
+ `, at = p.span`
680
+ width: ${({ $size: e }) => e}px;
681
+ height: ${({ $size: e }) => e}px;
682
+ border-radius: 50%;
683
+ background: ${({ $c: e }) => e};
684
+ display: inline-block;
685
+ margin-right: ${({ $margin: e }) => e}px;
686
+ `, ot = p.button`
687
+ display: inline-flex;
688
+ align-items: center;
689
+ justify-content: center;
690
+ min-width: ${({ $minWidth: e }) => e}px;
691
+ height: ${({ $height: e }) => e}px;
692
+ padding: 0 ${({ $padX: e }) => e}px;
693
+ border: ${({ theme: e }) => e.border.size} solid ${({ $edge: e }) => e};
694
+ border-radius: ${({ theme: e }) => e.border.radius};
695
+ background: ${({ theme: e }) => e.colors.overlay};
696
+ color: ${({ theme: e }) => e.colors.sectionContent};
697
+ font-size: ${({ $fontSize: e }) => e}px;
698
+ line-height: ${({ $lineHeight: e }) => e};
699
+ font-family: ${({ theme: e }) => e.font.family.text};
700
+ cursor: pointer;
701
+ &:hover { background: ${({ $edge: e }) => e}; }
702
+ &:disabled { ${({ theme: e }) => e.effects.interaction.disabled} }
703
+ `, st = p.button`
704
+ display: inline-flex;
705
+ align-items: center;
706
+ justify-content: center;
707
+ width: ${({ $size: e }) => e}px;
708
+ height: ${({ $size: e }) => e}px;
709
+ padding: 0;
710
+ border: 0;
711
+ border-radius: ${({ theme: e }) => e.border.radius};
712
+ background: transparent;
713
+ color: ${({ $ink: e }) => e};
714
+ font-size: ${({ $fontSize: e }) => e}px;
715
+ line-height: ${({ $lineHeight: e }) => e};
716
+ font-family: ${({ theme: e }) => e.font.family.text};
717
+ cursor: pointer;
718
+ opacity: ${({ $opacity: e }) => e};
719
+ transition: opacity ${n.TextButtonFadeMs}ms ease;
720
+ /* The label is tooltip-only: a wide text chip in the gutter would spill
721
+ over the code it is supposed to leave alone. */
722
+ & > span { display: none; }
723
+ &:hover { color: ${({ theme: e }) => e.colors.sectionContent}; background: ${({ $edge: e }) => e}; }
724
+ [data-actions-host]:hover & { opacity: ${({ $revealed: e }) => e}; }
725
+ &:disabled { ${({ theme: e }) => e.effects.interaction.disabled} }
726
+ `, ct = 18, lt = 16, ut = 3, dt = 10, N = 1, ft = 16, pt = 0, P = 1, F = ({ actions: e, entity: t, placement: n, params: r, emit: i }) => {
727
+ let { visible: a, run: o, isDisabled: s } = et({
728
+ actions: e,
729
+ entity: t,
730
+ placement: n,
731
+ params: r,
732
+ emit: i
733
+ }), { chrome: c } = O();
734
+ return a.length === 0 ? null : /* @__PURE__ */ g(h, { children: a.map((e) => {
735
+ let t = s(e), n = e.hover ?? e.placement === "above";
736
+ return (e.variant ?? (e.placement === "above" ? "text" : "icon")) === "text" ? /* @__PURE__ */ _(st, {
737
+ type: "button",
738
+ $opacity: n ? pt : P,
739
+ $revealed: P,
740
+ $size: ft,
741
+ $fontSize: dt,
742
+ $lineHeight: N,
743
+ $edge: c.edge,
744
+ $ink: c.dim,
745
+ "data-action": e.id,
746
+ title: e.label,
747
+ disabled: t,
748
+ onClick: (t) => {
749
+ t.stopPropagation(), o(e);
750
+ },
751
+ children: [e.icon ?? e.label.slice(0, 1), /* @__PURE__ */ g("span", { children: e.label })]
752
+ }, e.id) : /* @__PURE__ */ g(ot, {
753
+ type: "button",
754
+ $minWidth: ct,
755
+ $height: lt,
756
+ $padX: ut,
757
+ $fontSize: dt,
758
+ $lineHeight: N,
759
+ $edge: c.edge,
760
+ "data-action": e.id,
761
+ title: e.label,
762
+ disabled: t,
763
+ onClick: (t) => {
764
+ t.stopPropagation(), o(e);
765
+ },
766
+ children: e.icon ?? e.label.slice(0, 1)
767
+ }, e.id);
768
+ }) });
769
+ }, mt = (e, t, n, r) => {
770
+ if (t === null) return [];
771
+ let i = e.find((e) => e.id === t), a = [], o = (e) => [e, e.duplicate];
772
+ for (let e of i?.anchors ?? []) for (let t of o(e)) t !== void 0 && t.column === n && String(t.line) === r && a.push({
773
+ from: t.from,
774
+ to: t.to,
775
+ strong: !0
776
+ });
777
+ return a;
778
+ }, ht = (e, t) => e && t.length > 0 ? t : void 0, gt = ({ column: e, row: t, index: n, rubber: r, focus: i, hotRibbon: a, selected: o }) => {
779
+ let { config: s, theme: c, tones: l, state: u, emit: d, props: f } = O(), p = {
780
+ column: e.id,
781
+ row: t.id
782
+ }, m = Ze({
783
+ row: t,
784
+ column: e,
785
+ focus: i.length > 0 ? i : mt(f.ribbons ?? [], a, e.id, String(t.id)),
786
+ theme: c,
787
+ tones: l,
788
+ tokenize: f.tokenize
789
+ }), h = {
790
+ row: p,
791
+ selected: u.state.selected
792
+ }, _ = f.renderRow?.({
793
+ row: t,
794
+ column: e,
795
+ index: n,
796
+ mirrored: e.mirrored === !0
797
+ }), v = s.selectable ? { onToggleSelect: () => u.toggleSelect(p) } : {}, y = ht(r, t.text ?? m.spans.map((e) => e.text).join(""));
798
+ return /* @__PURE__ */ g("div", {
799
+ "data-row-host": !0,
800
+ title: y,
801
+ onPointerEnter: () => d("row:mouseEnter", { row: p }),
802
+ onPointerLeave: () => d("row:mouseLeave", { row: null }),
803
+ children: /* @__PURE__ */ g(qe, {
804
+ row: t,
805
+ spans: m.spans,
806
+ paint: m.paint,
807
+ explanationInk: m.explanationInk,
808
+ mirrored: e.mirrored === !0,
809
+ rubber: r,
810
+ rowHeight: s.rowHeight,
811
+ selected: o,
812
+ ...v,
813
+ aboveActions: /* @__PURE__ */ g(F, {
814
+ actions: f.actions ?? [],
815
+ entity: "row",
816
+ placement: "above",
817
+ params: h,
818
+ emit: d
819
+ }),
820
+ insideActions: /* @__PURE__ */ g(F, {
821
+ actions: f.actions ?? [],
822
+ entity: "row",
823
+ placement: ["inside-start", "inside-end"],
824
+ params: h,
825
+ emit: d
826
+ }),
827
+ ..._ === void 0 ? {} : { renderCustom: _ }
828
+ })
829
+ }, String(t.id));
830
+ }, _t = ({ slot: e, columnId: t }) => {
831
+ let { config: n, state: r, emit: i, chrome: a } = O();
832
+ return /* @__PURE__ */ _(ve, {
833
+ type: "button",
834
+ $rowHeight: n.rowHeight,
835
+ $edge: a.edge,
836
+ $faint: a.faint,
837
+ "data-fold": !0,
838
+ onClick: () => {
839
+ r.setRevealed(!0), i("row:show", { rows: e.ids.map((e) => ({
840
+ column: t,
841
+ row: e
842
+ })) });
843
+ },
844
+ children: [e.ids.map((e) => /* @__PURE__ */ g("span", {
845
+ "data-anchor": String(e),
846
+ style: {
847
+ position: "absolute",
848
+ width: 0,
849
+ height: 0,
850
+ overflow: "hidden"
851
+ }
852
+ }, String(e))), /* @__PURE__ */ g(ye, { children: n.foldLabel(e.count) })]
853
+ });
854
+ }, vt = ({ column: e, connected: t, highlights: n, hotRibbon: r, onLayout: i }) => {
855
+ let { config: a, state: o, props: s } = O(), c = (e.fit ?? s.fit) === "rubber", l = ae(e, t, o.state.revealed, a.foldUnconnected), u = new Set(o.state.selected.filter((t) => t.column === e.id).map((e) => String(e.row)));
856
+ return /* @__PURE__ */ g(Ee, {
857
+ count: l.length,
858
+ rowHeight: a.rowHeight,
859
+ overscan: a.overscan,
860
+ fullMount: a.fullMount,
861
+ maxHeight: a.maxHeight,
862
+ rubber: c,
863
+ cap: e.cap === !0,
864
+ bounded: a.boardHeight !== void 0,
865
+ renderRow: (t) => {
866
+ let i = l[t];
867
+ return i === void 0 ? null : i.kind === "fold" ? /* @__PURE__ */ g(_t, {
868
+ slot: i,
869
+ columnId: e.id
870
+ }) : /* @__PURE__ */ g(gt, {
871
+ column: e,
872
+ row: i.row,
873
+ index: i.index,
874
+ rubber: c,
875
+ focus: n?.get(String(i.row.id)) ?? [],
876
+ hotRibbon: r,
877
+ selected: u.has(String(i.row.id))
878
+ });
879
+ },
880
+ onWindow: i
881
+ });
882
+ }, yt = p.div`
883
+ position: absolute;
884
+ left: ${({ $x: e }) => e}px;
885
+ top: ${({ $y: e }) => e}px;
886
+ transform: ${({ $center: e }) => e};
887
+ z-index: ${({ $zBadge: e }) => e};
888
+ display: inline-flex;
889
+ align-items: center;
890
+ gap: ${({ theme: e }) => e.offsets.betweenElements};
891
+ pointer-events: auto;
892
+ `, bt = "translate(-50%, -50%)", xt = ({ connector: e, originX: t = 0, children: n }) => {
893
+ let { chrome: r } = O();
894
+ return /* @__PURE__ */ g(yt, {
895
+ $x: e.cx - t,
896
+ $y: e.cy,
897
+ $zBadge: r.zBadge,
898
+ $center: bt,
899
+ "data-connector-actions": `${e.from}->${e.to}`,
900
+ children: n
901
+ });
902
+ }, St = ({ props: e, connected: t, highlights: n, hotRibbon: r, geometry: i, layout: a, onLayout: o }) => {
903
+ let { config: s, state: c, emit: l, chrome: u } = O(), d = e.actions ?? [], f = d.filter((e) => e.entity === "ribbon" && e.placement === "connector"), p = (t) => e.columns.findIndex((e) => e.id === t);
904
+ return /* @__PURE__ */ g(h, { children: e.columns.map((m, h) => {
905
+ let v = e.renderers?.[m.id], y = e.corridors?.[h];
906
+ return /* @__PURE__ */ _("div", {
907
+ style: { display: "contents" },
908
+ children: [/* @__PURE__ */ g(te, {
909
+ "data-column": m.id,
910
+ $cap: m.cap === !0,
911
+ $bounded: s.boardHeight !== void 0,
912
+ $zPlate: u.zPlate,
913
+ children: v === void 0 ? /* @__PURE__ */ g(vt, {
914
+ column: m,
915
+ connected: t.get(m.id),
916
+ highlights: n.get(m.id),
917
+ hotRibbon: r,
918
+ onLayout: o
919
+ }) : /* @__PURE__ */ g(v, { column: m })
920
+ }), y === void 0 ? null : /* @__PURE__ */ g(ne, {
921
+ "data-corridor": h,
922
+ children: f.length === 0 ? null : i.measured.flatMap(({ ribbon: e, shape: t }) => t.connectors.filter((e) => p(e.from) === h).map((t) => /* @__PURE__ */ g(xt, {
923
+ connector: t,
924
+ originX: a?.columns.get(m.id)?.left ?? 0,
925
+ children: /* @__PURE__ */ g(F, {
926
+ actions: d,
927
+ entity: "ribbon",
928
+ placement: "connector",
929
+ params: {
930
+ ribbon: e,
931
+ selected: c.state.selected
932
+ },
933
+ emit: l
934
+ })
935
+ }, `${e.id}-${t.from}-${t.to}`)))
936
+ })]
937
+ }, m.id);
938
+ }) });
939
+ }, Ct = p.svg`
940
+ position: absolute;
941
+ inset: 0;
942
+ width: 100%;
943
+ height: 100%;
944
+ z-index: ${({ $zSurface: e }) => e};
945
+ overflow: hidden;
946
+ pointer-events: none;
947
+ & [data-ribbon] { cursor: pointer; }
948
+ & [data-ribbon] path { pointer-events: auto; }
949
+ & text { pointer-events: auto; cursor: default; }
950
+ `, wt = o(({ children: e, ...t }, n) => {
951
+ let { chrome: r } = O();
952
+ return /* @__PURE__ */ g(Ct, {
953
+ ref: n,
954
+ $zSurface: r.zSurface,
955
+ ...t,
956
+ children: e
957
+ });
958
+ });
959
+ wt.displayName = "Surface";
960
+ // default/data-display/CodeDiff/surface/types.ts
961
+ var I = (e, t) => `${e}::${t}`, Tt = (e) => {
962
+ let t = e.indexOf("::");
963
+ return t < 0 ? {
964
+ column: "",
965
+ id: e
966
+ } : {
967
+ column: e.slice(0, t),
968
+ id: e.slice(t + 2)
969
+ };
970
+ }, Et = (e, t) => e === void 0 ? t : {
971
+ top: Math.min(e.top, t.top),
972
+ bottom: Math.max(e.bottom, t.bottom),
973
+ left: Math.min(e.left, t.left),
974
+ right: Math.max(e.right, t.right)
975
+ }, Dt = (e, t) => {
976
+ let n = e.getBoundingClientRect(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map();
977
+ for (let a of e.querySelectorAll("[data-column]")) {
978
+ let e = a.getAttribute("data-column") ?? "", o = a.getBoundingClientRect();
979
+ r.set(e, {
980
+ top: o.top - n.top,
981
+ bottom: o.bottom - n.top,
982
+ left: o.left - n.left,
983
+ right: o.right - n.left
984
+ });
985
+ let s = a.firstElementChild instanceof HTMLElement ? a.firstElementChild : null, c = s === null ? 0 : s.scrollTop;
986
+ for (let r of a.querySelectorAll("[data-anchor]")) {
987
+ let a = r.getAttribute("data-anchor");
988
+ if (!a) continue;
989
+ let s = r.getBoundingClientRect(), l = {
990
+ top: s.top - o.top + c + t,
991
+ bottom: s.bottom - o.top + c - t,
992
+ left: s.left - n.left,
993
+ right: s.right - n.left
994
+ };
995
+ i.set(I(e, a), Et(i.get(I(e, a)), l));
996
+ }
997
+ }
998
+ return {
999
+ columns: r,
1000
+ anchors: i
1001
+ };
1002
+ }, Ot = (e) => {
1003
+ let t = /* @__PURE__ */ new Map();
1004
+ for (let n of e.querySelectorAll("[data-column]")) {
1005
+ let e = n.getAttribute("data-column") ?? "", r = n.firstElementChild instanceof HTMLElement ? n.firstElementChild : null;
1006
+ t.set(e, r === null ? 0 : r.scrollTop);
1007
+ }
1008
+ return t;
1009
+ }, L = (e, t) => (n, r) => {
1010
+ let i = e?.anchors.get(I(n, r));
1011
+ if (i === void 0) return null;
1012
+ let a = t.get(n) ?? 0;
1013
+ return {
1014
+ top: i.top - a,
1015
+ bottom: i.bottom - a,
1016
+ left: i.left,
1017
+ right: i.right
1018
+ };
1019
+ }, R = (e, t) => e?.columns.get(t) ?? null, kt = (e, t) => {
1020
+ if (e === null) return [];
1021
+ let n = L(e, t), r = [];
1022
+ for (let t of e.anchors.keys()) {
1023
+ let { column: e, id: i } = Tt(t), a = n(e, i);
1024
+ a !== null && a.bottom - a.top > .5 && r.push(a);
1025
+ }
1026
+ return r;
1027
+ }, At = (e) => [...e.columns.entries()].map(([e, t]) => `${e}:${t.top.toFixed(1)},${t.bottom.toFixed(1)},${t.left.toFixed(1)},${t.right.toFixed(1)}`).join("|") + "#" + [...e.anchors.entries()].map(([e, t]) => `${e}:${t.top.toFixed(1)},${t.bottom.toFixed(1)}`).join("|"), jt = (e, t) => {
1028
+ fe({
1029
+ next: At(e),
1030
+ last: t.lastKey,
1031
+ same: (e, t) => e === t,
1032
+ commit: () => {
1033
+ t.setLayout(e), t.bump();
1034
+ }
1035
+ });
1036
+ }, Mt = (e, t) => {
1037
+ let [n, r] = f(null), [i, a] = f(0), o = d(""), c = s(() => a((e) => e + 1), []);
1038
+ return {
1039
+ layout: n,
1040
+ revision: i,
1041
+ measure: s(() => {
1042
+ e.current !== null && jt(Dt(e.current, t), {
1043
+ lastKey: o,
1044
+ setLayout: r,
1045
+ bump: c
1046
+ });
1047
+ }, [
1048
+ e,
1049
+ t,
1050
+ c
1051
+ ])
1052
+ };
1053
+ }, Nt = (e) => {
1054
+ let t = requestAnimationFrame(() => e()), n = setTimeout(() => e(), 80);
1055
+ return () => {
1056
+ cancelAnimationFrame(t), clearTimeout(n);
1057
+ };
1058
+ }, Pt = (e, t, n) => {
1059
+ let r = Mt(e, t);
1060
+ return A({
1061
+ root: e,
1062
+ selector: "[data-column]",
1063
+ onChange: r.measure
1064
+ }), l(() => {
1065
+ if (e.current !== null) return r.measure(), Nt(r.measure);
1066
+ }, [
1067
+ e,
1068
+ r.measure,
1069
+ n
1070
+ ]), r;
1071
+ }, Ft = (e, t) => {
1072
+ let n = e.querySelector(`[data-column="${CSS.escape(t)}"]`)?.firstElementChild;
1073
+ return n instanceof HTMLElement ? n : null;
1074
+ }, It = (e) => {
1075
+ let t = e.axis ?? "xy", n = [];
1076
+ return t.includes("y") && n.push("scrollTop"), t.includes("x") && n.push("scrollLeft"), n;
1077
+ }, Lt = (e, t) => {
1078
+ let n = !1, r = [];
1079
+ for (let i of e) {
1080
+ let a = () => {
1081
+ if (!n) {
1082
+ n = !0;
1083
+ for (let n of e) n !== i && (n[t] = i[t]);
1084
+ requestAnimationFrame(() => {
1085
+ n = !1;
1086
+ });
1087
+ }
1088
+ };
1089
+ i.addEventListener("scroll", a), r.push(() => i.removeEventListener("scroll", a));
1090
+ }
1091
+ return () => r.forEach((e) => e());
1092
+ }, Rt = (e, t) => {
1093
+ let n = [];
1094
+ for (let r of t) {
1095
+ let t = r.columns.map((t) => Ft(e, t)).filter((e) => e !== null);
1096
+ if (!(t.length < 2)) for (let e of It(r)) n.push(Lt(t, e));
1097
+ }
1098
+ return () => n.forEach((e) => e());
1099
+ }, zt = (e, t) => {
1100
+ l(() => {
1101
+ let n = e.current;
1102
+ if (!n) return;
1103
+ let r = 0, i = () => {
1104
+ r === 0 && (r = requestAnimationFrame(() => {
1105
+ r = 0, t();
1106
+ }));
1107
+ };
1108
+ return n.addEventListener("scroll", i, {
1109
+ passive: !0,
1110
+ capture: !0
1111
+ }), () => {
1112
+ n.removeEventListener("scroll", i, { capture: !0 }), r !== 0 && cancelAnimationFrame(r);
1113
+ };
1114
+ }, [e, t]);
1115
+ }, Bt = (e, t) => {
1116
+ l(() => {
1117
+ let n = e.current;
1118
+ if (n !== null) return Rt(n, t);
1119
+ }, [e, t]);
1120
+ }, Vt = (e, t) => {
1121
+ let n = null;
1122
+ for (let r of e.ends ?? []) for (let e of r.rows ?? []) {
1123
+ let i = t.get(`${r.column}::${String(e)}`);
1124
+ if (i !== void 0) {
1125
+ if (n !== null && n !== i) return null;
1126
+ n = i;
1127
+ }
1128
+ }
1129
+ return n;
1130
+ }, Ht = (e, t, n) => {
1131
+ let r = t[n] ?? n, i = e.colors.status?.[r], a = e.colors.status?.ribbon?.background ?? "transparent";
1132
+ if (i === void 0) return {
1133
+ fill: a,
1134
+ hot: a,
1135
+ paint: e.colors.highlighted
1136
+ };
1137
+ let o = i.background;
1138
+ return {
1139
+ fill: o,
1140
+ hot: i.hot ?? i.content ?? o,
1141
+ text: i.content,
1142
+ paint: i.paint ?? e.colors.highlighted
1143
+ };
1144
+ }, Ut = (e, t, n, r) => {
1145
+ let i = u(() => {
1146
+ let e = /* @__PURE__ */ new Map();
1147
+ for (let n of t) for (let t of n.rows ?? []) t.tone !== void 0 && e.set(`${n.id}::${String(t.id)}`, t.tone);
1148
+ return e;
1149
+ }, [t]);
1150
+ return u(() => {
1151
+ let e = (e) => Vt(e, i) ?? e.tone ?? "duplicate", t = (e) => Ht(n, r, e);
1152
+ return {
1153
+ toneOf: e,
1154
+ colorOfKey: t,
1155
+ fillOf: (n) => t(e(n)).fill,
1156
+ hotOf: (n) => t(e(n)).hot
1157
+ };
1158
+ }, [
1159
+ e,
1160
+ i,
1161
+ n,
1162
+ r
1163
+ ]);
1164
+ }, Wt = (e, t) => `${e}::${String(t)}`, Gt = (e, t, n, r) => {
1165
+ let i = null, a = Infinity;
1166
+ for (let o of e) for (let e of o.anchors ?? []) {
1167
+ if (e.column !== t.column || String(e.line) !== r || e.from > n || n >= e.to) continue;
1168
+ let s = e.to - e.from;
1169
+ s < a && (a = s, i = o);
1170
+ }
1171
+ return i;
1172
+ }, Kt = (e) => u(() => {
1173
+ let t = (e) => {
1174
+ let t = /* @__PURE__ */ new Set();
1175
+ for (let n of e.ends ?? []) for (let e of n.rows ?? []) t.add(Wt(n.column, e));
1176
+ let n = [];
1177
+ for (let t of e.anchors ?? []) n.push(t), t.duplicate !== void 0 && n.push({ ...t.duplicate });
1178
+ return {
1179
+ ribbon: e,
1180
+ rows: t,
1181
+ anchors: n
1182
+ };
1183
+ }, n = new Map(e.map((e) => [e.id, e]));
1184
+ return {
1185
+ chainOfRibbon: (e) => {
1186
+ let r = n.get(e);
1187
+ return r === void 0 ? null : t(r);
1188
+ },
1189
+ chainOfRow: (n) => {
1190
+ let r = null, i = Infinity;
1191
+ for (let t of e) {
1192
+ if (!(t.ends ?? []).some((e) => e.column === n.column && (e.rows ?? []).some((e) => String(e) === String(n.row)))) continue;
1193
+ let e = (t.ends ?? []).reduce((e, t) => e + (t.rows ?? []).length, 0);
1194
+ e < i && (i = e, r = t);
1195
+ }
1196
+ return r === null ? null : t(r);
1197
+ },
1198
+ chainOfWord: (n, r, i) => {
1199
+ let a = Gt(e, n, r, i ?? String(n.row));
1200
+ return a === null ? null : t(a);
1201
+ }
1202
+ };
1203
+ }, [e]), z = (e) => Math.round(e * 10) / 10, qt = e.PlateauHalf, B = (e) => (e.top + e.bottom) / 2, V = ({ a: e, b: t, ax: n, bx: r, thickness: i, shift: a = 0, center: o }) => {
1204
+ let s = z((n + r) / 2), c = z(i / 2);
1205
+ return {
1206
+ midX: s,
1207
+ nodeY: z((o ?? (B(e) + B(t)) / 2) + a),
1208
+ half: c,
1209
+ plateau: z(Math.abs(r - n) * qt)
1210
+ };
1211
+ }, Jt = ({ a: t, b: n, ax: r, bx: i, al: a, br: o }, s) => {
1212
+ let { midX: c, nodeY: l, half: u, plateau: d } = s, f = z(c - d), p = z(c + d), m = (f - r) * e.RunFraction, h = (i - p) * e.RunFraction, g = z(l - u), _ = z(l + u), v = z(a ?? r), y = z(o ?? i);
1213
+ return [
1214
+ `M ${v} ${z(t.top)}`,
1215
+ `L ${z(r)} ${z(t.top)}`,
1216
+ `C ${z(r + m)} ${z(t.top)} ${z(f - m)} ${g} ${f} ${g}`,
1217
+ `L ${p} ${g}`,
1218
+ `C ${z(p + h)} ${g} ${z(i - h)} ${z(n.top)} ${z(i)} ${z(n.top)}`,
1219
+ `L ${y} ${z(n.top)}`,
1220
+ `L ${y} ${z(n.bottom)}`,
1221
+ `L ${z(i)} ${z(n.bottom)}`,
1222
+ `C ${z(i - h)} ${z(n.bottom)} ${z(p + h)} ${_} ${p} ${_}`,
1223
+ `L ${f} ${_}`,
1224
+ `C ${z(f - m)} ${_} ${z(r + m)} ${z(t.bottom)} ${z(r)} ${z(t.bottom)}`,
1225
+ `L ${v} ${z(t.bottom)}`,
1226
+ "Z"
1227
+ ].join(" ");
1228
+ }, H = (e) => Math.round(e * 10) / 10, U = e.LabelThickness;
1229
+ e.LabeledFloor;
1230
+ var Yt = e.RedThickness, Xt = e.GapThickness, Zt = e.Adjacent, W = e.GapHalf, Qt = e.CharWidth, $t = e.CaptionBaseline, en = (e, t, n) => t && e === null ? Xt : Math.min(e === null ? Yt : U, n), tn = (e) => {
1231
+ let t = [...e].sort((e, t) => e.box.top - t.box.top), n = [];
1232
+ for (let { id: e, box: r } of t) {
1233
+ let t = n[n.length - 1];
1234
+ if (t !== void 0 && r.top <= t.box.bottom + Zt) {
1235
+ let i = {
1236
+ top: Math.min(t.box.top, r.top),
1237
+ bottom: Math.max(t.box.bottom, r.bottom),
1238
+ left: Math.min(t.box.left, r.left),
1239
+ right: Math.max(t.box.right, r.right)
1240
+ };
1241
+ n[n.length - 1] = {
1242
+ box: i,
1243
+ rows: [...t.rows, e]
1244
+ };
1245
+ } else n.push({
1246
+ box: { ...r },
1247
+ rows: [e]
1248
+ });
1249
+ }
1250
+ return n;
1251
+ }, nn = (e) => ({
1252
+ top: Math.min(...e.map((e) => e.top)),
1253
+ bottom: Math.max(...e.map((e) => e.bottom)),
1254
+ left: Math.min(...e.map((e) => e.left)),
1255
+ right: Math.max(...e.map((e) => e.right))
1256
+ }), rn = (e, t, n) => {
1257
+ let { ax: r, bx: i, al: a, br: o } = n, s = H((r + i) / 2);
1258
+ return [
1259
+ `M ${H(a)} ${H(e.top)}`,
1260
+ `L ${H(r)} ${H(e.top)}`,
1261
+ `C ${s} ${H(e.top)} ${s} ${H(t.top)} ${H(i)} ${H(t.top)}`,
1262
+ `L ${H(o)} ${H(t.top)}`,
1263
+ `L ${H(o)} ${H(t.bottom)}`,
1264
+ `L ${H(i)} ${H(t.bottom)}`,
1265
+ `C ${s} ${H(t.bottom)} ${s} ${H(e.bottom)} ${H(r)} ${H(e.bottom)}`,
1266
+ `L ${H(a)} ${H(e.bottom)}`,
1267
+ "Z"
1268
+ ].join(" ");
1269
+ }, an = (t, n) => (t.rows ?? []).map((e) => ({
1270
+ id: e,
1271
+ box: n(t.column, String(e))
1272
+ })).filter((t) => t.box !== null && t.box.bottom - t.box.top > e.MinRowHeight), on = (e, t, n) => {
1273
+ let r = i(e, n);
1274
+ if (r === null) return [];
1275
+ let a = t.find((t) => t.id === e.column)?.box;
1276
+ return a == null ? [] : [{
1277
+ id: `gap:${e.column}:${H(r)}`,
1278
+ box: {
1279
+ top: r - W,
1280
+ bottom: r + W,
1281
+ left: a.left,
1282
+ right: a.right
1283
+ }
1284
+ }];
1285
+ }, sn = (e, t, n) => {
1286
+ let r = an(e, n);
1287
+ return r.length > 0 ? {
1288
+ boxes: r,
1289
+ gap: !1
1290
+ } : {
1291
+ boxes: on(e, t, n),
1292
+ gap: !0
1293
+ };
1294
+ }, cn = (e, t, n) => {
1295
+ let r = (e) => t.findIndex((t) => t.id === e);
1296
+ return (e.ends ?? []).map((e) => ({
1297
+ end: e,
1298
+ order: r(e.column)
1299
+ })).filter((e) => e.order >= 0).sort((e, t) => e.order - t.order).map(({ end: e }) => {
1300
+ let { boxes: r, gap: i } = sn(e, t, n);
1301
+ return {
1302
+ column: e.column,
1303
+ blocks: tn(r),
1304
+ box: r.length > 0 ? nn(r.map((e) => e.box)) : null,
1305
+ gap: i
1306
+ };
1307
+ }).filter((e) => e.box !== null);
1308
+ }, ln = (e, t) => {
1309
+ let n = e.map((e) => e.box).filter((e) => e !== null);
1310
+ return t !== null && n.push(t), n.length === 0 ? null : {
1311
+ top: H(Math.min(...n.map((e) => e.top))),
1312
+ bottom: H(Math.max(...n.map((e) => e.bottom)))
1313
+ };
1314
+ }, G = (e, t, n) => {
1315
+ let r = t.columns.find((t) => t.id === e.column)?.box ?? null, i = e.box ?? {
1316
+ top: 0,
1317
+ bottom: 0,
1318
+ left: 0,
1319
+ right: 0
1320
+ };
1321
+ return r === null ? n === "left" ? {
1322
+ corridor: i.right,
1323
+ outer: i.left
1324
+ } : {
1325
+ corridor: i.left,
1326
+ outer: i.right
1327
+ } : n === "left" ? {
1328
+ corridor: r.right,
1329
+ outer: r.left
1330
+ } : {
1331
+ corridor: r.left,
1332
+ outer: r.right
1333
+ };
1334
+ }, K = (e, t, n) => {
1335
+ if (e.box === null || t.box === null) return null;
1336
+ let r = G(e, n, "left"), i = G(t, n, "right");
1337
+ return {
1338
+ a: e.box,
1339
+ b: t.box,
1340
+ ax: r.corridor,
1341
+ bx: i.corridor,
1342
+ al: r.outer,
1343
+ br: i.outer,
1344
+ thickness: n.thickness,
1345
+ shift: n.shift,
1346
+ center: n.center
1347
+ };
1348
+ }, un = (e, t, n, r) => {
1349
+ let i = K(e, t, n);
1350
+ if (i === null || e.box === null || t.box === null) return null;
1351
+ if (r) {
1352
+ let n = V(i);
1353
+ return {
1354
+ from: e.column,
1355
+ to: t.column,
1356
+ path: Jt(i, n),
1357
+ height: H(n.half * 2),
1358
+ cx: n.midX,
1359
+ cy: n.nodeY
1360
+ };
1361
+ }
1362
+ let { ax: a, bx: o } = i, s = i.al ?? a, c = i.br ?? o, l = Math.max(e.box.bottom - e.box.top, t.box.bottom - t.box.top);
1363
+ return {
1364
+ from: e.column,
1365
+ to: t.column,
1366
+ path: rn(e.box, t.box, {
1367
+ ax: a,
1368
+ bx: o,
1369
+ al: s,
1370
+ br: c
1371
+ }),
1372
+ height: H(l),
1373
+ cx: H((a + o) / 2),
1374
+ cy: H((Math.max(e.box.top, t.box.top) + Math.min(e.box.bottom, t.box.bottom)) / 2)
1375
+ };
1376
+ }, dn = (e, t) => {
1377
+ let n = Math.max(1, Math.floor(t / Qt));
1378
+ return e.length <= n ? { text: e } : {
1379
+ text: `${e.slice(0, Math.max(1, n - 1))}…`,
1380
+ title: e
1381
+ };
1382
+ }, fn = (t, n, r) => {
1383
+ let i = t[0], a = t[1];
1384
+ if (i?.box == null || a?.box == null) return {
1385
+ caption: null,
1386
+ box: null
1387
+ };
1388
+ let o = K(i, a, n);
1389
+ if (o === null) return {
1390
+ caption: null,
1391
+ box: null
1392
+ };
1393
+ let s = Math.max(0, H(o.bx - o.ax)), c = r !== null, l = c ? dn(r, s) : { text: "" }, u = (e, t) => ({
1394
+ x: e,
1395
+ y: t,
1396
+ maxWidth: s,
1397
+ text: l.text,
1398
+ ...l.title === void 0 ? {} : { title: l.title }
1399
+ });
1400
+ if (t.length === 2) {
1401
+ let e = V(o), t = H(e.nodeY - e.half), n = {
1402
+ top: t,
1403
+ bottom: H(e.nodeY + e.half),
1404
+ left: H(o.ax),
1405
+ right: H(o.bx)
1406
+ };
1407
+ return {
1408
+ caption: c ? u(e.midX, H(t + $t)) : null,
1409
+ box: n
1410
+ };
1411
+ }
1412
+ let d = {
1413
+ top: Math.min(i.box.top, a.box.top),
1414
+ bottom: Math.max(i.box.bottom, a.box.bottom),
1415
+ left: H(o.ax),
1416
+ right: H(o.bx)
1417
+ };
1418
+ return {
1419
+ caption: c ? u(H((o.ax + o.bx) / 2), H(Math.min(i.box.top, a.box.top) + e.NCaptionOffset)) : null,
1420
+ box: d
1421
+ };
1422
+ }, pn = (e, t) => {
1423
+ let n = [];
1424
+ for (let r = 0; r < e.length - 1; r += 1) {
1425
+ let i = e[r], a = e[r + 1];
1426
+ if (i === void 0 || a === void 0) continue;
1427
+ let o = un(i, a, t, e.length === 2);
1428
+ o !== null && n.push(o);
1429
+ }
1430
+ return n;
1431
+ }, mn = (e, t, n) => {
1432
+ let r = (t.left + t.right) / 2, i = n.filter((t) => t.id !== e && t.box !== null);
1433
+ return i.length === 0 ? null : i.reduce((e, t) => Math.abs(t.box.left - r) < Math.abs(e.box.left - r) ? t : e);
1434
+ }, hn = (t, n) => ({
1435
+ id: `${t}:opposite`,
1436
+ box: {
1437
+ top: n.top,
1438
+ bottom: n.bottom,
1439
+ left: n.right + e.VirtualColumnGap,
1440
+ right: n.right + e.VirtualColumnWidth
1441
+ }
1442
+ }), gn = (t, n, r, i) => {
1443
+ if (t.box === null) return null;
1444
+ let a = n.find((e) => e.id === t.column)?.box ?? t.box, o = mn(t.column, a, n), s = o === null ? [...n, hn(t.column, a)] : [...n], c = o ?? s[s.length - 1];
1445
+ if (c?.box == null) return null;
1446
+ let l = (t.box.top + t.box.bottom) / 2, u = (i?.get(c.id) ?? []).map((e) => r(c.id, e)).filter((t) => t !== null && t.bottom - t.top > e.MinRowHeight), d = H(t.box.bottom + e.GapNudge), f = H(l);
1447
+ if (u.length > 0) {
1448
+ let t = Math.min(...u.map((e) => e.top)), n = Math.max(...u.map((e) => e.bottom));
1449
+ f = H((t + n) / 2), d = H(l >= f ? n + e.GapNudge : t - e.GapNudge);
1450
+ }
1451
+ let p = {
1452
+ top: d - W,
1453
+ bottom: d + W,
1454
+ left: c.box.left,
1455
+ right: c.box.right
1456
+ }, m = {
1457
+ column: c.id,
1458
+ blocks: [{
1459
+ box: p,
1460
+ rows: []
1461
+ }],
1462
+ box: p,
1463
+ gap: !0,
1464
+ hug: f
1465
+ }, h = (e) => n.find((t) => t.id === e.column)?.box?.left ?? e.box?.left ?? 0;
1466
+ return {
1467
+ ends: [t, m].sort((e, t) => h(e) - h(t)),
1468
+ columns: s
1469
+ };
1470
+ }, _n = (e) => (e.top + e.bottom) / 2, vn = (e, t) => {
1471
+ let n = e.map((e) => e.box).filter((e) => e !== null), r = H(Math.min(...n.map((e) => e.top))), i = H(Math.max(...n.map((e) => e.bottom))), a = e.filter((e) => e.gap).map((e) => e.box).find((e) => e !== null), o = n.map(_n), s = o[0] ?? 0, c = o[o.length - 1] ?? s, l = H(a === void 0 ? (s + c) / 2 : _n(a));
1472
+ return {
1473
+ center: l,
1474
+ top: r,
1475
+ bottom: i,
1476
+ thickness: t,
1477
+ hug: e.find((e) => e.hug !== void 0)?.hug ?? l
1478
+ };
1479
+ }, q = ({ ribbon: e, columns: t, lookup: n, rowHeight: r, shift: i = 0, thickness: a, placed: o }) => {
1480
+ let s = cn(e, t, n), c = s[0];
1481
+ if (c === void 0) return null;
1482
+ let l = e.label ?? null, u = s.length === 1 || s.some((e) => e.gap), d = a ?? en(l, u, r), f = s, p = t;
1483
+ if (s.length === 1) {
1484
+ let e = gn(c, t, n, o);
1485
+ if (e === null) return null;
1486
+ f = e.ends, p = e.columns;
1487
+ }
1488
+ let m = vn(f, d), h = {
1489
+ columns: p,
1490
+ shift: i,
1491
+ thickness: d,
1492
+ center: m.center
1493
+ }, { caption: g, box: _ } = fn(f, h, l);
1494
+ return {
1495
+ id: e.id,
1496
+ tone: e.tone ?? "duplicate",
1497
+ label: l,
1498
+ connectors: pn(f, h),
1499
+ caption: g,
1500
+ box: _,
1501
+ swept: ln(f, _),
1502
+ natural: m
1503
+ };
1504
+ }, J = e.PackGap, Y = e.LabeledFloor, X = e.Floor, yn = e.MinThickness, bn = (e) => ({
1505
+ top: e.center - e.thickness / 2,
1506
+ bottom: e.center + e.thickness / 2
1507
+ }), Z = (e, t) => e.reduce((e, t) => e + t, 0) + t * Math.max(0, e.length - 1), xn = (e) => e >= Y ? Y : X, Sn = (e, t, n) => {
1508
+ let r = Math.max(0, t - n * Math.max(0, e.length - 1)), i = e.reduce((e, t) => e + t, 0);
1509
+ if (i <= r) return [...e];
1510
+ if (r <= 0) return e.map(() => 0);
1511
+ let a = yn * e.length;
1512
+ if (r >= a && i > 0) {
1513
+ let t = r - a;
1514
+ return e.map((e) => yn + t * e / i);
1515
+ }
1516
+ let o = r / i;
1517
+ return e.map((e) => e * o);
1518
+ }, Cn = (e, t, n, r, i) => {
1519
+ let a = t.length;
1520
+ if (a === 0) return [];
1521
+ let o = [];
1522
+ for (let i = 0; i < a; i += 1) {
1523
+ let a = o[i - 1], s = t[i - 1], c = a !== void 0 && s !== void 0 ? a + s + n : r;
1524
+ o.push(Math.max(e[i] ?? c, c));
1525
+ }
1526
+ let s = t[a - 1];
1527
+ if (s === void 0) return o;
1528
+ let c = (o[a - 1] ?? 0) + s - i;
1529
+ if (c <= 0) return o;
1530
+ if ((o[0] ?? r) - c >= r) return o.map((e) => e - c);
1531
+ let l = [];
1532
+ for (let e = 0; e < a; e += 1) {
1533
+ let i = l[e - 1], a = t[e - 1];
1534
+ l.push(i !== void 0 && a !== void 0 ? i + a + n : r);
1535
+ }
1536
+ return l;
1537
+ }, wn = (e, t, n) => {
1538
+ let r = Math.max(0, n - t), i = e.length;
1539
+ if (i === 0) return {
1540
+ tops: [],
1541
+ ts: []
1542
+ };
1543
+ let a = Math.min(i, Math.max(0, Math.floor((r + J) / (Y + J)))), o = /* @__PURE__ */ new Set();
1544
+ for (let t = 0; t < i && o.size < a; t += 1) (e[t]?.natural.thickness ?? 0) >= Y && o.add(t);
1545
+ let s = e.map((e, t) => o.has(t) ? Y : X), c = Z(s, J) <= r ? J : 0;
1546
+ if (Z(s, c) > r) {
1547
+ let e = [];
1548
+ for (let t = 0; t < i; t += 1) o.has(t) || e.push(t);
1549
+ let t = o.size * Y + c * Math.max(0, i - 1), n = Math.max(0, r - t), a = Sn(e.map((e) => s[e] ?? X), n, 0);
1550
+ e.forEach((e, t) => {
1551
+ s[e] = a[t] ?? 0;
1552
+ });
1553
+ }
1554
+ return {
1555
+ tops: Cn(e.map((e, t) => e.natural.center - (s[t] ?? 0) / 2), s, c, t, n),
1556
+ ts: s
1557
+ };
1558
+ }, Tn = (e, t) => {
1559
+ if (e.length === 0) return;
1560
+ let n = [...e].sort((e, t) => e.natural.hug - t.natural.hug || e.natural.center - t.natural.center || e.natural.top - t.natural.top || e.natural.bottom - t.natural.bottom), r = Math.min(...n.map((e) => e.natural.top)), i = Math.max(...n.map((e) => e.natural.bottom)), a = Math.max(t.rowHeight, U), o = Z(n.map((e) => xn(e.natural.thickness)), J), s = Math.max(a, (o - (i - r)) / 2), c = r - s, l = i + s, u, d;
1561
+ if (t.bounds === void 0) {
1562
+ u = c, d = l;
1563
+ let e = o - (d - u);
1564
+ e > 0 && (u -= e / 2, d += e / 2);
1565
+ } else if (u = Math.max(c, t.bounds.top), d = Math.min(l, t.bounds.bottom), o - (d - u) > 0) {
1566
+ let e = (r + i) / 2, n = Math.max(t.bounds.top, e - o / 2);
1567
+ n + o <= t.bounds.bottom ? (u = n, d = n + o) : (u = t.bounds.top, d = u + o);
1568
+ }
1569
+ let { tops: f, ts: p } = wn(n, Math.min(u, d), Math.max(u, d));
1570
+ n.forEach((e, n) => {
1571
+ let r = p[n] ?? e.natural.thickness, i = f[n] ?? e.natural.center - r / 2, a = {
1572
+ top: i,
1573
+ bottom: i + r
1574
+ }, o = i + r / 2 - e.natural.center, s = t.measured[e.at];
1575
+ if (s === void 0) return;
1576
+ let c = o === 0 && r === e.natural.thickness ? s.shape : t.measure(s.ribbon, o, r) ?? s.shape;
1577
+ t.out[e.at] = {
1578
+ ribbon: s.ribbon,
1579
+ shape: c,
1580
+ shift: o,
1581
+ slot: a
1582
+ };
1583
+ });
1584
+ }, En = (e, t, n, r) => {
1585
+ let i = /* @__PURE__ */ new Map();
1586
+ e.forEach((e, t) => {
1587
+ let n = e.shape.box;
1588
+ if (n === null) return;
1589
+ let r = `${Math.round(n.left)}:${Math.round(n.right)}`, a = i.get(r) ?? [];
1590
+ a.push({
1591
+ at: t,
1592
+ natural: e.shape.natural
1593
+ }), i.set(r, a);
1594
+ });
1595
+ let a = e.map((e) => ({
1596
+ ribbon: e.ribbon,
1597
+ shape: e.shape,
1598
+ shift: 0,
1599
+ slot: bn(e.shape.natural)
1600
+ })), o = {
1601
+ measured: e,
1602
+ measure: t,
1603
+ rowHeight: n,
1604
+ ...r === void 0 ? {} : { bounds: r },
1605
+ out: a
1606
+ };
1607
+ for (let e of i.values()) Tn(e, o);
1608
+ return a;
1609
+ }, Q = "http://www.w3.org/2000/svg", Dn = (e, t) => {
1610
+ let n = document.createElementNS(Q, "path");
1611
+ return n.setAttribute("d", e), n.setAttribute("fill", t), n.setAttribute("stroke", "none"), n;
1612
+ }, On = (t, n, r) => {
1613
+ let i = (r.left + r.right) / 2, a = t.columnBoxes.filter((e) => e.id !== n && e.box !== null), o = (e) => e.box.left > r.right ? e.box.left : e.box.right;
1614
+ if (a.length === 0) {
1615
+ let t = r.left <= i ? r.right : r.left;
1616
+ return {
1617
+ x1: t,
1618
+ x2: t + (t === r.right ? e.HintStub : -e.HintStub)
1619
+ };
1620
+ }
1621
+ let s = a.reduce((e, t) => Math.abs(o(t) - i) < Math.abs(o(e) - i) ? t : e);
1622
+ return {
1623
+ x1: s.box.left > r.right ? r.right : r.left,
1624
+ x2: o(s)
1625
+ };
1626
+ }, kn = (e, t) => {
1627
+ let [n, r] = t.split("::");
1628
+ if (n === void 0 || r === void 0) return null;
1629
+ let i = e.lookup(n, r), a = e.columnBoxes.find((e) => e.id === n)?.box;
1630
+ if (i === null || a == null) return null;
1631
+ let o = e.columns.find((e) => e.id === n)?.rows?.find((e) => String(e.id) === r), s = e.tone.colorOfKey(o?.tone ?? "duplicate"), { x1: c, x2: l } = On(e, n, a), u = (c + l) / 2, { top: d, bottom: f } = i, p = Dn(`M ${c} ${d} C ${u} ${d}, ${u} ${d}, ${l} ${d} L ${l} ${f} C ${u} ${f}, ${u} ${f}, ${c} ${f} Z`, s.fill);
1632
+ return p.setAttribute("data-group-hint", t), p;
1633
+ }, An = ({ ribbon: e, shape: t, tone: n, hot: r }) => {
1634
+ let i = r ? n.hotOf(e) : n.fillOf(e), a = document.createElementNS(Q, "g");
1635
+ a.setAttribute("data-ribbon", t.id), a.setAttribute("data-hot", r ? "true" : "false");
1636
+ for (let e of t.connectors) a.append(Dn(e.path, i));
1637
+ if (t.caption === null && t.label !== null) {
1638
+ let e = document.createElementNS(Q, "title");
1639
+ e.textContent = t.label, a.append(e);
1640
+ }
1641
+ return a;
1642
+ }, jn = ({ shape: t, theme: n, hot: r }) => {
1643
+ if (t.caption === null || t.label === null) return null;
1644
+ let i = t.caption, a = document.createElementNS(Q, "text");
1645
+ if (a.setAttribute("x", String(i.x)), a.setAttribute("y", String(i.y)), a.setAttribute("text-anchor", "middle"), a.setAttribute("font-size", String(e.CaptionFontSize)), a.setAttribute("font-family", n.font.family.text), a.setAttribute("fill", r ? n.colors.sectionContent : n.colors.status?.dim?.content ?? n.colors.sectionContent), a.setAttribute("data-caption", t.id), a.textContent = i.text, i.title !== void 0) {
1646
+ let e = document.createElementNS(Q, "title");
1647
+ e.textContent = i.title, a.append(e);
1648
+ }
1649
+ return a;
1650
+ }, $ = (e, t) => {
1651
+ if (t !== null) return t;
1652
+ let n = document.createElementNS(Q, "g");
1653
+ return e.append(n), n;
1654
+ }, Mn = ({ svg: e, layers: t, scene: n, ctx: r, theme: i }) => {
1655
+ let a = $(e, t.hints);
1656
+ a.replaceChildren(...n.hints);
1657
+ let o = $(e, t.ribbons);
1658
+ o.replaceChildren(...n.measured.map(({ ribbon: e, shape: t }) => An({
1659
+ ribbon: e,
1660
+ shape: t,
1661
+ tone: r.tone,
1662
+ hot: r.hotRibbon === e.id
1663
+ })));
1664
+ let s = $(e, t.captions);
1665
+ return s.replaceChildren(...n.measured.map(({ shape: e }) => jn({
1666
+ shape: e,
1667
+ theme: i,
1668
+ hot: r.hotRibbon === e.id
1669
+ })).filter((e) => e !== null)), {
1670
+ hints: a,
1671
+ ribbons: o,
1672
+ captions: s
1673
+ };
1674
+ }, Nn = (e, t) => {
1675
+ let n = Infinity, r = -Infinity;
1676
+ for (let e of t) e.top < n && (n = e.top), e.bottom > r && (r = e.bottom);
1677
+ for (let t of e) t.slot.top < n && (n = t.slot.top), t.slot.bottom > r && (r = t.slot.bottom), t.shape.caption !== null && t.shape.caption.y > r && (r = t.shape.caption.y);
1678
+ return Number.isFinite(n) && Number.isFinite(r) ? {
1679
+ top: n,
1680
+ bottom: r
1681
+ } : null;
1682
+ }, Pn = (e) => {
1683
+ let t = /* @__PURE__ */ new Set();
1684
+ for (let n of e.ends ?? []) for (let e of n.rows ?? []) t.add(`${n.column}::${String(e)}`);
1685
+ return t;
1686
+ }, Fn = (e) => {
1687
+ let t = /* @__PURE__ */ new Map();
1688
+ for (let n of e) for (let e of n.ends ?? []) {
1689
+ let n = t.get(e.column) ?? [];
1690
+ for (let t of e.rows ?? []) n.push(String(t));
1691
+ t.set(e.column, n);
1692
+ }
1693
+ return t;
1694
+ }, In = (e) => {
1695
+ if (e.length === 0) return;
1696
+ let t = Infinity, n = -Infinity;
1697
+ for (let r of e) r.top < t && (t = r.top), r.bottom > n && (n = r.bottom);
1698
+ return {
1699
+ top: t,
1700
+ bottom: n
1701
+ };
1702
+ }, Ln = (e) => {
1703
+ let t = Fn(e.ribbons), n = [];
1704
+ for (let r of e.ribbons) {
1705
+ let i = q({
1706
+ ribbon: r,
1707
+ columns: e.columnBoxes,
1708
+ lookup: e.lookup,
1709
+ rowHeight: e.rowHeight,
1710
+ placed: t
1711
+ });
1712
+ i !== null && n.push({
1713
+ ribbon: r,
1714
+ shape: i
1715
+ });
1716
+ }
1717
+ let r = In(e.rowBoxes);
1718
+ return En(n, (n, r, i) => q({
1719
+ ribbon: n,
1720
+ columns: e.columnBoxes,
1721
+ lookup: e.lookup,
1722
+ rowHeight: e.rowHeight,
1723
+ placed: t,
1724
+ shift: r,
1725
+ thickness: i
1726
+ }), e.rowHeight, r);
1727
+ }, Rn = (e, t) => [...e.hotRows].filter((e) => !t.has(e)).map((t) => kn(e, t)).filter((e) => e !== null), zn = (e) => {
1728
+ let t = Ln(e), n = e.hotRibbon === null ? null : t.find((t) => t.ribbon.id === e.hotRibbon) ?? null;
1729
+ return {
1730
+ measured: t,
1731
+ hints: Rn(e, n === null ? /* @__PURE__ */ new Set() : Pn(n.ribbon)),
1732
+ extent: Nn(t, e.rowBoxes)
1733
+ };
1734
+ }, Bn = ({ root: e, layer: t, columns: n, ribbons: r, tone: i, theme: a, rowHeight: o, bandGap: c, hotRibbon: u, hotRows: f, revision: p, onExtent: m }) => {
1735
+ let h = d(null), g = d(null), _ = d(null), v = s(() => {
1736
+ let s = t.current, l = e.current;
1737
+ if (s === null || l === null) return;
1738
+ let d = Dt(l, c), p = Ot(l), v = {
1739
+ ribbons: r,
1740
+ columns: n,
1741
+ columnBoxes: n.map((e) => ({
1742
+ id: e.id,
1743
+ box: R(d, e.id)
1744
+ })),
1745
+ lookup: L(d, p),
1746
+ rowBoxes: kt(d, p),
1747
+ rowHeight: o,
1748
+ tone: i,
1749
+ hotRibbon: u,
1750
+ hotRows: f
1751
+ }, y = zn(v), b = Mn({
1752
+ svg: s,
1753
+ layers: {
1754
+ hints: h.current,
1755
+ ribbons: g.current,
1756
+ captions: _.current
1757
+ },
1758
+ scene: y,
1759
+ ctx: v,
1760
+ theme: a
1761
+ });
1762
+ h.current = b.hints, g.current = b.ribbons, _.current = b.captions, m?.(y.extent);
1763
+ }, [
1764
+ e,
1765
+ t,
1766
+ n,
1767
+ r,
1768
+ i,
1769
+ a,
1770
+ o,
1771
+ c,
1772
+ u,
1773
+ f,
1774
+ m
1775
+ ]);
1776
+ return l(() => {
1777
+ v();
1778
+ }, [v, p]), v;
1779
+ }, Vn = ({ ribbons: e, columns: t, layout: n, root: r, rowHeight: i }) => {
1780
+ let a = L(n, r === null ? /* @__PURE__ */ new Map() : Ot(r)), o = t.map((e) => ({
1781
+ id: e.id,
1782
+ box: R(n, e.id)
1783
+ })), s = [];
1784
+ for (let t of e) {
1785
+ let e = q({
1786
+ ribbon: t,
1787
+ columns: o,
1788
+ lookup: a,
1789
+ rowHeight: i
1790
+ });
1791
+ e !== null && s.push({
1792
+ ribbon: t,
1793
+ shape: e
1794
+ });
1795
+ }
1796
+ return {
1797
+ measured: s,
1798
+ columns: o,
1799
+ lookup: a
1800
+ };
1801
+ }, Hn = (e) => u(() => Vn(e), [
1802
+ e.ribbons,
1803
+ e.columns,
1804
+ e.layout,
1805
+ e.root,
1806
+ e.rowHeight
1807
+ ]), Un = (e) => u(() => {
1808
+ let t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map();
1809
+ for (let r of e) for (let e of r.rows ?? []) {
1810
+ if (e.group === void 0) continue;
1811
+ let i = `${r.id}::${String(e.id)}`;
1812
+ n.set(i, e.group);
1813
+ let a = t.get(e.group) ?? /* @__PURE__ */ new Set();
1814
+ a.add(i), t.set(e.group, a);
1815
+ }
1816
+ return {
1817
+ byGroup: t,
1818
+ groupOf: n
1819
+ };
1820
+ }, [e]), Wn = (e, t, n) => {
1821
+ if (t === null) return null;
1822
+ if (n !== void 0) {
1823
+ let r = e.chainOfWord(t, n);
1824
+ if (r !== null) return r;
1825
+ }
1826
+ return e.chainOfRow(t);
1827
+ }, Gn = (e, t, n) => {
1828
+ if (e === null) return /* @__PURE__ */ new Set();
1829
+ let r = t.groupOf.get(`${e.column}::${String(e.row)}`);
1830
+ return r === void 0 || n.find((t) => t.id === e.column)?.rows?.find((t) => String(t.id) === String(e.row))?.groupHeader !== !0 ? /* @__PURE__ */ new Set() : new Set(t.byGroup.get(r) ?? []);
1831
+ }, Kn = (e) => {
1832
+ let t = /* @__PURE__ */ new Map();
1833
+ if (e === null) return t;
1834
+ for (let n of e.anchors) {
1835
+ let e = t.get(n.column) ?? /* @__PURE__ */ new Map(), r = e.get(n.line) ?? [];
1836
+ r.push({
1837
+ from: n.from,
1838
+ to: n.to,
1839
+ strong: !0,
1840
+ ...n.ink === void 0 ? {} : { ink: n.ink }
1841
+ }), e.set(n.line, r), t.set(n.column, e);
1842
+ }
1843
+ return t;
1844
+ }, qn = ({ ribbons: e, columns: t, chain: n, groups: r, pickedRibbon: i }) => {
1845
+ let [a, o] = f(null), [s, c] = f(null), [l, d] = f(void 0), p = i === null ? null : n.chainOfRibbon(i), m = a === null ? Wn(n, s, l) : n.chainOfRibbon(a);
1846
+ return {
1847
+ hoverRibbon: a,
1848
+ setHoverRibbon: o,
1849
+ hoverRow: s,
1850
+ setHoverRow: c,
1851
+ setHoverChar: d,
1852
+ hotRibbon: m?.ribbon.id ?? i,
1853
+ hotRows: u(() => Gn(s, r, t), [
1854
+ s,
1855
+ r,
1856
+ t
1857
+ ]),
1858
+ connected: u(() => oe(t, p === null ? e.flatMap((e) => e.ends) : p.ribbon.ends), [
1859
+ t,
1860
+ e,
1861
+ p
1862
+ ]),
1863
+ highlights: u(() => Kn(m), [m])
1864
+ };
1865
+ }, Jn = (e, t, n) => {
1866
+ let r = e, i = r.caretPositionFromPoint?.(t, n);
1867
+ if (i != null) return {
1868
+ offsetNode: i.offsetNode,
1869
+ offset: i.offset
1870
+ };
1871
+ let a = r.caretRangeFromPoint?.(t, n);
1872
+ return a == null ? null : {
1873
+ offsetNode: a.startContainer,
1874
+ offset: a.startOffset
1875
+ };
1876
+ }, Yn = (e, t, n) => {
1877
+ let r = 0, i = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT, { acceptNode: (e) => e.nodeType === Node.ELEMENT_NODE && e.hasAttribute("data-plate") ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT });
1878
+ for (let e = i.nextNode(); e !== null; e = i.nextNode()) {
1879
+ if (e === t) return r + n;
1880
+ e.nodeType === Node.TEXT_NODE && (r += (e.textContent ?? "").length);
1881
+ }
1882
+ }, Xn = (e, t, n) => {
1883
+ if (e === null) return;
1884
+ let r = Jn(document, t, n);
1885
+ if (r?.offsetNode != null && e.contains(r.offsetNode)) return Yn(e, r.offsetNode, r.offset);
1886
+ }, Zn = (e) => {
1887
+ let t = e.closest("[data-column]"), n = e.closest("[data-item]");
1888
+ return !(t instanceof HTMLElement) || !(n instanceof HTMLElement) || n.dataset.item === void 0 ? null : {
1889
+ column: t.dataset.column ?? "",
1890
+ row: n.dataset.item
1891
+ };
1892
+ }, Qn = ({ emit: e, chain: t, focusedRibbon: n, setFocused: r, setHoverRow: i, setHoverRibbon: a, setHoverChar: o }) => ({
1893
+ onPointerOver: (e) => {
1894
+ let t = j(e.target);
1895
+ if (t === null || t.closest("svg") !== null) return;
1896
+ let n = Zn(t);
1897
+ if (n === null) {
1898
+ i(null), o(void 0);
1899
+ return;
1900
+ }
1901
+ let r = t.closest("[data-anchor]");
1902
+ o(Xn(r instanceof HTMLElement ? r : t, e.clientX, e.clientY)), i(n), a(null);
1903
+ },
1904
+ onClick: (i) => {
1905
+ let a = j(i.target);
1906
+ if (a === null || a.closest("[data-action]") !== null || a.closest("[data-fold]") !== null) return;
1907
+ let o = Zn(a);
1908
+ if (o === null || e("row:click", { row: o }).defaultPrevented) return;
1909
+ let s = t.chainOfRow(o);
1910
+ s !== null && r(n === s.ribbon.id ? null : s.ribbon.id);
1911
+ }
1912
+ }), $n = (e, t) => {
1913
+ let n = e.closest("[data-ribbon]")?.getAttribute("data-ribbon") ?? e.closest("[data-caption]")?.getAttribute("data-caption");
1914
+ return n == null ? null : t.find((e) => e.id === n) ?? null;
1915
+ }, er = n.ChipPadY, tr = n.ChipPadX, nr = n.ChipRadius, rr = n.ChipLineHeight, ir = n.BarGap, ar = n.BarPadY, or = n.BarPadX, sr = n.LegendGap, cr = n.LegendPadY, lr = n.LegendPadX, ur = n.DotSize, dr = n.DotMargin, fr = ({ on: e, onClick: t, children: n, title: r }) => {
1916
+ let { chrome: i, theme: a } = O();
1917
+ return /* @__PURE__ */ g(nt, {
1918
+ type: "button",
1919
+ $on: e,
1920
+ $padY: er,
1921
+ $padX: tr,
1922
+ $radius: nr,
1923
+ $lineHeight: rr,
1924
+ $edge: i.edge,
1925
+ $ink: e === !0 ? a.colors.sectionContent : i.dim,
1926
+ onClick: t,
1927
+ title: r,
1928
+ children: n
1929
+ });
1930
+ }, pr = ({ children: e }) => {
1931
+ let { chrome: t } = O();
1932
+ return /* @__PURE__ */ g(rt, {
1933
+ "data-toolbar": !0,
1934
+ $gap: ir,
1935
+ $padY: ar,
1936
+ $padX: or,
1937
+ $edge: t.edge,
1938
+ children: e
1939
+ });
1940
+ };
1941
+ function mr({ entries: e }) {
1942
+ let { chrome: t } = O();
1943
+ return /* @__PURE__ */ g(it, {
1944
+ "data-legend": !0,
1945
+ $gap: sr,
1946
+ $padY: cr,
1947
+ $padX: lr,
1948
+ $edge: t.edge,
1949
+ $ink: t.dim,
1950
+ children: e.map((e) => /* @__PURE__ */ _("span", { children: [/* @__PURE__ */ g(at, {
1951
+ $c: e.color,
1952
+ $size: ur,
1953
+ $margin: dr
1954
+ }), e.label] }, e.key))
1955
+ });
1956
+ }
1957
+ // default/data-display/CodeDiff/board/index.tsx
1958
+ var hr = () => {
1959
+ let { config: e, theme: t, tones: n, state: r, emit: i, props: a } = O(), o = d(null), c = d(null), l = a.columns, u = a.ribbons ?? [], p = `${l.map((e) => e.id).join(",")}|${r.state.revealed}|${r.state.focusedRibbon}`, { layout: m, measure: v, revision: y } = Pt(o, e.bandGap, p), b = Ut(u, l, t, n), x = Kt(u), S = qn({
1960
+ ribbons: u,
1961
+ columns: l,
1962
+ chain: x,
1963
+ groups: Un(l),
1964
+ pickedRibbon: r.state.focusedRibbon
1965
+ }), [C, w] = f(null), T = s((e) => {
1966
+ let t = e === null ? null : e.bottom;
1967
+ w((e) => e === t || e !== null && t !== null && Math.abs(e - t) < .5 ? e : t);
1968
+ }, []), E = e.boardHeight === void 0 && C !== null ? `${Math.ceil(C)}px` : void 0;
1969
+ zt(o, Bn({
1970
+ root: o,
1971
+ layer: c,
1972
+ columns: l,
1973
+ ribbons: u,
1974
+ tone: b,
1975
+ theme: t,
1976
+ rowHeight: e.rowHeight,
1977
+ bandGap: e.bandGap,
1978
+ hotRibbon: S.hotRibbon,
1979
+ hotRows: S.hotRows,
1980
+ revision: y,
1981
+ onExtent: T
1982
+ })), Bt(o, a.sync ?? []);
1983
+ let D = Hn({
1984
+ ribbons: u,
1985
+ columns: l,
1986
+ layout: m,
1987
+ root: o.current,
1988
+ rowHeight: e.rowHeight
1989
+ }), k = Qn({
1990
+ emit: i,
1991
+ chain: x,
1992
+ focusedRibbon: r.state.focusedRibbon,
1993
+ setFocused: r.setFocused,
1994
+ setHoverRow: S.setHoverRow,
1995
+ setHoverRibbon: S.setHoverRibbon,
1996
+ setHoverChar: S.setHoverChar
1997
+ }), te = (a.actions ?? []).filter((e) => e.placement === "toolbar");
1998
+ return /* @__PURE__ */ _(h, { children: [te.length === 0 ? null : /* @__PURE__ */ g(pr, { children: /* @__PURE__ */ g(F, {
1999
+ actions: a.actions ?? [],
2000
+ entity: "row",
2001
+ placement: "toolbar",
2002
+ params: { selected: r.state.selected },
2003
+ emit: i
2004
+ }) }), /* @__PURE__ */ _(ee, {
2005
+ ref: o,
2006
+ $template: ie(a),
2007
+ $height: e.boardHeight,
2008
+ $minHeight: E,
2009
+ onPointerOver: k.onPointerOver,
2010
+ onPointerMove: k.onPointerOver,
2011
+ onPointerLeave: () => {
2012
+ S.setHoverRow(null), S.setHoverRibbon(null);
2013
+ },
2014
+ onClick: k.onClick,
2015
+ children: [/* @__PURE__ */ g(St, {
2016
+ props: a,
2017
+ connected: S.connected,
2018
+ highlights: S.highlights,
2019
+ hotRibbon: S.hotRibbon,
2020
+ geometry: D,
2021
+ layout: m,
2022
+ onLayout: v
2023
+ }), /* @__PURE__ */ g(wt, {
2024
+ ref: c,
2025
+ onPointerOver: (e) => {
2026
+ let t = he(e.target), n = t === null ? null : $n(t, u);
2027
+ n !== null && (S.setHoverRibbon(n.id), S.setHoverRow(null), i("ribbon:mouseEnter", { ribbon: n }));
2028
+ },
2029
+ onPointerLeave: () => {
2030
+ S.setHoverRibbon(null), i("ribbon:mouseLeave", { ribbon: null });
2031
+ },
2032
+ onClick: (e) => {
2033
+ let t = he(e.target), n = t === null ? null : $n(t, u);
2034
+ n !== null && (e.stopPropagation(), i("ribbon:click", { ribbon: n }).defaultPrevented || r.setFocused(r.state.focusedRibbon === n.id ? null : n.id));
2035
+ }
2036
+ })]
2037
+ })] });
2038
+ }, gr = (e) => /* @__PURE__ */ g(k, {
2039
+ props: e,
2040
+ children: /* @__PURE__ */ g(hr, {})
2041
+ });
2042
+ export { F as a, pr as i, fr as n, tt as o, mr as r, gr as t };