@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,8 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
2
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
3
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
4
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
5
+ import { c as _c } from "react-compiler-runtime";
2
6
  // Copyright 2022 The Parca Authors
3
7
  // Licensed under the Apache License, Version 2.0 (the "License");
4
8
  // you may not use this file except in compliance with the License.
@@ -11,6 +15,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
11
15
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
16
  // See the License for the specific language governing permissions and
13
17
  // limitations under the License.
18
+
14
19
  /**
15
20
  * UnifiedLabelsProvider - UI Presentation Layer
16
21
  *
@@ -31,58 +36,118 @@ import { jsx as _jsx } from "react/jsx-runtime";
31
36
  *
32
37
  * Consumer Hook: useUnifiedLabels()
33
38
  */
39
+
34
40
  import { createContext, useContext } from 'react';
35
41
  import { transformLabelsForSelect } from '../SimpleMatchers';
36
42
  import { useLabelNameMappings } from './utils';
37
- const UnifiedLabelsContext = createContext(null);
38
- export function UnifiedLabelsProvider({ children, labelNames, isLabelNamesLoading, isLabelValuesLoading, refetchLabelValues, refetchLabelNames, currentLabelName, setCurrentLabelName, labelValues, suffix, }) {
39
- const labelNameFromMatchers = [];
40
- const labelNamesFromAPI = labelNames;
41
- const labelNameMappingsForMatchersInput = useLabelNameMappings(labelNamesFromAPI);
42
- const allLabelNames = new Set(labelNamesFromAPI);
43
- const nonMatchingLabels = labelNameFromMatchers.filter(label => !allLabelNames.has(label));
44
- const labelNameMappingsForSimpleMatchers = [];
45
- const labels = {
46
- type: 'cpu',
47
- labelNames: labelNamesFromAPI,
48
- isLoading: isLabelNamesLoading,
49
- };
43
+ import { jsx as _jsx } from "react/jsx-runtime";
44
+ var UnifiedLabelsContext = /*#__PURE__*/createContext(null);
45
+ export function UnifiedLabelsProvider(t0) {
46
+ var $ = _c(4);
47
+ var children = t0.children,
48
+ labelNames = t0.labelNames,
49
+ isLabelNamesLoading = t0.isLabelNamesLoading,
50
+ isLabelValuesLoading = t0.isLabelValuesLoading,
51
+ refetchLabelValues = t0.refetchLabelValues,
52
+ refetchLabelNames = t0.refetchLabelNames,
53
+ currentLabelName = t0.currentLabelName,
54
+ setCurrentLabelName = t0.setCurrentLabelName,
55
+ labelValues = t0.labelValues,
56
+ suffix = t0.suffix;
57
+ var labelNameFromMatchers = [];
58
+ var labelNamesFromAPI = labelNames;
59
+ var labelNameMappingsForMatchersInput = useLabelNameMappings(labelNamesFromAPI);
60
+ var allLabelNames = new Set(labelNamesFromAPI);
61
+ var nonMatchingLabels = labelNameFromMatchers.filter(function (label) {
62
+ return !allLabelNames.has(label);
63
+ });
64
+ var labelNameMappingsForSimpleMatchers = [];
65
+ var labels = {
66
+ type: "cpu",
67
+ labelNames: labelNamesFromAPI,
68
+ isLoading: isLabelNamesLoading
69
+ };
70
+ labelNameMappingsForSimpleMatchers.push({
71
+ type: labels.type,
72
+ values: transformLabelsForSelect(labels.labelNames)
73
+ });
74
+ if (nonMatchingLabels.length > 0) {
75
+ var uniqueNonMatchingLabels = Array.from(new Set(nonMatchingLabels));
50
76
  labelNameMappingsForSimpleMatchers.push({
51
- type: labels.type,
52
- values: transformLabelsForSelect(labels.labelNames),
77
+ type: "",
78
+ values: transformLabelsForSelect(uniqueNonMatchingLabels)
53
79
  });
54
- if (nonMatchingLabels.length > 0) {
55
- const uniqueNonMatchingLabels = Array.from(new Set(nonMatchingLabels));
56
- labelNameMappingsForSimpleMatchers.push({
57
- type: '',
58
- values: transformLabelsForSelect(uniqueNonMatchingLabels),
59
- });
60
- }
61
- const value = {
62
- labelNames: labelNamesFromAPI,
63
- labelNameMappingsForMatchersInput,
64
- isLabelNamesLoading,
65
- isLabelValuesLoading,
66
- currentLabelName,
67
- labelValues,
68
- setCurrentLabelName,
69
- shouldHandlePrefixes: false,
70
- refetchLabelValues: async () => {
71
- await refetchLabelValues();
72
- },
73
- refetchLabelNames: async () => {
74
- await refetchLabelNames();
75
- },
76
- labelNameFromMatchers,
77
- labelNameMappingsForSimpleMatchers,
78
- suffix,
79
- };
80
- return _jsx(UnifiedLabelsContext.Provider, { value: value, children: children });
80
+ }
81
+ var t1;
82
+ if ($[0] !== refetchLabelValues) {
83
+ t1 = /*#__PURE__*/function () {
84
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
85
+ return _regenerator().w(function (_context) {
86
+ while (1) switch (_context.n) {
87
+ case 0:
88
+ _context.n = 1;
89
+ return refetchLabelValues();
90
+ case 1:
91
+ return _context.a(2);
92
+ }
93
+ }, _callee);
94
+ }));
95
+ return function t1() {
96
+ return _ref.apply(this, arguments);
97
+ };
98
+ }();
99
+ $[0] = refetchLabelValues;
100
+ $[1] = t1;
101
+ } else {
102
+ t1 = $[1];
103
+ }
104
+ var t2;
105
+ if ($[2] !== refetchLabelNames) {
106
+ t2 = /*#__PURE__*/function () {
107
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
108
+ return _regenerator().w(function (_context2) {
109
+ while (1) switch (_context2.n) {
110
+ case 0:
111
+ _context2.n = 1;
112
+ return refetchLabelNames();
113
+ case 1:
114
+ return _context2.a(2);
115
+ }
116
+ }, _callee2);
117
+ }));
118
+ return function t2() {
119
+ return _ref2.apply(this, arguments);
120
+ };
121
+ }();
122
+ $[2] = refetchLabelNames;
123
+ $[3] = t2;
124
+ } else {
125
+ t2 = $[3];
126
+ }
127
+ var value = {
128
+ labelNames: labelNamesFromAPI,
129
+ labelNameMappingsForMatchersInput: labelNameMappingsForMatchersInput,
130
+ isLabelNamesLoading: isLabelNamesLoading,
131
+ isLabelValuesLoading: isLabelValuesLoading,
132
+ currentLabelName: currentLabelName,
133
+ labelValues: labelValues,
134
+ setCurrentLabelName: setCurrentLabelName,
135
+ shouldHandlePrefixes: false,
136
+ refetchLabelValues: t1,
137
+ refetchLabelNames: t2,
138
+ labelNameFromMatchers: labelNameFromMatchers,
139
+ labelNameMappingsForSimpleMatchers: labelNameMappingsForSimpleMatchers,
140
+ suffix: suffix
141
+ };
142
+ return /*#__PURE__*/_jsx(UnifiedLabelsContext.Provider, {
143
+ value: value,
144
+ children: children
145
+ });
81
146
  }
