unleash-server 7.2.0 → 7.2.2

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 (36) hide show
  1. package/dist/lib/db/feature-environment-store.d.ts.map +1 -1
  2. package/dist/lib/db/feature-environment-store.js +7 -0
  3. package/dist/lib/db/feature-environment-store.js.map +1 -1
  4. package/dist/lib/db/feature-environment-store.test.d.ts +2 -0
  5. package/dist/lib/db/feature-environment-store.test.d.ts.map +1 -0
  6. package/dist/lib/db/feature-environment-store.test.js +24 -0
  7. package/dist/lib/db/feature-environment-store.test.js.map +1 -0
  8. package/frontend/build/index.html +1 -1
  9. package/frontend/build/static/{AdvancedPlayground-CUkOz1YF.js → AdvancedPlayground-D2Y0O_LK.js} +1 -1
  10. package/frontend/build/static/{BackendConnections-Bi1Fsohi.js → BackendConnections-C9HcQ9To.js} +1 -1
  11. package/frontend/build/static/{ChartItem-Ci-KFL7s.js → ChartItem-COMyVdgD.js} +1 -1
  12. package/frontend/build/static/{CreateProject-COHPsP3X.js → CreateProject-jRfRrbUO.js} +1 -1
  13. package/frontend/build/static/{FeatureMetricsChart-ClbKeGOa.js → FeatureMetricsChart-CQkGp91T.js} +1 -1
  14. package/frontend/build/static/{FeatureStaleDialog-DZvKjxPB.js → FeatureStaleDialog-DKeGFuL1.js} +1 -1
  15. package/frontend/build/static/{FeatureViewLazyExport-yCIrczZt.js → FeatureViewLazyExport-CgntSCvS.js} +2 -2
  16. package/frontend/build/static/{FlagMetricsChart-D0GI-ltv.js → FlagMetricsChart-oDTQTkxU.js} +1 -1
  17. package/frontend/build/static/{FrontendNetworkTrafficUsage-DlRkx8CV.js → FrontendNetworkTrafficUsage-E4pIeMFQ.js} +1 -1
  18. package/frontend/build/static/{ImpactMetricsPage-BYcbHNWC.js → ImpactMetricsPage-B3STis_H.js} +1 -1
  19. package/frontend/build/static/{LazyAdminExport-BjSYZTvt.js → LazyAdminExport-CsCsRIwk.js} +2 -2
  20. package/frontend/build/static/{LazyProjectExport-9mNkV9Jq.js → LazyProjectExport-DkN0UegC.js} +2 -2
  21. package/frontend/build/static/{LifecycleChartComponent-BigwXcU3.js → LifecycleChartComponent-Dz1wdYkW.js} +1 -1
  22. package/frontend/build/static/{LineChartComponent-CPcDsiNa.js → LineChartComponent-DG1LdcL_.js} +1 -1
  23. package/frontend/build/static/{MarkCompletedDialogue-CS-kM4vW.js → MarkCompletedDialogue-Bw9Iccid.js} +1 -1
  24. package/frontend/build/static/{NetworkConnectedEdges-C2nfTRKM.js → NetworkConnectedEdges-HU923-QZ.js} +1 -1
  25. package/frontend/build/static/{NetworkOverview-BKozpi8w.js → NetworkOverview-_igGCPCJ.js} +1 -1
  26. package/frontend/build/static/{NetworkPrometheusAPIWarning-wqCXwcem.js → NetworkPrometheusAPIWarning-BS9PGbzI.js} +1 -1
  27. package/frontend/build/static/{NetworkTraffic-Co7oakIE.js → NetworkTraffic-BpNEMFBl.js} +1 -1
  28. package/frontend/build/static/{NetworkTrafficUsage-DNDJZGXi.js → NetworkTrafficUsage-bSUVPjoc.js} +1 -1
  29. package/frontend/build/static/{ReactJSONEditor-BDMT4-_1.js → ReactJSONEditor-DZ9l5V9S.js} +1 -1
  30. package/frontend/build/static/{RoleCell-COtuTPWk.js → RoleCell-C-hJFmul.js} +1 -1
  31. package/frontend/build/static/{aggregateFeatureMetrics-ClblY5Ev.js → aggregateFeatureMetrics-Dli6i5No.js} +1 -1
  32. package/frontend/build/static/{formatTickValue-DojfJagm.js → formatTickValue-D3KZyzeb.js} +1 -1
  33. package/frontend/build/static/{index-CqYZiU1N.js → index-A5We7bvX.js} +9 -9
  34. package/frontend/build/static/{networkTrafficUsageHighlightPlugin-BMMmh5e_.js → networkTrafficUsageHighlightPlugin-DLE_BBMN.js} +1 -1
  35. package/frontend/build/static/{useApiTokens-B6vbGXUF.js → useApiTokens-DNIDLJlc.js} +1 -1
  36. package/package.json +1 -1
