@odigos/ui-kit 0.0.259 → 0.0.260

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.260](https://github.com/odigos-io/ui-kit/compare/ui-kit-v0.0.259...ui-kit-v0.0.260) (2026-06-30)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **add-source-drawer:** show namespace count in Namespaces title ([#1040](https://github.com/odigos-io/ui-kit/issues/1040)) ([e39cc27](https://github.com/odigos-io/ui-kit/commit/e39cc27b85f1393ec17303ed3a4545a57551899a))
9
+ * **edit-source-drawer:** hide pods section when there are no running pods ([#1041](https://github.com/odigos-io/ui-kit/issues/1041)) ([529f931](https://github.com/odigos-io/ui-kit/commit/529f931097a383a8085ddb7113f232ccb2d0f34e))
10
+ * **odigos-api:** scope useSnapshots to the selected cluster in-proxy ([#1048](https://github.com/odigos-io/ui-kit/issues/1048)) ([5eb114d](https://github.com/odigos-io/ui-kit/commit/5eb114d5f59e661a045c8f2ba13e95b162415efa))
11
+ * **sampling:** clarify empty-state copy in source drawer sampling tab ([#1044](https://github.com/odigos-io/ui-kit/issues/1044)) ([d41c5a4](https://github.com/odigos-io/ui-kit/commit/d41c5a4d138b4fcc67d6cff305428a4bda7cf345))
12
+ * **sampling:** drop misleading scope text in source drawer rule summaries ([#1043](https://github.com/odigos-io/ui-kit/issues/1043)) ([bc2676b](https://github.com/odigos-io/ui-kit/commit/bc2676b435ee5eff962b9f41a451de824608b628))
13
+ * **wide-drawer:** remove unclear success banner ([#1042](https://github.com/odigos-io/ui-kit/issues/1042)) ([30591c8](https://github.com/odigos-io/ui-kit/commit/30591c8241a93716765148c5f3bb63b5739d8cbd))
14
+
3
15
  ## [0.0.259](https://github.com/odigos-io/ui-kit/compare/ui-kit-v0.0.258...ui-kit-v0.0.259) (2026-06-28)
4
16
 
5
17
 
@@ -1 +1 @@
1
- import{jsx as o}from"react/jsx-runtime";import{useMemo as n}from"react";import{e as t,_ as e}from"./use-odigos-api-UctF_jx_.js";const r=({connectionIds:r,children:i})=>{const s=t(),a=n(()=>({operations:s.operations,context:{...s.context,connectionIds:r},apolloConfig:s.apolloConfig}),[s.operations,s.context,s.apolloConfig,r.join(",")]);return o(e.Provider,{value:a,children:i})};export{r as O};
1
+ import{jsx as o}from"react/jsx-runtime";import{useMemo as n}from"react";import{e as t,_ as e}from"./use-odigos-api-CgkEC7if.js";const r=({connectionIds:r,children:i})=>{const s=t(),a=n(()=>({operations:s.operations,context:{...s.context,connectionIds:r},apolloConfig:s.apolloConfig}),[s.operations,s.context,s.apolloConfig,r.join(",")]);return o(e.Provider,{value:a,children:i})};export{r as O};
@@ -16,4 +16,4 @@ import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import{useMemo a
16
16
  border-radius: 4px;
17
17
  padding: 8px;
18
18
  max-width: 300px;
19
- `,_=({items:t,children:n})=>{const{popupRef:o,popupOpen:a,setPopupOpen:s,popupPosition:i,handlePosition:u}=c({positionMode:"viewport",defaultClientHeight:48,defaultClientwidth:240}),l=e=>{u(e.clientX,e.clientY),s("mouseleave"!==e.type)};return r(B,{onMouseEnter:l,onMouseMove:l,onMouseLeave:l,children:[n,e(p,{ref:o,isOpen:a,top:i.top,left:i.left,asPortal:!0,style:{backgroundColor:"transparent",border:"none"},borderRadius:"0",padding:"0",maxWidth:"300px",children:e(W,{children:t.map((t,r)=>e(d,{size:f.XXXS,children:t},r))})})]})},q=({parts:n})=>{const o=n.map(e=>({...e,text:e.text.trim()})).filter(e=>e.text.length>0);return e(t,{children:o.map((n,o)=>{const a=e(V,{$variant:n.variant,$isMono:J.includes(n.variant),children:n.text});return r(s,{children:[0!==o&&e(t,{children:" "}),n.tooltipItems?.length?e(_,{items:n.tooltipItems,children:a}):a]},`${n.variant}-${o}`)})})};var G;!function(e){e.Noisy="noisy",e.HighlyRelevant="highly-relevant",e.CostReduction="cost-reduction"}(G||(G={}));const Y=[{value:G.Noisy,label:"1. Noisy Operations",tooltip:"Rules that reduce noise from high-volume, low-value operations"},{value:G.HighlyRelevant,label:"2. Highly Relevant Operations",tooltip:"Rules that prioritize important traces for retention"},{value:G.CostReduction,label:"3. Cost Reduction",tooltip:"Rules that optimize costs by sampling less critical data"}],Q={[G.Noisy]:"This is the most efficient way to sample (with Head Sampling). Prefer to use it where possible.",[G.HighlyRelevant]:'Any trace from the "Noisy Operations" category is sampled prior to checking highly relevance.',[G.CostReduction]:"Cost reduction rules use Tail Sampling to drop traces that are unlikely to be useful for debugging or monitoring."},U={[G.Noisy]:"Noisy Operations rules list",[G.HighlyRelevant]:"Highly Relevant Operations rules list",[G.CostReduction]:"Cost Reduction rules list"},Z={[G.Noisy]:"noisy",[G.HighlyRelevant]:"highlyRelevant",[G.CostReduction]:"costReduction"},ee={noisy:G.Noisy,highlyRelevant:G.HighlyRelevant,costReduction:G.CostReduction};function te(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 re(e){return`any service in namespace '${e}'`}function ne(e){return`${e} services`}function oe(e){const t=function(e){if(!e)return[];const t=[];for(const r of e.sources??[]){const e=te(r);e&&t.push(e)}for(const r of e.namespaces??[])r&&t.push(re(r));for(const r of e.languages??[])r&&t.push(ne(r));return t}(e);if(!t.length)return[{text:" in ",variant:X.Default},{text:"any service in the cluster",variant:X.Scope}];const r=[{text:" in ",variant:X.Default}],n=t.slice(0,2),o=t.slice(2);return n.forEach((e,t)=>{t>0&&r.push({text:", ",variant:X.Default}),r.push({text:e,variant:X.Scope})}),o.length>0&&r.push({text:` + ${o.length} more`,variant:X.Default,tooltipItems:o}),r}function ae(e,t){const r=(n=e).startsWith("/")?n.slice(1):n;var n;return t?`${t} /${r}`:`/${r}`}function se(e){const t=e.method;return e.route?[{text:" for server endpoint ",variant:X.Default},{text:ae(e.route,t),variant:X.Endpoint}]:e.routePrefix?[{text:" for endpoints under ",variant:X.Default},{text:ae(e.routePrefix,t),variant:X.Endpoint}]:[]}function ie(e){const t=[];if(A(e.percentageAtMost)?t.push({text:"Drop all traces",variant:X.Action}):(t.push({text:`Keep at most ${e.percentageAtMost}%`,variant:X.Action}),t.push({text:" of traces",variant:X.Default})),e.operation){const r=e.operation.httpServer,n=r?function(e){const t=e.method;return e.route?[{text:" where the root span is ",variant:X.Default},{text:ae(e.route,t),variant:X.Endpoint}]:e.routePrefix?[{text:" where the root span is under ",variant:X.Default},{text:ae(e.routePrefix,t),variant:X.Endpoint}]:[]}(r):[];n.length>0&&t.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(t.push({text:" to ",variant:X.Default}),a){const r=ae(a,e);s&&(t.push({text:"server address ",variant:X.Default}),t.push({text:s,variant:X.Endpoint}),t.push({text:" ",variant:X.Default})),t.push({text:r,variant:X.Endpoint})}else s&&(t.push({text:"server address ",variant:X.Default}),t.push({text:s,variant:X.Endpoint}))}}else t.push({text:" on ",variant:X.Default}),t.push({text:"any operation",variant:X.Endpoint});return t.push(...oe(e.sourceScopes)),t}function ue(e){const t=[];if(null!=e.percentageAtLeast?(t.push({text:`Keep ${e.percentageAtLeast}%`,variant:X.Action}),t.push({text:" of traces",variant:X.Default})):t.push({text:"Keep all traces",variant:X.Action}),e.operation){const r=e.operation.httpServer;r&&t.push(...se(r))}else t.push({text:" on ",variant:X.Default}),t.push({text:"any operation",variant:X.Endpoint});return t.push(...oe(e.sourceScopes)),!e.error&&null!=e.durationAtLeastMs&&e.durationAtLeastMs>0&&(t.push({text:" with duration > ",variant:X.Default}),t.push({text:`${e.durationAtLeastMs}ms`,variant:X.Duration})),t}function le(e){const t=[];if(t.push({text:`Keep at most ${e.percentageAtMost}%`,variant:X.Action}),t.push({text:" of traces",variant:X.Default}),e.operation){const r=e.operation.httpServer,n=r?se(r):[];n.length>0&&t.push(...n);const o=e.operation.kafkaConsumer?.kafkaTopic;o&&0===n.length&&(t.push({text:" from ",variant:X.Default}),t.push({text:`topic '${o}'`,variant:X.Endpoint}))}else t.push({text:" on ",variant:X.Default}),t.push({text:"any operation",variant:X.Endpoint});return t.push(...oe(e.sourceScopes)),t}function ce(e){return e.error?"Error":null!=e.durationAtLeastMs?"Duration":"Relevance"}function pe(e,t,r){const n=Z[t],o=[];for(const a of e)switch(t){case G.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:ie(e),category:n});break;case G.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:ue(e),category:n,typeBadge:ce(e)});break;case G.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:le(e),category:n})}return o}function de(e,t){switch(e){case"noisy":return ie(t);case"highlyRelevant":return ue(t);case"costReduction":return le(t)}}function fe(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 he(e,t){const r=fe(e,t.samplingId,t.rule.ruleId,t.category);return r?{...r,summary:de(r.category,r.rule)}:null}function me(e,t){const r=fe(e,t.samplingId,t.ruleId,t.category);return r?{...r,summary:de(r.category,r.rule)}:null}function ve(e,t,r){for(const n of e){const o=fe(e,n.id,t,r);if(o)return{...o,summary:de(o.category,o.rule)}}return null}function ge(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 ye(e){return null==e?null:e}function xe(e,t){return JSON.stringify({sourceScopes:ge(e),operation:ye(t)})}function ke(e,t,r,n){return JSON.stringify({sourceScopes:ge(e),error:t??!1,durationAtLeastMs:(o=r,null==o?null:o),operation:ye(n)});var o}function Se(e,t){return JSON.stringify({sourceScopes:ge(e),operation:ye(t)})}function Ae(e,t,r,n){switch(t){case"noisy":{const t=xe(r.sourceScopes,r.operation);for(const r of e)for(const e of r.noisyOperations)if((!n||e.ruleId!==n)&&xe(e.sourceScopes,e.operation)===t)return e.ruleId;return null}case"highlyRelevant":{const t=ke(r.sourceScopes,r.error,r.durationAtLeastMs,r.operation);for(const r of e)for(const e of r.highlyRelevantOperations)if((!n||e.ruleId!==n)&&ke(e.sourceScopes,e.error,e.durationAtLeastMs,e.operation)===t)return e.ruleId;return null}case"costReduction":{const t=Se(r.sourceScopes,r.operation);for(const r of e)for(const e of r.costReductionRules)if((!n||e.ruleId!==n)&&Se(e.sourceScopes,e.operation)===t)return e.ruleId;return null}}}function Te(e){if(!e||!e.enabled)return[{text:"Auto rule is ",variant:X.Default},{text:"disabled",variant:X.Action}];return[{text:`Keep ${e.keepPercentage??0}%`,variant:X.Action},{text:" of ",variant:X.Default},{text:"traces for kubelet health probes in the entire cluster",variant:X.Scope}]}function Re(e){return!0===e.error&&k(e.sourceScopes)&&!e.operation&&(null==e.percentageAtLeast||100===e.percentageAtLeast)}function Pe(e){for(const t of e){const e=t.highlyRelevantOperations.find(Re);if(e)return{rule:e,samplingId:t.id}}return null}function be(e){return!e||e.disabled?[{text:"Auto rule is ",variant:X.Default},{text:"disabled",variant:X.Action}]:[{text:"Keep all traces",variant:X.Action},{text:" of ",variant:X.Default},{text:"error traces across the entire cluster",variant:X.Scope}]}function De(e){return k(e.sourceScopes)&&!e.operation}function Me(e){for(const t of e){const e=t.costReductionRules.find(De);if(e)return{rule:e,samplingId:t.id}}return null}function Ie(e){return!e||e.disabled?[{text:" is ",variant:X.Default},{text:"disabled",variant:X.Action}]:[{text:`Keep at most ${e.percentageAtMost}%`,variant:X.Action},{text:" of ",variant:X.Default},{text:"traces across the entire cluster",variant:X.Scope}]}export{Q as A,U as B,q as C,X as D,oe as E,A as F,w as G,E as H,$ as I,v as O,ee as R,G as S,Ie as a,be as b,g as c,Te as d,ie as e,ue as f,T as g,le as h,k as i,ve as j,Pe as k,Me as l,x as m,S as n,pe as o,N as p,O as q,he as r,L as s,me as t,y as u,F as v,de as w,Z as x,Ae as y,Y as z};
19
+ `,_=({items:t,children:n})=>{const{popupRef:o,popupOpen:a,setPopupOpen:s,popupPosition:i,handlePosition:u}=c({positionMode:"viewport",defaultClientHeight:48,defaultClientwidth:240}),l=e=>{u(e.clientX,e.clientY),s("mouseleave"!==e.type)};return r(B,{onMouseEnter:l,onMouseMove:l,onMouseLeave:l,children:[n,e(p,{ref:o,isOpen:a,top:i.top,left:i.left,asPortal:!0,style:{backgroundColor:"transparent",border:"none"},borderRadius:"0",padding:"0",maxWidth:"300px",children:e(W,{children:t.map((t,r)=>e(d,{size:f.XXXS,children:t},r))})})]})},q=({parts:n})=>{const o=n.map(e=>({...e,text:e.text.trim()})).filter(e=>e.text.length>0);return e(t,{children:o.map((n,o)=>{const a=e(V,{$variant:n.variant,$isMono:J.includes(n.variant),children:n.text});return r(s,{children:[0!==o&&e(t,{children:" "}),n.tooltipItems?.length?e(_,{items:n.tooltipItems,children:a}):a]},`${n.variant}-${o}`)})})};var G;!function(e){e.Noisy="noisy",e.HighlyRelevant="highly-relevant",e.CostReduction="cost-reduction"}(G||(G={}));const Y=[{value:G.Noisy,label:"1. Noisy Operations",tooltip:"Rules that reduce noise from high-volume, low-value operations"},{value:G.HighlyRelevant,label:"2. Highly Relevant Operations",tooltip:"Rules that prioritize important traces for retention"},{value:G.CostReduction,label:"3. Cost Reduction",tooltip:"Rules that optimize costs by sampling less critical data"}],Q={[G.Noisy]:"This is the most efficient way to sample (with Head Sampling). Prefer to use it where possible.",[G.HighlyRelevant]:'Any trace from the "Noisy Operations" category is sampled prior to checking highly relevance.',[G.CostReduction]:"Cost reduction rules use Tail Sampling to drop traces that are unlikely to be useful for debugging or monitoring."},U={[G.Noisy]:"Noisy Operations rules list",[G.HighlyRelevant]:"Highly Relevant Operations rules list",[G.CostReduction]:"Cost Reduction rules list"},Z={[G.Noisy]:"noisy",[G.HighlyRelevant]:"highlyRelevant",[G.CostReduction]:"costReduction"},ee={noisy:G.Noisy,highlyRelevant:G.HighlyRelevant,costReduction:G.CostReduction};function te(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 re(e){return`any service in namespace '${e}'`}function ne(e){return`${e} services`}function oe(e,t="global"){const r=function(e){if(!e)return[];const t=[];for(const r of e.sources??[]){const e=te(r);e&&t.push(e)}for(const r of e.namespaces??[])r&&t.push(re(r));for(const r of e.languages??[])r&&t.push(ne(r));return t}(e);if(!r.length)return"source"===t?[]:[{text:" in ",variant:X.Default},{text:"any service in the cluster",variant:X.Scope}];const n=[{text:" in ",variant:X.Default}],o=r.slice(0,2),a=r.slice(2);return o.forEach((e,t)=>{t>0&&n.push({text:", ",variant:X.Default}),n.push({text:e,variant:X.Scope})}),a.length>0&&n.push({text:` + ${a.length} more`,variant:X.Default,tooltipItems:a}),n}function ae(e,t){const r=(n=e).startsWith("/")?n.slice(1):n;var n;return t?`${t} /${r}`:`/${r}`}function se(e){const t=e.method;return e.route?[{text:" for server endpoint ",variant:X.Default},{text:ae(e.route,t),variant:X.Endpoint}]:e.routePrefix?[{text:" for endpoints under ",variant:X.Default},{text:ae(e.routePrefix,t),variant:X.Endpoint}]:[]}function ie(e,t="global"){const r=[];if(A(e.percentageAtMost)?r.push({text:"Drop all traces",variant:X.Action}):(r.push({text:`Keep at most ${e.percentageAtMost}%`,variant:X.Action}),r.push({text:" of traces",variant:X.Default})),e.operation){const t=e.operation.httpServer,n=t?function(e){const t=e.method;return e.route?[{text:" where the root span is ",variant:X.Default},{text:ae(e.route,t),variant:X.Endpoint}]:e.routePrefix?[{text:" where the root span is under ",variant:X.Default},{text:ae(e.routePrefix,t),variant:X.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:X.Default}),a){const t=ae(a,e);s&&(r.push({text:"server address ",variant:X.Default}),r.push({text:s,variant:X.Endpoint}),r.push({text:" ",variant:X.Default})),r.push({text:t,variant:X.Endpoint})}else s&&(r.push({text:"server address ",variant:X.Default}),r.push({text:s,variant:X.Endpoint}))}}else r.push({text:" on ",variant:X.Default}),r.push({text:"any operation",variant:X.Endpoint});return r.push(...oe(e.sourceScopes,t)),r}function ue(e,t="global"){const r=[];if(null!=e.percentageAtLeast?(r.push({text:`Keep ${e.percentageAtLeast}%`,variant:X.Action}),r.push({text:" of traces",variant:X.Default})):r.push({text:"Keep all traces",variant:X.Action}),e.operation){const t=e.operation.httpServer;t&&r.push(...se(t))}else r.push({text:" on ",variant:X.Default}),r.push({text:"any operation",variant:X.Endpoint});return r.push(...oe(e.sourceScopes,t)),!e.error&&null!=e.durationAtLeastMs&&e.durationAtLeastMs>0&&(r.push({text:" with duration > ",variant:X.Default}),r.push({text:`${e.durationAtLeastMs}ms`,variant:X.Duration})),r}function le(e,t="global"){const r=[];if(r.push({text:`Keep at most ${e.percentageAtMost}%`,variant:X.Action}),r.push({text:" of traces",variant:X.Default}),e.operation){const t=e.operation.httpServer,n=t?se(t):[];n.length>0&&r.push(...n);const o=e.operation.kafkaConsumer?.kafkaTopic;o&&0===n.length&&(r.push({text:" from ",variant:X.Default}),r.push({text:`topic '${o}'`,variant:X.Endpoint}))}else r.push({text:" on ",variant:X.Default}),r.push({text:"any operation",variant:X.Endpoint});return r.push(...oe(e.sourceScopes,t)),r}function ce(e){return e.error?"Error":null!=e.durationAtLeastMs?"Duration":"Relevance"}function pe(e,t,r){const n=Z[t],o=[];for(const a of e)switch(t){case G.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:ie(e),category:n});break;case G.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:ue(e),category:n,typeBadge:ce(e)});break;case G.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:le(e),category:n})}return o}function de(e,t){switch(e){case"noisy":return ie(t);case"highlyRelevant":return ue(t);case"costReduction":return le(t)}}function fe(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 he(e,t){const r=fe(e,t.samplingId,t.rule.ruleId,t.category);return r?{...r,summary:de(r.category,r.rule)}:null}function me(e,t){const r=fe(e,t.samplingId,t.ruleId,t.category);return r?{...r,summary:de(r.category,r.rule)}:null}function ve(e,t,r){for(const n of e){const o=fe(e,n.id,t,r);if(o)return{...o,summary:de(o.category,o.rule)}}return null}function ge(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 ye(e){return null==e?null:e}function xe(e,t){return JSON.stringify({sourceScopes:ge(e),operation:ye(t)})}function ke(e,t,r,n){return JSON.stringify({sourceScopes:ge(e),error:t??!1,durationAtLeastMs:(o=r,null==o?null:o),operation:ye(n)});var o}function Se(e,t){return JSON.stringify({sourceScopes:ge(e),operation:ye(t)})}function Ae(e,t,r,n){switch(t){case"noisy":{const t=xe(r.sourceScopes,r.operation);for(const r of e)for(const e of r.noisyOperations)if((!n||e.ruleId!==n)&&xe(e.sourceScopes,e.operation)===t)return e.ruleId;return null}case"highlyRelevant":{const t=ke(r.sourceScopes,r.error,r.durationAtLeastMs,r.operation);for(const r of e)for(const e of r.highlyRelevantOperations)if((!n||e.ruleId!==n)&&ke(e.sourceScopes,e.error,e.durationAtLeastMs,e.operation)===t)return e.ruleId;return null}case"costReduction":{const t=Se(r.sourceScopes,r.operation);for(const r of e)for(const e of r.costReductionRules)if((!n||e.ruleId!==n)&&Se(e.sourceScopes,e.operation)===t)return e.ruleId;return null}}}function Te(e){if(!e||!e.enabled)return[{text:"Auto rule is ",variant:X.Default},{text:"disabled",variant:X.Action}];return[{text:`Keep ${e.keepPercentage??0}%`,variant:X.Action},{text:" of ",variant:X.Default},{text:"traces for kubelet health probes in the entire cluster",variant:X.Scope}]}function Re(e){return!0===e.error&&k(e.sourceScopes)&&!e.operation&&(null==e.percentageAtLeast||100===e.percentageAtLeast)}function Pe(e){for(const t of e){const e=t.highlyRelevantOperations.find(Re);if(e)return{rule:e,samplingId:t.id}}return null}function be(e){return!e||e.disabled?[{text:"Auto rule is ",variant:X.Default},{text:"disabled",variant:X.Action}]:[{text:"Keep all traces",variant:X.Action},{text:" of ",variant:X.Default},{text:"error traces across the entire cluster",variant:X.Scope}]}function De(e){return k(e.sourceScopes)&&!e.operation}function Me(e){for(const t of e){const e=t.costReductionRules.find(De);if(e)return{rule:e,samplingId:t.id}}return null}function Ie(e){return!e||e.disabled?[{text:" is ",variant:X.Default},{text:"disabled",variant:X.Action}]:[{text:`Keep at most ${e.percentageAtMost}%`,variant:X.Action},{text:" of ",variant:X.Default},{text:"traces across the entire cluster",variant:X.Scope}]}export{Q as A,U as B,q as C,X as D,oe as E,A as F,w as G,E as H,$ as I,v as O,ee as R,G as S,Ie as a,be as b,g as c,Te as d,ie as e,ue as f,T as g,le as h,k as i,ve as j,Pe as k,Me as l,x as m,S as n,pe as o,N as p,O as q,he as r,L as s,me as t,y as u,F as v,de as w,Z as x,Ae as y,Y as z};
@@ -1,4 +1,4 @@
1
- import{ay as e,L as a,l as t,ab as l,ac as r,dN as n,V as i,aL as s,aq as o,a9 as d,s as c,ad as u,al as p,dO as h,B as g,z as m,dP as v,dQ as f,n as b,C as y,J as x,G as C,H as S,av as $,at as k,b1 as T,T as w,a6 as P,a7 as A,y as M,M as L,aH as O,dR as I,dS as D,aR as z,dT as X,b as N,dU as R,O as H,c as E,dV as B,dW as V,dX as q,dY as G,dZ as j,d_ as U,ai as J,d$ as K,e0 as W,e1 as F,e2 as Y,e3 as Q,bP as Z,e4 as _,e5 as ee,e6 as ae,e7 as te,e8 as le,e9 as re,ea as ne,eb as ie,ec as se,ed as oe,ee as de,ef as ce,eg as ue,eh as pe,ei as he,ej as ge,bC as me,ek as ve,el as fe,em as be,en as ye,eo as xe,ep as Ce,eq as Se,er as $e,es as ke,aX as Te,Y as we,et as Pe,o as Ae,eu as Me,b2 as Le,ev as Oe,ew as Ie,ex as De,ey as ze,br as Xe,ax as Ne,ez as Re,eA as He,eB as Ee,db as Be,eC as Ve,eD as qe,eE as Ge,e as je,d9 as Ue,a8 as Je,eF as Ke,Q as We,aK as Fe,N as Ye,ae as Qe,aO as Ze,dn as _e,U as ea,bj as aa,be as ta,bS as la,eG as ra}from"./ui-components-CrXELmQx.js";import{D as na,C as ia,E as sa,u as oa,F as da,h as ca,f as ua,e as pa,G as ha,H as ga,I as ma,i as va,m as fa}from"./helpers-zByTbpzZ.js";import{jsx as ba,jsxs as ya,Fragment as xa}from"react/jsx-runtime";import Ca,{useMemo as Sa,useCallback as $a,useState as ka,useEffect as Ta,useRef as wa,forwardRef as Pa,useImperativeHandle as Aa}from"react";import Ma,{useTheme as La}from"styled-components";import{EditIcon as Oa,OdigosLogoTextCentral as Ia,OdigosLogoTextEnterprise as Da,OdigosLogoTextCommunity as za,OdigosLogoTextColoredCentral as Xa,OdigosLogoTextColoredEnterprise as Na,OdigosLogoTextColoredCommunity as Ra,ArrowLeftIcon as Ha,ArrowRightIcon as Ea,VSquareIcon as Ba,VIcon as Va,CopyIcon as qa,YamlIcon as Ga}from"../icons.js";const ja=({isOpen:t,onClose:l,onDeny:r,onApprove:n})=>ba(e,{title:"Discard changes?",description:"You have unsaved changes.\nIf you cancel now, your changes won't be saved.",isOpen:t,onClose:l,denyButton:{label:"Keep editing",variant:a.Secondary,onClick:()=>{r?.(),l()}},approveButton:{label:"Discard changes",variant:a.Primary,onClick:()=>{n?.(),l()}}}),Ua=({isOpen:t,onClose:l,onDeny:r,onApprove:n,action:i="delete",target:s,description:o,overrideApproveButtonLabel:d,overrideDenyButtonLabel:c})=>{const u=i.charAt(0).toUpperCase()+i.substring(1),p=s?.endsWith("s")?"these":"this";return ba(e,{title:`${u}${s?` ${s}`:""}?`,description:o??`Are you sure you want to ${i}${s?` ${p} ${s}`:""}?`,isOpen:t,onClose:l,denyButton:{label:c??"Go back",variant:a.Secondary,onClick:()=>{r?.(),l()}},approveButton:{label:d??u,variant:a.Primary,onClick:()=>{n?.(),l()}}})},Ja=({componentType:e,inputType:a,name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,value:C,setValue:S,errorMessage:$,warnMessage:k,helpMessage:T,dropdownOptions:w,dropdownNoSearch:P,dropdownNoCheckbox:A,timeUnits:M,timeDefaultUnit:L})=>{switch(e){case t.Input:return ba(p,{name:g,type:a,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,value:C??"",onChange:e=>{const t=e.target.value;S(a===h.Number?""===t?null:Number(t):t)},errorMessage:$,warnMessage:k,helpMessage:T},g);case t.MultiInput:return ba(u,{name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,values:Array.isArray(C)?C:c(C,[]),setValues:e=>S(e),errorMessage:$,warnMessage:k,helpMessage:T},g);case t.KeyValuePair:return ba(d,{name:g,label:m,tooltip:v,badge:f,required:y,disabled:x,limitFieldsPerRow:2,columns:[{keyName:"key",label:"Key",placeholder:"Key"},{keyName:"value",label:"Value",placeholder:"Value"}],values:Array.isArray(C)?C:c(C,[]),setValues:e=>S(e),errorMessage:$,warnMessage:k,helpMessage:T},g);case t.TextArea:return ba(o,{name:g,label:m,tooltip:v,badge:f,required:y,disabled:x,placeholder:b,value:C??"",onChange:e=>S(e.target.value),errorMessage:$,warnMessage:k,helpMessage:T},g);case t.Dropdown:return ba(s,{name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,withSearch:!P,options:w?.map(e=>({id:e.id||"",label:e.label||"",withCheckbox:!A}))||[],values:C?[String(C)]:[],setValues:e=>S(e[0]),errorMessage:$,warnMessage:k,helpMessage:T},g);case t.Checkbox:return ba(i,{name:g,label:m,tooltip:v,badge:f,value:!0===C||"true"===C,onChange:e=>S(e),disabled:x,errorMessage:$,warnMessage:k,helpMessage:T},g);case t.Time:return ba(n,{name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,value:C??"",setValue:e=>S(e),units:M,defaultUnit:L,errorMessage:$,warnMessage:k,helpMessage:T},g);case t.Toggle:return ba(l,{name:g,labelAlign:r.Right,label:m,tooltip:v,badge:f,value:!0===C||"true"===C,onChange:e=>S(e),disabled:x,errorMessage:$,warnMessage:k,helpMessage:T},g);default:return null}},Ka=Ma.div`
1
+ import{ay as e,L as a,l as t,ab as l,ac as r,dN as n,V as i,aL as s,aq as o,a9 as d,s as c,ad as u,al as p,dO as h,B as g,z as m,dP as v,dQ as f,n as b,C as y,J as x,G as C,H as S,av as $,at as k,b1 as w,T,a6 as P,a7 as A,y as M,M as L,aH as O,dR as I,dS as D,aR as z,dT as X,b as N,dU as R,O as H,c as E,dV as B,dW as V,dX as q,dY as G,dZ as j,d_ as U,ai as J,d$ as K,e0 as W,e1 as F,e2 as Y,e3 as Q,bP as Z,e4 as _,e5 as ee,e6 as ae,e7 as te,e8 as le,e9 as re,ea as ne,eb as ie,ec as se,ed as oe,ee as de,ef as ce,eg as ue,eh as pe,ei as he,ej as ge,bC as me,ek as ve,el as fe,em as be,en as ye,eo as xe,ep as Ce,eq as Se,er as $e,es as ke,aX as we,Y as Te,et as Pe,o as Ae,eu as Me,b2 as Le,ev as Oe,ew as Ie,ex as De,ey as ze,br as Xe,ax as Ne,ez as Re,eA as He,eB as Ee,db as Be,eC as Ve,eD as qe,eE as Ge,e as je,d9 as Ue,a8 as Je,eF as Ke,Q as We,aK as Fe,N as Ye,ae as Qe,aO as Ze,dn as _e,U as ea,bj as aa,be as ta,bS as la,eG as ra}from"./ui-components-CrXELmQx.js";import{D as na,C as ia,E as sa,u as oa,F as da,h as ca,f as ua,e as pa,G as ha,H as ga,I as ma,i as va,m as fa}from"./helpers-45znEVHP.js";import{jsx as ba,jsxs as ya,Fragment as xa}from"react/jsx-runtime";import Ca,{useMemo as Sa,useCallback as $a,useState as ka,useEffect as wa,useRef as Ta,forwardRef as Pa,useImperativeHandle as Aa}from"react";import Ma,{useTheme as La}from"styled-components";import{EditIcon as Oa,OdigosLogoTextCentral as Ia,OdigosLogoTextEnterprise as Da,OdigosLogoTextCommunity as za,OdigosLogoTextColoredCentral as Xa,OdigosLogoTextColoredEnterprise as Na,OdigosLogoTextColoredCommunity as Ra,ArrowLeftIcon as Ha,ArrowRightIcon as Ea,VSquareIcon as Ba,VIcon as Va,CopyIcon as qa,YamlIcon as Ga}from"../icons.js";const ja=({isOpen:t,onClose:l,onDeny:r,onApprove:n})=>ba(e,{title:"Discard changes?",description:"You have unsaved changes.\nIf you cancel now, your changes won't be saved.",isOpen:t,onClose:l,denyButton:{label:"Keep editing",variant:a.Secondary,onClick:()=>{r?.(),l()}},approveButton:{label:"Discard changes",variant:a.Primary,onClick:()=>{n?.(),l()}}}),Ua=({isOpen:t,onClose:l,onDeny:r,onApprove:n,action:i="delete",target:s,description:o,overrideApproveButtonLabel:d,overrideDenyButtonLabel:c})=>{const u=i.charAt(0).toUpperCase()+i.substring(1),p=s?.endsWith("s")?"these":"this";return ba(e,{title:`${u}${s?` ${s}`:""}?`,description:o??`Are you sure you want to ${i}${s?` ${p} ${s}`:""}?`,isOpen:t,onClose:l,denyButton:{label:c??"Go back",variant:a.Secondary,onClick:()=>{r?.(),l()}},approveButton:{label:d??u,variant:a.Primary,onClick:()=>{n?.(),l()}}})},Ja=({componentType:e,inputType:a,name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,value:C,setValue:S,errorMessage:$,warnMessage:k,helpMessage:w,dropdownOptions:T,dropdownNoSearch:P,dropdownNoCheckbox:A,timeUnits:M,timeDefaultUnit:L})=>{switch(e){case t.Input:return ba(p,{name:g,type:a,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,value:C??"",onChange:e=>{const t=e.target.value;S(a===h.Number?""===t?null:Number(t):t)},errorMessage:$,warnMessage:k,helpMessage:w},g);case t.MultiInput:return ba(u,{name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,values:Array.isArray(C)?C:c(C,[]),setValues:e=>S(e),errorMessage:$,warnMessage:k,helpMessage:w},g);case t.KeyValuePair:return ba(d,{name:g,label:m,tooltip:v,badge:f,required:y,disabled:x,limitFieldsPerRow:2,columns:[{keyName:"key",label:"Key",placeholder:"Key"},{keyName:"value",label:"Value",placeholder:"Value"}],values:Array.isArray(C)?C:c(C,[]),setValues:e=>S(e),errorMessage:$,warnMessage:k,helpMessage:w},g);case t.TextArea:return ba(o,{name:g,label:m,tooltip:v,badge:f,required:y,disabled:x,placeholder:b,value:C??"",onChange:e=>S(e.target.value),errorMessage:$,warnMessage:k,helpMessage:w},g);case t.Dropdown:return ba(s,{name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,withSearch:!P,options:T?.map(e=>({id:e.id||"",label:e.label||"",withCheckbox:!A}))||[],values:C?[String(C)]:[],setValues:e=>S(e[0]),errorMessage:$,warnMessage:k,helpMessage:w},g);case t.Checkbox:return ba(i,{name:g,label:m,tooltip:v,badge:f,value:!0===C||"true"===C,onChange:e=>S(e),disabled:x,errorMessage:$,warnMessage:k,helpMessage:w},g);case t.Time:return ba(n,{name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:x,value:C??"",setValue:e=>S(e),units:M,defaultUnit:L,errorMessage:$,warnMessage:k,helpMessage:w},g);case t.Toggle:return ba(l,{name:g,labelAlign:r.Right,label:m,tooltip:v,badge:f,value:!0===C||"true"===C,onChange:e=>S(e),disabled:x,errorMessage:$,warnMessage:k,helpMessage:w},g);default:return null}},Ka=Ma.div`
2
2
  display: flex;
3
3
  align-items: center;
4
4
  gap: 24px;
@@ -10,7 +10,7 @@ import{ay as e,L as a,l as t,ab as l,ac as r,dN as n,V as i,aL as s,aq as o,a9 a
10
10
  min-width: 0;
11
11
  white-space: pre;
12
12
  overflow-x: auto;
13
- `,Fa=({title:e,summary:t,onEdit:l,renderAction:r})=>{const n=Sa(()=>{const a=[];return e&&(a.push({text:e,variant:na.Default}),a.push({text:" - ",variant:na.Default})),a.push(...t),a},[e,t]);return ya(Ka,{children:[ba(Wa,{children:ba(ia,{parts:n})}),r&&r(),l&&ba(g,{"data-id":"sampling-btn-edit-auto-rule",label:v,rightIcon:Oa,variant:a.Text,size:m.S,onClick:l})]})},Ya={[$.HttpRequest]:"HTTP request",[$.HttpResponse]:"HTTP response",[$.DbQuery]:"DB query",[$.Messaging]:"messaging"};function Qa(e,a,t){return 1===e?a:t??`${a}s`}function Za(e,a){const t=[],l=e.slice(0,3),r=e.slice(3);return l.forEach((e,l)=>{l>0&&t.push({text:", ",variant:na.Default}),t.push({text:e,variant:a})}),r.length>0&&t.push({text:` + ${r.length} more`,variant:na.Default,tooltipItems:r}),t}function _a(e,a){switch(e){case b.CodeAttributes:return function(e){const a=Object.values(k).filter(a=>!!e.codeAttributes?.[a]).map(e=>T(e).toLowerCase());return a.length?[{text:"Collect",variant:na.Action},{text:" ",variant:na.Default},...Za(a,na.Endpoint)]:null}(a);case b.PayloadCollection:return function(e){const a=Object.values($).filter(a=>null!=e.payloadCollection?.[a]).map(e=>Ya[e]);return a.length?[{text:"Collect",variant:na.Action},{text:" ",variant:na.Default},...Za(a,na.Endpoint)]:null}(a);case b.HeadersCollection:return function(e){const a=(e.headersCollection?.[S.HeaderKeys]??[]).map(e=>e.trim()).filter(e=>e.length>0);if(!a.length)return null;const t=Qa(a.length,"HTTP header");return[{text:`Collect ${a.length} ${t}`,variant:na.Action},{text:"",variant:na.Default,tooltipItems:a}]}(a);case b.CustomInstrumentation:return function(e){const a=(e.customInstrumentations?.[y.Java]??[]).map(e=>new x(e.className,e.methodName)).filter(e=>e.Verify()),t=(e.customInstrumentations?.[y.Golang]??[]).map(e=>new C(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).filter(e=>e.Verify());if(!(a.length+t.length))return null;const l=[];a.length&&l.push(`${a.length} Java ${Qa(a.length,"probe")}`),t.length&&l.push(`${t.length} Go ${Qa(t.length,"probe")}`);const r=[...a.map(e=>`Java: ${e.toString()}`),...t.map(e=>`Go: ${e.toString()}`)];return[{text:`Apply ${l.join(" + ")}`,variant:na.Action},{text:"",variant:na.Default,tooltipItems:r}]}(a);default:return null}}const et=({option:e,formState:a,renderAction:t})=>{const l=Sa(()=>{const t=_a(e?.type,a);return t?[...t,...sa(a.sourceScopes)]:[]},[e?.type,a]),r=0===l.length;return ba(Fa,{title:r?f:"Instrumentation Rule Preview",summary:l,renderAction:t})},at=({size:e=200,central:a=!1,useInline:t=!1})=>{const{tier:l}=oa();if(t){if(a)return ba(Ia,{size:e});switch(l){case w.Community:return ba(za,{size:e});case w.Onprem:return ba(Da,{size:e});default:return null}}if(a)return ba(Xa,{size:e});switch(l){case w.Community:return ba(Ra,{size:e});case w.Onprem:return ba(Na,{size:e});default:return null}},tt=[{value:"50",label:"50%"},{value:"25",label:"25%"},{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"custom",label:"Custom"}],lt=[{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"0.5",label:"0.5%"},{value:"0.1",label:"0.1%"},{value:"custom",label:"Custom"}],rt=[{value:"5000",label:"5s"},{value:"1000",label:"1s"},{value:"500",label:"500ms"},{value:"100",label:"100ms"},{value:"50",label:"50ms"},{value:"custom",label:"Custom"}],nt=({description:e,options:a,selected:t,onSelect:l,customName:r,customLabel:n,customPlaceholder:i,customValue:s,onCustomChange:o,customInputType:d=h.Number,customMin:c,customMax:u})=>ya(P,{$gap:6,children:[ba(A,{label:e}),ya(M,{$gap:8,$alignItems:"flex-end",children:[ba(L,{options:a,selected:t,setSelected:l}),"custom"===t&&ba(p,{name:r,label:n,placeholder:i,type:d,value:s,onChange:o,width:160,min:c,max:u})]})]}),it=()=>{},st=e=>e.readOnly?ba(ot,{rule:e.rule}):ba(dt,{ruleType:e.ruleType,formState:e.formState,onChange:e.onChange}),ot=({rule:e})=>{const a=null!=e.durationAtLeastMs;return e.error?ba(O,{richTitle:{title:I},children:ba(l,{name:"sampling-view-toggle-keep-errors",onChange:it,value:!0,size:z.S,label:D,labelAlign:r.Right})}):a?ba(O,{richTitle:{title:X},children:ya("div",{children:[ba(N,{size:E.XXXS,color:H.Secondary,children:R}),ba(N,{size:E.XS,children:`${e.durationAtLeastMs}ms`})]})}):null},dt=({ruleType:e,formState:a,onChange:t})=>{const l=$a(e=>t({durationPreset:e}),[t]),r=$a(e=>t({customDurationMs:e.target.value}),[t]);return"Duration"===e?ba(O,{richTitle:{title:X,subTitle:B},children:ba(nt,{description:R,options:rt,selected:a.durationPreset,onSelect:l,customName:"sampling-input-custom-duration",customLabel:V,customPlaceholder:"200ms",customValue:a.customDurationMs,onCustomChange:r})}):null},ct=Ma.div`
13
+ `,Fa=({title:e,summary:t,onEdit:l,renderAction:r})=>{const n=Sa(()=>{const a=[];return e&&(a.push({text:e,variant:na.Default}),a.push({text:" - ",variant:na.Default})),a.push(...t),a},[e,t]);return ya(Ka,{children:[ba(Wa,{children:ba(ia,{parts:n})}),r&&r(),l&&ba(g,{"data-id":"sampling-btn-edit-auto-rule",label:v,rightIcon:Oa,variant:a.Text,size:m.S,onClick:l})]})},Ya={[$.HttpRequest]:"HTTP request",[$.HttpResponse]:"HTTP response",[$.DbQuery]:"DB query",[$.Messaging]:"messaging"};function Qa(e,a,t){return 1===e?a:t??`${a}s`}function Za(e,a){const t=[],l=e.slice(0,3),r=e.slice(3);return l.forEach((e,l)=>{l>0&&t.push({text:", ",variant:na.Default}),t.push({text:e,variant:a})}),r.length>0&&t.push({text:` + ${r.length} more`,variant:na.Default,tooltipItems:r}),t}function _a(e,a){switch(e){case b.CodeAttributes:return function(e){const a=Object.values(k).filter(a=>!!e.codeAttributes?.[a]).map(e=>w(e).toLowerCase());return a.length?[{text:"Collect",variant:na.Action},{text:" ",variant:na.Default},...Za(a,na.Endpoint)]:null}(a);case b.PayloadCollection:return function(e){const a=Object.values($).filter(a=>null!=e.payloadCollection?.[a]).map(e=>Ya[e]);return a.length?[{text:"Collect",variant:na.Action},{text:" ",variant:na.Default},...Za(a,na.Endpoint)]:null}(a);case b.HeadersCollection:return function(e){const a=(e.headersCollection?.[S.HeaderKeys]??[]).map(e=>e.trim()).filter(e=>e.length>0);if(!a.length)return null;const t=Qa(a.length,"HTTP header");return[{text:`Collect ${a.length} ${t}`,variant:na.Action},{text:"",variant:na.Default,tooltipItems:a}]}(a);case b.CustomInstrumentation:return function(e){const a=(e.customInstrumentations?.[y.Java]??[]).map(e=>new x(e.className,e.methodName)).filter(e=>e.Verify()),t=(e.customInstrumentations?.[y.Golang]??[]).map(e=>new C(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).filter(e=>e.Verify());if(!(a.length+t.length))return null;const l=[];a.length&&l.push(`${a.length} Java ${Qa(a.length,"probe")}`),t.length&&l.push(`${t.length} Go ${Qa(t.length,"probe")}`);const r=[...a.map(e=>`Java: ${e.toString()}`),...t.map(e=>`Go: ${e.toString()}`)];return[{text:`Apply ${l.join(" + ")}`,variant:na.Action},{text:"",variant:na.Default,tooltipItems:r}]}(a);default:return null}}const et=({option:e,formState:a,renderAction:t})=>{const l=Sa(()=>{const t=_a(e?.type,a);return t?[...t,...sa(a.sourceScopes)]:[]},[e?.type,a]),r=0===l.length;return ba(Fa,{title:r?f:"Instrumentation Rule Preview",summary:l,renderAction:t})},at=({size:e=200,central:a=!1,useInline:t=!1})=>{const{tier:l}=oa();if(t){if(a)return ba(Ia,{size:e});switch(l){case T.Community:return ba(za,{size:e});case T.Onprem:return ba(Da,{size:e});default:return null}}if(a)return ba(Xa,{size:e});switch(l){case T.Community:return ba(Ra,{size:e});case T.Onprem:return ba(Na,{size:e});default:return null}},tt=[{value:"50",label:"50%"},{value:"25",label:"25%"},{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"custom",label:"Custom"}],lt=[{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"0.5",label:"0.5%"},{value:"0.1",label:"0.1%"},{value:"custom",label:"Custom"}],rt=[{value:"5000",label:"5s"},{value:"1000",label:"1s"},{value:"500",label:"500ms"},{value:"100",label:"100ms"},{value:"50",label:"50ms"},{value:"custom",label:"Custom"}],nt=({description:e,options:a,selected:t,onSelect:l,customName:r,customLabel:n,customPlaceholder:i,customValue:s,onCustomChange:o,customInputType:d=h.Number,customMin:c,customMax:u})=>ya(P,{$gap:6,children:[ba(A,{label:e}),ya(M,{$gap:8,$alignItems:"flex-end",children:[ba(L,{options:a,selected:t,setSelected:l}),"custom"===t&&ba(p,{name:r,label:n,placeholder:i,type:d,value:s,onChange:o,width:160,min:c,max:u})]})]}),it=()=>{},st=e=>e.readOnly?ba(ot,{rule:e.rule}):ba(dt,{ruleType:e.ruleType,formState:e.formState,onChange:e.onChange}),ot=({rule:e})=>{const a=null!=e.durationAtLeastMs;return e.error?ba(O,{richTitle:{title:I},children:ba(l,{name:"sampling-view-toggle-keep-errors",onChange:it,value:!0,size:z.S,label:D,labelAlign:r.Right})}):a?ba(O,{richTitle:{title:X},children:ya("div",{children:[ba(N,{size:E.XXXS,color:H.Secondary,children:R}),ba(N,{size:E.XS,children:`${e.durationAtLeastMs}ms`})]})}):null},dt=({ruleType:e,formState:a,onChange:t})=>{const l=$a(e=>t({durationPreset:e}),[t]),r=$a(e=>t({customDurationMs:e.target.value}),[t]);return"Duration"===e?ba(O,{richTitle:{title:X,subTitle:B},children:ba(nt,{description:R,options:rt,selected:a.durationPreset,onSelect:l,customName:"sampling-input-custom-duration",customLabel:V,customPlaceholder:"200ms",customValue:a.customDurationMs,onCustomChange:r})}):null},ct=Ma.div`
14
14
  display: flex;
15
15
  gap: 32px;
16
16
  `,ut=Ma.div`
@@ -43,7 +43,7 @@ import{ay as e,L as a,l as t,ab as l,ac as r,dN as n,V as i,aL as s,aq as o,a9 a
43
43
  align-items: flex-end;
44
44
  gap: 16px;
45
45
  margin-bottom: 12px;
46
- `,ft="Any",bt="Kafka topic",yt=()=>ba("div",{style:{marginBottom:"8px"},children:ba(N,{size:E.XS,weight:500,children:"And"})}),xt=[{value:"all",label:"All Operations"},{value:"httpServer",label:"HTTP Server"},{value:"httpClient",label:"HTTP Client"}],Ct=[{value:"all",label:"All Operations"},{value:"httpServer",label:"HTTP Server"},{value:"kafkaConsumer",label:"Kafka Consumer"},{value:"kafkaProducer",label:"Kafka Producer"}],St=[{id:"",label:ft},{id:"GET",label:"GET"},{id:"POST",label:"POST"},{id:"PUT",label:"PUT"},{id:"DELETE",label:"DELETE"},{id:"PATCH",label:"PATCH"}];const $t=e=>e.readOnly?ba(kt,{data:e.data}):ba(Tt,{category:e.category,formState:e.formState,onChange:e.onChange}),kt=({data:e})=>{const a=Sa(()=>function(e){if("noisy"===e.category){const a=e.rule.operation;if(a?.httpServer)return[{id:"type",title:te,value:ae},{id:"route",title:F,value:a.httpServer.route||a.httpServer.routePrefix||le},{id:"method",title:_,value:a.httpServer.method||ft}];if(a?.httpClient){const e=[{id:"type",title:te,value:re}];return a.httpClient.serverAddress&&e.push({id:"serverAddress",title:"Server address",value:a.httpClient.serverAddress}),e.push({id:"route",title:F,value:a.httpClient.templatedPath||a.httpClient.templatedPathPrefix||le}),e.push({id:"method",title:_,value:a.httpClient.method||ft}),e}return[{id:"type",title:te,value:ne}]}const a=e.rule.operation;return a?.httpServer?[{id:"type",title:te,value:ae},{id:"route",title:F,value:a.httpServer.route||a.httpServer.routePrefix||le},{id:"method",title:_,value:a.httpServer.method||ft}]:a?.kafkaConsumer?[{id:"type",title:te,value:ie},{id:"topic",title:bt,value:a.kafkaConsumer.kafkaTopic||le}]:a?.kafkaProducer?[{id:"type",title:te,value:se},{id:"topic",title:bt,value:a.kafkaProducer.kafkaTopic||le}]:[{id:"type",title:te,value:ne}]}(e),[e]);return ba(O,{richTitle:{title:q},children:ba(ct,{children:a.map(({id:e,title:a,value:t})=>ya(ut,{children:[ba(N,{size:E.XXXS,color:H.Secondary,nowrap:!0,children:a}),ba(N,{size:E.XS,nowrap:!0,children:t})]},e))})})},Tt=({category:e,formState:t,onChange:l})=>{const r=Sa(()=>"noisy"===e?xt:Ct,[e]),n=$a(e=>l({operationType:e,route:"",serverAddress:"",method:"",kafkaTopic:""}),[l]),i=$a(e=>a=>{a&&l({routeType:e,route:""})},[l]),s=$a(e=>l({route:e.target.value}),[l]),o=$a(e=>l({serverAddress:e.target.value}),[l]),d=$a(e=>l({method:e[0]||""}),[l]),c=$a(e=>l({kafkaTopic:e.target.value}),[l]),u="httpServer"===t.operationType||"httpClient"===t.operationType,h="kafkaConsumer"===t.operationType||"kafkaProducer"===t.operationType,g="httpClient"===t.operationType?W:F,v="httpClient"===t.operationType?Y:Q;return ya(O,{richTitle:{title:`2. ${q}`,subTitle:G},children:[ba(P,{$alignItems:"flex-start",children:ba(L,{options:r,selected:t.operationType,setSelected:n})}),u&&ya(pt,{children:["httpClient"===t.operationType&&ya(vt,{children:[ba(p,{name:"sampling-input-server-address",label:U,placeholder:j,value:t.serverAddress,onChange:o}),ba(yt,{})]}),ya(ht,{children:[ya(gt,{children:[ba(mt,{children:ba(J,{"data-id":"sampling-radio-route",value:"route"===t.routeType,onChange:i("route")})}),ba(p,{name:"sampling-input-route",label:g,placeholder:K,value:"route"===t.routeType?t.route:"",onChange:s,disabled:"route"!==t.routeType})]}),ya(gt,{children:[ba(mt,{children:ba(J,{"data-id":"sampling-radio-route-prefix",value:"routePrefix"===t.routeType,onChange:i("routePrefix")})}),ba(p,{name:"sampling-input-route-prefix",label:v,placeholder:K,value:"routePrefix"===t.routeType?t.route:"",onChange:s,disabled:"routePrefix"!==t.routeType})]})]}),ya(vt,{children:[ba(yt,{}),ba(Z,{label:_,items:St,selectedIds:[t.method||""],setSelectedIds:e=>d(e),buttonProps:{"data-id":"sampling-btn-method",label:St.find(e=>e.id===t.method)?.label||ft,size:m.S,variant:a.Secondary}})]})]}),h&&ba(p,{name:"sampling-input-kafka-topic",label:ee,placeholder:"Type kafka topic",value:t.kafkaTopic,onChange:c,width:"320px"})]})},wt=[{value:"all",label:"Drop All"},{value:"sample",label:"Sample"}],Pt=[{value:"all",label:"Keep All"},{value:"sample",label:"Sample"}];const At=e=>e.readOnly?ba(Mt,{data:e.data}):ba(Lt,{category:e.category,formState:e.formState,onChange:e.onChange}),Mt=({data:e})=>{const a=Sa(()=>function(e){switch(e.category){case"highlyRelevant":return null!=e.rule.percentageAtLeast?{title:de,method:pe,description:ce,value:`${e.rule.percentageAtLeast}%`}:{title:de,method:ge,description:null,value:null};case"noisy":return da(e.rule.percentageAtMost)?{title:de,method:he,description:null,value:null}:{title:de,method:pe,description:ue,value:`${e.rule.percentageAtMost}%`};case"costReduction":return{title:de,method:pe,description:ue,value:`${e.rule.percentageAtMost}%`}}}(e),[e]),t=[{id:"method",title:_,value:a.method},...null!=a.description?[{id:"value",title:a.description,value:a.value}]:[]];return ba(O,{richTitle:{title:a.title},children:ba(ct,{children:t.map(({id:e,title:a,value:t})=>ya(ut,{children:[ba(N,{size:E.XXXS,color:H.Secondary,nowrap:!0,children:a}),ba(N,{size:E.XS,nowrap:!0,children:t})]},e))})})},Lt=({category:e,formState:a,onChange:t})=>{const l="highlyRelevant"===e,r=l?Pt:wt,n=`${l?4:3}. ${de}`,i=oe[e],s=l?ce:ue,o="noisy"===e?lt:tt,d=$a(e=>t({percentageMode:e}),[t]),c=$a(e=>t({percentagePreset:e}),[t]),u=$a(e=>t({customPercentage:e.target.value}),[t]);return ya(O,{richTitle:{title:n,subTitle:i},children:["costReduction"!==e&&ba(P,{$alignItems:"flex-start",children:ba(L,{options:r,selected:a.percentageMode,setSelected:d})}),("costReduction"===e||"sample"===a.percentageMode)&&ba(nt,{description:s,options:o,selected:a.percentagePreset,onSelect:c,customName:"sampling-input-custom-percentage",customPlaceholder:"5%",customValue:a.customPercentage,onCustomChange:u,customInputType:h.Decimal,customMin:0,customMax:100})]})},Ot=Ma.div`
46
+ `,ft="Any",bt="Kafka topic",yt=()=>ba("div",{style:{marginBottom:"8px"},children:ba(N,{size:E.XS,weight:500,children:"And"})}),xt=[{value:"all",label:"All Operations"},{value:"httpServer",label:"HTTP Server"},{value:"httpClient",label:"HTTP Client"}],Ct=[{value:"all",label:"All Operations"},{value:"httpServer",label:"HTTP Server"},{value:"kafkaConsumer",label:"Kafka Consumer"},{value:"kafkaProducer",label:"Kafka Producer"}],St=[{id:"",label:ft},{id:"GET",label:"GET"},{id:"POST",label:"POST"},{id:"PUT",label:"PUT"},{id:"DELETE",label:"DELETE"},{id:"PATCH",label:"PATCH"}];const $t=e=>e.readOnly?ba(kt,{data:e.data}):ba(wt,{category:e.category,formState:e.formState,onChange:e.onChange}),kt=({data:e})=>{const a=Sa(()=>function(e){if("noisy"===e.category){const a=e.rule.operation;if(a?.httpServer)return[{id:"type",title:te,value:ae},{id:"route",title:F,value:a.httpServer.route||a.httpServer.routePrefix||le},{id:"method",title:_,value:a.httpServer.method||ft}];if(a?.httpClient){const e=[{id:"type",title:te,value:re}];return a.httpClient.serverAddress&&e.push({id:"serverAddress",title:"Server address",value:a.httpClient.serverAddress}),e.push({id:"route",title:F,value:a.httpClient.templatedPath||a.httpClient.templatedPathPrefix||le}),e.push({id:"method",title:_,value:a.httpClient.method||ft}),e}return[{id:"type",title:te,value:ne}]}const a=e.rule.operation;return a?.httpServer?[{id:"type",title:te,value:ae},{id:"route",title:F,value:a.httpServer.route||a.httpServer.routePrefix||le},{id:"method",title:_,value:a.httpServer.method||ft}]:a?.kafkaConsumer?[{id:"type",title:te,value:ie},{id:"topic",title:bt,value:a.kafkaConsumer.kafkaTopic||le}]:a?.kafkaProducer?[{id:"type",title:te,value:se},{id:"topic",title:bt,value:a.kafkaProducer.kafkaTopic||le}]:[{id:"type",title:te,value:ne}]}(e),[e]);return ba(O,{richTitle:{title:q},children:ba(ct,{children:a.map(({id:e,title:a,value:t})=>ya(ut,{children:[ba(N,{size:E.XXXS,color:H.Secondary,nowrap:!0,children:a}),ba(N,{size:E.XS,nowrap:!0,children:t})]},e))})})},wt=({category:e,formState:t,onChange:l})=>{const r=Sa(()=>"noisy"===e?xt:Ct,[e]),n=$a(e=>l({operationType:e,route:"",serverAddress:"",method:"",kafkaTopic:""}),[l]),i=$a(e=>a=>{a&&l({routeType:e,route:""})},[l]),s=$a(e=>l({route:e.target.value}),[l]),o=$a(e=>l({serverAddress:e.target.value}),[l]),d=$a(e=>l({method:e[0]||""}),[l]),c=$a(e=>l({kafkaTopic:e.target.value}),[l]),u="httpServer"===t.operationType||"httpClient"===t.operationType,h="kafkaConsumer"===t.operationType||"kafkaProducer"===t.operationType,g="httpClient"===t.operationType?W:F,v="httpClient"===t.operationType?Y:Q;return ya(O,{richTitle:{title:`2. ${q}`,subTitle:G},children:[ba(P,{$alignItems:"flex-start",children:ba(L,{options:r,selected:t.operationType,setSelected:n})}),u&&ya(pt,{children:["httpClient"===t.operationType&&ya(vt,{children:[ba(p,{name:"sampling-input-server-address",label:U,placeholder:j,value:t.serverAddress,onChange:o}),ba(yt,{})]}),ya(ht,{children:[ya(gt,{children:[ba(mt,{children:ba(J,{"data-id":"sampling-radio-route",value:"route"===t.routeType,onChange:i("route")})}),ba(p,{name:"sampling-input-route",label:g,placeholder:K,value:"route"===t.routeType?t.route:"",onChange:s,disabled:"route"!==t.routeType})]}),ya(gt,{children:[ba(mt,{children:ba(J,{"data-id":"sampling-radio-route-prefix",value:"routePrefix"===t.routeType,onChange:i("routePrefix")})}),ba(p,{name:"sampling-input-route-prefix",label:v,placeholder:K,value:"routePrefix"===t.routeType?t.route:"",onChange:s,disabled:"routePrefix"!==t.routeType})]})]}),ya(vt,{children:[ba(yt,{}),ba(Z,{label:_,items:St,selectedIds:[t.method||""],setSelectedIds:e=>d(e),buttonProps:{"data-id":"sampling-btn-method",label:St.find(e=>e.id===t.method)?.label||ft,size:m.S,variant:a.Secondary}})]})]}),h&&ba(p,{name:"sampling-input-kafka-topic",label:ee,placeholder:"Type kafka topic",value:t.kafkaTopic,onChange:c,width:"320px"})]})},Tt=[{value:"all",label:"Drop All"},{value:"sample",label:"Sample"}],Pt=[{value:"all",label:"Keep All"},{value:"sample",label:"Sample"}];const At=e=>e.readOnly?ba(Mt,{data:e.data}):ba(Lt,{category:e.category,formState:e.formState,onChange:e.onChange}),Mt=({data:e})=>{const a=Sa(()=>function(e){switch(e.category){case"highlyRelevant":return null!=e.rule.percentageAtLeast?{title:de,method:pe,description:ce,value:`${e.rule.percentageAtLeast}%`}:{title:de,method:ge,description:null,value:null};case"noisy":return da(e.rule.percentageAtMost)?{title:de,method:he,description:null,value:null}:{title:de,method:pe,description:ue,value:`${e.rule.percentageAtMost}%`};case"costReduction":return{title:de,method:pe,description:ue,value:`${e.rule.percentageAtMost}%`}}}(e),[e]),t=[{id:"method",title:_,value:a.method},...null!=a.description?[{id:"value",title:a.description,value:a.value}]:[]];return ba(O,{richTitle:{title:a.title},children:ba(ct,{children:t.map(({id:e,title:a,value:t})=>ya(ut,{children:[ba(N,{size:E.XXXS,color:H.Secondary,nowrap:!0,children:a}),ba(N,{size:E.XS,nowrap:!0,children:t})]},e))})})},Lt=({category:e,formState:a,onChange:t})=>{const l="highlyRelevant"===e,r=l?Pt:Tt,n=`${l?4:3}. ${de}`,i=oe[e],s=l?ce:ue,o="noisy"===e?lt:tt,d=$a(e=>t({percentageMode:e}),[t]),c=$a(e=>t({percentagePreset:e}),[t]),u=$a(e=>t({customPercentage:e.target.value}),[t]);return ya(O,{richTitle:{title:n,subTitle:i},children:["costReduction"!==e&&ba(P,{$alignItems:"flex-start",children:ba(L,{options:r,selected:a.percentageMode,setSelected:d})}),("costReduction"===e||"sample"===a.percentageMode)&&ba(nt,{description:s,options:o,selected:a.percentagePreset,onSelect:c,customName:"sampling-input-custom-percentage",customPlaceholder:"5%",customValue:a.customPercentage,onCustomChange:u,customInputType:h.Decimal,customMin:0,customMax:100})]})},Ot=Ma.div`
47
47
  display: flex;
48
48
  align-items: flex-end;
49
49
  gap: 16px;
@@ -101,7 +101,7 @@ import{ay as e,L as a,l as t,ab as l,ac as r,dN as n,V as i,aL as s,aq as o,a9 a
101
101
  border-radius: 999px;
102
102
  background-color: ${({theme:e})=>e.v2.colors.silver[700]};
103
103
  border: 1px solid ${({theme:e})=>e.v2.colors.silver[600]};
104
- `,Wt={[Xe.JavaScript]:"Node.js",[Xe.DotNet]:".NET",[Xe.Php]:"PHP",[Xe.Java]:"Java",[Xe.Go]:"Go",[Xe.Python]:"Python",[Xe.Ruby]:"Ruby",[Xe.Rust]:"Rust"},Ft=[Xe.Python,Xe.Java,Xe.JavaScript,Xe.DotNet,Xe.Php,Xe.Ruby,Xe.Go],Yt=[{value:"all",label:"Entire Cluster"},{value:"source",label:"Specific Source"},{value:"namespace",label:"Specific Namespace"},{value:"language",label:"Specific Programming Language"}];function Qt(e){const a=Wt[e];return a||e.charAt(0).toUpperCase()+e.slice(1)}function Zt(e){return null!=e?`${e}. ${Ge}`:Ge}const _t=({readOnly:e,...a})=>ba(e?tl:rl,{...a}),el=({title:e,count:a,children:t})=>ya(P,{$gap:6,children:[ya(M,{$gap:8,$alignItems:"center",children:[ba(N,{size:E.XS,color:H.Primary,nowrap:!0,children:e}),a>1&&ya(N,{size:E.XXS,color:H.Secondary,nowrap:!0,children:["(",Ve,")"]})]}),ba(Ut,{children:t})]}),al=()=>{const e=La();return ba(Jt,{children:ba(Kt,{children:ba(N,{size:E.XXS,color:e.v2.colors.white[500],nowrap:!0,children:qe})})})},tl=({scopes:e,titleNumber:a})=>{const t=Zt(a);if(va(e))return ba(Te,{bgTint:"900",richTitle:{title:t},withCollapse:!0,collapseIsDefaultOpen:!0,children:ba(we,{status:Ae.Default,message:Pe,fullWidth:!0})});const l=e.sources??[],r=e.namespaces??[],n=e.languages??[],i=[];return l.length&&i.push({kind:"sources",node:ba(el,{title:Me,count:l.length,children:l.map((e,a)=>{const t=[e.namespace,e.kind,e.name].filter(Boolean),l=t.length?t.join(" / "):Oe;return ba(Le,{label:l},`src-${a}-${l}`)})})}),r.length&&i.push({kind:"namespaces",node:ba(el,{title:Ie,count:r.length,children:r.map((e,a)=>ba(Le,{label:e},`ns-${a}-${e}`))})}),n.length&&i.push({kind:"languages",node:ba(el,{title:De,count:n.length,children:n.map((e,a)=>{const t=Ne(e);return ba(Le,{label:Qt(e),leftIcon:t},`lang-${a}-${e}`)})})}),ba(Te,{bgTint:"900",richTitle:{title:t,subTitle:i.length>1?ze:void 0},withCollapse:!0,collapseIsDefaultOpen:!0,children:ba(Te,{bgTint:"800",children:ba(jt,{children:i.map((e,a)=>ya(Ca.Fragment,{children:[a>0&&ba(al,{}),e.node]},e.kind))})})})},ll=e=>e.sources.length>0?"source":e.namespaces.length>0?"namespace":e.languages.length>0?"language":"all",rl=({scopes:e,onChange:a,sourceOptions:t=[],namespaceOptions:l=[],supportedLanguages:r,titleNumber:n,dataIdPrefix:s="source-scope",slim:o})=>{const d=e??fa(),[c,u]=ka(()=>ll(d)),{sources:p,namespaces:h,languages:g}=d,m=p.length>0||h.length>0||g.length>0;Ta(()=>{m&&"all"===c&&u(ll(d))},[m,c]);const v=Sa(()=>Yt.map(e=>"language"===e.value&&0===r?.length?null:{...e,disabled:"all"===e.value&&m}).filter(Boolean),[m]),f=Sa(()=>p.map(e=>{return a=e.namespace,t=e.kind,l=e.name,`${a}/${t}/${l}`;var a,t,l}),[p]),b=Sa(()=>[...h],[h]),y=Sa(()=>new Set(g),[g]),x=$a(e=>{u(e)},[]),C=$a(e=>{const t=e.map(e=>function(e){const a=e.split("/");return 3!==a.length?null:{namespace:a[0],kind:a[1],name:a[2]}}(e)).filter(e=>null!=e).map(e=>({namespace:e.namespace,kind:e.kind,name:e.name}));a({...d,sources:t})},[d,a]),S=$a(e=>{a({...d,namespaces:e})},[d,a]),$=$a(e=>{const t=d.languages,l=t.includes(e)?t.filter(a=>a!==e):[...t,e];a({...d,languages:l})},[d,a]),k=!m&&"all"===c,T=(r||Ft).map(e=>({id:e,label:Wt[e]??e.charAt(0).toUpperCase()+e.slice(1),Icon:Ne(e)}));return ya(O,{richTitle:o?{title:Zt(n),titleSize:E.XS,titleColor:H.Secondary,tooltip:Re}:{title:Zt(n),subTitle:Re,subTitleWrap:!0},backgroundColor:o?"transparent":void 0,padding:o?0:void 0,children:[ba(we,k?{status:Ae.Default,message:Pe,fullWidth:!0,smallIcon:!0}:{status:Ae.Info,message:ze,fullWidth:!0,smallIcon:!0}),ba(P,{$alignItems:"flex-start",children:ba(L,{options:v,selected:c,setSelected:x})}),"source"===c&&ba(He,{multiple:!0,"data-id":`${s}-autocomplete-source`,options:t,value:f,onSelect:C,placeholder:Ee}),"namespace"===c&&ba(He,{multiple:!0,"data-id":`${s}-autocomplete-namespace`,options:l,value:b,onSelect:S,placeholder:"Search namespace"}),"language"===c&&T.length>0&&ba(Vt,{children:T.map(({id:e,label:a,Icon:t})=>{const l=y.has(e);return ya(qt,{$selected:l,onClick:()=>$(e),children:[ba(i,{name:`${s}-lang-${e}`,size:Be.S,value:l,onChange:()=>$(e)}),ba(Gt,{children:ba(t,{size:20})}),ba(N,{size:E.XS,nowrap:!0,children:a})]},e)})})]})},nl=(e,a)=>!a?.length||!!a?.find(a=>a===e),il=({title:e="Signals",required:a,errorMessage:t,allowedSignals:l,selectedSignals:r,setSelectedSignals:n,disabled:s})=>{const[o,d]=ka(1===r.length),c=wa(JSON.stringify(r));Ta(()=>{let e=je(r).filter(e=>nl(e,l));e.length||(e=Ue.filter(({id:e})=>nl(e,l)).map(({id:e})=>e));const a=JSON.stringify(e);c.current!==a&&(c.current=a,n(e),d(1===e.length))},[l,r]);return ya(P,{$gap:12,children:[ba(A,{label:e,required:a}),ba(M,{$gap:12,children:Ue.map(e=>{const a=nl(e.id,l),t=((e,a)=>!!a?.find(a=>a===e))(e.id,r);return a?ba(i,{label:e.value,disabled:s||!a||o&&t,value:t,onChange:a=>((e,a)=>{const t=e,l=a?[...r,t]:r.filter(e=>e!==t);n(l),d(1===l.length)})(e.id,a)},e.id):null})}),ba(Je,{errorMessage:t})]})},sl=({minSupportedVersion:a,currentVersion:t})=>ba(e,{isOpen:!0,onClose:()=>{},relativeToParent:!0,visual:()=>ba(Ke,{scale:2.4,icon:()=>ba("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"21",viewBox:"0 0 22 21",fill:"none",children:ba("path",{fill:"#151618",d:"M9.4844 0.730003C9.99694 -0.243259 11.4076 -0.24341 11.92 0.730003L11.9685 0.831353L14.3039 6.22012L20.153 6.77755C21.3553 6.89211 21.841 8.38683 20.9358 9.18621L16.5314 13.0731L17.8091 18.8079C18.0716 19.9868 16.8005 20.9109 15.7605 20.2969L10.7017 17.3093L5.64282 20.2969C4.60289 20.9104 3.33173 19.9866 3.59427 18.8079L4.87192 13.0741L0.468608 9.18621C-0.43662 8.38693 0.0482932 6.8924 1.25029 6.77755L7.09837 6.22012L9.43588 0.831353L9.4844 0.730003ZM8.55284 7.02876C8.35287 7.48992 7.9179 7.80589 7.41751 7.85357L2.03952 8.36571L6.09027 11.941C6.46691 12.2737 6.63296 12.7852 6.5237 13.2758L5.34956 18.5459L10.0008 15.8009L10.1669 15.7179C10.5087 15.574 10.8945 15.5741 11.2364 15.7179L11.4036 15.8009L16.0538 18.5459L14.8807 13.2758C14.7714 12.7851 14.9374 12.2737 15.3141 11.941L19.3627 8.36571L13.9858 7.85357C13.4855 7.80587 13.0505 7.4899 12.8505 7.02876L10.7017 2.07342L8.55284 7.02876Z"})})}),title:"Upgrade Required",description:`To use this feature, please upgrade to Odigos v${a} or later.\nCurrent version: ${t}.`}),ol=Ma.div`
104
+ `,Wt={[Xe.JavaScript]:"Node.js",[Xe.DotNet]:".NET",[Xe.Php]:"PHP",[Xe.Java]:"Java",[Xe.Go]:"Go",[Xe.Python]:"Python",[Xe.Ruby]:"Ruby",[Xe.Rust]:"Rust"},Ft=[Xe.Python,Xe.Java,Xe.JavaScript,Xe.DotNet,Xe.Php,Xe.Ruby,Xe.Go],Yt=[{value:"all",label:"Entire Cluster"},{value:"source",label:"Specific Source"},{value:"namespace",label:"Specific Namespace"},{value:"language",label:"Specific Programming Language"}];function Qt(e){const a=Wt[e];return a||e.charAt(0).toUpperCase()+e.slice(1)}function Zt(e){return null!=e?`${e}. ${Ge}`:Ge}const _t=({readOnly:e,...a})=>ba(e?tl:rl,{...a}),el=({title:e,count:a,children:t})=>ya(P,{$gap:6,children:[ya(M,{$gap:8,$alignItems:"center",children:[ba(N,{size:E.XS,color:H.Primary,nowrap:!0,children:e}),a>1&&ya(N,{size:E.XXS,color:H.Secondary,nowrap:!0,children:["(",Ve,")"]})]}),ba(Ut,{children:t})]}),al=()=>{const e=La();return ba(Jt,{children:ba(Kt,{children:ba(N,{size:E.XXS,color:e.v2.colors.white[500],nowrap:!0,children:qe})})})},tl=({scopes:e,titleNumber:a})=>{const t=Zt(a);if(va(e))return ba(we,{bgTint:"900",richTitle:{title:t},withCollapse:!0,collapseIsDefaultOpen:!0,children:ba(Te,{status:Ae.Default,message:Pe,fullWidth:!0})});const l=e.sources??[],r=e.namespaces??[],n=e.languages??[],i=[];return l.length&&i.push({kind:"sources",node:ba(el,{title:Me,count:l.length,children:l.map((e,a)=>{const t=[e.namespace,e.kind,e.name].filter(Boolean),l=t.length?t.join(" / "):Oe;return ba(Le,{label:l},`src-${a}-${l}`)})})}),r.length&&i.push({kind:"namespaces",node:ba(el,{title:Ie,count:r.length,children:r.map((e,a)=>ba(Le,{label:e},`ns-${a}-${e}`))})}),n.length&&i.push({kind:"languages",node:ba(el,{title:De,count:n.length,children:n.map((e,a)=>{const t=Ne(e);return ba(Le,{label:Qt(e),leftIcon:t},`lang-${a}-${e}`)})})}),ba(we,{bgTint:"900",richTitle:{title:t,subTitle:i.length>1?ze:void 0},withCollapse:!0,collapseIsDefaultOpen:!0,children:ba(we,{bgTint:"800",children:ba(jt,{children:i.map((e,a)=>ya(Ca.Fragment,{children:[a>0&&ba(al,{}),e.node]},e.kind))})})})},ll=e=>e.sources.length>0?"source":e.namespaces.length>0?"namespace":e.languages.length>0?"language":"all",rl=({scopes:e,onChange:a,sourceOptions:t=[],namespaceOptions:l=[],supportedLanguages:r,titleNumber:n,dataIdPrefix:s="source-scope",slim:o})=>{const d=e??fa(),[c,u]=ka(()=>ll(d)),{sources:p,namespaces:h,languages:g}=d,m=p.length>0||h.length>0||g.length>0;wa(()=>{m&&"all"===c&&u(ll(d))},[m,c]);const v=Sa(()=>Yt.map(e=>"language"===e.value&&0===r?.length?null:{...e,disabled:"all"===e.value&&m}).filter(Boolean),[m]),f=Sa(()=>p.map(e=>{return a=e.namespace,t=e.kind,l=e.name,`${a}/${t}/${l}`;var a,t,l}),[p]),b=Sa(()=>[...h],[h]),y=Sa(()=>new Set(g),[g]),x=$a(e=>{u(e)},[]),C=$a(e=>{const t=e.map(e=>function(e){const a=e.split("/");return 3!==a.length?null:{namespace:a[0],kind:a[1],name:a[2]}}(e)).filter(e=>null!=e).map(e=>({namespace:e.namespace,kind:e.kind,name:e.name}));a({...d,sources:t})},[d,a]),S=$a(e=>{a({...d,namespaces:e})},[d,a]),$=$a(e=>{const t=d.languages,l=t.includes(e)?t.filter(a=>a!==e):[...t,e];a({...d,languages:l})},[d,a]),k=!m&&"all"===c,w=(r||Ft).map(e=>({id:e,label:Wt[e]??e.charAt(0).toUpperCase()+e.slice(1),Icon:Ne(e)}));return ya(O,{richTitle:o?{title:Zt(n),titleSize:E.XS,titleColor:H.Secondary,tooltip:Re}:{title:Zt(n),subTitle:Re,subTitleWrap:!0},backgroundColor:o?"transparent":void 0,padding:o?0:void 0,children:[ba(Te,k?{status:Ae.Default,message:Pe,fullWidth:!0,smallIcon:!0}:{status:Ae.Info,message:ze,fullWidth:!0,smallIcon:!0}),ba(P,{$alignItems:"flex-start",children:ba(L,{options:v,selected:c,setSelected:x})}),"source"===c&&ba(He,{multiple:!0,"data-id":`${s}-autocomplete-source`,options:t,value:f,onSelect:C,placeholder:Ee}),"namespace"===c&&ba(He,{multiple:!0,"data-id":`${s}-autocomplete-namespace`,options:l,value:b,onSelect:S,placeholder:"Search namespace"}),"language"===c&&w.length>0&&ba(Vt,{children:w.map(({id:e,label:a,Icon:t})=>{const l=y.has(e);return ya(qt,{$selected:l,onClick:()=>$(e),children:[ba(i,{name:`${s}-lang-${e}`,size:Be.S,value:l,onChange:()=>$(e)}),ba(Gt,{children:ba(t,{size:20})}),ba(N,{size:E.XS,nowrap:!0,children:a})]},e)})})]})},nl=(e,a)=>!a?.length||!!a?.find(a=>a===e),il=({title:e="Signals",required:a,errorMessage:t,allowedSignals:l,selectedSignals:r,setSelectedSignals:n,disabled:s})=>{const[o,d]=ka(1===r.length),c=Ta(JSON.stringify(r));wa(()=>{let e=je(r).filter(e=>nl(e,l));e.length||(e=Ue.filter(({id:e})=>nl(e,l)).map(({id:e})=>e));const a=JSON.stringify(e);c.current!==a&&(c.current=a,n(e),d(1===e.length))},[l,r]);return ya(P,{$gap:12,children:[ba(A,{label:e,required:a}),ba(M,{$gap:12,children:Ue.map(e=>{const a=nl(e.id,l),t=((e,a)=>!!a?.find(a=>a===e))(e.id,r);return a?ba(i,{label:e.value,disabled:s||!a||o&&t,value:t,onChange:a=>((e,a)=>{const t=e,l=a?[...r,t]:r.filter(e=>e!==t);n(l),d(1===l.length)})(e.id,a)},e.id):null})}),ba(Je,{errorMessage:t})]})},sl=({minSupportedVersion:a,currentVersion:t})=>ba(e,{isOpen:!0,onClose:()=>{},relativeToParent:!0,visual:()=>ba(Ke,{scale:2.4,icon:()=>ba("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"21",viewBox:"0 0 22 21",fill:"none",children:ba("path",{fill:"#151618",d:"M9.4844 0.730003C9.99694 -0.243259 11.4076 -0.24341 11.92 0.730003L11.9685 0.831353L14.3039 6.22012L20.153 6.77755C21.3553 6.89211 21.841 8.38683 20.9358 9.18621L16.5314 13.0731L17.8091 18.8079C18.0716 19.9868 16.8005 20.9109 15.7605 20.2969L10.7017 17.3093L5.64282 20.2969C4.60289 20.9104 3.33173 19.9866 3.59427 18.8079L4.87192 13.0741L0.468608 9.18621C-0.43662 8.38693 0.0482932 6.8924 1.25029 6.77755L7.09837 6.22012L9.43588 0.831353L9.4844 0.730003ZM8.55284 7.02876C8.35287 7.48992 7.9179 7.80589 7.41751 7.85357L2.03952 8.36571L6.09027 11.941C6.46691 12.2737 6.63296 12.7852 6.5237 13.2758L5.34956 18.5459L10.0008 15.8009L10.1669 15.7179C10.5087 15.574 10.8945 15.5741 11.2364 15.7179L11.4036 15.8009L16.0538 18.5459L14.8807 13.2758C14.7714 12.7851 14.9374 12.2737 15.3141 11.941L19.3627 8.36571L13.9858 7.85357C13.4855 7.80587 13.0505 7.4899 12.8505 7.02876L10.7017 2.07342L8.55284 7.02876Z"})})}),title:"Upgrade Required",description:`To use this feature, please upgrade to Odigos v${a} or later.\nCurrent version: ${t}.`}),ol=Ma.div`
105
105
  display: flex;
106
106
  flex-direction: column;
107
107
  justify-content: flex-end;
@@ -148,8 +148,8 @@ import{ay as e,L as a,l as t,ab as l,ac as r,dN as n,V as i,aL as s,aq as o,a9 a
148
148
  padding: 5vh 10vw;
149
149
  border-radius: 12px;
150
150
  background-color: ${({theme:e})=>e.v2.colors.silver[800]};
151
- `,bl=Pa(({isOpen:t,withOverlay:l,disableAnimation:r,onClose:n,onBack:i,onNext:s,nextIsSkip:o,onSave:d,disableSave:c,connectionIds:u,header:p,subHeader:h,leftColumn:g,rightColumn:m,search:v,filters:f,errorMessage:b,isFormDirty:y,hideDirtyNote:x,isFetching:C,progress:S},$)=>{const[k,T]=ka(!1),[w,P]=ka(!1),[A,M]=ka(void 0);Aa($,()=>({clearErrors:()=>M(void 0)}));const L=w,O=$a(()=>{y&&!k?T(!0):(T(!1),n?.())},[y,k,n]),I=c||w||"boolean"==typeof y&&!y,D=$a(async()=>{P(!0);const e=await d();P(!1),!1!==e&&(e?.error?M(e.error):(u?.setValue([]),n?.()))},[d,u,n]),z=!!v||!!u||!!f,X=!!h,N=(z?48:0)+(X?50:0),R=Sa(()=>C?{status:Ae.Info,message:"Fetching Data..."}:w&&!S?{status:Ae.Info,message:"Saving Changes..."}:A||b?{status:Ae.Error,message:A||b}:"boolean"==typeof y&&y&&!x?{status:Ae.Info,message:'The values don\'t reflect the current configurations of the selected clusters.\n"Save" will override the current configurations.'}:"boolean"!=typeof y||y||x?void 0:{status:Ae.Success,message:"The values reflect the current configuration of the selected cluster."},[C,w,S,A,b,y,x]),H=Sa(()=>i?{label:"Back",leftIcon:Ha,variant:a.Secondary,onClick:i}:{label:"Cancel",variant:a.Secondary,onClick:O,disabled:L},[i,O,L]),[B,V]=ka(!1),q=Sa(()=>s?o?{"data-id":"wide-drawer-skip",label:"Skip",rightIcon:Ea,variant:a.Secondary,onClick:()=>V(!0)}:{"data-id":"wide-drawer-next",label:"Next",rightIcon:Ea,variant:a.Primary,onClick:s}:{"data-id":"wide-drawer-save",label:"Save",variant:a.Primary,onClick:D,disabled:I},[s,o,D,I]);return ya(Qe,{width:pl,isOpen:t,disableAnimation:r,hideOverlay:!w&&!l,header:{...p,onClose:n?O:void 0,onCloseDisabled:L},footer:{note:R,actions:[H,q]},children:[w?ba(Fe,{$height:"calc(100vh - 136px)",children:ba(fl,{children:ba(Ze,{titleSize:E.S,subTitleSize:E.XXXS,withGradient:!0,withSpinner:!0,...S})})}):ya(hl,{children:[z&&ya(gl,{children:[u&&ba(_e,{icon:Ba,title:"Selected Clusters",badge:{label:u.value.length}}),v&&ba(ea,{width:"100%",...v}),f]}),X&&ba(ml,{children:ba(_e,{icon:h.icon,title:h.title,subTitle:h.description,badge:h.badge})}),ya(vl,{children:[ba(ul,{isLeft:!0,heightOffset:N,...g}),ba(ul,{isRight:!0,heightOffset:N,...m})]})]}),ba(ja,{isOpen:k,onClose:()=>T(!1),onApprove:O}),ba(e,{title:"Skip setup?",description:"Without completing setup, Odigos won't be able to collect and send your telemetry data. This may interrupt your data flow and limit the platform's ability to provide value.",isOpen:B,onClose:()=>V(!1),denyButton:{label:"Go Back",variant:a.Secondary,onClick:()=>V(!1)},approveButton:{label:"Skip",variant:a.Primary,onClick:()=>{s?.(),V(!1)}}})]})});bl.displayName=bl.name;const yl=Ma.div`
151
+ `,bl=Pa(({isOpen:t,withOverlay:l,disableAnimation:r,onClose:n,onBack:i,onNext:s,nextIsSkip:o,onSave:d,disableSave:c,connectionIds:u,header:p,subHeader:h,leftColumn:g,rightColumn:m,search:v,filters:f,errorMessage:b,isFormDirty:y,hideDirtyNote:x,isFetching:C,progress:S},$)=>{const[k,w]=ka(!1),[T,P]=ka(!1),[A,M]=ka(void 0);Aa($,()=>({clearErrors:()=>M(void 0)}));const L=T,O=$a(()=>{y&&!k?w(!0):(w(!1),n?.())},[y,k,n]),I=c||T||"boolean"==typeof y&&!y,D=$a(async()=>{P(!0);const e=await d();P(!1),!1!==e&&(e?.error?M(e.error):(u?.setValue([]),n?.()))},[d,u,n]),z=!!v||!!u||!!f,X=!!h,N=(z?48:0)+(X?50:0),R=Sa(()=>C?{status:Ae.Info,message:"Fetching Data..."}:T&&!S?{status:Ae.Info,message:"Saving Changes..."}:A||b?{status:Ae.Error,message:A||b}:"boolean"==typeof y&&y&&!x?{status:Ae.Info,message:'The values don\'t reflect the current configurations of the selected clusters.\n"Save" will override the current configurations.'}:void 0,[C,T,S,A,b,y,x]),H=Sa(()=>i?{label:"Back",leftIcon:Ha,variant:a.Secondary,onClick:i}:{label:"Cancel",variant:a.Secondary,onClick:O,disabled:L},[i,O,L]),[B,V]=ka(!1),q=Sa(()=>s?o?{"data-id":"wide-drawer-skip",label:"Skip",rightIcon:Ea,variant:a.Secondary,onClick:()=>V(!0)}:{"data-id":"wide-drawer-next",label:"Next",rightIcon:Ea,variant:a.Primary,onClick:s}:{"data-id":"wide-drawer-save",label:"Save",variant:a.Primary,onClick:D,disabled:I},[s,o,D,I]);return ya(Qe,{width:pl,isOpen:t,disableAnimation:r,hideOverlay:!T&&!l,header:{...p,onClose:n?O:void 0,onCloseDisabled:L},footer:{note:R,actions:[H,q]},children:[T?ba(Fe,{$height:"calc(100vh - 136px)",children:ba(fl,{children:ba(Ze,{titleSize:E.S,subTitleSize:E.XXXS,withGradient:!0,withSpinner:!0,...S})})}):ya(hl,{children:[z&&ya(gl,{children:[u&&ba(_e,{icon:Ba,title:"Selected Clusters",badge:{label:u.value.length}}),v&&ba(ea,{width:"100%",...v}),f]}),X&&ba(ml,{children:ba(_e,{icon:h.icon,title:h.title,subTitle:h.description,badge:h.badge})}),ya(vl,{children:[ba(ul,{isLeft:!0,heightOffset:N,...g}),ba(ul,{isRight:!0,heightOffset:N,...m})]})]}),ba(ja,{isOpen:k,onClose:()=>w(!1),onApprove:O}),ba(e,{title:"Skip setup?",description:"Without completing setup, Odigos won't be able to collect and send your telemetry data. This may interrupt your data flow and limit the platform's ability to provide value.",isOpen:B,onClose:()=>V(!1),denyButton:{label:"Go Back",variant:a.Secondary,onClick:()=>V(!1)},approveButton:{label:"Skip",variant:a.Primary,onClick:()=>{s?.(),V(!1)}}})]})});bl.displayName=bl.name;const yl=Ma.div`
152
152
  padding: 0 24px;
153
153
  border-radius: 12px;
154
154
  background-color: ${({$codeBgColor:e})=>e||"transparent"};
155
- `,xl=({title:e="YAML",yaml:t,defaultOpen:l,fullHeight:r,bgTint:n="1000",codeBgColor:i})=>{const{clickCopy:s,isCopied:o}=aa(),d=Sa(()=>t?[{id:la(),type:ta.Button,buttonProps:{variant:a.Text,size:m.S,leftIcon:o?Va:qa,onClick:()=>s(t||""),disabled:o}}]:[],[t,o]);return ba(Te,{bgTint:n,richTitle:{icon:Ga,title:e},actions:d,withCollapse:!0,collapseIsDefaultOpen:l,fullHeight:r,children:ba(yl,{$codeBgColor:i,children:t?ba(ra,{code:t,language:"yaml",theme:"duotoneDark"}):ba(Fe,{children:ba(Ye,{title:"YAML not found",subTitle:"The YAML for this resource is not available"})})})})};export{Fa as A,ja as C,Ja as D,et as I,lt as N,$t as O,nt as P,Xt as R,il as S,sl as U,bl as W,xl as Y,_t as a,tt as b,Bt as c,Et as d,st as e,At as f,Ua as g,at as h,pl as i,rt as j};
155
+ `,xl=({title:e="YAML",yaml:t,defaultOpen:l,fullHeight:r,bgTint:n="1000",codeBgColor:i})=>{const{clickCopy:s,isCopied:o}=aa(),d=Sa(()=>t?[{id:la(),type:ta.Button,buttonProps:{variant:a.Text,size:m.S,leftIcon:o?Va:qa,onClick:()=>s(t||""),disabled:o}}]:[],[t,o]);return ba(we,{bgTint:n,richTitle:{icon:Ga,title:e},actions:d,withCollapse:!0,collapseIsDefaultOpen:l,fullHeight:r,children:ba(yl,{$codeBgColor:i,children:t?ba(ra,{code:t,language:"yaml",theme:"duotoneDark"}):ba(Fe,{children:ba(Ye,{title:"YAML not found",subTitle:"The YAML for this resource is not available"})})})})};export{Fa as A,ja as C,Ja as D,et as I,lt as N,$t as O,nt as P,Xt as R,il as S,sl as U,bl as W,xl as Y,_t as a,tt as b,Bt as c,Et as d,st as e,At as f,Ua as g,at as h,pl as i,rt as j};
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{useState as t,useCallback as a,useMemo as n,useContext as r,createContext as s,useRef as o,useEffect as i}from"react";import{d as l,e as d,A as c,f as u,g as m,i as p,F as h,h as f,j as g,D as v,m as b,S as y,s as D,k as E,l as S,I as k,H as C,C as A,G as F,J as I,n as w,K as N,T as x,E as R}from"./ui-components-CrXELmQx.js";import{d as P}from"./use-odigos-api-UctF_jx_.js";import{n as T,m as O,i as L,b as M,a as U,d as j,v as K,g as G,u as V}from"./helpers-zByTbpzZ.js";const _={type:"",disabled:!1,name:"",notes:"",signals:[],fields:{}},q=s(null),H="All row fields are required",z="At least one row is required",J=(e,t)=>!!e&&t.every(t=>{const a=e[t];return Array.isArray(a)?a.length>0:!("string"==typeof(n=a)?!n.trim():p(n));var n}),Q=({children:r})=>{const[s,o]=t(null),i=l(_),f=a(e=>{i.resetFormData(),i.handleErrorChange(void 0,void 0,{}),e?.type&&i.handleFormChange("type",e.type),o(e)},[]),g=a(e=>{var t;i.resetFormData((({type:e,name:t,notes:a,disabled:n,signals:r,fields:s})=>({type:e,name:t||"",notes:a||"",disabled:!!n,signals:r??[],fields:s??{}}))(e)),i.handleErrorChange(void 0,void 0,{}),o((t=e.type,c.find(e=>e.type===t)??null))},[]),v=a(()=>{if(!s)return{errorMessage:"No action type selected",preparedFormData:d(_)};const e=(e=>{const t=d(e),a=t.fields||{},n=a[u.UrlTemplatizationRulesGroups];n?.length&&(a[u.UrlTemplatizationRulesGroups]=n.map(e=>({...e,templatizationRules:(e.templatizationRules||[]).filter(e=>!!e.template?.trim())})));const r=a[u.AttributeNamesToDelete];r?.length&&(a[u.AttributeNamesToDelete]=r.filter(e=>!!e?.trim()));const s=a[u.Renames];s&&(a[u.Renames]=Object.fromEntries(Object.entries(s).filter(([e,t])=>!!e?.trim()&&!!t?.trim())));const o=a[u.ExtractAttribute];return o?.extractions?.length&&(a[u.ExtractAttribute]={extractions:o.extractions.map(e=>({targetAttributeName:e.targetAttributeName?.trim()||"",lookupKey:e.lookupKey?.trim()||"",dataFormat:e.dataFormat||"",regex:e.regex?.trim()||""})).filter(e=>!!(e.targetAttributeName||e.lookupKey||e.dataFormat||e.regex))}),t.fields=a,t})(i.formData),t={};p(e.signals)&&(t.signals=h.FIELD_IS_REQUIRED),s.type&&Object.assign(t,((e,t,a)=>{const n={},r=t.fields||{},s=a.fields||{};switch(e){case m.K8sAttributes:{const e=!(r[u.CollectContainerAttributes]||r[u.CollectReplicaSetAttributes]||r[u.CollectWorkloadId]||r[u.CollectClusterId]),t=!r[u.LabelsAttributes]?.length,a=!r[u.AnnotationsAttributes]?.length;e&&t&&a&&(n[u.CollectContainerAttributes]="Enable at least one option or add a label/annotation row");const s=r[u.LabelsAttributes];s?.some(e=>!J(e,["labelKey","attributeKey","fromSources"]))&&(n[u.LabelsAttributes]=H);const o=r[u.AnnotationsAttributes];o?.some(e=>!J(e,["annotationKey","attributeKey","fromSources"]))&&(n[u.AnnotationsAttributes]=H);break}case m.AddClusterInfo:{const e=r[u.ClusterAttributes];e?.length?e.some(e=>!J(e,["attributeName","attributeStringValue"]))&&(n[u.ClusterAttributes]=H):n[u.ClusterAttributes]=z;break}case m.DeleteAttributes:{const e=s[u.AttributeNamesToDelete]||[],t=r[u.AttributeNamesToDelete]||[];t.length?e.length>t.length&&(n[u.AttributeNamesToDelete]=H):n[u.AttributeNamesToDelete]=e.length?H:z;break}case m.RenameAttributes:{const e=Object.entries(s[u.Renames]||{}),t=Object.entries(r[u.Renames]||{}),a=e.some(([e,t])=>!e?.trim()||!t?.trim());t.length?a&&(n[u.Renames]=H):n[u.Renames]=e.length?H:z;break}case m.PiiMasking:{const e=r[u.PiiCategories];e?.length||(n[u.PiiCategories]="Select at least one attribute to mask");break}case m.URLTemplatization:{const e=r[u.UrlTemplatizationRulesGroups];(!e?.length||e.some(e=>!e.templatizationRules?.length))&&(n[u.UrlTemplatizationRulesGroups]="Each rule group needs at least one non-blank template");break}case m.ExtractAttribute:{const e=r[u.ExtractAttribute]?.extractions||[],t=s[u.ExtractAttribute]?.extractions||[];if(e.length)if(e.some(e=>{if(!e.targetAttributeName?.trim())return!0;const t=!!e.regex?.trim(),a=!!e.lookupKey?.trim();return a!==!!e.dataFormat||t===a}))n[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 a=e.targetAttributeName?.trim()||"";return!!t.has(a)||(t.add(a),!1)})&&(n[u.ExtractAttribute]="Each new span attribute name must be unique")}else n[u.ExtractAttribute]=t.length?H:z;break}}return n})(s.type,e,i.formData)),i.handleErrorChange(void 0,void 0,t);return{errorMessage:Object.keys(t).length>0?"Invalid form values":void 0,preparedFormData:e}},[i,s]),b=n(()=>({selectedOption:s,onSelectOption:f,loadAction:g,genericForm:i,validateFormData:v}),[s,f,g,i,v]);return e(q.Provider,{value:b,children:r})},W=()=>{const e=r(q);if(!e)throw new Error("useActionFormContext must be used within an ActionFormContextProvider");return e},$={name:""},B=s(null),X=({children:r,defaultExcludeName:s=""})=>{const{dataStreams:i}=f(),[c,u]=t(void 0),[m,p]=t(s),[v,b]=t(void 0),[y,D]=t(null),E=o(null),S=l($),k=a(e=>{S.resetFormData({name:e}),S.handleErrorChange(void 0,void 0,{}),u(void 0),p(e),b(e),D(null),E.current=null},[]),C=a(()=>{const e=d(S.formData),t=(e=>{const t={};return e.name?g(e.name)||(t.name=h.ILLEGAL_K8S_LABEL):t.name=h.FIELD_IS_REQUIRED,t})(e);S.handleErrorChange(void 0,void 0,t);const a=Object.keys(t).length>0?h.REQUIRED_FIELDS:void 0;return u(a),{errorMessage:a,preparedFormData:e}},[S]),A=a(async e=>{const{errorMessage:t,preparedFormData:a}=C();if(t)return;const n=i.find(e=>e.name===a.name&&e.name!==m);if(n)return E.current=e,void D({preparedFormData:a,existingName:n.name,editingName:v});await e(a)},[C,i,m,v]),F=a(async()=>{const e=E.current,t=y?.preparedFormData;E.current=null,D(null),e&&t&&await e(t)},[y]),I=a(()=>{E.current=null,D(null)},[]),w=n(()=>({genericForm:S,loadDataStream:k,editingName:v,validateFormData:C,requestSubmit:A,pendingMerge:y,confirmMerge:F,cancelMerge:I,errorMessage:c,excludeName:m,setExcludeName:p}),[S,k,v,C,A,y,F,I,c,m]);return e(B.Provider,{value:w,children:r})},Y=()=>{const e=r(B);if(!e)throw new Error("useDataStreamFormContext must be used within a DataStreamFormContextProvider");return e},Z={type:"",name:"",currentStreamName:"",disabled:!1,exportedSignals:{logs:!1,metrics:!1,traces:!1,profiles:!1},fields:[]},ee={activeForm:null,onChangeActiveForm:()=>{},loadDestination:()=>{},genericForm:void 0,validateFormData:()=>({isOk:!1,preparedFormData:d(Z)}),unsavedDestinations:[],thisUnsavedDestination:void 0,setUnsavedDestinations:()=>{},addUnsavedDestination:()=>{},updateUnsavedDestination:()=>{},deleteUnsavedDestination:()=>{}},te=s(ee),ae=e=>e.filter(e=>!!e).map(e=>{const{name:t,componentType:a,componentProperties:n,displayName:r,initialValue:s,renderCondition:o}=e,i=a===S.Dropdown,l=D(n,{});return{componentType:a,renderCondition:o,name:t,title:r,value:s,placeholder:l.placeholder||(i?"Select an option":void 0),options:i&&Array.isArray(l.values)?l.values.map(e=>({id:e,label:e})):void 0,...l}}),ne=({children:r})=>{const{selectedStreamName:s}=f(),{items:o}=P().destinationsApi.useDestinations(),[c,u]=t(null),[m,g]=t(ee.unsavedDestinations),S=n(()=>"number"==typeof c?.unsavedIdx?m[c.unsavedIdx]:void 0,[c,m]),k=a((e,t)=>{c&&(g(t=>[...t,{...e,option:c.option}]),u(t?e=>e?{...e,listType:v.UNSAVED,unsavedIdx:m.length}:null:null))},[c,m.length]),C=a((e,t,a)=>{c&&(g(a=>a.map((a,n)=>n===e?{...a,...t,option:c.option}:a)),u(a?e=>e?{...e,listType:v.UNSAVED}:null:null))},[c]),A=a(e=>{g(t=>t.filter((t,a)=>a!==e)),u(null)},[]),F=l({...Z,currentStreamName:s});i(()=>{if(!c)return;if(S)return void F.resetFormData({...S.formData});if(c.listType===v.EXISTS&&c.option.id){const e=o.find(e=>e.id===c.option.id);if(e)return void F.resetFormData({type:e.destinationType.type,name:e.name||e.destinationType.displayName,currentStreamName:s,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=b(c.option.supportedSignals);F.resetFormData({type:c.option.type,name:c.option.displayName,currentStreamName:s,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 I=a(e=>{F.resetFormData(),F.handleErrorChange(void 0,void 0,{}),u(e?{...e,dynamicFields:e.option?.fields?ae(e.option.fields):[]}:null)},[]),w=a((e,t)=>{let a;for(const n of t){const t=n.items.find(t=>t.type===e.destinationType.type);if(t){a=t;break}}const n=D(e.fields,{}),r={id:e.id,type:e.destinationType.type,displayName:e.name||e.destinationType.displayName,selected:!0,testConnectionSupported:a?.testConnectionSupported??!1,supportedSignals:e.destinationType.supportedSignals,fields:a?a.fields.map(e=>({...e,initialValue:n[e.name]??e.initialValue})):[]},s=ae(r.fields);u({listType:v.EXISTS,option:r,dynamicFields:s})},[]),N=a(()=>{const e=d(F.formData),t={};c?.dynamicFields.forEach(({name:a,required:n})=>{if(n){const n=e.fields.find(e=>e.key===a)?.value;p(n)&&(t[a]=h.FIELD_IS_REQUIRED)}});return E(e.exportedSignals).length||(t.exportedSignals=h.FIELD_IS_REQUIRED),F.handleErrorChange(void 0,void 0,t),{errorMessage:0===Object.keys(t).length?void 0:"Invalid form values",preparedFormData:e}},[F,c]);return e(te.Provider,{value:{activeForm:c,onChangeActiveForm:I,loadDestination:w,genericForm:F,validateFormData:N,unsavedDestinations:m,thisUnsavedDestination:S,setUnsavedDestinations:g,addUnsavedDestination:k,updateUnsavedDestination:C,deleteUnsavedDestination:A},children:r})},re=()=>r(te),se={disabled:!1,ruleName:"",notes:"",sourceScopes:O(),workloads:null,instrumentationLibraries:null,payloadCollection:null,codeAttributes:null,headersCollection:null,customInstrumentations:null},oe=s(null),ie=({children:r,sourceOptions:s=[],namespaceOptions:o=[]})=>{const[i,c]=t(null),u=l(se),m=a(e=>{u.resetFormData(),u.handleErrorChange(void 0,void 0,{}),c(e)},[]),p=a(e=>{var t;u.resetFormData((({ruleName:e,notes:t,disabled:a,sourceScopes:n,instrumentationLibraries:r,payloadCollection:s,codeAttributes:o,headersCollection:i,customInstrumentations:l})=>({ruleName:e||"",notes:t||"",disabled:!!a,sourceScopes:T(n),workloads:null,instrumentationLibraries:r??null,payloadCollection:s??null,codeAttributes:o??null,headersCollection:i??null,customInstrumentations:l??null}))(e)),u.handleErrorChange(void 0,void 0,{}),c((t=e.type,k.find(e=>e.type===t)??null))},[]),h=a(()=>{if(!i)return{errorMessage:"No rule type selected",preparedFormData:d(se)};const e=(e=>{const t=d(e),a={...t,sourceScopes:L(t.sourceScopes)?null:t.sourceScopes,workloads:null};return a.headersCollection?.[C.HeaderKeys]?.length&&(a.headersCollection[C.HeaderKeys]=a.headersCollection[C.HeaderKeys].map(e=>e.trim()).filter(e=>e)),a.customInstrumentations?.[A.Golang]?.length&&(a.customInstrumentations[A.Golang]=a.customInstrumentations[A.Golang].map(e=>new F(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})),a.customInstrumentations?.[A.Java]?.length&&(a.customInstrumentations[A.Java]=a.customInstrumentations[A.Java].map(e=>new I(e.className,e.methodName)).filter(e=>{return t=e,!(!t.className?.trim()&&!t.methodName?.trim());var t})),a})(u.formData),t=((e,t)=>{const a={};switch(e){case w.CodeAttributes:Object.values(t.codeAttributes||{}).some(e=>null!=e)||(a.codeAttributes="Code attributes are required");break;case w.PayloadCollection:Object.values(t.payloadCollection||{}).some(e=>null!=e)||(a.payloadCollection="Payload collection are required");break;case w.HeadersCollection:t.headersCollection?.[C.HeaderKeys]?.length||(a.headersCollection="Header keys are required");break;case w.CustomInstrumentation:{const e=t.customInstrumentations?.[A.Golang]||[],n=t.customInstrumentations?.[A.Java]||[];if(!e.length&&!n.length){a.customInstrumentations="Custom instrumentation are required";break}const r=e.findIndex(e=>!new F(e.packageName,e.functionName,e.receiverName,e.receiverMethodName).Verify());if(-1!==r){a.customInstrumentations=`Golang probe #${r+1} is invalid: provide a package name plus either a function name OR both a receiver name and receiver method name`;break}const s=n.findIndex(e=>!new I(e.className,e.methodName).Verify());if(-1!==s){a.customInstrumentations=`Java probe #${s+1} is invalid: both class name and method name are required`;break}break}}return a})(i.type,e);return u.handleErrorChange(void 0,void 0,t),{errorMessage:Object.keys(t).length>0?"Invalid form values":void 0,preparedFormData:e}},[u,i]),f=n(()=>({selectedOption:i,onSelectOption:m,loadRule:p,genericForm:u,validateFormData:h,sourceOptions:s,namespaceOptions:o}),[i,m,p,u,h,s,o]);return e(oe.Provider,{value:f,children:r})},le=()=>{const e=r(oe);if(!e)throw new Error("useRuleFormContext must be used within a RuleFormContextProvider");return e};var de;!function(e){e.Create="create",e.View="view",e.EditAutoNoisy="edit-auto-noisy",e.EditAutoCostReduction="edit-auto-cost-reduction",e.EditAutoHighlyRelevant="edit-auto-highly-relevant"}(de||(de={}));const ce=s(null),ue=["50","25","10","1"];function me(e){const t=String(e);return ue.includes(t)?t:"custom"}const pe=({category:r,sourceOptions:s=[],namespaceOptions:o=[],children:d})=>{const{formData:c,handleFormChange:u,resetFormData:m}=l(G(r)),[p,h]=t(null);i(()=>{m(G(r)),h(null)},[r]);const f=a(e=>{h(null),u(void 0,void 0,{...c,...e})},[c,u]),g=a(()=>{m(G(r)),h(null)},[r,m]),v=n(()=>({formType:de.Create,category:r,formData:c,handleChange:f,resetForm:g,duplicateWarning:p,setDuplicateWarning:h,sourceOptions:s,namespaceOptions:o}),[r,c,f,g,p,s,o]);return e(ce.Provider,{value:v,children:d})},he=({data:r,defaultEditMode:s,sourceOptions:d=[],namespaceOptions:c=[],children:u})=>{const[m,p]=t(!1),{formData:h,handleFormChange:f,resetFormData:g}=l(void 0),v=o(null),[b,y]=t(null);i(()=>{r!==v.current&&(v.current=r,r&&s?(g(K(r)),y(null),p(!0)):(p(!1),y(null)))},[r,s]);const D=a(e=>{y(null),f(void 0,void 0,{...h,...e})},[h,f]),E=a(()=>{r&&(g(K(r)),y(null),p(!0))},[r,g]),S=a(()=>{p(!1),y(null)},[]),k=n(()=>({formType:de.View,data:r,isEditing:m,formData:h,handleChange:D,handleEdit:E,handleCancelEdit:S,duplicateWarning:b,setDuplicateWarning:y,sourceOptions:d,namespaceOptions:c}),[r,m,h,D,E,S,b,d,c]);return e(ce.Provider,{value:k,children:u})};function fe(e){const[a,r]=t(()=>0===e?"all":"sample"),[s,o]=t(()=>me(e)),[l,d]=t(()=>"custom"===me(e)?String(e):"");i(()=>{r(0===e?"all":"sample");const t=me(e);o(t),d("custom"===t?String(e):"")},[e]);const c=n(()=>"all"===a?0:"custom"===s?Number(l)||0:Number(s),[a,s,l]);return{percentageMode:a,setPercentageMode:r,percentagePreset:s,setPercentagePreset:o,customPercentage:l,setCustomPercentage:d,resolvedPercentage:c}}const ge=({enabled:a,keepPercentage:r,children:s})=>{const[o,l]=t(a),d=fe(r);i(()=>{l(a)},[a]);const c=n(()=>j({enabled:o,keepPercentage:d.resolvedPercentage}),[o,d.resolvedPercentage]),u=n(()=>({formType:de.EditAutoNoisy,localEnabled:o,setLocalEnabled:l,...d,summary:c}),[o,d,c]);return e(ce.Provider,{value:u,children:s})},ve=({enabled:a,dropPercentage:r,children:s})=>{const[o,l]=t(a),d=fe(r);i(()=>{l(a)},[a]);const c=n(()=>U(o?{disabled:!1,percentageAtMost:d.resolvedPercentage}:null),[o,d.resolvedPercentage]),u=n(()=>({formType:de.EditAutoCostReduction,localEnabled:o,setLocalEnabled:l,...d,summary:c}),[o,d,c]);return e(ce.Provider,{value:u,children:s})},be=({enabled:a,children:r})=>{const[s,o]=t(a);i(()=>{o(a)},[a]);const l=n(()=>M(s?{disabled:!1}:null),[s]),d=n(()=>({formType:de.EditAutoHighlyRelevant,localEnabled:s,setLocalEnabled:o,summary:l}),[s,l]);return e(ce.Provider,{value:d,children:r})},ye=t=>{switch(t.formType){case de.Create:return e(pe,{...t});case de.View:return e(he,{...t});case de.EditAutoNoisy:return e(ge,{...t});case de.EditAutoCostReduction:return e(ve,{...t});case de.EditAutoHighlyRelevant:return e(be,{...t})}};function De(e){const t=r(ce);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 Ee={otelServiceName:"",currentStreamName:""},Se=s(null),ke=({children:r})=>{const[s,o]=t(void 0),i=l(Ee),c=a(e=>{i.resetFormData((({serviceName:e,id:t})=>({otelServiceName:e||t.name||"",currentStreamName:""}))(e)),i.handleErrorChange(void 0,void 0,{}),o(void 0)},[]),u=a(()=>{const e=d(i.formData);return i.handleErrorChange(void 0,void 0,{}),o(void 0),{errorMessage:void 0,preparedFormData:e}},[i]),m=n(()=>({loadSource:c,genericForm:i,validateFormData:u,errorMessage:s}),[c,i,u,s]);return e(Se.Provider,{value:m,children:r})},Ce=()=>{const e=r(Se);if(!e)throw new Error("useSourceEditFormContext must be used within a SourceEditFormContextProvider");return e},Ae=new Set([N.StaticPod]),Fe=e=>{const t=e.workloads.filter(({selected:e})=>e).length,a=e.workloads.length;return{selectedCount:t,isAllSourced:t>0&&t===a,isSomeSourced:t>0&&t<a,isFutureApps:e.selected||!1}},Ie=(e,t,a)=>{if(t&&!e.name.toLowerCase().includes(t.toLowerCase()))return!1;if(a.showOnlySelected){const{isAllSourced:t,isSomeSourced:a,isFutureApps:n}=Fe(e);return t||a||n}return!0},we=(e,t,a)=>!(t&&!e.name.toLowerCase().includes(t.toLowerCase()))&&(!a.showOnlySelected||e.selected),Ne=s({snapshots:null,setSnapshots:()=>{},isFetching:!1,setIsFetching:()=>{},formData:[],handleSourceChange:()=>{},handleSelectAll:()=>{},formDiff:{},isFormDirty:!1}),xe=(e,t,a)=>{const n=[];return t.workloads.forEach(r=>{const s=e?.workloads.find(e=>e.name===r.name&&e.kind===r.kind);r.selected!==s?.selected&&n.push({namespace:t.name,name:r.name,kind:r.kind,selected:r.selected||!1,currentStreamName:a})}),n},Re=({children:r,selectedConnectionIds:s,initialInputs:o})=>{const{tier:l}=V(),c=l===x.Onprem,{capabilities:u}=P(),m=u.canInstrumentNamespaces,{selectedStreamName:p}=f(),[h,g]=t(!1),[v,b]=t(null),[y,D]=t([]);i(()=>{v&&D(e=>{const t=((e,t)=>d(((e,t)=>e.clusters.filter(({clusterId:e})=>!t||t.includes(e)))(e,t)))(v,s);return t.map(t=>{const a=e?.find(e=>e.clusterId===t.clusterId),n=a??t;if(o?.[t.clusterId]){const e=o[t.clusterId],a=d(n);return e.forEach(e=>{const t=a.namespaces.find(t=>t.name===e.namespace);if(t)if(e.name&&e.kind){const a=t.workloads.find(t=>t.name===e.name&&t.kind===e.kind);a&&(a.selected=e.selected)}else t.selected=e.selected,e.selected&&t.workloads.forEach(e=>{Ae.has(e.kind)&&!c||(e.selected=!0)})}),a}return n})})},[v,s,o]);const{formDiff:E,isFormDirty:S}=n(()=>{const e=((e,t,a,n)=>{const r={};return e.forEach(e=>{e.namespaces.forEach(s=>{const o=t.find(t=>t.clusterId===e.clusterId)?.namespaces.find(e=>e.name===s.name);if(!n){const t=xe(o,s,a);return void(t.length>0&&(r[e.clusterId]||(r[e.clusterId]=[]),r[e.clusterId].push(...t)))}const i=s.selected||!1;if(i!==o?.selected)r[e.clusterId]||(r[e.clusterId]=[]),r[e.clusterId].push({namespace:s.name,selected:i,currentStreamName:a}),i?r[e.clusterId]=r[e.clusterId].filter(e=>e.namespace!==s.name||e.namespace===s.name&&(!e.name||!e.kind)):s.workloads.forEach(t=>{t.selected&&r[e.clusterId].push({namespace:s.name,name:t.name,kind:t.kind,selected:!0,currentStreamName:a})});else{const t=xe(o,s,a);t.length>0&&(r[e.clusterId]||(r[e.clusterId]=[]),r[e.clusterId].push(...t))}})}),r})(y,v?.clusters||[],p,m);return{formDiff:e,isFormDirty:Object.keys(e).length>0}},[y,v,p,m]),k=a(e=>!c&&Ae.has(e),[c]),C=a(({clusterId:e,workloadId:t,selected:a,auto:n})=>{D(r=>{const s=d(r),o=s.findIndex(t=>t.clusterId===e);if(-1===o)return s;const i=s[o].namespaces.findIndex(e=>e.name===t.namespace);if(-1===i)return s;if(t.kind&&t.name){const e=s[o].namespaces[i].workloads.findIndex(e=>e.name===t.name&&e.kind===t.kind);if(-1===e)return s;const n="boolean"==typeof a?a:!s[o].namespaces[i].workloads[e].selected;if(s[o].namespaces[i].workloads[e].selected=n,m)if(n){s[o].namespaces[i].workloads.filter(e=>!k(e.kind)).every(e=>e.selected)&&(s[o].namespaces[i].selected=!0)}else s[o].namespaces[i].selected=!1}else if(m){const e="boolean"==typeof n?n:!s[o].namespaces[i].selected;s[o].namespaces[i].selected=e,e?s[o].namespaces[i].workloads.forEach(e=>{k(e.kind)||(e.selected=!0)}):"boolean"!=typeof a||a||s[o].namespaces[i].workloads.forEach(e=>{e.selected=!1})}else{const e="boolean"==typeof a?a:"boolean"!=typeof n||n;s[o].namespaces[i].workloads.forEach(t=>{e&&k(t.kind)||(t.selected=e)})}return s})},[k,m]),A=a(({clusterId:e,namespaceName:t,boolean:a,searchText:n="",searchBy:r="",filters:s})=>{D(o=>{const i=d(o),l=r===R.Namespace?n:"",c=r===R.Source?n:"",u=!!l||!!c||!!s?.showOnlySelected;return i.forEach((n,r)=>{e&&n.clusterId!==e||n.namespaces.forEach(({name:e,workloads:n},o)=>{if(!t||e===t)if(u)if(t){if(n.forEach((e,t)=>{a&&k(e.kind)||we(e,c,s||{showOnlySelected:!1})&&(i[r].namespaces[o].workloads[t].selected=a)}),m){const e=i[r].namespaces[o].workloads.filter(e=>!k(e.kind)).every(e=>e.selected);i[r].namespaces[o].selected=e}}else{if(!Ie(i[r].namespaces[o],l,s||{showOnlySelected:!1}))return;m&&(i[r].namespaces[o].selected=a),n.forEach((e,t)=>{a&&k(e.kind)||(i[r].namespaces[o].workloads[t].selected=a)})}else m&&(i[r].namespaces[o].selected=a),n.forEach((e,t)=>{a&&k(e.kind)||(i[r].namespaces[o].workloads[t].selected=a)})})}),i})},[k,m]);return e(Ne.Provider,{value:{snapshots:v,setSnapshots:b,isFetching:h,setIsFetching:g,formData:y,handleSourceChange:C,handleSelectAll:A,formDiff:E,isFormDirty:S},children:r})},Pe=()=>r(Ne);export{Q as A,X as D,Ae as E,ie as R,de as S,ne as a,ye as b,ke as c,Re as d,Y as e,re as f,le as g,De as h,Ce as i,Pe as j,we as k,Ie as l,Fe as m,W as u};
1
+ import{jsx as e}from"react/jsx-runtime";import{useState as t,useCallback as a,useMemo as n,useContext as r,createContext as s,useRef as o,useEffect as i}from"react";import{d as l,e as d,A as c,f as u,g as m,i as p,F as h,h as f,j as g,D as v,m as b,S as y,s as D,k as E,l as S,I as k,H as C,C as A,G as F,J as I,n as w,K as N,T as x,E as R}from"./ui-components-CrXELmQx.js";import{d as P}from"./use-odigos-api-CgkEC7if.js";import{n as T,m as O,i as L,b as M,a as U,d as j,v as K,g as G,u as V}from"./helpers-45znEVHP.js";const _={type:"",disabled:!1,name:"",notes:"",signals:[],fields:{}},q=s(null),H="All row fields are required",z="At least one row is required",J=(e,t)=>!!e&&t.every(t=>{const a=e[t];return Array.isArray(a)?a.length>0:!("string"==typeof(n=a)?!n.trim():p(n));var n}),Q=({children:r})=>{const[s,o]=t(null),i=l(_),f=a(e=>{i.resetFormData(),i.handleErrorChange(void 0,void 0,{}),e?.type&&i.handleFormChange("type",e.type),o(e)},[]),g=a(e=>{var t;i.resetFormData((({type:e,name:t,notes:a,disabled:n,signals:r,fields:s})=>({type:e,name:t||"",notes:a||"",disabled:!!n,signals:r??[],fields:s??{}}))(e)),i.handleErrorChange(void 0,void 0,{}),o((t=e.type,c.find(e=>e.type===t)??null))},[]),v=a(()=>{if(!s)return{errorMessage:"No action type selected",preparedFormData:d(_)};const e=(e=>{const t=d(e),a=t.fields||{},n=a[u.UrlTemplatizationRulesGroups];n?.length&&(a[u.UrlTemplatizationRulesGroups]=n.map(e=>({...e,templatizationRules:(e.templatizationRules||[]).filter(e=>!!e.template?.trim())})));const r=a[u.AttributeNamesToDelete];r?.length&&(a[u.AttributeNamesToDelete]=r.filter(e=>!!e?.trim()));const s=a[u.Renames];s&&(a[u.Renames]=Object.fromEntries(Object.entries(s).filter(([e,t])=>!!e?.trim()&&!!t?.trim())));const o=a[u.ExtractAttribute];return o?.extractions?.length&&(a[u.ExtractAttribute]={extractions:o.extractions.map(e=>({targetAttributeName:e.targetAttributeName?.trim()||"",lookupKey:e.lookupKey?.trim()||"",dataFormat:e.dataFormat||"",regex:e.regex?.trim()||""})).filter(e=>!!(e.targetAttributeName||e.lookupKey||e.dataFormat||e.regex))}),t.fields=a,t})(i.formData),t={};p(e.signals)&&(t.signals=h.FIELD_IS_REQUIRED),s.type&&Object.assign(t,((e,t,a)=>{const n={},r=t.fields||{},s=a.fields||{};switch(e){case m.K8sAttributes:{const e=!(r[u.CollectContainerAttributes]||r[u.CollectReplicaSetAttributes]||r[u.CollectWorkloadId]||r[u.CollectClusterId]),t=!r[u.LabelsAttributes]?.length,a=!r[u.AnnotationsAttributes]?.length;e&&t&&a&&(n[u.CollectContainerAttributes]="Enable at least one option or add a label/annotation row");const s=r[u.LabelsAttributes];s?.some(e=>!J(e,["labelKey","attributeKey","fromSources"]))&&(n[u.LabelsAttributes]=H);const o=r[u.AnnotationsAttributes];o?.some(e=>!J(e,["annotationKey","attributeKey","fromSources"]))&&(n[u.AnnotationsAttributes]=H);break}case m.AddClusterInfo:{const e=r[u.ClusterAttributes];e?.length?e.some(e=>!J(e,["attributeName","attributeStringValue"]))&&(n[u.ClusterAttributes]=H):n[u.ClusterAttributes]=z;break}case m.DeleteAttributes:{const e=s[u.AttributeNamesToDelete]||[],t=r[u.AttributeNamesToDelete]||[];t.length?e.length>t.length&&(n[u.AttributeNamesToDelete]=H):n[u.AttributeNamesToDelete]=e.length?H:z;break}case m.RenameAttributes:{const e=Object.entries(s[u.Renames]||{}),t=Object.entries(r[u.Renames]||{}),a=e.some(([e,t])=>!e?.trim()||!t?.trim());t.length?a&&(n[u.Renames]=H):n[u.Renames]=e.length?H:z;break}case m.PiiMasking:{const e=r[u.PiiCategories];e?.length||(n[u.PiiCategories]="Select at least one attribute to mask");break}case m.URLTemplatization:{const e=r[u.UrlTemplatizationRulesGroups];(!e?.length||e.some(e=>!e.templatizationRules?.length))&&(n[u.UrlTemplatizationRulesGroups]="Each rule group needs at least one non-blank template");break}case m.ExtractAttribute:{const e=r[u.ExtractAttribute]?.extractions||[],t=s[u.ExtractAttribute]?.extractions||[];if(e.length)if(e.some(e=>{if(!e.targetAttributeName?.trim())return!0;const t=!!e.regex?.trim(),a=!!e.lookupKey?.trim();return a!==!!e.dataFormat||t===a}))n[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 a=e.targetAttributeName?.trim()||"";return!!t.has(a)||(t.add(a),!1)})&&(n[u.ExtractAttribute]="Each new span attribute name must be unique")}else n[u.ExtractAttribute]=t.length?H:z;break}}return n})(s.type,e,i.formData)),i.handleErrorChange(void 0,void 0,t);return{errorMessage:Object.keys(t).length>0?"Invalid form values":void 0,preparedFormData:e}},[i,s]),b=n(()=>({selectedOption:s,onSelectOption:f,loadAction:g,genericForm:i,validateFormData:v}),[s,f,g,i,v]);return e(q.Provider,{value:b,children:r})},W=()=>{const e=r(q);if(!e)throw new Error("useActionFormContext must be used within an ActionFormContextProvider");return e},$={name:""},B=s(null),X=({children:r,defaultExcludeName:s=""})=>{const{dataStreams:i}=f(),[c,u]=t(void 0),[m,p]=t(s),[v,b]=t(void 0),[y,D]=t(null),E=o(null),S=l($),k=a(e=>{S.resetFormData({name:e}),S.handleErrorChange(void 0,void 0,{}),u(void 0),p(e),b(e),D(null),E.current=null},[]),C=a(()=>{const e=d(S.formData),t=(e=>{const t={};return e.name?g(e.name)||(t.name=h.ILLEGAL_K8S_LABEL):t.name=h.FIELD_IS_REQUIRED,t})(e);S.handleErrorChange(void 0,void 0,t);const a=Object.keys(t).length>0?h.REQUIRED_FIELDS:void 0;return u(a),{errorMessage:a,preparedFormData:e}},[S]),A=a(async e=>{const{errorMessage:t,preparedFormData:a}=C();if(t)return;const n=i.find(e=>e.name===a.name&&e.name!==m);if(n)return E.current=e,void D({preparedFormData:a,existingName:n.name,editingName:v});await e(a)},[C,i,m,v]),F=a(async()=>{const e=E.current,t=y?.preparedFormData;E.current=null,D(null),e&&t&&await e(t)},[y]),I=a(()=>{E.current=null,D(null)},[]),w=n(()=>({genericForm:S,loadDataStream:k,editingName:v,validateFormData:C,requestSubmit:A,pendingMerge:y,confirmMerge:F,cancelMerge:I,errorMessage:c,excludeName:m,setExcludeName:p}),[S,k,v,C,A,y,F,I,c,m]);return e(B.Provider,{value:w,children:r})},Y=()=>{const e=r(B);if(!e)throw new Error("useDataStreamFormContext must be used within a DataStreamFormContextProvider");return e},Z={type:"",name:"",currentStreamName:"",disabled:!1,exportedSignals:{logs:!1,metrics:!1,traces:!1,profiles:!1},fields:[]},ee={activeForm:null,onChangeActiveForm:()=>{},loadDestination:()=>{},genericForm:void 0,validateFormData:()=>({isOk:!1,preparedFormData:d(Z)}),unsavedDestinations:[],thisUnsavedDestination:void 0,setUnsavedDestinations:()=>{},addUnsavedDestination:()=>{},updateUnsavedDestination:()=>{},deleteUnsavedDestination:()=>{}},te=s(ee),ae=e=>e.filter(e=>!!e).map(e=>{const{name:t,componentType:a,componentProperties:n,displayName:r,initialValue:s,renderCondition:o}=e,i=a===S.Dropdown,l=D(n,{});return{componentType:a,renderCondition:o,name:t,title:r,value:s,placeholder:l.placeholder||(i?"Select an option":void 0),options:i&&Array.isArray(l.values)?l.values.map(e=>({id:e,label:e})):void 0,...l}}),ne=({children:r})=>{const{selectedStreamName:s}=f(),{items:o}=P().destinationsApi.useDestinations(),[c,u]=t(null),[m,g]=t(ee.unsavedDestinations),S=n(()=>"number"==typeof c?.unsavedIdx?m[c.unsavedIdx]:void 0,[c,m]),k=a((e,t)=>{c&&(g(t=>[...t,{...e,option:c.option}]),u(t?e=>e?{...e,listType:v.UNSAVED,unsavedIdx:m.length}:null:null))},[c,m.length]),C=a((e,t,a)=>{c&&(g(a=>a.map((a,n)=>n===e?{...a,...t,option:c.option}:a)),u(a?e=>e?{...e,listType:v.UNSAVED}:null:null))},[c]),A=a(e=>{g(t=>t.filter((t,a)=>a!==e)),u(null)},[]),F=l({...Z,currentStreamName:s});i(()=>{if(!c)return;if(S)return void F.resetFormData({...S.formData});if(c.listType===v.EXISTS&&c.option.id){const e=o.find(e=>e.id===c.option.id);if(e)return void F.resetFormData({type:e.destinationType.type,name:e.name||e.destinationType.displayName,currentStreamName:s,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=b(c.option.supportedSignals);F.resetFormData({type:c.option.type,name:c.option.displayName,currentStreamName:s,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 I=a(e=>{F.resetFormData(),F.handleErrorChange(void 0,void 0,{}),u(e?{...e,dynamicFields:e.option?.fields?ae(e.option.fields):[]}:null)},[]),w=a((e,t)=>{let a;for(const n of t){const t=n.items.find(t=>t.type===e.destinationType.type);if(t){a=t;break}}const n=D(e.fields,{}),r={id:e.id,type:e.destinationType.type,displayName:e.name||e.destinationType.displayName,selected:!0,testConnectionSupported:a?.testConnectionSupported??!1,supportedSignals:e.destinationType.supportedSignals,fields:a?a.fields.map(e=>({...e,initialValue:n[e.name]??e.initialValue})):[]},s=ae(r.fields);u({listType:v.EXISTS,option:r,dynamicFields:s})},[]),N=a(()=>{const e=d(F.formData),t={};c?.dynamicFields.forEach(({name:a,required:n})=>{if(n){const n=e.fields.find(e=>e.key===a)?.value;p(n)&&(t[a]=h.FIELD_IS_REQUIRED)}});return E(e.exportedSignals).length||(t.exportedSignals=h.FIELD_IS_REQUIRED),F.handleErrorChange(void 0,void 0,t),{errorMessage:0===Object.keys(t).length?void 0:"Invalid form values",preparedFormData:e}},[F,c]);return e(te.Provider,{value:{activeForm:c,onChangeActiveForm:I,loadDestination:w,genericForm:F,validateFormData:N,unsavedDestinations:m,thisUnsavedDestination:S,setUnsavedDestinations:g,addUnsavedDestination:k,updateUnsavedDestination:C,deleteUnsavedDestination:A},children:r})},re=()=>r(te),se={disabled:!1,ruleName:"",notes:"",sourceScopes:O(),workloads:null,instrumentationLibraries:null,payloadCollection:null,codeAttributes:null,headersCollection:null,customInstrumentations:null},oe=s(null),ie=({children:r,sourceOptions:s=[],namespaceOptions:o=[]})=>{const[i,c]=t(null),u=l(se),m=a(e=>{u.resetFormData(),u.handleErrorChange(void 0,void 0,{}),c(e)},[]),p=a(e=>{var t;u.resetFormData((({ruleName:e,notes:t,disabled:a,sourceScopes:n,instrumentationLibraries:r,payloadCollection:s,codeAttributes:o,headersCollection:i,customInstrumentations:l})=>({ruleName:e||"",notes:t||"",disabled:!!a,sourceScopes:T(n),workloads:null,instrumentationLibraries:r??null,payloadCollection:s??null,codeAttributes:o??null,headersCollection:i??null,customInstrumentations:l??null}))(e)),u.handleErrorChange(void 0,void 0,{}),c((t=e.type,k.find(e=>e.type===t)??null))},[]),h=a(()=>{if(!i)return{errorMessage:"No rule type selected",preparedFormData:d(se)};const e=(e=>{const t=d(e),a={...t,sourceScopes:L(t.sourceScopes)?null:t.sourceScopes,workloads:null};return a.headersCollection?.[C.HeaderKeys]?.length&&(a.headersCollection[C.HeaderKeys]=a.headersCollection[C.HeaderKeys].map(e=>e.trim()).filter(e=>e)),a.customInstrumentations?.[A.Golang]?.length&&(a.customInstrumentations[A.Golang]=a.customInstrumentations[A.Golang].map(e=>new F(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})),a.customInstrumentations?.[A.Java]?.length&&(a.customInstrumentations[A.Java]=a.customInstrumentations[A.Java].map(e=>new I(e.className,e.methodName)).filter(e=>{return t=e,!(!t.className?.trim()&&!t.methodName?.trim());var t})),a})(u.formData),t=((e,t)=>{const a={};switch(e){case w.CodeAttributes:Object.values(t.codeAttributes||{}).some(e=>null!=e)||(a.codeAttributes="Code attributes are required");break;case w.PayloadCollection:Object.values(t.payloadCollection||{}).some(e=>null!=e)||(a.payloadCollection="Payload collection are required");break;case w.HeadersCollection:t.headersCollection?.[C.HeaderKeys]?.length||(a.headersCollection="Header keys are required");break;case w.CustomInstrumentation:{const e=t.customInstrumentations?.[A.Golang]||[],n=t.customInstrumentations?.[A.Java]||[];if(!e.length&&!n.length){a.customInstrumentations="Custom instrumentation are required";break}const r=e.findIndex(e=>!new F(e.packageName,e.functionName,e.receiverName,e.receiverMethodName).Verify());if(-1!==r){a.customInstrumentations=`Golang probe #${r+1} is invalid: provide a package name plus either a function name OR both a receiver name and receiver method name`;break}const s=n.findIndex(e=>!new I(e.className,e.methodName).Verify());if(-1!==s){a.customInstrumentations=`Java probe #${s+1} is invalid: both class name and method name are required`;break}break}}return a})(i.type,e);return u.handleErrorChange(void 0,void 0,t),{errorMessage:Object.keys(t).length>0?"Invalid form values":void 0,preparedFormData:e}},[u,i]),f=n(()=>({selectedOption:i,onSelectOption:m,loadRule:p,genericForm:u,validateFormData:h,sourceOptions:s,namespaceOptions:o}),[i,m,p,u,h,s,o]);return e(oe.Provider,{value:f,children:r})},le=()=>{const e=r(oe);if(!e)throw new Error("useRuleFormContext must be used within a RuleFormContextProvider");return e};var de;!function(e){e.Create="create",e.View="view",e.EditAutoNoisy="edit-auto-noisy",e.EditAutoCostReduction="edit-auto-cost-reduction",e.EditAutoHighlyRelevant="edit-auto-highly-relevant"}(de||(de={}));const ce=s(null),ue=["50","25","10","1"];function me(e){const t=String(e);return ue.includes(t)?t:"custom"}const pe=({category:r,sourceOptions:s=[],namespaceOptions:o=[],children:d})=>{const{formData:c,handleFormChange:u,resetFormData:m}=l(G(r)),[p,h]=t(null);i(()=>{m(G(r)),h(null)},[r]);const f=a(e=>{h(null),u(void 0,void 0,{...c,...e})},[c,u]),g=a(()=>{m(G(r)),h(null)},[r,m]),v=n(()=>({formType:de.Create,category:r,formData:c,handleChange:f,resetForm:g,duplicateWarning:p,setDuplicateWarning:h,sourceOptions:s,namespaceOptions:o}),[r,c,f,g,p,s,o]);return e(ce.Provider,{value:v,children:d})},he=({data:r,defaultEditMode:s,sourceOptions:d=[],namespaceOptions:c=[],children:u})=>{const[m,p]=t(!1),{formData:h,handleFormChange:f,resetFormData:g}=l(void 0),v=o(null),[b,y]=t(null);i(()=>{r!==v.current&&(v.current=r,r&&s?(g(K(r)),y(null),p(!0)):(p(!1),y(null)))},[r,s]);const D=a(e=>{y(null),f(void 0,void 0,{...h,...e})},[h,f]),E=a(()=>{r&&(g(K(r)),y(null),p(!0))},[r,g]),S=a(()=>{p(!1),y(null)},[]),k=n(()=>({formType:de.View,data:r,isEditing:m,formData:h,handleChange:D,handleEdit:E,handleCancelEdit:S,duplicateWarning:b,setDuplicateWarning:y,sourceOptions:d,namespaceOptions:c}),[r,m,h,D,E,S,b,d,c]);return e(ce.Provider,{value:k,children:u})};function fe(e){const[a,r]=t(()=>0===e?"all":"sample"),[s,o]=t(()=>me(e)),[l,d]=t(()=>"custom"===me(e)?String(e):"");i(()=>{r(0===e?"all":"sample");const t=me(e);o(t),d("custom"===t?String(e):"")},[e]);const c=n(()=>"all"===a?0:"custom"===s?Number(l)||0:Number(s),[a,s,l]);return{percentageMode:a,setPercentageMode:r,percentagePreset:s,setPercentagePreset:o,customPercentage:l,setCustomPercentage:d,resolvedPercentage:c}}const ge=({enabled:a,keepPercentage:r,children:s})=>{const[o,l]=t(a),d=fe(r);i(()=>{l(a)},[a]);const c=n(()=>j({enabled:o,keepPercentage:d.resolvedPercentage}),[o,d.resolvedPercentage]),u=n(()=>({formType:de.EditAutoNoisy,localEnabled:o,setLocalEnabled:l,...d,summary:c}),[o,d,c]);return e(ce.Provider,{value:u,children:s})},ve=({enabled:a,dropPercentage:r,children:s})=>{const[o,l]=t(a),d=fe(r);i(()=>{l(a)},[a]);const c=n(()=>U(o?{disabled:!1,percentageAtMost:d.resolvedPercentage}:null),[o,d.resolvedPercentage]),u=n(()=>({formType:de.EditAutoCostReduction,localEnabled:o,setLocalEnabled:l,...d,summary:c}),[o,d,c]);return e(ce.Provider,{value:u,children:s})},be=({enabled:a,children:r})=>{const[s,o]=t(a);i(()=>{o(a)},[a]);const l=n(()=>M(s?{disabled:!1}:null),[s]),d=n(()=>({formType:de.EditAutoHighlyRelevant,localEnabled:s,setLocalEnabled:o,summary:l}),[s,l]);return e(ce.Provider,{value:d,children:r})},ye=t=>{switch(t.formType){case de.Create:return e(pe,{...t});case de.View:return e(he,{...t});case de.EditAutoNoisy:return e(ge,{...t});case de.EditAutoCostReduction:return e(ve,{...t});case de.EditAutoHighlyRelevant:return e(be,{...t})}};function De(e){const t=r(ce);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 Ee={otelServiceName:"",currentStreamName:""},Se=s(null),ke=({children:r})=>{const[s,o]=t(void 0),i=l(Ee),c=a(e=>{i.resetFormData((({serviceName:e,id:t})=>({otelServiceName:e||t.name||"",currentStreamName:""}))(e)),i.handleErrorChange(void 0,void 0,{}),o(void 0)},[]),u=a(()=>{const e=d(i.formData);return i.handleErrorChange(void 0,void 0,{}),o(void 0),{errorMessage:void 0,preparedFormData:e}},[i]),m=n(()=>({loadSource:c,genericForm:i,validateFormData:u,errorMessage:s}),[c,i,u,s]);return e(Se.Provider,{value:m,children:r})},Ce=()=>{const e=r(Se);if(!e)throw new Error("useSourceEditFormContext must be used within a SourceEditFormContextProvider");return e},Ae=new Set([N.StaticPod]),Fe=e=>{const t=e.workloads.filter(({selected:e})=>e).length,a=e.workloads.length;return{selectedCount:t,isAllSourced:t>0&&t===a,isSomeSourced:t>0&&t<a,isFutureApps:e.selected||!1}},Ie=(e,t,a)=>{if(t&&!e.name.toLowerCase().includes(t.toLowerCase()))return!1;if(a.showOnlySelected){const{isAllSourced:t,isSomeSourced:a,isFutureApps:n}=Fe(e);return t||a||n}return!0},we=(e,t,a)=>!(t&&!e.name.toLowerCase().includes(t.toLowerCase()))&&(!a.showOnlySelected||e.selected),Ne=s({snapshots:null,setSnapshots:()=>{},isFetching:!1,setIsFetching:()=>{},formData:[],handleSourceChange:()=>{},handleSelectAll:()=>{},formDiff:{},isFormDirty:!1}),xe=(e,t,a)=>{const n=[];return t.workloads.forEach(r=>{const s=e?.workloads.find(e=>e.name===r.name&&e.kind===r.kind);r.selected!==s?.selected&&n.push({namespace:t.name,name:r.name,kind:r.kind,selected:r.selected||!1,currentStreamName:a})}),n},Re=({children:r,selectedConnectionIds:s,initialInputs:o})=>{const{tier:l}=V(),c=l===x.Onprem,{capabilities:u}=P(),m=u.canInstrumentNamespaces,{selectedStreamName:p}=f(),[h,g]=t(!1),[v,b]=t(null),[y,D]=t([]);i(()=>{v&&D(e=>{const t=((e,t)=>d(((e,t)=>e.clusters.filter(({clusterId:e})=>!t||t.includes(e)))(e,t)))(v,s);return t.map(t=>{const a=e?.find(e=>e.clusterId===t.clusterId),n=a??t;if(o?.[t.clusterId]){const e=o[t.clusterId],a=d(n);return e.forEach(e=>{const t=a.namespaces.find(t=>t.name===e.namespace);if(t)if(e.name&&e.kind){const a=t.workloads.find(t=>t.name===e.name&&t.kind===e.kind);a&&(a.selected=e.selected)}else t.selected=e.selected,e.selected&&t.workloads.forEach(e=>{Ae.has(e.kind)&&!c||(e.selected=!0)})}),a}return n})})},[v,s,o]);const{formDiff:E,isFormDirty:S}=n(()=>{const e=((e,t,a,n)=>{const r={};return e.forEach(e=>{e.namespaces.forEach(s=>{const o=t.find(t=>t.clusterId===e.clusterId)?.namespaces.find(e=>e.name===s.name);if(!n){const t=xe(o,s,a);return void(t.length>0&&(r[e.clusterId]||(r[e.clusterId]=[]),r[e.clusterId].push(...t)))}const i=s.selected||!1;if(i!==o?.selected)r[e.clusterId]||(r[e.clusterId]=[]),r[e.clusterId].push({namespace:s.name,selected:i,currentStreamName:a}),i?r[e.clusterId]=r[e.clusterId].filter(e=>e.namespace!==s.name||e.namespace===s.name&&(!e.name||!e.kind)):s.workloads.forEach(t=>{t.selected&&r[e.clusterId].push({namespace:s.name,name:t.name,kind:t.kind,selected:!0,currentStreamName:a})});else{const t=xe(o,s,a);t.length>0&&(r[e.clusterId]||(r[e.clusterId]=[]),r[e.clusterId].push(...t))}})}),r})(y,v?.clusters||[],p,m);return{formDiff:e,isFormDirty:Object.keys(e).length>0}},[y,v,p,m]),k=a(e=>!c&&Ae.has(e),[c]),C=a(({clusterId:e,workloadId:t,selected:a,auto:n})=>{D(r=>{const s=d(r),o=s.findIndex(t=>t.clusterId===e);if(-1===o)return s;const i=s[o].namespaces.findIndex(e=>e.name===t.namespace);if(-1===i)return s;if(t.kind&&t.name){const e=s[o].namespaces[i].workloads.findIndex(e=>e.name===t.name&&e.kind===t.kind);if(-1===e)return s;const n="boolean"==typeof a?a:!s[o].namespaces[i].workloads[e].selected;if(s[o].namespaces[i].workloads[e].selected=n,m)if(n){s[o].namespaces[i].workloads.filter(e=>!k(e.kind)).every(e=>e.selected)&&(s[o].namespaces[i].selected=!0)}else s[o].namespaces[i].selected=!1}else if(m){const e="boolean"==typeof n?n:!s[o].namespaces[i].selected;s[o].namespaces[i].selected=e,e?s[o].namespaces[i].workloads.forEach(e=>{k(e.kind)||(e.selected=!0)}):"boolean"!=typeof a||a||s[o].namespaces[i].workloads.forEach(e=>{e.selected=!1})}else{const e="boolean"==typeof a?a:"boolean"!=typeof n||n;s[o].namespaces[i].workloads.forEach(t=>{e&&k(t.kind)||(t.selected=e)})}return s})},[k,m]),A=a(({clusterId:e,namespaceName:t,boolean:a,searchText:n="",searchBy:r="",filters:s})=>{D(o=>{const i=d(o),l=r===R.Namespace?n:"",c=r===R.Source?n:"",u=!!l||!!c||!!s?.showOnlySelected;return i.forEach((n,r)=>{e&&n.clusterId!==e||n.namespaces.forEach(({name:e,workloads:n},o)=>{if(!t||e===t)if(u)if(t){if(n.forEach((e,t)=>{a&&k(e.kind)||we(e,c,s||{showOnlySelected:!1})&&(i[r].namespaces[o].workloads[t].selected=a)}),m){const e=i[r].namespaces[o].workloads.filter(e=>!k(e.kind)).every(e=>e.selected);i[r].namespaces[o].selected=e}}else{if(!Ie(i[r].namespaces[o],l,s||{showOnlySelected:!1}))return;m&&(i[r].namespaces[o].selected=a),n.forEach((e,t)=>{a&&k(e.kind)||(i[r].namespaces[o].workloads[t].selected=a)})}else m&&(i[r].namespaces[o].selected=a),n.forEach((e,t)=>{a&&k(e.kind)||(i[r].namespaces[o].workloads[t].selected=a)})})}),i})},[k,m]);return e(Ne.Provider,{value:{snapshots:v,setSnapshots:b,isFetching:h,setIsFetching:g,formData:y,handleSourceChange:C,handleSelectAll:A,formDiff:E,isFormDirty:S},children:r})},Pe=()=>r(Ne);export{Q as A,X as D,Ae as E,ie as R,de as S,ne as a,ye as b,ke as c,Re as d,Y as e,re as f,le as g,De as h,Ce as i,Pe as j,we as k,Ie as l,Fe as m,W as u};
@@ -0,0 +1,5 @@
1
+ import{useMemo as e,useContext as t,createContext as r,useCallback as a,useState as n,useEffect as o}from"react";import{HttpLink as s,from as i,split as c,ApolloClient as d,InMemoryCache as u,ApolloProvider as l,useLazyQuery as E,useApolloClient as f,useQuery as T,gql as _}from"@apollo/client";import{jsx as S}from"react/jsx-runtime";import{onError as p}from"@apollo/client/link/error";import{setContext as y}from"@apollo/client/link/context";import{getMainDefinition as R}from"@apollo/client/utilities";import{W as m,F as O,p as A,o as I,Z as N,_ as C,E as h,P as g,T as L,h as P,$ as G,a0 as U,a1 as v,a2 as D,a3 as w,a4 as F,a5 as k}from"./ui-components-CrXELmQx.js";const M=e=>{if(!e)return!1;const t=e.toLowerCase();return t.includes("authentication required")||t.includes("authentication expired")||t.includes("http 401")},b=r(null),H=()=>{const e=t(b);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},W=({apolloConfig:t,operations:r,context:a,children:n})=>{const o=e(()=>(e=>{const t=new s({uri:e.httpUrl,credentials:e.credentials??"same-origin"}),r=p(({graphQLErrors:t,networkError:r})=>{t&&t.length>0&&t.some(e=>M(e.message))&&e.onAuthError?.(),r&&(401===r.statusCode||M(r.message))&&e.onAuthError?.()}),a=y(async(t,r)=>{const a={...r.headers};if(e.authHeader){const t=await e.authHeader();Object.assign(a,t)}return e.csrfHeader&&Object.assign(a,e.csrfHeader()),{headers:a}}),n=[];e.additionalLinks?.length&&n.push(...e.additionalLinks),n.push(a,r,t);let o=i(n);e.wsLink&&(o=c(({query:e})=>{const t=R(e);return"OperationDefinition"===t.kind&&"subscription"===t.operation},e.wsLink,o));const l=e.defaultFetchPolicies;return new d({link:o,cache:new u({addTypename:e.addTypename??!0,typePolicies:e.cacheTypePolicies}),defaultOptions:{watchQuery:{fetchPolicy:l?.watchQuery??"cache-and-network"},query:{fetchPolicy:l?.query??"cache-first"},mutate:{fetchPolicy:l?.mutate??"network-only"}}})})(t),[t.httpUrl,t.wsLink,t.addTypename,t.credentials]),E=e(()=>({operations:r,context:a,apolloConfig:t}),[r,a,t]);return S(l,{client:o,children:S(b.Provider,{value:E,children:n})})},Y=b,x=(e,t)=>{if(e)return"string"==typeof e?e:N(e,t)},K=e=>{const{addNotification:t}=m(),r=(r,a,n,o,s)=>t({type:r,title:a,message:n,crdType:e,target:x(o,e),hideFromHistory:s});return{notify:r,notifyError:(e,t,a)=>r(I.Error,e,t,a),notifySuccess:(e,t,a)=>r(I.Success,e,t,a),notifyPending:(e,t)=>r(I.Default,"Pending",e,t,!0),notifyReadonly:()=>{t({type:I.Warning,title:A.READONLY,message:O.READONLY_WARNING,hideFromHistory:!0})}}},V=e=>{e({type:I.Warning,title:A.READONLY,message:O.READONLY_WARNING,hideFromHistory:!0})},$=e=>({error:e,results:[],allSucceeded:!1,anySucceeded:!1,successCount:0,failureCount:0}),B=(e,t)=>{if(e)return"function"==typeof e?e(t):e},j=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)},q=(e,t)=>e.client??t,Q=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(q(t,e),r,a)}catch(e){return{error:j(e)}}const o=B(t.document,a);if(!o)return{error:"Query operation not supported in this context"};const s=t.transformVariables?t.transformVariables(r,a):r,i=q(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?j(e.error):void 0}}catch(e){return{error:j(e)}}},z=async(e,t,r,a)=>{if(!t)return{error:"Mutation operation not configured"};if(t.canRun&&!t.canRun(a))return{data:void 0};if(t.run)try{return await t.run(q(t,e),r,a)}catch(e){return{error:j(e)}}const n=B(t.document,a);if(!n)return{error:"Mutation operation not supported in this context"};const o=t.transformVariables?t.transformVariables(r,a):r,s=q(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:j(e)}}},J=async(e,t,r,a,n)=>{if(!t)return $("Multi fetch operation not configured");if(!r.length)return $("No proxy ids supplied for multi fetch");const o=q(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=j(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,d=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:d.length?d.join(", "):void 0}}const s=await Promise.all(r.map(async r=>{const o={...n,proxyID:r},s=await Q(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,d=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:d.length?d.join(", "):void 0}},X=_`
2
+ query OdigosApiNoop {
3
+ __typename
4
+ }
5
+ `,Z=(e,t)=>{if(e)return"function"==typeof e?e(t):e},ee=(e,t)=>e[t],te=(e,t,r)=>{if(void 0===t)return;return e?.transformResult?e.transformResult(t,r):t},re=(e,t,r)=>{if(!e)return;const a=e.transformVariables;return a?a(t,r):t},ae=(t,r,n)=>{const{operations:o,context:s}=H(),i=ee(o,t),c=e(()=>Z(i?.document,s),[i,s]),d=e(()=>re(i,r,s),[i,r,s]),u=!i||!c,l=!!i?.canRun&&!i.canRun(s),E=n?.skip||u||l,f=T(c??X,{variables:d,skip:E,pollInterval:n?.pollInterval,fetchPolicy:n?.fetchPolicy??"cache-and-network",notifyOnNetworkStatusChange:n?.notifyOnNetworkStatusChange,client:i?.client,onCompleted:n?.onCompleted?e=>{const t=te(i,e,s);void 0!==t&&n.onCompleted(t)}:void 0,onError:n?.onError}),_=e(()=>{if(!E)return te(i,f.data,s)},[i,s,f.data,E]),S=a(async()=>{if(u)return{data:void 0};const e=await f.refetch();return{data:te(i,e.data,s)}},[i,s,f,u]);return{data:_,loading:!E&&f.loading,error:f.error,refetch:S,unsupported:u}},ne=(t,r)=>{const{operations:n,context:o}=H(),s=ee(n,t),i=e(()=>Z(s?.document,o),[s,o]),c=!s||!i,[d,u]=E(i??X,{fetchPolicy:r?.fetchPolicy??"network-only",notifyOnNetworkStatusChange:r?.notifyOnNetworkStatusChange,client:s?.client});return{execute:a(async e=>{if(c)return{error:void 0};if(s?.canRun&&!s.canRun(o))return{data:void 0};const t=re(s,e,o),r=await d({variables:t});return r.error?{error:r.error}:{data:te(s,r.data,o)}},[s,o,d,c]),data:e(()=>te(s,u.data,o),[s,o,u.data]),loading:u.loading,error:u.error,called:u.called,unsupported:c}},oe=(t,r)=>{const{operations:o,context:s}=H(),i=f(),c=ee(o,t),d=e(()=>Z(c?.document,s),[c,s]),u=!c||!d,[l,E]=n({loading:!1,called:!1}),T=a(()=>E({loading:!1,called:!1}),[]);return[a(async e=>{if(u||!d)return{error:void 0};if(c?.canRun&&!c.canRun(s))return{data:void 0};const t=re(c,e,s),a=c?.client??i;E(e=>({...e,loading:!0,called:!0}));try{const e=await a.mutate({mutation:d,variables:t}),n=te(c,e.data,s);if(E({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 E({data:void 0,loading:!1,error:t,called:!0}),r?.onError?.(t),{error:t}}},[c,s,i,d,u,r]),{data:l.data,loading:l.loading,error:l.error,called:l.called,unsupported:u,reset:T}]},se=[],ie=(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,d=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&&d++}a(c,d),o.sources.push(...e)}return{payload:o,isEmpty:n}},ce=(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}},de={filter:{markedForInstrumentation:!0}},ue=[],le=[],Ee=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){}},fe=[],Te=[],_e=e=>{if(!e)return;return{clusters:[e],totalNamespaces:e.namespaces?.length??0,totalWorkloads:(e.namespaces??[]).reduce((e,t)=>e+(t.workloads?.length??0),0),lastUpdated:e.timestamp}},Se=[],pe=[],ye=(e,t)=>({...e,fields:e.fields.filter(({value:e})=>void 0!==e),currentStreamName:t}),Re=()=>{const{operations:t,context:r}=H(),n=f(),s=((e,t)=>{const r=f(),{notifyError:n,notifySuccess:o,notifyPending:s,notifyReadonly:i}=K(h.Source),{selectedStreamName:c}=P(),{setProgress:d,resetProgress:u}=G(),{setConfiguredSources:l,setConfiguredFutureApps:E}=U(),T=(e,t)=>{const{progress:r}=G.getState();e>0&&d(v.Instrumenting,{total:(r[v.Instrumenting]?.total||0)+e,current:r[v.Instrumenting]?.current||0}),t>0&&d(v.Uninstrumenting,{total:(r[v.Uninstrumenting]?.total||0)+t,current:r[v.Uninstrumenting]?.current||0})},_=a(async()=>{const{error:a}=await Q(r,e.GET_WORKLOADS,de,t);a&&n(C.Read,a)},[r,e.GET_WORKLOADS,t,n]);return{useSources:()=>{const e=ae("GET_WORKLOADS",de,{fetchPolicy:"cache-first"});return{items:e.data?.workloads??ue,loading:e.loading,refetch:_}},fetchAll:_,fetchByTargets:async(a,o)=>{const s=!!o?.slim,i=a.map(e=>D(e,h.Source)).filter(e=>e.namespace&&e.name&&e.kind);if(0===i.length)return;if(i.length>50)return void await _();const c=s&&e.GET_WORKLOADS_BY_IDS_SLIM?e.GET_WORKLOADS_BY_IDS_SLIM:e.GET_WORKLOADS_BY_IDS,{error:d}=await Q(r,c,{ids:i.map(({namespace:e,kind:t,name:r})=>({namespace:e,kind:t,name:r}))},t);d?n(C.Read,d):await _()},fetchById:async a=>{const{data:o,error:s}=await Q(r,e.GET_WORKLOADS_BY_IDS,{ids:[{namespace:a.namespace,kind:a.kind,name:a.name}]},t);if(!s)return o?.workloadsByIds?.find(e=>e.id.namespace===a.namespace&&e.id.kind===a.kind&&e.id.name===a.name);n(C.Read,s)},fetchLibraries:async a=>Q(r,e.GET_SOURCE_LIBRARIES,a,t),fetchPeerSources:async a=>Q(r,e.GET_PEER_SOURCES,{serviceName:a},t),usePeerSources:(e,t)=>ae("GET_PEER_SOURCES",e,t),persist:async(a,o)=>{if(t.isReadonly)return i();const{data:d}=await Q(r,e.GET_WORKLOADS,de,t,"cache-first"),f=d?.workloads??ue,{payload:_,isEmpty:S}=ie(a,f,c,T),{payload:p,isEmpty:y}=ce(o,c);let R=!1;S||(R=!0,s("Persisting sources...")),y||R||s("Persisting namespaces...");const{error:m}=await z(r,e.PERSIST_SOURCES,_,t);if(m&&(u(v.Instrumenting),u(v.Uninstrumenting),n(C.Update,m)),e.PERSIST_NAMESPACES){const{error:a}=await z(r,e.PERSIST_NAMESPACES,p,t);a&&n(C.Update,a)}l({}),E({})},persistV2:async a=>{if(t.isReadonly)return i(),{error:"readonly"};const n=[];for(const[,o]of Object.entries(a)){const a={sources:[]},s={namespaces:[]};for(const e of o)e.name&&e.kind?a.sources.push(e):s.namespaces.push(e);if(s.namespaces.length>0&&e.PERSIST_NAMESPACES){const{error:a}=await z(r,e.PERSIST_NAMESPACES,s,t);a&&n.push(a)}if(a.sources.length>0){const{error:o}=await z(r,e.PERSIST_SOURCES,a,t);o&&n.push(o)}}return n.length?{error:n.join(", ")}:void 0},update:async(a,d)=>{if(t.isReadonly)return i();s("Updating source...");const u={sourceId:a,patchSourceRequest:{...d,currentStreamName:c}},{data:l,error:E}=await z(r,e.UPDATE_SOURCE,u,t);E?n(C.Update,E,a):l?.updateK8sActualSource&&o(C.Update,`Successfully updated "${a.name}" source`,a)},restartWorkloads:async a=>{if(t.isReadonly)return i();s("Restarting sources...");const{data:c,error:d}=await z(r,e.RESTART_WORKLOADS,{sourceIds:a},t);d?n(C.Update,d):c?.restartWorkloads&&o(C.Update,`Successfully restarted ${a.length} sources`)},restartPod:async(a,c)=>{if(t.isReadonly)return i();s("Restarting pod...");const{data:d,error:u}=await z(r,e.RESTART_POD,{namespace:a,name:c},t);u?n(C.Update,u):d?.restartPod&&o(C.Update,`Successfully restarted pod ${a}/${c}`)},recoverFromRollback:async a=>{if(t.isReadonly)return i();s("Recovering from rollback...");const{data:c,error:d}=await z(r,e.RECOVER_FROM_ROLLBACK,{sourceId:a},t);d?n(C.Update,d,a):c?.recoverFromRollbackForWorkload&&o(C.Update,"Successfully triggered recovery from rollback")}}})(t,r),i=((e,t)=>{const r=f(),{notifyError:a,notifySuccess:n,notifyReadonly:o}=K(h.Destination),{selectedStreamName:s}=P(),i=async()=>{const{error:n}=await Q(r,e.GET_DESTINATIONS,void 0,t);n&&a(C.Read,n)};return{useDestinations:()=>{const e=ae("GET_DESTINATIONS",void 0,{fetchPolicy:"cache-first"});return{items:e.data?.computePlatform?.destinations??e.data?.destinations??pe,loading:e.loading,refetch:i}},useDestinationCategories:()=>{const e=ae("GET_DESTINATION_CATEGORIES",void 0);return{data:e.data,loading:e.loading}},usePotentialDestinations:()=>{const e=ae("GET_POTENTIAL_DESTINATIONS",void 0);return{data:e.data,loading:e.loading}},fetchAll:i,testConnection:async a=>{const{data:n}=await z(r,e.TEST_DESTINATION_CONNECTION,{destination:ye(a,s)},t);return n},create:async c=>{if(t.isReadonly)return o();const{error:d}=await z(r,e.CREATE_DESTINATION,{destination:ye(c,s)},t);d?a(C.Create,d):(n(C.Create,`Successfully created "${c.type}" destination`),await i())},update:async(c,d)=>{if(t.isReadonly)return o();const{data:u,error:l}=await z(r,e.UPDATE_DESTINATION,{id:c,destination:ye(d,s)},t);l?a(C.Update,l,c):u?.updateDestination&&(n(C.Update,`Successfully updated "${d.type}" destination`,c),await i())},remove:async c=>{if(t.isReadonly)return o();const{data:d}=await Q(r,e.GET_DESTINATIONS,void 0,t,"cache-first"),u=d?.computePlatform?.destinations??d?.destinations??pe,l=u.find(e=>w(e)===c)?.destinationType?.type,{error:E}=await z(r,e.DELETE_DESTINATION,{id:c,currentStreamName:s},t);E?a(C.Delete,E,c):(n(C.Delete,`Successfully deleted "${l??c}" destination`,c),await i())}}})(t,r),c=((e,t)=>{const r=f(),{notifyError:a,notifySuccess:n,notifyReadonly:o}=K(h.Action),s=async()=>{const{error:n}=await Q(r,e.GET_ACTIONS,void 0,t);n&&a(C.Read,n)};return{useActions:()=>{const e=ae("GET_ACTIONS",void 0,{fetchPolicy:"cache-first"});return{items:e.data?.computePlatform?.actions??e.data?.actions??le,loading:e.loading,refetch:s}},fetchAll:s,create:async i=>{if(t.isReadonly)return o();if(!e.CREATE_ACTION)return;const{error:c}=await z(r,e.CREATE_ACTION,{action:i},t);c?a(C.Create,c):(n(C.Create,`Successfully created "${i.type}" action`),await s())},update:async(i,c)=>{if(t.isReadonly)return o();if(!e.UPDATE_ACTION)return;const{error:d}=await z(r,e.UPDATE_ACTION,{id:i,action:c},t);d?a(C.Update,d,i):(n(C.Update,`Successfully updated "${c.type}" action`,i),await s())},remove:async(i,c)=>{if(t.isReadonly)return o();if(!e.DELETE_ACTION)return;const{error:d}=await z(r,e.DELETE_ACTION,{id:i,actionType:c},t);d?a(C.Delete,d,i):(n(C.Delete,`Successfully deleted "${c}" action`,i),await s())}}})(t,r),d=((t,r)=>{const a=f(),{notifyError:n,notifySuccess:o,notifyReadonly:s}=K(h.InstrumentationRule),i=async()=>{const{error:e}=await Q(a,t.GET_INSTRUMENTATION_RULES,void 0,r);e&&n(C.Read,e)};return{useRules:()=>{const t=ae("GET_INSTRUMENTATION_RULES",void 0,{fetchPolicy:"cache-first"});return{items:e(()=>(t.data?.computePlatform?.instrumentationRules??t.data?.instrumentationRules??[]).map(k),[t.data]),loading:t.loading,refetch:i}},fetchAll:i,create:async(e,c)=>{if(r.isReadonly)return s();if(!t.CREATE_INSTRUMENTATION_RULE)return;const{error:d}=await z(a,t.CREATE_INSTRUMENTATION_RULE,{instrumentationRule:F(e)},r);d?n(C.Create,d):(o(C.Create,`Successfully created${c?` "${c}"`:""} rule`),await i())},update:async(e,c,d)=>{if(r.isReadonly)return s();if(!t.UPDATE_INSTRUMENTATION_RULE)return;const{error:u}=await z(a,t.UPDATE_INSTRUMENTATION_RULE,{ruleId:e,instrumentationRule:F(c)},r);u?n(C.Update,u,e):(o(C.Update,`Successfully updated${d?` "${d}"`:""} rule`,e),await i())},remove:async(e,c)=>{if(r.isReadonly)return s();if(!t.DELETE_INSTRUMENTATION_RULE)return;const{error:d}=await z(a,t.DELETE_INSTRUMENTATION_RULE,{ruleId:e},r);d?n(C.Delete,d,e):(o(C.Delete,`Successfully deleted${c?` "${c}"`:""} rule`,e),await i())}}})(t,r),u=((e,t)=>{const r=f(),{addNotification:a}=m(),{setDataStreams:n}=P(),s=(e,t)=>a({type:I.Error,title:e,message:t}),i=async()=>{const{data:a,error:o}=await Q(r,e.GET_DATA_STREAMS,void 0,t);if(o)s(C.Read,o);else if(a){const e=a.computePlatform?.dataStreams??a.dataStreams??[];n(e)}},c=e.CREATE_DATA_STREAM?async n=>{if(t.isReadonly)return V(a);const{error:o}=await z(r,e.CREATE_DATA_STREAM,{stream:n},t);o?s(C.Create,o):await i()}:void 0;return{useDataStreams:()=>{const e=ae("GET_DATA_STREAMS",void 0,{fetchPolicy:"cache-first"}),t=e.data?.computePlatform?.dataStreams??e.data?.dataStreams??Se;return o(()=>{n(t)},[JSON.stringify(t.map(e=>e.name))]),{items:t,loading:e.loading,refetch:i}},fetchAll:i,create:c,update:async(n,o)=>{if(t.isReadonly)return V(a);const{error:c}=await z(r,e.UPDATE_DATA_STREAM,{id:n,dataStream:o},t);c?s(C.Update,c):await i()},remove:async n=>{if(t.isReadonly)return V(a);const{error:o}=await z(r,e.DELETE_DATA_STREAM,{id:n},t);o?s(C.Delete,o):await i()}}})(t,r),l=((e,t)=>{const r=f(),{notifyError:a,notifyReadonly:n}=K(h.Namespace),o=async()=>{const n=await Q(r,e.GET_NAMESPACES_WITH_WORKLOADS,void 0,t);return n.error&&a(C.Read,n.error),n};return{useNamespaces:()=>{const e=ae("GET_NAMESPACES_WITH_WORKLOADS",void 0,{fetchPolicy:"cache-first"});return{items:e.data?.namespaces??Te,loading:e.loading,refetch:o}},fetchAll:o,persist:async o=>{if(t.isReadonly)return n();const{error:s}=await z(r,e.PERSIST_NAMESPACES,o,t);return s&&a(C.Update,s),s?{error:s}:void 0}}})(t,r),E=((e,t)=>{const r=f(),{notifyError:a}=K(h.Source);return{fetch:async n=>{const o=await Q(r,e.GET_K8S_MANIFEST,n,t);return o.error&&a(C.Read,o.error),o}}})(t,r),T=((e,t)=>{const r=f(),{notifyError:a,notifySuccess:n,notifyReadonly:o}=K(h.Source);return{useEffectiveConfig:(e,t)=>ae("GET_EFFECTIVE_CONFIG",e,t),useConfigYamls:e=>ae("GET_CONFIG_YAMLS",void 0,e),getEffectiveConfig:async a=>e.GET_EFFECTIVE_CONFIG?Q(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();const{error:i}=await z(r,e.UPDATE_REMOTE_CONFIG,{formData:n,connectionIds:s},t);return i&&a(C.Update,i),i?{error:i}:void 0}:void 0,getConfigYamls:e.GET_CONFIG_YAMLS?async()=>Q(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 z(r,e.UPDATE_LOCAL_UI_CONFIG,{config:s},t);return i?a(C.Update,i):n(C.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 z(r,e.RESET_LOCAL_UI_CONFIG_TO_FACTORY_DEFAULTS,void 0,t);return s?a(C.Update,s):n(C.Update,"Local UI configuration reset to factory defaults"),s?{error:s}:void 0}:void 0}})(t,r),_=((e,t)=>{const r=f(),{apolloConfig:a}=H();return{fetchDescribeOdigos:e.GET_DESCRIBE_ODIGOS?async()=>Q(r,e.GET_DESCRIBE_ODIGOS,void 0,t):void 0,fetchDescribeSource:e.GET_DESCRIBE_SOURCE?async a=>Q(r,e.GET_DESCRIBE_SOURCE,a,t):void 0,downloadDiagnose:e.GET_DIAGNOSE?async(n,o)=>{const s=await Q(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 Ee(a),s}:void 0}})(t,r),S=((e,t)=>{const r=f(),{notifyError:a,notifyReadonly:n}=K(h.Source),o=async()=>{e.GET_TOKENS&&await Q(r,e.GET_TOKENS,void 0,t)};return{useTokens:()=>{const e=ae("GET_TOKENS",void 0,{fetchPolicy:"cache-first"});return{items:e.data??se,loading:e.loading,refetch:o}},updateToken:e.UPDATE_TOKEN?async o=>{if(t.isReadonly)return n();const{error:s}=await z(r,e.UPDATE_TOKEN,{token:o},t);return s&&a(C.Update,s),s?{error:s}:void 0}:void 0}})(t,r),p=((e,t)=>{const r=f();return{useMetrics:e=>ae("GET_METRICS",void 0,e),fetch:async()=>Q(r,e.GET_METRICS,void 0,t)}})(t,r),y=((e,t)=>{const r=f();return{useServiceMap:e=>ae("GET_SERVICE_MAP",void 0,e),fetch:e.GET_SERVICE_MAP?async()=>Q(r,e.GET_SERVICE_MAP,void 0,t):void 0}})(t,r),R=((e,t)=>{const r=f();return{useSlots:e=>ae("GET_PROFILING_SLOTS",void 0,e),useSourceProfiling:(e,t)=>ae("GET_SOURCE_PROFILING",e,t),fetchSlots:e.GET_PROFILING_SLOTS?async()=>Q(r,e.GET_PROFILING_SLOTS,void 0,t):void 0,fetchSourceProfiling:e.GET_SOURCE_PROFILING?async a=>Q(r,e.GET_SOURCE_PROFILING,a,t):void 0,enableProfiling:e.ENABLE_SOURCE_PROFILING?async a=>z(r,e.ENABLE_SOURCE_PROFILING,a,t):void 0}})(t,r),O=((e,t)=>{const r=f();return{useGatewayInfo:e=>ae("GET_GATEWAY_INFO",void 0,e),useGatewayPods:e=>ae("GET_GATEWAY_PODS",void 0,e),useNodeCollectorInfo:e=>ae("GET_NODE_COLLECTOR_INFO",void 0,e),useNodeCollectorPods:e=>ae("GET_NODE_COLLECTOR_PODS",void 0,e),usePodInfo:(e,t)=>ae("GET_COLLECTOR_POD_INFO",e,t),getGatewayInfo:e.GET_GATEWAY_INFO?async()=>Q(r,e.GET_GATEWAY_INFO,void 0,t):void 0,getGatewayPods:e.GET_GATEWAY_PODS?async()=>Q(r,e.GET_GATEWAY_PODS,void 0,t):void 0,getNodeCollectorInfo:e.GET_NODE_COLLECTOR_INFO?async()=>Q(r,e.GET_NODE_COLLECTOR_INFO,void 0,t):void 0,getNodeCollectorPods:e.GET_NODE_COLLECTOR_PODS?async()=>Q(r,e.GET_NODE_COLLECTOR_PODS,void 0,t):void 0,getExtendedPodInfo:e.GET_COLLECTOR_POD_INFO?async(a,n)=>Q(r,e.GET_COLLECTOR_POD_INFO,{namespace:a,name:n},t):void 0}})(t,r),A=((e,t)=>{const r=f(),{notifyError:a,notifySuccess:n,notifyReadonly:o}=K(h.SamplingRule),s=async()=>{e.GET_SAMPLING_RULES&&await Q(r,e.GET_SAMPLING_RULES,void 0,t)},i=(e,i)=>e?async c=>{if(t.isReadonly)return o();const{error:d}=await z(r,e,c,t);return d?a(i,d):(n(C.Create,"Successfully created sampling rule"),await s()),d?{error:d}:void 0}:void 0,c=(e,i)=>e?async(c,d)=>{if(t.isReadonly)return o();const{error:u}=await z(r,e,{samplingId:d.samplingId,ruleId:c,rule:d.rule},t);return u?a(i,u):(n(C.Update,"Successfully updated sampling rule"),await s()),u?{error:u}:void 0}:void 0,d=e=>e?async(i,c)=>{if(t.isReadonly)return o();const{error:d}=await z(r,e,{samplingId:c,ruleId:i},t);return d?a(C.Delete,d):(n(C.Delete,"Successfully deleted sampling rule"),await s()),d?{error:d}:void 0}:void 0;return{useSamplingRules:()=>{const e=ae("GET_SAMPLING_RULES",void 0,{fetchPolicy:"cache-first"});return{items:e.data?.computePlatform?.samplingRules??e.data?.samplingRules??fe,k8sHealthProbesConfig:e.data?.computePlatform?.k8sHealthProbesConfig??e.data?.k8sHealthProbesConfig??null,loading:e.loading,refetch:s}},fetchAll:e.GET_SAMPLING_RULES?async()=>Q(r,e.GET_SAMPLING_RULES,void 0,t):void 0,createNoisy:i(e.CREATE_NOISY_OPERATION_RULE,C.Create),updateNoisy:c(e.UPDATE_NOISY_OPERATION_RULE,C.Update),deleteNoisy:d(e.DELETE_NOISY_OPERATION_RULE),createHighlyRelevant:i(e.CREATE_HIGHLY_RELEVANT_OPERATION_RULE,C.Create),updateHighlyRelevant:c(e.UPDATE_HIGHLY_RELEVANT_OPERATION_RULE,C.Update),deleteHighlyRelevant:d(e.DELETE_HIGHLY_RELEVANT_OPERATION_RULE),createCostReduction:i(e.CREATE_COST_REDUCTION_RULE,C.Create),updateCostReduction:c(e.UPDATE_COST_REDUCTION_RULE,C.Update),deleteCostReduction:d(e.DELETE_COST_REDUCTION_RULE),updateK8sHealthProbesConfig:e.UPDATE_LOCAL_UI_SAMPLING_CONFIG?async n=>{if(t.isReadonly)return o();const{error:i}=await z(r,e.UPDATE_LOCAL_UI_SAMPLING_CONFIG,{config:{k8sHealthProbesSampling:n}},t);return i?a(C.Update,i):await s(),i?{error:i}:void 0}:void 0}})(t,r),N=((t,r)=>{const n=f();return{useSnapshots:()=>{const t=r.proxyID,n=!!t,o=ae("GET_ALL_CLUSTER_SNAPSHOTS",void 0,{fetchPolicy:"cache-first",skip:n}),s=ae("GET_CLUSTER_SNAPSHOT",t?{clusterId:t}:void 0,{fetchPolicy:"cache-first",skip:!n}),i=e(()=>n?_e(s.data):o.data,[n,s.data,o.data]),c=a(async()=>{if(!n)return o.refetch();const{data:e}=await s.refetch();return{data:_e(e)}},[n,o.refetch,s.refetch]);return{data:i,loading:n?s.loading:o.loading,unsupported:n?s.unsupported:o.unsupported,refetch:c}},getAllClusterSnapshots:t.GET_ALL_CLUSTER_SNAPSHOTS?async()=>Q(n,t.GET_ALL_CLUSTER_SNAPSHOTS,void 0,r):void 0,getClusterSnapshot:t.GET_CLUSTER_SNAPSHOT?async e=>Q(n,t.GET_CLUSTER_SNAPSHOT,{clusterId:e},r):void 0}})(t,r);return{sourcesApi:s,destinationsApi:i,actionsApi:c,instrumentationRulesApi:d,dataStreamsApi:u,namespacesApi:l,k8sManifestApi:E,configApi:T,describeApi:_,tokensApi:S,metricsApi:p,serviceMapApi:y,profilingApi:R,collectorsApi:O,samplingApi:A,snapshotsApi:N,capabilities:e(()=>((e,t)=>{const r=t.platformType===g.Vm,a=t.tier===L.Onprem,n=!r;return{canBulkPersistSources:n&&!!e.PERSIST_SOURCES,canInstrumentNamespaces:n&&!!e.PERSIST_NAMESPACES,canFetchSnapshots:n&&!!e.GET_ALL_CLUSTER_SNAPSHOTS,canRecoverFromRollback:n&&!!e.RECOVER_FROM_ROLLBACK,canRestartWorkloads:n&&!!e.RESTART_WORKLOADS,canFetchPeerSources:!!e.GET_PEER_SOURCES,canFetchSourceLibraries:!!e.GET_SOURCE_LIBRARIES,canFetchK8sManifest:n&&!!e.GET_K8S_MANIFEST,canCreateDestination:n&&!!e.CREATE_DESTINATION,canTestConnection:n&&!!e.TEST_DESTINATION_CONNECTION,canFetchDestinationCategories:!!e.GET_DESTINATION_CATEGORIES,canFetchPotentialDestinations:n&&!!e.GET_POTENTIAL_DESTINATIONS,canCreateAction:n&&!!e.CREATE_ACTION,canCreateInstrumentationRule:n&&!!e.CREATE_INSTRUMENTATION_RULE,canApplyEffectiveConfig:n&&!!e.UPDATE_REMOTE_CONFIG&&!!e.GET_EFFECTIVE_CONFIG,canFetchEffectiveConfig:!!e.GET_EFFECTIVE_CONFIG,canFetchConfigYamls:!!e.GET_CONFIG_YAMLS,canFetchProfiling:n&&!!e.GET_PROFILING_SLOTS,canFetchCollectorInfo:n&&!!e.GET_GATEWAY_INFO,canManageSamplingRules:!!e.GET_SAMPLING_RULES,isEnterprise:a,isVm:r}})(t,r),[t,r]),resetCache:a(async()=>{await n.cache.reset()},[n])}};export{W as O,Y as _,ie as a,oe as b,ae as c,Re as d,H as e,J as f,ce as p,z as r,ne as u};
@@ -15,10 +15,11 @@ export declare const SAMPLING_CATEGORY_NOTES: Record<SamplingCategory, string>;
15
15
  export declare const SAMPLING_CATEGORY_LIST_TITLES: Record<SamplingCategory, string>;
16
16
  export declare const CATEGORY_TO_RULE_CATEGORY: Record<SamplingCategory, SamplingRuleCategory>;
17
17
  export declare const RULE_CATEGORY_TO_CATEGORY: Record<SamplingRuleCategory, SamplingCategory>;
18
- export declare function buildScopeParts(scopes: SourcesScopes | null | undefined): ColoredSpanPart[];
19
- export declare function buildNoisySummary(rule: NoisyOperationRule): ColoredSpanPart[];
20
- export declare function buildHighlyRelevantSummary(rule: HighlyRelevantOperationRule): ColoredSpanPart[];
21
- export declare function buildCostReductionSummary(rule: CostReductionRule): ColoredSpanPart[];
18
+ export type SummaryContext = 'global' | 'source';
19
+ export declare function buildScopeParts(scopes: SourcesScopes | null | undefined, context?: SummaryContext): ColoredSpanPart[];
20
+ export declare function buildNoisySummary(rule: NoisyOperationRule, context?: SummaryContext): ColoredSpanPart[];
21
+ export declare function buildHighlyRelevantSummary(rule: HighlyRelevantOperationRule, context?: SummaryContext): ColoredSpanPart[];
22
+ export declare function buildCostReductionSummary(rule: CostReductionRule, context?: SummaryContext): ColoredSpanPart[];
22
23
  export declare function getHighlyRelevantTypeBadge(rule: HighlyRelevantOperationRule): HighlyRelevantBadgeType;
23
24
  export declare function buildSamplingRuleItems(groups: SamplingRules[], category: SamplingCategory, excludeRuleIds?: Set<string>): SamplingRuleItem[];
24
25
  export declare function buildSummaryForRule(category: SamplingRuleCategory, rule: NoisyOperationRule | HighlyRelevantOperationRule | CostReductionRule): ColoredSpanPart[];
@@ -1,4 +1,4 @@
1
- import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect as o,useMemo as a,useRef as i,useCallback as l,useState as s,Fragment as r,forwardRef as c,useImperativeHandle as d,Children as u,createContext as p,useContext as h,useLayoutEffect as m}from"react";import g,{useTheme as f,css as b,keyframes as v}from"styled-components";import{u as y,n as C,C as S,e as w,f as x,h as k,d as T,b as $,c as I,S as E,j as A,R as N,k as O,l as R,a as D,r as P,o as F,p as L,q as _,s as M,t as z,w as B,x as X,y as V,z as U,A as G,B as H}from"../chunks/helpers-zByTbpzZ.js";import{f as j,a6 as W,a7 as K,V as Y,a8 as J,a9 as q,aa as Z,ab as Q,ac as ee,ad as te,ae as ne,af as oe,b as ae,O as ie,c as le,y as se,B as re,z as ce,L as de,M as ue,ag as pe,ah as he,ai as me,aj as ge,ak as fe,al as be,am as ve,g as ye,N as Ce,an as Se,ao as we,ap as xe,aq as ke,ar as Te,Y as $e,o as Ie,S as Ee,k as Ae,m as Ne,as as Oe,at as Re,au as De,H as Pe,av as Fe,G as Le,J as _e,C as Me,n as ze,R as Be,aw as Xe,ax as Ve,ay as Ue,p as Ge,h as He,az as je,aA as We,aB as Ke,aC as Ye,aD as Je,aE as qe,aF as Ze,aG as Qe,aH as et,aI as tt,aJ as nt,A as ot,aK as at,D as it,aL as lt,aM as st,aN as rt,aO as ct,aP as dt,aQ as ut,e as pt,s as ht,I as mt,E as gt,T as ft,aR as bt,aS as vt,$ as yt,aT as Ct,aU as St,a1 as wt,a3 as xt,aV as kt,aW as Tt,aX as $t,aY as It,aZ as Et,d as At,a_ as Nt,l as Ot,a$ as Rt,b0 as Dt,b1 as Pt,W as Ft,F as Lt,b2 as _t,b3 as Mt,b4 as zt,b5 as Bt,b6 as Xt,b7 as Vt,b8 as Ut,b9 as Gt,ba as Ht,bb as jt,bc as Wt,bd as Kt,be as Yt,U as Jt,Q as qt,bf as Zt,bg as Qt,q as en,r as tn,w as nn,K as on,bh as an,bi as ln,bj as sn,bk as rn,bl as cn,bm as dn,bn as un,bo as pn,bp as hn,bq as mn,br as gn,bs as fn,bt as bn,bu as vn,bv as yn,bw as Cn,bx as Sn,by as wn,bz as xn,bA as kn,bB as Tn,bC as $n,bD as In,bE as En,bF as An,bG as Nn,bH as On,bI as Rn,bJ as Dn,bK as Pn,bL as Fn,bM as Ln,bN as _n,bO as Mn,bP as zn,bQ as Bn,bR as Xn,bS as Vn,bT as Un,bU as Gn,bV as Hn,bW as jn,bX as Wn,bY as Kn,bZ as Yn,b_ as Jn,b$ as qn,c0 as Zn,c1 as Qn,c2 as eo,c3 as to,c4 as no,c5 as oo,c6 as ao,c7 as io,c8 as lo,c9 as so,ca as ro,cb as co,cc as uo,cd as po,ce as ho,cf as mo,cg as go,ch as fo,ci as bo,cj as vo,ck as yo,cl as Co,cm as So,cn as wo,co as xo,cp as ko,cq as To,cr as $o,cs as Io,ct as Eo,cu as Ao,cv as No,cw as Oo,cx as Ro,cy as Do,cz as Po,cA as Fo,cB as Lo,cC as _o,cD as Mo,cE as zo,cF as Bo,cG as Xo,cH as Vo,cI as Uo,cJ as Go,cK as Ho,cL as jo,cM as Wo,cN as Ko,cO as Yo,cP as Jo,cQ as qo,cR as Zo,cS as Qo,cT as ea,cU as ta,cV as na,cW as oa,cX as aa,cY as ia,cZ as la,c_ as sa,c$ as ra,d0 as ca,d1 as da,d2 as ua,d3 as pa,d4 as ha,d5 as ma,d6 as ga,d7 as fa,d8 as ba,d9 as va,da as ya,db as Ca,dc as Sa,x as wa,dd as xa,v as ka,de as Ta,df as $a,dg as Ia,dh as Ea,di as Aa,dj as Na,dk as Oa,dl as Ra,a0 as Da,dm as Pa,dn as Fa,dp as La,dq as _a,dr as Ma,ds as za,dt as Ba,du as Xa,dv as Va,dw as Ua,dx as Ga,dy as Ha,dz as ja,dA as Wa,dB as Ka,dC as Ya,dD as Ja,dE as qa,dF as Za,dG as Qa,dH as ei,dI as ti,dJ as ni,dK as oi,dL as ai,dM as ii}from"../chunks/ui-components-CrXELmQx.js";import{TrashIcon as li,PlusIcon as si,ArrowRightIcon as ri,VSquareIcon as ci,XSquareIcon as di,BookIcon as ui,DeleteIcon as pi,EditIcon as hi,GoLogo as mi,JavaLogo as gi,ChevronRightIcon as fi,ActionIcon as bi,DestinationIcon as vi,ChevronUpIcon as yi,ChevronDownIcon as Ci,VIcon as Si,XIcon as wi,InstrumentationRuleIcon as xi,SourceIcon as ki,NamespacesIcon as Ti,SettingsIcon as $i,PodIcon as Ii,OdigosLogo as Ei,K8sLogo as Ai,RefreshIcon as Ni,ExclamationCircleIcon as Oi,QuestionCircleIcon as Ri,InboundIcon as Di,OutboundIcon as Pi,UserIcon as Fi,TerminalIcon as Li,MinusIcon as _i,SearchIcon as Mi,ExpandIcon as zi,CopyIcon as Bi,DotIcon as Xi,ArrowDownIcon as Vi,DownloadIcon as Ui,RefreshLeftArrowIcon as Gi,VmLogo as Hi,SamplingIcon as ji,ExclamationTriangleIcon as Wi,KeyIcon as Ki,DiagnoseIcon as Yi,StarIcon as Ji,ArrowIcon as qi,ConnectionsIcon as Zi,FilterIcon as Qi,DataStreamIcon as el,PipelineCollectorIcon as tl,ArrowDownSquareIcon as nl,ArrowUpSquareIcon as ol,GatewayIcon as al,YamlIcon as il}from"../icons.js";import{d as ll}from"../chunks/use-odigos-api-UctF_jx_.js";import{S as sl,D as rl,I as cl,a as dl,A as ul,P as pl,b as hl,c as ml,R as gl,O as fl,d as bl,e as vl,f as yl,W as Cl,g as Sl,C as wl,Y as xl,h as kl,i as Tl,U as $l}from"../chunks/index-Bio7SJqx.js";import{O as Il}from"../chunks/connections-scope-CogqbI1K.js";import{u as El,f as Al,g as Nl,e as Ol,i as Rl,h as Dl,S as Pl,k as Fl,E as Ll,l as _l,m as Ml,j as zl,b as Bl,d as Xl,a as Vl,A as Ul,R as Gl,c as Hl,D as jl}from"../chunks/source-instrument-form-context-CowQuxT5.js";import{U as Wl}from"../chunks/consts-D6GCMJ6c.js";import{createPortal as Kl}from"react-dom";import"zustand";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"../chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"virtua";import"@apollo/client";import"@apollo/client/link/error";import"@apollo/client/link/context";import"@apollo/client/utilities";const Yl=[{id:"CREDIT_CARD",label:"Credit card"}],Jl=[{id:j.CollectContainerAttributes,label:"Collect container attributes"},{id:j.CollectReplicaSetAttributes,label:"Collect ReplicaSet attributes"},{id:j.CollectWorkloadId,label:"Collect workload ID"},{id:j.CollectClusterId,label:"Collect cluster ID"}],ql=[{id:Z.Pod,label:Z.Pod},{id:Z.Namespace,label:Z.Namespace},{id:Z.Node,label:Z.Node}],Zl=[{label:"Label key",keyName:"labelKey",placeholder:"app.kubernetes.io/name"},{label:"Attribute key",keyName:"attributeKey",placeholder:"app.kubernetes.name"},{label:"From sources",keyName:"fromSources",placeholder:"pod, namespace",tooltip:"Select multiple sources. Higher precedence sources (pod > namespace > node) will override lower ones.",componentType:"multi-dropdown",options:ql}],Ql=[{label:"Annotation key",keyName:"annotationKey",placeholder:"kubectl.kubernetes.io/restartedAt"},{label:"Attribute key",keyName:"attributeKey",placeholder:"kubectl.kubernetes.restartedAt"},{label:"From sources",keyName:"fromSources",placeholder:"pod, namespace",tooltip:"Select multiple sources. Higher precedence sources (pod > namespace > node) will override lower ones.",componentType:"multi-dropdown",options:ql}],es=/^[a-zA-Z]$/,ts=new Set(["*","+","?"]),ns=new Set(["^","$"]),os={group:"rgba(102, 242, 102, 0.5)","anchor-quantifier":"rgba(102, 191, 255, 0.5)","class-bracket":"rgba(255, 153, 153, 0.5)","class-content":"rgba(178, 1, 1, 0.5)",alternation:"rgba(255, 153, 153, 0.5)",literal:"transparent"},as=g.div`
1
+ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect as o,useMemo as a,useRef as i,useCallback as l,useState as s,Fragment as r,forwardRef as c,useImperativeHandle as d,Children as u,createContext as p,useContext as h,useLayoutEffect as m}from"react";import g,{useTheme as f,css as b,keyframes as v}from"styled-components";import{u as y,n as C,C as S,e as w,f as x,h as k,d as T,b as $,c as I,S as E,j as A,R as N,k as O,l as R,a as D,r as P,o as F,p as L,q as _,s as M,t as z,w as B,x as X,y as V,z as U,A as G,B as H}from"../chunks/helpers-45znEVHP.js";import{f as j,a6 as W,a7 as K,V as Y,a8 as J,a9 as q,aa as Z,ab as Q,ac as ee,ad as te,ae as ne,af as oe,b as ae,O as ie,c as le,y as se,B as re,z as ce,L as de,M as ue,ag as pe,ah as he,ai as me,aj as ge,ak as fe,al as be,am as ve,g as ye,N as Ce,an as Se,ao as we,ap as xe,aq as ke,ar as Te,Y as $e,o as Ie,S as Ee,k as Ae,m as Ne,as as Oe,at as Re,au as De,H as Pe,av as Fe,G as Le,J as _e,C as Me,n as ze,R as Be,aw as Xe,ax as Ve,ay as Ue,p as Ge,h as He,az as je,aA as We,aB as Ke,aC as Ye,aD as Je,aE as qe,aF as Ze,aG as Qe,aH as et,aI as tt,aJ as nt,A as ot,aK as at,D as it,aL as lt,aM as st,aN as rt,aO as ct,aP as dt,aQ as ut,e as pt,s as ht,I as mt,E as gt,T as ft,aR as bt,aS as vt,$ as yt,aT as Ct,aU as St,a1 as wt,a3 as xt,aV as kt,aW as Tt,aX as $t,aY as It,aZ as Et,d as At,a_ as Nt,l as Ot,a$ as Rt,b0 as Dt,b1 as Pt,W as Ft,F as Lt,b2 as _t,b3 as Mt,b4 as zt,b5 as Bt,b6 as Xt,b7 as Vt,b8 as Ut,b9 as Gt,ba as Ht,bb as jt,bc as Wt,bd as Kt,be as Yt,U as Jt,Q as qt,bf as Zt,bg as Qt,q as en,r as tn,w as nn,K as on,bh as an,bi as ln,bj as sn,bk as rn,bl as cn,bm as dn,bn as un,bo as pn,bp as hn,bq as mn,br as gn,bs as fn,bt as bn,bu as vn,bv as yn,bw as Cn,bx as Sn,by as wn,bz as xn,bA as kn,bB as Tn,bC as $n,bD as In,bE as En,bF as An,bG as Nn,bH as On,bI as Rn,bJ as Dn,bK as Pn,bL as Fn,bM as Ln,bN as _n,bO as Mn,bP as zn,bQ as Bn,bR as Xn,bS as Vn,bT as Un,bU as Gn,bV as Hn,bW as jn,bX as Wn,bY as Kn,bZ as Yn,b_ as Jn,b$ as qn,c0 as Zn,c1 as Qn,c2 as eo,c3 as to,c4 as no,c5 as oo,c6 as ao,c7 as io,c8 as lo,c9 as so,ca as ro,cb as co,cc as uo,cd as po,ce as ho,cf as mo,cg as go,ch as fo,ci as bo,cj as vo,ck as yo,cl as Co,cm as So,cn as wo,co as xo,cp as ko,cq as To,cr as $o,cs as Io,ct as Eo,cu as Ao,cv as No,cw as Oo,cx as Ro,cy as Do,cz as Po,cA as Fo,cB as Lo,cC as _o,cD as Mo,cE as zo,cF as Bo,cG as Xo,cH as Vo,cI as Uo,cJ as Go,cK as Ho,cL as jo,cM as Wo,cN as Ko,cO as Yo,cP as Jo,cQ as qo,cR as Zo,cS as Qo,cT as ea,cU as ta,cV as na,cW as oa,cX as aa,cY as ia,cZ as la,c_ as sa,c$ as ra,d0 as ca,d1 as da,d2 as ua,d3 as pa,d4 as ha,d5 as ma,d6 as ga,d7 as fa,d8 as ba,d9 as va,da as ya,db as Ca,dc as Sa,x as wa,dd as xa,v as ka,de as Ta,df as $a,dg as Ia,dh as Ea,di as Aa,dj as Na,dk as Oa,dl as Ra,a0 as Da,dm as Pa,dn as Fa,dp as La,dq as _a,dr as Ma,ds as za,dt as Ba,du as Xa,dv as Va,dw as Ua,dx as Ga,dy as Ha,dz as ja,dA as Wa,dB as Ka,dC as Ya,dD as Ja,dE as qa,dF as Za,dG as Qa,dH as ei,dI as ti,dJ as ni,dK as oi,dL as ai,dM as ii}from"../chunks/ui-components-CrXELmQx.js";import{TrashIcon as li,PlusIcon as si,ArrowRightIcon as ri,VSquareIcon as ci,XSquareIcon as di,BookIcon as ui,DeleteIcon as pi,EditIcon as hi,GoLogo as mi,JavaLogo as gi,ChevronRightIcon as fi,ActionIcon as bi,DestinationIcon as vi,ChevronUpIcon as yi,ChevronDownIcon as Ci,VIcon as Si,XIcon as wi,InstrumentationRuleIcon as xi,SourceIcon as ki,NamespacesIcon as Ti,SettingsIcon as $i,PodIcon as Ii,OdigosLogo as Ei,K8sLogo as Ai,RefreshIcon as Ni,ExclamationCircleIcon as Oi,QuestionCircleIcon as Ri,InboundIcon as Di,OutboundIcon as Pi,UserIcon as Fi,TerminalIcon as Li,MinusIcon as _i,SearchIcon as Mi,ExpandIcon as zi,CopyIcon as Bi,DotIcon as Xi,ArrowDownIcon as Vi,DownloadIcon as Ui,RefreshLeftArrowIcon as Gi,VmLogo as Hi,SamplingIcon as ji,ExclamationTriangleIcon as Wi,KeyIcon as Ki,DiagnoseIcon as Yi,StarIcon as Ji,ArrowIcon as qi,ConnectionsIcon as Zi,FilterIcon as Qi,DataStreamIcon as el,PipelineCollectorIcon as tl,ArrowDownSquareIcon as nl,ArrowUpSquareIcon as ol,GatewayIcon as al,YamlIcon as il}from"../icons.js";import{d as ll}from"../chunks/use-odigos-api-CgkEC7if.js";import{S as sl,D as rl,I as cl,a as dl,A as ul,P as pl,b as hl,c as ml,R as gl,O as fl,d as bl,e as vl,f as yl,W as Cl,g as Sl,C as wl,Y as xl,h as kl,i as Tl,U as $l}from"../chunks/index-D-8Yak_c.js";import{O as Il}from"../chunks/connections-scope-BLrBW0hm.js";import{u as El,f as Al,g as Nl,e as Ol,i as Rl,h as Dl,S as Pl,k as Fl,E as Ll,l as _l,m as Ml,j as zl,b as Bl,d as Xl,a as Vl,A as Ul,R as Gl,c as Hl,D as jl}from"../chunks/source-instrument-form-context-D7wjfWpw.js";import{U as Wl}from"../chunks/consts-D6GCMJ6c.js";import{createPortal as Kl}from"react-dom";import"zustand";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"../chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"virtua";import"@apollo/client";import"@apollo/client/link/error";import"@apollo/client/link/context";import"@apollo/client/utilities";const Yl=[{id:"CREDIT_CARD",label:"Credit card"}],Jl=[{id:j.CollectContainerAttributes,label:"Collect container attributes"},{id:j.CollectReplicaSetAttributes,label:"Collect ReplicaSet attributes"},{id:j.CollectWorkloadId,label:"Collect workload ID"},{id:j.CollectClusterId,label:"Collect cluster ID"}],ql=[{id:Z.Pod,label:Z.Pod},{id:Z.Namespace,label:Z.Namespace},{id:Z.Node,label:Z.Node}],Zl=[{label:"Label key",keyName:"labelKey",placeholder:"app.kubernetes.io/name"},{label:"Attribute key",keyName:"attributeKey",placeholder:"app.kubernetes.name"},{label:"From sources",keyName:"fromSources",placeholder:"pod, namespace",tooltip:"Select multiple sources. Higher precedence sources (pod > namespace > node) will override lower ones.",componentType:"multi-dropdown",options:ql}],Ql=[{label:"Annotation key",keyName:"annotationKey",placeholder:"kubectl.kubernetes.io/restartedAt"},{label:"Attribute key",keyName:"attributeKey",placeholder:"kubectl.kubernetes.restartedAt"},{label:"From sources",keyName:"fromSources",placeholder:"pod, namespace",tooltip:"Select multiple sources. Higher precedence sources (pod > namespace > node) will override lower ones.",componentType:"multi-dropdown",options:ql}],es=/^[a-zA-Z]$/,ts=new Set(["*","+","?"]),ns=new Set(["^","$"]),os={group:"rgba(102, 242, 102, 0.5)","anchor-quantifier":"rgba(102, 191, 255, 0.5)","class-bracket":"rgba(255, 153, 153, 0.5)","class-content":"rgba(178, 1, 1, 0.5)",alternation:"rgba(255, 153, 153, 0.5)",literal:"transparent"},as=g.div`
2
2
  padding: 8px 16px;
3
3
  border-radius: 6px;
4
4
  border: 1px solid ${({theme:e})=>e.v2.colors.silver[500]};
@@ -188,7 +188,7 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
188
188
  ${Rr}:hover & {
189
189
  visibility: visible;
190
190
  }
191
- `,Pr=({clusterId:n,namespaceName:o,checkbox:a,isFutureApps:i,selectedCounts:l,isActive:s,onActive:r,handleSourceChange:c})=>{const{isVm:d}=y(),u=e=>{r(),c({clusterId:n,workloadId:{namespace:o},auto:e.auto,selected:e.all})};return t(Rr,{children:t(ar,{dataId:`namespace-${o}`,withCarret:!0,title:o,isSelected:s,onClick:r,isPartiallyChecked:a.partial,isChecked:a.all,onCheckboxChange:e=>u({auto:e,all:e}),children:e(se,{$gap:12,children:[!d&&t(Dr,{$visible:s||i,children:t(De,{text:Ir,children:t(Q,{label:$r,labelAlign:ee.Left,size:bt.S,value:i,onChange:e=>u({auto:e,all:e||void 0})})})}),e(se,{$gap:8,children:[t(ae,{variant:vt.Span,size:le.XXXS,color:ie.Secondary,align:"right",children:Tr}),t(Be,{label:`${l.sourced}/${l.total}`,status:s?Ie.Default:Ie.Unknown,minWidth:"42px"})]})]})})})},Fr=({withCollapse:e,clusterId:n,clusterName:o,namespaces:i,selectedArea:l,setSelectedArea:s,handleSourceChange:r})=>{const c=a(()=>i.map(({name:e,totalWorkloads:a,selectedCount:i,isAllSourced:c,isSomeSourced:d,isFutureApps:u})=>t(Pr,{clusterId:n,namespaceName:e,isFutureApps:u,checkbox:{all:c||u,partial:d},selectedCounts:{sourced:i,total:a},isActive:l.clusterId===n&&l.namespaceName===e,onActive:()=>s({clusterId:n,clusterName:o,namespaceName:e}),handleSourceChange:r},`${n}#${e}`)),[n,o,i,l]);return e?t(cr,{title:o,list:c,noBgColor:!0}):c},Lr=({onClose:n,onBack:i,onNext:l,selectedConnectionIds:r,setSelectedConnectionIds:c,withOverlay:d,disableAnimation:u})=>{const{isVm:p}=y(),{sourcesApi:h,snapshotsApi:m,namespacesApi:g}=ll(),{data:f,loading:b,refetch:v}=m.useSnapshots(),{items:C,loading:S,refetch:w}=g.useNamespaces(),x=yr(p),{selectedStreamName:k}=He(),{progress:T,resetProgress:$}=yt(),{isFetching:I,setIsFetching:E,setSnapshots:A,formData:N,handleSourceChange:O,handleSelectAll:R,formDiff:D,isFormDirty:P}=zl();o(()=>{v(),w()},[]);const F=a(()=>{if(f)return f;const e=C;return e.length?{clusters:[{clusterId:St,clusterName:Ct,namespaces:e.map(e=>({name:e.name,selected:e.markedForInstrumentation&&e.dataStreamNames.includes(k),workloads:e.workloads?.map(e=>({namespace:e.id.namespace,name:e.id.name,kind:e.id.kind,selected:(e.markedForInstrumentation?.markedForInstrumentation??!1)&&(e.dataStreamNames?.includes(k)??!1)}))||[]}))}]}:null},[f,C,k]);o(()=>{E(b||S),F&&A(F)},[F,b,S,E,A]);const[L,_]=s(""),[M,z]=s(gt.Namespace),[B,X]=s({showOnlySelected:!1}),[V,U]=s({clusterId:"",clusterName:"",namespaceName:""}),G=(({isFetching:n,formData:o,handleSourceChange:i,handleSelectAll:l,selectedArea:s,setSelectedArea:r,searchText:c,searchBy:d,filters:u})=>{const{isVm:p}=y(),h=yr(p),m=a(()=>o.map(e=>{const t=[...e.namespaces].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>_l(e,c,u)).map(e=>({name:e.name,totalWorkloads:e.workloads.length,...Ml(e)}));return{clusterId:e.clusterId,clusterName:e.clusterName,visibleNamespaces:t}}),[o,c,u]),g=a(()=>{let e=!1;for(const{visibleNamespaces:t}of m)for(const{totalWorkloads:n,selectedCount:o}of t)if(e=!0,o!==n)return!1;return e},[m]),{list:f,withFilterCount:b,filteredCount:v,totalCount:C}=a(()=>{const e=m.map(({clusterId:e,clusterName:n,visibleNamespaces:o})=>o.length?t(Fr,{withCollapse:m.length>1,clusterId:e,clusterName:n,namespaces:o,selectedArea:s,setSelectedArea:r,handleSourceChange:i},e):null),n=e.filter(e=>null!==e);return{list:n,withFilterCount:n.length!==e.length,filteredCount:n.length,totalCount:e.length}},[m,s]);return{width:"60%",header:e(se,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(se,{$gap:8,children:[t(ae,{size:le.XS,nowrap:!0,children:h.groupColumnHeader}),t(De,{text:b?Ge.FILTERED_COUNT_TOOLTIP:void 0,children:t(Be,{label:`${b?`${v} / ${C}`:C}`,status:Ie.Unknown})})]}),t(ae,{"data-id":"namespaces-select-all",onClick:()=>l({boolean:!g,searchText:c,searchBy:d,filters:u}),disabled:!f.length,size:le.XS,children:xr(g)})]}),list:f.length?f:n?[t(at,{$height:"100%",children:t(ct,{title:h.fetchingGroups.title,subTitle:h.fetchingGroups.subTitle,withSpinner:!0})},"loading")]:[t(at,{$height:"100%",children:t(Ce,c?{icon:Ti,title:Cr,subTitle:h.noGroupMatchedFilter(c)}:{icon:Ti,title:h.noGroups.title,subTitle:h.noGroups.subTitle})},"no-data")]}})({isFetching:I,formData:N,handleSourceChange:O,handleSelectAll:R,selectedArea:V,setSelectedArea:U,searchText:M===gt.Namespace?L:"",searchBy:M,filters:B}),H=(({formData:n,handleSourceChange:o,handleSelectAll:i,selectedArea:l,searchText:s,searchBy:r,filters:c})=>{const{tier:d,isVm:u}=y(),p=yr(u),h=d===ft.Onprem,m=a(()=>l.value.namespaceName?n.find(({clusterId:e})=>e===l.value.clusterId)?.namespaces.find(({name:e})=>e===l.value.namespaceName):void 0,[n,l.value.clusterId,l.value.namespaceName]),g=a(()=>m?[...m.workloads].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>Fl(e,s,c)):[],[m,s,c]),f=a(()=>!!g.length&&g.every(({selected:e})=>e),[g]),b=a(()=>{if(!m)return[];const{clusterId:e}=l.value,{name:n}=m;return g.map(({name:a,selected:i,kind:l})=>{const s=!u&&!h&&Ll.has(l);return t(Or,{workloadName:a,workloadKind:l,isChecked:!s&&(i||!1),onToggle:()=>o({clusterId:e,workloadId:{namespace:n,name:a,kind:l}}),disabled:s,disabledReason:Er},`${e}#${n}#${a}#${l}`)})},[g,m,l.value.clusterId]),{withFilterCount:v,filteredCount:C,totalCount:S}=a(()=>{const e=m?.workloads.length??0;return{withFilterCount:g.length!==e,filteredCount:g.length,totalCount:e}},[g,m]);return{width:"40%",header:e(se,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(se,{$gap:8,children:[t(ae,{size:le.XS,nowrap:!0,children:l.value.namespaceName?`${l.value.namespaceName} > ${p.itemColumnHeader}`:p.itemColumnHeader}),t(De,{text:v?Ge.FILTERED_COUNT_TOOLTIP:void 0,children:t(Be,{label:`${v?`${C} / ${S}`:S}`,status:Ie.Unknown})})]}),t(ae,{"data-id":"workloads-select-all",onClick:()=>i({clusterId:l.value.clusterId,namespaceName:l.value.namespaceName,boolean:!f,searchText:s,searchBy:r,filters:c}),disabled:!b.length,size:le.XS,children:xr(f)})]}),list:b.length?b:[t(at,{$height:"100%",children:t(Ce,m?s?{icon:ki,title:Cr,subTitle:wr(s)}:{icon:ki,title:Sr,subTitle:p.noItemsInGroupSubTitle}:{icon:ki,title:p.selectGroupPrompt.title,subTitle:p.selectGroupPrompt.subTitle})},"no-data")]}})({formData:N,handleSourceChange:O,handleSelectAll:R,selectedArea:{value:V},searchText:M===gt.Source?L:"",searchBy:M,filters:B});return t(Cl,{isOpen:!0,withOverlay:d,disableAnimation:u,onClose:n?()=>{$(wt.BulkInstrumenting),n()}:void 0,onBack:i?()=>i(D):void 0,onNext:l?()=>l(D):void 0,nextIsSkip:!P,onSave:()=>h.persistV2(D),header:{icon:ki,title:Ge.ADD_SOURCE,subTitle:Ge.ADD_SOURCES_DESCRIPTION},connectionIds:r&&c?{value:r,setValue:c}:void 0,search:{value:L,onChange:e=>{_(e),M===gt.Namespace&&U({clusterId:"",clusterName:"",namespaceName:""})},placeholder:x.searchPlaceholder(M),segment:{options:[{label:x.groupSegmentLabel,value:gt.Namespace},{label:x.itemSegmentLabel,value:gt.Source}],selected:M,setSelected:z}},filters:e(se,{$gap:8,children:[t(ae,{size:le.XXXS,color:ie.Secondary,nowrap:!0,children:kr}),t(Q,{name:"filter-selected",size:bt.S,label:Tr,value:B.showOnlySelected,onChange:e=>X(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:P,isFetching:I,progress:{title:Ge.CREATING_SOURCES,subTitle:Ge.CREATING_SOURCES_SUBTITLE,percentage:T[wt.BulkInstrumenting]?.percentage||0},leftColumn:G,rightColumn:H})},_r=(e,t)=>{const n=[{id:"type",title:Ge.TYPE,label:t.label},{id:"status",title:Ge.STATUS,badge:{status:e.disabled?Ie.Unknown:Ie.Success,label:e.disabled?Ge.DISABLED:Ge.ENABLED}}],o=e.signals?.map(e=>{let t=e.toLowerCase();return t=`${t.charAt(0).toUpperCase()}${t.slice(1)}`,t}).join(", ");return o&&n.push({id:"signals",title:Ge.SIGNALS_FOR_PROCESSING,label:o}),e.name&&n.push({id:"name",title:Ge.NAME,label:e.name}),e.notes&&n.push({id:"notes",title:Ge.NOTES,label:e.notes}),n},Mr=({onClose:i,actionId:r})=>{const c=f(),{actionsApi:d}=ll(),{items:u,refetch:p}=d.useActions(),{selectedOption:h,loadAction:m,validateFormData:g,genericForm:b}=El();o(()=>{p()},[]);const[v,y]=s(!1),[C,S]=s(!1),[w,x]=s(null),k=v&&!!b?.isFormDirty,T=a(()=>u?.find(e=>xt(e)===r),[r,u]),$=a(()=>ot.find(({type:e})=>e===T?.type)??null,[T?.type]);o(()=>{T&&m(T)},[T]);const I=l(()=>{T&&y(!0)},[T]),E=l(()=>{T&&(m(T),y(!1))},[T,m]),A=l(()=>{k?x("close"):i()},[k,i]),N=l(()=>{k?x("cancel"):E()},[k,E]),O=l(()=>{const e=w;x(null),"close"===e?(E(),i()):E()},[w,E,i]),R=l(async()=>{if(T){const{errorMessage:e,preparedFormData:t}=g();e||(await d.update(T.id,t),y(!1))}},[T,g,d]),D=l(()=>{T&&S(!0)},[T]),P=l(async()=>{T&&(await d.remove(T.id,T.type),i())},[T,d,i]);if(!T||!$)return null;const F=(e=>{const t=[],{type:n,fields:o}=e,a=e=>({status:e?Ie.Success:Ie.Unknown,label:e?"True":"False",invertColors:!0});if(n===ye.K8sAttributes&&(t.push({id:"collectContainerAttributes",title:"Collect Container Attributes",badge:a(o.collectContainerAttributes)}),t.push({id:"collectReplicaSetAttributes",title:"Collect ReplicaSet Attributes",badge:a(o.collectReplicaSetAttributes)}),t.push({id:"collectWorkloadId",title:"Collect Workload ID",badge:a(o.collectWorkloadId)}),t.push({id:"collectClusterId",title:"Collect Cluster ID",badge:a(o.collectClusterId)}),o.labelsAttributes?.forEach(({labelKey:e,attributeKey:n,from:a,fromSources:i},l)=>{const s=i?.length?i.join(", "):a||Z.Pod,r=(o.labelsAttributes?.length??0)>1?`Label #${l+1} `:"Label ";t.push({id:`label-${l}-key`,title:`${r}Key`,label:e}),t.push({id:`label-${l}-attr`,title:`${r}Attribute Key`,label:n}),t.push({id:`label-${l}-from`,title:`${r}From`,label:s})}),o.annotationsAttributes?.forEach(({annotationKey:e,attributeKey:n,from:a,fromSources:i},l)=>{const s=i?.length?i.join(", "):a||Z.Pod,r=(o.annotationsAttributes?.length??0)>1?`Annotation #${l+1} `:"Annotation ";t.push({id:`annotation-${l}-key`,title:`${r}Key`,label:e}),t.push({id:`annotation-${l}-attr`,title:`${r}Attribute Key`,label:n}),t.push({id:`annotation-${l}-from`,title:`${r}From`,label:s})})),n===ye.AddClusterInfo&&(t.push({id:"overwriteExistingValues",title:"Overwrite Existing Values",badge:a(o.overwriteExistingValues)}),o.clusterAttributes?.forEach(({attributeName:e,attributeStringValue:n},o)=>{t.push({id:`cluster-attr-${o}`,title:e,label:n})})),n===ye.DeleteAttributes&&o.attributeNamesToDelete?.forEach((e,n)=>{t.push({id:`del-attr-${n}`,title:"Attribute"+((o.attributeNamesToDelete?.length??0)>1?` #${n+1}`:""),label:e})}),n===ye.RenameAttributes&&Object.entries(o.renames||{}).forEach(([e,n],o)=>{t.push({id:`rename-${o}`,title:e,label:n})}),n===ye.PiiMasking&&o.piiCategories?.forEach((e,n)=>{t.push({id:`pii-${n}`,title:"Category"+((o.piiCategories?.length??0)>1?` #${n+1}`:""),label:e})}),n===ye.ExtractAttribute){const e=o.extractAttribute?.extractions??[];e.forEach(({targetAttributeName:n,lookupKey:o,dataFormat:a,regex:i},l)=>{const s=e.length>1?`Extraction #${l+1} `:"Extraction ";t.push({id:`extract-${l}-target`,title:`${s}New Attribute Name`,label:n||"-"}),o&&t.push({id:`extract-${l}-lookupKey`,title:`${s}Lookup Key`,label:o}),a&&t.push({id:`extract-${l}-format`,title:`${s}Data Format`,label:a}),i&&t.push({id:`extract-${l}-regex`,title:`${s}Regex`,label:i})})}return n===ye.URLTemplatization&&o.urlTemplatizationRulesGroups?.forEach((e,n)=>{const a=(o.urlTemplatizationRulesGroups?.length??0)>1?`Group #${n+1} `:"Group ";e.filterK8sNamespace&&t.push({id:`group-${n}-ns`,title:`${a}Namespace`,label:e.filterK8sNamespace}),e.workloadFilters?.forEach((o,i)=>{const l=[o.kind,o.name].filter(Boolean).join("/");l&&t.push({id:`group-${n}-wf-${i}`,title:`${a}Workload${(e.workloadFilters?.length??0)>1?` #${i+1}`:""}`,label:l})});const i=e.templatizationRules?.map(e=>e.template).filter(Boolean).join(", ");i&&t.push({id:`group-${n}-templates`,title:`${a}Templates`,label:i}),e.notes&&t.push({id:`group-${n}-notes`,title:`${a}Notes`,label:e.notes})}),t})(T);return e(n,{children:[t(ne,{isOpen:!0,header:{icon:Et(T.type),title:$.label,onClose:A,actions:[{id:"edit-action-btn-edit",label:kt.EDIT,icon:hi,active:v,onClick:I},{id:"edit-action-btn-delete",label:kt.DELETE,icon:li,color:c.v2.colors.red[500],active:C,onClick:D}]},footer:{actions:v?[{"data-id":"edit-action-btn-cancel",label:kt.CANCEL,variant:de.Secondary,onClick:N},{"data-id":"edit-action-btn-save",label:kt.SAVE,variant:de.Primary,onClick:R}]:[]},children:t(Tt,{$padding:"4px 12px 12px",children:v&&h?t(Rs,{}):t(W,{$gap:16,children:e($t,{bgTint:"1000",children:[e($t,{bgTint:"900",children:[t(It,{conditions:T.conditions||[]}),t($t,{bgTint:"800",cellsPerRow:2,items:_r(T,$)})]}),!!F?.length&&t($t,{bgTint:"900",richTitle:{title:"Configuration"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t($t,{bgTint:"800",cellsPerRow:2,items:F})})]})})})}),t(Sl,{target:"action",isOpen:C,onClose:()=>S(!1),onApprove:P}),t(wl,{isOpen:null!==w,onClose:()=>x(null),onApprove:O})]})},zr=({onClose:n,connections:l,selectedConnectionIds:r,setSelectedConnectionIds:c})=>{const{configApi:d}=ll(),[u,p]=s(""),[h,m]=s({showOnlySelected:!1}),g=a(()=>l.filter(e=>{const t=!u||e.name.toLowerCase().includes(u.toLowerCase()),n=!h.showOnlySelected||h.showOnlySelected&&r.includes(e.id);return t&&n}),[l.length,r.length,u,h]),f=e=>{c(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},b=1===r.length?r[0]:void 0,{data:v,loading:y}=d.useEffectiveConfig(b?{id:b}:void 0,{skip:!b}),C=a(()=>{if(b&&v)return{rollout:{automaticRolloutDisabled:v.rollout?.automaticRolloutDisabled??!1}}},[b,v]),{formData:S,handleFormChange:w,areFormValuesEqual:x,resetFormData:k}=At(C||{rollout:{automaticRolloutDisabled:!1}}),T=i(k);T.current=k,o(()=>{C&&T.current(C)},[C]);const $=a(()=>r.length>1||void 0!==C&&!x(C,S),[r.length,C,S]);return t(Cl,{isOpen:!0,onClose:n,onSave:async()=>await(d.applyConfigurations?.(S,r))??void 0,header:{icon:$i,title:"Cluster Configuration"},connectionIds:{value:r,setValue:c},search:{placeholder:"Search by cluster name",value:u,onChange:p},filters:e(se,{$gap:8,children:[t(ae,{size:le.XXXS,color:ie.Secondary,nowrap:!0,children:"Show only:"}),t(Q,{size:bt.S,label:"Selected",value:h.showOnlySelected,onChange:e=>m(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:$,isFetching:y,leftColumn:{width:"35%",header:e(se,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(se,{$gap:8,children:[t(ae,{size:le.XS,children:"Clusters"}),t(Be,{label:g.length,status:Ie.Unknown})]}),e(se,{$gap:8,children:[t(ae,{size:le.XXXS,color:ie.Secondary,align:"right",children:"Selected clusters"}),t(Be,{label:`${r.length}/${g.length}`,status:Ie.Unknown})]})]}),list:g.map(e=>t(ar,{title:e.name,isChecked:r.includes(e.id),onClick:()=>f(e.id),onCheckboxChange:()=>f(e.id)},e.id))},rightColumn:{width:"65%",header:t(ae,{size:le.XS,children:"Configurations"}),list:[t(Q,{label:"Automatic rollout disabled",tooltip:"Odigos automatically triggers a one-time rollout for workloads when instrumenting or uninstrumenting, ensuring that changes are applied without requiring manual intervention. When automatic rollout is disabled, Odigos will not restart workloads, and users will need to manually trigger rollouts after adding or removing sources.",value:S.rollout?.automaticRolloutDisabled||!1,onChange:e=>w("rollout.automaticRolloutDisabled",e)},"automatic-rollout-disabled")]}})},Br=e=>{const t=[{id:"type",title:Ge.TYPE,label:e.destinationType.displayName},{id:"status",title:Ge.STATUS,badge:{status:e.disabled?Ie.Unknown:Ie.Success,label:e.disabled?Ge.DISABLED:Ge.ENABLED}}],n=Ae(e.exportedSignals).map(e=>{let t=e.toLowerCase();return t=`${t.charAt(0).toUpperCase()}${t.slice(1)}`,t}).join(", ");return n&&t.push({id:"monitors",title:Ge.MONITORS,label:n}),e.name&&t.push({id:"name",title:Ge.NAME,label:e.name}),t},Xr=({onClose:r,destinationId:c})=>{const d=f(),{isVm:u}=y(),{destinationsApi:p}=ll(),{selectedStreamName:h}=He(),{items:m,refetch:g}=p.useDestinations(),{data:b,loading:v}=p.useDestinationCategories(),{activeForm:C,loadDestination:S,validateFormData:w,genericForm:x}=Al();o(()=>{g()},[]);const k=i(null),[T,$]=s(!1),[I,E]=s(!1),[A,N]=s(null),O=T&&!!x?.isFormDirty,R=a(()=>Rt(m,h),[m,h]),D=a(()=>R?.find(e=>xt(e)===c),[c,R]),P=b?.destinationCategories?.categories??null;o(()=>{D&&P&&S(D,P)},[D,P]);const F=a(()=>D&&P?Dt(P,D):[],[D,P]),L=l(()=>{D&&$(!0)},[D]),_=l(()=>{D&&P&&(S(D,P),$(!1))},[D,P,S]),M=l(()=>{O?N("close"):r()},[O,r]),z=l(()=>{O?N("cancel"):_()},[O,_]),B=l(()=>{const e=A;N(null),"close"===e?(_(),r()):_()},[A,_,r]),X=l(async()=>{if(D){const{errorMessage:e,preparedFormData:t}=w();e||(await p.update(D.id,Oe(t)),$(!1))}},[D,w,p]),V=l(()=>{D&&E(!0)},[D]),U=l(async()=>{D&&(await p.remove(D.id),r())},[D,p,r]);if(!D)return null;const{icon:G,iconSrc:H}=ut(D.destinationType.type),j=((e,t)=>{const n=[],o=Nt(e,t),a=o.map(e=>({name:e.key,value:e.value})),i=Ae(e.exportedSignals);let l=[];const s=()=>{l.length&&(n.push({kind:"cells",id:`cells-${n.length}`,items:l}),l=[])};return o.forEach(({key:e,name:o,value:r})=>{const c=t.find(t=>t.name===e),{secret:d,componentType:u,componentProperties:p,hideFromReadData:h,customReadDataLabels:m}=c||{};if(h?.length&&Te(h,i,a))return;const{type:g}=ht(p,{type:""}),f=d||"password"===g;if(m?.length)m.forEach(({condition:t,...n},o)=>{t==r&&l.push({id:`${e}-custom-${o}`,title:n.title,label:n.value})});else if(r)if(f)l.push({id:e,title:o,label:new Array(10).fill("•").join("")});else{if(u===Ot.MultiInput){const t=ht(r,null);if(Array.isArray(t)&&t.length)return s(),void n.push({kind:"list",id:e,title:o,items:t.map((t,n)=>({id:`${e}-${n}`,label:String(t)}))})}if(u===Ot.KeyValuePair){const t=ht(r,null);if(Array.isArray(t)&&t.length)return s(),void n.push({kind:"pairs",id:e,title:o,items:t.map((t,n)=>{const o=t&&"object"==typeof t?t:{};return{id:`${e}-${n}`,title:null!=o.key?String(o.key):"",label:null!=o.value?String(o.value):""}})})}l.push({id:e,title:o,label:r})}else l.push({id:e,title:o,label:"-"})}),s(),n})(D,F);return e(n,{children:[t(ne,{isOpen:!0,header:{icon:G,iconSrc:H,title:D.name||D.destinationType.displayName,onClose:M,actions:[{id:"edit-destination-btn-edit",label:kt.EDIT,icon:hi,active:T,onClick:L},{id:"edit-destination-btn-delete",label:kt.DELETE,icon:li,color:d.v2.colors.red[500],active:I,onClick:V}]},footer:{actions:T?[{"data-id":"edit-destination-btn-cancel",label:kt.CANCEL,variant:de.Secondary,onClick:z},...C?.option.testConnectionSupported&&!u?[{"data-id":"edit-destination-btn-test-connection",label:kt.TEST_CONNECTION,variant:de.Secondary,onClick:()=>k.current?.testConnection()}]:[],{"data-id":"edit-destination-btn-save",label:kt.SAVE,variant:de.Primary,onClick:X}]:[]},children:t(Tt,{$padding:"4px 12px 12px",children:v?t(at,{$height:"50vh",children:t(ct,{withSpinner:!0})}):T&&C?t(Fs,{ref:k,isEdit:!0}):t(W,{$gap:16,children:e($t,{bgTint:"1000",children:[e($t,{bgTint:"900",children:[!u&&t(It,{conditions:D.conditions||[]}),t($t,{bgTint:"800",cellsPerRow:2,items:Br(D)})]}),!!j.length&&t($t,{bgTint:"900",richTitle:{title:"Configuration"},withCollapse:!0,collapseIsDefaultOpen:!0,children:j.map(e=>"cells"===e.kind?t($t,{bgTint:"800",cellsPerRow:2,items:e.items},e.id):(e.kind,t($t,{bgTint:"800",richTitle:{title:e.title},cellsPerRow:2,items:e.items},e.id)))})]})})})}),t(Sl,{target:"destination",isOpen:I,onClose:()=>E(!1),onApprove:U}),t(wl,{isOpen:null!==A,onClose:()=>N(null),onApprove:B})]})},Vr=(e,t)=>{const n=[{id:"type",title:Ge.TYPE,label:t.label},{id:"status",title:Ge.STATUS,badge:{status:e.disabled?Ie.Unknown:Ie.Success,label:e.disabled?Ge.DISABLED:Ge.ENABLED}}];return e.ruleName&&n.push({id:"name",title:Ge.NAME,label:e.ruleName}),e.profileName&&n.push({id:"profile",title:Ge.MANAGED_BY_PROFILE,label:e.profileName}),e.notes&&n.push({id:"notes",title:Ge.NOTES,label:e.notes}),n},Ur=({onClose:i,ruleId:r})=>{const c=f(),{addNotification:d}=Ft(),{instrumentationRulesApi:u}=ll(),{items:p,refetch:h}=u.useRules(),{selectedOption:m,loadRule:g,validateFormData:b,genericForm:v}=Nl();o(()=>{h()},[]);const[y,C]=s(!1),[S,w]=s(!1),[x,k]=s(null),T=y&&!!v?.isFormDirty,$=a(()=>p?.find(e=>xt(e)===r),[r,p]),I=a(()=>mt.find(({type:e})=>e===$?.type)??null,[$?.type]);o(()=>{$&&g($)},[$]);const E=l(()=>{if($){if(!$.mutable)return void d({type:Ie.Warning,title:Lt.FORBIDDEN,message:Lt.CANNOT_EDIT_RULE,crdType:gt.InstrumentationRule,target:$.ruleId,hideFromHistory:!0});C(!0)}},[$,d]),A=l(()=>{$&&(g($),C(!1))},[$,g]),N=l(()=>{T?k("close"):i()},[T,i]),O=l(()=>{T?k("cancel"):A()},[T,A]),R=l(()=>{const e=x;k(null),"close"===e?(A(),i()):A()},[x,A,i]),D=l(async()=>{if($){const{errorMessage:e,preparedFormData:t}=b();e||(await u.update($.ruleId,t,$.type),C(!1))}},[$,b,u]),P=l(()=>{if($){if(!$.mutable)return void d({type:Ie.Warning,title:Lt.FORBIDDEN,message:Lt.CANNOT_DELETE_RULE,crdType:gt.InstrumentationRule,target:$.ruleId,hideFromHistory:!0});w(!0)}},[$,d]),F=l(async()=>{$&&(await u.remove($.ruleId,$.type),i())},[$,u,i]);if(!$||!I)return null;const L=((e,n)=>{const o=[];return e.payloadCollection&&Object.entries(e.payloadCollection).forEach(([e,n])=>{n&&o.push(t(ae,{size:le.XS,children:`• ${Pt(e).toLowerCase()}`},`payload-${e}`))}),e.codeAttributes&&Object.entries(e.codeAttributes).forEach(([e,n])=>{n&&o.push(t(ae,{size:le.XS,children:`• ${Pt(e).toLowerCase()}`},`code-${e}`))}),e.headersCollection?.[Pe.HeaderKeys]?.length&&e.headersCollection[Pe.HeaderKeys].forEach((e,n)=>{e&&o.push(t(ae,{size:le.XS,children:e},`header-${n}-${e}`))}),e.customInstrumentations&&(e.customInstrumentations[Me.Java]?.forEach((e,a)=>{const i=new _e(e.className,e.methodName);if(i.Verify()){0===a&&o.push(t(ae,{size:le.XS,children:"Java Custom Probes:"},"java-custom-probes"));const e=i.toString();o.push(t(ae,{size:le.XXS,color:n.v2.colors.grey[200],children:`• ${e}`},`java-probe-${a}-${e}`))}}),e.customInstrumentations[Me.Golang]?.forEach((e,a)=>{const i=new Le(e.packageName,e.functionName,e.receiverName,e.receiverMethodName);if(i.Verify()){0===a&&o.push(t(ae,{size:le.XS,children:"Golang Custom Probes:"},"golang-custom-probes"));const e=i.toString();o.push(t(ae,{size:le.XXS,color:n.v2.colors.grey[200],children:`• ${e}`},`golang-probe-${a}-${e}`))}})),o})($,c);return e(n,{children:[t(ne,{isOpen:!0,header:{icon:Mt($.type),title:I.label,onClose:N,actions:[{id:"edit-rule-btn-edit",label:kt.EDIT,icon:hi,active:y,onClick:E},{id:"edit-rule-btn-delete",label:kt.DELETE,icon:li,color:c.v2.colors.red[500],active:S,onClick:P}]},footer:{actions:y?[{"data-id":"edit-rule-btn-cancel",label:kt.CANCEL,variant:de.Secondary,onClick:O},{"data-id":"edit-rule-btn-save",label:kt.SAVE,variant:de.Primary,onClick:D}]:[]},children:t(Tt,{$padding:"4px 12px 12px",children:y&&m?t(Us,{}):t(W,{$gap:16,children:e($t,{bgTint:"1000",children:[e($t,{bgTint:"900",children:[t(It,{conditions:$.conditions||[]}),t($t,{bgTint:"800",cellsPerRow:2,items:Vr($,I)})]}),t(dl,{readOnly:!0,scopes:$.sourceScopes??null}),!!L.length&&t($t,{bgTint:"900",richTitle:{title:"Collect"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t($t,{bgTint:"800",children:L})}),!!I.supportedLanguages.length&&t($t,{bgTint:"900",richTitle:{title:"Supported languages"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t($t,{bgTint:"800",children:t(se,{$gap:12,$wrap:"wrap",children:I.supportedLanguages.map(e=>t(_t,{label:Xe[e],leftIcon:Ve(e),flex:"0.5"},e))})})})]})})})}),t(Sl,{target:"instrumentation rule",isOpen:S,onClose:()=>w(!1),onApprove:F}),t(wl,{isOpen:null!==x,onClose:()=>k(null),onApprove:R})]})};var Gr;!function(e){e.Overview="overview",e.Pods="pods",e.PeerSources="peer-sources",e.Profiling="profiling",e.Sampling="sampling",e.Debug="debug"}(Gr||(Gr={}));const Hr=({collapseIsDefaultOpen:e,isJumpToTarget:n,onClickRestartPod:o,namespace:i,podName:l,nodeName:s,startTime:r,agentInjectedStatus:c,odigosHealthStatus:d,k8sHealthStatus:u,children:p})=>{const{formatDurationAgo:h}=zt(),m=Bt(!!n),g=a(()=>({title:l,icon:Ii,withCopy:!0}),[l]),f=a(()=>{const e=[],t=Xt(c);t&&e.push(t);const n=Xt(d,Ei,"health");n&&e.push(n);const o=Xt(u,Ai,"health");return o&&e.push(o),e},[c,d,u]),b=a(()=>o?[{id:`restart-pod-${l}`,icon:Ni,label:kt.RESTART_POD,onClick:()=>o(i,l)}]:void 0,[o,i,l]),v=a(()=>[{id:"nodeName",title:Ge.NODE,label:s,withCopy:!0},{id:"age",title:Ge.AGE,label:r?h(r,{style:"short"}):Ge.NOT_RUNNING,labelTooltip:r}],[s,r,h]);return t("div",{ref:m,children:t($t,{bgTint:"900",richTitle:g,badges:f,dropDataActions:b,items:v,withCollapse:!0,collapseIsDefaultOpen:e,children:p})})},jr=g.div`
191
+ `,Pr=({clusterId:n,namespaceName:o,checkbox:a,isFutureApps:i,selectedCounts:l,isActive:s,onActive:r,handleSourceChange:c})=>{const{isVm:d}=y(),u=e=>{r(),c({clusterId:n,workloadId:{namespace:o},auto:e.auto,selected:e.all})};return t(Rr,{children:t(ar,{dataId:`namespace-${o}`,withCarret:!0,title:o,isSelected:s,onClick:r,isPartiallyChecked:a.partial,isChecked:a.all,onCheckboxChange:e=>u({auto:e,all:e}),children:e(se,{$gap:12,children:[!d&&t(Dr,{$visible:s||i,children:t(De,{text:Ir,children:t(Q,{label:$r,labelAlign:ee.Left,size:bt.S,value:i,onChange:e=>u({auto:e,all:e||void 0})})})}),e(se,{$gap:8,children:[t(ae,{variant:vt.Span,size:le.XXXS,color:ie.Secondary,align:"right",children:Tr}),t(Be,{label:`${l.sourced}/${l.total}`,status:s?Ie.Default:Ie.Unknown,minWidth:"42px"})]})]})})})},Fr=({withCollapse:e,clusterId:n,clusterName:o,namespaces:i,selectedArea:l,setSelectedArea:s,handleSourceChange:r})=>{const c=a(()=>i.map(({name:e,totalWorkloads:a,selectedCount:i,isAllSourced:c,isSomeSourced:d,isFutureApps:u})=>t(Pr,{clusterId:n,namespaceName:e,isFutureApps:u,checkbox:{all:c||u,partial:d},selectedCounts:{sourced:i,total:a},isActive:l.clusterId===n&&l.namespaceName===e,onActive:()=>s({clusterId:n,clusterName:o,namespaceName:e}),handleSourceChange:r},`${n}#${e}`)),[n,o,i,l]);return e?t(cr,{title:o,list:c,noBgColor:!0}):c},Lr=({onClose:n,onBack:i,onNext:l,selectedConnectionIds:r,setSelectedConnectionIds:c,withOverlay:d,disableAnimation:u})=>{const{isVm:p}=y(),{sourcesApi:h,snapshotsApi:m,namespacesApi:g}=ll(),{data:f,loading:b,refetch:v}=m.useSnapshots(),{items:C,loading:S,refetch:w}=g.useNamespaces(),x=yr(p),{selectedStreamName:k}=He(),{progress:T,resetProgress:$}=yt(),{isFetching:I,setIsFetching:E,setSnapshots:A,formData:N,handleSourceChange:O,handleSelectAll:R,formDiff:D,isFormDirty:P}=zl();o(()=>{v(),w()},[]);const F=a(()=>{if(f)return f;const e=C;return e.length?{clusters:[{clusterId:St,clusterName:Ct,namespaces:e.map(e=>({name:e.name,selected:e.markedForInstrumentation&&e.dataStreamNames.includes(k),workloads:e.workloads?.map(e=>({namespace:e.id.namespace,name:e.id.name,kind:e.id.kind,selected:(e.markedForInstrumentation?.markedForInstrumentation??!1)&&(e.dataStreamNames?.includes(k)??!1)}))||[]}))}]}:null},[f,C,k]);o(()=>{E(b||S),F&&A(F)},[F,b,S,E,A]);const[L,_]=s(""),[M,z]=s(gt.Namespace),[B,X]=s({showOnlySelected:!1}),[V,U]=s({clusterId:"",clusterName:"",namespaceName:""}),G=(({isFetching:n,formData:o,handleSourceChange:i,handleSelectAll:l,selectedArea:s,setSelectedArea:r,searchText:c,searchBy:d,filters:u})=>{const{isVm:p}=y(),h=yr(p),m=a(()=>o.map(e=>{const t=[...e.namespaces].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>_l(e,c,u)).map(e=>({name:e.name,totalWorkloads:e.workloads.length,...Ml(e)}));return{clusterId:e.clusterId,clusterName:e.clusterName,visibleNamespaces:t}}),[o,c,u]),g=a(()=>{let e=!1;for(const{visibleNamespaces:t}of m)for(const{totalWorkloads:n,selectedCount:o}of t)if(e=!0,o!==n)return!1;return e},[m]),{list:f,withFilterCount:b,filteredCount:v,totalCount:C}=a(()=>{const e=m.map(({clusterId:e,clusterName:n,visibleNamespaces:o})=>o.length?t(Fr,{withCollapse:m.length>1,clusterId:e,clusterName:n,namespaces:o,selectedArea:s,setSelectedArea:r,handleSourceChange:i},e):null).filter(e=>null!==e),n=m.reduce((e,{visibleNamespaces:t})=>e+t.length,0),a=o.reduce((e,{namespaces:t})=>e+t.length,0);return{list:e,withFilterCount:n!==a,filteredCount:n,totalCount:a}},[m,o,s]);return{width:"60%",header:e(se,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(se,{$gap:8,children:[t(ae,{size:le.XS,nowrap:!0,children:h.groupColumnHeader}),t(De,{text:b?Ge.FILTERED_COUNT_TOOLTIP:void 0,children:t(Be,{label:`${b?`${v} / ${C}`:C}`,status:Ie.Unknown})})]}),t(ae,{"data-id":"namespaces-select-all",onClick:()=>l({boolean:!g,searchText:c,searchBy:d,filters:u}),disabled:!f.length,size:le.XS,children:xr(g)})]}),list:f.length?f:n?[t(at,{$height:"100%",children:t(ct,{title:h.fetchingGroups.title,subTitle:h.fetchingGroups.subTitle,withSpinner:!0})},"loading")]:[t(at,{$height:"100%",children:t(Ce,c?{icon:Ti,title:Cr,subTitle:h.noGroupMatchedFilter(c)}:{icon:Ti,title:h.noGroups.title,subTitle:h.noGroups.subTitle})},"no-data")]}})({isFetching:I,formData:N,handleSourceChange:O,handleSelectAll:R,selectedArea:V,setSelectedArea:U,searchText:M===gt.Namespace?L:"",searchBy:M,filters:B}),H=(({formData:n,handleSourceChange:o,handleSelectAll:i,selectedArea:l,searchText:s,searchBy:r,filters:c})=>{const{tier:d,isVm:u}=y(),p=yr(u),h=d===ft.Onprem,m=a(()=>l.value.namespaceName?n.find(({clusterId:e})=>e===l.value.clusterId)?.namespaces.find(({name:e})=>e===l.value.namespaceName):void 0,[n,l.value.clusterId,l.value.namespaceName]),g=a(()=>m?[...m.workloads].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>Fl(e,s,c)):[],[m,s,c]),f=a(()=>!!g.length&&g.every(({selected:e})=>e),[g]),b=a(()=>{if(!m)return[];const{clusterId:e}=l.value,{name:n}=m;return g.map(({name:a,selected:i,kind:l})=>{const s=!u&&!h&&Ll.has(l);return t(Or,{workloadName:a,workloadKind:l,isChecked:!s&&(i||!1),onToggle:()=>o({clusterId:e,workloadId:{namespace:n,name:a,kind:l}}),disabled:s,disabledReason:Er},`${e}#${n}#${a}#${l}`)})},[g,m,l.value.clusterId]),{withFilterCount:v,filteredCount:C,totalCount:S}=a(()=>{const e=m?.workloads.length??0;return{withFilterCount:g.length!==e,filteredCount:g.length,totalCount:e}},[g,m]);return{width:"40%",header:e(se,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(se,{$gap:8,children:[t(ae,{size:le.XS,nowrap:!0,children:l.value.namespaceName?`${l.value.namespaceName} > ${p.itemColumnHeader}`:p.itemColumnHeader}),t(De,{text:v?Ge.FILTERED_COUNT_TOOLTIP:void 0,children:t(Be,{label:`${v?`${C} / ${S}`:S}`,status:Ie.Unknown})})]}),t(ae,{"data-id":"workloads-select-all",onClick:()=>i({clusterId:l.value.clusterId,namespaceName:l.value.namespaceName,boolean:!f,searchText:s,searchBy:r,filters:c}),disabled:!b.length,size:le.XS,children:xr(f)})]}),list:b.length?b:[t(at,{$height:"100%",children:t(Ce,m?s?{icon:ki,title:Cr,subTitle:wr(s)}:{icon:ki,title:Sr,subTitle:p.noItemsInGroupSubTitle}:{icon:ki,title:p.selectGroupPrompt.title,subTitle:p.selectGroupPrompt.subTitle})},"no-data")]}})({formData:N,handleSourceChange:O,handleSelectAll:R,selectedArea:{value:V},searchText:M===gt.Source?L:"",searchBy:M,filters:B});return t(Cl,{isOpen:!0,withOverlay:d,disableAnimation:u,onClose:n?()=>{$(wt.BulkInstrumenting),n()}:void 0,onBack:i?()=>i(D):void 0,onNext:l?()=>l(D):void 0,nextIsSkip:!P,onSave:()=>h.persistV2(D),header:{icon:ki,title:Ge.ADD_SOURCE,subTitle:Ge.ADD_SOURCES_DESCRIPTION},connectionIds:r&&c?{value:r,setValue:c}:void 0,search:{value:L,onChange:e=>{_(e),M===gt.Namespace&&U({clusterId:"",clusterName:"",namespaceName:""})},placeholder:x.searchPlaceholder(M),segment:{options:[{label:x.groupSegmentLabel,value:gt.Namespace},{label:x.itemSegmentLabel,value:gt.Source}],selected:M,setSelected:z}},filters:e(se,{$gap:8,children:[t(ae,{size:le.XXXS,color:ie.Secondary,nowrap:!0,children:kr}),t(Q,{name:"filter-selected",size:bt.S,label:Tr,value:B.showOnlySelected,onChange:e=>X(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:P,isFetching:I,progress:{title:Ge.CREATING_SOURCES,subTitle:Ge.CREATING_SOURCES_SUBTITLE,percentage:T[wt.BulkInstrumenting]?.percentage||0},leftColumn:G,rightColumn:H})},_r=(e,t)=>{const n=[{id:"type",title:Ge.TYPE,label:t.label},{id:"status",title:Ge.STATUS,badge:{status:e.disabled?Ie.Unknown:Ie.Success,label:e.disabled?Ge.DISABLED:Ge.ENABLED}}],o=e.signals?.map(e=>{let t=e.toLowerCase();return t=`${t.charAt(0).toUpperCase()}${t.slice(1)}`,t}).join(", ");return o&&n.push({id:"signals",title:Ge.SIGNALS_FOR_PROCESSING,label:o}),e.name&&n.push({id:"name",title:Ge.NAME,label:e.name}),e.notes&&n.push({id:"notes",title:Ge.NOTES,label:e.notes}),n},Mr=({onClose:i,actionId:r})=>{const c=f(),{actionsApi:d}=ll(),{items:u,refetch:p}=d.useActions(),{selectedOption:h,loadAction:m,validateFormData:g,genericForm:b}=El();o(()=>{p()},[]);const[v,y]=s(!1),[C,S]=s(!1),[w,x]=s(null),k=v&&!!b?.isFormDirty,T=a(()=>u?.find(e=>xt(e)===r),[r,u]),$=a(()=>ot.find(({type:e})=>e===T?.type)??null,[T?.type]);o(()=>{T&&m(T)},[T]);const I=l(()=>{T&&y(!0)},[T]),E=l(()=>{T&&(m(T),y(!1))},[T,m]),A=l(()=>{k?x("close"):i()},[k,i]),N=l(()=>{k?x("cancel"):E()},[k,E]),O=l(()=>{const e=w;x(null),"close"===e?(E(),i()):E()},[w,E,i]),R=l(async()=>{if(T){const{errorMessage:e,preparedFormData:t}=g();e||(await d.update(T.id,t),y(!1))}},[T,g,d]),D=l(()=>{T&&S(!0)},[T]),P=l(async()=>{T&&(await d.remove(T.id,T.type),i())},[T,d,i]);if(!T||!$)return null;const F=(e=>{const t=[],{type:n,fields:o}=e,a=e=>({status:e?Ie.Success:Ie.Unknown,label:e?"True":"False",invertColors:!0});if(n===ye.K8sAttributes&&(t.push({id:"collectContainerAttributes",title:"Collect Container Attributes",badge:a(o.collectContainerAttributes)}),t.push({id:"collectReplicaSetAttributes",title:"Collect ReplicaSet Attributes",badge:a(o.collectReplicaSetAttributes)}),t.push({id:"collectWorkloadId",title:"Collect Workload ID",badge:a(o.collectWorkloadId)}),t.push({id:"collectClusterId",title:"Collect Cluster ID",badge:a(o.collectClusterId)}),o.labelsAttributes?.forEach(({labelKey:e,attributeKey:n,from:a,fromSources:i},l)=>{const s=i?.length?i.join(", "):a||Z.Pod,r=(o.labelsAttributes?.length??0)>1?`Label #${l+1} `:"Label ";t.push({id:`label-${l}-key`,title:`${r}Key`,label:e}),t.push({id:`label-${l}-attr`,title:`${r}Attribute Key`,label:n}),t.push({id:`label-${l}-from`,title:`${r}From`,label:s})}),o.annotationsAttributes?.forEach(({annotationKey:e,attributeKey:n,from:a,fromSources:i},l)=>{const s=i?.length?i.join(", "):a||Z.Pod,r=(o.annotationsAttributes?.length??0)>1?`Annotation #${l+1} `:"Annotation ";t.push({id:`annotation-${l}-key`,title:`${r}Key`,label:e}),t.push({id:`annotation-${l}-attr`,title:`${r}Attribute Key`,label:n}),t.push({id:`annotation-${l}-from`,title:`${r}From`,label:s})})),n===ye.AddClusterInfo&&(t.push({id:"overwriteExistingValues",title:"Overwrite Existing Values",badge:a(o.overwriteExistingValues)}),o.clusterAttributes?.forEach(({attributeName:e,attributeStringValue:n},o)=>{t.push({id:`cluster-attr-${o}`,title:e,label:n})})),n===ye.DeleteAttributes&&o.attributeNamesToDelete?.forEach((e,n)=>{t.push({id:`del-attr-${n}`,title:"Attribute"+((o.attributeNamesToDelete?.length??0)>1?` #${n+1}`:""),label:e})}),n===ye.RenameAttributes&&Object.entries(o.renames||{}).forEach(([e,n],o)=>{t.push({id:`rename-${o}`,title:e,label:n})}),n===ye.PiiMasking&&o.piiCategories?.forEach((e,n)=>{t.push({id:`pii-${n}`,title:"Category"+((o.piiCategories?.length??0)>1?` #${n+1}`:""),label:e})}),n===ye.ExtractAttribute){const e=o.extractAttribute?.extractions??[];e.forEach(({targetAttributeName:n,lookupKey:o,dataFormat:a,regex:i},l)=>{const s=e.length>1?`Extraction #${l+1} `:"Extraction ";t.push({id:`extract-${l}-target`,title:`${s}New Attribute Name`,label:n||"-"}),o&&t.push({id:`extract-${l}-lookupKey`,title:`${s}Lookup Key`,label:o}),a&&t.push({id:`extract-${l}-format`,title:`${s}Data Format`,label:a}),i&&t.push({id:`extract-${l}-regex`,title:`${s}Regex`,label:i})})}return n===ye.URLTemplatization&&o.urlTemplatizationRulesGroups?.forEach((e,n)=>{const a=(o.urlTemplatizationRulesGroups?.length??0)>1?`Group #${n+1} `:"Group ";e.filterK8sNamespace&&t.push({id:`group-${n}-ns`,title:`${a}Namespace`,label:e.filterK8sNamespace}),e.workloadFilters?.forEach((o,i)=>{const l=[o.kind,o.name].filter(Boolean).join("/");l&&t.push({id:`group-${n}-wf-${i}`,title:`${a}Workload${(e.workloadFilters?.length??0)>1?` #${i+1}`:""}`,label:l})});const i=e.templatizationRules?.map(e=>e.template).filter(Boolean).join(", ");i&&t.push({id:`group-${n}-templates`,title:`${a}Templates`,label:i}),e.notes&&t.push({id:`group-${n}-notes`,title:`${a}Notes`,label:e.notes})}),t})(T);return e(n,{children:[t(ne,{isOpen:!0,header:{icon:Et(T.type),title:$.label,onClose:A,actions:[{id:"edit-action-btn-edit",label:kt.EDIT,icon:hi,active:v,onClick:I},{id:"edit-action-btn-delete",label:kt.DELETE,icon:li,color:c.v2.colors.red[500],active:C,onClick:D}]},footer:{actions:v?[{"data-id":"edit-action-btn-cancel",label:kt.CANCEL,variant:de.Secondary,onClick:N},{"data-id":"edit-action-btn-save",label:kt.SAVE,variant:de.Primary,onClick:R}]:[]},children:t(Tt,{$padding:"4px 12px 12px",children:v&&h?t(Rs,{}):t(W,{$gap:16,children:e($t,{bgTint:"1000",children:[e($t,{bgTint:"900",children:[t(It,{conditions:T.conditions||[]}),t($t,{bgTint:"800",cellsPerRow:2,items:_r(T,$)})]}),!!F?.length&&t($t,{bgTint:"900",richTitle:{title:"Configuration"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t($t,{bgTint:"800",cellsPerRow:2,items:F})})]})})})}),t(Sl,{target:"action",isOpen:C,onClose:()=>S(!1),onApprove:P}),t(wl,{isOpen:null!==w,onClose:()=>x(null),onApprove:O})]})},zr=({onClose:n,connections:l,selectedConnectionIds:r,setSelectedConnectionIds:c})=>{const{configApi:d}=ll(),[u,p]=s(""),[h,m]=s({showOnlySelected:!1}),g=a(()=>l.filter(e=>{const t=!u||e.name.toLowerCase().includes(u.toLowerCase()),n=!h.showOnlySelected||h.showOnlySelected&&r.includes(e.id);return t&&n}),[l.length,r.length,u,h]),f=e=>{c(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},b=1===r.length?r[0]:void 0,{data:v,loading:y}=d.useEffectiveConfig(b?{id:b}:void 0,{skip:!b}),C=a(()=>{if(b&&v)return{rollout:{automaticRolloutDisabled:v.rollout?.automaticRolloutDisabled??!1}}},[b,v]),{formData:S,handleFormChange:w,areFormValuesEqual:x,resetFormData:k}=At(C||{rollout:{automaticRolloutDisabled:!1}}),T=i(k);T.current=k,o(()=>{C&&T.current(C)},[C]);const $=a(()=>r.length>1||void 0!==C&&!x(C,S),[r.length,C,S]);return t(Cl,{isOpen:!0,onClose:n,onSave:async()=>await(d.applyConfigurations?.(S,r))??void 0,header:{icon:$i,title:"Cluster Configuration"},connectionIds:{value:r,setValue:c},search:{placeholder:"Search by cluster name",value:u,onChange:p},filters:e(se,{$gap:8,children:[t(ae,{size:le.XXXS,color:ie.Secondary,nowrap:!0,children:"Show only:"}),t(Q,{size:bt.S,label:"Selected",value:h.showOnlySelected,onChange:e=>m(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:$,isFetching:y,leftColumn:{width:"35%",header:e(se,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(se,{$gap:8,children:[t(ae,{size:le.XS,children:"Clusters"}),t(Be,{label:g.length,status:Ie.Unknown})]}),e(se,{$gap:8,children:[t(ae,{size:le.XXXS,color:ie.Secondary,align:"right",children:"Selected clusters"}),t(Be,{label:`${r.length}/${g.length}`,status:Ie.Unknown})]})]}),list:g.map(e=>t(ar,{title:e.name,isChecked:r.includes(e.id),onClick:()=>f(e.id),onCheckboxChange:()=>f(e.id)},e.id))},rightColumn:{width:"65%",header:t(ae,{size:le.XS,children:"Configurations"}),list:[t(Q,{label:"Automatic rollout disabled",tooltip:"Odigos automatically triggers a one-time rollout for workloads when instrumenting or uninstrumenting, ensuring that changes are applied without requiring manual intervention. When automatic rollout is disabled, Odigos will not restart workloads, and users will need to manually trigger rollouts after adding or removing sources.",value:S.rollout?.automaticRolloutDisabled||!1,onChange:e=>w("rollout.automaticRolloutDisabled",e)},"automatic-rollout-disabled")]}})},Br=e=>{const t=[{id:"type",title:Ge.TYPE,label:e.destinationType.displayName},{id:"status",title:Ge.STATUS,badge:{status:e.disabled?Ie.Unknown:Ie.Success,label:e.disabled?Ge.DISABLED:Ge.ENABLED}}],n=Ae(e.exportedSignals).map(e=>{let t=e.toLowerCase();return t=`${t.charAt(0).toUpperCase()}${t.slice(1)}`,t}).join(", ");return n&&t.push({id:"monitors",title:Ge.MONITORS,label:n}),e.name&&t.push({id:"name",title:Ge.NAME,label:e.name}),t},Xr=({onClose:r,destinationId:c})=>{const d=f(),{isVm:u}=y(),{destinationsApi:p}=ll(),{selectedStreamName:h}=He(),{items:m,refetch:g}=p.useDestinations(),{data:b,loading:v}=p.useDestinationCategories(),{activeForm:C,loadDestination:S,validateFormData:w,genericForm:x}=Al();o(()=>{g()},[]);const k=i(null),[T,$]=s(!1),[I,E]=s(!1),[A,N]=s(null),O=T&&!!x?.isFormDirty,R=a(()=>Rt(m,h),[m,h]),D=a(()=>R?.find(e=>xt(e)===c),[c,R]),P=b?.destinationCategories?.categories??null;o(()=>{D&&P&&S(D,P)},[D,P]);const F=a(()=>D&&P?Dt(P,D):[],[D,P]),L=l(()=>{D&&$(!0)},[D]),_=l(()=>{D&&P&&(S(D,P),$(!1))},[D,P,S]),M=l(()=>{O?N("close"):r()},[O,r]),z=l(()=>{O?N("cancel"):_()},[O,_]),B=l(()=>{const e=A;N(null),"close"===e?(_(),r()):_()},[A,_,r]),X=l(async()=>{if(D){const{errorMessage:e,preparedFormData:t}=w();e||(await p.update(D.id,Oe(t)),$(!1))}},[D,w,p]),V=l(()=>{D&&E(!0)},[D]),U=l(async()=>{D&&(await p.remove(D.id),r())},[D,p,r]);if(!D)return null;const{icon:G,iconSrc:H}=ut(D.destinationType.type),j=((e,t)=>{const n=[],o=Nt(e,t),a=o.map(e=>({name:e.key,value:e.value})),i=Ae(e.exportedSignals);let l=[];const s=()=>{l.length&&(n.push({kind:"cells",id:`cells-${n.length}`,items:l}),l=[])};return o.forEach(({key:e,name:o,value:r})=>{const c=t.find(t=>t.name===e),{secret:d,componentType:u,componentProperties:p,hideFromReadData:h,customReadDataLabels:m}=c||{};if(h?.length&&Te(h,i,a))return;const{type:g}=ht(p,{type:""}),f=d||"password"===g;if(m?.length)m.forEach(({condition:t,...n},o)=>{t==r&&l.push({id:`${e}-custom-${o}`,title:n.title,label:n.value})});else if(r)if(f)l.push({id:e,title:o,label:new Array(10).fill("•").join("")});else{if(u===Ot.MultiInput){const t=ht(r,null);if(Array.isArray(t)&&t.length)return s(),void n.push({kind:"list",id:e,title:o,items:t.map((t,n)=>({id:`${e}-${n}`,label:String(t)}))})}if(u===Ot.KeyValuePair){const t=ht(r,null);if(Array.isArray(t)&&t.length)return s(),void n.push({kind:"pairs",id:e,title:o,items:t.map((t,n)=>{const o=t&&"object"==typeof t?t:{};return{id:`${e}-${n}`,title:null!=o.key?String(o.key):"",label:null!=o.value?String(o.value):""}})})}l.push({id:e,title:o,label:r})}else l.push({id:e,title:o,label:"-"})}),s(),n})(D,F);return e(n,{children:[t(ne,{isOpen:!0,header:{icon:G,iconSrc:H,title:D.name||D.destinationType.displayName,onClose:M,actions:[{id:"edit-destination-btn-edit",label:kt.EDIT,icon:hi,active:T,onClick:L},{id:"edit-destination-btn-delete",label:kt.DELETE,icon:li,color:d.v2.colors.red[500],active:I,onClick:V}]},footer:{actions:T?[{"data-id":"edit-destination-btn-cancel",label:kt.CANCEL,variant:de.Secondary,onClick:z},...C?.option.testConnectionSupported&&!u?[{"data-id":"edit-destination-btn-test-connection",label:kt.TEST_CONNECTION,variant:de.Secondary,onClick:()=>k.current?.testConnection()}]:[],{"data-id":"edit-destination-btn-save",label:kt.SAVE,variant:de.Primary,onClick:X}]:[]},children:t(Tt,{$padding:"4px 12px 12px",children:v?t(at,{$height:"50vh",children:t(ct,{withSpinner:!0})}):T&&C?t(Fs,{ref:k,isEdit:!0}):t(W,{$gap:16,children:e($t,{bgTint:"1000",children:[e($t,{bgTint:"900",children:[!u&&t(It,{conditions:D.conditions||[]}),t($t,{bgTint:"800",cellsPerRow:2,items:Br(D)})]}),!!j.length&&t($t,{bgTint:"900",richTitle:{title:"Configuration"},withCollapse:!0,collapseIsDefaultOpen:!0,children:j.map(e=>"cells"===e.kind?t($t,{bgTint:"800",cellsPerRow:2,items:e.items},e.id):(e.kind,t($t,{bgTint:"800",richTitle:{title:e.title},cellsPerRow:2,items:e.items},e.id)))})]})})})}),t(Sl,{target:"destination",isOpen:I,onClose:()=>E(!1),onApprove:U}),t(wl,{isOpen:null!==A,onClose:()=>N(null),onApprove:B})]})},Vr=(e,t)=>{const n=[{id:"type",title:Ge.TYPE,label:t.label},{id:"status",title:Ge.STATUS,badge:{status:e.disabled?Ie.Unknown:Ie.Success,label:e.disabled?Ge.DISABLED:Ge.ENABLED}}];return e.ruleName&&n.push({id:"name",title:Ge.NAME,label:e.ruleName}),e.profileName&&n.push({id:"profile",title:Ge.MANAGED_BY_PROFILE,label:e.profileName}),e.notes&&n.push({id:"notes",title:Ge.NOTES,label:e.notes}),n},Ur=({onClose:i,ruleId:r})=>{const c=f(),{addNotification:d}=Ft(),{instrumentationRulesApi:u}=ll(),{items:p,refetch:h}=u.useRules(),{selectedOption:m,loadRule:g,validateFormData:b,genericForm:v}=Nl();o(()=>{h()},[]);const[y,C]=s(!1),[S,w]=s(!1),[x,k]=s(null),T=y&&!!v?.isFormDirty,$=a(()=>p?.find(e=>xt(e)===r),[r,p]),I=a(()=>mt.find(({type:e})=>e===$?.type)??null,[$?.type]);o(()=>{$&&g($)},[$]);const E=l(()=>{if($){if(!$.mutable)return void d({type:Ie.Warning,title:Lt.FORBIDDEN,message:Lt.CANNOT_EDIT_RULE,crdType:gt.InstrumentationRule,target:$.ruleId,hideFromHistory:!0});C(!0)}},[$,d]),A=l(()=>{$&&(g($),C(!1))},[$,g]),N=l(()=>{T?k("close"):i()},[T,i]),O=l(()=>{T?k("cancel"):A()},[T,A]),R=l(()=>{const e=x;k(null),"close"===e?(A(),i()):A()},[x,A,i]),D=l(async()=>{if($){const{errorMessage:e,preparedFormData:t}=b();e||(await u.update($.ruleId,t,$.type),C(!1))}},[$,b,u]),P=l(()=>{if($){if(!$.mutable)return void d({type:Ie.Warning,title:Lt.FORBIDDEN,message:Lt.CANNOT_DELETE_RULE,crdType:gt.InstrumentationRule,target:$.ruleId,hideFromHistory:!0});w(!0)}},[$,d]),F=l(async()=>{$&&(await u.remove($.ruleId,$.type),i())},[$,u,i]);if(!$||!I)return null;const L=((e,n)=>{const o=[];return e.payloadCollection&&Object.entries(e.payloadCollection).forEach(([e,n])=>{n&&o.push(t(ae,{size:le.XS,children:`• ${Pt(e).toLowerCase()}`},`payload-${e}`))}),e.codeAttributes&&Object.entries(e.codeAttributes).forEach(([e,n])=>{n&&o.push(t(ae,{size:le.XS,children:`• ${Pt(e).toLowerCase()}`},`code-${e}`))}),e.headersCollection?.[Pe.HeaderKeys]?.length&&e.headersCollection[Pe.HeaderKeys].forEach((e,n)=>{e&&o.push(t(ae,{size:le.XS,children:e},`header-${n}-${e}`))}),e.customInstrumentations&&(e.customInstrumentations[Me.Java]?.forEach((e,a)=>{const i=new _e(e.className,e.methodName);if(i.Verify()){0===a&&o.push(t(ae,{size:le.XS,children:"Java Custom Probes:"},"java-custom-probes"));const e=i.toString();o.push(t(ae,{size:le.XXS,color:n.v2.colors.grey[200],children:`• ${e}`},`java-probe-${a}-${e}`))}}),e.customInstrumentations[Me.Golang]?.forEach((e,a)=>{const i=new Le(e.packageName,e.functionName,e.receiverName,e.receiverMethodName);if(i.Verify()){0===a&&o.push(t(ae,{size:le.XS,children:"Golang Custom Probes:"},"golang-custom-probes"));const e=i.toString();o.push(t(ae,{size:le.XXS,color:n.v2.colors.grey[200],children:`• ${e}`},`golang-probe-${a}-${e}`))}})),o})($,c);return e(n,{children:[t(ne,{isOpen:!0,header:{icon:Mt($.type),title:I.label,onClose:N,actions:[{id:"edit-rule-btn-edit",label:kt.EDIT,icon:hi,active:y,onClick:E},{id:"edit-rule-btn-delete",label:kt.DELETE,icon:li,color:c.v2.colors.red[500],active:S,onClick:P}]},footer:{actions:y?[{"data-id":"edit-rule-btn-cancel",label:kt.CANCEL,variant:de.Secondary,onClick:O},{"data-id":"edit-rule-btn-save",label:kt.SAVE,variant:de.Primary,onClick:D}]:[]},children:t(Tt,{$padding:"4px 12px 12px",children:y&&m?t(Us,{}):t(W,{$gap:16,children:e($t,{bgTint:"1000",children:[e($t,{bgTint:"900",children:[t(It,{conditions:$.conditions||[]}),t($t,{bgTint:"800",cellsPerRow:2,items:Vr($,I)})]}),t(dl,{readOnly:!0,scopes:$.sourceScopes??null}),!!L.length&&t($t,{bgTint:"900",richTitle:{title:"Collect"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t($t,{bgTint:"800",children:L})}),!!I.supportedLanguages.length&&t($t,{bgTint:"900",richTitle:{title:"Supported languages"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t($t,{bgTint:"800",children:t(se,{$gap:12,$wrap:"wrap",children:I.supportedLanguages.map(e=>t(_t,{label:Xe[e],leftIcon:Ve(e),flex:"0.5"},e))})})})]})})})}),t(Sl,{target:"instrumentation rule",isOpen:S,onClose:()=>w(!1),onApprove:F}),t(wl,{isOpen:null!==x,onClose:()=>k(null),onApprove:R})]})};var Gr;!function(e){e.Overview="overview",e.Pods="pods",e.PeerSources="peer-sources",e.Profiling="profiling",e.Sampling="sampling",e.Debug="debug"}(Gr||(Gr={}));const Hr=({collapseIsDefaultOpen:e,isJumpToTarget:n,onClickRestartPod:o,namespace:i,podName:l,nodeName:s,startTime:r,agentInjectedStatus:c,odigosHealthStatus:d,k8sHealthStatus:u,children:p})=>{const{formatDurationAgo:h}=zt(),m=Bt(!!n),g=a(()=>({title:l,icon:Ii,withCopy:!0}),[l]),f=a(()=>{const e=[],t=Xt(c);t&&e.push(t);const n=Xt(d,Ei,"health");n&&e.push(n);const o=Xt(u,Ai,"health");return o&&e.push(o),e},[c,d,u]),b=a(()=>o?[{id:`restart-pod-${l}`,icon:Ni,label:kt.RESTART_POD,onClick:()=>o(i,l)}]:void 0,[o,i,l]),v=a(()=>[{id:"nodeName",title:Ge.NODE,label:s,withCopy:!0},{id:"age",title:Ge.AGE,label:r?h(r,{style:"short"}):Ge.NOT_RUNNING,labelTooltip:r}],[s,r,h]);return t("div",{ref:m,children:t($t,{bgTint:"900",richTitle:g,badges:f,dropDataActions:b,items:v,withCollapse:!0,collapseIsDefaultOpen:e,children:p})})},jr=g.div`
192
192
  display: flex;
193
193
  align-items: center;
194
194
  justify-content: space-between;
@@ -246,7 +246,7 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
246
246
  background-color: ${({theme:e})=>e.v2.colors.silver[800]};
247
247
  }
248
248
  `}
249
- `,mc=({serviceName:n,isVirtual:o,nodeAttributes:i})=>{const l=Zt(e=>e.drawerEntityId),{items:s}=ll().sourcesApi.useSources(),r=a(()=>s.find(e=>e.id.name===n||e.serviceName===n),[s,n]),c=a(()=>r&&JSON.stringify(Qt(r))!==JSON.stringify(Qt(l)),[r,l]),d=a(()=>{if(o){const e=Object.fromEntries((i??[]).map(({key:e,value:t})=>[e,t]));return[en({serviceName:n,attributes:e})]}if(n?.toLowerCase()===Wl)return[Fi];const e=r?tn(r):void 0;return e?.length?e:[Ri]},[o,i,n,r]),u=c?()=>{const{setDrawerType:e,setDrawerEntityId:t}=Zt.getState();e(gt.Source),t({namespace:r?.id.namespace??"",name:r?.id.name??"",kind:r?.id.kind??""})}:void 0;return e(hc,{onClick:u,$withClick:!!u,children:[e(se,{$gap:8,children:[t(nn,{icons:d}),t(ae,{size:le.XXS,children:n})]}),o&&t(Be,{status:Ie.Info,label:Ge.VIRTUAL,textSize:le.XXXS,invertColors:!0,tooltip:Ge.VIRTUAL_TOOLTIP})]})},gc=e=>{if("string"==typeof e)return e;if(e&&"object"==typeof e){const t=e;if("string"==typeof t.k8sActualManifest)return t.k8sActualManifest;if("string"==typeof t.manifest)return t.manifest}},fc=({source:n})=>{const i=f(),{k8sManifestApi:l}=ll(),[r,c]=s(!0),[d,u]=s(void 0),[p,h]=s(!0),[m,g]=s(void 0);o(()=>{l.fetch({namespace:n.id.namespace,kind:n.id.kind,name:n.id.name}).then(({data:e})=>u(gc(e))).finally(()=>c(!1)),l.fetch({namespace:n.id.namespace,kind:on.InstrumentationConfig,name:`${n.id.kind}-${n.id.name}`.toLowerCase()}).then(({data:e})=>g(gc(e))).finally(()=>h(!1))},[l,n.id.namespace,n.id.kind,n.id.name]);const b=a(()=>[{label:Ge.DESCRIBE_POD,value:`kubectl describe ${n.id.kind} ${n.id.name} -n ${n.id.namespace}`},{label:Ge.GET_POD_YAML,value:`kubectl get ${n.id.kind} ${n.id.name} -n ${n.id.namespace} -o yaml`},{label:Ge.GET_POD_YAML,value:`kubectl get ${on.InstrumentationConfig} ${n.id.kind}-${n.id.name} -n ${n.id.namespace} -o yaml`}],[n.id.kind,n.id.name,n.id.namespace]);return e($t,{bgTint:"1000",children:[t($t,{bgTint:"900",richTitle:{icon:Li,title:Ge.DEBUG_COMMANDS},withCollapse:!0,collapseIsDefaultOpen:!0,children:b.map(({label:e,value:n},o)=>t(Kt,{label:e,value:n},`debug-cmd-${o}-${e}`))}),r?t(an,{size:1}):t(xl,{bgTint:"800",codeBgColor:i.v2.colors.silver[900],title:`${n.id.kind} YAML`,yaml:d}),p?t(an,{size:1}):t(xl,{bgTint:"800",codeBgColor:i.v2.colors.silver[900],title:"Instrumentation Config YAML",yaml:m})]})},bc=({title:n,children:o})=>e(W,{$gap:8,children:[t(ae,{size:le.XXXS,color:ie.Secondary,children:n}),o]}),vc=({source:n})=>{const o=a(()=>{const[e,t]=ln(n.telemetryMetrics?.[0]?.throughputBytes||0).split(" ");return{value:e,units:t}},[n]);return t(bc,{title:Ge.THROUGHPUT_LAST_10_SECONDS,children:e(se,{$alignItems:"flex-end",$gap:4,children:[t(ae,{size:le.L,children:o.value}),t(ae,{size:le.XS,variant:vt.Span,children:o.units})]})})},yc=({source:n})=>{const{CopyButton:o}=sn();return t(bc,{title:Ge.NAMESPACE,children:e(se,{children:[t(_t,{variant:Wt.Blue,label:n.id.namespace}),t(o,{value:n.id.namespace,size:rt.XS})]})})},Cc=({source:e})=>t(bc,{title:Ge.KIND,children:t(se,{children:t(_t,{variant:Wt.Blue,label:e.id.kind})})}),Sc=({source:n})=>{const{CopyButton:o}=sn();return t(bc,{title:Ge.NAME,children:e(se,{children:[t(_t,{variant:Wt.Blue,label:n.id.name}),t(o,{value:n.id.name,size:rt.XS})]})})},wc=({source:n})=>{const{isVm:o}=y();return t($t,{children:e(se,{$gap:24,$alignItems:"flex-start",$justifyContent:"flex-start",$wrap:"wrap",children:[!o&&t(vc,{source:n}),!o&&t(yc,{source:n}),t(Cc,{source:n}),t(Sc,{source:n})]})})},xc=({source:e})=>t($t,{bgTint:"900",children:t(Wr,{podsOdigosHealthStatus:e.podsOdigosHealthStatus,pods:e.pods,noPadding:!0})}),kc=({source:e})=>{const n=a(()=>e.workloadOdigosHealthStatus?{status:e.workloadOdigosHealthStatus.status?rn(e.workloadOdigosHealthStatus.status):Ie.Unknown,title:Pt(e.workloadOdigosHealthStatus.reasonEnum),subTitle:e.workloadOdigosHealthStatus.message}:null,[e]);return n?t(Ut,{...n,width:"100%"}):null},Tc="calc(50% - 6px)",$c=({source:n,onClickRollout:o,onClickRollback:i})=>{const l=a(()=>{const{status:e,reasonEnum:t,message:a}=n.conditions?.rollout||{},i=Gt(e);if(!i)return null;return{status:i,title:t?.toLowerCase().includes("rollout")?Pt(t):`${Ge.ROLLOUT} ${Pt(t)}`,subTitle:a,action:i!==Ie.Success?{icon:Ni,tooltip:Ge.ROLLOUT_RESTART,onClick:o}:void 0}},[n]),s=a(()=>{const{status:e,reasonEnum:t,message:o}=n.autoRollback?.autoRollbackStatus||{},a=Gt(e);if(!a)return null;return{status:a,title:t?.toLowerCase().includes("rollback")?Pt(t):`${Ge.ROLLBACK} ${Pt(t)}`,subTitle:o,action:a!==Ie.Success?{icon:Ni,tooltip:Ge.ROLLBACK_RECOVER,onClick:i}:void 0}},[n]);return l||s?e(se,{$gap:12,$alignItems:"stretch",children:[l&&t(Ut,{invertColors:!0,slim:!0,width:s?Tc:"100%",...l}),s&&t(Ut,{invertColors:!0,slim:!0,width:Tc,...s})]}):null},Ic=p(null),Ec=g.div`
249
+ `,mc=({serviceName:n,isVirtual:o,nodeAttributes:i})=>{const l=Zt(e=>e.drawerEntityId),{items:s}=ll().sourcesApi.useSources(),r=a(()=>s.find(e=>e.id.name===n||e.serviceName===n),[s,n]),c=a(()=>r&&JSON.stringify(Qt(r))!==JSON.stringify(Qt(l)),[r,l]),d=a(()=>{if(o){const e=Object.fromEntries((i??[]).map(({key:e,value:t})=>[e,t]));return[en({serviceName:n,attributes:e})]}if(n?.toLowerCase()===Wl)return[Fi];const e=r?tn(r):void 0;return e?.length?e:[Ri]},[o,i,n,r]),u=c?()=>{const{setDrawerType:e,setDrawerEntityId:t}=Zt.getState();e(gt.Source),t({namespace:r?.id.namespace??"",name:r?.id.name??"",kind:r?.id.kind??""})}:void 0;return e(hc,{onClick:u,$withClick:!!u,children:[e(se,{$gap:8,children:[t(nn,{icons:d}),t(ae,{size:le.XXS,children:n})]}),o&&t(Be,{status:Ie.Info,label:Ge.VIRTUAL,textSize:le.XXXS,invertColors:!0,tooltip:Ge.VIRTUAL_TOOLTIP})]})},gc=e=>{if("string"==typeof e)return e;if(e&&"object"==typeof e){const t=e;if("string"==typeof t.k8sActualManifest)return t.k8sActualManifest;if("string"==typeof t.manifest)return t.manifest}},fc=({source:n})=>{const i=f(),{k8sManifestApi:l}=ll(),[r,c]=s(!0),[d,u]=s(void 0),[p,h]=s(!0),[m,g]=s(void 0);o(()=>{l.fetch({namespace:n.id.namespace,kind:n.id.kind,name:n.id.name}).then(({data:e})=>u(gc(e))).finally(()=>c(!1)),l.fetch({namespace:n.id.namespace,kind:on.InstrumentationConfig,name:`${n.id.kind}-${n.id.name}`.toLowerCase()}).then(({data:e})=>g(gc(e))).finally(()=>h(!1))},[l,n.id.namespace,n.id.kind,n.id.name]);const b=a(()=>[{label:Ge.DESCRIBE_POD,value:`kubectl describe ${n.id.kind} ${n.id.name} -n ${n.id.namespace}`},{label:Ge.GET_POD_YAML,value:`kubectl get ${n.id.kind} ${n.id.name} -n ${n.id.namespace} -o yaml`},{label:Ge.GET_POD_YAML,value:`kubectl get ${on.InstrumentationConfig} ${n.id.kind}-${n.id.name} -n ${n.id.namespace} -o yaml`}],[n.id.kind,n.id.name,n.id.namespace]);return e($t,{bgTint:"1000",children:[t($t,{bgTint:"900",richTitle:{icon:Li,title:Ge.DEBUG_COMMANDS},withCollapse:!0,collapseIsDefaultOpen:!0,children:b.map(({label:e,value:n},o)=>t(Kt,{label:e,value:n},`debug-cmd-${o}-${e}`))}),r?t(an,{size:1}):t(xl,{bgTint:"800",codeBgColor:i.v2.colors.silver[900],title:`${n.id.kind} YAML`,yaml:d}),p?t(an,{size:1}):t(xl,{bgTint:"800",codeBgColor:i.v2.colors.silver[900],title:"Instrumentation Config YAML",yaml:m})]})},bc=({title:n,children:o})=>e(W,{$gap:8,children:[t(ae,{size:le.XXXS,color:ie.Secondary,children:n}),o]}),vc=({source:n})=>{const o=a(()=>{const[e,t]=ln(n.telemetryMetrics?.[0]?.throughputBytes||0).split(" ");return{value:e,units:t}},[n]);return t(bc,{title:Ge.THROUGHPUT_LAST_10_SECONDS,children:e(se,{$alignItems:"flex-end",$gap:4,children:[t(ae,{size:le.L,children:o.value}),t(ae,{size:le.XS,variant:vt.Span,children:o.units})]})})},yc=({source:n})=>{const{CopyButton:o}=sn();return t(bc,{title:Ge.NAMESPACE,children:e(se,{children:[t(_t,{variant:Wt.Blue,label:n.id.namespace}),t(o,{value:n.id.namespace,size:rt.XS})]})})},Cc=({source:e})=>t(bc,{title:Ge.KIND,children:t(se,{children:t(_t,{variant:Wt.Blue,label:e.id.kind})})}),Sc=({source:n})=>{const{CopyButton:o}=sn();return t(bc,{title:Ge.NAME,children:e(se,{children:[t(_t,{variant:Wt.Blue,label:n.id.name}),t(o,{value:n.id.name,size:rt.XS})]})})},wc=({source:n})=>{const{isVm:o}=y();return t($t,{children:e(se,{$gap:24,$alignItems:"flex-start",$justifyContent:"flex-start",$wrap:"wrap",children:[!o&&t(vc,{source:n}),!o&&t(yc,{source:n}),t(Cc,{source:n}),t(Sc,{source:n})]})})},xc=({source:e})=>e.pods?.length?t($t,{bgTint:"900",children:t(Wr,{podsOdigosHealthStatus:e.podsOdigosHealthStatus,pods:e.pods,noPadding:!0})}):null,kc=({source:e})=>{const n=a(()=>e.workloadOdigosHealthStatus?{status:e.workloadOdigosHealthStatus.status?rn(e.workloadOdigosHealthStatus.status):Ie.Unknown,title:Pt(e.workloadOdigosHealthStatus.reasonEnum),subTitle:e.workloadOdigosHealthStatus.message}:null,[e]);return n?t(Ut,{...n,width:"100%"}):null},Tc="calc(50% - 6px)",$c=({source:n,onClickRollout:o,onClickRollback:i})=>{const l=a(()=>{const{status:e,reasonEnum:t,message:a}=n.conditions?.rollout||{},i=Gt(e);if(!i)return null;return{status:i,title:t?.toLowerCase().includes("rollout")?Pt(t):`${Ge.ROLLOUT} ${Pt(t)}`,subTitle:a,action:i!==Ie.Success?{icon:Ni,tooltip:Ge.ROLLOUT_RESTART,onClick:o}:void 0}},[n]),s=a(()=>{const{status:e,reasonEnum:t,message:o}=n.autoRollback?.autoRollbackStatus||{},a=Gt(e);if(!a)return null;return{status:a,title:t?.toLowerCase().includes("rollback")?Pt(t):`${Ge.ROLLBACK} ${Pt(t)}`,subTitle:o,action:a!==Ie.Success?{icon:Ni,tooltip:Ge.ROLLBACK_RECOVER,onClick:i}:void 0}},[n]);return l||s?e(se,{$gap:12,$alignItems:"stretch",children:[l&&t(Ut,{invertColors:!0,slim:!0,width:s?Tc:"100%",...l}),s&&t(Ut,{invertColors:!0,slim:!0,width:Tc,...s})]}):null},Ic=p(null),Ec=g.div`
250
250
  position: relative;
251
251
  `,Ac=({children:e})=>{const n=i(null);return t(Ec,{ref:n,children:t(Ic.Provider,{value:n,children:e})})},Nc=g.div`
252
252
  position: fixed;
@@ -377,7 +377,7 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useEffect
377
377
  opacity: 1;
378
378
  pointer-events: auto;
379
379
  }
380
- `,Pd=({name:n,summary:o,onJumpToRule:a})=>e(Nd,{children:[e(Od,{children:[n&&t(ae,{size:le.XXXS,color:ie.Secondary,nowrap:!0,children:n}),t(Rd,{children:t(S,{parts:o})})]}),a&&t(Dd,{children:t(De,{text:Ge.OPEN_IN_SAMPLING_PAGE,children:t(re,{"data-id":"sampling-rule-jump",variant:de.Primary,size:ce.S,leftIcon:zi,onClick:a})})})]}),Fd=({source:e,onRedirectToSampling:n})=>t($t,{bgTint:"1000",richTitle:{title:Ge.SAMPLING},children:e.containers?.map(e=>t(Md,{container:e,onRedirectToSampling:n},e.containerName))});var Ld;!function(e){e.All="all",e.Noisy="noisy",e.HighlyRelevant="highly-relevant",e.CostReduction="cost-reduction"}(Ld||(Ld={}));const _d=e=>"noisy"===e.type?w(e.rule):"highlyRelevant"===e.type?x(e.rule):"costReduction"===e.type?k(e.rule):[],Md=({container:n,onRedirectToSampling:o})=>{const[i,l]=s(Ld.All),r=Zt(e=>e.setPendingViewSamplingRule),c=n.agentConfig?.traces?.headSampling?.noisyOperations??[],d=a(()=>(n.collectorConfig?.tailSampling?.noisyOperations??[]).map(e=>({type:"noisy",rule:e})),[n.agentConfig?.traces?.headSampling?.noisyOperations]),u=a(()=>(n.collectorConfig?.tailSampling?.highlyRelevantOperations??[]).map(e=>({type:"highlyRelevant",rule:e})),[n.collectorConfig?.tailSampling?.highlyRelevantOperations]),p=a(()=>(n.collectorConfig?.tailSampling?.costReductionRules??[]).map(e=>({type:"costReduction",rule:e})),[n.collectorConfig?.tailSampling?.costReductionRules]),h=a(()=>i===Ld.Noisy?d:i===Ld.HighlyRelevant?u:i===Ld.CostReduction?p:[...d,...u,...p],[i,u,p]),m=a(()=>(e,t)=>{r({ruleId:e,category:t}),o()},[o,r]);return e($t,{bgTint:"900",richTitle:{title:n.containerName},withCollapse:!0,collapseIsDefaultOpen:!0,children:[e($t,{bgTint:"800",richTitle:{title:Ge.HEAD_SAMPLING,badge:{label:c.length}},withCollapse:!0,collapseIsDefaultOpen:!!c.length,children:[t(ae,{size:le.XXS,children:Ge.NOISY_OPERATIONS}),t(W,{$gap:4,children:c.length?c.map(e=>t(Pd,{name:e.name,summary:w(e),onJumpToRule:()=>m(e.ruleId,"noisy")},e.ruleId)):t(Ce,{title:"No noisy operations"})})]}),e($t,{bgTint:"800",richTitle:{title:Ge.TAIL_SAMPLING,badge:{label:d.length+u.length+p.length}},withCollapse:!0,collapseIsDefaultOpen:!!h.length,children:[t(ue,{options:(g=d.length,f=u.length,b=p.length,[{value:Ld.All,label:"All",badge:{label:g+f+b,textSize:le.XXXS}},{value:Ld.Noisy,label:Ge.NOISY_OPERATIONS,badge:{label:g,textSize:le.XXXS}},{value:Ld.HighlyRelevant,label:Ge.HIGHLY_RELEVANT_OPERATIONS,badge:{label:f,textSize:le.XXXS}},{value:Ld.CostReduction,label:Ge.COST_REDUCTION_OPERATIONS,badge:{label:b,textSize:le.XXXS}}]),selected:i,setSelected:l}),t(W,{$gap:4,children:h.length?h.map(e=>t(Pd,{name:e.rule.name,summary:_d(e),onJumpToRule:()=>m(e.rule.ruleId,e.type)},e.rule.ruleId)):t(Ce,{title:`No ${i===Ld.All?`${Ld.Noisy}, ${Ld.HighlyRelevant} and ${Ld.CostReduction}`:i} operations`})})]})]});var g,f,b},zd=[on.Deployment,on.StatefulSet,on.DaemonSet,on.DeploymentConfig,on.Rollout,on.Pod];var Bd;!function(e){e.Workload="Workload",e.Pod="Pod"}(Bd||(Bd={}));const Xd=e=>!!e&&Gt(e.status)===Ie.Error,Vd=e=>Xd(e.healthStatus),Ud=e=>Xd(e.odigosHealthStatus)||(e.processes??[]).some(Vd),Gd=e=>Xd(e.agentInjectedStatus)||Xd(e.odigosHealthStatus)||(e.containers??[]).some(Ud),Hd=({onClose:n,sourceId:r,onRedirectToSampling:c})=>{const d=f(),{isVm:u}=y(),{sourcesApi:p,configApi:h}=ll(),{selectedStreamName:m}=He(),{genericForm:g,loadSource:b,validateFormData:v}=Rl(),{data:C}=h.useEffectiveConfig(),[S,w]=s(!1),[x,k]=s(!1),[T,$]=s(!1),[I,E]=s(Gr.Overview),[A,N]=s(null),[O,R]=s({openFor:null}),D=(()=>{const[e,t]=s(null),n=l(e=>{t({tab:Gr.Pods,podName:e.podName})},[]),o=l((e,n)=>{t({tab:Gr.Pods,podName:e.podName,containerName:n.containerName})},[]),i=l((e,n,o)=>{const a=Jr({identifyingAttributes:o.identifyingAttributes});t({tab:Gr.Pods,podName:e.podName,containerName:n.containerName,processPid:a})},[]),r=l(()=>t(null),[]);return a(()=>({jumpToTarget:e,jumpToPod:n,jumpToContainer:o,jumpToProcess:i,clearJumpToTarget:r}),[e,n,o,i,r])})();o(()=>{D.jumpToTarget&&E(D.jumpToTarget.tab)},[D.jumpToTarget]),o(()=>{A&&JSON.stringify(Qt(r))!==JSON.stringify(Qt(A))&&N(null)},[r,A]);const P=i(!1),F=l(async()=>N(await p.fetchById(r)||null),[r,p]);o(()=>{if(P.current||(F(),P.current=!0),!S){const e=setInterval(()=>F(),3e3);return()=>clearInterval(e)}},[F,S]),o(()=>{A&&b(A)},[A]);const L=A&&zd.includes(A.id.kind),_=a(()=>{const e=[],n=(A?.pods??[]).some(Gd);return e.push({value:Gr.Overview,label:Ge.OVERVIEW}),u||(e.push({value:Gr.Pods,label:Ge.PODS,icon:n?e=>t(Oi,{...e,fill:d.v2.colors.red[500]}):void 0}),e.push({value:Gr.PeerSources,label:Ge.PEER_SOURCES}),C?.profiling?.enabled&&e.push({value:Gr.Profiling,label:Ge.PROFILING}),e.push({value:Gr.Sampling,label:Ge.SAMPLING}),e.push({value:Gr.Debug,label:Ge.DEBUG})),e},[u,C,A?.pods]),M=l(()=>w(!0),[]),z=a(()=>()=>{n(),c()},[n,c]),B=l(()=>{A&&b(A),w(!1)},[A]),X=l(async()=>{if(!A||!g)return;const{errorMessage:e,preparedFormData:t}=v();if(e)return;const n=t.otelServiceName!==A.id.name?t.otelServiceName:"";await p.update(r,{...t,otelServiceName:n}),w(!1)},[A,g,v,r,p]),V=l(()=>k(!0),[]),U=l(async()=>{A&&(await p.persistV2({[St]:[{namespace:A.id.namespace,name:A.id.name,kind:A.id.kind,selected:!1,currentStreamName:m}]}),k(!1),n())},[A,p,m,n]),G=l(()=>{R({openFor:Bd.Workload})},[]),H=l(e=>{E(e),D.clearJumpToTarget()},[D]),j=l(async()=>{await p.recoverFromRollback(r)},[p,r]),K=l(()=>R({openFor:null}),[]),Y=l(async()=>{O.openFor===Bd.Workload?await p.restartWorkloads([r]):O.openFor===Bd.Pod&&O.podNamespace&&O.podName&&await p.restartPod(O.podNamespace,O.podName),K()},[O,p,r,K]),J=a(()=>{const{kind:e,name:t}=r;return{title:`Rollout ${e}`,description:`Are you sure you want to rollout the ${e.toLowerCase()} "${t}"?`}},[r]),q=a(()=>{const e=[];return S||I===Gr.Overview&&(e.push({id:"edit-source-btn-edit",label:kt.EDIT,icon:hi,active:S,onClick:M}),!u&&L&&e.push({id:"edit-source-btn-restart",label:Ge.ROLLOUT,icon:Gi,onClick:G}),e.push({id:"edit-source-btn-delete",label:kt.UNINSTRUMENT,icon:li,color:d.v2.colors.red[500],active:x,onClick:V})),e},[I,S,x,u,L,M,G,V,d]),Z=a(()=>{if(!A)return[];const e=[],t={backgroundColor:"transparent",textSize:le.S};return e.push({...t,label:A.id.name,leftIcon:u?void 0:Ai}),A.serviceName&&A.serviceName!==A.id.name&&e.push({...t,label:A.serviceName,leftIcon:Ei,textColor:d.v2.colors.silver[200]}),e},[A,d,u]);if(!A)return t(ne,{isOpen:!0,children:t(at,{$height:"80vh",children:t(ct,{withSpinner:!0})})});const Q=I===Gr.Profiling?T?"95vw":"fit-content":S?void 0:"60vw";return e(ic,{value:D,children:[t(ne,{isOpen:!0,width:Q,minWidth:"777px",header:{icon:u?Hi:yn(A.containers)[0],titleBadges:Z,onClose:()=>{H(Gr.Overview),N(null),$(!1),n()},actions:q},footer:{actions:S?[{"data-id":"edit-source-btn-cancel",label:kt.CANCEL,variant:de.Secondary,onClick:B},{"data-id":"edit-source-btn-save",label:kt.SAVE,variant:de.Primary,onClick:X}]:[]},children:t(Tt,{$padding:"4px 12px 12px",children:e(W,{$gap:16,children:[!S&&_.length>1&&t(ue,{options:_,selected:I,setSelected:H}),(()=>{switch(I){case Gr.Overview:return S?t(js,{}):t(Xc,{source:A,onClickRollout:G,onClickRollback:j});case Gr.Pods:return t(dc,{source:A,onClickRestartPod:L?(e,t)=>R({openFor:Bd.Pod,podNamespace:e,podName:t}):void 0});case Gr.PeerSources:return t(uc,{source:A});case Gr.Profiling:return t(Ad,{source:A,onFlameFullscreenChange:$});case Gr.Sampling:return t(Fd,{source:A,onRedirectToSampling:z});case Gr.Debug:return t(fc,{source:A});default:return null}})()]})})}),t(Sl,{target:"source",action:"uninstrument",isOpen:x,onClose:()=>k(!1),onApprove:U}),t(Ue,{isOpen:O.openFor===Bd.Workload,title:J.title,description:J.description,onClose:K,denyButton:{label:"Go back",variant:de.Secondary,onClick:K},approveButton:{label:kt.CONFIRM,variant:de.Primary,onClick:Y}}),t(Sl,{target:"pod",action:"restart",description:Ge.ROLLOUT_RESTART_WORKLOADS_DESCRIPTION,isOpen:O.openFor===Bd.Pod,onClose:K,onApprove:Y,overrideApproveButtonLabel:Ge.DELETE_POD_TO_RESTART})]})},jd=g.div`
380
+ `,Pd=({name:n,summary:o,onJumpToRule:a})=>e(Nd,{children:[e(Od,{children:[n&&t(ae,{size:le.XXXS,color:ie.Secondary,nowrap:!0,children:n}),t(Rd,{children:t(S,{parts:o})})]}),a&&t(Dd,{children:t(De,{text:Ge.OPEN_IN_SAMPLING_PAGE,children:t(re,{"data-id":"sampling-rule-jump",variant:de.Primary,size:ce.S,leftIcon:zi,onClick:a})})})]}),Fd=({source:e,onRedirectToSampling:n})=>t($t,{bgTint:"1000",richTitle:{title:Ge.SAMPLING},children:e.containers?.map(e=>t(Md,{container:e,onRedirectToSampling:n},e.containerName))});var Ld;!function(e){e.All="all",e.Noisy="noisy",e.HighlyRelevant="highly-relevant",e.CostReduction="cost-reduction"}(Ld||(Ld={}));const _d=e=>"noisy"===e.type?w(e.rule,"source"):"highlyRelevant"===e.type?x(e.rule,"source"):"costReduction"===e.type?k(e.rule,"source"):[],Md=({container:n,onRedirectToSampling:o})=>{const[i,l]=s(Ld.All),r=Zt(e=>e.setPendingViewSamplingRule),c=n.agentConfig?.traces?.headSampling?.noisyOperations??[],d=a(()=>(n.collectorConfig?.tailSampling?.noisyOperations??[]).map(e=>({type:"noisy",rule:e})),[n.agentConfig?.traces?.headSampling?.noisyOperations]),u=a(()=>(n.collectorConfig?.tailSampling?.highlyRelevantOperations??[]).map(e=>({type:"highlyRelevant",rule:e})),[n.collectorConfig?.tailSampling?.highlyRelevantOperations]),p=a(()=>(n.collectorConfig?.tailSampling?.costReductionRules??[]).map(e=>({type:"costReduction",rule:e})),[n.collectorConfig?.tailSampling?.costReductionRules]),h=a(()=>i===Ld.Noisy?d:i===Ld.HighlyRelevant?u:i===Ld.CostReduction?p:[...d,...u,...p],[i,u,p]),m=a(()=>(e,t)=>{r({ruleId:e,category:t}),o()},[o,r]);return e($t,{bgTint:"900",richTitle:{title:n.containerName},withCollapse:!0,collapseIsDefaultOpen:!0,children:[e($t,{bgTint:"800",richTitle:{title:Ge.HEAD_SAMPLING,badge:{label:c.length}},withCollapse:!0,collapseIsDefaultOpen:!!c.length,children:[t(ae,{size:le.XXS,children:Ge.NOISY_OPERATIONS}),t(W,{$gap:4,children:c.length?c.map(e=>t(Pd,{name:e.name,summary:w(e,"source"),onJumpToRule:()=>m(e.ruleId,"noisy")},e.ruleId)):t(Ce,{title:"No sampling rules for noisy operations"})})]}),e($t,{bgTint:"800",richTitle:{title:Ge.TAIL_SAMPLING,badge:{label:d.length+u.length+p.length}},withCollapse:!0,collapseIsDefaultOpen:!!h.length,children:[t(ue,{options:(g=d.length,f=u.length,b=p.length,[{value:Ld.All,label:"All",badge:{label:g+f+b,textSize:le.XXXS}},{value:Ld.Noisy,label:Ge.NOISY_OPERATIONS,badge:{label:g,textSize:le.XXXS}},{value:Ld.HighlyRelevant,label:Ge.HIGHLY_RELEVANT_OPERATIONS,badge:{label:f,textSize:le.XXXS}},{value:Ld.CostReduction,label:Ge.COST_REDUCTION_OPERATIONS,badge:{label:b,textSize:le.XXXS}}]),selected:i,setSelected:l}),t(W,{$gap:4,children:h.length?h.map(e=>t(Pd,{name:e.rule.name,summary:_d(e),onJumpToRule:()=>m(e.rule.ruleId,e.type)},e.rule.ruleId)):t(Ce,{title:`No sampling rules for ${i===Ld.All?`${Ld.Noisy}, ${Ld.HighlyRelevant} and ${Ld.CostReduction}`:i} operations`})})]})]});var g,f,b},zd=[on.Deployment,on.StatefulSet,on.DaemonSet,on.DeploymentConfig,on.Rollout,on.Pod];var Bd;!function(e){e.Workload="Workload",e.Pod="Pod"}(Bd||(Bd={}));const Xd=e=>!!e&&Gt(e.status)===Ie.Error,Vd=e=>Xd(e.healthStatus),Ud=e=>Xd(e.odigosHealthStatus)||(e.processes??[]).some(Vd),Gd=e=>Xd(e.agentInjectedStatus)||Xd(e.odigosHealthStatus)||(e.containers??[]).some(Ud),Hd=({onClose:n,sourceId:r,onRedirectToSampling:c})=>{const d=f(),{isVm:u}=y(),{sourcesApi:p,configApi:h}=ll(),{selectedStreamName:m}=He(),{genericForm:g,loadSource:b,validateFormData:v}=Rl(),{data:C}=h.useEffectiveConfig(),[S,w]=s(!1),[x,k]=s(!1),[T,$]=s(!1),[I,E]=s(Gr.Overview),[A,N]=s(null),[O,R]=s({openFor:null}),D=(()=>{const[e,t]=s(null),n=l(e=>{t({tab:Gr.Pods,podName:e.podName})},[]),o=l((e,n)=>{t({tab:Gr.Pods,podName:e.podName,containerName:n.containerName})},[]),i=l((e,n,o)=>{const a=Jr({identifyingAttributes:o.identifyingAttributes});t({tab:Gr.Pods,podName:e.podName,containerName:n.containerName,processPid:a})},[]),r=l(()=>t(null),[]);return a(()=>({jumpToTarget:e,jumpToPod:n,jumpToContainer:o,jumpToProcess:i,clearJumpToTarget:r}),[e,n,o,i,r])})();o(()=>{D.jumpToTarget&&E(D.jumpToTarget.tab)},[D.jumpToTarget]),o(()=>{A&&JSON.stringify(Qt(r))!==JSON.stringify(Qt(A))&&N(null)},[r,A]);const P=i(!1),F=l(async()=>N(await p.fetchById(r)||null),[r,p]);o(()=>{if(P.current||(F(),P.current=!0),!S){const e=setInterval(()=>F(),3e3);return()=>clearInterval(e)}},[F,S]),o(()=>{A&&b(A)},[A]);const L=A&&zd.includes(A.id.kind),_=a(()=>{const e=[],n=(A?.pods??[]).some(Gd);return e.push({value:Gr.Overview,label:Ge.OVERVIEW}),u||(e.push({value:Gr.Pods,label:Ge.PODS,icon:n?e=>t(Oi,{...e,fill:d.v2.colors.red[500]}):void 0}),e.push({value:Gr.PeerSources,label:Ge.PEER_SOURCES}),C?.profiling?.enabled&&e.push({value:Gr.Profiling,label:Ge.PROFILING}),e.push({value:Gr.Sampling,label:Ge.SAMPLING}),e.push({value:Gr.Debug,label:Ge.DEBUG})),e},[u,C,A?.pods]),M=l(()=>w(!0),[]),z=a(()=>()=>{n(),c()},[n,c]),B=l(()=>{A&&b(A),w(!1)},[A]),X=l(async()=>{if(!A||!g)return;const{errorMessage:e,preparedFormData:t}=v();if(e)return;const n=t.otelServiceName!==A.id.name?t.otelServiceName:"";await p.update(r,{...t,otelServiceName:n}),w(!1)},[A,g,v,r,p]),V=l(()=>k(!0),[]),U=l(async()=>{A&&(await p.persistV2({[St]:[{namespace:A.id.namespace,name:A.id.name,kind:A.id.kind,selected:!1,currentStreamName:m}]}),k(!1),n())},[A,p,m,n]),G=l(()=>{R({openFor:Bd.Workload})},[]),H=l(e=>{E(e),D.clearJumpToTarget()},[D]),j=l(async()=>{await p.recoverFromRollback(r)},[p,r]),K=l(()=>R({openFor:null}),[]),Y=l(async()=>{O.openFor===Bd.Workload?await p.restartWorkloads([r]):O.openFor===Bd.Pod&&O.podNamespace&&O.podName&&await p.restartPod(O.podNamespace,O.podName),K()},[O,p,r,K]),J=a(()=>{const{kind:e,name:t}=r;return{title:`Rollout ${e}`,description:`Are you sure you want to rollout the ${e.toLowerCase()} "${t}"?`}},[r]),q=a(()=>{const e=[];return S||I===Gr.Overview&&(e.push({id:"edit-source-btn-edit",label:kt.EDIT,icon:hi,active:S,onClick:M}),!u&&L&&e.push({id:"edit-source-btn-restart",label:Ge.ROLLOUT,icon:Gi,onClick:G}),e.push({id:"edit-source-btn-delete",label:kt.UNINSTRUMENT,icon:li,color:d.v2.colors.red[500],active:x,onClick:V})),e},[I,S,x,u,L,M,G,V,d]),Z=a(()=>{if(!A)return[];const e=[],t={backgroundColor:"transparent",textSize:le.S};return e.push({...t,label:A.id.name,leftIcon:u?void 0:Ai}),A.serviceName&&A.serviceName!==A.id.name&&e.push({...t,label:A.serviceName,leftIcon:Ei,textColor:d.v2.colors.silver[200]}),e},[A,d,u]);if(!A)return t(ne,{isOpen:!0,children:t(at,{$height:"80vh",children:t(ct,{withSpinner:!0})})});const Q=I===Gr.Profiling?T?"95vw":"fit-content":S?void 0:"60vw";return e(ic,{value:D,children:[t(ne,{isOpen:!0,width:Q,minWidth:"777px",header:{icon:u?Hi:yn(A.containers)[0],titleBadges:Z,onClose:()=>{H(Gr.Overview),N(null),$(!1),n()},actions:q},footer:{actions:S?[{"data-id":"edit-source-btn-cancel",label:kt.CANCEL,variant:de.Secondary,onClick:B},{"data-id":"edit-source-btn-save",label:kt.SAVE,variant:de.Primary,onClick:X}]:[]},children:t(Tt,{$padding:"4px 12px 12px",children:e(W,{$gap:16,children:[!S&&_.length>1&&t(ue,{options:_,selected:I,setSelected:H}),(()=>{switch(I){case Gr.Overview:return S?t(js,{}):t(Xc,{source:A,onClickRollout:G,onClickRollback:j});case Gr.Pods:return t(dc,{source:A,onClickRestartPod:L?(e,t)=>R({openFor:Bd.Pod,podNamespace:e,podName:t}):void 0});case Gr.PeerSources:return t(uc,{source:A});case Gr.Profiling:return t(Ad,{source:A,onFlameFullscreenChange:$});case Gr.Sampling:return t(Fd,{source:A,onRedirectToSampling:z});case Gr.Debug:return t(fc,{source:A});default:return null}})()]})})}),t(Sl,{target:"source",action:"uninstrument",isOpen:x,onClose:()=>k(!1),onApprove:U}),t(Ue,{isOpen:O.openFor===Bd.Workload,title:J.title,description:J.description,onClose:K,denyButton:{label:"Go back",variant:de.Secondary,onClick:K},approveButton:{label:kt.CONFIRM,variant:de.Primary,onClick:Y}}),t(Sl,{target:"pod",action:"restart",description:Ge.ROLLOUT_RESTART_WORKLOADS_DESCRIPTION,isOpen:O.openFor===Bd.Pod,onClose:K,onApprove:Y,overrideApproveButtonLabel:Ge.DELETE_POD_TO_RESTART})]})},jd=g.div`
381
381
  display: flex;
382
382
  align-items: center;
383
383
  gap: 8px;
package/lib/containers.js CHANGED
@@ -1,4 +1,4 @@
1
- import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import o,{useTheme as r}from"styled-components";import{memo as n,useState as a,useCallback as s,useEffect as d,useMemo as l,createContext as c,useContext as p,useRef as u}from"react";import{U as h}from"./chunks/consts-D6GCMJ6c.js";import{MarkerType as g,useNodesState as m,useEdgesState as f,Handle as v,Position as y,getSmoothStepPath as b,BaseEdge as x,EdgeLabelRenderer as N,ReactFlowProvider as S,ReactFlow as I,Background as w,Controls as $,ControlButton as k,useReactFlow as M}from"@xyflow/react";import{N as C,o as T,p as A,q as E,r as z,v as X,w as K,b as R,c as V,x as O,y as _,B as q,z as L,L as j,M as H,O as D,Q as G,R as P,U as B,V as F,W as U,X as Y,Y as W}from"./chunks/ui-components-CrXELmQx.js";import{UserIcon as Z,ImageErrorIcon as Q,ArrowLeftIcon as J,InboundIcon as ee,OutboundIcon as te,RefreshIcon as ie}from"./icons.js";import oe from"elkjs/lib/elk.bundled.js";import{d as re}from"./chunks/use-odigos-api-UctF_jx_.js";import"@xyflow/react/dist/style.css";import"zustand";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";import"@apollo/client";import"@apollo/client/link/error";import"@apollo/client/link/context";import"@apollo/client/utilities";const ne=o.div`
1
+ import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import o,{useTheme as r}from"styled-components";import{memo as n,useState as a,useCallback as s,useEffect as d,useMemo as l,createContext as c,useContext as p,useRef as u}from"react";import{U as h}from"./chunks/consts-D6GCMJ6c.js";import{MarkerType as g,useNodesState as m,useEdgesState as f,Handle as v,Position as y,getSmoothStepPath as b,BaseEdge as x,EdgeLabelRenderer as N,ReactFlowProvider as S,ReactFlow as I,Background as w,Controls as $,ControlButton as k,useReactFlow as M}from"@xyflow/react";import{N as C,o as T,p as A,q as E,r as z,v as X,w as K,b as R,c as V,x as O,y as _,B as q,z as L,L as j,M as H,O as D,Q as G,R as P,U as B,V as F,W as U,X as Y,Y as W}from"./chunks/ui-components-CrXELmQx.js";import{UserIcon as Z,ImageErrorIcon as Q,ArrowLeftIcon as J,InboundIcon as ee,OutboundIcon as te,RefreshIcon as ie}from"./icons.js";import oe from"elkjs/lib/elk.bundled.js";import{d as re}from"./chunks/use-odigos-api-CgkEC7if.js";import"@xyflow/react/dist/style.css";import"zustand";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";import"@apollo/client";import"@apollo/client/link/error";import"@apollo/client/link/context";import"@apollo/client/utilities";const ne=o.div`
2
2
  padding: 12px;
3
3
  border-radius: 12px;
4
4
  background-color: ${({theme:e})=>e.v2.colors.silver[750]};
@@ -2,12 +2,20 @@
2
2
  * `useSnapshotsApi` — central-ui's cross-cluster snapshot reads.
3
3
  *
4
4
  * Reactive `data` / `loading` flow through the `useSnapshots()` sub-hook, which
5
- * owns a `useApiQuery('GET_ALL_CLUSTER_SNAPSHOTS')`. The hook honors the
6
- * operation's `canRun(ctx)` guard INTERNALLY: when the host blocks the op for
7
- * the active context (e.g. central-ui can't snapshot a < v1.20 proxy) the query
8
- * is skipped and `data` stays `undefined` consumers treat that as the signal
9
- * to fall back to the per-proxy `namespacesApi` path. Imperative
10
- * `getAllClusterSnapshots` / `getClusterSnapshot` remain for fire-and-forget reads.
5
+ * routes by the active context:
6
+ * - In-proxy (a specific proxy is selected, e.g. the overview's
7
+ * AddSourceDrawer) it owns a `useApiQuery('GET_CLUSTER_SNAPSHOT')` scoped to
8
+ * the selected proxy id and wraps that single cluster into the
9
+ * `AllClusterSnapshots` shape consumers expect.
10
+ * - Out-of-proxy (the connections overview / bulk AddSourceDrawer) it owns a
11
+ * `useApiQuery('GET_ALL_CLUSTER_SNAPSHOTS')` for the full cross-cluster
12
+ * aggregate.
13
+ * Either way the op's `canRun(ctx)` guard is honored INTERNALLY: when the host
14
+ * blocks the op for the active context (e.g. central-ui can't snapshot a
15
+ * < v1.20 proxy, or a VM proxy) the query is skipped and `data` stays
16
+ * `undefined` — consumers treat that as the signal to fall back to the
17
+ * per-proxy `namespacesApi` path. Imperative `getAllClusterSnapshots` /
18
+ * `getClusterSnapshot` remain for fire-and-forget reads.
11
19
  */
12
20
  import type { AllClusterSnapshots, ClusterSnapshot } from '@/types';
13
21
  import type { OperationContext, OdigosApiOperations } from '../types';
@@ -1 +1 @@
1
- import{e as o,r,f as t}from"../chunks/use-odigos-api-UctF_jx_.js";export{O as OdigosApiProvider,p as prepareNamespacePayloads,a as prepareSourcePayloads,u as useApiLazyQuery,b as useApiMutation,c as useApiQuery,d as useOdigosApi}from"../chunks/use-odigos-api-UctF_jx_.js";export{O as OdigosApiConnectionsScope}from"../chunks/connections-scope-CogqbI1K.js";import{useApolloClient as e}from"@apollo/client";import{P as s,t as i}from"../chunks/ui-components-CrXELmQx.js";import"react";import"react/jsx-runtime";import"@apollo/client/link/error";import"@apollo/client/link/context";import"@apollo/client/utilities";import"styled-components";import"../icons.js";import"zustand";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"../chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";const n=()=>{const s=e(),{operations:i,context:n}=o();return{multiFetch:async(o,r,e)=>{const a=i[o];return a?t(s,a,r,e,n):{results:[],allSucceeded:!1,anySucceeded:!1,successCount:0,failureCount:r.length,error:`Operation ${String(o)} not configured`}},bulkPersistSources:async(o,t)=>{const e=[];for(const a of o){const o={...n,proxyID:a},{error:c}=await r(s,i.PERSIST_SOURCES,t,o);c&&e.push(`${a}: ${c}`)}return e.length?{error:e.join(", ")}:void 0},applyConfigurations:async(o,t)=>{if(!i.UPDATE_REMOTE_CONFIG)return{error:"UPDATE_REMOTE_CONFIG not configured"};const{error:e}=await r(s,i.UPDATE_REMOTE_CONFIG,{formData:t,connectionIds:o},n);return e?{error:e}:void 0}}},m=(o,r)=>o.platformType===s.K8s?r.K8s:o.platformType===s.Vm?r.Vm:void 0,l=o=>r=>{const t=o[r.platformType];if(!t)return;const e=Object.keys(t);if(0===e.length)return;const s=i(r.schemaVersion??r.version),n=[...e].sort((o,r)=>i(r)-i(o)).find(o=>s>=i(o));return n?t[n]:void 0},f=(o,r)=>{const t={};for(const e of Object.keys(o))t[e]=r(o[e]);return t};export{m as pickByPlatform,n as useApiForConnections,l as versionedDocument,f as vmDialectMap};
1
+ import{e as o,r,f as t}from"../chunks/use-odigos-api-CgkEC7if.js";export{O as OdigosApiProvider,p as prepareNamespacePayloads,a as prepareSourcePayloads,u as useApiLazyQuery,b as useApiMutation,c as useApiQuery,d as useOdigosApi}from"../chunks/use-odigos-api-CgkEC7if.js";export{O as OdigosApiConnectionsScope}from"../chunks/connections-scope-BLrBW0hm.js";import{useApolloClient as e}from"@apollo/client";import{P as s,t as i}from"../chunks/ui-components-CrXELmQx.js";import"react";import"react/jsx-runtime";import"@apollo/client/link/error";import"@apollo/client/link/context";import"@apollo/client/utilities";import"styled-components";import"../icons.js";import"zustand";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"../chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";const n=()=>{const s=e(),{operations:i,context:n}=o();return{multiFetch:async(o,r,e)=>{const a=i[o];return a?t(s,a,r,e,n):{results:[],allSucceeded:!1,anySucceeded:!1,successCount:0,failureCount:r.length,error:`Operation ${String(o)} not configured`}},bulkPersistSources:async(o,t)=>{const e=[];for(const a of o){const o={...n,proxyID:a},{error:c}=await r(s,i.PERSIST_SOURCES,t,o);c&&e.push(`${a}: ${c}`)}return e.length?{error:e.join(", ")}:void 0},applyConfigurations:async(o,t)=>{if(!i.UPDATE_REMOTE_CONFIG)return{error:"UPDATE_REMOTE_CONFIG not configured"};const{error:e}=await r(s,i.UPDATE_REMOTE_CONFIG,{formData:t,connectionIds:o},n);return e?{error:e}:void 0}}},m=(o,r)=>o.platformType===s.K8s?r.K8s:o.platformType===s.Vm?r.Vm:void 0,l=o=>r=>{const t=o[r.platformType];if(!t)return;const e=Object.keys(t);if(0===e.length)return;const s=i(r.schemaVersion??r.version),n=[...e].sort((o,r)=>i(r)-i(o)).find(o=>s>=i(o));return n?t[n]:void 0},f=(o,r)=>{const t={};for(const e of Object.keys(o))t[e]=r(o[e]);return t};export{m as pickByPlatform,n as useApiForConnections,l as versionedDocument,f as vmDialectMap};
package/lib/contexts.js CHANGED
@@ -1 +1 @@
1
- export{A as ActionFormContextProvider,D as DataStreamFormContextProvider,a as DestinationFormContextProvider,R as RuleFormContextProvider,S as SamplingRuleFormType,b as SamplingRulesFormProvider,c as SourceEditFormContextProvider,d as SourceInstrumentFormContextProvider,u as useActionFormContext,e as useDataStreamFormContext,f as useDestinationFormContext,g as useRuleFormContext,h as useSamplingRulesFormContext,i as useSourceEditFormContext,j as useSourceInstrumentFormContext}from"./chunks/source-instrument-form-context-CowQuxT5.js";export{O as OdigosProvider,c as checkVersionSupport,u as useOdigos}from"./chunks/helpers-zByTbpzZ.js";import{jsx as o}from"react/jsx-runtime";import{useMemo as r,useContext as t,createContext as s}from"react";export{O as OdigosApiConnectionsScope}from"./chunks/connections-scope-CogqbI1K.js";export{O as OdigosApiProvider,p as prepareNamespacePayloads,a as prepareSourcePayloads,u as useApiLazyQuery,b as useApiMutation,c as useApiQuery,d as useOdigosApi}from"./chunks/use-odigos-api-UctF_jx_.js";export{pickByPlatform,useApiForConnections,versionedDocument,vmDialectMap}from"./contexts/odigos-api.js";import"./chunks/ui-components-CrXELmQx.js";import"styled-components";import"./icons.js";import"zustand";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";import"@apollo/client";import"@apollo/client/link/error";import"@apollo/client/link/context";import"@apollo/client/utilities";const n=s({formType:void 0}),m=({children:e,formType:t})=>{const s=r(()=>({formType:t}),[t]);return o(n.Provider,{value:s,children:e})},l=()=>t(n);export{m as StorybookProvider,l as useStorybook};
1
+ export{A as ActionFormContextProvider,D as DataStreamFormContextProvider,a as DestinationFormContextProvider,R as RuleFormContextProvider,S as SamplingRuleFormType,b as SamplingRulesFormProvider,c as SourceEditFormContextProvider,d as SourceInstrumentFormContextProvider,u as useActionFormContext,e as useDataStreamFormContext,f as useDestinationFormContext,g as useRuleFormContext,h as useSamplingRulesFormContext,i as useSourceEditFormContext,j as useSourceInstrumentFormContext}from"./chunks/source-instrument-form-context-D7wjfWpw.js";export{O as OdigosProvider,c as checkVersionSupport,u as useOdigos}from"./chunks/helpers-45znEVHP.js";import{jsx as o}from"react/jsx-runtime";import{useMemo as r,useContext as t,createContext as s}from"react";export{O as OdigosApiConnectionsScope}from"./chunks/connections-scope-BLrBW0hm.js";export{O as OdigosApiProvider,p as prepareNamespacePayloads,a as prepareSourcePayloads,u as useApiLazyQuery,b as useApiMutation,c as useApiQuery,d as useOdigosApi}from"./chunks/use-odigos-api-CgkEC7if.js";export{pickByPlatform,useApiForConnections,versionedDocument,vmDialectMap}from"./contexts/odigos-api.js";import"./chunks/ui-components-CrXELmQx.js";import"styled-components";import"./icons.js";import"zustand";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";import"@apollo/client";import"@apollo/client/link/error";import"@apollo/client/link/context";import"@apollo/client/utilities";const n=s({formType:void 0}),m=({children:e,formType:t})=>{const s=r(()=>({formType:t}),[t]);return o(n.Provider,{value:s,children:e})},l=()=>t(n);export{m as StorybookProvider,l as useStorybook};
@@ -1 +1 @@
1
- export{be as ActionType,dp as Actions,dn as RichTitle}from"../chunks/ui-components-CrXELmQx.js";export{C as CancelModal,j as DURATION_OPTIONS,g as DeleteModal,e as DurationErrorsSection,D as DynamicField,I as InstrumentationPreviewSection,N as NOISY_PERCENTAGE_OPTIONS,h as OdigosLogoTextByTier,O as OperationSection,b as PERCENTAGE_OPTIONS,f as PercentageSection,P as PresetWithCustomInput,R as RuleInfoSection,d as RuleTypeSection,c as SamplingPreviewSection,S as SignalsCheckboxList,a as SourceScopeSection,U as UpgradeModal,i as WIDE_DRAWER_WIDTH,W as WideDrawer,Y as YamlSectionCard}from"../chunks/index-Bio7SJqx.js";export{C as ColoredSpan,D as ColoredSpanVariant}from"../chunks/helpers-zByTbpzZ.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"prism-react-renderer";import"../chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";
1
+ export{be as ActionType,dp as Actions,dn as RichTitle}from"../chunks/ui-components-CrXELmQx.js";export{C as CancelModal,j as DURATION_OPTIONS,g as DeleteModal,e as DurationErrorsSection,D as DynamicField,I as InstrumentationPreviewSection,N as NOISY_PERCENTAGE_OPTIONS,h as OdigosLogoTextByTier,O as OperationSection,b as PERCENTAGE_OPTIONS,f as PercentageSection,P as PresetWithCustomInput,R as RuleInfoSection,d as RuleTypeSection,c as SamplingPreviewSection,S as SignalsCheckboxList,a as SourceScopeSection,U as UpgradeModal,i as WIDE_DRAWER_WIDTH,W as WideDrawer,Y as YamlSectionCard}from"../chunks/index-D-8Yak_c.js";export{C as ColoredSpan,D as ColoredSpanVariant}from"../chunks/helpers-45znEVHP.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"prism-react-renderer";import"../chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";
package/lib/snippets.js CHANGED
@@ -1 +1 @@
1
- export{be as ActionType,dp as Actions,dn as RichTitle}from"./chunks/ui-components-CrXELmQx.js";export{C as CancelModal,j as DURATION_OPTIONS,g as DeleteModal,e as DurationErrorsSection,D as DynamicField,I as InstrumentationPreviewSection,N as NOISY_PERCENTAGE_OPTIONS,h as OdigosLogoTextByTier,O as OperationSection,b as PERCENTAGE_OPTIONS,f as PercentageSection,P as PresetWithCustomInput,R as RuleInfoSection,d as RuleTypeSection,c as SamplingPreviewSection,S as SignalsCheckboxList,a as SourceScopeSection,U as UpgradeModal,i as WIDE_DRAWER_WIDTH,W as WideDrawer,Y as YamlSectionCard}from"./chunks/index-Bio7SJqx.js";export{C as ColoredSpan,D as ColoredSpanVariant}from"./chunks/helpers-zByTbpzZ.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"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";
1
+ export{be as ActionType,dp as Actions,dn as RichTitle}from"./chunks/ui-components-CrXELmQx.js";export{C as CancelModal,j as DURATION_OPTIONS,g as DeleteModal,e as DurationErrorsSection,D as DynamicField,I as InstrumentationPreviewSection,N as NOISY_PERCENTAGE_OPTIONS,h as OdigosLogoTextByTier,O as OperationSection,b as PERCENTAGE_OPTIONS,f as PercentageSection,P as PresetWithCustomInput,R as RuleInfoSection,d as RuleTypeSection,c as SamplingPreviewSection,S as SignalsCheckboxList,a as SourceScopeSection,U as UpgradeModal,i as WIDE_DRAWER_WIDTH,W as WideDrawer,Y as YamlSectionCard}from"./chunks/index-D-8Yak_c.js";export{C as ColoredSpan,D as ColoredSpanVariant}from"./chunks/helpers-45znEVHP.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"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odigos/ui-kit",
3
- "version": "0.0.259",
3
+ "version": "0.0.260",
4
4
  "author": "Odigos",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,5 +0,0 @@
1
- import{useMemo as e,useContext as t,createContext as r,useCallback as a,useState as n,useEffect as o}from"react";import{HttpLink as i,from as s,split as c,ApolloClient as d,InMemoryCache as u,ApolloProvider as l,useLazyQuery as E,useApolloClient as f,useQuery as T,gql as _}from"@apollo/client";import{jsx as S}from"react/jsx-runtime";import{onError as y}from"@apollo/client/link/error";import{setContext as R}from"@apollo/client/link/context";import{getMainDefinition as p}from"@apollo/client/utilities";import{W as m,F as O,p as A,o as I,Z as N,_ as C,E as h,P as g,T as L,h as P,$ as G,a0 as v,a1 as U,a2 as D,a3 as w,a4 as F,a5 as M}from"./ui-components-CrXELmQx.js";const k=e=>{if(!e)return!1;const t=e.toLowerCase();return t.includes("authentication required")||t.includes("authentication expired")||t.includes("http 401")},b=r(null),H=()=>{const e=t(b);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},W=({apolloConfig:t,operations:r,context:a,children:n})=>{const o=e(()=>(e=>{const t=new i({uri:e.httpUrl,credentials:e.credentials??"same-origin"}),r=y(({graphQLErrors:t,networkError:r})=>{t&&t.length>0&&t.some(e=>k(e.message))&&e.onAuthError?.(),r&&(401===r.statusCode||k(r.message))&&e.onAuthError?.()}),a=R(async(t,r)=>{const a={...r.headers};if(e.authHeader){const t=await e.authHeader();Object.assign(a,t)}return e.csrfHeader&&Object.assign(a,e.csrfHeader()),{headers:a}}),n=[];e.additionalLinks?.length&&n.push(...e.additionalLinks),n.push(a,r,t);let o=s(n);e.wsLink&&(o=c(({query:e})=>{const t=p(e);return"OperationDefinition"===t.kind&&"subscription"===t.operation},e.wsLink,o));const l=e.defaultFetchPolicies;return new d({link:o,cache:new u({addTypename:e.addTypename??!0,typePolicies:e.cacheTypePolicies}),defaultOptions:{watchQuery:{fetchPolicy:l?.watchQuery??"cache-and-network"},query:{fetchPolicy:l?.query??"cache-first"},mutate:{fetchPolicy:l?.mutate??"network-only"}}})})(t),[t.httpUrl,t.wsLink,t.addTypename,t.credentials]),E=e(()=>({operations:r,context:a,apolloConfig:t}),[r,a,t]);return S(l,{client:o,children:S(b.Provider,{value:E,children:n})})},Y=b,x=(e,t)=>{if(e)return"string"==typeof e?e:N(e,t)},K=e=>{const{addNotification:t}=m(),r=(r,a,n,o,i)=>t({type:r,title:a,message:n,crdType:e,target:x(o,e),hideFromHistory:i});return{notify:r,notifyError:(e,t,a)=>r(I.Error,e,t,a),notifySuccess:(e,t,a)=>r(I.Success,e,t,a),notifyPending:(e,t)=>r(I.Default,"Pending",e,t,!0),notifyReadonly:()=>{t({type:I.Warning,title:A.READONLY,message:O.READONLY_WARNING,hideFromHistory:!0})}}},V=e=>{e({type:I.Warning,title:A.READONLY,message:O.READONLY_WARNING,hideFromHistory:!0})},$=e=>({error:e,results:[],allSucceeded:!1,anySucceeded:!1,successCount:0,failureCount:0}),B=(e,t)=>{if(e)return"function"==typeof e?e(t):e},j=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)},q=(e,t)=>e.client??t,Q=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(q(t,e),r,a)}catch(e){return{error:j(e)}}const o=B(t.document,a);if(!o)return{error:"Query operation not supported in this context"};const i=t.transformVariables?t.transformVariables(r,a):r,s=q(t,e);try{const e=await s.query({query:o,variables:i,fetchPolicy:n??"network-only"});return{data:t.transformResult?t.transformResult(e.data,a):e.data,error:e.error?j(e.error):void 0}}catch(e){return{error:j(e)}}},z=async(e,t,r,a)=>{if(!t)return{error:"Mutation operation not configured"};if(t.canRun&&!t.canRun(a))return{data:void 0};if(t.run)try{return await t.run(q(t,e),r,a)}catch(e){return{error:j(e)}}const n=B(t.document,a);if(!n)return{error:"Mutation operation not supported in this context"};const o=t.transformVariables?t.transformVariables(r,a):r,i=q(t,e);try{const e=await i.mutate({mutation:n,variables:o});return{data:t.transformResult?t.transformResult(e.data,a):e.data,error:void 0}}catch(e){return{error:j(e)}}},J=async(e,t,r,a,n)=>{if(!t)return $("Multi fetch operation not configured");if(!r.length)return $("No proxy ids supplied for multi fetch");const o=q(t,e);if(t.transformVariablesMulti&&(t.documentMulti||t.document)){const e=t.transformVariablesMulti(r,a,n),i=[];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=>i.push(e)):r.proxyIDs.forEach(t=>{i.push({proxyID:t,success:!e.error,data:e.data,error:e.error?.message})})}catch(e){const t=j(e);r.proxyIDs.forEach(e=>i.push({proxyID:e,success:!1,error:t}))}const s=i.filter(e=>e.success).length,c=i.length-s,d=Array.from(new Set(i.filter(e=>!!e.error).map(e=>e.error)));return{results:i,allSucceeded:0===c,anySucceeded:s>0,successCount:s,failureCount:c,error:d.length?d.join(", "):void 0}}const i=await Promise.all(r.map(async r=>{const o={...n,proxyID:r},i=await Q(e,t,a,o);return{proxyID:r,success:!i.error,data:i.data,error:i.error}})),s=i.filter(e=>e.success).length,c=i.length-s,d=Array.from(new Set(i.filter(e=>!!e.error).map(e=>e.error)));return{results:i,allSucceeded:0===c,anySucceeded:s>0,successCount:s,failureCount:c,error:d.length?d.join(", "):void 0}},X=_`
2
- query OdigosApiNoop {
3
- __typename
4
- }
5
- `,Z=(e,t)=>{if(e)return"function"==typeof e?e(t):e},ee=(e,t)=>e[t],te=(e,t,r)=>{if(void 0===t)return;return e?.transformResult?e.transformResult(t,r):t},re=(e,t,r)=>{if(!e)return;const a=e.transformVariables;return a?a(t,r):t},ae=(t,r,n)=>{const{operations:o,context:i}=H(),s=ee(o,t),c=e(()=>Z(s?.document,i),[s,i]),d=e(()=>re(s,r,i),[s,r,i]),u=!s||!c,l=!!s?.canRun&&!s.canRun(i),E=n?.skip||u||l,f=T(c??X,{variables:d,skip:E,pollInterval:n?.pollInterval,fetchPolicy:n?.fetchPolicy??"cache-and-network",notifyOnNetworkStatusChange:n?.notifyOnNetworkStatusChange,client:s?.client,onCompleted:n?.onCompleted?e=>{const t=te(s,e,i);void 0!==t&&n.onCompleted(t)}:void 0,onError:n?.onError}),_=e(()=>{if(!E)return te(s,f.data,i)},[s,i,f.data,E]),S=a(async()=>{if(u)return{data:void 0};const e=await f.refetch();return{data:te(s,e.data,i)}},[s,i,f,u]);return{data:_,loading:!E&&f.loading,error:f.error,refetch:S,unsupported:u}},ne=(t,r)=>{const{operations:n,context:o}=H(),i=ee(n,t),s=e(()=>Z(i?.document,o),[i,o]),c=!i||!s,[d,u]=E(s??X,{fetchPolicy:r?.fetchPolicy??"network-only",notifyOnNetworkStatusChange:r?.notifyOnNetworkStatusChange,client:i?.client});return{execute:a(async e=>{if(c)return{error:void 0};if(i?.canRun&&!i.canRun(o))return{data:void 0};const t=re(i,e,o),r=await d({variables:t});return r.error?{error:r.error}:{data:te(i,r.data,o)}},[i,o,d,c]),data:e(()=>te(i,u.data,o),[i,o,u.data]),loading:u.loading,error:u.error,called:u.called,unsupported:c}},oe=(t,r)=>{const{operations:o,context:i}=H(),s=f(),c=ee(o,t),d=e(()=>Z(c?.document,i),[c,i]),u=!c||!d,[l,E]=n({loading:!1,called:!1}),T=a(()=>E({loading:!1,called:!1}),[]);return[a(async e=>{if(u||!d)return{error:void 0};if(c?.canRun&&!c.canRun(i))return{data:void 0};const t=re(c,e,i),a=c?.client??s;E(e=>({...e,loading:!0,called:!0}));try{const e=await a.mutate({mutation:d,variables:t}),n=te(c,e.data,i);if(E({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 E({data:void 0,loading:!1,error:t,called:!0}),r?.onError?.(t),{error:t}}},[c,i,s,d,u,r]),{data:l.data,loading:l.loading,error:l.error,called:l.called,unsupported:u,reset:T}]},ie=[],se=(e,t,r,a)=>{let n=!0;const o={sources:[]};for(const[i,s]of Object.entries(e)){if(!s.length)continue;n=!1;const e=s.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,d=0;for(const r of e){const e=t.find(e=>e.id.namespace===i&&e.id.name===r.name&&e.id.kind===r.kind),a=e?.dataStreamNames||[];r.selected&&!e?c++:!r.selected&&e&&a.length<=1&&d++}a(c,d),o.sources.push(...e)}return{payload:o,isEmpty:n}},ce=(e,t)=>{let r=!0;const a={namespaces:[]};for(const[n,{selected:o,currentStreamName:i}]of Object.entries(e))"boolean"==typeof o&&(r=!1,a.namespaces.push({namespace:n,selected:o,currentStreamName:i||t}));return{payload:a,isEmpty:r}},de={filter:{markedForInstrumentation:!0}},ue=[],le=[],Ee=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){}},fe=[],Te=[],_e=[],Se=[],ye=(e,t)=>({...e,fields:e.fields.filter(({value:e})=>void 0!==e),currentStreamName:t}),Re=()=>{const{operations:t,context:r}=H(),n=f(),i=((e,t)=>{const r=f(),{notifyError:n,notifySuccess:o,notifyPending:i,notifyReadonly:s}=K(h.Source),{selectedStreamName:c}=P(),{setProgress:d,resetProgress:u}=G(),{setConfiguredSources:l,setConfiguredFutureApps:E}=v(),T=(e,t)=>{const{progress:r}=G.getState();e>0&&d(U.Instrumenting,{total:(r[U.Instrumenting]?.total||0)+e,current:r[U.Instrumenting]?.current||0}),t>0&&d(U.Uninstrumenting,{total:(r[U.Uninstrumenting]?.total||0)+t,current:r[U.Uninstrumenting]?.current||0})},_=a(async()=>{const{error:a}=await Q(r,e.GET_WORKLOADS,de,t);a&&n(C.Read,a)},[r,e.GET_WORKLOADS,t,n]);return{useSources:()=>{const e=ae("GET_WORKLOADS",de,{fetchPolicy:"cache-first"});return{items:e.data?.workloads??ue,loading:e.loading,refetch:_}},fetchAll:_,fetchByTargets:async(a,o)=>{const i=!!o?.slim,s=a.map(e=>D(e,h.Source)).filter(e=>e.namespace&&e.name&&e.kind);if(0===s.length)return;if(s.length>50)return void await _();const c=i&&e.GET_WORKLOADS_BY_IDS_SLIM?e.GET_WORKLOADS_BY_IDS_SLIM:e.GET_WORKLOADS_BY_IDS,{error:d}=await Q(r,c,{ids:s.map(({namespace:e,kind:t,name:r})=>({namespace:e,kind:t,name:r}))},t);d?n(C.Read,d):await _()},fetchById:async a=>{const{data:o,error:i}=await Q(r,e.GET_WORKLOADS_BY_IDS,{ids:[{namespace:a.namespace,kind:a.kind,name:a.name}]},t);if(!i)return o?.workloadsByIds?.find(e=>e.id.namespace===a.namespace&&e.id.kind===a.kind&&e.id.name===a.name);n(C.Read,i)},fetchLibraries:async a=>Q(r,e.GET_SOURCE_LIBRARIES,a,t),fetchPeerSources:async a=>Q(r,e.GET_PEER_SOURCES,{serviceName:a},t),usePeerSources:(e,t)=>ae("GET_PEER_SOURCES",e,t),persist:async(a,o)=>{if(t.isReadonly)return s();const{data:d}=await Q(r,e.GET_WORKLOADS,de,t,"cache-first"),f=d?.workloads??ue,{payload:_,isEmpty:S}=se(a,f,c,T),{payload:y,isEmpty:R}=ce(o,c);let p=!1;S||(p=!0,i("Persisting sources...")),R||p||i("Persisting namespaces...");const{error:m}=await z(r,e.PERSIST_SOURCES,_,t);if(m&&(u(U.Instrumenting),u(U.Uninstrumenting),n(C.Update,m)),e.PERSIST_NAMESPACES){const{error:a}=await z(r,e.PERSIST_NAMESPACES,y,t);a&&n(C.Update,a)}l({}),E({})},persistV2:async a=>{if(t.isReadonly)return s(),{error:"readonly"};const n=[];for(const[,o]of Object.entries(a)){const a={sources:[]},i={namespaces:[]};for(const e of o)e.name&&e.kind?a.sources.push(e):i.namespaces.push(e);if(i.namespaces.length>0&&e.PERSIST_NAMESPACES){const{error:a}=await z(r,e.PERSIST_NAMESPACES,i,t);a&&n.push(a)}if(a.sources.length>0){const{error:o}=await z(r,e.PERSIST_SOURCES,a,t);o&&n.push(o)}}return n.length?{error:n.join(", ")}:void 0},update:async(a,d)=>{if(t.isReadonly)return s();i("Updating source...");const u={sourceId:a,patchSourceRequest:{...d,currentStreamName:c}},{data:l,error:E}=await z(r,e.UPDATE_SOURCE,u,t);E?n(C.Update,E,a):l?.updateK8sActualSource&&o(C.Update,`Successfully updated "${a.name}" source`,a)},restartWorkloads:async a=>{if(t.isReadonly)return s();i("Restarting sources...");const{data:c,error:d}=await z(r,e.RESTART_WORKLOADS,{sourceIds:a},t);d?n(C.Update,d):c?.restartWorkloads&&o(C.Update,`Successfully restarted ${a.length} sources`)},restartPod:async(a,c)=>{if(t.isReadonly)return s();i("Restarting pod...");const{data:d,error:u}=await z(r,e.RESTART_POD,{namespace:a,name:c},t);u?n(C.Update,u):d?.restartPod&&o(C.Update,`Successfully restarted pod ${a}/${c}`)},recoverFromRollback:async a=>{if(t.isReadonly)return s();i("Recovering from rollback...");const{data:c,error:d}=await z(r,e.RECOVER_FROM_ROLLBACK,{sourceId:a},t);d?n(C.Update,d,a):c?.recoverFromRollbackForWorkload&&o(C.Update,"Successfully triggered recovery from rollback")}}})(t,r),s=((e,t)=>{const r=f(),{notifyError:a,notifySuccess:n,notifyReadonly:o}=K(h.Destination),{selectedStreamName:i}=P(),s=async()=>{const{error:n}=await Q(r,e.GET_DESTINATIONS,void 0,t);n&&a(C.Read,n)};return{useDestinations:()=>{const e=ae("GET_DESTINATIONS",void 0,{fetchPolicy:"cache-first"});return{items:e.data?.computePlatform?.destinations??e.data?.destinations??Se,loading:e.loading,refetch:s}},useDestinationCategories:()=>{const e=ae("GET_DESTINATION_CATEGORIES",void 0);return{data:e.data,loading:e.loading}},usePotentialDestinations:()=>{const e=ae("GET_POTENTIAL_DESTINATIONS",void 0);return{data:e.data,loading:e.loading}},fetchAll:s,testConnection:async a=>{const{data:n}=await z(r,e.TEST_DESTINATION_CONNECTION,{destination:ye(a,i)},t);return n},create:async c=>{if(t.isReadonly)return o();const{error:d}=await z(r,e.CREATE_DESTINATION,{destination:ye(c,i)},t);d?a(C.Create,d):(n(C.Create,`Successfully created "${c.type}" destination`),await s())},update:async(c,d)=>{if(t.isReadonly)return o();const{data:u,error:l}=await z(r,e.UPDATE_DESTINATION,{id:c,destination:ye(d,i)},t);l?a(C.Update,l,c):u?.updateDestination&&(n(C.Update,`Successfully updated "${d.type}" destination`,c),await s())},remove:async c=>{if(t.isReadonly)return o();const{data:d}=await Q(r,e.GET_DESTINATIONS,void 0,t,"cache-first"),u=d?.computePlatform?.destinations??d?.destinations??Se,l=u.find(e=>w(e)===c)?.destinationType?.type,{error:E}=await z(r,e.DELETE_DESTINATION,{id:c,currentStreamName:i},t);E?a(C.Delete,E,c):(n(C.Delete,`Successfully deleted "${l??c}" destination`,c),await s())}}})(t,r),c=((e,t)=>{const r=f(),{notifyError:a,notifySuccess:n,notifyReadonly:o}=K(h.Action),i=async()=>{const{error:n}=await Q(r,e.GET_ACTIONS,void 0,t);n&&a(C.Read,n)};return{useActions:()=>{const e=ae("GET_ACTIONS",void 0,{fetchPolicy:"cache-first"});return{items:e.data?.computePlatform?.actions??e.data?.actions??le,loading:e.loading,refetch:i}},fetchAll:i,create:async s=>{if(t.isReadonly)return o();if(!e.CREATE_ACTION)return;const{error:c}=await z(r,e.CREATE_ACTION,{action:s},t);c?a(C.Create,c):(n(C.Create,`Successfully created "${s.type}" action`),await i())},update:async(s,c)=>{if(t.isReadonly)return o();if(!e.UPDATE_ACTION)return;const{error:d}=await z(r,e.UPDATE_ACTION,{id:s,action:c},t);d?a(C.Update,d,s):(n(C.Update,`Successfully updated "${c.type}" action`,s),await i())},remove:async(s,c)=>{if(t.isReadonly)return o();if(!e.DELETE_ACTION)return;const{error:d}=await z(r,e.DELETE_ACTION,{id:s,actionType:c},t);d?a(C.Delete,d,s):(n(C.Delete,`Successfully deleted "${c}" action`,s),await i())}}})(t,r),d=((t,r)=>{const a=f(),{notifyError:n,notifySuccess:o,notifyReadonly:i}=K(h.InstrumentationRule),s=async()=>{const{error:e}=await Q(a,t.GET_INSTRUMENTATION_RULES,void 0,r);e&&n(C.Read,e)};return{useRules:()=>{const t=ae("GET_INSTRUMENTATION_RULES",void 0,{fetchPolicy:"cache-first"});return{items:e(()=>(t.data?.computePlatform?.instrumentationRules??t.data?.instrumentationRules??[]).map(M),[t.data]),loading:t.loading,refetch:s}},fetchAll:s,create:async(e,c)=>{if(r.isReadonly)return i();if(!t.CREATE_INSTRUMENTATION_RULE)return;const{error:d}=await z(a,t.CREATE_INSTRUMENTATION_RULE,{instrumentationRule:F(e)},r);d?n(C.Create,d):(o(C.Create,`Successfully created${c?` "${c}"`:""} rule`),await s())},update:async(e,c,d)=>{if(r.isReadonly)return i();if(!t.UPDATE_INSTRUMENTATION_RULE)return;const{error:u}=await z(a,t.UPDATE_INSTRUMENTATION_RULE,{ruleId:e,instrumentationRule:F(c)},r);u?n(C.Update,u,e):(o(C.Update,`Successfully updated${d?` "${d}"`:""} rule`,e),await s())},remove:async(e,c)=>{if(r.isReadonly)return i();if(!t.DELETE_INSTRUMENTATION_RULE)return;const{error:d}=await z(a,t.DELETE_INSTRUMENTATION_RULE,{ruleId:e},r);d?n(C.Delete,d,e):(o(C.Delete,`Successfully deleted${c?` "${c}"`:""} rule`,e),await s())}}})(t,r),u=((e,t)=>{const r=f(),{addNotification:a}=m(),{setDataStreams:n}=P(),i=(e,t)=>a({type:I.Error,title:e,message:t}),s=async()=>{const{data:a,error:o}=await Q(r,e.GET_DATA_STREAMS,void 0,t);if(o)i(C.Read,o);else if(a){const e=a.computePlatform?.dataStreams??a.dataStreams??[];n(e)}},c=e.CREATE_DATA_STREAM?async n=>{if(t.isReadonly)return V(a);const{error:o}=await z(r,e.CREATE_DATA_STREAM,{stream:n},t);o?i(C.Create,o):await s()}:void 0;return{useDataStreams:()=>{const e=ae("GET_DATA_STREAMS",void 0,{fetchPolicy:"cache-first"}),t=e.data?.computePlatform?.dataStreams??e.data?.dataStreams??_e;return o(()=>{n(t)},[JSON.stringify(t.map(e=>e.name))]),{items:t,loading:e.loading,refetch:s}},fetchAll:s,create:c,update:async(n,o)=>{if(t.isReadonly)return V(a);const{error:c}=await z(r,e.UPDATE_DATA_STREAM,{id:n,dataStream:o},t);c?i(C.Update,c):await s()},remove:async n=>{if(t.isReadonly)return V(a);const{error:o}=await z(r,e.DELETE_DATA_STREAM,{id:n},t);o?i(C.Delete,o):await s()}}})(t,r),l=((e,t)=>{const r=f(),{notifyError:a,notifyReadonly:n}=K(h.Namespace),o=async()=>{const n=await Q(r,e.GET_NAMESPACES_WITH_WORKLOADS,void 0,t);return n.error&&a(C.Read,n.error),n};return{useNamespaces:()=>{const e=ae("GET_NAMESPACES_WITH_WORKLOADS",void 0,{fetchPolicy:"cache-first"});return{items:e.data?.namespaces??Te,loading:e.loading,refetch:o}},fetchAll:o,persist:async o=>{if(t.isReadonly)return n();const{error:i}=await z(r,e.PERSIST_NAMESPACES,o,t);return i&&a(C.Update,i),i?{error:i}:void 0}}})(t,r),E=((e,t)=>{const r=f(),{notifyError:a}=K(h.Source);return{fetch:async n=>{const o=await Q(r,e.GET_K8S_MANIFEST,n,t);return o.error&&a(C.Read,o.error),o}}})(t,r),T=((e,t)=>{const r=f(),{notifyError:a,notifySuccess:n,notifyReadonly:o}=K(h.Source);return{useEffectiveConfig:(e,t)=>ae("GET_EFFECTIVE_CONFIG",e,t),useConfigYamls:e=>ae("GET_CONFIG_YAMLS",void 0,e),getEffectiveConfig:async a=>e.GET_EFFECTIVE_CONFIG?Q(r,e.GET_EFFECTIVE_CONFIG,{id:a},t):{error:"GET_EFFECTIVE_CONFIG not configured"},applyConfigurations:e.UPDATE_REMOTE_CONFIG?async(n,i)=>{if(t.isReadonly)return o();const{error:s}=await z(r,e.UPDATE_REMOTE_CONFIG,{formData:n,connectionIds:i},t);return s&&a(C.Update,s),s?{error:s}:void 0}:void 0,getConfigYamls:e.GET_CONFIG_YAMLS?async()=>Q(r,e.GET_CONFIG_YAMLS,void 0,t):void 0,updateLocalUiConfig:e.UPDATE_LOCAL_UI_CONFIG?async i=>{if(t.isReadonly)return o();const{error:s}=await z(r,e.UPDATE_LOCAL_UI_CONFIG,{config:i},t);return s?a(C.Update,s):n(C.Update,"Local UI configuration updated successfully"),s?{error:s}:void 0}:void 0,resetLocalUiConfigToDefaults:e.RESET_LOCAL_UI_CONFIG_TO_FACTORY_DEFAULTS?async()=>{if(t.isReadonly)return o();const{error:i}=await z(r,e.RESET_LOCAL_UI_CONFIG_TO_FACTORY_DEFAULTS,void 0,t);return i?a(C.Update,i):n(C.Update,"Local UI configuration reset to factory defaults"),i?{error:i}:void 0}:void 0}})(t,r),_=((e,t)=>{const r=f(),{apolloConfig:a}=H();return{fetchDescribeOdigos:e.GET_DESCRIBE_ODIGOS?async()=>Q(r,e.GET_DESCRIBE_ODIGOS,void 0,t):void 0,fetchDescribeSource:e.GET_DESCRIBE_SOURCE?async a=>Q(r,e.GET_DESCRIBE_SOURCE,a,t):void 0,downloadDiagnose:e.GET_DIAGNOSE?async(n,o)=>{const i=await Q(r,e.GET_DIAGNOSE,{input:n,dryRun:o?.dryRun??!1},t),s=i?.data?.stats?.fileCount??0;return!i.error&&s>0&&!o?.dryRun&&await Ee(a),i}:void 0}})(t,r),S=((e,t)=>{const r=f(),{notifyError:a,notifyReadonly:n}=K(h.Source),o=async()=>{e.GET_TOKENS&&await Q(r,e.GET_TOKENS,void 0,t)};return{useTokens:()=>{const e=ae("GET_TOKENS",void 0,{fetchPolicy:"cache-first"});return{items:e.data??ie,loading:e.loading,refetch:o}},updateToken:e.UPDATE_TOKEN?async o=>{if(t.isReadonly)return n();const{error:i}=await z(r,e.UPDATE_TOKEN,{token:o},t);return i&&a(C.Update,i),i?{error:i}:void 0}:void 0}})(t,r),y=((e,t)=>{const r=f();return{useMetrics:e=>ae("GET_METRICS",void 0,e),fetch:async()=>Q(r,e.GET_METRICS,void 0,t)}})(t,r),R=((e,t)=>{const r=f();return{useServiceMap:e=>ae("GET_SERVICE_MAP",void 0,e),fetch:e.GET_SERVICE_MAP?async()=>Q(r,e.GET_SERVICE_MAP,void 0,t):void 0}})(t,r),p=((e,t)=>{const r=f();return{useSlots:e=>ae("GET_PROFILING_SLOTS",void 0,e),useSourceProfiling:(e,t)=>ae("GET_SOURCE_PROFILING",e,t),fetchSlots:e.GET_PROFILING_SLOTS?async()=>Q(r,e.GET_PROFILING_SLOTS,void 0,t):void 0,fetchSourceProfiling:e.GET_SOURCE_PROFILING?async a=>Q(r,e.GET_SOURCE_PROFILING,a,t):void 0,enableProfiling:e.ENABLE_SOURCE_PROFILING?async a=>z(r,e.ENABLE_SOURCE_PROFILING,a,t):void 0}})(t,r),O=((e,t)=>{const r=f();return{useGatewayInfo:e=>ae("GET_GATEWAY_INFO",void 0,e),useGatewayPods:e=>ae("GET_GATEWAY_PODS",void 0,e),useNodeCollectorInfo:e=>ae("GET_NODE_COLLECTOR_INFO",void 0,e),useNodeCollectorPods:e=>ae("GET_NODE_COLLECTOR_PODS",void 0,e),usePodInfo:(e,t)=>ae("GET_COLLECTOR_POD_INFO",e,t),getGatewayInfo:e.GET_GATEWAY_INFO?async()=>Q(r,e.GET_GATEWAY_INFO,void 0,t):void 0,getGatewayPods:e.GET_GATEWAY_PODS?async()=>Q(r,e.GET_GATEWAY_PODS,void 0,t):void 0,getNodeCollectorInfo:e.GET_NODE_COLLECTOR_INFO?async()=>Q(r,e.GET_NODE_COLLECTOR_INFO,void 0,t):void 0,getNodeCollectorPods:e.GET_NODE_COLLECTOR_PODS?async()=>Q(r,e.GET_NODE_COLLECTOR_PODS,void 0,t):void 0,getExtendedPodInfo:e.GET_COLLECTOR_POD_INFO?async(a,n)=>Q(r,e.GET_COLLECTOR_POD_INFO,{namespace:a,name:n},t):void 0}})(t,r),A=((e,t)=>{const r=f(),{notifyError:a,notifySuccess:n,notifyReadonly:o}=K(h.SamplingRule),i=async()=>{e.GET_SAMPLING_RULES&&await Q(r,e.GET_SAMPLING_RULES,void 0,t)},s=(e,s)=>e?async c=>{if(t.isReadonly)return o();const{error:d}=await z(r,e,c,t);return d?a(s,d):(n(C.Create,"Successfully created sampling rule"),await i()),d?{error:d}:void 0}:void 0,c=(e,s)=>e?async(c,d)=>{if(t.isReadonly)return o();const{error:u}=await z(r,e,{samplingId:d.samplingId,ruleId:c,rule:d.rule},t);return u?a(s,u):(n(C.Update,"Successfully updated sampling rule"),await i()),u?{error:u}:void 0}:void 0,d=e=>e?async(s,c)=>{if(t.isReadonly)return o();const{error:d}=await z(r,e,{samplingId:c,ruleId:s},t);return d?a(C.Delete,d):(n(C.Delete,"Successfully deleted sampling rule"),await i()),d?{error:d}:void 0}:void 0;return{useSamplingRules:()=>{const e=ae("GET_SAMPLING_RULES",void 0,{fetchPolicy:"cache-first"});return{items:e.data?.computePlatform?.samplingRules??e.data?.samplingRules??fe,k8sHealthProbesConfig:e.data?.computePlatform?.k8sHealthProbesConfig??e.data?.k8sHealthProbesConfig??null,loading:e.loading,refetch:i}},fetchAll:e.GET_SAMPLING_RULES?async()=>Q(r,e.GET_SAMPLING_RULES,void 0,t):void 0,createNoisy:s(e.CREATE_NOISY_OPERATION_RULE,C.Create),updateNoisy:c(e.UPDATE_NOISY_OPERATION_RULE,C.Update),deleteNoisy:d(e.DELETE_NOISY_OPERATION_RULE),createHighlyRelevant:s(e.CREATE_HIGHLY_RELEVANT_OPERATION_RULE,C.Create),updateHighlyRelevant:c(e.UPDATE_HIGHLY_RELEVANT_OPERATION_RULE,C.Update),deleteHighlyRelevant:d(e.DELETE_HIGHLY_RELEVANT_OPERATION_RULE),createCostReduction:s(e.CREATE_COST_REDUCTION_RULE,C.Create),updateCostReduction:c(e.UPDATE_COST_REDUCTION_RULE,C.Update),deleteCostReduction:d(e.DELETE_COST_REDUCTION_RULE),updateK8sHealthProbesConfig:e.UPDATE_LOCAL_UI_SAMPLING_CONFIG?async n=>{if(t.isReadonly)return o();const{error:s}=await z(r,e.UPDATE_LOCAL_UI_SAMPLING_CONFIG,{config:{k8sHealthProbesSampling:n}},t);return s?a(C.Update,s):await i(),s?{error:s}:void 0}:void 0}})(t,r),N=((e,t)=>{const r=f();return{useSnapshots:()=>{const e=ae("GET_ALL_CLUSTER_SNAPSHOTS",void 0,{fetchPolicy:"cache-first"});return{data:e.data,loading:e.loading,unsupported:e.unsupported,refetch:e.refetch}},getAllClusterSnapshots:e.GET_ALL_CLUSTER_SNAPSHOTS?async()=>Q(r,e.GET_ALL_CLUSTER_SNAPSHOTS,void 0,t):void 0,getClusterSnapshot:e.GET_CLUSTER_SNAPSHOT?async a=>Q(r,e.GET_CLUSTER_SNAPSHOT,{clusterId:a},t):void 0}})(t,r);return{sourcesApi:i,destinationsApi:s,actionsApi:c,instrumentationRulesApi:d,dataStreamsApi:u,namespacesApi:l,k8sManifestApi:E,configApi:T,describeApi:_,tokensApi:S,metricsApi:y,serviceMapApi:R,profilingApi:p,collectorsApi:O,samplingApi:A,snapshotsApi:N,capabilities:e(()=>((e,t)=>{const r=t.platformType===g.Vm,a=t.tier===L.Onprem,n=!r;return{canBulkPersistSources:n&&!!e.PERSIST_SOURCES,canInstrumentNamespaces:n&&!!e.PERSIST_NAMESPACES,canFetchSnapshots:n&&!!e.GET_ALL_CLUSTER_SNAPSHOTS,canRecoverFromRollback:n&&!!e.RECOVER_FROM_ROLLBACK,canRestartWorkloads:n&&!!e.RESTART_WORKLOADS,canFetchPeerSources:!!e.GET_PEER_SOURCES,canFetchSourceLibraries:!!e.GET_SOURCE_LIBRARIES,canFetchK8sManifest:n&&!!e.GET_K8S_MANIFEST,canCreateDestination:n&&!!e.CREATE_DESTINATION,canTestConnection:n&&!!e.TEST_DESTINATION_CONNECTION,canFetchDestinationCategories:!!e.GET_DESTINATION_CATEGORIES,canFetchPotentialDestinations:n&&!!e.GET_POTENTIAL_DESTINATIONS,canCreateAction:n&&!!e.CREATE_ACTION,canCreateInstrumentationRule:n&&!!e.CREATE_INSTRUMENTATION_RULE,canApplyEffectiveConfig:n&&!!e.UPDATE_REMOTE_CONFIG&&!!e.GET_EFFECTIVE_CONFIG,canFetchEffectiveConfig:!!e.GET_EFFECTIVE_CONFIG,canFetchConfigYamls:!!e.GET_CONFIG_YAMLS,canFetchProfiling:n&&!!e.GET_PROFILING_SLOTS,canFetchCollectorInfo:n&&!!e.GET_GATEWAY_INFO,canManageSamplingRules:!!e.GET_SAMPLING_RULES,isEnterprise:a,isVm:r}})(t,r),[t,r]),resetCache:a(async()=>{await n.cache.reset()},[n])}};export{W as O,Y as _,se as a,oe as b,ae as c,Re as d,H as e,J as f,ce as p,z as r,ne as u};