82
147
  export function useUnifiedLabels() {
83
- const context = useContext(UnifiedLabelsContext);
84
- if (context === null) {
85
- throw new Error('useUnifiedLabels must be used within a UnifiedLabelsProvider');
86
- }
87
- return context;
88
- }
148
+ var context = useContext(UnifiedLabelsContext);
149
+ if (context === null) {
150
+ throw new Error("useUnifiedLabels must be used within a UnifiedLabelsProvider");
151
+ }
152
+ return context;
153
+ }
@@ -1,3 +1,4 @@
1
+ import { c as _c } from "react-compiler-runtime";
1
2
  // Copyright 2022 The Parca Authors
2
3
  // Licensed under the Apache License, Version 2.0 (the "License");
3
4
  // you may not use this file except in compliance with the License.
@@ -10,22 +11,43 @@
10
11
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
12
  // See the License for the specific language governing permissions and
12
13
  // limitations under the License.
14
+
13
15
  import { useMemo } from 'react';
14
- export const transformLabelName = (labelName) => {
15
- return labelName.replace(/^(attributes\.|attributes_resource\.)/, '');
16
+ export var transformLabelName = function transformLabelName(labelName) {
17
+ return labelName.replace(/^(attributes\.|attributes_resource\.)/, '');
16
18
  };
17
- export const useLabelNameMappings = (labelNames) => {
18
- return useMemo(() => {
19
- return labelNames.map(name => ({
20
- displayName: transformLabelName(name),
21
- fullName: name,
22
- }));
23
- }, [labelNames]);
19
+ export var useLabelNameMappings = function useLabelNameMappings(labelNames) {
20
+ var $ = _c(2);
21
+ var t0;
22
+ if ($[0] !== labelNames) {
23
+ t0 = labelNames.map(_temp);
24
+ $[0] = labelNames;
25
+ $[1] = t0;
26
+ } else {
27
+ t0 = $[1];
28
+ }
29
+ return t0;
24
30
  };
25
- export const useExtractedLabelNames = (response, error) => {
26
- return useMemo(() => {
27
- return (error === undefined || error == null) && response !== undefined && response != null
28
- ? response.labelNames?.filter(e => e !== '__name__') ?? []
29
- : [];
30
- }, [response, error]);
31
+ export var useExtractedLabelNames = function useExtractedLabelNames(response, error) {
32
+ var $ = _c(3);
33
+ var t0;
34
+ if ($[0] !== error || $[1] !== response) {
35
+ var _response$labelNames$, _response$labelNames;
36
+ t0 = (error === undefined || error == null) && response !== undefined && response != null ? (_response$labelNames$ = (_response$labelNames = response.labelNames) === null || _response$labelNames === void 0 ? void 0 : _response$labelNames.filter(_temp2)) !== null && _response$labelNames$ !== void 0 ? _response$labelNames$ : [] : [];
37
+ $[0] = error;
38
+ $[1] = response;
39
+ $[2] = t0;
40
+ } else {
41
+ t0 = $[2];
42
+ }
43
+ return t0;
31
44
  };
45
+ function _temp(name) {
46
+ return {
47
+ displayName: transformLabelName(name),
48
+ fullName: name
49
+ };
50
+ }
51
+ function _temp2(e) {
52
+ return e !== "__name__";
53
+ }
@@ -10,23 +10,35 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
+
13
14
  import { createParser, parseAsArrayOf, parseAsBoolean, parseAsInteger, parseAsString } from 'nuqs';
14
- const opts = { history: 'replace' };
15
+ var opts = {
16
+ history: 'replace'
17
+ };
18
+
15
19
  // === Base parsers with common options ===
16
- export const stringParam = parseAsString.withOptions(opts);
17
- export const boolParam = parseAsBoolean.withOptions(opts);
18
- export const intParam = parseAsInteger.withOptions(opts);
19
- export const commaArrayParam = parseAsArrayOf(parseAsString, ',').withOptions(opts);
20
+ export var stringParam = parseAsString.withOptions(opts);
21
+ export var boolParam = parseAsBoolean.withOptions(opts);
22
+ export var intParam = parseAsInteger.withOptions(opts);
23
+ export var commaArrayParam = parseAsArrayOf(parseAsString, ',').withOptions(opts);
24
+
20
25
  // === Param-specific parsers with defaults ===
21
- export const invertCallStackParser = boolParam.withDefault(false);
22
- export const groupByParser = commaArrayParam;
23
- export const flamechartDimensionParser = commaArrayParam;
24
- export const tableColumnsParser = commaArrayParam;
25
- export const hiddenBinariesParser = commaArrayParam.withDefault([]);
26
+ export var invertCallStackParser = boolParam.withDefault(false);
27
+ export var groupByParser = commaArrayParam;
28
+ export var flamechartDimensionParser = commaArrayParam;
29
+ export var tableColumnsParser = commaArrayParam;
30
+ export var hiddenBinariesParser = commaArrayParam.withDefault([]);
31
+
26
32
  // === JSON parser with BigInt support ===
27
33
  export function jsonParser() {
28
- return createParser({
29
- parse: (value) => JSON.parse(value),
30
- serialize: (value) => JSON.stringify(value, (_, v) => (typeof v === 'bigint' ? v.toString() : v)),
31
- }).withOptions(opts);
32
- }
34
+ return createParser({
35
+ parse: function parse(value) {
36
+ return JSON.parse(value);
37
+ },
38
+ serialize: function serialize(value) {
39
+ return JSON.stringify(value, function (_, v) {
40
+ return typeof v === 'bigint' ? v.toString() : v;
41
+ });
42
+ }
43
+ }).withOptions(opts);
44
+ }
@@ -1,3 +1,10 @@
1
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
2
+ 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."); }
3
+ 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; } }
4
+ 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; }
5
+ 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; } }
6
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
7
+ import { c as _c } from "react-compiler-runtime";
1
8
  // Copyright 2022 The Parca Authors
