@parca/profile 0.19.140 → 0.19.143

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 (182) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/dist/GraphTooltipArrow/Content.js +224 -30
  3. package/dist/GraphTooltipArrow/DockedGraphTooltip/index.js +192 -33
  4. package/dist/GraphTooltipArrow/ExpandOnHoverValue.js +53 -3
  5. package/dist/GraphTooltipArrow/index.d.ts.map +1 -1
  6. package/dist/GraphTooltipArrow/index.js +86 -56
  7. package/dist/GraphTooltipArrow/useGraphTooltip/index.js +37 -37
  8. package/dist/GraphTooltipArrow/useGraphTooltipMetaInfo/index.js +94 -68
  9. package/dist/MatchersInput/SuggestionItem.js +91 -12
  10. package/dist/MatchersInput/SuggestionsList.d.ts +2 -1
  11. package/dist/MatchersInput/SuggestionsList.d.ts.map +1 -1
  12. package/dist/MatchersInput/SuggestionsList.js +371 -157
  13. package/dist/MatchersInput/SuggestionsList.test.d.ts +2 -0
  14. package/dist/MatchersInput/SuggestionsList.test.d.ts.map +1 -0
  15. package/dist/MatchersInput/index.js +308 -115
  16. package/dist/MetricsCircle/index.js +39 -3
  17. package/dist/MetricsGraph/MetricsContextMenu/index.js +119 -19
  18. package/dist/MetricsGraph/MetricsInfoPanel/index.js +81 -20
  19. package/dist/MetricsGraph/MetricsTooltip/index.d.ts.map +1 -1
  20. package/dist/MetricsGraph/MetricsTooltip/index.js +107 -74
  21. package/dist/MetricsGraph/index.js +552 -203
  22. package/dist/MetricsGraph/useMetricsGraphDimensions.js +46 -25
  23. package/dist/MetricsGraph/utils/colorMapping.js +24 -17
  24. package/dist/MetricsSeries/index.js +70 -7
  25. package/dist/PreSelectedMatchers/index.d.ts.map +1 -1
  26. package/dist/PreSelectedMatchers/index.js +249 -102
  27. package/dist/ProfileExplorer/ProfileExplorerCompare.d.ts.map +1 -1
  28. package/dist/ProfileExplorer/ProfileExplorerCompare.js +240 -45
  29. package/dist/ProfileExplorer/ProfileExplorerSingle.js +98 -11
  30. package/dist/ProfileExplorer/index.js +183 -32
  31. package/dist/ProfileFlameChart/SamplesStrips/SamplesGraph/index.js +333 -148
  32. package/dist/ProfileFlameChart/SamplesStrips/SamplesStrips.stories.js +69 -35
  33. package/dist/ProfileFlameChart/SamplesStrips/index.js +645 -134
  34. package/dist/ProfileFlameChart/SamplesStrips/labelSetUtils.js +114 -55
  35. package/dist/ProfileFlameChart/index.js +260 -126
  36. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.js +283 -85
  37. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenuWrapper.js +56 -20
  38. package/dist/ProfileFlameGraph/FlameGraphArrow/FlameGraphNodes.js +211 -140
  39. package/dist/ProfileFlameGraph/FlameGraphArrow/MemoizedTooltip.js +133 -38
  40. package/dist/ProfileFlameGraph/FlameGraphArrow/MiniMap.js +261 -216
  41. package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.d.ts.map +1 -1
  42. package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.js +71 -45
  43. package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.d.ts.map +1 -1
  44. package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.js +58 -28
  45. package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.d.ts.map +1 -1
  46. package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.js +59 -8
  47. package/dist/ProfileFlameGraph/FlameGraphArrow/index.js +396 -179
  48. package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.d.ts.map +1 -1
  49. package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.js +68 -50
  50. package/dist/ProfileFlameGraph/FlameGraphArrow/useMappingList.js +62 -38
  51. package/dist/ProfileFlameGraph/FlameGraphArrow/useNodeColor.js +14 -6
  52. package/dist/ProfileFlameGraph/FlameGraphArrow/useScrollViewport.js +124 -82
  53. package/dist/ProfileFlameGraph/FlameGraphArrow/useVisibleNodes.js +160 -98
  54. package/dist/ProfileFlameGraph/FlameGraphArrow/useZoom.js +232 -112
  55. package/dist/ProfileFlameGraph/FlameGraphArrow/utils.js +137 -114
  56. package/dist/ProfileFlameGraph/benchmarks/benchdata/populateData.js +85 -0
  57. package/dist/ProfileFlameGraph/index.js +322 -147
  58. package/dist/ProfileMetricsGraph/hooks/useQueryRange.js +140 -32
  59. package/dist/ProfileMetricsGraph/index.js +515 -256
  60. package/dist/ProfileSelector/CompareButton.js +132 -12
  61. package/dist/ProfileSelector/MetricsGraphSection.js +228 -63
  62. package/dist/ProfileSelector/index.d.ts +1 -1
  63. package/dist/ProfileSelector/index.d.ts.map +1 -1
  64. package/dist/ProfileSelector/index.js +734 -142
  65. package/dist/ProfileSelector/useAutoQuerySelector.d.ts +1 -3
  66. package/dist/ProfileSelector/useAutoQuerySelector.d.ts.map +1 -1
  67. package/dist/ProfileSelector/useAutoQuerySelector.js +280 -132
  68. package/dist/ProfileSource.js +230 -163
  69. package/dist/ProfileTypeSelector/index.js +214 -125
  70. package/dist/ProfileView/components/ActionButtons/GroupByDropdown.js +50 -4
  71. package/dist/ProfileView/components/ActionButtons/SortByDropdown.js +137 -32
  72. package/dist/ProfileView/components/ColorStackLegend.js +182 -54
  73. package/dist/ProfileView/components/DashboardItems/index.js +87 -28
  74. package/dist/ProfileView/components/DashboardLayout/index.js +108 -16
  75. package/dist/ProfileView/components/DiffLegend.js +172 -29
  76. package/dist/ProfileView/components/GroupByLabelsDropdown/index.js +199 -55
  77. package/dist/ProfileView/components/InvertCallStack/index.js +97 -9
  78. package/dist/ProfileView/components/ProfileFilters/filterPresets.js +260 -315
  79. package/dist/ProfileView/components/ProfileFilters/index.js +518 -215
  80. package/dist/ProfileView/components/ProfileFilters/useProfileFilters.js +370 -306
  81. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.js +191 -118
  82. package/dist/ProfileView/components/ProfileHeader/index.js +105 -11
  83. package/dist/ProfileView/components/ShareButton/ResultBox.js +119 -16
  84. package/dist/ProfileView/components/ShareButton/index.js +352 -62
  85. package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.d.ts.map +1 -1
  86. package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.js +664 -192
  87. package/dist/ProfileView/components/Toolbars/SwitchMenuItem.js +94 -7
  88. package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.js +196 -155
  89. package/dist/ProfileView/components/Toolbars/index.js +441 -21
  90. package/dist/ProfileView/components/ViewSelector/Dropdown.js +233 -22
  91. package/dist/ProfileView/components/ViewSelector/index.js +186 -82
  92. package/dist/ProfileView/components/VisualizationContainer/index.d.ts.map +1 -1
  93. package/dist/ProfileView/components/VisualizationContainer/index.js +52 -7
  94. package/dist/ProfileView/components/VisualizationPanel.js +185 -8
  95. package/dist/ProfileView/context/DashboardContext.js +74 -26
  96. package/dist/ProfileView/context/ProfileViewContext.js +56 -15
  97. package/dist/ProfileView/hooks/useAutoSelectDimension.js +71 -41
  98. package/dist/ProfileView/hooks/useProfileMetadata.js +50 -18
  99. package/dist/ProfileView/hooks/useResetFlameGraphState.js +31 -10
  100. package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.js +71 -27
  101. package/dist/ProfileView/hooks/useResetStateOnSeriesChange.js +53 -17
  102. package/dist/ProfileView/hooks/useVisualizationState.js +229 -69
  103. package/dist/ProfileView/index.js +383 -45
  104. package/dist/ProfileView/types/visualization.js +1 -13
  105. package/dist/ProfileView/utils/colorUtils.js +8 -7
  106. package/dist/ProfileViewWithData.js +319 -225
  107. package/dist/QueryControls/index.js +418 -47
  108. package/dist/Sandwich/components/CalleesSection.js +54 -4
  109. package/dist/Sandwich/components/CallersSection.js +97 -27
  110. package/dist/Sandwich/components/TableSection.js +77 -4
  111. package/dist/Sandwich/index.js +125 -12
  112. package/dist/Sandwich/utils/processRowData.js +48 -39
  113. package/dist/SelectWithRefresh/index.js +102 -28
  114. package/dist/SimpleMatchers/Select.js +520 -187
  115. package/dist/SimpleMatchers/index.js +590 -288
  116. package/dist/SourceView/Highlighter.js +230 -70
  117. package/dist/SourceView/LineNo.js +72 -17
  118. package/dist/SourceView/index.js +177 -101
  119. package/dist/SourceView/lang-detector/ext-to-lang.json +798 -798
  120. package/dist/SourceView/lang-detector/index.js +28 -14
  121. package/dist/SourceView/useSelectedLineRange.js +72 -20
  122. package/dist/Table/ColorCell.js +42 -1
  123. package/dist/Table/ColumnsVisibility.js +114 -6
  124. package/dist/Table/MoreDropdown.js +107 -21
  125. package/dist/Table/TableContextMenu.js +144 -134
  126. package/dist/Table/TableContextMenuWrapper.js +59 -14
  127. package/dist/Table/hooks/useColorManagement.js +58 -16
  128. package/dist/Table/hooks/useTableConfiguration.d.ts.map +1 -1
  129. package/dist/Table/hooks/useTableConfiguration.js +323 -167
  130. package/dist/Table/index.js +217 -123
  131. package/dist/Table/utils/functions.js +169 -144
  132. package/dist/Table/utils/topAndBottomExpandedRowModel.js +69 -52
  133. package/dist/TimelineGuide/index.js +209 -16
  134. package/dist/TopTable/benchmarks/benchdata/populateData.js +91 -0
  135. package/dist/TopTable/index.js +325 -121
  136. package/dist/contexts/LabelsQueryProvider.js +94 -32
  137. package/dist/contexts/UnifiedLabelsContext.js +114 -49
  138. package/dist/contexts/utils.js +37 -15
  139. package/dist/hooks/urlParsers.js +27 -15
  140. package/dist/hooks/useColorBy.js +47 -10
  141. package/dist/hooks/useCompareModeMeta.js +112 -62
  142. package/dist/hooks/useDashboardItems.js +52 -11
  143. package/dist/hooks/useLabels.js +295 -52
  144. package/dist/hooks/useQueryState.d.ts +1 -1
  145. package/dist/hooks/useQueryState.d.ts.map +1 -1
  146. package/dist/hooks/useQueryState.js +375 -329
  147. package/dist/index.js +11 -6
  148. package/dist/testdata/fg-diff.json +3750 -0
  149. package/dist/testdata/fg-simple.json +1879 -0
  150. package/dist/testdata/link_data.json +56 -0
  151. package/dist/testdata/tabular.json +30 -0
  152. package/dist/testdata/test_flamegraph.json +26846 -0
  153. package/dist/testdata/test_graph.json +53 -0
  154. package/dist/useDelayedLoader.js +32 -18
  155. package/dist/useGrpcQuery/index.js +71 -11
  156. package/dist/useHasProfileData.js +90 -12
  157. package/dist/useQuery.js +205 -64
  158. package/dist/useSumBy.d.ts.map +1 -1
  159. package/dist/useSumBy.js +294 -138
  160. package/dist/utils.js +62 -30
  161. package/package.json +9 -9
  162. package/src/GraphTooltipArrow/index.tsx +3 -0
  163. package/src/MatchersInput/SuggestionsList.test.tsx +70 -0
  164. package/src/MatchersInput/SuggestionsList.tsx +11 -10
  165. package/src/MatchersInput/index.tsx +1 -1
  166. package/src/MetricsGraph/MetricsTooltip/index.tsx +22 -34
  167. package/src/PreSelectedMatchers/index.tsx +3 -0
  168. package/src/ProfileExplorer/ProfileExplorerCompare.tsx +9 -2
  169. package/src/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.tsx +3 -0
  170. package/src/ProfileFlameGraph/FlameGraphArrow/TooltipContext.tsx +3 -0
  171. package/src/ProfileFlameGraph/FlameGraphArrow/ZoomControls.tsx +3 -0
  172. package/src/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.ts +3 -0
  173. package/src/ProfileSelector/index.tsx +31 -9
  174. package/src/ProfileSelector/useAutoQuerySelector.ts +64 -42
  175. package/src/ProfileView/components/Toolbars/MultiLevelDropdown.tsx +3 -0
  176. package/src/ProfileView/components/VisualizationContainer/index.tsx +3 -0
  177. package/src/Table/hooks/useTableConfiguration.tsx +7 -13
  178. package/src/hooks/useQueryState.ts +18 -3
  179. package/src/useDelayedLoader.ts +10 -10
  180. package/src/useSumBy.ts +12 -18
  181. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.test.js +0 -455
  182. package/dist/hooks/useQueryState.test.js +0 -868
