llmtap 0.1.4 → 0.1.6
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.
- package/dist/dashboard/assets/Costs-DcNWZXjX.js +1 -0
- package/dist/dashboard/assets/Dashboard-Dkx38fyX.js +9 -0
- package/dist/dashboard/assets/DataTable-CBsuKoTx.js +1 -0
- package/dist/dashboard/assets/Models-CESHenJX.js +1 -0
- package/dist/dashboard/assets/Sessions-BcRE0OFh.js +3 -0
- package/dist/dashboard/assets/Settings-BUDP0ZDT.js +12 -0
- package/dist/dashboard/assets/StatusDot-BAf4TSfE.js +1 -0
- package/dist/dashboard/assets/TraceDetail-ByibqI-g.js +17 -0
- package/dist/dashboard/assets/Traces-D9kJG7O9.js +1 -0
- package/dist/dashboard/assets/charts-BXAtT8sy.js +89 -0
- package/dist/dashboard/assets/constants-OlSc-7iA.js +1 -0
- package/dist/dashboard/assets/content-BRoZVvRJ.js +2 -0
- package/dist/dashboard/assets/format-CgXokIEM.js +1 -0
- package/dist/dashboard/assets/icons-DhpK1vUv.js +1 -0
- package/dist/dashboard/assets/index-C7GMIuGj.css +1 -0
- package/dist/dashboard/assets/index-jVcSWGwX.js +58 -0
- package/dist/dashboard/assets/motion-Bw6xJyTE.js +9 -0
- package/dist/dashboard/assets/number-ticker-C1hiu1bi.js +1 -0
- package/dist/dashboard/assets/query-BSZkMKN4.js +4 -0
- package/dist/dashboard/assets/select-CbYE6Q0M.js +1 -0
- package/dist/dashboard/index.html +6 -2
- package/dist/index.js +0 -0
- package/package.json +24 -13
- package/dist/dashboard/assets/BarChart-C6HDCruv.js +0 -1
- package/dist/dashboard/assets/Costs-CbzbCKu_.js +0 -4
- package/dist/dashboard/assets/Dashboard-CnMusiwU.js +0 -9
- package/dist/dashboard/assets/Models-C1x1xboT.js +0 -1
- package/dist/dashboard/assets/Sessions-Bh-4XfWy.js +0 -3
- package/dist/dashboard/assets/Settings-DzwivrGY.js +0 -6
- package/dist/dashboard/assets/StatusDot-CjYDb6xj.js +0 -1
- package/dist/dashboard/assets/TraceDetail-C0tQsZ-6.js +0 -17
- package/dist/dashboard/assets/Traces-D6m-Ef3q.js +0 -1
- package/dist/dashboard/assets/chart-styles-BD7W97c9.js +0 -61
- package/dist/dashboard/assets/clock-BEYeaSdD.js +0 -1
- package/dist/dashboard/assets/coins-BmXTNwva.js +0 -1
- package/dist/dashboard/assets/constants-BzCnW506.js +0 -1
- package/dist/dashboard/assets/content-DqloWqre.js +0 -2
- package/dist/dashboard/assets/download-B-39NUBC.js +0 -1
- package/dist/dashboard/assets/format-CNuIwzac.js +0 -1
- package/dist/dashboard/assets/gauge-CfqhcKwk.js +0 -1
- package/dist/dashboard/assets/index-BuSUiwyD.css +0 -1
- package/dist/dashboard/assets/index-M3DwcRrc.js +0 -66
- package/dist/dashboard/assets/layers-BQ0MpYqk.js +0 -1
- package/dist/dashboard/assets/orbit-eg7lcPsM.js +0 -1
- package/dist/dashboard/assets/zap-DjNN7wJp.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as n,j as r,R as ee}from"./query-BSZkMKN4.js";import{S as gt,c as K,w as Me,q as O,G as Se,H as Re,I as St,J as Ne,K as Y,M as A,N as je,V as wt,Q as Ct,s as R,U as yt,X as bt,Y as It,Z as Nt,_ as Tt,$ as Rt,a0 as Pt,a1 as _t}from"./index-jVcSWGwX.js";import{c as Et,a as Ae,h as Mt}from"./charts-BXAtT8sy.js";import{n as Oe,z as jt,m as At}from"./icons-DhpK1vUv.js";const Pe=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,_e=Et,Ot=(t,o)=>e=>{var l;if(o?.variants==null)return _e(t,e?.class,e?.className);const{variants:a,defaultVariants:u}=o,s=Object.keys(a).map(p=>{const v=e?.[p],g=u?.[p];if(v===null)return null;const w=Pe(v)||Pe(g);return a[p][w]}),c=e&&Object.entries(e).reduce((p,v)=>{let[g,w]=v;return w===void 0||(p[g]=w),p},{}),i=o==null||(l=o.compoundVariants)===null||l===void 0?void 0:l.reduce((p,v)=>{let{class:g,className:w,...y}=v;return Object.entries(y).every(C=>{let[d,m]=C;return Array.isArray(m)?m.includes({...u,...c}[d]):{...u,...c}[d]===m})?[...p,g,w]:p},[]);return _e(t,s,i,e?.class,e?.className)},Dt=Ot("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-2xl text-sm font-medium transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-400/50 focus-visible:ring-offset-2 focus-visible:ring-offset-slate-950 disabled:pointer-events-none disabled:opacity-50 cursor-pointer [&_svg]:pointer-events-none [&_svg]:h-4 [&_svg]:w-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-emerald-500 text-slate-950 shadow-[0_0_20px_rgba(16,185,129,0.3)] hover:bg-emerald-400",destructive:"bg-rose-500/20 text-rose-300 border border-rose-400/20 hover:bg-rose-500/30",outline:"border border-white/10 bg-white/4 text-slate-200 hover:bg-white/8 hover:border-white/15",secondary:"bg-white/6 text-slate-200 border border-white/8 hover:bg-white/10",ghost:"text-slate-400 hover:bg-white/6 hover:text-slate-200",link:"text-emerald-400 underline-offset-4 hover:underline"},size:{default:"h-10 px-5 py-2",sm:"h-8 rounded-xl px-3.5 text-xs",lg:"h-12 rounded-2xl px-8 text-base",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Lt=n.forwardRef(({className:t,variant:o,size:e,asChild:l=!1,...a},u)=>{const s=l?gt:"button";return r.jsx(s,{className:K(Dt({variant:o,size:e,className:t})),ref:u,...a})});Lt.displayName="Button";function Ee(t,[o,e]){return Math.min(e,Math.max(o,t))}function Vt(t){const o=t+"CollectionProvider",[e,l]=Me(o),[a,u]=e(o,{collectionRef:{current:null},itemMap:new Map}),s=d=>{const{scope:m,children:S}=d,f=ee.useRef(null),x=ee.useRef(new Map).current;return r.jsx(a,{scope:m,itemMap:x,collectionRef:f,children:S})};s.displayName=o;const c=t+"CollectionSlot",i=Se(c),p=ee.forwardRef((d,m)=>{const{scope:S,children:f}=d,x=u(c,S),P=O(m,x.collectionRef);return r.jsx(i,{ref:P,children:f})});p.displayName=c;const v=t+"CollectionItemSlot",g="data-radix-collection-item",w=Se(v),y=ee.forwardRef((d,m)=>{const{scope:S,children:f,...x}=d,P=ee.useRef(null),E=O(m,P),L=u(v,S);return ee.useEffect(()=>(L.itemMap.set(P,{ref:P,...x}),()=>{L.itemMap.delete(P)})),r.jsx(w,{[g]:"",ref:E,children:f})});y.displayName=v;function C(d){const m=u(t+"CollectionConsumer",d);return ee.useCallback(()=>{const f=m.collectionRef.current;if(!f)return[];const x=Array.from(f.querySelectorAll(`[${g}]`));return Array.from(m.itemMap.values()).sort((L,_)=>x.indexOf(L.ref.current)-x.indexOf(_.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:s,Slot:p,ItemSlot:y},C,l]}var kt=n.createContext(void 0);function Bt(t){const o=n.useContext(kt);return t||o||"ltr"}function Ht(t){const o=n.useRef({value:t,previous:t});return n.useMemo(()=>(o.current.value!==t&&(o.current.previous=o.current.value,o.current.value=t),o.current.previous),[t])}var Ut=[" ","Enter","ArrowUp","ArrowDown"],Ft=[" ","Enter"],te="Select",[de,ue,Wt]=Vt(te),[re]=Me(te,[Wt,je]),pe=je(),[Kt,q]=re(te),[$t,zt]=re(te),De=t=>{const{__scopeSelect:o,children:e,open:l,defaultOpen:a,onOpenChange:u,value:s,defaultValue:c,onValueChange:i,dir:p,name:v,autoComplete:g,disabled:w,required:y,form:C}=t,d=pe(o),[m,S]=n.useState(null),[f,x]=n.useState(null),[P,E]=n.useState(!1),L=Bt(p),[_,V]=Re({prop:l,defaultProp:a??!1,onChange:u,caller:te}),[$,Z]=Re({prop:s,defaultProp:c,onChange:i,caller:te}),B=n.useRef(null),H=m?C||!!m.closest("form"):!0,[z,U]=n.useState(new Set),F=Array.from(z).map(M=>M.props.value).join(";");return r.jsx(St,{...d,children:r.jsxs(Kt,{required:y,scope:o,trigger:m,onTriggerChange:S,valueNode:f,onValueNodeChange:x,valueNodeHasChildren:P,onValueNodeHasChildrenChange:E,contentId:Ne(),value:$,onValueChange:Z,open:_,onOpenChange:V,dir:L,triggerPointerDownPosRef:B,disabled:w,children:[r.jsx(de.Provider,{scope:o,children:r.jsx($t,{scope:t.__scopeSelect,onNativeOptionAdd:n.useCallback(M=>{U(k=>new Set(k).add(M))},[]),onNativeOptionRemove:n.useCallback(M=>{U(k=>{const W=new Set(k);return W.delete(M),W})},[]),children:e})}),H?r.jsxs(st,{"aria-hidden":!0,required:y,tabIndex:-1,name:v,autoComplete:g,value:$,onChange:M=>Z(M.target.value),disabled:w,form:C,children:[$===void 0?r.jsx("option",{value:""}):null,Array.from(z)]},F):null]})})};De.displayName=te;var Le="SelectTrigger",Ve=n.forwardRef((t,o)=>{const{__scopeSelect:e,disabled:l=!1,...a}=t,u=pe(e),s=q(Le,e),c=s.disabled||l,i=O(o,s.onTriggerChange),p=ue(e),v=n.useRef("touch"),[g,w,y]=at(d=>{const m=p().filter(x=>!x.disabled),S=m.find(x=>x.value===s.value),f=ct(m,d,S);f!==void 0&&s.onValueChange(f.value)}),C=d=>{c||(s.onOpenChange(!0),y()),d&&(s.triggerPointerDownPosRef.current={x:Math.round(d.pageX),y:Math.round(d.pageY)})};return r.jsx(Ct,{asChild:!0,...u,children:r.jsx(A.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":lt(s.value)?"":void 0,...a,ref:i,onClick:R(a.onClick,d=>{d.currentTarget.focus(),v.current!=="mouse"&&C(d)}),onPointerDown:R(a.onPointerDown,d=>{v.current=d.pointerType;const m=d.target;m.hasPointerCapture(d.pointerId)&&m.releasePointerCapture(d.pointerId),d.button===0&&d.ctrlKey===!1&&d.pointerType==="mouse"&&(C(d),d.preventDefault())}),onKeyDown:R(a.onKeyDown,d=>{const m=g.current!=="";!(d.ctrlKey||d.altKey||d.metaKey)&&d.key.length===1&&w(d.key),!(m&&d.key===" ")&&Ut.includes(d.key)&&(C(),d.preventDefault())})})})});Ve.displayName=Le;var ke="SelectValue",Be=n.forwardRef((t,o)=>{const{__scopeSelect:e,className:l,style:a,children:u,placeholder:s="",...c}=t,i=q(ke,e),{onValueNodeHasChildrenChange:p}=i,v=u!==void 0,g=O(o,i.onValueNodeChange);return Y(()=>{p(v)},[p,v]),r.jsx(A.span,{...c,ref:g,style:{pointerEvents:"none"},children:lt(i.value)?r.jsx(r.Fragment,{children:s}):u})});Be.displayName=ke;var Gt="SelectIcon",He=n.forwardRef((t,o)=>{const{__scopeSelect:e,children:l,...a}=t;return r.jsx(A.span,{"aria-hidden":!0,...a,ref:o,children:l||"▼"})});He.displayName=Gt;var Yt="SelectPortal",Ue=t=>r.jsx(yt,{asChild:!0,...t});Ue.displayName=Yt;var oe="SelectContent",Fe=n.forwardRef((t,o)=>{const e=q(oe,t.__scopeSelect),[l,a]=n.useState();if(Y(()=>{a(new DocumentFragment)},[]),!e.open){const u=l;return u?Ae.createPortal(r.jsx(We,{scope:t.__scopeSelect,children:r.jsx(de.Slot,{scope:t.__scopeSelect,children:r.jsx("div",{children:t.children})})}),u):null}return r.jsx(Ke,{...t,ref:o})});Fe.displayName=oe;var D=10,[We,X]=re(oe),qt="SelectContentImpl",Xt=Se("SelectContent.RemoveScroll"),Ke=n.forwardRef((t,o)=>{const{__scopeSelect:e,position:l="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:u,onPointerDownOutside:s,side:c,sideOffset:i,align:p,alignOffset:v,arrowPadding:g,collisionBoundary:w,collisionPadding:y,sticky:C,hideWhenDetached:d,avoidCollisions:m,...S}=t,f=q(oe,e),[x,P]=n.useState(null),[E,L]=n.useState(null),_=O(o,h=>P(h)),[V,$]=n.useState(null),[Z,B]=n.useState(null),H=ue(e),[z,U]=n.useState(!1),F=n.useRef(!1);n.useEffect(()=>{if(x)return Mt(x)},[x]),It();const M=n.useCallback(h=>{const[N,...j]=H().map(T=>T.ref.current),[b]=j.slice(-1),I=document.activeElement;for(const T of h)if(T===I||(T?.scrollIntoView({block:"nearest"}),T===N&&E&&(E.scrollTop=0),T===b&&E&&(E.scrollTop=E.scrollHeight),T?.focus(),document.activeElement!==I))return},[H,E]),k=n.useCallback(()=>M([V,x]),[M,V,x]);n.useEffect(()=>{z&&k()},[z,k]);const{onOpenChange:W,triggerPointerDownPosRef:G}=f;n.useEffect(()=>{if(x){let h={x:0,y:0};const N=b=>{h={x:Math.abs(Math.round(b.pageX)-(G.current?.x??0)),y:Math.abs(Math.round(b.pageY)-(G.current?.y??0))}},j=b=>{h.x<=10&&h.y<=10?b.preventDefault():x.contains(b.target)||W(!1),document.removeEventListener("pointermove",N),G.current=null};return G.current!==null&&(document.addEventListener("pointermove",N),document.addEventListener("pointerup",j,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",N),document.removeEventListener("pointerup",j,{capture:!0})}}},[x,W,G]),n.useEffect(()=>{const h=()=>W(!1);return window.addEventListener("blur",h),window.addEventListener("resize",h),()=>{window.removeEventListener("blur",h),window.removeEventListener("resize",h)}},[W]);const[fe,ae]=at(h=>{const N=H().filter(I=>!I.disabled),j=N.find(I=>I.ref.current===document.activeElement),b=ct(N,h,j);b&&setTimeout(()=>b.ref.current.focus())}),me=n.useCallback((h,N,j)=>{const b=!F.current&&!j;(f.value!==void 0&&f.value===N||b)&&($(h),b&&(F.current=!0))},[f.value]),he=n.useCallback(()=>x?.focus(),[x]),ne=n.useCallback((h,N,j)=>{const b=!F.current&&!j;(f.value!==void 0&&f.value===N||b)&&B(h)},[f.value]),ce=l==="popper"?we:$e,se=ce===we?{side:c,sideOffset:i,align:p,alignOffset:v,arrowPadding:g,collisionBoundary:w,collisionPadding:y,sticky:C,hideWhenDetached:d,avoidCollisions:m}:{};return r.jsx(We,{scope:e,content:x,viewport:E,onViewportChange:L,itemRefCallback:me,selectedItem:V,onItemLeave:he,itemTextRefCallback:ne,focusSelectedItem:k,selectedItemText:Z,position:l,isPositioned:z,searchRef:fe,children:r.jsx(Nt,{as:Xt,allowPinchZoom:!0,children:r.jsx(Tt,{asChild:!0,trapped:f.open,onMountAutoFocus:h=>{h.preventDefault()},onUnmountAutoFocus:R(a,h=>{f.trigger?.focus({preventScroll:!0}),h.preventDefault()}),children:r.jsx(Rt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:u,onPointerDownOutside:s,onFocusOutside:h=>h.preventDefault(),onDismiss:()=>f.onOpenChange(!1),children:r.jsx(ce,{role:"listbox",id:f.contentId,"data-state":f.open?"open":"closed",dir:f.dir,onContextMenu:h=>h.preventDefault(),...S,...se,onPlaced:()=>U(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...S.style},onKeyDown:R(S.onKeyDown,h=>{const N=h.ctrlKey||h.altKey||h.metaKey;if(h.key==="Tab"&&h.preventDefault(),!N&&h.key.length===1&&ae(h.key),["ArrowUp","ArrowDown","Home","End"].includes(h.key)){let b=H().filter(I=>!I.disabled).map(I=>I.ref.current);if(["ArrowUp","End"].includes(h.key)&&(b=b.slice().reverse()),["ArrowUp","ArrowDown"].includes(h.key)){const I=h.target,T=b.indexOf(I);b=b.slice(T+1)}setTimeout(()=>M(b)),h.preventDefault()}})})})})})})});Ke.displayName=qt;var Zt="SelectItemAlignedPosition",$e=n.forwardRef((t,o)=>{const{__scopeSelect:e,onPlaced:l,...a}=t,u=q(oe,e),s=X(oe,e),[c,i]=n.useState(null),[p,v]=n.useState(null),g=O(o,_=>v(_)),w=ue(e),y=n.useRef(!1),C=n.useRef(!0),{viewport:d,selectedItem:m,selectedItemText:S,focusSelectedItem:f}=s,x=n.useCallback(()=>{if(u.trigger&&u.valueNode&&c&&p&&d&&m&&S){const _=u.trigger.getBoundingClientRect(),V=p.getBoundingClientRect(),$=u.valueNode.getBoundingClientRect(),Z=S.getBoundingClientRect();if(u.dir!=="rtl"){const I=Z.left-V.left,T=$.left-I,J=_.left-T,Q=_.width+J,ve=Math.max(Q,V.width),xe=window.innerWidth-D,ge=Ee(T,[D,Math.max(D,xe-ve)]);c.style.minWidth=Q+"px",c.style.left=ge+"px"}else{const I=V.right-Z.right,T=window.innerWidth-$.right-I,J=window.innerWidth-_.right-T,Q=_.width+J,ve=Math.max(Q,V.width),xe=window.innerWidth-D,ge=Ee(T,[D,Math.max(D,xe-ve)]);c.style.minWidth=Q+"px",c.style.right=ge+"px"}const B=w(),H=window.innerHeight-D*2,z=d.scrollHeight,U=window.getComputedStyle(p),F=parseInt(U.borderTopWidth,10),M=parseInt(U.paddingTop,10),k=parseInt(U.borderBottomWidth,10),W=parseInt(U.paddingBottom,10),G=F+M+z+W+k,fe=Math.min(m.offsetHeight*5,G),ae=window.getComputedStyle(d),me=parseInt(ae.paddingTop,10),he=parseInt(ae.paddingBottom,10),ne=_.top+_.height/2-D,ce=H-ne,se=m.offsetHeight/2,h=m.offsetTop+se,N=F+M+h,j=G-N;if(N<=ne){const I=B.length>0&&m===B[B.length-1].ref.current;c.style.bottom="0px";const T=p.clientHeight-d.offsetTop-d.offsetHeight,J=Math.max(ce,se+(I?he:0)+T+k),Q=N+J;c.style.height=Q+"px"}else{const I=B.length>0&&m===B[0].ref.current;c.style.top="0px";const J=Math.max(ne,F+d.offsetTop+(I?me:0)+se)+j;c.style.height=J+"px",d.scrollTop=N-ne+d.offsetTop}c.style.margin=`${D}px 0`,c.style.minHeight=fe+"px",c.style.maxHeight=H+"px",l?.(),requestAnimationFrame(()=>y.current=!0)}},[w,u.trigger,u.valueNode,c,p,d,m,S,u.dir,l]);Y(()=>x(),[x]);const[P,E]=n.useState();Y(()=>{p&&E(window.getComputedStyle(p).zIndex)},[p]);const L=n.useCallback(_=>{_&&C.current===!0&&(x(),f?.(),C.current=!1)},[x,f]);return r.jsx(Qt,{scope:e,contentWrapper:c,shouldExpandOnScrollRef:y,onScrollButtonChange:L,children:r.jsx("div",{ref:i,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:P},children:r.jsx(A.div,{...a,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});$e.displayName=Zt;var Jt="SelectPopperPosition",we=n.forwardRef((t,o)=>{const{__scopeSelect:e,align:l="start",collisionPadding:a=D,...u}=t,s=pe(e);return r.jsx(Pt,{...s,...u,ref:o,align:l,collisionPadding:a,style:{boxSizing:"border-box",...u.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});we.displayName=Jt;var[Qt,Te]=re(oe,{}),Ce="SelectViewport",ze=n.forwardRef((t,o)=>{const{__scopeSelect:e,nonce:l,...a}=t,u=X(Ce,e),s=Te(Ce,e),c=O(o,u.onViewportChange),i=n.useRef(0);return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:l}),r.jsx(de.Slot,{scope:e,children:r.jsx(A.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:R(a.onScroll,p=>{const v=p.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:w}=s;if(w?.current&&g){const y=Math.abs(i.current-v.scrollTop);if(y>0){const C=window.innerHeight-D*2,d=parseFloat(g.style.minHeight),m=parseFloat(g.style.height),S=Math.max(d,m);if(S<C){const f=S+y,x=Math.min(C,f),P=f-x;g.style.height=x+"px",g.style.bottom==="0px"&&(v.scrollTop=P>0?P:0,g.style.justifyContent="flex-end")}}}i.current=v.scrollTop})})})]})});ze.displayName=Ce;var Ge="SelectGroup",[eo,to]=re(Ge),oo=n.forwardRef((t,o)=>{const{__scopeSelect:e,...l}=t,a=Ne();return r.jsx(eo,{scope:e,id:a,children:r.jsx(A.div,{role:"group","aria-labelledby":a,...l,ref:o})})});oo.displayName=Ge;var Ye="SelectLabel",qe=n.forwardRef((t,o)=>{const{__scopeSelect:e,...l}=t,a=to(Ye,e);return r.jsx(A.div,{id:a.id,...l,ref:o})});qe.displayName=Ye;var ie="SelectItem",[no,Xe]=re(ie),Ze=n.forwardRef((t,o)=>{const{__scopeSelect:e,value:l,disabled:a=!1,textValue:u,...s}=t,c=q(ie,e),i=X(ie,e),p=c.value===l,[v,g]=n.useState(u??""),[w,y]=n.useState(!1),C=O(o,f=>i.itemRefCallback?.(f,l,a)),d=Ne(),m=n.useRef("touch"),S=()=>{a||(c.onValueChange(l),c.onOpenChange(!1))};if(l==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return r.jsx(no,{scope:e,value:l,disabled:a,textId:d,isSelected:p,onItemTextChange:n.useCallback(f=>{g(x=>x||(f?.textContent??"").trim())},[]),children:r.jsx(de.ItemSlot,{scope:e,value:l,disabled:a,textValue:v,children:r.jsx(A.div,{role:"option","aria-labelledby":d,"data-highlighted":w?"":void 0,"aria-selected":p&&w,"data-state":p?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...s,ref:C,onFocus:R(s.onFocus,()=>y(!0)),onBlur:R(s.onBlur,()=>y(!1)),onClick:R(s.onClick,()=>{m.current!=="mouse"&&S()}),onPointerUp:R(s.onPointerUp,()=>{m.current==="mouse"&&S()}),onPointerDown:R(s.onPointerDown,f=>{m.current=f.pointerType}),onPointerMove:R(s.onPointerMove,f=>{m.current=f.pointerType,a?i.onItemLeave?.():m.current==="mouse"&&f.currentTarget.focus({preventScroll:!0})}),onPointerLeave:R(s.onPointerLeave,f=>{f.currentTarget===document.activeElement&&i.onItemLeave?.()}),onKeyDown:R(s.onKeyDown,f=>{i.searchRef?.current!==""&&f.key===" "||(Ft.includes(f.key)&&S(),f.key===" "&&f.preventDefault())})})})})});Ze.displayName=ie;var le="SelectItemText",Je=n.forwardRef((t,o)=>{const{__scopeSelect:e,className:l,style:a,...u}=t,s=q(le,e),c=X(le,e),i=Xe(le,e),p=zt(le,e),[v,g]=n.useState(null),w=O(o,S=>g(S),i.onItemTextChange,S=>c.itemTextRefCallback?.(S,i.value,i.disabled)),y=v?.textContent,C=n.useMemo(()=>r.jsx("option",{value:i.value,disabled:i.disabled,children:y},i.value),[i.disabled,i.value,y]),{onNativeOptionAdd:d,onNativeOptionRemove:m}=p;return Y(()=>(d(C),()=>m(C)),[d,m,C]),r.jsxs(r.Fragment,{children:[r.jsx(A.span,{id:i.textId,...u,ref:w}),i.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Ae.createPortal(u.children,s.valueNode):null]})});Je.displayName=le;var Qe="SelectItemIndicator",et=n.forwardRef((t,o)=>{const{__scopeSelect:e,...l}=t;return Xe(Qe,e).isSelected?r.jsx(A.span,{"aria-hidden":!0,...l,ref:o}):null});et.displayName=Qe;var ye="SelectScrollUpButton",tt=n.forwardRef((t,o)=>{const e=X(ye,t.__scopeSelect),l=Te(ye,t.__scopeSelect),[a,u]=n.useState(!1),s=O(o,l.onScrollButtonChange);return Y(()=>{if(e.viewport&&e.isPositioned){let c=function(){const p=i.scrollTop>0;u(p)};const i=e.viewport;return c(),i.addEventListener("scroll",c),()=>i.removeEventListener("scroll",c)}},[e.viewport,e.isPositioned]),a?r.jsx(nt,{...t,ref:s,onAutoScroll:()=>{const{viewport:c,selectedItem:i}=e;c&&i&&(c.scrollTop=c.scrollTop-i.offsetHeight)}}):null});tt.displayName=ye;var be="SelectScrollDownButton",ot=n.forwardRef((t,o)=>{const e=X(be,t.__scopeSelect),l=Te(be,t.__scopeSelect),[a,u]=n.useState(!1),s=O(o,l.onScrollButtonChange);return Y(()=>{if(e.viewport&&e.isPositioned){let c=function(){const p=i.scrollHeight-i.clientHeight,v=Math.ceil(i.scrollTop)<p;u(v)};const i=e.viewport;return c(),i.addEventListener("scroll",c),()=>i.removeEventListener("scroll",c)}},[e.viewport,e.isPositioned]),a?r.jsx(nt,{...t,ref:s,onAutoScroll:()=>{const{viewport:c,selectedItem:i}=e;c&&i&&(c.scrollTop=c.scrollTop+i.offsetHeight)}}):null});ot.displayName=be;var nt=n.forwardRef((t,o)=>{const{__scopeSelect:e,onAutoScroll:l,...a}=t,u=X("SelectScrollButton",e),s=n.useRef(null),c=ue(e),i=n.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return n.useEffect(()=>()=>i(),[i]),Y(()=>{c().find(v=>v.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[c]),r.jsx(A.div,{"aria-hidden":!0,...a,ref:o,style:{flexShrink:0,...a.style},onPointerDown:R(a.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(l,50))}),onPointerMove:R(a.onPointerMove,()=>{u.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(l,50))}),onPointerLeave:R(a.onPointerLeave,()=>{i()})})}),ro="SelectSeparator",rt=n.forwardRef((t,o)=>{const{__scopeSelect:e,...l}=t;return r.jsx(A.div,{"aria-hidden":!0,...l,ref:o})});rt.displayName=ro;var Ie="SelectArrow",so=n.forwardRef((t,o)=>{const{__scopeSelect:e,...l}=t,a=pe(e),u=q(Ie,e),s=X(Ie,e);return u.open&&s.position==="popper"?r.jsx(_t,{...a,...l,ref:o}):null});so.displayName=Ie;var lo="SelectBubbleInput",st=n.forwardRef(({__scopeSelect:t,value:o,...e},l)=>{const a=n.useRef(null),u=O(l,a),s=Ht(o);return n.useEffect(()=>{const c=a.current;if(!c)return;const i=window.HTMLSelectElement.prototype,v=Object.getOwnPropertyDescriptor(i,"value").set;if(s!==o&&v){const g=new Event("change",{bubbles:!0});v.call(c,o),c.dispatchEvent(g)}},[s,o]),r.jsx(A.select,{...e,style:{...wt,...e.style},ref:u,defaultValue:o})});st.displayName=lo;function lt(t){return t===""||t===void 0}function at(t){const o=bt(t),e=n.useRef(""),l=n.useRef(0),a=n.useCallback(s=>{const c=e.current+s;o(c),(function i(p){e.current=p,window.clearTimeout(l.current),p!==""&&(l.current=window.setTimeout(()=>i(""),1e3))})(c)},[o]),u=n.useCallback(()=>{e.current="",window.clearTimeout(l.current)},[]);return n.useEffect(()=>()=>window.clearTimeout(l.current),[]),[e,a,u]}function ct(t,o,e){const a=o.length>1&&Array.from(o).every(p=>p===o[0])?o[0]:o,u=e?t.indexOf(e):-1;let s=ao(t,Math.max(u,0));a.length===1&&(s=s.filter(p=>p!==e));const i=s.find(p=>p.textValue.toLowerCase().startsWith(a.toLowerCase()));return i!==e?i:void 0}function ao(t,o){return t.map((e,l)=>t[(o+l)%t.length])}var co=De,it=Ve,io=Be,uo=He,po=Ue,dt=Fe,fo=ze,ut=qe,pt=Ze,mo=Je,ho=et,ft=tt,mt=ot,ht=rt;const No=co,To=io,vo=n.forwardRef(({className:t,children:o,...e},l)=>r.jsxs(it,{ref:l,className:K("flex h-9 w-full items-center justify-between gap-2 rounded-xl border border-white/10 bg-white/4 px-3 py-2 text-sm text-slate-200 transition-colors placeholder:text-slate-500 hover:bg-white/8 focus:outline-none focus:ring-2 focus:ring-emerald-400/50 focus:ring-offset-2 focus:ring-offset-slate-950 disabled:cursor-not-allowed disabled:opacity-50 cursor-pointer [&>span]:line-clamp-1",t),...e,children:[o,r.jsx(uo,{asChild:!0,children:r.jsx(Oe,{className:"h-4 w-4 opacity-50"})})]}));vo.displayName=it.displayName;const vt=n.forwardRef(({className:t,...o},e)=>r.jsx(ft,{ref:e,className:K("flex cursor-default items-center justify-center py-1",t),...o,children:r.jsx(At,{className:"h-4 w-4"})}));vt.displayName=ft.displayName;const xt=n.forwardRef(({className:t,...o},e)=>r.jsx(mt,{ref:e,className:K("flex cursor-default items-center justify-center py-1",t),...o,children:r.jsx(Oe,{className:"h-4 w-4"})}));xt.displayName=mt.displayName;const xo=n.forwardRef(({className:t,children:o,position:e="popper",...l},a)=>r.jsx(po,{children:r.jsxs(dt,{ref:a,className:K("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-xl border border-white/10 bg-slate-900/95 shadow-[0_16px_40px_rgba(0,0,0,0.5)] backdrop-blur-xl data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:e,...l,children:[r.jsx(vt,{}),r.jsx(fo,{className:K("p-1",e==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:o}),r.jsx(xt,{})]})}));xo.displayName=dt.displayName;const go=n.forwardRef(({className:t,...o},e)=>r.jsx(ut,{ref:e,className:K("px-2 py-1.5 text-xs font-medium text-slate-500",t),...o}));go.displayName=ut.displayName;const So=n.forwardRef(({className:t,children:o,...e},l)=>r.jsxs(pt,{ref:l,className:K("relative flex w-full cursor-pointer select-none items-center rounded-lg py-1.5 pl-8 pr-2 text-sm text-slate-300 outline-none transition-colors hover:bg-white/8 hover:text-white focus:bg-white/8 focus:text-white data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...e,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(ho,{children:r.jsx(jt,{className:"h-4 w-4 text-emerald-400"})})}),r.jsx(mo,{children:o})]}));So.displayName=pt.displayName;const wo=n.forwardRef(({className:t,...o},e)=>r.jsx(ht,{ref:e,className:K("-mx-1 my-1 h-px bg-white/8",t),...o}));wo.displayName=ht.displayName;export{Lt as B,No as S,vo as a,To as b,xo as c,So as d,Ot as e,Dt as f};
|
|
@@ -4,8 +4,12 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>LLMTap — LLM Observability</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
-
<link rel="
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-jVcSWGwX.js"></script>
|
|
8
|
+
<link rel="modulepreload" crossorigin href="/assets/query-BSZkMKN4.js">
|
|
9
|
+
<link rel="modulepreload" crossorigin href="/assets/charts-BXAtT8sy.js">
|
|
10
|
+
<link rel="modulepreload" crossorigin href="/assets/icons-DhpK1vUv.js">
|
|
11
|
+
<link rel="modulepreload" crossorigin href="/assets/motion-Bw6xJyTE.js">
|
|
12
|
+
<link rel="stylesheet" crossorigin href="/assets/index-C7GMIuGj.css">
|
|
9
13
|
</head>
|
|
10
14
|
<body>
|
|
11
15
|
<div id="root"></div>
|
package/dist/index.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "llmtap",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "DevTools for AI Agents - See every LLM call, trace agent workflows, track costs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"llmtap": "./dist/index.js"
|
|
8
8
|
},
|
|
9
|
-
"files": [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"build": "tsup",
|
|
13
|
-
"postbuild": "node -e \"const fs=require('fs');const path=require('path');const src=path.resolve(__dirname,'..','dashboard','dist');const dst=path.resolve(__dirname,'dist','dashboard');if(fs.existsSync(src)){fs.cpSync(src,dst,{recursive:true});console.log('Dashboard bundled into CLI dist')}else{console.log('Dashboard dist not found at',src)}\"",
|
|
14
|
-
"clean": "rimraf dist"
|
|
15
|
-
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
16
12
|
"dependencies": {
|
|
17
|
-
"@llmtap/collector": "
|
|
18
|
-
"@llmtap/shared": "
|
|
13
|
+
"@llmtap/collector": "^0.1.3",
|
|
14
|
+
"@llmtap/shared": "^0.1.3",
|
|
19
15
|
"chalk": "^5.4.0",
|
|
20
16
|
"commander": "^13.0.0",
|
|
21
17
|
"open": "^10.1.0"
|
|
@@ -27,8 +23,17 @@
|
|
|
27
23
|
"typescript": "^5.7.0"
|
|
28
24
|
},
|
|
29
25
|
"keywords": [
|
|
30
|
-
"llm",
|
|
31
|
-
"
|
|
26
|
+
"llm",
|
|
27
|
+
"ai",
|
|
28
|
+
"agent",
|
|
29
|
+
"observability",
|
|
30
|
+
"devtools",
|
|
31
|
+
"openai",
|
|
32
|
+
"anthropic",
|
|
33
|
+
"gemini",
|
|
34
|
+
"groq",
|
|
35
|
+
"tracing",
|
|
36
|
+
"debugging"
|
|
32
37
|
],
|
|
33
38
|
"engines": {
|
|
34
39
|
"node": ">=18"
|
|
@@ -38,5 +43,11 @@
|
|
|
38
43
|
"type": "git",
|
|
39
44
|
"url": "https://github.com/DivyaanshuXD/LLMTap",
|
|
40
45
|
"directory": "packages/cli"
|
|
46
|
+
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"prebuild": "node -e \"\"",
|
|
49
|
+
"build": "tsup",
|
|
50
|
+
"postbuild": "node -e \"const fs=require('fs');const path=require('path');const src=path.resolve(__dirname,'..','dashboard','dist');const dst=path.resolve(__dirname,'dist','dashboard');if(fs.existsSync(src)){fs.cpSync(src,dst,{recursive:true});console.log('Dashboard bundled into CLI dist')}else{console.log('Dashboard dist not found at',src)}\"",
|
|
51
|
+
"clean": "rimraf dist"
|
|
41
52
|
}
|
|
42
|
-
}
|
|
53
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{l as a,N as i,X as s,Y as t,n as e}from"./chart-styles-BD7W97c9.js";var x=a({chartName:"BarChart",GraphicalChild:i,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:s},{axisType:"yAxis",AxisComp:t}],formatAxisMap:e});export{x as B};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{c as le,a as E,R as f,q as He,r as be,j as s,m as D,f as st,g as ot}from"./index-M3DwcRrc.js";import{u as lt,P as ct,b as I,a as ut,c as dt}from"./format-CNuIwzac.js";import{f as j,r as We,p as ft,q as Ze,s as pt,g as M,v as je,w as S,L as O,x as Ge,y as Ae,z as Ue,D as mt,C as ht,b as Z,j as z,S as vt,A as xt,B as yt,a as Oe,d as gt,i as q,e as bt,u as jt,G as At,E as ne,F as kt,H as Xe,I as Pt,J as re,K as Ne,l as wt,M as Ot,R as _e,o as Nt,X as _t,Y as St,T as Se,t as Te,N as Tt}from"./chart-styles-BD7W97c9.js";import{a as Re}from"./provider-colors-DcHYMgVv.js";import{C as Rt}from"./coins-BmXTNwva.js";import{Z as Et}from"./zap-DjNN7wJp.js";import{B as Lt}from"./BarChart-C6HDCruv.js";import{O as It}from"./orbit-eg7lcPsM.js";import{L as $t}from"./layers-BQ0MpYqk.js";const Ct=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],Ee=le("chart-column",Ct);const Dt=[["path",{d:"M13 16H8",key:"wsln4y"}],["path",{d:"M14 8H8",key:"1l3xfs"}],["path",{d:"M16 12H8",key:"1fr5h0"}],["path",{d:"M4 3a1 1 0 0 1 1-1 1.3 1.3 0 0 1 .7.2l.933.6a1.3 1.3 0 0 0 1.4 0l.934-.6a1.3 1.3 0 0 1 1.4 0l.933.6a1.3 1.3 0 0 0 1.4 0l.933-.6a1.3 1.3 0 0 1 1.4 0l.934.6a1.3 1.3 0 0 0 1.4 0l.933-.6A1.3 1.3 0 0 1 19 2a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1 1.3 1.3 0 0 1-.7-.2l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.934.6a1.3 1.3 0 0 1-1.4 0l-.933-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-1.4 0l-.934-.6a1.3 1.3 0 0 0-1.4 0l-.933.6a1.3 1.3 0 0 1-.7.2 1 1 0 0 1-1-1z",key:"ycz6yz"}]],Mt=le("receipt-text",Dt);const Bt=[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M12 14v-4",key:"1evpnu"}],["path",{d:"M4 13a8 8 0 0 1 8-7 8 8 0 1 1-5.3 14L4 17.6",key:"1ts96g"}],["path",{d:"M9 17H4v5",key:"8t5av"}]],Ft=le("timer-reset",Bt);const Kt=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2",key:"4125el"}],["path",{d:"M3 11h3c.8 0 1.6.3 2.1.9l1.1.9c1.6 1.6 4.1 1.6 5.7 0l1.1-.9c.5-.5 1.3-.9 2.1-.9H21",key:"1dpki6"}]],Vt=le("wallet-cards",Kt);var zt=["points","className","baseLinePoints","connectNulls"];function H(){return H=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r},H.apply(this,arguments)}function qt(r,e){if(r==null)return{};var n=Ht(r,e),t,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);for(a=0;a<o.length;a++)t=o[a],!(e.indexOf(t)>=0)&&Object.prototype.propertyIsEnumerable.call(r,t)&&(n[t]=r[t])}return n}function Ht(r,e){if(r==null)return{};var n={};for(var t in r)if(Object.prototype.hasOwnProperty.call(r,t)){if(e.indexOf(t)>=0)continue;n[t]=r[t]}return n}function Le(r){return Ut(r)||Gt(r)||Zt(r)||Wt()}function Wt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
2
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zt(r,e){if(r){if(typeof r=="string")return ve(r,e);var n=Object.prototype.toString.call(r).slice(8,-1);if(n==="Object"&&r.constructor&&(n=r.constructor.name),n==="Map"||n==="Set")return Array.from(r);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ve(r,e)}}function Gt(r){if(typeof Symbol<"u"&&r[Symbol.iterator]!=null||r["@@iterator"]!=null)return Array.from(r)}function Ut(r){if(Array.isArray(r))return ve(r)}function ve(r,e){(e==null||e>r.length)&&(e=r.length);for(var n=0,t=new Array(e);n<e;n++)t[n]=r[n];return t}var Ie=function(e){return e&&e.x===+e.x&&e.y===+e.y},Xt=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return e.forEach(function(t){Ie(t)?n[n.length-1].push(t):n[n.length-1].length>0&&n.push([])}),Ie(e[0])&&n[n.length-1].push(e[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},J=function(e,n){var t=Xt(e);n&&(t=[t.reduce(function(o,i){return[].concat(Le(o),Le(i))},[])]);var a=t.map(function(o){return o.reduce(function(i,l,d){return"".concat(i).concat(d===0?"M":"L").concat(l.x,",").concat(l.y)},"")}).join("");return t.length===1?"".concat(a,"Z"):a},Yt=function(e,n,t){var a=J(e,t);return"".concat(a.slice(-1)==="Z"?a.slice(0,-1):a,"L").concat(J(n.reverse(),t).slice(1))},Jt=function(e){var n=e.points,t=e.className,a=e.baseLinePoints,o=e.connectNulls,i=qt(e,zt);if(!n||!n.length)return null;var l=E("recharts-polygon",t);if(a&&a.length){var d=i.stroke&&i.stroke!=="none",c=Yt(n,a,o);return f.createElement("g",{className:l},f.createElement("path",H({},j(i,!0),{fill:c.slice(-1)==="Z"?i.fill:"none",stroke:"none",d:c})),d?f.createElement("path",H({},j(i,!0),{fill:"none",d:J(n,o)})):null,d?f.createElement("path",H({},j(i,!0),{fill:"none",d:J(a,o)})):null)}var p=J(n,o);return f.createElement("path",H({},j(i,!0),{fill:p.slice(-1)==="Z"?i.fill:"none",className:l,d:p}))},pe,$e;function Qt(){if($e)return pe;$e=1;var r=We(),e=ft(),n=Ze();function t(a,o){return a&&a.length?r(a,n(o,2),e):void 0}return pe=t,pe}var er=Qt();const tr=He(er);var me,Ce;function rr(){if(Ce)return me;Ce=1;var r=We(),e=Ze(),n=pt();function t(a,o){return a&&a.length?r(a,e(o,2),n):void 0}return me=t,me}var nr=rr();const ar=He(nr);var ir=["cx","cy","angle","ticks","axisLine"],sr=["ticks","tick","angle","tickFormatter","stroke"];function G(r){"@babel/helpers - typeof";return G=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},G(r)}function Q(){return Q=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r},Q.apply(this,arguments)}function De(r,e){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);e&&(t=t.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),n.push.apply(n,t)}return n}function $(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?De(Object(n),!0).forEach(function(t){ce(r,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):De(Object(n)).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(n,t))})}return r}function Me(r,e){if(r==null)return{};var n=or(r,e),t,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(r);for(a=0;a<o.length;a++)t=o[a],!(e.indexOf(t)>=0)&&Object.prototype.propertyIsEnumerable.call(r,t)&&(n[t]=r[t])}return n}function or(r,e){if(r==null)return{};var n={};for(var t in r)if(Object.prototype.hasOwnProperty.call(r,t)){if(e.indexOf(t)>=0)continue;n[t]=r[t]}return n}function lr(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function Be(r,e){for(var n=0;n<e.length;n++){var t=e[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(r,Je(t.key),t)}}function cr(r,e,n){return e&&Be(r.prototype,e),n&&Be(r,n),Object.defineProperty(r,"prototype",{writable:!1}),r}function ur(r,e,n){return e=ie(e),dr(r,Ye()?Reflect.construct(e,n||[],ie(r).constructor):e.apply(r,n))}function dr(r,e){if(e&&(G(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return fr(r)}function fr(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function Ye(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Ye=function(){return!!r})()}function ie(r){return ie=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ie(r)}function pr(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&xe(r,e)}function xe(r,e){return xe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,a){return t.__proto__=a,t},xe(r,e)}function ce(r,e,n){return e=Je(e),e in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n,r}function Je(r){var e=mr(r,"string");return G(e)=="symbol"?e:e+""}function mr(r,e){if(G(r)!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var t=n.call(r,e);if(G(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var ue=(function(r){function e(){return lr(this,e),ur(this,e,arguments)}return pr(e,r),cr(e,[{key:"getTickValueCoord",value:function(t){var a=t.coordinate,o=this.props,i=o.angle,l=o.cx,d=o.cy;return S(l,d,a,i)}},{key:"getTickTextAnchor",value:function(){var t=this.props.orientation,a;switch(t){case"left":a="end";break;case"right":a="start";break;default:a="middle";break}return a}},{key:"getViewBox",value:function(){var t=this.props,a=t.cx,o=t.cy,i=t.angle,l=t.ticks,d=tr(l,function(p){return p.coordinate||0}),c=ar(l,function(p){return p.coordinate||0});return{cx:a,cy:o,startAngle:i,endAngle:i,innerRadius:c.coordinate||0,outerRadius:d.coordinate||0}}},{key:"renderAxisLine",value:function(){var t=this.props,a=t.cx,o=t.cy,i=t.angle,l=t.ticks,d=t.axisLine,c=Me(t,ir),p=l.reduce(function(m,u){return[Math.min(m[0],u.coordinate),Math.max(m[1],u.coordinate)]},[1/0,-1/0]),h=S(a,o,p[0],i),y=S(a,o,p[1],i),A=$($($({},j(c,!1)),{},{fill:"none"},j(d,!1)),{},{x1:h.x,y1:h.y,x2:y.x,y2:y.y});return f.createElement("line",Q({className:"recharts-polar-radius-axis-line"},A))}},{key:"renderTicks",value:function(){var t=this,a=this.props,o=a.ticks,i=a.tick,l=a.angle,d=a.tickFormatter,c=a.stroke,p=Me(a,sr),h=this.getTickTextAnchor(),y=j(p,!1),A=j(i,!1),m=o.map(function(u,x){var g=t.getTickValueCoord(u),b=$($($($({textAnchor:h,transform:"rotate(".concat(90-l,", ").concat(g.x,", ").concat(g.y,")")},y),{},{stroke:"none",fill:c},A),{},{index:x},g),{},{payload:u});return f.createElement(O,Q({className:E("recharts-polar-radius-axis-tick",Ge(i)),key:"tick-".concat(u.coordinate)},Ae(t.props,u,x)),e.renderTickItem(i,b,d?d(u.value,x):u.value))});return f.createElement(O,{className:"recharts-polar-radius-axis-ticks"},m)}},{key:"render",value:function(){var t=this.props,a=t.ticks,o=t.axisLine,i=t.tick;return!a||!a.length?null:f.createElement(O,{className:E("recharts-polar-radius-axis",this.props.className)},o&&this.renderAxisLine(),i&&this.renderTicks(),Ue.renderCallByParent(this.props,this.getViewBox()))}}],[{key:"renderTickItem",value:function(t,a,o){var i;return f.isValidElement(t)?i=f.cloneElement(t,a):M(t)?i=t(a):i=f.createElement(je,Q({},a,{className:"recharts-polar-radius-axis-tick-value"}),o),i}}])})(be.PureComponent);ce(ue,"displayName","PolarRadiusAxis");ce(ue,"axisType","radiusAxis");ce(ue,"defaultProps",{type:"number",radiusAxisId:0,cx:0,cy:0,angle:0,orientation:"right",stroke:"#ccc",axisLine:!0,tick:!0,tickCount:5,allowDataOverflow:!1,scale:"auto",allowDuplicatedCategory:!0});function U(r){"@babel/helpers - typeof";return U=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},U(r)}function B(){return B=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r},B.apply(this,arguments)}function Fe(r,e){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);e&&(t=t.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),n.push.apply(n,t)}return n}function C(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Fe(Object(n),!0).forEach(function(t){de(r,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):Fe(Object(n)).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(n,t))})}return r}function hr(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function Ke(r,e){for(var n=0;n<e.length;n++){var t=e[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(r,et(t.key),t)}}function vr(r,e,n){return e&&Ke(r.prototype,e),n&&Ke(r,n),Object.defineProperty(r,"prototype",{writable:!1}),r}function xr(r,e,n){return e=se(e),yr(r,Qe()?Reflect.construct(e,n||[],se(r).constructor):e.apply(r,n))}function yr(r,e){if(e&&(U(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return gr(r)}function gr(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function Qe(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Qe=function(){return!!r})()}function se(r){return se=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},se(r)}function br(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&ye(r,e)}function ye(r,e){return ye=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,a){return t.__proto__=a,t},ye(r,e)}function de(r,e,n){return e=et(e),e in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n,r}function et(r){var e=jr(r,"string");return U(e)=="symbol"?e:e+""}function jr(r,e){if(U(r)!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var t=n.call(r,e);if(U(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}var Ar=Math.PI/180,Ve=1e-5,fe=(function(r){function e(){return hr(this,e),xr(this,e,arguments)}return br(e,r),vr(e,[{key:"getTickLineCoord",value:function(t){var a=this.props,o=a.cx,i=a.cy,l=a.radius,d=a.orientation,c=a.tickSize,p=c||8,h=S(o,i,l,t.coordinate),y=S(o,i,l+(d==="inner"?-1:1)*p,t.coordinate);return{x1:h.x,y1:h.y,x2:y.x,y2:y.y}}},{key:"getTickTextAnchor",value:function(t){var a=this.props.orientation,o=Math.cos(-t.coordinate*Ar),i;return o>Ve?i=a==="outer"?"start":"end":o<-Ve?i=a==="outer"?"end":"start":i="middle",i}},{key:"renderAxisLine",value:function(){var t=this.props,a=t.cx,o=t.cy,i=t.radius,l=t.axisLine,d=t.axisLineType,c=C(C({},j(this.props,!1)),{},{fill:"none"},j(l,!1));if(d==="circle")return f.createElement(mt,B({className:"recharts-polar-angle-axis-line"},c,{cx:a,cy:o,r:i}));var p=this.props.ticks,h=p.map(function(y){return S(a,o,i,y.coordinate)});return f.createElement(Jt,B({className:"recharts-polar-angle-axis-line"},c,{points:h}))}},{key:"renderTicks",value:function(){var t=this,a=this.props,o=a.ticks,i=a.tick,l=a.tickLine,d=a.tickFormatter,c=a.stroke,p=j(this.props,!1),h=j(i,!1),y=C(C({},p),{},{fill:"none"},j(l,!1)),A=o.map(function(m,u){var x=t.getTickLineCoord(m),g=t.getTickTextAnchor(m),b=C(C(C({textAnchor:g},p),{},{stroke:"none",fill:c},h),{},{index:u,payload:m,x:x.x2,y:x.y2});return f.createElement(O,B({className:E("recharts-polar-angle-axis-tick",Ge(i)),key:"tick-".concat(m.coordinate)},Ae(t.props,m,u)),l&&f.createElement("line",B({className:"recharts-polar-angle-axis-tick-line"},y,x)),i&&e.renderTickItem(i,b,d?d(m.value,u):m.value))});return f.createElement(O,{className:"recharts-polar-angle-axis-ticks"},A)}},{key:"render",value:function(){var t=this.props,a=t.ticks,o=t.radius,i=t.axisLine;return o<=0||!a||!a.length?null:f.createElement(O,{className:E("recharts-polar-angle-axis",this.props.className)},i&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(t,a,o){var i;return f.isValidElement(t)?i=f.cloneElement(t,a):M(t)?i=t(a):i=f.createElement(je,B({},a,{className:"recharts-polar-angle-axis-tick-value"}),o),i}}])})(be.PureComponent);de(fe,"displayName","PolarAngleAxis");de(fe,"axisType","angleAxis");de(fe,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var ae;function X(r){"@babel/helpers - typeof";return X=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},X(r)}function W(){return W=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r},W.apply(this,arguments)}function ze(r,e){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);e&&(t=t.filter(function(a){return Object.getOwnPropertyDescriptor(r,a).enumerable})),n.push.apply(n,t)}return n}function v(r){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ze(Object(n),!0).forEach(function(t){P(r,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):ze(Object(n)).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(n,t))})}return r}function kr(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function qe(r,e){for(var n=0;n<e.length;n++){var t=e[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(r,rt(t.key),t)}}function Pr(r,e,n){return e&&qe(r.prototype,e),n&&qe(r,n),Object.defineProperty(r,"prototype",{writable:!1}),r}function wr(r,e,n){return e=oe(e),Or(r,tt()?Reflect.construct(e,n||[],oe(r).constructor):e.apply(r,n))}function Or(r,e){if(e&&(X(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Nr(r)}function Nr(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function tt(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(tt=function(){return!!r})()}function oe(r){return oe=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},oe(r)}function _r(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),e&&ge(r,e)}function ge(r,e){return ge=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,a){return t.__proto__=a,t},ge(r,e)}function P(r,e,n){return e=rt(e),e in r?Object.defineProperty(r,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[e]=n,r}function rt(r){var e=Sr(r,"string");return X(e)=="symbol"?e:e+""}function Sr(r,e){if(X(r)!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var t=n.call(r,e);if(X(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}var T=(function(r){function e(n){var t;return kr(this,e),t=wr(this,e,[n]),P(t,"pieRef",null),P(t,"sectorRefs",[]),P(t,"id",jt("recharts-pie-")),P(t,"handleAnimationEnd",function(){var a=t.props.onAnimationEnd;t.setState({isAnimationFinished:!0}),M(a)&&a()}),P(t,"handleAnimationStart",function(){var a=t.props.onAnimationStart;t.setState({isAnimationFinished:!1}),M(a)&&a()}),t.state={isAnimationFinished:!n.isAnimationActive,prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,sectorToFocus:0},t}return _r(e,r),Pr(e,[{key:"isActiveIndex",value:function(t){var a=this.props.activeIndex;return Array.isArray(a)?a.indexOf(t)!==-1:t===a}},{key:"hasActiveIndex",value:function(){var t=this.props.activeIndex;return Array.isArray(t)?t.length!==0:t||t===0}},{key:"renderLabels",value:function(t){var a=this.props.isAnimationActive;if(a&&!this.state.isAnimationFinished)return null;var o=this.props,i=o.label,l=o.labelLine,d=o.dataKey,c=o.valueKey,p=j(this.props,!1),h=j(i,!1),y=j(l,!1),A=i&&i.offsetRadius||20,m=t.map(function(u,x){var g=(u.startAngle+u.endAngle)/2,b=S(u.cx,u.cy,u.outerRadius+A,g),w=v(v(v(v({},p),u),{},{stroke:"none"},h),{},{index:x,textAnchor:e.getTextAnchor(b.x,u.cx)},b),F=v(v(v(v({},p),u),{},{fill:"none",stroke:u.fill},y),{},{index:x,points:[S(u.cx,u.cy,u.outerRadius,g),b]}),N=d;return Z(d)&&Z(c)?N="value":Z(d)&&(N=c),f.createElement(O,{key:"label-".concat(u.startAngle,"-").concat(u.endAngle,"-").concat(u.midAngle,"-").concat(x)},l&&e.renderLabelLineItem(l,F,"line"),e.renderLabelItem(i,w,z(u,N)))});return f.createElement(O,{className:"recharts-pie-labels"},m)}},{key:"renderSectorsStatically",value:function(t){var a=this,o=this.props,i=o.activeShape,l=o.blendStroke,d=o.inactiveShape;return t.map(function(c,p){if(c?.startAngle===0&&c?.endAngle===0&&t.length!==1)return null;var h=a.isActiveIndex(p),y=d&&a.hasActiveIndex()?d:null,A=h?i:y,m=v(v({},c),{},{stroke:l?c.fill:c.stroke,tabIndex:-1});return f.createElement(O,W({ref:function(x){x&&!a.sectorRefs.includes(x)&&a.sectorRefs.push(x)},tabIndex:-1,className:"recharts-pie-sector"},Ae(a.props,c,p),{key:"sector-".concat(c?.startAngle,"-").concat(c?.endAngle,"-").concat(c.midAngle,"-").concat(p)}),f.createElement(vt,W({option:A,isActive:h,shapeType:"sector"},m)))})}},{key:"renderSectorsWithAnimation",value:function(){var t=this,a=this.props,o=a.sectors,i=a.isAnimationActive,l=a.animationBegin,d=a.animationDuration,c=a.animationEasing,p=a.animationId,h=this.state,y=h.prevSectors,A=h.prevIsAnimationActive;return f.createElement(xt,{begin:l,duration:d,isActive:i,easing:c,from:{t:0},to:{t:1},key:"pie-".concat(p,"-").concat(A),onAnimationStart:this.handleAnimationStart,onAnimationEnd:this.handleAnimationEnd},function(m){var u=m.t,x=[],g=o&&o[0],b=g.startAngle;return o.forEach(function(w,F){var N=y&&y[F],L=F>0?yt(w,"paddingAngle",0):0;if(N){var Y=Oe(N.endAngle-N.startAngle,w.endAngle-w.startAngle),k=v(v({},w),{},{startAngle:b+L,endAngle:b+Y(u)+L});x.push(k),b=k.endAngle}else{var K=w.endAngle,_=w.startAngle,ee=Oe(0,K-_),te=ee(u),R=v(v({},w),{},{startAngle:b+L,endAngle:b+te+L});x.push(R),b=R.endAngle}}),f.createElement(O,null,t.renderSectorsStatically(x))})}},{key:"attachKeyboardHandlers",value:function(t){var a=this;t.onkeydown=function(o){if(!o.altKey)switch(o.key){case"ArrowLeft":{var i=++a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[i].focus(),a.setState({sectorToFocus:i});break}case"ArrowRight":{var l=--a.state.sectorToFocus<0?a.sectorRefs.length-1:a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[l].focus(),a.setState({sectorToFocus:l});break}case"Escape":{a.sectorRefs[a.state.sectorToFocus].blur(),a.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var t=this.props,a=t.sectors,o=t.isAnimationActive,i=this.state.prevSectors;return o&&a&&a.length&&(!i||!gt(i,a))?this.renderSectorsWithAnimation():this.renderSectorsStatically(a)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var t=this,a=this.props,o=a.hide,i=a.sectors,l=a.className,d=a.label,c=a.cx,p=a.cy,h=a.innerRadius,y=a.outerRadius,A=a.isAnimationActive,m=this.state.isAnimationFinished;if(o||!i||!i.length||!q(c)||!q(p)||!q(h)||!q(y))return null;var u=E("recharts-pie",l);return f.createElement(O,{tabIndex:this.props.rootTabIndex,className:u,ref:function(g){t.pieRef=g}},this.renderSectors(),d&&this.renderLabels(i),Ue.renderCallByParent(this.props,null,!1),(!A||m)&&bt.renderCallByParent(this.props,i,!1))}}],[{key:"getDerivedStateFromProps",value:function(t,a){return a.prevIsAnimationActive!==t.isAnimationActive?{prevIsAnimationActive:t.isAnimationActive,prevAnimationId:t.animationId,curSectors:t.sectors,prevSectors:[],isAnimationFinished:!0}:t.isAnimationActive&&t.animationId!==a.prevAnimationId?{prevAnimationId:t.animationId,curSectors:t.sectors,prevSectors:a.curSectors,isAnimationFinished:!0}:t.sectors!==a.curSectors?{curSectors:t.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(t,a){return t>a?"start":t<a?"end":"middle"}},{key:"renderLabelLineItem",value:function(t,a,o){if(f.isValidElement(t))return f.cloneElement(t,a);if(M(t))return t(a);var i=E("recharts-pie-label-line",typeof t!="boolean"?t.className:"");return f.createElement(ht,W({},a,{key:o,type:"linear",className:i}))}},{key:"renderLabelItem",value:function(t,a,o){if(f.isValidElement(t))return f.cloneElement(t,a);var i=o;if(M(t)&&(i=t(a),f.isValidElement(i)))return i;var l=E("recharts-pie-label-text",typeof t!="boolean"&&!M(t)?t.className:"");return f.createElement(je,W({},a,{alignmentBaseline:"middle",className:l}),i)}}])})(be.PureComponent);ae=T;P(T,"displayName","Pie");P(T,"defaultProps",{stroke:"#fff",fill:"#808080",legendType:"rect",cx:"50%",cy:"50%",startAngle:0,endAngle:360,innerRadius:0,outerRadius:"80%",paddingAngle:0,labelLine:!0,hide:!1,minAngle:0,isAnimationActive:!At.isSsr,animationBegin:400,animationDuration:1500,animationEasing:"ease",nameKey:"name",blendStroke:!1,rootTabIndex:0});P(T,"parseDeltaAngle",function(r,e){var n=ne(e-r),t=Math.min(Math.abs(e-r),360);return n*t});P(T,"getRealPieData",function(r){var e=r.data,n=r.children,t=j(r,!1),a=kt(n,Xe);return e&&e.length?e.map(function(o,i){return v(v(v({payload:o},t),o),a&&a[i]&&a[i].props)}):a&&a.length?a.map(function(o){return v(v({},t),o.props)}):[]});P(T,"parseCoordinateOfPie",function(r,e){var n=e.top,t=e.left,a=e.width,o=e.height,i=Pt(a,o),l=t+re(r.cx,a,a/2),d=n+re(r.cy,o,o/2),c=re(r.innerRadius,i,0),p=re(r.outerRadius,i,i*.8),h=r.maxRadius||Math.sqrt(a*a+o*o)/2;return{cx:l,cy:d,innerRadius:c,outerRadius:p,maxRadius:h}});P(T,"getComposedData",function(r){var e=r.item,n=r.offset,t=e.type.defaultProps!==void 0?v(v({},e.type.defaultProps),e.props):e.props,a=ae.getRealPieData(t);if(!a||!a.length)return null;var o=t.cornerRadius,i=t.startAngle,l=t.endAngle,d=t.paddingAngle,c=t.dataKey,p=t.nameKey,h=t.valueKey,y=t.tooltipType,A=Math.abs(t.minAngle),m=ae.parseCoordinateOfPie(t,n),u=ae.parseDeltaAngle(i,l),x=Math.abs(u),g=c;Z(c)&&Z(h)?(Ne(!1,`Use "dataKey" to specify the value of pie,
|
|
3
|
-
the props "valueKey" will be deprecated in 1.1.0`),g="value"):Z(c)&&(Ne(!1,`Use "dataKey" to specify the value of pie,
|
|
4
|
-
the props "valueKey" will be deprecated in 1.1.0`),g=h);var b=a.filter(function(k){return z(k,g,0)!==0}).length,w=(x>=360?b:b-1)*d,F=x-b*A-w,N=a.reduce(function(k,K){var _=z(K,g,0);return k+(q(_)?_:0)},0),L;if(N>0){var Y;L=a.map(function(k,K){var _=z(k,g,0),ee=z(k,p,K),te=(q(_)?_:0)/N,R;K?R=Y.endAngle+ne(u)*d*(_!==0?1:0):R=i;var ke=R+ne(u)*((_!==0?A:0)+te*F),Pe=(R+ke)/2,we=(m.innerRadius+m.outerRadius)/2,at=[{name:ee,value:_,payload:k,dataKey:g,type:y}],it=S(m.cx,m.cy,we,Pe);return Y=v(v(v({percent:te,cornerRadius:o,name:ee,tooltipPayload:at,midAngle:Pe,middleRadius:we,tooltipPosition:it},k),m),{},{value:z(k,g),startAngle:R,endAngle:ke,payload:k,paddingAngle:ne(u)*d}),Y})}return v(v({},m),{},{sectors:L,data:a})});var Tr=wt({chartName:"PieChart",GraphicalChild:T,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:fe},{axisType:"radiusAxis",AxisComp:ue}],formatAxisMap:Ot,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});const V=["#34d399","#38bdf8","#818cf8","#f59e0b","#f97316","#f472b6"],nt={container:{transition:{staggerChildren:.08}},item:{hidden:{opacity:0,y:20,scale:.97},show:{opacity:1,y:0,scale:1,transition:{duration:.4,ease:[.22,1,.36,1]}}}};function he({label:r,value:e,sub:n,icon:t,gradient:a}){return s.jsxs(D.div,{variants:nt.item,className:"metric-card",children:[s.jsx("div",{className:`metric-orb ${a}`,children:t}),s.jsxs("div",{children:[s.jsx("div",{className:"hud-label",children:r}),s.jsx("div",{className:"mt-1 text-3xl font-semibold tracking-[-0.04em] text-white",children:e}),n&&s.jsx("div",{className:"mt-2 text-sm text-slate-400",children:n})]})]})}function Fr(){const{data:r,isLoading:e}=lt({queryKey:["stats"],queryFn:()=>ot(24)}),n=r?.byModel??[],t=r?.byProvider??[],a=n.map(i=>({name:i.model.length>22?`${i.model.slice(0,20)}...`:i.model,cost:Number(i.totalCost.toFixed(6)),tokens:i.totalTokens,calls:i.spanCount})),o=t.map(i=>({name:i.provider,value:Number(i.totalCost.toFixed(6))}));return e?s.jsxs("div",{className:"mx-auto max-w-[1500px] space-y-8",children:[s.jsx("div",{className:"skeleton-panel h-44 rounded-[28px]"}),s.jsx("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-3",children:[...Array(3)].map((i,l)=>s.jsxs("div",{className:"metric-card",children:[s.jsx("div",{className:"skeleton-panel h-12 w-12 rounded-2xl"}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"skeleton-panel h-3 w-20 rounded-full"}),s.jsx("div",{className:"skeleton-panel h-8 w-28 rounded-full"})]})]},l))})]}):s.jsxs(ct,{eyebrow:"Economic Layer",title:"Understand where every token is converting into spend.",description:"The economics view is now built like a cost cockpit. It surfaces burn concentration, provider mix, and the models that are consuming budget fastest.",aside:s.jsxs("div",{className:"insight-panel",children:[s.jsx(st,{}),s.jsxs("div",{className:"mt-4 space-y-3",children:[s.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[s.jsx("div",{className:"hud-label",children:"Highest model spend"}),s.jsx("div",{className:"mt-2 text-base font-medium text-white",children:n[0]?.model??"Awaiting traffic"}),s.jsx("div",{className:"mt-1 text-sm text-slate-400",children:n[0]?`${I(n[0].totalCost)} across ${n[0].spanCount} calls`:"No model cost data yet"})]}),s.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[s.jsx("div",{className:"hud-label",children:"Provider spread"}),s.jsxs("div",{className:"mt-2 text-base font-medium text-white",children:[t.length," active providers"]}),s.jsx("div",{className:"mt-1 text-sm text-slate-400",children:"Cost dominance becomes obvious here before it becomes expensive."})]})]})]}),children:[s.jsxs(D.div,{className:"grid grid-cols-1 gap-4 md:grid-cols-3",variants:nt.container,initial:"hidden",animate:"show",children:[s.jsx(he,{icon:s.jsx(Rt,{className:"h-5 w-5"}),label:"Total Cost",value:I(r?.totalCost??0),sub:"Accumulated over the last 24 hours",gradient:"bg-[linear-gradient(135deg,rgba(250,204,21,0.18),rgba(249,115,22,0.18))] text-amber-200"}),s.jsx(he,{icon:s.jsx(Et,{className:"h-5 w-5"}),label:"Token Volume",value:ut(r?.totalTokens??0),sub:`${r?.totalSpans??0} model calls observed`,gradient:"bg-[linear-gradient(135deg,rgba(56,189,248,0.18),rgba(168,85,247,0.18))] text-sky-200"}),s.jsx(he,{icon:s.jsx(Vt,{className:"h-5 w-5"}),label:"Models in Rotation",value:String(n.length),sub:`${t.length} providers contributing to spend`,gradient:"bg-[linear-gradient(135deg,rgba(52,211,153,0.18),rgba(14,165,233,0.18))] text-emerald-200"})]}),s.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1.1fr)_minmax(360px,0.9fr)]",children:[s.jsxs(D.div,{className:"dashboard-shell rounded-[26px] px-5 py-5",initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{delay:.15,duration:.35},children:[s.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("div",{className:"hud-label",children:"Model ranking"}),s.jsx("h2",{className:"mt-1 text-xl font-semibold tracking-[-0.04em] text-white",children:"Cost by model"})]}),s.jsxs("span",{className:"status-chip",children:[s.jsx(Mt,{className:"h-3.5 w-3.5 text-sky-300"}),s.jsx("span",{children:"Spend concentration"})]})]}),a.length>0?s.jsx("div",{className:"relative min-h-[320px]",children:s.jsx(_e,{width:"100%",height:Math.max(320,a.length*58),children:s.jsxs(Lt,{data:a,layout:"vertical",children:[s.jsx(Nt,{stroke:"rgba(148,163,184,0.08)",horizontal:!1}),s.jsx(_t,{type:"number",tick:{fontSize:11,fill:"#94a3b8"},axisLine:!1,tickLine:!1,tickFormatter:i=>I(i)}),s.jsx(St,{type:"category",dataKey:"name",tick:{fontSize:11,fill:"#cbd5e1"},axisLine:!1,tickLine:!1,width:160}),s.jsx(Se,{contentStyle:Te,formatter:i=>[I(i),"Cost"]}),s.jsx(Tt,{dataKey:"cost",fill:"#34d399",radius:[0,10,10,0]})]})})}):s.jsxs("div",{className:"empty-state h-[320px]",children:[s.jsx(Ee,{className:"h-8 w-8 text-slate-500"}),s.jsx("div",{className:"text-base font-medium text-white",children:"No cost data yet"}),s.jsx("div",{className:"text-center text-sm text-slate-400",children:"Model spend will stack up here as soon as traffic hits the collector."})]})]}),s.jsxs(D.div,{className:"dashboard-shell rounded-[26px] px-5 py-5",initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{delay:.2,duration:.35},children:[s.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("div",{className:"hud-label",children:"Provider mix"}),s.jsx("h2",{className:"mt-1 text-xl font-semibold tracking-[-0.04em] text-white",children:"Who is taking the budget"})]}),s.jsx(It,{className:"h-4 w-4 text-sky-300"})]}),o.length>0?s.jsxs("div",{className:"flex flex-col gap-6 lg:flex-row lg:items-center",children:[s.jsx(_e,{width:"100%",height:260,className:"lg:max-w-[260px]",children:s.jsxs(Tr,{children:[s.jsx(T,{data:o,cx:"50%",cy:"50%",innerRadius:62,outerRadius:96,paddingAngle:3,dataKey:"value",strokeWidth:0,children:o.map((i,l)=>s.jsx(Xe,{fill:V[l%V.length]},`cell-${l}`))}),s.jsx(Se,{contentStyle:Te,formatter:i=>[I(i),"Cost"]})]})}),s.jsx("div",{className:"flex-1 space-y-3",children:o.map((i,l)=>s.jsx("div",{className:"rounded-2xl border border-white/6 bg-white/4 p-3.5",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"h-3 w-3 shrink-0 rounded-sm",style:{backgroundColor:V[l%V.length],boxShadow:`0 0 10px ${V[l%V.length]}50`}}),s.jsx("span",{className:"flex-1 text-sm font-medium capitalize text-white",children:i.name}),s.jsx("span",{className:"font-mono text-xs text-slate-400",children:I(i.value)})]})},i.name))})]}):s.jsxs("div",{className:"empty-state h-[260px]",children:[s.jsx($t,{className:"h-8 w-8 text-slate-500"}),s.jsx("div",{className:"text-base font-medium text-white",children:"No providers yet"}),s.jsx("div",{className:"text-center text-sm text-slate-400",children:"Provider allocation appears here as soon as at least one model call is captured."})]})]})]}),n.length>0?s.jsxs(D.div,{className:"dashboard-shell overflow-hidden rounded-[26px] px-4 py-4 sm:px-5",initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{delay:.25,duration:.35},children:[s.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3 px-1",children:[s.jsxs("div",{children:[s.jsx("div",{className:"hud-label",children:"Detailed ledger"}),s.jsx("h2",{className:"mt-1 text-xl font-semibold tracking-[-0.04em] text-white",children:"Breakdown by model"})]}),s.jsxs("span",{className:"status-chip",children:[s.jsx(Ft,{className:"h-3.5 w-3.5 text-sky-300"}),s.jsxs("span",{children:[n.length," models"]})]})]}),s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full border-separate border-spacing-y-2 text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"text-left text-[11px] uppercase tracking-[0.18em] text-slate-500",children:[s.jsx("th",{className:"px-4 py-2",children:"Model"}),s.jsx("th",{className:"px-4 py-2",children:"Provider"}),s.jsx("th",{className:"px-4 py-2 text-right",children:"Calls"}),s.jsx("th",{className:"px-4 py-2 text-right",children:"Tokens"}),s.jsx("th",{className:"px-4 py-2 text-right",children:"Cost"}),s.jsx("th",{className:"px-4 py-2 text-right",children:"Avg Duration"})]})}),s.jsx("tbody",{children:n.map((i,l)=>s.jsxs(D.tr,{className:"rounded-2xl border border-white/6 bg-white/4",initial:{opacity:0,x:-8},animate:{opacity:1,x:0},transition:{delay:.03*l,duration:.3},children:[s.jsx("td",{className:"rounded-l-2xl px-4 py-4 font-mono text-xs font-semibold text-slate-100",children:i.model}),s.jsx("td",{className:"px-4 py-4",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:Re[i.provider]??"#a855f6",boxShadow:`0 0 10px ${Re[i.provider]??"#a855f6"}`}}),s.jsx("span",{className:"text-xs font-medium capitalize text-slate-200",children:i.provider})]})}),s.jsx("td",{className:"px-4 py-4 text-right",children:s.jsx("span",{className:"inline-flex items-center justify-center rounded-md border border-white/8 bg-slate-950/70 px-2 py-0.5 font-mono text-xs text-slate-400",children:i.spanCount})}),s.jsx("td",{className:"px-4 py-4 text-right font-mono text-xs text-slate-300",children:i.totalTokens.toLocaleString()}),s.jsx("td",{className:"px-4 py-4 text-right font-mono text-xs font-semibold text-white",children:I(i.totalCost)}),s.jsx("td",{className:"rounded-r-2xl px-4 py-4 text-right font-mono text-xs text-slate-500",children:i.avgDuration?dt(i.avgDuration):"-"})]},`${i.provider}-${i.model}`))})]})})]}):s.jsx(D.div,{className:"dashboard-shell rounded-[26px] p-16",initial:{opacity:0},animate:{opacity:1},children:s.jsxs("div",{className:"empty-state",children:[s.jsx(Ee,{className:"h-8 w-8 text-slate-500"}),s.jsx("div",{className:"text-base font-medium text-white",children:"No cost data yet"}),s.jsx("div",{className:"max-w-sm text-center text-sm text-slate-400",children:"Start making traced model calls and the economic layer will fill in automatically."})]})})]})}export{Fr as default};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{c as le,R as b,a as Ae,r as T,j as e,b as De,u as Le,d as Te,C as Ee,m as Me,X as Re,S as Ie,L as $e,T as ce,e as ze,f as Be,g as Fe,h as qe,i as He}from"./index-M3DwcRrc.js";import{u as ae,f as Ve,P as We,a as se,b as q,c as de,d as me}from"./format-CNuIwzac.js";import{C as Ke,S as Ge,A as Xe}from"./StatusDot-CjYDb6xj.js";import{P as he,A as ue,C as Ye,a as Ue,b as xe,B as pe}from"./constants-BzCnW506.js";import{f as H,L as X,m as Q,i as W,C as re,A as Qe,a as V,b as fe,c as Ze,d as ve,h as Je,e as et,u as tt,g as ie,G as at,j as be,k as ge,D as st,l as rt,X as ke,Y as Se,n as it,R as nt,o as lt,T as ot,t as ct}from"./chart-styles-BD7W97c9.js";import{G as dt}from"./gauge-CfqhcKwk.js";import{O as mt}from"./orbit-eg7lcPsM.js";const ht=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],ut=le("lightbulb",ht);const xt=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],ye=le("shield-alert",xt);const pt=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],Z=le("trending-up",pt);var ft=["layout","type","stroke","connectNulls","isRange","ref"],vt=["key"],Pe;function K(t){"@babel/helpers - typeof";return K=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},K(t)}function Oe(t,s){if(t==null)return{};var r=bt(t,s),a,n;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)a=o[n],!(s.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(t,a)&&(r[a]=t[a])}return r}function bt(t,s){if(t==null)return{};var r={};for(var a in t)if(Object.prototype.hasOwnProperty.call(t,a)){if(s.indexOf(a)>=0)continue;r[a]=t[a]}return r}function F(){return F=Object.assign?Object.assign.bind():function(t){for(var s=1;s<arguments.length;s++){var r=arguments[s];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},F.apply(this,arguments)}function je(t,s){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);s&&(a=a.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,a)}return r}function R(t){for(var s=1;s<arguments.length;s++){var r=arguments[s]!=null?arguments[s]:{};s%2?je(Object(r),!0).forEach(function(a){D(t,a,r[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):je(Object(r)).forEach(function(a){Object.defineProperty(t,a,Object.getOwnPropertyDescriptor(r,a))})}return t}function gt(t,s){if(!(t instanceof s))throw new TypeError("Cannot call a class as a function")}function Ne(t,s){for(var r=0;r<s.length;r++){var a=s[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,_e(a.key),a)}}function yt(t,s,r){return s&&Ne(t.prototype,s),r&&Ne(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function jt(t,s,r){return s=ee(s),Nt(t,Ce()?Reflect.construct(s,r||[],ee(t).constructor):s.apply(t,r))}function Nt(t,s){if(s&&(K(s)==="object"||typeof s=="function"))return s;if(s!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return wt(t)}function wt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Ce(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Ce=function(){return!!t})()}function ee(t){return ee=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ee(t)}function At(t,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(s&&s.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),s&&ne(t,s)}function ne(t,s){return ne=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(a,n){return a.__proto__=n,a},ne(t,s)}function D(t,s,r){return s=_e(s),s in t?Object.defineProperty(t,s,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[s]=r,t}function _e(t){var s=kt(t,"string");return K(s)=="symbol"?s:s+""}function kt(t,s){if(K(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var a=r.call(t,s);if(K(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var I=(function(t){function s(){var r;gt(this,s);for(var a=arguments.length,n=new Array(a),o=0;o<a;o++)n[o]=arguments[o];return r=jt(this,s,[].concat(n)),D(r,"state",{isAnimationFinished:!0}),D(r,"id",tt("recharts-area-")),D(r,"handleAnimationEnd",function(){var l=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),ie(l)&&l()}),D(r,"handleAnimationStart",function(){var l=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),ie(l)&&l()}),r}return At(s,t),yt(s,[{key:"renderDots",value:function(a,n,o){var l=this.props.isAnimationActive,c=this.state.isAnimationFinished;if(l&&!c)return null;var m=this.props,d=m.dot,h=m.points,u=m.dataKey,p=H(this.props,!1),x=H(d,!0),N=h.map(function(y,P){var g=R(R(R({key:"dot-".concat(P),r:3},p),x),{},{index:P,cx:y.x,cy:y.y,dataKey:u,value:y.value,payload:y.payload,points:h});return s.renderDotItem(d,g)}),k={clipPath:a?"url(#clipPath-".concat(n?"":"dots-").concat(o,")"):null};return b.createElement(X,F({className:"recharts-area-dots"},k),N)}},{key:"renderHorizontalRect",value:function(a){var n=this.props,o=n.baseLine,l=n.points,c=n.strokeWidth,m=l[0].x,d=l[l.length-1].x,h=a*Math.abs(m-d),u=Q(l.map(function(p){return p.y||0}));return W(o)&&typeof o=="number"?u=Math.max(o,u):o&&Array.isArray(o)&&o.length&&(u=Math.max(Q(o.map(function(p){return p.y||0})),u)),W(u)?b.createElement("rect",{x:m<d?m:m-h,y:0,width:h,height:Math.floor(u+(c?parseInt("".concat(c),10):1))}):null}},{key:"renderVerticalRect",value:function(a){var n=this.props,o=n.baseLine,l=n.points,c=n.strokeWidth,m=l[0].y,d=l[l.length-1].y,h=a*Math.abs(m-d),u=Q(l.map(function(p){return p.x||0}));return W(o)&&typeof o=="number"?u=Math.max(o,u):o&&Array.isArray(o)&&o.length&&(u=Math.max(Q(o.map(function(p){return p.x||0})),u)),W(u)?b.createElement("rect",{x:0,y:m<d?m:m-h,width:u+(c?parseInt("".concat(c),10):1),height:Math.floor(h)}):null}},{key:"renderClipRect",value:function(a){var n=this.props.layout;return n==="vertical"?this.renderVerticalRect(a):this.renderHorizontalRect(a)}},{key:"renderAreaStatically",value:function(a,n,o,l){var c=this.props,m=c.layout,d=c.type,h=c.stroke,u=c.connectNulls,p=c.isRange;c.ref;var x=Oe(c,ft);return b.createElement(X,{clipPath:o?"url(#clipPath-".concat(l,")"):null},b.createElement(re,F({},H(x,!0),{points:a,connectNulls:u,type:d,baseLine:n,layout:m,stroke:"none",className:"recharts-area-area"})),h!=="none"&&b.createElement(re,F({},H(this.props,!1),{className:"recharts-area-curve",layout:m,type:d,connectNulls:u,fill:"none",points:a})),h!=="none"&&p&&b.createElement(re,F({},H(this.props,!1),{className:"recharts-area-curve",layout:m,type:d,connectNulls:u,fill:"none",points:n})))}},{key:"renderAreaWithAnimation",value:function(a,n){var o=this,l=this.props,c=l.points,m=l.baseLine,d=l.isAnimationActive,h=l.animationBegin,u=l.animationDuration,p=l.animationEasing,x=l.animationId,N=this.state,k=N.prevPoints,y=N.prevBaseLine;return b.createElement(Qe,{begin:h,duration:u,isActive:d,easing:p,from:{t:0},to:{t:1},key:"area-".concat(x),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(P){var g=P.t;if(k){var S=k.length/c.length,v=c.map(function(w,E){var C=Math.floor(E*S);if(k[C]){var A=k[C],_=V(A.x,w.x),$=V(A.y,w.y);return R(R({},w),{},{x:_(g),y:$(g)})}return w}),f;if(W(m)&&typeof m=="number"){var j=V(y,m);f=j(g)}else if(fe(m)||Ze(m)){var O=V(y,0);f=O(g)}else f=m.map(function(w,E){var C=Math.floor(E*S);if(y[C]){var A=y[C],_=V(A.x,w.x),$=V(A.y,w.y);return R(R({},w),{},{x:_(g),y:$(g)})}return w});return o.renderAreaStatically(v,f,a,n)}return b.createElement(X,null,b.createElement("defs",null,b.createElement("clipPath",{id:"animationClipPath-".concat(n)},o.renderClipRect(g))),b.createElement(X,{clipPath:"url(#animationClipPath-".concat(n,")")},o.renderAreaStatically(c,m,a,n)))})}},{key:"renderArea",value:function(a,n){var o=this.props,l=o.points,c=o.baseLine,m=o.isAnimationActive,d=this.state,h=d.prevPoints,u=d.prevBaseLine,p=d.totalLength;return m&&l&&l.length&&(!h&&p>0||!ve(h,l)||!ve(u,c))?this.renderAreaWithAnimation(a,n):this.renderAreaStatically(l,c,a,n)}},{key:"render",value:function(){var a,n=this.props,o=n.hide,l=n.dot,c=n.points,m=n.className,d=n.top,h=n.left,u=n.xAxis,p=n.yAxis,x=n.width,N=n.height,k=n.isAnimationActive,y=n.id;if(o||!c||!c.length)return null;var P=this.state.isAnimationFinished,g=c.length===1,S=Ae("recharts-area",m),v=u&&u.allowDataOverflow,f=p&&p.allowDataOverflow,j=v||f,O=fe(y)?this.id:y,w=(a=H(l,!1))!==null&&a!==void 0?a:{r:3,strokeWidth:2},E=w.r,C=E===void 0?3:E,A=w.strokeWidth,_=A===void 0?2:A,$=Je(l)?l:{},G=$.clipDot,Y=G===void 0?!0:G,z=C*2+_;return b.createElement(X,{className:S},v||f?b.createElement("defs",null,b.createElement("clipPath",{id:"clipPath-".concat(O)},b.createElement("rect",{x:v?h:h-x/2,y:f?d:d-N/2,width:v?x:x*2,height:f?N:N*2})),!Y&&b.createElement("clipPath",{id:"clipPath-dots-".concat(O)},b.createElement("rect",{x:h-z/2,y:d-z/2,width:x+z,height:N+z}))):null,g?null:this.renderArea(j,O),(l||g)&&this.renderDots(j,Y,O),(!k||P)&&et.renderCallByParent(this.props,c))}}],[{key:"getDerivedStateFromProps",value:function(a,n){return a.animationId!==n.prevAnimationId?{prevAnimationId:a.animationId,curPoints:a.points,curBaseLine:a.baseLine,prevPoints:n.curPoints,prevBaseLine:n.curBaseLine}:a.points!==n.curPoints||a.baseLine!==n.curBaseLine?{curPoints:a.points,curBaseLine:a.baseLine}:null}}])})(T.PureComponent);Pe=I;D(I,"displayName","Area");D(I,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!at.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});D(I,"getBaseValue",function(t,s,r,a){var n=t.layout,o=t.baseValue,l=s.props.baseValue,c=l??o;if(W(c)&&typeof c=="number")return c;var m=n==="horizontal"?a:r,d=m.scale.domain();if(m.type==="number"){var h=Math.max(d[0],d[1]),u=Math.min(d[0],d[1]);return c==="dataMin"?u:c==="dataMax"||h<0?h:Math.max(Math.min(d[0],d[1]),0)}return c==="dataMin"?d[0]:c==="dataMax"?d[1]:d[0]});D(I,"getComposedData",function(t){var s=t.props,r=t.item,a=t.xAxis,n=t.yAxis,o=t.xAxisTicks,l=t.yAxisTicks,c=t.bandSize,m=t.dataKey,d=t.stackedData,h=t.dataStartIndex,u=t.displayedData,p=t.offset,x=s.layout,N=d&&d.length,k=Pe.getBaseValue(s,r,a,n),y=x==="horizontal",P=!1,g=u.map(function(v,f){var j;N?j=d[h+f]:(j=be(v,m),Array.isArray(j)?P=!0:j=[k,j]);var O=j[1]==null||N&&be(v,m)==null;return y?{x:ge({axis:a,ticks:o,bandSize:c,entry:v,index:f}),y:O?null:n.scale(j[1]),value:j,payload:v}:{x:O?null:a.scale(j[1]),y:ge({axis:n,ticks:l,bandSize:c,entry:v,index:f}),value:j,payload:v}}),S;return N||P?S=g.map(function(v){var f=Array.isArray(v.value)?v.value[0]:null;return y?{x:v.x,y:f!=null&&v.y!=null?n.scale(f):null}:{x:f!=null?a.scale(f):null,y:v.y}}):S=y?n.scale(k):a.scale(k),R({points:g,baseLine:S,layout:x,isRange:P},p)});D(I,"renderDotItem",function(t,s){var r;if(b.isValidElement(t))r=b.cloneElement(t,s);else if(ie(t))r=t(s);else{var a=Ae("recharts-area-dot",typeof t!="boolean"?t.className:""),n=s.key,o=Oe(s,vt);r=b.createElement(st,F({},o,{key:n,className:a}))}return r});var St=rt({chartName:"AreaChart",GraphicalChild:I,axisComponents:[{axisType:"xAxis",AxisComp:ke},{axisType:"yAxis",AxisComp:Se}],formatAxisMap:it});function Pt({children:t,className:s,spotlightColor:r="rgba(52, 211, 153, 0.15)"}){const a=T.useRef(null),[n,o]=T.useState({x:0,y:0}),[l,c]=T.useState(0);function m(d){if(!a.current)return;const h=a.current.getBoundingClientRect();o({x:d.clientX-h.left,y:d.clientY-h.top})}return e.jsxs("div",{ref:a,onMouseMove:m,onMouseEnter:()=>c(1),onMouseLeave:()=>c(0),className:De("relative overflow-hidden",s),children:[e.jsx("div",{className:"pointer-events-none absolute -inset-px opacity-0 transition-opacity duration-300",style:{opacity:l,background:`radial-gradient(600px circle at ${n.x}px ${n.y}px, ${r}, transparent 40%)`}}),t]})}const we=[12,25,50,100];function J({label:t,value:s,detail:r,accent:a,icon:n}){return e.jsxs(Pt,{className:"metric-card",children:[e.jsx("div",{className:`metric-orb ${a}`,children:n}),e.jsxs("div",{children:[e.jsx("div",{className:"hud-label",children:t}),e.jsx("div",{className:"mt-1 text-3xl font-semibold tracking-[-0.04em] text-white",children:s}),e.jsx("div",{className:"mt-1 text-sm text-slate-400",children:r})]})]})}function Mt(){const[t,s]=Le(),r=t.get("q")??"",a=T.useDeferredValue(r),n=t.get("provider")??"",o=t.get("status"),l=o==="ok"||o==="error"?o:"",c=Number(t.get("periodHours")??"24"),m=Number(t.get("pageSize")??"12"),d=we.includes(m)?m:12,h=Math.max(1,Number(t.get("page")??"1")||1),u=(h-1)*d,p=T.useMemo(()=>({limit:d,offset:u,q:a.trim()||void 0,provider:n||void 0,status:l||void 0,periodHours:he.some(i=>i.value===c)?c:24}),[a,d,u,c,n,l]),{data:x}=ae({queryKey:["stats",p.periodHours],queryFn:()=>Fe(p.periodHours??24)}),{data:N,isLoading:k}=ae({queryKey:["traces",p],queryFn:()=>qe(p)}),{data:y}=ae({queryKey:["insights"],queryFn:He,refetchInterval:6e4}),P=y?.insights??[],g=N?.traces??[],S=N?.total??0,v=Math.max(1,Math.ceil(S/d)),[f,j]=T.useState(null),[O,w]=T.useState("desc");function E(i){f===i?w(L=>L==="asc"?"desc":"asc"):(j(i),w("desc"))}const C=T.useMemo(()=>f?[...g].sort((i,L)=>{const U=i[f]??0,B=L[f]??0;return O==="asc"?U-B:B-U}):g,[g,f,O]),A=x?.byProvider[0],_=C[0],$=[...new Set(x?.byProvider.map(i=>i.provider)??[])],G=x?.costOverTime.map(i=>({time:Ve(i.timestamp),cost:i.cost}))??[],Y=x&&x.totalSpans>0?x.totalCost/x.totalSpans:0,z=r.length>0||n.length>0||l.length>0||p.periodHours!==24;function M(i,L=!0){s(U=>{const B=new URLSearchParams(U);for(const[oe,te]of Object.entries(i))te===void 0||te===""?B.delete(oe):B.set(oe,String(te));return L&&B.delete("page"),B},{replace:!0})}return e.jsxs(We,{eyebrow:"Flight Deck",title:"Read the behavior of every model call like a live system.",description:"The dashboard should act like an operator console. This version adds a real trace search surface, URL-synced filters, and paginated queue control.",aside:e.jsxs("div",{className:"insight-panel",children:[e.jsx(Be,{}),e.jsxs("div",{className:"mt-4 grid gap-3",children:[e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsx("div",{className:"hud-label",children:"Dominant provider"}),e.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[e.jsx("div",{className:"text-lg font-medium capitalize text-white",children:A?.provider??"Awaiting traffic"}),e.jsx(mt,{className:"h-4 w-4 text-sky-300"})]}),e.jsx("div",{className:"mt-1 text-sm text-slate-400",children:A?`${A.spanCount} calls, ${q(A.totalCost)} spend`:"No provider activity yet"})]}),e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsx("div",{className:"hud-label",children:"Latest trace"}),e.jsx("div",{className:"mt-2 text-base font-medium text-white",children:_?.name??"No recent traces"}),e.jsx("div",{className:"mt-1 text-sm text-slate-400",children:_?`${me(_.startTime)} / ${_.spanCount} spans`:"Start sending spans to populate the deck"})]})]})]}),children:[e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-4",children:[e.jsx(J,{label:"Trace Volume",value:se(x?.totalTraces??0),detail:`${x?.totalSpans??0} spans in window`,icon:e.jsx(Te,{className:"h-5 w-5"}),accent:"bg-[linear-gradient(135deg,rgba(52,211,153,0.18),rgba(14,165,233,0.18))] text-emerald-200"}),e.jsx(J,{label:"Token Throughput",value:se(x?.totalTokens??0),detail:"Token load across the active filter window",icon:e.jsx(Ee,{className:"h-5 w-5"}),accent:"bg-[linear-gradient(135deg,rgba(56,189,248,0.18),rgba(168,85,247,0.18))] text-sky-200"}),e.jsx(J,{label:"Spend Velocity",value:q(x?.totalCost??0),detail:`${q(Y)} average cost per call`,icon:e.jsx(Z,{className:"h-5 w-5"}),accent:"bg-[linear-gradient(135deg,rgba(251,191,36,0.18),rgba(249,115,22,0.18))] text-amber-200"}),e.jsx(J,{label:"Risk Surface",value:`${Math.round((x?.errorRate??0)*100)}%`,detail:`${x?.errorCount??0} failing calls`,icon:e.jsx(ye,{className:"h-5 w-5"}),accent:"bg-[linear-gradient(135deg,rgba(244,63,94,0.18),rgba(168,85,247,0.18))] text-rose-200"})]}),e.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1.5fr)_minmax(320px,0.95fr)]",children:[e.jsxs("section",{className:"dashboard-shell rounded-[26px] px-5 py-5 sm:px-6",children:[e.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"hud-label",children:"Economic pulse"}),e.jsx("h2",{className:"mt-1 text-xl font-semibold tracking-[-0.04em] text-white",children:"Cost gradient"})]}),e.jsxs("div",{className:"status-chip",children:[e.jsx(dt,{className:"h-3.5 w-3.5 text-sky-300"}),e.jsxs("span",{children:[p.periodHours,"h window"]})]})]}),G.length>0?e.jsx(nt,{width:"100%",height:320,children:e.jsxs(St,{data:G,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"dashboardCostFill",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"#34d399",stopOpacity:.35}),e.jsx("stop",{offset:"100%",stopColor:"#38bdf8",stopOpacity:0})]})}),e.jsx(lt,{stroke:"rgba(148,163,184,0.08)",vertical:!1}),e.jsx(ke,{dataKey:"time",tick:{fontSize:11,fill:"#94a3b8"},axisLine:!1,tickLine:!1}),e.jsx(Se,{tick:{fontSize:11,fill:"#94a3b8"},axisLine:!1,tickLine:!1,width:54}),e.jsx(ot,{contentStyle:ct,formatter:i=>[q(i),"Cost"]}),e.jsx(I,{type:"monotone",dataKey:"cost",stroke:"#34d399",fill:"url(#dashboardCostFill)",strokeWidth:2.6,dot:!1})]})}):e.jsxs("div",{className:"empty-state h-[320px]",children:[e.jsx(Z,{className:"h-8 w-8 text-slate-500"}),e.jsx("div",{className:"text-base font-medium text-white",children:"No cost movement yet"})]})]}),e.jsxs("section",{className:"dashboard-shell rounded-[26px] px-5 py-5 sm:px-6",children:[e.jsxs("div",{className:"mb-5",children:[e.jsx("div",{className:"hud-label",children:"Provider pressure"}),e.jsx("h2",{className:"mt-1 text-xl font-semibold tracking-[-0.04em] text-white",children:"Allocation by provider"})]}),e.jsx("div",{className:"space-y-4",children:(x?.byProvider??[]).map(i=>{const L=(x?.totalCost??0)>0?i.totalCost/(x?.totalCost??1)*100:0;return e.jsxs("div",{className:"rounded-2xl border border-white/6 bg-white/4 p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium capitalize text-white",children:i.provider}),e.jsxs("div",{className:"text-xs text-slate-400",children:[i.spanCount," calls / ",se(i.totalTokens)," tokens"]})]}),e.jsxs("div",{className:"text-right",children:[e.jsx("div",{className:"text-sm font-medium text-white",children:q(i.totalCost)}),e.jsx("div",{className:"text-xs text-slate-500",children:de(i.avgDuration)})]})]}),e.jsx("div",{className:"mt-3 h-2 overflow-hidden rounded-full bg-slate-900/80",children:e.jsx(Me.div,{className:"h-full w-full origin-left rounded-full bg-[linear-gradient(90deg,#34d399,#38bdf8)]",initial:{scaleX:0},animate:{scaleX:Math.max(L,4)/100},transition:{duration:.5,ease:"easeOut"}})})]},i.provider)})})]})]}),e.jsxs("div",{className:"grid gap-5 xl:grid-cols-[minmax(0,1.45fr)_minmax(320px,0.85fr)]",children:[e.jsxs("section",{className:"dashboard-shell rounded-[26px] px-4 py-4 sm:px-5 sm:py-5",children:[e.jsxs("div",{className:"mb-4 rounded-[24px] border border-white/8 bg-[linear-gradient(180deg,rgba(7,14,26,0.95),rgba(4,8,18,0.98))] p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"hud-label",children:"Search console"}),e.jsx("h2",{className:"mt-1 text-xl font-semibold tracking-[-0.04em] text-white",children:"Trace dispatch queue"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"status-chip",children:[S," matches"]}),e.jsxs("button",{type:"button",onClick:()=>M({q:void 0,provider:void 0,status:void 0,periodHours:void 0}),disabled:!z,className:"status-chip transition-colors hover:border-white/16 hover:bg-white/8 disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx(Re,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Clear"})]})]})]}),e.jsxs("div",{className:"mt-4 grid gap-3 xl:grid-cols-[minmax(0,1.7fr)_repeat(3,minmax(0,0.7fr))]",children:[e.jsxs("label",{className:"relative block",children:[e.jsx(Ie,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-slate-500"}),e.jsx("input",{value:r,onChange:i=>M({q:i.target.value||void 0}),placeholder:"Search traces, models, providers, errors",className:"w-full rounded-2xl border border-white/8 bg-white/4 py-3 pl-10 pr-4 text-sm text-white placeholder:text-slate-500 focus:border-emerald-400/30 focus:bg-white/6 focus:outline-none"})]}),e.jsxs("select",{value:n,onChange:i=>M({provider:i.target.value||void 0}),className:"w-full rounded-2xl border border-white/8 bg-white/4 px-4 py-3 text-sm text-white focus:border-sky-400/30 focus:bg-white/6 focus:outline-none",children:[e.jsx("option",{value:"",children:"All providers"}),$.map(i=>e.jsx("option",{value:i,children:i},i))]}),e.jsxs("select",{value:l,onChange:i=>M({status:i.target.value||void 0}),className:"w-full rounded-2xl border border-white/8 bg-white/4 px-4 py-3 text-sm text-white focus:border-emerald-400/30 focus:bg-white/6 focus:outline-none",children:[e.jsx("option",{value:"",children:"All states"}),e.jsx("option",{value:"ok",children:"Healthy only"}),e.jsx("option",{value:"error",children:"Errors only"})]}),e.jsx("select",{value:String(p.periodHours??24),onChange:i=>M({periodHours:Number(i.target.value)===24?void 0:Number(i.target.value)}),className:"w-full rounded-2xl border border-white/8 bg-white/4 px-4 py-3 text-sm text-white focus:border-amber-400/30 focus:bg-white/6 focus:outline-none",children:he.map(i=>e.jsx("option",{value:i.value,children:i.label},i.value))})]})]}),k?e.jsx("div",{className:"empty-state h-[280px] text-slate-500",children:"Loading trace queue..."}):C.length===0&&!z?e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-6 sm:p-8",children:[e.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[e.jsx(ue,{className:"h-10 w-10 text-amber-400/60"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-lg font-semibold text-white",children:"No traces recorded yet"}),e.jsx("p",{className:"mt-1 text-sm text-slate-400",children:"Get started in 3 steps — takes under a minute."})]})]}),e.jsxs("div",{className:"mx-auto mt-6 flex max-w-3xl flex-col gap-4",children:[e.jsxs("div",{className:"rounded-xl border border-white/6 bg-white/3 p-4",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[e.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-amber-400/20 text-[10px] font-bold text-amber-400",children:"1"}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-amber-400",children:"Install the SDK"})]}),e.jsx("pre",{className:"overflow-x-auto rounded-lg bg-black/40 p-3 text-sm leading-relaxed text-green-400 select-all",children:"npm install @llmtap/sdk"})]}),e.jsxs("div",{className:"rounded-xl border border-white/6 bg-white/3 p-4",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[e.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-amber-400/20 text-[10px] font-bold text-amber-400",children:"2"}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-amber-400",children:"Wrap your client & use normally"})]}),e.jsx("pre",{className:"overflow-x-auto rounded-lg bg-black/40 p-3 text-sm leading-relaxed text-green-400 select-all whitespace-pre",children:`import { wrap } from "@llmtap/sdk";
|
|
2
|
-
import OpenAI from "openai";
|
|
3
|
-
|
|
4
|
-
const client = wrap(new OpenAI());
|
|
5
|
-
|
|
6
|
-
const res = await client.chat.completions.create({
|
|
7
|
-
model: "gpt-4o-mini",
|
|
8
|
-
messages: [{ role: "user", content: "Hello!" }],
|
|
9
|
-
});`})]}),e.jsxs("div",{className:"rounded-xl border border-white/6 bg-white/3 p-4",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[e.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-amber-400/20 text-[10px] font-bold text-amber-400",children:"3"}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-amber-400",children:"Start the collector"})]}),e.jsx("pre",{className:"overflow-x-auto rounded-lg bg-black/40 p-3 text-sm leading-relaxed text-green-400 select-all",children:"npx llmtap"}),e.jsx("p",{className:"mt-2 text-xs text-slate-500",children:"Run your app and traces will appear here automatically."})]})]}),e.jsx("div",{className:"mx-auto mt-4 max-w-3xl rounded-lg border border-white/4 bg-white/2 px-4 py-2.5",children:e.jsxs("p",{className:"text-center text-xs text-slate-500",children:["Works with ",e.jsx("span",{className:"text-slate-400",children:"OpenAI"}),", ",e.jsx("span",{className:"text-slate-400",children:"Anthropic"}),", ",e.jsx("span",{className:"text-slate-400",children:"Google Gemini"}),", ",e.jsx("span",{className:"text-slate-400",children:"DeepSeek"}),", ",e.jsx("span",{className:"text-slate-400",children:"Groq"}),", ",e.jsx("span",{className:"text-slate-400",children:"Together"}),", ",e.jsx("span",{className:"text-slate-400",children:"Fireworks"}),", ",e.jsx("span",{className:"text-slate-400",children:"OpenRouter"}),", and any OpenAI-compatible provider."]})})]}):C.length===0?e.jsxs("div",{className:"empty-state h-[280px]",children:[e.jsx(ue,{className:"h-8 w-8 text-slate-500"}),e.jsx("div",{className:"text-base font-medium text-white",children:"No traces match these filters"})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full border-separate border-spacing-y-2 text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-[11px] uppercase tracking-[0.18em] text-slate-500",children:[e.jsx("th",{className:"px-4 py-2",children:"State"}),e.jsx("th",{className:"px-4 py-2",children:"Trace"}),[["spanCount","Spans"],["totalTokens","Tokens"],["totalCost","Cost"],["startTime","When"]].map(([i,L])=>e.jsx("th",{className:"px-4 py-2 text-right",children:e.jsxs("button",{type:"button",onClick:()=>E(i),className:"inline-flex items-center gap-1 transition-colors hover:text-slate-300",children:[L,f===i?O==="asc"?e.jsx(Ye,{className:"h-3 w-3"}):e.jsx(Ke,{className:"h-3 w-3"}):e.jsx(Ue,{className:"h-3 w-3 opacity-30"})]})},i))]})}),e.jsx("tbody",{children:C.map(i=>e.jsxs("tr",{className:"rounded-2xl border border-white/6 bg-white/4",children:[e.jsx("td",{className:"rounded-l-2xl px-4 py-4",children:e.jsx(Ge,{status:i.status})}),e.jsx("td",{className:"px-4 py-4",children:e.jsxs($e,{to:`/trace/${i.traceId}`,className:"group inline-flex max-w-[380px] flex-col gap-1 text-sm font-medium text-white transition-colors hover:text-emerald-300",children:[e.jsxs("span",{className:"inline-flex items-center gap-2",children:[e.jsx("span",{className:"truncate",children:i.name}),e.jsx(xe,{className:"h-3.5 w-3.5 opacity-0 transition-all group-hover:translate-x-0.5 group-hover:opacity-100"})]}),e.jsxs("span",{className:"font-mono text-[10px] uppercase tracking-[0.16em] text-slate-500",children:[i.traceId.slice(0,12),i.totalDuration?` / ${de(i.totalDuration)}`:""]})]})}),e.jsx("td",{className:"px-4 py-4 text-right font-mono text-xs text-slate-300",children:i.spanCount}),e.jsx("td",{className:"px-4 py-4 text-right font-mono text-xs text-slate-300",children:i.totalTokens.toLocaleString()}),e.jsx("td",{className:"px-4 py-4 text-right font-mono text-xs text-slate-300",children:q(i.totalCost)}),e.jsx("td",{className:"rounded-r-2xl px-4 py-4 text-right text-xs text-slate-500",children:me(i.startTime)})]},i.traceId))})]})}),e.jsxs("div",{className:"mt-4 flex items-center justify-between gap-3 px-1",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"text-xs text-slate-500",children:S>0?`Showing ${u+1}-${Math.min(u+C.length,S)} of ${S}`:"Awaiting traces"}),e.jsx("select",{value:String(d),onChange:i=>M({pageSize:Number(i.target.value)===12?void 0:Number(i.target.value)}),className:"rounded-xl border border-white/8 bg-white/4 px-2 py-1.5 text-xs text-slate-300 focus:border-emerald-400/30 focus:outline-none",children:we.map(i=>e.jsxs("option",{value:i,children:[i," / page"]},i))})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(pe,{variant:"outline",size:"sm",onClick:()=>M({page:h>2?h-1:void 0},!1),disabled:h<=1,children:[e.jsx(Xe,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Previous"})]}),e.jsxs(pe,{variant:"outline",size:"sm",onClick:()=>M({page:h+1},!1),disabled:h>=v,children:[e.jsx("span",{children:"Next"}),e.jsx(xe,{className:"h-3.5 w-3.5"})]})]})]})]})]}),e.jsxs("section",{className:"dashboard-shell rounded-[26px] px-5 py-5",children:[e.jsxs("div",{className:"mb-5",children:[e.jsx("div",{className:"hud-label",children:"Intelligence layer"}),e.jsx("h2",{className:"mt-1 text-xl font-semibold tracking-[-0.04em] text-white",children:"Insights"})]}),e.jsx("div",{className:"space-y-4",children:P.length>0?P.map(i=>e.jsxs("div",{className:`rounded-2xl border p-4 ${i.severity==="critical"?"border-rose-400/20 bg-rose-500/8":i.severity==="warning"?"border-amber-400/20 bg-amber-500/8":"border-white/6 bg-white/4"}`,children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-white",children:[i.type==="cost_anomaly"&&e.jsx(ce,{className:"h-4 w-4 text-amber-300"}),i.type==="error_pattern"&&e.jsx(ye,{className:"h-4 w-4 text-rose-300"}),i.type==="model_recommendation"&&e.jsx(ut,{className:"h-4 w-4 text-sky-300"}),i.type==="token_waste"&&e.jsx(Z,{className:"h-4 w-4 text-purple-300"}),i.title]}),i.metric&&e.jsx("span",{className:"shrink-0 rounded-full border border-white/10 bg-white/6 px-2 py-0.5 text-[10px] font-mono text-slate-400",children:i.metric})]}),e.jsx("p",{className:"text-sm leading-6 text-slate-400",children:i.description})]},i.id)):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"rounded-2xl border border-white/6 bg-white/4 p-4",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2 text-sm font-medium text-white",children:[e.jsx(ze,{className:"h-4 w-4 text-sky-300"}),"Health read"]}),e.jsx("p",{className:"text-sm leading-6 text-slate-400",children:(x?.errorRate??0)>.05?"Error rate is elevated. Start with the most recent failed trace and inspect provider or tool payloads.":"Error pressure is currently low. Use this window to compare provider cost drift and latency patterns."})]}),e.jsxs("div",{className:"rounded-2xl border border-white/6 bg-white/4 p-4",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2 text-sm font-medium text-white",children:[e.jsx(Z,{className:"h-4 w-4 text-emerald-300"}),"Spend insight"]}),e.jsx("p",{className:"text-sm leading-6 text-slate-400",children:A?`${A.provider} currently leads cost share. If that is unexpected, inspect the filtered queue for bursty workflows.`:"Provider concentration will appear here once traces land."})]}),e.jsxs("div",{className:"rounded-2xl border border-white/6 bg-white/4 p-4",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2 text-sm font-medium text-white",children:[e.jsx(ce,{className:"h-4 w-4 text-amber-300"}),"Queue focus"]}),e.jsx("p",{className:"text-sm leading-6 text-slate-400",children:_?`Latest traffic is "${_.name}". Open it to inspect hierarchy, timing, and payload shape.`:"No active traces yet. Generate a request through an instrumented client to validate the pipeline."})]})]})})]})]})]})}export{Mt as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,m as a,C as v,f as g,g as w}from"./index-M3DwcRrc.js";import{u as k,P as C,a as d,b as i,c as l}from"./format-CNuIwzac.js";import{R as o,o as c,X as x,Y as m,T as h,t as p,N as j}from"./chart-styles-BD7W97c9.js";import{a as y}from"./provider-colors-DcHYMgVv.js";import{L}from"./layers-BQ0MpYqk.js";import{C as S}from"./clock-BEYeaSdD.js";import{B as f}from"./BarChart-C6HDCruv.js";import{G as M}from"./gauge-CfqhcKwk.js";function q(){const{data:u,isLoading:N}=k({queryKey:["stats",168],queryFn:()=>w(168)}),s=u?.byModel??[],r=s.map(t=>({name:t.model.length>20?`${t.model.slice(0,18)}...`:t.model,p50:t.avgDuration})),n=s.map(t=>({name:t.model.length>20?`${t.model.slice(0,18)}...`:t.model,tokens:t.totalTokens}));return N?e.jsxs("div",{className:"mx-auto max-w-[1500px] space-y-8",children:[e.jsx("div",{className:"skeleton-panel h-44 rounded-[28px]"}),e.jsx("div",{className:"skeleton-panel h-80 rounded-[24px]"})]}):e.jsx(C,{eyebrow:"Model Intelligence",title:"Every model. Every metric. One surface.",description:"Compare cost, token volume, latency, and call frequency across all models in your rotation. Identify the models consuming the most budget and the ones delivering the best performance.",aside:e.jsxs("div",{className:"insight-panel",children:[e.jsx(g,{}),e.jsxs("div",{className:"mt-4 space-y-3",children:[e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsx("div",{className:"hud-label",children:"Models active"}),e.jsx("div",{className:"mt-2 text-lg font-medium text-white",children:s.length}),e.jsxs("div",{className:"mt-1 text-sm text-slate-400",children:["Across ",new Set(s.map(t=>t.provider)).size," providers"]})]}),e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsx("div",{className:"hud-label",children:"Highest cost model"}),e.jsx("div",{className:"mt-2 text-base font-medium text-white",children:s[0]?.model??"No data"}),e.jsx("div",{className:"mt-1 text-sm text-slate-400",children:s[0]?i(s[0].totalCost):"-"})]})]})]}),children:s.length>0?e.jsxs(e.Fragment,{children:[e.jsxs(a.div,{className:"dashboard-shell overflow-hidden rounded-[26px] px-4 py-4 sm:px-5",initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.35},children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3 px-1",children:[e.jsxs("div",{children:[e.jsx("div",{className:"hud-label",children:"Model roster"}),e.jsx("h2",{className:"mt-1 text-xl font-semibold tracking-[-0.04em] text-white",children:"Performance by model"})]}),e.jsxs("span",{className:"status-chip",children:[e.jsx(L,{className:"h-3.5 w-3.5 text-sky-300"}),e.jsxs("span",{children:[s.length," models"]})]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full border-separate border-spacing-y-2 text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-[11px] uppercase tracking-[0.18em] text-slate-500",children:[e.jsx("th",{className:"px-4 py-2",children:"Model"}),e.jsx("th",{className:"px-4 py-2",children:"Provider"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Calls"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Tokens"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Cost"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Avg Latency"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Cost/Call"})]})}),e.jsx("tbody",{children:s.map((t,b)=>e.jsxs(a.tr,{className:"rounded-2xl border border-white/6 bg-white/4",initial:{opacity:0,x:-8},animate:{opacity:1,x:0},transition:{delay:.03*b,duration:.3},children:[e.jsx("td",{className:"rounded-l-2xl px-4 py-4",children:e.jsx("div",{className:"font-mono text-xs font-semibold text-slate-100",children:t.model})}),e.jsx("td",{className:"px-4 py-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:y[t.provider]??"#a855f6",boxShadow:`0 0 10px ${y[t.provider]??"#a855f6"}`}}),e.jsx("span",{className:"text-xs font-medium capitalize text-slate-200",children:t.provider})]})}),e.jsx("td",{className:"px-4 py-4 text-right",children:e.jsx("span",{className:"inline-flex items-center justify-center rounded-md border border-white/8 bg-slate-950/70 px-2 py-0.5 font-mono text-xs text-slate-400",children:t.spanCount})}),e.jsx("td",{className:"px-4 py-4 text-right font-mono text-xs text-slate-300",children:d(t.totalTokens)}),e.jsx("td",{className:"px-4 py-4 text-right font-mono text-xs font-semibold text-white",children:i(t.totalCost)}),e.jsx("td",{className:"px-4 py-4 text-right font-mono text-xs text-slate-400",children:t.avgDuration?l(t.avgDuration):"-"}),e.jsx("td",{className:"rounded-r-2xl px-4 py-4 text-right font-mono text-xs text-slate-500",children:t.spanCount>0?i(t.totalCost/t.spanCount):"-"})]},`${t.provider}-${t.model}`))})]})})]}),e.jsxs("div",{className:"grid gap-5 xl:grid-cols-2",children:[e.jsxs(a.div,{className:"dashboard-shell rounded-[26px] px-5 py-5",initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{delay:.1,duration:.35},children:[e.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"hud-label",children:"Latency profile"}),e.jsx("h2",{className:"mt-1 text-xl font-semibold tracking-[-0.04em] text-white",children:"Average latency by model"})]}),e.jsx(S,{className:"h-4 w-4 text-sky-300"})]}),e.jsx(o,{width:"100%",height:Math.max(280,r.length*52),children:e.jsxs(f,{data:r,layout:"vertical",children:[e.jsx(c,{stroke:"rgba(148,163,184,0.08)",horizontal:!1}),e.jsx(x,{type:"number",tick:{fontSize:11,fill:"#94a3b8"},axisLine:!1,tickLine:!1,tickFormatter:t=>l(t)}),e.jsx(m,{type:"category",dataKey:"name",tick:{fontSize:11,fill:"#cbd5e1"},axisLine:!1,tickLine:!1,width:150}),e.jsx(h,{contentStyle:p,formatter:t=>[l(t),"Avg latency"]}),e.jsx(j,{dataKey:"p50",fill:"#38bdf8",radius:[0,10,10,0]})]})})]}),e.jsxs(a.div,{className:"dashboard-shell rounded-[26px] px-5 py-5",initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{delay:.15,duration:.35},children:[e.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"hud-label",children:"Token distribution"}),e.jsx("h2",{className:"mt-1 text-xl font-semibold tracking-[-0.04em] text-white",children:"Token volume by model"})]}),e.jsx(v,{className:"h-4 w-4 text-emerald-300"})]}),e.jsx(o,{width:"100%",height:Math.max(280,n.length*52),children:e.jsxs(f,{data:n,layout:"vertical",children:[e.jsx(c,{stroke:"rgba(148,163,184,0.08)",horizontal:!1}),e.jsx(x,{type:"number",tick:{fontSize:11,fill:"#94a3b8"},axisLine:!1,tickLine:!1,tickFormatter:t=>d(t)}),e.jsx(m,{type:"category",dataKey:"name",tick:{fontSize:11,fill:"#cbd5e1"},axisLine:!1,tickLine:!1,width:150}),e.jsx(h,{contentStyle:p,formatter:t=>[t.toLocaleString(),"Tokens"]}),e.jsx(j,{dataKey:"tokens",fill:"#34d399",radius:[0,10,10,0]})]})})]})]})]}):e.jsx("div",{className:"dashboard-shell rounded-[26px] p-16",children:e.jsxs("div",{className:"empty-state",children:[e.jsx(M,{className:"h-8 w-8 text-slate-500"}),e.jsx("div",{className:"text-base font-medium text-white",children:"No models tracked yet"}),e.jsx("div",{className:"max-w-sm text-center text-sm text-slate-400",children:"Start sending traced API calls and model metrics will populate automatically."})]})})})}export{q as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{c as h,j as e,m as l,M as n,T as p,f as j,t as u}from"./index-M3DwcRrc.js";import{u as N,P as y,a as g,b as o,d as x}from"./format-CNuIwzac.js";const f=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],b=h("users",f);function k(){const{data:r,isLoading:d}=N({queryKey:["sessions"],queryFn:()=>u(168)}),a=r?.sessions??[],i=r?.total??0,c=a.reduce((s,t)=>s+t.totalCost,0),m=a.reduce((s,t)=>s+t.traceCount,0);return d?e.jsxs("div",{className:"mx-auto max-w-[1500px] space-y-8",children:[e.jsx("div",{className:"skeleton-panel h-44 rounded-[28px]"}),e.jsx("div",{className:"skeleton-panel h-80 rounded-[24px]"})]}):e.jsx(y,{eyebrow:"Session Fabric",title:"Multi-turn conversations, grouped and measured.",description:"Sessions collect related traces into logical units. Track total cost and token volume across entire user conversations, multi-step agent runs, or workflow pipelines.",aside:e.jsxs("div",{className:"insight-panel",children:[e.jsx(j,{}),e.jsxs("div",{className:"mt-4 space-y-3",children:[e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsx("div",{className:"hud-label",children:"Active sessions"}),e.jsx("div",{className:"mt-2 text-lg font-medium text-white",children:i}),e.jsxs("div",{className:"mt-1 text-sm text-slate-400",children:[m," traces across all sessions"]})]}),e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsx("div",{className:"hud-label",children:"Session spend"}),e.jsx("div",{className:"mt-2 text-base font-medium text-white",children:o(c)}),e.jsx("div",{className:"mt-1 text-sm text-slate-400",children:"Combined cost across visible sessions"})]})]})]}),children:a.length>0?e.jsxs(l.div,{className:"dashboard-shell overflow-hidden rounded-[26px] px-4 py-4 sm:px-5",initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.35},children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3 px-1",children:[e.jsxs("div",{children:[e.jsx("div",{className:"hud-label",children:"Session registry"}),e.jsx("h2",{className:"mt-1 text-xl font-semibold tracking-[-0.04em] text-white",children:"Tracked sessions"})]}),e.jsxs("span",{className:"status-chip",children:[e.jsx(b,{className:"h-3.5 w-3.5 text-sky-300"}),e.jsxs("span",{children:[i," sessions"]})]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full border-separate border-spacing-y-2 text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"text-left text-[11px] uppercase tracking-[0.18em] text-slate-500",children:[e.jsx("th",{className:"px-4 py-2",children:"Session ID"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Traces"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Spans"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Tokens"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Cost"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Errors"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"First Seen"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Last Active"})]})}),e.jsx("tbody",{children:a.map((s,t)=>e.jsxs(l.tr,{className:"rounded-2xl border border-white/6 bg-white/4",initial:{opacity:0,x:-8},animate:{opacity:1,x:0},transition:{delay:.03*t,duration:.3},children:[e.jsx("td",{className:"rounded-l-2xl px-4 py-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(n,{className:"h-4 w-4 text-sky-300"}),e.jsx("span",{className:"font-mono text-xs font-semibold text-slate-100",children:s.sessionId.length>28?`${s.sessionId.slice(0,26)}...`:s.sessionId})]})}),e.jsx("td",{className:"px-4 py-4 text-right font-mono text-xs text-slate-300",children:s.traceCount}),e.jsx("td",{className:"px-4 py-4 text-right font-mono text-xs text-slate-300",children:s.spanCount}),e.jsx("td",{className:"px-4 py-4 text-right font-mono text-xs text-slate-300",children:g(s.totalTokens)}),e.jsx("td",{className:"px-4 py-4 text-right font-mono text-xs font-semibold text-white",children:o(s.totalCost)}),e.jsx("td",{className:"px-4 py-4 text-right",children:s.errorCount>0?e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-rose-400/20 bg-rose-400/10 px-2 py-0.5 text-[10px] font-bold text-rose-300",children:[e.jsx(p,{className:"h-3 w-3"}),s.errorCount]}):e.jsx("span",{className:"font-mono text-xs text-slate-500",children:"0"})}),e.jsx("td",{className:"px-4 py-4 text-right text-xs text-slate-500",children:x(s.firstSeen)}),e.jsx("td",{className:"rounded-r-2xl px-4 py-4 text-right text-xs text-slate-500",children:x(s.lastSeen)})]},s.sessionId))})]})})]}):e.jsx("div",{className:"dashboard-shell rounded-[26px] p-16",children:e.jsxs("div",{className:"empty-state",children:[e.jsx(n,{className:"h-8 w-8 text-slate-500"}),e.jsx("div",{className:"text-base font-medium text-white",children:"No sessions tracked yet"}),e.jsxs("div",{className:"max-w-md text-center text-sm text-slate-400",children:["Sessions appear when you pass a ",e.jsx("code",{className:"rounded bg-white/8 px-1.5 py-0.5 font-mono text-emerald-300",children:"sessionId"})," to the SDK. This groups related traces into logical conversations or workflows."]}),e.jsx("pre",{className:"mt-4 max-w-lg rounded-2xl border border-white/8 bg-white/4 p-4 text-left font-mono text-xs text-slate-300",children:`import { init } from "@llmtap/sdk";
|
|
2
|
-
|
|
3
|
-
init({ sessionId: "user-session-123" });`})]})})})}export{k as default};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{c as h,v as Y,r as a,j as e,m as x,w as Z,D as ee,X as B,x as te,y as se,z as ae,f as ne,B as le,E as re,F as oe}from"./index-M3DwcRrc.js";import{u as ie,P as de,d as U}from"./format-CNuIwzac.js";import{C as f,a as ce,D as w}from"./download-B-39NUBC.js";const xe=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],pe=h("database",xe);const me=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],he=h("info",me);const ue=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],be=h("plus",ue);const ye=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],ge=h("send",ye);const je=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],fe=h("timer",je);const we=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],ve=h("trash-2",we);function z(o){if(o===0)return"0 B";const i=["B","KB","MB","GB"],d=Math.min(Math.floor(Math.log(o)/Math.log(1024)),i.length-1);return`${(o/Math.pow(1024,d)).toFixed(d===0?0:1)} ${i[d]}`}function u({label:o,value:i,mono:d}){return e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-2xl border border-white/6 bg-white/4 px-4 py-3",children:[e.jsx("span",{className:"text-sm text-slate-400",children:o}),e.jsx("span",{className:`text-sm font-medium text-white ${d?"font-mono":""}`,children:i})]})}function Se(){const o=Y(),[i,d]=a.useState(!1),[J,M]=a.useState(!1),[b,P]=a.useState(!1),[K,$]=a.useState(null),[y,E]=a.useState([]),[Q,v]=a.useState(!1),[l,p]=a.useState({provider:"",model:"",inputCostPer1M:"",outputCostPer1M:""}),[g,V]=a.useState("30"),[q,D]=a.useState(!1),[N,O]=a.useState(null),[R,T]=a.useState(!1),[k,G]=a.useState(""),[C,H]=a.useState("llmtap"),[A,L]=a.useState(!1),[S,j]=a.useState(null),[I,_]=a.useState(!1),{data:n}=ie({queryKey:["db-info"],queryFn:oe});async function W(){if(confirm("Delete all trace data? This cannot be undone.")){d(!0);try{await le(),M(!0),o.invalidateQueries(),setTimeout(()=>M(!1),3e3)}catch(t){alert(`Reset failed: ${t instanceof Error?t.message:String(t)}`)}finally{d(!1)}}}async function F(t){P(!0);try{const s=await re(t),m=new Blob([s],{type:t==="json"?"application/json":"text/csv"}),r=URL.createObjectURL(m),c=document.createElement("a");c.href=r,c.download=`llmtap-traces-${new Date().toISOString().slice(0,10)}.${t}`,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(r)}catch(s){alert(`Export failed: ${s instanceof Error?s.message:String(s)}`)}finally{P(!1)}}function X(t,s){navigator.clipboard.writeText(t).catch(()=>{}),$(s),setTimeout(()=>$(null),2e3)}return e.jsx(de,{eyebrow:"Control Panel",title:"Configure, export, and manage your local collector.",description:"Database status, data export, and maintenance controls. Everything runs locally on your machine — your data never leaves.",aside:e.jsxs("div",{className:"insight-panel",children:[e.jsx(ne,{}),e.jsx("div",{className:"mt-4 space-y-3",children:e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsx("div",{className:"hud-label",children:"Database"}),e.jsx("div",{className:"mt-2 text-lg font-medium text-white",children:n?z(n.sizeBytes):"..."}),e.jsxs("div",{className:"mt-1 text-sm text-slate-400",children:[n?.spanCount??0," spans stored"]})]})})]}),children:e.jsxs("div",{className:"grid gap-5 xl:grid-cols-2",children:[e.jsxs(x.div,{className:"dashboard-shell rounded-[26px] px-5 py-5",initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.35},children:[e.jsxs("div",{className:"mb-5 flex items-center gap-2",children:[e.jsx(pe,{className:"h-4 w-4 text-sky-300"}),e.jsx("h2",{className:"text-xl font-semibold tracking-[-0.04em] text-white",children:"Database status"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{label:"Size on disk",value:n?z(n.sizeBytes):"-"}),e.jsx(u,{label:"Total spans",value:String(n?.spanCount??0),mono:!0}),e.jsx(u,{label:"Total traces",value:String(n?.traceCount??0),mono:!0}),e.jsx(u,{label:"Journal mode",value:n?.walMode?.toUpperCase()??"-",mono:!0}),e.jsx(u,{label:"Data range",value:n?.oldestSpan&&n?.newestSpan?`${U(n.oldestSpan)} to ${U(n.newestSpan)}`:"No data"}),e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-2xl border border-white/6 bg-white/4 px-4 py-3",children:[e.jsx("span",{className:"text-sm text-slate-400",children:"Storage path"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"max-w-[220px] truncate font-mono text-xs text-slate-300",children:n?.path??"-"}),n?.path&&e.jsx("button",{type:"button",onClick:()=>X(n.path,"path"),className:"rounded-lg border border-white/8 bg-white/4 p-1.5 text-slate-400 transition-colors hover:text-white",children:K==="path"?e.jsx(f,{className:"h-3 w-3 text-emerald-300"}):e.jsx(ce,{className:"h-3 w-3"})})]})]})]})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs(x.div,{className:"dashboard-shell rounded-[26px] px-5 py-5",initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{delay:.1,duration:.35},children:[e.jsxs("div",{className:"mb-5 flex items-center gap-2",children:[e.jsx(w,{className:"h-4 w-4 text-emerald-300"}),e.jsx("h2",{className:"text-xl font-semibold tracking-[-0.04em] text-white",children:"Export data"})]}),e.jsx("p",{className:"mb-4 text-sm text-slate-400",children:"Download all trace data for offline analysis, backup, or migration."}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("button",{type:"button",onClick:()=>F("json"),disabled:b,className:"status-chip transition-colors hover:border-white/16 hover:bg-white/8 disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx(w,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:b?"Exporting...":"Export JSON"})]}),e.jsxs("button",{type:"button",onClick:()=>F("csv"),disabled:b,className:"status-chip transition-colors hover:border-white/16 hover:bg-white/8 disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx(w,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:b?"Exporting...":"Export CSV"})]})]})]}),e.jsxs(x.div,{className:"dashboard-shell rounded-[26px] px-5 py-5",initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{delay:.15,duration:.35},children:[e.jsxs("div",{className:"mb-5 flex items-center gap-2",children:[e.jsx(ve,{className:"h-4 w-4 text-rose-300"}),e.jsx("h2",{className:"text-xl font-semibold tracking-[-0.04em] text-white",children:"Reset data"})]}),e.jsx("p",{className:"mb-4 text-sm text-slate-400",children:"Permanently delete all stored traces and spans. This action cannot be undone."}),e.jsx("button",{type:"button",onClick:W,disabled:i,className:"inline-flex items-center gap-2 rounded-full border border-rose-400/20 bg-rose-400/8 px-4 py-2.5 text-sm font-medium text-rose-200 transition-colors hover:border-rose-400/30 hover:bg-rose-400/14 disabled:cursor-not-allowed disabled:opacity-50",children:J?e.jsxs(e.Fragment,{children:[e.jsx(f,{className:"h-4 w-4 text-emerald-300"}),e.jsx("span",{children:"Data cleared"})]}):e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:`h-4 w-4 ${i?"animate-spin":""}`}),e.jsx("span",{children:i?"Resetting...":"Reset all data"})]})})]}),e.jsxs(x.div,{className:"dashboard-shell rounded-[26px] px-5 py-5",initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{delay:.2,duration:.35},children:[e.jsxs("div",{className:"mb-5 flex items-center gap-2",children:[e.jsx(ee,{className:"h-4 w-4 text-amber-300"}),e.jsx("h2",{className:"text-xl font-semibold tracking-[-0.04em] text-white",children:"Pricing overrides"})]}),e.jsx("p",{className:"mb-4 text-sm text-slate-400",children:"Override built-in per-model pricing. Use this for custom or private models not in the default table."}),y.length>0&&e.jsx("div",{className:"mb-4 space-y-2",children:y.map((t,s)=>e.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-2xl border border-white/6 bg-white/4 px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"rounded-full border border-white/10 bg-white/6 px-2 py-0.5 text-[10px] font-bold uppercase tracking-[0.16em] text-slate-300",children:t.provider}),e.jsx("span",{className:"font-mono text-sm text-white",children:t.model})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"font-mono text-xs text-slate-400",children:["$",t.inputCostPer1M,"/M in"]}),e.jsxs("span",{className:"font-mono text-xs text-slate-400",children:["$",t.outputCostPer1M,"/M out"]}),e.jsx("button",{type:"button",onClick:()=>E(m=>m.filter((r,c)=>c!==s)),className:"rounded-lg border border-white/8 bg-white/4 p-1.5 text-slate-500 transition-colors hover:text-rose-300",children:e.jsx(B,{className:"h-3 w-3"})})]})]},`${t.provider}-${t.model}`))}),Q?e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[e.jsx("input",{value:l.provider,onChange:t=>p(s=>({...s,provider:t.target.value})),placeholder:"Provider",className:"rounded-xl border border-white/8 bg-white/4 px-3 py-2 text-sm text-white placeholder:text-slate-500 focus:border-emerald-400/30 focus:outline-none"}),e.jsx("input",{value:l.model,onChange:t=>p(s=>({...s,model:t.target.value})),placeholder:"Model name",className:"rounded-xl border border-white/8 bg-white/4 px-3 py-2 text-sm text-white placeholder:text-slate-500 focus:border-emerald-400/30 focus:outline-none"}),e.jsx("input",{value:l.inputCostPer1M,onChange:t=>p(s=>({...s,inputCostPer1M:t.target.value})),placeholder:"Input $/M",type:"number",step:"0.01",className:"rounded-xl border border-white/8 bg-white/4 px-3 py-2 text-sm text-white placeholder:text-slate-500 focus:border-emerald-400/30 focus:outline-none"}),e.jsx("input",{value:l.outputCostPer1M,onChange:t=>p(s=>({...s,outputCostPer1M:t.target.value})),placeholder:"Output $/M",type:"number",step:"0.01",className:"rounded-xl border border-white/8 bg-white/4 px-3 py-2 text-sm text-white placeholder:text-slate-500 focus:border-emerald-400/30 focus:outline-none"})]}),e.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>{l.provider&&l.model&&l.inputCostPer1M&&l.outputCostPer1M&&(E(t=>[...t,{...l}]),p({provider:"",model:"",inputCostPer1M:"",outputCostPer1M:""}),v(!1))},className:"status-chip transition-colors hover:border-white/16 hover:bg-white/8",children:[e.jsx(f,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Add"})]}),e.jsxs("button",{type:"button",onClick:()=>{v(!1),p({provider:"",model:"",inputCostPer1M:"",outputCostPer1M:""})},className:"status-chip transition-colors hover:border-white/16 hover:bg-white/8",children:[e.jsx(B,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Cancel"})]})]})]}):e.jsxs("button",{type:"button",onClick:()=>v(!0),className:"status-chip transition-colors hover:border-white/16 hover:bg-white/8",children:[e.jsx(be,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Add pricing override"})]}),y.length>0&&e.jsxs("div",{className:"mt-4 rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsx("div",{className:"mb-2 text-xs font-semibold uppercase tracking-[0.16em] text-slate-500",children:"SDK code to apply these overrides"}),e.jsx("pre",{className:"font-mono text-xs leading-relaxed text-slate-300",children:`import { setPricing } from "@llmtap/sdk";
|
|
2
|
-
${y.map(t=>`setPricing("${t.provider}", "${t.model}", ${t.inputCostPer1M}, ${t.outputCostPer1M});`).join(`
|
|
3
|
-
`)}`})]})]}),e.jsxs(x.div,{className:"dashboard-shell rounded-[26px] px-5 py-5",initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{delay:.25,duration:.35},children:[e.jsxs("div",{className:"mb-5 flex items-center gap-2",children:[e.jsx(fe,{className:"h-4 w-4 text-purple-300"}),e.jsx("h2",{className:"text-xl font-semibold tracking-[-0.04em] text-white",children:"Data retention"})]}),e.jsx("p",{className:"mb-4 text-sm text-slate-400",children:"Configure how long trace data is kept. Older traces will be automatically cleaned up."}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("select",{value:g,onChange:t=>V(t.target.value),className:"rounded-2xl border border-white/8 bg-white/4 px-4 py-3 text-sm text-white focus:border-purple-400/30 focus:outline-none",children:[e.jsx("option",{value:"7",children:"7 days"}),e.jsx("option",{value:"14",children:"14 days"}),e.jsx("option",{value:"30",children:"30 days"}),e.jsx("option",{value:"90",children:"90 days"}),e.jsx("option",{value:"365",children:"1 year"}),e.jsx("option",{value:"0",children:"Keep forever"})]}),e.jsx("button",{type:"button",onClick:async()=>{const t=parseInt(g,10);if(!(t>0&&!confirm(`Delete all trace data older than ${g} days?`))){T(!0);try{const s=await te(t);O(s.deletedSpans),D(!0),o.invalidateQueries(),setTimeout(()=>{D(!1),O(null)},4e3)}catch(s){alert(`Retention failed: ${s instanceof Error?s.message:String(s)}`)}finally{T(!1)}}},disabled:R,className:"status-chip transition-colors hover:border-white/16 hover:bg-white/8 disabled:cursor-not-allowed disabled:opacity-50",children:q?e.jsxs(e.Fragment,{children:[e.jsx(f,{className:"h-3.5 w-3.5 text-emerald-300"}),e.jsx("span",{children:N!==null&&N>0?`Cleaned ${N} spans`:"Applied"})]}):e.jsx("span",{children:R?"Applying...":"Apply now"})})]}),e.jsxs("p",{className:"mt-3 text-xs text-slate-500",children:["This immediately deletes spans older than the selected period. For automatic enforcement on every startup, use ",e.jsxs("code",{className:"rounded bg-white/6 px-1.5 py-0.5 font-mono text-slate-400",children:["llmtap start --retention ",g]}),"."]})]}),e.jsxs(x.div,{className:"dashboard-shell rounded-[26px] px-5 py-5",initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{delay:.27,duration:.35},children:[e.jsxs("div",{className:"mb-5 flex items-center gap-2",children:[e.jsx(ge,{className:"h-4 w-4 text-cyan-300"}),e.jsx("h2",{className:"text-xl font-semibold tracking-[-0.04em] text-white",children:"OpenTelemetry Export"})]}),e.jsx("p",{className:"mb-4 text-sm text-slate-400",children:"Export spans in OTLP format for Datadog, Grafana Tempo, Jaeger, Honeycomb, or any OTLP-compatible backend."}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("button",{type:"button",disabled:I,onClick:async()=>{_(!0);try{const t=await se(1e3,C),s=new Blob([t],{type:"application/json"}),m=URL.createObjectURL(s),r=document.createElement("a");r.href=m,r.download="llmtap-export.otlp.json",document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(m)}catch(t){alert(`Export failed: ${t instanceof Error?t.message:String(t)}`)}finally{_(!1)}},className:"flex items-center gap-2 rounded-2xl border border-cyan-400/20 bg-cyan-400/10 px-4 py-2.5 text-sm font-medium text-cyan-300 transition-colors hover:bg-cyan-400/20",children:[e.jsx(w,{className:"h-3.5 w-3.5"}),I?"Exporting...":"Download OTLP JSON"]}),e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsx("div",{className:"mb-3 text-xs font-semibold uppercase tracking-[0.16em] text-slate-500",children:"Forward to OTLP endpoint"}),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row",children:[e.jsx("input",{type:"text",value:k,onChange:t=>{G(t.target.value),j(null)},placeholder:"http://localhost:4318/v1/traces",className:"flex-1 rounded-xl border border-white/8 bg-white/4 px-3 py-2 text-sm text-white placeholder-slate-500 focus:border-cyan-400/30 focus:outline-none"}),e.jsx("input",{type:"text",value:C,onChange:t=>H(t.target.value),placeholder:"service name",className:"w-32 rounded-xl border border-white/8 bg-white/4 px-3 py-2 text-sm text-white placeholder-slate-500 focus:border-cyan-400/30 focus:outline-none"}),e.jsx("button",{type:"button",disabled:!k||A,onClick:async()=>{L(!0),j(null);try{const t=await ae(k,{service:C});j(`Forwarded ${t.spanCount} spans`)}catch(t){j(`Error: ${t instanceof Error?t.message:String(t)}`)}finally{L(!1)}},className:"rounded-xl border border-cyan-400/20 bg-cyan-400/10 px-4 py-2 text-sm font-medium text-cyan-300 transition-colors hover:bg-cyan-400/20 disabled:opacity-40",children:A?"Sending...":"Send"})]}),S&&e.jsx("p",{className:`mt-2 text-xs ${S.startsWith("Error")?"text-rose-400":"text-emerald-400"}`,children:S})]}),e.jsxs("p",{className:"text-xs text-slate-500",children:["CLI: ",e.jsx("code",{className:"rounded bg-white/6 px-1.5 py-0.5 font-mono text-slate-400",children:"llmtap export --format otlp --endpoint http://localhost:4318/v1/traces"})]})]})]}),e.jsxs(x.div,{className:"dashboard-shell rounded-[26px] px-5 py-5",initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{delay:.3,duration:.35},children:[e.jsxs("div",{className:"mb-5 flex items-center gap-2",children:[e.jsx(he,{className:"h-4 w-4 text-sky-300"}),e.jsx("h2",{className:"text-xl font-semibold tracking-[-0.04em] text-white",children:"Quick start"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsx("div",{className:"mb-2 text-xs font-semibold uppercase tracking-[0.16em] text-slate-500",children:"1. Install the SDK"}),e.jsx("pre",{className:"font-mono text-xs text-slate-300",children:"npm install @llmtap/sdk"})]}),e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsx("div",{className:"mb-2 text-xs font-semibold uppercase tracking-[0.16em] text-slate-500",children:"2. Wrap your client"}),e.jsx("pre",{className:"font-mono text-xs leading-relaxed text-slate-300",children:`import { wrap } from "@llmtap/sdk";
|
|
4
|
-
import OpenAI from "openai";
|
|
5
|
-
|
|
6
|
-
const openai = wrap(new OpenAI());`})]}),e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsx("div",{className:"mb-2 text-xs font-semibold uppercase tracking-[0.16em] text-slate-500",children:"3. That's it"}),e.jsx("p",{className:"text-xs leading-relaxed text-slate-400",children:"All API calls are now traced automatically. Open this dashboard to see real-time data."})]})]})]})]})]})})}export{Se as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as o,j as e,b as s}from"./index-M3DwcRrc.js";const a=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],d=o("arrow-left",a);const c=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],i=o("chevron-down",c);function u({status:n,className:t}){const r=n==="error";return e.jsxs("span",{className:s("relative flex h-3.5 w-3.5 items-center justify-center",t),children:[e.jsx("span",{className:s("absolute inset-0 rounded-full",r?"bg-rose-400/25":"bg-emerald-400/25")}),e.jsx("span",{className:s("relative h-2 w-2 rounded-full",r?"bg-rose-400":"bg-emerald-300")})]})}export{d as A,i as C,u as S};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import{c as f,j as e,b as ce,n as de,r as h,L as pe,A as Y,m as M,o as xe,f as me,p as he,k as ue}from"./index-M3DwcRrc.js";import{u as ge,P as be,b as w,c as g}from"./format-CNuIwzac.js";import{g as k,C as Z,M as W}from"./content-DqloWqre.js";import{p as fe,d as je}from"./provider-colors-DcHYMgVv.js";import{A as ye,C as L,S as Ne}from"./StatusDot-CjYDb6xj.js";import{C as O,D as ve,a as we}from"./download-B-39NUBC.js";import{L as P}from"./layers-BQ0MpYqk.js";import{Z as ke}from"./zap-DjNN7wJp.js";import{C as Q}from"./coins-BmXTNwva.js";import{C as E}from"./clock-BEYeaSdD.js";import{O as Ce}from"./orbit-eg7lcPsM.js";const $e=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Te=f("chevron-right",$e);const Me=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Se=f("circle-check",Me);const _e=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],Ie=f("code",_e);const Re=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Le=f("file-text",Re);const Oe=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],Pe=f("hash",Oe);const Ee=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Ae=f("image",Ee);const De=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],X=f("play",De);const He=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],ze=f("terminal",He);const Fe=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],Be=f("wrench",Fe);function qe({provider:t,className:a}){const n=t.toLowerCase(),i=fe[n]??je;return e.jsx("span",{className:ce("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold capitalize",i.bg,i.text,i.border,a),children:t})}function Ke(t){const a=new Map,n=[];for(const l of t)a.set(l.spanId,{span:l,children:[]});for(const l of t){const c=a.get(l.spanId);c&&(l.parentSpanId&&a.has(l.parentSpanId)?a.get(l.parentSpanId)?.children.push(c):n.push(c))}const i=l=>{l.sort((c,s)=>c.span.startTime-s.span.startTime);for(const c of l)i(c.children)};return i(n),n}function A(t){return t.children.reduce((a,n)=>a+1+A(n),0)}function Je(){const[t,a]=h.useState(null);function n(i,l){navigator.clipboard.writeText(i),a(l),setTimeout(()=>a(null),2e3)}return{copied:t,copy:n}}function v({text:t,label:a,copied:n,onCopy:i}){return e.jsx("button",{type:"button",onClick:l=>{l.stopPropagation(),i(t,a)},className:"rounded-lg border border-white/8 bg-white/4 p-1.5 text-slate-500 transition-colors hover:text-white",title:"Copy to clipboard",children:n===a?e.jsx(O,{className:"h-3 w-3 text-emerald-300"}):e.jsx(we,{className:"h-3 w-3"})})}function b({icon:t,label:a,value:n}){return e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.16em] text-slate-500",children:[e.jsx(t,{className:"h-3 w-3"}),a]}),e.jsx("div",{className:"font-mono text-sm font-semibold text-slate-100",children:n})]})}function Ue({role:t,type:a}){const n={system:"bg-purple-400/10 text-purple-200 border-purple-400/16",user:"bg-sky-400/10 text-sky-200 border-sky-400/16",assistant:"bg-emerald-400/10 text-emerald-200 border-emerald-400/16",tool:"bg-amber-300/10 text-amber-200 border-amber-300/16",function:"bg-amber-300/10 text-amber-200 border-amber-300/16"},i=a==="input"?"bg-sky-400/10 text-sky-200 border-sky-400/16":"bg-emerald-400/10 text-emerald-200 border-emerald-400/16";return e.jsx("span",{className:`rounded-full border px-2.5 py-1 text-[10px] font-bold capitalize tracking-[0.16em] ${n[t]??i}`,children:t})}function G(t){return!t||typeof t=="string"?!1:t.some(a=>a.type==="image_url"||a.type==="image")}function D(t){return t.map(a=>a.type==="image_url"&&a.image_url?.url?a.image_url.url:a.type==="image"&&a.source?.data?`data:${a.source.media_type||"image/png"};base64,${a.source.data}`:null).filter(a=>{if(!a)return!1;if(a.startsWith("data:image/"))return!0;try{const n=new URL(a);return n.protocol==="http:"||n.protocol==="https:"}catch{return!1}})}function Ye(t){const a=k(t);let n=a?Math.ceil(a.length/4):0;if(t&&typeof t!="string"){const i=t.filter(l=>l.type==="image_url"||l.type==="image").length;n+=i*85}return n}function V({message:t,type:a,copied:n,onCopy:i}){const l=t.content,c=k(l),s=l&&typeof l!="string"?D(l):[],d=a==="input"?"border-white/8":"border-emerald-400/10",o=`msg-${a}-${t.role}-${c.slice(0,20)}`;return e.jsxs("div",{className:`rounded-2xl border ${d} bg-white/4 p-4`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ue,{role:t.role,type:a}),t.name&&e.jsx("span",{className:"font-mono text-[10px] text-slate-500",children:t.name}),s.length>0&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full border border-purple-400/16 bg-purple-400/10 px-2 py-0.5 text-[10px] font-bold uppercase tracking-[0.12em] text-purple-200",children:[e.jsx(Ae,{className:"h-2.5 w-2.5"}),s.length," image",s.length>1?"s":""]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-mono text-[10px] text-slate-600",children:["~",Ye(l)," tok"]}),c&&e.jsx(v,{text:c,label:o,copied:n,onCopy:i})]})]}),c&&e.jsx("pre",{className:"mt-2.5 whitespace-pre-wrap font-mono text-xs leading-relaxed text-slate-200",children:Ve(c)}),s.length>0&&e.jsx("div",{className:"mt-2.5 flex flex-wrap gap-2",children:s.map((p,j)=>e.jsxs("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"group relative overflow-hidden rounded-lg border border-white/10 bg-slate-950/60 transition-colors hover:border-white/20",children:[e.jsx("img",{src:p,alt:`Image ${j+1}`,className:"max-h-48 max-w-64 object-contain",loading:"lazy"}),e.jsx("span",{className:"absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 transition-opacity group-hover:opacity-100",children:e.jsx("span",{className:"text-[10px] font-bold uppercase tracking-widest text-white",children:"Open"})})]},j))})]})}function We({span:t,copied:a,onCopy:n}){const i=t.inputMessages?.length??0,l=t.outputMessages?.length??0,[c,s]=h.useState(i>3),[d,o]=h.useState(l>3);return e.jsx(M.div,{initial:{opacity:0,gridTemplateRows:"0fr"},animate:{opacity:1,gridTemplateRows:"1fr"},exit:{opacity:0,gridTemplateRows:"0fr"},transition:{duration:.2},style:{display:"grid"},children:e.jsx("div",{className:"overflow-hidden",children:e.jsxs("div",{className:"mx-4 mb-4 space-y-5 rounded-[24px] border border-white/8 bg-[linear-gradient(180deg,rgba(8,15,28,0.96),rgba(4,8,18,0.98))] p-5 text-sm",children:[e.jsx("div",{className:"flex items-center justify-between gap-2",children:e.jsxs("div",{className:"grid flex-1 grid-cols-2 gap-3 md:grid-cols-4",children:[e.jsx(b,{icon:Pe,label:"Model",value:t.responseModel??t.requestModel??"-"}),e.jsx(b,{icon:P,label:"Tokens",value:`${t.inputTokens} in / ${t.outputTokens} out`}),e.jsx(b,{icon:Q,label:"Cost",value:w(t.totalCost)}),e.jsx(b,{icon:E,label:"Duration",value:t.duration?g(t.duration):"-"})]})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(v,{text:t.spanId,label:"spanId",copied:a,onCopy:n}),e.jsxs("span",{className:"font-mono text-[10px] text-slate-500",children:["span: ",t.spanId.slice(0,12),"..."]}),t.sessionId&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-slate-600",children:"|"}),e.jsxs("span",{className:"font-mono text-[10px] text-slate-500",children:["session: ",t.sessionId]})]}),t.temperature!==void 0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-slate-600",children:"|"}),e.jsxs("span",{className:"font-mono text-[10px] text-slate-500",children:["temp: ",t.temperature]})]}),t.topP!==void 0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-slate-600",children:"|"}),e.jsxs("span",{className:"font-mono text-[10px] text-slate-500",children:["top_p: ",t.topP]})]}),t.maxTokens!==void 0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-slate-600",children:"|"}),e.jsxs("span",{className:"font-mono text-[10px] text-slate-500",children:["max_tokens: ",t.maxTokens]})]})]}),t.status==="error"&&e.jsxs("div",{className:"rounded-2xl border border-rose-400/18 bg-rose-400/6 p-4",children:[e.jsxs("div",{className:"mb-1.5 flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 text-xs font-bold uppercase tracking-[0.16em] text-rose-300",children:[e.jsx(Z,{className:"h-4 w-4"}),t.errorType??"error"]}),t.errorMessage&&e.jsx(v,{text:t.errorMessage,label:"error",copied:a,onCopy:n})]}),e.jsx("div",{className:"font-mono text-xs leading-relaxed text-rose-200/70",children:t.errorMessage})]}),t.inputMessages&&t.inputMessages.length>0&&e.jsxs("div",{children:[e.jsxs("button",{type:"button",onClick:()=>s(p=>!p),className:"mb-3 flex w-full items-center gap-1.5 text-[10px] font-bold uppercase tracking-[0.16em] text-slate-500 transition-colors hover:text-slate-300",children:[e.jsx(L,{className:`h-3.5 w-3.5 transition-transform ${c?"-rotate-90":""}`}),e.jsx(W,{className:"h-3.5 w-3.5"}),"Input messages (",t.inputMessages.length,")"]}),!c&&e.jsx("div",{className:"space-y-2",children:t.inputMessages.map((p,j)=>e.jsx(V,{message:p,type:"input",copied:a,onCopy:n},`in-${p.role}-${j}`))})]}),t.outputMessages&&t.outputMessages.length>0&&e.jsxs("div",{children:[e.jsxs("button",{type:"button",onClick:()=>o(p=>!p),className:"mb-3 flex w-full items-center gap-1.5 text-[10px] font-bold uppercase tracking-[0.16em] text-slate-500 transition-colors hover:text-slate-300",children:[e.jsx(L,{className:`h-3.5 w-3.5 transition-transform ${d?"-rotate-90":""}`}),e.jsx(W,{className:"h-3.5 w-3.5"}),"Output messages (",t.outputMessages.length,")"]}),!d&&e.jsx("div",{className:"space-y-2",children:t.outputMessages.map((p,j)=>e.jsx(V,{message:p,type:"output",copied:a,onCopy:n},`out-${p.role}-${j}`))})]}),t.toolCalls&&t.toolCalls.length>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"mb-3 flex items-center gap-1.5 text-[10px] font-bold uppercase tracking-[0.16em] text-slate-500",children:[e.jsx(Be,{className:"h-3.5 w-3.5"}),"Tool calls (",t.toolCalls.length,")"]}),e.jsx("div",{className:"space-y-2",children:t.toolCalls.map(p=>e.jsxs("div",{className:"rounded-2xl border border-amber-300/10 bg-white/4 p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"rounded-full border border-amber-300/16 bg-amber-300/10 px-2.5 py-1 text-[10px] font-bold tracking-[0.16em] text-amber-200",children:p.name}),e.jsx(v,{text:p.arguments,label:`tool-${p.id}`,copied:a,onCopy:n})]}),e.jsx("pre",{className:"mt-2.5 overflow-x-auto font-mono text-xs leading-relaxed text-slate-200",children:ee(p.arguments)}),p.result&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"my-2 border-t border-white/6"}),e.jsx("div",{className:"mb-1 text-[10px] font-bold uppercase tracking-[0.16em] text-slate-600",children:"Result"}),e.jsx("pre",{className:"overflow-x-auto font-mono text-xs leading-relaxed text-slate-300",children:p.result})]})]},p.id))})]})]})})})}function ee(t){try{return JSON.stringify(JSON.parse(t),null,2)}catch{return t}}function Xe(t){const a=t.providerName?.toLowerCase()??"",n=t.requestModel??t.responseModel??"unknown",i=(t.inputMessages??[]).map(s=>({role:s.role,content:typeof s.content=="string"?s.content:s.content??""})),c=JSON.stringify({model:n,messages:i}).replace(/'/g,"'\\''");return a==="openai"?`curl https://api.openai.com/v1/chat/completions \\
|
|
2
|
-
-H "Authorization: Bearer $OPENAI_API_KEY" \\
|
|
3
|
-
-H "Content-Type: application/json" \\
|
|
4
|
-
-d '${c}'`:a==="anthropic"?`curl https://api.anthropic.com/v1/messages \\
|
|
5
|
-
-H "x-api-key: $ANTHROPIC_API_KEY" \\
|
|
6
|
-
-H "anthropic-version: 2023-06-01" \\
|
|
7
|
-
-H "Content-Type: application/json" \\
|
|
8
|
-
-d '${JSON.stringify({model:n,max_tokens:t.maxTokens??1024,messages:i.filter(o=>o.role!=="system"),...i.find(o=>o.role==="system")?{system:i.find(o=>o.role==="system").content}:{}}).replace(/'/g,"'\\''")}'`:a==="google"?`curl "https://generativelanguage.googleapis.com/v1beta/models/${n}:generateContent?key=$GOOGLE_API_KEY" \\
|
|
9
|
-
-H "Content-Type: application/json" \\
|
|
10
|
-
-d '${c}'`:`curl https://api.example.com/v1/chat/completions \\
|
|
11
|
-
-H "Authorization: Bearer $API_KEY" \\
|
|
12
|
-
-H "Content-Type: application/json" \\
|
|
13
|
-
-d '${c}'`}function Ge(t,a,n,i,l,c){const s=[];s.push("# Trace Report"),s.push(""),s.push(`**Trace ID:** \`${t}\``),s.push(`**Status:** ${c?"Error":"Stable"}`),s.push(`**Total Spans:** ${a.length}`),s.push(`**Total Tokens:** ${n.toLocaleString()}`),s.push(`**Total Cost:** ${w(i)}`),s.push(`**Duration:** ${g(l)}`),s.push(""),s.push("---"),s.push("");for(const d of a){if(s.push(`## Span: ${d.name}`),s.push(""),s.push("| Field | Value |"),s.push("|-------|-------|"),s.push(`| Span ID | \`${d.spanId}\` |`),s.push(`| Provider | ${d.providerName} |`),s.push(`| Model | ${d.responseModel??d.requestModel??"-"} |`),s.push(`| Operation | ${d.operationName} |`),s.push(`| Tokens | ${d.inputTokens} in / ${d.outputTokens} out |`),s.push(`| Cost | ${w(d.totalCost)} |`),s.push(`| Duration | ${d.duration?g(d.duration):"-"} |`),s.push(`| Status | ${d.status} |`),s.push(""),d.inputMessages&&d.inputMessages.length>0){s.push("### Input Messages"),s.push("");for(const o of d.inputMessages)s.push(`**[${o.role}]${o.name?` (${o.name})`:""}**`),s.push(""),s.push(k(o.content)||"_empty_"),G(o.content)&&s.push(`
|
|
14
|
-
_[${D(o.content).length} image(s) attached]_`),s.push("")}if(d.outputMessages&&d.outputMessages.length>0){s.push("### Output Messages"),s.push("");for(const o of d.outputMessages)s.push(`**[${o.role}]${o.name?` (${o.name})`:""}**`),s.push(""),s.push(k(o.content)||"_empty_"),G(o.content)&&s.push(`
|
|
15
|
-
_[${D(o.content).length} image(s) attached]_`),s.push("")}if(d.toolCalls&&d.toolCalls.length>0){s.push("### Tool Calls"),s.push("");for(const o of d.toolCalls)s.push(`**${o.name}** (\`${o.id}\`)`),s.push(""),s.push("```json"),s.push(ee(o.arguments)),s.push("```"),o.result&&(s.push(""),s.push("Result:"),s.push("```"),s.push(o.result),s.push("```")),s.push("")}s.push("---"),s.push("")}return s.join(`
|
|
16
|
-
`)}function Ve(t){const a=/```(\w*)\n?([\s\S]*?)```/g,n=[];let i=0,l,c=0;for(;(l=a.exec(t))!==null;){l.index>i&&n.push(e.jsx("span",{children:t.slice(i,l.index)},c++));const s=l[1]||"",d=l[2];n.push(e.jsxs("span",{className:"my-1.5 block rounded-lg border border-white/8 bg-slate-950/80 px-3 py-2",children:[s&&e.jsxs("span",{className:"mb-1 flex items-center gap-1 text-[10px] font-bold uppercase tracking-[0.16em] text-slate-500",children:[e.jsx(Ie,{className:"h-3 w-3"}),s]}),e.jsx("span",{className:"block font-mono text-[11px] leading-relaxed text-emerald-200/80",children:d})]},c++)),i=l.index+l[0].length}return i<t.length&&n.push(e.jsx("span",{children:t.slice(i)},c++)),n.length===0?t:n}function dt(){const{traceId:t}=de(),[a,n]=h.useState(null),[i,l]=h.useState({}),{copied:c,copy:s}=Je(),[d,o]=h.useState(!1),[p,j]=h.useState(""),[H,z]=h.useState(!1),[y,C]=h.useState(null),[F,$]=h.useState(null),[S,te]=h.useState(null),{data:se,isLoading:ae}=ge({queryKey:["trace",t],queryFn:()=>ue(t),enabled:!!t}),x=se?.spans??[],_=h.useMemo(()=>Ke(x),[x]),I=x.length>0?Math.min(...x.map(r=>r.startTime)):0,N=(x.length>0?Math.max(...x.map(r=>r.endTime??r.startTime)):0)-I||1,B=x.reduce((r,u)=>r+u.totalTokens,0),q=x.reduce((r,u)=>r+u.totalCost,0),R=x.some(r=>r.status==="error");function re(){const r=new Blob([JSON.stringify(x,null,2)],{type:"application/json"}),u=URL.createObjectURL(r),m=document.createElement("a");m.href=u,m.download=`trace-${t?.slice(0,12)}.json`,document.body.appendChild(m),m.click(),document.body.removeChild(m),URL.revokeObjectURL(u)}async function ne(){if(!(!S||!p.trim())){z(!0),$(null),C(null);try{const r=await he(S,p.trim());C(r)}catch(r){$(r instanceof Error?r.message:String(r))}finally{z(!1)}}}function le(r){te(r),o(!0),C(null),$(null)}const K=(r,u=0)=>{const m=r.span.spanId===a,J=r.children.length>0,U=i[r.span.spanId]??!1,oe=(r.span.startTime-I)/N*100,ie=Math.max(((r.span.endTime??r.span.startTime)-r.span.startTime)/N*100,1);return e.jsxs(h.Fragment,{children:[e.jsx("div",{className:"border-t border-white/6 first:border-t-0",children:e.jsxs("div",{className:"flex items-start gap-2 px-4 py-3 sm:px-5",children:[e.jsx("div",{className:"flex items-center",style:{paddingLeft:`${u*22}px`},children:J?e.jsx("button",{type:"button",onClick:()=>l(T=>({...T,[r.span.spanId]:!T[r.span.spanId]})),className:"flex h-8 w-8 items-center justify-center rounded-full border border-white/8 bg-white/4 text-slate-400 transition-colors hover:text-white",children:e.jsx(Te,{className:`h-4 w-4 transition-transform ${U?"":"rotate-90"}`})}):e.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full border border-white/8 bg-white/4 text-slate-500",children:e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-slate-500"})})}),e.jsxs("button",{type:"button",onClick:()=>n(m?null:r.span.spanId),className:`grid min-w-0 flex-1 gap-3 rounded-[22px] px-3 py-3 text-left transition-colors sm:grid-cols-[minmax(0,320px)_minmax(0,1fr)_88px] sm:items-center ${m?"bg-white/8":"hover:bg-white/4"}`,children:[e.jsx("div",{className:"min-w-0",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Ne,{status:r.span.status}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-medium text-white",children:r.span.name}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2.5",children:[e.jsx(qe,{provider:r.span.providerName}),e.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.16em] text-slate-500",children:r.span.operationName}),J?e.jsxs("span",{className:"font-mono text-[10px] uppercase tracking-[0.16em] text-slate-500",children:[A(r)," child",A(r)===1?"":"ren"]}):null]})]})]})}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between text-[10px] uppercase tracking-[0.16em] text-slate-500",children:[e.jsxs("span",{children:[Math.round(r.span.startTime-I),"ms"]}),e.jsx("span",{children:r.span.duration?g(r.span.duration):"instant"})]}),e.jsx("div",{className:"relative h-8 overflow-hidden rounded-full bg-slate-950/90",children:e.jsx(M.div,{className:`absolute bottom-1 top-1 origin-left rounded-full ${r.span.status==="error"?"bg-[linear-gradient(90deg,#fb7185,#f97316)]":"bg-[linear-gradient(90deg,#34d399,#38bdf8)]"}`,style:{left:`${oe}%`,width:`${Math.max(ie,.5)}%`},initial:{scaleX:0},animate:{scaleX:1},transition:{duration:.4,ease:"easeOut"}})})]}),e.jsxs("div",{className:"text-right font-mono text-[11px] text-slate-400",children:[e.jsx("div",{className:"text-slate-200",children:w(r.span.totalCost)}),e.jsxs("div",{children:[r.span.totalTokens.toLocaleString()," tok"]})]})]})]})}),e.jsx(Y,{children:m?e.jsx(We,{span:r.span,copied:c,onCopy:s}):null}),!U&&r.children.map(T=>K(T,u+1))]},r.span.spanId)};return ae?e.jsxs("div",{className:"mx-auto max-w-[1500px] space-y-6",children:[e.jsx("div",{className:"skeleton-panel h-44 rounded-[28px]"}),e.jsx("div",{className:"skeleton-panel h-28 rounded-[24px]"}),e.jsx("div",{className:"skeleton-panel h-72 rounded-[24px]"})]}):e.jsxs(be,{eyebrow:"Trace Console",title:t?`Trace ${t.slice(0,12)}...`:"Trace detail",description:"Inspect the nested execution tree, timing offsets, token pressure, and payloads for a single trace without losing the operator surface.",aside:e.jsxs("div",{className:"insight-panel",children:[e.jsx(me,{}),e.jsxs("div",{className:"mt-4 space-y-3",children:[e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsx("div",{className:"hud-label",children:"Current status"}),e.jsx("div",{className:"mt-2 flex items-center gap-2 text-base font-medium text-white",children:R?e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"h-4 w-4 text-rose-300"}),"Error state"]}):e.jsxs(e.Fragment,{children:[e.jsx(Se,{className:"h-4 w-4 text-emerald-300"}),"Stable"]})})]}),e.jsxs("div",{className:"rounded-2xl border border-white/8 bg-white/4 p-4",children:[e.jsx("div",{className:"hud-label",children:"Hierarchy"}),e.jsxs("div",{className:"mt-2 text-base font-medium text-white",children:[_.length," root spans"]}),e.jsxs("div",{className:"mt-1 text-sm text-slate-400",children:[g(N)," elapsed from first to last event"]})]})]})]}),children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(pe,{to:"/",className:"status-chip transition-colors hover:text-white",children:[e.jsx(ye,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Back to overview"})]}),e.jsx("span",{className:"truncate font-mono text-xs text-slate-500",children:t}),e.jsx(v,{text:t??"",label:"traceId",copied:c,onCopy:s})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[x.length>0&&e.jsxs("button",{type:"button",onClick:()=>{const r=x[0];s(Xe(r),"curl")},className:"status-chip transition-colors hover:border-white/16 hover:bg-white/8",children:[c==="curl"?e.jsx(O,{className:"h-3.5 w-3.5 text-emerald-300"}):e.jsx(ze,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:c==="curl"?"Copied!":"Copy as cURL"})]}),x.length>0&&e.jsxs("button",{type:"button",onClick:()=>{s(Ge(t??"",x,B,q,N,R),"markdown")},className:"status-chip transition-colors hover:border-white/16 hover:bg-white/8",children:[c==="markdown"?e.jsx(O,{className:"h-3.5 w-3.5 text-emerald-300"}):e.jsx(Le,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:c==="markdown"?"Copied!":"Copy as Markdown"})]}),e.jsxs("button",{type:"button",onClick:re,className:"status-chip transition-colors hover:border-white/16 hover:bg-white/8",children:[e.jsx(ve,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:"Export JSON"})]}),x.length>0&&e.jsxs("button",{type:"button",onClick:()=>le(x[0].spanId),className:"status-chip border-emerald-400/20 bg-emerald-400/8 transition-colors hover:border-emerald-400/30 hover:bg-emerald-400/14",children:[e.jsx(X,{className:"h-3.5 w-3.5 text-emerald-300"}),e.jsx("span",{children:"Replay"})]})]})]}),e.jsx("div",{className:"dashboard-shell rounded-[26px] px-5 py-5",children:e.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-5",children:[e.jsx(b,{icon:P,label:"Spans",value:String(x.length)}),e.jsx(b,{icon:ke,label:"Tokens",value:B.toLocaleString()}),e.jsx(b,{icon:Q,label:"Cost",value:w(q)}),e.jsx(b,{icon:E,label:"Duration",value:x.length>0?g(N):"-"}),e.jsx(b,{icon:Ce,label:"Status",value:R?"Error":"Stable"})]})}),e.jsxs("div",{className:"dashboard-shell overflow-hidden rounded-[26px]",children:[e.jsxs("div",{className:"flex items-center gap-2.5 border-b border-white/6 px-5 py-4",children:[e.jsx(E,{className:"h-4 w-4 text-sky-300"}),e.jsx("h2",{className:"text-xl font-semibold tracking-[-0.04em] text-white",children:"Trace hierarchy"}),e.jsxs("span",{className:"ml-auto text-xs font-mono tracking-[0.18em] text-slate-500",children:[g(N)," total"]})]}),_.length>0?e.jsx("div",{className:"py-2",children:_.map(r=>K(r))}):e.jsxs("div",{className:"empty-state h-[280px]",children:[e.jsx(P,{className:"h-8 w-8 text-slate-500"}),e.jsx("div",{className:"text-base font-medium text-white",children:"No spans found for this trace"})]})]}),e.jsx(Y,{children:d&&e.jsxs(e.Fragment,{children:[e.jsx(M.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 bg-black/60 backdrop-blur-sm",onClick:()=>o(!1)}),e.jsxs(M.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{type:"spring",bounce:.15,duration:.4},className:"fixed left-1/2 top-1/2 z-50 w-full max-w-2xl -translate-x-1/2 -translate-y-1/2 rounded-[24px] border border-white/10 bg-[linear-gradient(180deg,rgba(12,18,32,0.98),rgba(4,8,18,0.99))] p-6 shadow-[0_40px_100px_rgba(0,0,0,0.5)]",children:[e.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-2xl border border-emerald-400/20 bg-emerald-400/8",children:e.jsx(X,{className:"h-4.5 w-4.5 text-emerald-300"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold text-white",children:"Trace Replay"}),e.jsx("p",{className:"text-xs text-slate-500",children:"Re-send the same prompts and compare responses"})]})]}),e.jsx("button",{onClick:()=>o(!1),className:"flex h-8 w-8 items-center justify-center rounded-xl border border-white/8 bg-white/5 text-slate-400 transition-colors hover:text-white",children:e.jsx(L,{className:"h-4 w-4"})})]}),!y&&!H&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"rounded-xl border border-amber-400/20 bg-amber-500/8 p-3 text-xs text-amber-200/80",children:"Your API key is sent directly to the provider and is never stored by LLMTap."}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs font-medium text-slate-400",children:"Provider API Key"}),e.jsx("input",{type:"password",value:p,onChange:r=>j(r.target.value),placeholder:"sk-... or anthropic key",className:"w-full rounded-xl border border-white/10 bg-white/5 px-4 py-3 text-sm text-white placeholder:text-slate-600 focus:border-emerald-400/30 focus:outline-none"})]}),F&&e.jsx("div",{className:"rounded-xl border border-rose-400/20 bg-rose-500/8 p-3 text-sm text-rose-200",children:F}),e.jsx("button",{type:"button",disabled:!p.trim(),onClick:ne,className:"w-full rounded-xl bg-emerald-500 px-4 py-3 text-sm font-semibold text-white transition-colors hover:bg-emerald-400 disabled:cursor-not-allowed disabled:opacity-40",children:"Send Replay Request"})]}),H&&e.jsxs("div",{className:"flex flex-col items-center gap-3 py-12",children:[e.jsx(xe,{className:"h-8 w-8 animate-spin text-emerald-300"}),e.jsxs("p",{className:"text-sm text-slate-400",children:["Replaying against ",x[0]?.providerName," API..."]})]}),y&&(()=>{const r=x.find(m=>m.spanId===S)??x[0],u=r?.outputMessages?.map(m=>k(m.content)).join(`
|
|
17
|
-
`)??"";return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-3 gap-3 text-center",children:[e.jsxs("div",{className:"rounded-xl border border-white/8 bg-white/4 p-3",children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-slate-500",children:"Tokens"}),e.jsxs("div",{className:"mt-1 font-mono text-sm text-white",children:[r.totalTokens," ",e.jsx("span",{className:"text-slate-500",children:"vs"})," ",y.totalTokens]})]}),e.jsxs("div",{className:"rounded-xl border border-white/8 bg-white/4 p-3",children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-slate-500",children:"Duration"}),e.jsxs("div",{className:"mt-1 font-mono text-sm text-white",children:[g(r.duration??0)," ",e.jsx("span",{className:"text-slate-500",children:"vs"})," ",g(y.duration)]})]}),e.jsxs("div",{className:"rounded-xl border border-white/8 bg-white/4 p-3",children:[e.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.16em] text-slate-500",children:"Model"}),e.jsx("div",{className:"mt-1 truncate font-mono text-xs text-white",children:y.responseModel})]})]}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-xs font-semibold uppercase tracking-[0.16em] text-slate-500",children:"Original Response"}),e.jsx("div",{className:"max-h-[300px] overflow-y-auto rounded-xl border border-white/8 bg-white/4 p-3 text-sm leading-6 text-slate-300",children:u||e.jsx("span",{className:"text-slate-600",children:"No content captured"})})]}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-xs font-semibold uppercase tracking-[0.16em] text-emerald-400/80",children:"Replay Response"}),e.jsx("div",{className:"max-h-[300px] overflow-y-auto rounded-xl border border-emerald-400/12 bg-emerald-400/4 p-3 text-sm leading-6 text-slate-300",children:y.content||e.jsx("span",{className:"text-slate-600",children:"Empty response"})})]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:()=>{C(null),$(null)},className:"flex-1 rounded-xl border border-white/10 bg-white/5 px-4 py-2.5 text-sm text-slate-300 transition-colors hover:bg-white/10",children:"Replay Again"}),e.jsx("button",{type:"button",onClick:()=>o(!1),className:"flex-1 rounded-xl bg-emerald-500 px-4 py-2.5 text-sm font-semibold text-white transition-colors hover:bg-emerald-400",children:"Done"})]})]})})()]})]})})]})}export{dt as default};
|