import{G as x,j as p,a as y}from"./index-b983ad9b.js";import{r as m}from"./react-b0e0d18a.js";import{f as w}from"./index.module-32df86df.js";import{K as E}from"./KB-757eebe4.js";import{L as F}from"./index-411ad78c.js";import"./antd-8ca2e36c.js";/* empty css                *//* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              */import"./Room-7ae51b0a.js";/* empty css              *//* empty css              */function O({event:i}){const[u,f]=m.useState([]),n=m.useRef(!0);m.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[]),m.useEffect(()=>{i&&(async()=>{const t=await x().get(`api/v1/event/${i.id}/snapshot`);if(!t)return;const o=[];for(let r of i.measurements){if(!t[r])continue;const[,a]=r.split("."),{title:e,unit:d}=await E.getMeasurement(a)||{},{data:l,time:h,pitch:g}=t[r];o.push({key:a,title:e,unit:d,data:l.map((s,v)=>({time:h+g*v,value:s})).filter(({value:s})=>s!==null)})}n.current&&f(o)})()},[i.id]);const c={autoFit:!0,height:64,xField:"time",yField:"value",yAxis:{tickCount:3},point:{shape:"point"}};return p("div",{style:{maxHeight:256,overflow:"auto",paddingLeft:8,paddingRight:8},children:u.map(({key:t,title:o,unit:r,data:a})=>y("div",{style:{backgroundColor:"#eee",marginBottom:4,padding:8},children:[p("div",{style:{marginBottom:8},children:o||t}),p(F,{...c,meta:{time:{formatter:e=>w(new Date(Number(e)),"HH:mm")}},tooltip:{formatter:e=>({name:"浓度",value:`${Number(e.value).toFixed(2)}${r}`})},data:a})]},t))})}export{O as default};
