@parca/profile 0.19.140 → 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 (253) hide show
  1. package/CHANGELOG.md +5 -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.d.ts.map +1 -1
  9. package/dist/GraphTooltipArrow/useGraphTooltipMetaInfo/index.js +104 -72
  10. package/dist/MatchersInput/SuggestionItem.js +91 -12
  11. package/dist/MatchersInput/SuggestionsList.d.ts +2 -1
  12. package/dist/MatchersInput/SuggestionsList.d.ts.map +1 -1
  13. package/dist/MatchersInput/SuggestionsList.js +371 -157
  14. package/dist/MatchersInput/SuggestionsList.test.d.ts +2 -0
  15. package/dist/MatchersInput/SuggestionsList.test.d.ts.map +1 -0
  16. package/dist/MatchersInput/index.js +308 -115
  17. package/dist/MetricsCircle/index.js +39 -3
  18. package/dist/MetricsGraph/MetricsContextMenu/index.js +119 -19
  19. package/dist/MetricsGraph/MetricsInfoPanel/index.js +81 -20
  20. package/dist/MetricsGraph/MetricsTooltip/index.d.ts.map +1 -1
  21. package/dist/MetricsGraph/MetricsTooltip/index.js +107 -74
  22. package/dist/MetricsGraph/index.js +552 -203
  23. package/dist/MetricsGraph/useMetricsGraphDimensions.js +46 -25
  24. package/dist/MetricsGraph/utils/colorMapping.js +24 -17
  25. package/dist/MetricsSeries/index.js +70 -7
  26. package/dist/PreSelectedMatchers/index.d.ts.map +1 -1
  27. package/dist/PreSelectedMatchers/index.js +249 -102
  28. package/dist/ProfileExplorer/ProfileExplorerCompare.d.ts.map +1 -1
  29. package/dist/ProfileExplorer/ProfileExplorerCompare.js +241 -45
  30. package/dist/ProfileExplorer/ProfileExplorerSingle.js +98 -11
  31. package/dist/ProfileExplorer/index.js +183 -32
  32. package/dist/ProfileFlameChart/SamplesStrips/SamplesGraph/index.js +333 -148
  33. package/dist/ProfileFlameChart/SamplesStrips/SamplesStrips.stories.js +69 -35
  34. package/dist/ProfileFlameChart/SamplesStrips/index.d.ts +2 -2
  35. package/dist/ProfileFlameChart/SamplesStrips/index.d.ts.map +1 -1
  36. package/dist/ProfileFlameChart/SamplesStrips/index.js +645 -134
  37. package/dist/ProfileFlameChart/SamplesStrips/labelSetUtils.js +114 -55
  38. package/dist/ProfileFlameChart/index.d.ts.map +1 -1
  39. package/dist/ProfileFlameChart/index.js +267 -129
  40. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.d.ts.map +1 -1
  41. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.js +288 -89
  42. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenuWrapper.js +56 -20
  43. package/dist/ProfileFlameGraph/FlameGraphArrow/FlameGraphNodes.js +211 -140
  44. package/dist/ProfileFlameGraph/FlameGraphArrow/MemoizedTooltip.js +133 -38
  45. package/dist/ProfileFlameGraph/FlameGraphArrow/MiniMap.js +261 -216
  46. package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.d.ts.map +1 -1
  47. package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.js +72 -47
  48. package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.d.ts.map +1 -1
  49. package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.js +58 -28
  50. package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.d.ts.map +1 -1
  51. package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.js +59 -8
  52. package/dist/ProfileFlameGraph/FlameGraphArrow/index.js +396 -179
  53. package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.d.ts.map +1 -1
  54. package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.js +68 -50
  55. package/dist/ProfileFlameGraph/FlameGraphArrow/useMappingList.js +62 -38
  56. package/dist/ProfileFlameGraph/FlameGraphArrow/useNodeColor.js +14 -6
  57. package/dist/ProfileFlameGraph/FlameGraphArrow/useScrollViewport.js +124 -82
  58. package/dist/ProfileFlameGraph/FlameGraphArrow/useVisibleNodes.js +160 -98
  59. package/dist/ProfileFlameGraph/FlameGraphArrow/useZoom.js +232 -112
  60. package/dist/ProfileFlameGraph/FlameGraphArrow/utils.js +137 -114
  61. package/dist/ProfileFlameGraph/benchmarks/benchdata/populateData.js +85 -0
  62. package/dist/ProfileFlameGraph/index.d.ts.map +1 -1
  63. package/dist/ProfileFlameGraph/index.js +324 -150
  64. package/dist/ProfileMetricsGraph/hooks/useQueryRange.js +140 -32
  65. package/dist/ProfileMetricsGraph/index.d.ts.map +1 -1
  66. package/dist/ProfileMetricsGraph/index.js +519 -258
  67. package/dist/ProfileSelector/CompareButton.js +132 -12
  68. package/dist/ProfileSelector/MetricsGraphSection.d.ts.map +1 -1
  69. package/dist/ProfileSelector/MetricsGraphSection.js +236 -64
  70. package/dist/ProfileSelector/index.d.ts.map +1 -1
  71. package/dist/ProfileSelector/index.js +727 -141
  72. package/dist/ProfileSelector/useAutoQuerySelector.js +249 -130
  73. package/dist/ProfileSource.js +230 -163
  74. package/dist/ProfileTypeSelector/index.js +214 -125
  75. package/dist/ProfileView/components/ActionButtons/GroupByDropdown.js +50 -4
  76. package/dist/ProfileView/components/ActionButtons/SortByDropdown.d.ts.map +1 -1
  77. package/dist/ProfileView/components/ActionButtons/SortByDropdown.js +141 -35
  78. package/dist/ProfileView/components/ColorStackLegend.d.ts.map +1 -1
  79. package/dist/ProfileView/components/ColorStackLegend.js +185 -55
  80. package/dist/ProfileView/components/DashboardItems/index.js +87 -28
  81. package/dist/ProfileView/components/DashboardLayout/index.js +108 -16
  82. package/dist/ProfileView/components/DiffLegend.js +172 -29
  83. package/dist/ProfileView/components/GroupByLabelsDropdown/index.js +199 -55
  84. package/dist/ProfileView/components/InvertCallStack/index.d.ts.map +1 -1
  85. package/dist/ProfileView/components/InvertCallStack/index.js +100 -12
  86. package/dist/ProfileView/components/ProfileFilters/filterPresets.js +260 -315
  87. package/dist/ProfileView/components/ProfileFilters/index.js +518 -215
  88. package/dist/ProfileView/components/ProfileFilters/useProfileFilters.js +370 -306
  89. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.d.ts +2 -1
  90. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.d.ts.map +1 -1
  91. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.js +188 -118
  92. package/dist/ProfileView/components/ProfileHeader/index.js +105 -11
  93. package/dist/ProfileView/components/ShareButton/ResultBox.js +119 -16
  94. package/dist/ProfileView/components/ShareButton/index.js +352 -62
  95. package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.d.ts.map +1 -1
  96. package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.js +678 -194
  97. package/dist/ProfileView/components/Toolbars/SwitchMenuItem.js +94 -7
  98. package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.d.ts.map +1 -1
  99. package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.js +199 -157
  100. package/dist/ProfileView/components/Toolbars/index.d.ts +2 -2
  101. package/dist/ProfileView/components/Toolbars/index.d.ts.map +1 -1
  102. package/dist/ProfileView/components/Toolbars/index.js +441 -21
  103. package/dist/ProfileView/components/ViewSelector/Dropdown.js +233 -22
  104. package/dist/ProfileView/components/ViewSelector/index.d.ts.map +1 -1
  105. package/dist/ProfileView/components/ViewSelector/index.js +212 -86
  106. package/dist/ProfileView/components/VisualizationContainer/index.d.ts.map +1 -1
  107. package/dist/ProfileView/components/VisualizationContainer/index.js +52 -7
  108. package/dist/ProfileView/components/VisualizationPanel.js +185 -8
  109. package/dist/ProfileView/context/DashboardContext.d.ts.map +1 -1
  110. package/dist/ProfileView/context/DashboardContext.js +85 -29
  111. package/dist/ProfileView/context/ProfileViewContext.js +56 -15
  112. package/dist/ProfileView/hooks/useAutoSelectDimension.js +71 -41
  113. package/dist/ProfileView/hooks/useProfileMetadata.js +50 -18
  114. package/dist/ProfileView/hooks/useResetFlameGraphState.d.ts.map +1 -1
  115. package/dist/ProfileView/hooks/useResetFlameGraphState.js +32 -12
  116. package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.d.ts.map +1 -1
  117. package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.js +71 -27
  118. package/dist/ProfileView/hooks/useResetStateOnSeriesChange.d.ts.map +1 -1
  119. package/dist/ProfileView/hooks/useResetStateOnSeriesChange.js +40 -19
  120. package/dist/ProfileView/hooks/useVisualizationState.d.ts +3 -3
  121. package/dist/ProfileView/hooks/useVisualizationState.d.ts.map +1 -1
  122. package/dist/ProfileView/hooks/useVisualizationState.js +258 -67
  123. package/dist/ProfileView/index.js +383 -45
  124. package/dist/ProfileView/types/visualization.js +1 -13
  125. package/dist/ProfileView/utils/colorUtils.js +8 -7
  126. package/dist/ProfileViewWithData.d.ts.map +1 -1
  127. package/dist/ProfileViewWithData.js +332 -228
  128. package/dist/QueryControls/index.js +418 -47
  129. package/dist/Sandwich/components/CalleesSection.js +54 -4
  130. package/dist/Sandwich/components/CallersSection.js +97 -27
  131. package/dist/Sandwich/components/TableSection.js +77 -4
  132. package/dist/Sandwich/index.d.ts.map +1 -1
  133. package/dist/Sandwich/index.js +126 -14
  134. package/dist/Sandwich/utils/processRowData.js +48 -39
  135. package/dist/SelectWithRefresh/index.js +102 -28
  136. package/dist/SimpleMatchers/Select.js +520 -187
  137. package/dist/SimpleMatchers/index.js +590 -288
  138. package/dist/SourceView/Highlighter.js +230 -70
  139. package/dist/SourceView/LineNo.js +72 -17
  140. package/dist/SourceView/index.d.ts.map +1 -1
  141. package/dist/SourceView/index.js +178 -104
  142. package/dist/SourceView/lang-detector/ext-to-lang.json +798 -798
  143. package/dist/SourceView/lang-detector/index.js +28 -14
  144. package/dist/SourceView/useSelectedLineRange.d.ts.map +1 -1
  145. package/dist/SourceView/useSelectedLineRange.js +99 -23
  146. package/dist/Table/ColorCell.js +42 -1
  147. package/dist/Table/ColumnsVisibility.js +114 -6
  148. package/dist/Table/MoreDropdown.d.ts.map +1 -1
  149. package/dist/Table/MoreDropdown.js +122 -25
  150. package/dist/Table/TableContextMenu.d.ts.map +1 -1
  151. package/dist/Table/TableContextMenu.js +151 -137
  152. package/dist/Table/TableContextMenuWrapper.js +59 -14
  153. package/dist/Table/hooks/useColorManagement.js +58 -16
  154. package/dist/Table/hooks/useTableConfiguration.d.ts.map +1 -1
  155. package/dist/Table/hooks/useTableConfiguration.js +333 -169
  156. package/dist/Table/index.d.ts.map +1 -1
  157. package/dist/Table/index.js +222 -128
  158. package/dist/Table/utils/functions.js +169 -144
  159. package/dist/Table/utils/topAndBottomExpandedRowModel.js +69 -52
  160. package/dist/TimelineGuide/index.js +209 -16
  161. package/dist/TopTable/benchmarks/benchdata/populateData.js +91 -0
  162. package/dist/TopTable/index.d.ts.map +1 -1
  163. package/dist/TopTable/index.js +342 -123
  164. package/dist/contexts/LabelsQueryProvider.js +94 -32
  165. package/dist/contexts/UnifiedLabelsContext.js +114 -49
  166. package/dist/contexts/utils.js +37 -15
  167. package/dist/hooks/useCompareModeMeta.d.ts.map +1 -1
  168. package/dist/hooks/useCompareModeMeta.js +158 -64
  169. package/dist/hooks/useLabels.js +295 -52
  170. package/dist/hooks/useQueryState.d.ts +3 -3
  171. package/dist/hooks/useQueryState.d.ts.map +1 -1
  172. package/dist/hooks/useQueryState.js +373 -332
  173. package/dist/index.d.ts +2 -3
  174. package/dist/index.d.ts.map +1 -1
  175. package/dist/index.js +22 -8
  176. package/dist/testdata/fg-diff.json +3750 -0
  177. package/dist/testdata/fg-simple.json +1879 -0
  178. package/dist/testdata/link_data.json +56 -0
  179. package/dist/testdata/tabular.json +30 -0
  180. package/dist/testdata/test_flamegraph.json +26846 -0
  181. package/dist/testdata/test_graph.json +53 -0
  182. package/dist/useDelayedLoader.js +32 -18
  183. package/dist/useGrpcQuery/index.js +71 -11
  184. package/dist/useHasProfileData.js +90 -12
  185. package/dist/useQuery.js +205 -64
  186. package/dist/useSumBy.d.ts +1 -1
  187. package/dist/useSumBy.d.ts.map +1 -1
  188. package/dist/useSumBy.js +294 -138
  189. package/dist/utils.js +62 -30
  190. package/package.json +9 -10
  191. package/src/GraphTooltipArrow/index.tsx +3 -0
  192. package/src/GraphTooltipArrow/useGraphTooltipMetaInfo/index.ts +13 -11
  193. package/src/MatchersInput/SuggestionsList.test.tsx +70 -0
  194. package/src/MatchersInput/SuggestionsList.tsx +11 -10
  195. package/src/MatchersInput/index.tsx +1 -1
  196. package/src/MetricsGraph/MetricsTooltip/index.tsx +22 -34
  197. package/src/PreSelectedMatchers/index.tsx +3 -0
  198. package/src/ProfileExplorer/ProfileExplorerCompare.tsx +9 -4
  199. package/src/ProfileFlameChart/SamplesStrips/index.tsx +2 -2
  200. package/src/ProfileFlameChart/index.tsx +28 -21
  201. package/src/ProfileFlameGraph/FlameGraphArrow/ContextMenu.tsx +9 -10
  202. package/src/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.tsx +6 -5
  203. package/src/ProfileFlameGraph/FlameGraphArrow/TooltipContext.tsx +3 -0
  204. package/src/ProfileFlameGraph/FlameGraphArrow/ZoomControls.tsx +3 -0
  205. package/src/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.ts +3 -0
  206. package/src/ProfileFlameGraph/index.tsx +9 -6
  207. package/src/ProfileMetricsGraph/index.tsx +8 -6
  208. package/src/ProfileSelector/MetricsGraphSection.tsx +10 -5
  209. package/src/ProfileSelector/index.tsx +61 -39
  210. package/src/ProfileView/components/ActionButtons/SortByDropdown.tsx +6 -10
  211. package/src/ProfileView/components/ColorStackLegend.tsx +4 -2
  212. package/src/ProfileView/components/InvertCallStack/index.tsx +4 -5
  213. package/src/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.test.tsx +192 -94
  214. package/src/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.ts +21 -21
  215. package/src/ProfileView/components/Toolbars/MultiLevelDropdown.tsx +28 -24
  216. package/src/ProfileView/components/Toolbars/TableColumnsDropdown.tsx +5 -4
  217. package/src/ProfileView/components/Toolbars/index.tsx +3 -3
  218. package/src/ProfileView/components/ViewSelector/index.tsx +16 -9
  219. package/src/ProfileView/components/VisualizationContainer/index.tsx +3 -0
  220. package/src/ProfileView/context/DashboardContext.tsx +6 -6
  221. package/src/ProfileView/hooks/useResetFlameGraphState.ts +4 -6
  222. package/src/ProfileView/hooks/useResetStateOnProfileTypeChange.ts +26 -24
  223. package/src/ProfileView/hooks/useResetStateOnSeriesChange.ts +8 -16
  224. package/src/ProfileView/hooks/useVisualizationState.ts +69 -61
  225. package/src/ProfileViewWithData.tsx +35 -29
  226. package/src/Sandwich/index.tsx +3 -4
  227. package/src/SourceView/index.tsx +2 -4
  228. package/src/SourceView/useSelectedLineRange.ts +19 -34
  229. package/src/Table/MoreDropdown.tsx +11 -9
  230. package/src/Table/TableContextMenu.tsx +13 -10
  231. package/src/Table/hooks/useTableConfiguration.tsx +11 -16
  232. package/src/Table/index.tsx +21 -12
  233. package/src/TopTable/index.tsx +4 -3
  234. package/src/hooks/useCompareModeMeta.ts +91 -61
  235. package/src/hooks/useQueryState.test.tsx +345 -275
  236. package/src/hooks/useQueryState.ts +118 -136
  237. package/src/index.tsx +15 -16
  238. package/src/useDelayedLoader.ts +10 -10
  239. package/src/useSumBy.ts +15 -21
  240. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.test.js +0 -455
  241. package/dist/hooks/urlParsers.d.ts +0 -18
  242. package/dist/hooks/urlParsers.d.ts.map +0 -1
  243. package/dist/hooks/urlParsers.js +0 -32
  244. package/dist/hooks/useColorBy.d.ts +0 -5
  245. package/dist/hooks/useColorBy.d.ts.map +0 -1
  246. package/dist/hooks/useColorBy.js +0 -26
  247. package/dist/hooks/useDashboardItems.d.ts +0 -5
  248. package/dist/hooks/useDashboardItems.d.ts.map +0 -1
  249. package/dist/hooks/useDashboardItems.js +0 -27
  250. package/dist/hooks/useQueryState.test.js +0 -868
  251. package/src/hooks/urlParsers.ts +0 -38
  252. package/src/hooks/useColorBy.ts +0 -42
  253. package/src/hooks/useDashboardItems.ts +0 -46