2
9
  // Licensed under the Apache License, Version 2.0 (the "License");
3
10
  // you may not use this file except in compliance with the License.
@@ -10,17 +17,47 @@
10
17
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
18
  // See the License for the specific language governing permissions and
12
19
  // limitations under the License.
20
+
13
21
  import { useCallback } from 'react';
14
22
  import { useQueryState } from 'nuqs';
15
23
  import { USER_PREFERENCES, useUserPreference } from '@parca/hooks';
16
24
  import { stringParam } from './urlParsers';
17
- export const useColorBy = () => {
18
- const [colorByPreference, setColorByPreference] = useUserPreference(USER_PREFERENCES.COLOR_BY.key);
19
- const [colorByRaw, setRawColorBy] = useQueryState('color_by', stringParam);
20
- const colorBy = colorByRaw ?? colorByPreference ?? 'binary';
21
- const setColorBy = useCallback((value) => {
22
- void setRawColorBy(value);
23
- setColorByPreference(value);
24
- }, [setRawColorBy, setColorByPreference]);
25
- return { colorBy, setColorBy };
26
- };
25
+ export var useColorBy = function useColorBy() {
26
+ var _ref;
27
+ var $ = _c(6);
28
+ var _useUserPreference = useUserPreference(USER_PREFERENCES.COLOR_BY.key),
29
+ _useUserPreference2 = _slicedToArray(_useUserPreference, 2),
30
+ colorByPreference = _useUserPreference2[0],
31
+ setColorByPreference = _useUserPreference2[1];
32
+ var _useQueryState = useQueryState("color_by", stringParam),
33
+ _useQueryState2 = _slicedToArray(_useQueryState, 2),
34
+ colorByRaw = _useQueryState2[0],
35
+ setRawColorBy = _useQueryState2[1];
36
+ var colorBy = (_ref = colorByRaw !== null && colorByRaw !== void 0 ? colorByRaw : colorByPreference) !== null && _ref !== void 0 ? _ref : "binary";
37
+ var t0;
38
+ if ($[0] !== setColorByPreference || $[1] !== setRawColorBy) {
39
+ t0 = function t0(value) {
40
+ setRawColorBy(value);
41
+ setColorByPreference(value);
42
+ };
43
+ $[0] = setColorByPreference;
44
+ $[1] = setRawColorBy;
45
+ $[2] = t0;
46
+ } else {
47
+ t0 = $[2];
48
+ }
49
+ var setColorBy = t0;
50
+ var t1;
51
+ if ($[3] !== colorBy || $[4] !== setColorBy) {
52
+ t1 = {
53
+ colorBy: colorBy,
54
+ setColorBy: setColorBy
55
+ };
56
+ $[3] = colorBy;
57
+ $[4] = setColorBy;
58
+ $[5] = t1;
59
+ } else {
60
+ t1 = $[5];
61
+ }
62
+ return t1;
63
+ };
@@ -1,3 +1,16 @@
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 _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
8
+ 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."); }
9
+ 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; } }
10
+ 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; }
11
+ 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; } }
12
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
13
+ import { c as _c } from "react-compiler-runtime";
1
14
  // Copyright 2022 The Parca Authors
