Skip to content

The only tool you need to know what is happening and how to fix it.

3.0 KB
Raw Blame
import"./DsnmJJEf.js";import{p as K,e as p,m as v,h as g,g as t,u as d,c as Q,f as h,o as D,d as l,r as f,q as w,a as V}from"./BKFspo1J.js";import{i as W}from"./COK9M2N0.js";import{e as Z,i as tt}from"./DpeZtIXD.js";import{c as P}from"./CWm9VMfX.js";import{a as et,b as T}from"./DwMHXN8q.js";import{p as rt}from"./CARHnQ8P.js";import{T as ot,a as at,b as st}from"./uWQtYvRH.js";import{S as nt}from"./8zLz30Kn.js";import{f as it,g as dt}from"./DbaB4N6s.js";import{g as ut}from"./qSFdVk7G.js";var lt=p('<div class="absolute right-7 left-0 h-[1px]"></div> <span class="absolute right-1 w-[20px] text-[10px] font-medium text-muted-foreground tabular-nums"> </span>',1),ct=p("<div></div>"),mt=p('<div class="text-sm font-medium"> </div> <div class="text-xs text-muted-foreground"> </div>',1),vt=p("<!> <!>",1),ft=p('<div class="relative h-8 w-44 flex-shrink-0"><div class="absolute right-7 bottom-0 left-0 border-t border-muted-foreground/30"></div> <!> <div class="absolute inset-0 right-7 flex items-end gap-[2px]"></div></div>');function Pt(Y,x){K(x,!0);let j=rt(x,"trend",19,()=>[]);const S=d(()=>x.timezone??ut()),q=24,C=10,z=d(()=>()=>{const a=dt(t(S)),o=[],i=new nt;for(const e of j()){const s=new Date(e.timestamp),r=`${s.getFullYear()}-${s.getMonth()}-${s.getDate()}-${s.getHours()}`;i.set(r,(i.get(r)||0)+e.count)}for(let e=q-1;e>=0;e--){const r=a.minus({hours:e}).startOf("hour").toJSDate(),c=`${r.getFullYear()}-${r.getMonth()}-${r.getDate()}-${r.getHours()}`;o.push({hour:r,count:i.get(c)||0})}return o}),n=d(()=>()=>Math.max(...t(z)().map(a=>a.count),0)),_=d(()=>()=>Math.max(C,t(n)())),E=d(()=>()=>t(n)()===0?0:t(n)()/t(_)()*100);var $=ft(),F=v(g($),2);{var J=a=>{var o=lt(),i=h(o),e=v(i,2),s=g(e,!0);f(e),D((r,c,b)=>{T(i,`bottom: ${r??""}%; background: repeating-linear-gradient(to right, var(--muted-foreground) 0, var(--muted-foreground) 4px, transparent 4px, transparent 7px); opacity: 0.4;`),T(e,`bottom: calc(${c??""}% - 6px);`),w(s,b)},[()=>t(E)(),()=>t(E)(),()=>t(n)()>999?(t(n)()/1e3).toFixed(1)+"k":t(n)()]),l(a,o)};W(F,a=>{t(n)()>0&&a(J)})}var H=v(F,2);Z(H,21,()=>t(z)(),tt,(a,o)=>{const i=d(()=>t(_)()>0?t(o).count/t(_)()*100:0),e=d(()=>t(o).count>0),s=d(()=>t(e)&&t(o).count===t(n)());var r=Q(),c=h(r);P(c,()=>ot,(b,L)=>{L(b,{children:(N,pt)=>{var A=vt(),I=h(A);P(I,()=>at,(k,M)=>{M(k,{class:"flex h-full flex-1 items-end justify-center",children:(y,U)=>{var u=ct();D(m=>{et(u,1,`w-full max-w-[5px] rounded-[2px] ${t(e)?t(s)?"bg-pink-500 hover:opacity-80 dark:bg-pink-400":"bg-(--trend-bar) hover:opacity-80":"bg-foreground/10"}`),T(u,`height: ${m??""}%;`)},[()=>Math.max(t(e)?8:3,t(i))]),l(y,u)},$$slots:{default:!0}})});var R=v(I,2);P(R,()=>st,(k,M)=>{M(k,{side:"top",class:"!animate-none px-3 py-2 !transition-none",children:(y,U)=>{var u=mt(),m=h(u),X=g(m);f(m);var O=v(m,2),B=g(O,!0);f(O),D(G=>{w(X,`${t(o).count??""}
						${t(o).count===1?"Event":"Events"}`),w(B,G)},[()=>it(t(o).hour,{timezone:t(S),format:"full"})]),l(y,u)},$$slots:{default:!0}})}),l(N,A)},$$slots:{default:!0}})}),l(a,r)}),f(H),f($),l(Y,$),V()}export{Pt as I};