import{aj as j,r as c,j as e,d as a,b6 as w,cT as H}from"./index-CK33qGU_.js";const I=[{duration:"5m",label:"5 min"},{duration:"15m",label:"15 min"},{duration:"30m",label:"30 min"},{duration:"1h",label:"1 hr"},{duration:"5h",label:"5 hr"},{duration:"24h",label:"24 hr"}],t={THEME:"light",DURATION_TO:"now",REFRESH:"10s",HEIGHT:"300px",PANEL_WIDTH:"50%",DURATION_FROM:"15m"},p=({panels:n,panelDurationsControls:i=I})=>{const{colorMode:l}=j(),[s,o]=c.useState(t.DURATION_FROM),h=({urlPath:r,refresh:m=t.REFRESH,theme:f=t.THEME,variables:x,panelId:b,duration:E=s,to:T=t.DURATION_TO})=>{const D={...x.reduce((R,d)=>({...R,[`var-${d.name}`]:d.value}),{}),theme:f,refresh:m,panelId:b,from:`now-${E}`,to:T,orgId:1},g=H.stringify(D);return`https://localhost:8181/hopsworks-api/${r}?${g}`},u=c.useCallback(r=>()=>{o(r)},[o]);return e.jsxs(e.Fragment,{children:[i.length>0&&e.jsx(a,{flexDirection:"row",mb:20,children:i.map(r=>e.jsx(w,{onClick:u(r.duration),intent:r.duration===s?"primary":"secondary",children:r.label},`option-${r.label}`))}),n.length>0&&e.jsx(a,{justifyContent:"space-between",alignItems:"center",flexDirection:"row",flexWrap:"wrap",sx:{...l==="dark"?{filter:"invert(92%)"}:{}},children:n.map(r=>e.jsx(a,{width:r.width??t.PANEL_WIDTH,sx:{...l==="dark"&&{filter:"invert(92%)"}},children:e.jsx("iframe",{title:r.title,src:h({...r.linkParams}),width:"100%",height:r.height??t.HEIGHT,frameBorder:"0"})},`panel-${r.title.replace(/\s/g,"")}`))})]})};export{p as G};
