@parca/profile 0.19.139 → 0.19.142

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