@odigos/ui-kit 0.0.286-dev.520 → 0.0.287
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.
- package/CHANGELOG.md +7 -0
- package/lib/chunks/helpers-CtkwQ3Wc.js +9 -0
- package/lib/chunks/{index-9H2LDuOq.js → index-BlYPxLja.js} +23 -23
- package/lib/chunks/source-instrument-form-context-Bg6JzU76.js +5 -0
- package/lib/chunks/ui-components-CjgsN17j.js +1943 -0
- package/lib/components/button/index.d.ts +3 -1
- package/lib/components/drop-data/index.d.ts +4 -10
- package/lib/components/index.d.ts +2 -0
- package/lib/components/popup/index.d.ts +17 -0
- package/lib/components/select-window-hours/index.d.ts +17 -0
- package/lib/components.js +1 -1
- package/lib/constants/index.d.ts +1 -0
- package/lib/constants/instrumentation-rules/index.d.ts +2 -1
- package/lib/constants/strings/index.d.ts +14 -0
- package/lib/constants/url-templatization/index.d.ts +90 -0
- package/lib/constants.js +1 -1
- package/lib/containers/_drawers/index.d.ts +3 -0
- package/lib/containers/_drawers/url-templatization-custom-template-drawer/destination-step.d.ts +16 -0
- package/lib/containers/_drawers/url-templatization-custom-template-drawer/index.d.ts +18 -0
- package/lib/containers/_drawers/url-templatization-default-rule-drawer/index.d.ts +14 -0
- package/lib/containers/_drawers/url-templatization-template-view-drawer/index.d.ts +9 -0
- package/lib/containers/central-connections/helpers.d.ts +8 -0
- package/lib/containers/central-connections/index.d.ts +1 -0
- package/lib/containers/index.d.ts +1 -0
- package/lib/containers/insights/findings/drawer/anomaly/index.d.ts +1 -0
- package/lib/containers/insights/findings/drawer/helpers.d.ts +0 -2
- package/lib/containers/insights/findings/drawer/violation/index.d.ts +1 -0
- package/lib/containers/insights/findings/helpers.d.ts +13 -3
- package/lib/containers/insights/findings/resolve-findings/index.d.ts +11 -0
- package/lib/containers/insights/overview/contained-table-and-heading/index.d.ts +1 -0
- package/lib/containers/insights/settings-and-configurations/panels/guardrails/create-panel.d.ts +2 -6
- package/lib/containers/insights/settings-and-configurations/panels/guardrails/facet-section.d.ts +1 -0
- package/lib/containers/insights/settings-and-configurations/panels/guardrails/mappers.d.ts +5 -0
- package/lib/containers/insights/transactions/helpers.d.ts +0 -1
- package/lib/containers/url-templatization/converters.d.ts +43 -0
- package/lib/containers/url-templatization/custom-templates-list.d.ts +16 -0
- package/lib/containers/url-templatization/default-rules-list.d.ts +10 -0
- package/lib/containers/url-templatization/helpers.d.ts +17 -0
- package/lib/containers/url-templatization/index.d.ts +5 -0
- package/lib/containers/url-templatization/scope-summary.d.ts +8 -0
- package/lib/containers/url-templatization/template-path.d.ts +8 -0
- package/lib/containers.js +888 -432
- package/lib/contexts/odigos-api/hooks/use-insights-api.d.ts +4 -1
- package/lib/contexts/odigos-api/index.d.ts +1 -1
- package/lib/contexts/odigos-api/types.d.ts +5 -0
- package/lib/contexts/odigos-context.d.ts +3 -3
- package/lib/contexts.js +1 -1
- package/lib/functions.js +1 -1
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/useAnchoredPopup.d.ts +44 -0
- package/lib/hooks/useOnClickOutside.d.ts +1 -0
- package/lib/hooks.js +1 -1
- package/lib/icons/common/clock-icon/index.d.ts +2 -0
- package/lib/icons/common/index.d.ts +1 -0
- package/lib/icons/overview/index.d.ts +1 -0
- package/lib/icons/overview/url-templatization-icon/index.d.ts +2 -0
- package/lib/icons.js +1 -1
- package/lib/snippets/actions/index.d.ts +8 -5
- package/lib/snippets/upgrade-modal/index.d.ts +1 -1
- package/lib/snippets/wide-drawer/index.d.ts +6 -0
- package/lib/snippets.js +1 -1
- package/lib/store.js +1 -1
- package/lib/theme.js +1 -1
- package/lib/types/actions/index.d.ts +12 -0
- package/lib/types/common/index.d.ts +7 -2
- package/lib/types/instrumentation-rules/index.d.ts +1 -0
- package/lib/types.js +1 -1
- package/lib/visuals.js +1 -1
- package/package.json +1 -1
- package/lib/chunks/helpers-B0SJ6hqm.js +0 -9
- package/lib/chunks/source-instrument-form-context-BF70uJ_R.js +0 -5
- package/lib/chunks/ui-components-DqG0z5U0.js +0 -1878
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import { type
|
|
1
|
+
import React, { FC } from 'react';
|
|
2
|
+
import { type PopupProps } from '../../components/popup';
|
|
3
3
|
import { type DropDataProps } from '../../components/drop-data';
|
|
4
|
+
import { type ButtonProps } from '../../components/button';
|
|
4
5
|
export declare enum ActionType {
|
|
5
6
|
Button = "button",
|
|
6
|
-
|
|
7
|
+
DropDataButton = "drop-data-button",
|
|
8
|
+
PopupButton = "popup-button"
|
|
7
9
|
}
|
|
8
10
|
interface Action {
|
|
9
11
|
id: string;
|
|
10
12
|
type: ActionType;
|
|
11
|
-
buttonProps?: ButtonProps & {
|
|
12
|
-
onClick?: (id: string) => void;
|
|
13
|
+
buttonProps?: Omit<ButtonProps, 'onClick'> & {
|
|
14
|
+
onClick?: ((e: React.MouseEvent<HTMLButtonElement>) => unknown) | ((id: string) => void);
|
|
13
15
|
};
|
|
14
16
|
dropDataProps?: Pick<DropDataProps, 'items' | 'alignX' | 'alignY'>;
|
|
17
|
+
popupProps?: PopupProps;
|
|
15
18
|
}
|
|
16
19
|
export interface ActionsProps {
|
|
17
20
|
onAnyClick?: () => void;
|
|
@@ -33,6 +33,12 @@ export interface WideDrawerProps {
|
|
|
33
33
|
filters?: ReactNode;
|
|
34
34
|
errorMessage?: string;
|
|
35
35
|
isFormDirty?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Opt out of the implicit "pristine forms cannot be saved" gate while still reporting
|
|
38
|
+
* dirtiness (which drives the discard-changes prompt on close). Needed when the entity is
|
|
39
|
+
* fully specified without the user editing any field.
|
|
40
|
+
*/
|
|
41
|
+
allowSaveWhenPristine?: boolean;
|
|
36
42
|
hideDirtyNote?: boolean;
|
|
37
43
|
forcedNote?: NoteProps;
|
|
38
44
|
isFetching?: boolean;
|
package/lib/snippets.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{A as ActionType,a as Actions,R as RichTitle}from"./chunks/ui-components-
|
|
1
|
+
export{A as ActionType,a as Actions,R as RichTitle}from"./chunks/ui-components-CjgsN17j.js";export{A as AnimatedCollapse,C as CancelModal,a as CodeModal,b as ConnectorCreatedModal,D as DURATION_OPTIONS,c as DeleteModal,d as DurationErrorsSection,e as DynamicActionFields,f as DynamicField,g as DynamicFields,E as EnableDisableSegment,I as InstrumentationPreviewSection,N as NOISY_PERCENTAGE_OPTIONS,O as OdigosLogoTextByTier,h as OperationSection,P as PERCENTAGE_OPTIONS,i as PercentageSection,j as PresetWithCustomInput,R as RuleInfoSection,k as RuleTypeSection,S as SamplingPreviewSection,l as SignalsCheckboxList,m as SourceScopeSection,U as UpgradeModal,W as WIDE_DRAWER_WIDTH,n as WideDrawer,Y as YamlSectionCard}from"./chunks/index-BlYPxLja.js";export{C as ColoredSpan,a as ColoredSpanVariant}from"./chunks/helpers-CtkwQ3Wc.js";import"react/jsx-runtime";import"styled-components";import"./icons.js";import"zustand";import"react";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"react-dom";import"prism-react-renderer";import"zustand/middleware";import"react-error-boundary";import"virtua";
|
package/lib/store.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{eM as DrawerType,bi as ProgressKeys,gt as getDrawerTypeForAdd,cE as getDrawerTypeForEdit,iD as useDarkMode,bf as useDataStreamStore,cz as useDrawerStore,go as useFilterStore,ba as useNotificationStore,bg as useProgressStore,gu as useSelectedStore,bh as useSetupStore}from"./chunks/ui-components-CjgsN17j.js";import"react/jsx-runtime";import"styled-components";import"./icons.js";import"zustand";import"react";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"react-dom";import"prism-react-renderer";import"zustand/middleware";import"react-error-boundary";import"virtua";
|
package/lib/theme.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{iQ as Provider,iR as animations,iS as opacity,iT as palettes}from"./chunks/ui-components-CjgsN17j.js";import"react/jsx-runtime";import"styled-components";import"./icons.js";import"zustand";import"react";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"react-dom";import"prism-react-renderer";import"zustand/middleware";import"react-error-boundary";import"virtua";
|
|
@@ -31,6 +31,7 @@ export declare enum ActionKeyTypes {
|
|
|
31
31
|
Renames = "renames",
|
|
32
32
|
PiiCategories = "piiCategories",
|
|
33
33
|
UrlTemplatizationRulesGroups = "urlTemplatizationRulesGroups",
|
|
34
|
+
UrlTemplatizationDefaultGroups = "urlTemplatizationDefaultGroups",
|
|
34
35
|
ExtractAttribute = "extractAttribute",
|
|
35
36
|
TemplatizeLiterals = "templatizeLiterals",
|
|
36
37
|
Scopes = "scopes"
|
|
@@ -105,6 +106,7 @@ export interface ActionFields {
|
|
|
105
106
|
} | null;
|
|
106
107
|
[ActionKeyTypes.PiiCategories]?: string[] | null;
|
|
107
108
|
[ActionKeyTypes.UrlTemplatizationRulesGroups]?: UrlTemplatizationRulesGroup[] | null;
|
|
109
|
+
[ActionKeyTypes.UrlTemplatizationDefaultGroups]?: UrlTemplatizationDefaultGroup[] | null;
|
|
108
110
|
[ActionKeyTypes.ExtractAttribute]?: ExtractAttribute | null;
|
|
109
111
|
[ActionKeyTypes.TemplatizeLiterals]?: boolean | null;
|
|
110
112
|
[ActionKeyTypes.Scopes]?: SourcesScopes | null;
|
|
@@ -224,7 +226,17 @@ export interface Extraction {
|
|
|
224
226
|
export interface ExtractAttribute {
|
|
225
227
|
extractions: Extraction[];
|
|
226
228
|
}
|
|
229
|
+
export interface UrlTemplatizationDefaultSkipPolicy {
|
|
230
|
+
skipForNonSuccessCodes?: boolean | null;
|
|
231
|
+
skipHttpStatusCodes?: number[] | null;
|
|
232
|
+
}
|
|
233
|
+
export interface UrlTemplatizationDefaultGroup {
|
|
234
|
+
scopes?: SourcesScopes | null;
|
|
235
|
+
disabled?: boolean | null;
|
|
236
|
+
skipPolicy?: UrlTemplatizationDefaultSkipPolicy | null;
|
|
237
|
+
}
|
|
227
238
|
export interface UrlTemplatizationRulesGroup {
|
|
239
|
+
scopes?: SourcesScopes | null;
|
|
228
240
|
filterK8sNamespace?: string;
|
|
229
241
|
/** @deprecated Use workloadFilters instead. Kept for backward compatibility with existing CRs. */
|
|
230
242
|
filterK8sWorkloadKind?: WorkloadKind;
|
|
@@ -45,16 +45,21 @@ export declare enum PlatformType {
|
|
|
45
45
|
Connector = "connector",
|
|
46
46
|
AwsEcs = "aws.ecs"
|
|
47
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* A version threshold. Strings are required for values JS numbers cannot
|
|
50
|
+
* represent (`1.20 === 1.2`); `trimVersion` accepts both.
|
|
51
|
+
*/
|
|
52
|
+
export type VersionThreshold = number | string;
|
|
48
53
|
/**
|
|
49
54
|
* The minimum Odigos version required to use a given feature.
|
|
50
55
|
*
|
|
51
|
-
* A single
|
|
56
|
+
* A single number/string applies the same threshold to every platform
|
|
52
57
|
* (backwards-compatible with the historical k8s-only behavior), while a
|
|
53
58
|
* partial map lets a feature declare a different minimum per platform type
|
|
54
59
|
* (e.g. a feature that shipped earlier on `k8s` than on `vm`). Platforms
|
|
55
60
|
* omitted from the map are treated as having no requirement (always supported).
|
|
56
61
|
*/
|
|
57
|
-
export type MinSupportedVersion =
|
|
62
|
+
export type MinSupportedVersion = VersionThreshold | Partial<Record<PlatformType, VersionThreshold>>;
|
|
58
63
|
export declare enum InstallationMethod {
|
|
59
64
|
Cli = "odigos-cli",
|
|
60
65
|
Helm = "helm",
|
|
@@ -6,6 +6,7 @@ export declare enum InstrumentationRuleType {
|
|
|
6
6
|
HeadersCollection = "HeadersCollection",
|
|
7
7
|
PayloadCollection = "PayloadCollection",
|
|
8
8
|
CustomInstrumentation = "CustomInstrumentation",
|
|
9
|
+
NetworkMetrics = "NetworkMetrics",
|
|
9
10
|
UnknownType = "UnknownType"
|
|
10
11
|
}
|
|
11
12
|
export interface InstrumentationRule {
|
package/lib/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{c7 as ActionCategoryTypes,bx as ActionKeyTypes,by as ActionType,hi as AgentInjectedReason,hj as BooleanOperation,cd as CloudConnectorFeatureKey,am as CodeAttributesKeyTypes,hk as ConditionType,bd as Crud,ag as CustomInstrumentationsKeyTypes,cP as DesiredConditionActionItemType,cs as DesiredStateProgress,hl as DestinationTypes,be as EntityTypes,bO as ExtractionDataFormat,p as FieldTypes,ai as GolangCustomProbe,ak as HeadersCollectionKeyTypes,J as InputTypes,hm as InsightsAnomalyClassFindingKind,g4 as InsightsAnomalyResolution,g0 as InsightsAnomalyStatus,gb as InsightsBaselineLearningPhase,g3 as InsightsBulkResolution,ge as InsightsDeviationClass,bm as InsightsEntityTypes,g1 as InsightsFindingKind,gh as InsightsLearningConditionType,gg as InsightsLearningMode,gf as InsightsPolicyScope,gi as InsightsRuleMode,gd as InsightsSampleReason,g2 as InsightsSeverity,gl as InsightsStorageDiskStatus,hn as InsightsStorageHealthStatus,ho as InsightsTransactionKind,f$ as InsightsViolationStatus,hp as InstallationMethod,hq as InstallationStatus,af as InstrumentationRuleType,hr as IntrumentationStatus,ah as JavaCustomProbe,hs as JsonOperation,bM as K8sAttributesFrom,bG as K8sResourceKind,ht as K8sWorkloadContainerAgentConfigTracesHeadSamplingSpanMetricsMode,hu as ListDirection,hv as NumberOperation,hw as OtelDistroName,hx as OtherEntityTypes,al as PayloadCollectionKeyTypes,aj as PhpCustomProbe,P as PlatformType,hy as PodContainerLifecycleStatus,hz as PodContainerStatus,hA as PodPhase,hB as Profile,_ as ProgrammingLanguages,c$ as RecommendationApplyExampleType,d0 as RecommendationRemediationType,c_ as RecommendationState,hC as RecommendationType,hD as SIGNAL_KEY_TO_TYPE,hE as SIGNAL_TYPE_TO_KEY,hF as SignalKey,bD as SignalType,hG as SortDirection,S as StatusType,hH as StringOperation,b as Tier,hI as WorkloadRolloutReason,gH as WorkloadRolloutStatus}from"./chunks/ui-components-CjgsN17j.js";import"react/jsx-runtime";import"styled-components";import"./icons.js";import"zustand";import"react";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"react-dom";import"prism-react-renderer";import"zustand/middleware";import"react-error-boundary";import"virtua";
|
package/lib/visuals.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{hJ as VISUAL_ODIGOS_LOGO_HEIGHT,hK as VISUAL_ODIGOS_LOGO_WIDTH,V as VisualGreenRings,hL as VisualOdigosLogo,eW as VisualPurpleRings}from"./chunks/ui-components-CjgsN17j.js";import"react/jsx-runtime";import"styled-components";import"./icons.js";import"zustand";import"react";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"react-dom";import"prism-react-renderer";import"zustand/middleware";import"react-error-boundary";import"virtua";
|
package/package.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import{Fragment as n,useMemo as o,useContext as a,createContext as s}from"react";import{T as i,t as u,b as l,P as c}from"./ui-components-DqG0z5U0.js";import p from"styled-components";var d;(e=>{e.Default="default",e.Action="action",e.Endpoint="endpoint",e.Scope="scope",e.Duration="duration"})(d||(d={}));const f=[d.Action,d.Endpoint,d.Scope,d.Duration],h=p.span`
|
|
2
|
-
font-family: ${({theme:e,$isMono:t})=>t?e.font_family.secondary:e.font_family.primary};
|
|
3
|
-
font-size: ${({theme:e})=>e.v2.text.size.xxs}px;
|
|
4
|
-
line-height: 20px;
|
|
5
|
-
color: ${({theme:e,$variant:t})=>{const r=e.v2.colors;switch(t){case"action":return r.green[400];case"endpoint":return r.purple[300];case"scope":return r.yellow[400];case"duration":return r.orange[500];default:return r.white[500]}}};
|
|
6
|
-
`,m=p.span`
|
|
7
|
-
text-decoration: underline dotted;
|
|
8
|
-
text-underline-offset: 3px;
|
|
9
|
-
`,v=({parts:o})=>{const a=o.map(e=>({...e,text:e.text.trim()})).filter(e=>e.text.length>0);return e(t,{children:a.map((o,a)=>{const s=e(h,{$variant:o.variant,$isMono:f.includes(o.variant),children:o.text});return r(n,{children:[0!==a&&e(t,{children:" "}),o.tooltipItems?.length?e(i,{text:o.tooltipItems,inline:!0,maxWidth:"300px",children:e(m,{children:s})}):s]},`${o.variant}-${a}`)})})};function g(){return{sources:[],namespaces:[],languages:[]}}function y(e){return!e||!e.sources?.length&&!e.namespaces?.length&&!e.languages?.length}function x(e){return e?{sources:e.sources?[...e.sources]:[],namespaces:e.namespaces?[...e.namespaces]:[],languages:e.languages?[...e.languages]:[]}:{sources:[],namespaces:[],languages:[]}}function k(e){return null==e||0===e}function T(e){return{name:"",notes:"",disabled:!1,ruleType:"Relevance",sourceScopes:{sources:[],namespaces:[],languages:[]},operationType:"all",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:"",durationPreset:"500",customDurationMs:"",keepErrors:!1,percentageMode:"costReduction"===e?"sample":"all",percentagePreset:"0",customPercentage:""}}function A(e){return y(e.sourceScopes)?null:e.sourceScopes}function S(e){return A(e)}function R(e){if("all"===e.percentageMode)return null;if("custom"===e.percentagePreset){const t=parseFloat(e.customPercentage);return isNaN(t)?null:t}return parseFloat(e.percentagePreset)}function P(e){if("custom"===e.durationPreset){const t=parseFloat(e.customDurationMs);return isNaN(t)?null:t}return parseInt(e.durationPreset,10)}function b(e){return{httpServer:{[e.routeType]:e.route||null,method:e.method||null}}}function D(e){return"all"===e.operationType?null:"httpServer"===e.operationType?b(e):"httpClient"===e.operationType?{httpClient:{serverAddress:e.serverAddress||null,["route"===e.routeType?"templatedPath":"templatedPathPrefix"]:e.route||null,method:e.method||null}}:null}function I(e){return"all"===e.operationType?null:"httpServer"===e.operationType?b(e):"kafkaConsumer"===e.operationType?{kafkaConsumer:{kafkaTopic:e.kafkaTopic||null}}:"kafkaProducer"===e.operationType?{kafkaProducer:{kafkaTopic:e.kafkaTopic||null}}:null}function M(e){return{ruleId:"",name:e.name||null,disabled:!1,notes:e.notes||null,sourceScopes:A(e),percentageAtMost:R(e),operation:D(e)}}function C(e){return{ruleId:"",name:e.name||null,disabled:!1,notes:e.notes||null,sourceScopes:A(e),error:e.keepErrors,durationAtLeastMs:"Duration"===e.ruleType?P(e):null,percentageAtLeast:R(e),operation:I(e)}}function $(e){return{ruleId:"",name:e.name||null,disabled:!1,notes:e.notes||null,sourceScopes:A(e),percentageAtMost:R(e)??0,operation:I(e)}}function E(e){return{name:e.name||null,disabled:e.disabled,sourceScopes:S(e),operation:D(e),percentageAtMost:R(e),notes:e.notes||null}}function w(e){return{name:e.name||null,disabled:e.disabled,sourceScopes:S(e),error:"Error"===e.ruleType,durationAtLeastMs:"Duration"===e.ruleType?P(e):null,operation:I(e),percentageAtLeast:R(e),notes:e.notes||null}}function L(e){return{name:e.name||null,disabled:e.disabled,sourceScopes:S(e),operation:I(e),percentageAtMost:R(e)??0,notes:e.notes||null}}const N=["5000","1000","500","100","50"],O=["50","25","10","1","0.5","0.1","0"];function H(e){if(null==e)return{percentageMode:"all",percentagePreset:"0",customPercentage:""};const t=O.find(t=>Number(t)===e);return t?{percentageMode:"sample",percentagePreset:t,customPercentage:""}:{percentageMode:"sample",percentagePreset:"custom",customPercentage:String(e)}}function K(e){if(!e)return{operationType:"all",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:""};const t=e;return t.httpServer?{operationType:"httpServer",routeType:t.httpServer.routePrefix?"routePrefix":"route",route:t.httpServer.route||t.httpServer.routePrefix||"",serverAddress:"",method:t.httpServer.method||"",kafkaTopic:""}:t.kafkaConsumer?{operationType:"kafkaConsumer",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:t.kafkaConsumer.kafkaTopic||""}:t.kafkaProducer?{operationType:"kafkaProducer",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:t.kafkaProducer.kafkaTopic||""}:{operationType:"all",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:""}}function j(e){const t=T(),r=x(e.rule.sourceScopes),n=(e=>"highlyRelevant"!==e.category?"Relevance":e.rule.error?"Error":null!=e.rule.durationAtLeastMs?"Duration":"Relevance")(e);let o,a,s={durationPreset:"500",customDurationMs:""},i=!1;switch(e.category){case"noisy":o=(e=>{const t=e.rule.operation;return t?t.httpServer?{operationType:"httpServer",routeType:t.httpServer.routePrefix?"routePrefix":"route",route:t.httpServer.route||t.httpServer.routePrefix||"",serverAddress:"",method:t.httpServer.method||"",kafkaTopic:""}:t.httpClient?{operationType:"httpClient",routeType:t.httpClient.templatedPathPrefix?"routePrefix":"route",route:t.httpClient.templatedPath||t.httpClient.templatedPathPrefix||"",serverAddress:t.httpClient.serverAddress||"",method:t.httpClient.method||"",kafkaTopic:""}:{operationType:"all",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:""}:{operationType:"all",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:""}})(e),a=k(u=e.rule.percentageAtMost)?{percentageMode:"all",percentagePreset:"0",customPercentage:""}:H(u);break;case"highlyRelevant":o=K(e.rule.operation),a=H(e.rule.percentageAtLeast),s=(e=>{if(null==e)return{durationPreset:"500",customDurationMs:""};const t=N.find(t=>Number(t)===e);return t?{durationPreset:t,customDurationMs:""}:{durationPreset:"custom",customDurationMs:String(e)}})(e.rule.durationAtLeastMs),i=e.rule.error;break;case"costReduction":o=K(e.rule.operation),a=H(e.rule.percentageAtMost)}var u;return{...t,name:e.rule.name||"",notes:e.rule.notes||"",disabled:e.rule.disabled,ruleType:n,sourceScopes:r,...o,...s,keepErrors:i,...a}}const z=s({platformType:c.K8s,tier:l.Community,version:"v0.0.0"}),F=({children:t,platformType:r,tier:n,version:a})=>{const s=o(()=>({platformType:r,tier:n,version:a}),[r,n,a]);return e(z.Provider,{value:s,children:t})},J=(e,t)=>null==e?0:"number"==typeof e?e:t?e[t]??0:0,V=(e,t,r)=>{const n=J(t,r);return!n||u(e)>=u(n)},B=e=>{const t=a(z),r=J(e,t.platformType),n=V(t.version,r),o=t.platformType===c.K8s,s=t.platformType===c.Vm,i=t.platformType===c.Connector,u=t.platformType===c.AwsEcs;return{...t,isVersionSupported:n,minSupportedVersion:r,isK8s:o,isVm:s,isConnector:i,isAwsEcs:u,isEnterprise:t.tier===l.Onprem}};var W;(e=>{e.Noisy="noisy",e.HighlyRelevant="highly-relevant",e.CostReduction="cost-reduction"})(W||(W={}));const _=[{value:W.Noisy,label:"1. Noisy Operations",tooltip:"Rules that reduce noise from high-volume, low-value operations"},{value:W.HighlyRelevant,label:"2. Highly Relevant Operations",tooltip:"Rules that prioritize important traces for retention"},{value:W.CostReduction,label:"3. Cost Reduction",tooltip:"Rules that optimize costs by sampling less critical data"}],q={[W.Noisy]:"This is the most efficient way to sample (with Head Sampling). Prefer to use it where possible.",[W.HighlyRelevant]:'Any trace from the "Noisy Operations" category is sampled prior to checking highly relevance.',[W.CostReduction]:"Cost reduction rules use Tail Sampling to drop traces that are unlikely to be useful for debugging or monitoring."},G={[W.Noisy]:"Noisy Operations rules list",[W.HighlyRelevant]:"Highly Relevant Operations rules list",[W.CostReduction]:"Cost Reduction rules list"},Q={[W.Noisy]:"noisy",[W.HighlyRelevant]:"highlyRelevant",[W.CostReduction]:"costReduction"},U={noisy:W.Noisy,highlyRelevant:W.HighlyRelevant,costReduction:W.CostReduction};function X(e){const t=e.kind?String(e.kind).toLowerCase():"deployment";return e.namespace&&e.name?`${t} '${e.name}' in namespace '${e.namespace}'`:e.name?`${t} '${e.name}'`:e.namespace?`any service in namespace '${e.namespace}'`:""}function Y(e){return`any service in namespace '${e}'`}function Z(e){return`${e} services`}function ee(e,t="global"){const r=(e=>{if(!e)return[];const t=[];for(const r of e.sources??[]){const e=X(r);e&&t.push(e)}for(const r of e.namespaces??[])r&&t.push(Y(r));for(const r of e.languages??[])r&&t.push(Z(r));return t})(e);if(!r.length)return"source"===t?[]:[{text:" in ",variant:d.Default},{text:"any service in the cluster",variant:d.Scope}];const n=[{text:" in ",variant:d.Default}],o=r.slice(0,2),a=r.slice(2);return o.forEach((e,t)=>{t>0&&n.push({text:", ",variant:d.Default}),n.push({text:e,variant:d.Scope})}),a.length>0&&n.push({text:` + ${a.length} more`,variant:d.Default,tooltipItems:a}),n}function te(e,t){const r=(n=e).startsWith("/")?n.slice(1):n;var n;return t?`${t} /${r}`:`/${r}`}function re(e){const t=e.method;return e.route?[{text:" for server endpoint ",variant:d.Default},{text:te(e.route,t),variant:d.Endpoint}]:e.routePrefix?[{text:" for endpoints under ",variant:d.Default},{text:te(e.routePrefix,t),variant:d.Endpoint}]:[]}function ne(e,t="global"){const r=[];if(k(e.percentageAtMost)?r.push({text:"Drop all traces",variant:d.Action}):(r.push({text:`Keep at most ${e.percentageAtMost}%`,variant:d.Action}),r.push({text:" of traces",variant:d.Default})),e.operation){const t=e.operation.httpServer,n=t?(e=>{const t=e.method;return e.route?[{text:" where the root span is ",variant:d.Default},{text:te(e.route,t),variant:d.Endpoint}]:e.routePrefix?[{text:" where the root span is under ",variant:d.Default},{text:te(e.routePrefix,t),variant:d.Endpoint}]:[]})(t):[];n.length>0&&r.push(...n);const o=e.operation.httpClient,a=o?.templatedPath||o?.templatedPathPrefix,s=o?.serverAddress;if((a||s)&&0===n.length){const e=o?.method;if(r.push({text:" to ",variant:d.Default}),a){const t=te(a,e);s&&(r.push({text:"server address ",variant:d.Default}),r.push({text:s,variant:d.Endpoint}),r.push({text:" ",variant:d.Default})),r.push({text:t,variant:d.Endpoint})}else s&&(r.push({text:"server address ",variant:d.Default}),r.push({text:s,variant:d.Endpoint}))}}else r.push({text:" on ",variant:d.Default}),r.push({text:"any operation",variant:d.Endpoint});return r.push(...ee(e.sourceScopes,t)),r}function oe(e,t="global"){const r=[];if(null!=e.percentageAtLeast?(r.push({text:`Keep ${e.percentageAtLeast}%`,variant:d.Action}),r.push({text:" of traces",variant:d.Default})):r.push({text:"Keep all traces",variant:d.Action}),e.operation){const t=e.operation.httpServer;t&&r.push(...re(t))}else r.push({text:" on ",variant:d.Default}),r.push({text:"any operation",variant:d.Endpoint});return r.push(...ee(e.sourceScopes,t)),!e.error&&null!=e.durationAtLeastMs&&e.durationAtLeastMs>0&&(r.push({text:" with duration > ",variant:d.Default}),r.push({text:`${e.durationAtLeastMs}ms`,variant:d.Duration})),r}function ae(e,t="global"){const r=[];if(r.push({text:`Keep at most ${e.percentageAtMost}%`,variant:d.Action}),r.push({text:" of traces",variant:d.Default}),e.operation){const t=e.operation.httpServer,n=t?re(t):[];n.length>0&&r.push(...n);const o=e.operation.kafkaConsumer?.kafkaTopic;o&&0===n.length&&(r.push({text:" from ",variant:d.Default}),r.push({text:`topic '${o}'`,variant:d.Endpoint}))}else r.push({text:" on ",variant:d.Default}),r.push({text:"any operation",variant:d.Endpoint});return r.push(...ee(e.sourceScopes,t)),r}function se(e){return e.error?"Error":null!=e.durationAtLeastMs?"Duration":"Relevance"}function ie(e,t,r){const n=Q[t],o=[];for(const a of e)switch(t){case W.Noisy:for(const e of a.noisyOperations)r?.has(e.ruleId)||o.push({ruleId:e.ruleId,samplingId:a.id,name:e.name??null,disabled:e.disabled,notes:e.notes??null,summary:ne(e),category:n});break;case W.HighlyRelevant:for(const e of a.highlyRelevantOperations)r?.has(e.ruleId)||o.push({ruleId:e.ruleId,samplingId:a.id,name:e.name??null,disabled:e.disabled,notes:e.notes??null,summary:oe(e),category:n,typeBadge:se(e)});break;case W.CostReduction:for(const e of a.costReductionRules)r?.has(e.ruleId)||o.push({ruleId:e.ruleId,samplingId:a.id,name:e.name??null,disabled:e.disabled,notes:e.notes??null,summary:ae(e),category:n})}return o}function ue(e,t){switch(e){case"noisy":return ne(t);case"highlyRelevant":return oe(t);case"costReduction":return ae(t)}}function le(e,t,r,n){for(const o of e)if(o.id===t)switch(n){case"noisy":{const e=o.noisyOperations.find(e=>e.ruleId===r);if(e)return{category:"noisy",samplingId:o.id,rule:e};break}case"highlyRelevant":{const e=o.highlyRelevantOperations.find(e=>e.ruleId===r);if(e)return{category:"highlyRelevant",samplingId:o.id,rule:e};break}case"costReduction":{const e=o.costReductionRules.find(e=>e.ruleId===r);if(e)return{category:"costReduction",samplingId:o.id,rule:e};break}}return null}function ce(e,t){const r=le(e,t.samplingId,t.rule.ruleId,t.category);return r?{...r,summary:ue(r.category,r.rule)}:null}function pe(e,t){const r=le(e,t.samplingId,t.ruleId,t.category);return r?{...r,summary:ue(r.category,r.rule)}:null}function de(e,t,r){for(const n of e){const o=le(e,n.id,t,r);if(o)return{...o,summary:ue(o.category,o.rule)}}return null}function fe(e){if(!e)return null;const t=(e.sources??[]).map(e=>`${e.namespace}/${e.kind}/${e.name}`).sort(),r=(e.namespaces??[]).slice().sort(),n=(e.languages??[]).slice().sort();return t.length||r.length||n.length?[t.join("|"),r.join("|"),n.join("|")].join("::"):null}function he(e){return null==e?null:e}function me(e,t){return JSON.stringify({sourceScopes:fe(e),operation:he(t)})}function ve(e,t,r,n){return JSON.stringify({sourceScopes:fe(e),error:t??!1,durationAtLeastMs:(o=r,null==o?null:o),operation:he(n)});var o}function ge(e,t){return JSON.stringify({sourceScopes:fe(e),operation:he(t)})}function ye(e,t,r,n){switch(t){case"noisy":{const t=me(r.sourceScopes,r.operation);for(const r of e)for(const e of r.noisyOperations)if((!n||e.ruleId!==n)&&me(e.sourceScopes,e.operation)===t)return e.ruleId;return null}case"highlyRelevant":{const t=ve(r.sourceScopes,r.error,r.durationAtLeastMs,r.operation);for(const r of e)for(const e of r.highlyRelevantOperations)if((!n||e.ruleId!==n)&&ve(e.sourceScopes,e.error,e.durationAtLeastMs,e.operation)===t)return e.ruleId;return null}case"costReduction":{const t=ge(r.sourceScopes,r.operation);for(const r of e)for(const e of r.costReductionRules)if((!n||e.ruleId!==n)&&ge(e.sourceScopes,e.operation)===t)return e.ruleId;return null}}}function xe(e){return e&&e.enabled?[{text:`Keep ${e.keepPercentage??0}%`,variant:d.Action},{text:" of ",variant:d.Default},{text:"traces for kubelet health probes in the entire cluster",variant:d.Scope}]:[{text:"Auto rule is ",variant:d.Default},{text:"disabled",variant:d.Action}]}function ke(e){return!0===e.error&&y(e.sourceScopes)&&!e.operation&&(null==e.percentageAtLeast||100===e.percentageAtLeast)}function Te(e){for(const t of e){const e=t.highlyRelevantOperations.find(ke);if(e)return{rule:e,samplingId:t.id}}return null}function Ae(e){return!e||e.disabled?[{text:"Auto rule is ",variant:d.Default},{text:"disabled",variant:d.Action}]:[{text:"Keep all traces",variant:d.Action},{text:" of ",variant:d.Default},{text:"error traces across the entire cluster",variant:d.Scope}]}function Se(e){return y(e.sourceScopes)&&!e.operation}function Re(e){for(const t of e){const e=t.costReductionRules.find(Se);if(e)return{rule:e,samplingId:t.id}}return null}function Pe(e){return!e||e.disabled?[{text:" is ",variant:d.Default},{text:"disabled",variant:d.Action}]:[{text:`Keep at most ${e.percentageAtMost}%`,variant:d.Action},{text:" of ",variant:d.Default},{text:"traces across the entire cluster",variant:d.Scope}]}export{w as A,E as B,v as C,pe as D,ue as E,Q as F,ye as G,_ as H,q as I,G as J,F as O,U as R,W as S,d as a,ee as b,V as c,k as d,ae as e,oe as f,ne as g,$ as h,y as i,C as j,M as k,Ae as l,g as m,x as n,Pe as o,xe as p,T as q,J as r,de as s,Te as t,B as u,j as v,Re as w,ce as x,ie as y,L as z};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{useMemo as t,useContext as r,createContext as a,useCallback as n,useState as o,useEffect as s,useRef as i}from"react";import{t as c,ba as l,bb as d,o as u,S as m,bc as S,bd as E,be as I,P as p,bf as T,bg as _,bh as f,bi as y,bj as N,bk as A,bl as R,bm as g,bn as h,bo as O,bp as v,bq as G,br as C,bs as L,bt as D,bu as P,b3 as w,bv as b,bw as U,p as F,bx as k,by as H,bz as M,bA as x,bB as V,bC as Y,E as K,bD as W,bE as B,ak as $,ag as j,ai as q,ah as Q,aj as z,af as J,bF as X,b as Z}from"./ui-components-DqG0z5U0.js";import{i as ee,n as te,m as re,l as ae,o as ne,p as oe,v as se,q as ie,u as ce}from"./helpers-B0SJ6hqm.js";import{ApolloProvider as le,useLazyQuery as de,useApolloClient as ue,useQuery as me}from"@apollo/client/react";import{ErrorLink as Se}from"@apollo/client/link/error";import{SetContextLink as Ee}from"@apollo/client/link/context";import{getMainDefinition as Ie}from"@apollo/client/utilities";import{CombinedGraphQLErrors as pe,ServerError as Te}from"@apollo/client/errors";import{HttpLink as _e,ApolloLink as fe,ApolloClient as ye,InMemoryCache as Ne,gql as Ae}from"@apollo/client";const Re=e=>{if(!e)return!1;const t=e.toLowerCase();return t.includes("authentication required")||t.includes("authentication expired")||t.includes("http 401")},ge=a(null),he=()=>{const e=r(ge);if(!e)throw new Error("[ui-kit] useOdigosApi() / useXxxApi() called outside of <OdigosApiProvider>. Make sure the host app mounts the provider at its layout level.");return e},Oe=({apolloConfig:r,operations:a,context:n,children:o})=>{const s=t(()=>(e=>{const t=new _e({uri:e.httpUrl,credentials:e.credentials??"same-origin"}),r=new Se(({error:t})=>{pe.is(t)?t.errors.some(e=>Re(e.message))&&e.onAuthError?.():(Te.is(t)&&401===t.statusCode||Re(t.message))&&e.onAuthError?.()}),a=new Ee(async t=>{const r={...t.headers};if(e.authHeader){const t=await e.authHeader();Object.assign(r,t)}return e.csrfHeader&&Object.assign(r,e.csrfHeader()),{headers:r}}),n=[];e.additionalLinks?.length&&n.push(...e.additionalLinks),n.push(a,r,t);let o=fe.from(n);e.wsLink&&(o=fe.split(({query:e})=>{const t=Ie(e);return"OperationDefinition"===t.kind&&"subscription"===t.operation},e.wsLink,o));const s=e.defaultFetchPolicies;return new ye({link:o,cache:new Ne({typePolicies:e.cacheTypePolicies}),defaultOptions:{watchQuery:{fetchPolicy:s?.watchQuery??"cache-and-network"},query:{fetchPolicy:s?.query??"cache-first"},mutate:{fetchPolicy:s?.mutate??"network-only"}}})})(r),[r.httpUrl,r.wsLink,r.credentials,r.clientKey]),i=t(()=>({operations:a,context:n,apolloConfig:r}),[a,n,r]);return e(le,{client:s,children:e(ge.Provider,{value:i,children:o})})},ve=ge,Ge=e=>e.map(e=>`${e.id}:${e.odigosVersion}:${e.type}`).join(","),Ce=(e,t,r)=>{const a=t.length?t.map(e=>e.id):r??[],n={...e,connectionIds:a};if(!t.length||c(e.version)>0)return n;const o=t[0];return{...n,version:o.odigosVersion||e.version,platformType:o.type??e.platformType}},Le=({connections:r,connectionIds:a,children:n})=>{const o=he(),s=t(()=>({operations:o.operations,context:Ce(o.context,r,a),apolloConfig:o.apolloConfig}),[o.operations,o.context,o.apolloConfig,Ge(r),a?.join(",")]);return e(ve.Provider,{value:s,children:n})},De=(e,t)=>{if(e)return"string"==typeof e?e:S(e,t)},Pe=e=>{const{addNotification:t}=l(),r=(r,a,n,o,s)=>t({type:r,title:a,message:n,crdType:e,target:De(o,e),hideFromHistory:s});return{notify:r,notifyError:(e,t,a)=>r(m.Error,e,t,a),notifySuccess:(e,t,a)=>r(m.Success,e,t,a),notifyPending:(e,t)=>r(m.Default,"Pending",e,t,!0),notifyReadonly:()=>{t({type:m.Warning,title:u.READONLY,message:d.READONLY_WARNING,hideFromHistory:!0})}}},we=e=>{e({type:m.Warning,title:u.READONLY,message:d.READONLY_WARNING,hideFromHistory:!0})},be=e=>({error:e,results:[],allSucceeded:!1,anySucceeded:!1,successCount:0,failureCount:0}),Ue=(e,t)=>{if(e)return"function"==typeof e?e(t):e},Fe=e=>{if(!e)return"Unknown error";if(e instanceof Error)return e.cause instanceof Error?e.cause.message:e.message;if("object"==typeof e){const t=e;return t.cause?.message||t.message||String(e)}return String(e)},ke=(e,t)=>e.client??t,He=async(e,t,r,a,n)=>{if(!t)return{error:"Query operation not configured"};if(t.canRun&&!t.canRun(a))return{data:void 0};if(t.run)try{return await t.run(ke(t,e),r,a)}catch(e){return{error:Fe(e)}}const o=Ue(t.document,a);if(!o)return{error:"Query operation not supported in this context"};const s=t.transformVariables?t.transformVariables(r,a):r,i=ke(t,e);try{const e=await i.query({query:o,variables:s,fetchPolicy:n??"network-only"});return{data:t.transformResult?t.transformResult(e.data,a):e.data,error:e.error?Fe(e.error):void 0}}catch(e){return{error:Fe(e)}}},Me=async(e,t,r,a)=>{if(!t)return{error:"Mutation operation not configured"};if(t.canRun&&!t.canRun(a))return{error:"Mutation operation not supported in this context"};if(t.run)try{return await t.run(ke(t,e),r,a)}catch(e){return{error:Fe(e)}}const n=Ue(t.document,a);if(!n)return{error:"Mutation operation not supported in this context"};const o=t.transformVariables?t.transformVariables(r,a):r,s=ke(t,e);try{const e=await s.mutate({mutation:n,variables:o});return{data:t.transformResult?t.transformResult(e.data,a):e.data,error:void 0}}catch(e){return{error:Fe(e)}}},xe=async(e,t,r,a,n)=>{if(!t)return be("Multi fetch operation not configured");if(!r.length)return be("No proxy ids supplied for multi fetch");const o=ke(t,e);if(t.transformVariablesMulti&&(t.documentMulti||t.document)){const e=t.transformVariablesMulti(r,a,n),s=[];for(const r of e)try{const e=await o.query({query:r.document,variables:r.variables,fetchPolicy:"network-only"});t.transformMultiResult?t.transformMultiResult(e.data,n).forEach(e=>s.push(e)):r.proxyIDs.forEach(t=>{s.push({proxyID:t,success:!e.error,data:e.data,error:e.error?.message})})}catch(e){const t=Fe(e);r.proxyIDs.forEach(e=>s.push({proxyID:e,success:!1,error:t}))}const i=s.filter(e=>e.success).length,c=s.length-i,l=Array.from(new Set(s.filter(e=>!!e.error).map(e=>e.error)));return{results:s,allSucceeded:0===c,anySucceeded:i>0,successCount:i,failureCount:c,error:l.length?l.join(", "):void 0}}const s=await Promise.all(r.map(async r=>{const o={...n,proxyID:r},s=await He(e,t,a,o);return{proxyID:r,success:!s.error,data:s.data,error:s.error}})),i=s.filter(e=>e.success).length,c=s.length-i,l=Array.from(new Set(s.filter(e=>!!e.error).map(e=>e.error)));return{results:s,allSucceeded:0===c,anySucceeded:i>0,successCount:i,failureCount:c,error:l.length?l.join(", "):void 0}},Ve=Ae`
|
|
2
|
-
query OdigosApiNoop {
|
|
3
|
-
__typename
|
|
4
|
-
}
|
|
5
|
-
`,Ye=(e,t)=>{if(e)return"function"==typeof e?e(t):e},Ke=(e,t)=>e[t],We=(e,t,r)=>{if(void 0!==t)return e?.transformResult?e.transformResult(t,r):t},Be=(e,t,r)=>{if(!e)return;const a=e.transformVariables;return a?a(t,r):t},$e=(e,r,a)=>{const{operations:o,context:i}=he(),c=Ke(o,e),l=t(()=>Ye(c?.document,i),[c,i]),d=t(()=>Be(c,r,i),[c,r,i]),u=!c||!l,m=!!c?.canRun&&!c.canRun(i),S=a?.skip||u||m,E=me(l??Ve,{variables:d,skip:S,pollInterval:a?.pollInterval,fetchPolicy:a?.fetchPolicy??"cache-and-network",notifyOnNetworkStatusChange:a?.notifyOnNetworkStatusChange,client:c?.client}),I=t(()=>{if(!S)return We(c,E.data,i)},[c,i,E.data,S]);s(()=>{S||void 0===I||a?.onCompleted?.(I)},[S,I,a?.onCompleted]),s(()=>{E.error&&a?.onError?.(E.error)},[E.error,a?.onError]);const p=n(async()=>{if(S)return{data:void 0};const e=await E.refetch();return{data:We(c,e.data,i)}},[c,i,E,S]);return{data:I,loading:!S&&E.loading,error:E.error,refetch:p,unsupported:u}},je=(e,r)=>{const{operations:a,context:o}=he(),s=Ke(a,e),i=t(()=>Ye(s?.document,o),[s,o]),c=!s||!i,[l,d]=de(i??Ve,{fetchPolicy:r?.fetchPolicy??"network-only",notifyOnNetworkStatusChange:r?.notifyOnNetworkStatusChange,client:s?.client});return{execute:n(async e=>{if(c)return{error:void 0};if(s?.canRun&&!s.canRun(o))return{data:void 0};const t=Be(s,e,o),r=await l({variables:t});return r.error?{error:r.error}:{data:We(s,r.data,o)}},[s,o,l,c]),data:t(()=>We(s,d.data,o),[s,o,d.data]),loading:d.loading,error:d.error,called:d.called,unsupported:c}},qe=(e,r)=>{const{operations:a,context:s}=he(),i=ue(),c=Ke(a,e),l=t(()=>Ye(c?.document,s),[c,s]),d=!c||!l,[u,m]=o({loading:!1,called:!1}),S=n(()=>m({loading:!1,called:!1}),[]);return[n(async e=>{if(d||!l)return{error:void 0};if(c?.canRun&&!c.canRun(s))return{data:void 0};const t=Be(c,e,s),a=c?.client??i;m(e=>({...e,loading:!0,called:!0}));try{const e=await a.mutate({mutation:l,variables:t}),n=We(c,e.data,s);if(m({data:n,loading:!1,error:void 0,called:!0}),r?.refetchQueries){const e=a.refetchQueries({include:r.refetchQueries});r?.awaitRefetchQueries&&await e}return void 0!==n&&r?.onCompleted?.(n),{data:n}}catch(e){const t=e;return m({data:void 0,loading:!1,error:t,called:!0}),r?.onError?.(t),{error:t}}},[c,s,i,l,d,r]),{data:u.data,loading:u.loading,error:u.error,called:u.called,unsupported:d,reset:S}]},Qe=[],ze=(e,t,r,a)=>{let n=!0;const o={sources:[]};for(const[s,i]of Object.entries(e)){if(!i.length)continue;n=!1;const e=i.map(({id:e,selected:t,currentStreamName:a})=>({namespace:e.namespace,name:e.name,kind:e.kind,selected:void 0!==t&&t,currentStreamName:a||r}));let c=0,l=0;for(const r of e){const e=t.find(e=>e.id.namespace===s&&e.id.name===r.name&&e.id.kind===r.kind),a=e?.dataStreamNames||[];r.selected&&!e?c++:!r.selected&&e&&a.length<=1&&l++}a(c,l),o.sources.push(...e)}return{payload:o,isEmpty:n}},Je=(e,t)=>{let r=!0;const a={namespaces:[]};for(const[n,{selected:o,currentStreamName:s}]of Object.entries(e))"boolean"==typeof o&&(r=!1,a.namespaces.push({namespace:n,selected:o,currentStreamName:s||t}));return{payload:a,isEmpty:r}},Xe={filter:{markedForInstrumentation:!0}},Ze=[],et=e=>{const t=e.markedForInstrumentation?.markedForInstrumentation;return"boolean"==typeof t?e:{...e,markedForInstrumentation:{...e.markedForInstrumentation??{markedForInstrumentation:!0},markedForInstrumentation:!0}}},tt=e=>{let t=!1;const r=e.map(e=>{const r=et(e);return r!==e&&(t=!0),r});return t?r:e},rt=[],at=[],nt=[],ot=(e,t)=>{const r=ue(),{notifyError:a,notifySuccess:n,notifyReadonly:o}=Pe(R.Finding),s=async()=>{e.GET_INSIGHTS_FINDINGS&&await He(r,e.GET_INSIGHTS_FINDINGS,void 0,t)},i=async()=>{e.GET_INSIGHTS_ANOMALIES&&await He(r,e.GET_INSIGHTS_ANOMALIES,void 0,t)},c=async()=>{e.GET_INSIGHTS_TRANSACTIONS&&await He(r,e.GET_INSIGHTS_TRANSACTIONS,void 0,t)},l=async()=>{if(!e.GET_INSIGHTS_POLICIES)return;const a="function"==typeof e.GET_INSIGHTS_POLICIES.document?e.GET_INSIGHTS_POLICIES.document(t):e.GET_INSIGHTS_POLICIES.document;a?await r.refetchQueries({include:[a]}):await He(r,e.GET_INSIGHTS_POLICIES,void 0,t)},d=async()=>{e.GET_INSIGHTS_LEARNING_POLICIES&&await He(r,e.GET_INSIGHTS_LEARNING_POLICIES,void 0,t)},u=async()=>{e.GET_INSIGHTS_GUARDRAILS&&await He(r,e.GET_INSIGHTS_GUARDRAILS,void 0,t)},m=async()=>{e.GET_INSIGHTS_GUARDRAIL_VIOLATIONS&&await He(r,e.GET_INSIGHTS_GUARDRAIL_VIOLATIONS,void 0,t)};return{useServices:e=>$e("GET_INSIGHTS_SERVICES",void 0,e),useTransactions:(e,t)=>$e("GET_INSIGHTS_TRANSACTIONS",e,t),useTransaction:(e,t)=>$e("GET_INSIGHTS_TRANSACTION",e,t),useBaseline:(e,t)=>$e("GET_INSIGHTS_BASELINE",e,t),useObservations:(e,t)=>$e("GET_INSIGHTS_OBSERVATIONS",e,t),useObservation:(e,t)=>$e("GET_INSIGHTS_OBSERVATION",e,t),useFindings:(e,t)=>$e("GET_INSIGHTS_FINDINGS",e,t),useAnomalies:(e,t)=>$e("GET_INSIGHTS_ANOMALIES",e,t),useAnomaly:(e,t)=>$e("GET_INSIGHTS_ANOMALY",e,t),usePolicies:e=>$e("GET_INSIGHTS_POLICIES",void 0,e),useLearningPolicies:e=>$e("GET_INSIGHTS_LEARNING_POLICIES",void 0,e),useGuardrails:e=>$e("GET_INSIGHTS_GUARDRAILS",void 0,e),useGuardrailViolations:(e,t)=>$e("GET_INSIGHTS_GUARDRAIL_VIOLATIONS",e,t),useGuardrailViolation:(e,t)=>$e("GET_INSIGHTS_GUARDRAIL_VIOLATION",e,t),useServiceProfile:(e,t)=>$e("GET_INSIGHTS_SERVICE_PROFILE",e,t),useBlastRadius:(e,t)=>$e("GET_INSIGHTS_BLAST_RADIUS",e,t),useCatalog:e=>$e("GET_INSIGHTS_CATALOG",void 0,e),useSystemSettings:e=>$e("GET_INSIGHTS_SYSTEM_SETTINGS",void 0,e),useStorageHealth:e=>$e("GET_INSIGHTS_STORAGE_HEALTH",void 0,e),getServices:e.GET_INSIGHTS_SERVICES?async()=>He(r,e.GET_INSIGHTS_SERVICES,void 0,t):void 0,getTransactions:e.GET_INSIGHTS_TRANSACTIONS?async a=>He(r,e.GET_INSIGHTS_TRANSACTIONS,a,t):void 0,getTransaction:e.GET_INSIGHTS_TRANSACTION?async a=>He(r,e.GET_INSIGHTS_TRANSACTION,a,t):void 0,getFindings:e.GET_INSIGHTS_FINDINGS?async a=>He(r,e.GET_INSIGHTS_FINDINGS,a,t):void 0,getAnomalies:e.GET_INSIGHTS_ANOMALIES?async a=>He(r,e.GET_INSIGHTS_ANOMALIES,a,t):void 0,getAnomaly:e.GET_INSIGHTS_ANOMALY?async a=>He(r,e.GET_INSIGHTS_ANOMALY,a,t):void 0,getPolicies:e.GET_INSIGHTS_POLICIES?async()=>He(r,e.GET_INSIGHTS_POLICIES,void 0,t):void 0,getLearningPolicies:e.GET_INSIGHTS_LEARNING_POLICIES?async()=>He(r,e.GET_INSIGHTS_LEARNING_POLICIES,void 0,t):void 0,getGuardrails:e.GET_INSIGHTS_GUARDRAILS?async()=>He(r,e.GET_INSIGHTS_GUARDRAILS,void 0,t):void 0,getGuardrailViolation:e.GET_INSIGHTS_GUARDRAIL_VIOLATION?async a=>He(r,e.GET_INSIGHTS_GUARDRAIL_VIOLATION,a,t):void 0,getServiceProfile:e.GET_INSIGHTS_SERVICE_PROFILE?async a=>He(r,e.GET_INSIGHTS_SERVICE_PROFILE,a,t):void 0,getBlastRadius:e.GET_INSIGHTS_BLAST_RADIUS?async a=>He(r,e.GET_INSIGHTS_BLAST_RADIUS,a,t):void 0,getCatalog:e.GET_INSIGHTS_CATALOG?async()=>He(r,e.GET_INSIGHTS_CATALOG,void 0,t):void 0,getSystemSettings:e.GET_INSIGHTS_SYSTEM_SETTINGS?async()=>He(r,e.GET_INSIGHTS_SYSTEM_SETTINGS,void 0,t):void 0,getStorageHealth:e.GET_INSIGHTS_STORAGE_HEALTH?async()=>He(r,e.GET_INSIGHTS_STORAGE_HEALTH,void 0,t):void 0,promoteBaselineClass:e.PROMOTE_INSIGHTS_BASELINE_CLASS?async s=>{if(t.isReadonly)return o();const{data:i,error:c}=await Me(r,e.PROMOTE_INSIGHTS_BASELINE_CLASS,s,t);return c?a(E.Update,c):n(E.Update,"Successfully promoted baseline class"),{data:i,error:c}}:void 0,resetBaselineClass:e.RESET_INSIGHTS_BASELINE_CLASS?async(s,i)=>{if(t.isReadonly)return o();const{error:c}=await Me(r,e.RESET_INSIGHTS_BASELINE_CLASS,{transactionId:s,class:i},t);return c?a(E.Update,c):n(E.Update,"Successfully reset baseline class"),c?{error:c}:void 0}:void 0,resetTransactionBaselines:e.RESET_INSIGHTS_TRANSACTION_BASELINES?async s=>{if(t.isReadonly)return o();const{error:i}=await Me(r,e.RESET_INSIGHTS_TRANSACTION_BASELINES,{transactionId:s},t);return i?a(E.Update,i):n(E.Update,"Successfully reset transaction baselines"),i?{error:i}:void 0}:void 0,deleteTransaction:e.DELETE_INSIGHTS_TRANSACTION?async l=>{if(t.isReadonly)return o();const{error:d}=await Me(r,e.DELETE_INSIGHTS_TRANSACTION,{transactionId:l},t);return d?a(E.Delete,d):(n(E.Delete,"Successfully deleted transaction"),await Promise.all([c(),s(),i()])),d?{error:d}:void 0}:void 0,upsertPolicy:e.UPSERT_INSIGHTS_POLICY?async s=>{if(t.isReadonly)return o();const{data:i,error:c}=await Me(r,e.UPSERT_INSIGHTS_POLICY,{policy:s},t);return c?a(E.Update,c):(n(E.Update,`Successfully saved policy "${s.name}"`),await l()),{data:i,error:c}}:void 0,deletePolicy:e.DELETE_INSIGHTS_POLICY?async(s,i)=>{if(t.isReadonly)return o();const{error:c}=await Me(r,e.DELETE_INSIGHTS_POLICY,{scope:s,scopeKey:i},t);return c?a(E.Delete,c):(n(E.Delete,"Successfully deleted policy"),await l()),c?{error:c}:void 0}:void 0,upsertLearningPolicy:e.UPSERT_INSIGHTS_LEARNING_POLICY?async s=>{if(t.isReadonly)return o();const{data:i,error:c}=await Me(r,e.UPSERT_INSIGHTS_LEARNING_POLICY,{policy:s},t);return c?a(E.Update,c):(n(E.Update,"Successfully saved learning policy"),await d()),{data:i,error:c}}:void 0,deleteLearningPolicy:e.DELETE_INSIGHTS_LEARNING_POLICY?async(s,i,c)=>{if(t.isReadonly)return o();const{error:l}=await Me(r,e.DELETE_INSIGHTS_LEARNING_POLICY,{class:s,scope:i,scopeKey:c},t);return l?a(E.Delete,l):(n(E.Delete,"Successfully deleted learning policy"),await d()),l?{error:l}:void 0}:void 0,resolveAnomaly:e.RESOLVE_INSIGHTS_ANOMALY?async c=>{if(t.isReadonly)return o();const{error:l}=await Me(r,e.RESOLVE_INSIGHTS_ANOMALY,c,t);return l?a(E.Update,l):(n(E.Update,`Successfully ${c.resolution}ed anomaly`),await Promise.all([i(),s()])),l?{error:l}:void 0}:void 0,bulkResolveAnomalies:e.BULK_RESOLVE_INSIGHTS_ANOMALIES?async(c,l)=>{if(t.isReadonly)return o();const d={resolution:c,items:l},{data:u,error:m}=await Me(r,e.BULK_RESOLVE_INSIGHTS_ANOMALIES,d,t);return m?a(E.Update,m):(n(E.Update,`Successfully ${c}ed ${u?.resolved??l.length} anomalies`),await Promise.all([i(),s()])),{data:u,error:m}}:void 0,upsertGuardrail:e.UPSERT_INSIGHTS_GUARDRAIL?async s=>{if(t.isReadonly)return o();const{data:i,error:c}=await Me(r,e.UPSERT_INSIGHTS_GUARDRAIL,{guardrail:s},t);return c?a(E.Update,c):(n(E.Update,"Successfully saved guardrail"),await u()),{data:i,error:c}}:void 0,deleteGuardrail:e.DELETE_INSIGHTS_GUARDRAIL?async s=>{if(t.isReadonly)return o();const{error:i}=await Me(r,e.DELETE_INSIGHTS_GUARDRAIL,{scopeKey:s},t);return i?a(E.Delete,i):(n(E.Delete,"Successfully deleted guardrail"),await u()),i?{error:i}:void 0}:void 0,seedGuardrail:e.SEED_INSIGHTS_GUARDRAIL?async s=>{if(t.isReadonly)return o();const{error:i}=await Me(r,e.SEED_INSIGHTS_GUARDRAIL,{seed:s},t);return i?a(E.Create,i):(n(E.Create,"Successfully seeded guardrail"),await u()),i?{error:i}:void 0}:void 0,allowViolation:e.ALLOW_INSIGHTS_GUARDRAIL_VIOLATION?async i=>{if(t.isReadonly)return o();const{error:c}=await Me(r,e.ALLOW_INSIGHTS_GUARDRAIL_VIOLATION,{action:i},t);return c?a(E.Update,c):(n(E.Update,"Successfully allowed violation"),await Promise.all([m(),s()])),c?{error:c}:void 0}:void 0,dismissViolation:e.DISMISS_INSIGHTS_GUARDRAIL_VIOLATION?async i=>{if(t.isReadonly)return o();const{error:c}=await Me(r,e.DISMISS_INSIGHTS_GUARDRAIL_VIOLATION,{action:i},t);return c?a(E.Update,c):(n(E.Update,"Successfully dismissed violation"),await Promise.all([m(),s()])),c?{error:c}:void 0}:void 0,reopenViolation:e.REOPEN_INSIGHTS_GUARDRAIL_VIOLATION?async i=>{if(t.isReadonly)return o();const{error:c}=await Me(r,e.REOPEN_INSIGHTS_GUARDRAIL_VIOLATION,{action:i},t);return c?a(E.Update,c):(n(E.Update,"Successfully reopened violation"),await Promise.all([m(),s()])),c?{error:c}:void 0}:void 0,updateSystemSettings:e.UPDATE_INSIGHTS_SYSTEM_SETTINGS?async s=>{if(t.isReadonly)return o();const{data:i,error:c}=await Me(r,e.UPDATE_INSIGHTS_SYSTEM_SETTINGS,{settings:s},t);return c?a(E.Update,c):(n(E.Update,"Successfully updated system settings"),await(async()=>{e.GET_INSIGHTS_SYSTEM_SETTINGS&&await He(r,e.GET_INSIGHTS_SYSTEM_SETTINGS,void 0,t)})()),{data:i,error:c}}:void 0}},st=[],it=e=>{if(e)return{clusters:[e],totalNamespaces:e.namespaces?.length??0,totalWorkloads:(e.namespaces??[]).reduce((e,t)=>e+(t.workloads?.length??0),0),lastUpdated:e.timestamp}},ct=[],lt=[],dt=(e,t)=>({...e,fields:e.fields.filter(({value:e})=>void 0!==e),currentStreamName:t}),ut=[],mt=[],St=()=>{const{operations:e,context:r}=he(),a=ue(),o=((e,r)=>{const a=ue(),{notifyError:o,notifySuccess:s,notifyPending:i,notifyReadonly:c}=Pe(I.Source),{selectedStreamName:l}=T(),{setProgress:d,resetProgress:u}=_(),{setConfiguredSources:m,setConfiguredFutureApps:S}=f(),p=(e,t)=>{const{progress:r}=_.getState();e>0&&d(y.Instrumenting,{total:(r[y.Instrumenting]?.total||0)+e,current:r[y.Instrumenting]?.current||0}),t>0&&d(y.Uninstrumenting,{total:(r[y.Uninstrumenting]?.total||0)+t,current:r[y.Uninstrumenting]?.current||0})},A=n(async()=>{const{error:t}=await He(a,e.GET_WORKLOADS,Xe,r);t&&o(E.Read,t)},[a,e.GET_WORKLOADS,r,o]);return{useSources:()=>{const e=$e("GET_WORKLOADS",Xe,{fetchPolicy:"cache-first"}),r=e.data?.workloads;return{items:t(()=>r?tt(r):Ze,[r]),loading:e.loading,refetch:A}},fetchAll:A,fetchByTargets:async(t,n)=>{const s=!!n?.slim,i=t.map(e=>N(e,I.Source)).filter(e=>e.namespace&&e.name&&e.kind);if(0===i.length)return;if(i.length>50)return void await A();const c=s&&e.GET_WORKLOADS_BY_IDS_SLIM?e.GET_WORKLOADS_BY_IDS_SLIM:e.GET_WORKLOADS_BY_IDS,{error:l}=await He(a,c,{ids:i.map(({namespace:e,kind:t,name:r,region:a})=>({namespace:e,kind:t,name:r,region:a||void 0}))},r);l?o(E.Read,l):await A()},fetchById:async t=>{const{data:n,error:s}=await He(a,e.GET_WORKLOADS_BY_IDS,{ids:[{namespace:t.namespace,kind:t.kind,name:t.name,...t.region?{region:t.region}:{}}]},r);if(s)return void o(E.Read,s);const i=n?.workloadsByIds?.find(e=>e.id.namespace===t.namespace&&e.id.kind===t.kind&&e.id.name===t.name&&(e.id.region??"")===(t.region??""));return i?et(i):void 0},fetchLibraries:async t=>He(a,e.GET_SOURCE_LIBRARIES,t,r),fetchPeerSources:async t=>He(a,e.GET_PEER_SOURCES,{serviceName:t},r),usePeerSources:(e,t)=>$e("GET_PEER_SOURCES",e,t),persist:async(t,n)=>{if(r.isReadonly)return c();const{data:s}=await He(a,e.GET_WORKLOADS,Xe,r,"cache-first"),d=tt(s?.workloads??Ze),{payload:I,isEmpty:T}=ze(t,d,l,p),{payload:_,isEmpty:f}=Je(n,l);let N=!1;T||(N=!0,i("Persisting sources...")),f||N||i("Persisting namespaces...");const{error:A}=await Me(a,e.PERSIST_SOURCES,I,r);if(A&&(u(y.Instrumenting),u(y.Uninstrumenting),o(E.Update,A)),e.PERSIST_NAMESPACES){const{error:t}=await Me(a,e.PERSIST_NAMESPACES,_,r);t&&o(E.Update,t)}m({}),S({})},persistV2:async t=>{if(r.isReadonly)return c(),{error:"readonly"};const n=[];for(const[,o]of Object.entries(t)){const t={sources:[]},s={namespaces:[]};for(const e of o)e.name&&e.kind?t.sources.push(e):s.namespaces.push(e);if(s.namespaces.length>0&&e.PERSIST_NAMESPACES){const{error:t}=await Me(a,e.PERSIST_NAMESPACES,s,r);t&&n.push(t)}if(t.sources.length>0){const{error:o}=await Me(a,e.PERSIST_SOURCES,t,r);o&&n.push(o)}}return n.length?{error:n.join(", ")}:void 0},update:async(t,n)=>{if(r.isReadonly)return c();i("Updating source...");const d={sourceId:t,patchSourceRequest:{...n,currentStreamName:l}},{data:u,error:m}=await Me(a,e.UPDATE_SOURCE,d,r);m?o(E.Update,m,t):u?.updateK8sActualSource&&s(E.Update,`Successfully updated "${t.name}" source`,t)},restartWorkloads:async t=>{if(r.isReadonly)return c();i("Restarting sources...");const{data:n,error:l}=await Me(a,e.RESTART_WORKLOADS,{sourceIds:t},r);l?o(E.Update,l):n?.restartWorkloads&&s(E.Update,`Successfully restarted ${t.length} sources`)},restartPod:async(t,n)=>{if(r.isReadonly)return c();i("Restarting pod...");const{data:l,error:d}=await Me(a,e.RESTART_POD,{namespace:t,name:n},r);d?o(E.Update,d):l?.restartPod&&s(E.Update,`Successfully restarted pod ${t}/${n}`)},recoverFromRollback:async t=>{if(r.isReadonly)return c();i("Recovering from rollback...");const{data:n,error:l}=await Me(a,e.RECOVER_FROM_ROLLBACK,{sourceId:t},r);l?o(E.Update,l,t):n?.recoverFromRollbackForWorkload&&s(E.Update,"Successfully triggered recovery from rollback")}}})(e,r),i=((e,t)=>{const r=ue(),{notifyError:a,notifySuccess:n,notifyReadonly:o}=Pe(I.Destination),{selectedStreamName:s}=T(),i=async()=>{const{error:n}=await He(r,e.GET_DESTINATIONS,void 0,t);n&&a(E.Read,n)};return{useDestinations:()=>{const e=$e("GET_DESTINATIONS",void 0,{fetchPolicy:"cache-first"});return{items:e.data?.computePlatform?.destinations??e.data?.destinations??lt,loading:e.loading,refetch:i}},useDestinationCategories:()=>{const e=$e("GET_DESTINATION_CATEGORIES",void 0);return{data:e.data,loading:e.loading}},usePotentialDestinations:()=>{const e=$e("GET_POTENTIAL_DESTINATIONS",void 0);return{data:e.data,loading:e.loading}},fetchAll:i,testConnection:async a=>{const{data:n}=await Me(r,e.TEST_DESTINATION_CONNECTION,{destination:dt(a,s)},t);return n},create:async c=>{if(t.isReadonly)return o();const{error:l}=await Me(r,e.CREATE_DESTINATION,{destination:dt(c,s)},t);l?a(E.Create,l):(n(E.Create,`Successfully created "${c.type}" destination`),await i())},update:async(c,l)=>{if(t.isReadonly)return o();const{data:d,error:u}=await Me(r,e.UPDATE_DESTINATION,{id:c,destination:dt(l,s)},t);u?a(E.Update,u,c):d?.updateDestination&&(n(E.Update,`Successfully updated "${l.type}" destination`,c),await i())},remove:async c=>{if(t.isReadonly)return o();const{data:l}=await He(r,e.GET_DESTINATIONS,void 0,t,"cache-first"),d=l?.computePlatform?.destinations??l?.destinations??lt,u=d.find(e=>g(e)===c)?.destinationType?.type,{error:m}=await Me(r,e.DELETE_DESTINATION,{id:c,currentStreamName:s},t);m?a(E.Delete,m,c):(n(E.Delete,`Successfully deleted "${u??c}" destination`,c),await i())}}})(e,r),c=((e,r)=>{const a=ue(),{notifyError:n,notifySuccess:o,notifyReadonly:s}=Pe(I.Action),i=async()=>{const{error:t}=await He(a,e.GET_ACTIONS,void 0,r);t&&n(E.Read,t)};return{useActions:()=>{const e=$e("GET_ACTIONS",void 0,{fetchPolicy:"cache-first"});return{items:e.data?.computePlatform?.actions??e.data?.actions??rt,loading:e.loading,refetch:i}},useActionTypes:()=>{const e=$e("GET_ACTION_TYPES",void 0,{fetchPolicy:"cache-first"});return{options:t(()=>A(e.data)||at,[e.data]),loading:e.loading}},fetchAll:i,create:async t=>{if(r.isReadonly)return s(),{error:d.READONLY_WARNING};if(!e.CREATE_ACTION)return{error:"Action creation is not supported"};const{error:c}=await Me(a,e.CREATE_ACTION,{action:t},r);return c?n(E.Create,c):(o(E.Create,`Successfully created "${t.type}" action`),await i()),c?{error:c}:void 0},update:async(t,c)=>{if(r.isReadonly)return s();if(!e.UPDATE_ACTION)return;const{error:l}=await Me(a,e.UPDATE_ACTION,{id:t,action:c},r);l?n(E.Update,l,t):(o(E.Update,`Successfully updated "${c.type}" action`,t),await i())},remove:async(t,c)=>{if(r.isReadonly)return s();if(!e.DELETE_ACTION)return;const{error:l}=await Me(a,e.DELETE_ACTION,{id:t,actionType:c},r);l?n(E.Delete,l,t):(o(E.Delete,`Successfully deleted "${c}" action`,t),await i())}}})(e,r),u=((e,r)=>{const a=ue(),{notifyError:n,notifySuccess:o,notifyReadonly:s}=Pe(I.InstrumentationRule),i=async()=>{const{error:t}=await He(a,e.GET_INSTRUMENTATION_RULES,void 0,r);t&&n(E.Read,t)};return{useRules:()=>{const e=$e("GET_INSTRUMENTATION_RULES",void 0,{fetchPolicy:"cache-first"});return{items:t(()=>(e.data?.computePlatform?.instrumentationRules??e.data?.instrumentationRules??[]).map(D),[e.data]),loading:e.loading,refetch:i}},useRuleTypes:()=>{const e=$e("GET_INSTRUMENTATION_RULE_TYPES",void 0,{fetchPolicy:"cache-first"});return{options:t(()=>L(e.data)||mt,[e.data]),loading:e.loading}},fetchAll:i,create:async(t,c)=>{if(r.isReadonly)return s();if(!e.CREATE_INSTRUMENTATION_RULE)return;const{error:l}=await Me(a,e.CREATE_INSTRUMENTATION_RULE,{instrumentationRule:C(t)},r);l?n(E.Create,l):(o(E.Create,`Successfully created${c?` "${c}"`:""} rule`),await i())},update:async(t,c,l)=>{if(r.isReadonly)return s();if(!e.UPDATE_INSTRUMENTATION_RULE)return;const{error:d}=await Me(a,e.UPDATE_INSTRUMENTATION_RULE,{ruleId:t,instrumentationRule:C(c)},r);d?n(E.Update,d,t):(o(E.Update,`Successfully updated${l?` "${l}"`:""} rule`,t),await i())},remove:async(t,c)=>{if(r.isReadonly)return s();if(!e.DELETE_INSTRUMENTATION_RULE)return;const{error:l}=await Me(a,e.DELETE_INSTRUMENTATION_RULE,{ruleId:t},r);l?n(E.Delete,l,t):(o(E.Delete,`Successfully deleted${c?` "${c}"`:""} rule`,t),await i())}}})(e,r),S=((e,t)=>{const r=ue(),{addNotification:a}=l(),{setDataStreams:n}=T(),o=(e,t)=>a({type:m.Error,title:e,message:t}),i=async()=>{const{data:a,error:s}=await He(r,e.GET_DATA_STREAMS,void 0,t);if(s)o(E.Read,s);else if(a){const e=a.computePlatform?.dataStreams??a.dataStreams??[];n(e)}},c=e.CREATE_DATA_STREAM?async n=>{if(t.isReadonly)return we(a);const{error:s}=await Me(r,e.CREATE_DATA_STREAM,{stream:n},t);s?o(E.Create,s):await i()}:void 0;return{useDataStreams:()=>{const e=$e("GET_DATA_STREAMS",void 0,{fetchPolicy:"cache-first"}),t=e.data?.computePlatform?.dataStreams??e.data?.dataStreams??ct;return s(()=>{n(t)},[JSON.stringify(t.map(e=>e.name))]),{items:t,loading:e.loading,refetch:i}},fetchAll:i,create:c,update:async(n,s)=>{if(t.isReadonly)return we(a);const{error:c}=await Me(r,e.UPDATE_DATA_STREAM,{id:n,dataStream:s},t);c?o(E.Update,c):await i()},remove:async n=>{if(t.isReadonly)return we(a);const{error:s}=await Me(r,e.DELETE_DATA_STREAM,{id:n},t);s?o(E.Delete,s):await i()}}})(e,r),R=((e,t)=>{const r=ue(),{notifyError:a,notifyReadonly:n}=Pe(I.Namespace),o=async()=>{const n=await He(r,e.GET_NAMESPACES_WITH_WORKLOADS,void 0,t);return n.error&&a(E.Read,n.error),n};return{useNamespaces:e=>{const t=$e("GET_NAMESPACES_WITH_WORKLOADS",void 0,{fetchPolicy:"cache-and-network",skip:e?.skip});return{items:t.data?.namespaces??st,loading:t.loading,refetch:o}},fetchAll:o,persist:async o=>{if(t.isReadonly)return n();const{error:s}=await Me(r,e.PERSIST_NAMESPACES,o,t);return s&&a(E.Update,s),s?{error:s}:void 0}}})(e,r),P=((e,t)=>{const r=ue(),{notifyError:a}=Pe(I.Source);return{fetch:async n=>{const o=await He(r,e.GET_K8S_MANIFEST,n,t);return o.error&&a(E.Read,o.error),o}}})(e,r),w=((e,t)=>{const r=ue(),{notifyError:a,notifySuccess:n,notifyReadonly:o}=Pe(I.Source);return{useEffectiveConfig:(e,t)=>$e("GET_EFFECTIVE_CONFIG",e,t),useConfigYamls:e=>$e("GET_CONFIG_YAMLS",void 0,e),getEffectiveConfig:async a=>e.GET_EFFECTIVE_CONFIG?He(r,e.GET_EFFECTIVE_CONFIG,{id:a},t):{error:"GET_EFFECTIVE_CONFIG not configured"},applyConfigurations:e.UPDATE_REMOTE_CONFIG?async(n,s)=>{if(t.isReadonly)return o();if(!s.length)return{error:"No connections selected"};const i={formData:n,connectionIds:s},c=e.UPDATE_REMOTE_CONFIG;let l;return 1===s.length?({error:l}=await Me(r,c,i,t)):({error:l}=await xe(r,c,s,i,t)),l&&a(E.Update,l),l?{error:l}:void 0}:void 0,getConfigYamls:e.GET_CONFIG_YAMLS?async()=>He(r,e.GET_CONFIG_YAMLS,void 0,t):void 0,updateLocalUiConfig:e.UPDATE_LOCAL_UI_CONFIG?async s=>{if(t.isReadonly)return o();const{error:i}=await Me(r,e.UPDATE_LOCAL_UI_CONFIG,{config:s},t);return i?a(E.Update,i):n(E.Update,"Local UI configuration updated successfully"),i?{error:i}:void 0}:void 0,resetLocalUiConfigToDefaults:e.RESET_LOCAL_UI_CONFIG_TO_FACTORY_DEFAULTS?async()=>{if(t.isReadonly)return o();const{error:s}=await Me(r,e.RESET_LOCAL_UI_CONFIG_TO_FACTORY_DEFAULTS,void 0,t);return s?a(E.Update,s):n(E.Update,"Local UI configuration reset to factory defaults"),s?{error:s}:void 0}:void 0}})(e,r),b=((e,t)=>{const r=ue(),{apolloConfig:a}=he();return{fetchDescribeOdigos:e.GET_DESCRIBE_ODIGOS?async()=>He(r,e.GET_DESCRIBE_ODIGOS,void 0,t):void 0,fetchDescribeSource:e.GET_DESCRIBE_SOURCE?async a=>He(r,e.GET_DESCRIBE_SOURCE,a,t):void 0,downloadDiagnose:e.GET_DIAGNOSE?async(n,o)=>{const s=await He(r,e.GET_DIAGNOSE,{input:n,dryRun:o?.dryRun??!1},t),i=s?.data?.stats?.fileCount??0;return!s.error&&i>0&&!o?.dryRun&&await(async e=>{const t=(e=>{try{return new URL("/diagnose/download",e).toString()}catch{return null}})(e.httpUrl);if(t)try{const[r,a]=await Promise.all([Promise.resolve(e.authHeader?.()??{}),Promise.resolve(e.csrfHeader?.()??{})]),n=await fetch(t,{credentials:e.credentials??"same-origin",headers:{...r,...a}});if(!n.ok)throw new Error(`Failed to download diagnose archive: ${n.status} ${n.statusText}`);((e,t)=>{if("undefined"==typeof document)return;const r=URL.createObjectURL(e),a=document.createElement("a");a.href=r,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(r)})(await n.blob(),`odigos-diagnose-${Date.now()}.tar.gz`)}catch(e){}})(a),s}:void 0}})(e,r),U=((e,t)=>{const r=ue(),{notifyError:a,notifyReadonly:n}=Pe(I.Source),o=async()=>{e.GET_TOKENS&&await He(r,e.GET_TOKENS,void 0,t)};return{useTokens:()=>{const e=$e("GET_TOKENS",void 0,{fetchPolicy:"cache-first"});return{items:e.data??Qe,loading:e.loading,refetch:o}},updateToken:e.UPDATE_TOKEN?async o=>{if(t.isReadonly)return n();const{error:s}=await Me(r,e.UPDATE_TOKEN,{token:o},t);return s&&a(E.Update,s),s?{error:s}:void 0}:void 0}})(e,r),F=((e,t)=>{const r=ue();return{useMetrics:e=>$e("GET_METRICS",void 0,e),fetch:async()=>He(r,e.GET_METRICS,void 0,t)}})(e,r),k=((e,t)=>{const r=ue();return{useServiceMap:e=>$e("GET_SERVICE_MAP",void 0,e),fetch:e.GET_SERVICE_MAP?async()=>He(r,e.GET_SERVICE_MAP,void 0,t):void 0}})(e,r),H=((e,t)=>{const r=ue();return{useSlots:e=>$e("GET_PROFILING_SLOTS",void 0,e),useSourceProfiling:(e,t)=>$e("GET_SOURCE_PROFILING",e,t),useHotFunctions:(e,t)=>$e("GET_PROFILE_HOT_FUNCTIONS",e,t),fetchSlots:e.GET_PROFILING_SLOTS?async()=>He(r,e.GET_PROFILING_SLOTS,void 0,t):void 0,fetchSourceProfiling:e.GET_SOURCE_PROFILING?async a=>He(r,e.GET_SOURCE_PROFILING,a,t):void 0,enableProfiling:e.ENABLE_SOURCE_PROFILING?async a=>Me(r,e.ENABLE_SOURCE_PROFILING,a,t):void 0,fetchHotFunctions:e.GET_PROFILE_HOT_FUNCTIONS?async a=>He(r,e.GET_PROFILE_HOT_FUNCTIONS,a,t):void 0,clearProfileCache:e.CLEAR_PROFILE_CACHE?async()=>Me(r,e.CLEAR_PROFILE_CACHE,void 0,t):void 0}})(e,r),M=((e,t)=>{const r=ue();return{useGatewayInfo:e=>$e("GET_GATEWAY_INFO",void 0,e),useGatewayPods:e=>$e("GET_GATEWAY_PODS",void 0,e),useNodeCollectorInfo:e=>$e("GET_NODE_COLLECTOR_INFO",void 0,e),useNodeCollectorPods:e=>$e("GET_NODE_COLLECTOR_PODS",void 0,e),usePodInfo:(e,t)=>$e("GET_COLLECTOR_POD_INFO",e,t),getGatewayInfo:e.GET_GATEWAY_INFO?async()=>He(r,e.GET_GATEWAY_INFO,void 0,t):void 0,getGatewayPods:e.GET_GATEWAY_PODS?async()=>He(r,e.GET_GATEWAY_PODS,void 0,t):void 0,getNodeCollectorInfo:e.GET_NODE_COLLECTOR_INFO?async()=>He(r,e.GET_NODE_COLLECTOR_INFO,void 0,t):void 0,getNodeCollectorPods:e.GET_NODE_COLLECTOR_PODS?async()=>He(r,e.GET_NODE_COLLECTOR_PODS,void 0,t):void 0,getExtendedPodInfo:e.GET_COLLECTOR_POD_INFO?async(a,n)=>He(r,e.GET_COLLECTOR_POD_INFO,{namespace:a,name:n},t):void 0}})(e,r),x=((e,t)=>{const r=ue(),{notifyError:a,notifySuccess:n,notifyReadonly:o}=Pe(I.SamplingRule),s=async()=>{e.GET_SAMPLING_RULES&&await He(r,e.GET_SAMPLING_RULES,void 0,t)},i=(e,i)=>e?async c=>{if(t.isReadonly)return o();const{error:l}=await Me(r,e,c,t);return l?a(i,l):(n(E.Create,"Successfully created sampling rule"),await s()),l?{error:l}:void 0}:void 0,c=(e,i)=>e?async(c,l)=>{if(t.isReadonly)return o();const{error:d}=await Me(r,e,{samplingId:l.samplingId,ruleId:c,rule:l.rule},t);return d?a(i,d):(n(E.Update,"Successfully updated sampling rule"),await s()),d?{error:d}:void 0}:void 0,l=e=>e?async(i,c)=>{if(t.isReadonly)return o();const{error:l}=await Me(r,e,{samplingId:c,ruleId:i},t);return l?a(E.Delete,l):(n(E.Delete,"Successfully deleted sampling rule"),await s()),l?{error:l}:void 0}:void 0;return{useSamplingRules:()=>{const e=$e("GET_SAMPLING_RULES",void 0,{fetchPolicy:"cache-first"});return{items:e.data?.computePlatform?.samplingRules??e.data?.samplingRules??nt,k8sHealthProbesConfig:e.data?.computePlatform?.k8sHealthProbesConfig??e.data?.k8sHealthProbesConfig??null,loading:e.loading,refetch:s}},fetchAll:e.GET_SAMPLING_RULES?async()=>He(r,e.GET_SAMPLING_RULES,void 0,t):void 0,createNoisy:i(e.CREATE_NOISY_OPERATION_RULE,E.Create),updateNoisy:c(e.UPDATE_NOISY_OPERATION_RULE,E.Update),deleteNoisy:l(e.DELETE_NOISY_OPERATION_RULE),createHighlyRelevant:i(e.CREATE_HIGHLY_RELEVANT_OPERATION_RULE,E.Create),updateHighlyRelevant:c(e.UPDATE_HIGHLY_RELEVANT_OPERATION_RULE,E.Update),deleteHighlyRelevant:l(e.DELETE_HIGHLY_RELEVANT_OPERATION_RULE),createCostReduction:i(e.CREATE_COST_REDUCTION_RULE,E.Create),updateCostReduction:c(e.UPDATE_COST_REDUCTION_RULE,E.Update),deleteCostReduction:l(e.DELETE_COST_REDUCTION_RULE),updateK8sHealthProbesConfig:e.UPDATE_LOCAL_UI_SAMPLING_CONFIG?async n=>{if(t.isReadonly)return o();const{error:i}=await Me(r,e.UPDATE_LOCAL_UI_SAMPLING_CONFIG,{config:{k8sHealthProbesSampling:n}},t);return i?a(E.Update,i):await s(),i?{error:i}:void 0}:void 0}})(e,r),V=((e,t)=>{const r=ue(),{notifyError:a,notifySuccess:n,notifyReadonly:o}=Pe(I.Recommendation),s=async()=>{e.GET_RECOMMENDATIONS&&await He(r,e.GET_RECOMMENDATIONS,void 0,t)};return{useRecommendations:()=>{const e=$e("GET_RECOMMENDATIONS",void 0,{fetchPolicy:"cache-first"});return{items:e.data?.computePlatform?.recommendations??e.data?.recommendations??ut,loading:e.loading,refetch:s}},fetchAll:e.GET_RECOMMENDATIONS?async()=>He(r,e.GET_RECOMMENDATIONS,void 0,t):void 0,setDismissed:e.SET_RECOMMENDATION_DISMISSED?async(i,c)=>{if(t.isReadonly)return o(),{error:d.READONLY_WARNING};const{error:l}=await Me(r,e.SET_RECOMMENDATION_DISMISSED,{name:i,dismissed:c},t);return l?a(E.Update,l):(n(E.Update,c?v:G),await s()),l?{error:l}:void 0}:void 0,applyRemediation:e.APPLY_RECOMMENDATION_REMEDIATION?async(i,c)=>{if(t.isReadonly)return o(),{error:d.READONLY_WARNING};const{data:l,error:u}=await Me(r,e.APPLY_RECOMMENDATION_REMEDIATION,{recommendationType:i,remediationType:c},t),m=u||!l?.applyRecommendationRemediation;return m?a(E.Update,u||h):(n(E.Update,O),await s()),m?{error:u||h}:void 0}:void 0}})(e,r),Y=((e,r)=>{const a=ue();return{useSnapshots:()=>{const e=r.proxyID,a=!!e,o=$e("GET_ALL_CLUSTER_SNAPSHOTS",void 0,{fetchPolicy:"cache-and-network",skip:a}),s=$e("GET_CLUSTER_SNAPSHOT",e?{clusterId:e}:void 0,{fetchPolicy:"cache-and-network",skip:!a}),i=t(()=>a?it(s.data):o.data,[a,s.data,o.data]),c=a?s.loading:o.loading,l=n(async()=>{if(!a)return o.refetch();const{data:e}=await s.refetch();return{data:it(e)}},[a,o.refetch,s.refetch]);return{data:i,loading:c,pending:c&&!i,unsupported:a?s.unsupported:o.unsupported,refetch:l}},getAllClusterSnapshots:e.GET_ALL_CLUSTER_SNAPSHOTS?async()=>He(a,e.GET_ALL_CLUSTER_SNAPSHOTS,void 0,r):void 0,getClusterSnapshot:e.GET_CLUSTER_SNAPSHOT?async t=>He(a,e.GET_CLUSTER_SNAPSHOT,{clusterId:t},r):void 0}})(e,r);return{sourcesApi:o,destinationsApi:i,actionsApi:c,instrumentationRulesApi:u,dataStreamsApi:S,namespacesApi:R,k8sManifestApi:P,configApi:w,describeApi:b,tokensApi:U,metricsApi:F,serviceMapApi:k,profilingApi:H,collectorsApi:M,samplingApi:x,recommendationsApi:V,snapshotsApi:Y,insightsApi:ot(e,r),capabilities:t(()=>((e,t)=>{const r=t.platformType===p.K8s,a=r,n=r,o=t.platformType===p.Vm,s=!o,i=!(t.platformType===p.Connector);return{canBulkPersistSources:s&&!!e.PERSIST_SOURCES,canInstrumentNamespaces:n&&!!e.PERSIST_NAMESPACES,canFetchSnapshots:a&&!!e.GET_ALL_CLUSTER_SNAPSHOTS,canRecoverFromRollback:a&&!!e.RECOVER_FROM_ROLLBACK,canRestartWorkloads:a&&!!e.RESTART_WORKLOADS,canFetchPeerSources:!!e.GET_PEER_SOURCES,canFetchSourceLibraries:!!e.GET_SOURCE_LIBRARIES,canFetchK8sManifest:a&&!!e.GET_K8S_MANIFEST,canCreateDestination:!!e.CREATE_DESTINATION,canTestConnection:s&&!!e.TEST_DESTINATION_CONNECTION,canFetchDestinationCategories:!!e.GET_DESTINATION_CATEGORIES,canFetchPotentialDestinations:s&&!!e.GET_POTENTIAL_DESTINATIONS,canManageActions:i&&!!e.GET_ACTIONS,canCreateAction:i&&!!e.CREATE_ACTION,canFetchActionTypes:i&&!!e.GET_ACTION_TYPES,canManageInstrumentationRules:i&&!!e.GET_INSTRUMENTATION_RULES,canCreateInstrumentationRule:i&&!!e.CREATE_INSTRUMENTATION_RULE,canFetchInstrumentationRuleTypes:i&&!!e.GET_INSTRUMENTATION_RULE_TYPES,canApplyEffectiveConfig:s&&!!e.UPDATE_REMOTE_CONFIG,canFetchEffectiveConfig:!!e.GET_EFFECTIVE_CONFIG,canFetchConfigYamls:!!e.GET_CONFIG_YAMLS,canFetchProfiling:a&&!!e.GET_PROFILING_SLOTS||o&&(!!e.GET_SOURCE_PROFILING||!!e.GET_PROFILE_HOT_FUNCTIONS),canFetchCollectorInfo:a&&!!e.GET_GATEWAY_INFO,canManageSamplingRules:!!e.GET_SAMPLING_RULES,canManageInsightsPolicies:!!e.GET_INSIGHTS_POLICIES,canFetchInsights:!!e.GET_INSIGHTS_FINDINGS,canManageRecommendations:a&&!!e.GET_RECOMMENDATIONS}})(e,r),[e,r]),resetCache:n(async()=>{await a.cache.reset()},[a])}},Et={type:"",disabled:!1,name:"",notes:"",signals:[],fields:{}},It=a(null),pt=e=>e?.length?e.map(e=>!e.fromSources?.length&&e.from?{...e,fromSources:[e.from]}:e):e,Tt=(e,t)=>{const r=w(e??{}),a=r[U.ExtractAttribute];var n;a?.extractions?.length&&(a.extractions=a.extractions.map(e=>{const t=e;return{...t,method:t.method||(t.regex?.trim()?"regex":"preset")}})),r[U.LabelsAttributes]&&(r[U.LabelsAttributes]=pt(r[U.LabelsAttributes])),r[U.AnnotationsAttributes]&&(r[U.AnnotationsAttributes]=pt(r[U.AnnotationsAttributes])),r[U.UrlTemplatizationRulesGroups]&&(r[U.UrlTemplatizationRulesGroups]=(n=r[U.UrlTemplatizationRulesGroups],n?.length?n.map(e=>{const t=e.filterK8sWorkloadKind,r=e.filterK8sWorkloadName;return e.workloadFilters?.length||!t&&!r?e:{...e,workloadFilters:[{kind:t,name:r||void 0}]}}):n));const o=new Set((t?.fields||[]).filter(e=>e.componentType===F.SourceScopes).map(e=>e.name));return void 0!==r[U.Scopes]&&o.add(U.Scopes),o.forEach(e=>{const t=e;r[t]=te(r[t])}),r},_t="All row fields are required",ft="At least one row is required",yt=(e,t)=>!!e&&t.every(t=>{const r=e[t];return Array.isArray(r)?r.length>0:!("string"==typeof(a=r)?!a.trim():H(a));var a}),Nt=({children:r,sourceOptions:a=[],namespaceOptions:s=[]})=>{const[i,c]=o(null),l=P(Et),u=n(e=>{l.resetFormData(),l.handleErrorChange(void 0,void 0,{}),e?.type&&l.handleFormChange("type",e.type),c(e)},[]),m=n((e,t)=>{const r=t??(a=e.type,b.find(e=>e.type===a)??null);var a;l.resetFormData((({type:e,name:t,notes:r,disabled:a,signals:n,fields:o},s)=>({type:e,name:t||"",notes:r||"",disabled:!!a,signals:n??[],fields:Tt(o,s)}))(e,r)),l.handleErrorChange(void 0,void 0,{}),c(r)},[]),S=n(()=>{if(!i)return{errorMessage:"No action type selected",preparedFormData:w(Et)};const e=((e,t)=>{const r=w(e),a=r.fields||{},n=a[U.UrlTemplatizationRulesGroups];n?.length&&(a[U.UrlTemplatizationRulesGroups]=n.map(e=>({...e,templatizationRules:(e.templatizationRules||[]).filter(e=>!!e.template?.trim())})));const o=a[U.AttributeNamesToDelete];o?.length&&(a[U.AttributeNamesToDelete]=o.filter(e=>!!e?.trim()));const s=a[U.Renames];if(s){const e=Array.isArray(s)?s.map(e=>[e?.key??"",e?.value??""]):Object.entries(s);a[U.Renames]=Object.fromEntries(e.filter(([e,t])=>!!e?.trim()&&!!t?.trim()))}const i=new Set((t?.fields||[]).filter(e=>e.componentType===F.SourceScopes).map(e=>e.name));void 0!==a[U.Scopes]&&i.add(U.Scopes),i.forEach(e=>{const t=a[e];void 0!==t&&(a[e]=ee(t)?null:t)});const c=a[U.ExtractAttribute];return c?.extractions?.length&&(a[U.ExtractAttribute]={extractions:c.extractions.map(e=>{const t=e,r=t.method||(t.regex?.trim()?"regex":"preset"),a=t.targetAttributeName?.trim()||"";if("regex"===r)return{targetAttributeName:a,lookupKey:"",regex:t.regex?.trim()||""};const n={targetAttributeName:a,lookupKey:t.lookupKey?.trim()||"",regex:""};return t.dataFormat&&(n.dataFormat=t.dataFormat),n}).filter(e=>!!(e.targetAttributeName||e.lookupKey||e.dataFormat||e.regex))}),r.fields=a,r})(l.formData,i),t={};return H(e.signals)&&(t.signals=d.FIELD_IS_REQUIRED),i.type&&Object.assign(t,((e,t,r)=>{const a={},n=t.fields||{},o=r.fields||{};switch(e){case k.K8sAttributes:{const e=!(n[U.CollectContainerAttributes]||n[U.CollectReplicaSetAttributes]||n[U.CollectWorkloadId]||n[U.CollectClusterId]),t=!n[U.LabelsAttributes]?.length,r=!n[U.AnnotationsAttributes]?.length;e&&t&&r&&(a[U.CollectContainerAttributes]="Enable at least one option or add a label/annotation row");const o=n[U.LabelsAttributes];o?.some(e=>!yt(e,["labelKey","attributeKey","fromSources"]))&&(a[U.LabelsAttributes]=_t);const s=n[U.AnnotationsAttributes];s?.some(e=>!yt(e,["annotationKey","attributeKey","fromSources"]))&&(a[U.AnnotationsAttributes]=_t);break}case k.AddClusterInfo:{const e=n[U.ClusterAttributes];e?.length?e.some(e=>!yt(e,["attributeName","attributeStringValue"]))&&(a[U.ClusterAttributes]=_t):a[U.ClusterAttributes]=ft;break}case k.DeleteAttributes:{const e=o[U.AttributeNamesToDelete]||[],t=n[U.AttributeNamesToDelete]||[];t.length?e.length>t.length&&(a[U.AttributeNamesToDelete]=_t):a[U.AttributeNamesToDelete]=e.length?_t:ft;break}case k.RenameAttributes:{const e=Object.entries(o[U.Renames]||{}),t=Object.entries(n[U.Renames]||{}),r=e.some(([e,t])=>!e?.trim()||!t?.trim());t.length?r&&(a[U.Renames]=_t):a[U.Renames]=e.length?_t:ft;break}case k.PiiMasking:{const e=n[U.PiiCategories];e?.length||(a[U.PiiCategories]="Select at least one attribute to mask");break}case k.URLTemplatization:{const e=n[U.UrlTemplatizationRulesGroups];(!e?.length||e.some(e=>!e.templatizationRules?.length))&&(a[U.UrlTemplatizationRulesGroups]="Each rule group needs at least one non-blank template");break}case k.ExtractAttribute:{const e=n[U.ExtractAttribute]?.extractions||[],t=o[U.ExtractAttribute]?.extractions||[];if(e.length)if(e.some(e=>{if(!e.targetAttributeName?.trim())return!0;const t=!!e.regex?.trim(),r=!!e.lookupKey?.trim();return r!==!!e.dataFormat||t===r}))a[U.ExtractAttribute]="Each row needs a target attribute name and either a regex or both lookup key and data format";else{const t=new Set;e.some(e=>{const r=e.targetAttributeName?.trim()||"";return!!t.has(r)||(t.add(r),!1)})&&(a[U.ExtractAttribute]="Each new span attribute name must be unique")}else a[U.ExtractAttribute]=t.length?_t:ft;break}}return a})(i.type,e,l.formData)),l.handleErrorChange(void 0,void 0,t),{errorMessage:Object.keys(t).length>0?"Invalid form values":void 0,preparedFormData:e}},[l,i]),E=t(()=>({selectedOption:i,onSelectOption:u,loadAction:m,genericForm:l,validateFormData:S,sourceOptions:a,namespaceOptions:s}),[i,u,m,l,S,a,s]);return e(It.Provider,{value:E,children:r})},At=()=>{const e=r(It);if(!e)throw new Error("useActionFormContext must be used within an ActionFormContextProvider");return e},Rt={provider:"",permission:"",customCapabilities:{},authMethod:"",setupMethod:"",accountId:"",credentials:{},accessToken:"",secretId:"",name:""},gt=a(null),ht=({children:r,providers:a=[]})=>{const o=P(Rt),s=n(()=>{const e=w(o.formData);return e.provider?e.permission?{errorMessage:void 0,preparedFormData:e}:{errorMessage:"Please select a permission level",preparedFormData:e}:{errorMessage:"Please select a provider",preparedFormData:e}},[o]),i=t(()=>({providers:a,genericForm:o,validateFormData:s}),[a,o,s]);return e(gt.Provider,{value:i,children:r})},Ot=()=>{const e=r(gt);if(!e)throw new Error("useCloudConnectorFormContext must be used within a CloudConnectorFormContextProvider");return e},vt={name:""},Gt=a(null),Ct=({children:r,defaultExcludeName:a=""})=>{const{dataStreams:s}=T(),[c,l]=o(void 0),[u,m]=o(a),[S,E]=o(void 0),[I,p]=o(null),_=i(null),f=P(vt),y=n(e=>{f.resetFormData({name:e}),f.handleErrorChange(void 0,void 0,{}),l(void 0),m(e),E(e),p(null),_.current=null},[]),N=n(()=>{const e=w(f.formData),t=(e=>{const t={};return e.name?M(e.name)||(t.name=d.ILLEGAL_K8S_LABEL):t.name=d.FIELD_IS_REQUIRED,t})(e);f.handleErrorChange(void 0,void 0,t);const r=Object.keys(t).length>0?d.REQUIRED_FIELDS:void 0;return l(r),{errorMessage:r,preparedFormData:e}},[f]),A=n(async e=>{const{errorMessage:t,preparedFormData:r}=N();if(t)return;const a=s.find(e=>e.name===r.name&&e.name!==u);if(a)return _.current=e,void p({preparedFormData:r,existingName:a.name,editingName:S});await e(r)},[N,s,u,S]),R=n(async()=>{const e=_.current,t=I?.preparedFormData;_.current=null,p(null),e&&t&&await e(t)},[I]),g=n(()=>{_.current=null,p(null)},[]),h=t(()=>({genericForm:f,loadDataStream:y,editingName:S,validateFormData:N,requestSubmit:A,pendingMerge:I,confirmMerge:R,cancelMerge:g,errorMessage:c,excludeName:u,setExcludeName:m}),[f,y,S,N,A,I,R,g,c,u]);return e(Gt.Provider,{value:h,children:r})},Lt=()=>{const e=r(Gt);if(!e)throw new Error("useDataStreamFormContext must be used within a DataStreamFormContextProvider");return e},Dt={type:"",name:"",currentStreamName:"",disabled:!1,exportedSignals:{logs:!1,metrics:!1,traces:!1,profiles:!1},fields:[]},Pt={activeForm:null,onChangeActiveForm:()=>{},loadDestination:()=>{},genericForm:void 0,validateFormData:()=>({isOk:!1,preparedFormData:w(Dt)}),unsavedDestinations:[],thisUnsavedDestination:void 0,setUnsavedDestinations:()=>{},addUnsavedDestination:()=>{},updateUnsavedDestination:()=>{},deleteUnsavedDestination:()=>{}},wt=a(Pt),bt=e=>e.filter(e=>!!e).map(e=>{const{name:t,componentType:r,componentProperties:a,displayName:n,initialValue:o,renderCondition:s}=e,i=r===F.Dropdown,c=K(a,{});return{componentType:r,renderCondition:s,name:t,title:n,value:o,placeholder:c.placeholder||(i?"Select an option":void 0),options:i&&Array.isArray(c.values)?c.values.map(e=>({id:e,label:e})):void 0,...c}}),Ut=({children:r})=>{const{selectedStreamName:a}=T(),{items:i}=St().destinationsApi.useDestinations(),[c,l]=o(null),[u,m]=o(Pt.unsavedDestinations),S=t(()=>"number"==typeof c?.unsavedIdx?u[c.unsavedIdx]:void 0,[c,u]),E=n((e,t)=>{c&&(m(t=>[...t,{...e,option:c.option}]),l(t?e=>e?{...e,listType:x.UNSAVED,unsavedIdx:u.length}:null:null))},[c,u.length]),I=n((e,t,r)=>{c&&(m(r=>r.map((r,a)=>a===e?{...r,...t,option:c.option}:r)),l(r?e=>e?{...e,listType:x.UNSAVED}:null:null))},[c]),p=n(e=>{m(t=>t.filter((t,r)=>r!==e)),l(null)},[]),_=P({...Dt,currentStreamName:a});s(()=>{if(!c)return;if(S)return void _.resetFormData({...S.formData});if(c.listType===x.EXISTS&&c.option.id){const e=i.find(e=>e.id===c.option.id);if(e)return void _.resetFormData({type:e.destinationType.type,name:e.name||e.destinationType.displayName,currentStreamName:a,disabled:!!e.disabled,exportedSignals:{logs:!!e.exportedSignals?.logs,metrics:!!e.exportedSignals?.metrics,traces:!!e.exportedSignals?.traces,profiles:!!e.exportedSignals?.profiles},fields:c.dynamicFields.map(e=>({key:e.name,value:e.value}))})}const e=V(c.option.supportedSignals);_.resetFormData({type:c.option.type,name:c.option.displayName,currentStreamName:a,disabled:!1,exportedSignals:{logs:e.includes(Y.Logs),metrics:e.includes(Y.Metrics),traces:e.includes(Y.Traces),profiles:e.includes(Y.Profiles)},fields:c.dynamicFields.map(e=>({key:e.name,value:e.value}))})},[c,S]);const f=n(e=>{_.resetFormData(),_.handleErrorChange(void 0,void 0,{}),l(e?{...e,dynamicFields:e.option?.fields?bt(e.option.fields):[]}:null)},[]),y=n((e,t)=>{let r;for(const a of t){const t=a.items.find(t=>t.type===e.destinationType.type);if(t){r=t;break}}const a=K(e.fields,{}),n={id:e.id,type:e.destinationType.type,displayName:e.name||e.destinationType.displayName,selected:!0,testConnectionSupported:r?.testConnectionSupported??!1,supportedSignals:e.destinationType.supportedSignals,fields:r?r.fields.map(e=>({...e,initialValue:a[e.name]??e.initialValue})):[]},o=bt(n.fields);l({listType:x.EXISTS,option:n,dynamicFields:o})},[]),N=n(()=>{const e=w(_.formData),t={};return c?.dynamicFields.forEach(({name:r,required:a})=>{if(a){const a=e.fields.find(e=>e.key===r)?.value;H(a)&&(t[r]=d.FIELD_IS_REQUIRED)}}),W(e.exportedSignals).length||(t.exportedSignals=d.FIELD_IS_REQUIRED),_.handleErrorChange(void 0,void 0,t),{errorMessage:0===Object.keys(t).length?void 0:"Invalid form values",preparedFormData:e}},[_,c]);return e(wt.Provider,{value:{activeForm:c,onChangeActiveForm:f,loadDestination:y,genericForm:_,validateFormData:N,unsavedDestinations:u,thisUnsavedDestination:S,setUnsavedDestinations:m,addUnsavedDestination:E,updateUnsavedDestination:I,deleteUnsavedDestination:p},children:r})},Ft=()=>r(wt),kt={disabled:!1,ruleName:"",notes:"",sourceScopes:re(),workloads:null,instrumentationLibraries:null,payloadCollection:null,codeAttributes:null,headersCollection:null,customInstrumentations:null,networkMetrics:null},Ht=a(null),Mt=({children:r,sourceOptions:a=[],namespaceOptions:s=[]})=>{const[i,c]=o(null),l=P(kt),d=n(e=>{l.resetFormData(),l.handleErrorChange(void 0,void 0,{}),c(e)},[]),u=n((e,t)=>{var r;l.resetFormData((({ruleName:e,notes:t,disabled:r,sourceScopes:a,instrumentationLibraries:n,payloadCollection:o,codeAttributes:s,headersCollection:i,customInstrumentations:c,networkMetrics:l,workloads:d})=>({ruleName:e||"",notes:t||"",disabled:!!r,sourceScopes:te(a),workloads:d??null,instrumentationLibraries:n??null,payloadCollection:o??null,codeAttributes:s??null,headersCollection:i??null,customInstrumentations:c??null,networkMetrics:l??null}))(e)),l.handleErrorChange(void 0,void 0,{}),c(t??(r=e.type,B.find(e=>e.type===r)??null))},[]),m=n(()=>{if(!i)return{errorMessage:"No rule type selected",preparedFormData:w(kt)};const e=(e=>{const t=w(e),{workloads:r,...a}=t,n={...a,sourceScopes:ee(t.sourceScopes)?null:t.sourceScopes,...r?.length?{workloads:r}:{}};return n.headersCollection?.[$.HeaderKeys]?.length&&(n.headersCollection[$.HeaderKeys]=n.headersCollection[$.HeaderKeys].map(e=>e.trim()).filter(e=>e)),n.customInstrumentations?.[j.Golang]?.length&&(n.customInstrumentations[j.Golang]=n.customInstrumentations[j.Golang].map(e=>new q(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).filter(e=>{return t=e,!!(t.packageName?.trim()||t.functionName?.trim()||t.receiverName?.trim()||t.receiverMethodName?.trim());var t})),n.customInstrumentations?.[j.Java]?.length&&(n.customInstrumentations[j.Java]=n.customInstrumentations[j.Java].map(e=>new Q(e.className,e.methodName)).filter(e=>{return t=e,!(!t.className?.trim()&&!t.methodName?.trim());var t})),n.customInstrumentations?.[j.Php]?.length&&(n.customInstrumentations[j.Php]=n.customInstrumentations[j.Php].map(e=>new z(e.className,e.functionName)).filter(e=>{return t=e,!(!t.className?.trim()&&!t.functionName?.trim());var t})),n})(l.formData),t=((e,t)=>{const r={};switch(e){case J.CodeAttributes:Object.values(t.codeAttributes||{}).some(e=>null!=e)||(r.codeAttributes="Code attributes are required");break;case J.PayloadCollection:Object.values(t.payloadCollection||{}).some(e=>null!=e)||(r.payloadCollection="Payload collection are required");break;case J.HeadersCollection:t.headersCollection?.[$.HeaderKeys]?.length||(r.headersCollection="Header keys are required");break;case J.CustomInstrumentation:{const e=t.customInstrumentations?.[j.Golang]||[],a=t.customInstrumentations?.[j.Java]||[],n=t.customInstrumentations?.[j.Php]||[];if(!e.length&&!a.length&&!n.length){r.customInstrumentations="Custom instrumentation are required";break}const o=e.findIndex(e=>!new q(e.packageName,e.functionName,e.receiverName,e.receiverMethodName).Verify());if(-1!==o){r.customInstrumentations=`Golang probe #${o+1} is invalid: provide a package name plus either a function name OR both a receiver name and receiver method name`;break}const s=a.findIndex(e=>!new Q(e.className,e.methodName).Verify());if(-1!==s){r.customInstrumentations=`Java probe #${s+1} is invalid: both class name and method name are required`;break}const i=n.findIndex(e=>!new z(e.className,e.functionName).Verify());if(-1!==i){r.customInstrumentations=`PHP probe #${i+1} is invalid: function name is required`;break}break}}return r})(i.type,e);return l.handleErrorChange(void 0,void 0,t),{errorMessage:Object.keys(t).length>0?"Invalid form values":void 0,preparedFormData:e}},[l,i]),S=t(()=>({selectedOption:i,onSelectOption:d,loadRule:u,genericForm:l,validateFormData:m,sourceOptions:a,namespaceOptions:s}),[i,d,u,l,m,a,s]);return e(Ht.Provider,{value:S,children:r})},xt=()=>{const e=r(Ht);if(!e)throw new Error("useRuleFormContext must be used within a RuleFormContextProvider");return e};var Vt;(e=>{e.Create="create",e.View="view",e.EditAutoNoisy="edit-auto-noisy",e.EditAutoCostReduction="edit-auto-cost-reduction",e.EditAutoHighlyRelevant="edit-auto-highly-relevant"})(Vt||(Vt={}));const Yt=a(null),Kt=["50","25","10","1"];function Wt(e){const t=String(e);return Kt.includes(t)?t:"custom"}const Bt=({category:r,sourceOptions:a=[],namespaceOptions:i=[],children:c})=>{const{formData:l,handleFormChange:d,resetFormData:u}=P(ie(r)),[m,S]=o(null);s(()=>{u(ie(r)),S(null)},[r]);const E=n(e=>{S(null),d(void 0,void 0,{...l,...e})},[l,d]),I=n(()=>{u(ie(r)),S(null)},[r,u]),p=t(()=>({formType:Vt.Create,category:r,formData:l,handleChange:E,resetForm:I,duplicateWarning:m,setDuplicateWarning:S,sourceOptions:a,namespaceOptions:i}),[r,l,E,I,m,a,i]);return e(Yt.Provider,{value:p,children:c})},$t=({data:r,defaultEditMode:a,sourceOptions:c=[],namespaceOptions:l=[],children:d})=>{const[u,m]=o(!1),{formData:S,handleFormChange:E,resetFormData:I}=P(void 0),p=i(null),[T,_]=o(null);s(()=>{r!==p.current&&(p.current=r,r&&a?(I(se(r)),_(null),m(!0)):(m(!1),_(null)))},[r,a]);const f=n(e=>{_(null),E(void 0,void 0,{...S,...e})},[S,E]),y=n(()=>{r&&(I(se(r)),_(null),m(!0))},[r,I]),N=n(()=>{m(!1),_(null)},[]),A=t(()=>({formType:Vt.View,data:r,isEditing:u,formData:S,handleChange:f,handleEdit:y,handleCancelEdit:N,duplicateWarning:T,setDuplicateWarning:_,sourceOptions:c,namespaceOptions:l}),[r,u,S,f,y,N,T,c,l]);return e(Yt.Provider,{value:A,children:d})};function jt(e){const[r,a]=o(()=>0===e?"all":"sample"),[n,i]=o(()=>Wt(e)),[c,l]=o(()=>"custom"===Wt(e)?String(e):"");s(()=>{a(0===e?"all":"sample");const t=Wt(e);i(t),l("custom"===t?String(e):"")},[e]);const d=t(()=>"all"===r?0:"custom"===n?Number(c)||0:Number(n),[r,n,c]);return{percentageMode:r,setPercentageMode:a,percentagePreset:n,setPercentagePreset:i,customPercentage:c,setCustomPercentage:l,resolvedPercentage:d}}const qt=({enabled:r,keepPercentage:a,children:n})=>{const[i,c]=o(r),l=jt(a);s(()=>{c(r)},[r]);const d=t(()=>oe({enabled:i,keepPercentage:l.resolvedPercentage}),[i,l.resolvedPercentage]),u=t(()=>({formType:Vt.EditAutoNoisy,localEnabled:i,setLocalEnabled:c,...l,summary:d}),[i,l,d]);return e(Yt.Provider,{value:u,children:n})},Qt=({enabled:r,dropPercentage:a,children:n})=>{const[i,c]=o(r),l=jt(a);s(()=>{c(r)},[r]);const d=t(()=>ne(i?{disabled:!1,percentageAtMost:l.resolvedPercentage}:null),[i,l.resolvedPercentage]),u=t(()=>({formType:Vt.EditAutoCostReduction,localEnabled:i,setLocalEnabled:c,...l,summary:d}),[i,l,d]);return e(Yt.Provider,{value:u,children:n})},zt=({enabled:r,children:a})=>{const[n,i]=o(r);s(()=>{i(r)},[r]);const c=t(()=>ae(n?{disabled:!1}:null),[n]),l=t(()=>({formType:Vt.EditAutoHighlyRelevant,localEnabled:n,setLocalEnabled:i,summary:c}),[n,c]);return e(Yt.Provider,{value:l,children:a})},Jt=t=>{switch(t.formType){case Vt.Create:return e(Bt,{...t});case Vt.View:return e($t,{...t});case Vt.EditAutoNoisy:return e(qt,{...t});case Vt.EditAutoCostReduction:return e(Qt,{...t});case Vt.EditAutoHighlyRelevant:return e(zt,{...t})}};function Xt(e){const t=r(Yt);if(!t)throw new Error("useSamplingRulesFormContext must be used within a SamplingRulesFormProvider");if(e&&t.formType!==e)throw new Error(`Expected formType "${e}" but found "${t.formType}"`);return t}const Zt={otelServiceName:"",currentStreamName:""},er=a(null),tr=({children:r})=>{const[a,s]=o(void 0),i=P(Zt),c=n(e=>{i.resetFormData((({serviceName:e,id:t})=>({otelServiceName:e||t.name||"",currentStreamName:""}))(e)),i.handleErrorChange(void 0,void 0,{}),s(void 0)},[]),l=n(()=>{const e=w(i.formData);return i.handleErrorChange(void 0,void 0,{}),s(void 0),{errorMessage:void 0,preparedFormData:e}},[i]),d=t(()=>({loadSource:c,genericForm:i,validateFormData:l,errorMessage:a}),[c,i,l,a]);return e(er.Provider,{value:d,children:r})},rr=()=>{const e=r(er);if(!e)throw new Error("useSourceEditFormContext must be used within a SourceEditFormContextProvider");return e},ar=new Set([X.StaticPod]),nr=e=>{const t=e.workloads.filter(({selected:e})=>e).length,r=e.workloads.length;return{selectedCount:t,isAllSourced:t>0&&t===r,isSomeSourced:t>0&&t<r,isFutureApps:e.selected||!1}},or=(e,t,r)=>{if(t&&!e.name.toLowerCase().includes(t.toLowerCase()))return!1;if(r.showOnlySelected){const{isAllSourced:t,isSomeSourced:r,isFutureApps:a}=nr(e);return t||r||a}return!0},sr=(e,t,r)=>!(t&&!e.name.toLowerCase().includes(t.toLowerCase()))&&(!r.showOnlySelected||e.selected),ir=a({snapshots:null,setSnapshots:()=>{},isFetching:!1,setIsFetching:()=>{},formData:[],handleSourceChange:()=>{},handleSelectAll:()=>{},formDiff:{},isFormDirty:!1}),cr=(e,t)=>`${e}\0${t}`,lr=(e,t,r,a)=>`${e}\0${t}\0${r}/${a}`,dr=(e,t)=>e.name===t.name&&e.kind===t.kind&&(e.region??"")===(t.region??""),ur=(e,t,r)=>{const a=[];return t.workloads.forEach(n=>{const o=e?.workloads.find(e=>dr(e,n));n.selected!==o?.selected&&a.push({namespace:t.name,name:n.name,kind:n.kind,region:n.region||void 0,selected:n.selected||!1,currentStreamName:r})}),a},mr=({children:r,selectedConnectionIds:a,initialInputs:c})=>{const{tier:l}=ce(),d=l===Z.Onprem,{capabilities:u}=St(),m=u.canInstrumentNamespaces,{selectedStreamName:S}=T(),[E,p]=o(!1),[_,f]=o(null),[y,N]=o([]),A=i(new Set),R=n((e,t)=>{t.forEach(t=>{const r=e.find(e=>e.clusterId===t.clusterId);r&&t.namespaces.forEach(e=>{const a=r.namespaces.find(t=>t.name===e.name);a&&(a.selected!==e.selected&&A.current.add(cr(t.clusterId,e.name)),e.workloads.forEach(r=>{const n=a.workloads.find(e=>e.name===r.name&&e.kind===r.kind);n&&n.selected!==r.selected&&A.current.add(lr(t.clusterId,e.name,r.kind,r.name))}))})})},[]);s(()=>{_&&N(e=>{const t=((e,t)=>w(((e,t)=>e.clusters.filter(({clusterId:e})=>!t||t.includes(e)))(e,t)))(_,a);return t.map(t=>{const r=e?.find(e=>e.clusterId===t.clusterId),a=((e,t,r)=>{if(!t)return e;const a=new Map(t.namespaces.map(e=>[e.name,e]));return{...e,namespaces:e.namespaces.map(t=>{const n=a.get(t.name);if(!n)return t;const o=new Map(n.workloads.map(e=>[`${e.kind}/${e.name}`,e])),s=r.has(cr(e.clusterId,t.name));return{...t,selected:s?n.selected:t.selected,workloads:t.workloads.map(a=>{const n=o.get(`${a.kind}/${a.name}`),s=r.has(lr(e.clusterId,t.name,a.kind,a.name));return n&&s?{...a,selected:n.selected}:a})}})}})(t,r,A.current);if(c?.[t.clusterId]){const e=c[t.clusterId],r=w(a);return e.forEach(e=>{const t=r.namespaces.find(t=>t.name===e.namespace);if(t)if(e.name&&e.kind){const r=t.workloads.find(t=>t.name===e.name&&t.kind===e.kind);r&&(r.selected=e.selected)}else t.selected=e.selected,e.selected&&t.workloads.forEach(e=>{ar.has(e.kind)&&!d||(e.selected=!0)})}),r}return a})})},[_,a,c]);const{formDiff:g,isFormDirty:h}=t(()=>{const e=((e,t,r,a)=>{const n={};return e.forEach(e=>{e.namespaces.forEach(o=>{const s=t.find(t=>t.clusterId===e.clusterId)?.namespaces.find(e=>e.name===o.name);if(!a){const t=ur(s,o,r);return void(t.length>0&&(n[e.clusterId]||(n[e.clusterId]=[]),n[e.clusterId].push(...t)))}const i=o.selected||!1;if(i!==s?.selected)n[e.clusterId]||(n[e.clusterId]=[]),n[e.clusterId].push({namespace:o.name,selected:i,currentStreamName:r}),i?n[e.clusterId]=n[e.clusterId].filter(e=>e.namespace!==o.name||e.namespace===o.name&&(!e.name||!e.kind)):o.workloads.forEach(t=>{t.selected&&n[e.clusterId].push({namespace:o.name,name:t.name,kind:t.kind,region:t.region||void 0,selected:!0,currentStreamName:r})});else{const t=ur(s,o,r);t.length>0&&(n[e.clusterId]||(n[e.clusterId]=[]),n[e.clusterId].push(...t))}})}),n})(y,_?.clusters||[],S,m);return{formDiff:e,isFormDirty:Object.keys(e).length>0}},[y,_,S,m]),O=n(e=>!d&&ar.has(e),[d]),v=n(({clusterId:e,workloadId:t,selected:r,auto:a})=>{N(n=>{const o=w(n),s=o.findIndex(t=>t.clusterId===e);if(-1===s)return o;const i=o[s].namespaces.findIndex(e=>e.name===t.namespace);if(-1===i)return o;if(t.kind&&t.name){const e=o[s].namespaces[i].workloads.findIndex(e=>dr(e,{name:t.name,kind:t.kind,region:t.region}));if(-1===e)return o;const a="boolean"==typeof r?r:!o[s].namespaces[i].workloads[e].selected;o[s].namespaces[i].workloads[e].selected=a,m&&(a?o[s].namespaces[i].workloads.filter(e=>!O(e.kind)).every(e=>e.selected)&&(o[s].namespaces[i].selected=!0):o[s].namespaces[i].selected=!1)}else if(m){const e="boolean"==typeof a?a:!o[s].namespaces[i].selected;o[s].namespaces[i].selected=e,e?o[s].namespaces[i].workloads.forEach(e=>{O(e.kind)||(e.selected=!0)}):"boolean"!=typeof r||r||o[s].namespaces[i].workloads.forEach(e=>{e.selected=!1})}else{const e="boolean"==typeof r?r:"boolean"!=typeof a||a;o[s].namespaces[i].workloads.forEach(t=>{e&&O(t.kind)||(t.selected=e)})}return R(n,o),o})},[O,m,R]),G=n(({clusterId:e,namespaceName:t,boolean:r,searchText:a="",searchBy:n="",filters:o})=>{N(s=>{const i=w(s),c=n===I.Namespace?a:"",l=n===I.Source?a:"",d=!!c||!!l||!!o?.showOnlySelected;return i.forEach((a,n)=>{e&&a.clusterId!==e||a.namespaces.forEach(({name:e,workloads:a},s)=>{if(!t||e===t)if(d)if(t){if(a.forEach((e,t)=>{r&&O(e.kind)||sr(e,l,o||{showOnlySelected:!1})&&(i[n].namespaces[s].workloads[t].selected=r)}),m){const e=i[n].namespaces[s].workloads.filter(e=>!O(e.kind)).every(e=>e.selected);i[n].namespaces[s].selected=e}}else{if(!or(i[n].namespaces[s],c,o||{showOnlySelected:!1}))return;m&&(i[n].namespaces[s].selected=r),a.forEach((e,t)=>{r&&O(e.kind)||(i[n].namespaces[s].workloads[t].selected=r)})}else m&&(i[n].namespaces[s].selected=r),a.forEach((e,t)=>{r&&O(e.kind)||(i[n].namespaces[s].workloads[t].selected=r)})})}),R(s,i),i})},[O,m,R]);return e(ir.Provider,{value:{snapshots:_,setSnapshots:f,isFetching:E,setIsFetching:p,formData:y,handleSourceChange:v,handleSelectAll:G,formDiff:g,isFormDirty:h},children:r})},Sr=()=>r(ir);export{Nt as A,ht as C,Ct as D,ar as E,Le as O,Mt as R,Vt as S,xe as a,Ut as b,Oe as c,Jt as d,tr as e,mr as f,ze as g,At as h,je as i,qe as j,$e as k,Ot as l,Lt as m,Ft as n,St as o,Je as p,xt as q,Me as r,Xt as s,rr as t,he as u,Sr as v,sr as w,or as x,nr as y};
|