manifest
Version:
Self-hosted Manifest LLM router with embedded server, SQLite database, and dashboard
2 lines (1 loc) • 4.2 kB
JavaScript
import{e as M,f as $,C as b,o as A}from"./vendor-C-Y5oNOq.js";function w(e){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()}function C(e){return`hsl(${w(e)})`}function T(e,t){return`hsl(${w(e)} / ${t})`}function N(e,t){return(n=>{if(!isFinite(n.bbox.top)||!isFinite(n.bbox.height)||n.bbox.height===0)return e;const r=n.ctx.createLinearGradient(0,n.bbox.top,0,n.bbox.top+n.bbox.height);return r.addColorStop(0,e),r.addColorStop(1,t),r})}function L(e,t){return N(T(e,t),"transparent")}function E(e){let t=null,n=null;const r=260;function o(){if(t)return;const s=e.buildChart();s&&(t=s,t.setCursor({left:-1,top:-1}))}M(()=>{e.data()?.length&&(n=new ResizeObserver(()=>{t?t.setSize({width:e.el().clientWidth,height:r}):o()}),n.observe(e.el()),setTimeout(o,50))}),$(b(e.data,()=>{t&&(t.destroy(),t=null),e.data()?.length&&setTimeout(o,0)},{defer:!0})),A(()=>{n?.disconnect(),t?.destroy(),t=null})}function I(e,t){return{show:!0,x:!0,y:!1,drag:{x:!1,y:!1},points:{show:!0,size:8,fill:t,stroke:e,width:2},move:(n,r,o)=>{const s=n.posToIdx(r);return[s!=null&&n.data[0]?.[s]!=null?Math.round(n.valToPos(n.data[0][s],"x")):r,o]}}}const y=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Y(e){const t=m.has(e??"");return(n,r)=>{if(r==null||isNaN(r))return"";const o=new Date(r*1e3),s=y[o.getMonth()],i=o.getDate();if(t)return`${s} ${i}`;const f=String(o.getHours()).padStart(2,"0"),a=String(o.getMinutes()).padStart(2,"0");return`${s} ${i}, ${f}:${a}`}}function z(e,t){return t==null||isNaN(t)?"":t>0&&t<.01?"< $0.01":`$${t.toFixed(2)}`}function O(e,t){if(t==null||isNaN(t))return"";if(t=Math.round(t),t>=1e6){const n=t/1e6;return`${n%1===0?n.toFixed(0):n.toFixed(1)}M`}if(t>=1e3){const n=t/1e3;return`${n%1===0?n.toFixed(0):n.toFixed(1)}k`}return t.toString()}const k={"1h":3600,"24h":86400,"7d":604800,"30d":2592e3},m=new Set(["7d","30d"]),x=new Set(["1h","24h"]),F={"7d":7,"30d":30},R={"24h":24};function _(e){return k[e]??86400}function P(e,t,n,r){const o=R[t];if(o){const a=new Date;a.setMinutes(0,0,0);const c=new Map;for(let d=o;d>=0;d--){const u=new Date(a.getTime()-d*36e5),l=u.getFullYear(),h=String(u.getMonth()+1).padStart(2,"0"),g=String(u.getDate()).padStart(2,"0"),D=String(u.getHours()).padStart(2,"0"),p=`${l}-${h}-${g}T${D}:00:00`;c.set(p,r(p))}for(const d of e){const u=String(d[n]??"");c.has(u)&&c.set(u,d)}return Array.from(c.values())}const s=F[t];if(!s)return e;const i=new Date;i.setHours(0,0,0,0);const f=new Map;for(let a=s;a>=0;a--){const c=new Date(i);c.setDate(i.getDate()-a);const d=c.getFullYear(),u=String(c.getMonth()+1).padStart(2,"0"),l=String(c.getDate()).padStart(2,"0"),h=`${d}-${u}-${l}`;f.set(h,r(h))}for(const a of e){const c=String(a[n]??"");f.has(c)&&f.set(c,a)}return Array.from(f.values())}function H(e,t){const n=new Date(e*1e3);if(x.has(t)){const s=String(n.getHours()).padStart(2,"0"),i=String(n.getMinutes()).padStart(2,"0");return`${s}:${i}`}const r=y[n.getMonth()],o=n.getDate();return`${r} ${o}`}function J(e){return m.has(e??"")}function V(e,t,n){const r=m.has(n??""),o=n??"";return[{stroke:e,grid:{stroke:t,width:1},ticks:{stroke:t,width:1},font:'11px "DM Sans", sans-serif',gap:8,...r?{splits:i=>Array.from(i.data[0])}:{},values:(i,f)=>{let a=o;a||(a=(i.scales.x?.max??f[f.length-1]??0)-(i.scales.x?.min??f[0]??0)>86400?"7d":"24h");const c=f.map(u=>H(u,a)),d=c.map((u,l)=>l>0&&u===c[l-1]?"":u);if(r){const u=d.filter(h=>h!==""),l=u.length>20?5:u.length>14?3:1;if(l>1){let h=0;return d.map(g=>g===""?"":h++%l===0?g:"")}}return d}},{stroke:e,grid:{stroke:t,width:1},ticks:{show:!1},font:'11px "DM Sans", sans-serif',size:54,gap:8}]}function U(e){return e.map(t=>{if(t.hour){const i=t.hour.replace(" ","T");return new Date(i).getTime()/1e3}const n=t.date??"",[r,o,s]=n.split("-").map(Number);return new Date(r,o-1,s).getTime()/1e3})}const S=6*3600;function j(e){const t=m.has(e??""),n=x.has(e??""),r=e?_(e):0;return(o,s,i)=>{const f=Date.now()/1e3;if(t)return[s,i];if(n)return[f-r,f];const a=Math.min(i,f);return a-s<S?[a-S,a]:[s,a]}}function q(e){return e.map(t=>Number.isFinite(t)?t:null)}export{T as a,z as b,V as c,Y as d,j as e,P as f,C as g,I as h,J as i,O as j,L as m,U as p,q as s,E as u};