2
15
  // Licensed under the Apache License, Version 2.0 (the "License");
3
16
  // you may not use this file except in compliance with the License.
@@ -10,73 +23,110 @@
10
23
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
24
  // See the License for the specific language governing permissions and
12
25
  // limitations under the License.
26
+
13
27
  import { useCallback } from 'react';
14
28
  import { useQueryStates } from 'nuqs';
15
29
  import { boolParam, stringParam } from './urlParsers';
30
+
16
31
  /**
17
32
  * Hook to manage compare mode state and operations
18
33
  * Returns compare mode flags and a function to close compare mode
19
34
  */
20
- export const useCompareModeMeta = () => {
21
- const [state, setState] = useQueryStates({
22
- // Side A
23
- expression_a: stringParam,
24
- from_a: stringParam,
25
- to_a: stringParam,
26
- time_selection_a: stringParam,
27
- sum_by_a: stringParam,
28
- merge_from_a: stringParam,
29
- merge_to_a: stringParam,
30
- selection_a: stringParam,
31
- // Side B
32
- expression_b: stringParam,
33
- from_b: stringParam,
34
- to_b: stringParam,
35
- time_selection_b: stringParam,
36
- sum_by_b: stringParam,
37
- merge_from_b: stringParam,
38
- merge_to_b: stringParam,
39
- selection_b: stringParam,
40
- // Compare flags
41
- compare_a: boolParam,
42
- compare_b: boolParam,
43
- compare_absolute: boolParam,
44
- }, { history: 'replace' });
45
- const closeCompareMode = useCallback((side) => {
46
- // If closing side A, swap B → A first (keep B's data as the single view)
47
- const swapAFromB = side === 'A'
48
- ? {
49
- expression_a: state.expression_b,
50
- from_a: state.from_b,
51
- to_a: state.to_b,
52
- time_selection_a: state.time_selection_b,
53
- sum_by_a: state.sum_by_b,
54
- merge_from_a: state.merge_from_b,
55
- merge_to_a: state.merge_to_b,
56
- selection_a: state.selection_b,
57
- }
58
- : {};
59
- // Atomic update: swap A (if needed), clear all B params and compare flags
60
- void setState({
61
- ...swapAFromB,
62
- expression_b: null,
63
- from_b: null,
64
- to_b: null,
65
- time_selection_b: null,
66
- sum_by_b: null,
67
- merge_from_b: null,
68
- merge_to_b: null,
69
- selection_b: null,
70
- compare_a: null,
71
- compare_b: null,
72
- compare_absolute: null,
73
- });
74
- }, [state, setState]);
75
- const isCompareMode = state.compare_a === true || state.compare_b === true;
76
- const isCompareAbsolute = state.compare_absolute === true;
77
- return {
78
- isCompareMode,
79
- isCompareAbsolute,
80
- closeCompareMode,
35
+ export var useCompareModeMeta = function useCompareModeMeta() {
36
+ var $ = _c(16);
37
+ var t0;
38
+ var t1;
39
+ if ($[0] === Symbol["for"]("react.memo_cache_sentinel")) {
40
+ t0 = {
41
+ expression_a: stringParam,
42
+ from_a: stringParam,
43
+ to_a: stringParam,
44
+ time_selection_a: stringParam,
45
+ sum_by_a: stringParam,
46
+ merge_from_a: stringParam,
47
+ merge_to_a: stringParam,
48
+ selection_a: stringParam,
49
+ expression_b: stringParam,
50
+ from_b: stringParam,
51
+ to_b: stringParam,
52
+ time_selection_b: stringParam,
53
+ sum_by_b: stringParam,
54
+ merge_from_b: stringParam,
55
+ merge_to_b: stringParam,
56
+ selection_b: stringParam,
57
+ compare_a: boolParam,
58
+ compare_b: boolParam,
59
+ compare_absolute: boolParam
81
60
  };
82
- };
61
+ t1 = {
62
+ history: "replace"
63
+ };
64
+ $[0] = t0;
65
+ $[1] = t1;
66
+ } else {
67
+ t0 = $[0];
68
+ t1 = $[1];
69
+ }
70
+ var _useQueryStates = useQueryStates(t0, t1),
71
+ _useQueryStates2 = _slicedToArray(_useQueryStates, 2),
72
+ state = _useQueryStates2[0],
73
+ setState = _useQueryStates2[1];
74
+ var t2;
75
+ if ($[2] !== setState || $[3] !== state.expression_b || $[4] !== state.from_b || $[5] !== state.merge_from_b || $[6] !== state.merge_to_b || $[7] !== state.selection_b || $[8] !== state.sum_by_b || $[9] !== state.time_selection_b || $[10] !== state.to_b) {
76
+ t2 = function t2(side) {
77
+ var swapAFromB = side === "A" ? {
78
+ expression_a: state.expression_b,
79
+ from_a: state.from_b,
80
+ to_a: state.to_b,
81
+ time_selection_a: state.time_selection_b,
82
+ sum_by_a: state.sum_by_b,
83
+ merge_from_a: state.merge_from_b,
84
+ merge_to_a: state.merge_to_b,
85
+ selection_a: state.selection_b
86
+ } : {};
87
+ setState(_objectSpread(_objectSpread({}, swapAFromB), {}, {
88
+ expression_b: null,
89
+ from_b: null,
90
+ to_b: null,
91
+ time_selection_b: null,
92
+ sum_by_b: null,
93
+ merge_from_b: null,
94
+ merge_to_b: null,
95
+ selection_b: null,
96
+ compare_a: null,
97
+ compare_b: null,
98
+ compare_absolute: null
99
+ }));
100
+ };
101
+ $[2] = setState;
102
+ $[3] = state.expression_b;
103
+ $[4] = state.from_b;
104
+ $[5] = state.merge_from_b;
105
+ $[6] = state.merge_to_b;
106
+ $[7] = state.selection_b;
107
+ $[8] = state.sum_by_b;
108
+ $[9] = state.time_selection_b;
109
+ $[10] = state.to_b;
110
+ $[11] = t2;
111
+ } else {
112
+ t2 = $[11];
113
+ }
114
+ var closeCompareMode = t2;
115
+ var isCompareMode = state.compare_a === true || state.compare_b === true;
116
+ var isCompareAbsolute = state.compare_absolute === true;
117
+ var t3;
118
+ if ($[12] !== closeCompareMode || $[13] !== isCompareAbsolute || $[14] !== isCompareMode) {
119
+ t3 = {
120
+ isCompareMode: isCompareMode,
121
+ isCompareAbsolute: isCompareAbsolute,
122
+ closeCompareMode: closeCompareMode
123
+ };
124
+ $[12] = closeCompareMode;
125
+ $[13] = isCompareAbsolute;
126
+ $[14] = isCompareMode;
127
+ $[15] = t3;
128
+ } else {
129
+ t3 = $[15];
130
+ }
131
+ return t3;
132
+ };
@@ -1,3 +1,10 @@
1
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
2
+ 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."); }
3
+ 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; } }
4
+ 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; }
5
+ 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; } }
6
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
7
+ import { c as _c } from "react-compiler-runtime";
1
8
  // Copyright 2022 The Parca Authors
