@odigos/ui-kit 0.0.291 → 0.0.293

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +69 -72
  2. package/Makefile +1 -1
  3. package/lib/chunks/{helpers-eTR126Dv.js → helpers-DbT32OSr.js} +1 -1
  4. package/lib/chunks/index-MwonXqI1.js +338 -0
  5. package/lib/chunks/{source-instrument-form-context-opFCr-VF.js → source-instrument-form-context-CmMX5vdq.js} +1 -1
  6. package/lib/chunks/ui-components-Bhz7WgBl.js +2118 -0
  7. package/lib/components/charts/bar-chart/index.d.ts +14 -0
  8. package/lib/components/charts/index.d.ts +1 -0
  9. package/lib/components/index.d.ts +1 -0
  10. package/lib/components/ping/index.d.ts +5 -0
  11. package/lib/components/typography/index.d.ts +1 -0
  12. package/lib/components.js +1 -1
  13. package/lib/constants/strings/index.d.ts +0 -1
  14. package/lib/constants.js +1 -1
  15. package/lib/containers/insights/findings/drawer/helpers.d.ts +3 -9
  16. package/lib/containers/insights/findings/helpers.d.ts +17 -0
  17. package/lib/containers/insights/insights-context.d.ts +0 -20
  18. package/lib/containers/insights/transactions/drawer/baselines/data-drawer/db-access/helpers.d.ts +18 -0
  19. package/lib/containers/insights/transactions/drawer/baselines/data-drawer/db-access/index.d.ts +7 -0
  20. package/lib/containers/insights/transactions/drawer/baselines/data-drawer/db-access/map.d.ts +7 -0
  21. package/lib/containers/insights/transactions/drawer/baselines/data-drawer/db-access/node.d.ts +6 -0
  22. package/lib/containers/insights/transactions/drawer/baselines/data-drawer/db-access/types.d.ts +34 -0
  23. package/lib/containers/insights/transactions/drawer/baselines/data-drawer/histogram.d.ts +7 -0
  24. package/lib/containers/insights/transactions/drawer/baselines/data-drawer/index.d.ts +8 -0
  25. package/lib/containers/insights/transactions/drawer/observations/data-drawer/index.d.ts +8 -0
  26. package/lib/containers/overview/search/builder.d.ts +1 -1
  27. package/lib/containers/pipeline-collectors/general-info/helpers/get-general-text-cards.d.ts +1 -1
  28. package/lib/containers/pipeline-collectors/general-info/index.d.ts +1 -0
  29. package/lib/containers.js +563 -533
  30. package/lib/contexts.js +1 -1
  31. package/lib/functions/safe-json-parse/index.d.ts +1 -1
  32. package/lib/functions.js +1 -1
  33. package/lib/hooks.js +1 -1
  34. package/lib/icons/common/db-icon/index.d.ts +2 -0
  35. package/lib/icons/common/index.d.ts +1 -0
  36. package/lib/icons.js +1 -1
  37. package/lib/snippets/index.d.ts +0 -1
  38. package/lib/snippets.js +1 -1
  39. package/lib/store/index.d.ts +0 -1
  40. package/lib/store.js +1 -1
  41. package/lib/theme.js +1 -1
  42. package/lib/types/insights/index.d.ts +2 -0
  43. package/lib/types.js +1 -1
  44. package/lib/visuals.js +1 -1
  45. package/package.json +1 -1
  46. package/lib/chunks/index-CWNa5Q-H.js +0 -351
  47. package/lib/chunks/ui-components-Bvz84w4Q.js +0 -1981
  48. package/lib/snippets/code-modal/index.d.ts +0 -9
  49. package/lib/snippets/trace-modal/index.d.ts +0 -8
  50. package/lib/store/useDarkMode.d.ts +0 -19