@@ -1,4 +1,20 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
8
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
10
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
11
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
12
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
13
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
14
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
15
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
16
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
17
+ import { c as _c } from "react-compiler-runtime";
2
18
  // Copyright 2022 The Parca Authors
3
19
  // Licensed under the Apache License, Version 2.0 (the "License");
4
20
  // you may not use this file except in compliance with the License.
@@ -11,208 +27,664 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
11
27
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
28
  // See the License for the specific language governing permissions and
13
29
  // limitations under the License.
14
- import { useCallback, useEffect, useRef, useState } from 'react';
30
+
31
+ /* eslint-disable react-hooks/set-state-in-effect */
32
+
33
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
15
34
  import { Menu } from '@headlessui/react';
16
35
  import { Icon } from '@iconify/react';
17
36
  import cx from 'classnames';
18
37
  import { useQueryState } from 'nuqs';
19
38
  import { USER_PREFERENCES, useUserPreference } from '@parca/hooks';
20
- import { FIELD_FUNCTION_FILE_NAME, FIELD_FUNCTION_NAME, FIELD_LOCATION_ADDRESS, FIELD_MAPPING_FILE, } from '../../../ProfileFlameGraph/FlameGraphArrow';
39
+ import { FIELD_FUNCTION_FILE_NAME, FIELD_FUNCTION_NAME, FIELD_LOCATION_ADDRESS, FIELD_MAPPING_FILE } from '../../../ProfileFlameGraph/FlameGraphArrow';
21
40
  import { boolParam, hiddenBinariesParser, stringParam } from '../../../hooks/urlParsers';