@@ -1 +1 @@
1
- import{bc as w,cc as A,ba as M,b9 as C,r as S,bb as E,G as L,H as I,j as e,s as i,c2 as h,cG as N,eR as T,cH as D,N as z,bs as R,h9 as f,bp as k,y as B,T as u,cS as F,b as P,V as U,gg as j,jw as V,jx as $,jy as H}from"./index-CqYZiU1N.js";import{u as _}from"./unknownify-B7hmSXnj.js";const G=[],W=s=>{const{isEnterprise:t}=w(),r=A("edgeObservability"),{data:c,error:n,mutate:a}=M(t()&&r,G,C("api/admin/metrics/edges"),q,s);return S.useMemo(()=>({connectedEdges:c??[],loading:!n&&!c,refetch:()=>a(),error:n}),[c,n,a])},q=s=>fetch(s).then(E("Connected Edges")).then(t=>t.json());var m={},O=I;Object.defineProperty(m,"__esModule",{value:!0});var v=m.default=void 0,K=O(L()),Y=e,J=(0,K.default)((0,Y.jsx)("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2z"}),"Circle");v=m.default=J;const Q=i("table")(({theme:s})=>({width:"100%",borderCollapse:"collapse",fontSize:s.fontSizes.smallerBody,"& > thead":{borderBottom:`1px solid ${s.palette.text.primary}`},"& tr":{textAlign:"right","& > th:first-of-type, td:first-of-type":{textAlign:"left"}}})),y=i("tr")(({theme:s})=>({fontWeight:s.fontWeight.bold,"&&& > td":{paddingTop:s.spacing(1),"& > div":{display:"flex",alignItems:"center"}}})),X=({instance:s})=>e.jsxs(Q,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Latency (ms)"}),e.jsx("th",{children:"Avg"}),e.jsx("th",{children:"p99"})]})}),e.jsxs("tbody",{children:[e.jsx(y,{children:e.jsx("td",{colSpan:3,children:e.jsxs("div",{children:["Upstream"," ",e.jsx(h,{tooltip:"Latency measured for requests sent from this Edge instance to the configured upstream, i.e. Unleash or another Edge instance.",size:"16px"})]})})}),e.jsxs("tr",{children:[e.jsx("td",{children:"Client Features"}),e.jsx("td",{children:s.upstreamFeaturesAverageLatencyMs}),e.jsx("td",{children:s.upstreamFeaturesP99LatencyMs})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Metrics"}),e.jsx("td",{children:s.upstreamMetricsAverageLatencyMs}),e.jsx("td",{children:s.upstreamMetricsP99LatencyMs})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Edge"}),e.jsx("td",{children:s.upstreamEdgeAverageLatencyMs}),e.jsx("td",{children:s.upstreamEdgeP99LatencyMs})]}),e.jsx(y,{children:e.jsx("td",{colSpan:3,children:e.jsxs("div",{children:["Downstream"," ",e.jsx(h,{tooltip:"Latency measured when serving requests from clients, i.e. SDKs or other Edge instances.",size:"16px"})]})})}),e.jsxs("tr",{children:[e.jsx("td",{children:"Client Features"}),e.jsx("td",{children:s.clientFeaturesAverageLatencyMs}),e.jsx("td",{children:s.clientFeaturesP99LatencyMs})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Frontend"}),e.jsx("td",{children:s.frontendApiAverageLatencyMs}),e.jsx("td",{children:s.frontendApiP99LatencyMs})]})]})]}),Z=i("div")(({theme:s})=>({width:"100%",borderRadius:s.shape.borderRadiusMedium,border:"1px solid",borderColor:s.palette.secondary.border,backgroundColor:s.palette.secondary.light,display:"flex",flexDirection:"column",alignItems:"center",padding:0,zIndex:1,marginTop:s.spacing(1)})),ee=i(N)({width:"100%",background:"transparent",boxShadow:"none"}),se=i(T,{shouldForwardProp:s=>s!=="connectionStatus"})(({theme:s,connectionStatus:t})=>({fontSize:s.fontSizes.smallBody,padding:s.spacing(1),minHeight:s.spacing(3),"& .MuiAccordionSummary-content":{alignItems:"center",gap:s.spacing(1),margin:0,"&.Mui-expanded":{margin:0},"& svg":{fontSize:s.fontSizes.mainHeader,color:t==="Stale"?s.palette.warning.main:t==="Disconnected"?s.palette.error.main:s.palette.success.main}}})),te=i(D)(({theme:s})=>({display:"flex",flexDirection:"column",fontSize:s.fontSizes.smallerBody,gap:s.spacing(2)})),l=i("div")(({theme:s})=>({display:"flex",justifyContent:"space-between",gap:s.spacing(2),"& > span":{display:"flex",alignItems:"center"}})),ne=i(z)(({theme:s})=>({padding:s.spacing(0,1)})),re=({reportedAt:s})=>{const t=new Date(s).getTime(),r=(Date.now()-t)/1e3;return r>360?"Disconnected":r>180?"Stale":"Connected"},ae=({started:s,reportedAt:t,cpuUsage:r})=>{const c=Number(r);if(!c)return"No usage";const n=new Date(s).getTime(),o=(new Date(t).getTime()-n)/1e3;return o===0?"No usage":`${(c/o*100).toFixed(2)} %`},oe=({memoryUsage:s})=>{if(!s)return"No usage";const t=["B","KB","MB","GB"];let r=s,c=0;for(;r>=1024&&c<t.length-1;)r/=1024,c++;return`${r.toFixed(2)} ${t[c]}`},ce=({instance:s})=>{const{locationSettings:t}=R(),r=re(s),c=f(s.started,t==null?void 0:t.locale),n=f(s.reportedAt,t==null?void 0:t.locale),a=ae(s),o=oe(s),d=a==="No usage"&&o==="No usage"&&e.jsx("p",{children:"Resource metrics are only available when running on Linux."});return e.jsx(Z,{children:e.jsxs(ee,{children:[e.jsxs(se,{expandIcon:e.jsx(k,{}),connectionStatus:r,children:[e.jsx(B,{arrow:!0,title:`${r}. Last reported: ${n}`,children:e.jsx(v,{})}),s.id||s.instanceId]}),e.jsxs(te,{children:[e.jsxs(l,{children:[e.jsx("strong",{children:"ID"}),e.jsx("span",{children:s.instanceId})]}),e.jsxs(l,{children:[e.jsx("strong",{children:"Upstream server"}),e.jsx("span",{children:s.connectedVia||"Unleash"})]}),e.jsxs(l,{children:[e.jsx("strong",{children:"Region"}),e.jsx("span",{children:s.region||"Unknown"})]}),e.jsxs(l,{children:[e.jsx("strong",{children:"Version"}),e.jsx("span",{children:s.edgeVersion})]}),e.jsxs(l,{children:[e.jsx("strong",{children:"Status"}),e.jsx(ne,{color:r==="Disconnected"?"error":r==="Stale"?"warning":"success",children:r})]}),e.jsxs(l,{children:[e.jsx("strong",{children:"Start"}),e.jsx("span",{children:c})]}),e.jsxs(l,{children:[e.jsx("strong",{children:"Last report"}),e.jsx("span",{children:n})]}),e.jsxs(l,{children:[e.jsx("strong",{children:"CPU"}),e.jsxs("span",{children:[a," ",e.jsx(h,{tooltip:e.jsxs(e.Fragment,{children:[e.jsx("p",{children:"CPU average usage since instance started."}),d]}),size:"16px"})]})]}),e.jsxs(l,{children:[e.jsx("strong",{children:"Memory"}),e.jsxs("span",{children:[o," ",e.jsx(h,{tooltip:e.jsxs(e.Fragment,{children:[e.jsx("p",{children:"Current memory usage."}),d]}),size:"16px"})]})]}),e.jsxs(l,{children:[e.jsx("strong",{children:"Stream clients"}),e.jsx("span",{children:s.connectedStreamingClients})]}),e.jsx(l,{children:e.jsx(X,{instance:s})})]})]})})},p="Unleash",de=i("div")(({theme:s})=>({marginBottom:s.spacing(18),display:"flex",justifyContent:"center"})),ie=i("div")(({theme:s})=>({display:"flex",justifyContent:"center",gap:s.spacing(4),flexWrap:"wrap",marginTop:s.spacing(2)})),b=i("div")(({theme:s})=>({borderRadius:s.shape.borderRadiusMedium,border:`1px solid ${s.palette.secondary.border}`,backgroundColor:s.palette.secondary.light,display:"flex",flexDirection:"column",alignItems:"center",padding:s.spacing(1.5),zIndex:1,marginTop:s.spacing(1),"& > svg":{width:s.spacing(9),height:s.spacing(9)}})),le=i(b)({backgroundColor:"transparent"}),pe=i(u)(({theme:s})=>({fontWeight:s.fontWeight.bold})),xe=i(u)(({theme:s})=>({fontSize:s.fontSizes.smallerBody,color:s.palette.text.secondary})),he=s=>s.reduce((t,r)=>(t.has(r.appName)||t.set(r.appName,{appName:r.appName,instances:[],groupTargets:new Set,level:0}),t.get(r.appName).instances.push(r),t),new Map),ge=s=>{const t=new Map,r=n=>{if(t.has(n.appName))return t.get(n.appName);let a=0;return n.groupTargets.forEach(o=>{if(o!==p){const d=s.get(o);d&&(a=Math.max(a,r(d)+1))}}),t.set(n.appName,a),a};s.forEach(n=>{n.level=r(n)});const c=new Map;return s.forEach(n=>{const a=c.get(n.level)||[];a.push(n),c.set(n.level,a)}),c},je=s=>{const t=he(s),r=new Map,c=new Map;return t.forEach(n=>{n.instances=n.instances.sort((a,o)=>a.instanceId.localeCompare(o.instanceId)).map((a,o)=>{const d=`${n.appName}-${o+1}`;return r.set(a.instanceId,d),c.set(d,n.appName),{...a,id:d}})}),t.forEach(n=>{n.instances=n.instances.map(o=>({...o,connectedVia:o.connectedVia?r.get(o.connectedVia)||o.connectedVia:p}));const a=new Set;n.instances.forEach(o=>{if(!o.connectedVia||o.connectedVia===p)a.add(p);else{const d=c.get(o.connectedVia);d&&d!==n.appName&&a.add(d)}}),n.groupTargets=a}),ge(t)},fe=()=>{F("Network - Connected Edges");const s=P(),{connectedEdges:t}=W({refreshInterval:3e4}),r=S.useMemo(()=>je(t),[t]),c=Array.from(r.keys()).sort((n,a)=>n-a);return r.size===0?e.jsx(U,{severity:"warning",children:"No data available."}):e.jsxs(j.ArcherContainer,{strokeColor:s.palette.text.primary,endShape:{arrow:{arrowLength:4,arrowThickness:4}},children:[e.jsx(de,{children:e.jsx(j.ArcherElement,{id:p,children:e.jsxs(b,{children:[e.jsx(V,{darkmode:e.jsx($,{}),lightmode:e.jsx(H,{})}),e.jsx(u,{sx:{mt:1},children:p})]})})}),c.map(n=>{var a;return e.jsx(ie,{children:(a=r.get(n))==null?void 0:a.map(({appName:o,groupTargets:d,instances:g})=>e.jsx(j.ArcherElement,{id:o,relations:Array.from(d).map(x=>({targetId:x,targetAnchor:"bottom",sourceAnchor:"top",style:{strokeColor:s.palette.secondary.border}})),children:e.jsxs(le,{children:[e.jsx(pe,{children:_(o)}),e.jsxs(xe,{children:[g.length," instance",g.length!==1&&"s"]}),g.map(x=>e.jsx(ce,{instance:x},x.instanceId))]})},o))},n)})]})};export{fe as NetworkConnectedEdges,fe as default};
1
+ import{bc as w,cc as A,ba as M,b9 as C,r as S,bb as E,G as L,H as I,j as e,s as i,c2 as h,cG as N,eR as T,cH as D,N as z,bs as R,h9 as f,bp as k,y as B,T as u,cS as F,b as P,V as U,gg as j,jw as V,jx as $,jy as H}from"./index-A5We7bvX.js";import{u as _}from"./unknownify-B7hmSXnj.js";const G=[],W=s=>{const{isEnterprise:t}=w(),r=A("edgeObservability"),{data:c,error:n,mutate:a}=M(t()&&r,G,C("api/admin/metrics/edges"),q,s);return S.useMemo(()=>({connectedEdges:c??[],loading:!n&&!c,refetch:()=>a(),error:n}),[c,n,a])},q=s=>fetch(s).then(E("Connected Edges")).then(t=>t.json());var m={},O=I;Object.defineProperty(m,"__esModule",{value:!0});var v=m.default=void 0,K=O(L()),Y=e,J=(0,K.default)((0,Y.jsx)("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2z"}),"Circle");v=m.default=J;const Q=i("table")(({theme:s})=>({width:"100%",borderCollapse:"collapse",fontSize:s.fontSizes.smallerBody,"& > thead":{borderBottom:`1px solid ${s.palette.text.primary}`},"& tr":{textAlign:"right","& > th:first-of-type, td:first-of-type":{textAlign:"left"}}})),y=i("tr")(({theme:s})=>({fontWeight:s.fontWeight.bold,"&&& > td":{paddingTop:s.spacing(1),"& > div":{display:"flex",alignItems:"center"}}})),X=({instance:s})=>e.jsxs(Q,{children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Latency (ms)"}),e.jsx("th",{children:"Avg"}),e.jsx("th",{children:"p99"})]})}),e.jsxs("tbody",{children:[e.jsx(y,{children:e.jsx("td",{colSpan:3,children:e.jsxs("div",{children:["Upstream"," ",e.jsx(h,{tooltip:"Latency measured for requests sent from this Edge instance to the configured upstream, i.e. Unleash or another Edge instance.",size:"16px"})]})})}),e.jsxs("tr",{children:[e.jsx("td",{children:"Client Features"}),e.jsx("td",{children:s.upstreamFeaturesAverageLatencyMs}),e.jsx("td",{children:s.upstreamFeaturesP99LatencyMs})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Metrics"}),e.jsx("td",{children:s.upstreamMetricsAverageLatencyMs}),e.jsx("td",{children:s.upstreamMetricsP99LatencyMs})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Edge"}),e.jsx("td",{children:s.upstreamEdgeAverageLatencyMs}),e.jsx("td",{children:s.upstreamEdgeP99LatencyMs})]}),e.jsx(y,{children:e.jsx("td",{colSpan:3,children:e.jsxs("div",{children:["Downstream"," ",e.jsx(h,{tooltip:"Latency measured when serving requests from clients, i.e. SDKs or other Edge instances.",size:"16px"})]})})}),e.jsxs("tr",{children:[e.jsx("td",{children:"Client Features"}),e.jsx("td",{children:s.clientFeaturesAverageLatencyMs}),e.jsx("td",{children:s.clientFeaturesP99LatencyMs})]}),e.jsxs("tr",{children:[e.jsx("td",{children:"Frontend"}),e.jsx("td",{children:s.frontendApiAverageLatencyMs}),e.jsx("td",{children:s.frontendApiP99LatencyMs})]})]})]}),Z=i("div")(({theme:s})=>({width:"100%",borderRadius:s.shape.borderRadiusMedium,border:"1px solid",borderColor:s.palette.secondary.border,backgroundColor:s.palette.secondary.light,display:"flex",flexDirection:"column",alignItems:"center",padding:0,zIndex:1,marginTop:s.spacing(1)})),ee=i(N)({width:"100%",background:"transparent",boxShadow:"none"}),se=i(T,{shouldForwardProp:s=>s!=="connectionStatus"})(({theme:s,connectionStatus:t})=>({fontSize:s.fontSizes.smallBody,padding:s.spacing(1),minHeight:s.spacing(3),"& .MuiAccordionSummary-content":{alignItems:"center",gap:s.spacing(1),margin:0,"&.Mui-expanded":{margin:0},"& svg":{fontSize:s.fontSizes.mainHeader,color:t==="Stale"?s.palette.warning.main:t==="Disconnected"?s.palette.error.main:s.palette.success.main}}})),te=i(D)(({theme:s})=>({display:"flex",flexDirection:"column",fontSize:s.fontSizes.smallerBody,gap:s.spacing(2)})),l=i("div")(({theme:s})=>({display:"flex",justifyContent:"space-between",gap:s.spacing(2),"& > span":{display:"flex",alignItems:"center"}})),ne=i(z)(({theme:s})=>({padding:s.spacing(0,1)})),re=({reportedAt:s})=>{const t=new Date(s).getTime(),r=(Date.now()-t)/1e3;return r>360?"Disconnected":r>180?"Stale":"Connected"},ae=({started:s,reportedAt:t,cpuUsage:r})=>{const c=Number(r);if(!c)return"No usage";const n=new Date(s).getTime(),o=(new Date(t).getTime()-n)/1e3;return o===0?"No usage":`${(c/o*100).toFixed(2)} %`},oe=({memoryUsage:s})=>{if(!s)return"No usage";const t=["B","KB","MB","GB"];let r=s,c=0;for(;r>=1024&&c<t.length-1;)r/=1024,c++;return`${r.toFixed(2)} ${t[c]}`},ce=({instance:s})=>{const{locationSettings:t}=R(),r=re(s),c=f(s.started,t==null?void 0:t.locale),n=f(s.reportedAt,t==null?void 0:t.locale),a=ae(s),o=oe(s),d=a==="No usage"&&o==="No usage"&&e.jsx("p",{children:"Resource metrics are only available when running on Linux."});return e.jsx(Z,{children:e.jsxs(ee,{children:[e.jsxs(se,{expandIcon:e.jsx(k,{}),connectionStatus:r,children:[e.jsx(B,{arrow:!0,title:`${r}. Last reported: ${n}`,children:e.jsx(v,{})}),s.id||s.instanceId]}),e.jsxs(te,{children:[e.jsxs(l,{children:[e.jsx("strong",{children:"ID"}),e.jsx("span",{children:s.instanceId})]}),e.jsxs(l,{children:[e.jsx("strong",{children:"Upstream server"}),e.jsx("span",{children:s.connectedVia||"Unleash"})]}),e.jsxs(l,{children:[e.jsx("strong",{children:"Region"}),e.jsx("span",{children:s.region||"Unknown"})]}),e.jsxs(l,{children:[e.jsx("strong",{children:"Version"}),e.jsx("span",{children:s.edgeVersion})]}),e.jsxs(l,{children:[e.jsx("strong",{children:"Status"}),e.jsx(ne,{color:r==="Disconnected"?"error":r==="Stale"?"warning":"success",children:r})]}),e.jsxs(l,{children:[e.jsx("strong",{children:"Start"}),e.jsx("span",{children:c})]}),e.jsxs(l,{children:[e.jsx("strong",{children:"Last report"}),e.jsx("span",{children:n})]}),e.jsxs(l,{children:[e.jsx("strong",{children:"CPU"}),e.jsxs("span",{children:[a," ",e.jsx(h,{tooltip:e.jsxs(e.Fragment,{children:[e.jsx("p",{children:"CPU average usage since instance started."}),d]}),size:"16px"})]})]}),e.jsxs(l,{children:[e.jsx("strong",{children:"Memory"}),e.jsxs("span",{children:[o," ",e.jsx(h,{tooltip:e.jsxs(e.Fragment,{children:[e.jsx("p",{children:"Current memory usage."}),d]}),size:"16px"})]})]}),e.jsxs(l,{children:[e.jsx("strong",{children:"Stream clients"}),e.jsx("span",{children:s.connectedStreamingClients})]}),e.jsx(l,{children:e.jsx(X,{instance:s})})]})]})})},p="Unleash",de=i("div")(({theme:s})=>({marginBottom:s.spacing(18),display:"flex",justifyContent:"center"})),ie=i("div")(({theme:s})=>({display:"flex",justifyContent:"center",gap:s.spacing(4),flexWrap:"wrap",marginTop:s.spacing(2)})),b=i("div")(({theme:s})=>({borderRadius:s.shape.borderRadiusMedium,border:`1px solid ${s.palette.secondary.border}`,backgroundColor:s.palette.secondary.light,display:"flex",flexDirection:"column",alignItems:"center",padding:s.spacing(1.5),zIndex:1,marginTop:s.spacing(1),"& > svg":{width:s.spacing(9),height:s.spacing(9)}})),le=i(b)({backgroundColor:"transparent"}),pe=i(u)(({theme:s})=>({fontWeight:s.fontWeight.bold})),xe=i(u)(({theme:s})=>({fontSize:s.fontSizes.smallerBody,color:s.palette.text.secondary})),he=s=>s.reduce((t,r)=>(t.has(r.appName)||t.set(r.appName,{appName:r.appName,instances:[],groupTargets:new Set,level:0}),t.get(r.appName).instances.push(r),t),new Map),ge=s=>{const t=new Map,r=n=>{if(t.has(n.appName))return t.get(n.appName);let a=0;return n.groupTargets.forEach(o=>{if(o!==p){const d=s.get(o);d&&(a=Math.max(a,r(d)+1))}}),t.set(n.appName,a),a};s.forEach(n=>{n.level=r(n)});const c=new Map;return s.forEach(n=>{const a=c.get(n.level)||[];a.push(n),c.set(n.level,a)}),c},je=s=>{const t=he(s),r=new Map,c=new Map;return t.forEach(n=>{n.instances=n.instances.sort((a,o)=>a.instanceId.localeCompare(o.instanceId)).map((a,o)=>{const d=`${n.appName}-${o+1}`;return r.set(a.instanceId,d),c.set(d,n.appName),{...a,id:d}})}),t.forEach(n=>{n.instances=n.instances.map(o=>({...o,connectedVia:o.connectedVia?r.get(o.connectedVia)||o.connectedVia:p}));const a=new Set;n.instances.forEach(o=>{if(!o.connectedVia||o.connectedVia===p)a.add(p);else{const d=c.get(o.connectedVia);d&&d!==n.appName&&a.add(d)}}),n.groupTargets=a}),ge(t)},fe=()=>{F("Network - Connected Edges");const s=P(),{connectedEdges:t}=W({refreshInterval:3e4}),r=S.useMemo(()=>je(t),[t]),c=Array.from(r.keys()).sort((n,a)=>n-a);return r.size===0?e.jsx(U,{severity:"warning",children:"No data available."}):e.jsxs(j.ArcherContainer,{strokeColor:s.palette.text.primary,endShape:{arrow:{arrowLength:4,arrowThickness:4}},children:[e.jsx(de,{children:e.jsx(j.ArcherElement,{id:p,children:e.jsxs(b,{children:[e.jsx(V,{darkmode:e.jsx($,{}),lightmode:e.jsx(H,{})}),e.jsx(u,{sx:{mt:1},children:p})]})})}),c.map(n=>{var a;return e.jsx(ie,{children:(a=r.get(n))==null?void 0:a.map(({appName:o,groupTargets:d,instances:g})=>e.jsx(j.ArcherElement,{id:o,relations:Array.from(d).map(x=>({targetId:x,targetAnchor:"bottom",sourceAnchor:"top",style:{strokeColor:s.palette.secondary.border}})),children:e.jsxs(le,{children:[e.jsx(pe,{children:_(o)}),e.jsxs(xe,{children:[g.length," instance",g.length!==1&&"s"]}),g.map(x=>e.jsx(ce,{instance:x},x.instanceId))]})},o))},n)})]})};export{fe as NetworkConnectedEdges,fe as default};
@@ -1 +1 @@
1
- import{s as i,T as d,cS as h,b as x,r as u,j as t,V as m,gg as c,jw as y,jx as j,jy as f}from"./index-CqYZiU1N.js";import{u as b,N as v}from"./NetworkPrometheusAPIWarning-wqCXwcem.js";import{u as g}from"./unknownify-B7hmSXnj.js";const w=i("div")(({theme:e})=>({marginBottom:e.spacing(18),display:"flex",justifyContent:"center"})),S=i("div")(({theme:e})=>({display:"flex",justifyContent:"center",gap:e.spacing(4),flexWrap:"wrap"})),p=i("div")(({theme:e})=>({borderRadius:e.shape.borderRadiusMedium,border:"1px solid",borderColor:e.palette.secondary.border,backgroundColor:e.palette.secondary.light,display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(1.5),zIndex:1,"& > svg":{width:e.spacing(9),height:e.spacing(9)}})),k=i(d)(({theme:e})=>({fontWeight:e.fontWeight.bold})),A=i(d)(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary})),q=i(d)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary})),C=e=>e[0]*1e3>new Date().getTime()-6e5,E=e=>{var a,s;const r=(e.values||[]).filter(l=>C(l)),o=r.length?Number.parseFloat(r[r.length-1][1]):0;return{label:e.label,reqs:o,type:g((s=(a=e.metric)==null?void 0:a.endpoint)==null?void 0:s.split("/")[2])}},T=(e,n)=>{var o;const r=n.label+n.type;return e[r]={...n,reqs:n.reqs+(((o=e[r])==null?void 0:o.reqs)??0)},e},B=e=>{var o,a;const r=(((a=(o=e==null?void 0:e.data)==null?void 0:o.result)==null?void 0:a.map(s=>{var l;return{...s,label:g((l=s.metric)==null?void 0:l.appName)}}).filter(s=>s.label!=="unknown"))||[]).map(E).reduce(T,{});return Object.values(r).map(s=>({...s,reqs:s.reqs.toFixed(2)})).filter(s=>s.reqs!=="0.00")??[]},D=()=>{h("Network - Overview");const e=x(),{metrics:n}=b(),r=u.useMemo(()=>B(n),[n]);return r.length===0?t.jsxs(m,{severity:"warning",children:["No data available.",t.jsx(v,{})]}):t.jsxs(c.ArcherContainer,{strokeColor:e.palette.text.primary,endShape:{arrow:{arrowLength:4,arrowThickness:4}},children:[t.jsx(w,{children:t.jsx(c.ArcherElement,{id:"unleash",children:t.jsxs(p,{children:[t.jsx(y,{darkmode:t.jsx(j,{}),lightmode:t.jsx(f,{})}),t.jsx(d,{sx:{marginTop:e.spacing(1)},children:"Unleash"})]})})}),t.jsx(S,{children:r.map(({label:o,reqs:a,type:s},l)=>t.jsx(c.ArcherElement,{id:`${l}`,relations:[{targetId:"unleash",targetAnchor:"bottom",sourceAnchor:"top",style:{strokeColor:e.palette.secondary.border}}],children:t.jsxs(p,{children:[t.jsx(k,{children:o}),t.jsxs(A,{children:[a," req/s"]}),t.jsxs(q,{children:[s," app"]})]})}))})]})};export{D as NetworkOverview,D as default};
1
+ import{s as i,T as d,cS as h,b as x,r as u,j as t,V as m,gg as c,jw as y,jx as j,jy as f}from"./index-A5We7bvX.js";import{u as b,N as v}from"./NetworkPrometheusAPIWarning-BS9PGbzI.js";import{u as g}from"./unknownify-B7hmSXnj.js";const w=i("div")(({theme:e})=>({marginBottom:e.spacing(18),display:"flex",justifyContent:"center"})),S=i("div")(({theme:e})=>({display:"flex",justifyContent:"center",gap:e.spacing(4),flexWrap:"wrap"})),p=i("div")(({theme:e})=>({borderRadius:e.shape.borderRadiusMedium,border:"1px solid",borderColor:e.palette.secondary.border,backgroundColor:e.palette.secondary.light,display:"flex",flexDirection:"column",alignItems:"center",padding:e.spacing(1.5),zIndex:1,"& > svg":{width:e.spacing(9),height:e.spacing(9)}})),k=i(d)(({theme:e})=>({fontWeight:e.fontWeight.bold})),A=i(d)(({theme:e})=>({fontSize:e.fontSizes.smallBody,color:e.palette.text.secondary})),q=i(d)(({theme:e})=>({fontSize:e.fontSizes.smallerBody,color:e.palette.text.secondary})),C=e=>e[0]*1e3>new Date().getTime()-6e5,E=e=>{var a,s;const r=(e.values||[]).filter(l=>C(l)),o=r.length?Number.parseFloat(r[r.length-1][1]):0;return{label:e.label,reqs:o,type:g((s=(a=e.metric)==null?void 0:a.endpoint)==null?void 0:s.split("/")[2])}},T=(e,n)=>{var o;const r=n.label+n.type;return e[r]={...n,reqs:n.reqs+(((o=e[r])==null?void 0:o.reqs)??0)},e},B=e=>{var o,a;const r=(((a=(o=e==null?void 0:e.data)==null?void 0:o.result)==null?void 0:a.map(s=>{var l;return{...s,label:g((l=s.metric)==null?void 0:l.appName)}}).filter(s=>s.label!=="unknown"))||[]).map(E).reduce(T,{});return Object.values(r).map(s=>({...s,reqs:s.reqs.toFixed(2)})).filter(s=>s.reqs!=="0.00")??[]},D=()=>{h("Network - Overview");const e=x(),{metrics:n}=b(),r=u.useMemo(()=>B(n),[n]);return r.length===0?t.jsxs(m,{severity:"warning",children:["No data available.",t.jsx(v,{})]}):t.jsxs(c.ArcherContainer,{strokeColor:e.palette.text.primary,endShape:{arrow:{arrowLength:4,arrowThickness:4}},children:[t.jsx(w,{children:t.jsx(c.ArcherElement,{id:"unleash",children:t.jsxs(p,{children:[t.jsx(y,{darkmode:t.jsx(j,{}),lightmode:t.jsx(f,{})}),t.jsx(d,{sx:{marginTop:e.spacing(1)},children:"Unleash"})]})})}),t.jsx(S,{children:r.map(({label:o,reqs:a,type:s},l)=>t.jsx(c.ArcherElement,{id:`${l}`,relations:[{targetId:"unleash",targetAnchor:"bottom",sourceAnchor:"top",style:{strokeColor:e.palette.secondary.border}}],children:t.jsxs(p,{children:[t.jsx(k,{children:o}),t.jsxs(A,{children:[a," req/s"]}),t.jsxs(q,{children:[s," app"]})]})}))})]})};export{D as NetworkOverview,D as default};
@@ -1 +1 @@
1
- import{bc as a,ba as i,b9 as c,r as u,bb as h,j as n}from"./index-CqYZiU1N.js";const f=(e={})=>{const{uiConfig:{prometheusAPIAvailable:r}}=a(),{data:t,error:s,mutate:o}=i(r,{},c("api/admin/metrics/rps"),l,e);return u.useMemo(()=>({metrics:t,loading:!s&&!t,refetch:()=>o(),error:s}),[t,s,o])},l=e=>fetch(e).then(h("Instance Metrics")).then(r=>r.json()),p=()=>{const{uiConfig:{prometheusAPIAvailable:e}}=a();return e?null:n.jsxs("p",{children:["This view requires the ",n.jsx("strong",{children:"PROMETHEUS_API"})," environment variable to be set. Refer to our"," ",n.jsx("a",{href:"https://docs.getunleash.io/reference/network-view#data-source",target:"_blank",rel:"noreferrer",children:"documentation"})," ","for more information."]})};export{p as N,f as u};
1
+ import{bc as a,ba as i,b9 as c,r as u,bb as h,j as n}from"./index-A5We7bvX.js";const f=(e={})=>{const{uiConfig:{prometheusAPIAvailable:r}}=a(),{data:t,error:s,mutate:o}=i(r,{},c("api/admin/metrics/rps"),l,e);return u.useMemo(()=>({metrics:t,loading:!s&&!t,refetch:()=>o(),error:s}),[t,s,o])},l=e=>fetch(e).then(h("Instance Metrics")).then(r=>r.json()),p=()=>{const{uiConfig:{prometheusAPIAvailable:e}}=a();return e?null:n.jsxs("p",{children:["This view requires the ",n.jsx("strong",{children:"PROMETHEUS_API"})," environment variable to be set. Refer to our"," ",n.jsx("a",{href:"https://docs.getunleash.io/reference/network-view#data-source",target:"_blank",rel:"noreferrer",children:"documentation"})," ","for more information."]})};export{p as N,f as u};
@@ -1 +1 @@
1
- var f=Object.defineProperty;var h=(e,t,a)=>t in e?f(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;var s=(e,t,a)=>h(e,typeof t!="symbol"?t+"":t,a);import{bs as k,b as C,r as p,cS as v,j as o,C as w,V as P,d6 as S,jq as N,i$ as I,j0 as A,j1 as M,ji as R,jv as T,jl as q,j5 as E,j4 as L,j3 as _,iZ as u,jz as D}from"./index-CqYZiU1N.js";import{u as W,N as $}from"./NetworkPrometheusAPIWarning-wqCXwcem.js";import{u as g}from"./unknownify-B7hmSXnj.js";const m=["circle","rect","rectRounded","rectRot","triangle"],z=(e,t)=>e.map(a=>({x:a[0],y:t(a[1])})),H=(e,t)=>({locale:t.locale,responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},color:e.palette.text.secondary,plugins:{tooltip:{backgroundColor:e.palette.background.paper,bodyColor:e.palette.text.primary,titleColor:e.palette.action.active,borderColor:e.palette.primary.main,borderWidth:1,padding:10,boxPadding:5,usePointStyle:!0,callbacks:{title:a=>u(1e3*a[0].parsed.x,t.locale)},itemSort:(a,i)=>i.parsed.y-a.parsed.y},legend:{position:"bottom",align:"start",labels:{boxWidth:10,boxHeight:10,usePointStyle:!0,padding:24}},title:{text:"Top 10 requests per second in the last 6 hours",position:"top",align:"start",display:!0,font:{size:16,weight:"400"},color:e.palette.text.primary,padding:{bottom:32}}},scales:{y:{type:"linear",title:{display:!0,text:"Requests per second",color:e.palette.text.secondary},suggestedMin:0,ticks:{precision:0,color:e.palette.text.secondary},grid:{color:e.palette.divider,borderColor:e.palette.divider}},x:{type:"time",time:{unit:"minute"},grid:{display:!0,color:e.palette.divider,borderColor:e.palette.divider},ticks:{callback:(a,i,r)=>u(r[i].value*1e3,t.locale)}}}});class B{constructor(t){s(this,"items");s(this,"picked",new Map);this.items=new D(t)}pick(t){return this.picked.has(t)||this.picked.set(t,this.items.next()),this.picked.get(t)}}const F=(e,t)=>{var a;if((a=t==null?void 0:t.data)!=null&&a.result){const i=new B([e.palette.success,e.palette.error,e.palette.primary,e.palette.warning]);return t.data.result.map((r,x)=>{var c,d;const n=g((c=r.metric)==null?void 0:c.endpoint),y=g((d=r.metric)==null?void 0:d.appName),l=i.pick(n),b=r.values||[];return{label:`${n}: ${y}`,borderColor:l.main,backgroundColor:l.main,data:z(b,j=>Number.parseFloat(j)),elements:{point:{radius:4,pointStyle:m[x%m.length]},line:{borderDash:[8,4]}}}})}return[]},J=()=>{const{locationSettings:e}=k(),{metrics:t}=W(),a=C(),i=p.useMemo(()=>H(a,e),[a,e]);v("Network - Traffic");const r=p.useMemo(()=>({datasets:F(a,t)}),[a,t,e]);return o.jsx(w,{condition:r.datasets.length===0,show:o.jsxs(P,{severity:"warning",children:["No data available.",o.jsx($,{})]}),elseShow:o.jsx(S,{sx:{display:"grid",gap:4},children:o.jsx("div",{style:{height:400},children:o.jsx(N,{data:r,options:i,"aria-label":"An instance metrics line chart with two lines: requests per second for admin API and requests per second for client API"})})})})};I.register(A,M,R,T,q,E,L,_);export{J as NetworkTraffic,J as default};
1
+ var f=Object.defineProperty;var h=(e,t,a)=>t in e?f(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a;var s=(e,t,a)=>h(e,typeof t!="symbol"?t+"":t,a);import{bs as k,b as C,r as p,cS as v,j as o,C as w,V as P,d6 as S,jq as N,i$ as I,j0 as A,j1 as M,ji as R,jv as T,jl as q,j5 as E,j4 as L,j3 as _,iZ as u,jz as D}from"./index-A5We7bvX.js";import{u as W,N as $}from"./NetworkPrometheusAPIWarning-BS9PGbzI.js";import{u as g}from"./unknownify-B7hmSXnj.js";const m=["circle","rect","rectRounded","rectRot","triangle"],z=(e,t)=>e.map(a=>({x:a[0],y:t(a[1])})),H=(e,t)=>({locale:t.locale,responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},color:e.palette.text.secondary,plugins:{tooltip:{backgroundColor:e.palette.background.paper,bodyColor:e.palette.text.primary,titleColor:e.palette.action.active,borderColor:e.palette.primary.main,borderWidth:1,padding:10,boxPadding:5,usePointStyle:!0,callbacks:{title:a=>u(1e3*a[0].parsed.x,t.locale)},itemSort:(a,i)=>i.parsed.y-a.parsed.y},legend:{position:"bottom",align:"start",labels:{boxWidth:10,boxHeight:10,usePointStyle:!0,padding:24}},title:{text:"Top 10 requests per second in the last 6 hours",position:"top",align:"start",display:!0,font:{size:16,weight:"400"},color:e.palette.text.primary,padding:{bottom:32}}},scales:{y:{type:"linear",title:{display:!0,text:"Requests per second",color:e.palette.text.secondary},suggestedMin:0,ticks:{precision:0,color:e.palette.text.secondary},grid:{color:e.palette.divider,borderColor:e.palette.divider}},x:{type:"time",time:{unit:"minute"},grid:{display:!0,color:e.palette.divider,borderColor:e.palette.divider},ticks:{callback:(a,i,r)=>u(r[i].value*1e3,t.locale)}}}});class B{constructor(t){s(this,"items");s(this,"picked",new Map);this.items=new D(t)}pick(t){return this.picked.has(t)||this.picked.set(t,this.items.next()),this.picked.get(t)}}const F=(e,t)=>{var a;if((a=t==null?void 0:t.data)!=null&&a.result){const i=new B([e.palette.success,e.palette.error,e.palette.primary,e.palette.warning]);return t.data.result.map((r,x)=>{var c,d;const n=g((c=r.metric)==null?void 0:c.endpoint),y=g((d=r.metric)==null?void 0:d.appName),l=i.pick(n),b=r.values||[];return{label:`${n}: ${y}`,borderColor:l.main,backgroundColor:l.main,data:z(b,j=>Number.parseFloat(j)),elements:{point:{radius:4,pointStyle:m[x%m.length]},line:{borderDash:[8,4]}}}})}return[]},J=()=>{const{locationSettings:e}=k(),{metrics:t}=W(),a=C(),i=p.useMemo(()=>H(a,e),[a,e]);v("Network - Traffic");const r=p.useMemo(()=>({datasets:F(a,t)}),[a,t,e]);return o.jsx(w,{condition:r.datasets.length===0,show:o.jsxs(P,{severity:"warning",children:["No data available.",o.jsx($,{})]}),elseShow:o.jsx(S,{sx:{display:"grid",gap:4},children:o.jsx("div",{style:{height:400},children:o.jsx(N,{data:r,options:i,"aria-label":"An instance metrics line chart with two lines: requests per second for admin API and requests per second for client API"})})})})};I.register(A,M,R,T,q,E,L,_);export{J as NetworkTraffic,J as default};
@@ -1 +1 @@
1
- import{s as c,bs as E,j as e,N as d,c0 as v,jA as f,bc as y,b9 as A,ci as B,r as q,bb as I,cS as F,cc as P,C as p,V as x,L as j,j6 as _,i$ as M,j0 as N,j1 as k,j2 as $,j3 as z,j4 as H,j5 as O}from"./index-CqYZiU1N.js";import{a as W}from"./formatTickValue-DojfJagm.js";import{u as Y,a as G,B as V,S as J,T as K,P as Q,n as X,g as Z}from"./networkTrafficUsageHighlightPlugin-BMMmh5e_.js";import{p as ee,c as l}from"./LazyAdminExport-BjSYZTvt.js";import"./RoleCell-COtuTPWk.js";import"./useApiTokens-B6vbGXUF.js";const S=c("article")(({theme:s})=>({minWidth:"200px",border:`2px solid ${s.palette.divider}`,borderRadius:s.shape.borderRadiusLarge,padding:s.spacing(3),display:"flex",flexDirection:"column",gap:s.spacing(2)})),T=c("h3")(({theme:s})=>({margin:0,fontSize:s.typography.body1.fontSize})),w=c("dl")(({theme:s})=>({display:"flex",flexDirection:"column",gap:s.spacing(2.5),padding:0,margin:0})),o=c("div")(({theme:s})=>({display:"flex",flexFlow:"row wrap",justifyContent:"space-between",gap:s.spacing(1,3),fontSize:s.typography.body2.fontSize,color:s.palette.text.secondary,"& dd":{margin:0,color:s.palette.text.primary}})),se=s=>{const r=n=>n.toLocaleString("en-US",{month:"short",year:"numeric"});if(s.grouping==="monthly"){const n=new Date,t=f(n,s.monthsBack),a=f(n,1);return`Average requests from ${r(t)} to ${r(a)}`}return`Requests used in ${r(ee(s.month))}`},ne=({period:s,usageTotal:r,includedTraffic:n,purchasedTraffic:t,currentMonth:a})=>{const{locationSettings:i}=E();return e.jsxs(S,{children:[e.jsx(T,{children:"Number of requests to Unleash"}),e.jsxs(w,{children:[e.jsxs(o,{children:[e.jsx("dt",{children:se(s)}),e.jsx("dd",{children:e.jsxs(d,{color:n>0?r<=n?"success":"error":"neutral",children:[r.toLocaleString(i.locale??"en-US")," ","requests"]})})]}),n>0&&e.jsxs(o,{children:[e.jsx("dt",{children:"Included in your plan"}),e.jsxs("dd",{children:[n.toLocaleString("en-US")," requests"]})]}),t>0&&a&&e.jsxs(o,{children:[e.jsx("dt",{children:"Additional traffic purchased"}),e.jsxs("dd",{children:[t.toLocaleString("en-US")," requests"]})]}),n>0&&a&&e.jsxs(o,{children:[e.jsx("dt",{children:"Total traffic available"}),e.jsxs("dd",{children:[(n+t).toLocaleString("en-US")," ","requests"]})]})]})]})},te=({overages:s,overageCost:r,estimatedMonthlyCost:n})=>e.jsxs(S,{children:[e.jsx(T,{children:"Accrued traffic charges"}),e.jsxs(w,{children:[e.jsxs(o,{children:[e.jsxs("dt",{children:["Request overages this month (",e.jsx(v,{href:"https://www.getunleash.io/pricing",children:"pricing"}),")"]}),e.jsxs("dd",{children:[s.toLocaleString()," requests"]})]}),e.jsxs(o,{children:[e.jsx("dt",{children:"Accrued traffic charges"}),e.jsx("dd",{children:e.jsxs(d,{color:"secondary",children:[r," USD"]})})]}),n>0&&e.jsxs(o,{children:[e.jsx("dt",{children:"Estimated charges based on current usage"}),e.jsx("dd",{children:e.jsxs(d,{color:"secondary",children:[n," USD"]})})]})]})]}),re=53,ae=259,m=1e6,oe=(s,r)=>!s||r==="pay-as-you-go"?re:ae;function ie(s,r,n){return s===void 0?oe(r,n):s}function ce(s){return s===void 0?0:s}const le=()=>{const{isEnterprise:s,uiConfig:r}=y(),n=A("/api/instance/trafficBundles"),{data:t,error:a,mutate:i}=B(n,de);return{trafficBundles:q.useMemo(()=>({includedTraffic:ie(t==null?void 0:t.includedTraffic,s(),r.billing)*m,purchasedTraffic:ce(t==null?void 0:t.purchasedTraffic)*m}),[t]),loading:!a&&!t,refetch:i}},de=s=>fetch(s).then(I("configuration")).then(r=>r.json()),ue=c("div")(({theme:s})=>({display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, max-content))",flex:1,gap:s.spacing(2,4)})),me=()=>{F("Network - Data Usage");const s=P("estimateTrafficDataCost"),{isOss:r}=y(),{trafficBundles:n}=le(),t=n.includedTraffic+n.purchasedTraffic,{chartDataSelection:a,setChartDataSelection:i,options:u}=Y(t),{chartData:C,usageTotal:h,overageCost:g,estimatedMonthlyCost:b,requestSummaryUsage:L}=G(t,a),U=a.grouping==="daily"&&a.month===l&&t>0&&h-t>0&&s,D=a.grouping==="daily"&&a.month===l,R=(a.grouping==="monthly"||a.month===l)&&t>0&&g>0;return e.jsx(p,{condition:r(),show:e.jsx(x,{severity:"warning",children:"Not enabled."}),elseShow:e.jsxs(e.Fragment,{children:[e.jsx(p,{condition:R,show:e.jsxs(x,{severity:"warning",sx:{mb:4},children:[e.jsx(V,{children:"Heads up!"})," You are currently consuming more requests than your plan includes and will be billed according to our terms. Please see"," ",e.jsx(j,{to:"https://www.getunleash.io/pricing",children:"this page"})," ","for more information. In order to reduce your traffic consumption, you may configure an"," ",e.jsx(j,{to:"https://docs.getunleash.io/reference/unleash-edge",children:"Unleash Edge instance"})," ","in your own datacenter."]})}),e.jsxs(J,{children:[e.jsxs(K,{children:[e.jsxs(ue,{children:[e.jsx(ne,{period:a,usageTotal:L,includedTraffic:n.includedTraffic,purchasedTraffic:n.purchasedTraffic,currentMonth:D}),U&&e.jsx(te,{overageCost:g,overages:h-t,estimatedMonthlyCost:b})]}),e.jsx(Q,{selectedPeriod:a,setPeriod:i})]}),e.jsx(_,{data:C,plugins:[X],options:u,"aria-label":Z(a)})]})]})})};M.register(W,N,k,$,z,H,O);export{me as default};
1
+ import{s as c,bs as E,j as e,N as d,c0 as v,jA as f,bc as y,b9 as A,ci as B,r as q,bb as I,cS as F,cc as P,C as p,V as x,L as j,j6 as _,i$ as M,j0 as N,j1 as k,j2 as $,j3 as z,j4 as H,j5 as O}from"./index-A5We7bvX.js";import{a as W}from"./formatTickValue-D3KZyzeb.js";import{u as Y,a as G,B as V,S as J,T as K,P as Q,n as X,g as Z}from"./networkTrafficUsageHighlightPlugin-DLE_BBMN.js";import{p as ee,c as l}from"./LazyAdminExport-CsCsRIwk.js";import"./RoleCell-C-hJFmul.js";import"./useApiTokens-DNIDLJlc.js";const S=c("article")(({theme:s})=>({minWidth:"200px",border:`2px solid ${s.palette.divider}`,borderRadius:s.shape.borderRadiusLarge,padding:s.spacing(3),display:"flex",flexDirection:"column",gap:s.spacing(2)})),T=c("h3")(({theme:s})=>({margin:0,fontSize:s.typography.body1.fontSize})),w=c("dl")(({theme:s})=>({display:"flex",flexDirection:"column",gap:s.spacing(2.5),padding:0,margin:0})),o=c("div")(({theme:s})=>({display:"flex",flexFlow:"row wrap",justifyContent:"space-between",gap:s.spacing(1,3),fontSize:s.typography.body2.fontSize,color:s.palette.text.secondary,"& dd":{margin:0,color:s.palette.text.primary}})),se=s=>{const r=n=>n.toLocaleString("en-US",{month:"short",year:"numeric"});if(s.grouping==="monthly"){const n=new Date,t=f(n,s.monthsBack),a=f(n,1);return`Average requests from ${r(t)} to ${r(a)}`}return`Requests used in ${r(ee(s.month))}`},ne=({period:s,usageTotal:r,includedTraffic:n,purchasedTraffic:t,currentMonth:a})=>{const{locationSettings:i}=E();return e.jsxs(S,{children:[e.jsx(T,{children:"Number of requests to Unleash"}),e.jsxs(w,{children:[e.jsxs(o,{children:[e.jsx("dt",{children:se(s)}),e.jsx("dd",{children:e.jsxs(d,{color:n>0?r<=n?"success":"error":"neutral",children:[r.toLocaleString(i.locale??"en-US")," ","requests"]})})]}),n>0&&e.jsxs(o,{children:[e.jsx("dt",{children:"Included in your plan"}),e.jsxs("dd",{children:[n.toLocaleString("en-US")," requests"]})]}),t>0&&a&&e.jsxs(o,{children:[e.jsx("dt",{children:"Additional traffic purchased"}),e.jsxs("dd",{children:[t.toLocaleString("en-US")," requests"]})]}),n>0&&a&&e.jsxs(o,{children:[e.jsx("dt",{children:"Total traffic available"}),e.jsxs("dd",{children:[(n+t).toLocaleString("en-US")," ","requests"]})]})]})]})},te=({overages:s,overageCost:r,estimatedMonthlyCost:n})=>e.jsxs(S,{children:[e.jsx(T,{children:"Accrued traffic charges"}),e.jsxs(w,{children:[e.jsxs(o,{children:[e.jsxs("dt",{children:["Request overages this month (",e.jsx(v,{href:"https://www.getunleash.io/pricing",children:"pricing"}),")"]}),e.jsxs("dd",{children:[s.toLocaleString()," requests"]})]}),e.jsxs(o,{children:[e.jsx("dt",{children:"Accrued traffic charges"}),e.jsx("dd",{children:e.jsxs(d,{color:"secondary",children:[r," USD"]})})]}),n>0&&e.jsxs(o,{children:[e.jsx("dt",{children:"Estimated charges based on current usage"}),e.jsx("dd",{children:e.jsxs(d,{color:"secondary",children:[n," USD"]})})]})]})]}),re=53,ae=259,m=1e6,oe=(s,r)=>!s||r==="pay-as-you-go"?re:ae;function ie(s,r,n){return s===void 0?oe(r,n):s}function ce(s){return s===void 0?0:s}const le=()=>{const{isEnterprise:s,uiConfig:r}=y(),n=A("/api/instance/trafficBundles"),{data:t,error:a,mutate:i}=B(n,de);return{trafficBundles:q.useMemo(()=>({includedTraffic:ie(t==null?void 0:t.includedTraffic,s(),r.billing)*m,purchasedTraffic:ce(t==null?void 0:t.purchasedTraffic)*m}),[t]),loading:!a&&!t,refetch:i}},de=s=>fetch(s).then(I("configuration")).then(r=>r.json()),ue=c("div")(({theme:s})=>({display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(200px, max-content))",flex:1,gap:s.spacing(2,4)})),me=()=>{F("Network - Data Usage");const s=P("estimateTrafficDataCost"),{isOss:r}=y(),{trafficBundles:n}=le(),t=n.includedTraffic+n.purchasedTraffic,{chartDataSelection:a,setChartDataSelection:i,options:u}=Y(t),{chartData:C,usageTotal:h,overageCost:g,estimatedMonthlyCost:b,requestSummaryUsage:L}=G(t,a),U=a.grouping==="daily"&&a.month===l&&t>0&&h-t>0&&s,D=a.grouping==="daily"&&a.month===l,R=(a.grouping==="monthly"||a.month===l)&&t>0&&g>0;return e.jsx(p,{condition:r(),show:e.jsx(x,{severity:"warning",children:"Not enabled."}),elseShow:e.jsxs(e.Fragment,{children:[e.jsx(p,{condition:R,show:e.jsxs(x,{severity:"warning",sx:{mb:4},children:[e.jsx(V,{children:"Heads up!"})," You are currently consuming more requests than your plan includes and will be billed according to our terms. Please see"," ",e.jsx(j,{to:"https://www.getunleash.io/pricing",children:"this page"})," ","for more information. In order to reduce your traffic consumption, you may configure an"," ",e.jsx(j,{to:"https://docs.getunleash.io/reference/unleash-edge",children:"Unleash Edge instance"})," ","in your own datacenter."]})}),e.jsxs(J,{children:[e.jsxs(K,{children:[e.jsxs(ue,{children:[e.jsx(ne,{period:a,usageTotal:L,includedTraffic:n.includedTraffic,purchasedTraffic:n.purchasedTraffic,currentMonth:D}),U&&e.jsx(te,{overageCost:g,overages:h-t,estimatedMonthlyCost:b})]}),e.jsx(Q,{selectedPeriod:a,setPeriod:i})]}),e.jsx(_,{data:C,plugins:[X],options:u,"aria-label":Z(a)})]})]})})};M.register(W,N,k,$,z,H,O);export{me as default};
@@ -1,4 +1,4 @@
1
- import{g as Db,iR as Fb,du as Bb,s as Ub,r as Ya,U as Vb,j as pu}from"./index-CqYZiU1N.js";import{L as Hb,G as Jb,I as Kb,J as Wb,K as Gd,M as Gb,N as Qb,V as a1,O as Yb,P as Xb,A as bi,Q as kc,R as s1,T as c1,H as Zb,B as Ua,o as l1,E as Ji,z as Qd,C as ej,U as tj,b as nj,e as rj,g as oj,i as ij,j as aj,k as sj,m as cj,n as lj,p as uj,q as fj,r as dj,t as pj,u as vj,v as mj,w as hj,x as gj,c as yj,d as bj,s as jj,h as $j,f as wj,a as xj,l as Sj,W as Cj,X as kj,y as _j,Y as Ej,Z as Oj,_ as Mj,$ as Va,a0 as Pj,a1 as Tj,a2 as Rj,a3 as Nj}from"./index-Bj8wwcOa.js";function xn(t){return Array.isArray(t)}function In(t){return t!==null&&typeof t=="object"&&(t.constructor===void 0||t.constructor.name==="Object")}function u1(t){return t&&typeof t=="object"?t.op==="add":!1}function f1(t){return t&&typeof t=="object"?t.op==="remove":!1}function vf(t){return t&&typeof t=="object"?t.op==="replace":!1}function vu(t){return t&&typeof t=="object"?t.op==="copy":!1}function la(t){return t&&typeof t=="object"?t.op==="move":!1}function Aj(t,e){return JSON.stringify(t)===JSON.stringify(e)}function Ij(t,e){return t===e}function d1(t){return t.slice(0,t.length-1)}function zj(t){return t[t.length-1]}function qj(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ij;if(t.length<e.length)return!1;for(let r=0;r<e.length;r++)if(!n(t[r],e[r]))return!1;return!0}function p1(t){return typeof t=="object"&&t!==null}function mf(t){if(xn(t)){const e=t.slice();return Object.getOwnPropertySymbols(t).forEach(n=>{e[n]=t[n]}),e}else if(In(t)){const e={...t};return Object.getOwnPropertySymbols(t).forEach(n=>{e[n]=t[n]}),e}else return t}function hf(t,e,n){if(t[e]===n)return t;{const r=mf(t);return r[e]=n,r}}function We(t,e){let n=t,r=0;for(;r<e.length;)In(n)?n=n[e[r]]:xn(n)?n=n[parseInt(e[r])]:n=void 0,r++;return n}function Yr(t,e,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e.length===0)return n;const o=e[0],i=Yr(t?t[o]:void 0,e.slice(1),n,r);if(In(t)||xn(t))return hf(t,o,i);if(r){const a=Lj.test(o)?[]:{};return a[o]=i,a}else throw new Error("Path does not exist")}const Lj=/^\d+$/;function v1(t,e,n){if(e.length===0)return n(t);if(!p1(t))throw new Error("Path doesn't exist");const r=e[0],o=v1(t[r],e.slice(1),n);return hf(t,r,o)}function gf(t,e){if(e.length===0)return t;if(!p1(t))throw new Error("Path does not exist");if(e.length===1){const o=e[0];if(o in t){const i=mf(t);return xn(i)&&i.splice(parseInt(o),1),In(i)&&delete i[o],i}else return t}const n=e[0],r=gf(t[n],e.slice(1));return hf(t,n,r)}function yf(t,e,n){const r=e.slice(0,e.length-1),o=e[e.length-1];return v1(t,r,i=>{if(!Array.isArray(i))throw new TypeError("Array expected at path "+JSON.stringify(r));const a=mf(i);return a.splice(parseInt(o),0,n),a})}function Lr(t,e){return t===void 0?!1:e.length===0?!0:t===null?!1:Lr(t[e[0]],e.slice(1))}function ao(t){const e=t.split("/");return e.shift(),e.map(n=>n.replace(/~1/g,"/").replace(/~0/g,"~"))}function Be(t){return t.map(bf).join("")}function bf(t){return"/"+String(t).replace(/~/g,"~0").replace(/\//g,"~1")}function Yd(t,e){return t+bf(e)}function nl(t,e){return t.startsWith(e)&&(t.length===e.length||t[e.length]==="/")}function to(t,e,n){let r=t;for(let o=0;o<e.length;o++){Kj(e[o]);let i=e[o];if(n&&n.before){const l=n.before(r,i);if(l!==void 0){if(l.document!==void 0&&(r=l.document),l.json!==void 0)throw new Error('Deprecation warning: returned object property ".json" has been renamed to ".document"');l.operation!==void 0&&(i=l.operation)}}const a=r,s=yo(r,i.path);if(i.op==="add")r=Bj(r,s,i.value);else if(i.op==="remove")r=Fj(r,s);else if(i.op==="replace")r=Dj(r,s,i.value);else if(i.op==="copy")r=Uj(r,s,mu(i.from));else if(i.op==="move")r=Vj(r,s,mu(i.from));else if(i.op==="test")Hj(r,s,i.value);else throw new Error("Unknown JSONPatch operation "+JSON.stringify(i));if(n&&n.after){const l=n.after(r,i,a);l!==void 0&&(r=l)}}return r}function Dj(t,e,n){return Yr(t,e,n)}function Fj(t,e){return gf(t,e)}function Bj(t,e,n){return Os(t,e)?yf(t,e,n):Yr(t,e,n)}function Uj(t,e,n){const r=We(t,n);if(Os(t,e))return yf(t,e,r);{const o=We(t,n);return Yr(t,e,o)}}function Vj(t,e,n){const r=We(t,n),o=gf(t,n);return Os(o,e)?yf(o,e,r):Yr(o,e,r)}function Hj(t,e,n){if(n===void 0)throw new Error(`Test failed: no value provided (path: "${Be(e)}")`);if(!Lr(t,e))throw new Error(`Test failed: path not found (path: "${Be(e)}")`);const r=We(t,e);if(!Aj(r,n))throw new Error(`Test failed, value differs (path: "${Be(e)}")`)}function Os(t,e){if(e.length===0)return!1;const n=We(t,d1(e));return Array.isArray(n)}function Jj(t,e){if(zj(e)!=="-")return e;const n=d1(e),r=We(t,n);return n.concat(r.length)}function Kj(t){if(!["add","remove","replace","copy","move","test"].includes(t.op))throw new Error("Unknown JSONPatch op "+JSON.stringify(t.op));if(typeof t.path!="string")throw new Error('Required property "path" missing or not a string in operation '+JSON.stringify(t));if((t.op==="copy"||t.op==="move")&&typeof t.from!="string")throw new Error('Required property "from" missing or not a string in operation '+JSON.stringify(t))}function yo(t,e){return Jj(t,ao(e))}function mu(t){return ao(t)}function m1(t,e,n){let r=[];return to(t,e,{before:(i,a)=>{let s;const l=yo(i,a.path);if(a.op==="add")s=y1(i,l);else if(a.op==="remove")s=g1(i,l);else if(a.op==="replace")s=h1(i,l);else if(a.op==="copy")s=Wj(i,l);else if(a.op==="move")s=Gj(i,l,mu(a.from));else if(a.op==="test")s=[];else throw new Error("Unknown JSONPatch operation "+JSON.stringify(a));let c;if(n&&n.before){const u=n.before(i,a,s);if(u&&u.revertOperations&&(s=u.revertOperations),u&&u.document&&(c=u.document),u&&u.json)throw new Error('Deprecation warning: returned object property ".json" has been renamed to ".document"')}if(r=s.concat(r),c!==void 0)return{document:c}}}),r}function h1(t,e){return[{op:"replace",path:Be(e),value:We(t,e)}]}function g1(t,e){return[{op:"add",path:Be(e),value:We(t,e)}]}function y1(t,e){return Os(t,e)||!Lr(t,e)?[{op:"remove",path:Be(e)}]:h1(t,e)}function Wj(t,e){return y1(t,e)}function Gj(t,e,n){if(e.length<n.length&&qj(n,e))return[{op:"replace",path:Be(e),value:t}];const r={op:"move",from:Be(e),path:Be(n)};return!Os(t,e)&&Lr(t,e)?[r,...g1(t,e)]:[r]}var _c={},Xd={b:"\b",f:"\f",n:`
1
+ import{g as Db,iR as Fb,du as Bb,s as Ub,r as Ya,U as Vb,j as pu}from"./index-A5We7bvX.js";import{L as Hb,G as Jb,I as Kb,J as Wb,K as Gd,M as Gb,N as Qb,V as a1,O as Yb,P as Xb,A as bi,Q as kc,R as s1,T as c1,H as Zb,B as Ua,o as l1,E as Ji,z as Qd,C as ej,U as tj,b as nj,e as rj,g as oj,i as ij,j as aj,k as sj,m as cj,n as lj,p as uj,q as fj,r as dj,t as pj,u as vj,v as mj,w as hj,x as gj,c as yj,d as bj,s as jj,h as $j,f as wj,a as xj,l as Sj,W as Cj,X as kj,y as _j,Y as Ej,Z as Oj,_ as Mj,$ as Va,a0 as Pj,a1 as Tj,a2 as Rj,a3 as Nj}from"./index-Bj8wwcOa.js";function xn(t){return Array.isArray(t)}function In(t){return t!==null&&typeof t=="object"&&(t.constructor===void 0||t.constructor.name==="Object")}function u1(t){return t&&typeof t=="object"?t.op==="add":!1}function f1(t){return t&&typeof t=="object"?t.op==="remove":!1}function vf(t){return t&&typeof t=="object"?t.op==="replace":!1}function vu(t){return t&&typeof t=="object"?t.op==="copy":!1}function la(t){return t&&typeof t=="object"?t.op==="move":!1}function Aj(t,e){return JSON.stringify(t)===JSON.stringify(e)}function Ij(t,e){return t===e}function d1(t){return t.slice(0,t.length-1)}function zj(t){return t[t.length-1]}function qj(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ij;if(t.length<e.length)return!1;for(let r=0;r<e.length;r++)if(!n(t[r],e[r]))return!1;return!0}function p1(t){return typeof t=="object"&&t!==null}function mf(t){if(xn(t)){const e=t.slice();return Object.getOwnPropertySymbols(t).forEach(n=>{e[n]=t[n]}),e}else if(In(t)){const e={...t};return Object.getOwnPropertySymbols(t).forEach(n=>{e[n]=t[n]}),e}else return t}function hf(t,e,n){if(t[e]===n)return t;{const r=mf(t);return r[e]=n,r}}function We(t,e){let n=t,r=0;for(;r<e.length;)In(n)?n=n[e[r]]:xn(n)?n=n[parseInt(e[r])]:n=void 0,r++;return n}function Yr(t,e,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(e.length===0)return n;const o=e[0],i=Yr(t?t[o]:void 0,e.slice(1),n,r);if(In(t)||xn(t))return hf(t,o,i);if(r){const a=Lj.test(o)?[]:{};return a[o]=i,a}else throw new Error("Path does not exist")}const Lj=/^\d+$/;function v1(t,e,n){if(e.length===0)return n(t);if(!p1(t))throw new Error("Path doesn't exist");const r=e[0],o=v1(t[r],e.slice(1),n);return hf(t,r,o)}function gf(t,e){if(e.length===0)return t;if(!p1(t))throw new Error("Path does not exist");if(e.length===1){const o=e[0];if(o in t){const i=mf(t);return xn(i)&&i.splice(parseInt(o),1),In(i)&&delete i[o],i}else return t}const n=e[0],r=gf(t[n],e.slice(1));return hf(t,n,r)}function yf(t,e,n){const r=e.slice(0,e.length-1),o=e[e.length-1];return v1(t,r,i=>{if(!Array.isArray(i))throw new TypeError("Array expected at path "+JSON.stringify(r));const a=mf(i);return a.splice(parseInt(o),0,n),a})}function Lr(t,e){return t===void 0?!1:e.length===0?!0:t===null?!1:Lr(t[e[0]],e.slice(1))}function ao(t){const e=t.split("/");return e.shift(),e.map(n=>n.replace(/~1/g,"/").replace(/~0/g,"~"))}function Be(t){return t.map(bf).join("")}function bf(t){return"/"+String(t).replace(/~/g,"~0").replace(/\//g,"~1")}function Yd(t,e){return t+bf(e)}function nl(t,e){return t.startsWith(e)&&(t.length===e.length||t[e.length]==="/")}function to(t,e,n){let r=t;for(let o=0;o<e.length;o++){Kj(e[o]);let i=e[o];if(n&&n.before){const l=n.before(r,i);if(l!==void 0){if(l.document!==void 0&&(r=l.document),l.json!==void 0)throw new Error('Deprecation warning: returned object property ".json" has been renamed to ".document"');l.operation!==void 0&&(i=l.operation)}}const a=r,s=yo(r,i.path);if(i.op==="add")r=Bj(r,s,i.value);else if(i.op==="remove")r=Fj(r,s);else if(i.op==="replace")r=Dj(r,s,i.value);else if(i.op==="copy")r=Uj(r,s,mu(i.from));else if(i.op==="move")r=Vj(r,s,mu(i.from));else if(i.op==="test")Hj(r,s,i.value);else throw new Error("Unknown JSONPatch operation "+JSON.stringify(i));if(n&&n.after){const l=n.after(r,i,a);l!==void 0&&(r=l)}}return r}function Dj(t,e,n){return Yr(t,e,n)}function Fj(t,e){return gf(t,e)}function Bj(t,e,n){return Os(t,e)?yf(t,e,n):Yr(t,e,n)}function Uj(t,e,n){const r=We(t,n);if(Os(t,e))return yf(t,e,r);{const o=We(t,n);return Yr(t,e,o)}}function Vj(t,e,n){const r=We(t,n),o=gf(t,n);return Os(o,e)?yf(o,e,r):Yr(o,e,r)}function Hj(t,e,n){if(n===void 0)throw new Error(`Test failed: no value provided (path: "${Be(e)}")`);if(!Lr(t,e))throw new Error(`Test failed: path not found (path: "${Be(e)}")`);const r=We(t,e);if(!Aj(r,n))throw new Error(`Test failed, value differs (path: "${Be(e)}")`)}function Os(t,e){if(e.length===0)return!1;const n=We(t,d1(e));return Array.isArray(n)}function Jj(t,e){if(zj(e)!=="-")return e;const n=d1(e),r=We(t,n);return n.concat(r.length)}function Kj(t){if(!["add","remove","replace","copy","move","test"].includes(t.op))throw new Error("Unknown JSONPatch op "+JSON.stringify(t.op));if(typeof t.path!="string")throw new Error('Required property "path" missing or not a string in operation '+JSON.stringify(t));if((t.op==="copy"||t.op==="move")&&typeof t.from!="string")throw new Error('Required property "from" missing or not a string in operation '+JSON.stringify(t))}function yo(t,e){return Jj(t,ao(e))}function mu(t){return ao(t)}function m1(t,e,n){let r=[];return to(t,e,{before:(i,a)=>{let s;const l=yo(i,a.path);if(a.op==="add")s=y1(i,l);else if(a.op==="remove")s=g1(i,l);else if(a.op==="replace")s=h1(i,l);else if(a.op==="copy")s=Wj(i,l);else if(a.op==="move")s=Gj(i,l,mu(a.from));else if(a.op==="test")s=[];else throw new Error("Unknown JSONPatch operation "+JSON.stringify(a));let c;if(n&&n.before){const u=n.before(i,a,s);if(u&&u.revertOperations&&(s=u.revertOperations),u&&u.document&&(c=u.document),u&&u.json)throw new Error('Deprecation warning: returned object property ".json" has been renamed to ".document"')}if(r=s.concat(r),c!==void 0)return{document:c}}}),r}function h1(t,e){return[{op:"replace",path:Be(e),value:We(t,e)}]}function g1(t,e){return[{op:"add",path:Be(e),value:We(t,e)}]}function y1(t,e){return Os(t,e)||!Lr(t,e)?[{op:"remove",path:Be(e)}]:h1(t,e)}function Wj(t,e){return y1(t,e)}function Gj(t,e,n){if(e.length<n.length&&qj(n,e))return[{op:"replace",path:Be(e),value:t}];const r={op:"move",from:Be(e),path:Be(n)};return!Os(t,e)&&Lr(t,e)?[r,...g1(t,e)]:[r]}var _c={},Xd={b:"\b",f:"\f",n:`
2
2
  `,r:"\r",t:" ",'"':'"',"/":"/","\\":"\\"},Qj=97;_c.parse=function(t,e,n){var r={},o=0,i=0,a=0,s=n&&n.bigint&&typeof BigInt<"u";return{data:l("",!0),pointers:r};function l(W,U){c();var te;b(W,"value");var F=m();switch(F){case"t":v("rue"),te=!0;break;case"f":v("alse"),te=!1;break;case"n":v("ull"),te=null;break;case'"':te=u();break;case"[":te=d(W);break;case"{":te=p(W);break;default:g(),"-0123456789".indexOf(F)>=0?te=f():R()}return b(W,"valueEnd"),c(),U&&a<t.length&&R(),te}function c(){e:for(;a<t.length;){switch(t[a]){case" ":i++;break;case" ":i+=4;break;case"\r":i=0;break;case`
3
3
  `:i=0,o++;break;default:break e}a++}}function u(){for(var W="",U;U=m(),U!='"';)U=="\\"?(U=m(),U in Xd?W+=Xd[U]:U=="u"?W+=h():D()):W+=U;return W}function f(){var W="",U=!0;t[a]=="-"&&(W+=m()),W+=t[a]=="0"?m():y(),t[a]=="."&&(W+=m()+y(),U=!1),(t[a]=="e"||t[a]=="E")&&(W+=m(),(t[a]=="+"||t[a]=="-")&&(W+=m()),W+=y(),U=!1);var te=+W;return s&&U&&(te>Number.MAX_SAFE_INTEGER||te<Number.MIN_SAFE_INTEGER)?BigInt(W):te}function d(W){c();var U=[],te=0;if(m()=="]")return U;for(g();;){var F=W+"/"+te;U.push(l(F)),c();var J=m();if(J=="]")break;J!=","&&D(),c(),te++}return U}function p(W){c();var U={};if(m()=="}")return U;for(g();;){var te=w();m()!='"'&&D();var F=u(),J=W+"/"+hu(F);S(J,"key",te),b(J,"keyEnd"),c(),m()!=":"&&D(),c(),U[F]=l(J),c();var H=m();if(H=="}")break;H!=","&&D(),c()}return U}function v(W){for(var U=0;U<W.length;U++)m()!==W[U]&&D()}function m(){Z();var W=t[a];return a++,i++,W}function g(){a--,i--}function h(){for(var W=4,U=0;W--;){U<<=4;var te=m().toLowerCase();te>="a"&&te<="f"?U+=te.charCodeAt()-Qj+10:te>="0"&&te<="9"?U+=+te:D()}return String.fromCharCode(U)}function y(){for(var W="";t[a]>="0"&&t[a]<="9";)W+=m();if(W.length)return W;Z(),R()}function b(W,U){S(W,U,w())}function S(W,U,te){r[W]=r[W]||{},r[W][U]=te}function w(){return{line:o,column:i,pos:a}}function R(){throw new SyntaxError("Unexpected token "+t[a]+" in JSON at position "+a)}function D(){g(),R()}function Z(){if(a>=t.length)throw new SyntaxError("Unexpected end of JSON input")}};_c.stringify=function(t,e,n){if(!Js(t))return;var r=0,o,i,a=typeof n=="object"?n.space:n;switch(typeof a){case"number":var s=a>10?10:a<0?0:Math.floor(a);a=s&&S(s," "),o=s,i=s;break;case"string":a=a.slice(0,10),o=0,i=0;for(var l=0;l<a.length;l++){var c=a[l];switch(c){case" ":i++;break;case" ":i+=4;break;case"\r":i=0;break;case`
4
4
  `:i=0,r++;break;default:throw new Error("whitespace characters not allowed in JSON")}o++}break;default:a=void 0}var u="",f={},d=0,p=0,v=0,m=n&&n.es6&&typeof Map=="function";return g(t,0,""),{json:u,pointers:f};function g(w,R,D){switch(b(D,"value"),typeof w){case"number":case"bigint":case"boolean":h(""+w);break;case"string":h(Ks(w));break;case"object":w===null?h("null"):typeof w.toJSON=="function"?h(Ks(w.toJSON())):Array.isArray(w)?Z():m?w.constructor.BYTES_PER_ELEMENT?Z():w instanceof Map?U():w instanceof Set?U(!0):W():W()}b(D,"valueEnd");function Z(){if(w.length){h("[");for(var te=R+1,F=0;F<w.length;F++){F&&h(","),y(te);var J=Js(w[F])?w[F]:null,H=D+"/"+F;g(J,te,H)}y(R),h("]")}else h("[]")}function W(){var te=Object.keys(w);if(te.length){h("{");for(var F=R+1,J=0;J<te.length;J++){var H=te[J],X=w[H];if(Js(X)){J&&h(",");var K=D+"/"+hu(H);y(F),b(K,"key"),h(Ks(H)),b(K,"keyEnd"),h(":"),a&&h(" "),g(X,F,K)}}y(R),h("}")}else h("{}")}function U(te){if(w.size){h("{");for(var F=R+1,J=!0,H=w.entries(),X=H.next();!X.done;){var K=X.value,Q=K[0],M=te?!0:K[1];if(Js(M)){J||h(","),J=!1;var A=D+"/"+hu(Q);y(F),b(A,"key"),h(Ks(Q)),b(A,"keyEnd"),h(":"),a&&h(" "),g(M,F,A)}X=H.next()}y(R),h("}")}else h("{}")}}function h(w){p+=w.length,v+=w.length,u+=w}function y(w){if(a){for(u+=`
@@ -1 +1 @@
1
- import{s as c,bc as k,e as D,j as e,V as L,y as H,D as K,fG as S,B as f,dg as z,al as ne,dr as se,ao as oe,C as b,az as re,ap as ae,ay as $,c0 as P,bt as ie,ey as le,bh as ce,iQ as de,L as q,eo as ue,ak as A,g6 as I,r as d,ep as E,av as he,G as pe,H as xe,aj as G,fl as me,an as w,ee as je,eF as ge,ac as T,ad as fe,cC as V,b3 as ye,aY as Y,h as be,w as ke,aT as Ce,i as Te,aA as Q,gM as N,hK as Ae,dL as ve,dK as Ee,T as R,d$ as we,F as Ne,f7 as Se,dY as Ie,f8 as Re,gL as De,ci as Le,b9 as J,bb as X,ba as Pe,b8 as Be,b4 as _e,dU as Fe}from"./index-CqYZiU1N.js";import{u as Ue}from"./useApiTokens-B6vbGXUF.js";const Oe=c("div")(({theme:t})=>({display:"grid",gridTemplateColumns:"auto auto 1fr",gridAutoRows:"min-content",alignItems:"center",gap:t.spacing(1),marginTop:t.spacing(1.5)})),g=f,Me=()=>{const{uiConfig:t}=k(),{setToastData:n}=D(),s=a=>()=>{z(a),n({type:"success",text:"Copied to clipboard"})},o=`${t.unleashUrl}/api/`,r=`${t.unleashUrl}/api/frontend/`;return e.jsxs(L,{severity:"info",children:[e.jsxs("p",{children:["Read the"," ",e.jsx("a",{href:"https://docs.getunleash.io/reference/sdks",target:"_blank",rel:"noreferrer",children:"SDK overview"})," ","to connect Unleash to your application. Please note it can take up to ",e.jsx("strong",{children:"1 minute"})," before a new API key is activated."]}),e.jsxs(Oe,{children:[e.jsx(g,{children:e.jsx("strong",{children:"CLIENT API URL: "})}),e.jsx(g,{children:e.jsx("pre",{style:{display:"inline"},children:o})}),e.jsx(g,{children:e.jsx(H,{title:"Copy URL",arrow:!0,children:e.jsx(K,{onClick:s(o),size:"small",children:e.jsx(S,{})})})}),e.jsx(g,{children:e.jsx("strong",{children:"FRONTEND API URL: "})}),e.jsx(g,{children:e.jsx("pre",{style:{display:"inline"},children:r})}),e.jsx(g,{children:e.jsx(H,{title:"Copy URL",arrow:!0,children:e.jsx(K,{onClick:s(r),size:"small",children:e.jsx(S,{})})})})]})]})},He=["Icon","createdAt","seenAt"],Ke=["Icon","project","seenAt"],ft=({compact:t=!1,setHiddenColumns:n,columns:s,loading:o,rows:r,headerGroups:a,globalFilter:i,prepareRow:p})=>{const u=ne(se.breakpoints.down("xl"));return oe([{condition:u,columns:He},{condition:t,columns:Ke}],n,s),e.jsxs(e.Fragment,{children:[e.jsx(b,{condition:r.length>0,show:e.jsx(f,{sx:{mb:4},children:e.jsx(Me,{})})}),e.jsx(f,{sx:{overflowX:"auto"},children:e.jsx(re,{value:i,children:e.jsx(ae,{rows:r,headerGroups:a,prepareRow:p})})}),e.jsx(b,{condition:r.length===0&&!o,show:e.jsx(b,{condition:(i==null?void 0:i.length)>0,show:e.jsxs($,{children:["No tokens found matching “",i,"”"]}),elseShow:e.jsx($,{children:e.jsxs("span",{children:["No tokens available. Read ",e.jsx(P,{href:"https://docs.getunleash.io/api-overview",target:"_blank",rel:"noreferrer",children:"API How-to guides"})," "," to learn more."]})})})})]})},$e=(t,n)=>{const s=n>=t;return{limitReached:s,limitMessage:s?`You have reached the limit of ${t} API tokens`:void 0}},yt=({path:t,permission:n,project:s})=>{const o=ie(),{tokens:r,loading:a}=Ue(),{uiConfig:i}=k(),{limitReached:p,limitMessage:u}=$e(i.resourceLimits.apiTokens,r.length);return e.jsx(le,{Icon:ce,onClick:()=>o(t),"data-testid":de,permission:n,projectId:s,maxWidth:"700px",disabled:a||p,tooltipProps:{title:u},children:"New API token"})},Ge=c(q)(({theme:t})=>({textDecoration:"none",color:t.palette.links,"&:hover, &:focus":{textDecoration:"underline"}})),We=c("div")({display:"flex",alignItems:"center"}),ze=({projects:t,project:n})=>{const{searchQuery:s}=ue(),o=t&&Array.isArray(t)&&t.length>1?t:[];if(o.length>0)return e.jsx(A,{children:e.jsx(I,{title:o.map((r,a)=>e.jsxs(d.Fragment,{children:[a>0&&", ",!r||r==="*"?e.jsx(E,{search:s,children:"*"}):e.jsx(Ge,{to:`/projects/${r}`,children:e.jsx(E,{search:s,children:r})})]},r)),placement:"bottom-start",arrow:!0,tabIndex:0,children:e.jsxs("span",{children:[`${o.length}`," projects"]})})});if(o.length===1&&o[0]!=="*"||n&&n!=="*"){const r=n||o[0];return e.jsx(he,{to:`/projects/${r}`,title:r})}return e.jsx(A,{children:e.jsx(I,{title:"ALL current and future projects.",placement:"bottom",arrow:!0,children:e.jsx(We,{children:e.jsx(E,{search:s,children:"*"})})})})};var B={},qe=xe;Object.defineProperty(B,"__esModule",{value:!0});var Z=B.default=void 0,Ve=qe(pe()),Ye=e,Qe=(0,Ve.default)((0,Ye.jsx)("path",{d:"M21 10h-8.35C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H13l2 2 2-2 2 2 4-4.04L21 10zM7 15c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3z"}),"Key");Z=B.default=Qe;const Je=({secret:t,project:n,projects:s})=>{const o=t!=null&&t.includes(":")?"v2":"v1",r=t==null?void 0:t.startsWith("*:"),a=s&&(s==null?void 0:s.length)>1||(s==null?void 0:s.length)===1&&s[0]!=="*"||n&&n!=="*";return o==="v2"&&!r&&!a},Xe=({...t})=>Je(t)?e.jsx(G,{icon:e.jsx(I,{title:e.jsxs("p",{children:["This is an orphaned token. All of its original projects have been deleted and it now has access to all current and future projects. You should stop using this token and delete it. Read more in"," ",e.jsx(P,{target:"_blank",rel:"noopener noreferrer",href:"https://github.com/Unleash/unleash/releases/tag/v6.1.0",children:"release notes"}),"."]}),placement:"bottom-start",arrow:!0,children:e.jsx(me,{"aria-label":"Orphaned token",color:"warning","data-testid":"orphaned-token-icon"})})}):e.jsx(G,{icon:e.jsx(Z,{color:"disabled"})}),bt=(t,n)=>{const s=d.useMemo(()=>({sortBy:[{id:"createdAt",desc:!0}]}),[]),o=d.useMemo(()=>[{id:"Icon",Cell:h=>e.jsx(Xe,{secret:h.row.original.secret,project:h.row.original.project,projects:h.row.original.projects}),disableSortBy:!0,disableGlobalFilter:!0,width:50},{Header:"Token name",accessor:"tokenName",Cell:w,minWidth:35},{Header:"Type",accessor:"type",Cell:({value:h})=>e.jsx(w,{value:W[h.toLowerCase()].label,subtitle:W[h.toLowerCase()].title,subtitleTooltip:!0}),width:180},{Header:"Project",accessor:"project",Cell:h=>e.jsx(ze,{project:h.row.original.project,projects:h.row.original.projects}),width:160},{Header:"Environment",accessor:"environment",Cell:w,width:120},{Header:"Created",accessor:"createdAt",Cell:je,width:150,disableGlobalFilter:!0},{Header:"Last seen",accessor:"seenAt",Cell:ge,width:140,disableGlobalFilter:!0},{Header:"Actions",width:120,id:"Actions",align:"center",disableSortBy:!0,disableGlobalFilter:!0,Cell:n}],[]),{getTableProps:r,getTableBodyProps:a,headerGroups:i,rows:p,prepareRow:u,state:j,setGlobalFilter:m,setHiddenColumns:y}=T.useTable({columns:o,data:t,initialState:s,sortTypes:fe,autoResetHiddenColumns:!1,disableSortRemove:!0},T.useGlobalFilter,T.useSortBy,T.useFlexLayout);return{getTableProps:r,getTableBodyProps:a,headerGroups:i,rows:p,prepareRow:u,state:j,setGlobalFilter:m,setHiddenColumns:y,columns:o}},W={client:{label:"BACKEND",title:"Connect backend SDK or Unleash Edge"},backend:{label:"BACKEND",title:"Connect backend SDK or Unleash Edge"},frontend:{label:"FRONTEND",title:"Connect frontend SDK"},admin:{label:"ADMIN",title:"Full access for managing Unleash"}},kt=({token:t,project:n,permission:s,track:o})=>{const{setToastData:r}=D(),a=i=>{z(i)&&(r({type:"success",text:"Token copied to clipboard"}),o&&typeof o=="function"&&o())};return e.jsx(V,{permission:s,projectId:n,tooltipProps:{title:"Copy token",arrow:!0},onClick:()=>a(t.secret),size:"large",children:e.jsx(S,{})})},Ze=c("ul")({marginBottom:0}),Ct=({token:t,permission:n,onRemove:s,project:o})=>{const[r,a]=d.useState(!1),{setToastData:i,setToastApiError:p}=D(),u=async()=>{try{await s(),a(!1),i({type:"success",text:"API token removed"})}catch(j){p(be(j))}};return e.jsxs(e.Fragment,{children:[e.jsx(V,{permission:n,projectId:o,tooltipProps:{title:"Delete token",arrow:!0},onClick:()=>a(!0),size:"large",children:e.jsx(ye,{})}),e.jsx(Y,{open:r,onClick:u,onClose:()=>a(!1),title:"Confirm deletion",children:e.jsxs("div",{children:["Are you sure you want to delete the following API token?",e.jsx("br",{}),e.jsxs(Ze,{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"name"}),":"," ",e.jsx("code",{children:t.tokenName})]}),e.jsxs("li",{children:[e.jsx("strong",{children:"type"}),": ",e.jsx("code",{children:t.type})]}),e.jsxs("li",{children:[e.jsx("strong",{children:"environment"}),":"," ",e.jsx("code",{children:t.environment})]})]})]})})]})},et=c("div")(()=>({maxWidth:"400px"})),tt=c("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),nt=c(ke)(({theme:t})=>({width:"100%",marginBottom:t.spacing(2)})),st=c(Ce)(({theme:t})=>({marginBottom:t.spacing(2),minWidth:"400px",[t.breakpoints.down("sm")]:{minWidth:"379px"}})),ee=c("p")(({theme:t})=>({marginBottom:t.spacing(1)})),ot=c("label")(({theme:t})=>({marginBottom:t.spacing(1)})),rt=c(Te)(({theme:t})=>({marginLeft:t.spacing(3)})),at=c(f)({marginTop:"auto",display:"flex",justifyContent:"flex-end"}),Tt=({children:t,actions:n,handleSubmit:s,handleCancel:o})=>{var i;const{uiConfig:r}=k(),a=!!((i=r==null?void 0:r.flags)!=null&&i.UNLEASH_CLOUD);return e.jsxs(tt,{onSubmit:s,children:[e.jsx(b,{condition:a,show:e.jsxs(L,{severity:"info",sx:{mb:4},children:["Please be aware of our"," ",e.jsx(P,{href:"https://www.getunleash.io/fair-use-policy",children:"fair use policy"}),"."]})}),t,e.jsxs(at,{children:[n,e.jsx(rt,{onClick:o,children:"Cancel"})]})]})};var x=(t=>(t.ADMIN="ADMIN",t.CLIENT="CLIENT",t.FRONTEND="FRONTEND",t))(x||{});const At=t=>{var U,O;const{environments:n}=Q(),s=(U=n==null?void 0:n.find(l=>l.enabled))==null?void 0:U.name,o=N(Ae,t),r=[{key:x.CLIENT,label:"Backend SDK",title:"Creates a backend token to connect a backend SDK or Unleash Edge",enabled:N(ve)||o},{key:x.FRONTEND,label:"Frontend SDK",title:"Creates a frontend token to connect a frontend SDK",enabled:N(Ee)||o}],a=(O=r.find(l=>l.enabled))==null?void 0:O.key,[i,p]=d.useState(""),[u,j]=d.useState(a||x.CLIENT),[m,y]=d.useState([t||"*"]),[h,te]=d.useState(m),[_,C]=d.useState(),[F,v]=d.useState({});return d.useEffect(()=>{C(u==="ADMIN"?"*":s)},[u,s]),{tokenName:i,type:u,apiTokenTypes:r,projects:m,environment:_,setTokenName:p,setTokenType:l=>{l==="ADMIN"?(j(x.ADMIN),te(m),y(["*"]),C("*")):(j(l),y(h),C(s))},setProjects:y,setEnvironment:C,getApiTokenPayload:()=>({tokenName:i,type:u,environment:_,projects:m}),isValid:()=>{const l={};return i||(l.tokenName="Token name is required"),m.length===0&&(l.projects="At least one project is required"),v(l),Object.keys(l).length===0},clearErrors:l=>{if(l){const M={...F};delete M[l],v(M)}else v({})},errors:F}},vt=({open:t,setOpen:n,closeConfirm:s,token:o,type:r})=>e.jsxs(Y,{open:t,setOpen:n,onClick:s,primaryButtonText:"Close",title:"New token created",children:[e.jsx(R,{variant:"body1",children:"Your new token has been created successfully."}),e.jsx(we,{token:o}),e.jsx(b,{condition:r===x.FRONTEND,show:e.jsxs(L,{sx:{mt:2},severity:"info",children:["By default, all ",x.FRONTEND," tokens may be used from any CORS origin. If you'd like to configure a strict set of origins, please use the"," ",e.jsx(q,{to:"/admin/cors",target:"_blank",rel:"noreferrer",children:"CORS origins configuration page"}),"."]})})]}),Et=({tokenName:t,setTokenName:n,errors:s,clearErrors:o})=>e.jsxs(e.Fragment,{children:[e.jsx(ee,{children:"What would you like to call this token?"}),e.jsx(nt,{value:t,name:"tokenName",onChange:r=>n(r.target.value),label:"Token name",error:s.tokenName!==void 0,errorText:s.tokenName,onFocus:()=>o("tokenName"),autoFocus:!0})]}),wt=({type:t,setType:n,apiTokenTypes:s})=>e.jsx(et,{children:e.jsxs(Ne,{sx:{mb:2,width:"100%"},children:[e.jsx(ot,{id:"token-type",children:"What do you want to connect?"}),e.jsx(Se,{"aria-labelledby":"token-type",defaultValue:"CLIENT",name:"radio-buttons-group",value:t,onChange:(o,r)=>n(r),children:s.map(({key:o,label:r,title:a,enabled:i})=>e.jsx(Ie,{value:o,sx:{mb:1},disabled:!i,control:e.jsx(Re,{sx:{ml:.75,alignSelf:"flex-start"}}),label:e.jsx(f,{children:e.jsxs(f,{children:[e.jsx(R,{children:r}),e.jsx(R,{variant:"body2",color:"text.secondary",children:a})]})})},o))})]})}),Nt=({type:t,environment:n,setEnvironment:s})=>{const{environments:o}=Q(),r=t===x.ADMIN?[{key:"*",label:"ALL"}]:o.map(a=>({key:a.name,label:`${a.name.concat(a.enabled?"":" - deprecated")}`,title:a.name,disabled:!1}));return e.jsxs(e.Fragment,{children:[e.jsx(ee,{children:"Which environment should the token have access to?"}),e.jsx(st,{disabled:t===x.ADMIN,options:r,value:n,onChange:s,label:"Environment",id:"api_key_environment",name:"environment",IconComponent:De,fullWidth:!0})]})},it=t=>t.map(n=>({...n.user,joinedAt:new Date(n.joinedAt),createdBy:n.createdBy})),St=t=>{const{data:n,error:s,mutate:o}=Le(J(`api/admin/groups/${t}`),lt);return d.useMemo(()=>({group:n&&{...n,users:it((n==null?void 0:n.users)??[])},loading:!s&&!n,refetchGroup:()=>o(),error:s}),[n,s,o])},lt=t=>fetch(t).then(X("Group")).then(n=>n.json()),It=()=>{const{isEnterprise:t}=k(),{data:n,error:s,mutate:o}=Pe(t(),{serviceAccounts:[],rootRoles:[]},J("api/admin/service-account"),ct);return d.useMemo(()=>({serviceAccounts:(n==null?void 0:n.serviceAccounts)??[],roles:(n==null?void 0:n.rootRoles)??[],loading:!s&&!n,refetch:()=>o(),error:s}),[n,s,o])},ct=t=>fetch(t).then(X("Service Accounts")).then(n=>n.json()),dt=c("div")(({theme:t})=>({display:"flex",flexDirection:"column",gap:t.spacing(.5),"& > *:not(:last-child)":{borderBottom:`1px solid ${t.palette.divider}`,paddingBottom:t.spacing(1)}})),ut=c(Be)(()=>({display:"block"})),Rt=({role:t,roles:n,value:s})=>{const{isEnterprise:o}=k();if(o()){const r=n||[t];return e.jsx(A,{children:e.jsx(_e,{tooltip:e.jsx(dt,{children:r.map(a=>e.jsx(Fe,{roleId:a,tooltip:!0},a))}),children:e.jsx(ut,{children:s})})})}return e.jsx(A,{children:s})};export{ft as A,yt as C,Nt as E,Ct as R,ee as S,x as T,kt as a,At as b,Tt as c,Et as d,wt as e,vt as f,It as g,St as h,Rt as i,Z as j,it as m,bt as u};
1
+ import{s as c,bc as k,e as D,j as e,V as L,y as H,D as K,fG as S,B as f,dg as z,al as ne,dr as se,ao as oe,C as b,az as re,ap as ae,ay as $,c0 as P,bt as ie,ey as le,bh as ce,iQ as de,L as q,eo as ue,ak as A,g6 as I,r as d,ep as E,av as he,G as pe,H as xe,aj as G,fl as me,an as w,ee as je,eF as ge,ac as T,ad as fe,cC as V,b3 as ye,aY as Y,h as be,w as ke,aT as Ce,i as Te,aA as Q,gM as N,hK as Ae,dL as ve,dK as Ee,T as R,d$ as we,F as Ne,f7 as Se,dY as Ie,f8 as Re,gL as De,ci as Le,b9 as J,bb as X,ba as Pe,b8 as Be,b4 as _e,dU as Fe}from"./index-A5We7bvX.js";import{u as Ue}from"./useApiTokens-DNIDLJlc.js";const Oe=c("div")(({theme:t})=>({display:"grid",gridTemplateColumns:"auto auto 1fr",gridAutoRows:"min-content",alignItems:"center",gap:t.spacing(1),marginTop:t.spacing(1.5)})),g=f,Me=()=>{const{uiConfig:t}=k(),{setToastData:n}=D(),s=a=>()=>{z(a),n({type:"success",text:"Copied to clipboard"})},o=`${t.unleashUrl}/api/`,r=`${t.unleashUrl}/api/frontend/`;return e.jsxs(L,{severity:"info",children:[e.jsxs("p",{children:["Read the"," ",e.jsx("a",{href:"https://docs.getunleash.io/reference/sdks",target:"_blank",rel:"noreferrer",children:"SDK overview"})," ","to connect Unleash to your application. Please note it can take up to ",e.jsx("strong",{children:"1 minute"})," before a new API key is activated."]}),e.jsxs(Oe,{children:[e.jsx(g,{children:e.jsx("strong",{children:"CLIENT API URL: "})}),e.jsx(g,{children:e.jsx("pre",{style:{display:"inline"},children:o})}),e.jsx(g,{children:e.jsx(H,{title:"Copy URL",arrow:!0,children:e.jsx(K,{onClick:s(o),size:"small",children:e.jsx(S,{})})})}),e.jsx(g,{children:e.jsx("strong",{children:"FRONTEND API URL: "})}),e.jsx(g,{children:e.jsx("pre",{style:{display:"inline"},children:r})}),e.jsx(g,{children:e.jsx(H,{title:"Copy URL",arrow:!0,children:e.jsx(K,{onClick:s(r),size:"small",children:e.jsx(S,{})})})})]})]})},He=["Icon","createdAt","seenAt"],Ke=["Icon","project","seenAt"],ft=({compact:t=!1,setHiddenColumns:n,columns:s,loading:o,rows:r,headerGroups:a,globalFilter:i,prepareRow:p})=>{const u=ne(se.breakpoints.down("xl"));return oe([{condition:u,columns:He},{condition:t,columns:Ke}],n,s),e.jsxs(e.Fragment,{children:[e.jsx(b,{condition:r.length>0,show:e.jsx(f,{sx:{mb:4},children:e.jsx(Me,{})})}),e.jsx(f,{sx:{overflowX:"auto"},children:e.jsx(re,{value:i,children:e.jsx(ae,{rows:r,headerGroups:a,prepareRow:p})})}),e.jsx(b,{condition:r.length===0&&!o,show:e.jsx(b,{condition:(i==null?void 0:i.length)>0,show:e.jsxs($,{children:["No tokens found matching “",i,"”"]}),elseShow:e.jsx($,{children:e.jsxs("span",{children:["No tokens available. Read ",e.jsx(P,{href:"https://docs.getunleash.io/api-overview",target:"_blank",rel:"noreferrer",children:"API How-to guides"})," "," to learn more."]})})})})]})},$e=(t,n)=>{const s=n>=t;return{limitReached:s,limitMessage:s?`You have reached the limit of ${t} API tokens`:void 0}},yt=({path:t,permission:n,project:s})=>{const o=ie(),{tokens:r,loading:a}=Ue(),{uiConfig:i}=k(),{limitReached:p,limitMessage:u}=$e(i.resourceLimits.apiTokens,r.length);return e.jsx(le,{Icon:ce,onClick:()=>o(t),"data-testid":de,permission:n,projectId:s,maxWidth:"700px",disabled:a||p,tooltipProps:{title:u},children:"New API token"})},Ge=c(q)(({theme:t})=>({textDecoration:"none",color:t.palette.links,"&:hover, &:focus":{textDecoration:"underline"}})),We=c("div")({display:"flex",alignItems:"center"}),ze=({projects:t,project:n})=>{const{searchQuery:s}=ue(),o=t&&Array.isArray(t)&&t.length>1?t:[];if(o.length>0)return e.jsx(A,{children:e.jsx(I,{title:o.map((r,a)=>e.jsxs(d.Fragment,{children:[a>0&&", ",!r||r==="*"?e.jsx(E,{search:s,children:"*"}):e.jsx(Ge,{to:`/projects/${r}`,children:e.jsx(E,{search:s,children:r})})]},r)),placement:"bottom-start",arrow:!0,tabIndex:0,children:e.jsxs("span",{children:[`${o.length}`," projects"]})})});if(o.length===1&&o[0]!=="*"||n&&n!=="*"){const r=n||o[0];return e.jsx(he,{to:`/projects/${r}`,title:r})}return e.jsx(A,{children:e.jsx(I,{title:"ALL current and future projects.",placement:"bottom",arrow:!0,children:e.jsx(We,{children:e.jsx(E,{search:s,children:"*"})})})})};var B={},qe=xe;Object.defineProperty(B,"__esModule",{value:!0});var Z=B.default=void 0,Ve=qe(pe()),Ye=e,Qe=(0,Ve.default)((0,Ye.jsx)("path",{d:"M21 10h-8.35C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H13l2 2 2-2 2 2 4-4.04L21 10zM7 15c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3z"}),"Key");Z=B.default=Qe;const Je=({secret:t,project:n,projects:s})=>{const o=t!=null&&t.includes(":")?"v2":"v1",r=t==null?void 0:t.startsWith("*:"),a=s&&(s==null?void 0:s.length)>1||(s==null?void 0:s.length)===1&&s[0]!=="*"||n&&n!=="*";return o==="v2"&&!r&&!a},Xe=({...t})=>Je(t)?e.jsx(G,{icon:e.jsx(I,{title:e.jsxs("p",{children:["This is an orphaned token. All of its original projects have been deleted and it now has access to all current and future projects. You should stop using this token and delete it. Read more in"," ",e.jsx(P,{target:"_blank",rel:"noopener noreferrer",href:"https://github.com/Unleash/unleash/releases/tag/v6.1.0",children:"release notes"}),"."]}),placement:"bottom-start",arrow:!0,children:e.jsx(me,{"aria-label":"Orphaned token",color:"warning","data-testid":"orphaned-token-icon"})})}):e.jsx(G,{icon:e.jsx(Z,{color:"disabled"})}),bt=(t,n)=>{const s=d.useMemo(()=>({sortBy:[{id:"createdAt",desc:!0}]}),[]),o=d.useMemo(()=>[{id:"Icon",Cell:h=>e.jsx(Xe,{secret:h.row.original.secret,project:h.row.original.project,projects:h.row.original.projects}),disableSortBy:!0,disableGlobalFilter:!0,width:50},{Header:"Token name",accessor:"tokenName",Cell:w,minWidth:35},{Header:"Type",accessor:"type",Cell:({value:h})=>e.jsx(w,{value:W[h.toLowerCase()].label,subtitle:W[h.toLowerCase()].title,subtitleTooltip:!0}),width:180},{Header:"Project",accessor:"project",Cell:h=>e.jsx(ze,{project:h.row.original.project,projects:h.row.original.projects}),width:160},{Header:"Environment",accessor:"environment",Cell:w,width:120},{Header:"Created",accessor:"createdAt",Cell:je,width:150,disableGlobalFilter:!0},{Header:"Last seen",accessor:"seenAt",Cell:ge,width:140,disableGlobalFilter:!0},{Header:"Actions",width:120,id:"Actions",align:"center",disableSortBy:!0,disableGlobalFilter:!0,Cell:n}],[]),{getTableProps:r,getTableBodyProps:a,headerGroups:i,rows:p,prepareRow:u,state:j,setGlobalFilter:m,setHiddenColumns:y}=T.useTable({columns:o,data:t,initialState:s,sortTypes:fe,autoResetHiddenColumns:!1,disableSortRemove:!0},T.useGlobalFilter,T.useSortBy,T.useFlexLayout);return{getTableProps:r,getTableBodyProps:a,headerGroups:i,rows:p,prepareRow:u,state:j,setGlobalFilter:m,setHiddenColumns:y,columns:o}},W={client:{label:"BACKEND",title:"Connect backend SDK or Unleash Edge"},backend:{label:"BACKEND",title:"Connect backend SDK or Unleash Edge"},frontend:{label:"FRONTEND",title:"Connect frontend SDK"},admin:{label:"ADMIN",title:"Full access for managing Unleash"}},kt=({token:t,project:n,permission:s,track:o})=>{const{setToastData:r}=D(),a=i=>{z(i)&&(r({type:"success",text:"Token copied to clipboard"}),o&&typeof o=="function"&&o())};return e.jsx(V,{permission:s,projectId:n,tooltipProps:{title:"Copy token",arrow:!0},onClick:()=>a(t.secret),size:"large",children:e.jsx(S,{})})},Ze=c("ul")({marginBottom:0}),Ct=({token:t,permission:n,onRemove:s,project:o})=>{const[r,a]=d.useState(!1),{setToastData:i,setToastApiError:p}=D(),u=async()=>{try{await s(),a(!1),i({type:"success",text:"API token removed"})}catch(j){p(be(j))}};return e.jsxs(e.Fragment,{children:[e.jsx(V,{permission:n,projectId:o,tooltipProps:{title:"Delete token",arrow:!0},onClick:()=>a(!0),size:"large",children:e.jsx(ye,{})}),e.jsx(Y,{open:r,onClick:u,onClose:()=>a(!1),title:"Confirm deletion",children:e.jsxs("div",{children:["Are you sure you want to delete the following API token?",e.jsx("br",{}),e.jsxs(Ze,{children:[e.jsxs("li",{children:[e.jsx("strong",{children:"name"}),":"," ",e.jsx("code",{children:t.tokenName})]}),e.jsxs("li",{children:[e.jsx("strong",{children:"type"}),": ",e.jsx("code",{children:t.type})]}),e.jsxs("li",{children:[e.jsx("strong",{children:"environment"}),":"," ",e.jsx("code",{children:t.environment})]})]})]})})]})},et=c("div")(()=>({maxWidth:"400px"})),tt=c("form")(()=>({display:"flex",flexDirection:"column",height:"100%"})),nt=c(ke)(({theme:t})=>({width:"100%",marginBottom:t.spacing(2)})),st=c(Ce)(({theme:t})=>({marginBottom:t.spacing(2),minWidth:"400px",[t.breakpoints.down("sm")]:{minWidth:"379px"}})),ee=c("p")(({theme:t})=>({marginBottom:t.spacing(1)})),ot=c("label")(({theme:t})=>({marginBottom:t.spacing(1)})),rt=c(Te)(({theme:t})=>({marginLeft:t.spacing(3)})),at=c(f)({marginTop:"auto",display:"flex",justifyContent:"flex-end"}),Tt=({children:t,actions:n,handleSubmit:s,handleCancel:o})=>{var i;const{uiConfig:r}=k(),a=!!((i=r==null?void 0:r.flags)!=null&&i.UNLEASH_CLOUD);return e.jsxs(tt,{onSubmit:s,children:[e.jsx(b,{condition:a,show:e.jsxs(L,{severity:"info",sx:{mb:4},children:["Please be aware of our"," ",e.jsx(P,{href:"https://www.getunleash.io/fair-use-policy",children:"fair use policy"}),"."]})}),t,e.jsxs(at,{children:[n,e.jsx(rt,{onClick:o,children:"Cancel"})]})]})};var x=(t=>(t.ADMIN="ADMIN",t.CLIENT="CLIENT",t.FRONTEND="FRONTEND",t))(x||{});const At=t=>{var U,O;const{environments:n}=Q(),s=(U=n==null?void 0:n.find(l=>l.enabled))==null?void 0:U.name,o=N(Ae,t),r=[{key:x.CLIENT,label:"Backend SDK",title:"Creates a backend token to connect a backend SDK or Unleash Edge",enabled:N(ve)||o},{key:x.FRONTEND,label:"Frontend SDK",title:"Creates a frontend token to connect a frontend SDK",enabled:N(Ee)||o}],a=(O=r.find(l=>l.enabled))==null?void 0:O.key,[i,p]=d.useState(""),[u,j]=d.useState(a||x.CLIENT),[m,y]=d.useState([t||"*"]),[h,te]=d.useState(m),[_,C]=d.useState(),[F,v]=d.useState({});return d.useEffect(()=>{C(u==="ADMIN"?"*":s)},[u,s]),{tokenName:i,type:u,apiTokenTypes:r,projects:m,environment:_,setTokenName:p,setTokenType:l=>{l==="ADMIN"?(j(x.ADMIN),te(m),y(["*"]),C("*")):(j(l),y(h),C(s))},setProjects:y,setEnvironment:C,getApiTokenPayload:()=>({tokenName:i,type:u,environment:_,projects:m}),isValid:()=>{const l={};return i||(l.tokenName="Token name is required"),m.length===0&&(l.projects="At least one project is required"),v(l),Object.keys(l).length===0},clearErrors:l=>{if(l){const M={...F};delete M[l],v(M)}else v({})},errors:F}},vt=({open:t,setOpen:n,closeConfirm:s,token:o,type:r})=>e.jsxs(Y,{open:t,setOpen:n,onClick:s,primaryButtonText:"Close",title:"New token created",children:[e.jsx(R,{variant:"body1",children:"Your new token has been created successfully."}),e.jsx(we,{token:o}),e.jsx(b,{condition:r===x.FRONTEND,show:e.jsxs(L,{sx:{mt:2},severity:"info",children:["By default, all ",x.FRONTEND," tokens may be used from any CORS origin. If you'd like to configure a strict set of origins, please use the"," ",e.jsx(q,{to:"/admin/cors",target:"_blank",rel:"noreferrer",children:"CORS origins configuration page"}),"."]})})]}),Et=({tokenName:t,setTokenName:n,errors:s,clearErrors:o})=>e.jsxs(e.Fragment,{children:[e.jsx(ee,{children:"What would you like to call this token?"}),e.jsx(nt,{value:t,name:"tokenName",onChange:r=>n(r.target.value),label:"Token name",error:s.tokenName!==void 0,errorText:s.tokenName,onFocus:()=>o("tokenName"),autoFocus:!0})]}),wt=({type:t,setType:n,apiTokenTypes:s})=>e.jsx(et,{children:e.jsxs(Ne,{sx:{mb:2,width:"100%"},children:[e.jsx(ot,{id:"token-type",children:"What do you want to connect?"}),e.jsx(Se,{"aria-labelledby":"token-type",defaultValue:"CLIENT",name:"radio-buttons-group",value:t,onChange:(o,r)=>n(r),children:s.map(({key:o,label:r,title:a,enabled:i})=>e.jsx(Ie,{value:o,sx:{mb:1},disabled:!i,control:e.jsx(Re,{sx:{ml:.75,alignSelf:"flex-start"}}),label:e.jsx(f,{children:e.jsxs(f,{children:[e.jsx(R,{children:r}),e.jsx(R,{variant:"body2",color:"text.secondary",children:a})]})})},o))})]})}),Nt=({type:t,environment:n,setEnvironment:s})=>{const{environments:o}=Q(),r=t===x.ADMIN?[{key:"*",label:"ALL"}]:o.map(a=>({key:a.name,label:`${a.name.concat(a.enabled?"":" - deprecated")}`,title:a.name,disabled:!1}));return e.jsxs(e.Fragment,{children:[e.jsx(ee,{children:"Which environment should the token have access to?"}),e.jsx(st,{disabled:t===x.ADMIN,options:r,value:n,onChange:s,label:"Environment",id:"api_key_environment",name:"environment",IconComponent:De,fullWidth:!0})]})},it=t=>t.map(n=>({...n.user,joinedAt:new Date(n.joinedAt),createdBy:n.createdBy})),St=t=>{const{data:n,error:s,mutate:o}=Le(J(`api/admin/groups/${t}`),lt);return d.useMemo(()=>({group:n&&{...n,users:it((n==null?void 0:n.users)??[])},loading:!s&&!n,refetchGroup:()=>o(),error:s}),[n,s,o])},lt=t=>fetch(t).then(X("Group")).then(n=>n.json()),It=()=>{const{isEnterprise:t}=k(),{data:n,error:s,mutate:o}=Pe(t(),{serviceAccounts:[],rootRoles:[]},J("api/admin/service-account"),ct);return d.useMemo(()=>({serviceAccounts:(n==null?void 0:n.serviceAccounts)??[],roles:(n==null?void 0:n.rootRoles)??[],loading:!s&&!n,refetch:()=>o(),error:s}),[n,s,o])},ct=t=>fetch(t).then(X("Service Accounts")).then(n=>n.json()),dt=c("div")(({theme:t})=>({display:"flex",flexDirection:"column",gap:t.spacing(.5),"& > *:not(:last-child)":{borderBottom:`1px solid ${t.palette.divider}`,paddingBottom:t.spacing(1)}})),ut=c(Be)(()=>({display:"block"})),Rt=({role:t,roles:n,value:s})=>{const{isEnterprise:o}=k();if(o()){const r=n||[t];return e.jsx(A,{children:e.jsx(_e,{tooltip:e.jsx(dt,{children:r.map(a=>e.jsx(Fe,{roleId:a,tooltip:!0},a))}),children:e.jsx(ut,{children:s})})})}return e.jsx(A,{children:s})};export{ft as A,yt as C,Nt as E,Ct as R,ee as S,x as T,kt as a,At as b,Tt as c,Et as d,wt as e,vt as f,It as g,St as h,Rt as i,Z as j,it as m,bt as u};
@@ -1 +1 @@
1
- import{s as h,L as f,j as n,aY as m,b9 as p,ci as y,r as d,bd as v,bb as g,as as b,bc as k,aT as x}from"./index-CqYZiU1N.js";const E=h(f)(({theme:a})=>({textDecoration:"none",color:a.palette.primary.main,fontWeight:a.fontWeight.bold})),w=({isOpen:a,onClose:r,features:e,project:t})=>n.jsxs(m,{title:"You can't archive a feature that other features depend on",open:a,primaryButtonText:"OK",onClick:r,children:[n.jsx("p",{children:"The following features depend on your feature:"}),n.jsx("ul",{children:e.map(s=>n.jsx("li",{children:n.jsx(E,{to:`/projects/${t}/features/${s}`,target:"_blank",rel:"noopener noreferrer",children:s})},s))})]}),F=p("api/admin/client-metrics/features"),A=(a,r)=>{const e=p(`api/admin/client-metrics/features/${a}/raw?hoursBack=${r}`),{data:t,error:s}=y(e,()=>L(e)),i=d.useCallback(()=>{v(F).catch(console.warn)},[]);return{featureMetrics:t==null?void 0:t.data,loading:!s&&!t,refetchFeatureMetrics:i,error:s}},L=a=>fetch(a).then(g("Features")).then(r=>r.json()).then(),M=48,j=({hoursBack:a,setHoursBack:r,label:e="Period"})=>{const{trackEvent:t}=b(),s=o=>{r(Number.parseInt(o)),t("feature-metrics",{props:{eventType:"change-period",hoursBack:o}})},{isEnterprise:i}=k(),l=i()?[...u,...R]:u,c=l.map(o=>Number(o.key)).includes(a)?a:M;return d.useEffect(()=>{a!==c&&r(c)},[a]),n.jsx("div",{children:n.jsx(x,{name:"feature-metrics-period",label:e,id:"feature-metrics-period",options:l,value:String(c),onChange:s,fullWidth:!0})})},u=[{key:"1",label:"Last hour"},{key:"24",label:"Last 24 hours"},{key:"48",label:"Last 48 hours"}],R=[{key:`${7*24}`,label:"Last 7 days"},{key:`${30*24}`,label:"Last 30 days"},{key:`${90*24}`,label:"Last 90 days"}],$=a=>{const r=new Map;return a.forEach(e=>{let t=r.get(e.timestamp);if(t||(t={...e,yes:0,no:0,variants:{}},r.set(e.timestamp,t)),t.yes+=e.yes,t.no+=e.no,e.variants){t.variants=t.variants||{};for(const[s,i]of Object.entries(e.variants))t.variants[s]=(t.variants[s]||0)+i}}),Array.from(r.values()).map(e=>({...e,variants:e.variants&&Object.keys(e.variants).length===0?void 0:e.variants}))};export{w as F,M as a,$ as b,j as c,A as u};
1
+ import{s as h,L as f,j as n,aY as m,b9 as p,ci as y,r as d,bd as v,bb as g,as as b,bc as k,aT as x}from"./index-A5We7bvX.js";const E=h(f)(({theme:a})=>({textDecoration:"none",color:a.palette.primary.main,fontWeight:a.fontWeight.bold})),w=({isOpen:a,onClose:r,features:e,project:t})=>n.jsxs(m,{title:"You can't archive a feature that other features depend on",open:a,primaryButtonText:"OK",onClick:r,children:[n.jsx("p",{children:"The following features depend on your feature:"}),n.jsx("ul",{children:e.map(s=>n.jsx("li",{children:n.jsx(E,{to:`/projects/${t}/features/${s}`,target:"_blank",rel:"noopener noreferrer",children:s})},s))})]}),F=p("api/admin/client-metrics/features"),A=(a,r)=>{const e=p(`api/admin/client-metrics/features/${a}/raw?hoursBack=${r}`),{data:t,error:s}=y(e,()=>L(e)),i=d.useCallback(()=>{v(F).catch(console.warn)},[]);return{featureMetrics:t==null?void 0:t.data,loading:!s&&!t,refetchFeatureMetrics:i,error:s}},L=a=>fetch(a).then(g("Features")).then(r=>r.json()).then(),M=48,j=({hoursBack:a,setHoursBack:r,label:e="Period"})=>{const{trackEvent:t}=b(),s=o=>{r(Number.parseInt(o)),t("feature-metrics",{props:{eventType:"change-period",hoursBack:o}})},{isEnterprise:i}=k(),l=i()?[...u,...R]:u,c=l.map(o=>Number(o.key)).includes(a)?a:M;return d.useEffect(()=>{a!==c&&r(c)},[a]),n.jsx("div",{children:n.jsx(x,{name:"feature-metrics-period",label:e,id:"feature-metrics-period",options:l,value:String(c),onChange:s,fullWidth:!0})})},u=[{key:"1",label:"Last hour"},{key:"24",label:"Last 24 hours"},{key:"48",label:"Last 48 hours"}],R=[{key:`${7*24}`,label:"Last 7 days"},{key:`${30*24}`,label:"Last 30 days"},{key:`${90*24}`,label:"Last 90 days"}],$=a=>{const r=new Map;return a.forEach(e=>{let t=r.get(e.timestamp);if(t||(t={...e,yes:0,no:0,variants:{}},r.set(e.timestamp,t)),t.yes+=e.yes,t.no+=e.no,e.variants){t.variants=t.variants||{};for(const[s,i]of Object.entries(e.variants))t.variants[s]=(t.variants[s]||0)+i}}),Array.from(r.values()).map(e=>({...e,variants:e.variants&&Object.keys(e.variants).length===0?void 0:e.variants}))};export{w as F,M as a,$ as b,j as c,A as u};
@@ -1,4 +1,4 @@
1
- import{jc as ct,jE as R,jF as w,jG as p,jd as Q,jH as fe,jI as ut,jJ as b,i$ as oe,jk as B,jK as A,jL as ft,jM as ht,je as _,jf as he,ja as K,jN as yt,jO as bt,jP as X,jQ as J,jR as Ce,jS as gt,jT as Pe,jU as T,jV as Ve,jW as $e,jX as mt}from"./index-CqYZiU1N.js";/*!
1
+ import{jc as ct,jE as R,jF as w,jG as p,jd as Q,jH as fe,jI as ut,jJ as b,i$ as oe,jk as B,jK as A,jL as ft,jM as ht,je as _,jf as he,ja as K,jN as yt,jO as bt,jP as X,jQ as J,jR as Ce,jS as gt,jT as Pe,jU as T,jV as Ve,jW as $e,jX as mt}from"./index-A5We7bvX.js";/*!
2
2
  * chartjs-plugin-annotation v2.2.1
3
3
  * https://www.chartjs.org/chartjs-plugin-annotation/index
4
4
  * (c) 2023 chartjs-plugin-annotation Contributors