2
9
  // Licensed under the Apache License, Version 2.0 (the "License");
3
10
  // you may not use this file except in compliance with the License.
@@ -10,18 +17,52 @@
10
17
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
18
  // See the License for the specific language governing permissions and
12
19
  // limitations under the License.
20
+
13
21
  import { useCallback, useMemo } from 'react';
14
22
  import { parseAsArrayOf, parseAsString, useQueryState } from 'nuqs';
15
23
  import { useParcaContext } from '@parca/components';
16
- const opts = { history: 'replace' };
17
- export const useDashboardItems = () => {
18
- const { defaultDashboardItems } = useParcaContext();
19
- const parser = useMemo(() => parseAsArrayOf(parseAsString, ',')
20
- .withDefault(defaultDashboardItems ?? ['flamegraph'])
21
- .withOptions(opts), [defaultDashboardItems]);
22
- const [dashboardItems, setRawDashboardItems] = useQueryState('dashboard_items', parser);
23
- const setDashboardItems = useCallback((items) => {
24
- void setRawDashboardItems(items);
25
- }, [setRawDashboardItems]);
26
- return { dashboardItems, setDashboardItems };
24
+ var opts = {
25
+ history: 'replace'
27
26
  };
27
+ export var useDashboardItems = function useDashboardItems() {
28
+ var $ = _c(7);
29
+ var _useParcaContext = useParcaContext(),
30
+ defaultDashboardItems = _useParcaContext.defaultDashboardItems;
31
+ var t0;
32
+ if ($[0] !== defaultDashboardItems) {
33
+ t0 = parseAsArrayOf(parseAsString, ",").withDefault(defaultDashboardItems !== null && defaultDashboardItems !== void 0 ? defaultDashboardItems : ["flamegraph"]).withOptions(opts);
34
+ $[0] = defaultDashboardItems;
35
+ $[1] = t0;
36
+ } else {
37
+ t0 = $[1];
38
+ }
39
+ var parser = t0;
40
+ var _useQueryState = useQueryState("dashboard_items", parser),
41
+ _useQueryState2 = _slicedToArray(_useQueryState, 2),
42
+ dashboardItems = _useQueryState2[0],
43
+ setRawDashboardItems = _useQueryState2[1];
44
+ var t1;
45
+ if ($[2] !== setRawDashboardItems) {
46
+ t1 = function t1(items) {
47
+ setRawDashboardItems(items);
48
+ };
49
+ $[2] = setRawDashboardItems;
50
+ $[3] = t1;
51
+ } else {
52
+ t1 = $[3];
53
+ }
54
+ var setDashboardItems = t1;
55
+ var t2;
56
+ if ($[4] !== dashboardItems || $[5] !== setDashboardItems) {
57
+ t2 = {
58
+ dashboardItems: dashboardItems,
59
+ setDashboardItems: setDashboardItems
60
+ };
61
+ $[4] = dashboardItems;
62
+ $[5] = setDashboardItems;
63
+ $[6] = t2;
64
+ } else {
65
+ t2 = $[6];
66
+ }
67
+ return t2;
68
+ };