22
41
  import { useProfileViewContext } from '../../context/ProfileViewContext';
23
42
  import SwitchMenuItem from './SwitchMenuItem';
24
- const MenuItem = ({ label, items, onclick, onSelect, path = [], id, closeDropdown, isNested = false, activeValueForSortBy, activeValueForColorBy, activeValuesForLevel, value, disabled = false, icon, customSubmenu, renderAsDiv = false, }) => {
25
- const menuRef = useRef(null);
26
- const [shouldOpenLeft, setShouldOpenLeft] = useState(false);
27
- useEffect(() => {
28
- if (items !== undefined && menuRef.current !== null) {
29
- const rect = menuRef.current.getBoundingClientRect();
30
- const viewportWidth = window.innerWidth;
31
- const menuWidth = 224; // w-56 = 14rem = 224px
32
- const spaceOnRight = viewportWidth - rect.right;
33
- const spaceOnLeft = rect.left;
34
- // Open to the left if there's not enough space on the right but enough on the left
35
- setShouldOpenLeft(spaceOnRight < menuWidth && spaceOnLeft >= menuWidth);
36
- }
37
- }, [items]);
38
- let isActive = false;
39
- if (isNested) {
40
- if (activeValueForSortBy !== undefined && value === activeValueForSortBy) {
41
- isActive = true;
42
- }
43
- if (activeValueForColorBy !== undefined && value === activeValueForColorBy) {
44
- isActive = true;
45
- }
46
- if (activeValuesForLevel?.includes(value ?? '') ?? false) {
47
- isActive = true;
48
- }
43
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
44
+ var _MenuItem = function MenuItem(_ref) {
45
+ 'use no memo';
46
+
47
+ var label = _ref.label,
48
+ items = _ref.items,
49
+ onclick = _ref.onclick,
50
+ _onSelect = _ref.onSelect,
51
+ _ref$path = _ref.path,
52
+ path = _ref$path === void 0 ? [] : _ref$path,
53
+ id = _ref.id,
54
+ closeDropdown = _ref.closeDropdown,
55
+ _ref$isNested = _ref.isNested,
56
+ isNested = _ref$isNested === void 0 ? false : _ref$isNested,
57
+ activeValueForSortBy = _ref.activeValueForSortBy,
58
+ activeValueForColorBy = _ref.activeValueForColorBy,
59
+ activeValuesForLevel = _ref.activeValuesForLevel,
60
+ value = _ref.value,
61
+ _ref$disabled = _ref.disabled,
62
+ disabled = _ref$disabled === void 0 ? false : _ref$disabled,
63
+ icon = _ref.icon,
64
+ customSubmenu = _ref.customSubmenu,
65
+ _ref$renderAsDiv = _ref.renderAsDiv,
66
+ renderAsDiv = _ref$renderAsDiv === void 0 ? false : _ref$renderAsDiv;
67
+ var menuRef = useRef(null);
68
+ var _useState = useState(false),
69
+ _useState2 = _slicedToArray(_useState, 2),
70
+ shouldOpenLeft = _useState2[0],
71
+ setShouldOpenLeft = _useState2[1];
72
+ useEffect(function () {
73
+ if (items !== undefined && menuRef.current !== null) {
74
+ var rect = menuRef.current.getBoundingClientRect();
75
+ var viewportWidth = window.innerWidth;
76
+ var menuWidth = 224; // w-56 = 14rem = 224px
77
+ var spaceOnRight = viewportWidth - rect.right;
78
+ var spaceOnLeft = rect.left;
79
+
80
+ // Open to the left if there's not enough space on the right but enough on the left
81
+ setShouldOpenLeft(spaceOnRight < menuWidth && spaceOnLeft >= menuWidth);
49
82
  }
50
- const handleSelect = () => {
51
- if (items === undefined) {
52
- if (onclick !== undefined) {
53
- onclick();
54
- closeDropdown();
55
- }
56
- else {
57
- onSelect([...path, label]);
58
- closeDropdown();
59
- }
83
+ }, [items]);
84
+ var isActive = false;
85
+ if (isNested) {
86
+ var _activeValuesForLevel;
87
+ if (activeValueForSortBy !== undefined && value === activeValueForSortBy) {
88
+ isActive = true;
89
+ }
90
+ if (activeValueForColorBy !== undefined && value === activeValueForColorBy) {
91
+ isActive = true;
92
+ }
93
+ if ((_activeValuesForLevel = activeValuesForLevel === null || activeValuesForLevel === void 0 ? void 0 : activeValuesForLevel.includes(value !== null && value !== void 0 ? value : '')) !== null && _activeValuesForLevel !== void 0 ? _activeValuesForLevel : false) {
94
+ isActive = true;
95
+ }
96
+ }
97
+ var handleSelect = function handleSelect() {
98
+ if (items === undefined) {
99
+ if (onclick !== undefined) {
100
+ onclick();
101
+ closeDropdown();
102
+ } else {
103
+ _onSelect([].concat(_toConsumableArray(path), [label]));
104
+ closeDropdown();
105
+ }
106
+ }
107
+ };
108
+ return /*#__PURE__*/_jsx("div", {
109
+ className: "relative",
110
+ ref: menuRef,
111
+ children: /*#__PURE__*/_jsx(Menu, {
112
+ children: function children(_ref2) {
113
+ var close = _ref2.close;
114
+ return /*#__PURE__*/_jsxs(_Fragment, {
115
+ children: [/*#__PURE__*/_jsxs(Menu.Button, {
116
+ as: renderAsDiv ? 'div' : 'button',
117
+ className: "w-full text-left px-4 py-2 text-sm ".concat(disabled ? 'text-gray-400' : isActive ? 'text-white bg-indigo-400 hover:text-white' : 'text-white-600 hover:bg-indigo-600 hover:text-white', " flex justify-between items-center"),
118
+ onClick: handleSelect,
119
+ id: id,
120
+ disabled: disabled,
121
+ children: [customSubmenu !== undefined ? customSubmenu : /*#__PURE__*/_jsxs("span", {
122
+ className: "flex items-center",
123
+ children: [/*#__PURE__*/_jsxs("div", {
124
+ className: "flex items-center gap-2",
125
+ children: [icon !== undefined && /*#__PURE__*/_jsx(Icon, {
126
+ icon: icon,
127
+ className: "h-4 w-4"
128
+ }), /*#__PURE__*/_jsx("span", {
129
+ children: label
130
+ })]
131
+ }), isActive && /*#__PURE__*/_jsx(Icon, {
132
+ icon: "heroicons-solid:check",
133
+ className: "ml-2 h-4 w-4"
134
+ })]
135
+ }), items !== undefined && /*#__PURE__*/_jsx(Icon, {
136
+ icon: "flowbite:caret-right-solid",
137
+ className: "h-[14px] w-[14px]"
138
+ })]
139
+ }), items !== undefined && /*#__PURE__*/_jsx(Menu.Items, {
140
+ className: "absolute top-0 w-56 mt-0 bg-white border border-gray-200 rounded-md shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none dark:bg-gray-900 dark:border-gray-600 ".concat(shouldOpenLeft ? 'right-full mr-1 origin-top-left' : 'left-full ml-1 origin-top-right'),
141
+ children: items === null || items === void 0 ? void 0 : items.map(function (item, index) {
142
+ return /*#__PURE__*/_jsx(_MenuItem, _objectSpread(_objectSpread({}, item), {}, {
143
+ onSelect: function onSelect(selectedPath) {
144
+ _onSelect([].concat(_toConsumableArray(path), _toConsumableArray(selectedPath)));
145
+ close();
146
+ closeDropdown();
147
+ },
148
+ path: [].concat(_toConsumableArray(path), [label]),
149
+ closeDropdown: closeDropdown,
150
+ isNested: true,
151
+ activeValueForSortBy: activeValueForSortBy,
152
+ activeValueForColorBy: activeValueForColorBy,
153
+ activeValuesForLevel: activeValuesForLevel
154
+ }), index);
155
+ })
156
+ })]
157
+ });
158
+ }
159
+ })
160
+ });
161
+ };
162
+ var MultiLevelDropdown = function MultiLevelDropdown(t0) {
163
+ var $ = _c(93);
164
+ var onSelect = t0.onSelect,
165
+ profileType = t0.profileType,
166
+ groupBy = t0.groupBy,
167
+ toggleGroupBy = t0.toggleGroupBy,
168
+ isTableVizOnly = t0.isTableVizOnly,
169
+ alignFunctionName = t0.alignFunctionName,
170
+ setAlignFunctionName = t0.setAlignFunctionName,
171
+ colorBy = t0.colorBy,
172
+ setColorBy = t0.setColorBy;
173
+ var dropdownRef = useRef(null);
174
+ var _useState3 = useState(false),
175
+ _useState4 = _slicedToArray(_useState3, 2),
176
+ shouldOpenLeft = _useState4[0],
177
+ setShouldOpenLeft = _useState4[1];
178
+ var t1;
179
+ if ($[0] === Symbol["for"]("react.memo_cache_sentinel")) {
180
+ t1 = stringParam.withDefault(FIELD_FUNCTION_NAME);
181
+ $[0] = t1;
182
+ } else {
183
+ t1 = $[0];
184
+ }
185
+ var _useQueryState = useQueryState("sort_by", t1),
186
+ _useQueryState2 = _slicedToArray(_useQueryState, 1),
187
+ storeSortBy = _useQueryState2[0];
188
+ var _useQueryState3 = useQueryState("color_stack_legend", stringParam),
189
+ _useQueryState4 = _slicedToArray(_useQueryState3, 2),
190
+ colorStackLegend = _useQueryState4[0],
191
+ setStoreColorStackLegend = _useQueryState4[1];
192
+ var _useQueryState5 = useQueryState("hidden_binaries", hiddenBinariesParser),
193
+ _useQueryState6 = _slicedToArray(_useQueryState5, 2),
194
+ hiddenBinaries = _useQueryState6[0],
195
+ setHiddenBinaries = _useQueryState6[1];
196
+ var _useProfileViewContex = useProfileViewContext(),
197
+ compareMode = _useProfileViewContex.compareMode;
198
+ var _useUserPreference = useUserPreference(USER_PREFERENCES.FLAMEGRAPH_COLOR_PROFILE.key),
199
+ _useUserPreference2 = _slicedToArray(_useUserPreference, 1),
200
+ colorProfileName = _useUserPreference2[0];
201
+ var isColorStackLegendEnabled = colorStackLegend === "true";
202
+ var isLeftAligned = alignFunctionName === "left";
203
+ var compareAbsoluteDefault = (profileType === null || profileType === void 0 ? void 0 : profileType.delta) === false;
204
+ var _useQueryState7 = useQueryState("compare_absolute", boolParam),
205
+ _useQueryState8 = _slicedToArray(_useQueryState7, 2),
206
+ compareAbsolute = _useQueryState8[0],
207
+ setCompareAbsolute = _useQueryState8[1];
208
+ var isCompareAbsolute = compareAbsolute !== null && compareAbsolute !== void 0 ? compareAbsolute : compareAbsoluteDefault;
209
+ var t2;
210
+ var t3;
211
+ if ($[1] !== isTableVizOnly) {
212
+ t2 = function t2() {
213
+ var checkOverflow = function checkOverflow() {
214
+ if (dropdownRef.current !== null) {
215
+ var rect = dropdownRef.current.getBoundingClientRect();
216
+ var viewportWidth = window.innerWidth;
217
+ var menuWidth = isTableVizOnly ? 256 : 320;
218
+ var spaceOnRight = viewportWidth - rect.right;
219
+ var spaceOnLeft = rect.left;
220
+ setShouldOpenLeft(spaceOnRight < menuWidth && spaceOnLeft >= menuWidth);
60
221
  }
222
+ };
223
+ checkOverflow();
224
+ window.addEventListener("resize", checkOverflow);
225
+ return function () {
226
+ return window.removeEventListener("resize", checkOverflow);
227
+ };
61
228
  };
62
- return (_jsx("div", { className: "relative", ref: menuRef, children: _jsx(Menu, { children: ({ close }) => (_jsxs(_Fragment, { children: [_jsxs(Menu.Button, { as: renderAsDiv ? 'div' : 'button', className: `w-full text-left px-4 py-2 text-sm ${disabled
63
- ? 'text-gray-400'
64
- : isActive
65
- ? 'text-white bg-indigo-400 hover:text-white'
66
- : 'text-white-600 hover:bg-indigo-600 hover:text-white'} flex justify-between items-center`, onClick: handleSelect, id: id, disabled: disabled, children: [customSubmenu !== undefined ? (customSubmenu) : (_jsxs("span", { className: "flex items-center", children: [_jsxs("div", { className: "flex items-center gap-2", children: [icon !== undefined && _jsx(Icon, { icon: icon, className: "h-4 w-4" }), _jsx("span", { children: label })] }), isActive && _jsx(Icon, { icon: "heroicons-solid:check", className: "ml-2 h-4 w-4" })] })), items !== undefined && (_jsx(Icon, { icon: "flowbite:caret-right-solid", className: "h-[14px] w-[14px]" }))] }), items !== undefined && (_jsx(Menu.Items, { className: `absolute top-0 w-56 mt-0 bg-white border border-gray-200 rounded-md shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none dark:bg-gray-900 dark:border-gray-600 ${shouldOpenLeft
67
- ? 'right-full mr-1 origin-top-left'
68
- : 'left-full ml-1 origin-top-right'}`, children: items?.map((item, index) => (_jsx(MenuItem, { ...item, onSelect: selectedPath => {
69
- onSelect([...path, ...selectedPath]);
70
- close();
71
- closeDropdown();
72
- }, path: [...path, label], closeDropdown: closeDropdown, isNested: true, activeValueForSortBy: activeValueForSortBy, activeValueForColorBy: activeValueForColorBy, activeValuesForLevel: activeValuesForLevel }, index))) }))] })) }) }));
73
- };
74
- const MultiLevelDropdown = ({ onSelect, profileType, groupBy, toggleGroupBy, isTableVizOnly, alignFunctionName, setAlignFunctionName, colorBy, setColorBy, }) => {
75
- const dropdownRef = useRef(null);
76
- const [shouldOpenLeft, setShouldOpenLeft] = useState(false);
77
- const [storeSortBy] = useQueryState('sort_by', stringParam.withDefault(FIELD_FUNCTION_NAME));
78
- const [colorStackLegend, setStoreColorStackLegend] = useQueryState('color_stack_legend', stringParam);
79
- const [hiddenBinaries, setHiddenBinaries] = useQueryState('hidden_binaries', hiddenBinariesParser);
80
- const { compareMode } = useProfileViewContext();
81
- const [colorProfileName] = useUserPreference(USER_PREFERENCES.FLAMEGRAPH_COLOR_PROFILE.key);
82
- const isColorStackLegendEnabled = colorStackLegend === 'true';
83
- const isLeftAligned = alignFunctionName === 'left';
84
- // By default, we want delta profiles (CPU) to be relatively compared.
85
- // For non-delta profiles, like goroutines or memory, we want the profiles to be compared absolutely.
86
- const compareAbsoluteDefault = profileType?.delta === false;
87
- const [compareAbsolute, setCompareAbsolute] = useQueryState('compare_absolute', boolParam);
88
- const isCompareAbsolute = compareAbsolute ?? compareAbsoluteDefault;
89
- useEffect(() => {
90
- const checkOverflow = () => {
91
- if (dropdownRef.current !== null) {
92
- const rect = dropdownRef.current.getBoundingClientRect();
93
- const viewportWidth = window.innerWidth;
94
- const menuWidth = isTableVizOnly ? 256 : 320; // w-64 = 256px, w-80 = 320px
95
- const spaceOnRight = viewportWidth - rect.right;
96
- const spaceOnLeft = rect.left;
97
- setShouldOpenLeft(spaceOnRight < menuWidth && spaceOnLeft >= menuWidth);
229
+ t3 = [isTableVizOnly];
230
+ $[1] = isTableVizOnly;
231
+ $[2] = t2;
232
+ $[3] = t3;
233
+ } else {
234
+ t2 = $[2];
235
+ t3 = $[3];
236
+ }
237
+ useEffect(t2, t3);
238
+ var t4;
239
+ if ($[4] !== hiddenBinaries || $[5] !== setHiddenBinaries) {
240
+ t4 = function t4(index) {
241
+ var updatedBinaries = _toConsumableArray(hiddenBinaries);
242
+ updatedBinaries.splice(index, 1);
243
+ setHiddenBinaries(updatedBinaries);
244
+ };
245
+ $[4] = hiddenBinaries;
246
+ $[5] = setHiddenBinaries;
247
+ $[6] = t4;
248
+ } else {
249
+ t4 = $[6];
250
+ }
251
+ var handleBinaryToggle = t4;
252
+ var t5;
253
+ if ($[7] !== setStoreColorStackLegend) {
254
+ t5 = function t5(value) {
255
+ setStoreColorStackLegend(value);
256
+ };
257
+ $[7] = setStoreColorStackLegend;
258
+ $[8] = t5;
259
+ } else {
260
+ t5 = $[8];
261
+ }
262
+ var setColorStackLegend = t5;
263
+ var t6;
264
+ if ($[9] !== setHiddenBinaries) {
265
+ t6 = function t6() {
266
+ setHiddenBinaries([]);
267
+ };
268
+ $[9] = setHiddenBinaries;
269
+ $[10] = t6;
270
+ } else {
271
+ t6 = $[10];
272
+ }
273
+ var resetLegend = t6;
274
+ var t7;
275
+ if ($[11] !== toggleGroupBy) {
276
+ t7 = {
277
+ label: "Function",
278
+ onclick: function onclick() {
279
+ return toggleGroupBy(FIELD_FUNCTION_NAME);
280
+ },
281
+ value: FIELD_FUNCTION_NAME
282
+ };
283
+ $[11] = toggleGroupBy;
284
+ $[12] = t7;
285
+ } else {
286
+ t7 = $[12];
287
+ }
288
+ var t8;
289
+ if ($[13] !== toggleGroupBy) {
290
+ t8 = {
291
+ label: "Binary",
292
+ onclick: function onclick() {
293
+ return toggleGroupBy(FIELD_MAPPING_FILE);
294
+ },
295
+ value: FIELD_MAPPING_FILE
296
+ };
297
+ $[13] = toggleGroupBy;
298
+ $[14] = t8;
299
+ } else {
300
+ t8 = $[14];
301
+ }
302
+ var t9;
303
+ if ($[15] !== toggleGroupBy) {
304
+ t9 = {
305
+ label: "Code",
306
+ onclick: function onclick() {
307
+ return toggleGroupBy(FIELD_FUNCTION_FILE_NAME);
308
+ },
309
+ value: FIELD_FUNCTION_FILE_NAME
310
+ };
311
+ $[15] = toggleGroupBy;
312
+ $[16] = t9;
313
+ } else {
314
+ t9 = $[16];
315
+ }
316
+ var t10;
317
+ if ($[17] !== toggleGroupBy) {
318
+ t10 = {
319
+ label: "Address",
320
+ onclick: function onclick() {
321
+ return toggleGroupBy(FIELD_LOCATION_ADDRESS);
322
+ },
323
+ value: FIELD_LOCATION_ADDRESS
324
+ };
325
+ $[17] = toggleGroupBy;
326
+ $[18] = t10;
327
+ } else {
328
+ t10 = $[18];
329
+ }
330
+ var t11;
331
+ if ($[19] !== t10 || $[20] !== t7 || $[21] !== t8 || $[22] !== t9) {
332
+ t11 = [t7, t8, t9, t10];
333
+ $[19] = t10;
334
+ $[20] = t7;
335
+ $[21] = t8;
336
+ $[22] = t9;
337
+ $[23] = t11;
338
+ } else {
339
+ t11 = $[23];
340
+ }
341
+ var t12 = !!isTableVizOnly;
342
+ var t13;
343
+ if ($[24] !== t11 || $[25] !== t12) {
344
+ t13 = {
345
+ label: "Levels",
346
+ id: "h-levels-filter",
347
+ items: t11,
348
+ hide: t12,
349
+ icon: "heroicons-solid:bars-3"
350
+ };
351
+ $[24] = t11;
352
+ $[25] = t12;
353
+ $[26] = t13;
354
+ } else {
355
+ t13 = $[26];
356
+ }
357
+ var t14;
358
+ if ($[27] !== setColorBy) {
359
+ t14 = {
360
+ label: "Binary",
361
+ onclick: function onclick() {
362
+ return setColorBy("binary");
363
+ },
364
+ value: "binary"
365
+ };
366
+ $[27] = setColorBy;
367
+ $[28] = t14;
368
+ } else {
369
+ t14 = $[28];
370
+ }
371
+ var t15;
372
+ if ($[29] !== setColorBy) {
373
+ t15 = {
374
+ label: "Filename",
375
+ onclick: function onclick() {
376
+ return setColorBy("filename");
377
+ },
378
+ value: "filename"
379
+ };
380
+ $[29] = setColorBy;
381
+ $[30] = t15;
382
+ } else {
383
+ t15 = $[30];
384
+ }
385
+ var t16;
386
+ if ($[31] !== t14 || $[32] !== t15) {
387
+ t16 = {
388
+ label: "Color by",
389
+ id: "h-color-by-filter",
390
+ items: [t14, t15],
391
+ hide: false,
392
+ icon: "carbon:color-palette"
393
+ };
394
+ $[31] = t14;
395
+ $[32] = t15;
396
+ $[33] = t16;
397
+ } else {
398
+ t16 = $[33];
399
+ }
400
+ var t17 = isColorStackLegendEnabled ? "Hide legend" : "Show legend";
401
+ var t18;
402
+ if ($[34] !== isColorStackLegendEnabled || $[35] !== setColorStackLegend) {
403
+ t18 = function t18() {
404
+ return setColorStackLegend(isColorStackLegendEnabled ? "false" : "true");
405
+ };
406
+ $[34] = isColorStackLegendEnabled;
407
+ $[35] = setColorStackLegend;
408
+ $[36] = t18;
409
+ } else {
410
+ t18 = $[36];
411
+ }
412
+ var t19 = compareMode || colorProfileName === "default";
413
+ var t20 = isColorStackLegendEnabled ? "ph:eye-closed" : "ph:eye";
414
+ var t21;
415
+ if ($[37] !== t17 || $[38] !== t18 || $[39] !== t19 || $[40] !== t20) {
416
+ t21 = {
417
+ label: t17,
418
+ onclick: t18,
419
+ hide: t19,
420
+ id: "h-show-legend-button",
421
+ icon: t20
422
+ };
423
+ $[37] = t17;
424
+ $[38] = t18;
425
+ $[39] = t19;
426
+ $[40] = t20;
427
+ $[41] = t21;
428
+ } else {
429
+ t21 = $[41];
430
+ }
431
+ var t22 = isLeftAligned ? "Right-align function names" : "Left-align function names";
432
+ var t23;
433
+ if ($[42] !== isLeftAligned || $[43] !== setAlignFunctionName) {
434
+ t23 = function t23() {
435
+ return setAlignFunctionName(isLeftAligned ? "right" : "left");
436
+ };
437
+ $[42] = isLeftAligned;
438
+ $[43] = setAlignFunctionName;
439
+ $[44] = t23;
440
+ } else {
441
+ t23 = $[44];
442
+ }
443
+ var t24 = !!isTableVizOnly;
444
+ var t25 = isLeftAligned ? "ic:outline-align-horizontal-right" : "ic:outline-align-horizontal-left";
445
+ var t26;
446
+ if ($[45] !== t22 || $[46] !== t23 || $[47] !== t24 || $[48] !== t25) {
447
+ t26 = {
448
+ label: t22,
449
+ onclick: t23,
450
+ id: "h-align-function-names",
451
+ hide: t24,
452
+ icon: t25
453
+ };
454
+ $[45] = t22;
455
+ $[46] = t23;
456
+ $[47] = t24;
457
+ $[48] = t25;
458
+ $[49] = t26;
459
+ } else {
460
+ t26 = $[49];
461
+ }
462
+ var t27 = isCompareAbsolute ? "Compare Relative" : "Compare Absolute";
463
+ var t28;
464
+ if ($[50] !== isCompareAbsolute || $[51] !== setCompareAbsolute) {
465
+ t28 = function t28() {
466
+ return void setCompareAbsolute(!isCompareAbsolute);
467
+ };
468
+ $[50] = isCompareAbsolute;
469
+ $[51] = setCompareAbsolute;
470
+ $[52] = t28;
471
+ } else {
472
+ t28 = $[52];
473
+ }
474
+ var t29 = !compareMode;
475
+ var t30 = isCompareAbsolute ? "fluent-mdl2:compare" : "fluent-mdl2:compare-uneven";
476
+ var t31;
477
+ if ($[53] !== t27 || $[54] !== t28 || $[55] !== t29 || $[56] !== t30) {
478
+ t31 = {
479
+ label: t27,
480
+ onclick: t28,
481
+ hide: t29,
482
+ icon: t30
483
+ };
484
+ $[53] = t27;
485
+ $[54] = t28;
486
+ $[55] = t29;
487
+ $[56] = t30;
488
+ $[57] = t31;
489
+ } else {
490
+ t31 = $[57];
491
+ }
492
+ var t32 = !!isTableVizOnly;
493
+ var t33;
494
+ if ($[58] === Symbol["for"]("react.memo_cache_sentinel")) {
495
+ t33 = /*#__PURE__*/_jsx(SwitchMenuItem, {
496
+ label: "Dock graph tooltip",
497
+ id: "h-dock-graph-meta-info",
498
+ userPreferenceDetails: USER_PREFERENCES.GRAPH_METAINFO_DOCKED
499
+ });
500
+ $[58] = t33;
501
+ } else {
502
+ t33 = $[58];
503
+ }
504
+ var t34;
505
+ if ($[59] !== t32) {
506
+ t34 = {
507
+ label: "Dock Graph MetaInfo",
508
+ hide: t32,
509
+ customSubmenu: t33,
510
+ renderAsDiv: true
511
+ };
512
+ $[59] = t32;
513
+ $[60] = t34;
514
+ } else {
515
+ t34 = $[60];
516
+ }
517
+ var t35 = !!isTableVizOnly;
518
+ var t36;
519
+ if ($[61] === Symbol["for"]("react.memo_cache_sentinel")) {
520
+ t36 = /*#__PURE__*/_jsx(SwitchMenuItem, {
521
+ label: "Highlight similar stacks when hovering over a node",
522
+ id: "h-highlight-similar-stacks",
523
+ userPreferenceDetails: USER_PREFERENCES.HIGHLIGHT_SIMILAR_STACKS
524
+ });
525
+ $[61] = t36;
526
+ } else {
527
+ t36 = $[61];
528
+ }
529
+ var t37;
530
+ if ($[62] !== t35) {
531
+ t37 = {
532
+ label: "Highlight similar stacks when hovering over a node",
533
+ hide: t35,
534
+ customSubmenu: t36,
535
+ renderAsDiv: true
536
+ };
537
+ $[62] = t35;
538
+ $[63] = t37;
539
+ } else {
540
+ t37 = $[63];
541
+ }
542
+ var t38 = hiddenBinaries.length === 0;
543
+ var t39;
544
+ if ($[64] !== resetLegend) {
545
+ t39 = function t39() {
546
+ return resetLegend();
547
+ };
548
+ $[64] = resetLegend;
549
+ $[65] = t39;
550
+ } else {
551
+ t39 = $[65];
552
+ }
553
+ var t40;
554
+ if ($[66] !== t38 || $[67] !== t39) {
555
+ t40 = {
556
+ label: "Reset Legend",
557
+ hide: t38,
558
+ onclick: t39,
559
+ id: "h-reset-legend-button",
560
+ icon: "system-uicons:reset"
561
+ };
562
+ $[66] = t38;
563
+ $[67] = t39;
564
+ $[68] = t40;
565
+ } else {
566
+ t40 = $[68];
567
+ }
568
+ var t41;
569
+ if ($[69] !== handleBinaryToggle || $[70] !== hiddenBinaries) {
570
+ t41 = hiddenBinaries.map(function (binary, index_0) {
571
+ return {
572
+ label: binary,
573
+ customSubmenu: /*#__PURE__*/_jsxs("div", {
574
+ className: "flex items-center gap-2 w-full",
575
+ children: [/*#__PURE__*/_jsx("input", {
576
+ id: binary,
577
+ name: binary,
578
+ type: "checkbox",
579
+ className: "h-4 w-4 rounded-md border-2 border-gray-300 text-indigo-600 focus:ring-indigo-600 focus:ring-offset-0 checked:bg-indigo-600 checked:border-indigo-600",
580
+ checked: hiddenBinaries === null || hiddenBinaries === void 0 ? void 0 : hiddenBinaries.includes(binary),
581
+ onChange: function onChange() {
582
+ return handleBinaryToggle(index_0);
98
583
  }
99
- };
100
- checkOverflow();
101
- window.addEventListener('resize', checkOverflow);
102
- return () => window.removeEventListener('resize', checkOverflow);
103
- }, [isTableVizOnly]);
104
- const handleBinaryToggle = (index) => {
105
- const updatedBinaries = [...hiddenBinaries];
106
- updatedBinaries.splice(index, 1);
107
- void setHiddenBinaries(updatedBinaries);
108
- };
109
- const setColorStackLegend = useCallback((value) => {
110
- void setStoreColorStackLegend(value);
111
- }, [setStoreColorStackLegend]);
112
- const resetLegend = () => {
113
- void setHiddenBinaries([]);
114
- };
115
- const menuItems = [
116
- {
117
- label: 'Levels',
118
- id: 'h-levels-filter',
119
- items: [
120
- {
121
- label: 'Function',
122
- onclick: () => toggleGroupBy(FIELD_FUNCTION_NAME),
123
- value: FIELD_FUNCTION_NAME,
124
- },
125
- {
126
- label: 'Binary',
127
- onclick: () => toggleGroupBy(FIELD_MAPPING_FILE),
128
- value: FIELD_MAPPING_FILE,
129
- },
130
- {
131
- label: 'Code',
132
- onclick: () => toggleGroupBy(FIELD_FUNCTION_FILE_NAME),
133
- value: FIELD_FUNCTION_FILE_NAME,
134
- },
135
- {
136
- label: 'Address',
137
- onclick: () => toggleGroupBy(FIELD_LOCATION_ADDRESS),
138
- value: FIELD_LOCATION_ADDRESS,
139
- },
140
- ],
141
- hide: !!isTableVizOnly,
142
- icon: 'heroicons-solid:bars-3',
143
- },
144
- {
145
- label: 'Color by',
146
- id: 'h-color-by-filter',
147
- items: [
148
- {
149
- label: 'Binary',
150
- onclick: () => setColorBy('binary'),
151
- value: 'binary',
152
- },
153
- {
154
- label: 'Filename',
155
- onclick: () => setColorBy('filename'),
156
- value: 'filename',
157
- },
158
- ],
159
- hide: false,
160
- icon: 'carbon:color-palette',
161
- },
162
- {
163
- label: isColorStackLegendEnabled ? 'Hide legend' : 'Show legend',
164
- onclick: () => setColorStackLegend(isColorStackLegendEnabled ? 'false' : 'true'),
165
- hide: compareMode || colorProfileName === 'default',
166
- id: 'h-show-legend-button',
167
- icon: isColorStackLegendEnabled ? 'ph:eye-closed' : 'ph:eye',
168
- },
169
- {
170
- label: isLeftAligned ? 'Right-align function names' : 'Left-align function names',
171
- onclick: () => setAlignFunctionName(isLeftAligned ? 'right' : 'left'),
172
- id: 'h-align-function-names',
173
- hide: !!isTableVizOnly,
174
- icon: isLeftAligned
175
- ? 'ic:outline-align-horizontal-right'
176
- : 'ic:outline-align-horizontal-left',
177
- },
178
- {
179
- label: isCompareAbsolute ? 'Compare Relative' : 'Compare Absolute',
180
- onclick: () => void setCompareAbsolute(!isCompareAbsolute),
181
- hide: !compareMode,
182
- icon: isCompareAbsolute ? 'fluent-mdl2:compare' : 'fluent-mdl2:compare-uneven',
183
- },
184
- {
185
- label: 'Dock Graph MetaInfo',
186
- hide: !!isTableVizOnly,
187
- customSubmenu: (_jsx(SwitchMenuItem, { label: "Dock graph tooltip", id: "h-dock-graph-meta-info", userPreferenceDetails: USER_PREFERENCES.GRAPH_METAINFO_DOCKED })),
188
- renderAsDiv: true,
189
- },
190
- {
191
- label: 'Highlight similar stacks when hovering over a node',
192
- hide: !!isTableVizOnly,
193
- customSubmenu: (_jsx(SwitchMenuItem, { label: "Highlight similar stacks when hovering over a node", id: "h-highlight-similar-stacks", userPreferenceDetails: USER_PREFERENCES.HIGHLIGHT_SIMILAR_STACKS })),
194
- renderAsDiv: true,
195
- },
196
- {
197
- label: 'Reset Legend',
198
- hide: hiddenBinaries.length === 0,
199
- onclick: () => resetLegend(),
200
- id: 'h-reset-legend-button',
201
- icon: 'system-uicons:reset',
202
- },
203
- {
204
- label: 'Hidden Binaries',
205
- id: 'h-hidden-binaries',
206
- items: hiddenBinaries.map((binary, index) => ({
207
- label: binary,
208
- customSubmenu: (_jsxs("div", { className: "flex items-center gap-2 w-full", children: [_jsx("input", { id: binary, name: binary, type: "checkbox", className: "h-4 w-4 rounded-md border-2 border-gray-300 text-indigo-600 focus:ring-indigo-600 focus:ring-offset-0 checked:bg-indigo-600 checked:border-indigo-600", checked: hiddenBinaries?.includes(binary), onChange: () => handleBinaryToggle(index) }), _jsx("span", { children: binary })] })),
209
- })),
210
- hide: hiddenBinaries.length === 0,
211
- icon: 'ph:eye-closed',
212
- },
213
- ];
214
- return (_jsx("div", { className: "relative inline-block text-left", id: "h-visualisation-toolbar-actions", ref: dropdownRef, children: _jsx(Menu, { children: ({ open, close }) => (_jsxs(_Fragment, { children: [_jsxs(Menu.Button, { className: "flex dark:bg-gray-900 dark:border-gray-600 justify-center w-full px-4 py-2 text-sm font-normal text-gray-600 dark:text-gray-200 bg-white rounded-md focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75 border border-gray-200 pr-[1.7rem]", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Icon, { icon: "pajamas:preferences", className: "w-4 h-4" }), _jsx("span", { children: "Preferences" })] }), _jsx("span", { className: "pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2 text-gray-400", children: _jsx(Icon, { icon: "heroicons:chevron-down-20-solid", "aria-hidden": "true" }) })] }), open && (_jsx(Menu.Items, { className: cx(isTableVizOnly ? 'w-64' : 'w-80', 'absolute z-50 mt-2 py-2 bg-white rounded-md shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none border dark:bg-gray-900 dark:border-gray-600', shouldOpenLeft ? 'right-0 origin-top-right' : 'left-0 origin-top-left'), children: menuItems
215
- .filter(item => item.hide !== undefined && !item.hide)
216
- .map((item, index) => (_jsx(MenuItem, { ...item, onSelect: onSelect, closeDropdown: close, activeValueForSortBy: storeSortBy, activeValueForColorBy: colorBy, activeValuesForLevel: groupBy, renderAsDiv: item.renderAsDiv }, index))) }))] })) }) }));
584
+ }), /*#__PURE__*/_jsx("span", {
585
+ children: binary
586
+ })]
587
+ })
588
+ };
589
+ });
590
+ $[69] = handleBinaryToggle;
591
+ $[70] = hiddenBinaries;
592
+ $[71] = t41;
593
+ } else {
594
+ t41 = $[71];
595
+ }
596
+ var t42 = hiddenBinaries.length === 0;
597
+ var t43;
598
+ if ($[72] !== t41 || $[73] !== t42) {
599
+ t43 = {
600
+ label: "Hidden Binaries",
601
+ id: "h-hidden-binaries",
602
+ items: t41,
603
+ hide: t42,
604
+ icon: "ph:eye-closed"
605
+ };
606
+ $[72] = t41;
607
+ $[73] = t42;
608
+ $[74] = t43;
609
+ } else {
610
+ t43 = $[74];
611
+ }
612
+ var t44;
613
+ if ($[75] !== t13 || $[76] !== t16 || $[77] !== t21 || $[78] !== t26 || $[79] !== t31 || $[80] !== t34 || $[81] !== t37 || $[82] !== t40 || $[83] !== t43) {
614
+ t44 = [t13, t16, t21, t26, t31, t34, t37, t40, t43];
615
+ $[75] = t13;
616
+ $[76] = t16;
617
+ $[77] = t21;
618
+ $[78] = t26;
619
+ $[79] = t31;
620
+ $[80] = t34;
621
+ $[81] = t37;
622
+ $[82] = t40;
623
+ $[83] = t43;
624
+ $[84] = t44;
625
+ } else {
626
+ t44 = $[84];
627
+ }
628
+ var menuItems = t44;
629
+ var t45;
630
+ if ($[85] !== colorBy || $[86] !== groupBy || $[87] !== isTableVizOnly || $[88] !== menuItems || $[89] !== onSelect || $[90] !== shouldOpenLeft || $[91] !== storeSortBy) {
631
+ t45 = /*#__PURE__*/_jsx("div", {
632
+ className: "relative inline-block text-left",
633
+ id: "h-visualisation-toolbar-actions",
634
+ ref: dropdownRef,
635
+ children: /*#__PURE__*/_jsx(Menu, {
636
+ children: function children(t46) {
637
+ var open = t46.open,
638
+ close = t46.close;
639
+ return /*#__PURE__*/_jsxs(_Fragment, {
640
+ children: [/*#__PURE__*/_jsxs(Menu.Button, {
641
+ className: "flex dark:bg-gray-900 dark:border-gray-600 justify-center w-full px-4 py-2 text-sm font-normal text-gray-600 dark:text-gray-200 bg-white rounded-md focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75 border border-gray-200 pr-[1.7rem]",
642
+ children: [/*#__PURE__*/_jsxs("div", {
643
+ className: "flex items-center gap-2",
644
+ children: [/*#__PURE__*/_jsx(Icon, {
645
+ icon: "pajamas:preferences",
646
+ className: "w-4 h-4"
647
+ }), /*#__PURE__*/_jsx("span", {
648
+ children: "Preferences"
649
+ })]
650
+ }), /*#__PURE__*/_jsx("span", {
651
+ className: "pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2 text-gray-400",
652
+ children: /*#__PURE__*/_jsx(Icon, {
653
+ icon: "heroicons:chevron-down-20-solid",
654
+ "aria-hidden": "true"
655
+ })
656
+ })]
657
+ }), open && /*#__PURE__*/_jsx(Menu.Items, {
658
+ className: cx(isTableVizOnly ? "w-64" : "w-80", "absolute z-50 mt-2 py-2 bg-white rounded-md shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none border dark:bg-gray-900 dark:border-gray-600", shouldOpenLeft ? "right-0 origin-top-right" : "left-0 origin-top-left"),
659
+ children: menuItems.filter(_temp).map(function (item_0, index_1) {
660
+ return /*#__PURE__*/_jsx(_MenuItem, _objectSpread(_objectSpread({}, item_0), {}, {
661
+ onSelect: onSelect,
662
+ closeDropdown: close,
663
+ activeValueForSortBy: storeSortBy,
664
+ activeValueForColorBy: colorBy,
665
+ activeValuesForLevel: groupBy,
666
+ renderAsDiv: item_0.renderAsDiv
667
+ }), index_1);
668
+ })
669
+ })]
670
+ });
671
+ }
672
+ })
673
+ });
674
+ $[85] = colorBy;
675
+ $[86] = groupBy;
676
+ $[87] = isTableVizOnly;
677
+ $[88] = menuItems;
678
+ $[89] = onSelect;
679
+ $[90] = shouldOpenLeft;
680
+ $[91] = storeSortBy;
681
+ $[92] = t45;
682
+ } else {
683
+ t45 = $[92];
684
+ }
685
+ return t45;
217
686
  };
218
687
  export default MultiLevelDropdown;
688
+ function _temp(item) {
689
+ return item.hide !== undefined && !item.hide;
690
+ }