@@ -0,0 +1,338 @@
1
+ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import r,{css as l,useTheme as n}from"styled-components";import i,{useMemo as o,useRef as s,useCallback as c,useState as d,memo as u,useEffect as p,Fragment as h,forwardRef as g,useImperativeHandle as m}from"react";import"@xyflow/react/dist/style.css";import{Handle as v,Position as f,getSmoothStepPath as b,BaseEdge as y,EdgeLabelRenderer as x,MarkerType as $,ReactFlowProvider as k,useNodesState as C,useEdgesState as S,ReactFlow as w,Background as T,useReactFlow as M}from"@xyflow/react";import{D as A,c as P,F as L,d as O,e as E,f as I,g as N,h as R,B as V,i as D,j as z,k as X,C as _,N as H,W as B,l as j,m as q,V as U,n as G,o as K,p as W,q as F,r as Y,s as J,u as Z,v as Q,I as ee,w as te,x as ae,y as re,z as le,E as ne,G as ie,H as oe,S as se,J as ce,K as de,U as ue,L as pe,M as he,O as ge,Q as me,X as ve,Y as fe,Z as be,_ as ye,$ as xe,a0 as $e,a1 as ke,a2 as Ce,a3 as Se,a4 as we,a5 as Te,a6 as Me,T as Ae,a7 as Pe,a8 as Le,a9 as Oe,aa as Ee,ab as Ie,ac as Ne,ad as Re,ae as Ve,af as De,ag as ze,ah as Xe,ai as _e,aj as He,b as Be,ak as je,al as qe,am as Ue,an as Ge,ao as Ke,ap as We,aq as Fe,ar as Ye,as as Je,at as Ze,au as Qe,av as et,aw as tt,ax as at,ay as rt,az as lt,aA as nt,aB as it,aC as ot,aD as st,aE as ct,aF as dt,aG as ut,aH as pt,aI as ht,aJ as gt,aK as mt,aL as vt,aM as ft,aN as bt,aO as yt,aP as xt,aQ as $t,aR as kt,aS as Ct,aT as St,aU as wt,aV as Tt,aW as Mt,aX as At,aY as Pt,aZ as Lt,a_ as Ot,a$ as Et,b0 as It,b1 as Nt,b2 as Rt,R as Vt,b3 as Dt,b4 as zt,A as Xt,b5 as _t,b6 as Ht}from"./ui-components-Bhz7WgBl.js";import{UserIcon as Bt,DestinationIcon as jt,HomeIcon as qt,VIcon as Ut,TrashIcon as Gt,PlusIcon as Kt,VSquareIcon as Wt,XSquareIcon as Ft,EditIcon as Yt,OdigosLogoTextCentral as Jt,OdigosLogoTextEnterprise as Zt,OdigosLogoTextCommunity as Qt,OdigosLogoTextColoredCentral as ea,OdigosLogoTextColoredEnterprise as ta,OdigosLogoTextColoredCommunity as aa,ArrowLeftIcon as ra,ArrowRightIcon as la,CopyIcon as na,YamlIcon as ia}from"../icons.js";import{i as oa,m as sa,u as ca,n as da,a as ua,C as pa,b as ha,d as ga,e as ma,f as va,g as fa,h as ba,j as ya,k as xa}from"./helpers-DbT32OSr.js";const $a=/^[a-zA-Z]$/,ka=new Set(["*","+","?"]),Ca=new Set(["^","$"]),Sa={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"},wa=r.div`
2
+ padding: 8px 16px;
3
+ border-radius: 6px;
4
+ border: 1px solid ${({theme:e})=>e.v2.colors.silver[500]};
5
+ background: ${({theme:e})=>e.v2.colors.black[500]};
6
+ font-family: ${({theme:e})=>e.font_family.code};
7
+ font-size: 12px;
8
+ line-height: 20px;
9
+ color: ${({theme:e})=>e.v2.colors.white[500]};
10
+ word-break: break-all;
11
+ white-space: pre-wrap;
12
+ user-select: text;
13
+
14
+ /* Wraps the background tightly to each visual fragment when a colored
15
+ token gets split across two visual lines. Without this the highlight
16
+ stretches all the way to the right edge of the container. */
17
+ & > span {
18
+ box-decoration-break: clone;
19
+ -webkit-box-decoration-break: clone;
20
+ }
21
+ `,Ta=r.span`
22
+ background: ${({$kind:e})=>Sa[e]};
23
+ `,Ma=({pattern:t,"data-id":a})=>{const r=o(()=>(e=>{const t=[];let a=0,r=!1;const l=(e,a)=>{const r=t[t.length-1];r&&r.kind===a?r.text+=e:t.push({text:e,kind:a})};for(;a<e.length;){const t=e[a];if(r){if("]"===t){l("]","class-bracket"),r=!1,a++;continue}if("\\"===t&&a+1<e.length){l(e.slice(a,a+2),"class-content"),a+=2;continue}l(t,"class-content"),a++}else{if("("===t&&"?"===e[a+1]){let t=2;const r=e[a+2];if(":"===r||"="===r||"!"===r)t=3;else if("<"===r){const r=e[a+3];if("="===r||"!"===r)t=4;else{const r=e.indexOf(">",a+2);-1!==r&&(t=r-a+1)}}l(e.slice(a,a+t),"group"),a+=t;continue}if("("!==t&&")"!==t)if("["!==t)if(ka.has(t)||Ca.has(t))l(t,"anchor-quantifier"),a++;else{if("{"===t){const t=e.indexOf("}",a);if(t>a&&/^\{\d+,?\d*\}$/.test(e.slice(a,t+1))){l(e.slice(a,t+1),"anchor-quantifier"),a=t+1;continue}}if("\\"===t&&a+1<e.length){const t=e[a+1];$a.test(t)?l(e.slice(a,a+2),"anchor-quantifier"):l(e.slice(a,a+2),"literal"),a+=2;continue}"|"!==t?(l(t,"literal"),a++):(l("|","alternation"),a++)}else"^"===e[a+1]?(l("[^","class-bracket"),a+=2):(l("[","class-bracket"),a++),r=!0;else l(t,"group"),a++}}return t})(t),[t]);return e(wa,t?{"data-id":a,children:r.map((t,a)=>e(Ta,{$kind:t.kind,children:t.text},a))}:{"data-id":a,children:" "})},Aa="rgba(102, 191, 255, 0.5)",Pa=l`
24
+ font-family: ${({theme:e})=>e.font_family.code};
25
+ font-size: 12px;
26
+ line-height: 20px;
27
+ letter-spacing: 0;
28
+ white-space: pre-wrap;
29
+ word-wrap: break-word;
30
+ overflow-wrap: break-word;
31
+ /* tab-size keeps tabs visually consistent across the two layers — some
32
+ browsers default to 8 on a textarea but 4 on a div. */
33
+ -moz-tab-size: 4;
34
+ tab-size: 4;
35
+ margin: 0;
36
+ `,La=r.div`
37
+ position: relative;
38
+ width: 100%;
39
+ min-height: ${({$minHeight:e})=>e}px;
40
+ border-radius: 6px;
41
+ border: 1px solid ${({theme:e})=>e.v2.colors.silver[500]};
42
+ background: ${({theme:e})=>e.v2.colors.black[500]};
43
+
44
+ &:hover,
45
+ &:focus-within {
46
+ border-color: ${({theme:e})=>e.v2.colors.silver[300]};
47
+ }
48
+ `,Oa=r.div`
49
+ ${Pa}
50
+ position: absolute;
51
+ inset: 0;
52
+ padding: 12px;
53
+ pointer-events: none;
54
+ color: transparent;
55
+ overflow: hidden;
56
+
57
+ /* Mandatory for backgrounds that wrap across visual lines. */
58
+ & > span {
59
+ box-decoration-break: clone;
60
+ -webkit-box-decoration-break: clone;
61
+ }
62
+ `,Ea=r.textarea`
63
+ ${Pa}
64
+ position: relative;
65
+ z-index: 1;
66
+ display: block;
67
+ width: 100%;
68
+ min-height: ${({$minHeight:e})=>e}px;
69
+ padding: 12px;
70
+ border: 0;
71
+ background: transparent;
72
+ outline: none;
73
+ resize: vertical;
74
+ color: ${({theme:e})=>e.v2.colors.white[500]};
75
+ caret-color: ${({theme:e})=>e.v2.colors.white[500]};
76
+ box-sizing: border-box;
77
+
78
+ &::placeholder {
79
+ color: ${({theme:e})=>e.v2.colors.silver[600]};
80
+ }
81
+ `,Ia=e=>({before:e,matchPre:"",capture:"",matchPost:"",after:""}),Na=({regex:a,value:r,onChange:l,minHeight:n=240,...i})=>{const d=s(null),u=s(null),p=o(()=>((e,t)=>{if(!e||!t)return Ia(t);let a;try{a=new RegExp(e)}catch{return Ia(t)}const r=a.exec(t);if(!r)return Ia(t);const l=r.index,n=r.index+r[0].length;if(r.length<2||null==r[1])return{before:t.slice(0,l),matchPre:"",capture:t.slice(l,n),matchPost:"",after:t.slice(n)};const i=r[0].indexOf(r[1]),o=i>=0?l+i:l,s=o+r[1].length;return{before:t.slice(0,l),matchPre:t.slice(l,o),capture:t.slice(o,s),matchPost:t.slice(s,n),after:t.slice(n)}})(a,r),[a,r]),h=c(()=>{d.current&&u.current&&(d.current.scrollTop=u.current.scrollTop,d.current.scrollLeft=u.current.scrollLeft)},[]);return t(La,{$minHeight:n,children:[t(Oa,{ref:d,"aria-hidden":!0,children:[p.before,e("span",{style:{background:Aa},children:p.matchPre}),e("span",{style:{background:"rgba(102, 242, 102, 0.5)"},children:p.capture}),e("span",{style:{background:Aa},children:p.matchPost}),p.after,r.endsWith("\n")?" ":""]}),e(Ea,{ref:u,$minHeight:n,value:r,onChange:e=>l(e.target.value),onScroll:h,spellCheck:!1,...i})]})},Ra=r.div`
82
+ flex: 1;
83
+ min-height: 0;
84
+ overflow-y: auto;
85
+ `,Va=r.div`
86
+ background: ${({theme:e})=>e.v2.colors.silver[900]};
87
+ border-radius: 8px;
88
+ padding: 8px;
89
+ display: flex;
90
+ flex-direction: column;
91
+ gap: 12px;
92
+ `,Da=r.div`
93
+ padding: 8px 16px;
94
+ border-radius: 8px;
95
+ background: ${({theme:e})=>e.v2.colors.silver[800]};
96
+ font-family: ${({theme:e})=>e.font_family.code};
97
+ font-size: 12px;
98
+ line-height: 20px;
99
+ color: ${({theme:e,$tone:t})=>"error"===t?e.v2.colors.red[500]:"match"===t?e.v2.colors.white[500]:e.v2.colors.silver[200]};
100
+ word-break: break-all;
101
+ white-space: pre-wrap;
102
+ user-select: text;
103
+ `,za=({isOpen:a,regex:r,onClose:l,initialTestString:n=""})=>{const[i,s]=d(n),c=o(()=>((e,t)=>{if(!e)return{ok:!0,isMatch:!1,message:P.RESULT_EMPTY_REGEX};if(!t)return{ok:!0,isMatch:!1,message:P.RESULT_EMPTY_INPUT};let a;try{a=new RegExp(e)}catch(e){return{ok:!1,message:e instanceof Error?e.message:P.RESULT_INVALID_REGEX_FALLBACK}}const r=a.exec(t);return r?{ok:!0,isMatch:!0,message:r.length>1?r[1]:r[0]}:{ok:!0,isMatch:!1,message:P.RESULT_NO_MATCH}})(r,i),[r,i]),u=c.ok?c.isMatch?"match":"neutral":"error";return e(A,{isOpen:a,header:{title:P.TITLE,onClose:()=>{s(""),l()}},children:e(Ra,{children:t(Va,{children:[t(L,{$gap:6,children:[e(O,{label:P.REGEX_LABEL}),e(Ma,{pattern:r,"data-id":"regex-tester-regex"}),!r&&e(E,{size:N.XXS,color:I.Secondary,children:P.REGEX_EMPTY_HINT})]}),t(L,{$gap:6,children:[t(R,{$width:"100%",$justifyContent:"space-between",$alignItems:"center",children:[e(O,{label:P.TEST_STRING_LABEL}),e(V,{"data-id":"regex-tester-unescape",label:P.UNESCAPE_LABEL,tooltip:P.UNESCAPE_TOOLTIP,variant:z.Secondary,size:D.S,onClick:()=>s(e=>(e=>{let t="";for(let a=0;a<e.length;a++){if("\\"===e[a]&&a+1<e.length){const r=e[a+1],l="n"===r?"\n":"t"===r?"\t":"r"===r?"\r":'"'===r?'"':"'"===r?"'":"\\"===r?"\\":null;if(null!=l){t+=l,a++;continue}}t+=e[a]}return t})(e)),disabled:(p=i,!/\\["'\\nrt]/.test(p))})]}),e(Na,{name:"regex-tester-test-string","data-id":"regex-tester-test-string",placeholder:P.TEST_STRING_PLACEHOLDER,regex:r,value:i,onChange:s,minHeight:240}),e(X,{helpMessage:P.TEST_STRING_HELP})]}),t(L,{$gap:8,children:[e(O,{label:P.RESULT_LABEL}),e(Da,{$tone:u,"data-id":"regex-tester-result",children:c.message}),c.ok&&c.isMatch&&e(E,{size:N.XXS,color:I.Secondary,children:P.RESULT_CAPTURE_HINT})]})]})})});var p},Xa=r.div`
104
+ display: grid;
105
+ grid-template-rows: ${({$open:e})=>e?"1fr":"0fr"};
106
+ opacity: ${({$open:e})=>e?1:0};
107
+ margin-bottom: ${({$open:e,$gapCancelPx:t})=>e?"0":`-${t}px`};
108
+ transition:
109
+ grid-template-rows ${220}ms ease,
110
+ opacity ${220}ms ease ${({$open:e,$delayInMs:t})=>e?`${t}ms`:"0ms"},
111
+ margin-bottom ${220}ms ease;
112
+ pointer-events: ${({$open:e})=>e?"auto":"none"};
113
+
114
+ > .animated-collapse-inner {
115
+ overflow: hidden;
116
+ min-height: 0;
117
+ }
118
+ `,_a=({open:t,children:a,delayInMs:r=0,gapCancelPx:l=0})=>e(Xa,{$open:t,$delayInMs:r,$gapCancelPx:l,"aria-hidden":!t,children:e("div",{className:"animated-collapse-inner",children:a})}),Ha=r.div`
119
+ box-sizing: border-box;
120
+ min-width: 109px;
121
+ max-width: 160px;
122
+ padding: 12px;
123
+ border-radius: 8px;
124
+ display: flex;
125
+ flex-direction: column;
126
+ gap: 8px;
127
+ background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
128
+ border: 1px
129
+ ${({theme:e,$isRoot:t,$isVirtual:a})=>t?`solid ${e.v2.colors.purple[400]}`:a?`dashed ${e.v2.colors.silver[300]}`:`solid ${e.v2.colors.silver[200]}`};
130
+ opacity: ${({$isVirtual:e,$isRoot:t})=>e&&!t?.85:1};
131
+ `,Ba=r.div`
132
+ display: flex;
133
+ align-items: center;
134
+ gap: 4px;
135
+ min-width: 0;
136
+ `,ja=r.div`
137
+ flex-shrink: 0;
138
+ width: 16px;
139
+ height: 16px;
140
+ display: flex;
141
+ align-items: center;
142
+ justify-content: center;
143
+ `,qa={visibility:"hidden"},Ua=u(({data:r})=>{const l=n(),{service:i,namespace:o,isVirtual:s,isRoot:c,isAttacker:d,isUser:u}=r,p=((e,t)=>"user"===e?Bt:t?jt:qt)(i,s),h=c?l.v2.colors.purple[400]:l.v2.colors.silver[200],g=c?I.Link:I.Secondary,m=o?`${o}/${i}`:i,b=s?"virtual":"-";return t(a,{children:[e(v,d||u?{type:"source",position:f.Bottom,style:qa}:{type:"source",position:f.Top,style:qa}),e(v,d||u?{type:"target",position:f.Right,style:qa}:{type:"target",position:f.Left,style:qa}),t(Ha,{$isRoot:c,$isVirtual:s,children:[t(Ba,{children:[e(ja,{children:e(p,{size:16,fill:h})}),e(E,{size:N.XXXS,color:g,nowrap:!0,children:m})]}),e(E,{size:N.XXXS,color:g,nowrap:!0,children:b})]})]})});Ua.displayName=Ua.name;const Ga="0;0.5;1",Ka=u(({id:r,sourceX:l,sourceY:i,targetX:s,targetY:c,sourcePosition:d,targetPosition:u,markerEnd:p,style:h,data:g})=>{const m=n(),[v]=b({sourceX:l,sourceY:i,targetX:s,targetY:c,sourcePosition:d,targetPosition:u}),f=`${r}__blast-radius-motion`,$=!!g?.isAttacker,k="string"==typeof h?.stroke?h.stroke:$?m.v2.colors.red[500]:m.v2.colors.silver[400],C=$?m.v2.colors.red[700]:m.v2.colors.silver[600],S=$?m.v2.colors.red[400]:m.v2.colors.silver[200],{travelDuration:w,ballCount:T}=o(()=>{const e=Math.hypot(s-l,c-i),t=((e,t)=>{if("undefined"==typeof document)return t;const a=document.createElementNS("http://www.w3.org/2000/svg","path");return a.setAttribute("d",e),a.getTotalLength()||t})(v,e);return{travelDuration:Math.max(1.2,t/100),ballCount:Math.min(10,Math.max(3,Math.round(t/72)))}},[v,l,i,s,c]),M=`${w.toFixed(3)}s`;return t(a,{children:[e(y,{id:r,path:v,markerEnd:p,style:{...h,stroke:k,strokeWidth:1}}),e(x,{children:t("svg",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"visible",pointerEvents:"none"},children:[e("path",{id:f,d:v,fill:"none",stroke:"none"}),Array.from({length:T}).map((a,r)=>{const l=`-${(w/T*r).toFixed(3)}s`;return t("circle",{r:0,fill:C,children:[e("animateMotion",{dur:M,begin:l,repeatCount:"indefinite",children:e("mpath",{href:`#${f}`})}),e("animate",{attributeName:"r",dur:M,begin:l,repeatCount:"indefinite",keyTimes:Ga,values:"0;3.5;3.5"}),e("animate",{attributeName:"fill",dur:M,begin:l,repeatCount:"indefinite",keyTimes:Ga,values:`${C};${S};${S}`})]},r)})]})})]})});var Wa,Fa;Ka.displayName=Ka.name,(e=>{e.Service="blast-radius-service"})(Wa||(Wa={})),(e=>{e.Animated="blast-radius-animated"})(Fa||(Fa={}));const Ya=(e,t)=>{const a=(e||"").trim();return a?`${a}/${t}`:t},Ja=e=>Ya(e.namespace,e.service),Za="user",Qa=(e,t,a)=>{const r=new Set(e),l=[...e];for(;l.length;){const e=l.shift();for(const n of a.get(e)??[])n===t||r.has(n)||(r.add(n),l.push(n))}return r},er=(e,t,a)=>{const r=new Map;if(!e.length)return r;const l=[];for(let t=0;t<e.length;t+=6)l.push(e.slice(t,t+6));const n=-72*(l.length-1)/2;return l.forEach((e,l)=>{const i=n+72*l;e.forEach((e,l)=>{const n=t+a*(l+1)*160;r.set(e,{x:n,y:i})})}),r},tr=(e,t,a)=>{const r=t.map(e=>a.get(e)).filter(e=>!!e);if(!r.length)return{x:0,y:72};const l={x:r.reduce((e,t)=>e+t.x,0)/r.length,y:r.reduce((e,t)=>e+t.y,0)/r.length+72},n=new Set([...a.entries()].filter(([t])=>t!==e).map(([,e])=>`${e.x},${e.y}`));let i=l;for(;n.has(`${i.x},${i.y}`);)i={x:i.x,y:i.y+72};return i},ar=r.div`
144
+ position: relative;
145
+ width: 100%;
146
+ height: 286px;
147
+ border-radius: 8px;
148
+ overflow: hidden;
149
+ background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
150
+
151
+ .react-flow__attribution {
152
+ visibility: hidden;
153
+ }
154
+
155
+ * {
156
+ transition: none;
157
+ }
158
+ `,rr={[Wa.Service]:Ua},lr={[Fa.Animated]:Ka},nr={duration:300,padding:.2,includeHiddenNodes:!0,maxZoom:1},ir=({trigger:e})=>{const{fitView:t}=M(),a=s(!0);return p(()=>{a.current?a.current=!1:e>0&&requestAnimationFrame(()=>t(nr))},[e,t]),null},or=({subgraph:a})=>{const r=n(),[l,i,s]=C([]),[c,u,h]=S([]),[g,m]=d(0),[v,f]=d(null),b=o(()=>{const e=a.nodes.map(e=>`${e.namespace||""}/${e.service}:${e.isVirtual?1:0}`).join("|"),t=a.edges.map(e=>`${e.clientNamespace||""}/${e.clientService}->${e.serverNamespace||""}/${e.serverService}`).join("|");return`${(e=>`${e.root.namespace||""}/${e.root.service}`)(a)}::${e}::${t}`},[a]);p(()=>{const e=((e,t)=>{const a=t.find(t=>t.service===Za&&t.id!==e);return a?.id??null})(Ja(a.root),a.nodes.map(e=>({id:Ja(e),service:e.service}))),t=((e,t)=>{const a=Ja(e.root);return e.nodes.map(e=>{const r=Ja(e);return{id:r,type:Wa.Service,position:{x:0,y:0},data:{service:e.service,namespace:e.namespace||"",isVirtual:e.isVirtual,isRoot:r===a,isAttacker:r===t,isUser:e.service===Za},measured:{width:120,height:58}}})})(a,e),l=new Set(t.map(e=>e.id)),n=((e,t,a,r)=>{const l=t.v2.colors.silver[400],n=t.v2.colors.red[500],i=Ja(e.root);return e.edges.flatMap(e=>{const t=(e=>Ya(e.clientNamespace,e.clientService))(e),o=(e=>Ya(e.serverNamespace,e.serverService))(e);if(!a.has(t)||!a.has(o))return[];const s=!!r&&(t===r&&o===i||t===i&&o===r),c=s?n:l;return[{id:`${t}->${o}`,type:"smoothstep",source:t,target:o,data:{isAttacker:s},markerEnd:{type:$.ArrowClosed,color:c,width:16,height:16},style:{stroke:c,strokeWidth:1}}]})})(a,r,l,e),o=((e,t)=>{if(!e.length)return{nodes:e,edges:t};const a=(e.find(e=>e.data.isRoot)??e[0]).id,r=e.find(e=>e.data.isAttacker)?.id??null,l=new Map,n=new Map,i=new Map;for(const t of e)l.set(t.id,[]),n.set(t.id,[]),i.set(t.id,[]);for(const e of t)l.get(e.source)?.push(e.target),n.get(e.target)?.push(e.source),i.get(e.source)?.push(e.target),i.get(e.target)?.push(e.source);const o=Qa((n.get(a)??[]).filter(e=>e!==r),a,i),s=Qa((l.get(a)??[]).filter(e=>e!==r&&!o.has(e)),a,i);r&&(o.delete(r),s.delete(r));const c=((e,t)=>{const a=new Map([[e,0]]),r=[e];for(;r.length;){const e=r.shift(),l=(a.get(e)??0)+1;for(const n of t.get(e)??[])a.has(n)||(a.set(n,l),r.push(n))}return a})(a,i),d=[...o].sort((e,t)=>{const a=(c.get(t)??0)-(c.get(e)??0);return 0!==a?a:e.localeCompare(t)}),u=[...s].filter(e=>!o.has(e)).sort((e,t)=>{const a=(c.get(e)??0)-(c.get(t)??0);return 0!==a?a:e.localeCompare(t)});for(const t of e)t.id===a||t.id===r||o.has(t.id)||s.has(t.id)||d.push(t.id);const p=new Map([[a,{x:0,y:0}]]);for(const[e,t]of er(d,0,-1))p.set(e,t);for(const[e,t]of er(u,0,1))p.set(e,t);return r&&p.set(r,tr(r,i.get(r)??[],p)),{nodes:e.map(e=>({...e,position:p.get(e.id)??e.position})),edges:t}})(t,n);i(o.nodes),u(o.edges),f(null),m(e=>e+1)},[b,a,r,i,u]);const y=o(()=>v?c.map(e=>{if(e.source===v||e.target===v)return{...e,type:Fa.Animated};const t={opacity:.3};return{...e,style:{...e.style,...t},labelStyle:{...e.labelStyle,...t},labelBgStyle:{...e.labelBgStyle,...t}}}):c,[c,v]);return e(ar,{children:t(w,{nodes:l,edges:y,nodeTypes:rr,edgeTypes:lr,onNodesChange:s,onEdgesChange:h,onNodeMouseEnter:(e,t)=>f(t.id),onNodeMouseLeave:()=>f(null),nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,panOnDrag:!0,zoomOnScroll:!0,minZoom:.4,maxZoom:1.5,proOptions:{hideAttribution:!0},children:[e(T,{color:r.v2.colors.silver[600],gap:17,size:1}),e(ir,{trigger:g})]})})},sr=({blastRadius:t})=>t?.nodes?.length?e(k,{children:e(or,{subgraph:t})}):e(_,{children:e(H,{subTitle:"No blast-radius neighborhood for this service yet."})}),cr=({isOpen:t,onClose:a,onDeny:r,onApprove:l})=>e(B,{title:"Discard changes?",description:"You have unsaved changes.\nIf you cancel now, your changes won't be saved.",isOpen:t,onClose:a,denyButton:{label:"Keep editing",variant:z.Secondary,onClick:()=>{r?.(),a()}},approveButton:{label:"Discard changes",variant:z.Primary,onClick:()=>{l?.(),a()}}}),dr=({isOpen:t,onClose:a,onViewConnector:r})=>e(B,{isOpen:t,onClose:a,visual:()=>e(U,{scale:1.2,icon:Ut}),title:q.CLOUD_CONNECTOR_CREATED_MODAL_TITLE,description:q.CLOUD_CONNECTOR_CREATED_MODAL_DESC,denyButton:{label:j.STAY_ON_CONNECTIONS,variant:z.Secondary,onClick:a},approveButton:{label:j.GO_TO_CONNECTOR_OVERVIEW,variant:z.Primary,onClick:r??a}}),ur=({isOpen:t,onClose:a,onDeny:r,onApprove:l,action:n="delete",target:i,description:o,overrideApproveButtonLabel:s,overrideDenyButtonLabel:c})=>{const d=n.charAt(0).toUpperCase()+n.substring(1),u=i?.endsWith("s")?"these":"this";return e(B,{title:`${d}${i?` ${i}`:""}?`,description:o??`Are you sure you want to ${n}${i?` ${u} ${i}`:""}?`,isOpen:t,onClose:a,denyButton:{label:c??"Go back",variant:z.Secondary,onClick:()=>{r?.(),a()}},approveButton:{label:s??d,variant:z.Primary,onClick:()=>{l?.(),a()}}})},pr=({componentType:t,inputType:a,name:r,label:l,tooltip:n,badge:i,placeholder:o,required:s,disabled:c,value:d,setValue:u,errorMessage:p,warnMessage:h,helpMessage:g,dropdownOptions:m,dropdownNoSearch:v,dropdownNoCheckbox:f,timeUnits:b,timeDefaultUnit:y,toggleSize:x=F.L,keyLabel:$,valueLabel:k})=>{switch(t){case G.Input:return e(re,{name:r,type:a,label:l,tooltip:n,badge:i,placeholder:o,required:s,disabled:c,value:d??"",onChange:e=>{const t=e.target.value;u(a===le.Number?""===t?null:Number(t):t)},errorMessage:p,warnMessage:h,helpMessage:g},r);case G.MultiInput:return e(ae,{name:r,label:l,tooltip:n,badge:i,placeholder:o,required:s,disabled:c,values:Array.isArray(d)?d:te(d,[]),setValues:e=>u(e),errorMessage:p,warnMessage:h,helpMessage:g,plain:!0},r);case G.KeyValuePair:return e(ee,{name:r,label:l,tooltip:n,badge:i,required:s,disabled:c,limitFieldsPerRow:2,columns:[{keyName:"key",label:$||"Key",placeholder:$||"Key"},{keyName:"value",label:k||"Value",placeholder:k||"Value"}],values:Array.isArray(d)?d:te(d,[]),setValues:e=>u(e),errorMessage:p,warnMessage:h,helpMessage:g},r);case G.TextArea:return e(Q,{name:r,label:l,tooltip:n,badge:i,required:s,disabled:c,placeholder:o,value:d??"",onChange:e=>u(e.target.value),errorMessage:p,warnMessage:h,helpMessage:g},r);case G.Dropdown:return e(Z,{name:r,label:l,tooltip:n,badge:i,placeholder:o,required:s,disabled:c,withSearch:!v,options:m?.map(e=>({id:e.id||"",label:e.label||"",withCheckbox:!f}))||[],values:d?[String(d)]:[],setValues:e=>u(e[0]),errorMessage:p,warnMessage:h,helpMessage:g},r);case G.Checkbox:return e(J,{name:r,label:l,tooltip:n,badge:i,value:!0===d||"true"===d,onChange:e=>u(e),disabled:c,errorMessage:p,warnMessage:h,helpMessage:g},r);case G.Time:return e(Y,{name:r,label:l,tooltip:n,badge:i,placeholder:o,required:s,disabled:c,value:d??"",setValue:e=>u(e),units:b,defaultUnit:y,errorMessage:p,warnMessage:h,helpMessage:g},r);case G.Toggle:return e(K,{name:r,size:x,labelAlign:W.Right,label:l,tooltip:n,badge:i,value:!0===d||"true"===d,onChange:e=>u(e),disabled:c,errorMessage:p,warnMessage:h,helpMessage:g},r);default:return null}},hr=r.div`
159
+ display: flex;
160
+ flex-wrap: wrap;
161
+ gap: 8px;
162
+ `,gr=r.div`
163
+ display: flex;
164
+ align-items: center;
165
+ gap: 8px;
166
+ padding: 8px 12px;
167
+ border-radius: 8px;
168
+ cursor: pointer;
169
+ background: ${({theme:e,$selected:t})=>t?e.v2.colors.silver[700]:e.v2.colors.silver[800]};
170
+ border: 1px solid ${({theme:e,$selected:t})=>t?e.v2.colors.silver[500]:e.v2.colors.silver[750]};
171
+
172
+ &:hover {
173
+ background: ${({theme:e})=>e.v2.colors.silver[700]};
174
+ }
175
+ `,mr=r.div`
176
+ display: flex;
177
+ width: 32px;
178
+ height: 32px;
179
+ justify-content: center;
180
+ align-items: center;
181
+ flex-shrink: 0;
182
+ `,vr=r.div`
183
+ display: flex;
184
+ flex-direction: column;
185
+ gap: 12px;
186
+ `,fr=r.div`
187
+ display: flex;
188
+ flex-wrap: wrap;
189
+ gap: 6px;
190
+ `,br=r.div`
191
+ display: flex;
192
+ align-items: center;
193
+ gap: 8px;
194
+ &::before,
195
+ &::after {
196
+ content: '';
197
+ flex: 1;
198
+ height: 1px;
199
+ background-color: ${({theme:e})=>e.v2.colors.silver[700]};
200
+ }
201
+ `,yr=r.div`
202
+ padding: 2px 10px;
203
+ border-radius: 999px;
204
+ background-color: ${({theme:e})=>e.v2.colors.silver[700]};
205
+ border: 1px solid ${({theme:e})=>e.v2.colors.silver[600]};
206
+ `,xr={[me.JavaScript]:"Node.js",[me.DotNet]:".NET",[me.Php]:"PHP",[me.Java]:"Java",[me.Go]:"Go",[me.Python]:"Python",[me.Ruby]:"Ruby",[me.Rust]:"Rust"},$r=[me.Python,me.Java,me.JavaScript,me.DotNet,me.Php,me.Ruby,me.Go],kr=[{value:"all",label:"Entire Cluster"},{value:"source",label:"Specific Source"},{value:"namespace",label:"Specific Namespace"},{value:"language",label:"Specific Programming Language"}];function Cr(e){return xr[e]||e.charAt(0).toUpperCase()+e.slice(1)}function Sr(e){return null!=e?`${e}. ${we}`:we}const wr=({readOnly:t,...a})=>e(t?Ar:Lr,{...a}),Tr=({title:a,count:r,children:l})=>t(L,{$gap:6,children:[t(R,{$gap:8,$alignItems:"center",children:[e(E,{size:N.XS,color:I.Primary,nowrap:!0,children:a}),r>1&&e(E,{size:N.XXS,color:I.Secondary,nowrap:!0,children:`(${Ce})`})]}),e(fr,{children:l})]}),Mr=()=>{const t=n();return e(br,{children:e(yr,{children:e(E,{size:N.XXS,color:t.v2.colors.white[500],nowrap:!0,children:Se})})})},Ar=({scopes:a,titleNumber:r,title:l,subTitle:n,icon:o,bgTint:s="900",entireClusterWarningMessage:c})=>{const d=l??Sr(r),u={icon:o,title:d,subTitle:n,alignItems:n||o?"flex-start":void 0};if(oa(a))return e(ne,{bgTint:s,richTitle:u,withCollapse:!0,collapseIsDefaultOpen:!0,children:t(L,{$gap:8,children:[e(ie,{status:se.Default,message:oe,fullWidth:!0}),c&&e(ie,{status:se.Warning,message:c,fullWidth:!0,smallIcon:!0})]})});const p=a.sources??[],h=a.namespaces??[],g=a.languages??[],m=[];p.length&&m.push({kind:"sources",node:e(Tr,{title:ce,count:p.length,children:p.map((t,a)=>{const r=[t.namespace,t.kind,t.name].filter(Boolean),l=r.length?r.join(" / "):ue;return e(de,{label:l},`src-${a}-${l}`)})})}),h.length&&m.push({kind:"namespaces",node:e(Tr,{title:pe,count:h.length,children:h.map((t,a)=>e(de,{label:t},`ns-${a}-${t}`))})}),g.length&&m.push({kind:"languages",node:e(Tr,{title:he,count:g.length,children:g.map((t,a)=>{const r=ve(t);return e(de,{label:Cr(t),leftIcon:r},`lang-${a}-${t}`)})})});const v=n??(m.length>1?ge:void 0);return e(ne,{bgTint:s,richTitle:{icon:o,title:d,subTitle:v,alignItems:v||o?"flex-start":void 0},withCollapse:!0,collapseIsDefaultOpen:!0,children:e(ne,{bgTint:"800",children:e(vr,{children:m.map((a,r)=>t(i.Fragment,{children:[r>0&&e(Mr,{}),a.node]},a.kind))})})})},Pr=(e,t="all")=>e.sources.length>0?"source":e.namespaces.length>0?"namespace":e.languages.length>0?"language":t,Lr=({scopes:r,onChange:l,sourceOptions:n=[],namespaceOptions:i=[],supportedLanguages:s,titleNumber:u,title:h,subTitle:g,icon:m,dataIdPrefix:v="source-scope",slim:f,disabled:b,hideLogicNote:y,hideEntireClusterNote:x,entireClusterWarningMessage:$,defaultScopeTab:k="all"})=>{const C=r??sa(),[S,w]=d(()=>Pr(C,k)),{sources:T,namespaces:M,languages:A}=C,P=T.length>0||M.length>0||A.length>0;p(()=>{P&&"all"===S&&w(Pr(C,k))},[k,P,S,C]);const O=o(()=>kr.map(e=>"language"===e.value&&0===s?.length?null:{...e,disabled:"all"===e.value&&P}).filter(Boolean),[P]),R=o(()=>T.map(e=>`${e.namespace}/${e.kind}/${e.name}`),[T]),V=o(()=>[...M],[M]),D=o(()=>new Set(A),[A]),z=c(e=>{w(e)},[]),X=c(e=>{const t=e.map(e=>(e=>{const t=e.split("/");return 3!==t.length?null:{namespace:t[0],kind:t[1],name:t[2]}})(e)).filter(e=>null!=e).map(e=>({namespace:e.namespace,kind:e.kind,name:e.name}));l({...C,sources:t})},[C,l]),_=c(e=>{l({...C,namespaces:e})},[C,l]),H=c(e=>{const t=C.languages,a=t.includes(e)?t.filter(t=>t!==e):[...t,e];l({...C,languages:a})},[C,l]),B=!P&&"all"===S,j=(s||$r).map(e=>({id:e,label:xr[e]??e.charAt(0).toUpperCase()+e.slice(1),Icon:ve(e)})),q=h??Sr(u),U=g??be;return e(fe,{richTitle:f?{icon:m,title:q,titleSize:N.XS,titleColor:I.Secondary,tooltip:U,alignItems:m?"flex-start":void 0}:{icon:m,title:q,subTitle:U,subTitleWrap:!0,alignItems:m||U?"flex-start":void 0},backgroundColor:f?"transparent":void 0,padding:f?0:void 0,children:t(L,{$gap:16,children:[B?t(a,{children:[!x&&e(ie,{status:se.Default,message:oe,fullWidth:!0,smallIcon:!0}),$&&e(ie,{status:se.Warning,message:$,fullWidth:!0,smallIcon:!0})]}):!y&&e(ie,{status:se.Info,message:ge,fullWidth:!0,smallIcon:!0}),e(L,{$alignItems:"flex-start",children:e(ye,{options:O,selected:S,setSelected:z,disabled:b})}),"source"===S&&e(xe,{multiple:!0,"data-id":`${v}-autocomplete-source`,options:n,value:R,onSelect:X,placeholder:$e,disabled:b}),"namespace"===S&&e(xe,{multiple:!0,"data-id":`${v}-autocomplete-namespace`,options:i,value:V,onSelect:_,placeholder:"Search namespace",disabled:b}),"language"===S&&j.length>0&&e(hr,{children:j.map(({id:a,label:r,Icon:l})=>{const n=D.has(a);return t(gr,{$selected:n,onClick:()=>H(a),children:[e(J,{name:`${v}-lang-${a}`,size:ke.S,value:n,onChange:()=>H(a),disabled:b}),e(mr,{children:e(l,{size:20})}),e(E,{size:N.XS,nowrap:!0,children:r})]},a)})})]})})},Or=e=>{if(null!=e){if(!Array.isArray(e)&&"object"==typeof e)return Object.entries(e).map(([e,t])=>({id:e,label:null==t?e:String(t)}));if(Array.isArray(e))return e.map(e=>"string"==typeof e?{id:e,label:e}:e)}},Er=e=>{if(!Array.isArray(e)||e.length<3)return;const[t,a,r]=e;return e=>{const l=null==e?.[t]?"":String(e[t]);switch(a){case"=":case"==":case"===":return l===r;case"!=":case"!==":return l!==r;default:return!0}}},Ir=e=>{if(Array.isArray(e))return e.map(e=>{const t=e;return{keyName:String(t.keyName??t.name??""),label:t.label??t.displayName,tooltip:t.tooltip,placeholder:t.placeholder,helpMessage:t.helpMessage,componentType:t.componentType,options:Or(t.options??t.values),fullRow:t.fullRow,defaultValue:t.defaultValue,withRegexTester:t.withRegexTester,separator:t.separator,copyByColumn:t.copyByColumn,renderCondition:Er(t.renderCondition)}})},Nr=e=>{if(Array.isArray(e))return e.map(e=>{if("string"==typeof e)return{id:e,label:e};const t=e;return{id:String(t.id??t.keyName??t.name??""),label:t.label??t.displayName??String(t.id??""),tooltip:t.tooltip,fields:Array.isArray(t.fields)?t.fields.map(Rr):void 0}})},Rr=e=>{const t="string"==typeof e.componentProperties?te(e.componentProperties,{}):e.componentProps||{};return{name:e.name,componentType:e.componentType,inputType:e.inputType??t.inputType??t.type,title:e.displayName,tooltip:t.tooltip,placeholder:t.placeholder,helpMessage:t.helpMessage,required:t.required,initialValue:e.initialValue,renderCondition:e.renderCondition,options:Or(t.options??t.values),itemWrapperKey:t.itemWrapperKey,columns:Ir(t.columns),limitFieldsPerRow:t.limitFieldsPerRow,variant:t.variant,wrapKey:t.wrapKey,checkboxOptions:Nr(t.options??t.values),checkedValue:t.checkedValue??"true",valueMode:t.valueMode??"object",fields:Array.isArray(t.fields)?t.fields.map(Rr):void 0,addLabel:t.addLabel,itemLabel:t.itemLabel,keyLabel:t.titleKey??t.keyLabel,valueLabel:t.titleValue??t.valueLabel,persistAs:t.persistAs}},Vr=e=>{const t=e.initialValue;if(void 0!==t&&""!==t)return e.componentType===G.CheckboxList?"array"===e.valueMode?te(t,[]):te(t,{}):e.componentType!==G.MultiInput&&e.componentType!==G.MultiTabledInput||!e.wrapKey?e.componentType===G.MultiInput||e.componentType===G.MultiTabledInput?te(t,[]):e.componentType===G.SourceScopes?"null"===t||"{}"===t?sa():da(te(t,null)):e.componentType===G.Toggle||e.componentType===G.Checkbox?"true"===t:t:{[e.wrapKey]:te(t,[])}},Dr=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),zr=e=>Array.isArray(e)?e:[],Xr=e=>{const t={};return e.forEach(e=>{t[String(e.key??"")]=String(e.value??"")}),t},_r=e=>Dr(e)?Object.entries(e).map(([e,t])=>({key:e,value:String(t??"")})):[],Hr=({field:t,value:a,setValue:r,errorMessage:l,disabled:n})=>{const[i,o]=d(()=>_r(a));return p(()=>{const e=Dr(a)?a:{};((e,t)=>{const a=Object.keys(e),r=Object.keys(t);return a.length===r.length&&a.every(a=>Object.prototype.hasOwnProperty.call(t,a)&&t[a]===e[a])})(Xr(i),e)||o(_r(a))},[a]),e(ee,{name:t.name,label:t.title,tooltip:t.tooltip,helpMessage:t.helpMessage,required:t.required,disabled:n,limitFieldsPerRow:2,columns:[{keyName:"key",label:t.keyLabel||"Key",placeholder:t.keyLabel||"Key"},{keyName:"value",label:t.valueLabel||"Value",placeholder:t.valueLabel||"Value"}],values:i,setValues:e=>{o(e),r(Xr(e))},errorMessage:l})},Br=({field:r,value:l,setValue:n,errorMessage:i,disabled:o,keyValuePersistAs:s,sourceOptions:c,namespaceOptions:u})=>{const{name:p,componentType:h,inputType:g,title:m,tooltip:v,placeholder:f,helpMessage:b,required:y,initialValue:x,options:$,itemWrapperKey:k,columns:C,limitFieldsPerRow:S,variant:w,wrapKey:T,checkboxOptions:M}=r,[A,P]=d({open:!1,value:""});if(h===G.SourceScopes)return e(wr,{scopes:da(l),onChange:e=>n(e),sourceOptions:c,namespaceOptions:u,dataIdPrefix:`dynamic-field-${p}`,slim:!0});if(h===G.CheckboxList&&"array"===r.valueMode){const a=zr(l),r=(e,t)=>n(t?[...a.filter(t=>t!==e),e]:a.filter(t=>t!==e));return t(L,{$gap:12,children:[m&&e(O,{label:m,tooltip:v,required:y}),e(L,{$gap:8,children:(M||[]).map(t=>{const l=e(J,{name:t.id,label:t.label,value:a.includes(t.id),disabled:o,onChange:e=>r(t.id,e)},t.id);return t.tooltip?e(Ae,{text:t.tooltip,withIcon:!0,children:l},t.id):l})}),e(X,{errorMessage:i,helpMessage:b})]})}if(h===G.CheckboxList){const a=Dr(l)?l:{},c=(e=>"emptyObject"!==e.checkedValue||{})(r),d=e=>"emptyObject"===r.checkedValue?Dr(e):!!e;return t(L,{$gap:12,children:[m&&e(E,{size:N.XS,color:I.Secondary,nowrap:!0,children:m}),e(L,{$gap:12,children:(M||[]).map(r=>{const l=a[r.id],i=d(l),u=Dr(l)?l:{},h=e(J,{label:r.label,value:i,disabled:o,onChange:e=>n({...a,[r.id]:e?Dr(l)?l:c:null})}),g=r.tooltip?e(Ae,{text:r.tooltip,withIcon:!0,children:h}):h,m=i&&r.fields?.length?e(L,{$gap:12,$padding:"0 0 0 24px",children:r.fields.map(t=>e(Br,{field:t,value:u[t.name],setValue:e=>n({...a,[r.id]:{...u,[t.name]:e}}),disabled:o,keyValuePersistAs:s},`${p}-${r.id}-${t.name}`))}):null;return t(L,{$gap:12,children:[g,m]},r.id)})}),e(X,{errorMessage:i,helpMessage:b})]})}if(h===G.MultiTabledInput){const r=zr(T?l?.[T]:l),s=e=>n(T?{...Dr(l)?l:{},[T]:e}:e),c=(C||[]).some(e=>e.withRegexTester);return t(a,{children:[e("cards"===w?Pe:ee,{name:p,label:m,tooltip:v,helpMessage:b,required:y,disabled:o,columns:C||[],limitFieldsPerRow:S,values:r,setValues:s,errorMessage:i,onTestRegex:c?e=>P({open:!0,value:e}):void 0}),c&&e(za,{isOpen:A.open,regex:A.value,onClose:()=>P({open:!1,value:""})})]})}if(h===G.MultiInput&&T){const t=zr(l?.[T]);return e(ae,{name:p,label:m,tooltip:v,helpMessage:b,required:y,disabled:o,placeholder:f,values:t,setValues:e=>n({...Dr(l)?l:{},[T]:e}),errorMessage:i})}if(h===G.MultiInput&&k){const t=zr(l).map(e=>String(e?.[k]??""));return e(ae,{name:p,label:m,tooltip:v,helpMessage:b,required:y,disabled:o,placeholder:f,values:t,setValues:e=>n(e.map(e=>({[k]:e}))),errorMessage:i})}return h===G.KeyValuePair?"map"===(r.persistAs??s)?e(Hr,{field:r,value:l,setValue:n,errorMessage:i,disabled:o}):e(pr,{componentType:h,name:p,label:m,tooltip:v,helpMessage:b,disabled:o,required:y,errorMessage:i,keyLabel:r.keyLabel,valueLabel:r.valueLabel,value:l??[],setValue:n}):e(pr,{componentType:h,inputType:g,name:p,label:m,tooltip:v,helpMessage:b,disabled:o,required:y,placeholder:f,errorMessage:i,dropdownOptions:$,value:(null==l?x:l)??"",setValue:n})},jr=({field:r,value:l,setValue:i,disabled:o,keyValuePersistAs:s,sourceOptions:c,namespaceOptions:d})=>{const u=n(),p=zr(l),g=p.length?p:[{}],m=r.fields||[],v=e=>i(e);return t(a,{children:[g.map((a,l)=>t(h,{children:[e(Me,{}),t(L,{$gap:12,children:[t(R,{$justifyContent:"space-between",$alignItems:"center",children:[e(O,{label:`${r.itemLabel||r.title||"Item"} ${l+1}`}),e(V,{leftIcon:()=>e(Gt,{fill:u.v2.colors.red[500]}),variant:z.Secondary,size:D.S,onClick:()=>(e=>{const t=g.filter((t,a)=>a!==e);v(t)})(l),disabled:o||1===g.length})]}),m.map(t=>e(Br,{field:t,value:a[t.name],setValue:e=>((e,t,a)=>v(g.map((r,l)=>l===e?{...r,[t]:a}:r)))(l,t.name,e),disabled:o,keyValuePersistAs:s,sourceOptions:c,namespaceOptions:d},`${r.name}-group-${l}-${t.name}`))]})]},`${r.name}-group-${l}`)),e(V,{variant:z.Secondary,label:r.addLabel||"Add",leftIcon:Kt,onClick:()=>v([...g,{}]),disabled:o}),e(Me,{})]})},qr=({field:a,value:r,setValue:l,errorMessage:n,disabled:i})=>t(L,{$gap:12,children:[a.title&&e(O,{label:a.title,tooltip:a.tooltip,required:a.required}),e(L,{$gap:8,children:(a.checkboxOptions||[]).map(t=>{const a=e(J,{name:t.id,label:t.label,value:!0===r?.[t.id],disabled:i,onChange:e=>l(t.id,e)},t.id);return t.tooltip?e(Ae,{text:t.tooltip,withIcon:!0,children:a},t.id):a})}),e(X,{errorMessage:n,helpMessage:a.helpMessage})]}),Ur=({signals:t,fields:r,value:l,setValue:n,formErrors:i,disabled:o,seedInitialValues:s,keyValuePersistAs:c="map",sourceOptions:d,namespaceOptions:u})=>{const{isK8s:h}=ca(),g=(r||[]).filter(e=>!!e).map(e=>Rr(e));return p(()=>{if(!s)return;const e=l||{},t={};g.forEach(a=>{if(a.componentType===G.SourceScopes&&!h)return;const r=a.componentType===G.SourceScopes?Vr(a)??sa():Vr(a);if(void 0===r)return;if(a.componentType===G.CheckboxList&&"flatFields"===a.valueMode&&Dr(r))return void Object.entries(r).forEach(([a,r])=>{void 0!==e[a]&&null!==e[a]||(t[a]=r)});const l=e[a.name];if(a.componentType===G.SourceScopes){if(void 0!==l)return}else if(null!=l)return;t[a.name]=Dr(r)&&Dr(t[a.name])?{...t[a.name],...r}:r}),Object.entries(t).forEach(([e,t])=>n(e,t))},[]),e(a,{children:g.map((a,r)=>{const s=Object.entries(l||{}).map(([e,t])=>({name:e,key:e,value:t}));if(a.renderCondition&&!Te(a.renderCondition,t,s))return null;if(a.componentType===G.SourceScopes&&!h)return null;const p=l?.[a.name],g=`${a.name}-${r}`;if(a.componentType===G.FieldGroup)return e(jr,{field:a,value:p,setValue:e=>n(a.name,e),disabled:o,keyValuePersistAs:c,sourceOptions:d,namespaceOptions:u},g);if(a.componentType===G.CheckboxList&&"flatFields"===a.valueMode){const t=a.checkboxOptions?.map(e=>i[e.id]).find(Boolean);return e(qr,{field:a,value:l||{},setValue:n,errorMessage:t,disabled:o},g)}return e(Br,{field:a,value:p,setValue:e=>n(a.name,e),errorMessage:i[a.name],disabled:o,keyValuePersistAs:c,sourceOptions:d,namespaceOptions:u},g)})})},Gr=Ur,Kr=({isEnabled:t,setIsEnabled:a,fieldDisabled:r})=>{const l=n();return e(ye,{options:[{icon:Wt,label:"Enable",value:!0,selectedBgColor:l.v2.colors.green[1e3],selectedBorderColor:l.v2.colors.green[400],selectedTextColor:l.v2.colors.green[400]},{icon:Ft,label:"Disable",value:!1,selectedBgColor:l.v2.colors.red[1e3],selectedBorderColor:l.v2.colors.red[500],selectedTextColor:l.v2.colors.red[400]}],size:Le.S,selected:t,setSelected:a,disabled:r})},Wr=r.div`
207
+ display: flex;
208
+ align-items: center;
209
+ gap: 24px;
210
+ padding: 8px 16px;
211
+ border-radius: 12px;
212
+ background-color: ${({theme:e})=>e.v2.colors.silver[800]};
213
+ `,Fr=r.div`
214
+ flex: 1;
215
+ min-width: 0;
216
+ white-space: pre;
217
+ overflow-x: auto;
218
+ `,Yr=({title:a,summary:r,onEdit:l,renderAction:n})=>{const i=o(()=>{const e=[];return a&&(e.push({text:a,variant:ua.Default}),e.push({text:" - ",variant:ua.Default})),e.push(...r),e},[a,r]);return t(Wr,{children:[e(Fr,{children:e(pa,{parts:i})}),n&&n(),l&&e(V,{"data-id":"sampling-btn-edit-auto-rule",label:Oe,rightIcon:Yt,variant:z.Text,size:D.S,onClick:l})]})},Jr={[Xe.HttpRequest]:"HTTP request",[Xe.HttpResponse]:"HTTP response",[Xe.DbQuery]:"DB query",[Xe.Messaging]:"messaging"};function Zr(e,t,a){return 1===e?t:a??`${t}s`}function Qr(e,t){const a=[],r=e.slice(0,3),l=e.slice(3);return r.forEach((e,r)=>{r>0&&a.push({text:", ",variant:ua.Default}),a.push({text:e,variant:t})}),l.length>0&&a.push({text:` + ${l.length} more`,variant:ua.Default,tooltipItems:l}),a}const el=({option:t,formState:a,renderAction:r})=>{const l=o(()=>{const e=function(e,t){switch(e){case Ie.CodeAttributes:return(e=>{const t=Object.values(_e).filter(t=>!!e.codeAttributes?.[t]).map(e=>He(e).toLowerCase());return t.length?[{text:"Collect",variant:ua.Action},{text:" ",variant:ua.Default},...Qr(t,ua.Endpoint)]:null})(t);case Ie.PayloadCollection:return(e=>{const t=Object.values(Xe).filter(t=>null!=e.payloadCollection?.[t]).map(e=>Jr[e]);return t.length?[{text:"Collect",variant:ua.Action},{text:" ",variant:ua.Default},...Qr(t,ua.Endpoint)]:null})(t);case Ie.HeadersCollection:return(e=>{const t=(e.headersCollection?.[ze.HeaderKeys]??[]).map(e=>e.trim()).filter(e=>e.length>0);if(!t.length)return null;const a=Zr(t.length,"HTTP header");return[{text:`Collect ${t.length} ${a}`,variant:ua.Action},{text:"",variant:ua.Default,tooltipItems:t}]})(t);case Ie.CustomInstrumentation:return(e=>{const t=(e.customInstrumentations?.[Ne.Java]??[]).map(e=>new Re(e.className,e.methodName)).filter(e=>e.Verify()),a=(e.customInstrumentations?.[Ne.Golang]??[]).map(e=>new Ve(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).filter(e=>e.Verify()),r=(e.customInstrumentations?.[Ne.Php]??[]).map(e=>new De(e.className,e.functionName)).filter(e=>e.Verify());if(!(t.length+a.length+r.length))return null;const l=[];t.length&&l.push(`${t.length} Java ${Zr(t.length,"probe")}`),a.length&&l.push(`${a.length} Go ${Zr(a.length,"probe")}`),r.length&&l.push(`${r.length} PHP ${Zr(r.length,"probe")}`);const n=[...t.map(e=>`Java: ${e.toString()}`),...a.map(e=>`Go: ${e.toString()}`),...r.map(e=>`PHP: ${e.toString()}`)];return[{text:`Apply ${l.join(" + ")}`,variant:ua.Action},{text:"",variant:ua.Default,tooltipItems:n}]})(t);case Ie.NetworkMetrics:return[{text:"Collect",variant:ua.Action},{text:" ",variant:ua.Default},{text:"network flow and TCP stats metrics",variant:ua.Endpoint}];default:return null}}(t?.type,a);return e?[...e,...ha(a.sourceScopes)]:[]},[t?.type,a]),n=0===l.length;return e(Yr,{title:n?Ee:"Instrumentation Rule Preview",summary:l,renderAction:r})},tl=({size:t=200,central:a=!1,useInline:r=!1})=>{const{tier:l}=ca();if(r){if(a)return e(Jt,{size:t});switch(l){case Be.Community:return e(Qt,{size:t});case Be.Onprem:return e(Zt,{size:t});default:return null}}if(a)return e(ea,{size:t});switch(l){case Be.Community:return e(aa,{size:t});case Be.Onprem:return e(ta,{size:t});default:return null}},al=[{value:"50",label:"50%"},{value:"25",label:"25%"},{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"custom",label:"Custom"}],rl=[{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"0.5",label:"0.5%"},{value:"0.1",label:"0.1%"},{value:"custom",label:"Custom"}],ll=[{value:"5000",label:"5s"},{value:"1000",label:"1s"},{value:"500",label:"500ms"},{value:"100",label:"100ms"},{value:"50",label:"50ms"},{value:"custom",label:"Custom"}],nl=({description:a,options:r,selected:l,onSelect:n,customName:i,customLabel:o,customPlaceholder:s,customValue:c,onCustomChange:d,customInputType:u=le.Number,customMin:p,customMax:h})=>t(L,{$gap:6,children:[e(O,{label:a}),t(R,{$gap:8,$alignItems:"flex-end",children:[e(ye,{options:r,selected:l,setSelected:n}),"custom"===l&&e(re,{name:i,label:o,placeholder:s,type:u,value:c,onChange:d,width:160,min:p,max:h})]})]}),il=()=>{},ol=t=>t.readOnly?e(sl,{rule:t.rule}):e(cl,{ruleType:t.ruleType,formState:t.formState,onChange:t.onChange}),sl=({rule:a})=>{const r=null!=a.durationAtLeastMs;return a.error?e(fe,{richTitle:{title:je},children:e(K,{name:"sampling-view-toggle-keep-errors",onChange:il,value:!0,size:F.S,label:qe,labelAlign:W.Right})}):r?e(fe,{richTitle:{title:Ue},children:t("div",{children:[e(E,{size:N.XXXS,color:I.Secondary,children:Ge}),e(E,{size:N.XS,children:`${a.durationAtLeastMs}ms`})]})}):null},cl=({ruleType:t,formState:a,onChange:r})=>{const l=c(e=>r({durationPreset:e}),[r]),n=c(e=>r({customDurationMs:e.target.value}),[r]);return"Duration"===t?e(fe,{richTitle:{title:Ue,subTitle:Ke},children:e(nl,{description:Ge,options:ll,selected:a.durationPreset,onSelect:l,customName:"sampling-input-custom-duration",customLabel:We,customPlaceholder:"200ms",customValue:a.customDurationMs,onCustomChange:n})}):null},dl=r.div`
219
+ display: flex;
220
+ gap: 32px;
221
+ `,ul=r.div`
222
+ display: flex;
223
+ flex-direction: column;
224
+ gap: 4px;
225
+ `,pl=r.div`
226
+ display: flex;
227
+ flex-wrap: wrap;
228
+ align-items: flex-end;
229
+ gap: 16px;
230
+ `,hl=r.div`
231
+ display: flex;
232
+ align-items: flex-end;
233
+ gap: 16px;
234
+ padding: 12px 16px;
235
+ border-radius: 8px;
236
+ background-color: ${({theme:e})=>e.v2.colors.black[500]};
237
+ `,gl=r.div`
238
+ display: flex;
239
+ align-items: flex-end;
240
+ gap: 10px;
241
+ flex: 1;
242
+ `,ml=r.div`
243
+ display: flex;
244
+ align-items: center;
245
+ height: 32px;
246
+ `,vl=r.div`
247
+ display: flex;
248
+ align-items: flex-end;
249
+ gap: 16px;
250
+ margin-bottom: 12px;
251
+ `,fl="Any",bl="Kafka topic",yl=()=>e("div",{style:{marginBottom:"8px"},children:e(E,{size:N.XS,weight:500,children:"And"})}),xl=[{value:"all",label:"All Operations"},{value:"httpServer",label:"HTTP Server"},{value:"httpClient",label:"HTTP Client"}],$l=[{value:"all",label:"All Operations"},{value:"httpServer",label:"HTTP Server"},{value:"kafkaConsumer",label:"Kafka Consumer"},{value:"kafkaProducer",label:"Kafka Producer"}],kl=[{id:"",label:fl},{id:"GET",label:"GET"},{id:"POST",label:"POST"},{id:"PUT",label:"PUT"},{id:"DELETE",label:"DELETE"},{id:"PATCH",label:"PATCH"}],Cl=t=>t.readOnly?e(Sl,{data:t.data}):e(wl,{category:t.category,formState:t.formState,onChange:t.onChange}),Sl=({data:a})=>{const r=o(()=>(e=>{if("noisy"===e.category){const t=e.rule.operation;if(t?.httpServer)return[{id:"type",title:ct,value:st},{id:"route",title:at,value:t.httpServer.route||t.httpServer.routePrefix||dt},{id:"method",title:it,value:t.httpServer.method||fl}];if(t?.httpClient){const e=[{id:"type",title:ct,value:ut}];return t.httpClient.serverAddress&&e.push({id:"serverAddress",title:"Server address",value:t.httpClient.serverAddress}),e.push({id:"route",title:at,value:t.httpClient.templatedPath||t.httpClient.templatedPathPrefix||dt}),e.push({id:"method",title:it,value:t.httpClient.method||fl}),e}return[{id:"type",title:ct,value:pt}]}const t=e.rule.operation;return t?.httpServer?[{id:"type",title:ct,value:st},{id:"route",title:at,value:t.httpServer.route||t.httpServer.routePrefix||dt},{id:"method",title:it,value:t.httpServer.method||fl}]:t?.kafkaConsumer?[{id:"type",title:ct,value:ht},{id:"topic",title:bl,value:t.kafkaConsumer.kafkaTopic||dt}]:t?.kafkaProducer?[{id:"type",title:ct,value:gt},{id:"topic",title:bl,value:t.kafkaProducer.kafkaTopic||dt}]:[{id:"type",title:ct,value:pt}]})(a),[a]);return e(fe,{richTitle:{title:Fe},children:e(dl,{children:r.map(({id:a,title:r,value:l})=>t(ul,{children:[e(E,{size:N.XXXS,color:I.Secondary,nowrap:!0,children:r}),e(E,{size:N.XS,nowrap:!0,children:l})]},a))})})},wl=({category:a,formState:r,onChange:l})=>{const n=o(()=>"noisy"===a?xl:$l,[a]),i=c(e=>l({operationType:e,route:"",serverAddress:"",method:"",kafkaTopic:""}),[l]),s=c(e=>t=>{t&&l({routeType:e,route:""})},[l]),d=c(e=>l({route:e.target.value}),[l]),u=c(e=>l({serverAddress:e.target.value}),[l]),p=c(e=>l({method:e[0]||""}),[l]),h=c(e=>l({kafkaTopic:e.target.value}),[l]),g="httpServer"===r.operationType||"httpClient"===r.operationType,m="kafkaConsumer"===r.operationType||"kafkaProducer"===r.operationType,v="httpClient"===r.operationType?tt:at,f="httpClient"===r.operationType?rt:lt;return t(fe,{richTitle:{title:`2. ${Fe}`,subTitle:Ye},children:[e(L,{$alignItems:"flex-start",children:e(ye,{options:n,selected:r.operationType,setSelected:i})}),g&&t(pl,{children:["httpClient"===r.operationType&&t(vl,{children:[e(re,{name:"sampling-input-server-address",label:Ze,placeholder:Je,value:r.serverAddress,onChange:u}),e(yl,{})]}),t(hl,{children:[t(gl,{children:[e(ml,{children:e(Qe,{"data-id":"sampling-radio-route",value:"route"===r.routeType,onChange:s("route")})}),e(re,{name:"sampling-input-route",label:v,placeholder:et,value:"route"===r.routeType?r.route:"",onChange:d,disabled:"route"!==r.routeType})]}),t(gl,{children:[e(ml,{children:e(Qe,{"data-id":"sampling-radio-route-prefix",value:"routePrefix"===r.routeType,onChange:s("routePrefix")})}),e(re,{name:"sampling-input-route-prefix",label:f,placeholder:et,value:"routePrefix"===r.routeType?r.route:"",onChange:d,disabled:"routePrefix"!==r.routeType})]})]}),t(vl,{children:[e(yl,{}),e(nt,{label:it,items:kl,selectedIds:[r.method||""],setSelectedIds:e=>p(e),buttonProps:{"data-id":"sampling-btn-method",label:kl.find(e=>e.id===r.method)?.label||fl,size:D.S,variant:z.Secondary}})]})]}),m&&e(re,{name:"sampling-input-kafka-topic",label:ot,placeholder:"Type kafka topic",value:r.kafkaTopic,onChange:h,width:"320px"})]})},Tl=[{value:"all",label:"Drop All"},{value:"sample",label:"Sample"}],Ml=[{value:"all",label:"Keep All"},{value:"sample",label:"Sample"}],Al=t=>t.readOnly?e(Pl,{data:t.data}):e(Ll,{category:t.category,formState:t.formState,onChange:t.onChange}),Pl=({data:a})=>{const r=o(()=>(e=>{switch(e.category){case"highlyRelevant":return null!=e.rule.percentageAtLeast?{title:vt,method:yt,description:ft,value:`${e.rule.percentageAtLeast}%`}:{title:vt,method:$t,description:null,value:null};case"noisy":return ga(e.rule.percentageAtMost)?{title:vt,method:xt,description:null,value:null}:{title:vt,method:yt,description:bt,value:`${e.rule.percentageAtMost}%`};case"costReduction":return{title:vt,method:yt,description:bt,value:`${e.rule.percentageAtMost}%`}}})(a),[a]),l=[{id:"method",title:it,value:r.method},...null!=r.description?[{id:"value",title:r.description,value:r.value}]:[]];return e(fe,{richTitle:{title:r.title},children:e(dl,{children:l.map(({id:a,title:r,value:l})=>t(ul,{children:[e(E,{size:N.XXXS,color:I.Secondary,nowrap:!0,children:r}),e(E,{size:N.XS,nowrap:!0,children:l})]},a))})})},Ll=({category:a,formState:r,onChange:l})=>{const n="highlyRelevant"===a,i=n?Ml:Tl,o=`${n?4:3}. ${vt}`,s=mt[a],d=n?ft:bt,u="noisy"===a?rl:al,p=c(e=>l({percentageMode:e}),[l]),h=c(e=>l({percentagePreset:e}),[l]),g=c(e=>l({customPercentage:e.target.value}),[l]);return t(fe,{richTitle:{title:o,subTitle:s},children:["costReduction"!==a&&e(L,{$alignItems:"flex-start",children:e(ye,{options:i,selected:r.percentageMode,setSelected:p})}),("costReduction"===a||"sample"===r.percentageMode)&&e(nl,{description:d,options:u,selected:r.percentagePreset,onSelect:h,customName:"sampling-input-custom-percentage",customPlaceholder:"5%",customValue:r.customPercentage,onCustomChange:g,customInputType:le.Decimal,customMin:0,customMax:100})]})},Ol=r.div`
252
+ display: flex;
253
+ align-items: flex-end;
254
+ gap: 16px;
255
+ `,El=r.div`
256
+ width: 280px;
257
+ flex-shrink: 0;
258
+ `,Il=r.div`
259
+ flex: 1;
260
+ min-width: 0;
261
+ `;function Nl(e){return"highlyRelevant"===e.category?e.rule.error?"Error":null!=e.rule.durationAtLeastMs?"Duration":"Relevance":Pt[e.category]}const Rl=t=>t.readOnly?e(Vl,{data:t.data}):e(Dl,{formState:t.formState,onChange:t.onChange}),Vl=({data:a})=>{const r=o(()=>[{id:"name",title:Ct,value:a.rule.name||kt},{id:"type",title:St,value:Nl(a)}],[a]),l=a.rule.notes||dt;return t(fe,{children:[e(dl,{children:r.map(({id:a,title:r,value:l})=>t(ul,{children:[e(E,{size:N.XXXS,color:I.Secondary,nowrap:!0,children:r}),e(E,{size:N.XS,nowrap:!0,children:l})]},a))}),t(ul,{children:[e(E,{size:N.XXXS,color:I.Secondary,children:wt}),e(E,{size:N.XS,children:l})]})]})},Dl=({formState:a,onChange:r})=>{const l=c(e=>r({name:e.target.value}),[r]),n=c(e=>r({notes:e.target.value}),[r]);return e(fe,{children:t(Ol,{children:[e(El,{children:e(re,{name:"sampling-input-rule-name",label:Ct,tooltip:"Optional. Give this rule a name for easier identification.",placeholder:Tt,value:a.name,onChange:l})}),e(Il,{children:e(re,{name:"sampling-input-note",label:wt,tooltip:At,placeholder:Mt,value:a.notes,onChange:n})})]})})},zl=[{value:"Relevance",label:"Relevance"},{value:"Error",label:"Error"},{value:"Duration",label:"Duration"}],Xl=({formState:t,onChange:a})=>{const r=c(e=>a({ruleType:e,keepErrors:"Error"===e}),[a]);return e(fe,{richTitle:{title:`3. ${St}`,subTitle:Lt},children:e(L,{$alignItems:"flex-start",children:e(ye,{options:zl,selected:t.ruleType,setSelected:r})})})},_l=t=>{const a=o(()=>{if(t.readOnly)return t.summary;switch(t.category){case"noisy":return fa(xa(t.formState));case"highlyRelevant":return va(ya(t.formState));case"costReduction":return ma(ba(t.formState))}},[t]);if(t.readOnly)return e(Yr,{title:Ot,summary:a,renderAction:t.renderAction});const r=1===a.length&&"default"===a[0].variant;return e(Yr,{title:r?Ee:Ot,summary:r?[]:a,renderAction:t.renderAction})},Hl=(e,t)=>!t?.length||!!t?.find(t=>t===e),Bl=({title:a="Signals",required:r,errorMessage:l,allowedSignals:n,selectedSignals:i,setSelectedSignals:o,disabled:c})=>{const[u,h]=d(1===i.length),g=s(JSON.stringify(i));return p(()=>{let e=Et(i).filter(e=>Hl(e,n));e.length||(e=It.filter(({id:e})=>Hl(e,n)).map(({id:e})=>e));const t=JSON.stringify(e);g.current!==t&&(g.current=t,o(e),h(1===e.length))},[n,i]),t(L,{$gap:12,children:[e(O,{label:a,required:r}),e(R,{$gap:12,children:It.map(t=>{const a=Hl(t.id,n),r=((e,t)=>!!t?.find(t=>t===e))(t.id,i);return a?e(J,{label:t.value,disabled:c||!a||u&&r,value:r,onChange:e=>((e,t)=>{const a=e,r=t?[...i,a]:i.filter(e=>e!==a);o(r),h(1===r.length)})(t.id,e)},t.id):null})}),e(X,{errorMessage:l})]})},jl=({minSupportedVersion:t,currentVersion:a})=>e(B,{isOpen:!0,onClose:()=>{},relativeToParent:!0,visual:()=>e(U,{scale:2.4,icon:()=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"21",viewBox:"0 0 22 21",fill:"none",children:e("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:q.UPGRADE_REQUIRED,description:`${q.UPGRADE_TO_USE_FEATURE(t)}\n${q.CURRENT_VERSION(a)}`}),ql=r.div`
262
+ display: flex;
263
+ flex-direction: column;
264
+ justify-content: flex-end;
265
+ width: ${({$width:e})=>e};
266
+ gap: ${({$columnHasHeader:e})=>e?"0":"12px"};
267
+ `,Ul=r.div`
268
+ display: flex;
269
+ align-items: center;
270
+ min-height: 24px;
271
+ padding: 12px;
272
+ border-radius: 16px 16px 0 0;
273
+ background-color: ${({theme:e})=>e.v2.colors.silver[800]};
274
+ `,Gl=r.div`
275
+ display: flex;
276
+ flex-direction: column;
277
+ gap: ${({$gap:e})=>e}px;
278
+ padding: 12px 12px 0 12px;
279
+ width: 100%;
280
+ height: ${({$heightOffset:e,$columnHasHeader:t})=>`calc(100vh - 180px - ${e}px ${t?"- 48px":""})`};
281
+ border-radius: ${({$columnHasHeader:e,$isLeft:t,$isRight:a})=>e?t?"0 0 0 16px":a?"0 16px 0 0":"0":t?"16px 0 0 16px":a?"0 16px 16px 0":"16px"};
282
+ background-color: ${({theme:e})=>e.v2.colors.silver[900]};
283
+ overflow-y: auto;
284
+ overflow-x: hidden;
285
+ `,Kl=({isLeft:r,isRight:l,heightOffset:n=0,width:i,header:o,list:s})=>t(ql,{$width:i,$columnHasHeader:!!o,children:[o&&e(Ul,{children:o}),e(Gl,{$gap:8,$isLeft:r,$isRight:l,$heightOffset:n,$columnHasHeader:!!o,children:s.length?s.length>1?e(Nt,{gap:8,elements:s}):e(a,{children:s[0]}):e(_,{$height:"100%",children:e(H,{})})})]}),Wl="75vw",Fl=r.div`
286
+ display: flex;
287
+ flex-direction: column;
288
+ border-radius: 16px;
289
+ background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
290
+ overflow: hidden;
291
+ `,Yl=r.div`
292
+ display: flex;
293
+ gap: 12px;
294
+ padding: 16px 16px 0 16px;
295
+ background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
296
+ position: sticky;
297
+ top: 0;
298
+ `,Jl=r.div`
299
+ padding: 12px 12px 0 12px;
300
+ `,Zl=r.div`
301
+ display: flex;
302
+ gap: 12px;
303
+ padding: 16px;
304
+ `,Ql=r.div`
305
+ padding: 5vh 10vw;
306
+ border-radius: 12px;
307
+ background-color: ${({theme:e})=>e.v2.colors.silver[800]};
308
+ `,en=g(({isOpen:a,withOverlay:r,disableAnimation:l,onClose:n,onBack:i,onNext:s,nextIsSkip:u,onSave:p,disableSave:h,connectionIds:g,header:v,subHeader:f,leftColumn:b,rightColumn:y,search:x,filters:$,errorMessage:k,isFormDirty:C,allowSaveWhenPristine:S,hideDirtyNote:w,forcedNote:T,isFetching:M,progress:P},L)=>{const[O,E]=d(!1),[I,R]=d(!1),[V,D]=d(void 0);m(L,()=>({clearErrors:()=>D(void 0)}));const X=I,H=c(()=>{C&&!O?E(!0):(E(!1),n?.())},[C,O,n]),j=h||I||!S&&"boolean"==typeof C&&!C,q=c(async()=>{R(!0);const e=await p();R(!1),!1!==e&&(e?.error?D(e.error):(g?.setValue([]),n?.()))},[p,g,n]),U=!!x||!!g||!!$,G=!!f,K=(U?48:0)+(G?50:0),W=o(()=>T||(M?{status:se.Info,message:"Fetching Data..."}:I&&!P?{status:se.Info,message:"Saving Changes..."}:V||k?{status:se.Error,message:V||k}:"boolean"!=typeof C||w?void 0:C?{status:se.Info,message:'The values don\'t reflect the current configurations of the selected clusters.\n"Save" will override the current configurations.'}:{status:se.Success,message:"The values reflect the current configuration of the selected cluster."}),[M,I,P,V,k,C,w,T]),F=o(()=>i?{label:"Back",leftIcon:ra,variant:z.Secondary,onClick:i}:{label:"Cancel",variant:z.Secondary,onClick:H,disabled:X},[i,H,X]),[Y,J]=d(!1),Z=o(()=>s?u?{"data-id":"wide-drawer-skip",label:"Skip",rightIcon:la,variant:z.Secondary,onClick:()=>J(!0)}:{"data-id":"wide-drawer-next",label:"Next",rightIcon:la,variant:z.Primary,onClick:s}:{"data-id":"wide-drawer-save",label:"Save",variant:z.Primary,onClick:q,disabled:j},[s,u,q,j]);return t(A,{width:Wl,isOpen:a,disableAnimation:l,hideOverlay:!I&&!r,header:{...v,onClose:n?H:void 0,onCloseDisabled:X},footer:{note:W,actions:[F,Z]},children:[I?e(_,{$height:"calc(100vh - 136px)",children:e(Ql,{children:e(Rt,{titleSize:N.S,subTitleSize:N.XXXS,withGradient:!0,withSpinner:!0,...P})})}):t(Fl,{children:[U&&t(Yl,{children:[g&&e(Vt,{icon:Wt,title:"Selected Clusters",badge:{label:g.value.length}}),x&&e(Dt,{...x,width:x.width??"100%"}),$]}),G&&e(Jl,{children:e(Vt,{icon:f.icon,title:f.title,subTitle:f.description,badge:f.badge})}),t(Zl,{children:[e(Kl,{isLeft:!0,heightOffset:K,...b}),e(Kl,{isRight:!0,heightOffset:K,...y})]})]}),e(cr,{isOpen:O,onClose:()=>E(!1),onApprove:H}),e(B,{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:Y,onClose:()=>J(!1),denyButton:{label:"Go Back",variant:z.Secondary,onClick:()=>J(!1)},approveButton:{label:"Skip",variant:z.Primary,onClick:()=>{s?.(),J(!1)}}})]})});en.displayName=en.name;const tn=r.div`
309
+ padding: 0 24px;
310
+ border-radius: 12px;
311
+ background-color: ${({$codeBgColor:e})=>e||"transparent"};
312
+ `,an=r.div`
313
+ display: flex;
314
+ flex-direction: column;
315
+ gap: 8px;
316
+ width: 100%;
317
+ padding: 8px;
318
+ border: 1px solid ${({theme:e})=>e.v2.colors.silver[700]};
319
+ border-radius: 12px;
320
+ background-color: ${({theme:e})=>e.v2.colors.silver[900]};
321
+ `,rn=r.div`
322
+ display: flex;
323
+ align-items: center;
324
+ gap: 4px;
325
+ width: 100%;
326
+ `,ln=r.div`
327
+ flex: 1;
328
+ min-width: 0;
329
+ `,nn=r.div`
330
+ width: 100%;
331
+ max-height: 180px;
332
+ overflow: auto;
333
+ padding: 0 12px;
334
+
335
+ pre {
336
+ margin: 0;
337
+ }
338
+ `,on=({title:a="YAML",yaml:r,defaultOpen:l,fullHeight:n,bgTint:i="1000",codeBgColor:s,compact:c})=>{const{clickCopy:d,isCopied:u,CopyButton:p}=zt(),h=o(()=>r?[{id:_t(),type:Xt.Button,buttonProps:{variant:z.Text,size:D.S,leftIcon:u?Ut:na,onClick:()=>d(r||""),disabled:u}}]:[],[r,u]);return c?t(an,{children:[t(rn,{children:[e(ia,{size:16}),e(ln,{children:e(E,{size:N.XXS,color:I.Primary,children:a})}),r&&e(p,{value:r})]}),r?e(nn,{children:e(Ht,{code:r,language:"yaml",theme:"duotoneDark"})}):e(H,{title:"YAML not found",subTitle:"The YAML for this resource is not available"})]}):e(ne,{bgTint:i,richTitle:{icon:ia,title:a},actions:h,withCollapse:!0,collapseIsDefaultOpen:l,fullHeight:n,children:e(tn,{$codeBgColor:s,children:r?e(Ht,{code:r,language:"yaml",theme:"duotoneDark"}):e(_,{children:e(H,{title:"YAML not found",subTitle:"The YAML for this resource is not available"})})})})};export{_a as A,sr as B,cr as C,ll as D,Kr as E,el as I,rl as N,tl as O,al as P,Rl as R,_l as S,jl as U,Wl as W,on as Y,dr as a,ur as b,ol as c,Gr as d,pr as e,Ur as f,Cl as g,Al as h,nl as i,Xl as j,Bl as k,wr as l,en as m,za as n,Yr as o};
@@ -1,4 +1,4 @@
1
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useMemo as a,useContext as r,createContext as n,useCallback as s,useState as o,useEffect as i,useRef as l}from"react";import{t as c,ba as d,bb as u,p as m,S,bc as p,bd as E,be as I,P as T,bf as f,bg as y,bh as _,bi as h,bj as g,bk as N,bl as v,bm as A,bn as R,bo as O,bp as C,bq as G,br as D,bs as b,bt as L,bu as w,bv as P,b4 as U,bw as F,bx as k,q as M,by as H,bz as x,bA as $,bB as K,bC as V,bD as B,G as Y,bE as W,h as j,U as q,bF as z,T as Q,bG as J,bH as X,bI as Z,bJ as ee,bK as te,bL as ae,bM as re,bN as ne,bO as se,bP as oe,bQ as ie,bR as le,bS as ce,bT as de,bU as ue,bV as me,bW as Se,bX as pe,bY as Ee,bZ as Ie,b_ as Te,al as fe,ah as ye,aj as _e,ai as he,ak as ge,ag as Ne,b$ as ve,b as Ae}from"./ui-components-Bvz84w4Q.js";import{i as Re,n as Oe,m as Ce,l as Ge,o as De,p as be,v as Le,q as we,u as Pe}from"./helpers-eTR126Dv.js";import{ApolloProvider as Ue,useLazyQuery as Fe,useApolloClient as ke,useQuery as Me}from"@apollo/client/react";import{ErrorLink as He}from"@apollo/client/link/error";import{SetContextLink as xe}from"@apollo/client/link/context";import{getMainDefinition as $e}from"@apollo/client/utilities";import{CombinedGraphQLErrors as Ke,ServerError as Ve}from"@apollo/client/errors";import{HttpLink as Be,ApolloLink as Ye,ApolloClient as We,InMemoryCache as je,gql as qe}from"@apollo/client";const ze=e=>{if(!e)return!1;const t=e.toLowerCase();return t.includes("authentication required")||t.includes("authentication expired")||t.includes("http 401")},Qe=n(null),Je=()=>{const e=r(Qe);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},Xe=({apolloConfig:t,operations:r,context:n,children:s})=>{const o=a(()=>(e=>{const t=new Be({uri:e.httpUrl,credentials:e.credentials??"same-origin"}),a=new He(({error:t})=>{Ke.is(t)?t.errors.some(e=>ze(e.message))&&e.onAuthError?.():(Ve.is(t)&&401===t.statusCode||ze(t.message))&&e.onAuthError?.()}),r=new xe(async t=>{const a={...t.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(r,a,t);let s=Ye.from(n);e.wsLink&&(s=Ye.split(({query:e})=>{const t=$e(e);return"OperationDefinition"===t.kind&&"subscription"===t.operation},e.wsLink,s));const o=e.defaultFetchPolicies;return new We({link:s,cache:new je({typePolicies:e.cacheTypePolicies}),defaultOptions:{watchQuery:{fetchPolicy:o?.watchQuery??"cache-and-network"},query:{fetchPolicy:o?.query??"cache-first"},mutate:{fetchPolicy:o?.mutate??"network-only"}}})})(t),[t.httpUrl,t.wsLink,t.credentials,t.clientKey]),i=a(()=>({operations:r,context:n,apolloConfig:t}),[r,n,t]);return e(Ue,{client:o,children:e(Qe.Provider,{value:i,children:s})})},Ze=Qe,et=e=>e.map(e=>`${e.id}:${e.odigosVersion}:${e.type}`).join(","),tt=(e,t,a)=>{const r=t.length?t.map(e=>e.id):a??[],n={...e,connectionIds:r};if(!t.length||c(e.version)>0)return n;const s=t[0];return{...n,version:s.odigosVersion||e.version,platformType:s.type??e.platformType}},at=({connections:t,connectionIds:r,children:n})=>{const s=Je(),o=a(()=>({operations:s.operations,context:tt(s.context,t,r),apolloConfig:s.apolloConfig}),[s.operations,s.context,s.apolloConfig,et(t),r?.join(",")]);return e(Ze.Provider,{value:o,children:n})},rt=(e,t)=>{if(e)return"string"==typeof e?e:p(e,t)},nt=e=>{const{addNotification:t}=d(),a=(a,r,n,s,o)=>t({type:a,title:r,message:n,crdType:e,target:rt(s,e),hideFromHistory:o});return{notify:a,notifyError:(e,t,r)=>a(S.Error,e,t,r),notifySuccess:(e,t,r)=>a(S.Success,e,t,r),notifyPending:(e,t)=>a(S.Default,"Pending",e,t,!0),notifyReadonly:()=>{t({type:S.Warning,title:m.READONLY,message:u.READONLY_WARNING,hideFromHistory:!0})}}},st=e=>{e({type:S.Warning,title:m.READONLY,message:u.READONLY_WARNING,hideFromHistory:!0})},ot=e=>({error:e,results:[],allSucceeded:!1,anySucceeded:!1,successCount:0,failureCount:0}),it=(e,t)=>{if(e)return"function"==typeof e?e(t):e},lt=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)},ct=(e,t)=>e.client??t,dt=async(e,t,a,r,n)=>{if(!t)return{error:"Query operation not configured"};if(t.canRun&&!t.canRun(r))return{data:void 0};if(t.run)try{return await t.run(ct(t,e),a,r)}catch(e){return{error:lt(e)}}const s=it(t.document,r);if(!s)return{error:"Query operation not supported in this context"};const o=t.transformVariables?t.transformVariables(a,r):a,i=ct(t,e);try{const e=await i.query({query:s,variables:o,fetchPolicy:n??"network-only"});return{data:t.transformResult?t.transformResult(e.data,r):e.data,error:e.error?lt(e.error):void 0}}catch(e){return{error:lt(e)}}},ut=async(e,t,a,r)=>{if(!t)return{error:"Mutation operation not configured"};if(t.canRun&&!t.canRun(r))return{error:"Mutation operation not supported in this context"};if(t.run)try{return await t.run(ct(t,e),a,r)}catch(e){return{error:lt(e)}}const n=it(t.document,r);if(!n)return{error:"Mutation operation not supported in this context"};const s=t.transformVariables?t.transformVariables(a,r):a,o=ct(t,e);try{const e=await o.mutate({mutation:n,variables:s});return{data:t.transformResult?t.transformResult(e.data,r):e.data,error:void 0}}catch(e){return{error:lt(e)}}},mt=async(e,t,a,r,n)=>{if(!t)return ot("Multi fetch operation not configured");if(!a.length)return ot("No proxy ids supplied for multi fetch");const s=ct(t,e);if(t.transformVariablesMulti&&(t.documentMulti||t.document)){const e=t.transformVariablesMulti(a,r,n),o=[];for(const a of e)try{const e=await s.query({query:a.document,variables:a.variables,fetchPolicy:"network-only"});t.transformMultiResult?t.transformMultiResult(e.data,n).forEach(e=>o.push(e)):a.proxyIDs.forEach(t=>{o.push({proxyID:t,success:!e.error,data:e.data,error:e.error?.message})})}catch(e){const t=lt(e);a.proxyIDs.forEach(e=>o.push({proxyID:e,success:!1,error:t}))}const i=o.filter(e=>e.success).length,l=o.length-i,c=Array.from(new Set(o.filter(e=>!!e.error).map(e=>e.error)));return{results:o,allSucceeded:0===l,anySucceeded:i>0,successCount:i,failureCount:l,error:c.length?c.join(", "):void 0}}const o=await Promise.all(a.map(async a=>{const s={...n,proxyID:a},o=await dt(e,t,r,s);return{proxyID:a,success:!o.error,data:o.data,error:o.error}})),i=o.filter(e=>e.success).length,l=o.length-i,c=Array.from(new Set(o.filter(e=>!!e.error).map(e=>e.error)));return{results:o,allSucceeded:0===l,anySucceeded:i>0,successCount:i,failureCount:l,error:c.length?c.join(", "):void 0}},St=qe`
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useMemo as a,useContext as r,createContext as n,useCallback as s,useState as o,useEffect as i,useRef as l}from"react";import{t as c,b7 as d,b8 as u,m,S,b9 as p,ba as E,bb as I,P as T,bc as f,bd as y,be as _,bf as h,bg as g,bh as N,bi as v,bj as A,bk as R,bl as O,bm as C,bn as G,bo as D,bp as b,bq as L,br as w,bs as P,a$ as U,bt as F,bu as k,n as M,bv as H,bw as x,bx as $,by as K,bz as V,bA as B,w as Y,bB as W,h as j,K as q,bC as z,T as Q,bD as J,bE as X,bF as Z,bG as ee,bH as te,bI as ae,bJ as re,bK as ne,bL as se,bM as oe,bN as ie,bO as le,bP as ce,bQ as de,bR as ue,bS as me,bT as Se,bU as pe,bV as Ee,bW as Ie,bX as Te,ag as fe,ac as ye,ae as _e,ad as he,af as ge,ab as Ne,bY as ve,b as Ae}from"./ui-components-Bhz7WgBl.js";import{i as Re,n as Oe,m as Ce,l as Ge,o as De,p as be,v as Le,q as we,u as Pe}from"./helpers-DbT32OSr.js";import{ApolloProvider as Ue,useLazyQuery as Fe,useApolloClient as ke,useQuery as Me}from"@apollo/client/react";import{ErrorLink as He}from"@apollo/client/link/error";import{SetContextLink as xe}from"@apollo/client/link/context";import{getMainDefinition as $e}from"@apollo/client/utilities";import{CombinedGraphQLErrors as Ke,ServerError as Ve}from"@apollo/client/errors";import{HttpLink as Be,ApolloLink as Ye,ApolloClient as We,InMemoryCache as je,gql as qe}from"@apollo/client";const ze=e=>{if(!e)return!1;const t=e.toLowerCase();return t.includes("authentication required")||t.includes("authentication expired")||t.includes("http 401")},Qe=n(null),Je=()=>{const e=r(Qe);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},Xe=({apolloConfig:t,operations:r,context:n,children:s})=>{const o=a(()=>(e=>{const t=new Be({uri:e.httpUrl,credentials:e.credentials??"same-origin"}),a=new He(({error:t})=>{Ke.is(t)?t.errors.some(e=>ze(e.message))&&e.onAuthError?.():(Ve.is(t)&&401===t.statusCode||ze(t.message))&&e.onAuthError?.()}),r=new xe(async t=>{const a={...t.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(r,a,t);let s=Ye.from(n);e.wsLink&&(s=Ye.split(({query:e})=>{const t=$e(e);return"OperationDefinition"===t.kind&&"subscription"===t.operation},e.wsLink,s));const o=e.defaultFetchPolicies;return new We({link:s,cache:new je({typePolicies:e.cacheTypePolicies}),defaultOptions:{watchQuery:{fetchPolicy:o?.watchQuery??"cache-and-network"},query:{fetchPolicy:o?.query??"cache-first"},mutate:{fetchPolicy:o?.mutate??"network-only"}}})})(t),[t.httpUrl,t.wsLink,t.credentials,t.clientKey]),i=a(()=>({operations:r,context:n,apolloConfig:t}),[r,n,t]);return e(Ue,{client:o,children:e(Qe.Provider,{value:i,children:s})})},Ze=Qe,et=e=>e.map(e=>`${e.id}:${e.odigosVersion}:${e.type}`).join(","),tt=(e,t,a)=>{const r=t.length?t.map(e=>e.id):a??[],n={...e,connectionIds:r};if(!t.length||c(e.version)>0)return n;const s=t[0];return{...n,version:s.odigosVersion||e.version,platformType:s.type??e.platformType}},at=({connections:t,connectionIds:r,children:n})=>{const s=Je(),o=a(()=>({operations:s.operations,context:tt(s.context,t,r),apolloConfig:s.apolloConfig}),[s.operations,s.context,s.apolloConfig,et(t),r?.join(",")]);return e(Ze.Provider,{value:o,children:n})},rt=(e,t)=>{if(e)return"string"==typeof e?e:p(e,t)},nt=e=>{const{addNotification:t}=d(),a=(a,r,n,s,o)=>t({type:a,title:r,message:n,crdType:e,target:rt(s,e),hideFromHistory:o});return{notify:a,notifyError:(e,t,r)=>a(S.Error,e,t,r),notifySuccess:(e,t,r)=>a(S.Success,e,t,r),notifyPending:(e,t)=>a(S.Default,"Pending",e,t,!0),notifyReadonly:()=>{t({type:S.Warning,title:m.READONLY,message:u.READONLY_WARNING,hideFromHistory:!0})}}},st=e=>{e({type:S.Warning,title:m.READONLY,message:u.READONLY_WARNING,hideFromHistory:!0})},ot=e=>({error:e,results:[],allSucceeded:!1,anySucceeded:!1,successCount:0,failureCount:0}),it=(e,t)=>{if(e)return"function"==typeof e?e(t):e},lt=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)},ct=(e,t)=>e.client??t,dt=async(e,t,a,r,n)=>{if(!t)return{error:"Query operation not configured"};if(t.canRun&&!t.canRun(r))return{data:void 0};if(t.run)try{return await t.run(ct(t,e),a,r)}catch(e){return{error:lt(e)}}const s=it(t.document,r);if(!s)return{error:"Query operation not supported in this context"};const o=t.transformVariables?t.transformVariables(a,r):a,i=ct(t,e);try{const e=await i.query({query:s,variables:o,fetchPolicy:n??"network-only"});return{data:t.transformResult?t.transformResult(e.data,r):e.data,error:e.error?lt(e.error):void 0}}catch(e){return{error:lt(e)}}},ut=async(e,t,a,r)=>{if(!t)return{error:"Mutation operation not configured"};if(t.canRun&&!t.canRun(r))return{error:"Mutation operation not supported in this context"};if(t.run)try{return await t.run(ct(t,e),a,r)}catch(e){return{error:lt(e)}}const n=it(t.document,r);if(!n)return{error:"Mutation operation not supported in this context"};const s=t.transformVariables?t.transformVariables(a,r):a,o=ct(t,e);try{const e=await o.mutate({mutation:n,variables:s});return{data:t.transformResult?t.transformResult(e.data,r):e.data,error:void 0}}catch(e){return{error:lt(e)}}},mt=async(e,t,a,r,n)=>{if(!t)return ot("Multi fetch operation not configured");if(!a.length)return ot("No proxy ids supplied for multi fetch");const s=ct(t,e);if(t.transformVariablesMulti&&(t.documentMulti||t.document)){const e=t.transformVariablesMulti(a,r,n),o=[];for(const a of e)try{const e=await s.query({query:a.document,variables:a.variables,fetchPolicy:"network-only"});t.transformMultiResult?t.transformMultiResult(e.data,n).forEach(e=>o.push(e)):a.proxyIDs.forEach(t=>{o.push({proxyID:t,success:!e.error,data:e.data,error:e.error?.message})})}catch(e){const t=lt(e);a.proxyIDs.forEach(e=>o.push({proxyID:e,success:!1,error:t}))}const i=o.filter(e=>e.success).length,l=o.length-i,c=Array.from(new Set(o.filter(e=>!!e.error).map(e=>e.error)));return{results:o,allSucceeded:0===l,anySucceeded:i>0,successCount:i,failureCount:l,error:c.length?c.join(", "):void 0}}const o=await Promise.all(a.map(async a=>{const s={...n,proxyID:a},o=await dt(e,t,r,s);return{proxyID:a,success:!o.error,data:o.data,error:o.error}})),i=o.filter(e=>e.success).length,l=o.length-i,c=Array.from(new Set(o.filter(e=>!!e.error).map(e=>e.error)));return{results:o,allSucceeded:0===l,anySucceeded:i>0,successCount:i,failureCount:l,error:c.length?c.join(", "):void 0}},St=qe`
2
2
  query OdigosApiNoop {
3
3
  __typename
4
4
  }