@@ -1,4 +1,16 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } 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 _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 _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
11
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
12
+ 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; }
13
+ import { c as _c } from "react-compiler-runtime";
2
14
  // Copyright 2022 The Parca Authors
3
15
  // Licensed under the Apache License, Version 2.0 (the "License");
4
16
  // you may not use this file except in compliance with the License.
@@ -11,6 +23,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
11
23
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
24
  // See the License for the specific language governing permissions and
13
25
  // limitations under the License.
26
+
14
27
  import { useCallback } from 'react';
15
28
  import { Icon } from '@iconify/react';
16
29
  import cx from 'classnames';
@@ -19,221 +32,511 @@ import { TEST_IDS, testId } from '@parca/test-utils';
19
32
  import { useProfileViewContext } from '../../context/ProfileViewContext';
20
33
  import { getPresetByKey, getPresetsForProfileType, isPresetKey } from './filterPresets';
21
34
  import { useProfileFilters } from './useProfileFilters';
22
- export const isFilterComplete = (filter) => {
23
- // For preset filters, only need type and value
24
- if (filter.type != null && isPresetKey(filter.type)) {
25
- return filter.value !== '' && filter.type != null;
35
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
36
+ export var isFilterComplete = function isFilterComplete(filter) {
37
+ // For preset filters, only need type and value
38
+ if (filter.type != null && isPresetKey(filter.type)) {
39
+ return filter.value !== '' && filter.type != null;
40
+ }
41
+ // For regular filters, need all fields
42
+ return filter.value !== '' && filter.type != null && filter.field != null && filter.matchType != null;
43
+ };
44
+ var getFilterTypeItems = function getFilterTypeItems(currentProfileType) {
45
+ return [{
46
+ key: 'stack',
47
+ element: {
48
+ active: /*#__PURE__*/_jsx(_Fragment, {
49
+ children: "Stack Filter"
50
+ }),
51
+ expanded: /*#__PURE__*/_jsxs(_Fragment, {
52
+ children: [/*#__PURE__*/_jsx("span", {
53
+ children: "Stack Filter"
54
+ }), /*#__PURE__*/_jsx("br", {}), /*#__PURE__*/_jsx("span", {
55
+ className: "text-xs",
56
+ children: "Filters entire call stacks"
57
+ })]
58
+ })
26
59
  }
27
- // For regular filters, need all fields
28
- return (filter.value !== '' && filter.type != null && filter.field != null && filter.matchType != null);
60
+ }, {
61
+ key: 'frame',
62
+ element: {
63
+ active: /*#__PURE__*/_jsx(_Fragment, {
64
+ children: "Frame Filter"
65
+ }),
66
+ expanded: /*#__PURE__*/_jsxs(_Fragment, {
67
+ children: [/*#__PURE__*/_jsx("span", {
68
+ children: "Frame Filter"
69
+ }), /*#__PURE__*/_jsx("br", {}), /*#__PURE__*/_jsx("span", {
70
+ className: "text-xs",
71
+ children: "Filters individual frames"
72
+ })]
73
+ })
74
+ }
75
+ }].concat(_toConsumableArray(getPresetsForProfileType(currentProfileType).map(function (preset) {
76
+ return {
77
+ key: preset.key,
78
+ element: {
79
+ active: /*#__PURE__*/_jsx(_Fragment, {
80
+ children: preset.name
81
+ }),
82
+ expanded: /*#__PURE__*/_jsxs(_Fragment, {
83
+ children: [/*#__PURE__*/_jsx("span", {
84
+ children: preset.name
85
+ }), /*#__PURE__*/_jsx("br", {}), /*#__PURE__*/_jsx("span", {
86
+ className: "text-xs",
87
+ children: preset.description
88
+ })]
89
+ })
90
+ }
91
+ };
92
+ })));
29
93
  };
30
- const getFilterTypeItems = (currentProfileType) => [
31
- {
32
- key: 'stack',
33
- element: {
34
- active: _jsx(_Fragment, { children: "Stack Filter" }),
35
- expanded: (_jsxs(_Fragment, { children: [_jsx("span", { children: "Stack Filter" }), _jsx("br", {}), _jsx("span", { className: "text-xs", children: "Filters entire call stacks" })] })),
36
- },
37
- },
38
- {
39
- key: 'frame',
40
- element: {
41
- active: _jsx(_Fragment, { children: "Frame Filter" }),
42
- expanded: (_jsxs(_Fragment, { children: [_jsx("span", { children: "Frame Filter" }), _jsx("br", {}), _jsx("span", { className: "text-xs", children: "Filters individual frames" })] })),
43
- },
44
- },
45
- ...getPresetsForProfileType(currentProfileType).map(preset => ({
46
- key: preset.key,
47
- element: {
48
- active: _jsx(_Fragment, { children: preset.name }),
49
- expanded: (_jsxs(_Fragment, { children: [_jsx("span", { children: preset.name }), _jsx("br", {}), _jsx("span", { className: "text-xs", children: preset.description })] })),
50
- },
51
- })),
52
- ];
53
- const fieldItems = [
54
- {
55
- key: 'function_name',
56
- element: {
57
- active: _jsx(_Fragment, { children: "Function" }),
58
- expanded: _jsx(_Fragment, { children: "Function Name" }),
59
- },
60
- },
61
- {
62
- key: 'binary',
63
- element: {
64
- active: _jsx(_Fragment, { children: "Binary" }),
65
- expanded: _jsx(_Fragment, { children: "Binary/Executable Name" }),
66
- },
67
- },
68
- {
69
- key: 'system_name',
70
- element: {
71
- active: _jsx(_Fragment, { children: "System Name" }),
72
- expanded: _jsx(_Fragment, { children: "System Name" }),
73
- },
74
- },
75
- {
76
- key: 'filename',
77
- element: {
78
- active: _jsx(_Fragment, { children: "Filename" }),
79
- expanded: _jsx(_Fragment, { children: "Source Filename" }),
80
- },
81
- },
82
- {
83
- key: 'address',
84
- element: {
85
- active: _jsx(_Fragment, { children: "Address" }),
86
- expanded: _jsx(_Fragment, { children: "Memory Address" }),
87
- },
88
- },
89
- {
90
- key: 'line_number',
91
- element: {
92
- active: _jsx(_Fragment, { children: "Line Number" }),
93
- expanded: _jsx(_Fragment, { children: "Source Line Number" }),
94
- },
95
- },
96
- ];
97
- const stringMatchTypeItems = [
98
- {
99
- key: 'equal',
100
- element: {
101
- active: _jsx(_Fragment, { children: "Equals" }),
102
- expanded: _jsx(_Fragment, { children: "Equals" }),
103
- },
104
- },
105
- {
106
- key: 'not_equal',
107
- element: {
108
- active: _jsx(_Fragment, { children: "Not Equals" }),
109
- expanded: _jsx(_Fragment, { children: "Not Equals" }),
110
- },
111
- },
112
- {
113
- key: 'contains',
114
- element: {
115
- active: _jsx(_Fragment, { children: "Contains" }),
116
- expanded: _jsx(_Fragment, { children: "Contains" }),
117
- },
118
- },
119
- {
120
- key: 'not_contains',
121
- element: {
122
- active: _jsx(_Fragment, { children: "Not Contains" }),
123
- expanded: _jsx(_Fragment, { children: "Not Contains" }),
124
- },
125
- },
126
- {
127
- key: 'starts_with',
128
- element: {
129
- active: _jsx(_Fragment, { children: "Starts With" }),
130
- expanded: _jsx(_Fragment, { children: "Starts With" }),
131
- },
132
- },
133
- {
134
- key: 'not_starts_with',
135
- element: {
136
- active: _jsx(_Fragment, { children: "Not Starts With" }),
137
- expanded: _jsx(_Fragment, { children: "Not Starts With" }),
138
- },
139
- },
140
- ];
141
- const numberMatchTypeItems = [
142
- {
143
- key: 'equal',
144
- element: {
145
- active: _jsx(_Fragment, { children: "Equals" }),
146
- expanded: _jsx(_Fragment, { children: "Equals" }),
147
- },
148
- },
149
- {
150
- key: 'not_equal',
151
- element: {
152
- active: _jsx(_Fragment, { children: "Not Equals" }),
153
- expanded: _jsx(_Fragment, { children: "Not Equals" }),
154
- },
155
- },
156
- ];
157
- const ProfileFilters = ({ readOnly = false } = {}) => {
158
- const { profileSource } = useProfileViewContext();
159
- const currentProfileType = profileSource?.ProfileType()?.toString();
160
- const filterTypeItems = getFilterTypeItems(currentProfileType);
161
- const { localFilters, appliedFilters, hasUnsavedChanges, onApplyFilters, addFilter, removeFilter, updateFilter, resetFilters, } = useProfileFilters();
162
- const handleKeyDown = useCallback((e) => {
163
- if (e.key === 'Enter') {
164
- e.preventDefault();
165
- if (e.currentTarget.value.trim() === '') {
166
- return;
167
- }
168
- onApplyFilters();
94
+ var fieldItems = [{
95
+ key: 'function_name',
96
+ element: {
97
+ active: /*#__PURE__*/_jsx(_Fragment, {
98
+ children: "Function"
99
+ }),
100
+ expanded: /*#__PURE__*/_jsx(_Fragment, {
101
+ children: "Function Name"
102
+ })
103
+ }
104
+ }, {
105
+ key: 'binary',
106
+ element: {
107
+ active: /*#__PURE__*/_jsx(_Fragment, {
108
+ children: "Binary"
109
+ }),
110
+ expanded: /*#__PURE__*/_jsx(_Fragment, {
111
+ children: "Binary/Executable Name"
112
+ })
113
+ }
114
+ }, {
115
+ key: 'system_name',
116
+ element: {
117
+ active: /*#__PURE__*/_jsx(_Fragment, {
118
+ children: "System Name"
119
+ }),
120
+ expanded: /*#__PURE__*/_jsx(_Fragment, {
121
+ children: "System Name"
122
+ })
123
+ }
124
+ }, {
125
+ key: 'filename',
126
+ element: {
127
+ active: /*#__PURE__*/_jsx(_Fragment, {
128
+ children: "Filename"
129
+ }),
130
+ expanded: /*#__PURE__*/_jsx(_Fragment, {
131
+ children: "Source Filename"
132
+ })
133
+ }
134
+ }, {
135
+ key: 'address',
136
+ element: {
137
+ active: /*#__PURE__*/_jsx(_Fragment, {
138
+ children: "Address"
139
+ }),
140
+ expanded: /*#__PURE__*/_jsx(_Fragment, {
141
+ children: "Memory Address"
142
+ })
143
+ }
144
+ }, {
145
+ key: 'line_number',
146
+ element: {
147
+ active: /*#__PURE__*/_jsx(_Fragment, {
148
+ children: "Line Number"
149
+ }),
150
+ expanded: /*#__PURE__*/_jsx(_Fragment, {
151
+ children: "Source Line Number"
152
+ })
153
+ }
154
+ }];
155
+ var stringMatchTypeItems = [{
156
+ key: 'equal',
157
+ element: {
158
+ active: /*#__PURE__*/_jsx(_Fragment, {
159
+ children: "Equals"
160
+ }),
161
+ expanded: /*#__PURE__*/_jsx(_Fragment, {
162
+ children: "Equals"
163
+ })
164
+ }
165
+ }, {
166
+ key: 'not_equal',
167
+ element: {
168
+ active: /*#__PURE__*/_jsx(_Fragment, {
169
+ children: "Not Equals"
170
+ }),
171
+ expanded: /*#__PURE__*/_jsx(_Fragment, {
172
+ children: "Not Equals"
173
+ })
174
+ }
175
+ }, {
176
+ key: 'contains',
177
+ element: {
178
+ active: /*#__PURE__*/_jsx(_Fragment, {
179
+ children: "Contains"
180
+ }),
181
+ expanded: /*#__PURE__*/_jsx(_Fragment, {
182
+ children: "Contains"
183
+ })
184
+ }
185
+ }, {
186
+ key: 'not_contains',
187
+ element: {
188
+ active: /*#__PURE__*/_jsx(_Fragment, {
189
+ children: "Not Contains"
190
+ }),
191
+ expanded: /*#__PURE__*/_jsx(_Fragment, {
192
+ children: "Not Contains"
193
+ })
194
+ }
195
+ }, {
196
+ key: 'starts_with',
197
+ element: {
198
+ active: /*#__PURE__*/_jsx(_Fragment, {
199
+ children: "Starts With"
200
+ }),
201
+ expanded: /*#__PURE__*/_jsx(_Fragment, {
202
+ children: "Starts With"
203
+ })
204
+ }
205
+ }, {
206
+ key: 'not_starts_with',
207
+ element: {
208
+ active: /*#__PURE__*/_jsx(_Fragment, {
209
+ children: "Not Starts With"
210
+ }),
211
+ expanded: /*#__PURE__*/_jsx(_Fragment, {
212
+ children: "Not Starts With"
213
+ })
214
+ }
215
+ }];
216
+ var numberMatchTypeItems = [{
217
+ key: 'equal',
218
+ element: {
219
+ active: /*#__PURE__*/_jsx(_Fragment, {
220
+ children: "Equals"
221
+ }),
222
+ expanded: /*#__PURE__*/_jsx(_Fragment, {
223
+ children: "Equals"
224
+ })
225
+ }
226
+ }, {
227
+ key: 'not_equal',
228
+ element: {
229
+ active: /*#__PURE__*/_jsx(_Fragment, {
230
+ children: "Not Equals"
231
+ }),
232
+ expanded: /*#__PURE__*/_jsx(_Fragment, {
233
+ children: "Not Equals"
234
+ })
235
+ }
236
+ }];
237
+ var ProfileFilters = function ProfileFilters(t0) {
238
+ var $ = _c(49);
239
+ var t1;
240
+ if ($[0] !== t0) {
241
+ t1 = t0 === undefined ? {} : t0;
242
+ $[0] = t0;
243
+ $[1] = t1;
244
+ } else {
245
+ t1 = $[1];
246
+ }
247
+ var _t = t1,
248
+ t2 = _t.readOnly;
249
+ var readOnly = t2 === undefined ? false : t2;
250
+ var _useProfileViewContex = useProfileViewContext(),
251
+ profileSource = _useProfileViewContex.profileSource;
252
+ var t3;
253
+ if ($[2] !== profileSource) {
254
+ var _profileSource$Profil;
255
+ var currentProfileType = profileSource === null || profileSource === void 0 || (_profileSource$Profil = profileSource.ProfileType()) === null || _profileSource$Profil === void 0 ? void 0 : _profileSource$Profil.toString();
256
+ t3 = getFilterTypeItems(currentProfileType);
257
+ $[2] = profileSource;
258
+ $[3] = t3;
259
+ } else {
260
+ t3 = $[3];
261
+ }
262
+ var filterTypeItems = t3;
263
+ var _useProfileFilters = useProfileFilters(),
264
+ localFilters = _useProfileFilters.localFilters,
265
+ appliedFilters = _useProfileFilters.appliedFilters,
266
+ hasUnsavedChanges = _useProfileFilters.hasUnsavedChanges,
267
+ onApplyFilters = _useProfileFilters.onApplyFilters,
268
+ addFilter = _useProfileFilters.addFilter,
269
+ removeFilter = _useProfileFilters.removeFilter,
270
+ updateFilter = _useProfileFilters.updateFilter,
271
+ resetFilters = _useProfileFilters.resetFilters;
272
+ var t4;
273
+ if ($[4] !== onApplyFilters) {
274
+ t4 = function t4(e) {
275
+ if (e.key === "Enter") {
276
+ e.preventDefault();
277
+ if (e.currentTarget.value.trim() === "") {
278
+ return;
169
279
  }
170
- }, [onApplyFilters]);
171
- const filtersToRender = localFilters.length > 0 ? localFilters : appliedFilters ?? [];
172
- return (_jsxs("div", { className: "flex gap-2 w-full items-start", ...testId(TEST_IDS.PROFILE_FILTERS_CONTAINER), children: [_jsxs("div", { className: "flex-1 flex flex-wrap gap-2", children: [filtersToRender.map(filter => {
173
- const isNumberField = filter.field === 'address' || filter.field === 'line_number';
174
- const matchTypeItems = isNumberField ? numberMatchTypeItems : stringMatchTypeItems;
175
- const isPresetFilter = filter.type != null && isPresetKey(filter.type);
176
- return (_jsxs("div", { className: "flex items-center gap-0", children: [_jsx(Select, { items: filterTypeItems, selectedKey: filter.type, placeholder: "Select Filter", disabled: readOnly, ...testId(TEST_IDS.FILTER_TYPE_SELECT), flyoutTestId: "filter-type-select-flyout", onSelection: key => {
177
- // Check if this is a preset selection
178
- if (isPresetKey(key)) {
179
- const preset = getPresetByKey(key);
180
- if (preset != null) {
181
- updateFilter(filter.id, {
182
- type: preset.key,
183
- field: undefined,
184
- matchType: undefined,
185
- value: preset.name,
186
- });
187
- }
188
- }
189
- else {
190
- const newType = key;
191
- // Check if we're converting a preset filter to a regular filter
192
- if (filter.type != null && isPresetKey(filter.type)) {
193
- updateFilter(filter.id, {
194
- type: newType,
195
- field: 'function_name',
196
- matchType: 'contains',
197
- value: '',
198
- });
199
- }
200
- else {
201
- updateFilter(filter.id, {
202
- type: newType,
203
- field: filter.field ?? 'function_name',
204
- matchType: filter.matchType ?? 'contains',
205
- });
206
- }
207
- }
208
- }, className: cx('gap-0 focus:z-50 focus:relative focus:outline-1', readOnly ? '' : 'pr-1', readOnly && isPresetFilter ? 'rounded-md' : 'rounded-l-md rounded-r-none', !readOnly && (isPresetFilter ? 'rounded-r-none border-r-0' : 'rounded-r-none'), readOnly ? 'w-auto' : filter.type != null ? 'border-r-0 w-auto' : 'w-32'), hideCaretDropdown: readOnly }), filter.type != null && !isPresetFilter && (_jsxs(_Fragment, { children: [_jsx(Select, { items: fieldItems, selectedKey: filter.field ?? '', disabled: readOnly, ...testId(TEST_IDS.FILTER_FIELD_SELECT), flyoutTestId: "filter-field-select-flyout", onSelection: key => {
209
- const newField = key;
210
- const isNewFieldNumber = newField === 'address' || newField === 'line_number';
211
- const isCurrentFieldNumber = filter.field === 'address' || filter.field === 'line_number';
212
- if (isNewFieldNumber !== isCurrentFieldNumber) {
213
- updateFilter(filter.id, {
214
- field: newField,
215
- matchType: 'equal',
216
- });
217
- }
218
- else {
219
- updateFilter(filter.id, { field: newField });
220
- }
221
- }, className: cx('rounded-none border-r-0 w-32 gap-0 focus:z-50 focus:relative focus:outline-1', readOnly ? '' : 'pr-1'), hideCaretDropdown: readOnly }), _jsx(Select, { items: matchTypeItems, selectedKey: filter.matchType ?? '', disabled: readOnly, ...testId(TEST_IDS.FILTER_MATCH_TYPE_SELECT), flyoutTestId: "filter-match-type-select-flyout", onSelection: key => updateFilter(filter.id, { matchType: key }), className: cx('rounded-none border-r-0 gap-0 focus:z-50 focus:relative focus:outline-1', readOnly ? '' : 'pr-1'), hideCaretDropdown: readOnly }), _jsx(Input, { placeholder: "Value", value: filter.value, disabled: readOnly, onChange: e => updateFilter(filter.id, { value: e.target.value }), onKeyDown: handleKeyDown, className: "rounded-none w-36 text-sm focus:outline-1", ...testId(TEST_IDS.FILTER_VALUE_INPUT) })] })), !readOnly && (_jsx(Button, { variant: "neutral", ...testId(TEST_IDS.FILTER_REMOVE_BUTTON), onClick: () => {
222
- // If we're displaying local filters and this is the last one, reset everything
223
- if (localFilters.length > 0 && localFilters.length === 1) {
224
- resetFilters();
225
- }
226
- // If we're displaying applied filters and this is the last one, reset everything
227
- else if (localFilters.length === 0 && filtersToRender.length === 1) {
228
- resetFilters();
229
- }
230
- // Otherwise, just remove this specific filter
231
- else {
232
- removeFilter(filter.id);
233
- }
234
- }, className: cx('h-[38px] p-3', filter.type != null
235
- ? 'rounded-none rounded-r-md'
236
- : 'rounded-l-none rounded-r-md'), children: _jsx(Icon, { icon: "mdi:close", className: "h-4 w-4" }) }))] }, filter.id));
237
- }), !readOnly && localFilters.length > 0 && (_jsx(Button, { variant: "neutral", onClick: addFilter, className: "p-3 h-[38px]", ...testId(TEST_IDS.ADD_FILTER_BUTTON), children: _jsx(Icon, { icon: "mdi:filter-plus-outline", className: "h-4 w-4" }) })), !readOnly && localFilters.length === 0 && (appliedFilters?.length ?? 0) === 0 && (_jsxs(Button, { variant: "neutral", onClick: addFilter, className: "flex items-center gap-2", ...testId(TEST_IDS.ADD_FILTER_BUTTON), children: [_jsx(Icon, { icon: "mdi:filter-outline", className: "h-4 w-4" }), _jsx("span", { children: "Filter" })] }))] }), !readOnly && localFilters.length > 0 && (_jsx(Button, { variant: "primary", onClick: onApplyFilters, disabled: !hasUnsavedChanges || !localFilters.some(isFilterComplete), className: cx('flex items-center gap-2 sticky top-0'), ...testId(TEST_IDS.APPLY_FILTERS_BUTTON), children: _jsx("span", { children: "Apply" }) }))] }));
280
+ onApplyFilters();
281
+ }
282
+ };
283
+ $[4] = onApplyFilters;
284
+ $[5] = t4;
285
+ } else {
286
+ t4 = $[5];
287
+ }
288
+ var handleKeyDown = t4;
289
+ var t5;
290
+ if ($[6] !== appliedFilters || $[7] !== localFilters) {
291
+ t5 = localFilters.length > 0 ? localFilters : appliedFilters !== null && appliedFilters !== void 0 ? appliedFilters : [];
292
+ $[6] = appliedFilters;
293
+ $[7] = localFilters;
294
+ $[8] = t5;
295
+ } else {
296
+ t5 = $[8];
297
+ }
298
+ var filtersToRender = t5;
299
+ var t6;
300
+ if ($[9] === Symbol["for"]("react.memo_cache_sentinel")) {
301
+ t6 = testId(TEST_IDS.PROFILE_FILTERS_CONTAINER);
302
+ $[9] = t6;
303
+ } else {
304
+ t6 = $[9];
305
+ }
306
+ var t7;
307
+ if ($[10] !== filterTypeItems || $[11] !== filtersToRender || $[12] !== handleKeyDown || $[13] !== localFilters.length || $[14] !== readOnly || $[15] !== removeFilter || $[16] !== resetFilters || $[17] !== updateFilter) {
308
+ var _t2;
309
+ if ($[19] !== filterTypeItems || $[20] !== filtersToRender.length || $[21] !== handleKeyDown || $[22] !== localFilters.length || $[23] !== readOnly || $[24] !== removeFilter || $[25] !== resetFilters || $[26] !== updateFilter) {
310
+ _t2 = function _t2(filter) {
311
+ var _filter$field2, _filter$matchType2;
312
+ var isNumberField = filter.field === "address" || filter.field === "line_number";
313
+ var matchTypeItems = isNumberField ? numberMatchTypeItems : stringMatchTypeItems;
314
+ var isPresetFilter = filter.type != null && isPresetKey(filter.type);
315
+ return /*#__PURE__*/_jsxs("div", {
316
+ className: "flex items-center gap-0",
317
+ children: [/*#__PURE__*/_jsx(Select, _objectSpread(_objectSpread({
318
+ items: filterTypeItems,
319
+ selectedKey: filter.type,
320
+ placeholder: "Select Filter",
321
+ disabled: readOnly
322
+ }, testId(TEST_IDS.FILTER_TYPE_SELECT)), {}, {
323
+ flyoutTestId: "filter-type-select-flyout",
324
+ onSelection: function onSelection(key) {
325
+ if (isPresetKey(key)) {
326
+ var preset = getPresetByKey(key);
327
+ if (preset != null) {
328
+ updateFilter(filter.id, {
329
+ type: preset.key,
330
+ field: undefined,
331
+ matchType: undefined,
332
+ value: preset.name
333
+ });
334
+ }
335
+ } else {
336
+ var newType = key;
337
+ if (filter.type != null && isPresetKey(filter.type)) {
338
+ updateFilter(filter.id, {
339
+ type: newType,
340
+ field: "function_name",
341
+ matchType: "contains",
342
+ value: ""
343
+ });
344
+ } else {
345
+ var _filter$field, _filter$matchType;
346
+ updateFilter(filter.id, {
347
+ type: newType,
348
+ field: (_filter$field = filter.field) !== null && _filter$field !== void 0 ? _filter$field : "function_name",
349
+ matchType: (_filter$matchType = filter.matchType) !== null && _filter$matchType !== void 0 ? _filter$matchType : "contains"
350
+ });
351
+ }
352
+ }
353
+ },
354
+ className: cx("gap-0 focus:z-50 focus:relative focus:outline-1", readOnly ? "" : "pr-1", readOnly && isPresetFilter ? "rounded-md" : "rounded-l-md rounded-r-none", !readOnly && (isPresetFilter ? "rounded-r-none border-r-0" : "rounded-r-none"), readOnly ? "w-auto" : filter.type != null ? "border-r-0 w-auto" : "w-32"),
355
+ hideCaretDropdown: readOnly
356
+ })), filter.type != null && !isPresetFilter && /*#__PURE__*/_jsxs(_Fragment, {
357
+ children: [/*#__PURE__*/_jsx(Select, _objectSpread(_objectSpread({
358
+ items: fieldItems,
359
+ selectedKey: (_filter$field2 = filter.field) !== null && _filter$field2 !== void 0 ? _filter$field2 : "",
360
+ disabled: readOnly
361
+ }, testId(TEST_IDS.FILTER_FIELD_SELECT)), {}, {
362
+ flyoutTestId: "filter-field-select-flyout",
363
+ onSelection: function onSelection(key_0) {
364
+ var newField = key_0;
365
+ var isNewFieldNumber = newField === "address" || newField === "line_number";
366
+ var isCurrentFieldNumber = filter.field === "address" || filter.field === "line_number";
367
+ if (isNewFieldNumber !== isCurrentFieldNumber) {
368
+ updateFilter(filter.id, {
369
+ field: newField,
370
+ matchType: "equal"
371
+ });
372
+ } else {
373
+ updateFilter(filter.id, {
374
+ field: newField
375
+ });
376
+ }
377
+ },
378
+ className: cx("rounded-none border-r-0 w-32 gap-0 focus:z-50 focus:relative focus:outline-1", readOnly ? "" : "pr-1"),
379
+ hideCaretDropdown: readOnly
380
+ })), /*#__PURE__*/_jsx(Select, _objectSpread(_objectSpread({
381
+ items: matchTypeItems,
382
+ selectedKey: (_filter$matchType2 = filter.matchType) !== null && _filter$matchType2 !== void 0 ? _filter$matchType2 : "",
383
+ disabled: readOnly
384
+ }, testId(TEST_IDS.FILTER_MATCH_TYPE_SELECT)), {}, {
385
+ flyoutTestId: "filter-match-type-select-flyout",
386
+ onSelection: function onSelection(key_1) {
387
+ return updateFilter(filter.id, {
388
+ matchType: key_1
389
+ });
390
+ },
391
+ className: cx("rounded-none border-r-0 gap-0 focus:z-50 focus:relative focus:outline-1", readOnly ? "" : "pr-1"),
392
+ hideCaretDropdown: readOnly
393
+ })), /*#__PURE__*/_jsx(Input, _objectSpread({
394
+ placeholder: "Value",
395
+ value: filter.value,
396
+ disabled: readOnly,
397
+ onChange: function onChange(e_0) {
398
+ return updateFilter(filter.id, {
399
+ value: e_0.target.value
400
+ });
401
+ },
402
+ onKeyDown: handleKeyDown,
403
+ className: "rounded-none w-36 text-sm focus:outline-1"
404
+ }, testId(TEST_IDS.FILTER_VALUE_INPUT)))]
405
+ }), !readOnly && /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
406
+ variant: "neutral"
407
+ }, testId(TEST_IDS.FILTER_REMOVE_BUTTON)), {}, {
408
+ onClick: function onClick() {
409
+ if (localFilters.length > 0 && localFilters.length === 1) {
410
+ resetFilters();
411
+ } else {
412
+ if (localFilters.length === 0 && filtersToRender.length === 1) {
413
+ resetFilters();
414
+ } else {
415
+ removeFilter(filter.id);
416
+ }
417
+ }
418
+ },
419
+ className: cx("h-[38px] p-3", filter.type != null ? "rounded-none rounded-r-md" : "rounded-l-none rounded-r-md"),
420
+ children: /*#__PURE__*/_jsx(Icon, {
421
+ icon: "mdi:close",
422
+ className: "h-4 w-4"
423
+ })
424
+ }))]
425
+ }, filter.id);
426
+ };
427
+ $[19] = filterTypeItems;
428
+ $[20] = filtersToRender.length;
429
+ $[21] = handleKeyDown;
430
+ $[22] = localFilters.length;
431
+ $[23] = readOnly;
432
+ $[24] = removeFilter;
433
+ $[25] = resetFilters;
434
+ $[26] = updateFilter;
435
+ $[27] = _t2;
436
+ } else {
437
+ _t2 = $[27];
438
+ }
439
+ t7 = filtersToRender.map(_t2);
440
+ $[10] = filterTypeItems;
441
+ $[11] = filtersToRender;
442
+ $[12] = handleKeyDown;
443
+ $[13] = localFilters.length;
444
+ $[14] = readOnly;
445
+ $[15] = removeFilter;
446
+ $[16] = resetFilters;
447
+ $[17] = updateFilter;
448
+ $[18] = t7;
449
+ } else {
450
+ t7 = $[18];
451
+ }
452
+ var t8;
453
+ if ($[28] !== addFilter || $[29] !== localFilters.length || $[30] !== readOnly) {
454
+ t8 = !readOnly && localFilters.length > 0 && /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
455
+ variant: "neutral",
456
+ onClick: addFilter,
457
+ className: "p-3 h-[38px]"
458
+ }, testId(TEST_IDS.ADD_FILTER_BUTTON)), {}, {
459
+ children: /*#__PURE__*/_jsx(Icon, {
460
+ icon: "mdi:filter-plus-outline",
461
+ className: "h-4 w-4"
462
+ })
463
+ }));
464
+ $[28] = addFilter;
465
+ $[29] = localFilters.length;
466
+ $[30] = readOnly;
467
+ $[31] = t8;
468
+ } else {
469
+ t8 = $[31];
470
+ }
471
+ var t9;
472
+ if ($[32] !== addFilter || $[33] !== (appliedFilters === null || appliedFilters === void 0 ? void 0 : appliedFilters.length) || $[34] !== localFilters.length || $[35] !== readOnly) {
473
+ var _appliedFilters$lengt;
474
+ t9 = !readOnly && localFilters.length === 0 && ((_appliedFilters$lengt = appliedFilters === null || appliedFilters === void 0 ? void 0 : appliedFilters.length) !== null && _appliedFilters$lengt !== void 0 ? _appliedFilters$lengt : 0) === 0 && /*#__PURE__*/_jsxs(Button, _objectSpread(_objectSpread({
475
+ variant: "neutral",
476
+ onClick: addFilter,
477
+ className: "flex items-center gap-2"
478
+ }, testId(TEST_IDS.ADD_FILTER_BUTTON)), {}, {
479
+ children: [/*#__PURE__*/_jsx(Icon, {
480
+ icon: "mdi:filter-outline",
481
+ className: "h-4 w-4"
482
+ }), /*#__PURE__*/_jsx("span", {
483
+ children: "Filter"
484
+ })]
485
+ }));
486
+ $[32] = addFilter;
487
+ $[33] = appliedFilters === null || appliedFilters === void 0 ? void 0 : appliedFilters.length;
488
+ $[34] = localFilters.length;
489
+ $[35] = readOnly;
490
+ $[36] = t9;
491
+ } else {
492
+ t9 = $[36];
493
+ }
494
+ var t10;
495
+ if ($[37] !== t7 || $[38] !== t8 || $[39] !== t9) {
496
+ t10 = /*#__PURE__*/_jsxs("div", {
497
+ className: "flex-1 flex flex-wrap gap-2",
498
+ children: [t7, t8, t9]
499
+ });
500
+ $[37] = t7;
501
+ $[38] = t8;
502
+ $[39] = t9;
503
+ $[40] = t10;
504
+ } else {
505
+ t10 = $[40];
506
+ }
507
+ var t11;
508
+ if ($[41] !== hasUnsavedChanges || $[42] !== localFilters || $[43] !== onApplyFilters || $[44] !== readOnly) {
509
+ t11 = !readOnly && localFilters.length > 0 && /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({
510
+ variant: "primary",
511
+ onClick: onApplyFilters,
512
+ disabled: !hasUnsavedChanges || !localFilters.some(isFilterComplete),
513
+ className: cx("flex items-center gap-2 sticky top-0")
514
+ }, testId(TEST_IDS.APPLY_FILTERS_BUTTON)), {}, {
515
+ children: /*#__PURE__*/_jsx("span", {
516
+ children: "Apply"
517
+ })
518
+ }));
519
+ $[41] = hasUnsavedChanges;
520
+ $[42] = localFilters;
521
+ $[43] = onApplyFilters;
522
+ $[44] = readOnly;
523
+ $[45] = t11;
524
+ } else {
525
+ t11 = $[45];
526
+ }
527
+ var t12;
528
+ if ($[46] !== t10 || $[47] !== t11) {
529
+ t12 = /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
530
+ className: "flex gap-2 w-full items-start"
531
+ }, t6), {}, {
532
+ children: [t10, t11]
533
+ }));
534
+ $[46] = t10;
535
+ $[47] = t11;
536
+ $[48] = t12;
537
+ } else {
538
+ t12 = $[48];
539
+ }
540
+ return t12;
238
541
  };
239
- export default ProfileFilters;
542
+ export default ProfileFilters;