arize-phoenix 5.3.0__py3-none-any.whl → 5.3.1__py3-none-any.whl

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.
@@ -1,4 +1,4 @@
1
- import{r as u,j as e,R as Ke,n as ya,ak as Rs,l as s,O as q,A as C,al as Pe,E as ne,t as D,am as Pn,an as ln,$ as U,ao as ca,H as he,I as ke,M as Z,K as Rn,g as El,ap as Xe,aq as ce,ar as Ye,as as Ms,P as Ba,at as Cn,au as se,av as ve,a9 as Ie,aa as B,ab as Ns,aw as we,ax as zs,ay as Ta,az as Ia,aA as La,aB as qn,aC as fa,o as Vs,aD as $s,aE as Os,af as Qs,ag as js,aF as qs,p as Us,q as Bs,aG as Hs,D as Gs,aH as O,aI as Ws,aJ as Js,aK as cl,aL as Zs,aM as Xs,aN as Ys,aO as eo,aP as no,aQ as ao,aR as lo,aS as to}from"./vendor-D-NIjePD.js";import{C as G,d as F,K as ea,D as W,c as h,I as P,a as I,J as Ha,G as Te,H as J,M as _e,N as de,O as io,m as ha,Q as na,P as tn,S as Be,i as Mn,j as re,q as Fn,r as Nn,v as me,b as K,o as Rl,U as Re,L as Zn,V as Ml,e as M,t as ee,W as Nl,X as zl,Y as ro,Z as so,h as kn,w as aa,T as Le,k as X,B as ka,s as ye,$ as z,a0 as Ga,E as ba,f as wn,a1 as Wa,a2 as oo,z as la,u as co,a3 as uo,R as ga,n as Vl}from"./vendor-arizeai-DoY5jUTO.js";import{c as mo,N as go,T as po,L as fe,u as ge,B as yo,a as mn,D as fo,G as ho,b as ko,d as bo,S as So,R as xe,e as ze,f as He,g as Ja,P as $l,h as Ol,M as ul,i as ml,j as zn,k as vo,l as Co,m as Q,n as Ql,o as Ce,p as Sa,q as Vn,r as jl,s as $n,t as On,v as ql,w as Ge,x as Qe,C as pe,y as va,z as rn,A as Za,E as We,F as Ul,H as Fo,I as Ko,J as xo,K as Do,O as To,Q as Io,U as je,V as ue,W as Lo,X as Po,Y as Bl,Z as Ao,_ as wo,$ as gl,a0 as _o,a1 as Eo,a2 as Ro,a3 as Mo,a4 as No,a5 as zo,a6 as Hl,a7 as Kn,a8 as Vo,a9 as $o,aa as Oo,ab as Qo,ac as jo,ad as bn,ae as Xa,af as Gl,ag as An,ah as $a,ai as In,aj as Ve,ak as qo,al as Uo,am as oe,an as Wl,ao as Ca,ap as Me,aq as Ya,ar as xn,as as le,at as Je,au as Bo,av as el,aw as Oe,ax as Ee,ay as Sn,az as nl,aA as Jl,aB as al,aC as Ho,aD as Zl,aE as Ae,aF as qe,aG as ta,aH as Go,aI as ia,aJ as Fa,aK as Xl,aL as Yl,aM as Wo,aN as et,aO as nt,aP as at,aQ as Qn,aR as en,aS as Ze,aT as Fe,aU as Jo,aV as pl,aW as lt,aX as Zo,aY as Xo,aZ as Yo,a_ as ed,a$ as nd,b0 as _n,b1 as pn,b2 as Oa,b3 as yn,b4 as tt,b5 as ad,b6 as fn,b7 as ld,b8 as Ka,b9 as td,ba as ll,bb as id,bc as tl,bd as it,be as rt,bf as rd,bg as Qa,bh as st,bi as sd,bj as od,bk as ua,bl as dd,bm as ot,bn as dt,bo as cd,bp as ct,bq as ud,br as ut,bs as md,bt as xa,bu as gd,bv as pd,bw as mt,bx as yd,by as fd,bz as hd,bA as kd,bB as bd,bC as Sd,bD as vd,bE as yl,bF as Cd}from"./components-DwERj42u.js";import{R as sn,C as ra,X as on,Y as Ne,a as dn,T as cn,B as En,A as Xn,b as gt,c as il,L as pt,d as Fd,P as Kd,e as xd,f as Dd}from"./vendor-recharts-Dgcm35Jq.js";import{p as rl,R as sa,n as oa,j as Td,E as yt,m as Id,o as Ld,i as Pd}from"./vendor-codemirror-CIhY_nEU.js";const ft=u.createContext(null);function Ty({children:n,...a}){const[l]=u.useState(()=>mo(a));return e(ft.Provider,{value:l,children:n})}function ja(n,a){const l=Ke.useContext(ft);if(!l)throw new Error("Missing CredentialsContext.Provider in the tree");return ya(l,n,a)}const ht="arize-phoenix-feature-flags",Pa={playground:!1};function Ad(){const n=localStorage.getItem(ht);if(!n)return Pa;try{const a=JSON.parse(n);return Object.assign({},Pa,a)}catch{return Pa}}const kt=u.createContext(null);function bt(){const n=Ke.useContext(kt);if(n===null)throw new Error("useFeatureFlags must be used within a FeatureFlagsProvider");return n}function St(n){const{featureFlags:a}=bt();return a[n]}function Iy(n){const[a,l]=u.useState(Ad()),t=i=>{localStorage.setItem(ht,JSON.stringify(i)),l(i)};return e(kt.Provider,{value:{featureFlags:a,setFeatureFlags:t},children:e(wd,{children:n.children})})}function wd(n){const{children:a}=n,{featureFlags:l,setFeatureFlags:t}=bt(),[i,r]=u.useState(!1);return Rs("ctrl+shift+f",()=>r(!0)),s(q,{children:[a,e(W,{type:"modal",isDismissable:!0,onDismiss:()=>r(!1),children:i&&e(G,{title:"Feature Flags",children:e(F,{height:"size-1000",padding:"size-100",children:Object.keys(l).map(o=>e(ea,{isSelected:l[o],onChange:c=>t({...l,[o]:c}),children:o},o))})})})]})}const vt=u.createContext(null);function _d(){const n=u.useContext(vt);if(n===null)throw new Error("useFunctionality must be used within a FunctionalityProvider");return n}function Ly(n){return e(vt.Provider,{value:{authenticationEnabled:window.Config.authenticationEnabled},children:n.children})}const Ed=C`
1
+ import{r as u,j as e,R as Ke,n as ya,ak as Rs,l as s,O as q,A as C,al as Pe,E as ne,t as D,am as Pn,an as ln,$ as B,ao as ca,H as he,I as ke,M as Z,K as Rn,g as El,ap as Xe,aq as ue,ar as Ye,as as Ms,P as Ba,at as Cn,au as se,av as ve,a9 as Ie,aa as H,ab as Ns,aw as we,ax as zs,ay as Ta,az as Ia,aA as La,aB as qn,aC as fa,o as Vs,aD as $s,aE as Os,af as Qs,ag as js,aF as qs,p as Us,q as Bs,aG as Hs,D as Gs,aH as O,aI as Ws,aJ as Js,aK as cl,aL as Zs,aM as Xs,aN as Ys,aO as eo,aP as no,aQ as ao,aR as lo,aS as to}from"./vendor-D-NIjePD.js";import{C as G,d as F,K as ea,D as W,c as h,I as P,a as I,J as Ha,G as Te,H as J,M as _e,N as de,O as io,m as ha,Q as na,P as tn,S as Be,i as Mn,j as re,q as Fn,r as Nn,v as ge,b as K,o as Rl,U as Re,L as Zn,V as Ml,e as M,t as ee,W as Nl,X as zl,Y as ro,Z as so,h as kn,w as aa,T as Le,k as X,B as ka,s as ye,$ as z,a0 as Ga,E as ba,f as wn,a1 as Wa,a2 as oo,z as la,u as co,a3 as uo,R as ga,n as Vl}from"./vendor-arizeai-DoY5jUTO.js";import{c as mo,N as go,T as po,L as fe,u as ce,B as yo,a as mn,D as fo,G as ho,b as ko,d as bo,S as So,R as xe,e as ze,f as He,g as Ja,P as $l,h as Ol,M as ul,i as ml,j as zn,k as vo,l as Co,m as Q,n as Ql,o as Ce,p as Sa,q as Vn,r as jl,s as $n,t as On,v as ql,w as Ge,x as Qe,C as pe,y as va,z as rn,A as Za,E as We,F as Ul,H as Fo,I as Ko,J as xo,K as Do,O as To,Q as Io,U as je,V as me,W as Lo,X as Po,Y as Bl,Z as Ao,_ as wo,$ as gl,a0 as _o,a1 as Eo,a2 as Ro,a3 as Mo,a4 as No,a5 as zo,a6 as Hl,a7 as Kn,a8 as Vo,a9 as $o,aa as Oo,ab as Qo,ac as jo,ad as bn,ae as Xa,af as Gl,ag as An,ah as $a,ai as In,aj as Ve,ak as qo,al as Uo,am as oe,an as Wl,ao as Ca,ap as Me,aq as Ya,ar as xn,as as le,at as Je,au as Bo,av as el,aw as Oe,ax as Ee,ay as Sn,az as nl,aA as Jl,aB as al,aC as Ho,aD as Zl,aE as Ae,aF as qe,aG as ta,aH as Go,aI as ia,aJ as Fa,aK as Xl,aL as Yl,aM as Wo,aN as et,aO as nt,aP as at,aQ as Qn,aR as en,aS as Ze,aT as Fe,aU as Jo,aV as pl,aW as lt,aX as Zo,aY as Xo,aZ as Yo,a_ as ed,a$ as nd,b0 as _n,b1 as pn,b2 as Oa,b3 as yn,b4 as tt,b5 as ad,b6 as fn,b7 as ld,b8 as Ka,b9 as td,ba as ll,bb as id,bc as tl,bd as it,be as rt,bf as rd,bg as Qa,bh as st,bi as sd,bj as od,bk as ua,bl as dd,bm as ot,bn as dt,bo as cd,bp as ct,bq as ud,br as ut,bs as md,bt as xa,bu as gd,bv as pd,bw as mt,bx as yd,by as fd,bz as hd,bA as kd,bB as bd,bC as Sd,bD as vd,bE as yl,bF as Cd}from"./components-CeBEsPFA.js";import{R as sn,C as ra,X as on,Y as Ne,a as dn,T as cn,B as En,A as Xn,b as gt,c as il,L as pt,d as Fd,P as Kd,e as xd,f as Dd}from"./vendor-recharts-Dgcm35Jq.js";import{p as rl,R as sa,n as oa,j as Td,E as yt,m as Id,o as Ld,i as Pd}from"./vendor-codemirror-CIhY_nEU.js";const ft=u.createContext(null);function Ty({children:n,...a}){const[l]=u.useState(()=>mo(a));return e(ft.Provider,{value:l,children:n})}function ja(n,a){const l=Ke.useContext(ft);if(!l)throw new Error("Missing CredentialsContext.Provider in the tree");return ya(l,n,a)}const ht="arize-phoenix-feature-flags",Pa={playground:!1};function Ad(){const n=localStorage.getItem(ht);if(!n)return Pa;try{const a=JSON.parse(n);return Object.assign({},Pa,a)}catch{return Pa}}const kt=u.createContext(null);function bt(){const n=Ke.useContext(kt);if(n===null)throw new Error("useFeatureFlags must be used within a FeatureFlagsProvider");return n}function St(n){const{featureFlags:a}=bt();return a[n]}function Iy(n){const[a,l]=u.useState(Ad()),t=i=>{localStorage.setItem(ht,JSON.stringify(i)),l(i)};return e(kt.Provider,{value:{featureFlags:a,setFeatureFlags:t},children:e(wd,{children:n.children})})}function wd(n){const{children:a}=n,{featureFlags:l,setFeatureFlags:t}=bt(),[i,r]=u.useState(!1);return Rs("ctrl+shift+f",()=>r(!0)),s(q,{children:[a,e(W,{type:"modal",isDismissable:!0,onDismiss:()=>r(!1),children:i&&e(G,{title:"Feature Flags",children:e(F,{height:"size-1000",padding:"size-100",children:Object.keys(l).map(o=>e(ea,{isSelected:l[o],onChange:c=>t({...l,[o]:c}),children:o},o))})})})]})}const vt=u.createContext(null);function _d(){const n=u.useContext(vt);if(n===null)throw new Error("useFunctionality must be used within a FunctionalityProvider");return n}function Ly(n){return e(vt.Provider,{value:{authenticationEnabled:window.Config.authenticationEnabled},children:n.children})}const Ed=C`
2
2
  display: flex;
3
3
  direction: row;
4
4
  height: 100vh;
@@ -27,7 +27,7 @@ import{r as u,j as e,R as Ke,n as ya,ak as Rs,l as s,O as q,A as C,al as Pe,E as
27
27
  display: flex;
28
28
  flex-direction: column;
29
29
  gap: var(--ac-global-dimension-size-50);
30
- `;function Py(){return s("div",{css:Ed,"data-testid":"layout",children:[e(Vd,{}),s("div",{css:Rd,children:[e(po,{children:e(go,{})}),e("div",{"data-testid":"content",css:Md,children:e(u.Suspense,{fallback:e(fe,{}),children:e(Pe,{})})})]})]})}function Vd(){const n=u.useMemo(()=>window.Config.hasInferences,[]),a=ge(),{authenticationEnabled:l}=_d(),t=ne(),i=u.useCallback(async()=>{const o=await fetch("/auth/logout",{method:"POST"});if(o.ok){t("/login");return}a({title:"Logout Failed",message:"Failed to log out: "+o.statusText})},[t,a]),r=St("playground");return s(So,{children:[e(yo,{}),s(h,{direction:"column",justifyContent:"space-between",flex:"1 1 auto",children:[s("ul",{css:zd,children:[n&&e("li",{children:e(mn,{to:"/model",text:"Model",icon:e(P,{svg:e(I.CubeOutline,{})})})}),e("li",{children:e(mn,{to:"/projects",text:"Projects",icon:e(P,{svg:e(I.GridOutline,{})})})}),e("li",{children:e(mn,{to:"/datasets",text:"Datasets",icon:e(P,{svg:e(I.DatabaseOutline,{})})})}),r&&e("li",{children:e(mn,{to:"/playground",text:"Playground",icon:e(P,{svg:e(I.PlayCircleOutline,{})})})}),e("li",{children:e(mn,{to:"/apis",text:"APIs",icon:e(P,{svg:e(I.Code,{})})})})]}),s("ul",{css:Nd,children:[e("li",{children:e(mn,{to:"/settings",text:"Settings",icon:e(P,{svg:e(I.SettingsOutline,{})})})}),e("li",{children:e(fo,{})}),e("li",{children:e(ho,{})}),e("li",{children:e(ko,{})}),l&&s(q,{children:[e("li",{children:e(mn,{to:"/profile",text:"Profile",icon:e(P,{svg:e(I.PersonOutline,{})})})}),e("li",{children:e(bo,{text:"Log Out",icon:e(P,{svg:e(I.LogOut,{})}),onClick:i})})]})]})]})]})}const Ct=function(){var n=[{alias:null,args:null,concreteType:"Functionality",kind:"LinkedField",name:"functionality",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"modelInferences",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"ProjectConnection",kind:"LinkedField",name:"projects",plural:!1,selections:[{alias:null,args:null,concreteType:"ProjectEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"project",args:null,concreteType:"Project",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"endTime",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"homeLoaderQuery",selections:n,type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"homeLoaderQuery",selections:n},params:{cacheID:"6926e4e720b443f7b7252b60271944e6",id:null,metadata:{},name:"homeLoaderQuery",operationKind:"query",text:`query homeLoaderQuery {
30
+ `;function Py(){return s("div",{css:Ed,"data-testid":"layout",children:[e(Vd,{}),s("div",{css:Rd,children:[e(po,{children:e(go,{})}),e("div",{"data-testid":"content",css:Md,children:e(u.Suspense,{fallback:e(fe,{}),children:e(Pe,{})})})]})]})}function Vd(){const n=u.useMemo(()=>window.Config.hasInferences,[]),a=ce(),{authenticationEnabled:l}=_d(),t=ne(),i=u.useCallback(async()=>{const o=await fetch("/auth/logout",{method:"POST"});if(o.ok){t("/login");return}a({title:"Logout Failed",message:"Failed to log out: "+o.statusText})},[t,a]),r=St("playground");return s(So,{children:[e(yo,{}),s(h,{direction:"column",justifyContent:"space-between",flex:"1 1 auto",children:[s("ul",{css:zd,children:[n&&e("li",{children:e(mn,{to:"/model",text:"Model",icon:e(P,{svg:e(I.CubeOutline,{})})})}),e("li",{children:e(mn,{to:"/projects",text:"Projects",icon:e(P,{svg:e(I.GridOutline,{})})})}),e("li",{children:e(mn,{to:"/datasets",text:"Datasets",icon:e(P,{svg:e(I.DatabaseOutline,{})})})}),r&&e("li",{children:e(mn,{to:"/playground",text:"Playground",icon:e(P,{svg:e(I.PlayCircleOutline,{})})})}),e("li",{children:e(mn,{to:"/apis",text:"APIs",icon:e(P,{svg:e(I.Code,{})})})})]}),s("ul",{css:Nd,children:[e("li",{children:e(mn,{to:"/settings",text:"Settings",icon:e(P,{svg:e(I.SettingsOutline,{})})})}),e("li",{children:e(fo,{})}),e("li",{children:e(ho,{})}),e("li",{children:e(ko,{})}),l&&s(q,{children:[e("li",{children:e(mn,{to:"/profile",text:"Profile",icon:e(P,{svg:e(I.PersonOutline,{})})})}),e("li",{children:e(bo,{text:"Log Out",icon:e(P,{svg:e(I.LogOut,{})}),onClick:i})})]})]})]})]})}const Ct=function(){var n=[{alias:null,args:null,concreteType:"Functionality",kind:"LinkedField",name:"functionality",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"modelInferences",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"ProjectConnection",kind:"LinkedField",name:"projects",plural:!1,selections:[{alias:null,args:null,concreteType:"ProjectEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"project",args:null,concreteType:"Project",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"endTime",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"homeLoaderQuery",selections:n,type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"homeLoaderQuery",selections:n},params:{cacheID:"6926e4e720b443f7b7252b60271944e6",id:null,metadata:{},name:"homeLoaderQuery",operationKind:"query",text:`query homeLoaderQuery {
31
31
  functionality {
32
32
  modelInferences
33
33
  }
@@ -117,7 +117,7 @@ fragment MetricSelector_dimensions on Model {
117
117
  }
118
118
  }
119
119
  }
120
- `}};Kt.hash="374499f7f8ce6919e4a0a4ecbe380c52";const xt=function(){var n={defaultValue:null,kind:"LocalArgument",name:"clusterMinSamples"},a={defaultValue:null,kind:"LocalArgument",name:"clusterSelectionEpsilon"},l={defaultValue:null,kind:"LocalArgument",name:"dataQualityMetricColumnName"},t={defaultValue:null,kind:"LocalArgument",name:"fetchDataQualityMetric"},i={defaultValue:null,kind:"LocalArgument",name:"fetchPerformanceMetric"},r={defaultValue:null,kind:"LocalArgument",name:"id"},o={defaultValue:null,kind:"LocalArgument",name:"minClusterSize"},c={defaultValue:null,kind:"LocalArgument",name:"minDist"},d={defaultValue:null,kind:"LocalArgument",name:"nNeighbors"},g={defaultValue:null,kind:"LocalArgument",name:"nSamples"},f={defaultValue:null,kind:"LocalArgument",name:"performanceMetric"},m={defaultValue:null,kind:"LocalArgument",name:"timeRange"},p=[{kind:"Variable",name:"id",variableName:"id"}],y={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},k={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},b={alias:null,args:null,kind:"ScalarField",name:"x",storageKey:null},v={alias:null,args:null,kind:"ScalarField",name:"y",storageKey:null},S=[y,{alias:null,args:null,kind:"ScalarField",name:"eventId",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"coordinates",plural:!1,selections:[k,{kind:"InlineFragment",selections:[b,v,{alias:null,args:null,kind:"ScalarField",name:"z",storageKey:null}],type:"Point3D",abstractKey:null},{kind:"InlineFragment",selections:[b,v],type:"Point2D",abstractKey:null}],storageKey:null},{alias:null,args:null,concreteType:"EmbeddingMetadata",kind:"LinkedField",name:"embeddingMetadata",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"linkToData",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"rawData",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"EventMetadata",kind:"LinkedField",name:"eventMetadata",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"predictionId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"predictionLabel",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"actualLabel",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"predictionScore",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"actualScore",storageKey:null}],storageKey:null}],L=[{alias:null,args:null,kind:"ScalarField",name:"primaryValue",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"referenceValue",storageKey:null}],A={kind:"InlineFragment",selections:[{alias:null,args:[{kind:"Variable",name:"clusterMinSamples",variableName:"clusterMinSamples"},{kind:"Variable",name:"clusterSelectionEpsilon",variableName:"clusterSelectionEpsilon"},{kind:"Variable",name:"minClusterSize",variableName:"minClusterSize"},{kind:"Variable",name:"minDist",variableName:"minDist"},{kind:"Variable",name:"nNeighbors",variableName:"nNeighbors"},{kind:"Variable",name:"nSamples",variableName:"nSamples"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],concreteType:"UMAPPoints",kind:"LinkedField",name:"UMAPPoints",plural:!1,selections:[{alias:null,args:null,concreteType:"UMAPPoint",kind:"LinkedField",name:"data",plural:!0,selections:S,storageKey:null},{alias:null,args:null,concreteType:"UMAPPoint",kind:"LinkedField",name:"referenceData",plural:!0,selections:S,storageKey:null},{alias:null,args:null,concreteType:"UMAPPoint",kind:"LinkedField",name:"corpusData",plural:!0,selections:S,storageKey:null},{alias:null,args:null,concreteType:"Cluster",kind:"LinkedField",name:"clusters",plural:!0,selections:[y,{alias:null,args:null,kind:"ScalarField",name:"eventIds",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"driftRatio",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"primaryToCorpusRatio",storageKey:null},{condition:"fetchDataQualityMetric",kind:"Condition",passingValue:!0,selections:[{alias:null,args:[{fields:[{kind:"Variable",name:"columnName",variableName:"dataQualityMetricColumnName"},{kind:"Literal",name:"metric",value:"mean"}],kind:"ObjectValue",name:"metric"}],concreteType:"DatasetValues",kind:"LinkedField",name:"dataQualityMetric",plural:!1,selections:L,storageKey:null}]},{condition:"fetchPerformanceMetric",kind:"Condition",passingValue:!0,selections:[{alias:null,args:[{fields:[{kind:"Variable",name:"metric",variableName:"performanceMetric"}],kind:"ObjectValue",name:"metric"}],concreteType:"DatasetValues",kind:"LinkedField",name:"performanceMetric",plural:!1,selections:L,storageKey:null}]}],storageKey:null},{alias:null,args:null,concreteType:"Retrieval",kind:"LinkedField",name:"contextRetrievals",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"queryId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"documentId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"relevance",storageKey:null}],storageKey:null}],storageKey:null}],type:"EmbeddingDimension",abstractKey:null};return{fragment:{argumentDefinitions:[n,a,l,t,i,r,o,c,d,g,f,m],kind:"Fragment",metadata:null,name:"EmbeddingPageUMAPQuery",selections:[{alias:"embedding",args:p,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[A],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[r,m,c,d,g,o,n,a,t,l,i,f],kind:"Operation",name:"EmbeddingPageUMAPQuery",selections:[{alias:"embedding",args:p,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[k,A,{kind:"TypeDiscriminator",abstractKey:"__isNode"},y],storageKey:null}]},params:{cacheID:"d30210c52f86b9d9a7ac958f866aa93e",id:null,metadata:{},name:"EmbeddingPageUMAPQuery",operationKind:"query",text:`query EmbeddingPageUMAPQuery(
120
+ `}};Kt.hash="374499f7f8ce6919e4a0a4ecbe380c52";const xt=function(){var n={defaultValue:null,kind:"LocalArgument",name:"clusterMinSamples"},a={defaultValue:null,kind:"LocalArgument",name:"clusterSelectionEpsilon"},l={defaultValue:null,kind:"LocalArgument",name:"dataQualityMetricColumnName"},t={defaultValue:null,kind:"LocalArgument",name:"fetchDataQualityMetric"},i={defaultValue:null,kind:"LocalArgument",name:"fetchPerformanceMetric"},r={defaultValue:null,kind:"LocalArgument",name:"id"},o={defaultValue:null,kind:"LocalArgument",name:"minClusterSize"},c={defaultValue:null,kind:"LocalArgument",name:"minDist"},d={defaultValue:null,kind:"LocalArgument",name:"nNeighbors"},g={defaultValue:null,kind:"LocalArgument",name:"nSamples"},f={defaultValue:null,kind:"LocalArgument",name:"performanceMetric"},m={defaultValue:null,kind:"LocalArgument",name:"timeRange"},p=[{kind:"Variable",name:"id",variableName:"id"}],y={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},b={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},k={alias:null,args:null,kind:"ScalarField",name:"x",storageKey:null},v={alias:null,args:null,kind:"ScalarField",name:"y",storageKey:null},S=[y,{alias:null,args:null,kind:"ScalarField",name:"eventId",storageKey:null},{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"coordinates",plural:!1,selections:[b,{kind:"InlineFragment",selections:[k,v,{alias:null,args:null,kind:"ScalarField",name:"z",storageKey:null}],type:"Point3D",abstractKey:null},{kind:"InlineFragment",selections:[k,v],type:"Point2D",abstractKey:null}],storageKey:null},{alias:null,args:null,concreteType:"EmbeddingMetadata",kind:"LinkedField",name:"embeddingMetadata",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"linkToData",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"rawData",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"EventMetadata",kind:"LinkedField",name:"eventMetadata",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"predictionId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"predictionLabel",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"actualLabel",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"predictionScore",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"actualScore",storageKey:null}],storageKey:null}],A=[{alias:null,args:null,kind:"ScalarField",name:"primaryValue",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"referenceValue",storageKey:null}],L={kind:"InlineFragment",selections:[{alias:null,args:[{kind:"Variable",name:"clusterMinSamples",variableName:"clusterMinSamples"},{kind:"Variable",name:"clusterSelectionEpsilon",variableName:"clusterSelectionEpsilon"},{kind:"Variable",name:"minClusterSize",variableName:"minClusterSize"},{kind:"Variable",name:"minDist",variableName:"minDist"},{kind:"Variable",name:"nNeighbors",variableName:"nNeighbors"},{kind:"Variable",name:"nSamples",variableName:"nSamples"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],concreteType:"UMAPPoints",kind:"LinkedField",name:"UMAPPoints",plural:!1,selections:[{alias:null,args:null,concreteType:"UMAPPoint",kind:"LinkedField",name:"data",plural:!0,selections:S,storageKey:null},{alias:null,args:null,concreteType:"UMAPPoint",kind:"LinkedField",name:"referenceData",plural:!0,selections:S,storageKey:null},{alias:null,args:null,concreteType:"UMAPPoint",kind:"LinkedField",name:"corpusData",plural:!0,selections:S,storageKey:null},{alias:null,args:null,concreteType:"Cluster",kind:"LinkedField",name:"clusters",plural:!0,selections:[y,{alias:null,args:null,kind:"ScalarField",name:"eventIds",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"driftRatio",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"primaryToCorpusRatio",storageKey:null},{condition:"fetchDataQualityMetric",kind:"Condition",passingValue:!0,selections:[{alias:null,args:[{fields:[{kind:"Variable",name:"columnName",variableName:"dataQualityMetricColumnName"},{kind:"Literal",name:"metric",value:"mean"}],kind:"ObjectValue",name:"metric"}],concreteType:"DatasetValues",kind:"LinkedField",name:"dataQualityMetric",plural:!1,selections:A,storageKey:null}]},{condition:"fetchPerformanceMetric",kind:"Condition",passingValue:!0,selections:[{alias:null,args:[{fields:[{kind:"Variable",name:"metric",variableName:"performanceMetric"}],kind:"ObjectValue",name:"metric"}],concreteType:"DatasetValues",kind:"LinkedField",name:"performanceMetric",plural:!1,selections:A,storageKey:null}]}],storageKey:null},{alias:null,args:null,concreteType:"Retrieval",kind:"LinkedField",name:"contextRetrievals",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"queryId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"documentId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"relevance",storageKey:null}],storageKey:null}],storageKey:null}],type:"EmbeddingDimension",abstractKey:null};return{fragment:{argumentDefinitions:[n,a,l,t,i,r,o,c,d,g,f,m],kind:"Fragment",metadata:null,name:"EmbeddingPageUMAPQuery",selections:[{alias:"embedding",args:p,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[L],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[r,m,c,d,g,o,n,a,t,l,i,f],kind:"Operation",name:"EmbeddingPageUMAPQuery",selections:[{alias:"embedding",args:p,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[b,L,{kind:"TypeDiscriminator",abstractKey:"__isNode"},y],storageKey:null}]},params:{cacheID:"d30210c52f86b9d9a7ac958f866aa93e",id:null,metadata:{},name:"EmbeddingPageUMAPQuery",operationKind:"query",text:`query EmbeddingPageUMAPQuery(
121
121
  $id: GlobalID!
122
122
  $timeRange: TimeRange!
123
123
  $minDist: Float!
@@ -266,14 +266,14 @@ fragment MetricSelector_dimensions on Model {
266
266
  height: 0;
267
267
  vertical-align: middle;
268
268
  width: 0;
269
- `})]}),e(ha,{children:e(na,{style:{width:200},selectedKeys:[c],selectionMode:"single",items:o,onSelectionChange:d=>{if(d instanceof Set&&d.size>0){const[g]=d.values(),[f,m]=g.split(":");t({column:f,dir:m})}r(!1)},children:d=>e(U,{children:d.label},d.value)})})]})})}const Tt=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"clusters"}],a=[{alias:null,args:[{kind:"Variable",name:"clusters",variableName:"clusters"}],concreteType:"ExportedFile",kind:"LinkedField",name:"exportClusters",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"fileName",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"EmbeddingActionMenuExportClustersMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"EmbeddingActionMenuExportClustersMutation",selections:a},params:{cacheID:"1bef6586fcb3d6eb7034204fbe49633c",id:null,metadata:{},name:"EmbeddingActionMenuExportClustersMutation",operationKind:"mutation",text:`mutation EmbeddingActionMenuExportClustersMutation(
269
+ `})]}),e(ha,{children:e(na,{style:{width:200},selectedKeys:[c],selectionMode:"single",items:o,onSelectionChange:d=>{if(d instanceof Set&&d.size>0){const[g]=d.values(),[f,m]=g.split(":");t({column:f,dir:m})}r(!1)},children:d=>e(B,{children:d.label},d.value)})})]})})}const Tt=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"clusters"}],a=[{alias:null,args:[{kind:"Variable",name:"clusters",variableName:"clusters"}],concreteType:"ExportedFile",kind:"LinkedField",name:"exportClusters",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"fileName",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"EmbeddingActionMenuExportClustersMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"EmbeddingActionMenuExportClustersMutation",selections:a},params:{cacheID:"1bef6586fcb3d6eb7034204fbe49633c",id:null,metadata:{},name:"EmbeddingActionMenuExportClustersMutation",operationKind:"mutation",text:`mutation EmbeddingActionMenuExportClustersMutation(
270
270
  $clusters: [ClusterInput!]!
271
271
  ) {
272
272
  exportClusters(clusters: $clusters) {
273
273
  fileName
274
274
  }
275
275
  }
276
- `}}}();Tt.hash="b5ff2517dbb0d19a1b24dea1796a3576";function jd(){const n=Q(r=>r.clusters),{notifyError:a,notifySuccess:l}=Ql(),[t,i]=D.useMutation(Tt);return e(Be,{align:"end",buttonSize:"compact",icon:i?e(P,{svg:e(I.LoadingOutline,{})}):null,onAction:r=>{switch(r){case"export_cluster":t({variables:{clusters:n.map(o=>({eventIds:o.eventIds,id:o.id}))},onCompleted:o=>{const{fileName:c}=o.exportClusters;l({title:"Clusters Exported",message:"dataframe is available via px.active_session().exports or can be downloaded by clicking below",action:{text:"Download",onClick:()=>{window.open(`/exports?filename=${c}`,"_self")}}})},onError:o=>{a({title:"Failed to export clusters",message:`Failed to export clusters: ${o.message}`})}});break}},children:s(U,{children:[e(P,{svg:e(I.Download,{})}),"Export clusters"]},"export_cluster")})}const It={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"MetricSelector_dimensions",selections:[{alias:"numericDimensions",args:[{kind:"Literal",name:"include",value:{dataTypes:["numeric"]}}],concreteType:"DimensionConnection",kind:"LinkedField",name:"dimensions",plural:!1,selections:[{alias:null,args:null,concreteType:"DimensionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"Dimension",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"type",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:'dimensions(include:{"dataTypes":["numeric"]})'}],type:"Model",abstractKey:null};It.hash="55d03de16503d7af254c17cef7d18ee0";const Ln=":";function qd(n){return["drift","performance","dataQuality","retrieval"].includes(n)}function Un(n){const{type:a,metric:l}=n;switch(a){case"drift":return`${a}${Ln}${l}`;case"retrieval":return`${a}${Ln}${l}`;case"performance":return`${a}${Ln}${l}`;case"dataQuality":{const{name:t}=n.dimension;return`${a}${Ln}${l}${Ln}${t}`}default:Ce()}}function Ud({metricKey:n,dimensions:a}){const[l,t,i]=n.split(Ln);if(!qd(l))throw new Error(`Invalid metric type: ${l}`);switch(l){case"drift":return{type:l,metric:t};case"retrieval":return{type:l,metric:t};case"performance":return{type:l,metric:t};case"dataQuality":{const r=a.find(o=>o.name===i);if(!r)throw new Error(`Invalid dimension name: ${i}`);return{type:l,metric:t,dimension:r}}default:Ce()}}const Bd=s(Nn,{variant:"info",children:[e(re,{level:4,children:"Analysis Metric"}),s(Fn,{children:[e("p",{children:"Select a metric to drive the analysis of your embeddings."}),e("p",{children:"To analyze the the drift between your two inferencess, select a drift metric and the UI will highlight areas of high drift."}),e("p",{children:"To analyze the quality of your embeddings, select a dimension data quality metric by which to analyze the point cloud. The UI will highlight areas where the data quality is degrading."})]})]});function Hd({model:n}){const[,a]=u.useTransition(),l=D.useFragment(It,n),{referenceInferences:t,corpusInferences:i}=ze(),r=!!t,o=!!i,c=Q(y=>y.metric),d=Q(y=>y.loading),g=Q(y=>y.setMetric),f=l.numericDimensions.edges.map(y=>y.node),m=f.length>0,p=u.useCallback(y=>{const k=Ud({metricKey:y,dimensions:f});a(()=>{g(k)})},[g,f,a]);return s(Mn,{label:"metric",labelExtra:Bd,selectedKey:c?Un(c):void 0,onSelectionChange:p,placeholder:"Select a metric...",isDisabled:d,children:[r?e(ca,{title:"Drift",children:e(U,{children:"Euclidean Distance"},Un({type:"drift",metric:"euclideanDistance"}))}):null,o?e(ca,{title:"Retrieval",children:e(U,{children:"Query Distance"},Un({type:"retrieval",metric:"queryDistance"}))}):null,e(ca,{title:"Performance",children:e(U,{children:"Accuracy Score"},Un({type:"performance",metric:"accuracyScore"}))}),m?e(ca,{title:"Data Quality",children:f.map(y=>e(U,{children:`${y.name} avg`},Un({type:"dataQuality",metric:"average",dimension:y})))}):null]})}const Lt=function(){var n={defaultValue:null,kind:"LocalArgument",name:"countGranularity"},a={defaultValue:null,kind:"LocalArgument",name:"dimensionId"},l={defaultValue:null,kind:"LocalArgument",name:"embeddingDimensionId"},t={defaultValue:null,kind:"LocalArgument",name:"fetchDataQuality"},i={defaultValue:null,kind:"LocalArgument",name:"fetchDrift"},r={defaultValue:null,kind:"LocalArgument",name:"fetchPerformance"},o={defaultValue:null,kind:"LocalArgument",name:"fetchQueryDistance"},c={defaultValue:null,kind:"LocalArgument",name:"metricGranularity"},d={defaultValue:null,kind:"LocalArgument",name:"performanceMetric"},g={defaultValue:null,kind:"LocalArgument",name:"timeRange"},f=[{kind:"Variable",name:"id",variableName:"embeddingDimensionId"}],m={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},p={kind:"Variable",name:"granularity",variableName:"metricGranularity"},y={kind:"Variable",name:"timeRange",variableName:"timeRange"},k=[p,{kind:"Literal",name:"metric",value:"euclideanDistance"},y],b=[{alias:null,args:null,concreteType:"TimeSeriesDataPoint",kind:"LinkedField",name:"data",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"timestamp",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null}],v={kind:"InlineFragment",selections:[{condition:"fetchDrift",kind:"Condition",passingValue:!0,selections:[{alias:"euclideanDistanceTimeSeries",args:k,concreteType:"DriftTimeSeries",kind:"LinkedField",name:"driftTimeSeries",plural:!1,selections:b,storageKey:null}]},{condition:"fetchQueryDistance",kind:"Condition",passingValue:!0,selections:[{alias:null,args:k,concreteType:"DriftTimeSeries",kind:"LinkedField",name:"retrievalMetricTimeSeries",plural:!1,selections:b,storageKey:null}]},{alias:"trafficTimeSeries",args:[{kind:"Variable",name:"granularity",variableName:"countGranularity"},{kind:"Literal",name:"metric",value:"count"},y],concreteType:"DataQualityTimeSeries",kind:"LinkedField",name:"dataQualityTimeSeries",plural:!1,selections:b,storageKey:null}],type:"EmbeddingDimension",abstractKey:null},S=[{kind:"Variable",name:"id",variableName:"dimensionId"}],L={kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:[p,{kind:"Literal",name:"metric",value:"mean"},y],concreteType:"DataQualityTimeSeries",kind:"LinkedField",name:"dataQualityTimeSeries",plural:!1,selections:b,storageKey:null}],type:"Dimension",abstractKey:null},A={alias:null,args:null,concreteType:"Model",kind:"LinkedField",name:"model",plural:!1,selections:[{condition:"fetchPerformance",kind:"Condition",passingValue:!0,selections:[{alias:null,args:[p,{fields:[{kind:"Variable",name:"metric",variableName:"performanceMetric"}],kind:"ObjectValue",name:"metric"},y],concreteType:"PerformanceTimeSeries",kind:"LinkedField",name:"performanceTimeSeries",plural:!1,selections:b,storageKey:null}]}],storageKey:null},_={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null};return{fragment:{argumentDefinitions:[n,a,l,t,i,r,o,c,d,g],kind:"Fragment",metadata:null,name:"MetricTimeSeriesQuery",selections:[{alias:"embedding",args:f,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[m,v],storageKey:null},{condition:"fetchDataQuality",kind:"Condition",passingValue:!0,selections:[{alias:"dimension",args:S,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[L],storageKey:null}]},A],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[l,g,c,n,i,o,t,a,r,d],kind:"Operation",name:"MetricTimeSeriesQuery",selections:[{alias:"embedding",args:f,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[_,m,v],storageKey:null},{condition:"fetchDataQuality",kind:"Condition",passingValue:!0,selections:[{alias:"dimension",args:S,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[_,L,{kind:"TypeDiscriminator",abstractKey:"__isNode"},m],storageKey:null}]},A]},params:{cacheID:"a68a8204bf7fdd13e6915b338d4b5497",id:null,metadata:{},name:"MetricTimeSeriesQuery",operationKind:"query",text:`query MetricTimeSeriesQuery(
276
+ `}}}();Tt.hash="b5ff2517dbb0d19a1b24dea1796a3576";function jd(){const n=Q(r=>r.clusters),{notifyError:a,notifySuccess:l}=Ql(),[t,i]=D.useMutation(Tt);return e(Be,{align:"end",buttonSize:"compact",icon:i?e(P,{svg:e(I.LoadingOutline,{})}):null,onAction:r=>{switch(r){case"export_cluster":t({variables:{clusters:n.map(o=>({eventIds:o.eventIds,id:o.id}))},onCompleted:o=>{const{fileName:c}=o.exportClusters;l({title:"Clusters Exported",message:"dataframe is available via px.active_session().exports or can be downloaded by clicking below",action:{text:"Download",onClick:()=>{window.open(`/exports?filename=${c}`,"_self")}}})},onError:o=>{a({title:"Failed to export clusters",message:`Failed to export clusters: ${o.message}`})}});break}},children:s(B,{children:[e(P,{svg:e(I.Download,{})}),"Export clusters"]},"export_cluster")})}const It={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"MetricSelector_dimensions",selections:[{alias:"numericDimensions",args:[{kind:"Literal",name:"include",value:{dataTypes:["numeric"]}}],concreteType:"DimensionConnection",kind:"LinkedField",name:"dimensions",plural:!1,selections:[{alias:null,args:null,concreteType:"DimensionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"Dimension",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"type",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:'dimensions(include:{"dataTypes":["numeric"]})'}],type:"Model",abstractKey:null};It.hash="55d03de16503d7af254c17cef7d18ee0";const Ln=":";function qd(n){return["drift","performance","dataQuality","retrieval"].includes(n)}function Un(n){const{type:a,metric:l}=n;switch(a){case"drift":return`${a}${Ln}${l}`;case"retrieval":return`${a}${Ln}${l}`;case"performance":return`${a}${Ln}${l}`;case"dataQuality":{const{name:t}=n.dimension;return`${a}${Ln}${l}${Ln}${t}`}default:Ce()}}function Ud({metricKey:n,dimensions:a}){const[l,t,i]=n.split(Ln);if(!qd(l))throw new Error(`Invalid metric type: ${l}`);switch(l){case"drift":return{type:l,metric:t};case"retrieval":return{type:l,metric:t};case"performance":return{type:l,metric:t};case"dataQuality":{const r=a.find(o=>o.name===i);if(!r)throw new Error(`Invalid dimension name: ${i}`);return{type:l,metric:t,dimension:r}}default:Ce()}}const Bd=s(Nn,{variant:"info",children:[e(re,{level:4,children:"Analysis Metric"}),s(Fn,{children:[e("p",{children:"Select a metric to drive the analysis of your embeddings."}),e("p",{children:"To analyze the the drift between your two inferencess, select a drift metric and the UI will highlight areas of high drift."}),e("p",{children:"To analyze the quality of your embeddings, select a dimension data quality metric by which to analyze the point cloud. The UI will highlight areas where the data quality is degrading."})]})]});function Hd({model:n}){const[,a]=u.useTransition(),l=D.useFragment(It,n),{referenceInferences:t,corpusInferences:i}=ze(),r=!!t,o=!!i,c=Q(y=>y.metric),d=Q(y=>y.loading),g=Q(y=>y.setMetric),f=l.numericDimensions.edges.map(y=>y.node),m=f.length>0,p=u.useCallback(y=>{const b=Ud({metricKey:y,dimensions:f});a(()=>{g(b)})},[g,f,a]);return s(Mn,{label:"metric",labelExtra:Bd,selectedKey:c?Un(c):void 0,onSelectionChange:p,placeholder:"Select a metric...",isDisabled:d,children:[r?e(ca,{title:"Drift",children:e(B,{children:"Euclidean Distance"},Un({type:"drift",metric:"euclideanDistance"}))}):null,o?e(ca,{title:"Retrieval",children:e(B,{children:"Query Distance"},Un({type:"retrieval",metric:"queryDistance"}))}):null,e(ca,{title:"Performance",children:e(B,{children:"Accuracy Score"},Un({type:"performance",metric:"accuracyScore"}))}),m?e(ca,{title:"Data Quality",children:f.map(y=>e(B,{children:`${y.name} avg`},Un({type:"dataQuality",metric:"average",dimension:y})))}):null]})}const Lt=function(){var n={defaultValue:null,kind:"LocalArgument",name:"countGranularity"},a={defaultValue:null,kind:"LocalArgument",name:"dimensionId"},l={defaultValue:null,kind:"LocalArgument",name:"embeddingDimensionId"},t={defaultValue:null,kind:"LocalArgument",name:"fetchDataQuality"},i={defaultValue:null,kind:"LocalArgument",name:"fetchDrift"},r={defaultValue:null,kind:"LocalArgument",name:"fetchPerformance"},o={defaultValue:null,kind:"LocalArgument",name:"fetchQueryDistance"},c={defaultValue:null,kind:"LocalArgument",name:"metricGranularity"},d={defaultValue:null,kind:"LocalArgument",name:"performanceMetric"},g={defaultValue:null,kind:"LocalArgument",name:"timeRange"},f=[{kind:"Variable",name:"id",variableName:"embeddingDimensionId"}],m={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},p={kind:"Variable",name:"granularity",variableName:"metricGranularity"},y={kind:"Variable",name:"timeRange",variableName:"timeRange"},b=[p,{kind:"Literal",name:"metric",value:"euclideanDistance"},y],k=[{alias:null,args:null,concreteType:"TimeSeriesDataPoint",kind:"LinkedField",name:"data",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"timestamp",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null}],v={kind:"InlineFragment",selections:[{condition:"fetchDrift",kind:"Condition",passingValue:!0,selections:[{alias:"euclideanDistanceTimeSeries",args:b,concreteType:"DriftTimeSeries",kind:"LinkedField",name:"driftTimeSeries",plural:!1,selections:k,storageKey:null}]},{condition:"fetchQueryDistance",kind:"Condition",passingValue:!0,selections:[{alias:null,args:b,concreteType:"DriftTimeSeries",kind:"LinkedField",name:"retrievalMetricTimeSeries",plural:!1,selections:k,storageKey:null}]},{alias:"trafficTimeSeries",args:[{kind:"Variable",name:"granularity",variableName:"countGranularity"},{kind:"Literal",name:"metric",value:"count"},y],concreteType:"DataQualityTimeSeries",kind:"LinkedField",name:"dataQualityTimeSeries",plural:!1,selections:k,storageKey:null}],type:"EmbeddingDimension",abstractKey:null},S=[{kind:"Variable",name:"id",variableName:"dimensionId"}],A={kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:[p,{kind:"Literal",name:"metric",value:"mean"},y],concreteType:"DataQualityTimeSeries",kind:"LinkedField",name:"dataQualityTimeSeries",plural:!1,selections:k,storageKey:null}],type:"Dimension",abstractKey:null},L={alias:null,args:null,concreteType:"Model",kind:"LinkedField",name:"model",plural:!1,selections:[{condition:"fetchPerformance",kind:"Condition",passingValue:!0,selections:[{alias:null,args:[p,{fields:[{kind:"Variable",name:"metric",variableName:"performanceMetric"}],kind:"ObjectValue",name:"metric"},y],concreteType:"PerformanceTimeSeries",kind:"LinkedField",name:"performanceTimeSeries",plural:!1,selections:k,storageKey:null}]}],storageKey:null},w={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null};return{fragment:{argumentDefinitions:[n,a,l,t,i,r,o,c,d,g],kind:"Fragment",metadata:null,name:"MetricTimeSeriesQuery",selections:[{alias:"embedding",args:f,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[m,v],storageKey:null},{condition:"fetchDataQuality",kind:"Condition",passingValue:!0,selections:[{alias:"dimension",args:S,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[A],storageKey:null}]},L],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[l,g,c,n,i,o,t,a,r,d],kind:"Operation",name:"MetricTimeSeriesQuery",selections:[{alias:"embedding",args:f,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[w,m,v],storageKey:null},{condition:"fetchDataQuality",kind:"Condition",passingValue:!0,selections:[{alias:"dimension",args:S,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[w,A,{kind:"TypeDiscriminator",abstractKey:"__isNode"},m],storageKey:null}]},L]},params:{cacheID:"a68a8204bf7fdd13e6915b338d4b5497",id:null,metadata:{},name:"MetricTimeSeriesQuery",operationKind:"query",text:`query MetricTimeSeriesQuery(
277
277
  $embeddingDimensionId: GlobalID!
278
278
  $timeRange: TimeRange!
279
279
  $metricGranularity: Granularity!
@@ -340,7 +340,7 @@ fragment MetricSelector_dimensions on Model {
340
340
  gap: var(--px-spacing-sm);
341
341
 
342
342
  margin-top: var(--px-spacing-sm);
343
- `,children:[e(P,{svg:e(Rl,{})}),e("span",{children:"Click to view the point cloud at this time"})]})]})}return null}function Wd(n){switch(n.type){case"drift":return"Embedding Drift";case"performance":return"Model Performance";case"dataQuality":return"Data Quality";case"retrieval":return"Query Distance";default:Ce()}}function Jd(n){if(n)switch(n.type){case"drift":return hn(n.metric);case"performance":return hn(n.metric);case"dataQuality":return`${n.dimension.name} avg`;case"retrieval":return hn(n.metric);default:Ce()}else return"Count"}function Zd(n){switch(n.type){case"drift":return Aa(n.metric);case"performance":return Aa(n.metric);case"dataQuality":return null;case"retrieval":return Aa(n.metric);default:Ce()}}function Xd({embeddingDimensionId:n}){const a=Q(x=>x.metric),l=a.type==="drift",t=a.type==="retrieval",i=a.type==="dataQuality",r=a.type==="performance",{timeRange:o}=He(),{selectedTimestamp:c,setSelectedTimestamp:d}=Sa(),g=Vn(o),f=D.useLazyLoadQuery(Lt,{embeddingDimensionId:n,timeRange:{start:o.start.toISOString(),end:o.end.toISOString()},metricGranularity:jl(o),countGranularity:g,fetchDrift:l,fetchQueryDistance:t,fetchDataQuality:i,fetchPerformance:r,dimensionId:a.type==="dataQuality"?a.dimension.id:n,performanceMetric:a.type==="performance"?a.metric:"accuracyScore"}),m=$n({samplingIntervalMinutes:g.samplingIntervalMinutes}),p=u.useCallback(x=>{const{activePayload:T}=x;if(T!=null&&T.length>0){const E=T[0].payload;d(new Date(E.timestamp))}},[d]),y=Yd({data:f,metric:a}),b=ec(f).reduce((x,T)=>(x[T.timestamp]=T.value,x),{})??{},v=y.map(x=>{const T=b[x.timestamp];return{...x,traffic:T,timestamp:new Date(x.timestamp).getTime()}}),S=Jd(a),L=Zd(a),{color:A,barColor:_}=Pt();return s("section",{css:C`
343
+ `,children:[e(P,{svg:e(Rl,{})}),e("span",{children:"Click to view the point cloud at this time"})]})]})}return null}function Wd(n){switch(n.type){case"drift":return"Embedding Drift";case"performance":return"Model Performance";case"dataQuality":return"Data Quality";case"retrieval":return"Query Distance";default:Ce()}}function Jd(n){if(n)switch(n.type){case"drift":return hn(n.metric);case"performance":return hn(n.metric);case"dataQuality":return`${n.dimension.name} avg`;case"retrieval":return hn(n.metric);default:Ce()}else return"Count"}function Zd(n){switch(n.type){case"drift":return Aa(n.metric);case"performance":return Aa(n.metric);case"dataQuality":return null;case"retrieval":return Aa(n.metric);default:Ce()}}function Xd({embeddingDimensionId:n}){const a=Q(x=>x.metric),l=a.type==="drift",t=a.type==="retrieval",i=a.type==="dataQuality",r=a.type==="performance",{timeRange:o}=He(),{selectedTimestamp:c,setSelectedTimestamp:d}=Sa(),g=Vn(o),f=D.useLazyLoadQuery(Lt,{embeddingDimensionId:n,timeRange:{start:o.start.toISOString(),end:o.end.toISOString()},metricGranularity:jl(o),countGranularity:g,fetchDrift:l,fetchQueryDistance:t,fetchDataQuality:i,fetchPerformance:r,dimensionId:a.type==="dataQuality"?a.dimension.id:n,performanceMetric:a.type==="performance"?a.metric:"accuracyScore"}),m=$n({samplingIntervalMinutes:g.samplingIntervalMinutes}),p=u.useCallback(x=>{const{activePayload:T}=x;if(T!=null&&T.length>0){const E=T[0].payload;d(new Date(E.timestamp))}},[d]),y=Yd({data:f,metric:a}),k=ec(f).reduce((x,T)=>(x[T.timestamp]=T.value,x),{})??{},v=y.map(x=>{const T=k[x.timestamp];return{...x,traffic:T,timestamp:new Date(x.timestamp).getTime()}}),S=Jd(a),A=Zd(a),{color:L,barColor:w}=Pt();return s("section",{css:C`
344
344
  width: 100%;
345
345
  height: 100%;
346
346
  display: flex;
@@ -360,7 +360,7 @@ fragment MetricSelector_dimensions on Model {
360
360
  width: 100%;
361
361
  overflow: hidden;
362
362
  }
363
- `,children:[s(re,{level:3,children:[Wd(a),L!=null?s(Nn,{children:[e(re,{level:4,children:S}),e(Fn,{children:L})]}):null]}),e("div",{children:e(sn,{width:"100%",height:"100%",children:s(ra,{data:v,margin:{top:25,right:18,left:18,bottom:10},onClick:p,children:[s("defs",{children:[s("linearGradient",{id:"colorUv",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:A,stopOpacity:.8}),e("stop",{offset:"95%",stopColor:A,stopOpacity:0})]}),s("linearGradient",{id:"barColor",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:_,stopOpacity:.3}),e("stop",{offset:"95%",stopColor:_,stopOpacity:0})]})]}),e(on,{...On,tickFormatter:x=>m(new Date(x)),style:{fill:"var(--ac-global-text-color-700)"}}),e(Ne,{stroke:me.colors.gray200,label:{value:S,angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(Ne,{yAxisId:"right",orientation:"right",label:{value:"Count",angle:90,position:"insideRight",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(dn,{strokeDasharray:"4 4",stroke:me.colors.gray200,strokeOpacity:.5}),e(cn,{content:e(Gd,{})}),e(En,{yAxisId:"right",dataKey:"traffic",fill:"url(#barColor)",spacing:5}),e(Xn,{type:"monotone",dataKey:"value",stroke:A,fillOpacity:1,fill:"url(#colorUv)"}),c!=null?e(gt,{...ql,x:c.getTime()}):null]})})})]})}function Yd({data:n,metric:a}){var l,t,i,r,o,c;if(((l=n.embedding.euclideanDistanceTimeSeries)==null?void 0:l.data)!=null&&n.embedding.euclideanDistanceTimeSeries.data.length>0)return n.embedding.euclideanDistanceTimeSeries.data.map(d=>({metricName:hn(a.metric),...d}));if(((t=n.embedding.retrievalMetricTimeSeries)==null?void 0:t.data)!=null&&n.embedding.retrievalMetricTimeSeries.data.length>0)return n.embedding.retrievalMetricTimeSeries.data.map(d=>({metricName:hn(a.metric),...d}));if(n.dimension&&((r=(i=n.dimension)==null?void 0:i.dataQualityTimeSeries)==null?void 0:r.data)!=null&&n.dimension.dataQualityTimeSeries.data.length>0){const d=n.dimension.name||"unknown";return n.dimension.dataQualityTimeSeries.data.map(g=>({metricName:`${d} avg`,...g}))}else{if(n.model&&((o=n.model.performanceTimeSeries)==null?void 0:o.data)!=null&&n.model.performanceTimeSeries.data.length>0)return n.model.performanceTimeSeries.data.map(d=>({metricName:hn(a.metric),...d}));if(((c=n.embedding.trafficTimeSeries)==null?void 0:c.data)!=null)return n.embedding.trafficTimeSeries.data.map(d=>({metricName:"Count",...d}))}return[]}function ec(n){var a;return((a=n.embedding.trafficTimeSeries)==null?void 0:a.data)!=null?[...n.embedding.trafficTimeSeries.data]:[]}const At=function(){var n={defaultValue:null,kind:"LocalArgument",name:"corpusEventIds"},a={defaultValue:null,kind:"LocalArgument",name:"primaryEventIds"},l={defaultValue:null,kind:"LocalArgument",name:"referenceEventIds"},t=[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,concreteType:"DimensionWithValue",kind:"LinkedField",name:"dimensions",plural:!0,selections:[{alias:null,args:null,concreteType:"Dimension",kind:"LinkedField",name:"dimension",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"type",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"EventMetadata",kind:"LinkedField",name:"eventMetadata",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"predictionId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"predictionLabel",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"predictionScore",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"actualLabel",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"actualScore",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PromptResponse",kind:"LinkedField",name:"promptAndResponse",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"prompt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"response",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"documentText",storageKey:null}],i=[{alias:null,args:null,concreteType:"Model",kind:"LinkedField",name:"model",plural:!1,selections:[{alias:null,args:null,concreteType:"Inferences",kind:"LinkedField",name:"primaryInferences",plural:!1,selections:[{alias:null,args:[{kind:"Variable",name:"eventIds",variableName:"primaryEventIds"}],concreteType:"Event",kind:"LinkedField",name:"events",plural:!0,selections:t,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Inferences",kind:"LinkedField",name:"referenceInferences",plural:!1,selections:[{alias:null,args:[{kind:"Variable",name:"eventIds",variableName:"referenceEventIds"}],concreteType:"Event",kind:"LinkedField",name:"events",plural:!0,selections:t,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Inferences",kind:"LinkedField",name:"corpusInferences",plural:!1,selections:[{alias:null,args:[{kind:"Variable",name:"eventIds",variableName:"corpusEventIds"}],concreteType:"Event",kind:"LinkedField",name:"events",plural:!0,selections:t,storageKey:null}],storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:[n,a,l],kind:"Fragment",metadata:null,name:"PointSelectionPanelContentQuery",selections:i,type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,l,n],kind:"Operation",name:"PointSelectionPanelContentQuery",selections:i},params:{cacheID:"8b48064eba35d0d6c8dc834c2f7795c0",id:null,metadata:{},name:"PointSelectionPanelContentQuery",operationKind:"query",text:`query PointSelectionPanelContentQuery(
363
+ `,children:[s(re,{level:3,children:[Wd(a),A!=null?s(Nn,{children:[e(re,{level:4,children:S}),e(Fn,{children:A})]}):null]}),e("div",{children:e(sn,{width:"100%",height:"100%",children:s(ra,{data:v,margin:{top:25,right:18,left:18,bottom:10},onClick:p,children:[s("defs",{children:[s("linearGradient",{id:"colorUv",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:L,stopOpacity:.8}),e("stop",{offset:"95%",stopColor:L,stopOpacity:0})]}),s("linearGradient",{id:"barColor",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:w,stopOpacity:.3}),e("stop",{offset:"95%",stopColor:w,stopOpacity:0})]})]}),e(on,{...On,tickFormatter:x=>m(new Date(x)),style:{fill:"var(--ac-global-text-color-700)"}}),e(Ne,{stroke:ge.colors.gray200,label:{value:S,angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(Ne,{yAxisId:"right",orientation:"right",label:{value:"Count",angle:90,position:"insideRight",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(dn,{strokeDasharray:"4 4",stroke:ge.colors.gray200,strokeOpacity:.5}),e(cn,{content:e(Gd,{})}),e(En,{yAxisId:"right",dataKey:"traffic",fill:"url(#barColor)",spacing:5}),e(Xn,{type:"monotone",dataKey:"value",stroke:L,fillOpacity:1,fill:"url(#colorUv)"}),c!=null?e(gt,{...ql,x:c.getTime()}):null]})})})]})}function Yd({data:n,metric:a}){var l,t,i,r,o,c;if(((l=n.embedding.euclideanDistanceTimeSeries)==null?void 0:l.data)!=null&&n.embedding.euclideanDistanceTimeSeries.data.length>0)return n.embedding.euclideanDistanceTimeSeries.data.map(d=>({metricName:hn(a.metric),...d}));if(((t=n.embedding.retrievalMetricTimeSeries)==null?void 0:t.data)!=null&&n.embedding.retrievalMetricTimeSeries.data.length>0)return n.embedding.retrievalMetricTimeSeries.data.map(d=>({metricName:hn(a.metric),...d}));if(n.dimension&&((r=(i=n.dimension)==null?void 0:i.dataQualityTimeSeries)==null?void 0:r.data)!=null&&n.dimension.dataQualityTimeSeries.data.length>0){const d=n.dimension.name||"unknown";return n.dimension.dataQualityTimeSeries.data.map(g=>({metricName:`${d} avg`,...g}))}else{if(n.model&&((o=n.model.performanceTimeSeries)==null?void 0:o.data)!=null&&n.model.performanceTimeSeries.data.length>0)return n.model.performanceTimeSeries.data.map(d=>({metricName:hn(a.metric),...d}));if(((c=n.embedding.trafficTimeSeries)==null?void 0:c.data)!=null)return n.embedding.trafficTimeSeries.data.map(d=>({metricName:"Count",...d}))}return[]}function ec(n){var a;return((a=n.embedding.trafficTimeSeries)==null?void 0:a.data)!=null?[...n.embedding.trafficTimeSeries.data]:[]}const At=function(){var n={defaultValue:null,kind:"LocalArgument",name:"corpusEventIds"},a={defaultValue:null,kind:"LocalArgument",name:"primaryEventIds"},l={defaultValue:null,kind:"LocalArgument",name:"referenceEventIds"},t=[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,concreteType:"DimensionWithValue",kind:"LinkedField",name:"dimensions",plural:!0,selections:[{alias:null,args:null,concreteType:"Dimension",kind:"LinkedField",name:"dimension",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"type",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"EventMetadata",kind:"LinkedField",name:"eventMetadata",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"predictionId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"predictionLabel",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"predictionScore",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"actualLabel",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"actualScore",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PromptResponse",kind:"LinkedField",name:"promptAndResponse",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"prompt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"response",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"documentText",storageKey:null}],i=[{alias:null,args:null,concreteType:"Model",kind:"LinkedField",name:"model",plural:!1,selections:[{alias:null,args:null,concreteType:"Inferences",kind:"LinkedField",name:"primaryInferences",plural:!1,selections:[{alias:null,args:[{kind:"Variable",name:"eventIds",variableName:"primaryEventIds"}],concreteType:"Event",kind:"LinkedField",name:"events",plural:!0,selections:t,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Inferences",kind:"LinkedField",name:"referenceInferences",plural:!1,selections:[{alias:null,args:[{kind:"Variable",name:"eventIds",variableName:"referenceEventIds"}],concreteType:"Event",kind:"LinkedField",name:"events",plural:!0,selections:t,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"Inferences",kind:"LinkedField",name:"corpusInferences",plural:!1,selections:[{alias:null,args:[{kind:"Variable",name:"eventIds",variableName:"corpusEventIds"}],concreteType:"Event",kind:"LinkedField",name:"events",plural:!0,selections:t,storageKey:null}],storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:[n,a,l],kind:"Fragment",metadata:null,name:"PointSelectionPanelContentQuery",selections:i,type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,l,n],kind:"Operation",name:"PointSelectionPanelContentQuery",selections:i},params:{cacheID:"8b48064eba35d0d6c8dc834c2f7795c0",id:null,metadata:{},name:"PointSelectionPanelContentQuery",operationKind:"query",text:`query PointSelectionPanelContentQuery(
364
364
  $primaryEventIds: [ID!]!
365
365
  $referenceEventIds: [ID!]!
366
366
  $corpusEventIds: [ID!]!
@@ -560,7 +560,7 @@ dataframe`,oc=C`
560
560
  min-width: var(--grid-item-min-width);
561
561
  height: var(--grid-item-height);
562
562
  }
563
- `,children:l.map((g,f)=>{const m=i.get(g.id),{rawData:p=null,linkToData:y=null}=(m==null?void 0:m.embeddingMetadata)??{},{predictionLabel:k=null,actualLabel:b=null}=(m==null?void 0:m.eventMetadata)??{},v=xo(g.id),S=a(v),L=r[g.id],A=o[L];return e("li",{children:e(Do,{rawData:p,linkToData:y,inferencesName:S,group:L,onClick:()=>{t(g.id)},onMouseOver:()=>{d(g.id)},onMouseOut:()=>{d(null)},color:A,size:c,predictionLabel:k,actualLabel:b,promptAndResponse:g.promptAndResponse,documentText:g.documentText,autoPlay:!1})},f)})})})}function gc({data:n,onPointSelected:a}){const{primaryInferences:l,referenceInferences:t}=ze(),i=Q(f=>f.metric),[r,o]=u.useState([]),{columns:c,tableData:d}=u.useMemo(()=>{const f=n.filter(A=>A.id.includes("CORPUS")===!1);let m=!1,p=!1,y=!1,k=!1,b=!1;n.forEach(A=>{A.linkToData&&(m=!0),A.rawData&&(p=!0),(A.prompt||A.response)&&(y=!0),A.predictionLabel&&(k=!0),A.actualLabel&&(b=!0)});const v=[];t&&v.push({header:"Inference Set",accessorKey:"id",size:50,cell:({getValue:A})=>e(pc,{id:A(),primaryInferencesName:l.name,referenceInferencesName:(t==null?void 0:t.name)??"reference"})}),m&&v.push({header:"Link",accessorKey:"linkToData",cell:({getValue:A})=>{const _=A();if(typeof _=="string"){const x=_.split("/").pop();return e(je,{href:_,children:x})}return null}}),y?(v.push({header:"Prompt",accessorKey:"prompt",cell:ue,size:200}),v.push({header:"Response",accessorKey:"response",cell:ue,size:200})):p&&v.push({header:"Raw Data",accessorKey:"rawData"}),k&&v.push({header:"Prediction Label",accessorKey:"predictionLabel",size:50}),b&&v.push({header:"Actual Label",accessorKey:"actualLabel",size:50});const S=[];if(i&&i.type==="dataQuality"){const A=i.dimension.name;S.push({header:i.dimension.name,accessorKey:"metric",cell:To,sortingFn:"basic"}),f.forEach(_=>{var T;const x=(T=_.dimensions.find(E=>E.dimension.name===A))==null?void 0:T.value;_.metric=x!=null?Number(x):null})}return{columns:[...v,...S,{header:"",id:"view-details",size:50,cell:({row:A})=>e(Io,{"aria-label":"view point details",onClick:()=>{a(A.original.id)},children:"view details"})}],tableData:f}},[n,a,l,t,i]),g=he({columns:c,data:d,state:{sorting:r},getCoreRowModel:ke(),onSortingChange:o,getSortedRowModel:Rn()});return s("table",{css:We,children:[e("thead",{children:g.getHeaderGroups().map(f=>e("tr",{children:f.headers.map(m=>s("th",{children:[m.isPlaceholder?null:s("div",{className:m.column.getCanSort()?"cursor-pointer":"",onClick:m.column.getToggleSortingHandler(),children:[Z(m.column.columnDef.header,m.getContext()),m.column.getIsSorted()?e(P,{className:"sort-icon",svg:m.column.getIsSorted()==="asc"?e(I.ArrowDownFilled,{}):e(I.ArrowUpFilled,{})}):null]}),e("div",{onMouseDown:m.getResizeHandler(),onTouchStart:m.getResizeHandler(),className:`resizer ${m.column.getIsResizing()?"isResizing":""}`,style:{transform:m.column.getIsResizing()?`translateX(${g.getState().columnSizingInfo.deltaOffset}px)`:""}})]},m.id))},f.id))}),e("tbody",{children:g.getRowModel().rows.map(f=>e("tr",{children:f.getVisibleCells().map(m=>e("td",{style:{width:m.column.getSize()},children:Z(m.column.columnDef.cell,m.getContext())},m.id))},f.id))})]})}function pc({id:n,primaryInferencesName:a,referenceInferencesName:l}){const t=n.includes("PRIMARY"),i=$d();return s(h,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Po,{shape:Lo.circle,color:i[t?0:1]}),t?a:l]})}const yc=C`
563
+ `,children:l.map((g,f)=>{const m=i.get(g.id),{rawData:p=null,linkToData:y=null}=(m==null?void 0:m.embeddingMetadata)??{},{predictionLabel:b=null,actualLabel:k=null}=(m==null?void 0:m.eventMetadata)??{},v=xo(g.id),S=a(v),A=r[g.id],L=o[A];return e("li",{children:e(Do,{rawData:p,linkToData:y,inferencesName:S,group:A,onClick:()=>{t(g.id)},onMouseOver:()=>{d(g.id)},onMouseOut:()=>{d(null)},color:L,size:c,predictionLabel:b,actualLabel:k,promptAndResponse:g.promptAndResponse,documentText:g.documentText,autoPlay:!1})},f)})})})}function gc({data:n,onPointSelected:a}){const{primaryInferences:l,referenceInferences:t}=ze(),i=Q(f=>f.metric),[r,o]=u.useState([]),{columns:c,tableData:d}=u.useMemo(()=>{const f=n.filter(L=>L.id.includes("CORPUS")===!1);let m=!1,p=!1,y=!1,b=!1,k=!1;n.forEach(L=>{L.linkToData&&(m=!0),L.rawData&&(p=!0),(L.prompt||L.response)&&(y=!0),L.predictionLabel&&(b=!0),L.actualLabel&&(k=!0)});const v=[];t&&v.push({header:"Inference Set",accessorKey:"id",size:50,cell:({getValue:L})=>e(pc,{id:L(),primaryInferencesName:l.name,referenceInferencesName:(t==null?void 0:t.name)??"reference"})}),m&&v.push({header:"Link",accessorKey:"linkToData",cell:({getValue:L})=>{const w=L();if(typeof w=="string"){const x=w.split("/").pop();return e(je,{href:w,children:x})}return null}}),y?(v.push({header:"Prompt",accessorKey:"prompt",cell:me,size:200}),v.push({header:"Response",accessorKey:"response",cell:me,size:200})):p&&v.push({header:"Raw Data",accessorKey:"rawData"}),b&&v.push({header:"Prediction Label",accessorKey:"predictionLabel",size:50}),k&&v.push({header:"Actual Label",accessorKey:"actualLabel",size:50});const S=[];if(i&&i.type==="dataQuality"){const L=i.dimension.name;S.push({header:i.dimension.name,accessorKey:"metric",cell:To,sortingFn:"basic"}),f.forEach(w=>{var T;const x=(T=w.dimensions.find(E=>E.dimension.name===L))==null?void 0:T.value;w.metric=x!=null?Number(x):null})}return{columns:[...v,...S,{header:"",id:"view-details",size:50,cell:({row:L})=>e(Io,{"aria-label":"view point details",onClick:()=>{a(L.original.id)},children:"view details"})}],tableData:f}},[n,a,l,t,i]),g=he({columns:c,data:d,state:{sorting:r},getCoreRowModel:ke(),onSortingChange:o,getSortedRowModel:Rn()});return s("table",{css:We,children:[e("thead",{children:g.getHeaderGroups().map(f=>e("tr",{children:f.headers.map(m=>s("th",{children:[m.isPlaceholder?null:s("div",{className:m.column.getCanSort()?"cursor-pointer":"",onClick:m.column.getToggleSortingHandler(),children:[Z(m.column.columnDef.header,m.getContext()),m.column.getIsSorted()?e(P,{className:"sort-icon",svg:m.column.getIsSorted()==="asc"?e(I.ArrowDownFilled,{}):e(I.ArrowUpFilled,{})}):null]}),e("div",{onMouseDown:m.getResizeHandler(),onTouchStart:m.getResizeHandler(),className:`resizer ${m.column.getIsResizing()?"isResizing":""}`,style:{transform:m.column.getIsResizing()?`translateX(${g.getState().columnSizingInfo.deltaOffset}px)`:""}})]},m.id))},f.id))}),e("tbody",{children:g.getRowModel().rows.map(f=>e("tr",{children:f.getVisibleCells().map(m=>e("td",{style:{width:m.column.getSize()},children:Z(m.column.columnDef.cell,m.getContext())},m.id))},f.id))})]})}function pc({id:n,primaryInferencesName:a,referenceInferencesName:l}){const t=n.includes("PRIMARY"),i=$d();return s(h,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Po,{shape:Lo.circle,color:i[t?0:1]}),t?a:l]})}const yc=C`
564
564
  width: 100%;
565
565
  height: 100%;
566
566
  position: relative;
@@ -590,26 +590,26 @@ dataframe`,oc=C`
590
590
  }
591
591
  }
592
592
  }
593
- `;function fc({event:n,relevance:a}){return{id:n.eventMetadata.predictionId||"unknown id",text:n.documentText??"empty document",relevance:a}}function hc(){const n=Q(x=>x.selectedEventIds),a=Q(x=>x.setSelectedEventIds),l=Q(x=>x.setSelectedClusterId),t=Q(x=>x.selectionDisplay),[i,r]=Ke.useState(null),{primaryEventIds:o,referenceEventIds:c,corpusEventIds:d}=u.useMemo(()=>{const x=[],T=[],E=[];return n.forEach(R=>{R.includes("PRIMARY")?x.push(R):R.includes("CORPUS")?E.push(R):T.push(R)}),{primaryEventIds:x,referenceEventIds:T,corpusEventIds:E}},[n]),g=D.useLazyLoadQuery(At,{primaryEventIds:[...o],referenceEventIds:[...c],corpusEventIds:[...d]}),f=u.useMemo(()=>{var R,j,ae,ie,be,Se;const x=((j=(R=g.model)==null?void 0:R.primaryInferences)==null?void 0:j.events)??[],T=((ie=(ae=g.model)==null?void 0:ae.referenceInferences)==null?void 0:ie.events)??[],E=((Se=(be=g.model)==null?void 0:be.corpusInferences)==null?void 0:Se.events)??[];return[...x,...T,...E]},[g]),m=()=>{a(new Set),l(null)},p=Q(x=>x.eventIdToDataMap),y=Q(x=>x.pointData),k=Q(x=>x.selectionSearchText),b=u.useMemo(()=>f.map(x=>{var R,j,ae,ie,be,Se,N;const T=p.get(x.id),E=[];return y!=null&&(T==null?void 0:T.retrievals)!=null&&T.retrievals.forEach(({documentId:V,relevance:w})=>{const $=y[V];$!=null&&E.push(fc({event:$,relevance:w}))}),{id:x.id,predictionId:((R=x.eventMetadata)==null?void 0:R.predictionId)??null,actualLabel:((j=x.eventMetadata)==null?void 0:j.actualLabel)??null,actualScore:((ae=x.eventMetadata)==null?void 0:ae.actualScore)??null,predictionLabel:((ie=x.eventMetadata)==null?void 0:ie.predictionLabel)??null,predictionScore:((be=x.eventMetadata)==null?void 0:be.predictionScore)??null,rawData:(T==null?void 0:T.embeddingMetadata.rawData)??null,linkToData:(T==null?void 0:T.embeddingMetadata.linkToData)??null,dimensions:x.dimensions,prompt:((Se=x.promptAndResponse)==null?void 0:Se.prompt)??null,response:((N=x.promptAndResponse)==null?void 0:N.response)??null,retrievedDocuments:E,documentText:x.documentText??null}}),[f,p,y]),v=u.useMemo(()=>{if(k){const x=k.toLowerCase();return b.filter(T=>{var E,R,j,ae;return T.id.includes(x)||((E=T.documentText)==null?void 0:E.toLowerCase().includes(x))||((R=T.predictionId)==null?void 0:R.includes(x))||((j=T.prompt)==null?void 0:j.toLowerCase().includes(x))||((ae=T.response)==null?void 0:ae.toLowerCase().includes(x))})}return b},[b,k]),S=u.useMemo(()=>{if(k){const x=k.toLowerCase();return f.filter(T=>{var E,R,j,ae,ie,be,Se;return T.id.includes(x)||((E=T.documentText)==null?void 0:E.toLowerCase().includes(x))||((j=(R=T.eventMetadata)==null?void 0:R.predictionId)==null?void 0:j.includes(x))||((ie=(ae=T.promptAndResponse)==null?void 0:ae.prompt)==null?void 0:ie.toLowerCase().includes(x))||((Se=(be=T.promptAndResponse)==null?void 0:be.response)==null?void 0:Se.toLowerCase().includes(x))})}return f},[f,k]),L=u.useMemo(()=>i?b.find(T=>T.id===i)??null:null,[b,i]),A=f.length,_=S.length;return s("section",{css:yc,children:[s("div",{role:"toolbar",css:C`
593
+ `;function fc({event:n,relevance:a}){return{id:n.eventMetadata.predictionId||"unknown id",text:n.documentText??"empty document",relevance:a}}function hc(){const n=Q(x=>x.selectedEventIds),a=Q(x=>x.setSelectedEventIds),l=Q(x=>x.setSelectedClusterId),t=Q(x=>x.selectionDisplay),[i,r]=Ke.useState(null),{primaryEventIds:o,referenceEventIds:c,corpusEventIds:d}=u.useMemo(()=>{const x=[],T=[],E=[];return n.forEach(R=>{R.includes("PRIMARY")?x.push(R):R.includes("CORPUS")?E.push(R):T.push(R)}),{primaryEventIds:x,referenceEventIds:T,corpusEventIds:E}},[n]),g=D.useLazyLoadQuery(At,{primaryEventIds:[...o],referenceEventIds:[...c],corpusEventIds:[...d]}),f=u.useMemo(()=>{var R,j,ae,ie,be,Se;const x=((j=(R=g.model)==null?void 0:R.primaryInferences)==null?void 0:j.events)??[],T=((ie=(ae=g.model)==null?void 0:ae.referenceInferences)==null?void 0:ie.events)??[],E=((Se=(be=g.model)==null?void 0:be.corpusInferences)==null?void 0:Se.events)??[];return[...x,...T,...E]},[g]),m=()=>{a(new Set),l(null)},p=Q(x=>x.eventIdToDataMap),y=Q(x=>x.pointData),b=Q(x=>x.selectionSearchText),k=u.useMemo(()=>f.map(x=>{var R,j,ae,ie,be,Se,N;const T=p.get(x.id),E=[];return y!=null&&(T==null?void 0:T.retrievals)!=null&&T.retrievals.forEach(({documentId:V,relevance:_})=>{const $=y[V];$!=null&&E.push(fc({event:$,relevance:_}))}),{id:x.id,predictionId:((R=x.eventMetadata)==null?void 0:R.predictionId)??null,actualLabel:((j=x.eventMetadata)==null?void 0:j.actualLabel)??null,actualScore:((ae=x.eventMetadata)==null?void 0:ae.actualScore)??null,predictionLabel:((ie=x.eventMetadata)==null?void 0:ie.predictionLabel)??null,predictionScore:((be=x.eventMetadata)==null?void 0:be.predictionScore)??null,rawData:(T==null?void 0:T.embeddingMetadata.rawData)??null,linkToData:(T==null?void 0:T.embeddingMetadata.linkToData)??null,dimensions:x.dimensions,prompt:((Se=x.promptAndResponse)==null?void 0:Se.prompt)??null,response:((N=x.promptAndResponse)==null?void 0:N.response)??null,retrievedDocuments:E,documentText:x.documentText??null}}),[f,p,y]),v=u.useMemo(()=>{if(b){const x=b.toLowerCase();return k.filter(T=>{var E,R,j,ae;return T.id.includes(x)||((E=T.documentText)==null?void 0:E.toLowerCase().includes(x))||((R=T.predictionId)==null?void 0:R.includes(x))||((j=T.prompt)==null?void 0:j.toLowerCase().includes(x))||((ae=T.response)==null?void 0:ae.toLowerCase().includes(x))})}return k},[k,b]),S=u.useMemo(()=>{if(b){const x=b.toLowerCase();return f.filter(T=>{var E,R,j,ae,ie,be,Se;return T.id.includes(x)||((E=T.documentText)==null?void 0:E.toLowerCase().includes(x))||((j=(R=T.eventMetadata)==null?void 0:R.predictionId)==null?void 0:j.includes(x))||((ie=(ae=T.promptAndResponse)==null?void 0:ae.prompt)==null?void 0:ie.toLowerCase().includes(x))||((Se=(be=T.promptAndResponse)==null?void 0:be.response)==null?void 0:Se.toLowerCase().includes(x))})}return f},[f,b]),A=u.useMemo(()=>i?k.find(T=>T.id===i)??null:null,[k,i]),L=f.length,w=S.length;return s("section",{css:yc,children:[s("div",{role:"toolbar",css:C`
594
594
  position: absolute;
595
595
  top: var(--px-spacing-med);
596
596
  right: var(--px-spacing-lg);
597
597
  display: flex;
598
598
  flex-direction: row-reverse;
599
599
  gap: var(--px-spacing-med);
600
- `,children:[e(M,{variant:"default",size:"compact",icon:e(P,{svg:e(ro,{})}),"aria-label":"Clear selection",onClick:m}),e(cc,{})]}),e(Te,{children:s(J,{name:"Selection",children:[e(kc,{numSelectedEvents:A,numMatchingEvents:_,searchText:k}),t===Bl.list?e("div",{css:C`
600
+ `,children:[e(M,{variant:"default",size:"compact",icon:e(P,{svg:e(ro,{})}),"aria-label":"Clear selection",onClick:m}),e(cc,{})]}),e(Te,{children:s(J,{name:"Selection",children:[e(kc,{numSelectedEvents:L,numMatchingEvents:w,searchText:b}),t===Bl.list?e("div",{css:C`
601
601
  flex: 1 1 auto;
602
602
  overflow-y: auto;
603
- `,children:e(gc,{data:v,onPointSelected:r})}):e(mc,{events:S,onItemSelected:r})]})}),e(W,{type:"slideOver",isDismissable:!0,onDismiss:()=>r(null),children:L&&e(G,{title:"Embedding Details",size:"L",children:e(nc,{event:L})})})]})}function kc({numSelectedEvents:n,numMatchingEvents:a,searchText:l}){const t=Q(g=>g.selectionDisplay),i=Q(g=>g.setSelectionDisplay),r=Q(g=>g.selectionGridSize),o=Q(g=>g.setSelectionGridSize),c=Q(g=>g.setSelectionSearchText),d=u.useMemo(()=>l?`${a}/${n} match "${l}"`:`${n} selected`,[n,a,l]);return e(Ja,{extra:s("div",{css:C`
603
+ `,children:e(gc,{data:v,onPointSelected:r})}):e(mc,{events:S,onItemSelected:r})]})}),e(W,{type:"slideOver",isDismissable:!0,onDismiss:()=>r(null),children:A&&e(G,{title:"Embedding Details",size:"L",children:e(nc,{event:A})})})]})}function kc({numSelectedEvents:n,numMatchingEvents:a,searchText:l}){const t=Q(g=>g.selectionDisplay),i=Q(g=>g.setSelectionDisplay),r=Q(g=>g.selectionGridSize),o=Q(g=>g.setSelectionGridSize),c=Q(g=>g.setSelectionSearchText),d=u.useMemo(()=>l?`${a}/${n} match "${l}"`:`${n} selected`,[n,a,l]);return e(Ja,{extra:s("div",{css:C`
604
604
  display: flex;
605
605
  flex-direction: row;
606
606
  gap: var(--px-spacing-med);
607
- `,children:[e(so,{placeholder:"Search by text or ID",onChange:g=>{c(g)}}),t===Bl.gallery&&e(Ao,{size:r,onChange:o}),e(wo,{mode:t,onChange:g=>{i(g)}})]}),children:e(K,{children:d})})}const Et=xt;function _y(){const{referenceInferences:n,corpusInferences:a}=ze(),{timeRange:l}=He(),t=u.useMemo(()=>{let i={};return a!=null?i=Ro():n!=null?i=Mo():i=No(),i={...i,umapParameters:{...window.Config.UMAP}},i},[a,n]);return e(Hl,{initialTimestamp:l.end,children:e(zo,{...t,children:e(bc,{})})})}function bc(){const n=Od(),{primaryInferences:a,referenceInferences:l}=ze(),t=Q(S=>S.umapParameters),i=Q(S=>S.getHDSCANParameters),r=Q(S=>S.getMetric),o=Q(S=>S.reset),c=Q(S=>S.setLoading),[d,g]=u.useState(!0),[f,m,p]=D.useQueryLoader(Et),{selectedTimestamp:y}=Sa(),k=u.useMemo(()=>y??new Date(a.endTime),[y,a.endTime]),b=u.useMemo(()=>({start:El(k,2).toISOString(),end:k.toISOString()}),[k]),v=D.useLazyLoadQuery(Kt,{});return u.useEffect(()=>{o(),c(!0);const S=r();return m({id:n,timeRange:b,...t,...i(),fetchDataQualityMetric:S.type==="dataQuality",fetchPerformanceMetric:S.type==="performance",dataQualityMetricColumnName:S.type==="dataQuality"?S.dimension.name:null,performanceMetric:S.type==="performance"?S.metric:"accuracyScore"},{fetchPolicy:"network-only"}),()=>{p()}},[c,o,n,m,p,t,i,r,b]),s("main",{css:C`
607
+ `,children:[e(so,{placeholder:"Search by text or ID",onChange:g=>{c(g)}}),t===Bl.gallery&&e(Ao,{size:r,onChange:o}),e(wo,{mode:t,onChange:g=>{i(g)}})]}),children:e(K,{children:d})})}const Et=xt;function _y(){const{referenceInferences:n,corpusInferences:a}=ze(),{timeRange:l}=He(),t=u.useMemo(()=>{let i={};return a!=null?i=Ro():n!=null?i=Mo():i=No(),i={...i,umapParameters:{...window.Config.UMAP}},i},[a,n]);return e(Hl,{initialTimestamp:l.end,children:e(zo,{...t,children:e(bc,{})})})}function bc(){const n=Od(),{primaryInferences:a,referenceInferences:l}=ze(),t=Q(S=>S.umapParameters),i=Q(S=>S.getHDSCANParameters),r=Q(S=>S.getMetric),o=Q(S=>S.reset),c=Q(S=>S.setLoading),[d,g]=u.useState(!0),[f,m,p]=D.useQueryLoader(Et),{selectedTimestamp:y}=Sa(),b=u.useMemo(()=>y??new Date(a.endTime),[y,a.endTime]),k=u.useMemo(()=>({start:El(b,2).toISOString(),end:b.toISOString()}),[b]),v=D.useLazyLoadQuery(Kt,{});return u.useEffect(()=>{o(),c(!0);const S=r();return m({id:n,timeRange:k,...t,...i(),fetchDataQualityMetric:S.type==="dataQuality",fetchPerformanceMetric:S.type==="performance",dataQualityMetricColumnName:S.type==="dataQuality"?S.dimension.name:null,performanceMetric:S.type==="performance"?S.metric:"accuracyScore"},{fetchPolicy:"network-only"}),()=>{p()}},[c,o,n,m,p,t,i,r,k]),s("main",{css:C`
608
608
  flex: 1 1 auto;
609
609
  display: flex;
610
610
  flex-direction: column;
611
611
  overflow: hidden;
612
- `,children:[e(Tc,{}),s(Ja,{extra:s(h,{direction:"row",justifyContent:"center",alignItems:"center",gap:"size-100",children:[e(ea,{onChange:S=>{g(S)},defaultSelected:!0,labelPlacement:"start",children:"Show Timeseries"}),e(jd,{})]}),children:[e($l,{}),l?e(Ol,{inferencesRole:"reference",timeRange:{start:new Date(l.startTime),end:new Date(l.endTime)}}):null,e(Hd,{model:v.model})]}),s(Xe,{direction:"vertical",children:[d?s(q,{children:[e(ce,{defaultSize:20,collapsible:!0,order:1,children:e(u.Suspense,{fallback:e(fe,{}),children:e(Xd,{embeddingDimensionId:n})})}),e(Ye,{css:Kn})]}):null,e(ce,{order:2,children:e("div",{css:C`
612
+ `,children:[e(Tc,{}),s(Ja,{extra:s(h,{direction:"row",justifyContent:"center",alignItems:"center",gap:"size-100",children:[e(ea,{onChange:S=>{g(S)},defaultSelected:!0,labelPlacement:"start",children:"Show Timeseries"}),e(jd,{})]}),children:[e($l,{}),l?e(Ol,{inferencesRole:"reference",timeRange:{start:new Date(l.startTime),end:new Date(l.endTime)}}):null,e(Hd,{model:v.model})]}),s(Xe,{direction:"vertical",children:[d?s(q,{children:[e(ue,{defaultSize:20,collapsible:!0,order:1,children:e(u.Suspense,{fallback:e(fe,{}),children:e(Xd,{embeddingDimensionId:n})})}),e(Ye,{css:Kn})]}):null,e(ue,{order:2,children:e("div",{css:C`
613
613
  width: 100%;
614
614
  height: 100%;
615
615
  position: relative;
@@ -620,7 +620,7 @@ dataframe`,oc=C`
620
620
  align-items: stretch;
621
621
  width: 100%;
622
622
  height: 100%;
623
- `,"data-testid":"point-cloud-display",children:s(Xe,{direction:"horizontal",children:[e(ce,{id:"embedding-left",defaultSize:15,maxSize:30,minSize:10,collapsible:!0,children:s(Xe,{autoSaveId:"embedding-controls-vertical",direction:"vertical",children:[e(ce,{css:C`
623
+ `,"data-testid":"point-cloud-display",children:s(Xe,{direction:"horizontal",children:[e(ue,{id:"embedding-left",defaultSize:15,maxSize:30,minSize:10,collapsible:!0,children:s(Xe,{autoSaveId:"embedding-controls-vertical",direction:"vertical",children:[e(ue,{css:C`
624
624
  display: flex;
625
625
  flex-direction: column;
626
626
  .ac-tabs {
@@ -641,7 +641,7 @@ dataframe`,oc=C`
641
641
  }
642
642
  }
643
643
  }
644
- `,children:e(xc,{})}),e(Ye,{css:Kn}),e(ce,{css:C`
644
+ `,children:e(xc,{})}),e(Ye,{css:Kn}),e(ue,{css:C`
645
645
  .ac-tabs {
646
646
  height: 100%;
647
647
  overflow: hidden;
@@ -650,7 +650,7 @@ dataframe`,oc=C`
650
650
  overflow-y: auto;
651
651
  }
652
652
  }
653
- `,children:s(Te,{children:[e(J,{name:"Display",children:e($o,{})}),e(J,{name:"Hyperparameters",children:e(Oo,{})})]})})]})}),e(Ye,{css:Qo}),e(ce,{children:s("div",{css:C`
653
+ `,children:s(Te,{children:[e(J,{name:"Display",children:e($o,{})}),e(J,{name:"Hyperparameters",children:e(Oo,{})})]})})]})}),e(Ye,{css:Qo}),e(ue,{children:s("div",{css:C`
654
654
  position: relative;
655
655
  width: 100%;
656
656
  height: 100%;
@@ -660,7 +660,7 @@ dataframe`,oc=C`
660
660
  left: 0;
661
661
  bottom: 0;
662
662
  right: 0;
663
- `,"data-testid":"selection-panel",children:s(Xe,{direction:"vertical",children:[e(ce,{}),e(Ye,{css:Kn,style:{zIndex:1}}),e(ce,{id:"embedding-point-selection",defaultSize:40,minSize:20,order:2,style:{zIndex:1},children:e(Fc,{children:e(u.Suspense,{fallback:e(fe,{}),children:e(hc,{})})})})]})})}function Fc(n){return e("div",{css:C`
663
+ `,"data-testid":"selection-panel",children:s(Xe,{direction:"vertical",children:[e(ue,{}),e(Ye,{css:Kn,style:{zIndex:1}}),e(ue,{id:"embedding-point-selection",defaultSize:40,minSize:20,order:2,style:{zIndex:1},children:e(Fc,{children:e(u.Suspense,{fallback:e(fe,{}),children:e(hc,{})})})})]})})}function Fc(n){return e("div",{css:C`
664
664
  background-color: var(--ac-global-color-grey-75);
665
665
  width: 100%;
666
666
  height: 100%;
@@ -782,7 +782,7 @@ fragment DimensionSegmentsBarChart_dimension_3E0ZE6 on Dimension {
782
782
  }
783
783
  }
784
784
  }
785
- `}}}();zt.hash="88ce04bb2022d5e2bc75c663abd7e5de";const da={top:25,right:18,left:18,bottom:5},Lc=new Intl.NumberFormat([],{maximumFractionDigits:2}),Vt=()=>{const{gray300:n}=Ge();return{color:n}};function Pc({active:n,payload:a,label:l}){var i;const{color:t}=Vt();if(n&&a&&a.length){const r=((i=a[0])==null?void 0:i.value)??null,o=typeof r=="number"?Lc.format(r):"--";return s(rn,{children:[e(K,{weight:"heavy",textSize:"medium",children:`${Qe(new Date(l))}`}),e(pe,{color:t,name:"Cardinality",value:o}),e(va,{})]})}return null}function Ac({dimensionId:n}){var c;const{timeRange:a}=He(),l=Vn(a),t=D.useLazyLoadQuery(zt,{dimensionId:n,timeRange:{start:a.start.toISOString(),end:a.end.toISOString()},granularity:l}),{color:i}=Vt(),r=((c=t.dimension.cardinalityTimeSeries)==null?void 0:c.data.map(d=>({timestamp:new Date(d.timestamp).valueOf(),value:d.value})))||[],o=$n({samplingIntervalMinutes:l.samplingIntervalMinutes});return e(sn,{width:"100%",height:"100%",children:s(ra,{data:r,margin:da,syncId:"dimensionDetails",children:[e("defs",{children:s("linearGradient",{id:"cardinalityColorUv",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:i,stopOpacity:.8}),e("stop",{offset:"95%",stopColor:i,stopOpacity:0})]})}),e(on,{...On,tickFormatter:d=>o(new Date(d))}),e(Ne,{stroke:me.colors.gray200,label:{value:"Cardinality",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(dn,{strokeDasharray:"4 4",stroke:me.colors.gray200,strokeOpacity:.5}),e(cn,{content:e(Pc,{})}),e(Xn,{type:"monotone",dataKey:"value",stroke:i,fillOpacity:1,fill:"url(#cardinalityColorUv)"})]})})}const $t={argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],kind:"Fragment",metadata:null,name:"DimensionCountStats_dimension",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:"count",args:[{kind:"Literal",name:"metric",value:"count"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],kind:"ScalarField",name:"dataQualityMetric",storageKey:null}],type:"Dimension",abstractKey:null};$t.hash="6dccac51f3fb0853276677c692af5a43";function wc(n){const l=D.useFragment($t,n.dimension).count??0;return s(q,{children:[e(K,{elementType:"h3",textSize:"small",color:"text-700",children:"Total Count"}),e(K,{textSize:"xlarge",children:bn(l)})]})}const Ot=function(){var n={defaultValue:null,kind:"LocalArgument",name:"countGranularity"},a={defaultValue:null,kind:"LocalArgument",name:"dimensionId"},l={defaultValue:null,kind:"LocalArgument",name:"timeRange"},t=[{kind:"Variable",name:"id",variableName:"dimensionId"}],i={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},r={kind:"InlineFragment",selections:[{alias:"trafficTimeSeries",args:[{kind:"Variable",name:"granularity",variableName:"countGranularity"},{kind:"Literal",name:"metric",value:"count"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],concreteType:"DataQualityTimeSeries",kind:"LinkedField",name:"dataQualityTimeSeries",plural:!1,selections:[{alias:null,args:null,concreteType:"TimeSeriesDataPoint",kind:"LinkedField",name:"data",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"timestamp",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null}],storageKey:null}],type:"Dimension",abstractKey:null};return{fragment:{argumentDefinitions:[n,a,l],kind:"Fragment",metadata:null,name:"DimensionCountTimeSeriesQuery",selections:[{alias:"embedding",args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[i,r],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,l,n],kind:"Operation",name:"DimensionCountTimeSeriesQuery",selections:[{alias:"embedding",args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},i,r],storageKey:null}]},params:{cacheID:"1f9eff6d8d453148844edae32b844df7",id:null,metadata:{},name:"DimensionCountTimeSeriesQuery",operationKind:"query",text:`query DimensionCountTimeSeriesQuery(
785
+ `}}}();zt.hash="88ce04bb2022d5e2bc75c663abd7e5de";const da={top:25,right:18,left:18,bottom:5},Lc=new Intl.NumberFormat([],{maximumFractionDigits:2}),Vt=()=>{const{gray300:n}=Ge();return{color:n}};function Pc({active:n,payload:a,label:l}){var i;const{color:t}=Vt();if(n&&a&&a.length){const r=((i=a[0])==null?void 0:i.value)??null,o=typeof r=="number"?Lc.format(r):"--";return s(rn,{children:[e(K,{weight:"heavy",textSize:"medium",children:`${Qe(new Date(l))}`}),e(pe,{color:t,name:"Cardinality",value:o}),e(va,{})]})}return null}function Ac({dimensionId:n}){var c;const{timeRange:a}=He(),l=Vn(a),t=D.useLazyLoadQuery(zt,{dimensionId:n,timeRange:{start:a.start.toISOString(),end:a.end.toISOString()},granularity:l}),{color:i}=Vt(),r=((c=t.dimension.cardinalityTimeSeries)==null?void 0:c.data.map(d=>({timestamp:new Date(d.timestamp).valueOf(),value:d.value})))||[],o=$n({samplingIntervalMinutes:l.samplingIntervalMinutes});return e(sn,{width:"100%",height:"100%",children:s(ra,{data:r,margin:da,syncId:"dimensionDetails",children:[e("defs",{children:s("linearGradient",{id:"cardinalityColorUv",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:i,stopOpacity:.8}),e("stop",{offset:"95%",stopColor:i,stopOpacity:0})]})}),e(on,{...On,tickFormatter:d=>o(new Date(d))}),e(Ne,{stroke:ge.colors.gray200,label:{value:"Cardinality",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(dn,{strokeDasharray:"4 4",stroke:ge.colors.gray200,strokeOpacity:.5}),e(cn,{content:e(Pc,{})}),e(Xn,{type:"monotone",dataKey:"value",stroke:i,fillOpacity:1,fill:"url(#cardinalityColorUv)"})]})})}const $t={argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],kind:"Fragment",metadata:null,name:"DimensionCountStats_dimension",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:"count",args:[{kind:"Literal",name:"metric",value:"count"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],kind:"ScalarField",name:"dataQualityMetric",storageKey:null}],type:"Dimension",abstractKey:null};$t.hash="6dccac51f3fb0853276677c692af5a43";function wc(n){const l=D.useFragment($t,n.dimension).count??0;return s(q,{children:[e(K,{elementType:"h3",textSize:"small",color:"text-700",children:"Total Count"}),e(K,{textSize:"xlarge",children:bn(l)})]})}const Ot=function(){var n={defaultValue:null,kind:"LocalArgument",name:"countGranularity"},a={defaultValue:null,kind:"LocalArgument",name:"dimensionId"},l={defaultValue:null,kind:"LocalArgument",name:"timeRange"},t=[{kind:"Variable",name:"id",variableName:"dimensionId"}],i={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},r={kind:"InlineFragment",selections:[{alias:"trafficTimeSeries",args:[{kind:"Variable",name:"granularity",variableName:"countGranularity"},{kind:"Literal",name:"metric",value:"count"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],concreteType:"DataQualityTimeSeries",kind:"LinkedField",name:"dataQualityTimeSeries",plural:!1,selections:[{alias:null,args:null,concreteType:"TimeSeriesDataPoint",kind:"LinkedField",name:"data",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"timestamp",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null}],storageKey:null}],type:"Dimension",abstractKey:null};return{fragment:{argumentDefinitions:[n,a,l],kind:"Fragment",metadata:null,name:"DimensionCountTimeSeriesQuery",selections:[{alias:"embedding",args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[i,r],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,l,n],kind:"Operation",name:"DimensionCountTimeSeriesQuery",selections:[{alias:"embedding",args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},i,r],storageKey:null}]},params:{cacheID:"1f9eff6d8d453148844edae32b844df7",id:null,metadata:{},name:"DimensionCountTimeSeriesQuery",operationKind:"query",text:`query DimensionCountTimeSeriesQuery(
786
786
  $dimensionId: GlobalID!
787
787
  $timeRange: TimeRange!
788
788
  $countGranularity: Granularity!
@@ -800,7 +800,7 @@ fragment DimensionSegmentsBarChart_dimension_3E0ZE6 on Dimension {
800
800
  }
801
801
  }
802
802
  }
803
- `}}}();Ot.hash="9677ef7c6b298554824fe3fd3904c7aa";const _c=new Intl.NumberFormat([],{maximumFractionDigits:2}),Qt=()=>{const{gray300:n}=Ge();return{barColor:n}};function Ec({active:n,payload:a,label:l}){var i;const{barColor:t}=Qt();if(n&&a&&a.length){const r=((i=a[0])==null?void 0:i.value)??null,o=typeof r=="number"?_c.format(r):"--";return s(rn,{children:[e(K,{weight:"heavy",textSize:"medium",children:`${Qe(new Date(l))}`}),e(pe,{color:t,shape:"square",name:"Count",value:o})]})}return null}function Rc({dimensionId:n}){var d;const{timeRange:a}=He(),l=Vn(a),r=(((d=D.useLazyLoadQuery(Ot,{dimensionId:n,timeRange:{start:a.start.toISOString(),end:a.end.toISOString()},countGranularity:l}).embedding.trafficTimeSeries)==null?void 0:d.data)||[]).map(g=>({...g,timestamp:new Date(g.timestamp).valueOf()})),o=$n({samplingIntervalMinutes:l.samplingIntervalMinutes}),{barColor:c}=Qt();return e(sn,{width:"100%",height:"100%",children:s(il,{data:r,margin:da,syncId:"dimensionDetails",children:[e("defs",{children:s("linearGradient",{id:"countBarColor",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:c,stopOpacity:1}),e("stop",{offset:"95%",stopColor:c,stopOpacity:.5})]})}),e(on,{...On,tickFormatter:g=>o(new Date(g))}),e(Ne,{stroke:me.colors.gray200,label:{value:"Count",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(dn,{strokeDasharray:"4 4",stroke:me.colors.gray200,strokeOpacity:.5}),e(cn,{...Xa,content:e(Ec,{})}),e(En,{dataKey:"value",fill:"url(#countBarColor)",spacing:5})]})})}const jt=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"dimensionId"},{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],a=[{kind:"Variable",name:"id",variableName:"dimensionId"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t=[{kind:"Variable",name:"primaryTimeRange",variableName:"timeRange"}],i={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},o={alias:null,args:null,concreteType:"NumericRange",kind:"LinkedField",name:"range",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"start",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"end",storageKey:null}],storageKey:null},c=[{alias:null,args:null,kind:"ScalarField",name:"primaryValue",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"referenceValue",storageKey:null}],d={alias:null,args:null,concreteType:"DatasetValues",kind:"LinkedField",name:"counts",plural:!1,selections:c,storageKey:null},g={alias:null,args:null,concreteType:"DatasetValues",kind:"LinkedField",name:"totalCounts",plural:!1,selections:c,storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"DimensionDriftBreakdownSegmentBarChartQuery",selections:[{alias:"dimension",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{kind:"InlineFragment",selections:[{kind:"RequiredField",field:{alias:null,args:t,concreteType:"Segments",kind:"LinkedField",name:"segmentsComparison",plural:!1,selections:[{alias:null,args:null,concreteType:"Segment",kind:"LinkedField",name:"segments",plural:!0,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"bin",plural:!1,selections:[{kind:"InlineFragment",selections:[i,r],type:"NominalBin",abstractKey:null},{kind:"InlineFragment",selections:[i,o],type:"IntervalBin",abstractKey:null},{kind:"InlineFragment",selections:[i],type:"MissingValueBin",abstractKey:null}],storageKey:null},d],storageKey:null},g],storageKey:null},action:"THROW",path:"dimension.segmentsComparison"}],type:"Dimension",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"DimensionDriftBreakdownSegmentBarChartQuery",selections:[{alias:"dimension",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[i,l,{kind:"InlineFragment",selections:[{alias:null,args:t,concreteType:"Segments",kind:"LinkedField",name:"segmentsComparison",plural:!1,selections:[{alias:null,args:null,concreteType:"Segment",kind:"LinkedField",name:"segments",plural:!0,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"bin",plural:!1,selections:[i,{kind:"InlineFragment",selections:[r],type:"NominalBin",abstractKey:null},{kind:"InlineFragment",selections:[o],type:"IntervalBin",abstractKey:null}],storageKey:null},d],storageKey:null},g],storageKey:null}],type:"Dimension",abstractKey:null}],storageKey:null}]},params:{cacheID:"7d11d88f419003f5ee8cd9d11312e427",id:null,metadata:{},name:"DimensionDriftBreakdownSegmentBarChartQuery",operationKind:"query",text:`query DimensionDriftBreakdownSegmentBarChartQuery(
803
+ `}}}();Ot.hash="9677ef7c6b298554824fe3fd3904c7aa";const _c=new Intl.NumberFormat([],{maximumFractionDigits:2}),Qt=()=>{const{gray300:n}=Ge();return{barColor:n}};function Ec({active:n,payload:a,label:l}){var i;const{barColor:t}=Qt();if(n&&a&&a.length){const r=((i=a[0])==null?void 0:i.value)??null,o=typeof r=="number"?_c.format(r):"--";return s(rn,{children:[e(K,{weight:"heavy",textSize:"medium",children:`${Qe(new Date(l))}`}),e(pe,{color:t,shape:"square",name:"Count",value:o})]})}return null}function Rc({dimensionId:n}){var d;const{timeRange:a}=He(),l=Vn(a),r=(((d=D.useLazyLoadQuery(Ot,{dimensionId:n,timeRange:{start:a.start.toISOString(),end:a.end.toISOString()},countGranularity:l}).embedding.trafficTimeSeries)==null?void 0:d.data)||[]).map(g=>({...g,timestamp:new Date(g.timestamp).valueOf()})),o=$n({samplingIntervalMinutes:l.samplingIntervalMinutes}),{barColor:c}=Qt();return e(sn,{width:"100%",height:"100%",children:s(il,{data:r,margin:da,syncId:"dimensionDetails",children:[e("defs",{children:s("linearGradient",{id:"countBarColor",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:c,stopOpacity:1}),e("stop",{offset:"95%",stopColor:c,stopOpacity:.5})]})}),e(on,{...On,tickFormatter:g=>o(new Date(g))}),e(Ne,{stroke:ge.colors.gray200,label:{value:"Count",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(dn,{strokeDasharray:"4 4",stroke:ge.colors.gray200,strokeOpacity:.5}),e(cn,{...Xa,content:e(Ec,{})}),e(En,{dataKey:"value",fill:"url(#countBarColor)",spacing:5})]})})}const jt=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"dimensionId"},{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],a=[{kind:"Variable",name:"id",variableName:"dimensionId"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t=[{kind:"Variable",name:"primaryTimeRange",variableName:"timeRange"}],i={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},o={alias:null,args:null,concreteType:"NumericRange",kind:"LinkedField",name:"range",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"start",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"end",storageKey:null}],storageKey:null},c=[{alias:null,args:null,kind:"ScalarField",name:"primaryValue",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"referenceValue",storageKey:null}],d={alias:null,args:null,concreteType:"DatasetValues",kind:"LinkedField",name:"counts",plural:!1,selections:c,storageKey:null},g={alias:null,args:null,concreteType:"DatasetValues",kind:"LinkedField",name:"totalCounts",plural:!1,selections:c,storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"DimensionDriftBreakdownSegmentBarChartQuery",selections:[{alias:"dimension",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{kind:"InlineFragment",selections:[{kind:"RequiredField",field:{alias:null,args:t,concreteType:"Segments",kind:"LinkedField",name:"segmentsComparison",plural:!1,selections:[{alias:null,args:null,concreteType:"Segment",kind:"LinkedField",name:"segments",plural:!0,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"bin",plural:!1,selections:[{kind:"InlineFragment",selections:[i,r],type:"NominalBin",abstractKey:null},{kind:"InlineFragment",selections:[i,o],type:"IntervalBin",abstractKey:null},{kind:"InlineFragment",selections:[i],type:"MissingValueBin",abstractKey:null}],storageKey:null},d],storageKey:null},g],storageKey:null},action:"THROW",path:"dimension.segmentsComparison"}],type:"Dimension",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"DimensionDriftBreakdownSegmentBarChartQuery",selections:[{alias:"dimension",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[i,l,{kind:"InlineFragment",selections:[{alias:null,args:t,concreteType:"Segments",kind:"LinkedField",name:"segmentsComparison",plural:!1,selections:[{alias:null,args:null,concreteType:"Segment",kind:"LinkedField",name:"segments",plural:!0,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"bin",plural:!1,selections:[i,{kind:"InlineFragment",selections:[r],type:"NominalBin",abstractKey:null},{kind:"InlineFragment",selections:[o],type:"IntervalBin",abstractKey:null}],storageKey:null},d],storageKey:null},g],storageKey:null}],type:"Dimension",abstractKey:null}],storageKey:null}]},params:{cacheID:"7d11d88f419003f5ee8cd9d11312e427",id:null,metadata:{},name:"DimensionDriftBreakdownSegmentBarChartQuery",operationKind:"query",text:`query DimensionDriftBreakdownSegmentBarChartQuery(
804
804
  $dimensionId: GlobalID!
805
805
  $timeRange: TimeRange!
806
806
  ) {
@@ -840,7 +840,7 @@ fragment DimensionSegmentsBarChart_dimension_3E0ZE6 on Dimension {
840
840
  }
841
841
  }
842
842
  }
843
- `}}}();jt.hash="6bb76e3cce4ee28c333e485b3aa2dffd";const kl=Ba(".2f"),qt=()=>{const{primary:n,reference:a}=Ge();return{primaryBarColor:n,referenceBarColor:a}};function Mc({active:n,payload:a,label:l}){var r,o,c,d,g,f;const{primaryBarColor:t,referenceBarColor:i}=qt();if(n&&a&&a.length){const m=(o=(r=a[0])==null?void 0:r.payload)==null?void 0:o.primaryName,p=(c=a[0])==null?void 0:c.value,y=(g=(d=a[0])==null?void 0:d.payload)==null?void 0:g.referenceName,k=(f=a[1])==null?void 0:f.value;return s(rn,{children:[e(K,{elementType:"h3",textSize:"medium",weight:"heavy",children:l}),e(pe,{color:t,shape:"square",name:m,value:p!=null?`${kl(p)}%`:"--"}),e(pe,{color:i,shape:"square",name:y,value:k!=null?`${kl(k)}%`:"--"})]})}return null}function Nc(n){var p,y,k,b,v;const{primaryInferences:a,referenceInferences:l}=ze(),t=a.name,i=(l==null?void 0:l.name)||"reference",{selectedTimestamp:r}=Sa(),o=u.useMemo(()=>r??new Date(a.endTime),[r,a.endTime]),c=u.useMemo(()=>({start:El(o,2).toISOString(),end:o.toISOString()}),[o]),d=D.useLazyLoadQuery(jt,{dimensionId:n.dimensionId,timeRange:c}),g=u.useMemo(()=>{var _,x,T,E,R;const S=((_=d.dimension.segmentsComparison)==null?void 0:_.segments)??[],L=((T=(x=d.dimension.segmentsComparison)==null?void 0:x.totalCounts)==null?void 0:T.primaryValue)??0,A=((R=(E=d.dimension.segmentsComparison)==null?void 0:E.totalCounts)==null?void 0:R.referenceValue)??0;return S.map(j=>{var V,w;const ae=((V=j.counts)==null?void 0:V.primaryValue)??0,ie=((w=j.counts)==null?void 0:w.referenceValue)??0,be=Gl(j.bin),Se=ae/L*100,N=ie/A*100;return{name:be,primaryName:t,referenceName:i,primaryPercent:Se,referencePercent:N}})},[(p=d.dimension.segmentsComparison)==null?void 0:p.segments,(k=(y=d.dimension.segmentsComparison)==null?void 0:y.totalCounts)==null?void 0:k.primaryValue,(v=(b=d.dimension.segmentsComparison)==null?void 0:b.totalCounts)==null?void 0:v.referenceValue,t,i]),{primaryBarColor:f,referenceBarColor:m}=qt();return s(h,{direction:"column",height:"100%",children:[e(F,{flex:"none",paddingTop:"size-100",paddingStart:"size-200",children:e(K,{elementType:"h3",textSize:"medium",color:"text-700",children:`Distribution comparison at ${Qe(new Date(c.end))}`})}),e(F,{flex:!0,children:e(sn,{children:s(il,{data:g,margin:{top:15,right:18,left:18,bottom:5},children:[s("defs",{children:[s("linearGradient",{id:"dimensionPrimarySegmentsBarColor",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:f,stopOpacity:1}),e("stop",{offset:"95%",stopColor:f,stopOpacity:.5})]}),s("linearGradient",{id:"dimensionReferenceSegmentsBarColor",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:m,stopOpacity:1}),e("stop",{offset:"95%",stopColor:m,stopOpacity:.5})]})]}),e(on,{dataKey:"name",style:{fill:"var(--ac-global-text-color-700)"}}),e(Ne,{stroke:me.colors.gray200,label:{value:"Percent",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(dn,{strokeDasharray:"4 4",stroke:me.colors.gray200,strokeOpacity:.5}),e(cn,{...Xa,content:e(Mc,{})}),e(En,{dataKey:"primaryPercent",fill:"url(#dimensionPrimarySegmentsBarColor)"}),e(En,{dataKey:"referencePercent",fill:"url(#dimensionReferenceSegmentsBarColor)"})]})})})]})}const Ut={argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],kind:"Fragment",metadata:null,name:"DimensionDriftStats_dimension",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:"psi",args:[{kind:"Literal",name:"metric",value:"psi"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],kind:"ScalarField",name:"driftMetric",storageKey:null}],type:"Dimension",abstractKey:null};Ut.hash="f8a9fb08a14f63906e38bc247d50b189";const zc=s(Nn,{variant:"info",placement:"top end",children:[e(re,{weight:"heavy",level:4,children:"Population Stability Index"}),e(Fn,{children:e(K,{children:"PSI is a symmetric metric that measures the relative entropy, or difference in information represented by two distributions. It can be thought of as measuring the distance between two data distributions showing how different the two distributions are from each other."})}),e("footer",{children:e(je,{href:"https://arize.com/blog-course/population-stability-index-psi/#:~:text=Population%20Stability%20Index%20(PSI)%20Overview,distributions%20are%20from%20each%20other.",children:"Learn more"})})]});function Vc(n){const a=D.useFragment(Ut,n.dimension);return s(q,{children:[s(h,{direction:"row",alignItems:"center",gap:"size-25",children:[e(K,{elementType:"h3",textSize:"small",color:"text-700",children:"PSI"}),zc]}),e(K,{textSize:"xlarge",children:An(a.psi)})]})}const Bt=function(){var n={defaultValue:null,kind:"LocalArgument",name:"countGranularity"},a={defaultValue:null,kind:"LocalArgument",name:"dimensionId"},l={defaultValue:null,kind:"LocalArgument",name:"driftGranularity"},t={defaultValue:null,kind:"LocalArgument",name:"timeRange"},i=[{kind:"Variable",name:"id",variableName:"dimensionId"}],r={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},o={kind:"Variable",name:"timeRange",variableName:"timeRange"},c=[{alias:null,args:null,concreteType:"TimeSeriesDataPoint",kind:"LinkedField",name:"data",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"timestamp",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null}],d={kind:"InlineFragment",selections:[{alias:null,args:[{kind:"Variable",name:"granularity",variableName:"driftGranularity"},{kind:"Literal",name:"metric",value:"psi"},o],concreteType:"DriftTimeSeries",kind:"LinkedField",name:"driftTimeSeries",plural:!1,selections:c,storageKey:null},{alias:"trafficTimeSeries",args:[{kind:"Variable",name:"granularity",variableName:"countGranularity"},{kind:"Literal",name:"metric",value:"count"},o],concreteType:"DataQualityTimeSeries",kind:"LinkedField",name:"dataQualityTimeSeries",plural:!1,selections:c,storageKey:null}],type:"Dimension",abstractKey:null};return{fragment:{argumentDefinitions:[n,a,l,t],kind:"Fragment",metadata:null,name:"DimensionDriftTimeSeriesQuery",selections:[{alias:"embedding",args:i,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[r,d],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,t,l,n],kind:"Operation",name:"DimensionDriftTimeSeriesQuery",selections:[{alias:"embedding",args:i,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},r,d],storageKey:null}]},params:{cacheID:"af2d25e28675891b3c8a6bc75027f731",id:null,metadata:{},name:"DimensionDriftTimeSeriesQuery",operationKind:"query",text:`query DimensionDriftTimeSeriesQuery(
843
+ `}}}();jt.hash="6bb76e3cce4ee28c333e485b3aa2dffd";const kl=Ba(".2f"),qt=()=>{const{primary:n,reference:a}=Ge();return{primaryBarColor:n,referenceBarColor:a}};function Mc({active:n,payload:a,label:l}){var r,o,c,d,g,f;const{primaryBarColor:t,referenceBarColor:i}=qt();if(n&&a&&a.length){const m=(o=(r=a[0])==null?void 0:r.payload)==null?void 0:o.primaryName,p=(c=a[0])==null?void 0:c.value,y=(g=(d=a[0])==null?void 0:d.payload)==null?void 0:g.referenceName,b=(f=a[1])==null?void 0:f.value;return s(rn,{children:[e(K,{elementType:"h3",textSize:"medium",weight:"heavy",children:l}),e(pe,{color:t,shape:"square",name:m,value:p!=null?`${kl(p)}%`:"--"}),e(pe,{color:i,shape:"square",name:y,value:b!=null?`${kl(b)}%`:"--"})]})}return null}function Nc(n){var p,y,b,k,v;const{primaryInferences:a,referenceInferences:l}=ze(),t=a.name,i=(l==null?void 0:l.name)||"reference",{selectedTimestamp:r}=Sa(),o=u.useMemo(()=>r??new Date(a.endTime),[r,a.endTime]),c=u.useMemo(()=>({start:El(o,2).toISOString(),end:o.toISOString()}),[o]),d=D.useLazyLoadQuery(jt,{dimensionId:n.dimensionId,timeRange:c}),g=u.useMemo(()=>{var w,x,T,E,R;const S=((w=d.dimension.segmentsComparison)==null?void 0:w.segments)??[],A=((T=(x=d.dimension.segmentsComparison)==null?void 0:x.totalCounts)==null?void 0:T.primaryValue)??0,L=((R=(E=d.dimension.segmentsComparison)==null?void 0:E.totalCounts)==null?void 0:R.referenceValue)??0;return S.map(j=>{var V,_;const ae=((V=j.counts)==null?void 0:V.primaryValue)??0,ie=((_=j.counts)==null?void 0:_.referenceValue)??0,be=Gl(j.bin),Se=ae/A*100,N=ie/L*100;return{name:be,primaryName:t,referenceName:i,primaryPercent:Se,referencePercent:N}})},[(p=d.dimension.segmentsComparison)==null?void 0:p.segments,(b=(y=d.dimension.segmentsComparison)==null?void 0:y.totalCounts)==null?void 0:b.primaryValue,(v=(k=d.dimension.segmentsComparison)==null?void 0:k.totalCounts)==null?void 0:v.referenceValue,t,i]),{primaryBarColor:f,referenceBarColor:m}=qt();return s(h,{direction:"column",height:"100%",children:[e(F,{flex:"none",paddingTop:"size-100",paddingStart:"size-200",children:e(K,{elementType:"h3",textSize:"medium",color:"text-700",children:`Distribution comparison at ${Qe(new Date(c.end))}`})}),e(F,{flex:!0,children:e(sn,{children:s(il,{data:g,margin:{top:15,right:18,left:18,bottom:5},children:[s("defs",{children:[s("linearGradient",{id:"dimensionPrimarySegmentsBarColor",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:f,stopOpacity:1}),e("stop",{offset:"95%",stopColor:f,stopOpacity:.5})]}),s("linearGradient",{id:"dimensionReferenceSegmentsBarColor",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:m,stopOpacity:1}),e("stop",{offset:"95%",stopColor:m,stopOpacity:.5})]})]}),e(on,{dataKey:"name",style:{fill:"var(--ac-global-text-color-700)"}}),e(Ne,{stroke:ge.colors.gray200,label:{value:"Percent",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(dn,{strokeDasharray:"4 4",stroke:ge.colors.gray200,strokeOpacity:.5}),e(cn,{...Xa,content:e(Mc,{})}),e(En,{dataKey:"primaryPercent",fill:"url(#dimensionPrimarySegmentsBarColor)"}),e(En,{dataKey:"referencePercent",fill:"url(#dimensionReferenceSegmentsBarColor)"})]})})})]})}const Ut={argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],kind:"Fragment",metadata:null,name:"DimensionDriftStats_dimension",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:"psi",args:[{kind:"Literal",name:"metric",value:"psi"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],kind:"ScalarField",name:"driftMetric",storageKey:null}],type:"Dimension",abstractKey:null};Ut.hash="f8a9fb08a14f63906e38bc247d50b189";const zc=s(Nn,{variant:"info",placement:"top end",children:[e(re,{weight:"heavy",level:4,children:"Population Stability Index"}),e(Fn,{children:e(K,{children:"PSI is a symmetric metric that measures the relative entropy, or difference in information represented by two distributions. It can be thought of as measuring the distance between two data distributions showing how different the two distributions are from each other."})}),e("footer",{children:e(je,{href:"https://arize.com/blog-course/population-stability-index-psi/#:~:text=Population%20Stability%20Index%20(PSI)%20Overview,distributions%20are%20from%20each%20other.",children:"Learn more"})})]});function Vc(n){const a=D.useFragment(Ut,n.dimension);return s(q,{children:[s(h,{direction:"row",alignItems:"center",gap:"size-25",children:[e(K,{elementType:"h3",textSize:"small",color:"text-700",children:"PSI"}),zc]}),e(K,{textSize:"xlarge",children:An(a.psi)})]})}const Bt=function(){var n={defaultValue:null,kind:"LocalArgument",name:"countGranularity"},a={defaultValue:null,kind:"LocalArgument",name:"dimensionId"},l={defaultValue:null,kind:"LocalArgument",name:"driftGranularity"},t={defaultValue:null,kind:"LocalArgument",name:"timeRange"},i=[{kind:"Variable",name:"id",variableName:"dimensionId"}],r={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},o={kind:"Variable",name:"timeRange",variableName:"timeRange"},c=[{alias:null,args:null,concreteType:"TimeSeriesDataPoint",kind:"LinkedField",name:"data",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"timestamp",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null}],d={kind:"InlineFragment",selections:[{alias:null,args:[{kind:"Variable",name:"granularity",variableName:"driftGranularity"},{kind:"Literal",name:"metric",value:"psi"},o],concreteType:"DriftTimeSeries",kind:"LinkedField",name:"driftTimeSeries",plural:!1,selections:c,storageKey:null},{alias:"trafficTimeSeries",args:[{kind:"Variable",name:"granularity",variableName:"countGranularity"},{kind:"Literal",name:"metric",value:"count"},o],concreteType:"DataQualityTimeSeries",kind:"LinkedField",name:"dataQualityTimeSeries",plural:!1,selections:c,storageKey:null}],type:"Dimension",abstractKey:null};return{fragment:{argumentDefinitions:[n,a,l,t],kind:"Fragment",metadata:null,name:"DimensionDriftTimeSeriesQuery",selections:[{alias:"embedding",args:i,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[r,d],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,t,l,n],kind:"Operation",name:"DimensionDriftTimeSeriesQuery",selections:[{alias:"embedding",args:i,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},r,d],storageKey:null}]},params:{cacheID:"af2d25e28675891b3c8a6bc75027f731",id:null,metadata:{},name:"DimensionDriftTimeSeriesQuery",operationKind:"query",text:`query DimensionDriftTimeSeriesQuery(
844
844
  $dimensionId: GlobalID!
845
845
  $timeRange: TimeRange!
846
846
  $driftGranularity: Granularity!
@@ -873,7 +873,7 @@ fragment DimensionSegmentsBarChart_dimension_3E0ZE6 on Dimension {
873
873
  gap: var(--px-spacing-sm);
874
874
 
875
875
  margin-top: var(--px-spacing-sm);
876
- `,children:[e(P,{svg:e(Rl,{})}),e("span",{children:"Click to view details"})]})]})}return null}function Oc({dimensionId:n}){var y,k;const{timeRange:a}=He(),{selectedTimestamp:l,setSelectedTimestamp:t}=Sa(),i=Vn(a),r=D.useLazyLoadQuery(Bt,{dimensionId:n,timeRange:{start:a.start.toISOString(),end:a.end.toISOString()},driftGranularity:jl(a),countGranularity:i}),o=((y=r.embedding.driftTimeSeries)==null?void 0:y.data)||[],c=((k=r.embedding.trafficTimeSeries)==null?void 0:k.data.reduce((b,v)=>(b[v.timestamp]=v.value,b),{}))??{},d=o.map(b=>{const v=c[b.timestamp];return{...b,traffic:v,timestamp:new Date(b.timestamp).valueOf()}}),g=$n({samplingIntervalMinutes:i.samplingIntervalMinutes}),f=u.useCallback(b=>{const{activePayload:v}=b;if(v!=null&&v.length>0){const S=v[0].payload;t(new Date(S.timestamp))}},[t]),{color:m,barColor:p}=Ht();return e(sn,{width:"100%",height:"100%",children:s(ra,{data:d,margin:da,onClick:f,syncId:"dimensionDetails",children:[s("defs",{children:[s("linearGradient",{id:"dimensionDriftColorUv",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:m,stopOpacity:.8}),e("stop",{offset:"95%",stopColor:m,stopOpacity:0})]}),s("linearGradient",{id:"barColor",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:p,stopOpacity:.8}),e("stop",{offset:"95%",stopColor:p,stopOpacity:0})]})]}),e(on,{...On,tickFormatter:b=>g(new Date(b))}),e(Ne,{stroke:me.colors.gray200,label:{value:"PSI",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(Ne,{yAxisId:"right",orientation:"right",tick:!1,tickLine:!1,width:0}),e(dn,{strokeDasharray:"4 4",stroke:me.colors.gray200,strokeOpacity:.5}),e(cn,{content:e($c,{})}),e(En,{yAxisId:"right",dataKey:"traffic",fill:"url(#barColor)",spacing:5}),e(Xn,{type:"monotone",dataKey:"value",stroke:m,fillOpacity:1,fill:"url(#dimensionDriftColorUv)"}),l!=null?e(gt,{...ql,x:l.getTime()}):null]})})}const Gt=function(){var n={kind:"Literal",name:"metric",value:"percentEmpty"};return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"hasReference"},{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],kind:"Fragment",metadata:null,name:"DimensionPercentEmptyStats_dimension",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:"percentEmpty",args:[n,{kind:"Variable",name:"timeRange",variableName:"timeRange"}],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{condition:"hasReference",kind:"Condition",passingValue:!0,selections:[{alias:"referencePercentEmpty",args:[{kind:"Literal",name:"inferencesRole",value:"reference"},n],kind:"ScalarField",name:"dataQualityMetric",storageKey:'dataQualityMetric(inferencesRole:"reference",metric:"percentEmpty")'}]}],type:"Dimension",abstractKey:null}}();Gt.hash="1e10d0449d6607d9292f355548c41c78";function Qc(n){const a=D.useFragment(Gt,n.dimension);return s(q,{children:[e(K,{elementType:"h3",textSize:"small",color:"text-700",children:"% Empty"}),e(K,{textSize:"xlarge",children:$a(a.percentEmpty)}),a.referencePercentEmpty!=null&&e(K,{textSize:"medium",color:"designationPurple",children:$a(a.referencePercentEmpty)})]})}const Wt=function(){var n={defaultValue:null,kind:"LocalArgument",name:"dimensionId"},a={defaultValue:null,kind:"LocalArgument",name:"granularity"},l={defaultValue:null,kind:"LocalArgument",name:"timeRange"},t=[{kind:"Variable",name:"id",variableName:"dimensionId"}],i={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},r={kind:"InlineFragment",selections:[{alias:"percentEmptyTimeSeries",args:[{kind:"Variable",name:"granularity",variableName:"granularity"},{kind:"Literal",name:"metric",value:"percentEmpty"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],concreteType:"DataQualityTimeSeries",kind:"LinkedField",name:"dataQualityTimeSeries",plural:!1,selections:[{alias:null,args:null,concreteType:"TimeSeriesDataPoint",kind:"LinkedField",name:"data",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"timestamp",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null}],storageKey:null}],type:"Dimension",abstractKey:null};return{fragment:{argumentDefinitions:[n,a,l],kind:"Fragment",metadata:null,name:"DimensionPercentEmptyTimeSeriesQuery",selections:[{alias:"embedding",args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[i,r],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,l,a],kind:"Operation",name:"DimensionPercentEmptyTimeSeriesQuery",selections:[{alias:"embedding",args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},i,r],storageKey:null}]},params:{cacheID:"9be05c72f19755036f4829777a96f97d",id:null,metadata:{},name:"DimensionPercentEmptyTimeSeriesQuery",operationKind:"query",text:`query DimensionPercentEmptyTimeSeriesQuery(
876
+ `,children:[e(P,{svg:e(Rl,{})}),e("span",{children:"Click to view details"})]})]})}return null}function Oc({dimensionId:n}){var y,b;const{timeRange:a}=He(),{selectedTimestamp:l,setSelectedTimestamp:t}=Sa(),i=Vn(a),r=D.useLazyLoadQuery(Bt,{dimensionId:n,timeRange:{start:a.start.toISOString(),end:a.end.toISOString()},driftGranularity:jl(a),countGranularity:i}),o=((y=r.embedding.driftTimeSeries)==null?void 0:y.data)||[],c=((b=r.embedding.trafficTimeSeries)==null?void 0:b.data.reduce((k,v)=>(k[v.timestamp]=v.value,k),{}))??{},d=o.map(k=>{const v=c[k.timestamp];return{...k,traffic:v,timestamp:new Date(k.timestamp).valueOf()}}),g=$n({samplingIntervalMinutes:i.samplingIntervalMinutes}),f=u.useCallback(k=>{const{activePayload:v}=k;if(v!=null&&v.length>0){const S=v[0].payload;t(new Date(S.timestamp))}},[t]),{color:m,barColor:p}=Ht();return e(sn,{width:"100%",height:"100%",children:s(ra,{data:d,margin:da,onClick:f,syncId:"dimensionDetails",children:[s("defs",{children:[s("linearGradient",{id:"dimensionDriftColorUv",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:m,stopOpacity:.8}),e("stop",{offset:"95%",stopColor:m,stopOpacity:0})]}),s("linearGradient",{id:"barColor",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:p,stopOpacity:.8}),e("stop",{offset:"95%",stopColor:p,stopOpacity:0})]})]}),e(on,{...On,tickFormatter:k=>g(new Date(k))}),e(Ne,{stroke:ge.colors.gray200,label:{value:"PSI",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(Ne,{yAxisId:"right",orientation:"right",tick:!1,tickLine:!1,width:0}),e(dn,{strokeDasharray:"4 4",stroke:ge.colors.gray200,strokeOpacity:.5}),e(cn,{content:e($c,{})}),e(En,{yAxisId:"right",dataKey:"traffic",fill:"url(#barColor)",spacing:5}),e(Xn,{type:"monotone",dataKey:"value",stroke:m,fillOpacity:1,fill:"url(#dimensionDriftColorUv)"}),l!=null?e(gt,{...ql,x:l.getTime()}):null]})})}const Gt=function(){var n={kind:"Literal",name:"metric",value:"percentEmpty"};return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"hasReference"},{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],kind:"Fragment",metadata:null,name:"DimensionPercentEmptyStats_dimension",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:"percentEmpty",args:[n,{kind:"Variable",name:"timeRange",variableName:"timeRange"}],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{condition:"hasReference",kind:"Condition",passingValue:!0,selections:[{alias:"referencePercentEmpty",args:[{kind:"Literal",name:"inferencesRole",value:"reference"},n],kind:"ScalarField",name:"dataQualityMetric",storageKey:'dataQualityMetric(inferencesRole:"reference",metric:"percentEmpty")'}]}],type:"Dimension",abstractKey:null}}();Gt.hash="1e10d0449d6607d9292f355548c41c78";function Qc(n){const a=D.useFragment(Gt,n.dimension);return s(q,{children:[e(K,{elementType:"h3",textSize:"small",color:"text-700",children:"% Empty"}),e(K,{textSize:"xlarge",children:$a(a.percentEmpty)}),a.referencePercentEmpty!=null&&e(K,{textSize:"medium",color:"designationPurple",children:$a(a.referencePercentEmpty)})]})}const Wt=function(){var n={defaultValue:null,kind:"LocalArgument",name:"dimensionId"},a={defaultValue:null,kind:"LocalArgument",name:"granularity"},l={defaultValue:null,kind:"LocalArgument",name:"timeRange"},t=[{kind:"Variable",name:"id",variableName:"dimensionId"}],i={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},r={kind:"InlineFragment",selections:[{alias:"percentEmptyTimeSeries",args:[{kind:"Variable",name:"granularity",variableName:"granularity"},{kind:"Literal",name:"metric",value:"percentEmpty"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],concreteType:"DataQualityTimeSeries",kind:"LinkedField",name:"dataQualityTimeSeries",plural:!1,selections:[{alias:null,args:null,concreteType:"TimeSeriesDataPoint",kind:"LinkedField",name:"data",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"timestamp",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],storageKey:null}],storageKey:null}],type:"Dimension",abstractKey:null};return{fragment:{argumentDefinitions:[n,a,l],kind:"Fragment",metadata:null,name:"DimensionPercentEmptyTimeSeriesQuery",selections:[{alias:"embedding",args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[i,r],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,l,a],kind:"Operation",name:"DimensionPercentEmptyTimeSeriesQuery",selections:[{alias:"embedding",args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},i,r],storageKey:null}]},params:{cacheID:"9be05c72f19755036f4829777a96f97d",id:null,metadata:{},name:"DimensionPercentEmptyTimeSeriesQuery",operationKind:"query",text:`query DimensionPercentEmptyTimeSeriesQuery(
877
877
  $dimensionId: GlobalID!
878
878
  $timeRange: TimeRange!
879
879
  $granularity: Granularity!
@@ -891,7 +891,7 @@ fragment DimensionSegmentsBarChart_dimension_3E0ZE6 on Dimension {
891
891
  }
892
892
  }
893
893
  }
894
- `}}}();Wt.hash="1e843d6c8dbe05b389b24188c6bdb394";const jc=new Intl.NumberFormat([],{maximumFractionDigits:2}),Jt=()=>{const{gray100:n}=Ge();return{color:n}};function qc({active:n,payload:a,label:l}){var i;const{color:t}=Jt();if(n&&a&&a.length){const r=((i=a[0])==null?void 0:i.value)??null,o=typeof r=="number"?jc.format(r):"--";return s(rn,{children:[e(K,{weight:"heavy",textSize:"medium",children:`${Qe(new Date(l))}`}),e(pe,{color:t,name:"% Empty",value:o})]})}return null}function Uc({dimensionId:n}){var c;const{timeRange:a}=He(),l=Vn(a),i=((c=D.useLazyLoadQuery(Wt,{dimensionId:n,timeRange:{start:a.start.toISOString(),end:a.end.toISOString()},granularity:l}).embedding.percentEmptyTimeSeries)==null?void 0:c.data.map(d=>({timestamp:new Date(d.timestamp).valueOf(),value:d.value})))||[],r=$n({samplingIntervalMinutes:l.samplingIntervalMinutes}),{color:o}=Jt();return e(sn,{width:"100%",height:"100%",children:s(ra,{data:i,margin:da,syncId:"dimensionDetails",children:[e("defs",{children:s("linearGradient",{id:"percentEmptyColorUv",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:o,stopOpacity:.8}),e("stop",{offset:"95%",stopColor:o,stopOpacity:0})]})}),e(on,{...On,tickFormatter:d=>r(new Date(d))}),e(Ne,{stroke:me.colors.gray200,label:{value:"% Empty",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(dn,{strokeDasharray:"4 4",stroke:me.colors.gray200,strokeOpacity:.5}),e(cn,{content:e(qc,{})}),e(pt,{type:"monotone",dataKey:"value",stroke:o,fillOpacity:1,fill:"url(#percentEmptyColorUv)"})]})})}const Zt=function(){var n={kind:"Variable",name:"timeRange",variableName:"timeRange"};return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],kind:"Fragment",metadata:null,name:"DimensionQuantilesStats_dimension",selections:[{alias:"p99",args:[{kind:"Literal",name:"metric",value:"p99"},n],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p75",args:[{kind:"Literal",name:"metric",value:"p75"},n],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p50",args:[{kind:"Literal",name:"metric",value:"p50"},n],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p25",args:[{kind:"Literal",name:"metric",value:"p25"},n],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p1",args:[{kind:"Literal",name:"metric",value:"p01"},n],kind:"ScalarField",name:"dataQualityMetric",storageKey:null}],type:"Dimension",abstractKey:null}}();Zt.hash="c306c8eafb1d34be464d3a658d5f94a7";function Bc(n){const a=D.useFragment(Zt,n.dimension);return e("ul",{css:C`
894
+ `}}}();Wt.hash="1e843d6c8dbe05b389b24188c6bdb394";const jc=new Intl.NumberFormat([],{maximumFractionDigits:2}),Jt=()=>{const{gray100:n}=Ge();return{color:n}};function qc({active:n,payload:a,label:l}){var i;const{color:t}=Jt();if(n&&a&&a.length){const r=((i=a[0])==null?void 0:i.value)??null,o=typeof r=="number"?jc.format(r):"--";return s(rn,{children:[e(K,{weight:"heavy",textSize:"medium",children:`${Qe(new Date(l))}`}),e(pe,{color:t,name:"% Empty",value:o})]})}return null}function Uc({dimensionId:n}){var c;const{timeRange:a}=He(),l=Vn(a),i=((c=D.useLazyLoadQuery(Wt,{dimensionId:n,timeRange:{start:a.start.toISOString(),end:a.end.toISOString()},granularity:l}).embedding.percentEmptyTimeSeries)==null?void 0:c.data.map(d=>({timestamp:new Date(d.timestamp).valueOf(),value:d.value})))||[],r=$n({samplingIntervalMinutes:l.samplingIntervalMinutes}),{color:o}=Jt();return e(sn,{width:"100%",height:"100%",children:s(ra,{data:i,margin:da,syncId:"dimensionDetails",children:[e("defs",{children:s("linearGradient",{id:"percentEmptyColorUv",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:o,stopOpacity:.8}),e("stop",{offset:"95%",stopColor:o,stopOpacity:0})]})}),e(on,{...On,tickFormatter:d=>r(new Date(d))}),e(Ne,{stroke:ge.colors.gray200,label:{value:"% Empty",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(dn,{strokeDasharray:"4 4",stroke:ge.colors.gray200,strokeOpacity:.5}),e(cn,{content:e(qc,{})}),e(pt,{type:"monotone",dataKey:"value",stroke:o,fillOpacity:1,fill:"url(#percentEmptyColorUv)"})]})})}const Zt=function(){var n={kind:"Variable",name:"timeRange",variableName:"timeRange"};return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],kind:"Fragment",metadata:null,name:"DimensionQuantilesStats_dimension",selections:[{alias:"p99",args:[{kind:"Literal",name:"metric",value:"p99"},n],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p75",args:[{kind:"Literal",name:"metric",value:"p75"},n],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p50",args:[{kind:"Literal",name:"metric",value:"p50"},n],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p25",args:[{kind:"Literal",name:"metric",value:"p25"},n],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p1",args:[{kind:"Literal",name:"metric",value:"p01"},n],kind:"ScalarField",name:"dataQualityMetric",storageKey:null}],type:"Dimension",abstractKey:null}}();Zt.hash="c306c8eafb1d34be464d3a658d5f94a7";function Bc(n){const a=D.useFragment(Zt,n.dimension);return e("ul",{css:C`
895
895
  display: flex;
896
896
  flex-direction: column;
897
897
  gap: var(--px-spacing-sm);
@@ -941,7 +941,7 @@ fragment DimensionSegmentsBarChart_dimension_3E0ZE6 on Dimension {
941
941
  }
942
942
  }
943
943
  }
944
- `}}}();Xt.hash="134f0dad0e0ecc7863dfbb0f437d829b";const Hc=Ba("~s");var Yt=(n=>(n.p99_p01="p99_p01",n.p75_p25="p75_p25",n.p50="p50",n))(Yt||{});const Gc=new Intl.NumberFormat([],{maximumFractionDigits:2});function Hn(n){return typeof n=="number"?Gc.format(n):"--"}const ei=()=>{const n=Ge();return{outerColor:n.gray500,innerColor:n.gray300,lineColor:n.default}};function Wc({active:n,payload:a,label:l}){const{outerColor:t,innerColor:i,lineColor:r}=ei();if(n&&a&&a.length){const o=a[0].payload;return s(rn,{children:[e(K,{weight:"heavy",textSize:"medium",children:`${Qe(new Date(l))}`}),e(pe,{color:t,name:"p99",value:Hn(o.p99_p01[0])}),e(pe,{color:i,name:"p75",value:Hn(o.p75_p25[0])}),e(pe,{color:r,name:"p50",value:Hn(o.p50)}),e(pe,{color:i,name:"p25",value:Hn(o.p75_p25[1])}),e(pe,{color:t,name:"p01",value:Hn(o.p99_p01[1])})]})}return null}function Jc({dimensionId:n}){var A,_,x,T,E;const{timeRange:a}=He(),l=Vn(a),t=D.useLazyLoadQuery(Xt,{dimensionId:n,timeRange:{start:a.start.toISOString(),end:a.end.toISOString()},granularity:l}),i=((A=t.dimension.p99TimeSeries)==null?void 0:A.data.map(R=>R))||[],r=((_=t.dimension.p01TimeSeries)==null?void 0:_.data.map(R=>R))||[],o=((x=t.dimension.p75TimeSeries)==null?void 0:x.data.map(R=>R))||[],c=((T=t.dimension.p25TimeSeries)==null?void 0:T.data.map(R=>R))||[],d=((E=t.dimension.p50TimeSeries)==null?void 0:E.data.map(R=>R))||[],g=i.map((R,j)=>({timestamp:new Date(R.timestamp).valueOf(),p99_p01:[R.value,r[j].value],p75_p25:[o[j].value,c[j].value],p50:d[j].value})),f=$n({samplingIntervalMinutes:l.samplingIntervalMinutes}),[m,p]=u.useState(Object.keys(Yt).reduce((R,j)=>(R[j]=!1,R),{})),y=R=>{m[R.dataKey]||p({...m})},k=()=>{p({...m})},b=R=>{p({...m,[String(R.dataKey)]:!m[R.dataKey]})},{outerColor:v,innerColor:S,lineColor:L}=ei();return e(sn,{width:"100%",height:"100%",children:s(ra,{data:g,margin:da,syncId:"dimensionDetails",children:[s("defs",{children:[s("linearGradient",{id:"p99_p01ColorUV",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"10%",stopColor:v,stopOpacity:.7}),e("stop",{offset:"50%",stopColor:v,stopOpacity:.3}),e("stop",{offset:"90%",stopColor:v,stopOpacity:.7})]}),s("linearGradient",{id:"p75_p25ColorUV",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"10%",stopColor:S,stopOpacity:.7}),e("stop",{offset:"50%",stopColor:S,stopOpacity:.3}),e("stop",{offset:"90%",stopColor:S,stopOpacity:.7})]})]}),e(on,{...On,tickFormatter:R=>f(new Date(R))}),e(Ne,{stroke:me.colors.gray200,label:{value:"Value",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},tickFormatter:R=>Hc(R),style:{fill:"var(--ac-global-text-color-700)"}}),e(dn,{strokeDasharray:"4 4",stroke:me.colors.gray200,strokeOpacity:.5}),e(cn,{content:e(Wc,{})}),e(Fd,{onClick:b,onMouseOver:y,onMouseOut:k}),e(Xn,{type:"monotone",dataKey:"p99_p01",name:"p99 - p01",fillOpacity:1,fill:"url(#p99_p01ColorUV)",stroke:v,hide:m.p99_p01===!0}),e(Xn,{type:"monotone",dataKey:"p75_p25",name:"p75 - p25",fillOpacity:1,stroke:S,fill:"url(#p75_p25ColorUV)",hide:m.p75_p25===!0}),e(pt,{type:"monotone",dataKey:"p50",stroke:L,hide:m.p50===!0})]})})}const ni=function(){var n={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},a=[{alias:null,args:null,kind:"ScalarField",name:"primaryValue",storageKey:null}];return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],kind:"Fragment",metadata:null,name:"DimensionSegmentsBarChart_dimension",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:[{kind:"Variable",name:"primaryTimeRange",variableName:"timeRange"}],concreteType:"Segments",kind:"LinkedField",name:"segmentsComparison",plural:!1,selections:[{alias:null,args:null,concreteType:"Segment",kind:"LinkedField",name:"segments",plural:!0,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"bin",plural:!1,selections:[{kind:"InlineFragment",selections:[n,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],type:"NominalBin",abstractKey:null},{kind:"InlineFragment",selections:[n,{alias:null,args:null,concreteType:"NumericRange",kind:"LinkedField",name:"range",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"start",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"end",storageKey:null}],storageKey:null}],type:"IntervalBin",abstractKey:null},{kind:"InlineFragment",selections:[n],type:"MissingValueBin",abstractKey:null}],storageKey:null},{alias:null,args:null,concreteType:"DatasetValues",kind:"LinkedField",name:"counts",plural:!1,selections:a,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"DatasetValues",kind:"LinkedField",name:"totalCounts",plural:!1,selections:a,storageKey:null}],storageKey:null}],type:"Dimension",abstractKey:null}}();ni.hash="8cef9841e9a5bd7d0d50acb5db9028b0";const Zc=Ba(".2f"),ai=()=>{const{primary:n}=Ge();return{color:n}};function Xc({active:n,payload:a,label:l}){var i;const{color:t}=ai();if(n&&a&&a.length){const r=(i=a[0])==null?void 0:i.value;return e(rn,{children:e(pe,{color:t,shape:"square",name:l,value:r!=null?`${Zc(r)}%`:"--"})})}return null}function Yc(n){const a=D.useFragment(ni,n.dimension),l=u.useMemo(()=>{var o,c,d;const i=((o=a.segmentsComparison)==null?void 0:o.segments)??[],r=((d=(c=a.segmentsComparison)==null?void 0:c.totalCounts)==null?void 0:d.primaryValue)??0;return i.map(g=>{var y;const f=((y=g.counts)==null?void 0:y.primaryValue)??0,m=Gl(g.bin),p=f/r*100;return{name:m,percent:p}})},[a]),{color:t}=ai();return e(sn,{children:s(il,{data:l,margin:{top:25,right:18,left:18,bottom:5},children:[e("defs",{children:s("linearGradient",{id:"dimensionSegmentsBarColor",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:t,stopOpacity:1}),e("stop",{offset:"95%",stopColor:t,stopOpacity:.5})]})}),e(on,{dataKey:"name",style:{fill:"var(--ac-global-text-color-700)"}}),e(Ne,{stroke:me.colors.gray200,label:{value:"% Volume",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(dn,{strokeDasharray:"4 4",stroke:me.colors.gray200,strokeOpacity:.5}),e(cn,{...Xa,content:e(Xc,{})}),e(En,{dataKey:"percent",fill:"url(#dimensionSegmentsBarColor)",spacing:15})]})})}function Ry(){const{dimensionId:n}=ln(),{timeRange:a}=He(),l=Cn(),{referenceInferences:t}=ze(),i=t!==null,r=i,o=l.dimension.shape!=="continuous",c=l.dimension.dataType==="numeric",d=ne(),g=D.useLazyLoadQuery(Mt,{dimensionId:n,timeRange:{start:a.start.toISOString(),end:a.end.toISOString()},hasReference:i});if(!n)throw new Error("Dimension ID is required to display a dimension");return e(Hl,{initialTimestamp:new Date(a.end),children:e(W,{type:"slideOver",isDismissable:!0,onDismiss:()=>d(-1),children:e(G,{size:"L",title:l.dimension.name,children:e("main",{css:C`
944
+ `}}}();Xt.hash="134f0dad0e0ecc7863dfbb0f437d829b";const Hc=Ba("~s");var Yt=(n=>(n.p99_p01="p99_p01",n.p75_p25="p75_p25",n.p50="p50",n))(Yt||{});const Gc=new Intl.NumberFormat([],{maximumFractionDigits:2});function Hn(n){return typeof n=="number"?Gc.format(n):"--"}const ei=()=>{const n=Ge();return{outerColor:n.gray500,innerColor:n.gray300,lineColor:n.default}};function Wc({active:n,payload:a,label:l}){const{outerColor:t,innerColor:i,lineColor:r}=ei();if(n&&a&&a.length){const o=a[0].payload;return s(rn,{children:[e(K,{weight:"heavy",textSize:"medium",children:`${Qe(new Date(l))}`}),e(pe,{color:t,name:"p99",value:Hn(o.p99_p01[0])}),e(pe,{color:i,name:"p75",value:Hn(o.p75_p25[0])}),e(pe,{color:r,name:"p50",value:Hn(o.p50)}),e(pe,{color:i,name:"p25",value:Hn(o.p75_p25[1])}),e(pe,{color:t,name:"p01",value:Hn(o.p99_p01[1])})]})}return null}function Jc({dimensionId:n}){var L,w,x,T,E;const{timeRange:a}=He(),l=Vn(a),t=D.useLazyLoadQuery(Xt,{dimensionId:n,timeRange:{start:a.start.toISOString(),end:a.end.toISOString()},granularity:l}),i=((L=t.dimension.p99TimeSeries)==null?void 0:L.data.map(R=>R))||[],r=((w=t.dimension.p01TimeSeries)==null?void 0:w.data.map(R=>R))||[],o=((x=t.dimension.p75TimeSeries)==null?void 0:x.data.map(R=>R))||[],c=((T=t.dimension.p25TimeSeries)==null?void 0:T.data.map(R=>R))||[],d=((E=t.dimension.p50TimeSeries)==null?void 0:E.data.map(R=>R))||[],g=i.map((R,j)=>({timestamp:new Date(R.timestamp).valueOf(),p99_p01:[R.value,r[j].value],p75_p25:[o[j].value,c[j].value],p50:d[j].value})),f=$n({samplingIntervalMinutes:l.samplingIntervalMinutes}),[m,p]=u.useState(Object.keys(Yt).reduce((R,j)=>(R[j]=!1,R),{})),y=R=>{m[R.dataKey]||p({...m})},b=()=>{p({...m})},k=R=>{p({...m,[String(R.dataKey)]:!m[R.dataKey]})},{outerColor:v,innerColor:S,lineColor:A}=ei();return e(sn,{width:"100%",height:"100%",children:s(ra,{data:g,margin:da,syncId:"dimensionDetails",children:[s("defs",{children:[s("linearGradient",{id:"p99_p01ColorUV",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"10%",stopColor:v,stopOpacity:.7}),e("stop",{offset:"50%",stopColor:v,stopOpacity:.3}),e("stop",{offset:"90%",stopColor:v,stopOpacity:.7})]}),s("linearGradient",{id:"p75_p25ColorUV",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"10%",stopColor:S,stopOpacity:.7}),e("stop",{offset:"50%",stopColor:S,stopOpacity:.3}),e("stop",{offset:"90%",stopColor:S,stopOpacity:.7})]})]}),e(on,{...On,tickFormatter:R=>f(new Date(R))}),e(Ne,{stroke:ge.colors.gray200,label:{value:"Value",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},tickFormatter:R=>Hc(R),style:{fill:"var(--ac-global-text-color-700)"}}),e(dn,{strokeDasharray:"4 4",stroke:ge.colors.gray200,strokeOpacity:.5}),e(cn,{content:e(Wc,{})}),e(Fd,{onClick:k,onMouseOver:y,onMouseOut:b}),e(Xn,{type:"monotone",dataKey:"p99_p01",name:"p99 - p01",fillOpacity:1,fill:"url(#p99_p01ColorUV)",stroke:v,hide:m.p99_p01===!0}),e(Xn,{type:"monotone",dataKey:"p75_p25",name:"p75 - p25",fillOpacity:1,stroke:S,fill:"url(#p75_p25ColorUV)",hide:m.p75_p25===!0}),e(pt,{type:"monotone",dataKey:"p50",stroke:A,hide:m.p50===!0})]})})}const ni=function(){var n={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},a=[{alias:null,args:null,kind:"ScalarField",name:"primaryValue",storageKey:null}];return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],kind:"Fragment",metadata:null,name:"DimensionSegmentsBarChart_dimension",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:[{kind:"Variable",name:"primaryTimeRange",variableName:"timeRange"}],concreteType:"Segments",kind:"LinkedField",name:"segmentsComparison",plural:!1,selections:[{alias:null,args:null,concreteType:"Segment",kind:"LinkedField",name:"segments",plural:!0,selections:[{alias:null,args:null,concreteType:null,kind:"LinkedField",name:"bin",plural:!1,selections:[{kind:"InlineFragment",selections:[n,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],type:"NominalBin",abstractKey:null},{kind:"InlineFragment",selections:[n,{alias:null,args:null,concreteType:"NumericRange",kind:"LinkedField",name:"range",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"start",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"end",storageKey:null}],storageKey:null}],type:"IntervalBin",abstractKey:null},{kind:"InlineFragment",selections:[n],type:"MissingValueBin",abstractKey:null}],storageKey:null},{alias:null,args:null,concreteType:"DatasetValues",kind:"LinkedField",name:"counts",plural:!1,selections:a,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"DatasetValues",kind:"LinkedField",name:"totalCounts",plural:!1,selections:a,storageKey:null}],storageKey:null}],type:"Dimension",abstractKey:null}}();ni.hash="8cef9841e9a5bd7d0d50acb5db9028b0";const Zc=Ba(".2f"),ai=()=>{const{primary:n}=Ge();return{color:n}};function Xc({active:n,payload:a,label:l}){var i;const{color:t}=ai();if(n&&a&&a.length){const r=(i=a[0])==null?void 0:i.value;return e(rn,{children:e(pe,{color:t,shape:"square",name:l,value:r!=null?`${Zc(r)}%`:"--"})})}return null}function Yc(n){const a=D.useFragment(ni,n.dimension),l=u.useMemo(()=>{var o,c,d;const i=((o=a.segmentsComparison)==null?void 0:o.segments)??[],r=((d=(c=a.segmentsComparison)==null?void 0:c.totalCounts)==null?void 0:d.primaryValue)??0;return i.map(g=>{var y;const f=((y=g.counts)==null?void 0:y.primaryValue)??0,m=Gl(g.bin),p=f/r*100;return{name:m,percent:p}})},[a]),{color:t}=ai();return e(sn,{children:s(il,{data:l,margin:{top:25,right:18,left:18,bottom:5},children:[e("defs",{children:s("linearGradient",{id:"dimensionSegmentsBarColor",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:t,stopOpacity:1}),e("stop",{offset:"95%",stopColor:t,stopOpacity:.5})]})}),e(on,{dataKey:"name",style:{fill:"var(--ac-global-text-color-700)"}}),e(Ne,{stroke:ge.colors.gray200,label:{value:"% Volume",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},style:{fill:"var(--ac-global-text-color-700)"}}),e(dn,{strokeDasharray:"4 4",stroke:ge.colors.gray200,strokeOpacity:.5}),e(cn,{...Xa,content:e(Xc,{})}),e(En,{dataKey:"percent",fill:"url(#dimensionSegmentsBarColor)",spacing:15})]})})}function Ry(){const{dimensionId:n}=ln(),{timeRange:a}=He(),l=Cn(),{referenceInferences:t}=ze(),i=t!==null,r=i,o=l.dimension.shape!=="continuous",c=l.dimension.dataType==="numeric",d=ne(),g=D.useLazyLoadQuery(Mt,{dimensionId:n,timeRange:{start:a.start.toISOString(),end:a.end.toISOString()},hasReference:i});if(!n)throw new Error("Dimension ID is required to display a dimension");return e(Hl,{initialTimestamp:new Date(a.end),children:e(W,{type:"slideOver",isDismissable:!0,onDismiss:()=>d(-1),children:e(G,{size:"L",title:l.dimension.name,children:e("main",{css:C`
945
945
  padding: var(--px-spacing-med);
946
946
  display: flex;
947
947
  flex-direction: column;
@@ -1003,7 +1003,7 @@ fragment DimensionSegmentsBarChart_dimension_3E0ZE6 on Dimension {
1003
1003
  id
1004
1004
  }
1005
1005
  }
1006
- `}}}();ti.hash="8b568616f23f7d349cac5a31807463fb";const ii=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"spanId"}],a=[{kind:"Variable",name:"id",variableName:"spanId"}],l={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},i={alias:null,args:null,concreteType:"SpanContext",kind:"LinkedField",name:"context",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null}],storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"spanKind",storageKey:null},c={alias:"statusCode",args:null,kind:"ScalarField",name:"propagatedStatusCode",storageKey:null},d={alias:null,args:null,kind:"ScalarField",name:"statusMessage",storageKey:null},g={alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},f={alias:null,args:null,kind:"ScalarField",name:"parentId",storageKey:null},m={alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},p={alias:null,args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},y={alias:null,args:null,kind:"ScalarField",name:"tokenCountPrompt",storageKey:null},k={alias:null,args:null,kind:"ScalarField",name:"tokenCountCompletion",storageKey:null},b=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"mimeType",storageKey:null}],v={alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:b,storageKey:null},S={alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:b,storageKey:null},L={alias:null,args:null,kind:"ScalarField",name:"attributes",storageKey:null},A={alias:null,args:null,concreteType:"SpanEvent",kind:"LinkedField",name:"events",plural:!0,selections:[r,{alias:null,args:null,kind:"ScalarField",name:"message",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"timestamp",storageKey:null}],storageKey:null},_={alias:null,args:null,concreteType:"DocumentRetrievalMetrics",kind:"LinkedField",name:"documentRetrievalMetrics",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"evaluationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"ndcg",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"precision",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hit",storageKey:null}],storageKey:null},x={alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},T={alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},E={alias:null,args:null,kind:"ScalarField",name:"explanation",storageKey:null},R={alias:null,args:null,concreteType:"DocumentEvaluation",kind:"LinkedField",name:"documentEvaluations",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"documentPosition",storageKey:null},r,x,T,E],storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"SpanDetailsQuery",selections:[{alias:"span",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{kind:"InlineFragment",selections:[t,i,r,o,c,d,g,f,m,p,y,k,v,S,L,{kind:"RequiredField",field:A,action:"THROW",path:"span.events"},_,R,{alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[r],storageKey:null},{args:null,kind:"FragmentSpread",name:"SpanFeedback_annotations"},{args:null,kind:"FragmentSpread",name:"SpanAside_span"}],type:"Span",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"SpanDetailsQuery",selections:[{alias:"span",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{kind:"TypeDiscriminator",abstractKey:"__isNode"},t,{kind:"InlineFragment",selections:[i,r,o,c,d,g,f,m,p,y,k,v,S,L,A,_,R,{alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[r,x,T,E,{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null},t],storageKey:null},{alias:"code",args:null,kind:"ScalarField",name:"statusCode",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"endTime",storageKey:null}],type:"Span",abstractKey:null}],storageKey:null}]},params:{cacheID:"b1a80a0108c40baebf6e64b811ca0202",id:null,metadata:{},name:"SpanDetailsQuery",operationKind:"query",text:`query SpanDetailsQuery(
1006
+ `}}}();ti.hash="8b568616f23f7d349cac5a31807463fb";const ii=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"spanId"}],a=[{kind:"Variable",name:"id",variableName:"spanId"}],l={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},i={alias:null,args:null,concreteType:"SpanContext",kind:"LinkedField",name:"context",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null}],storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"spanKind",storageKey:null},c={alias:"statusCode",args:null,kind:"ScalarField",name:"propagatedStatusCode",storageKey:null},d={alias:null,args:null,kind:"ScalarField",name:"statusMessage",storageKey:null},g={alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},f={alias:null,args:null,kind:"ScalarField",name:"parentId",storageKey:null},m={alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},p={alias:null,args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},y={alias:null,args:null,kind:"ScalarField",name:"tokenCountPrompt",storageKey:null},b={alias:null,args:null,kind:"ScalarField",name:"tokenCountCompletion",storageKey:null},k=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"mimeType",storageKey:null}],v={alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:k,storageKey:null},S={alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:k,storageKey:null},A={alias:null,args:null,kind:"ScalarField",name:"attributes",storageKey:null},L={alias:null,args:null,concreteType:"SpanEvent",kind:"LinkedField",name:"events",plural:!0,selections:[r,{alias:null,args:null,kind:"ScalarField",name:"message",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"timestamp",storageKey:null}],storageKey:null},w={alias:null,args:null,concreteType:"DocumentRetrievalMetrics",kind:"LinkedField",name:"documentRetrievalMetrics",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"evaluationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"ndcg",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"precision",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hit",storageKey:null}],storageKey:null},x={alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},T={alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},E={alias:null,args:null,kind:"ScalarField",name:"explanation",storageKey:null},R={alias:null,args:null,concreteType:"DocumentEvaluation",kind:"LinkedField",name:"documentEvaluations",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"documentPosition",storageKey:null},r,x,T,E],storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"SpanDetailsQuery",selections:[{alias:"span",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{kind:"InlineFragment",selections:[t,i,r,o,c,d,g,f,m,p,y,b,v,S,A,{kind:"RequiredField",field:L,action:"THROW",path:"span.events"},w,R,{alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[r],storageKey:null},{args:null,kind:"FragmentSpread",name:"SpanFeedback_annotations"},{args:null,kind:"FragmentSpread",name:"SpanAside_span"}],type:"Span",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"SpanDetailsQuery",selections:[{alias:"span",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{kind:"TypeDiscriminator",abstractKey:"__isNode"},t,{kind:"InlineFragment",selections:[i,r,o,c,d,g,f,m,p,y,b,v,S,A,L,w,R,{alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[r,x,T,E,{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null},t],storageKey:null},{alias:"code",args:null,kind:"ScalarField",name:"statusCode",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"endTime",storageKey:null}],type:"Span",abstractKey:null}],storageKey:null}]},params:{cacheID:"b1a80a0108c40baebf6e64b811ca0202",id:null,metadata:{},name:"SpanDetailsQuery",operationKind:"query",text:`query SpanDetailsQuery(
1007
1007
  $spanId: GlobalID!
1008
1008
  ) {
1009
1009
  span: node(id: $spanId) {
@@ -1231,7 +1231,7 @@ fragment EditSpanAnnotationsDialog_spanAnnotations on Span {
1231
1231
  `}}}();ui.hash="ded0a7a64a2706f6ec472a63c1c57eca";const nu=C`
1232
1232
  color: var(--ac-global-text-color-900);
1233
1233
  font-size: 12px;
1234
- `;function mi(n){const{initialData:a,isReadOnly:l,onSubmit:t,isSubmitting:i=!1}=n,{control:r,handleSubmit:o,formState:{isDirty:c,isValid:d},setError:g,reset:f}=Ie({defaultValues:a,disabled:l}),m=u.useCallback(y=>{const k=!y.label,b=y.score===""||y.score==null;if(k&&b){g("label",{type:"manual",message:"Label or score is required"}),g("score",{type:"manual",message:"Label or score is required"});return}const v={...y,score:y.score!=null?parseFloat(y.score.toString()):null};t&&t(v),f(v)},[t,g,f]),p=l;return s(ye,{onSubmit:o(m),children:[e(F,{padding:"size-200",children:s(h,{direction:"column",gap:"size-100",children:[s("div",{css:C`
1234
+ `;function mi(n){const{initialData:a,isReadOnly:l,onSubmit:t,isSubmitting:i=!1}=n,{control:r,handleSubmit:o,formState:{isDirty:c,isValid:d},setError:g,reset:f}=Ie({defaultValues:a,disabled:l}),m=u.useCallback(y=>{const b=!y.label,k=y.score===""||y.score==null;if(b&&k){g("label",{type:"manual",message:"Label or score is required"}),g("score",{type:"manual",message:"Label or score is required"});return}const v={...y,score:y.score!=null?parseFloat(y.score.toString()):null};t&&t(v),f(v)},[t,g,f]),p=l;return s(ye,{onSubmit:o(m),children:[e(F,{padding:"size-200",children:s(h,{direction:"column",gap:"size-100",children:[s("div",{css:C`
1235
1235
  display: flex;
1236
1236
  flex-direction: row;
1237
1237
  width: 100%;
@@ -1243,7 +1243,7 @@ fragment EditSpanAnnotationsDialog_spanAnnotations on Span {
1243
1243
  .ac-textfield {
1244
1244
  min-width: 0;
1245
1245
  }
1246
- `,children:[e(B,{name:"label",control:r,render:({field:{onChange:y,onBlur:k,value:b},fieldState:{invalid:v,error:S}})=>e(X,{label:"Label",placeholder:"e.x. good, bad",description:"A categorical label like 'good' or 'bad'",isReadOnly:l,errorMessage:S==null?void 0:S.message,validationState:v?"invalid":"valid",onChange:y,onBlur:k,value:(b==null?void 0:b.toString())||""})}),e(B,{name:"score",control:r,render:({field:{onChange:y,onBlur:k,value:b},fieldState:{invalid:v,error:S}})=>e(X,{label:"Score",type:"number",placeholder:"e.x. 0.8",description:"A numeric grade",errorMessage:S==null?void 0:S.message,isReadOnly:l,validationState:v?"invalid":"valid",onChange:y,onBlur:k,value:(b==null?void 0:b.toString())||""})})]}),s("details",{open:!p,css:nu,children:[e("summary",{children:"Annotation Details"}),e(F,{paddingTop:"size-50",children:e(B,{name:"explanation",control:r,render:({field:{onChange:y,onBlur:k,value:b},fieldState:{invalid:v,error:S}})=>e(ka,{label:"Explanation",height:70,isReadOnly:l,description:"Why this score or label was given",errorMessage:S==null?void 0:S.message,validationState:v?"invalid":"valid",onChange:y,onBlur:k,value:(b==null?void 0:b.toString())||""})})})]})]})}),e(q,{children:l?null:e(F,{paddingTop:"size-100",paddingBottom:"size-100",paddingEnd:"size-200",paddingStart:"size-200",borderTopWidth:"thin",borderColor:"dark",children:e(h,{direction:"row",justifyContent:"end",children:e(M,{variant:c?"primary":"default",type:"submit",size:"compact",disabled:!d||!c||i,children:i?"Saving...":"Save"})})})})]})}function au(n){const{annotationName:a,spanNodeId:l,onCreated:t}=n,[i,r]=D.useMutation(ui);return e(mi,{initialData:{name:a},isSubmitting:r,onSubmit:c=>{i({variables:{input:{spanId:l,annotatorKind:"HUMAN",...c},spanId:l},onCompleted:()=>{t()}})}})}const gi=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"annotationId"},{defaultValue:null,kind:"LocalArgument",name:"spanId"}],a=[{fields:[{items:[{kind:"Variable",name:"annotationIds.0",variableName:"annotationId"}],kind:"ListValue",name:"annotationIds"}],kind:"ObjectValue",name:"input"}],l=[{kind:"Variable",name:"id",variableName:"spanId"}],t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"SpanAnnotationActionMenuDeleteMutation",selections:[{alias:null,args:a,concreteType:"SpanAnnotationMutationPayload",kind:"LinkedField",name:"deleteSpanAnnotations",plural:!1,selections:[{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{alias:null,args:l,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{kind:"InlineFragment",selections:[{args:null,kind:"FragmentSpread",name:"EditSpanAnnotationsDialog_spanAnnotations"}],type:"Span",abstractKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"SpanAnnotationActionMenuDeleteMutation",selections:[{alias:null,args:a,concreteType:"SpanAnnotationMutationPayload",kind:"LinkedField",name:"deleteSpanAnnotations",plural:!1,selections:[{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{alias:null,args:l,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"TypeDiscriminator",abstractKey:"__isNode"},t,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[t,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"explanation",storageKey:null}],storageKey:null}],type:"Span",abstractKey:null}],storageKey:null}],storageKey:null}],storageKey:null}]},params:{cacheID:"422687a283120080277d2649c1b9f6ee",id:null,metadata:{},name:"SpanAnnotationActionMenuDeleteMutation",operationKind:"mutation",text:`mutation SpanAnnotationActionMenuDeleteMutation(
1246
+ `,children:[e(H,{name:"label",control:r,render:({field:{onChange:y,onBlur:b,value:k},fieldState:{invalid:v,error:S}})=>e(X,{label:"Label",placeholder:"e.x. good, bad",description:"A categorical label like 'good' or 'bad'",isReadOnly:l,errorMessage:S==null?void 0:S.message,validationState:v?"invalid":"valid",onChange:y,onBlur:b,value:(k==null?void 0:k.toString())||""})}),e(H,{name:"score",control:r,render:({field:{onChange:y,onBlur:b,value:k},fieldState:{invalid:v,error:S}})=>e(X,{label:"Score",type:"number",placeholder:"e.x. 0.8",description:"A numeric grade",errorMessage:S==null?void 0:S.message,isReadOnly:l,validationState:v?"invalid":"valid",onChange:y,onBlur:b,value:(k==null?void 0:k.toString())||""})})]}),s("details",{open:!p,css:nu,children:[e("summary",{children:"Annotation Details"}),e(F,{paddingTop:"size-50",children:e(H,{name:"explanation",control:r,render:({field:{onChange:y,onBlur:b,value:k},fieldState:{invalid:v,error:S}})=>e(ka,{label:"Explanation",height:70,isReadOnly:l,description:"Why this score or label was given",errorMessage:S==null?void 0:S.message,validationState:v?"invalid":"valid",onChange:y,onBlur:b,value:(k==null?void 0:k.toString())||""})})})]})]})}),e(q,{children:l?null:e(F,{paddingTop:"size-100",paddingBottom:"size-100",paddingEnd:"size-200",paddingStart:"size-200",borderTopWidth:"thin",borderColor:"dark",children:e(h,{direction:"row",justifyContent:"end",children:e(M,{variant:c?"primary":"default",type:"submit",size:"compact",disabled:!d||!c||i,children:i?"Saving...":"Save"})})})})]})}function au(n){const{annotationName:a,spanNodeId:l,onCreated:t}=n,[i,r]=D.useMutation(ui);return e(mi,{initialData:{name:a},isSubmitting:r,onSubmit:c=>{i({variables:{input:{spanId:l,annotatorKind:"HUMAN",...c},spanId:l},onCompleted:()=>{t()}})}})}const gi=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"annotationId"},{defaultValue:null,kind:"LocalArgument",name:"spanId"}],a=[{fields:[{items:[{kind:"Variable",name:"annotationIds.0",variableName:"annotationId"}],kind:"ListValue",name:"annotationIds"}],kind:"ObjectValue",name:"input"}],l=[{kind:"Variable",name:"id",variableName:"spanId"}],t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"SpanAnnotationActionMenuDeleteMutation",selections:[{alias:null,args:a,concreteType:"SpanAnnotationMutationPayload",kind:"LinkedField",name:"deleteSpanAnnotations",plural:!1,selections:[{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{alias:null,args:l,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{kind:"InlineFragment",selections:[{args:null,kind:"FragmentSpread",name:"EditSpanAnnotationsDialog_spanAnnotations"}],type:"Span",abstractKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"SpanAnnotationActionMenuDeleteMutation",selections:[{alias:null,args:a,concreteType:"SpanAnnotationMutationPayload",kind:"LinkedField",name:"deleteSpanAnnotations",plural:!1,selections:[{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{alias:null,args:l,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"TypeDiscriminator",abstractKey:"__isNode"},t,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[t,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"explanation",storageKey:null}],storageKey:null}],type:"Span",abstractKey:null}],storageKey:null}],storageKey:null}],storageKey:null}]},params:{cacheID:"422687a283120080277d2649c1b9f6ee",id:null,metadata:{},name:"SpanAnnotationActionMenuDeleteMutation",operationKind:"mutation",text:`mutation SpanAnnotationActionMenuDeleteMutation(
1247
1247
  $annotationId: GlobalID!
1248
1248
  $spanId: GlobalID!
1249
1249
  ) {
@@ -1272,7 +1272,7 @@ fragment EditSpanAnnotationsDialog_spanAnnotations on Span {
1272
1272
  explanation
1273
1273
  }
1274
1274
  }
1275
- `}}}();gi.hash="a898fcb037b08cb626daaf3d385588ce";function lu(n){const{onDelete:a,isDisabled:l=!1}=n;return e("div",{onClick:t=>{t.preventDefault(),t.stopPropagation()},children:e(Be,{align:"end",buttonSize:"compact",isDisabled:l,onAction:t=>{switch(t){case"deleteAnnotation":a();break}},children:e(U,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(I.TrashOutline,{})}),e(K,{children:"Delete"})]})},"deleteAnnotation")})})}function tu(n){const{annotationId:a,spanNodeId:l,annotationName:t,onSpanAnnotationActionSuccess:i,onSpanAnnotationActionError:r}=n,[o,c]=u.useState(null),[d,g]=D.useMutation(gi),f=u.useCallback(()=>{u.startTransition(()=>{d({variables:{annotationId:a,spanId:l},onCompleted:()=>{i({title:"Annotation Deleted",message:`Annotation ${t} has been deleted.`})},onError:p=>{r(p)}})})},[d,a,l,i,t,r]),m=u.useCallback(()=>{c(s(G,{size:"S",title:"Delete Annotation",children:[e(F,{padding:"size-200",children:e(K,{color:"danger",children:`Are you sure you want to delete annotation ${t}? This cannot be undone.`})}),e(F,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(h,{direction:"row",justifyContent:"end",children:e(M,{variant:"danger",onClick:()=>{f(),c(null)},children:"Delete Annotation"})})})]}))},[f,t]);return s("div",{children:[e(lu,{onDelete:m,isDisabled:g}),e(W,{type:"modal",isDismissable:!0,onDismiss:()=>c(null),children:o})]})}function iu(n){const{projectId:a,spanNodeId:l}=n,[t,i]=u.useState(null),r=oe();return e(G,{title:"Annotate",size:"M",isDismissable:!0,extra:e(ru,{projectId:a,spanNodeId:l,disabled:t!==null,onAnnotationNameSelect:i}),children:s("div",{css:C`
1275
+ `}}}();gi.hash="a898fcb037b08cb626daaf3d385588ce";function lu(n){const{onDelete:a,isDisabled:l=!1}=n;return e("div",{onClick:t=>{t.preventDefault(),t.stopPropagation()},children:e(Be,{align:"end",buttonSize:"compact",isDisabled:l,onAction:t=>{switch(t){case"deleteAnnotation":a();break}},children:e(B,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(I.TrashOutline,{})}),e(K,{children:"Delete"})]})},"deleteAnnotation")})})}function tu(n){const{annotationId:a,spanNodeId:l,annotationName:t,onSpanAnnotationActionSuccess:i,onSpanAnnotationActionError:r}=n,[o,c]=u.useState(null),[d,g]=D.useMutation(gi),f=u.useCallback(()=>{u.startTransition(()=>{d({variables:{annotationId:a,spanId:l},onCompleted:()=>{i({title:"Annotation Deleted",message:`Annotation ${t} has been deleted.`})},onError:p=>{r(p)}})})},[d,a,l,i,t,r]),m=u.useCallback(()=>{c(s(G,{size:"S",title:"Delete Annotation",children:[e(F,{padding:"size-200",children:e(K,{color:"danger",children:`Are you sure you want to delete annotation ${t}? This cannot be undone.`})}),e(F,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(h,{direction:"row",justifyContent:"end",children:e(M,{variant:"danger",onClick:()=>{f(),c(null)},children:"Delete Annotation"})})})]}))},[f,t]);return s("div",{children:[e(lu,{onDelete:m,isDisabled:g}),e(W,{type:"modal",isDismissable:!0,onDismiss:()=>c(null),children:o})]})}function iu(n){const{projectId:a,spanNodeId:l}=n,[t,i]=u.useState(null),r=oe();return e(G,{title:"Annotate",size:"M",isDismissable:!0,extra:e(ru,{projectId:a,spanNodeId:l,disabled:t!==null,onAnnotationNameSelect:i}),children:s("div",{css:C`
1276
1276
  height: 100%;
1277
1277
  overflow-y: auto;
1278
1278
  padding: var(--ac-global-dimension-size-200);
@@ -1280,7 +1280,7 @@ fragment EditSpanAnnotationsDialog_spanAnnotations on Span {
1280
1280
  display: flex;
1281
1281
  flex-direction: column;
1282
1282
  gap: var(--ac-global-dimension-size-200);
1283
- `,children:t.map((r,o)=>e("li",{children:e(uu,{annotation:r,spanNodeId:l.id})},`${o}_${r.name}`))})]})}function cu(n){const{spanNodeId:a,name:l,onDelete:t,onCreated:i}=n;return s(z,{variant:"compact",title:l,borderColor:"orange-900",extra:s(h,{direction:"row",alignItems:"center",gap:"size-100",children:[e(pi,{kind:"HUMAN"}),e(M,{variant:"default",size:"compact",isDisabled:!0,"aria-label":"delete annotation",icon:e(P,{svg:e(I.CloseOutline,{})}),onClick:t})]}),bodyStyle:{padding:0},children:[e(ee,{variant:"info",banner:!0,children:"Fill out the fields below and click save to create a new annotation."}),e(au,{annotationName:l,spanNodeId:a,onCreated:i})]})}function uu(n){const{annotation:a,spanNodeId:l}=n,[t,i]=u.useState(null),r=oe(),[o,c]=D.useMutation(si),d=u.useCallback(g=>{u.startTransition(()=>{o({variables:{annotationId:a.id,spanId:l,...g},onCompleted:()=>{r({title:"Annotation Updated",message:`Annotation ${a.name} has been updated.`})},onError:f=>{i(f)}})})},[a.id,a.name,o,r,l]);return s(z,{variant:"compact",title:a.name,titleExtra:a.label||typeof a.score=="number"&&Ve(a.score)||null,collapsible:!0,bodyStyle:{padding:0},extra:s(h,{gap:"size-100",alignItems:"center",children:[e(pi,{kind:a.annotatorKind}),e(tu,{annotationId:a.id,spanNodeId:l,annotationName:a.name,onSpanAnnotationActionSuccess:g=>{r(g)},onSpanAnnotationActionError:g=>{i(g)}})]}),children:[t&&e(ee,{variant:"danger",banner:!0,children:t.message}),e(mi,{initialData:a,isReadOnly:a.annotatorKind==="LLM",isSubmitting:c,onSubmit:g=>{d(g)}})]})}function pi(n){const{kind:a}=n;return e(Zn,{color:a==="HUMAN"?"blue-900":"orange-900",children:a})}function mu(n){const{projectId:a,spanId:l,onAnnotationNameSelect:t}=n,i=D.useLazyLoadQuery(ri,{projectId:a,spanId:l}),[r,o]=u.useState(""),c=u.useMemo(()=>{var f,m;return((m=(f=i==null?void 0:i.span)==null?void 0:f.spanAnnotations)==null?void 0:m.map(p=>p.name))||[]},[i.span.spanAnnotations]),d=u.useMemo(()=>(i.project.spanAnnotationNames||[]).filter(m=>!c.includes(m)),[i.project.spanAnnotationNames,c]),g=d.length>0;return s(q,{children:[e(F,{padding:"size-200",children:s(h,{direction:"row",gap:"size-100",alignItems:"end",children:[e(X,{label:"Annotation Name",value:r,placeholder:"e.x. correctness",onChange:f=>{o(f)}}),e(M,{variant:"primary",onClick:()=>{t(r)},children:"Create"})]})}),g&&s(q,{children:[e(F,{borderTopWidth:"thin",borderBottomWidth:"thin",borderColor:"light",paddingStart:"size-200",paddingTop:"size-100",paddingBottom:"size-100",backgroundColor:"grey-300",children:e("label",{children:"select from existing"})}),e(na,{selectionMode:"single",onSelectionChange:f=>{if(f==="all"||f.size===0)return;const p=f.values().next().value;o(p||"")},disabledKeys:c,children:d.map(f=>e(U,{children:f},f))})]})]})}function gu(n){const{spanNodeId:a,projectId:l}=n,[t,i]=u.useState(null);return s(q,{children:[e(M,{variant:"default",icon:e(P,{svg:e(I.EditOutline,{})}),onClick:()=>i(e(iu,{spanNodeId:a,projectId:l})),children:"Annotate"}),e(W,{type:"slideOver",isDismissable:!0,onDismiss:()=>i(null),children:t})]})}const yi=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"SpanAsideSpanQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"SpanAside_span"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"SpanAsideSpanQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"TypeDiscriminator",abstractKey:"__isNode"},l,{kind:"InlineFragment",selections:[{alias:"code",args:null,kind:"ScalarField",name:"statusCode",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"endTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"tokenCountPrompt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"tokenCountCompletion",storageKey:null},{alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[l,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null}],storageKey:null}],type:"Span",abstractKey:null}],storageKey:null}]},params:{cacheID:"878027b90513af8f947e6aa408450057",id:null,metadata:{},name:"SpanAsideSpanQuery",operationKind:"query",text:`query SpanAsideSpanQuery(
1283
+ `,children:t.map((r,o)=>e("li",{children:e(uu,{annotation:r,spanNodeId:l.id})},`${o}_${r.name}`))})]})}function cu(n){const{spanNodeId:a,name:l,onDelete:t,onCreated:i}=n;return s(z,{variant:"compact",title:l,borderColor:"orange-900",extra:s(h,{direction:"row",alignItems:"center",gap:"size-100",children:[e(pi,{kind:"HUMAN"}),e(M,{variant:"default",size:"compact",isDisabled:!0,"aria-label":"delete annotation",icon:e(P,{svg:e(I.CloseOutline,{})}),onClick:t})]}),bodyStyle:{padding:0},children:[e(ee,{variant:"info",banner:!0,children:"Fill out the fields below and click save to create a new annotation."}),e(au,{annotationName:l,spanNodeId:a,onCreated:i})]})}function uu(n){const{annotation:a,spanNodeId:l}=n,[t,i]=u.useState(null),r=oe(),[o,c]=D.useMutation(si),d=u.useCallback(g=>{u.startTransition(()=>{o({variables:{annotationId:a.id,spanId:l,...g},onCompleted:()=>{r({title:"Annotation Updated",message:`Annotation ${a.name} has been updated.`})},onError:f=>{i(f)}})})},[a.id,a.name,o,r,l]);return s(z,{variant:"compact",title:a.name,titleExtra:a.label||typeof a.score=="number"&&Ve(a.score)||null,collapsible:!0,bodyStyle:{padding:0},extra:s(h,{gap:"size-100",alignItems:"center",children:[e(pi,{kind:a.annotatorKind}),e(tu,{annotationId:a.id,spanNodeId:l,annotationName:a.name,onSpanAnnotationActionSuccess:g=>{r(g)},onSpanAnnotationActionError:g=>{i(g)}})]}),children:[t&&e(ee,{variant:"danger",banner:!0,children:t.message}),e(mi,{initialData:a,isReadOnly:a.annotatorKind==="LLM",isSubmitting:c,onSubmit:g=>{d(g)}})]})}function pi(n){const{kind:a}=n;return e(Zn,{color:a==="HUMAN"?"blue-900":"orange-900",children:a})}function mu(n){const{projectId:a,spanId:l,onAnnotationNameSelect:t}=n,i=D.useLazyLoadQuery(ri,{projectId:a,spanId:l}),[r,o]=u.useState(""),c=u.useMemo(()=>{var f,m;return((m=(f=i==null?void 0:i.span)==null?void 0:f.spanAnnotations)==null?void 0:m.map(p=>p.name))||[]},[i.span.spanAnnotations]),d=u.useMemo(()=>(i.project.spanAnnotationNames||[]).filter(m=>!c.includes(m)),[i.project.spanAnnotationNames,c]),g=d.length>0;return s(q,{children:[e(F,{padding:"size-200",children:s(h,{direction:"row",gap:"size-100",alignItems:"end",children:[e(X,{label:"Annotation Name",value:r,placeholder:"e.x. correctness",onChange:f=>{o(f)}}),e(M,{variant:"primary",onClick:()=>{t(r)},children:"Create"})]})}),g&&s(q,{children:[e(F,{borderTopWidth:"thin",borderBottomWidth:"thin",borderColor:"light",paddingStart:"size-200",paddingTop:"size-100",paddingBottom:"size-100",backgroundColor:"grey-300",children:e("label",{children:"select from existing"})}),e(na,{selectionMode:"single",onSelectionChange:f=>{if(f==="all"||f.size===0)return;const p=f.values().next().value;o(p||"")},disabledKeys:c,children:d.map(f=>e(B,{children:f},f))})]})]})}function gu(n){const{spanNodeId:a,projectId:l}=n,[t,i]=u.useState(null);return s(q,{children:[e(M,{variant:"default",icon:e(P,{svg:e(I.EditOutline,{})}),onClick:()=>i(e(iu,{spanNodeId:a,projectId:l})),children:"Annotate"}),e(W,{type:"slideOver",isDismissable:!0,onDismiss:()=>i(null),children:t})]})}const yi=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"SpanAsideSpanQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"SpanAside_span"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"SpanAsideSpanQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"TypeDiscriminator",abstractKey:"__isNode"},l,{kind:"InlineFragment",selections:[{alias:"code",args:null,kind:"ScalarField",name:"statusCode",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"endTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"tokenCountPrompt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"tokenCountCompletion",storageKey:null},{alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[l,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null}],storageKey:null}],type:"Span",abstractKey:null}],storageKey:null}]},params:{cacheID:"878027b90513af8f947e6aa408450057",id:null,metadata:{},name:"SpanAsideSpanQuery",operationKind:"query",text:`query SpanAsideSpanQuery(
1284
1284
  $id: GlobalID!
1285
1285
  ) {
1286
1286
  node(id: $id) {
@@ -1313,7 +1313,7 @@ fragment SpanAside_span on Span {
1313
1313
  flex-direction: column;
1314
1314
  gap: var(--ac-global-dimension-size-100);
1315
1315
  align-items: flex-start;
1316
- `;function yu(n){const[a]=D.useRefetchableFragment(fi,n.span),{startTime:l,endTime:t,code:i,tokenCountCompletion:r,tokenCountPrompt:o,tokenCountTotal:c}=a,d=u.useMemo(()=>new Date(l),[l]),g=u.useMemo(()=>t?new Date(t):null,[t]),f=u.useMemo(()=>g?g.getTime()-d.getTime():null,[g,d]),m=Wl(i),p=a.spanAnnotations,y=p.length>0;return e(F,{padding:"size-200",borderColor:"dark",backgroundColor:"dark",borderLeftWidth:"thin",width:"230px",flex:"none",minHeight:"100%",children:s(h,{direction:"column",gap:"size-200",children:[e(Tn,{label:"Status",children:s(h,{direction:"row",gap:"size-50",alignItems:"center",children:[e(Ca,{statusCode:i}),e(K,{textSize:"xlarge",color:m,children:i})]})}),e(Tn,{label:"Start Time",children:e(K,{textSize:"xlarge",children:Qe(d)})}),g&&e(Tn,{label:"End Time",children:e(K,{textSize:"xlarge",children:Qe(g)})}),e(Tn,{label:"Latency",children:e(K,{textSize:"xlarge",children:typeof f=="number"?e(Me,{latencyMs:f,textSize:"xlarge"}):"--"})}),c?e(Tn,{label:"Total Tokens",children:e(Ya,{tokenCountTotal:c,tokenCountPrompt:o??0,tokenCountCompletion:r??0,textSize:"xlarge"})},"tokens"):null,y&&e(Tn,{label:"Feedback",children:e("ul",{css:pu,children:p.map(k=>e("li",{children:e(xn,{annotation:k,annotationDisplayPreference:"label"})},k.id))})})]})})}function Tn({label:n,children:a}){return s(h,{direction:"column",children:[e(K,{elementType:"h3",textSize:"medium",color:"text-700",children:n}),a]})}function fu(n){const{spanId:a,traceId:l}=n;return e("div",{css:C`
1316
+ `;function yu(n){const[a]=D.useRefetchableFragment(fi,n.span),{startTime:l,endTime:t,code:i,tokenCountCompletion:r,tokenCountPrompt:o,tokenCountTotal:c}=a,d=u.useMemo(()=>new Date(l),[l]),g=u.useMemo(()=>t?new Date(t):null,[t]),f=u.useMemo(()=>g?g.getTime()-d.getTime():null,[g,d]),m=Wl(i),p=a.spanAnnotations,y=p.length>0;return e(F,{padding:"size-200",borderColor:"dark",backgroundColor:"dark",borderLeftWidth:"thin",width:"230px",flex:"none",minHeight:"100%",children:s(h,{direction:"column",gap:"size-200",children:[e(Tn,{label:"Status",children:s(h,{direction:"row",gap:"size-50",alignItems:"center",children:[e(Ca,{statusCode:i}),e(K,{textSize:"xlarge",color:m,children:i})]})}),e(Tn,{label:"Start Time",children:e(K,{textSize:"xlarge",children:Qe(d)})}),g&&e(Tn,{label:"End Time",children:e(K,{textSize:"xlarge",children:Qe(g)})}),e(Tn,{label:"Latency",children:e(K,{textSize:"xlarge",children:typeof f=="number"?e(Me,{latencyMs:f,textSize:"xlarge"}):"--"})}),c?e(Tn,{label:"Total Tokens",children:e(Ya,{tokenCountTotal:c,tokenCountPrompt:o??0,tokenCountCompletion:r??0,textSize:"xlarge"})},"tokens"):null,y&&e(Tn,{label:"Feedback",children:e("ul",{css:pu,children:p.map(b=>e("li",{children:e(xn,{annotation:b,annotationDisplayPreference:"label"})},b.id))})})]})})}function Tn({label:n,children:a}){return s(h,{direction:"column",children:[e(K,{elementType:"h3",textSize:"medium",color:"text-700",children:n}),a]})}function fu(n){const{spanId:a,traceId:l}=n;return e("div",{css:C`
1317
1317
  button.ac-dropdown-button {
1318
1318
  min-width: 50px;
1319
1319
  .ac-dropdown-button__text {
@@ -1412,7 +1412,7 @@ fragment DatasetPicker__datasets on Query {
1412
1412
  }
1413
1413
  }
1414
1414
  }
1415
- `}};Si.hash="03d88d1706089bb63edcd44d04563cbc";const vi={argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:[],operation:Si}},name:"DatasetPicker__datasets",selections:[{alias:null,args:null,concreteType:"DatasetConnection",kind:"LinkedField",name:"datasets",plural:!1,selections:[{alias:null,args:null,concreteType:"DatasetEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"dataset",args:null,concreteType:"Dataset",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null};vi.hash="03d88d1706089bb63edcd44d04563cbc";function Ku(n){const[a,l]=D.useRefetchableFragment(vi,n.query);return s(h,{direction:"row",gap:"size-100",alignItems:"end",children:[e(Mn,{label:"dataset","data-testid":"dataset-picker",className:"dataset-picker",width:"100%","aria-label":"The dataset to add the example to",onSelectionChange:n.onSelectionChange,placeholder:"Select a dataset",onBlur:n.onBlur,isRequired:!0,validationState:n.validationState,errorMessage:n.errorMessage,children:a.datasets.edges.map(({dataset:t})=>e(U,{children:t.name},t.id))}),e(xu,{onDatasetCreated:()=>{u.startTransition(()=>{l({},{fetchPolicy:"store-and-network"})})}})]})}function xu({onDatasetCreated:n}){const[a,l]=u.useState(null),[t,i]=u.useState(!1),r=oe();return s(tn,{placement:"bottom right",isOpen:t,onOpenChange:o=>{l(null),i(o)},children:[e(M,{variant:"default",icon:e(P,{svg:e(I.PlusCircleOutline,{})}),"aria-label":"Create a new dataset"}),e(z,{title:"Create New Dataset",bodyStyle:{padding:0},variant:"compact",borderColor:"light",backgroundColor:"light",children:s(F,{width:"500px",children:[a?e(ee,{variant:"danger",children:a}):null,e(el,{onDatasetCreateError:o=>l(o.message),onDatasetCreated:({id:o,name:c})=>{l(null),i(!1),r({title:"Dataset Created",message:`Dataset "${c}" created successfully`}),n(o)}})]})})]})}const _a={backgroundColor:"light",borderColor:"light",collapsible:!0,bodyStyle:{padding:0}};function Du({spanId:n,onCompleted:a}){const[l,t]=u.useState(null),i=D.useLazyLoadQuery(bi,{spanId:n},{fetchPolicy:"store-and-network"}),{span:{revision:r}}=i,[o,c]=D.useMutation(ki),{control:d,setError:g,handleSubmit:f,formState:{isValid:m}}=Ie({defaultValues:{input:JSON.stringify(r==null?void 0:r.input,null,2),output:JSON.stringify(r==null?void 0:r.output,null,2),metadata:JSON.stringify(r==null?void 0:r.metadata,null,2),datasetId:""}}),p=u.useCallback(y=>{if(t(null),!Oe(y==null?void 0:y.input))return g("input",{message:"Input must be a valid JSON object"});if(!Oe(y==null?void 0:y.output))return g("output",{message:"Output must be a valid JSON object"});if(!Oe(y==null?void 0:y.metadata))return g("metadata",{message:"Metadata must be a valid JSON object"});if(!(y!=null&&y.datasetId))return g("datasetId",{message:"Dataset is required"});o({variables:{input:{datasetId:y.datasetId,examples:[{input:JSON.parse(y.input),output:JSON.parse(y.output),metadata:JSON.parse(y.metadata),spanId:n}]}},onCompleted:()=>{a(y.datasetId)},onError:k=>{t(k.message)}})},[o,g,n,a]);return e(G,{size:"fullscreen",title:"Add Example to Dataset",extra:e(M,{variant:"primary",size:"compact",disabled:!m||c,loading:c,onClick:f(p),icon:e(P,{svg:e(I.PlusCircleOutline,{})}),children:"Add Example"}),children:e("div",{css:C`
1415
+ `}};Si.hash="03d88d1706089bb63edcd44d04563cbc";const vi={argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:[],operation:Si}},name:"DatasetPicker__datasets",selections:[{alias:null,args:null,concreteType:"DatasetConnection",kind:"LinkedField",name:"datasets",plural:!1,selections:[{alias:null,args:null,concreteType:"DatasetEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"dataset",args:null,concreteType:"Dataset",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null};vi.hash="03d88d1706089bb63edcd44d04563cbc";function Ku(n){const[a,l]=D.useRefetchableFragment(vi,n.query);return s(h,{direction:"row",gap:"size-100",alignItems:"end",children:[e(Mn,{label:"dataset","data-testid":"dataset-picker",className:"dataset-picker",width:"100%","aria-label":"The dataset to add the example to",onSelectionChange:n.onSelectionChange,placeholder:"Select a dataset",onBlur:n.onBlur,isRequired:!0,validationState:n.validationState,errorMessage:n.errorMessage,children:a.datasets.edges.map(({dataset:t})=>e(B,{children:t.name},t.id))}),e(xu,{onDatasetCreated:()=>{u.startTransition(()=>{l({},{fetchPolicy:"store-and-network"})})}})]})}function xu({onDatasetCreated:n}){const[a,l]=u.useState(null),[t,i]=u.useState(!1),r=oe();return s(tn,{placement:"bottom right",isOpen:t,onOpenChange:o=>{l(null),i(o)},children:[e(M,{variant:"default",icon:e(P,{svg:e(I.PlusCircleOutline,{})}),"aria-label":"Create a new dataset"}),e(z,{title:"Create New Dataset",bodyStyle:{padding:0},variant:"compact",borderColor:"light",backgroundColor:"light",children:s(F,{width:"500px",children:[a?e(ee,{variant:"danger",children:a}):null,e(el,{onDatasetCreateError:o=>l(o.message),onDatasetCreated:({id:o,name:c})=>{l(null),i(!1),r({title:"Dataset Created",message:`Dataset "${c}" created successfully`}),n(o)}})]})})]})}const _a={backgroundColor:"light",borderColor:"light",collapsible:!0,bodyStyle:{padding:0}};function Du({spanId:n,onCompleted:a}){const[l,t]=u.useState(null),i=D.useLazyLoadQuery(bi,{spanId:n},{fetchPolicy:"store-and-network"}),{span:{revision:r}}=i,[o,c]=D.useMutation(ki),{control:d,setError:g,handleSubmit:f,formState:{isValid:m}}=Ie({defaultValues:{input:JSON.stringify(r==null?void 0:r.input,null,2),output:JSON.stringify(r==null?void 0:r.output,null,2),metadata:JSON.stringify(r==null?void 0:r.metadata,null,2),datasetId:""}}),p=u.useCallback(y=>{if(t(null),!Oe(y==null?void 0:y.input))return g("input",{message:"Input must be a valid JSON object"});if(!Oe(y==null?void 0:y.output))return g("output",{message:"Output must be a valid JSON object"});if(!Oe(y==null?void 0:y.metadata))return g("metadata",{message:"Metadata must be a valid JSON object"});if(!(y!=null&&y.datasetId))return g("datasetId",{message:"Dataset is required"});o({variables:{input:{datasetId:y.datasetId,examples:[{input:JSON.parse(y.input),output:JSON.parse(y.output),metadata:JSON.parse(y.metadata),spanId:n}]}},onCompleted:()=>{a(y.datasetId)},onError:b=>{t(b.message)}})},[o,g,n,a]);return e(G,{size:"fullscreen",title:"Add Example to Dataset",extra:e(M,{variant:"primary",size:"compact",disabled:!m||c,loading:c,onClick:f(p),icon:e(P,{svg:e(I.PlusCircleOutline,{})}),children:"Add Example"}),children:e("div",{css:C`
1416
1416
  overflow-y: auto;
1417
1417
  padding: var(--ac-global-dimension-size-400);
1418
1418
  /* Make widths configurable */
@@ -1423,7 +1423,7 @@ fragment DatasetPicker__datasets on Query {
1423
1423
  width: 100%;
1424
1424
  }
1425
1425
  }
1426
- `,children:e(h,{direction:"row",justifyContent:"center",children:e(F,{width:"900px",paddingStart:"auto",paddingEnd:"auto",children:s(h,{direction:"column",gap:"size-200",children:[l?e(ee,{variant:"danger",children:l}):null,e(B,{control:d,name:"datasetId",render:({field:{onChange:y,onBlur:k},fieldState:{invalid:b,error:v}})=>e(Ku,{onSelectionChange:y,onBlur:k,validationState:b?"invalid":"valid",errorMessage:v==null?void 0:v.message,query:i})}),e(B,{control:d,name:"input",render:({field:{onChange:y,onBlur:k,value:b},fieldState:{invalid:v,error:S}})=>s(z,{title:"Input",subTitle:"The input to the LLM, retriever, program, etc.",..._a,children:[v?e(ee,{variant:"danger",banner:!0,children:S==null?void 0:S.message}):null,e(Ee,{value:b,onChange:y,onBlur:k})]})}),e(B,{control:d,name:"output",render:({field:{onChange:y,onBlur:k,value:b},fieldState:{invalid:v,error:S}})=>s(z,{title:"Output",subTitle:"The output of the LLM or program to be used as an expected output",..._a,backgroundColor:"green-100",borderColor:"green-700",children:[v?e(ee,{variant:"danger",banner:!0,children:S==null?void 0:S.message}):null,e(Ee,{value:b,onChange:y,onBlur:k})]})}),e(B,{control:d,name:"metadata",render:({field:{onChange:y,onBlur:k,value:b},fieldState:{invalid:v,error:S}})=>s(z,{title:"Metadata",subTitle:"All data from the span to use during experimentation or evaluation",..._a,children:[v?e(ee,{variant:"danger",banner:!0,children:S==null?void 0:S.message}):null,e(Ee,{value:b,onChange:y,onBlur:k})]})})]})})})})})}const Tu=n=>u.useMemo(()=>al(n),[n]),Iu=n=>n.events.some(a=>a.name==="exception"),te={backgroundColor:"light",borderColor:"light",variant:"compact",collapsible:!0};function Lu({spanNodeId:n,projectId:a}){const l=St("playground"),t=ne(),{span:i}=D.useLazyLoadQuery(ii,{spanId:n});if(i.__typename!=="Span")throw new Error("Expected a span, but got a different type"+i.__typename);const r=u.useMemo(()=>Iu(i),[i]),o=Sn(d=>d.showSpanAside),c=Sn(d=>d.setShowSpanAside);return s(h,{direction:"column",flex:"1 1 auto",height:"100%",children:[e(F,{paddingTop:"size-100",paddingBottom:"size-100",paddingStart:"size-150",paddingEnd:"size-200",flex:"none",children:s(h,{direction:"row",gap:"size-200",alignItems:"center",children:[s(h,{direction:"row",gap:"size-100",width:"100%",height:"100%",alignItems:"center",children:[e(nl,{spanKind:i.spanKind}),e(K,{children:i.name})]}),s(h,{flex:"none",direction:"row",alignItems:"center",gap:"size-100",children:[l?e(M,{variant:"default",icon:e(P,{svg:e(I.PlayCircleOutline,{})}),disabled:i.spanKind!=="llm",onClick:()=>{t(`/playground/spans/${i.id}`)},children:"Playground"}):null,e(fu,{traceId:i.context.traceId,spanId:i.context.spanId}),e(wu,{span:i}),e(gu,{spanNodeId:i.id,projectId:a}),s(Le,{placement:"top",offset:5,children:[e(M,{variant:"default","aria-label":"Toggle showing span details",onClick:()=>{c(!o)},icon:e(P,{svg:o?e(I.SlideIn,{}):e(I.SlideOut,{})})}),e(wn,{children:o?"Hide Span Details":"Show Span Details"})]})]})]})}),s(Te,{children:[e(J,{name:"Info",children:s(h,{direction:"row",height:"100%",children:[e(Au,{children:e(Jl,{children:e(_u,{span:i})})}),o?e(yu,{span:i}):null]})}),e(J,{name:"Feedback",extra:e(Re,{variant:"light",children:i.spanAnnotations.length}),children:d=>d?e(bu,{span:i}):null}),e(J,{name:"Attributes",title:"Attributes",children:e(F,{padding:"size-200",children:e(z,{title:"All Attributes",...te,titleExtra:Ki,extra:e(le,{text:i.attributes}),bodyStyle:{padding:0},children:e(nn,{children:i.attributes})})})}),e(J,{name:"Events",extra:e(Re,{variant:r?"danger":"light",children:i.events.length}),children:e(Ju,{events:i.events})})]})]})}const Pu=C`
1426
+ `,children:e(h,{direction:"row",justifyContent:"center",children:e(F,{width:"900px",paddingStart:"auto",paddingEnd:"auto",children:s(h,{direction:"column",gap:"size-200",children:[l?e(ee,{variant:"danger",children:l}):null,e(H,{control:d,name:"datasetId",render:({field:{onChange:y,onBlur:b},fieldState:{invalid:k,error:v}})=>e(Ku,{onSelectionChange:y,onBlur:b,validationState:k?"invalid":"valid",errorMessage:v==null?void 0:v.message,query:i})}),e(H,{control:d,name:"input",render:({field:{onChange:y,onBlur:b,value:k},fieldState:{invalid:v,error:S}})=>s(z,{title:"Input",subTitle:"The input to the LLM, retriever, program, etc.",..._a,children:[v?e(ee,{variant:"danger",banner:!0,children:S==null?void 0:S.message}):null,e(Ee,{value:k,onChange:y,onBlur:b})]})}),e(H,{control:d,name:"output",render:({field:{onChange:y,onBlur:b,value:k},fieldState:{invalid:v,error:S}})=>s(z,{title:"Output",subTitle:"The output of the LLM or program to be used as an expected output",..._a,backgroundColor:"green-100",borderColor:"green-700",children:[v?e(ee,{variant:"danger",banner:!0,children:S==null?void 0:S.message}):null,e(Ee,{value:k,onChange:y,onBlur:b})]})}),e(H,{control:d,name:"metadata",render:({field:{onChange:y,onBlur:b,value:k},fieldState:{invalid:v,error:S}})=>s(z,{title:"Metadata",subTitle:"All data from the span to use during experimentation or evaluation",..._a,children:[v?e(ee,{variant:"danger",banner:!0,children:S==null?void 0:S.message}):null,e(Ee,{value:k,onChange:y,onBlur:b})]})})]})})})})})}const Tu=n=>u.useMemo(()=>al(n),[n]),Iu=n=>n.events.some(a=>a.name==="exception"),te={backgroundColor:"light",borderColor:"light",variant:"compact",collapsible:!0};function Lu({spanNodeId:n,projectId:a}){const l=St("playground"),t=ne(),{span:i}=D.useLazyLoadQuery(ii,{spanId:n});if(i.__typename!=="Span")throw new Error("Expected a span, but got a different type"+i.__typename);const r=u.useMemo(()=>Iu(i),[i]),o=Sn(d=>d.showSpanAside),c=Sn(d=>d.setShowSpanAside);return s(h,{direction:"column",flex:"1 1 auto",height:"100%",children:[e(F,{paddingTop:"size-100",paddingBottom:"size-100",paddingStart:"size-150",paddingEnd:"size-200",flex:"none",children:s(h,{direction:"row",gap:"size-200",alignItems:"center",children:[s(h,{direction:"row",gap:"size-100",width:"100%",height:"100%",alignItems:"center",children:[e(nl,{spanKind:i.spanKind}),e(K,{children:i.name})]}),s(h,{flex:"none",direction:"row",alignItems:"center",gap:"size-100",children:[l?e(M,{variant:"default",icon:e(P,{svg:e(I.PlayCircleOutline,{})}),disabled:i.spanKind!=="llm",onClick:()=>{t(`/playground/spans/${i.id}`)},children:"Playground"}):null,e(fu,{traceId:i.context.traceId,spanId:i.context.spanId}),e(wu,{span:i}),e(gu,{spanNodeId:i.id,projectId:a}),s(Le,{placement:"top",offset:5,children:[e(M,{variant:"default","aria-label":"Toggle showing span details",onClick:()=>{c(!o)},icon:e(P,{svg:o?e(I.SlideIn,{}):e(I.SlideOut,{})})}),e(wn,{children:o?"Hide Span Details":"Show Span Details"})]})]})]})}),s(Te,{children:[e(J,{name:"Info",children:s(h,{direction:"row",height:"100%",children:[e(Au,{children:e(Jl,{children:e(_u,{span:i})})}),o?e(yu,{span:i}):null]})}),e(J,{name:"Feedback",extra:e(Re,{variant:"light",children:i.spanAnnotations.length}),children:d=>d?e(bu,{span:i}):null}),e(J,{name:"Attributes",title:"Attributes",children:e(F,{padding:"size-200",children:e(z,{title:"All Attributes",...te,titleExtra:Ki,extra:e(le,{text:i.attributes}),bodyStyle:{padding:0},children:e(nn,{children:i.attributes})})})}),e(J,{name:"Events",extra:e(Re,{variant:r?"danger":"light",children:i.events.length}),children:e(Ju,{events:i.events})})]})]})}const Pu=C`
1427
1427
  flex: 1 1 auto;
1428
1428
  overflow-y: auto;
1429
1429
  // Overflow fails to take into account padding
@@ -1432,7 +1432,7 @@ fragment DatasetPicker__datasets on Query {
1432
1432
  display: block;
1433
1433
  height: var(--ac-global-dimension-static-size-400);
1434
1434
  }
1435
- `;function Au({children:n}){return e("div",{css:Pu,"data-testid":"span-info-wrap",children:n})}function wu({span:n}){const[a,l]=u.useState(null),t=oe(),i=ne(),r=u.useCallback(()=>{l(e(Du,{spanId:n.id,onCompleted:o=>{l(null),t({title:"Span Added to Dataset",message:"Successfully added span to dataset",action:{text:"View Dataset",onClick:()=>{i(`/datasets/${o}/examples`)}}})}}))},[n.id,t,i]);return s(q,{children:[e(M,{variant:"default",icon:e(P,{svg:e(I.DatabaseOutline,{})}),onClick:r,children:"Add to Dataset"}),e(u.Suspense,{children:e(W,{type:"slideOver",isDismissable:!0,onDismiss:()=>l(null),children:a})})]})}function _u({span:n}){const{spanKind:a,attributes:l}=n,{json:t,parseError:i}=Tu(l),r=u.useMemo(()=>n.statusMessage?e(ee,{variant:"danger",title:"Status Description",children:n.statusMessage}):null,[n]);if(i||!t)return e(F,{padding:"size-200",children:s(h,{direction:"column",gap:"size-200",children:[r,e(ee,{variant:"warning",title:"Un-parsable attributes",children:`Failed to parse span attributes. ${i instanceof Error?i.message:""}`}),e(z,{...te,title:"Attributes",children:e(F,{padding:"size-100",children:l})})]})});let o;switch(a){case"llm":{o=e(Eu,{span:n,spanAttributes:t});break}case"retriever":{o=e(Ru,{span:n,spanAttributes:t});break}case"reranker":{o=e(Mu,{span:n,spanAttributes:t});break}case"embedding":{o=e(Nu,{span:n,spanAttributes:t});break}case"tool":{o=e(zu,{span:n,spanAttributes:t});break}default:o=e(Ci,{span:n})}return e(F,{padding:"size-200",children:s(h,{direction:"column",gap:"size-200",children:[r,o,t!=null&&t.metadata?e(z,{...te,title:"Metadata",children:e(nn,{children:JSON.stringify(t.metadata)})}):null]})})}function Eu(n){const{spanAttributes:a,span:l}=n,{input:t,output:i}=l,r=u.useMemo(()=>a[se.llm]||null,[a]),o=u.useMemo(()=>{if(r==null)return null;const E=r[we.model_name];return typeof E=="string"?E:null},[r]),c=u.useMemo(()=>{if(r==null)return[];const E=r[we.input_messages];return bl(E)?(E==null?void 0:E.map(R=>R[se.message]).filter(Boolean))||[]:[]},[r]),d=u.useMemo(()=>{if(r==null)return[];const E=r[we.tools];return Array.isArray(E)?E==null?void 0:E.map(j=>j[se.tool]).filter(Boolean):[]},[r]),g=u.useMemo(()=>d.reduce((E,R)=>(R!=null&&R.json_schema&&E.push(R.json_schema),E),[]),[d]),f=u.useMemo(()=>{if(r==null)return[];const E=r[we.output_messages];return bl(E)?E.map(R=>R[se.message]).filter(Boolean)||[]:[]},[r]),m=u.useMemo(()=>{if(r==null)return[];const E=r[we.prompts];return Ho(E)?E:[]},[r]),p=u.useMemo(()=>{if(r==null)return null;const E=r[we.prompt_template];return E??null},[r]),y=u.useMemo(()=>r==null?"{}":r[we.invocation_parameters]||"{}",[r]),k=u.useMemo(()=>o==null?null:s(h,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Zl,{spanKind:"llm"}),e(K,{textSize:"large",weight:"heavy",children:o})]}),[o]),b=t!=null&&t.value!=null,v=c.length>0,S=g.length>0,L=i!=null&&i.value!=null,A=f.length>0,_=m.length>0,x=Object.keys(JSON.parse(y)).length>0,T=p!=null;return s(h,{direction:"column",gap:"size-200",children:[e(z,{collapsible:!0,backgroundColor:"light",borderColor:"light",bodyStyle:{padding:0},titleSeparator:!1,variant:"compact",title:k,children:s(Te,{children:[v?e(J,{name:"Input Messages",hidden:!v,children:e(vl,{messages:c})}):null,S?e(J,{name:"Tools",hidden:!S,children:e(Qu,{toolSchemas:g})}):null,b?e(J,{name:"Input",hidden:!b,children:e(F,{padding:"size-200",children:e(Ae,{children:e(z,{...te,title:"LLM Input",extra:s(h,{direction:"row",gap:"size-100",children:[e(qe,{}),e(le,{text:t.value})]}),children:e(Ue,{...t})})})})}):null,T?e(J,{name:"Prompt Template",hidden:!T,children:e(F,{padding:"size-200",children:s(h,{direction:"column",gap:"size-100",children:[e(F,{borderRadius:"medium",borderColor:"light",backgroundColor:"light",borderWidth:"thin",padding:"size-200",children:s(ma,{text:p.template,children:[e(K,{color:"text-700",fontStyle:"italic",children:"prompt template"}),e(Fi,{children:p.template})]})}),e(F,{borderRadius:"medium",borderColor:"light",backgroundColor:"light",borderWidth:"thin",padding:"size-200",children:s(ma,{text:JSON.stringify(p.variables),children:[e(K,{color:"text-700",fontStyle:"italic",children:"template variables"}),e(nn,{children:JSON.stringify(p.variables)})]})})]})})}):null,e(J,{name:"Prompts",hidden:!_,children:e(ju,{prompts:m})}),e(J,{name:"Invocation Params",hidden:!x,children:e(ma,{text:y,padding:"size-100",children:e(nn,{children:y})})})]})}),L||A?e(Ha,{...te,children:s(Te,{children:[A?e(J,{name:"Output Messages",hidden:!A,children:e(vl,{messages:f})}):null,L?e(J,{name:"Output",hidden:!L,children:e(F,{padding:"size-200",children:e(Ae,{children:e(z,{...te,title:"LLM Output",extra:s(h,{direction:"row",gap:"size-100",children:[e(qe,{}),e(le,{text:i.value})]}),children:e(Ue,{...i})})})})}):null]})}):null]})}function Ru(n){const{spanAttributes:a,span:l}=n,{input:t}=l,i=u.useMemo(()=>a[se.retrieval]||null,[a]),r=u.useMemo(()=>{var f;return i==null?[]:((f=i[zs.documents])==null?void 0:f.map(m=>m[se.document]).filter(Boolean))||[]},[i]),o=u.useMemo(()=>l.documentEvaluations.reduce((m,p)=>{const y=p.documentPosition,k=m[y]||[];return{...m,[y]:[...k,p]}},{}),[l.documentEvaluations]),c=t!=null&&t.value!=null,d=r.length>0,g=l.documentRetrievalMetrics.length>0;return s(h,{direction:"column",gap:"size-200",children:[c?e(Ae,{children:e(z,{title:"Input",...te,extra:s(h,{direction:"row",gap:"size-100",children:[e(qe,{}),e(le,{text:t.value})]}),children:e(Ue,{...t})})}):null,d?e(Ae,{children:e(z,{title:"Documents",...te,titleExtra:g&&e(h,{direction:"row",alignItems:"center",gap:"size-100",children:l.documentRetrievalMetrics.map(f=>s(q,{children:[e(De,{name:f.evaluationName,metric:"ndcg",score:f.ndcg},"ndcg"),e(De,{name:f.evaluationName,metric:"precision",score:f.precision},"precision"),e(De,{name:f.evaluationName,metric:"hit",score:f.hit},"hit")]}))}),extra:e(qe,{}),children:e("ul",{css:C`
1435
+ `;function Au({children:n}){return e("div",{css:Pu,"data-testid":"span-info-wrap",children:n})}function wu({span:n}){const[a,l]=u.useState(null),t=oe(),i=ne(),r=u.useCallback(()=>{l(e(Du,{spanId:n.id,onCompleted:o=>{l(null),t({title:"Span Added to Dataset",message:"Successfully added span to dataset",action:{text:"View Dataset",onClick:()=>{i(`/datasets/${o}/examples`)}}})}}))},[n.id,t,i]);return s(q,{children:[e(M,{variant:"default",icon:e(P,{svg:e(I.DatabaseOutline,{})}),onClick:r,children:"Add to Dataset"}),e(u.Suspense,{children:e(W,{type:"slideOver",isDismissable:!0,onDismiss:()=>l(null),children:a})})]})}function _u({span:n}){const{spanKind:a,attributes:l}=n,{json:t,parseError:i}=Tu(l),r=u.useMemo(()=>n.statusMessage?e(ee,{variant:"danger",title:"Status Description",children:n.statusMessage}):null,[n]);if(i||!t)return e(F,{padding:"size-200",children:s(h,{direction:"column",gap:"size-200",children:[r,e(ee,{variant:"warning",title:"Un-parsable attributes",children:`Failed to parse span attributes. ${i instanceof Error?i.message:""}`}),e(z,{...te,title:"Attributes",children:e(F,{padding:"size-100",children:l})})]})});let o;switch(a){case"llm":{o=e(Eu,{span:n,spanAttributes:t});break}case"retriever":{o=e(Ru,{span:n,spanAttributes:t});break}case"reranker":{o=e(Mu,{span:n,spanAttributes:t});break}case"embedding":{o=e(Nu,{span:n,spanAttributes:t});break}case"tool":{o=e(zu,{span:n,spanAttributes:t});break}default:o=e(Ci,{span:n})}return e(F,{padding:"size-200",children:s(h,{direction:"column",gap:"size-200",children:[r,o,t!=null&&t.metadata?e(z,{...te,title:"Metadata",children:e(nn,{children:JSON.stringify(t.metadata)})}):null]})})}function Eu(n){const{spanAttributes:a,span:l}=n,{input:t,output:i}=l,r=u.useMemo(()=>a[se.llm]||null,[a]),o=u.useMemo(()=>{if(r==null)return null;const E=r[we.model_name];return typeof E=="string"?E:null},[r]),c=u.useMemo(()=>{if(r==null)return[];const E=r[we.input_messages];return bl(E)?(E==null?void 0:E.map(R=>R[se.message]).filter(Boolean))||[]:[]},[r]),d=u.useMemo(()=>{if(r==null)return[];const E=r[we.tools];return Array.isArray(E)?E==null?void 0:E.map(j=>j[se.tool]).filter(Boolean):[]},[r]),g=u.useMemo(()=>d.reduce((E,R)=>(R!=null&&R.json_schema&&E.push(R.json_schema),E),[]),[d]),f=u.useMemo(()=>{if(r==null)return[];const E=r[we.output_messages];return bl(E)?E.map(R=>R[se.message]).filter(Boolean)||[]:[]},[r]),m=u.useMemo(()=>{if(r==null)return[];const E=r[we.prompts];return Ho(E)?E:[]},[r]),p=u.useMemo(()=>{if(r==null)return null;const E=r[we.prompt_template];return E??null},[r]),y=u.useMemo(()=>r==null?"{}":r[we.invocation_parameters]||"{}",[r]),b=u.useMemo(()=>o==null?null:s(h,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Zl,{spanKind:"llm"}),e(K,{textSize:"large",weight:"heavy",children:o})]}),[o]),k=t!=null&&t.value!=null,v=c.length>0,S=g.length>0,A=i!=null&&i.value!=null,L=f.length>0,w=m.length>0,x=Object.keys(JSON.parse(y)).length>0,T=p!=null;return s(h,{direction:"column",gap:"size-200",children:[e(z,{collapsible:!0,backgroundColor:"light",borderColor:"light",bodyStyle:{padding:0},titleSeparator:!1,variant:"compact",title:b,children:s(Te,{children:[v?e(J,{name:"Input Messages",hidden:!v,children:e(vl,{messages:c})}):null,S?e(J,{name:"Tools",hidden:!S,children:e(Qu,{toolSchemas:g})}):null,k?e(J,{name:"Input",hidden:!k,children:e(F,{padding:"size-200",children:e(Ae,{children:e(z,{...te,title:"LLM Input",extra:s(h,{direction:"row",gap:"size-100",children:[e(qe,{}),e(le,{text:t.value})]}),children:e(Ue,{...t})})})})}):null,T?e(J,{name:"Prompt Template",hidden:!T,children:e(F,{padding:"size-200",children:s(h,{direction:"column",gap:"size-100",children:[e(F,{borderRadius:"medium",borderColor:"light",backgroundColor:"light",borderWidth:"thin",padding:"size-200",children:s(ma,{text:p.template,children:[e(K,{color:"text-700",fontStyle:"italic",children:"prompt template"}),e(Fi,{children:p.template})]})}),e(F,{borderRadius:"medium",borderColor:"light",backgroundColor:"light",borderWidth:"thin",padding:"size-200",children:s(ma,{text:JSON.stringify(p.variables),children:[e(K,{color:"text-700",fontStyle:"italic",children:"template variables"}),e(nn,{children:JSON.stringify(p.variables)})]})})]})})}):null,e(J,{name:"Prompts",hidden:!w,children:e(ju,{prompts:m})}),e(J,{name:"Invocation Params",hidden:!x,children:e(ma,{text:y,padding:"size-100",children:e(nn,{children:y})})})]})}),A||L?e(Ha,{...te,children:s(Te,{children:[L?e(J,{name:"Output Messages",hidden:!L,children:e(vl,{messages:f})}):null,A?e(J,{name:"Output",hidden:!A,children:e(F,{padding:"size-200",children:e(Ae,{children:e(z,{...te,title:"LLM Output",extra:s(h,{direction:"row",gap:"size-100",children:[e(qe,{}),e(le,{text:i.value})]}),children:e(Ue,{...i})})})})}):null]})}):null]})}function Ru(n){const{spanAttributes:a,span:l}=n,{input:t}=l,i=u.useMemo(()=>a[se.retrieval]||null,[a]),r=u.useMemo(()=>{var f;return i==null?[]:((f=i[zs.documents])==null?void 0:f.map(m=>m[se.document]).filter(Boolean))||[]},[i]),o=u.useMemo(()=>l.documentEvaluations.reduce((m,p)=>{const y=p.documentPosition,b=m[y]||[];return{...m,[y]:[...b,p]}},{}),[l.documentEvaluations]),c=t!=null&&t.value!=null,d=r.length>0,g=l.documentRetrievalMetrics.length>0;return s(h,{direction:"column",gap:"size-200",children:[c?e(Ae,{children:e(z,{title:"Input",...te,extra:s(h,{direction:"row",gap:"size-100",children:[e(qe,{}),e(le,{text:t.value})]}),children:e(Ue,{...t})})}):null,d?e(Ae,{children:e(z,{title:"Documents",...te,titleExtra:g&&e(h,{direction:"row",alignItems:"center",gap:"size-100",children:l.documentRetrievalMetrics.map(f=>s(q,{children:[e(De,{name:f.evaluationName,metric:"ndcg",score:f.ndcg},"ndcg"),e(De,{name:f.evaluationName,metric:"precision",score:f.precision},"precision"),e(De,{name:f.evaluationName,metric:"hit",score:f.hit},"hit")]}))}),extra:e(qe,{}),children:e("ul",{css:C`
1436
1436
  display: flex;
1437
1437
  flex-direction: column;
1438
1438
  gap: var(--ac-global-dimension-static-size-200);
@@ -1529,7 +1529,7 @@ fragment DatasetPicker__datasets on Query {
1529
1529
  `,children:[e(Xu,{rootSpan:g}),s(Xe,{direction:"horizontal",autoSaveId:"trace-panel-group",css:C`
1530
1530
  flex: 1 1 auto;
1531
1531
  overflow: hidden;
1532
- `,children:[e(ce,{defaultSize:30,minSize:10,maxSize:70,children:e(em,{children:e(Go,{spans:o,selectedSpanNodeId:d,onSpanClick:f=>{i(m=>(m.set(Cl,f.id),m),{replace:!0})}})})}),e(Ye,{css:Kn}),e(ce,{children:e(Yu,{children:d?e(u.Suspense,{fallback:e(fe,{}),children:e(Lu,{spanNodeId:d,projectId:l})}):null})})]})]})}function Xu({rootSpan:n}){const{latencyMs:a,statusCode:l,spanAnnotations:t}=n??{latencyMs:null,statusCode:"UNSET",spanAnnotations:[]},i=t.length>0,r=Wl(l);return e(F,{padding:"size-200",borderBottomWidth:"thin",borderBottomColor:"dark",children:s(h,{direction:"row",gap:"size-400",children:[s(h,{direction:"column",children:[e(K,{elementType:"h3",textSize:"medium",color:"text-700",children:"Trace Status"}),e(K,{textSize:"xlarge",children:s(h,{direction:"row",gap:"size-50",alignItems:"center",children:[e(Ca,{statusCode:l}),e(K,{textSize:"xlarge",color:r,children:l})]})})]}),s(h,{direction:"column",children:[e(K,{elementType:"h3",textSize:"medium",color:"text-700",children:"Latency"}),e(K,{textSize:"xlarge",children:typeof a=="number"?e(Me,{latencyMs:a,textSize:"xlarge"}):"--"})]}),i?s(h,{direction:"column",gap:"size-50",children:[e(K,{elementType:"h3",textSize:"medium",color:"text-700",children:"Feedback"}),e(h,{direction:"row",gap:"size-50",children:t.map(o=>e(ia,{annotation:o,children:e(xn,{annotation:o,annotationDisplayPreference:"label"})},o.name))})]}):null]})})}function Yu({children:n}){return e("div",{"data-testid":"scrolling-tabs-wrapper",css:C`
1532
+ `,children:[e(ue,{defaultSize:30,minSize:10,maxSize:70,children:e(em,{children:e(Go,{spans:o,selectedSpanNodeId:d,onSpanClick:f=>{i(m=>(m.set(Cl,f.id),m),{replace:!0})}})})}),e(Ye,{css:Kn}),e(ue,{children:e(Yu,{children:d?e(u.Suspense,{fallback:e(fe,{}),children:e(Lu,{spanNodeId:d,projectId:l})}):null})})]})]})}function Xu({rootSpan:n}){const{latencyMs:a,statusCode:l,spanAnnotations:t}=n??{latencyMs:null,statusCode:"UNSET",spanAnnotations:[]},i=t.length>0,r=Wl(l);return e(F,{padding:"size-200",borderBottomWidth:"thin",borderBottomColor:"dark",children:s(h,{direction:"row",gap:"size-400",children:[s(h,{direction:"column",children:[e(K,{elementType:"h3",textSize:"medium",color:"text-700",children:"Trace Status"}),e(K,{textSize:"xlarge",children:s(h,{direction:"row",gap:"size-50",alignItems:"center",children:[e(Ca,{statusCode:l}),e(K,{textSize:"xlarge",color:r,children:l})]})})]}),s(h,{direction:"column",children:[e(K,{elementType:"h3",textSize:"medium",color:"text-700",children:"Latency"}),e(K,{textSize:"xlarge",children:typeof a=="number"?e(Me,{latencyMs:a,textSize:"xlarge"}):"--"})]}),i?s(h,{direction:"column",gap:"size-50",children:[e(K,{elementType:"h3",textSize:"medium",color:"text-700",children:"Feedback"}),e(h,{direction:"row",gap:"size-50",children:t.map(o=>e(ia,{annotation:o,children:e(xn,{annotation:o,annotationDisplayPreference:"label"})},o.name))})]}):null]})})}function Yu({children:n}){return e("div",{"data-testid":"scrolling-tabs-wrapper",css:C`
1533
1533
  height: 100%;
1534
1534
  overflow: hidden;
1535
1535
  .ac-tabs {
@@ -1552,7 +1552,7 @@ fragment DatasetPicker__datasets on Query {
1552
1552
  `,children:n})}function em({children:n}){return e("div",{"data-testid":"scrolling-panel-content",css:C`
1553
1553
  height: 100%;
1554
1554
  overflow-y: auto;
1555
- `,children:n})}function Ny(){const{traceId:n,projectId:a}=ln(),l=ne();return e(W,{type:"slideOver",isDismissable:!0,onDismiss:()=>l(`/projects/${a}`),children:e(G,{size:"fullscreen",title:"Trace Details",children:e(xi,{traceId:n,projectId:a})})})}const Di=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"},{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},r={kind:"Variable",name:"timeRange",variableName:"timeRange"},o=[{kind:"Literal",name:"first",value:50},{kind:"Literal",name:"rootSpansOnly",value:!0},{kind:"Literal",name:"sort",value:{col:"startTime",dir:"desc"}},r],c={alias:null,args:null,kind:"ScalarField",name:"spanKind",storageKey:null},d={alias:"statusCode",args:null,kind:"ScalarField",name:"propagatedStatusCode",storageKey:null},g={alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},f={alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},m={alias:null,args:null,kind:"ScalarField",name:"parentId",storageKey:null},p=[{alias:"value",args:null,kind:"ScalarField",name:"truncatedValue",storageKey:null}],y={alias:null,args:null,concreteType:"SpanContext",kind:"LinkedField",name:"context",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null}],storageKey:null},k={alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[i,{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null}],storageKey:null},b={alias:null,args:null,concreteType:"DocumentRetrievalMetrics",kind:"LinkedField",name:"documentRetrievalMetrics",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"evaluationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"ndcg",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"precision",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hit",storageKey:null}],storageKey:null},v=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],S=[r];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ProjectPageQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"TracesTable_spans"},{args:null,kind:"FragmentSpread",name:"ProjectPageHeader_stats"},{args:null,kind:"FragmentSpread",name:"StreamToggle_data"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ProjectPageQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{kind:"TypeDiscriminator",abstractKey:"__isNode"},t,{kind:"InlineFragment",selections:[i,{alias:null,args:null,kind:"ScalarField",name:"spanAnnotationNames",storageKey:null},{alias:"rootSpans",args:o,concreteType:"SpanConnection",kind:"LinkedField",name:"spans",plural:!1,selections:[{alias:null,args:null,concreteType:"SpanEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"rootSpan",args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[t,c,i,{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},d,g,f,{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountTotal",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountPrompt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountCompletion",storageKey:null},m,{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:p,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:p,storageKey:null},y,k,b,{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"descendants",plural:!0,selections:[t,c,i,d,g,f,m,{alias:"cumulativeTokenCountTotal",args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},{alias:"cumulativeTokenCountPrompt",args:null,kind:"ScalarField",name:"tokenCountPrompt",storageKey:null},{alias:"cumulativeTokenCountCompletion",args:null,kind:"ScalarField",name:"tokenCountCompletion",storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:v,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:v,storageKey:null},y,k,b],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[l],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:"rootSpans",args:o,filters:["sort","rootSpansOnly","filterCondition","timeRange"],handle:"connection",key:"TracesTable_rootSpans",kind:"LinkedHandle",name:"spans"},{alias:null,args:S,kind:"ScalarField",name:"traceCount",storageKey:null},{alias:null,args:S,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},{alias:"latencyMsP50",args:[{kind:"Literal",name:"probability",value:.5},r],kind:"ScalarField",name:"latencyMsQuantile",storageKey:null},{alias:"latencyMsP99",args:[{kind:"Literal",name:"probability",value:.99},r],kind:"ScalarField",name:"latencyMsQuantile",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"documentEvaluationNames",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"streamingLastUpdatedAt",storageKey:null}],type:"Project",abstractKey:null}],storageKey:null}]},params:{cacheID:"43fee2b22bc4798639d2e1fbef09ce21",id:null,metadata:{},name:"ProjectPageQuery",operationKind:"query",text:`query ProjectPageQuery(
1555
+ `,children:n})}function Ny(){const{traceId:n,projectId:a}=ln(),l=ne();return e(W,{type:"slideOver",isDismissable:!0,onDismiss:()=>l(`/projects/${a}`),children:e(G,{size:"fullscreen",title:"Trace Details",children:e(xi,{traceId:n,projectId:a})})})}const Di=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"},{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},r={kind:"Variable",name:"timeRange",variableName:"timeRange"},o=[{kind:"Literal",name:"first",value:50},{kind:"Literal",name:"rootSpansOnly",value:!0},{kind:"Literal",name:"sort",value:{col:"startTime",dir:"desc"}},r],c={alias:null,args:null,kind:"ScalarField",name:"spanKind",storageKey:null},d={alias:"statusCode",args:null,kind:"ScalarField",name:"propagatedStatusCode",storageKey:null},g={alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},f={alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},m={alias:null,args:null,kind:"ScalarField",name:"parentId",storageKey:null},p=[{alias:"value",args:null,kind:"ScalarField",name:"truncatedValue",storageKey:null}],y={alias:null,args:null,concreteType:"SpanContext",kind:"LinkedField",name:"context",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null}],storageKey:null},b={alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[i,{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null}],storageKey:null},k={alias:null,args:null,concreteType:"DocumentRetrievalMetrics",kind:"LinkedField",name:"documentRetrievalMetrics",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"evaluationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"ndcg",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"precision",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hit",storageKey:null}],storageKey:null},v=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}],S=[r];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ProjectPageQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"TracesTable_spans"},{args:null,kind:"FragmentSpread",name:"ProjectPageHeader_stats"},{args:null,kind:"FragmentSpread",name:"StreamToggle_data"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ProjectPageQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{kind:"TypeDiscriminator",abstractKey:"__isNode"},t,{kind:"InlineFragment",selections:[i,{alias:null,args:null,kind:"ScalarField",name:"spanAnnotationNames",storageKey:null},{alias:"rootSpans",args:o,concreteType:"SpanConnection",kind:"LinkedField",name:"spans",plural:!1,selections:[{alias:null,args:null,concreteType:"SpanEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"rootSpan",args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[t,c,i,{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},d,g,f,{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountTotal",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountPrompt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountCompletion",storageKey:null},m,{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:p,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:p,storageKey:null},y,b,k,{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"descendants",plural:!0,selections:[t,c,i,d,g,f,m,{alias:"cumulativeTokenCountTotal",args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},{alias:"cumulativeTokenCountPrompt",args:null,kind:"ScalarField",name:"tokenCountPrompt",storageKey:null},{alias:"cumulativeTokenCountCompletion",args:null,kind:"ScalarField",name:"tokenCountCompletion",storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:v,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:v,storageKey:null},y,b,k],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[l],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:"rootSpans",args:o,filters:["sort","rootSpansOnly","filterCondition","timeRange"],handle:"connection",key:"TracesTable_rootSpans",kind:"LinkedHandle",name:"spans"},{alias:null,args:S,kind:"ScalarField",name:"traceCount",storageKey:null},{alias:null,args:S,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},{alias:"latencyMsP50",args:[{kind:"Literal",name:"probability",value:.5},r],kind:"ScalarField",name:"latencyMsQuantile",storageKey:null},{alias:"latencyMsP99",args:[{kind:"Literal",name:"probability",value:.99},r],kind:"ScalarField",name:"latencyMsQuantile",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"documentEvaluationNames",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"streamingLastUpdatedAt",storageKey:null}],type:"Project",abstractKey:null}],storageKey:null}]},params:{cacheID:"43fee2b22bc4798639d2e1fbef09ce21",id:null,metadata:{},name:"ProjectPageQuery",operationKind:"query",text:`query ProjectPageQuery(
1556
1556
  $id: GlobalID!
1557
1557
  $timeRange: TimeRange!
1558
1558
  ) {
@@ -1805,7 +1805,7 @@ fragment AnnotationSummaryValueFragment_4BTVrq on Project {
1805
1805
  }
1806
1806
  id
1807
1807
  }
1808
- `}}}();_i.hash="6a15ba35fe9e1e35aa4c517ab6309a2b";function am({annotationName:n}){const{projectId:a}=ln(),{timeRange:l}=Fa(),t=D.useLazyLoadQuery(_i,{annotationName:n,id:a,timeRange:{start:l.start.toISOString(),end:l.end.toISOString()}});return s(h,{direction:"column",flex:"none",children:[e(K,{elementType:"h3",textSize:"medium",color:"text-700",children:n}),e(u.Suspense,{fallback:e(K,{textSize:"xlarge",children:"--"}),children:e(lm,{annotationName:n,project:t.project})})]})}function lm(n){var y,k;const{project:a,annotationName:l}=n,{fetchKey:t}=jn(),[i,r]=D.useRefetchableFragment(wi,a);u.useEffect(()=>{u.startTransition(()=>{r({},{fetchPolicy:"store-and-network"})})},[t,r]);const o=Ge(),d=[Xl(l),o.default,o.gray600,o.gray400,o.gray200],g=(y=i==null?void 0:i.spanAnnotationSummary)==null?void 0:y.meanScore,f=(k=i==null?void 0:i.spanAnnotationSummary)==null?void 0:k.labelFractions,m=typeof g=="number",p=Array.isArray(f)&&f.length>0;return!m&&!p?e(K,{textSize:"xlarge",children:"--"}):s(Le,{delay:0,placement:"bottom",children:[e(kn,{children:s(h,{direction:"row",alignItems:"center",gap:"size-50",children:[p?e(Kd,{width:24,height:24,children:e(xd,{data:f,dataKey:"fraction",nameKey:"label",cx:"50%",cy:"50%",innerRadius:8,outerRadius:11,strokeWidth:0,stroke:"transparent",children:f.map((b,v)=>e(Dd,{fill:d[v%d.length]},`cell-${v}`))})}):null,e(K,{textSize:"xlarge",children:m?Ve(g):"--"})]})}),e(aa,{children:e(F,{width:"size-2400",children:s(h,{direction:"column",gap:"size-50",children:[p&&e("ul",{children:f.map((b,v)=>e("li",{children:e(pe,{color:d[v%d.length],name:b.label,shape:"square",value:Yl(b.fraction*100)})},b.label))}),p&&m?e(va,{}):null,m?s(h,{direction:"row",justifyContent:"space-between",children:[e(K,{children:"mean"}),e(K,{children:Ve(g)})]}):null]})})})]})}const Ei=function(){var n={defaultValue:null,kind:"LocalArgument",name:"evaluationName"},a={defaultValue:null,kind:"LocalArgument",name:"id"},l={defaultValue:null,kind:"LocalArgument",name:"timeRange"},t=[{kind:"Variable",name:"id",variableName:"id"}],i=[{kind:"Variable",name:"evaluationName",variableName:"evaluationName"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}];return{fragment:{argumentDefinitions:[n,a,l],kind:"Fragment",metadata:null,name:"DocumentEvaluationSummaryValueQuery",selections:[{alias:null,args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:i,kind:"FragmentSpread",name:"DocumentEvaluationSummaryValueFragment"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,l,a],kind:"Operation",name:"DocumentEvaluationSummaryValueQuery",selections:[{alias:null,args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"TypeDiscriminator",abstractKey:"__isNode"},{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{kind:"InlineFragment",selections:[{alias:null,args:i,concreteType:"DocumentEvaluationSummary",kind:"LinkedField",name:"documentEvaluationSummary",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"averageNdcg",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"averagePrecision",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"meanReciprocalRank",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hitRate",storageKey:null}],storageKey:null}],type:"Project",abstractKey:null}],storageKey:null}]},params:{cacheID:"60d7798d88e1408e6b6b0bebdc1716f5",id:null,metadata:{},name:"DocumentEvaluationSummaryValueQuery",operationKind:"query",text:`query DocumentEvaluationSummaryValueQuery(
1808
+ `}}}();_i.hash="6a15ba35fe9e1e35aa4c517ab6309a2b";function am({annotationName:n}){const{projectId:a}=ln(),{timeRange:l}=Fa(),t=D.useLazyLoadQuery(_i,{annotationName:n,id:a,timeRange:{start:l.start.toISOString(),end:l.end.toISOString()}});return s(h,{direction:"column",flex:"none",children:[e(K,{elementType:"h3",textSize:"medium",color:"text-700",children:n}),e(u.Suspense,{fallback:e(K,{textSize:"xlarge",children:"--"}),children:e(lm,{annotationName:n,project:t.project})})]})}function lm(n){var y,b;const{project:a,annotationName:l}=n,{fetchKey:t}=jn(),[i,r]=D.useRefetchableFragment(wi,a);u.useEffect(()=>{u.startTransition(()=>{r({},{fetchPolicy:"store-and-network"})})},[t,r]);const o=Ge(),d=[Xl(l),o.default,o.gray600,o.gray400,o.gray200],g=(y=i==null?void 0:i.spanAnnotationSummary)==null?void 0:y.meanScore,f=(b=i==null?void 0:i.spanAnnotationSummary)==null?void 0:b.labelFractions,m=typeof g=="number",p=Array.isArray(f)&&f.length>0;return!m&&!p?e(K,{textSize:"xlarge",children:"--"}):s(Le,{delay:0,placement:"bottom",children:[e(kn,{children:s(h,{direction:"row",alignItems:"center",gap:"size-50",children:[p?e(Kd,{width:24,height:24,children:e(xd,{data:f,dataKey:"fraction",nameKey:"label",cx:"50%",cy:"50%",innerRadius:8,outerRadius:11,strokeWidth:0,stroke:"transparent",children:f.map((k,v)=>e(Dd,{fill:d[v%d.length]},`cell-${v}`))})}):null,e(K,{textSize:"xlarge",children:m?Ve(g):"--"})]})}),e(aa,{children:e(F,{width:"size-2400",children:s(h,{direction:"column",gap:"size-50",children:[p&&e("ul",{children:f.map((k,v)=>e("li",{children:e(pe,{color:d[v%d.length],name:k.label,shape:"square",value:Yl(k.fraction*100)})},k.label))}),p&&m?e(va,{}):null,m?s(h,{direction:"row",justifyContent:"space-between",children:[e(K,{children:"mean"}),e(K,{children:Ve(g)})]}):null]})})})]})}const Ei=function(){var n={defaultValue:null,kind:"LocalArgument",name:"evaluationName"},a={defaultValue:null,kind:"LocalArgument",name:"id"},l={defaultValue:null,kind:"LocalArgument",name:"timeRange"},t=[{kind:"Variable",name:"id",variableName:"id"}],i=[{kind:"Variable",name:"evaluationName",variableName:"evaluationName"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}];return{fragment:{argumentDefinitions:[n,a,l],kind:"Fragment",metadata:null,name:"DocumentEvaluationSummaryValueQuery",selections:[{alias:null,args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:i,kind:"FragmentSpread",name:"DocumentEvaluationSummaryValueFragment"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,l,a],kind:"Operation",name:"DocumentEvaluationSummaryValueQuery",selections:[{alias:null,args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"TypeDiscriminator",abstractKey:"__isNode"},{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{kind:"InlineFragment",selections:[{alias:null,args:i,concreteType:"DocumentEvaluationSummary",kind:"LinkedField",name:"documentEvaluationSummary",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"averageNdcg",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"averagePrecision",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"meanReciprocalRank",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hitRate",storageKey:null}],storageKey:null}],type:"Project",abstractKey:null}],storageKey:null}]},params:{cacheID:"60d7798d88e1408e6b6b0bebdc1716f5",id:null,metadata:{},name:"DocumentEvaluationSummaryValueQuery",operationKind:"query",text:`query DocumentEvaluationSummaryValueQuery(
1809
1809
  $evaluationName: String!
1810
1810
  $timeRange: TimeRange!
1811
1811
  $id: GlobalID!
@@ -1885,7 +1885,7 @@ fragment DocumentEvaluationSummaryValueFragment_1dJL9N on Project {
1885
1885
  left center,
1886
1886
  right center;
1887
1887
  background-attachment: local, local, scroll, scroll;
1888
- `,children:s(h,{direction:"row",gap:"size-400",alignItems:"center",children:[s(h,{direction:"column",flex:"none",children:[e(K,{elementType:"h3",textSize:"medium",color:"text-700",children:"Total Traces"}),e(K,{textSize:"xlarge",children:bn(t==null?void 0:t.traceCount)})]}),s(h,{direction:"column",flex:"none",children:[e(K,{elementType:"h3",textSize:"medium",color:"text-700",children:"Total Tokens"}),e(K,{textSize:"xlarge",children:bn(c)})]}),s(h,{direction:"column",flex:"none",children:[e(K,{elementType:"h3",textSize:"medium",color:"text-700",children:"Latency P50"}),r!=null?e(Me,{latencyMs:r,textSize:"xlarge"}):e(K,{textSize:"xlarge",children:"--"})]}),s(h,{direction:"column",flex:"none",children:[e(K,{elementType:"h3",textSize:"medium",color:"text-700",children:"Latency P99"}),o!=null?e(Me,{latencyMs:o,textSize:"xlarge"}):e(K,{textSize:"xlarge",children:"--"})]}),d.map(f=>e(am,{annotationName:f},f)),g.map(f=>e(tm,{evaluationName:f},`document-${f}`))]})}),e(F,{flex:"none",paddingStart:"size-100",children:a})]})})}const Ni=u.createContext(null);function zi(){const n=u.useContext(Ni);if(n===null)throw new Error("useSpanFilterCondition must be used within a SpanFilterConditionProvider");return n}function Fl(n){const[a,l]=u.useState(""),t=u.useCallback(r=>{u.startTransition(()=>{l(r)})},[]),i=u.useCallback(r=>{u.startTransition(()=>{a.length>0?l(a+" and "+r):l(r)})},[a]);return e(Ni.Provider,{value:{filterCondition:a,setFilterCondition:t,appendFilterCondition:i},children:n.children})}const Vi=function(){var n={defaultValue:null,kind:"LocalArgument",name:"after"},a={defaultValue:null,kind:"LocalArgument",name:"filterCondition"},l={defaultValue:50,kind:"LocalArgument",name:"first"},t={defaultValue:null,kind:"LocalArgument",name:"id"},i={defaultValue:{col:"startTime",dir:"desc"},kind:"LocalArgument",name:"sort"},r={defaultValue:null,kind:"LocalArgument",name:"timeRange"},o=[{kind:"Variable",name:"id",variableName:"id"}],c={kind:"Variable",name:"after",variableName:"after"},d={kind:"Variable",name:"filterCondition",variableName:"filterCondition"},g={kind:"Variable",name:"first",variableName:"first"},f={kind:"Variable",name:"sort",variableName:"sort"},m={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},p={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},y={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},k=[c,d,g,f,{kind:"Variable",name:"timeRange",variableName:"timeRange"}],b=[{alias:"value",args:null,kind:"ScalarField",name:"truncatedValue",storageKey:null}];return{fragment:{argumentDefinitions:[n,a,l,t,i,r],kind:"Fragment",metadata:null,name:"SpansTableSpansQuery",selections:[{alias:null,args:o,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:[c,d,g,f],kind:"FragmentSpread",name:"SpansTable_spans"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,a,l,i,r,t],kind:"Operation",name:"SpansTableSpansQuery",selections:[{alias:null,args:o,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[m,{kind:"TypeDiscriminator",abstractKey:"__isNode"},p,{kind:"InlineFragment",selections:[y,{alias:null,args:null,kind:"ScalarField",name:"spanAnnotationNames",storageKey:null},{alias:null,args:k,concreteType:"SpanConnection",kind:"LinkedField",name:"spans",plural:!1,selections:[{alias:null,args:null,concreteType:"SpanEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"span",args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[p,{alias:null,args:null,kind:"ScalarField",name:"spanKind",storageKey:null},y,{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"statusCode",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"tokenCountPrompt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"tokenCountCompletion",storageKey:null},{alias:null,args:null,concreteType:"SpanContext",kind:"LinkedField",name:"context",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:b,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:b,storageKey:null},{alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[y,{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"DocumentRetrievalMetrics",kind:"LinkedField",name:"documentRetrievalMetrics",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"evaluationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"ndcg",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"precision",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hit",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[m],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:k,filters:["sort","filterCondition","timeRange"],handle:"connection",key:"SpansTable_spans",kind:"LinkedHandle",name:"spans"}],type:"Project",abstractKey:null}],storageKey:null}]},params:{cacheID:"21dc6f490cf749c02bc20bcdb43c199c",id:null,metadata:{},name:"SpansTableSpansQuery",operationKind:"query",text:`query SpansTableSpansQuery(
1888
+ `,children:s(h,{direction:"row",gap:"size-400",alignItems:"center",children:[s(h,{direction:"column",flex:"none",children:[e(K,{elementType:"h3",textSize:"medium",color:"text-700",children:"Total Traces"}),e(K,{textSize:"xlarge",children:bn(t==null?void 0:t.traceCount)})]}),s(h,{direction:"column",flex:"none",children:[e(K,{elementType:"h3",textSize:"medium",color:"text-700",children:"Total Tokens"}),e(K,{textSize:"xlarge",children:bn(c)})]}),s(h,{direction:"column",flex:"none",children:[e(K,{elementType:"h3",textSize:"medium",color:"text-700",children:"Latency P50"}),r!=null?e(Me,{latencyMs:r,textSize:"xlarge"}):e(K,{textSize:"xlarge",children:"--"})]}),s(h,{direction:"column",flex:"none",children:[e(K,{elementType:"h3",textSize:"medium",color:"text-700",children:"Latency P99"}),o!=null?e(Me,{latencyMs:o,textSize:"xlarge"}):e(K,{textSize:"xlarge",children:"--"})]}),d.map(f=>e(am,{annotationName:f},f)),g.map(f=>e(tm,{evaluationName:f},`document-${f}`))]})}),e(F,{flex:"none",paddingStart:"size-100",children:a})]})})}const Ni=u.createContext(null);function zi(){const n=u.useContext(Ni);if(n===null)throw new Error("useSpanFilterCondition must be used within a SpanFilterConditionProvider");return n}function Fl(n){const[a,l]=u.useState(""),t=u.useCallback(r=>{u.startTransition(()=>{l(r)})},[]),i=u.useCallback(r=>{u.startTransition(()=>{a.length>0?l(a+" and "+r):l(r)})},[a]);return e(Ni.Provider,{value:{filterCondition:a,setFilterCondition:t,appendFilterCondition:i},children:n.children})}const Vi=function(){var n={defaultValue:null,kind:"LocalArgument",name:"after"},a={defaultValue:null,kind:"LocalArgument",name:"filterCondition"},l={defaultValue:50,kind:"LocalArgument",name:"first"},t={defaultValue:null,kind:"LocalArgument",name:"id"},i={defaultValue:{col:"startTime",dir:"desc"},kind:"LocalArgument",name:"sort"},r={defaultValue:null,kind:"LocalArgument",name:"timeRange"},o=[{kind:"Variable",name:"id",variableName:"id"}],c={kind:"Variable",name:"after",variableName:"after"},d={kind:"Variable",name:"filterCondition",variableName:"filterCondition"},g={kind:"Variable",name:"first",variableName:"first"},f={kind:"Variable",name:"sort",variableName:"sort"},m={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},p={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},y={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},b=[c,d,g,f,{kind:"Variable",name:"timeRange",variableName:"timeRange"}],k=[{alias:"value",args:null,kind:"ScalarField",name:"truncatedValue",storageKey:null}];return{fragment:{argumentDefinitions:[n,a,l,t,i,r],kind:"Fragment",metadata:null,name:"SpansTableSpansQuery",selections:[{alias:null,args:o,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:[c,d,g,f],kind:"FragmentSpread",name:"SpansTable_spans"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,a,l,i,r,t],kind:"Operation",name:"SpansTableSpansQuery",selections:[{alias:null,args:o,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[m,{kind:"TypeDiscriminator",abstractKey:"__isNode"},p,{kind:"InlineFragment",selections:[y,{alias:null,args:null,kind:"ScalarField",name:"spanAnnotationNames",storageKey:null},{alias:null,args:b,concreteType:"SpanConnection",kind:"LinkedField",name:"spans",plural:!1,selections:[{alias:null,args:null,concreteType:"SpanEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"span",args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[p,{alias:null,args:null,kind:"ScalarField",name:"spanKind",storageKey:null},y,{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"statusCode",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"tokenCountPrompt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"tokenCountCompletion",storageKey:null},{alias:null,args:null,concreteType:"SpanContext",kind:"LinkedField",name:"context",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:k,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:k,storageKey:null},{alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[y,{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"DocumentRetrievalMetrics",kind:"LinkedField",name:"documentRetrievalMetrics",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"evaluationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"ndcg",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"precision",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hit",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[m],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:b,filters:["sort","filterCondition","timeRange"],handle:"connection",key:"SpansTable_spans",kind:"LinkedHandle",name:"spans"}],type:"Project",abstractKey:null}],storageKey:null}]},params:{cacheID:"21dc6f490cf749c02bc20bcdb43c199c",id:null,metadata:{},name:"SpansTableSpansQuery",operationKind:"query",text:`query SpansTableSpansQuery(
1889
1889
  $after: String = null
1890
1890
  $filterCondition: String = null
1891
1891
  $first: Int = 50
@@ -2035,17 +2035,17 @@ fragment SpansTable_spans_1XEuU on Project {
2035
2035
  border-color: var(--ac-global-color-danger);
2036
2036
  }
2037
2037
  box-sizing: border-box;
2038
- `;function gm(n){const a=n.matchBefore(/\w*/);return!a||a.from==a.to&&!n.explicit?null:{from:a.from,options:[{label:"span_kind",type:"variable",info:"The span variant: CHAIN, LLM, RETRIEVER, TOOL, etc."},{label:"status_code",type:"variable",info:"The span status: OK, UNSET, or ERROR"},{label:"input.value",type:"variable",info:"The input value of a span, typically a query"},{label:"output.value",type:"variable",info:"The output value of a span, typically a response"},{label:"name",type:"variable",info:"The name given to a span - e.x. OpenAI"},{label:"latency_ms",type:"variable",info:"Latency (i.e. duration) in milliseconds"},{label:"cumulative_token_count.prompt",type:"variable",info:"Sum of token count for prompt from self and all child spans"},{label:"cumulative_token_count.completion",type:"variable",info:"Sum of token count for completion from self and all child spans"},{label:"cumulative_token_count.total",type:"variable",info:"Sum of token count total (prompt + completion) from self and all child spans"},{label:"llm spans",type:"text",apply:"span_kind == 'LLM'",detail:"macro"},{label:"retriever spans",type:"text",apply:"span_kind == 'RETRIEVER'",detail:"macro"},{label:"search input",type:"text",apply:"'' in input.value",detail:"macro"},{label:"search output",type:"text",apply:"'' in output.value",detail:"macro"},{label:"status_code error",type:"text",apply:"status_code == 'ERROR'",detail:"macro"},{label:"Latency >= 10s",type:"text",apply:"latency_ms >= 10_000",detail:"macro"},{label:"Tokens >= 1,000",type:"text",apply:"llm.token_count.total >= 1_000",detail:"macro"},{label:"Hallucinations",type:"text",apply:"annotations['Hallucination'].label == 'hallucinated'",detail:"macro"},{label:"Annotations",type:"text",apply:"annotations['Hallucination'].label == 'hallucinated'",detail:"macro"},{label:"Metadata",type:"text",apply:"metadata['topic'] == 'agent'",detail:"macro"},{label:"Substring",type:"text",apply:"'agent' in input.value",detail:"macro"}]}}async function pm(n,a){if(!n)return{isValid:!0,errorMessage:null};const l=await Vs.fetchQuery(xe,Bi,{condition:n,id:a}).toPromise();if(!l)throw new Error("Filter condition validation is null");return l.project.validateSpanFilterCondition}const ym=[Id.of([{key:"Enter",run:n=>!0}]),rl(),Ld({override:[gm]})];function Wi(n){const{onValidCondition:a,placeholder:l="filter condition (e.x. span_kind == 'LLM')"}=n,[t,i]=u.useState(!1),[r,o]=u.useState(""),{filterCondition:c,setFilterCondition:d,appendFilterCondition:g}=zi(),f=u.useDeferredValue(c),{theme:m}=zn(),p=m==="dark"?oa:void 0,{projectId:y}=ln();u.useEffect(()=>{pm(f,y).then(v=>{v!=null&&v.isValid?(o(""),u.startTransition(()=>{a(f)})):o((v==null?void 0:v.errorMessage)??"Invalid filter condition")})},[a,f,y]);const k=r!=="",b=c!=="";return s("div",{"data-is-focused":t,"data-is-invalid":k,className:"span-filter-condition-field",css:Gi,children:[s(h,{direction:"row",children:[e(oo,{children:e(P,{svg:e(I.Search,{})})}),e(sa,{css:Hi,indentWithTab:!1,basicSetup:{lineNumbers:!1,foldGutter:!1,bracketMatching:!0,syntaxHighlighting:!0,highlightActiveLine:!1,highlightActiveLineGutter:!1,defaultKeymap:!1},onFocus:()=>i(!0),onBlur:()=>i(!1),value:c,onChange:d,height:"36px",width:"100%",theme:p,placeholder:l,extensions:ym}),e("button",{css:C`
2038
+ `;function gm(n){const a=n.matchBefore(/\w*/);return!a||a.from==a.to&&!n.explicit?null:{from:a.from,options:[{label:"span_kind",type:"variable",info:"The span variant: CHAIN, LLM, RETRIEVER, TOOL, etc."},{label:"status_code",type:"variable",info:"The span status: OK, UNSET, or ERROR"},{label:"input.value",type:"variable",info:"The input value of a span, typically a query"},{label:"output.value",type:"variable",info:"The output value of a span, typically a response"},{label:"name",type:"variable",info:"The name given to a span - e.x. OpenAI"},{label:"latency_ms",type:"variable",info:"Latency (i.e. duration) in milliseconds"},{label:"cumulative_token_count.prompt",type:"variable",info:"Sum of token count for prompt from self and all child spans"},{label:"cumulative_token_count.completion",type:"variable",info:"Sum of token count for completion from self and all child spans"},{label:"cumulative_token_count.total",type:"variable",info:"Sum of token count total (prompt + completion) from self and all child spans"},{label:"llm spans",type:"text",apply:"span_kind == 'LLM'",detail:"macro"},{label:"retriever spans",type:"text",apply:"span_kind == 'RETRIEVER'",detail:"macro"},{label:"search input",type:"text",apply:"'' in input.value",detail:"macro"},{label:"search output",type:"text",apply:"'' in output.value",detail:"macro"},{label:"status_code error",type:"text",apply:"status_code == 'ERROR'",detail:"macro"},{label:"Latency >= 10s",type:"text",apply:"latency_ms >= 10_000",detail:"macro"},{label:"Tokens >= 1,000",type:"text",apply:"llm.token_count.total >= 1_000",detail:"macro"},{label:"Hallucinations",type:"text",apply:"annotations['Hallucination'].label == 'hallucinated'",detail:"macro"},{label:"Annotations",type:"text",apply:"annotations['Hallucination'].label == 'hallucinated'",detail:"macro"},{label:"Metadata",type:"text",apply:"metadata['topic'] == 'agent'",detail:"macro"},{label:"Substring",type:"text",apply:"'agent' in input.value",detail:"macro"}]}}async function pm(n,a){if(!n)return{isValid:!0,errorMessage:null};const l=await Vs.fetchQuery(xe,Bi,{condition:n,id:a}).toPromise();if(!l)throw new Error("Filter condition validation is null");return l.project.validateSpanFilterCondition}const ym=[Id.of([{key:"Enter",run:n=>!0}]),rl(),Ld({override:[gm]})];function Wi(n){const{onValidCondition:a,placeholder:l="filter condition (e.x. span_kind == 'LLM')"}=n,[t,i]=u.useState(!1),[r,o]=u.useState(""),{filterCondition:c,setFilterCondition:d,appendFilterCondition:g}=zi(),f=u.useDeferredValue(c),{theme:m}=zn(),p=m==="dark"?oa:void 0,{projectId:y}=ln();u.useEffect(()=>{pm(f,y).then(v=>{v!=null&&v.isValid?(o(""),u.startTransition(()=>{a(f)})):o((v==null?void 0:v.errorMessage)??"Invalid filter condition")})},[a,f,y]);const b=r!=="",k=c!=="";return s("div",{"data-is-focused":t,"data-is-invalid":b,className:"span-filter-condition-field",css:Gi,children:[s(h,{direction:"row",children:[e(oo,{children:e(P,{svg:e(I.Search,{})})}),e(sa,{css:Hi,indentWithTab:!1,basicSetup:{lineNumbers:!1,foldGutter:!1,bracketMatching:!0,syntaxHighlighting:!0,highlightActiveLine:!1,highlightActiveLineGutter:!1,defaultKeymap:!1},onFocus:()=>i(!0),onBlur:()=>i(!1),value:c,onChange:d,height:"36px",width:"100%",theme:p,placeholder:l,extensions:ym}),e("button",{css:C`
2039
2039
  margin-right: var(--ac-global-dimension-static-size-100);
2040
2040
  color: var(--ac-global-text-color-700);
2041
- visibility: ${b?"visible":"hidden"};
2041
+ visibility: ${k?"visible":"hidden"};
2042
2042
  `,onClick:()=>d(""),className:"button--reset",children:e(P,{svg:e(I.CloseCircleOutline,{})})}),s(tn,{placement:"bottom right",children:[e(kn,{children:e("button",{css:C`
2043
2043
  color: var(--ac-global-text-color-700);
2044
2044
  background-color: var(--ac-global-color-grey-400);
2045
2045
  padding-left: var(--ac-global-dimension-static-size-100);
2046
2046
  padding-right: var(--ac-global-dimension-static-size-100);
2047
2047
  height: 100%;
2048
- `,className:"button--reset",children:e(P,{svg:e(I.PlusCircleOutline,{})})})}),e(fm,{onAddFilterConditionSnippet:g})]})]}),s(Le,{isOpen:k&&t,placement:"bottom",children:[e(kn,{children:e("div",{})}),e(aa,{children:r!=""?e(K,{color:"danger",children:r}):e(K,{color:"success",children:"Valid Expression"})})]})]})}function fm(n){const{onAddFilterConditionSnippet:a}=n;return e(F,{width:"500px",paddingTop:"size-200",paddingStart:"size-200",paddingEnd:"size-200",borderRadius:"medium",borderWidth:"thin",borderColor:"light",backgroundColor:"light",children:s(ye,{children:[e(gn,{label:"filter by kind",initialSnippet:"span_kind == 'LLM'",onAddFilterConditionSnippet:a},"kind"),e(gn,{label:"filter by token count",initialSnippet:"cumulative_token_count.total > 1000",onAddFilterConditionSnippet:a},"token_count"),e(gn,{label:"filter by annotation label",initialSnippet:"annotations['Hallucination'].label == 'hallucinated'",onAddFilterConditionSnippet:a},"annotation_label"),e(gn,{label:"filter by evaluation label",initialSnippet:"evals['Hallucination'].label == 'hallucinated'",onAddFilterConditionSnippet:a},"eval_label"),e(gn,{label:"filter by evaluation score",initialSnippet:"evals['Hallucination'].score < 1",onAddFilterConditionSnippet:a},"eval_score"),e(gn,{label:"filter by metadata",initialSnippet:"metadata['topic'] == 'agent'",onAddFilterConditionSnippet:a},"metadata"),e(gn,{label:"filter by substring",initialSnippet:"'agent' in input.value",onAddFilterConditionSnippet:a},"substring")]})})}function gn(n){const{initialSnippet:a,onAddFilterConditionSnippet:l}=n,[t,i]=u.useState(a),{theme:r}=zn(),o=r==="light"?void 0:oa;return e(la,{label:n.label,children:s(h,{direction:"row",width:"100%",gap:"size-100",children:[e("div",{css:C(Gi,C`
2048
+ `,className:"button--reset",children:e(P,{svg:e(I.PlusCircleOutline,{})})})}),e(fm,{onAddFilterConditionSnippet:g})]})]}),s(Le,{isOpen:b&&t,placement:"bottom",children:[e(kn,{children:e("div",{})}),e(aa,{children:r!=""?e(K,{color:"danger",children:r}):e(K,{color:"success",children:"Valid Expression"})})]})]})}function fm(n){const{onAddFilterConditionSnippet:a}=n;return e(F,{width:"500px",paddingTop:"size-200",paddingStart:"size-200",paddingEnd:"size-200",borderRadius:"medium",borderWidth:"thin",borderColor:"light",backgroundColor:"light",children:s(ye,{children:[e(gn,{label:"filter by kind",initialSnippet:"span_kind == 'LLM'",onAddFilterConditionSnippet:a},"kind"),e(gn,{label:"filter by token count",initialSnippet:"cumulative_token_count.total > 1000",onAddFilterConditionSnippet:a},"token_count"),e(gn,{label:"filter by annotation label",initialSnippet:"annotations['Hallucination'].label == 'hallucinated'",onAddFilterConditionSnippet:a},"annotation_label"),e(gn,{label:"filter by evaluation label",initialSnippet:"evals['Hallucination'].label == 'hallucinated'",onAddFilterConditionSnippet:a},"eval_label"),e(gn,{label:"filter by evaluation score",initialSnippet:"evals['Hallucination'].score < 1",onAddFilterConditionSnippet:a},"eval_score"),e(gn,{label:"filter by metadata",initialSnippet:"metadata['topic'] == 'agent'",onAddFilterConditionSnippet:a},"metadata"),e(gn,{label:"filter by substring",initialSnippet:"'agent' in input.value",onAddFilterConditionSnippet:a},"substring")]})})}function gn(n){const{initialSnippet:a,onAddFilterConditionSnippet:l}=n,[t,i]=u.useState(a),{theme:r}=zn(),o=r==="light"?void 0:oa;return e(la,{label:n.label,children:s(h,{direction:"row",width:"100%",gap:"size-100",children:[e("div",{css:C(Gi,C`
2049
2049
  flex: 1 1 auto;
2050
2050
  `),children:e(sa,{value:t,basicSetup:{lineNumbers:!1,foldGutter:!1,bracketMatching:!0,syntaxHighlighting:!0,highlightActiveLine:!1,highlightActiveLineGutter:!1},extensions:[rl()],editable:!0,onChange:i,theme:o,css:Hi})}),e(M,{title:"Add to filter condition",variant:"default",onClick:()=>l(t),icon:e(P,{svg:e(I.PlusCircleOutline,{})})})]})})}const Ji=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"DatasetMutationPayload",kind:"LinkedField",name:"addSpansToDataset",plural:!1,selections:[{alias:null,args:null,concreteType:"Dataset",kind:"LinkedField",name:"dataset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"SpanSelectionToolbarAddSpansToDatasetMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"SpanSelectionToolbarAddSpansToDatasetMutation",selections:a},params:{cacheID:"1c694540190478b8fba8ef3c0cacf30c",id:null,metadata:{},name:"SpanSelectionToolbarAddSpansToDatasetMutation",operationKind:"mutation",text:`mutation SpanSelectionToolbarAddSpansToDatasetMutation(
2051
2051
  $input: AddSpansToDatasetInput!
@@ -2087,12 +2087,12 @@ fragment DatasetSelectorPopoverContent_datasets on Query {
2087
2087
  `}};Yi.hash="7cd8a13144d97d2b5294f2a09c9e1351";function hm(n){const{onCreateNewDataset:a,onDatasetSelected:l}=n,[t,i]=u.useState(""),r=D.useLazyLoadQuery(Yi,{},{fetchPolicy:"network-only"});return s(z,{title:"Add to Dataset",variant:"compact",backgroundColor:"light",borderColor:"light",bodyStyle:{padding:0},extra:e(M,{variant:"default",size:"compact",onClick:a,children:"New Dataset"}),children:[e(F,{padding:"size-100",children:e(X,{type:"search",placeholder:"Search datasets",addonBefore:e(P,{svg:e(I.Search,{})}),onChange:o=>{i(o)}})}),e(F,{borderTopWidth:"thin",borderColor:"light",children:e("div",{css:C`
2088
2088
  height: 400px;
2089
2089
  overflow-y: auto;
2090
- `,children:e(km,{query:r,search:t,onDatasetSelected:l})})})]})}function km(n){const{search:a,onDatasetSelected:l}=n,[t]=D.useRefetchableFragment(Xi,n.query),i=u.useMemo(()=>{let o=t.datasets.edges.map(c=>c.dataset);return a&&(o=o.filter(c=>c.name.toLowerCase().includes(a.toLowerCase()))),o},[a,t]);return i.length===0?e(F,{padding:"size-200",children:e(h,{direction:"column",justifyContent:"center",alignItems:"center",flex:"1 1 auto",children:e(K,{children:"No datasets found"})})}):e(na,{selectionMode:"single",onSelectionChange:o=>{if(typeof o=="object"){const c=Array.from(o);l(c[0])}},children:i.map(o=>e(U,{children:o.name},o.id))})}function er(n){const a=ne(),[l,t]=u.useState(null),i=oe(),r=ge(),[o,c]=u.useState(!1),{selectedSpans:d,onClearSelection:g}=n,[f,m]=D.useMutation(Ji),p=d.length!==1,y=u.useCallback(k=>{f({variables:{input:{datasetId:k,spanIds:d.map(b=>b.id)}},onCompleted:()=>{i({title:"Examples added to dataset",message:`${d.length} example${p?"s":""} have been added to the dataset.`,action:{text:"View dataset",onClick:()=>{a(`/datasets/${k}/examples`)}}}),g()},onError:b=>{r({title:"An error occurred",message:`Failed to add spans to dataset: ${b.message}`})}})},[f,d,i,p,g,a,r]);return s("div",{css:C`
2090
+ `,children:e(km,{query:r,search:t,onDatasetSelected:l})})})]})}function km(n){const{search:a,onDatasetSelected:l}=n,[t]=D.useRefetchableFragment(Xi,n.query),i=u.useMemo(()=>{let o=t.datasets.edges.map(c=>c.dataset);return a&&(o=o.filter(c=>c.name.toLowerCase().includes(a.toLowerCase()))),o},[a,t]);return i.length===0?e(F,{padding:"size-200",children:e(h,{direction:"column",justifyContent:"center",alignItems:"center",flex:"1 1 auto",children:e(K,{children:"No datasets found"})})}):e(na,{selectionMode:"single",onSelectionChange:o=>{if(typeof o=="object"){const c=Array.from(o);l(c[0])}},children:i.map(o=>e(B,{children:o.name},o.id))})}function er(n){const a=ne(),[l,t]=u.useState(null),i=oe(),r=ce(),[o,c]=u.useState(!1),{selectedSpans:d,onClearSelection:g}=n,[f,m]=D.useMutation(Ji),p=d.length!==1,y=u.useCallback(b=>{f({variables:{input:{datasetId:b,spanIds:d.map(k=>k.id)}},onCompleted:()=>{i({title:"Examples added to dataset",message:`${d.length} example${p?"s":""} have been added to the dataset.`,action:{text:"View dataset",onClick:()=>{a(`/datasets/${b}/examples`)}}}),g()},onError:k=>{r({title:"An error occurred",message:`Failed to add spans to dataset: ${k.message}`})}})},[f,d,i,p,g,a,r]);return s("div",{css:C`
2091
2091
  position: absolute;
2092
2092
  bottom: var(--ac-global-dimension-size-400);
2093
2093
  left: 50%;
2094
2094
  transform: translateX(-50%);
2095
- `,children:[e(F,{backgroundColor:"light",padding:"size-200",borderColor:"light",borderWidth:"thin",borderRadius:"medium",minWidth:"size-6000",children:s(h,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e(K,{children:`${d.length} span${p?"s":""} selected`}),s(h,{direction:"row",gap:"size-100",children:[e(M,{variant:"default",size:"compact",onClick:g,children:"Cancel"}),s(tn,{placement:"top end",crossOffset:300,isOpen:o,onOpenChange:k=>{c(k)},children:[e(M,{variant:"primary",size:"compact",icon:e(P,{svg:e(I.DatabaseOutline,{})}),loading:m,disabled:m,children:m?"Adding to dataset":"Add to dataset"}),e(u.Suspense,{children:e(hm,{onDatasetSelected:k=>{y(k),c(!1)},onCreateNewDataset:()=>{c(!1),t(e(G,{title:"New Dataset",isDismissable:!0,onDismiss:()=>t(null),children:e(el,{onDatasetCreateError:()=>{r({title:"Dataset creation failed",message:"Failed to create dataset."})},onDatasetCreated:k=>{t(null),i({title:"Dataset created",message:`${k.name} has been successfully created.`}),c(!0)}})}))}})})]})]})]})}),e(W,{onDismiss:()=>{t(null)},children:l})]})}const nr=C`
2095
+ `,children:[e(F,{backgroundColor:"light",padding:"size-200",borderColor:"light",borderWidth:"thin",borderRadius:"medium",minWidth:"size-6000",children:s(h,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e(K,{children:`${d.length} span${p?"s":""} selected`}),s(h,{direction:"row",gap:"size-100",children:[e(M,{variant:"default",size:"compact",onClick:g,children:"Cancel"}),s(tn,{placement:"top end",crossOffset:300,isOpen:o,onOpenChange:b=>{c(b)},children:[e(M,{variant:"primary",size:"compact",icon:e(P,{svg:e(I.DatabaseOutline,{})}),loading:m,disabled:m,children:m?"Adding to dataset":"Add to dataset"}),e(u.Suspense,{children:e(hm,{onDatasetSelected:b=>{y(b),c(!1)},onCreateNewDataset:()=>{c(!1),t(e(G,{title:"New Dataset",isDismissable:!0,onDismiss:()=>t(null),children:e(el,{onDatasetCreateError:()=>{r({title:"Dataset creation failed",message:"Failed to create dataset."})},onDatasetCreated:b=>{t(null),i({title:"Dataset created",message:`${b.name} has been successfully created.`}),c(!0)}})}))}})})]})]})]})}),e(W,{onDismiss:()=>{t(null)},children:l})]})}const nr=C`
2096
2096
  display: flex;
2097
2097
  flex-direction: column;
2098
2098
  flex: 1 1 auto;
@@ -2105,7 +2105,7 @@ fragment DatasetSelectorPopoverContent_datasets on Query {
2105
2105
  .ac-dropdown-button {
2106
2106
  min-width: var(--ac-global-dimension-static-size-300);
2107
2107
  }
2108
- `,Yn="annotations",$e=":",ar={col:"startTime",dir:"desc"};function lr(n){let a=null,l=null;if(n.id&&n.id.startsWith(Yn)){const[,t,i]=n.id.split($e);l={attr:t,name:i}}else a=n.id;return{col:a,evalResultKey:l,dir:n.desc?"desc":"asc"}}const Kl=50;function bm(n){const{fetchKey:a}=jn(),l=u.useRef(null),[t,i]=u.useState({}),[r,o]=u.useState([]),[c,d]=u.useState(""),g=an(N=>N.columnVisibility),f=ne(),{data:m,loadNext:p,hasNext:y,isLoadingNext:k,refetch:b}=D.usePaginationFragment($i,n.project),v=an(N=>N.annotationColumnVisibility),S=u.useMemo(()=>Object.keys(v).filter(N=>v[N]),[v]),L=u.useMemo(()=>m.spans.edges.map(({span:V})=>V),[m]),A=S.map(N=>({header:N,columns:[{header:"label",accessorKey:`${Yn}${$e}label${$e}${N}`,cell:({row:V})=>{const w=V.original.spanAnnotations.find($=>$.name===N);return w?w.label:null}},{header:"score",accessorKey:`${Yn}${$e}score${$e}${N}`,cell:({row:V})=>{const w=V.original.spanAnnotations.find($=>$.name===N);return w?w.score:null}}]})),_=[{header:()=>s(h,{direction:"row",gap:"size-50",children:[e("span",{children:"feedback"}),s(Nn,{children:[e(re,{level:3,weight:"heavy",children:"Feedback"}),e(Fn,{children:"Feedback includes evaluations and human annotations logged via the API or set via the UI."})]})]}),accessorKey:"spanAnnotations",enableSorting:!1,cell:({row:N})=>s(h,{direction:"row",gap:"size-50",wrap:"wrap",children:[N.original.spanAnnotations.map(V=>e(ia,{annotation:V,layout:"horizontal",width:"500px",extra:e(Qi,{annotation:V}),children:e(xn,{annotation:V,annotationDisplayPreference:"label"})},V.name)),N.original.documentRetrievalMetrics.map(V=>s(q,{children:[e(De,{name:V.evaluationName,metric:"ndcg",score:V.ndcg},"ndcg"),e(De,{name:V.evaluationName,metric:"precision",score:V.precision},"precision"),e(De,{name:V.evaluationName,metric:"hit",score:V.hit},"hit")]}))]})},...A],x=[{id:"select",maxSize:10,header:({table:N})=>e(en,{checked:N.getIsAllRowsSelected(),indeterminate:N.getIsSomeRowsSelected(),onChange:N.getToggleAllRowsSelectedHandler()}),cell:({row:N})=>e(en,{checked:N.getIsSelected(),disabled:!N.getCanSelect(),indeterminate:N.getIsSomeSelected(),onChange:N.getToggleSelectedHandler()})},{header:"kind",accessorKey:"spanKind",maxSize:100,enableSorting:!1,cell:({getValue:N})=>e(nl,{spanKind:N()})},{header:"name",accessorKey:"name",enableSorting:!1,cell:({getValue:N,row:V})=>{const w=V.original,{traceId:$}=w.context;return e(Ze,{to:`traces/${$}?selectedSpanNodeId=${w.id}`,children:N()})}},{header:"input",accessorKey:"input.value",cell:ue,enableSorting:!1},{header:"output",accessorKey:"output.value",cell:ue,enableSorting:!1},{header:"metadata",accessorKey:"metadata",cell:ue,enableSorting:!1},..._,{header:"start time",accessorKey:"startTime",cell:Fe},{header:"latency",accessorKey:"latencyMs",cell:({getValue:N})=>{const V=N();return V===null||typeof V!="number"?null:e(Me,{latencyMs:V})}},{header:"total tokens",accessorKey:"tokenCountTotal",cell:({row:N,getValue:V})=>{const w=V();return w===null?"--":e(Ya,{tokenCountTotal:w,tokenCountPrompt:N.original.tokenCountPrompt||0,tokenCountCompletion:N.original.tokenCountCompletion||0})}},{header:"status",accessorKey:"statusCode",enableSorting:!1,cell:({getValue:N})=>e(Ca,{statusCode:N()})}];u.useEffect(()=>{const N=r[0];u.startTransition(()=>{b({sort:N?lr(N):ar,after:null,first:Kl,filterCondition:c},{fetchPolicy:"store-and-network"})})},[r,b,c,a]);const T=u.useCallback(N=>{if(N){const{scrollHeight:V,scrollTop:w,clientHeight:$}=N;V-w-$<300&&!k&&y&&p(Kl)}},[y,k,p]),E=he({columns:x,data:L,state:{sorting:r,columnVisibility:g,rowSelection:t},manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:i,onSortingChange:o,getCoreRowModel:ke(),getSortedRowModel:Rn()}),R=E.getRowModel().rows,j=E.getSelectedRowModel().rows,ae=j.map(N=>N.original),ie=u.useCallback(()=>{i({})},[i]),be=R.length===0,Se=E.getAllColumns().filter(N=>N.columns.length===0);return s("div",{css:nr,children:[e(F,{paddingTop:"size-100",paddingBottom:"size-100",paddingStart:"size-200",paddingEnd:"size-200",borderBottomColor:"grey-300",borderBottomWidth:"thin",flex:"none",children:s(h,{direction:"row",gap:"size-100",width:"100%",alignItems:"center",children:[e(Wi,{onValidCondition:d}),e(Ui,{columns:Se,query:m})]})}),e("div",{css:C`
2108
+ `,Yn="annotations",$e=":",ar={col:"startTime",dir:"desc"};function lr(n){let a=null,l=null;if(n.id&&n.id.startsWith(Yn)){const[,t,i]=n.id.split($e);l={attr:t,name:i}}else a=n.id;return{col:a,evalResultKey:l,dir:n.desc?"desc":"asc"}}const Kl=50;function bm(n){const{fetchKey:a}=jn(),l=u.useRef(null),[t,i]=u.useState({}),[r,o]=u.useState([]),[c,d]=u.useState(""),g=an(N=>N.columnVisibility),f=ne(),{data:m,loadNext:p,hasNext:y,isLoadingNext:b,refetch:k}=D.usePaginationFragment($i,n.project),v=an(N=>N.annotationColumnVisibility),S=u.useMemo(()=>Object.keys(v).filter(N=>v[N]),[v]),A=u.useMemo(()=>m.spans.edges.map(({span:V})=>V),[m]),L=S.map(N=>({header:N,columns:[{header:"label",accessorKey:`${Yn}${$e}label${$e}${N}`,cell:({row:V})=>{const _=V.original.spanAnnotations.find($=>$.name===N);return _?_.label:null}},{header:"score",accessorKey:`${Yn}${$e}score${$e}${N}`,cell:({row:V})=>{const _=V.original.spanAnnotations.find($=>$.name===N);return _?_.score:null}}]})),w=[{header:()=>s(h,{direction:"row",gap:"size-50",children:[e("span",{children:"feedback"}),s(Nn,{children:[e(re,{level:3,weight:"heavy",children:"Feedback"}),e(Fn,{children:"Feedback includes evaluations and human annotations logged via the API or set via the UI."})]})]}),accessorKey:"spanAnnotations",enableSorting:!1,cell:({row:N})=>s(h,{direction:"row",gap:"size-50",wrap:"wrap",children:[N.original.spanAnnotations.map(V=>e(ia,{annotation:V,layout:"horizontal",width:"500px",extra:e(Qi,{annotation:V}),children:e(xn,{annotation:V,annotationDisplayPreference:"label"})},V.name)),N.original.documentRetrievalMetrics.map(V=>s(q,{children:[e(De,{name:V.evaluationName,metric:"ndcg",score:V.ndcg},"ndcg"),e(De,{name:V.evaluationName,metric:"precision",score:V.precision},"precision"),e(De,{name:V.evaluationName,metric:"hit",score:V.hit},"hit")]}))]})},...L],x=[{id:"select",maxSize:10,header:({table:N})=>e(en,{checked:N.getIsAllRowsSelected(),indeterminate:N.getIsSomeRowsSelected(),onChange:N.getToggleAllRowsSelectedHandler()}),cell:({row:N})=>e(en,{checked:N.getIsSelected(),disabled:!N.getCanSelect(),indeterminate:N.getIsSomeSelected(),onChange:N.getToggleSelectedHandler()})},{header:"kind",accessorKey:"spanKind",maxSize:100,enableSorting:!1,cell:({getValue:N})=>e(nl,{spanKind:N()})},{header:"name",accessorKey:"name",enableSorting:!1,cell:({getValue:N,row:V})=>{const _=V.original,{traceId:$}=_.context;return e(Ze,{to:`traces/${$}?selectedSpanNodeId=${_.id}`,children:N()})}},{header:"input",accessorKey:"input.value",cell:me,enableSorting:!1},{header:"output",accessorKey:"output.value",cell:me,enableSorting:!1},{header:"metadata",accessorKey:"metadata",cell:me,enableSorting:!1},...w,{header:"start time",accessorKey:"startTime",cell:Fe},{header:"latency",accessorKey:"latencyMs",cell:({getValue:N})=>{const V=N();return V===null||typeof V!="number"?null:e(Me,{latencyMs:V})}},{header:"total tokens",accessorKey:"tokenCountTotal",cell:({row:N,getValue:V})=>{const _=V();return _===null?"--":e(Ya,{tokenCountTotal:_,tokenCountPrompt:N.original.tokenCountPrompt||0,tokenCountCompletion:N.original.tokenCountCompletion||0})}},{header:"status",accessorKey:"statusCode",enableSorting:!1,cell:({getValue:N})=>e(Ca,{statusCode:N()})}];u.useEffect(()=>{const N=r[0];u.startTransition(()=>{k({sort:N?lr(N):ar,after:null,first:Kl,filterCondition:c},{fetchPolicy:"store-and-network"})})},[r,k,c,a]);const T=u.useCallback(N=>{if(N){const{scrollHeight:V,scrollTop:_,clientHeight:$}=N;V-_-$<300&&!b&&y&&p(Kl)}},[y,b,p]),E=he({columns:x,data:A,state:{sorting:r,columnVisibility:g,rowSelection:t},manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:i,onSortingChange:o,getCoreRowModel:ke(),getSortedRowModel:Rn()}),R=E.getRowModel().rows,j=E.getSelectedRowModel().rows,ae=j.map(N=>N.original),ie=u.useCallback(()=>{i({})},[i]),be=R.length===0,Se=E.getAllColumns().filter(N=>N.columns.length===0);return s("div",{css:nr,children:[e(F,{paddingTop:"size-100",paddingBottom:"size-100",paddingStart:"size-200",paddingEnd:"size-200",borderBottomColor:"grey-300",borderBottomWidth:"thin",flex:"none",children:s(h,{direction:"row",gap:"size-100",width:"100%",alignItems:"center",children:[e(Wi,{onValidCondition:d}),e(Ui,{columns:Se,query:m})]})}),e("div",{css:C`
2109
2109
  flex: 1 1 auto;
2110
2110
  overflow: auto;
2111
2111
  `,onScroll:N=>T(N.target),ref:l,children:s("table",{css:Qn,children:[e("thead",{children:E.getHeaderGroups().map(N=>e("tr",{children:N.headers.map(V=>e("th",{colSpan:V.colSpan,children:V.isPlaceholder?null:s("div",{className:V.column.getCanSort()?"cursor-pointer":"",onClick:V.column.getToggleSortingHandler(),style:{left:V.getStart(),width:V.getSize()},children:[Z(V.column.columnDef.header,V.getContext()),V.column.getIsSorted()?e(P,{className:"sort-icon",svg:V.column.getIsSorted()==="asc"?e(I.ArrowUpFilled,{}):e(I.ArrowDownFilled,{})}):null]})},V.id))},N.id))}),be?e(ji,{projectName:m.name}):e("tbody",{children:R.map(N=>e("tr",{onClick:()=>f(`traces/${N.original.context.traceId}?selectedSpanNodeId=${N.original.id}`),children:N.getVisibleCells().map(V=>e("td",{children:Z(V.column.columnDef.cell,V.getContext())},V.id))},N.id))})]})}),j.length?e(er,{selectedSpans:ae,onClearSelection:ie}):null]})}const tr=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"StreamToggleRefetchQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"StreamToggle_data"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"StreamToggleRefetchQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"TypeDiscriminator",abstractKey:"__isNode"},{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"streamingLastUpdatedAt",storageKey:null}],type:"Project",abstractKey:null}],storageKey:null}]},params:{cacheID:"4e136f41c0942f253822336dc0c5b291",id:null,metadata:{},name:"StreamToggleRefetchQuery",operationKind:"query",text:`query StreamToggleRefetchQuery(
@@ -2123,7 +2123,7 @@ fragment StreamToggle_data on Project {
2123
2123
  streamingLastUpdatedAt
2124
2124
  id
2125
2125
  }
2126
- `}}}();tr.hash="30a8f0bcf1aa6021b2c9a47866f5dc49";const ir={argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:["node"],operation:tr,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"StreamToggle_data",selections:[{alias:null,args:null,kind:"ScalarField",name:"streamingLastUpdatedAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],type:"Project",abstractKey:null};ir.hash="30a8f0bcf1aa6021b2c9a47866f5dc49";function rr(n,a){const l=u.useRef(null);u.useEffect(()=>{l.current=n},[n]),u.useEffect(()=>{function t(){l.current&&l.current()}if(typeof a=="number"){const i=setInterval(t,a);return()=>clearInterval(i)}},[a])}const Sm=2e3;function vm(n){const{isStreaming:a,setIsStreaming:l,setFetchKey:t}=jn(),[i,r]=D.useRefetchableFragment(ir,n.project),o=u.useRef(i.streamingLastUpdatedAt),c=u.useCallback(()=>{a&&u.startTransition(()=>{r({},{fetchPolicy:"store-and-network"})})},[a,r]),d=i.streamingLastUpdatedAt;return u.useEffect(()=>{d!=null&&(o.current==null||o.current<d)&&(o.current=d,t(`fetch-traces-${d}`))},[t,d]),rr(c,Sm),e(ea,{labelPlacement:"start",isSelected:a,onChange:()=>{l(!a)},children:"Stream"})}const sr=function(){var n={defaultValue:null,kind:"LocalArgument",name:"after"},a={defaultValue:null,kind:"LocalArgument",name:"filterCondition"},l={defaultValue:50,kind:"LocalArgument",name:"first"},t={defaultValue:null,kind:"LocalArgument",name:"id"},i={defaultValue:{col:"startTime",dir:"desc"},kind:"LocalArgument",name:"sort"},r={defaultValue:null,kind:"LocalArgument",name:"timeRange"},o=[{kind:"Variable",name:"id",variableName:"id"}],c={kind:"Variable",name:"after",variableName:"after"},d={kind:"Variable",name:"filterCondition",variableName:"filterCondition"},g={kind:"Variable",name:"first",variableName:"first"},f={kind:"Variable",name:"sort",variableName:"sort"},m={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},p={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},y={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},k=[c,d,g,{kind:"Literal",name:"rootSpansOnly",value:!0},f,{kind:"Variable",name:"timeRange",variableName:"timeRange"}],b={alias:null,args:null,kind:"ScalarField",name:"spanKind",storageKey:null},v={alias:"statusCode",args:null,kind:"ScalarField",name:"propagatedStatusCode",storageKey:null},S={alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},L={alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},A={alias:null,args:null,kind:"ScalarField",name:"parentId",storageKey:null},_=[{alias:"value",args:null,kind:"ScalarField",name:"truncatedValue",storageKey:null}],x={alias:null,args:null,concreteType:"SpanContext",kind:"LinkedField",name:"context",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null}],storageKey:null},T={alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[y,{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null}],storageKey:null},E={alias:null,args:null,concreteType:"DocumentRetrievalMetrics",kind:"LinkedField",name:"documentRetrievalMetrics",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"evaluationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"ndcg",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"precision",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hit",storageKey:null}],storageKey:null},R=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}];return{fragment:{argumentDefinitions:[n,a,l,t,i,r],kind:"Fragment",metadata:null,name:"TracesTableQuery",selections:[{alias:null,args:o,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:[c,d,g,f],kind:"FragmentSpread",name:"TracesTable_spans"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,a,l,i,r,t],kind:"Operation",name:"TracesTableQuery",selections:[{alias:null,args:o,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[m,{kind:"TypeDiscriminator",abstractKey:"__isNode"},p,{kind:"InlineFragment",selections:[y,{alias:null,args:null,kind:"ScalarField",name:"spanAnnotationNames",storageKey:null},{alias:"rootSpans",args:k,concreteType:"SpanConnection",kind:"LinkedField",name:"spans",plural:!1,selections:[{alias:null,args:null,concreteType:"SpanEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"rootSpan",args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[p,b,y,{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},v,S,L,{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountTotal",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountPrompt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountCompletion",storageKey:null},A,{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:_,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:_,storageKey:null},x,T,E,{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"descendants",plural:!0,selections:[p,b,y,v,S,L,A,{alias:"cumulativeTokenCountTotal",args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},{alias:"cumulativeTokenCountPrompt",args:null,kind:"ScalarField",name:"tokenCountPrompt",storageKey:null},{alias:"cumulativeTokenCountCompletion",args:null,kind:"ScalarField",name:"tokenCountCompletion",storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:R,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:R,storageKey:null},x,T,E],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[m],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:"rootSpans",args:k,filters:["sort","rootSpansOnly","filterCondition","timeRange"],handle:"connection",key:"TracesTable_rootSpans",kind:"LinkedHandle",name:"spans"}],type:"Project",abstractKey:null}],storageKey:null}]},params:{cacheID:"4e6571e93159d5ab4244d5cc4058a65a",id:null,metadata:{},name:"TracesTableQuery",operationKind:"query",text:`query TracesTableQuery(
2126
+ `}}}();tr.hash="30a8f0bcf1aa6021b2c9a47866f5dc49";const ir={argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:["node"],operation:tr,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"StreamToggle_data",selections:[{alias:null,args:null,kind:"ScalarField",name:"streamingLastUpdatedAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],type:"Project",abstractKey:null};ir.hash="30a8f0bcf1aa6021b2c9a47866f5dc49";function rr(n,a){const l=u.useRef(null);u.useEffect(()=>{l.current=n},[n]),u.useEffect(()=>{function t(){l.current&&l.current()}if(typeof a=="number"){const i=setInterval(t,a);return()=>clearInterval(i)}},[a])}const Sm=2e3;function vm(n){const{isStreaming:a,setIsStreaming:l,setFetchKey:t}=jn(),[i,r]=D.useRefetchableFragment(ir,n.project),o=u.useRef(i.streamingLastUpdatedAt),c=u.useCallback(()=>{a&&u.startTransition(()=>{r({},{fetchPolicy:"store-and-network"})})},[a,r]),d=i.streamingLastUpdatedAt;return u.useEffect(()=>{d!=null&&(o.current==null||o.current<d)&&(o.current=d,t(`fetch-traces-${d}`))},[t,d]),rr(c,Sm),e(ea,{labelPlacement:"start",isSelected:a,onChange:()=>{l(!a)},children:"Stream"})}const sr=function(){var n={defaultValue:null,kind:"LocalArgument",name:"after"},a={defaultValue:null,kind:"LocalArgument",name:"filterCondition"},l={defaultValue:50,kind:"LocalArgument",name:"first"},t={defaultValue:null,kind:"LocalArgument",name:"id"},i={defaultValue:{col:"startTime",dir:"desc"},kind:"LocalArgument",name:"sort"},r={defaultValue:null,kind:"LocalArgument",name:"timeRange"},o=[{kind:"Variable",name:"id",variableName:"id"}],c={kind:"Variable",name:"after",variableName:"after"},d={kind:"Variable",name:"filterCondition",variableName:"filterCondition"},g={kind:"Variable",name:"first",variableName:"first"},f={kind:"Variable",name:"sort",variableName:"sort"},m={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},p={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},y={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},b=[c,d,g,{kind:"Literal",name:"rootSpansOnly",value:!0},f,{kind:"Variable",name:"timeRange",variableName:"timeRange"}],k={alias:null,args:null,kind:"ScalarField",name:"spanKind",storageKey:null},v={alias:"statusCode",args:null,kind:"ScalarField",name:"propagatedStatusCode",storageKey:null},S={alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},A={alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},L={alias:null,args:null,kind:"ScalarField",name:"parentId",storageKey:null},w=[{alias:"value",args:null,kind:"ScalarField",name:"truncatedValue",storageKey:null}],x={alias:null,args:null,concreteType:"SpanContext",kind:"LinkedField",name:"context",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null}],storageKey:null},T={alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[y,{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null}],storageKey:null},E={alias:null,args:null,concreteType:"DocumentRetrievalMetrics",kind:"LinkedField",name:"documentRetrievalMetrics",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"evaluationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"ndcg",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"precision",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hit",storageKey:null}],storageKey:null},R=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}];return{fragment:{argumentDefinitions:[n,a,l,t,i,r],kind:"Fragment",metadata:null,name:"TracesTableQuery",selections:[{alias:null,args:o,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:[c,d,g,f],kind:"FragmentSpread",name:"TracesTable_spans"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,a,l,i,r,t],kind:"Operation",name:"TracesTableQuery",selections:[{alias:null,args:o,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[m,{kind:"TypeDiscriminator",abstractKey:"__isNode"},p,{kind:"InlineFragment",selections:[y,{alias:null,args:null,kind:"ScalarField",name:"spanAnnotationNames",storageKey:null},{alias:"rootSpans",args:b,concreteType:"SpanConnection",kind:"LinkedField",name:"spans",plural:!1,selections:[{alias:null,args:null,concreteType:"SpanEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"rootSpan",args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[p,k,y,{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},v,S,A,{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountTotal",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountPrompt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountCompletion",storageKey:null},L,{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:w,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:w,storageKey:null},x,T,E,{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"descendants",plural:!0,selections:[p,k,y,v,S,A,L,{alias:"cumulativeTokenCountTotal",args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},{alias:"cumulativeTokenCountPrompt",args:null,kind:"ScalarField",name:"tokenCountPrompt",storageKey:null},{alias:"cumulativeTokenCountCompletion",args:null,kind:"ScalarField",name:"tokenCountCompletion",storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:R,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:R,storageKey:null},x,T,E],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[m],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:"rootSpans",args:b,filters:["sort","rootSpansOnly","filterCondition","timeRange"],handle:"connection",key:"TracesTable_rootSpans",kind:"LinkedHandle",name:"spans"}],type:"Project",abstractKey:null}],storageKey:null}]},params:{cacheID:"4e6571e93159d5ab4244d5cc4058a65a",id:null,metadata:{},name:"TracesTableQuery",operationKind:"query",text:`query TracesTableQuery(
2127
2127
  $after: String = null
2128
2128
  $filterCondition: String = null
2129
2129
  $first: Int = 50
@@ -2229,16 +2229,16 @@ fragment TracesTable_spans_1XEuU on Project {
2229
2229
  }
2230
2230
  id
2231
2231
  }
2232
- `}}}();sr.hash="69e77ceeea7371be4ec13fc702225150";const or=function(){var n=["rootSpans"],a={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"spanKind",storageKey:null},i={alias:"statusCode",args:null,kind:"ScalarField",name:"propagatedStatusCode",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},c={alias:null,args:null,kind:"ScalarField",name:"parentId",storageKey:null},d=[{alias:"value",args:null,kind:"ScalarField",name:"truncatedValue",storageKey:null}],g={alias:null,args:null,concreteType:"SpanContext",kind:"LinkedField",name:"context",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null}],storageKey:null},f={alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[a,{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null}],storageKey:null},m={alias:null,args:null,concreteType:"DocumentRetrievalMetrics",kind:"LinkedField",name:"documentRetrievalMetrics",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"evaluationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"ndcg",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"precision",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hit",storageKey:null}],storageKey:null},p=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}];return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:null,kind:"LocalArgument",name:"filterCondition"},{defaultValue:50,kind:"LocalArgument",name:"first"},{defaultValue:{col:"startTime",dir:"desc"},kind:"LocalArgument",name:"sort"},{kind:"RootArgument",name:"timeRange"}],kind:"Fragment",metadata:{connection:[{count:"first",cursor:"after",direction:"forward",path:n}],refetch:{connection:{forward:{count:"first",cursor:"after"},backward:null,path:n},fragmentPathInResult:["node"],operation:sr,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"TracesTable_spans",selections:[a,{args:null,kind:"FragmentSpread",name:"SpanColumnSelector_annotations"},{alias:"rootSpans",args:[{kind:"Variable",name:"filterCondition",variableName:"filterCondition"},{kind:"Literal",name:"rootSpansOnly",value:!0},{kind:"Variable",name:"sort",variableName:"sort"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],concreteType:"SpanConnection",kind:"LinkedField",name:"__TracesTable_rootSpans_connection",plural:!1,selections:[{alias:null,args:null,concreteType:"SpanEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"rootSpan",args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[l,t,a,{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},i,r,o,{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountTotal",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountPrompt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountCompletion",storageKey:null},c,{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:d,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:d,storageKey:null},g,f,m,{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"descendants",plural:!0,selections:[l,t,a,i,r,o,c,{alias:"cumulativeTokenCountTotal",args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},{alias:"cumulativeTokenCountPrompt",args:null,kind:"ScalarField",name:"tokenCountPrompt",storageKey:null},{alias:"cumulativeTokenCountCompletion",args:null,kind:"ScalarField",name:"tokenCountCompletion",storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:p,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:p,storageKey:null},g,f,m],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},l],type:"Project",abstractKey:null}}();or.hash="69e77ceeea7371be4ec13fc702225150";const xl=50;function dr(n){const a=[];for(const l of n){const t={...l.span,children:dr(l.children)};a.push(t)}return a}function Cm(n){const a=u.useRef(null),[l,t]=u.useState({}),[i,r]=u.useState([]),[o,c]=u.useState(""),d=ne(),{fetchKey:g}=jn(),{data:f,loadNext:m,hasNext:p,isLoadingNext:y,refetch:k}=D.usePaginationFragment(or,n.project),b=an(w=>w.annotationColumnVisibility),v=u.useMemo(()=>Object.keys(b).filter(w=>b[w]),[b]),S=u.useMemo(()=>f.rootSpans.edges.map(({rootSpan:$})=>{const Y=Jo([$,...$.descendants]),[un]=dr(Y);return un}),[f]),L=v.map(w=>({header:w,columns:[{header:"label",accessorKey:`${Yn}${$e}label${$e}${w}`,cell:({row:$})=>{const Y=$.original.spanAnnotations.find(un=>un.name===w);return Y?Y.label:null}},{header:"score",accessorKey:`${Yn}${$e}score${$e}${w}`,cell:({row:$})=>{const Y=$.original.spanAnnotations.find(un=>un.name===w);return Y?Y.score:null}}]})),A=[{header:()=>s(h,{direction:"row",gap:"size-50",children:[e("span",{children:"feedback"}),s(Nn,{children:[e(re,{level:3,weight:"heavy",children:"Feedback"}),e(Fn,{children:"Feedback includes evaluations and human annotations logged via the API or set via the UI."})]})]}),accessorKey:"spanAnnotations",enableSorting:!1,cell:({row:w})=>{const $=w.original.spanAnnotations.length===0&&w.original.documentRetrievalMetrics.length===0;return s(h,{direction:"row",gap:"size-50",wrap:"wrap",children:[w.original.spanAnnotations.map(Y=>e(ia,{annotation:Y,layout:"horizontal",width:"500px",extra:e(Qi,{annotation:Y}),children:e(xn,{annotation:Y,annotationDisplayPreference:"label"})},Y.name)),w.original.documentRetrievalMetrics.map(Y=>s(u.Fragment,{children:[e(De,{name:Y.evaluationName,metric:"ndcg",score:Y.ndcg},"ndcg"),e(De,{name:Y.evaluationName,metric:"precision",score:Y.precision},"precision"),e(De,{name:Y.evaluationName,metric:"hit",score:Y.hit},"hit")]},"doc-evals")),$?"--":null]})}},...L],_=[{id:"select",maxSize:10,header:({table:w})=>e(en,{checked:w.getIsAllRowsSelected(),indeterminate:w.getIsSomeRowsSelected(),onChange:w.getToggleAllRowsSelectedHandler()}),cell:({row:w})=>e(en,{checked:w.getIsSelected(),disabled:!w.getCanSelect(),indeterminate:w.getIsSomeSelected(),onChange:w.getToggleSelectedHandler()})},{header:()=>s(h,{gap:"size-50",direction:"row",alignItems:"center",children:[e(pl,{isExpanded:j.getIsAllRowsExpanded(),onClick:j.getToggleAllRowsExpandedHandler(),"aria-label":"Expand all rows"}),"kind"]}),enableSorting:!1,accessorKey:"spanKind",maxSize:100,cell:w=>e("div",{css:C`
2232
+ `}}}();sr.hash="69e77ceeea7371be4ec13fc702225150";const or=function(){var n=["rootSpans"],a={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"spanKind",storageKey:null},i={alias:"statusCode",args:null,kind:"ScalarField",name:"propagatedStatusCode",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},c={alias:null,args:null,kind:"ScalarField",name:"parentId",storageKey:null},d=[{alias:"value",args:null,kind:"ScalarField",name:"truncatedValue",storageKey:null}],g={alias:null,args:null,concreteType:"SpanContext",kind:"LinkedField",name:"context",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null}],storageKey:null},f={alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[a,{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null}],storageKey:null},m={alias:null,args:null,concreteType:"DocumentRetrievalMetrics",kind:"LinkedField",name:"documentRetrievalMetrics",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"evaluationName",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"ndcg",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"precision",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hit",storageKey:null}],storageKey:null},p=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null}];return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:null,kind:"LocalArgument",name:"filterCondition"},{defaultValue:50,kind:"LocalArgument",name:"first"},{defaultValue:{col:"startTime",dir:"desc"},kind:"LocalArgument",name:"sort"},{kind:"RootArgument",name:"timeRange"}],kind:"Fragment",metadata:{connection:[{count:"first",cursor:"after",direction:"forward",path:n}],refetch:{connection:{forward:{count:"first",cursor:"after"},backward:null,path:n},fragmentPathInResult:["node"],operation:sr,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"TracesTable_spans",selections:[a,{args:null,kind:"FragmentSpread",name:"SpanColumnSelector_annotations"},{alias:"rootSpans",args:[{kind:"Variable",name:"filterCondition",variableName:"filterCondition"},{kind:"Literal",name:"rootSpansOnly",value:!0},{kind:"Variable",name:"sort",variableName:"sort"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],concreteType:"SpanConnection",kind:"LinkedField",name:"__TracesTable_rootSpans_connection",plural:!1,selections:[{alias:null,args:null,concreteType:"SpanEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"rootSpan",args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[l,t,a,{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},i,r,o,{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountTotal",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountPrompt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cumulativeTokenCountCompletion",storageKey:null},c,{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:d,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:d,storageKey:null},g,f,m,{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"descendants",plural:!0,selections:[l,t,a,i,r,o,c,{alias:"cumulativeTokenCountTotal",args:null,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},{alias:"cumulativeTokenCountPrompt",args:null,kind:"ScalarField",name:"tokenCountPrompt",storageKey:null},{alias:"cumulativeTokenCountCompletion",args:null,kind:"ScalarField",name:"tokenCountCompletion",storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:p,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:p,storageKey:null},g,f,m],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},l],type:"Project",abstractKey:null}}();or.hash="69e77ceeea7371be4ec13fc702225150";const xl=50;function dr(n){const a=[];for(const l of n){const t={...l.span,children:dr(l.children)};a.push(t)}return a}function Cm(n){const a=u.useRef(null),[l,t]=u.useState({}),[i,r]=u.useState([]),[o,c]=u.useState(""),d=ne(),{fetchKey:g}=jn(),{data:f,loadNext:m,hasNext:p,isLoadingNext:y,refetch:b}=D.usePaginationFragment(or,n.project),k=an(_=>_.annotationColumnVisibility),v=u.useMemo(()=>Object.keys(k).filter(_=>k[_]),[k]),S=u.useMemo(()=>f.rootSpans.edges.map(({rootSpan:$})=>{const Y=Jo([$,...$.descendants]),[un]=dr(Y);return un}),[f]),A=v.map(_=>({header:_,columns:[{header:"label",accessorKey:`${Yn}${$e}label${$e}${_}`,cell:({row:$})=>{const Y=$.original.spanAnnotations.find(un=>un.name===_);return Y?Y.label:null}},{header:"score",accessorKey:`${Yn}${$e}score${$e}${_}`,cell:({row:$})=>{const Y=$.original.spanAnnotations.find(un=>un.name===_);return Y?Y.score:null}}]})),L=[{header:()=>s(h,{direction:"row",gap:"size-50",children:[e("span",{children:"feedback"}),s(Nn,{children:[e(re,{level:3,weight:"heavy",children:"Feedback"}),e(Fn,{children:"Feedback includes evaluations and human annotations logged via the API or set via the UI."})]})]}),accessorKey:"spanAnnotations",enableSorting:!1,cell:({row:_})=>{const $=_.original.spanAnnotations.length===0&&_.original.documentRetrievalMetrics.length===0;return s(h,{direction:"row",gap:"size-50",wrap:"wrap",children:[_.original.spanAnnotations.map(Y=>e(ia,{annotation:Y,layout:"horizontal",width:"500px",extra:e(Qi,{annotation:Y}),children:e(xn,{annotation:Y,annotationDisplayPreference:"label"})},Y.name)),_.original.documentRetrievalMetrics.map(Y=>s(u.Fragment,{children:[e(De,{name:Y.evaluationName,metric:"ndcg",score:Y.ndcg},"ndcg"),e(De,{name:Y.evaluationName,metric:"precision",score:Y.precision},"precision"),e(De,{name:Y.evaluationName,metric:"hit",score:Y.hit},"hit")]},"doc-evals")),$?"--":null]})}},...A],w=[{id:"select",maxSize:10,header:({table:_})=>e(en,{checked:_.getIsAllRowsSelected(),indeterminate:_.getIsSomeRowsSelected(),onChange:_.getToggleAllRowsSelectedHandler()}),cell:({row:_})=>e(en,{checked:_.getIsSelected(),disabled:!_.getCanSelect(),indeterminate:_.getIsSomeSelected(),onChange:_.getToggleSelectedHandler()})},{header:()=>s(h,{gap:"size-50",direction:"row",alignItems:"center",children:[e(pl,{isExpanded:j.getIsAllRowsExpanded(),onClick:j.getToggleAllRowsExpandedHandler(),"aria-label":"Expand all rows"}),"kind"]}),enableSorting:!1,accessorKey:"spanKind",maxSize:100,cell:_=>e("div",{css:C`
2233
2233
  // Since rows are flattened by default,
2234
2234
  // we can use the row.depth property
2235
2235
  // and paddingLeft to visually indicate the depth
2236
2236
  // of the row
2237
- padding-left: ${w.row.depth*2}rem;
2238
- `,children:s(h,{gap:"size-50",children:[w.row.getCanExpand()?e(pl,{isExpanded:w.row.getIsExpanded(),onClick:w.row.getToggleExpandedHandler(),"aria-label":"Expand row"}):null,e(nl,{spanKind:w.getValue()})]})})},{header:"name",accessorKey:"name",enableSorting:!1,cell:({getValue:w,row:$})=>{const{traceId:Y}=$.original.context;return e(Ze,{to:`traces/${Y}?selectedSpanNodeId=${$.original.id}`,children:w()})}},{header:"input",accessorKey:"input.value",enableSorting:!1,cell:ue},{header:"output",accessorKey:"output.value",enableSorting:!1,cell:ue},{header:"metadata",accessorKey:"metadata",enableSorting:!1,cell:ue},...A,{header:"start time",accessorKey:"startTime",cell:Fe},{header:"latency",accessorKey:"latencyMs",cell:({getValue:w})=>{const $=w();return $===null||typeof $!="number"?null:e(Me,{latencyMs:$})}},{header:"total tokens",minSize:80,accessorKey:"cumulativeTokenCountTotal",cell:({row:w,getValue:$})=>{const Y=$();return Y===null?"--":e(Ya,{tokenCountTotal:Y,tokenCountPrompt:w.original.cumulativeTokenCountPrompt||0,tokenCountCompletion:w.original.cumulativeTokenCountCompletion||0})}},{header:"status",accessorKey:"statusCode",enableSorting:!1,cell:({getValue:w})=>e(Ca,{statusCode:w()})}];u.useEffect(()=>{const w=i[0];u.startTransition(()=>{k({sort:w?lr(w):ar,after:null,first:xl,filterCondition:o},{fetchPolicy:"store-and-network"})})},[i,k,o,g]);const x=Ke.useCallback(w=>{if(w){const{scrollHeight:$,scrollTop:Y,clientHeight:un}=w;$-Y-un<300&&!y&&p&&m(xl)}},[p,y,m]),[T,E]=u.useState({}),R=an(w=>w.columnVisibility),j=he({columns:_,data:S,onExpandedChange:E,manualSorting:!0,getSubRows:w=>w.children,state:{sorting:i,expanded:T,columnVisibility:R,rowSelection:l},onRowSelectionChange:t,enableSubRowSelection:!1,onSortingChange:r,getCoreRowModel:ke(),getSortedRowModel:Rn(),getExpandedRowModel:$s(),getRowId:w=>w.id}),ae=j.getRowModel().rows,ie=j.getSelectedRowModel().flatRows,be=ie.map(w=>w.original),Se=u.useCallback(()=>{t({})},[t]),N=ae.length===0,V=j.getAllColumns().filter(w=>w.columns.length===0);return s("div",{css:nr,children:[e(F,{paddingTop:"size-100",paddingBottom:"size-100",paddingStart:"size-200",paddingEnd:"size-200",borderBottomColor:"grey-300",borderBottomWidth:"thin",flex:"none",children:s(h,{direction:"row",gap:"size-100",width:"100%",alignItems:"center",children:[e(Wi,{onValidCondition:c}),e(Ui,{columns:V,query:f})]})}),e("div",{css:C`
2237
+ padding-left: ${_.row.depth*2}rem;
2238
+ `,children:s(h,{gap:"size-50",children:[_.row.getCanExpand()?e(pl,{isExpanded:_.row.getIsExpanded(),onClick:_.row.getToggleExpandedHandler(),"aria-label":"Expand row"}):null,e(nl,{spanKind:_.getValue()})]})})},{header:"name",accessorKey:"name",enableSorting:!1,cell:({getValue:_,row:$})=>{const{traceId:Y}=$.original.context;return e(Ze,{to:`traces/${Y}?selectedSpanNodeId=${$.original.id}`,children:_()})}},{header:"input",accessorKey:"input.value",enableSorting:!1,cell:me},{header:"output",accessorKey:"output.value",enableSorting:!1,cell:me},{header:"metadata",accessorKey:"metadata",enableSorting:!1,cell:me},...L,{header:"start time",accessorKey:"startTime",cell:Fe},{header:"latency",accessorKey:"latencyMs",cell:({getValue:_})=>{const $=_();return $===null||typeof $!="number"?null:e(Me,{latencyMs:$})}},{header:"total tokens",minSize:80,accessorKey:"cumulativeTokenCountTotal",cell:({row:_,getValue:$})=>{const Y=$();return Y===null?"--":e(Ya,{tokenCountTotal:Y,tokenCountPrompt:_.original.cumulativeTokenCountPrompt||0,tokenCountCompletion:_.original.cumulativeTokenCountCompletion||0})}},{header:"status",accessorKey:"statusCode",enableSorting:!1,cell:({getValue:_})=>e(Ca,{statusCode:_()})}];u.useEffect(()=>{const _=i[0];u.startTransition(()=>{b({sort:_?lr(_):ar,after:null,first:xl,filterCondition:o},{fetchPolicy:"store-and-network"})})},[i,b,o,g]);const x=Ke.useCallback(_=>{if(_){const{scrollHeight:$,scrollTop:Y,clientHeight:un}=_;$-Y-un<300&&!y&&p&&m(xl)}},[p,y,m]),[T,E]=u.useState({}),R=an(_=>_.columnVisibility),j=he({columns:w,data:S,onExpandedChange:E,manualSorting:!0,getSubRows:_=>_.children,state:{sorting:i,expanded:T,columnVisibility:R,rowSelection:l},onRowSelectionChange:t,enableSubRowSelection:!1,onSortingChange:r,getCoreRowModel:ke(),getSortedRowModel:Rn(),getExpandedRowModel:$s(),getRowId:_=>_.id}),ae=j.getRowModel().rows,ie=j.getSelectedRowModel().flatRows,be=ie.map(_=>_.original),Se=u.useCallback(()=>{t({})},[t]),N=ae.length===0,V=j.getAllColumns().filter(_=>_.columns.length===0);return s("div",{css:nr,children:[e(F,{paddingTop:"size-100",paddingBottom:"size-100",paddingStart:"size-200",paddingEnd:"size-200",borderBottomColor:"grey-300",borderBottomWidth:"thin",flex:"none",children:s(h,{direction:"row",gap:"size-100",width:"100%",alignItems:"center",children:[e(Wi,{onValidCondition:c}),e(Ui,{columns:V,query:f})]})}),e("div",{css:C`
2239
2239
  flex: 1 1 auto;
2240
2240
  overflow: auto;
2241
- `,onScroll:w=>x(w.target),ref:a,children:s("table",{css:Qn,children:[e("thead",{children:j.getHeaderGroups().map(w=>e("tr",{children:w.headers.map($=>e("th",{colSpan:$.colSpan,children:$.isPlaceholder?null:s("div",{"data-sortable":$.column.getCanSort(),className:$.column.getCanSort()?"cursor-pointer":"",onClick:$.column.getToggleSortingHandler(),style:{left:$.getStart(),width:$.getSize()},children:[Z($.column.columnDef.header,$.getContext()),$.column.getIsSorted()?e(P,{className:"sort-icon",svg:$.column.getIsSorted()==="asc"?e(I.ArrowUpFilled,{}):e(I.ArrowDownFilled,{})}):null]})},$.id))},w.id))}),N?e(ji,{projectName:f.name}):e("tbody",{children:ae.map(w=>e("tr",{onClick:()=>d(`traces/${w.original.context.traceId}`),children:w.getVisibleCells().map($=>e("td",{children:Z($.column.columnDef.cell,$.getContext())},$.id))},w.id))})]})}),ie.length?e(er,{selectedSpans:be,onClearSelection:Se}):null]})}const Fm=C`
2241
+ `,onScroll:_=>x(_.target),ref:a,children:s("table",{css:Qn,children:[e("thead",{children:j.getHeaderGroups().map(_=>e("tr",{children:_.headers.map($=>e("th",{colSpan:$.colSpan,children:$.isPlaceholder?null:s("div",{"data-sortable":$.column.getCanSort(),className:$.column.getCanSort()?"cursor-pointer":"",onClick:$.column.getToggleSortingHandler(),style:{left:$.getStart(),width:$.getSize()},children:[Z($.column.columnDef.header,$.getContext()),$.column.getIsSorted()?e(P,{className:"sort-icon",svg:$.column.getIsSorted()==="asc"?e(I.ArrowUpFilled,{}):e(I.ArrowDownFilled,{})}):null]})},$.id))},_.id))}),N?e(ji,{projectName:f.name}):e("tbody",{children:ae.map(_=>e("tr",{onClick:()=>d(`traces/${_.original.context.traceId}`),children:_.getVisibleCells().map($=>e("td",{children:Z($.column.columnDef.cell,$.getContext())},$.id))},_.id))})]})}),ie.length?e(er,{selectedSpans:be,onClearSelection:Se}):null]})}const Fm=C`
2242
2242
  flex: 1 1 auto;
2243
2243
  display: flex;
2244
2244
  flex-direction: column;
@@ -2412,7 +2412,7 @@ fragment ProjectsPageProjectsFragment on Query {
2412
2412
  __typename
2413
2413
  }
2414
2414
  }
2415
- `}}}();kr.hash="212501fe2d6367ec1503bd7a00c1730f";function wm(n){const{projectId:a}=n,l=u.useRef(null),[t,i]=D.useMutation(kr),{control:r,handleSubmit:o,setError:c,formState:{isValid:d}}=Ie({defaultValues:{endDate:new Date(Date.now()-ed).toISOString().slice(0,16)}}),g=u.useCallback(f=>{const m=Qs(f.endDate);if(!js(m))return c("endDate",{message:"Date is not in a valid format"});t({variables:{input:{id:a,endTime:new Date(m).toISOString()}},onCompleted:()=>{n.onComplete()},onError:p=>{alert("Failed to clear project traces: "+p)}})},[t,a,n,c]);return s("form",{onSubmit:o(g),ref:l,children:[s(F,{padding:"size-200",children:[e(K,{color:"danger",children:"You are about to remove all data before the following date. This cannot be undone."}),e(B,{name:"endDate",control:r,rules:{required:"field is required"},render:({field:{name:f,onChange:m,onBlur:p,value:y},fieldState:{invalid:k,error:b}})=>e(X,{label:"End Date",type:"datetime-local",name:f,description:"The date up to which you want to remove data",errorMessage:b==null?void 0:b.message,validationState:k?"invalid":"valid",onChange:m,onBlur:p,defaultValue:y})})]}),e(F,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(h,{direction:"row",justifyContent:"end",children:e(M,{type:"submit",variant:"danger",isDisabled:!d,size:"compact",loading:i,onClick:()=>{var f;(f=l.current)==null||f.requestSubmit()},children:i?"Removing...":"Remove Data"})})})]})}function _m({projectId:n,projectName:a,onProjectDelete:l,onProjectClear:t,onProjectRemoveData:i}){const[r,o]=u.useState(null),c=a!=="default",[d]=D.useMutation(hr),[g]=D.useMutation(fr),f=u.useCallback(()=>{u.startTransition(()=>{d({variables:{projectId:n}}),l()})},[d,n,l]),m=u.useCallback(()=>{u.startTransition(()=>{g({variables:{input:{id:n}},onCompleted:()=>{t()},onError:b=>{alert("Failed to clear project: "+b)}})})},[g,n,t]),p=u.useCallback(()=>{o(s(G,{size:"S",title:"Delete Project",children:[e(F,{padding:"size-200",children:e(K,{color:"danger",children:`Are you sure you want to delete project ${a}? This cannot be undone.`})}),e(F,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(h,{direction:"row",justifyContent:"end",children:e(M,{variant:"danger",onClick:()=>{f(),o(null)},children:"Delete Project"})})})]}))},[f,a]),y=u.useCallback(()=>{o(s(G,{size:"S",title:"Clear Project",children:[e(F,{padding:"size-200",children:e(K,{color:"danger",children:`Are you sure you want to clear project ${a}? All traces and evaluations for this project will be deleted. This cannot be undone.`})}),e(F,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(h,{direction:"row",justifyContent:"end",children:e(M,{variant:"danger",onClick:()=>{m(),o(null)},children:"Clear"})})})]}))},[m,a]),k=u.useCallback(()=>{o(e(G,{size:"M",title:"Remove Data",children:e(wm,{projectId:n,onComplete:()=>{i(),o(null)}})}))},[i,n]);return s("div",{onClick:b=>{b.preventDefault(),b.stopPropagation()},children:[s(Be,{buttonVariant:"quiet",align:"end",onAction:b=>{switch(b){case"deleteProject":return p();case"clearProject":return y();case"removeProjectData":return k()}},disabledKeys:c?[]:["deleteProject"],children:[e(U,{textValue:"Clear Traces",children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(I.Refresh,{})}),e(K,{children:"Clear Data"})]})},"clearProject"),e(U,{textValue:"Remove Data",children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(I.CloseCircleOutline,{})}),e(K,{children:"Remove Data"})]})},"removeProjectData"),c?e(U,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(I.TrashOutline,{})}),e(K,{children:"Delete"})]})},"deleteProject"):null]}),e(W,{type:"modal",isDismissable:!0,onDismiss:()=>o(null),children:r})]})}function Em(){const n=Sn(l=>l.projectsAutoRefreshEnabled),a=Sn(l=>l.setProjectAutoRefreshEnabled);return e(ea,{labelPlacement:"start",isSelected:n,onChange:()=>{a(!n)},children:"Auto-Refresh"})}const Rm=1e4,Mm=50;function qy(){const{timeRange:n}=Fa();return e(u.Suspense,{fallback:e(fe,{}),children:e(Nm,{timeRange:n})})}function Nm({timeRange:n}){const a=Sn(S=>S.projectsAutoRefreshEnabled),[l,t]=co(),i=u.useMemo(()=>({start:n.start.toISOString(),end:n.end.toISOString()}),[n]),r=D.useLazyLoadQuery(yr,{timeRange:i}),{data:o,loadNext:c,hasNext:d,isLoadingNext:g,refetch:f}=D.usePaginationFragment(pr,r),m=o.projects.edges.map(S=>S.project),p=u.useRef(null),y=u.useCallback(S=>{if(S){const{scrollHeight:L,scrollTop:A,clientHeight:_}=S;L-A-_<300&&!g&&d&&c(Mm)}},[d,g,c]);rr(()=>{u.startTransition(()=>{f({},{fetchPolicy:"store-and-network"})})},a?Rm:null);const k=u.useCallback(S=>{u.startTransition(()=>{f({},{fetchPolicy:"store-and-network"}),l({variant:"success",title:"Project Deleted",message:`Project ${S} has been deleted.`})})},[l,f]),b=u.useCallback(S=>{u.startTransition(()=>{f({},{fetchPolicy:"store-and-network"}),l({variant:"success",title:"Project Cleared",message:`Project ${S} has been cleared of traces.`})})},[l,f]),v=u.useCallback(S=>{u.startTransition(()=>{f({},{fetchPolicy:"store-and-network"}),l({variant:"success",title:"Project Data Removed",message:`Old data from project ${S} have been removed.`})})},[l,f]);return s("div",{css:C`
2415
+ `}}}();kr.hash="212501fe2d6367ec1503bd7a00c1730f";function wm(n){const{projectId:a}=n,l=u.useRef(null),[t,i]=D.useMutation(kr),{control:r,handleSubmit:o,setError:c,formState:{isValid:d}}=Ie({defaultValues:{endDate:new Date(Date.now()-ed).toISOString().slice(0,16)}}),g=u.useCallback(f=>{const m=Qs(f.endDate);if(!js(m))return c("endDate",{message:"Date is not in a valid format"});t({variables:{input:{id:a,endTime:new Date(m).toISOString()}},onCompleted:()=>{n.onComplete()},onError:p=>{alert("Failed to clear project traces: "+p)}})},[t,a,n,c]);return s("form",{onSubmit:o(g),ref:l,children:[s(F,{padding:"size-200",children:[e(K,{color:"danger",children:"You are about to remove all data before the following date. This cannot be undone."}),e(H,{name:"endDate",control:r,rules:{required:"field is required"},render:({field:{name:f,onChange:m,onBlur:p,value:y},fieldState:{invalid:b,error:k}})=>e(X,{label:"End Date",type:"datetime-local",name:f,description:"The date up to which you want to remove data",errorMessage:k==null?void 0:k.message,validationState:b?"invalid":"valid",onChange:m,onBlur:p,defaultValue:y})})]}),e(F,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(h,{direction:"row",justifyContent:"end",children:e(M,{type:"submit",variant:"danger",isDisabled:!d,size:"compact",loading:i,onClick:()=>{var f;(f=l.current)==null||f.requestSubmit()},children:i?"Removing...":"Remove Data"})})})]})}function _m({projectId:n,projectName:a,onProjectDelete:l,onProjectClear:t,onProjectRemoveData:i}){const[r,o]=u.useState(null),c=a!=="default",[d]=D.useMutation(hr),[g]=D.useMutation(fr),f=u.useCallback(()=>{u.startTransition(()=>{d({variables:{projectId:n}}),l()})},[d,n,l]),m=u.useCallback(()=>{u.startTransition(()=>{g({variables:{input:{id:n}},onCompleted:()=>{t()},onError:k=>{alert("Failed to clear project: "+k)}})})},[g,n,t]),p=u.useCallback(()=>{o(s(G,{size:"S",title:"Delete Project",children:[e(F,{padding:"size-200",children:e(K,{color:"danger",children:`Are you sure you want to delete project ${a}? This cannot be undone.`})}),e(F,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(h,{direction:"row",justifyContent:"end",children:e(M,{variant:"danger",onClick:()=>{f(),o(null)},children:"Delete Project"})})})]}))},[f,a]),y=u.useCallback(()=>{o(s(G,{size:"S",title:"Clear Project",children:[e(F,{padding:"size-200",children:e(K,{color:"danger",children:`Are you sure you want to clear project ${a}? All traces and evaluations for this project will be deleted. This cannot be undone.`})}),e(F,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(h,{direction:"row",justifyContent:"end",children:e(M,{variant:"danger",onClick:()=>{m(),o(null)},children:"Clear"})})})]}))},[m,a]),b=u.useCallback(()=>{o(e(G,{size:"M",title:"Remove Data",children:e(wm,{projectId:n,onComplete:()=>{i(),o(null)}})}))},[i,n]);return s("div",{onClick:k=>{k.preventDefault(),k.stopPropagation()},children:[s(Be,{buttonVariant:"quiet",align:"end",onAction:k=>{switch(k){case"deleteProject":return p();case"clearProject":return y();case"removeProjectData":return b()}},disabledKeys:c?[]:["deleteProject"],children:[e(B,{textValue:"Clear Traces",children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(I.Refresh,{})}),e(K,{children:"Clear Data"})]})},"clearProject"),e(B,{textValue:"Remove Data",children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(I.CloseCircleOutline,{})}),e(K,{children:"Remove Data"})]})},"removeProjectData"),c?e(B,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(I.TrashOutline,{})}),e(K,{children:"Delete"})]})},"deleteProject"):null]}),e(W,{type:"modal",isDismissable:!0,onDismiss:()=>o(null),children:r})]})}function Em(){const n=Sn(l=>l.projectsAutoRefreshEnabled),a=Sn(l=>l.setProjectAutoRefreshEnabled);return e(ea,{labelPlacement:"start",isSelected:n,onChange:()=>{a(!n)},children:"Auto-Refresh"})}const Rm=1e4,Mm=50;function qy(){const{timeRange:n}=Fa();return e(u.Suspense,{fallback:e(fe,{}),children:e(Nm,{timeRange:n})})}function Nm({timeRange:n}){const a=Sn(S=>S.projectsAutoRefreshEnabled),[l,t]=co(),i=u.useMemo(()=>({start:n.start.toISOString(),end:n.end.toISOString()}),[n]),r=D.useLazyLoadQuery(yr,{timeRange:i}),{data:o,loadNext:c,hasNext:d,isLoadingNext:g,refetch:f}=D.usePaginationFragment(pr,r),m=o.projects.edges.map(S=>S.project),p=u.useRef(null),y=u.useCallback(S=>{if(S){const{scrollHeight:A,scrollTop:L,clientHeight:w}=S;A-L-w<300&&!g&&d&&c(Mm)}},[d,g,c]);rr(()=>{u.startTransition(()=>{f({},{fetchPolicy:"store-and-network"})})},a?Rm:null);const b=u.useCallback(S=>{u.startTransition(()=>{f({},{fetchPolicy:"store-and-network"}),l({variant:"success",title:"Project Deleted",message:`Project ${S} has been deleted.`})})},[l,f]),k=u.useCallback(S=>{u.startTransition(()=>{f({},{fetchPolicy:"store-and-network"}),l({variant:"success",title:"Project Cleared",message:`Project ${S} has been cleared of traces.`})})},[l,f]),v=u.useCallback(S=>{u.startTransition(()=>{f({},{fetchPolicy:"store-and-network"}),l({variant:"success",title:"Project Data Removed",message:`Old data from project ${S} have been removed.`})})},[l,f]);return s("div",{css:C`
2416
2416
  flex: 1 1 auto;
2417
2417
  overflow-y: auto;
2418
2418
  overflow-x: hidden;
@@ -2424,7 +2424,7 @@ fragment ProjectsPageProjectsFragment on Query {
2424
2424
  flex-wrap: wrap;
2425
2425
  `,children:m.map(S=>e("li",{children:e(Ze,{to:`/projects/${S.id}`,css:C`
2426
2426
  text-decoration: none;
2427
- `,children:e(Vm,{project:S,onProjectDelete:()=>k(S.name),onProjectClear:()=>b(S.name),onProjectRemoveData:()=>v(S.name)})})},S.id))})}),t]})}function zm({gradientStartColor:n,gradientEndColor:a}){return e("div",{css:C`
2427
+ `,children:e(Vm,{project:S,onProjectDelete:()=>b(S.name),onProjectClear:()=>k(S.name),onProjectRemoveData:()=>v(S.name)})})},S.id))})}),t]})}function zm({gradientStartColor:n,gradientEndColor:a}){return e("div",{css:C`
2428
2428
  border-radius: 50%;
2429
2429
  width: 32px;
2430
2430
  height: 32px;
@@ -2483,7 +2483,7 @@ fragment DatasetsTable_datasets on Query {
2483
2483
  .ac-dropdown-button {
2484
2484
  width: 100%;
2485
2485
  }
2486
- `,children:[e(B,{name:"name",control:r,rules:{required:"field is required"},render:({field:{onChange:m,onBlur:p,value:y},fieldState:{invalid:k,error:b}})=>e(X,{label:"Dataset Name",description:"The name of the dataset",errorMessage:b==null?void 0:b.message,validationState:k?"invalid":"valid",onChange:m,onBlur:p,value:y.toString()})}),e(B,{name:"description",control:r,render:({field:{onChange:m,onBlur:p,value:y},fieldState:{invalid:k,error:b}})=>e(ka,{label:"description",placeholder:"Description of the dataset",isRequired:!1,height:100,errorMessage:b==null?void 0:b.message,validationState:k?"invalid":"valid",onChange:m,onBlur:p,value:y.toString()})}),e(B,{control:r,name:"file",rules:{required:"CSV file is required"},render:({field:{value:m,onChange:p,...y},fieldState:{invalid:k,error:b}})=>e(la,{label:"CSV file",validationState:k?"invalid":"valid",errorMessage:b==null?void 0:b.message,children:e("input",{...y,onChange:v=>{var L;p(v.target.files),c("input_keys"),c("output_keys"),c("metadata_keys");const S=(L=v.target.files)==null?void 0:L[0];if(S){const A=new FileReader;A.onload=function(_){if(!_.target)return;const x=_.target.result,T=$m(x);i(T)},A.readAsText(S)}},type:"file",id:"file",accept:".csv"})})}),e(B,{name:"input_keys",control:r,rules:{required:"field is required"},render:({field:{value:m,onChange:p},fieldState:{invalid:y,error:k}})=>e(Ea,{label:"input keys",validationState:y?"invalid":"valid",description:"the columns to use as input",columns:t,selectedColumns:m,onChange:p,errorMessage:k==null?void 0:k.message})}),e(B,{name:"output_keys",control:r,render:({field:{value:m,onChange:p},fieldState:{invalid:y,error:k}})=>e(Ea,{label:"output keys",validationState:y?"invalid":"valid",description:"the columns to use as output",columns:t,selectedColumns:m,onChange:p,errorMessage:k==null?void 0:k.message})}),e(B,{name:"metadata_keys",control:r,render:({field:{value:m,onChange:p},fieldState:{invalid:y,error:k}})=>e(Ea,{label:"metadata keys",validationState:y?"invalid":"valid",description:"the columns to use as metadata",columns:t,selectedColumns:m,onChange:p,errorMessage:k==null?void 0:k.message})})]}),e(F,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(h,{direction:"row",justifyContent:"end",children:e(M,{type:"submit",isDisabled:!g,variant:d?"primary":"default",size:"compact",loading:!1,children:"Create Dataset"})})})]})}function Ea(n){const{columns:a,selectedColumns:l,onChange:t,label:i,validationState:r,description:o,errorMessage:c,...d}=n,g=a.length===0,f=u.useMemo(()=>g?"No columns to select":l.length>0?`${l.join(", ")}`:"No columns selected",[l,g]);return e(la,{label:i,isDisabled:g,validationState:r,description:o,errorMessage:c,children:e(Wa,{isDisabled:g,...d,menu:e(na,{selectionMode:"multiple",onSelectionChange:m=>{t(Array.from(m))},selectedKeys:new Set(l),children:a.map(m=>e(U,{children:m},m))}),triggerProps:{placement:"bottom end"},children:f})})}const Sr=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:100,kind:"LocalArgument",name:"first"},{defaultValue:{col:"createdAt",dir:"desc"},kind:"LocalArgument",name:"sort"}],a=[{kind:"Variable",name:"after",variableName:"after"},{kind:"Variable",name:"first",variableName:"first"},{kind:"Variable",name:"sort",variableName:"sort"}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"DatasetsTableDatasetsQuery",selections:[{args:a,kind:"FragmentSpread",name:"DatasetsTable_datasets"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"DatasetsTableDatasetsQuery",selections:[{alias:null,args:a,concreteType:"DatasetConnection",kind:"LinkedField",name:"datasets",plural:!1,selections:[{alias:null,args:null,concreteType:"DatasetEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"Dataset",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"exampleCount",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"experimentCount",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:a,filters:["sort"],handle:"connection",key:"DatasetsTable_datasets",kind:"LinkedHandle",name:"datasets"}]},params:{cacheID:"5ac1688f54e51f9bb3247c83e23d98fb",id:null,metadata:{},name:"DatasetsTableDatasetsQuery",operationKind:"query",text:`query DatasetsTableDatasetsQuery(
2486
+ `,children:[e(H,{name:"name",control:r,rules:{required:"field is required"},render:({field:{onChange:m,onBlur:p,value:y},fieldState:{invalid:b,error:k}})=>e(X,{label:"Dataset Name",description:"The name of the dataset",errorMessage:k==null?void 0:k.message,validationState:b?"invalid":"valid",onChange:m,onBlur:p,value:y.toString()})}),e(H,{name:"description",control:r,render:({field:{onChange:m,onBlur:p,value:y},fieldState:{invalid:b,error:k}})=>e(ka,{label:"description",placeholder:"Description of the dataset",isRequired:!1,height:100,errorMessage:k==null?void 0:k.message,validationState:b?"invalid":"valid",onChange:m,onBlur:p,value:y.toString()})}),e(H,{control:r,name:"file",rules:{required:"CSV file is required"},render:({field:{value:m,onChange:p,...y},fieldState:{invalid:b,error:k}})=>e(la,{label:"CSV file",validationState:b?"invalid":"valid",errorMessage:k==null?void 0:k.message,children:e("input",{...y,onChange:v=>{var A;p(v.target.files),c("input_keys"),c("output_keys"),c("metadata_keys");const S=(A=v.target.files)==null?void 0:A[0];if(S){const L=new FileReader;L.onload=function(w){if(!w.target)return;const x=w.target.result,T=$m(x);i(T)},L.readAsText(S)}},type:"file",id:"file",accept:".csv"})})}),e(H,{name:"input_keys",control:r,rules:{required:"field is required"},render:({field:{value:m,onChange:p},fieldState:{invalid:y,error:b}})=>e(Ea,{label:"input keys",validationState:y?"invalid":"valid",description:"the columns to use as input",columns:t,selectedColumns:m,onChange:p,errorMessage:b==null?void 0:b.message})}),e(H,{name:"output_keys",control:r,render:({field:{value:m,onChange:p},fieldState:{invalid:y,error:b}})=>e(Ea,{label:"output keys",validationState:y?"invalid":"valid",description:"the columns to use as output",columns:t,selectedColumns:m,onChange:p,errorMessage:b==null?void 0:b.message})}),e(H,{name:"metadata_keys",control:r,render:({field:{value:m,onChange:p},fieldState:{invalid:y,error:b}})=>e(Ea,{label:"metadata keys",validationState:y?"invalid":"valid",description:"the columns to use as metadata",columns:t,selectedColumns:m,onChange:p,errorMessage:b==null?void 0:b.message})})]}),e(F,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(h,{direction:"row",justifyContent:"end",children:e(M,{type:"submit",isDisabled:!g,variant:d?"primary":"default",size:"compact",loading:!1,children:"Create Dataset"})})})]})}function Ea(n){const{columns:a,selectedColumns:l,onChange:t,label:i,validationState:r,description:o,errorMessage:c,...d}=n,g=a.length===0,f=u.useMemo(()=>g?"No columns to select":l.length>0?`${l.join(", ")}`:"No columns selected",[l,g]);return e(la,{label:i,isDisabled:g,validationState:r,description:o,errorMessage:c,children:e(Wa,{isDisabled:g,...d,menu:e(na,{selectionMode:"multiple",onSelectionChange:m=>{t(Array.from(m))},selectedKeys:new Set(l),children:a.map(m=>e(B,{children:m},m))}),triggerProps:{placement:"bottom end"},children:f})})}const Sr=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:100,kind:"LocalArgument",name:"first"},{defaultValue:{col:"createdAt",dir:"desc"},kind:"LocalArgument",name:"sort"}],a=[{kind:"Variable",name:"after",variableName:"after"},{kind:"Variable",name:"first",variableName:"first"},{kind:"Variable",name:"sort",variableName:"sort"}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"DatasetsTableDatasetsQuery",selections:[{args:a,kind:"FragmentSpread",name:"DatasetsTable_datasets"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"DatasetsTableDatasetsQuery",selections:[{alias:null,args:a,concreteType:"DatasetConnection",kind:"LinkedField",name:"datasets",plural:!1,selections:[{alias:null,args:null,concreteType:"DatasetEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"Dataset",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"exampleCount",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"experimentCount",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:a,filters:["sort"],handle:"connection",key:"DatasetsTable_datasets",kind:"LinkedHandle",name:"datasets"}]},params:{cacheID:"5ac1688f54e51f9bb3247c83e23d98fb",id:null,metadata:{},name:"DatasetsTableDatasetsQuery",operationKind:"query",text:`query DatasetsTableDatasetsQuery(
2487
2487
  $after: String = null
2488
2488
  $first: Int = 100
2489
2489
  $sort: DatasetSort = {col: createdAt, dir: desc}
@@ -2519,10 +2519,10 @@ fragment DatasetsTable_datasets_dWkdd on Query {
2519
2519
  __typename
2520
2520
  }
2521
2521
  }
2522
- `}}}();Cr.hash="7066cca7015a7e344b77862b0bdab21c";function Qm({datasetId:n,datasetName:a,onDatasetDelete:l,onDatasetDeleteError:t}){const[i,r]=D.useMutation(Cr),o=u.useCallback(()=>{u.startTransition(()=>{i({variables:{datasetId:n},onCompleted:()=>{l()},onError:c=>{t(c)}})})},[i,n,l,t]);return s(G,{size:"S",title:"Delete Dataset",children:[e(F,{padding:"size-200",children:e(K,{color:"danger",children:`Are you sure you want to delete dataset ${a}? This will also delete all associated experiments and traces, and it cannot be undone.`})}),e(F,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(h,{direction:"row",justifyContent:"end",children:e(M,{variant:"danger",onClick:()=>{o()},disabled:r,loading:r,children:"Delete Dataset"})})})]})}function jm({datasetName:n,datasetId:a,datasetDescription:l,datasetMetadata:t,onDatasetEdited:i,onDatasetEditError:r}){return e(G,{title:"Edit Dataset",size:"M",children:e(nd,{datasetName:n,datasetId:a,datasetDescription:l,datasetMetadata:t,onDatasetEdited:i,onDatasetEditError:r})})}function qm(n){const{datasetId:a,datasetName:l,datasetDescription:t,datasetMetadata:i,onDatasetDelete:r,onDatasetDeleteError:o,onDatasetEdit:c,onDatasetEditError:d}=n,[g,f]=u.useState(null),m=u.useCallback(()=>{f(e(Qm,{datasetId:a,datasetName:l,onDatasetDelete:()=>{r(),f(null)},onDatasetDeleteError:o}))},[a,l,r,o]),p=u.useCallback(()=>{f(e(jm,{datasetId:a,datasetName:l,datasetDescription:t,datasetMetadata:i,onDatasetEdited:()=>{c(),f(null)},onDatasetEditError:d}))},[t,a,i,l,c,d]);return s("div",{onClick:y=>{y.preventDefault(),y.stopPropagation()},children:[s(Be,{align:"end",buttonSize:"compact",onAction:y=>{switch(y){case"deleteDataset":m();break;case"editDataset":p();break}},children:[e(U,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(I.TrashOutline,{})}),e(K,{children:"Delete"})]})},"deleteDataset"),e(U,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(I.Edit2Outline,{})}),e(K,{children:"Edit"})]})},"editDataset")]}),e(W,{type:"modal",isDismissable:!0,onDismiss:()=>f(null),children:g})]})}const Dl=100;function Um(n){const a=n.id;if(a!=="createdAt"&&a!=="name")throw new Error("Invalid sort column");return{col:a,dir:n.desc?"desc":"asc"}}function Bm(n){const[a,l]=u.useState([]),t=u.useRef(null),i=ne(),r=oe(),o=ge(),{data:c,loadNext:d,hasNext:g,isLoadingNext:f,refetch:m}=D.usePaginationFragment(vr,n.query),p=u.useMemo(()=>c.datasets.edges.map(S=>S.node),[c]),y=Ke.useCallback(S=>{if(S){const{scrollHeight:L,scrollTop:A,clientHeight:_}=S;L-A-_<300&&!f&&g&&d(Dl)}},[g,f,d]),k=he({columns:[{header:"name",accessorKey:"name",cell:({row:S})=>{const A=S.original.experimentCount>0?`${S.original.id}/experiments`:`${S.original.id}/examples`;return e(Ze,{to:A,children:S.original.name})}},{header:"description",accessorKey:"description",enableSorting:!1},{header:"created at",accessorKey:"createdAt",cell:Fe},{header:"example count",accessorKey:"exampleCount",enableSorting:!1,meta:{textAlign:"right"}},{header:"experiment count",accessorKey:"experimentCount",enableSorting:!1,meta:{textAlign:"right"}},{header:"metadata",accessorKey:"metadata",enableSorting:!1,cell:_n},{header:"",id:"actions",enableSorting:!1,size:10,cell:({row:S})=>e(qm,{datasetId:S.original.id,datasetName:S.original.name,datasetDescription:S.original.description,datasetMetadata:S.original.metadata,onDatasetEdit:()=>{r({title:"Dataset updated",message:`${S.original.name} has been successfully updated.`}),m({},{fetchPolicy:"store-and-network"})},onDatasetEditError:L=>{o({title:"Dataset update failed",message:L.message})},onDatasetDelete:()=>{r({title:"Dataset deleted",message:`${S.original.name} has been successfully deleted.`}),m({},{fetchPolicy:"store-and-network"})},onDatasetDeleteError:L=>{o({title:"Dataset deletion failed",message:L.message})}})}],data:p,state:{sorting:a},getCoreRowModel:ke(),getSortedRowModel:Rn(),onSortingChange:l,manualSorting:!0});u.useEffect(()=>{const S=a[0];u.startTransition(()=>{m({sort:S?Um(S):{col:"createdAt",dir:"desc"},after:null,first:Dl},{fetchPolicy:"store-and-network"})})},[a,m]);const b=k.getRowModel().rows,v=b.length===0;return e("div",{css:C`
2522
+ `}}}();Cr.hash="7066cca7015a7e344b77862b0bdab21c";function Qm({datasetId:n,datasetName:a,onDatasetDelete:l,onDatasetDeleteError:t}){const[i,r]=D.useMutation(Cr),o=u.useCallback(()=>{u.startTransition(()=>{i({variables:{datasetId:n},onCompleted:()=>{l()},onError:c=>{t(c)}})})},[i,n,l,t]);return s(G,{size:"S",title:"Delete Dataset",children:[e(F,{padding:"size-200",children:e(K,{color:"danger",children:`Are you sure you want to delete dataset ${a}? This will also delete all associated experiments and traces, and it cannot be undone.`})}),e(F,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(h,{direction:"row",justifyContent:"end",children:e(M,{variant:"danger",onClick:()=>{o()},disabled:r,loading:r,children:"Delete Dataset"})})})]})}function jm({datasetName:n,datasetId:a,datasetDescription:l,datasetMetadata:t,onDatasetEdited:i,onDatasetEditError:r}){return e(G,{title:"Edit Dataset",size:"M",children:e(nd,{datasetName:n,datasetId:a,datasetDescription:l,datasetMetadata:t,onDatasetEdited:i,onDatasetEditError:r})})}function qm(n){const{datasetId:a,datasetName:l,datasetDescription:t,datasetMetadata:i,onDatasetDelete:r,onDatasetDeleteError:o,onDatasetEdit:c,onDatasetEditError:d}=n,[g,f]=u.useState(null),m=u.useCallback(()=>{f(e(Qm,{datasetId:a,datasetName:l,onDatasetDelete:()=>{r(),f(null)},onDatasetDeleteError:o}))},[a,l,r,o]),p=u.useCallback(()=>{f(e(jm,{datasetId:a,datasetName:l,datasetDescription:t,datasetMetadata:i,onDatasetEdited:()=>{c(),f(null)},onDatasetEditError:d}))},[t,a,i,l,c,d]);return s("div",{onClick:y=>{y.preventDefault(),y.stopPropagation()},children:[s(Be,{align:"end",buttonSize:"compact",onAction:y=>{switch(y){case"deleteDataset":m();break;case"editDataset":p();break}},children:[e(B,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(I.TrashOutline,{})}),e(K,{children:"Delete"})]})},"deleteDataset"),e(B,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(I.Edit2Outline,{})}),e(K,{children:"Edit"})]})},"editDataset")]}),e(W,{type:"modal",isDismissable:!0,onDismiss:()=>f(null),children:g})]})}const Dl=100;function Um(n){const a=n.id;if(a!=="createdAt"&&a!=="name")throw new Error("Invalid sort column");return{col:a,dir:n.desc?"desc":"asc"}}function Bm(n){const[a,l]=u.useState([]),t=u.useRef(null),i=ne(),r=oe(),o=ce(),{data:c,loadNext:d,hasNext:g,isLoadingNext:f,refetch:m}=D.usePaginationFragment(vr,n.query),p=u.useMemo(()=>c.datasets.edges.map(S=>S.node),[c]),y=Ke.useCallback(S=>{if(S){const{scrollHeight:A,scrollTop:L,clientHeight:w}=S;A-L-w<300&&!f&&g&&d(Dl)}},[g,f,d]),b=he({columns:[{header:"name",accessorKey:"name",cell:({row:S})=>{const L=S.original.experimentCount>0?`${S.original.id}/experiments`:`${S.original.id}/examples`;return e(Ze,{to:L,children:S.original.name})}},{header:"description",accessorKey:"description",enableSorting:!1},{header:"created at",accessorKey:"createdAt",cell:Fe},{header:"example count",accessorKey:"exampleCount",enableSorting:!1,meta:{textAlign:"right"}},{header:"experiment count",accessorKey:"experimentCount",enableSorting:!1,meta:{textAlign:"right"}},{header:"metadata",accessorKey:"metadata",enableSorting:!1,cell:_n},{header:"",id:"actions",enableSorting:!1,size:10,cell:({row:S})=>e(qm,{datasetId:S.original.id,datasetName:S.original.name,datasetDescription:S.original.description,datasetMetadata:S.original.metadata,onDatasetEdit:()=>{r({title:"Dataset updated",message:`${S.original.name} has been successfully updated.`}),m({},{fetchPolicy:"store-and-network"})},onDatasetEditError:A=>{o({title:"Dataset update failed",message:A.message})},onDatasetDelete:()=>{r({title:"Dataset deleted",message:`${S.original.name} has been successfully deleted.`}),m({},{fetchPolicy:"store-and-network"})},onDatasetDeleteError:A=>{o({title:"Dataset deletion failed",message:A.message})}})}],data:p,state:{sorting:a},getCoreRowModel:ke(),getSortedRowModel:Rn(),onSortingChange:l,manualSorting:!0});u.useEffect(()=>{const S=a[0];u.startTransition(()=>{m({sort:S?Um(S):{col:"createdAt",dir:"desc"},after:null,first:Dl},{fetchPolicy:"store-and-network"})})},[a,m]);const k=b.getRowModel().rows,v=k.length===0;return e("div",{css:C`
2523
2523
  flex: 1 1 auto;
2524
2524
  overflow: auto;
2525
- `,onScroll:S=>y(S.target),ref:t,children:s("table",{css:Qn,children:[e("thead",{children:k.getHeaderGroups().map(S=>e("tr",{children:S.headers.map(L=>{var A;return e("th",{colSpan:L.colSpan,children:L.isPlaceholder?null:s("div",{className:L.column.getCanSort()?"cursor-pointer":"",onClick:L.column.getToggleSortingHandler(),style:{textAlign:(A=L.column.columnDef.meta)==null?void 0:A.textAlign},children:[Z(L.column.columnDef.header,L.getContext()),L.column.getIsSorted()?e(P,{className:"sort-icon",svg:L.column.getIsSorted()==="asc"?e(I.ArrowUpFilled,{}):e(I.ArrowDownFilled,{})}):null]})},L.id)})},S.id))}),v?e(Je,{}):e("tbody",{children:b.map(S=>e("tr",{onClick:()=>{const A=S.original.experimentCount>0?`${S.original.id}/experiments`:`${S.original.id}/examples`;i(A)},children:S.getVisibleCells().map(L=>{var A;return e("td",{align:(A=L.column.columnDef.meta)==null?void 0:A.textAlign,children:Z(L.column.columnDef.cell,L.getContext())},L.id)})},S.id))})]})})}function Uy(){return e(u.Suspense,{fallback:e(fe,{}),children:e(Hm,{})})}function Hm(){const[n,a]=u.useState(0),l=D.useLazyLoadQuery(br,{},{fetchKey:n,fetchPolicy:"store-and-network"}),t=u.useCallback(()=>{a(i=>i+1)},[a]);return s(h,{direction:"column",height:"100%",children:[e(F,{padding:"size-200",borderBottomWidth:"thin",borderBottomColor:"dark",flex:"none",children:s(h,{direction:"row",justifyContent:"space-between",children:[e(re,{level:1,children:"Datasets"}),e(Gm,{onDatasetCreated:t})]})}),e(Bm,{query:l})]})}function Gm({onDatasetCreated:n}){const a=ne(),l=oe(),t=ge(),[i,r]=u.useState(null),o=()=>{r(e(G,{size:"S",title:"New Dataset",children:e(el,{onDatasetCreated:d=>{l({title:"Dataset created",message:`${d.name} has been successfully created.`,action:{text:"Go to Dataset",onClick:()=>{a(`/datasets/${d.id}`)}}}),r(null),n()},onDatasetCreateError:d=>{t({title:"Dataset creation failed",message:d.message})}})}))},c=()=>{r(e(G,{size:"M",title:"New Dataset from CSV",children:e(Om,{onDatasetCreated:d=>{l({title:"Dataset created",message:`${d.name} has been successfully created.`,action:{text:"Go to Dataset",onClick:()=>{a(`/datasets/${d.id}`)}}}),r(null),n()},onDatasetCreateError:d=>{t({title:"Dataset creation failed",message:d.message})}})}))};return s(q,{children:[s(Be,{buttonText:"Create Dataset",align:"end",icon:e(P,{svg:e(I.DatabaseOutline,{})}),onAction:d=>{switch(d){case"newDataset":o();break;case"datasetFromCSV":c();break}},children:[e(U,{children:"New Dataset"},"newDataset"),e(U,{children:"Dataset from CSV"},"datasetFromCSV")]}),e(W,{type:"modal",isDismissable:!0,onDismiss:()=>r(null),children:i})]})}const Fr=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"datasetId"}],a=[{kind:"Variable",name:"id",variableName:"datasetId"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={kind:"InlineFragment",selections:[{alias:"latestVersions",args:[{kind:"Literal",name:"first",value:1},{kind:"Literal",name:"sort",value:{col:"createdAt",dir:"desc"}}],concreteType:"DatasetVersionConnection",kind:"LinkedField",name:"versions",plural:!1,selections:[{alias:null,args:null,concreteType:"DatasetVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"version",args:null,concreteType:"DatasetVersion",kind:"LinkedField",name:"node",plural:!1,selections:[l,{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:'versions(first:1,sort:{"col":"createdAt","dir":"desc"})'}],type:"Dataset",abstractKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"datasetStore_latestVersionQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,t],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"datasetStore_latestVersionQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l,t],storageKey:null}]},params:{cacheID:"d7075240e4dae8871997e57616c05302",id:null,metadata:{},name:"datasetStore_latestVersionQuery",operationKind:"query",text:`query datasetStore_latestVersionQuery(
2525
+ `,onScroll:S=>y(S.target),ref:t,children:s("table",{css:Qn,children:[e("thead",{children:b.getHeaderGroups().map(S=>e("tr",{children:S.headers.map(A=>{var L;return e("th",{colSpan:A.colSpan,children:A.isPlaceholder?null:s("div",{className:A.column.getCanSort()?"cursor-pointer":"",onClick:A.column.getToggleSortingHandler(),style:{textAlign:(L=A.column.columnDef.meta)==null?void 0:L.textAlign},children:[Z(A.column.columnDef.header,A.getContext()),A.column.getIsSorted()?e(P,{className:"sort-icon",svg:A.column.getIsSorted()==="asc"?e(I.ArrowUpFilled,{}):e(I.ArrowDownFilled,{})}):null]})},A.id)})},S.id))}),v?e(Je,{}):e("tbody",{children:k.map(S=>e("tr",{onClick:()=>{const L=S.original.experimentCount>0?`${S.original.id}/experiments`:`${S.original.id}/examples`;i(L)},children:S.getVisibleCells().map(A=>{var L;return e("td",{align:(L=A.column.columnDef.meta)==null?void 0:L.textAlign,children:Z(A.column.columnDef.cell,A.getContext())},A.id)})},S.id))})]})})}function Uy(){return e(u.Suspense,{fallback:e(fe,{}),children:e(Hm,{})})}function Hm(){const[n,a]=u.useState(0),l=D.useLazyLoadQuery(br,{},{fetchKey:n,fetchPolicy:"store-and-network"}),t=u.useCallback(()=>{a(i=>i+1)},[a]);return s(h,{direction:"column",height:"100%",children:[e(F,{padding:"size-200",borderBottomWidth:"thin",borderBottomColor:"dark",flex:"none",children:s(h,{direction:"row",justifyContent:"space-between",children:[e(re,{level:1,children:"Datasets"}),e(Gm,{onDatasetCreated:t})]})}),e(Bm,{query:l})]})}function Gm({onDatasetCreated:n}){const a=ne(),l=oe(),t=ce(),[i,r]=u.useState(null),o=()=>{r(e(G,{size:"S",title:"New Dataset",children:e(el,{onDatasetCreated:d=>{l({title:"Dataset created",message:`${d.name} has been successfully created.`,action:{text:"Go to Dataset",onClick:()=>{a(`/datasets/${d.id}`)}}}),r(null),n()},onDatasetCreateError:d=>{t({title:"Dataset creation failed",message:d.message})}})}))},c=()=>{r(e(G,{size:"M",title:"New Dataset from CSV",children:e(Om,{onDatasetCreated:d=>{l({title:"Dataset created",message:`${d.name} has been successfully created.`,action:{text:"Go to Dataset",onClick:()=>{a(`/datasets/${d.id}`)}}}),r(null),n()},onDatasetCreateError:d=>{t({title:"Dataset creation failed",message:d.message})}})}))};return s(q,{children:[s(Be,{buttonText:"Create Dataset",align:"end",icon:e(P,{svg:e(I.DatabaseOutline,{})}),onAction:d=>{switch(d){case"newDataset":o();break;case"datasetFromCSV":c();break}},children:[e(B,{children:"New Dataset"},"newDataset"),e(B,{children:"Dataset from CSV"},"datasetFromCSV")]}),e(W,{type:"modal",isDismissable:!0,onDismiss:()=>r(null),children:i})]})}const Fr=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"datasetId"}],a=[{kind:"Variable",name:"id",variableName:"datasetId"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={kind:"InlineFragment",selections:[{alias:"latestVersions",args:[{kind:"Literal",name:"first",value:1},{kind:"Literal",name:"sort",value:{col:"createdAt",dir:"desc"}}],concreteType:"DatasetVersionConnection",kind:"LinkedField",name:"versions",plural:!1,selections:[{alias:null,args:null,concreteType:"DatasetVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"version",args:null,concreteType:"DatasetVersion",kind:"LinkedField",name:"node",plural:!1,selections:[l,{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:'versions(first:1,sort:{"col":"createdAt","dir":"desc"})'}],type:"Dataset",abstractKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"datasetStore_latestVersionQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,t],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"datasetStore_latestVersionQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l,t],storageKey:null}]},params:{cacheID:"d7075240e4dae8871997e57616c05302",id:null,metadata:{},name:"datasetStore_latestVersionQuery",operationKind:"query",text:`query datasetStore_latestVersionQuery(
2526
2526
  $datasetId: GlobalID!
2527
2527
  ) {
2528
2528
  dataset: node(id: $datasetId) {
@@ -2551,7 +2551,7 @@ fragment DatasetsTable_datasets_dWkdd on Query {
2551
2551
  `}}}();xr.hash="8d99470f590cd5d28701fa6e3c0330e6";const Ra={backgroundColor:"light",borderColor:"light",collapsible:!0,bodyStyle:{padding:0}};function Xm(n){const{datasetId:a,onCompleted:l}=n,[t,i]=u.useState(null),[r,o]=D.useMutation(xr),{control:c,setError:d,handleSubmit:g,formState:{isValid:f}}=Ie({defaultValues:{input:"{}",output:"{}",metadata:"{}"}}),m=u.useCallback(p=>{if(i(null),!Oe(p==null?void 0:p.input))return d("input",{message:"Input must be a valid JSON object"});if(!Oe(p==null?void 0:p.output))return d("output",{message:"Output must be a valid JSON object"});if(!Oe(p==null?void 0:p.metadata))return d("metadata",{message:"Metadata must be a valid JSON object"});r({variables:{input:{datasetId:a,examples:[{input:JSON.parse(p.input),output:JSON.parse(p.output),metadata:JSON.parse(p.metadata)}],datasetVersionDescription:p.description}},onCompleted:()=>{l()},onError:y=>{i(y.message)}})},[r,a,d,l]);return s(G,{size:"L",title:"Add Example",children:[e("div",{css:C`
2552
2552
  overflow-y: auto;
2553
2553
  padding: var(--ac-global-dimension-size-400);
2554
- `,children:e(h,{direction:"row",justifyContent:"center",children:e(F,{width:"900px",paddingStart:"auto",paddingEnd:"auto",children:s(h,{direction:"column",gap:"size-200",children:[t?e(ee,{variant:"danger",children:t}):null,e(B,{control:c,name:"input",render:({field:{onChange:p,onBlur:y,value:k},fieldState:{invalid:b,error:v}})=>s(z,{title:"Input",subTitle:"The input to the LLM, retriever, program, etc.",...Ra,children:[b?e(ee,{variant:"danger",banner:!0,children:v==null?void 0:v.message}):null,e(Ee,{value:k,onChange:p,onBlur:y})]})}),e(B,{control:c,name:"output",render:({field:{onChange:p,onBlur:y,value:k},fieldState:{invalid:b,error:v}})=>s(z,{title:"Output",subTitle:"The output of the LLM or program to be used as an expected output",...Ra,backgroundColor:"green-100",borderColor:"green-700",children:[b?e(ee,{variant:"danger",banner:!0,children:v==null?void 0:v.message}):null,e(Ee,{value:k,onChange:p,onBlur:y})]})}),e(B,{control:c,name:"metadata",render:({field:{onChange:p,onBlur:y,value:k},fieldState:{invalid:b,error:v}})=>s(z,{title:"Metadata",subTitle:"All data from the span to use during experimentation or evaluation",...Ra,children:[b?e(ee,{variant:"danger",banner:!0,children:v==null?void 0:v.message}):null,e(Ee,{value:k,onChange:p,onBlur:y})]})}),e(B,{control:c,name:"description",render:({field:{onChange:p,onBlur:y,value:k},fieldState:{invalid:b,error:v}})=>e(ka,{label:"Version Description",value:k,onChange:p,onBlur:y,errorMessage:v==null?void 0:v.message,validationState:b?"invalid":"valid",placeholder:"A description of the changes made. Will be displayed in the version history.",height:100})})]})})})}),e(F,{padding:"size-200",borderTopColor:"light",borderTopWidth:"thin",children:e(h,{direction:"row",justifyContent:"end",gap:"size-100",children:e(M,{variant:"primary",size:"compact",disabled:!f||o,loading:o,onClick:g(m),children:"Add Example"})})})]})}function Ym(n){const{datasetId:a,onAddExampleCompleted:l}=n,[t,i]=u.useState(null),r=u.useCallback(()=>{i(e(Xm,{datasetId:a,onCompleted:()=>{l(),i(null)}}))},[a,l]);return s(q,{children:[e(M,{icon:e(P,{svg:e(I.PlusCircleOutline,{})}),size:"compact",variant:"default",onClick:r,children:"Add Example"}),e(W,{isDismissable:!0,onDismiss:()=>{i(null)},children:t})]})}function eg(){const n=vn(i=>i.datasetId),a=vn(i=>i.latestVersion);let l=`${Oa}/v1/datasets/${n}/examples`;a&&(l+=`?version-id=${a.id}`);const t=u.useMemo(()=>`import phoenix as px
2554
+ `,children:e(h,{direction:"row",justifyContent:"center",children:e(F,{width:"900px",paddingStart:"auto",paddingEnd:"auto",children:s(h,{direction:"column",gap:"size-200",children:[t?e(ee,{variant:"danger",children:t}):null,e(H,{control:c,name:"input",render:({field:{onChange:p,onBlur:y,value:b},fieldState:{invalid:k,error:v}})=>s(z,{title:"Input",subTitle:"The input to the LLM, retriever, program, etc.",...Ra,children:[k?e(ee,{variant:"danger",banner:!0,children:v==null?void 0:v.message}):null,e(Ee,{value:b,onChange:p,onBlur:y})]})}),e(H,{control:c,name:"output",render:({field:{onChange:p,onBlur:y,value:b},fieldState:{invalid:k,error:v}})=>s(z,{title:"Output",subTitle:"The output of the LLM or program to be used as an expected output",...Ra,backgroundColor:"green-100",borderColor:"green-700",children:[k?e(ee,{variant:"danger",banner:!0,children:v==null?void 0:v.message}):null,e(Ee,{value:b,onChange:p,onBlur:y})]})}),e(H,{control:c,name:"metadata",render:({field:{onChange:p,onBlur:y,value:b},fieldState:{invalid:k,error:v}})=>s(z,{title:"Metadata",subTitle:"All data from the span to use during experimentation or evaluation",...Ra,children:[k?e(ee,{variant:"danger",banner:!0,children:v==null?void 0:v.message}):null,e(Ee,{value:b,onChange:p,onBlur:y})]})}),e(H,{control:c,name:"description",render:({field:{onChange:p,onBlur:y,value:b},fieldState:{invalid:k,error:v}})=>e(ka,{label:"Version Description",value:b,onChange:p,onBlur:y,errorMessage:v==null?void 0:v.message,validationState:k?"invalid":"valid",placeholder:"A description of the changes made. Will be displayed in the version history.",height:100})})]})})})}),e(F,{padding:"size-200",borderTopColor:"light",borderTopWidth:"thin",children:e(h,{direction:"row",justifyContent:"end",gap:"size-100",children:e(M,{variant:"primary",size:"compact",disabled:!f||o,loading:o,onClick:g(m),children:"Add Example"})})})]})}function Ym(n){const{datasetId:a,onAddExampleCompleted:l}=n,[t,i]=u.useState(null),r=u.useCallback(()=>{i(e(Xm,{datasetId:a,onCompleted:()=>{l(),i(null)}}))},[a,l]);return s(q,{children:[e(M,{icon:e(P,{svg:e(I.PlusCircleOutline,{})}),size:"compact",variant:"default",onClick:r,children:"Add Example"}),e(W,{isDismissable:!0,onDismiss:()=>{i(null)},children:t})]})}function eg(){const n=vn(i=>i.datasetId),a=vn(i=>i.latestVersion);let l=`${Oa}/v1/datasets/${n}/examples`;a&&(l+=`?version-id=${a.id}`);const t=u.useMemo(()=>`import phoenix as px
2555
2555
  client = px.Client()
2556
2556
  # Get the current dataset version
2557
2557
  dataset = client.get_dataset(id="${n}"${a?`, version_id="${a.id}"`:""})`,[n,a]);return e("div",{css:C`
@@ -2629,7 +2629,7 @@ fragment DatasetHistoryTable_versions_2HEEH6 on Dataset {
2629
2629
  }
2630
2630
  id
2631
2631
  }
2632
- `}}}();Tr.hash="37e453bc58759a1e89bc5862c460de6b";const Ir=function(){var n=["versions"],a={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:100,kind:"LocalArgument",name:"first"}],kind:"Fragment",metadata:{connection:[{count:"first",cursor:"after",direction:"forward",path:n}],refetch:{connection:{forward:{count:"first",cursor:"after"},backward:null,path:n},fragmentPathInResult:["node"],operation:Tr,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"DatasetHistoryTable_versions",selections:[{alias:"versions",args:null,concreteType:"DatasetVersionConnection",kind:"LinkedField",name:"__DatasetHistoryTable_versions_connection",plural:!1,selections:[{alias:null,args:null,concreteType:"DatasetVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"DatasetVersion",kind:"LinkedField",name:"node",plural:!1,selections:[a,{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},a],type:"Dataset",abstractKey:null}}();Ir.hash="37e453bc58759a1e89bc5862c460de6b";const ng=100;function ag(n){const a=u.useRef(null),{data:l,loadNext:t,hasNext:i,isLoadingNext:r}=D.usePaginationFragment(Ir,n.dataset),o=u.useMemo(()=>l.versions.edges.map(m=>m.node),[l]),c=Ke.useCallback(m=>{if(m){const{scrollHeight:p,scrollTop:y,clientHeight:k}=m;p-y-k<300&&!r&&i&&t(ng)}},[i,r,t]),d=he({columns:[{header:"version ID",accessorKey:"id"},{header:"description",accessorKey:"description"},{header:"created at",accessorKey:"createdAt",cell:Fe}],data:o,getCoreRowModel:ke(),getSortedRowModel:Rn()}),g=d.getRowModel().rows,f=g.length===0;return e("div",{css:C`
2632
+ `}}}();Tr.hash="37e453bc58759a1e89bc5862c460de6b";const Ir=function(){var n=["versions"],a={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:100,kind:"LocalArgument",name:"first"}],kind:"Fragment",metadata:{connection:[{count:"first",cursor:"after",direction:"forward",path:n}],refetch:{connection:{forward:{count:"first",cursor:"after"},backward:null,path:n},fragmentPathInResult:["node"],operation:Tr,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"DatasetHistoryTable_versions",selections:[{alias:"versions",args:null,concreteType:"DatasetVersionConnection",kind:"LinkedField",name:"__DatasetHistoryTable_versions_connection",plural:!1,selections:[{alias:null,args:null,concreteType:"DatasetVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:null,args:null,concreteType:"DatasetVersion",kind:"LinkedField",name:"node",plural:!1,selections:[a,{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},a],type:"Dataset",abstractKey:null}}();Ir.hash="37e453bc58759a1e89bc5862c460de6b";const ng=100;function ag(n){const a=u.useRef(null),{data:l,loadNext:t,hasNext:i,isLoadingNext:r}=D.usePaginationFragment(Ir,n.dataset),o=u.useMemo(()=>l.versions.edges.map(m=>m.node),[l]),c=Ke.useCallback(m=>{if(m){const{scrollHeight:p,scrollTop:y,clientHeight:b}=m;p-y-b<300&&!r&&i&&t(ng)}},[i,r,t]),d=he({columns:[{header:"version ID",accessorKey:"id"},{header:"description",accessorKey:"description"},{header:"created at",accessorKey:"createdAt",cell:Fe}],data:o,getCoreRowModel:ke(),getSortedRowModel:Rn()}),g=d.getRowModel().rows,f=g.length===0;return e("div",{css:C`
2633
2633
  flex: 1 1 auto;
2634
2634
  overflow: auto;
2635
2635
  `,onScroll:m=>c(m.target),ref:a,children:s("table",{css:We,children:[e("thead",{children:d.getHeaderGroups().map(m=>e("tr",{children:m.headers.map(p=>e("th",{colSpan:p.colSpan,children:p.isPlaceholder?null:s("div",{className:p.column.getCanSort()?"cursor-pointer":"",onClick:p.column.getToggleSortingHandler(),style:{left:p.getStart(),width:p.getSize()},children:[Z(p.column.columnDef.header,p.getContext()),p.column.getIsSorted()?e(P,{className:"sort-icon",svg:p.column.getIsSorted()==="asc"?e(I.ArrowUpFilled,{}):e(I.ArrowDownFilled,{})}):null]})},p.id))},m.id))}),f?e(Je,{}):e("tbody",{children:g.map(m=>e("tr",{children:m.getVisibleCells().map(p=>e("td",{children:Z(p.column.columnDef.cell,p.getContext())},p.id))},m.id))})]})})}function lg(n){const{datasetId:a}=n,l=D.useLazyLoadQuery(Dr,{datasetId:a});return e(G,{size:"L",title:"Dataset History",children:e("div",{css:C`
@@ -2681,7 +2681,7 @@ dataset = client.get_dataset(name="${n}"${a?`, version_id="${a.id}"`:""})`,[n,a]
2681
2681
  }
2682
2682
  }
2683
2683
  }
2684
- `;function mg({dataset:n}){const a=n.id,l=vn(d=>d.refreshLatestVersion),t=oe(),i=ne(),r=u.useCallback(d=>{d===0?i(`/datasets/${a}/experiments`):d===1&&i(`/datasets/${a}/examples`)},[i,a]),c=Hs().pathname.includes("examples")?1:0;return s("main",{css:ug,children:[e(F,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-200",paddingBottom:"size-50",flex:"none",children:s(h,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e(h,{direction:"column",justifyContent:"space-between",children:e(h,{direction:"row",gap:"size-200",alignItems:"center",children:s(h,{direction:"column",children:[e(K,{elementType:"h1",textSize:"xlarge",weight:"heavy",children:n.name}),e(K,{color:"text-700",children:n.description||"--"})]})})}),s(h,{direction:"row",gap:"size-100",children:[s(Be,{align:"end",icon:e(P,{svg:e(I.DownloadOutline,{})}),onAction:d=>{switch(d){case"csv":window.open(`/v1/datasets/${n.id}/csv`,"_blank");break;case"openai-ft":window.open(`/v1/datasets/${n.id}/jsonl/openai_ft`,"_blank");break;case"openai-evals":window.open(`/v1/datasets/${n.id}/jsonl/openai_evals`,"_blank");break}},children:[e(U,{children:"Download CSV"},"csv"),e(U,{children:"Download OpenAI Fine-Tuning JSONL"},"openai-ft"),e(U,{children:"Download OpenAI Evals JSONL"},"openai-evals")]}),e(tg,{datasetId:n.id}),e(eg,{}),e(Lr,{}),e(Ym,{datasetId:n.id,onAddExampleCompleted:()=>{t({title:"Example added",message:"The example has been added successfully and the version has been updated."}),l()}})]})]})}),s(Te,{onChange:r,defaultIndex:c,children:[e(J,{name:"Experiments",extra:e(Re,{children:n.experimentCount}),children:e(u.Suspense,{children:e(Pe,{})})}),e(J,{name:"Examples",extra:e(Re,{children:n.exampleCount}),children:e(u.Suspense,{children:e(Pe,{})})})]})]})}const Pr=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},i={kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},t,{alias:null,args:null,kind:"ScalarField",name:"exampleCount",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"experimentCount",storageKey:null},{alias:"latestVersions",args:[{kind:"Literal",name:"first",value:1},{kind:"Literal",name:"sort",value:{col:"createdAt",dir:"desc"}}],concreteType:"DatasetVersionConnection",kind:"LinkedField",name:"versions",plural:!1,selections:[{alias:null,args:null,concreteType:"DatasetVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"version",args:null,concreteType:"DatasetVersion",kind:"LinkedField",name:"node",plural:!1,selections:[l,t,{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:'versions(first:1,sort:{"col":"createdAt","dir":"desc"})'}],type:"Dataset",abstractKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"datasetLoaderQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,i],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"datasetLoaderQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l,i],storageKey:null}]},params:{cacheID:"5b221627cf7e63f41fbec41027cc0951",id:null,metadata:{},name:"datasetLoaderQuery",operationKind:"query",text:`query datasetLoaderQuery(
2684
+ `;function mg({dataset:n}){const a=n.id,l=vn(d=>d.refreshLatestVersion),t=oe(),i=ne(),r=u.useCallback(d=>{d===0?i(`/datasets/${a}/experiments`):d===1&&i(`/datasets/${a}/examples`)},[i,a]),c=Hs().pathname.includes("examples")?1:0;return s("main",{css:ug,children:[e(F,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-200",paddingBottom:"size-50",flex:"none",children:s(h,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e(h,{direction:"column",justifyContent:"space-between",children:e(h,{direction:"row",gap:"size-200",alignItems:"center",children:s(h,{direction:"column",children:[e(K,{elementType:"h1",textSize:"xlarge",weight:"heavy",children:n.name}),e(K,{color:"text-700",children:n.description||"--"})]})})}),s(h,{direction:"row",gap:"size-100",children:[s(Be,{align:"end",icon:e(P,{svg:e(I.DownloadOutline,{})}),onAction:d=>{switch(d){case"csv":window.open(`/v1/datasets/${n.id}/csv`,"_blank");break;case"openai-ft":window.open(`/v1/datasets/${n.id}/jsonl/openai_ft`,"_blank");break;case"openai-evals":window.open(`/v1/datasets/${n.id}/jsonl/openai_evals`,"_blank");break}},children:[e(B,{children:"Download CSV"},"csv"),e(B,{children:"Download OpenAI Fine-Tuning JSONL"},"openai-ft"),e(B,{children:"Download OpenAI Evals JSONL"},"openai-evals")]}),e(tg,{datasetId:n.id}),e(eg,{}),e(Lr,{}),e(Ym,{datasetId:n.id,onAddExampleCompleted:()=>{t({title:"Example added",message:"The example has been added successfully and the version has been updated."}),l()}})]})]})}),s(Te,{onChange:r,defaultIndex:c,children:[e(J,{name:"Experiments",extra:e(Re,{children:n.experimentCount}),children:e(u.Suspense,{children:e(Pe,{})})}),e(J,{name:"Examples",extra:e(Re,{children:n.exampleCount}),children:e(u.Suspense,{children:e(Pe,{})})})]})]})}const Pr=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},i={kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},t,{alias:null,args:null,kind:"ScalarField",name:"exampleCount",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"experimentCount",storageKey:null},{alias:"latestVersions",args:[{kind:"Literal",name:"first",value:1},{kind:"Literal",name:"sort",value:{col:"createdAt",dir:"desc"}}],concreteType:"DatasetVersionConnection",kind:"LinkedField",name:"versions",plural:!1,selections:[{alias:null,args:null,concreteType:"DatasetVersionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"version",args:null,concreteType:"DatasetVersion",kind:"LinkedField",name:"node",plural:!1,selections:[l,t,{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:'versions(first:1,sort:{"col":"createdAt","dir":"desc"})'}],type:"Dataset",abstractKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"datasetLoaderQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,i],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"datasetLoaderQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l,i],storageKey:null}]},params:{cacheID:"5b221627cf7e63f41fbec41027cc0951",id:null,metadata:{},name:"datasetLoaderQuery",operationKind:"query",text:`query datasetLoaderQuery(
2685
2685
  $id: GlobalID!
2686
2686
  ) {
2687
2687
  dataset: node(id: $id) {
@@ -2793,7 +2793,7 @@ fragment ExampleExperimentRunsTableFragment on DatasetExample {
2793
2793
  width: 100%;
2794
2794
  }
2795
2795
  }
2796
- `,children:e(h,{direction:"row",justifyContent:"center",children:e(F,{width:"900px",paddingStart:"auto",paddingEnd:"auto",children:s(h,{direction:"column",gap:"size-200",children:[t?e(ee,{variant:"danger",children:t}):null,e(B,{control:c,name:"input",render:({field:{onChange:p,onBlur:y,value:k},fieldState:{invalid:b,error:v}})=>s(z,{title:"Input",subTitle:"The input to the LLM, retriever, program, etc.",...Ma,children:[b?e(ee,{variant:"danger",banner:!0,children:v==null?void 0:v.message}):null,e(Ee,{value:k,onChange:p,onBlur:y})]})}),e(B,{control:c,name:"output",render:({field:{onChange:p,onBlur:y,value:k},fieldState:{invalid:b,error:v}})=>s(z,{title:"Output",subTitle:"The output of the LLM or program to be used as an expected output",...Ma,backgroundColor:"green-100",borderColor:"green-700",children:[b?e(ee,{variant:"danger",banner:!0,children:v==null?void 0:v.message}):null,e(Ee,{value:k,onChange:p,onBlur:y})]})}),e(B,{control:c,name:"metadata",render:({field:{onChange:p,onBlur:y,value:k},fieldState:{invalid:b,error:v}})=>s(z,{title:"Metadata",subTitle:"All data from the span to use during experimentation or evaluation",...Ma,children:[b?e(ee,{variant:"danger",banner:!0,children:v==null?void 0:v.message}):null,e(Ee,{value:k,onChange:p,onBlur:y})]})}),e(B,{control:c,name:"description",render:({field:{onChange:p,onBlur:y,value:k},fieldState:{invalid:b,error:v}})=>e(ka,{label:"Revision Description",value:k,onChange:p,onBlur:y,errorMessage:v==null?void 0:v.message,validationState:b?"invalid":"valid",placeholder:"A description of the changes made in this revision. Will be displayed in the version history.",height:100})})]})})})})})}function pg(n){const{onCompleted:a,...l}=n,[t,i]=u.useState(null);return s(q,{children:[e(M,{variant:"default",size:"compact",icon:e(P,{svg:e(I.EditOutline,{})}),onClick:()=>i(e(gg,{...l,onCompleted:()=>{i(null),a()}})),children:"Edit Example"}),e(W,{type:"slideOver",isDismissable:!0,onDismiss:()=>i(null),children:t})]})}const _r=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:100,kind:"LocalArgument",name:"first"},{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l=[{kind:"Variable",name:"after",variableName:"after"},{kind:"Variable",name:"first",variableName:"first"}],t={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},r={alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"projectId",storageKey:null}],storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ExampleExperimentRunsTableQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:l,kind:"FragmentSpread",name:"ExampleExperimentRunsTableFragment"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ExampleExperimentRunsTableQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[t,{kind:"TypeDiscriminator",abstractKey:"__isNode"},i,{kind:"InlineFragment",selections:[{alias:null,args:l,concreteType:"ExperimentRunConnection",kind:"LinkedField",name:"experimentRuns",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentRunEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"run",args:null,concreteType:"ExperimentRun",kind:"LinkedField",name:"node",plural:!1,selections:[i,{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"endTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"error",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"output",storageKey:null},r,{alias:null,args:null,concreteType:"ExperimentRunAnnotationConnection",kind:"LinkedField",name:"annotations",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentRunAnnotationEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"annotation",args:null,concreteType:"ExperimentRunAnnotation",kind:"LinkedField",name:"node",plural:!1,selections:[i,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"explanation",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null},r],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"ExperimentRun",kind:"LinkedField",name:"node",plural:!1,selections:[t],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:l,filters:null,handle:"connection",key:"ExampleExperimentRunsTable_experimentRuns",kind:"LinkedHandle",name:"experimentRuns"}],type:"DatasetExample",abstractKey:null}],storageKey:null}]},params:{cacheID:"2ec7ead16e6df0877bc47db0ed7c7553",id:null,metadata:{},name:"ExampleExperimentRunsTableQuery",operationKind:"query",text:`query ExampleExperimentRunsTableQuery(
2796
+ `,children:e(h,{direction:"row",justifyContent:"center",children:e(F,{width:"900px",paddingStart:"auto",paddingEnd:"auto",children:s(h,{direction:"column",gap:"size-200",children:[t?e(ee,{variant:"danger",children:t}):null,e(H,{control:c,name:"input",render:({field:{onChange:p,onBlur:y,value:b},fieldState:{invalid:k,error:v}})=>s(z,{title:"Input",subTitle:"The input to the LLM, retriever, program, etc.",...Ma,children:[k?e(ee,{variant:"danger",banner:!0,children:v==null?void 0:v.message}):null,e(Ee,{value:b,onChange:p,onBlur:y})]})}),e(H,{control:c,name:"output",render:({field:{onChange:p,onBlur:y,value:b},fieldState:{invalid:k,error:v}})=>s(z,{title:"Output",subTitle:"The output of the LLM or program to be used as an expected output",...Ma,backgroundColor:"green-100",borderColor:"green-700",children:[k?e(ee,{variant:"danger",banner:!0,children:v==null?void 0:v.message}):null,e(Ee,{value:b,onChange:p,onBlur:y})]})}),e(H,{control:c,name:"metadata",render:({field:{onChange:p,onBlur:y,value:b},fieldState:{invalid:k,error:v}})=>s(z,{title:"Metadata",subTitle:"All data from the span to use during experimentation or evaluation",...Ma,children:[k?e(ee,{variant:"danger",banner:!0,children:v==null?void 0:v.message}):null,e(Ee,{value:b,onChange:p,onBlur:y})]})}),e(H,{control:c,name:"description",render:({field:{onChange:p,onBlur:y,value:b},fieldState:{invalid:k,error:v}})=>e(ka,{label:"Revision Description",value:b,onChange:p,onBlur:y,errorMessage:v==null?void 0:v.message,validationState:k?"invalid":"valid",placeholder:"A description of the changes made in this revision. Will be displayed in the version history.",height:100})})]})})})})})}function pg(n){const{onCompleted:a,...l}=n,[t,i]=u.useState(null);return s(q,{children:[e(M,{variant:"default",size:"compact",icon:e(P,{svg:e(I.EditOutline,{})}),onClick:()=>i(e(gg,{...l,onCompleted:()=>{i(null),a()}})),children:"Edit Example"}),e(W,{type:"slideOver",isDismissable:!0,onDismiss:()=>i(null),children:t})]})}const _r=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:100,kind:"LocalArgument",name:"first"},{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l=[{kind:"Variable",name:"after",variableName:"after"},{kind:"Variable",name:"first",variableName:"first"}],t={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},r={alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"projectId",storageKey:null}],storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ExampleExperimentRunsTableQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:l,kind:"FragmentSpread",name:"ExampleExperimentRunsTableFragment"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ExampleExperimentRunsTableQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[t,{kind:"TypeDiscriminator",abstractKey:"__isNode"},i,{kind:"InlineFragment",selections:[{alias:null,args:l,concreteType:"ExperimentRunConnection",kind:"LinkedField",name:"experimentRuns",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentRunEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"run",args:null,concreteType:"ExperimentRun",kind:"LinkedField",name:"node",plural:!1,selections:[i,{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"endTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"error",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"output",storageKey:null},r,{alias:null,args:null,concreteType:"ExperimentRunAnnotationConnection",kind:"LinkedField",name:"annotations",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentRunAnnotationEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"annotation",args:null,concreteType:"ExperimentRunAnnotation",kind:"LinkedField",name:"node",plural:!1,selections:[i,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"explanation",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null},r],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"ExperimentRun",kind:"LinkedField",name:"node",plural:!1,selections:[t],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:l,filters:null,handle:"connection",key:"ExampleExperimentRunsTable_experimentRuns",kind:"LinkedHandle",name:"experimentRuns"}],type:"DatasetExample",abstractKey:null}],storageKey:null}]},params:{cacheID:"2ec7ead16e6df0877bc47db0ed7c7553",id:null,metadata:{},name:"ExampleExperimentRunsTableQuery",operationKind:"query",text:`query ExampleExperimentRunsTableQuery(
2797
2797
  $after: String = null
2798
2798
  $first: Int = 100
2799
2799
  $id: GlobalID!
@@ -2857,13 +2857,13 @@ fragment ExampleExperimentRunsTableFragment_2HEEH6 on DatasetExample {
2857
2857
  align-items: center;
2858
2858
  color: var(--ac-global-color-primary);
2859
2859
  gap: var(--ac-global-dimension-size-50);
2860
- `;function kg({example:n}){const a=u.useRef(null),l=ne(),{data:t,loadNext:i,hasNext:r,isLoadingNext:o}=D.usePaginationFragment(Er,n),c=u.useMemo(()=>t.experimentRuns.edges.map(y=>{let k=null;return y.run.startTime&&y.run.endTime&&(k=new Date(y.run.endTime).getTime()-new Date(y.run.startTime).getTime()),{...y.run,output:JSON.stringify(y.run.output),latencyMs:k}}),[t]),g=he({columns:[{header:"start time",accessorKey:"startTime",cell:Fe},{header:"output",accessorKey:"output",cell:y=>{var b;const k=(b=y.row.original)==null?void 0:b.error;return k!==null?e(K,{color:"danger",children:k}):e(ue,{...y})}},{header:"latency",accessorKey:"latencyMs",cell:({getValue:y})=>{const k=y();return k===null||typeof k!="number"?"--":e(Me,{latencyMs:k})}},{header:"evaluations",accessorKey:"annotations",cell:({row:y})=>e(h,{direction:"row",gap:"size-50",wrap:"wrap",children:y.original.annotations.edges.map((k,b)=>{const v=k.annotation;return e(ia,{annotation:v,extra:v.trace&&e(F,{paddingTop:"size-100",children:s("div",{css:hg,children:[e(P,{svg:e(I.InfoOutline,{})}),e("span",{children:"Click to view evaluator trace"})]})}),children:e(xn,{annotation:v,onClick:()=>{v.trace&&l(`/projects/${v.trace.projectId}/traces/${v.trace.traceId}`)}},b)},b)})})},{id:"actions",cell:({row:y})=>{const k=y.original.trace;if(k)return e(M,{variant:"default",size:"compact",icon:e(P,{svg:e(I.Trace,{})}),onClick:()=>{l(`/projects/${k.projectId}/traces/${k.traceId}`)},"aria-label":"view trace"})}}],data:c,getCoreRowModel:ke()}),f=g.getRowModel().rows,m=f.length===0,p=u.useCallback(y=>{if(y){const{scrollHeight:k,scrollTop:b,clientHeight:v}=y;k-b-v<300&&!o&&r&&i(yg)}},[r,o,i]);return e("div",{css:C`
2860
+ `;function kg({example:n}){const a=u.useRef(null),l=ne(),{data:t,loadNext:i,hasNext:r,isLoadingNext:o}=D.usePaginationFragment(Er,n),c=u.useMemo(()=>t.experimentRuns.edges.map(y=>{let b=null;return y.run.startTime&&y.run.endTime&&(b=new Date(y.run.endTime).getTime()-new Date(y.run.startTime).getTime()),{...y.run,output:JSON.stringify(y.run.output),latencyMs:b}}),[t]),g=he({columns:[{header:"start time",accessorKey:"startTime",cell:Fe},{header:"output",accessorKey:"output",cell:y=>{var k;const b=(k=y.row.original)==null?void 0:k.error;return b!==null?e(K,{color:"danger",children:b}):e(me,{...y})}},{header:"latency",accessorKey:"latencyMs",cell:({getValue:y})=>{const b=y();return b===null||typeof b!="number"?"--":e(Me,{latencyMs:b})}},{header:"evaluations",accessorKey:"annotations",cell:({row:y})=>e(h,{direction:"row",gap:"size-50",wrap:"wrap",children:y.original.annotations.edges.map((b,k)=>{const v=b.annotation;return e(ia,{annotation:v,extra:v.trace&&e(F,{paddingTop:"size-100",children:s("div",{css:hg,children:[e(P,{svg:e(I.InfoOutline,{})}),e("span",{children:"Click to view evaluator trace"})]})}),children:e(xn,{annotation:v,onClick:()=>{v.trace&&l(`/projects/${v.trace.projectId}/traces/${v.trace.traceId}`)}},k)},k)})})},{id:"actions",cell:({row:y})=>{const b=y.original.trace;if(b)return e(M,{variant:"default",size:"compact",icon:e(P,{svg:e(I.Trace,{})}),onClick:()=>{l(`/projects/${b.projectId}/traces/${b.traceId}`)},"aria-label":"view trace"})}}],data:c,getCoreRowModel:ke()}),f=g.getRowModel().rows,m=f.length===0,p=u.useCallback(y=>{if(y){const{scrollHeight:b,scrollTop:k,clientHeight:v}=y;b-k-v<300&&!o&&r&&i(yg)}},[r,o,i]);return e("div",{css:C`
2861
2861
  flex: 1 1 auto;
2862
2862
  overflow: auto;
2863
- `,ref:a,onScroll:y=>p(y.target),children:s("table",{css:Qn,children:[e("thead",{children:g.getHeaderGroups().map(y=>e("tr",{children:y.headers.map(k=>e("th",{children:e("div",{children:Z(k.column.columnDef.header,k.getContext())})},k.id))},y.id))}),m?e(fg,{}):e("tbody",{children:f.map(y=>e("tr",{children:y.getVisibleCells().map(k=>e("td",{children:Z(k.column.columnDef.cell,k.getContext())},k.id))},y.id))})]})})}function Rr({exampleId:n,onDismiss:a}){const[l,t]=u.useState(0),i=D.useLazyLoadQuery(Ar,{exampleId:n},{fetchKey:l,fetchPolicy:"store-and-network"}),r=u.useMemo(()=>{const p=i.example.latestRevision;return{input:JSON.stringify(p==null?void 0:p.input,null,2),output:JSON.stringify(p==null?void 0:p.output,null,2),metadata:JSON.stringify(p==null?void 0:p.metadata,null,2)}},[i]),o=u.useMemo(()=>{const p=i.example.span;return p?{id:p.id,traceId:p.context.traceId,projectId:p.project.id}:null},[i]),{input:c,output:d,metadata:g}=r,f=ne(),m=oe();return e(W,{type:"slideOver",isDismissable:!0,onDismiss:a,children:e(G,{size:"XL",title:`Example: ${n}`,extra:s(h,{direction:"row",gap:"size-100",children:[o?e(M,{variant:"default",size:"compact",onClick:()=>{f(`/projects/${o.projectId}/traces/${o.traceId}?selectedSpanNodeId=${o.id}`)},children:"View Source Span"}):null,e(pg,{exampleId:n,currentRevision:r,onCompleted:()=>{m({title:"Example updated",message:`Example ${n} has been updated.`}),t(p=>p+1)}})]}),children:s(Xe,{direction:"vertical",autoSaveId:"example-panel-group",children:[e(ce,{defaultSize:200,children:e("div",{css:C`
2863
+ `,ref:a,onScroll:y=>p(y.target),children:s("table",{css:Qn,children:[e("thead",{children:g.getHeaderGroups().map(y=>e("tr",{children:y.headers.map(b=>e("th",{children:e("div",{children:Z(b.column.columnDef.header,b.getContext())})},b.id))},y.id))}),m?e(fg,{}):e("tbody",{children:f.map(y=>e("tr",{children:y.getVisibleCells().map(b=>e("td",{children:Z(b.column.columnDef.cell,b.getContext())},b.id))},y.id))})]})})}function Rr({exampleId:n,onDismiss:a}){const[l,t]=u.useState(0),i=D.useLazyLoadQuery(Ar,{exampleId:n},{fetchKey:l,fetchPolicy:"store-and-network"}),r=u.useMemo(()=>{const p=i.example.latestRevision;return{input:JSON.stringify(p==null?void 0:p.input,null,2),output:JSON.stringify(p==null?void 0:p.output,null,2),metadata:JSON.stringify(p==null?void 0:p.metadata,null,2)}},[i]),o=u.useMemo(()=>{const p=i.example.span;return p?{id:p.id,traceId:p.context.traceId,projectId:p.project.id}:null},[i]),{input:c,output:d,metadata:g}=r,f=ne(),m=oe();return e(W,{type:"slideOver",isDismissable:!0,onDismiss:a,children:e(G,{size:"XL",title:`Example: ${n}`,extra:s(h,{direction:"row",gap:"size-100",children:[o?e(M,{variant:"default",size:"compact",onClick:()=>{f(`/projects/${o.projectId}/traces/${o.traceId}?selectedSpanNodeId=${o.id}`)},children:"View Source Span"}):null,e(pg,{exampleId:n,currentRevision:r,onCompleted:()=>{m({title:"Example updated",message:`Example ${n} has been updated.`}),t(p=>p+1)}})]}),children:s(Xe,{direction:"vertical",autoSaveId:"example-panel-group",children:[e(ue,{defaultSize:200,children:e("div",{css:C`
2864
2864
  overflow-y: auto;
2865
2865
  height: 100%;
2866
- `,children:e(h,{direction:"row",justifyContent:"center",children:e(F,{width:"900px",paddingStart:"auto",paddingEnd:"auto",paddingTop:"size-200",paddingBottom:"size-200",children:s(h,{direction:"column",gap:"size-200",children:[e(z,{title:"Input",...Na,extra:e(le,{text:c}),children:e(fn,{value:c})}),e(z,{title:"Output",...Na,extra:e(le,{text:d}),children:e(fn,{value:d})}),e(z,{title:"Metadata",...Na,extra:e(le,{text:g}),children:e(fn,{value:g})})]})})})})}),e(Ye,{css:Kn}),e(ce,{defaultSize:100,children:s(h,{direction:"column",height:"100%",children:[e(F,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderBottomColor:"dark",borderBottomWidth:"thin",flex:"none",children:e(re,{level:3,children:"Experiment Runs"})}),e(kg,{example:i.example})]})})]})})})}const Na={backgroundColor:"light",borderColor:"light",variant:"compact",collapsible:!0,bodyStyle:{padding:0}};function Gy(){const{exampleId:n,datasetId:a}=ln(),l=ne();return e(Rr,{exampleId:n,onDismiss:()=>{l(`/datasets/${a}/examples`)}})}const Mr=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},i=[{kind:"Literal",name:"first",value:100}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"examplesLoaderQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{args:null,kind:"FragmentSpread",name:"ExamplesTableFragment"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"examplesLoaderQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[t,l,{kind:"InlineFragment",selections:[{alias:null,args:i,concreteType:"DatasetExampleConnection",kind:"LinkedField",name:"examples",plural:!1,selections:[{alias:null,args:null,concreteType:"DatasetExampleEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"example",args:null,concreteType:"DatasetExample",kind:"LinkedField",name:"node",plural:!1,selections:[l,{alias:null,args:null,concreteType:"DatasetExampleRevision",kind:"LinkedField",name:"revision",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"input",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"output",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"DatasetExample",kind:"LinkedField",name:"node",plural:!1,selections:[t],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:"examples(first:100)"},{alias:null,args:i,filters:["datasetVersionId"],handle:"connection",key:"ExamplesTable_examples",kind:"LinkedHandle",name:"examples"}],type:"Dataset",abstractKey:null}],storageKey:null}]},params:{cacheID:"7e303fa9a3c09ccd6a3dc1f3dbb2afb3",id:null,metadata:{},name:"examplesLoaderQuery",operationKind:"query",text:`query examplesLoaderQuery(
2866
+ `,children:e(h,{direction:"row",justifyContent:"center",children:e(F,{width:"900px",paddingStart:"auto",paddingEnd:"auto",paddingTop:"size-200",paddingBottom:"size-200",children:s(h,{direction:"column",gap:"size-200",children:[e(z,{title:"Input",...Na,extra:e(le,{text:c}),children:e(fn,{value:c})}),e(z,{title:"Output",...Na,extra:e(le,{text:d}),children:e(fn,{value:d})}),e(z,{title:"Metadata",...Na,extra:e(le,{text:g}),children:e(fn,{value:g})})]})})})})}),e(Ye,{css:Kn}),e(ue,{defaultSize:100,children:s(h,{direction:"column",height:"100%",children:[e(F,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderBottomColor:"dark",borderBottomWidth:"thin",flex:"none",children:e(re,{level:3,children:"Experiment Runs"})}),e(kg,{example:i.example})]})})]})})})}const Na={backgroundColor:"light",borderColor:"light",variant:"compact",collapsible:!0,bodyStyle:{padding:0}};function Gy(){const{exampleId:n,datasetId:a}=ln(),l=ne();return e(Rr,{exampleId:n,onDismiss:()=>{l(`/datasets/${a}/examples`)}})}const Mr=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},i=[{kind:"Literal",name:"first",value:100}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"examplesLoaderQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{args:null,kind:"FragmentSpread",name:"ExamplesTableFragment"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"examplesLoaderQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[t,l,{kind:"InlineFragment",selections:[{alias:null,args:i,concreteType:"DatasetExampleConnection",kind:"LinkedField",name:"examples",plural:!1,selections:[{alias:null,args:null,concreteType:"DatasetExampleEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"example",args:null,concreteType:"DatasetExample",kind:"LinkedField",name:"node",plural:!1,selections:[l,{alias:null,args:null,concreteType:"DatasetExampleRevision",kind:"LinkedField",name:"revision",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"input",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"output",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"DatasetExample",kind:"LinkedField",name:"node",plural:!1,selections:[t],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:"examples(first:100)"},{alias:null,args:i,filters:["datasetVersionId"],handle:"connection",key:"ExamplesTable_examples",kind:"LinkedHandle",name:"examples"}],type:"Dataset",abstractKey:null}],storageKey:null}]},params:{cacheID:"7e303fa9a3c09ccd6a3dc1f3dbb2afb3",id:null,metadata:{},name:"examplesLoaderQuery",operationKind:"query",text:`query examplesLoaderQuery(
2867
2867
  $id: GlobalID!
2868
2868
  ) {
2869
2869
  dataset: node(id: $id) {
@@ -2942,15 +2942,15 @@ fragment ExamplesTableFragment_4a6F8Z on Dataset {
2942
2942
  }
2943
2943
  }
2944
2944
  }
2945
- `}}}();Vr.hash="455bf9e5dc4b9cc655095dc829ef7e12";function bg(n){const a=vn(y=>y.refreshLatestVersion),{selectedExamples:l,onExamplesDeleted:t,onClearSelection:i}=n,[r,o]=u.useState(null),c=oe(),d=ge(),[g,f]=D.useMutation(Vr),m=l.length!==1,p=u.useCallback(()=>{g({variables:{input:{exampleIds:l.map(y=>y.id)}},onCompleted:()=>{c({title:"Examples Deleted",message:`${l.length} example${m?"s":""} have been deleted.`}),t(),i(),a()},onError:y=>{d({title:"An error occurred",message:`Failed to delete examples: ${y.message}`})}})},[g,l,c,m,t,i,a,d]);return s("div",{css:C`
2945
+ `}}}();Vr.hash="455bf9e5dc4b9cc655095dc829ef7e12";function bg(n){const a=vn(y=>y.refreshLatestVersion),{selectedExamples:l,onExamplesDeleted:t,onClearSelection:i}=n,[r,o]=u.useState(null),c=oe(),d=ce(),[g,f]=D.useMutation(Vr),m=l.length!==1,p=u.useCallback(()=>{g({variables:{input:{exampleIds:l.map(y=>y.id)}},onCompleted:()=>{c({title:"Examples Deleted",message:`${l.length} example${m?"s":""} have been deleted.`}),t(),i(),a()},onError:y=>{d({title:"An error occurred",message:`Failed to delete examples: ${y.message}`})}})},[g,l,c,m,t,i,a,d]);return s("div",{css:C`
2946
2946
  position: absolute;
2947
2947
  bottom: var(--ac-global-dimension-size-400);
2948
2948
  left: 50%;
2949
2949
  transform: translateX(-50%);
2950
- `,children:[e(F,{backgroundColor:"light",padding:"size-200",borderColor:"light",borderWidth:"thin",borderRadius:"medium",minWidth:"size-6000",children:s(h,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e(K,{children:`${l.length} example${m?"s":""} selected`}),s(h,{direction:"row",gap:"size-100",children:[e(M,{variant:"default",size:"compact",onClick:i,children:"Cancel"}),e(M,{variant:"danger",size:"compact",icon:e(P,{svg:e(I.TrashOutline,{})}),loading:f,disabled:f,onClick:p,children:f?"Deleting...":"Delete Example"+(m?"s":"")})]})]})}),e(W,{onDismiss:()=>{o(null)},children:r})]})}const Sg=100;function vg({dataset:n}){const a=vn(_=>_.latestVersion),l=u.useRef(null),[t,i]=Ke.useState({}),{data:r,loadNext:o,hasNext:c,isLoadingNext:d,refetch:g}=D.usePaginationFragment(zr,n);u.useEffect(()=>{u.startTransition(()=>{g({datasetVersionId:(a==null?void 0:a.id)||null},{fetchPolicy:"store-and-network"})})},[a,g]);const f=u.useMemo(()=>r.examples.edges.map(_=>{const x=_.example,T=x.revision;return{id:x.id,input:T.input,output:T.output,metadata:T.metadata}}),[r]),p=he({columns:[{id:"select",header:({table:_})=>e(en,{checked:_.getIsAllRowsSelected(),indeterminate:_.getIsSomeRowsSelected(),onChange:_.getToggleAllRowsSelectedHandler()}),cell:({row:_})=>e(en,{checked:_.getIsSelected(),disabled:!_.getCanSelect(),indeterminate:_.getIsSomeSelected(),onChange:_.getToggleSelectedHandler()})},{header:"example id",accessorKey:"id",cell:({getValue:_,row:x})=>{const T=x.original.id;return e(Ze,{to:`${T}`,children:_()})}},{header:"input",accessorKey:"input",cell:_n},{header:"output",accessorKey:"output",cell:_n},{header:"metadata",accessorKey:"metadata",cell:_n}],data:f,state:{rowSelection:t},onRowSelectionChange:i,getCoreRowModel:ke()}),y=p.getRowModel().rows,k=y.length===0,b=p.getSelectedRowModel().rows,v=b.map(_=>_.original),S=u.useCallback(()=>{i({})},[i]),L=u.useCallback(_=>{if(_){const{scrollHeight:x,scrollTop:T,clientHeight:E}=_;x-T-E<300&&!d&&c&&o(Sg)}},[c,d,o]),A=ne();return s("div",{css:C`
2950
+ `,children:[e(F,{backgroundColor:"light",padding:"size-200",borderColor:"light",borderWidth:"thin",borderRadius:"medium",minWidth:"size-6000",children:s(h,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e(K,{children:`${l.length} example${m?"s":""} selected`}),s(h,{direction:"row",gap:"size-100",children:[e(M,{variant:"default",size:"compact",onClick:i,children:"Cancel"}),e(M,{variant:"danger",size:"compact",icon:e(P,{svg:e(I.TrashOutline,{})}),loading:f,disabled:f,onClick:p,children:f?"Deleting...":"Delete Example"+(m?"s":"")})]})]})}),e(W,{onDismiss:()=>{o(null)},children:r})]})}const Sg=100;function vg({dataset:n}){const a=vn(w=>w.latestVersion),l=u.useRef(null),[t,i]=Ke.useState({}),{data:r,loadNext:o,hasNext:c,isLoadingNext:d,refetch:g}=D.usePaginationFragment(zr,n);u.useEffect(()=>{u.startTransition(()=>{g({datasetVersionId:(a==null?void 0:a.id)||null},{fetchPolicy:"store-and-network"})})},[a,g]);const f=u.useMemo(()=>r.examples.edges.map(w=>{const x=w.example,T=x.revision;return{id:x.id,input:T.input,output:T.output,metadata:T.metadata}}),[r]),p=he({columns:[{id:"select",header:({table:w})=>e(en,{checked:w.getIsAllRowsSelected(),indeterminate:w.getIsSomeRowsSelected(),onChange:w.getToggleAllRowsSelectedHandler()}),cell:({row:w})=>e(en,{checked:w.getIsSelected(),disabled:!w.getCanSelect(),indeterminate:w.getIsSomeSelected(),onChange:w.getToggleSelectedHandler()})},{header:"example id",accessorKey:"id",cell:({getValue:w,row:x})=>{const T=x.original.id;return e(Ze,{to:`${T}`,children:w()})}},{header:"input",accessorKey:"input",cell:_n},{header:"output",accessorKey:"output",cell:_n},{header:"metadata",accessorKey:"metadata",cell:_n}],data:f,state:{rowSelection:t},onRowSelectionChange:i,getCoreRowModel:ke()}),y=p.getRowModel().rows,b=y.length===0,k=p.getSelectedRowModel().rows,v=k.map(w=>w.original),S=u.useCallback(()=>{i({})},[i]),A=u.useCallback(w=>{if(w){const{scrollHeight:x,scrollTop:T,clientHeight:E}=w;x-T-E<300&&!d&&c&&o(Sg)}},[c,d,o]),L=ne();return s("div",{css:C`
2951
2951
  flex: 1 1 auto;
2952
2952
  overflow: auto;
2953
- `,ref:l,onScroll:_=>L(_.target),children:[s("table",{css:Qn,children:[e("thead",{children:p.getHeaderGroups().map(_=>e("tr",{children:_.headers.map(x=>e("th",{children:e("div",{children:Z(x.column.columnDef.header,x.getContext())})},x.id))},_.id))}),k?e(Je,{}):e("tbody",{children:y.map(_=>e("tr",{onClick:()=>{A(`${_.original.id}`)},children:_.getVisibleCells().map(x=>e("td",{children:Z(x.column.columnDef.cell,x.getContext())},x.id))},_.id))})]}),b.length?e(bg,{selectedExamples:v,onClearSelection:S,onExamplesDeleted:()=>{g({},{fetchPolicy:"store-and-network"})}}):null]})}function Jy(){const n=Cn();return s(q,{children:[e(vg,{dataset:n.dataset})," ",e(u.Suspense,{children:e(Pe,{})})]})}const $r=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"annotationName",storageKey:null},r=[{kind:"Literal",name:"first",value:100}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"experimentsLoaderQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{kind:"InlineFragment",selections:[{args:null,kind:"FragmentSpread",name:"ExperimentsTableFragment"}],type:"Dataset",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"experimentsLoaderQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[t,l,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ExperimentAnnotationSummary",kind:"LinkedField",name:"experimentAnnotationSummaries",plural:!0,selections:[i,{alias:null,args:null,kind:"ScalarField",name:"minScore",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"maxScore",storageKey:null}],storageKey:null},{alias:null,args:r,concreteType:"ExperimentConnection",kind:"LinkedField",name:"experiments",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"experiment",args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:[l,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"errorRate",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"runCount",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"averageRunLatencyMs",storageKey:null},{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[l],storageKey:null},{alias:null,args:null,concreteType:"ExperimentAnnotationSummary",kind:"LinkedField",name:"annotationSummaries",plural:!0,selections:[i,{alias:null,args:null,kind:"ScalarField",name:"meanScore",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:[t],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:"experiments(first:100)"},{alias:null,args:r,filters:null,handle:"connection",key:"ExperimentsTable_experiments",kind:"LinkedHandle",name:"experiments"}],type:"Dataset",abstractKey:null}],storageKey:null}]},params:{cacheID:"91f92395f5df4858554b124deed3f47a",id:null,metadata:{},name:"experimentsLoaderQuery",operationKind:"query",text:`query experimentsLoaderQuery(
2953
+ `,ref:l,onScroll:w=>A(w.target),children:[s("table",{css:Qn,children:[e("thead",{children:p.getHeaderGroups().map(w=>e("tr",{children:w.headers.map(x=>e("th",{children:e("div",{children:Z(x.column.columnDef.header,x.getContext())})},x.id))},w.id))}),b?e(Je,{}):e("tbody",{children:y.map(w=>e("tr",{onClick:()=>{L(`${w.original.id}`)},children:w.getVisibleCells().map(x=>e("td",{children:Z(x.column.columnDef.cell,x.getContext())},x.id))},w.id))})]}),k.length?e(bg,{selectedExamples:v,onClearSelection:S,onExamplesDeleted:()=>{g({},{fetchPolicy:"store-and-network"})}}):null]})}function Jy(){const n=Cn();return s(q,{children:[e(vg,{dataset:n.dataset})," ",e(u.Suspense,{children:e(Pe,{})})]})}const $r=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"annotationName",storageKey:null},r=[{kind:"Literal",name:"first",value:100}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"experimentsLoaderQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{kind:"InlineFragment",selections:[{args:null,kind:"FragmentSpread",name:"ExperimentsTableFragment"}],type:"Dataset",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"experimentsLoaderQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[t,l,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ExperimentAnnotationSummary",kind:"LinkedField",name:"experimentAnnotationSummaries",plural:!0,selections:[i,{alias:null,args:null,kind:"ScalarField",name:"minScore",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"maxScore",storageKey:null}],storageKey:null},{alias:null,args:r,concreteType:"ExperimentConnection",kind:"LinkedField",name:"experiments",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"experiment",args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:[l,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"errorRate",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"runCount",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"averageRunLatencyMs",storageKey:null},{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[l],storageKey:null},{alias:null,args:null,concreteType:"ExperimentAnnotationSummary",kind:"LinkedField",name:"annotationSummaries",plural:!0,selections:[i,{alias:null,args:null,kind:"ScalarField",name:"meanScore",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:[t],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"PageInfo",kind:"LinkedField",name:"pageInfo",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"endCursor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"hasNextPage",storageKey:null}],storageKey:null}],storageKey:"experiments(first:100)"},{alias:null,args:r,filters:null,handle:"connection",key:"ExperimentsTable_experiments",kind:"LinkedHandle",name:"experiments"}],type:"Dataset",abstractKey:null}],storageKey:null}]},params:{cacheID:"91f92395f5df4858554b124deed3f47a",id:null,metadata:{},name:"experimentsLoaderQuery",operationKind:"query",text:`query experimentsLoaderQuery(
2954
2954
  $id: GlobalID!
2955
2955
  ) {
2956
2956
  dataset: node(id: $id) {
@@ -3058,12 +3058,12 @@ fragment ExperimentsTableFragment_2HEEH6 on Dataset {
3058
3058
  __typename
3059
3059
  }
3060
3060
  }
3061
- `}}}();jr.hash="4ab310746eb51c6a3fcb799d2c972762";function Fg(n){const a=ne(),[l,t]=u.useState(null),[i,r]=D.useMutation(jr),{datasetId:o,selectedExperiments:c,onClearSelection:d,onExperimentsDeleted:g}=n,f=c.length!==1,m=oe(),p=ge(),y=u.useCallback(()=>{i({variables:{input:{experimentIds:c.map(b=>b.id)}},onCompleted:()=>{m({title:"Examples Deleted",message:`${c.length} experiment${f?"s":""} have been deleted.`}),g(),d()},onError:b=>{p({title:"An error occurred",message:`Failed to delete examples: ${b.message}`})}})},[i,f,p,m,d,g,c]),k=u.useCallback(()=>{t(s(G,{size:"S",title:"Delete Experiments",children:[e(F,{padding:"size-200",children:e(K,{color:"danger",children:"Are you sure you want to delete these experiments? This will also delete all associated annotations and traces, and it cannot be undone."})}),e(F,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(h,{direction:"row",justifyContent:"end",children:e(M,{variant:"danger",onClick:()=>{y(),t(null)},children:"Delete Experiments"})})})]}))},[y]);return s("div",{css:C`
3061
+ `}}}();jr.hash="4ab310746eb51c6a3fcb799d2c972762";function Fg(n){const a=ne(),[l,t]=u.useState(null),[i,r]=D.useMutation(jr),{datasetId:o,selectedExperiments:c,onClearSelection:d,onExperimentsDeleted:g}=n,f=c.length!==1,m=oe(),p=ce(),y=u.useCallback(()=>{i({variables:{input:{experimentIds:c.map(k=>k.id)}},onCompleted:()=>{m({title:"Examples Deleted",message:`${c.length} experiment${f?"s":""} have been deleted.`}),g(),d()},onError:k=>{p({title:"An error occurred",message:`Failed to delete examples: ${k.message}`})}})},[i,f,p,m,d,g,c]),b=u.useCallback(()=>{t(s(G,{size:"S",title:"Delete Experiments",children:[e(F,{padding:"size-200",children:e(K,{color:"danger",children:"Are you sure you want to delete these experiments? This will also delete all associated annotations and traces, and it cannot be undone."})}),e(F,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(h,{direction:"row",justifyContent:"end",children:e(M,{variant:"danger",onClick:()=>{y(),t(null)},children:"Delete Experiments"})})})]}))},[y]);return s("div",{css:C`
3062
3062
  position: absolute;
3063
3063
  bottom: var(--ac-global-dimension-size-400);
3064
3064
  left: 50%;
3065
3065
  transform: translateX(-50%);
3066
- `,children:[e(F,{backgroundColor:"light",padding:"size-200",borderColor:"light",borderWidth:"thin",borderRadius:"medium",minWidth:"size-6000",children:s(h,{direction:"row",justifyContent:"space-between",alignItems:"center",gap:"size-100",children:[e(K,{children:`${c.length} experiment${f?"s":""} selected`}),s(h,{direction:"row",gap:"size-100",children:[e(M,{variant:"default",size:"compact",onClick:d,children:"Cancel"}),e(M,{variant:"danger",size:"compact",icon:e(P,{svg:e(I.TrashOutline,{})}),loading:r,disabled:r,onClick:k,children:r?"Deleting...":"Delete"}),e(M,{variant:"primary",size:"compact",onClick:()=>{a(`/datasets/${o}/compare?${c.map(b=>`experimentId=${b.id}`).join("&")}`)},icon:e(P,{svg:e(I.ArrowCompareOutline,{})}),children:"Compare Experiments"})]})]})}),e(W,{onDismiss:()=>{t(null)},children:l})]})}const Kg=100;function xg(){return e("tbody",{className:"is-empty",children:e("tr",{children:s("td",{colSpan:100,css:C`
3066
+ `,children:[e(F,{backgroundColor:"light",padding:"size-200",borderColor:"light",borderWidth:"thin",borderRadius:"medium",minWidth:"size-6000",children:s(h,{direction:"row",justifyContent:"space-between",alignItems:"center",gap:"size-100",children:[e(K,{children:`${c.length} experiment${f?"s":""} selected`}),s(h,{direction:"row",gap:"size-100",children:[e(M,{variant:"default",size:"compact",onClick:d,children:"Cancel"}),e(M,{variant:"danger",size:"compact",icon:e(P,{svg:e(I.TrashOutline,{})}),loading:r,disabled:r,onClick:b,children:r?"Deleting...":"Delete"}),e(M,{variant:"primary",size:"compact",onClick:()=>{a(`/datasets/${o}/compare?${c.map(k=>`experimentId=${k.id}`).join("&")}`)},icon:e(P,{svg:e(I.ArrowCompareOutline,{})}),children:"Compare Experiments"})]})]})}),e(W,{onDismiss:()=>{t(null)},children:l})]})}const Kg=100;function xg(){return e("tbody",{className:"is-empty",children:e("tr",{children:s("td",{colSpan:100,css:C`
3067
3067
  text-align: center;
3068
3068
  padding: var(--ac-global-dimension-size-400) !important;
3069
3069
  .ac-button {
@@ -3071,20 +3071,20 @@ fragment ExperimentsTableFragment_2HEEH6 on Dataset {
3071
3071
  margin-left: auto;
3072
3072
  margin-right: auto;
3073
3073
  }
3074
- `,children:["No experiments for this dataset. To see how to run experiments on a dataset, check out the documentation.",e(Lr,{})]})})})}function Dg({dataset:n}){const a=u.useRef(null),[l,t]=u.useState({}),{data:i,loadNext:r,hasNext:o,isLoadingNext:c,refetch:d}=D.usePaginationFragment(Qr,n),g=u.useMemo(()=>i.experiments.edges.map(x=>{const T=x.experiment.annotationSummaries.reduce((E,R)=>(E[R.annotationName]=R,E),{});return{...x.experiment,annotationSummaryMap:T}}),[i.experiments.edges]),f=[{id:"select",header:({table:x})=>e(en,{checked:x.getIsAllRowsSelected(),indeterminate:x.getIsSomeRowsSelected(),onChange:x.getToggleAllRowsSelectedHandler()}),cell:({row:x})=>e(en,{checked:x.getIsSelected(),disabled:!x.getCanSelect(),indeterminate:x.getIsSomeSelected(),onChange:x.getToggleSelectedHandler()})},{header:"name",accessorKey:"name",minSize:200,cell:({getValue:x,row:T})=>{const E=T.original.id,R=T.original.sequenceNumber;return s(h,{direction:"row",gap:"size-100",children:[e(Ka,{sequenceNumber:R}),e(Ze,{to:`/datasets/${n.id}/compare?experimentId=${E}`,children:x()})]})}},{header:"description",accessorKey:"description",minSize:300,cell:ue},{header:"created at",accessorKey:"createdAt",cell:Fe}],m=i.experimentAnnotationSummaries.map(x=>{const{annotationName:T,minScore:E,maxScore:R}=x;return{header:()=>s(h,{direction:"row",gap:"size-100",wrap:!0,alignItems:"center",justifyContent:"end",children:[e(K,{children:T}),e(ld,{annotationName:T})]}),id:`annotation-${T}`,meta:{textAlign:"right"},cell:({row:j})=>{const ae=j.original.annotationSummaryMap[T];return!ae||ae.meanScore==null?e("span",{css:C`
3074
+ `,children:["No experiments for this dataset. To see how to run experiments on a dataset, check out the documentation.",e(Lr,{})]})})})}function Dg({dataset:n}){const a=u.useRef(null),[l,t]=u.useState({}),{data:i,loadNext:r,hasNext:o,isLoadingNext:c,refetch:d}=D.usePaginationFragment(Qr,n),g=u.useMemo(()=>i.experiments.edges.map(x=>{const T=x.experiment.annotationSummaries.reduce((E,R)=>(E[R.annotationName]=R,E),{});return{...x.experiment,annotationSummaryMap:T}}),[i.experiments.edges]),f=[{id:"select",header:({table:x})=>e(en,{checked:x.getIsAllRowsSelected(),indeterminate:x.getIsSomeRowsSelected(),onChange:x.getToggleAllRowsSelectedHandler()}),cell:({row:x})=>e(en,{checked:x.getIsSelected(),disabled:!x.getCanSelect(),indeterminate:x.getIsSomeSelected(),onChange:x.getToggleSelectedHandler()})},{header:"name",accessorKey:"name",minSize:200,cell:({getValue:x,row:T})=>{const E=T.original.id,R=T.original.sequenceNumber;return s(h,{direction:"row",gap:"size-100",children:[e(Ka,{sequenceNumber:R}),e(Ze,{to:`/datasets/${n.id}/compare?experimentId=${E}`,children:x()})]})}},{header:"description",accessorKey:"description",minSize:300,cell:me},{header:"created at",accessorKey:"createdAt",cell:Fe}],m=i.experimentAnnotationSummaries.map(x=>{const{annotationName:T,minScore:E,maxScore:R}=x;return{header:()=>s(h,{direction:"row",gap:"size-100",wrap:!0,alignItems:"center",justifyContent:"end",children:[e(K,{children:T}),e(ld,{annotationName:T})]}),id:`annotation-${T}`,meta:{textAlign:"right"},cell:({row:j})=>{const ae=j.original.annotationSummaryMap[T];return!ae||ae.meanScore==null?e("span",{css:C`
3075
3075
  float: right;
3076
- `,children:"--"}):e(Tg,{annotationName:T,value:ae.meanScore,min:E,max:R})}}}),p=[{header:"run count",accessorKey:"runCount",meta:{textAlign:"right"},cell:td},{header:"avg latency",accessorKey:"averageRunLatencyMs",meta:{textAlign:"right"},cell:({getValue:x})=>{const T=x();return T===null||typeof T!="number"?"--":e(Me,{latencyMs:T})}},{header:"error rate",accessorKey:"errorRate",meta:{textAlign:"right"},cell:Cg},{header:"metadata",accessorKey:"metadata",minSize:200,cell:_n},{id:"actions",cell:({row:x})=>{const T=x.original.project,E=x.original.metadata;return e(Ig,{projectId:(T==null?void 0:T.id)||null,experimentId:x.original.id,metadata:E})}}],y=he({columns:[...f,...m,...p],data:g,getCoreRowModel:ke(),state:{rowSelection:l},onRowSelectionChange:t}),k=y.getRowModel().rows,b=y.getSelectedRowModel().rows,v=b.map(x=>x.original),S=u.useCallback(()=>{t({})},[t]),L=k.length===0,A=u.useCallback(x=>{if(x){const{scrollHeight:T,scrollTop:E,clientHeight:R}=x;T-E-R<300&&!c&&o&&r(Kg)}},[o,c,r]),_=ne();return s("div",{css:C`
3076
+ `,children:"--"}):e(Tg,{annotationName:T,value:ae.meanScore,min:E,max:R})}}}),p=[{header:"run count",accessorKey:"runCount",meta:{textAlign:"right"},cell:td},{header:"avg latency",accessorKey:"averageRunLatencyMs",meta:{textAlign:"right"},cell:({getValue:x})=>{const T=x();return T===null||typeof T!="number"?"--":e(Me,{latencyMs:T})}},{header:"error rate",accessorKey:"errorRate",meta:{textAlign:"right"},cell:Cg},{header:"metadata",accessorKey:"metadata",minSize:200,cell:_n},{id:"actions",cell:({row:x})=>{const T=x.original.project,E=x.original.metadata;return e(Ig,{projectId:(T==null?void 0:T.id)||null,experimentId:x.original.id,metadata:E})}}],y=he({columns:[...f,...m,...p],data:g,getCoreRowModel:ke(),state:{rowSelection:l},onRowSelectionChange:t}),b=y.getRowModel().rows,k=y.getSelectedRowModel().rows,v=k.map(x=>x.original),S=u.useCallback(()=>{t({})},[t]),A=b.length===0,L=u.useCallback(x=>{if(x){const{scrollHeight:T,scrollTop:E,clientHeight:R}=x;T-E-R<300&&!c&&o&&r(Kg)}},[o,c,r]),w=ne();return s("div",{css:C`
3077
3077
  flex: 1 1 auto;
3078
3078
  overflow: auto;
3079
3079
  width: table.getTotalSize();
3080
- `,ref:a,onScroll:x=>A(x.target),children:[s("table",{css:Qn,children:[e("thead",{children:y.getHeaderGroups().map(x=>e("tr",{children:x.headers.map(T=>{var E,R;return e("th",{align:(R=(E=T.column.columnDef)==null?void 0:E.meta)==null?void 0:R.textAlign,children:e("div",{children:Z(T.column.columnDef.header,T.getContext())})},T.id)})},x.id))}),L?e(xg,{}):e("tbody",{children:k.map(x=>e("tr",{onClick:()=>{_(`/datasets/${n.id}/compare?experimentId=${x.original.id}`)},children:x.getVisibleCells().map(T=>e("td",{children:Z(T.column.columnDef.cell,T.getContext())},T.id))},x.id))})]}),b.length?e(Fg,{datasetId:n.id,selectedExperiments:v,onClearSelection:S,onExperimentsDeleted:()=>{d({},{fetchPolicy:"store-and-network"})}}):null]})}function Tg({annotationName:n,value:a,min:l,max:t}){const i=Xl(n),r=u.useMemo(()=>{const o=typeof l=="number"?l:0,c=typeof t=="number"?t:1;if(o===c&&c===a)return 100;const d=c-o||1;return(a-o)/d*100},[a,l,t]);return s(Le,{children:[e(kn,{children:s("div",{css:C`
3080
+ `,ref:a,onScroll:x=>L(x.target),children:[s("table",{css:Qn,children:[e("thead",{children:y.getHeaderGroups().map(x=>e("tr",{children:x.headers.map(T=>{var E,R;return e("th",{align:(R=(E=T.column.columnDef)==null?void 0:E.meta)==null?void 0:R.textAlign,children:e("div",{children:Z(T.column.columnDef.header,T.getContext())})},T.id)})},x.id))}),A?e(xg,{}):e("tbody",{children:b.map(x=>e("tr",{onClick:()=>{w(`/datasets/${n.id}/compare?experimentId=${x.original.id}`)},children:x.getVisibleCells().map(T=>e("td",{children:Z(T.column.columnDef.cell,T.getContext())},T.id))},x.id))})]}),k.length?e(Fg,{datasetId:n.id,selectedExperiments:v,onClearSelection:S,onExperimentsDeleted:()=>{d({},{fetchPolicy:"store-and-network"})}}):null]})}function Tg({annotationName:n,value:a,min:l,max:t}){const i=Xl(n),r=u.useMemo(()=>{const o=typeof l=="number"?l:0,c=typeof t=="number"?t:1;if(o===c&&c===a)return 100;const d=c-o||1;return(a-o)/d*100},[a,l,t]);return s(Le,{children:[e(kn,{children:s("div",{css:C`
3081
3081
  float: right;
3082
3082
  --mod-barloader-fill-color: ${i};
3083
3083
  display: flex;
3084
3084
  flex-direction: row;
3085
3085
  align-items: center;
3086
3086
  gap: var(--ac-global-dimension-size-100);
3087
- `,children:[An(a),e(uo,{width:"40px",value:r,"aria-label":"where the mean score lands between overall min max"})]})}),e(aa,{children:s(F,{width:"size-2400",children:[e(re,{level:3,weight:"heavy",children:n}),s(h,{direction:"column",children:[s(h,{justifyContent:"space-between",children:[e(K,{weight:"heavy",textSize:"small",children:"Mean Score"}),e(K,{textSize:"small",children:An(a)})]}),s(h,{justifyContent:"space-between",children:[e(K,{weight:"heavy",textSize:"small",children:"All Experiments Min"}),e(K,{textSize:"small",children:An(l)})]}),s(h,{justifyContent:"space-between",children:[e(K,{weight:"heavy",textSize:"small",children:"All Experiments Max"}),e(K,{textSize:"small",children:An(t)})]}),s(h,{justifyContent:"space-between",children:[e(K,{weight:"heavy",textSize:"small",children:"Mean Score Percentile"}),e(K,{textSize:"small",children:Yl(r)})]})]})]})})]})}function Ig(n){const{projectId:a}=n,l=ne(),[t,i]=u.useState(null),r=oe();return s("div",{onClick:o=>{o.preventDefault(),o.stopPropagation()},children:[s(Be,{buttonSize:"compact",align:"end",disabledKeys:a?[]:["GO_TO_EXPERIMENT_RUN_TRACES"],onAction:o=>{switch(o){case"GO_TO_EXPERIMENT_RUN_TRACES":return l(`/projects/${a}`);case"VIEW_METADATA":{i(e(G,{title:"Metadata",onDismiss:()=>i(null),children:e(fn,{value:JSON.stringify(n.metadata,null,2)})}));break}case"COPY_EXPERIMENT_ID":{Gs(n.experimentId),r({title:"Copied",message:"The experiment ID has been copied to your clipboard"});break}default:Ce()}},children:[e(U,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(I.Trace,{})}),e(K,{children:"View run traces"})]})},"GO_TO_EXPERIMENT_RUN_TRACES"),e(U,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(I.InfoOutline,{})}),e(K,{children:"View metadata"})]})},"VIEW_METADATA"),e(U,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(I.ClipboardCopy,{})}),e(K,{children:"Copy experiment ID"})]})},"COPY_EXPERIMENT_ID")]}),e(W,{type:"modal",isDismissable:!0,onDismiss:()=>{i(null)},children:t})]})}function Xy(){const n=Cn();return s(q,{children:[e(Dg,{dataset:n.dataset}),e(u.Suspense,{children:e(Pe,{})})]})}const qr=function(){var n={defaultValue:null,kind:"LocalArgument",name:"datasetId"},a={defaultValue:null,kind:"LocalArgument",name:"experimentIds"},l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"projectId",storageKey:null}],storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},r={alias:"comparisons",args:[{kind:"Variable",name:"experimentIds",variableName:"experimentIds"}],concreteType:"ExperimentComparison",kind:"LinkedField",name:"compareExperiments",plural:!0,selections:[{alias:null,args:null,concreteType:"DatasetExample",kind:"LinkedField",name:"example",plural:!1,selections:[l,{alias:null,args:null,concreteType:"DatasetExampleRevision",kind:"LinkedField",name:"revision",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"input",storageKey:null},{alias:"referenceOutput",args:null,kind:"ScalarField",name:"output",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"RunComparisonItem",kind:"LinkedField",name:"runComparisonItems",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"experimentId",storageKey:null},{alias:null,args:null,concreteType:"ExperimentRun",kind:"LinkedField",name:"runs",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"output",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"error",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"endTime",storageKey:null},t,{alias:null,args:null,concreteType:"ExperimentRunAnnotationConnection",kind:"LinkedField",name:"annotations",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentRunAnnotationEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"annotation",args:null,concreteType:"ExperimentRunAnnotation",kind:"LinkedField",name:"node",plural:!1,selections:[l,i,{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"explanation",storageKey:null},t],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},o=[{kind:"Variable",name:"id",variableName:"datasetId"}],c={kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ExperimentConnection",kind:"LinkedField",name:"experiments",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"experiment",args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:[l,i,{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Dataset",abstractKey:null};return{fragment:{argumentDefinitions:[n,a],kind:"Fragment",metadata:null,name:"ExperimentCompareTableQuery",selections:[r,{alias:"dataset",args:o,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,c],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,n],kind:"Operation",name:"ExperimentCompareTableQuery",selections:[r,{alias:"dataset",args:o,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l,c],storageKey:null}]},params:{cacheID:"97e80c617426f75b81affa68e276b3d8",id:null,metadata:{},name:"ExperimentCompareTableQuery",operationKind:"query",text:`query ExperimentCompareTableQuery(
3087
+ `,children:[An(a),e(uo,{width:"40px",value:r,"aria-label":"where the mean score lands between overall min max"})]})}),e(aa,{children:s(F,{width:"size-2400",children:[e(re,{level:3,weight:"heavy",children:n}),s(h,{direction:"column",children:[s(h,{justifyContent:"space-between",children:[e(K,{weight:"heavy",textSize:"small",children:"Mean Score"}),e(K,{textSize:"small",children:An(a)})]}),s(h,{justifyContent:"space-between",children:[e(K,{weight:"heavy",textSize:"small",children:"All Experiments Min"}),e(K,{textSize:"small",children:An(l)})]}),s(h,{justifyContent:"space-between",children:[e(K,{weight:"heavy",textSize:"small",children:"All Experiments Max"}),e(K,{textSize:"small",children:An(t)})]}),s(h,{justifyContent:"space-between",children:[e(K,{weight:"heavy",textSize:"small",children:"Mean Score Percentile"}),e(K,{textSize:"small",children:Yl(r)})]})]})]})})]})}function Ig(n){const{projectId:a}=n,l=ne(),[t,i]=u.useState(null),r=oe();return s("div",{onClick:o=>{o.preventDefault(),o.stopPropagation()},children:[s(Be,{buttonSize:"compact",align:"end",disabledKeys:a?[]:["GO_TO_EXPERIMENT_RUN_TRACES"],onAction:o=>{switch(o){case"GO_TO_EXPERIMENT_RUN_TRACES":return l(`/projects/${a}`);case"VIEW_METADATA":{i(e(G,{title:"Metadata",onDismiss:()=>i(null),children:e(fn,{value:JSON.stringify(n.metadata,null,2)})}));break}case"COPY_EXPERIMENT_ID":{Gs(n.experimentId),r({title:"Copied",message:"The experiment ID has been copied to your clipboard"});break}default:Ce()}},children:[e(B,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(I.Trace,{})}),e(K,{children:"View run traces"})]})},"GO_TO_EXPERIMENT_RUN_TRACES"),e(B,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(I.InfoOutline,{})}),e(K,{children:"View metadata"})]})},"VIEW_METADATA"),e(B,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(I.ClipboardCopy,{})}),e(K,{children:"Copy experiment ID"})]})},"COPY_EXPERIMENT_ID")]}),e(W,{type:"modal",isDismissable:!0,onDismiss:()=>{i(null)},children:t})]})}function Xy(){const n=Cn();return s(q,{children:[e(Dg,{dataset:n.dataset}),e(u.Suspense,{children:e(Pe,{})})]})}const qr=function(){var n={defaultValue:null,kind:"LocalArgument",name:"datasetId"},a={defaultValue:null,kind:"LocalArgument",name:"experimentIds"},l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"projectId",storageKey:null}],storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},r={alias:"comparisons",args:[{kind:"Variable",name:"experimentIds",variableName:"experimentIds"}],concreteType:"ExperimentComparison",kind:"LinkedField",name:"compareExperiments",plural:!0,selections:[{alias:null,args:null,concreteType:"DatasetExample",kind:"LinkedField",name:"example",plural:!1,selections:[l,{alias:null,args:null,concreteType:"DatasetExampleRevision",kind:"LinkedField",name:"revision",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"input",storageKey:null},{alias:"referenceOutput",args:null,kind:"ScalarField",name:"output",storageKey:null}],storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"RunComparisonItem",kind:"LinkedField",name:"runComparisonItems",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"experimentId",storageKey:null},{alias:null,args:null,concreteType:"ExperimentRun",kind:"LinkedField",name:"runs",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"output",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"error",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"endTime",storageKey:null},t,{alias:null,args:null,concreteType:"ExperimentRunAnnotationConnection",kind:"LinkedField",name:"annotations",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentRunAnnotationEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"annotation",args:null,concreteType:"ExperimentRunAnnotation",kind:"LinkedField",name:"node",plural:!1,selections:[l,i,{alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"annotatorKind",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"explanation",storageKey:null},t],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null},o=[{kind:"Variable",name:"id",variableName:"datasetId"}],c={kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"ExperimentConnection",kind:"LinkedField",name:"experiments",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"experiment",args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:[l,i,{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Dataset",abstractKey:null};return{fragment:{argumentDefinitions:[n,a],kind:"Fragment",metadata:null,name:"ExperimentCompareTableQuery",selections:[r,{alias:"dataset",args:o,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,c],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,n],kind:"Operation",name:"ExperimentCompareTableQuery",selections:[r,{alias:"dataset",args:o,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l,c],storageKey:null}]},params:{cacheID:"97e80c617426f75b81affa68e276b3d8",id:null,metadata:{},name:"ExperimentCompareTableQuery",operationKind:"query",text:`query ExperimentCompareTableQuery(
3088
3088
  $experimentIds: [GlobalID!]!
3089
3089
  $datasetId: GlobalID!
3090
3090
  ) {
@@ -3182,7 +3182,7 @@ fragment ExperimentsTableFragment_2HEEH6 on Dataset {
3182
3182
  align-items: center;
3183
3183
  color: var(--ac-global-color-primary);
3184
3184
  gap: var(--ac-global-dimension-size-50);
3185
- `;function Ag(n){const{datasetId:a,experimentIds:l,displayFullText:t}=n,i=D.useLazyLoadQuery(qr,{experimentIds:l,datasetId:a}),r=u.useMemo(()=>{var v,S;return((S=(v=i.dataset)==null?void 0:v.experiments)==null?void 0:S.edges.reduce((L,A)=>(L[A.experiment.id]={...A.experiment},L),{}))||{}},[i]),o=u.useMemo(()=>i.comparisons.map(v=>{const S=v.runComparisonItems.reduce((L,A)=>(L[A.experimentId]=A,L),{});return{...v,id:v.example.id,input:v.example.revision.input,referenceOutput:v.example.revision.referenceOutput,runComparisonMap:S}}),[i]),[c,d]=u.useState(null),g=u.useMemo(()=>[{header:"input",accessorKey:"input",minWidth:500,cell:({row:v})=>s("div",{css:Ur,children:[e(ol,{children:e(ll,{json:v.original.input,disableTitle:!0,space:t?2:0})}),e("div",{className:"controls",css:Br,children:s(Le,{children:[e(M,{variant:"default",size:"compact","aria-label":"View example details",icon:e(P,{svg:e(I.ExpandOutline,{})}),onClick:()=>{u.startTransition(()=>{d(e(u.Suspense,{children:e(Rr,{exampleId:v.original.example.id,onDismiss:()=>{d(null)}})}))})}}),e(wn,{children:"View Example"})]})})]})},{header:"reference output",accessorKey:"referenceOutput",minWidth:500,cell:t?Mg:_n}],[t]),f=u.useMemo(()=>l.map(v=>({header:()=>{var A,_;const S=(A=r[v])==null?void 0:A.name,L=((_=r[v])==null?void 0:_.sequenceNumber)||0;return s(h,{direction:"row",gap:"size-100",wrap:!0,children:[e(Ka,{sequenceNumber:L}),e(K,{children:S})]})},accessorKey:v,minSize:500,cell:({row:S})=>{var j,ae;const L=S.original.runComparisonMap[v],A=(L==null?void 0:L.runs.length)||0;if(A===0)return e(Tl,{});if(A>1)return e(K,{color:"warning",children:`${A} runs`});const _=L==null?void 0:L.runs[0];let x=null;const T=(j=_==null?void 0:_.trace)==null?void 0:j.traceId,E=(ae=_==null?void 0:_.trace)==null?void 0:ae.projectId;T&&E&&(x=s(Le,{children:[e(M,{variant:"default",className:"trace-button",size:"compact","aria-label":"View run trace",icon:e(P,{svg:e(I.Trace,{})}),onClick:ie=>{ie.preventDefault(),ie.stopPropagation(),u.startTransition(()=>{d(e(Jr,{traceId:T,projectId:E,title:"Experiment Run Trace"}))})}}),e(wn,{children:"View Trace"})]}));const R=s(q,{children:[s(Le,{children:[e(M,{variant:"default",className:"expand-button",size:"compact","aria-label":"View example run details",icon:e(P,{svg:e(I.ExpandOutline,{})}),onClick:ie=>{ie.preventDefault(),ie.stopPropagation(),u.startTransition(()=>{d(e(Ng,{selectedExample:S.original,datasetId:a,experimentInfoById:r}))})}}),e(wn,{children:"View run details"})]}),x]});return _?e(Rg,{controls:R,children:e(Eg,{..._,displayFullText:t,setDialog:d})}):e(Tl,{})}})),[l,r,a,t]),m=u.useMemo(()=>[...g,...f,{id:"tail",minSize:500}],[g,f]),p=he({columns:m,data:o,getCoreRowModel:ke(),columnResizeMode:"onChange"}),y=Ke.useMemo(()=>{const v=p.getFlatHeaders(),S={};for(let L=0;L<v.length;L++){const A=v[L];S[`--header-${A.id}-size`]=A.getSize(),S[`--col-${A.column.id}-size`]=A.column.getSize()}return S},[p.getState().columnSizingInfo,p.getState().columnSizing]),b=p.getRowModel().rows.length===0;return s("div",{css:Lg,children:[s("table",{css:v=>C(We(v),id),style:{...y,width:p.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:p.getHeaderGroups().map(v=>e("tr",{children:v.headers.map(S=>s("th",{style:{width:`calc(var(--header-${S==null?void 0:S.id}-size) * 1px)`},children:[e("div",{children:Z(S.column.columnDef.header,S.getContext())}),e("div",{onMouseDown:S.getResizeHandler(),onTouchStart:S.getResizeHandler(),className:`resizer ${S.column.getIsResizing()?"isResizing":""}`})]},S.id))},v.id))}),b?e(Je,{}):p.getState().columnSizingInfo.isResizingColumn?e(wg,{table:p}):e(Hr,{table:p})]}),e(W,{isDismissable:!0,type:"slideOver",onDismiss:()=>{d(null)},children:c})]})}function Hr({table:n}){return e("tbody",{children:n.getRowModel().rows.map(a=>e("tr",{children:a.getVisibleCells().map(l=>e("td",{style:{width:`calc(var(--col-${l.column.id}-size) * 1px)`},children:Z(l.column.columnDef.cell,l.getContext())},l.id))},a.id))})}const wg=Ke.memo(Hr,(n,a)=>n.table.options.data===a.table.options.data);function _g(n){const{datasetId:a,exampleId:l}=n,t=ne();return e("div",{onClick:i=>{i.preventDefault(),i.stopPropagation()},children:e(Be,{buttonSize:"compact",align:"end",onAction:i=>{switch(i){case"gotoExample":return t(`/datasets/${a}/examples/${l}`);default:Ce()}},children:e(U,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(I.ExternalLinkOutline,{})}),e(K,{children:"Go to example"})]})},"gotoExample")})})}function Eg(n){const{output:a,error:l,startTime:t,endTime:i,annotations:r,displayFullText:o,setDialog:c}=n;if(l)return e(Gr,{error:l});const d=r!=null&&r.edges.length?r.edges.map(g=>g.annotation):[];return s(h,{direction:"column",gap:"size-100",height:"100%",justifyContent:"space-between",children:[e(ol,{children:e(ll,{json:a,disableTitle:!0,space:o?2:0})}),s("ul",{css:C`
3185
+ `;function Ag(n){const{datasetId:a,experimentIds:l,displayFullText:t}=n,i=D.useLazyLoadQuery(qr,{experimentIds:l,datasetId:a}),r=u.useMemo(()=>{var v,S;return((S=(v=i.dataset)==null?void 0:v.experiments)==null?void 0:S.edges.reduce((A,L)=>(A[L.experiment.id]={...L.experiment},A),{}))||{}},[i]),o=u.useMemo(()=>i.comparisons.map(v=>{const S=v.runComparisonItems.reduce((A,L)=>(A[L.experimentId]=L,A),{});return{...v,id:v.example.id,input:v.example.revision.input,referenceOutput:v.example.revision.referenceOutput,runComparisonMap:S}}),[i]),[c,d]=u.useState(null),g=u.useMemo(()=>[{header:"input",accessorKey:"input",minWidth:500,cell:({row:v})=>s("div",{css:Ur,children:[e(ol,{children:e(ll,{json:v.original.input,disableTitle:!0,space:t?2:0})}),e("div",{className:"controls",css:Br,children:s(Le,{children:[e(M,{variant:"default",size:"compact","aria-label":"View example details",icon:e(P,{svg:e(I.ExpandOutline,{})}),onClick:()=>{u.startTransition(()=>{d(e(u.Suspense,{children:e(Rr,{exampleId:v.original.example.id,onDismiss:()=>{d(null)}})}))})}}),e(wn,{children:"View Example"})]})})]})},{header:"reference output",accessorKey:"referenceOutput",minWidth:500,cell:t?Mg:_n}],[t]),f=u.useMemo(()=>l.map(v=>({header:()=>{var L,w;const S=(L=r[v])==null?void 0:L.name,A=((w=r[v])==null?void 0:w.sequenceNumber)||0;return s(h,{direction:"row",gap:"size-100",wrap:!0,children:[e(Ka,{sequenceNumber:A}),e(K,{children:S})]})},accessorKey:v,minSize:500,cell:({row:S})=>{var j,ae;const A=S.original.runComparisonMap[v],L=(A==null?void 0:A.runs.length)||0;if(L===0)return e(Tl,{});if(L>1)return e(K,{color:"warning",children:`${L} runs`});const w=A==null?void 0:A.runs[0];let x=null;const T=(j=w==null?void 0:w.trace)==null?void 0:j.traceId,E=(ae=w==null?void 0:w.trace)==null?void 0:ae.projectId;T&&E&&(x=s(Le,{children:[e(M,{variant:"default",className:"trace-button",size:"compact","aria-label":"View run trace",icon:e(P,{svg:e(I.Trace,{})}),onClick:ie=>{ie.preventDefault(),ie.stopPropagation(),u.startTransition(()=>{d(e(Jr,{traceId:T,projectId:E,title:"Experiment Run Trace"}))})}}),e(wn,{children:"View Trace"})]}));const R=s(q,{children:[s(Le,{children:[e(M,{variant:"default",className:"expand-button",size:"compact","aria-label":"View example run details",icon:e(P,{svg:e(I.ExpandOutline,{})}),onClick:ie=>{ie.preventDefault(),ie.stopPropagation(),u.startTransition(()=>{d(e(Ng,{selectedExample:S.original,datasetId:a,experimentInfoById:r}))})}}),e(wn,{children:"View run details"})]}),x]});return w?e(Rg,{controls:R,children:e(Eg,{...w,displayFullText:t,setDialog:d})}):e(Tl,{})}})),[l,r,a,t]),m=u.useMemo(()=>[...g,...f,{id:"tail",minSize:500}],[g,f]),p=he({columns:m,data:o,getCoreRowModel:ke(),columnResizeMode:"onChange"}),y=Ke.useMemo(()=>{const v=p.getFlatHeaders(),S={};for(let A=0;A<v.length;A++){const L=v[A];S[`--header-${L.id}-size`]=L.getSize(),S[`--col-${L.column.id}-size`]=L.column.getSize()}return S},[p.getState().columnSizingInfo,p.getState().columnSizing]),k=p.getRowModel().rows.length===0;return s("div",{css:Lg,children:[s("table",{css:v=>C(We(v),id),style:{...y,width:p.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:p.getHeaderGroups().map(v=>e("tr",{children:v.headers.map(S=>s("th",{style:{width:`calc(var(--header-${S==null?void 0:S.id}-size) * 1px)`},children:[e("div",{children:Z(S.column.columnDef.header,S.getContext())}),e("div",{onMouseDown:S.getResizeHandler(),onTouchStart:S.getResizeHandler(),className:`resizer ${S.column.getIsResizing()?"isResizing":""}`})]},S.id))},v.id))}),k?e(Je,{}):p.getState().columnSizingInfo.isResizingColumn?e(wg,{table:p}):e(Hr,{table:p})]}),e(W,{isDismissable:!0,type:"slideOver",onDismiss:()=>{d(null)},children:c})]})}function Hr({table:n}){return e("tbody",{children:n.getRowModel().rows.map(a=>e("tr",{children:a.getVisibleCells().map(l=>e("td",{style:{width:`calc(var(--col-${l.column.id}-size) * 1px)`},children:Z(l.column.columnDef.cell,l.getContext())},l.id))},a.id))})}const wg=Ke.memo(Hr,(n,a)=>n.table.options.data===a.table.options.data);function _g(n){const{datasetId:a,exampleId:l}=n,t=ne();return e("div",{onClick:i=>{i.preventDefault(),i.stopPropagation()},children:e(Be,{buttonSize:"compact",align:"end",onAction:i=>{switch(i){case"gotoExample":return t(`/datasets/${a}/examples/${l}`);default:Ce()}},children:e(B,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(I.ExternalLinkOutline,{})}),e(K,{children:"Go to example"})]})},"gotoExample")})})}function Eg(n){const{output:a,error:l,startTime:t,endTime:i,annotations:r,displayFullText:o,setDialog:c}=n;if(l)return e(Gr,{error:l});const d=r!=null&&r.edges.length?r.edges.map(g=>g.annotation):[];return s(h,{direction:"column",gap:"size-100",height:"100%",justifyContent:"space-between",children:[e(ol,{children:e(ll,{json:a,disableTitle:!0,space:o?2:0})}),s("ul",{css:C`
3186
3186
  display: flex;
3187
3187
  flex-direction: row;
3188
3188
  gap: var(--ac-global-dimension-static-size-100);
@@ -3191,10 +3191,10 @@ fragment ExperimentsTableFragment_2HEEH6 on Dataset {
3191
3191
  `,children:[e("li",{children:e(Wr,{startTime:t,endTime:i})},"run-latency"),d.map(g=>e("li",{children:e(ia,{annotation:g,extra:g.trace&&e(F,{paddingTop:"size-100",children:s("div",{css:Pg,children:[e(P,{svg:e(I.InfoOutline,{})}),e("span",{children:"Click to view evaluator trace"})]})}),children:e(xn,{annotation:g,onClick:()=>{const f=g.trace;f&&u.startTransition(()=>{c(e(Jr,{traceId:f.traceId,projectId:f.projectId,title:`Evaluator Trace: ${g.name}`}))})}})})},g.id))]})]})}function Rg(n){return s("div",{css:Ur,children:[n.children,e("div",{css:Br,className:"controls",children:n.controls})]})}function Gr({error:n}){return s(h,{direction:"row",gap:"size-50",alignItems:"center",children:[e(P,{svg:e(I.AlertCircleOutline,{}),color:"danger"}),e(K,{color:"danger",children:n})]})}function Wr({startTime:n,endTime:a}){const l=u.useMemo(()=>{let t=null;return n&&a&&(t=new Date(a).getTime()-new Date(n).getTime()),t},[n,a]);return l===null?null:e(Me,{latencyMs:l})}function Tl(){return s(h,{direction:"row",gap:"size-50",children:[e(P,{svg:e(I.MinusCircleOutline,{}),color:"grey-800"}),e(K,{color:"text-700",children:"not run"})]})}function Mg({getValue:n}){const a=n();return e(ol,{children:e(ll,{json:a,space:2})})}function ol({children:n}){return e("div",{css:C`
3192
3192
  max-height: 300px;
3193
3193
  overflow-y: auto;
3194
- `,children:n})}function Ng({selectedExample:n,datasetId:a,experimentInfoById:l}){return e(G,{title:`Comparing Experiments for Example: ${n.id}`,size:"fullscreen",extra:e(_g,{datasetId:a,exampleId:n.id}),children:s(Xe,{direction:"vertical",autoSaveId:"example-compare-panel-group",children:[e(ce,{defaultSize:100,children:e("div",{css:C`
3194
+ `,children:n})}function Ng({selectedExample:n,datasetId:a,experimentInfoById:l}){return e(G,{title:`Comparing Experiments for Example: ${n.id}`,size:"fullscreen",extra:e(_g,{datasetId:a,exampleId:n.id}),children:s(Xe,{direction:"vertical",autoSaveId:"example-compare-panel-group",children:[e(ue,{defaultSize:100,children:e("div",{css:C`
3195
3195
  overflow-y: auto;
3196
3196
  height: 100%;
3197
- `,children:e(F,{overflow:"hidden",padding:"size-200",children:s(h,{direction:"row",gap:"size-200",flex:"1 1 auto",children:[e(F,{width:"50%",children:e(z,{title:"Input",...za,bodyStyle:{padding:0,maxHeight:"300px",overflowY:"auto"},extra:e(le,{text:JSON.stringify(n.input)}),children:e(fn,{value:JSON.stringify(n.input,null,2)})})}),e(F,{width:"50%",children:e(z,{title:"Reference Output",...za,extra:e(le,{text:JSON.stringify(n.input)}),bodyStyle:{padding:0,maxHeight:"300px",overflowY:"auto"},children:e(fn,{value:JSON.stringify(n.referenceOutput,null,2)})})})]})})})}),e(Ye,{css:Kn}),e(ce,{defaultSize:200,children:s(h,{direction:"column",height:"100%",children:[e(F,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderBottomColor:"dark",borderBottomWidth:"thin",flex:"none",children:e(re,{level:2,children:"Experiments"})}),e("div",{css:C`
3197
+ `,children:e(F,{overflow:"hidden",padding:"size-200",children:s(h,{direction:"row",gap:"size-200",flex:"1 1 auto",children:[e(F,{width:"50%",children:e(z,{title:"Input",...za,bodyStyle:{padding:0,maxHeight:"300px",overflowY:"auto"},extra:e(le,{text:JSON.stringify(n.input)}),children:e(fn,{value:JSON.stringify(n.input,null,2)})})}),e(F,{width:"50%",children:e(z,{title:"Reference Output",...za,extra:e(le,{text:JSON.stringify(n.input)}),bodyStyle:{padding:0,maxHeight:"300px",overflowY:"auto"},children:e(fn,{value:JSON.stringify(n.referenceOutput,null,2)})})})]})})})}),e(Ye,{css:Kn}),e(ue,{defaultSize:200,children:s(h,{direction:"column",height:"100%",children:[e(F,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderBottomColor:"dark",borderBottomWidth:"thin",flex:"none",children:e(re,{level:2,children:"Experiments"})}),e("div",{css:C`
3198
3198
  overflow-y: auto;
3199
3199
  height: 100%;
3200
3200
  padding: var(--ac-global-dimension-static-size-200);
@@ -3213,7 +3213,7 @@ fragment ExperimentsTableFragment_2HEEH6 on Dataset {
3213
3213
  gap: var(
3214
3214
  --ac-global-dimension-static-size-100
3215
3215
  );
3216
- `,children:(c=r.annotations)==null?void 0:c.edges.map(d=>e("li",{children:e(xn,{annotation:d.annotation})},d.annotation.id))})]})]})},o)})})})},t.experimentId)})})})]})})]})})}function Jr({traceId:n,projectId:a,title:l}){const t=ne();return e(G,{title:l,size:"fullscreen",extra:e(M,{variant:"default",onClick:()=>t(`/projects/${a}/traces/${n}`),children:"View Trace in Project"}),children:e(xi,{traceId:n,projectId:a})})}const Zr={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"ExperimentMultiSelector__experiments",selections:[{alias:null,args:null,concreteType:"ExperimentConnection",kind:"LinkedField",name:"experiments",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"experiment",args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Dataset",abstractKey:null};Zr.hash="1aa376b1e9425f49268ac231dc2c0412";function zg(n){const{dataset:a,selectedExperimentIds:l,onChange:t,label:i,validationState:r,description:o,errorMessage:c,...d}=n,g=D.useFragment(Zr,a),f=u.useMemo(()=>g.experiments.edges.map(y=>y.experiment),[g]),m=f.length===0,p=u.useMemo(()=>{if(m)return"No experiments";const y=l.length;return y>0?`${y} experiment${y>1?"s":""}`:"No experiments selected"},[l,m]);return e(la,{label:i,isDisabled:m,validationState:r,description:o,errorMessage:c,children:e(Wa,{isDisabled:m,...d,menu:e(na,{selectionMode:"multiple",onSelectionChange:y=>{t(Array.from(y))},selectedKeys:new Set(l),children:f.map(y=>e(U,{textValue:y.name,children:s(h,{direction:"column",gap:"size-50",children:[s(h,{direction:"row",gap:"size-100",children:[e(Ka,{sequenceNumber:y.sequenceNumber}),e(K,{children:y.name})]}),e(K,{textSize:"small",color:"text-700",children:new Date(y.createdAt).toLocaleString()})]})},y.id))}),triggerProps:{placement:"bottom start"},children:p})})}function Yy(){const n=Cn(),[a,l]=u.useState(!1),[t,i]=fa(),r=t.getAll("experimentId"),o=r.length>0;return s("main",{css:C`
3216
+ `,children:(c=r.annotations)==null?void 0:c.edges.map(d=>e("li",{children:e(xn,{annotation:d.annotation})},d.annotation.id))})]})]})},o)})})})},t.experimentId)})})})]})})]})})}function Jr({traceId:n,projectId:a,title:l}){const t=ne();return e(G,{title:l,size:"fullscreen",extra:e(M,{variant:"default",onClick:()=>t(`/projects/${a}/traces/${n}`),children:"View Trace in Project"}),children:e(xi,{traceId:n,projectId:a})})}const Zr={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"ExperimentMultiSelector__experiments",selections:[{alias:null,args:null,concreteType:"ExperimentConnection",kind:"LinkedField",name:"experiments",plural:!1,selections:[{alias:null,args:null,concreteType:"ExperimentEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"experiment",args:null,concreteType:"Experiment",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"sequenceNumber",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],type:"Dataset",abstractKey:null};Zr.hash="1aa376b1e9425f49268ac231dc2c0412";function zg(n){const{dataset:a,selectedExperimentIds:l,onChange:t,label:i,validationState:r,description:o,errorMessage:c,...d}=n,g=D.useFragment(Zr,a),f=u.useMemo(()=>g.experiments.edges.map(y=>y.experiment),[g]),m=f.length===0,p=u.useMemo(()=>{if(m)return"No experiments";const y=l.length;return y>0?`${y} experiment${y>1?"s":""}`:"No experiments selected"},[l,m]);return e(la,{label:i,isDisabled:m,validationState:r,description:o,errorMessage:c,children:e(Wa,{isDisabled:m,...d,menu:e(na,{selectionMode:"multiple",onSelectionChange:y=>{t(Array.from(y))},selectedKeys:new Set(l),children:f.map(y=>e(B,{textValue:y.name,children:s(h,{direction:"column",gap:"size-50",children:[s(h,{direction:"row",gap:"size-100",children:[e(Ka,{sequenceNumber:y.sequenceNumber}),e(K,{children:y.name})]}),e(K,{textSize:"small",color:"text-700",children:new Date(y.createdAt).toLocaleString()})]})},y.id))}),triggerProps:{placement:"bottom start"},children:p})})}function Yy(){const n=Cn(),[a,l]=u.useState(!1),[t,i]=fa(),r=t.getAll("experimentId"),o=r.length>0;return s("main",{css:C`
3217
3217
  height: 100%;
3218
3218
  display: flex;
3219
3219
  flex-direction: column;
@@ -3317,7 +3317,7 @@ fragment SystemAPIKeysTableFragment on Query {
3317
3317
  expiresAt
3318
3318
  }
3319
3319
  }
3320
- `}};as.hash="de0fc04de739f0adfcbdeaff28b16265";const ls={argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:[],operation:as}},name:"SystemAPIKeysTableFragment",selections:[{alias:null,args:null,concreteType:"SystemApiKey",kind:"LinkedField",name:"systemApiKeys",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"expiresAt",storageKey:null}],storageKey:null}],type:"Query",abstractKey:null};ls.hash="de0fc04de739f0adfcbdeaff28b16265";function Vg({query:n}){const[a,l]=D.useRefetchableFragment(ls,n),t=ge(),i=oe(),[r]=D.useMutation(ns),o=u.useCallback(p=>{r({variables:{input:{id:p}},onCompleted:()=>{i({title:"System key deleted",message:"The system key has been deleted and is no longer active."}),u.startTransition(()=>{l({},{fetchPolicy:"network-only"})})},onError:y=>{t({title:"Error deleting system key",message:y.message})}})},[r,t,i,l]),c=u.useMemo(()=>[...a.systemApiKeys],[a]),d=u.useMemo(()=>[{header:"Name",accessorKey:"name"},{header:"Description",accessorKey:"description",cell:ue},{header:"Created At",accessorKey:"createdAt",cell:Fe},{header:"Expires At",accessorKey:"expiresAt",cell:Fe},{header:"",accessorKey:"id",size:10,cell:({row:y})=>e(h,{direction:"row",justifyContent:"end",width:"100%",children:e(tl,{handleDelete:()=>{o(y.original.id)}})}),meta:{textAlign:"right"}}],[o]),g=he({columns:d,data:c,getCoreRowModel:ke()}),f=g.getRowModel().rows,m=g.getRowModel().rows.length===0;return s("table",{css:We,children:[e("thead",{children:g.getHeaderGroups().map(p=>e("tr",{children:p.headers.map(y=>e("th",{colSpan:y.colSpan,children:y.isPlaceholder?null:s("div",{className:y.column.getCanSort()?"cursor-pointer":"",onClick:y.column.getToggleSortingHandler(),style:{left:y.getStart(),width:y.getSize()},children:[Z(y.column.columnDef.header,y.getContext()),y.column.getIsSorted()?e(P,{className:"sort-icon",svg:y.column.getIsSorted()==="asc"?e(I.ArrowUpFilled,{}):e(I.ArrowDownFilled,{})}):null]})},y.id))},p.id))}),m?e(Je,{message:"No Keys"}):e("tbody",{children:f.map(p=>e("tr",{children:p.getVisibleCells().map(y=>e("td",{children:Z(y.column.columnDef.cell,y.getContext())},y.id))},p.id))})]})}const ts=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"DeleteApiKeyMutationPayload",kind:"LinkedField",name:"deleteUserApiKey",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"apiKeyId",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"UserAPIKeysTableDeleteAPIKeyMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"UserAPIKeysTableDeleteAPIKeyMutation",selections:a},params:{cacheID:"d137498515ff43864f5525b3c1847376",id:null,metadata:{},name:"UserAPIKeysTableDeleteAPIKeyMutation",operationKind:"mutation",text:`mutation UserAPIKeysTableDeleteAPIKeyMutation(
3320
+ `}};as.hash="de0fc04de739f0adfcbdeaff28b16265";const ls={argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:[],operation:as}},name:"SystemAPIKeysTableFragment",selections:[{alias:null,args:null,concreteType:"SystemApiKey",kind:"LinkedField",name:"systemApiKeys",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"expiresAt",storageKey:null}],storageKey:null}],type:"Query",abstractKey:null};ls.hash="de0fc04de739f0adfcbdeaff28b16265";function Vg({query:n}){const[a,l]=D.useRefetchableFragment(ls,n),t=ce(),i=oe(),[r]=D.useMutation(ns),o=u.useCallback(p=>{r({variables:{input:{id:p}},onCompleted:()=>{i({title:"System key deleted",message:"The system key has been deleted and is no longer active."}),u.startTransition(()=>{l({},{fetchPolicy:"network-only"})})},onError:y=>{t({title:"Error deleting system key",message:y.message})}})},[r,t,i,l]),c=u.useMemo(()=>[...a.systemApiKeys],[a]),d=u.useMemo(()=>[{header:"Name",accessorKey:"name"},{header:"Description",accessorKey:"description",cell:me},{header:"Created At",accessorKey:"createdAt",cell:Fe},{header:"Expires At",accessorKey:"expiresAt",cell:Fe},{header:"",accessorKey:"id",size:10,cell:({row:y})=>e(h,{direction:"row",justifyContent:"end",width:"100%",children:e(tl,{handleDelete:()=>{o(y.original.id)}})}),meta:{textAlign:"right"}}],[o]),g=he({columns:d,data:c,getCoreRowModel:ke()}),f=g.getRowModel().rows,m=g.getRowModel().rows.length===0;return s("table",{css:We,children:[e("thead",{children:g.getHeaderGroups().map(p=>e("tr",{children:p.headers.map(y=>e("th",{colSpan:y.colSpan,children:y.isPlaceholder?null:s("div",{className:y.column.getCanSort()?"cursor-pointer":"",onClick:y.column.getToggleSortingHandler(),style:{left:y.getStart(),width:y.getSize()},children:[Z(y.column.columnDef.header,y.getContext()),y.column.getIsSorted()?e(P,{className:"sort-icon",svg:y.column.getIsSorted()==="asc"?e(I.ArrowUpFilled,{}):e(I.ArrowDownFilled,{})}):null]})},y.id))},p.id))}),m?e(Je,{message:"No Keys"}):e("tbody",{children:f.map(p=>e("tr",{children:p.getVisibleCells().map(y=>e("td",{children:Z(y.column.columnDef.cell,y.getContext())},y.id))},p.id))})]})}const ts=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"DeleteApiKeyMutationPayload",kind:"LinkedField",name:"deleteUserApiKey",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"apiKeyId",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"UserAPIKeysTableDeleteAPIKeyMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"UserAPIKeysTableDeleteAPIKeyMutation",selections:a},params:{cacheID:"d137498515ff43864f5525b3c1847376",id:null,metadata:{},name:"UserAPIKeysTableDeleteAPIKeyMutation",operationKind:"mutation",text:`mutation UserAPIKeysTableDeleteAPIKeyMutation(
3321
3321
  $input: DeleteApiKeyInput!
3322
3322
  ) {
3323
3323
  deleteUserApiKey(input: $input) {
@@ -3341,7 +3341,7 @@ fragment UserAPIKeysTableFragment on Query {
3341
3341
  }
3342
3342
  }
3343
3343
  }
3344
- `}};is.hash="c2b3a579bcb0ba915523ecb35cae3b44";const rs={argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:[],operation:is}},name:"UserAPIKeysTableFragment",selections:[{alias:null,args:null,concreteType:"UserApiKey",kind:"LinkedField",name:"userApiKeys",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"expiresAt",storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"email",storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null};rs.hash="c2b3a579bcb0ba915523ecb35cae3b44";const Il=70;function $g({query:n}){const[a,l]=D.useRefetchableFragment(rs,n),t=ge(),i=oe(),[r]=D.useMutation(ts),o=u.useCallback(p=>{r({variables:{input:{id:p}},onCompleted:()=>{i({title:"User key deleted",message:"The user key has been deleted and is no longer active."}),u.startTransition(()=>{l({},{fetchPolicy:"network-only"})})},onError:y=>{t({title:"Error deleting user key",message:y.message})}})},[r,t,i,l]),c=u.useMemo(()=>[...a.userApiKeys],[a]),d=u.useMemo(()=>[{header:"Name",accessorKey:"name",size:100,cell:ue},{header:"Description",accessorKey:"description",cell:ue},{header:"Created At",accessorKey:"createdAt",size:Il,cell:Fe},{header:"Expires At",accessorKey:"expiresAt",size:Il,cell:Fe},{header:"User",size:120,accessorKey:"user.email",cell:ue},{header:"",accessorKey:"id",size:10,cell:({row:y})=>e(h,{direction:"row",justifyContent:"end",width:"100%",children:e(tl,{handleDelete:()=>{o(y.original.id)}})}),meta:{textAlign:"right"}}],[o]),g=he({columns:d,data:c,getCoreRowModel:ke()}),f=g.getRowModel().rows,m=g.getRowModel().rows.length===0;return s("table",{css:We,children:[e("thead",{children:g.getHeaderGroups().map(p=>e("tr",{children:p.headers.map(y=>e("th",{colSpan:y.colSpan,children:y.isPlaceholder?null:s("div",{className:y.column.getCanSort()?"cursor-pointer":"",onClick:y.column.getToggleSortingHandler(),style:{left:y.getStart(),width:y.getSize()},children:[Z(y.column.columnDef.header,y.getContext()),y.column.getIsSorted()?e(P,{className:"sort-icon",svg:y.column.getIsSorted()==="asc"?e(I.ArrowUpFilled,{}):e(I.ArrowDownFilled,{})}):null]})},y.id))},p.id))}),m?e(Je,{message:"No Keys"}):e("tbody",{children:f.map(p=>e("tr",{children:p.getVisibleCells().map(y=>e("td",{children:Z(y.column.columnDef.cell,y.getContext())},y.id))},p.id))})]})}function Og(){const n=D.useLazyLoadQuery(es,{},{fetchPolicy:"network-only"});return s(Te,{children:[e(J,{title:"System Keys",name:"System Keys",children:e(Vg,{query:n})}),e(J,{title:"User Keys",name:"User Keys",children:e($g,{query:n})})]})}function Qg(){const[n,a]=u.useState(null),l=ge(),t=d=>{a(e(it,{jwt:d}))},[i,r]=D.useMutation(Yr),o=u.useCallback(d=>{i({variables:{...d,expiresAt:d.expiresAt||null},onCompleted:g=>{t(g.createSystemApiKey.jwt)},onError:g=>{l({title:"Error creating system key",message:g.message})}})},[i,l]),c=()=>{a(e(rt,{onSubmit:o,isCommitting:r,defaultName:"System"}))};return s("div",{children:[e(Ha,{title:"API Keys",variant:"compact",extra:e(M,{variant:"default",size:"compact",icon:e(P,{svg:e(I.PlusCircleOutline,{})}),onClick:c,children:"System Key"}),children:e(u.Suspense,{fallback:e(F,{padding:"size-100",children:e(fe,{})}),children:e(Og,{})})}),e(W,{onDismiss:()=>{a(null)},children:n})]})}const ss={fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"UsersCardQuery",selections:[{args:null,kind:"FragmentSpread",name:"UsersTable_users"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"UsersCardQuery",selections:[{alias:null,args:null,concreteType:"UserConnection",kind:"LinkedField",name:"users",plural:!1,selections:[{alias:null,args:null,concreteType:"UserEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"user",args:null,concreteType:"User",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"email",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"authMethod",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null},{alias:null,args:null,concreteType:"UserRole",kind:"LinkedField",name:"role",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}]},params:{cacheID:"926faf98cad4bc437a919677347e277c",id:null,metadata:{},name:"UsersCardQuery",operationKind:"query",text:`query UsersCardQuery {
3344
+ `}};is.hash="c2b3a579bcb0ba915523ecb35cae3b44";const rs={argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:[],operation:is}},name:"UserAPIKeysTableFragment",selections:[{alias:null,args:null,concreteType:"UserApiKey",kind:"LinkedField",name:"userApiKeys",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"expiresAt",storageKey:null},{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"email",storageKey:null}],storageKey:null}],storageKey:null}],type:"Query",abstractKey:null};rs.hash="c2b3a579bcb0ba915523ecb35cae3b44";const Il=70;function $g({query:n}){const[a,l]=D.useRefetchableFragment(rs,n),t=ce(),i=oe(),[r]=D.useMutation(ts),o=u.useCallback(p=>{r({variables:{input:{id:p}},onCompleted:()=>{i({title:"User key deleted",message:"The user key has been deleted and is no longer active."}),u.startTransition(()=>{l({},{fetchPolicy:"network-only"})})},onError:y=>{t({title:"Error deleting user key",message:y.message})}})},[r,t,i,l]),c=u.useMemo(()=>[...a.userApiKeys],[a]),d=u.useMemo(()=>[{header:"Name",accessorKey:"name",size:100,cell:me},{header:"Description",accessorKey:"description",cell:me},{header:"Created At",accessorKey:"createdAt",size:Il,cell:Fe},{header:"Expires At",accessorKey:"expiresAt",size:Il,cell:Fe},{header:"User",size:120,accessorKey:"user.email",cell:me},{header:"",accessorKey:"id",size:10,cell:({row:y})=>e(h,{direction:"row",justifyContent:"end",width:"100%",children:e(tl,{handleDelete:()=>{o(y.original.id)}})}),meta:{textAlign:"right"}}],[o]),g=he({columns:d,data:c,getCoreRowModel:ke()}),f=g.getRowModel().rows,m=g.getRowModel().rows.length===0;return s("table",{css:We,children:[e("thead",{children:g.getHeaderGroups().map(p=>e("tr",{children:p.headers.map(y=>e("th",{colSpan:y.colSpan,children:y.isPlaceholder?null:s("div",{className:y.column.getCanSort()?"cursor-pointer":"",onClick:y.column.getToggleSortingHandler(),style:{left:y.getStart(),width:y.getSize()},children:[Z(y.column.columnDef.header,y.getContext()),y.column.getIsSorted()?e(P,{className:"sort-icon",svg:y.column.getIsSorted()==="asc"?e(I.ArrowUpFilled,{}):e(I.ArrowDownFilled,{})}):null]})},y.id))},p.id))}),m?e(Je,{message:"No Keys"}):e("tbody",{children:f.map(p=>e("tr",{children:p.getVisibleCells().map(y=>e("td",{children:Z(y.column.columnDef.cell,y.getContext())},y.id))},p.id))})]})}function Og(){const n=D.useLazyLoadQuery(es,{},{fetchPolicy:"network-only"});return s(Te,{children:[e(J,{title:"System Keys",name:"System Keys",children:e(Vg,{query:n})}),e(J,{title:"User Keys",name:"User Keys",children:e($g,{query:n})})]})}function Qg(){const[n,a]=u.useState(null),l=ce(),t=d=>{a(e(it,{jwt:d}))},[i,r]=D.useMutation(Yr),o=u.useCallback(d=>{i({variables:{...d,expiresAt:d.expiresAt||null},onCompleted:g=>{t(g.createSystemApiKey.jwt)},onError:g=>{l({title:"Error creating system key",message:g.message})}})},[i,l]),c=()=>{a(e(rt,{onSubmit:o,isCommitting:r,defaultName:"System"}))};return s("div",{children:[e(Ha,{title:"API Keys",variant:"compact",extra:e(M,{variant:"default",size:"compact",icon:e(P,{svg:e(I.PlusCircleOutline,{})}),onClick:c,children:"System Key"}),children:e(u.Suspense,{fallback:e(F,{padding:"size-100",children:e(fe,{})}),children:e(Og,{})})}),e(W,{onDismiss:()=>{a(null)},children:n})]})}const ss={fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"UsersCardQuery",selections:[{args:null,kind:"FragmentSpread",name:"UsersTable_users"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"UsersCardQuery",selections:[{alias:null,args:null,concreteType:"UserConnection",kind:"LinkedField",name:"users",plural:!1,selections:[{alias:null,args:null,concreteType:"UserEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"user",args:null,concreteType:"User",kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"email",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"username",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"authMethod",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"profilePictureUrl",storageKey:null},{alias:null,args:null,concreteType:"UserRole",kind:"LinkedField",name:"role",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}]},params:{cacheID:"926faf98cad4bc437a919677347e277c",id:null,metadata:{},name:"UsersCardQuery",operationKind:"query",text:`query UsersCardQuery {
3345
3345
  ...UsersTable_users
3346
3346
  }
3347
3347
 
@@ -3398,21 +3398,21 @@ fragment UsersTable_users on Query {
3398
3398
  ) {
3399
3399
  deleteUsers(input: $input)
3400
3400
  }
3401
- `}}}();us.hash="a718ceab0ec0a7d461f6cd5e5b178a1f";function qg({userId:n,onDeleted:a,onClose:l}){const[t,i]=D.useMutation(us),r=oe(),o=ge(),c=u.useCallback(()=>{t({variables:{input:{userIds:[n]}},onCompleted:()=>{r({title:"User deleted",message:"User has been deleted."}),a(),l()},onError:d=>{o({title:"Failed to delete user",message:d.message})}})},[t,o,r,l,a,n]);return s(G,{title:"Delete User",isDismissable:!0,onDismiss:l,children:[e(F,{padding:"size-200",children:e(K,{color:"danger",children:"Are you sure you want to delete this user? This action cannot be undone."})}),e(F,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:s(h,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(M,{variant:"default",onClick:l,children:"Cancel"}),e(M,{variant:"danger",onClick:()=>{c()},disabled:i,children:"Delete user"})]})})]})}const ms=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"UserMutationPayload",kind:"LinkedField",name:"patchUser",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ResetPasswordDialogMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ResetPasswordDialogMutation",selections:a},params:{cacheID:"6ccff8dd53d97eeb41f656bcd2758da1",id:null,metadata:{},name:"ResetPasswordDialogMutation",operationKind:"mutation",text:`mutation ResetPasswordDialogMutation(
3401
+ `}}}();us.hash="a718ceab0ec0a7d461f6cd5e5b178a1f";function qg({userId:n,onDeleted:a,onClose:l}){const[t,i]=D.useMutation(us),r=oe(),o=ce(),c=u.useCallback(()=>{t({variables:{input:{userIds:[n]}},onCompleted:()=>{r({title:"User deleted",message:"User has been deleted."}),a(),l()},onError:d=>{o({title:"Failed to delete user",message:d.message})}})},[t,o,r,l,a,n]);return s(G,{title:"Delete User",isDismissable:!0,onDismiss:l,children:[e(F,{padding:"size-200",children:e(K,{color:"danger",children:"Are you sure you want to delete this user? This action cannot be undone."})}),e(F,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:s(h,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(M,{variant:"default",onClick:l,children:"Cancel"}),e(M,{variant:"danger",onClick:()=>{c()},disabled:i,children:"Delete user"})]})})]})}const ms=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"UserMutationPayload",kind:"LinkedField",name:"patchUser",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ResetPasswordDialogMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ResetPasswordDialogMutation",selections:a},params:{cacheID:"6ccff8dd53d97eeb41f656bcd2758da1",id:null,metadata:{},name:"ResetPasswordDialogMutation",operationKind:"mutation",text:`mutation ResetPasswordDialogMutation(
3402
3402
  $input: PatchUserInput!
3403
3403
  ) {
3404
3404
  patchUser(input: $input) {
3405
3405
  __typename
3406
3406
  }
3407
3407
  }
3408
- `}}}();ms.hash="85b22da61ec094c28e97db2759622b69";const Gn=4;function Ug({userId:n,onClose:a}){const l=ge(),t=oe(),[i,r]=D.useMutation(ms),{control:o,handleSubmit:c,formState:{isDirty:d}}=Ie({defaultValues:{newPassword:"",confirmPassword:""}}),g=u.useCallback(f=>{i({variables:{input:{userId:n,newPassword:f.newPassword}},onCompleted:()=>{t({title:"Password reset",message:"Users password has been reset."}),a()},onError:m=>{l({title:"Failed to reset password",message:m.message})}})},[i,l,t,a,n]);return e(G,{title:"Reset Password",isDismissable:!0,onDismiss:a,children:e(ye,{children:s(F,{padding:"size-200",children:[e(B,{name:"newPassword",control:o,rules:{required:"Password is required",minLength:{value:Gn,message:`Password must be at least ${Gn} characters`}},render:({field:{name:f,onChange:m,onBlur:p,value:y},fieldState:{invalid:k,error:b}})=>e(X,{label:"New Password",type:"password",isRequired:!0,description:`Password must be at least ${Gn} characters`,name:f,errorMessage:b==null?void 0:b.message,validationState:k?"invalid":"valid",onChange:m,onBlur:p,defaultValue:y})}),e(B,{name:"confirmPassword",control:o,rules:{required:"Password is required",minLength:{value:Gn,message:`Password must be at least ${Gn} characters`},validate:(f,m)=>f===m.newPassword||"Passwords do not match"},render:({field:{name:f,onChange:m,onBlur:p,value:y},fieldState:{invalid:k,error:b}})=>e(X,{label:"Confirm Password",isRequired:!0,type:"password",description:"Confirm the new password",name:f,errorMessage:b==null?void 0:b.message,validationState:k?"invalid":"valid",onChange:m,onBlur:p,defaultValue:y})}),e(F,{paddingTop:"size-200",children:e(h,{direction:"row",gap:"size-100",justifyContent:"end",children:e(M,{variant:d?"primary":"default",type:"submit",disabled:r,onClick:c(g),children:r?"Resetting...":"Reset Password"})})})]})})})}function Bg(n){return n==="LOCAL"}function Hg(n){const{userId:a,onUserDeleted:l,authMethod:t}=n,[i,r]=u.useState(null),o=u.useCallback(()=>{r(e(qg,{userId:a,onClose:()=>r(null),onDeleted:()=>{l(),r(null)}}))},[a,l]),c=u.useCallback(()=>{r(e(Ug,{userId:a,onClose:()=>r(null)}))},[a]),d=u.useMemo(()=>{const g=e(U,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(I.TrashOutline,{})}),e(K,{children:"Delete"})]})},"deleteUser"),f=e(U,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(I.Refresh,{})}),e(K,{children:"Reset Password"})]})},"resetPassword"),m=[g];return Bg(t)&&m.push(f),m},[t]);return s("div",{onClick:g=>{g.preventDefault(),g.stopPropagation()},children:[e(Be,{align:"end","aria-label":"User Actions",buttonSize:"compact",onAction:g=>{switch(g){case"deleteUser":o();break;case"resetPassword":c();break}},children:d}),e(W,{type:"modal",isDismissable:!0,onDismiss:()=>r(null),children:i})]})}const gs=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"UserMutationPayload",kind:"LinkedField",name:"patchUser",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"UserRoleChangeDialogMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"UserRoleChangeDialogMutation",selections:a},params:{cacheID:"44e970c967f83a0b7a6bd1cbafc3a936",id:null,metadata:{},name:"UserRoleChangeDialogMutation",operationKind:"mutation",text:`mutation UserRoleChangeDialogMutation(
3408
+ `}}}();ms.hash="85b22da61ec094c28e97db2759622b69";const Gn=4;function Ug({userId:n,onClose:a}){const l=ce(),t=oe(),[i,r]=D.useMutation(ms),{control:o,handleSubmit:c,formState:{isDirty:d}}=Ie({defaultValues:{newPassword:"",confirmPassword:""}}),g=u.useCallback(f=>{i({variables:{input:{userId:n,newPassword:f.newPassword}},onCompleted:()=>{t({title:"Password reset",message:"Users password has been reset."}),a()},onError:m=>{l({title:"Failed to reset password",message:m.message})}})},[i,l,t,a,n]);return e(G,{title:"Reset Password",isDismissable:!0,onDismiss:a,children:e(ye,{children:s(F,{padding:"size-200",children:[e(H,{name:"newPassword",control:o,rules:{required:"Password is required",minLength:{value:Gn,message:`Password must be at least ${Gn} characters`}},render:({field:{name:f,onChange:m,onBlur:p,value:y},fieldState:{invalid:b,error:k}})=>e(X,{label:"New Password",type:"password",isRequired:!0,description:`Password must be at least ${Gn} characters`,name:f,errorMessage:k==null?void 0:k.message,validationState:b?"invalid":"valid",onChange:m,onBlur:p,defaultValue:y})}),e(H,{name:"confirmPassword",control:o,rules:{required:"Password is required",minLength:{value:Gn,message:`Password must be at least ${Gn} characters`},validate:(f,m)=>f===m.newPassword||"Passwords do not match"},render:({field:{name:f,onChange:m,onBlur:p,value:y},fieldState:{invalid:b,error:k}})=>e(X,{label:"Confirm Password",isRequired:!0,type:"password",description:"Confirm the new password",name:f,errorMessage:k==null?void 0:k.message,validationState:b?"invalid":"valid",onChange:m,onBlur:p,defaultValue:y})}),e(F,{paddingTop:"size-200",children:e(h,{direction:"row",gap:"size-100",justifyContent:"end",children:e(M,{variant:d?"primary":"default",type:"submit",disabled:r,onClick:c(g),children:r?"Resetting...":"Reset Password"})})})]})})})}function Bg(n){return n==="LOCAL"}function Hg(n){const{userId:a,onUserDeleted:l,authMethod:t}=n,[i,r]=u.useState(null),o=u.useCallback(()=>{r(e(qg,{userId:a,onClose:()=>r(null),onDeleted:()=>{l(),r(null)}}))},[a,l]),c=u.useCallback(()=>{r(e(Ug,{userId:a,onClose:()=>r(null)}))},[a]),d=u.useMemo(()=>{const g=e(B,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(I.TrashOutline,{})}),e(K,{children:"Delete"})]})},"deleteUser"),f=e(B,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(I.Refresh,{})}),e(K,{children:"Reset Password"})]})},"resetPassword"),m=[g];return Bg(t)&&m.push(f),m},[t]);return s("div",{onClick:g=>{g.preventDefault(),g.stopPropagation()},children:[e(Be,{align:"end","aria-label":"User Actions",buttonSize:"compact",onAction:g=>{switch(g){case"deleteUser":o();break;case"resetPassword":c();break}},children:d}),e(W,{type:"modal",isDismissable:!0,onDismiss:()=>r(null),children:i})]})}const gs=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"UserMutationPayload",kind:"LinkedField",name:"patchUser",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"UserRoleChangeDialogMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"UserRoleChangeDialogMutation",selections:a},params:{cacheID:"44e970c967f83a0b7a6bd1cbafc3a936",id:null,metadata:{},name:"UserRoleChangeDialogMutation",operationKind:"mutation",text:`mutation UserRoleChangeDialogMutation(
3409
3409
  $input: PatchUserInput!
3410
3410
  ) {
3411
3411
  patchUser(input: $input) {
3412
3412
  __typename
3413
3413
  }
3414
3414
  }
3415
- `}}}();gs.hash="468eff05b42e39b55f9aa5b9a7d2c483";function Gg({userId:n,email:a,currentRole:l,newRole:t,onRoleChanged:i,onClose:r}){const[o,c]=D.useMutation(gs),d=oe(),g=ge(),f=u.useCallback(()=>{o({variables:{input:{userId:n,newRole:t}},onCompleted:()=>{d({title:"Role Changed",message:"Users role has been changed."}),i(),r()},onError:m=>{g({title:"Failed to delete user",message:m.message})}})},[o,t,g,d,r,i,n]);return s(G,{title:"Confirm role change",children:[e(F,{padding:"size-200",children:s(K,{children:[`Are you sure you want to change the role for ${a} from `," ",e("b",{children:Qa(l)})," to"," ",e("b",{children:Qa(t)}),"?"]})}),e(F,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:s(h,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(M,{variant:"default",onClick:r,children:"Cancel"}),e(M,{variant:"primary",onClick:()=>{f()},disabled:c,children:"Change role"})]})})]})}const Wg=55,Jg=C`
3415
+ `}}}();gs.hash="468eff05b42e39b55f9aa5b9a7d2c483";function Gg({userId:n,email:a,currentRole:l,newRole:t,onRoleChanged:i,onClose:r}){const[o,c]=D.useMutation(gs),d=oe(),g=ce(),f=u.useCallback(()=>{o({variables:{input:{userId:n,newRole:t}},onCompleted:()=>{d({title:"Role Changed",message:"Users role has been changed."}),i(),r()},onError:m=>{g({title:"Failed to delete user",message:m.message})}})},[o,t,g,d,r,i,n]);return s(G,{title:"Confirm role change",children:[e(F,{padding:"size-200",children:s(K,{children:[`Are you sure you want to change the role for ${a} from `," ",e("b",{children:Qa(l)})," to"," ",e("b",{children:Qa(t)}),"?"]})}),e(F,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:s(h,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(M,{variant:"default",onClick:r,children:"Cancel"}),e(M,{variant:"primary",onClick:()=>{f()},disabled:c,children:"Change role"})]})})]})}const Wg=55,Jg=C`
3416
3416
  text-decoration: none;
3417
3417
  color: var(--ac-global-color-grey-600);
3418
3418
  font-size: 12px;
@@ -3421,7 +3421,7 @@ fragment UsersTable_users on Query {
3421
3421
  }
3422
3422
  `,Zg=C`
3423
3423
  height: ${Wg}px;
3424
- `,Ll=n=>n.email==="admin@localhost"||n.username==="admin";function Xg({query:n}){const[a,l]=u.useState(null),[t,i]=D.useRefetchableFragment(cs,n),r=u.useMemo(()=>t.users.edges.map(({user:m})=>({id:m.id,email:m.email,username:m.username,profilePictureUrl:m.profilePictureUrl,createdAt:m.createdAt,role:m.role.name,authMethod:m.authMethod})),[t]),o=u.useCallback(()=>{u.startTransition(()=>{i({},{fetchPolicy:"network-only"})})},[i]),c=u.useMemo(()=>[{header:"user",accessorKey:"username",cell:({row:m})=>s(h,{direction:"row",gap:"size-50",alignItems:"center",children:[e(st,{name:m.original.username,profilePictureUrl:m.original.profilePictureUrl,size:20}),e("span",{children:m.original.username}),e("a",{href:`mailto:${m.original.email}`,css:Jg,children:m.original.email})]})},{header:"method",accessorKey:"authMethod",size:10,cell:({row:m})=>m.original.authMethod.toLowerCase()},{header:"role",accessorKey:"role",cell:({row:m})=>Ll(m.original)?Qa(m.original.role):e(od,{includeLabel:!1,onChange:p=>{p!==m.original.role&&l(e(Gg,{onClose:()=>l(null),onRoleChanged:o,currentRole:m.original.role,newRole:p,email:m.original.email,userId:m.original.id}))},role:sd(m.original.role)?m.original.role:void 0})},{header:"created at",accessorKey:"createdAt",cell:Fe},{header:"",accessorKey:"id",size:10,cell:({row:m})=>Ll(m.original)?null:e(h,{direction:"row",justifyContent:"end",width:"100%",children:e(Hg,{userId:m.original.id,onUserDeleted:o,authMethod:m.original.authMethod})}),meta:{textAlign:"right"}}],[o]),d=he({columns:c,data:r,getCoreRowModel:ke(),getSortedRowModel:Rn()}),g=d.getRowModel().rows,f=d.getRowModel().rows.length===0;return s("table",{css:We,children:[e("thead",{children:d.getHeaderGroups().map(m=>e("tr",{children:m.headers.map(p=>e("th",{colSpan:p.colSpan,children:p.isPlaceholder?null:s("div",{className:p.column.getCanSort()?"cursor-pointer":"",onClick:p.column.getToggleSortingHandler(),style:{left:p.getStart(),width:p.getSize()},children:[Z(p.column.columnDef.header,p.getContext()),p.column.getIsSorted()?e(P,{className:"sort-icon",svg:p.column.getIsSorted()==="asc"?e(I.ArrowUpFilled,{}):e(I.ArrowDownFilled,{})}):null]})},p.id))},m.id))}),f?e(Je,{}):e("tbody",{children:g.map(m=>e("tr",{css:Zg,children:m.getVisibleCells().map(p=>e("td",{children:Z(p.column.columnDef.cell,p.getContext())},p.id))},m.id))}),e(W,{onDismiss:()=>l(null),isDismissable:!0,type:"modal",children:a})]})}function Yg(){const[n,a]=u.useState(0),[l,t]=u.useState(null),i=oe(),r=ge(),o=D.useLazyLoadQuery(ss,{},{fetchKey:n,fetchPolicy:"store-and-network"});return s(z,{title:"Users",variant:"compact",bodyStyle:{padding:0,overflowX:"auto"},extra:e(M,{onClick:()=>{t(e(jg,{onDismiss:()=>{t(null)},onNewUserCreated:c=>{t(null),i({title:"User added",message:`User ${c} has been added.`}),a(d=>d+1)},onNewUserCreationError:c=>{r({title:"Error adding user",message:c.message})}}))},variant:"default",size:"compact",icon:e(P,{svg:e(I.PlusCircleOutline,{})}),children:"Add User"}),children:[e(u.Suspense,{fallback:e(F,{padding:"size-200",children:e(fe,{})}),children:e(Xg,{query:o})}),e(W,{onDismiss:()=>{t(null)},children:l})]})}const ep=C`
3424
+ `,Ll=n=>n.email==="admin@localhost"||n.username==="admin";function Xg({query:n}){const[a,l]=u.useState(null),[t,i]=D.useRefetchableFragment(cs,n),r=u.useMemo(()=>t.users.edges.map(({user:m})=>({id:m.id,email:m.email,username:m.username,profilePictureUrl:m.profilePictureUrl,createdAt:m.createdAt,role:m.role.name,authMethod:m.authMethod})),[t]),o=u.useCallback(()=>{u.startTransition(()=>{i({},{fetchPolicy:"network-only"})})},[i]),c=u.useMemo(()=>[{header:"user",accessorKey:"username",cell:({row:m})=>s(h,{direction:"row",gap:"size-50",alignItems:"center",children:[e(st,{name:m.original.username,profilePictureUrl:m.original.profilePictureUrl,size:20}),e("span",{children:m.original.username}),e("a",{href:`mailto:${m.original.email}`,css:Jg,children:m.original.email})]})},{header:"method",accessorKey:"authMethod",size:10,cell:({row:m})=>m.original.authMethod.toLowerCase()},{header:"role",accessorKey:"role",cell:({row:m})=>Ll(m.original)?Qa(m.original.role):e(od,{includeLabel:!1,onChange:p=>{p!==m.original.role&&l(e(Gg,{onClose:()=>l(null),onRoleChanged:o,currentRole:m.original.role,newRole:p,email:m.original.email,userId:m.original.id}))},role:sd(m.original.role)?m.original.role:void 0})},{header:"created at",accessorKey:"createdAt",cell:Fe},{header:"",accessorKey:"id",size:10,cell:({row:m})=>Ll(m.original)?null:e(h,{direction:"row",justifyContent:"end",width:"100%",children:e(Hg,{userId:m.original.id,onUserDeleted:o,authMethod:m.original.authMethod})}),meta:{textAlign:"right"}}],[o]),d=he({columns:c,data:r,getCoreRowModel:ke(),getSortedRowModel:Rn()}),g=d.getRowModel().rows,f=d.getRowModel().rows.length===0;return s("table",{css:We,children:[e("thead",{children:d.getHeaderGroups().map(m=>e("tr",{children:m.headers.map(p=>e("th",{colSpan:p.colSpan,children:p.isPlaceholder?null:s("div",{className:p.column.getCanSort()?"cursor-pointer":"",onClick:p.column.getToggleSortingHandler(),style:{left:p.getStart(),width:p.getSize()},children:[Z(p.column.columnDef.header,p.getContext()),p.column.getIsSorted()?e(P,{className:"sort-icon",svg:p.column.getIsSorted()==="asc"?e(I.ArrowUpFilled,{}):e(I.ArrowDownFilled,{})}):null]})},p.id))},m.id))}),f?e(Je,{}):e("tbody",{children:g.map(m=>e("tr",{css:Zg,children:m.getVisibleCells().map(p=>e("td",{children:Z(p.column.columnDef.cell,p.getContext())},p.id))},m.id))}),e(W,{onDismiss:()=>l(null),isDismissable:!0,type:"modal",children:a})]})}function Yg(){const[n,a]=u.useState(0),[l,t]=u.useState(null),i=oe(),r=ce(),o=D.useLazyLoadQuery(ss,{},{fetchKey:n,fetchPolicy:"store-and-network"});return s(z,{title:"Users",variant:"compact",bodyStyle:{padding:0,overflowX:"auto"},extra:e(M,{onClick:()=>{t(e(jg,{onDismiss:()=>{t(null)},onNewUserCreated:c=>{t(null),i({title:"User added",message:`User ${c} has been added.`}),a(d=>d+1)},onNewUserCreationError:c=>{r({title:"Error adding user",message:c.message})}}))},variant:"default",size:"compact",icon:e(P,{svg:e(I.PlusCircleOutline,{})}),children:"Add User"}),children:[e(u.Suspense,{fallback:e(F,{padding:"size-200",children:e(fe,{})}),children:e(Xg,{query:o})}),e(W,{onDismiss:()=>{t(null)},children:l})]})}const ep=C`
3425
3425
  overflow-y: auto;
3426
3426
  `,np=C`
3427
3427
  padding: var(--ac-global-dimension-size-400);
@@ -3477,7 +3477,7 @@ fragment UsersTable_users on Query {
3477
3477
  text-decoration: underline;
3478
3478
  }
3479
3479
  }
3480
- `,children:[e("a",{href:"https://docs.arize.com/phoenix",children:"Documentation"}),"|",e("a",{href:"https://join.slack.com/t/arize-ai/shared_invite/zt-1px8dcmlf-fmThhDFD_V_48oU7ALan4Q",children:"Community"}),"|",e("a",{href:"https://twitter.com/ArizePhoenix",children:"Social"}),"|",e("a",{href:"https://github.com/Arize-ai/phoenix",children:"GitHub"}),"|",e("a",{href:"https://github.com/Arize-ai/phoenix/releases",children:`arize-phoenix v${window.Config.platformVersion}`})]})]})}function lp(n){const a=ne(),{initialError:l,onSubmit:t}=n,[i,r]=u.useState(l),[o,c]=u.useState(!1),d=u.useCallback(async m=>{t==null||t(),r(null),c(!0);try{const y=await fetch("/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(m)});if(!y.ok){const k=y.status===429?"Too many requests. Please try again later.":"Invalid login";r(k);return}}catch{r("Invalid login");return}finally{c(()=>!1)}const p=dd();a(p)},[a,t,r]),{control:g,handleSubmit:f}=Ie({defaultValues:{email:"",password:""}});return s(q,{children:[i?s(F,{paddingBottom:"size-100",children:[e(ee,{variant:"danger",children:i})," "]}):null,s(ye,{children:[e(B,{name:"email",control:g,render:({field:{onChange:m,value:p}})=>e(X,{label:"Email",name:"email",isRequired:!0,type:"email",onChange:m,value:p,placeholder:"your email address"})}),s("div",{css:C`
3480
+ `,children:[e("a",{href:"https://docs.arize.com/phoenix",children:"Documentation"}),"|",e("a",{href:"https://join.slack.com/t/arize-ai/shared_invite/zt-1px8dcmlf-fmThhDFD_V_48oU7ALan4Q",children:"Community"}),"|",e("a",{href:"https://twitter.com/ArizePhoenix",children:"Social"}),"|",e("a",{href:"https://github.com/Arize-ai/phoenix",children:"GitHub"}),"|",e("a",{href:"https://github.com/Arize-ai/phoenix/releases",children:`arize-phoenix v${window.Config.platformVersion}`})]})]})}function lp(n){const a=ne(),{initialError:l,onSubmit:t}=n,[i,r]=u.useState(l),[o,c]=u.useState(!1),d=u.useCallback(async m=>{t==null||t(),r(null),c(!0);try{const y=await fetch("/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(m)});if(!y.ok){const b=y.status===429?"Too many requests. Please try again later.":"Invalid login";r(b);return}}catch{r("Invalid login");return}finally{c(()=>!1)}const p=dd();a(p)},[a,t,r]),{control:g,handleSubmit:f}=Ie({defaultValues:{email:"",password:""}});return s(q,{children:[i?s(F,{paddingBottom:"size-100",children:[e(ee,{variant:"danger",children:i})," "]}):null,s(ye,{children:[e(H,{name:"email",control:g,render:({field:{onChange:m,value:p}})=>e(X,{label:"Email",name:"email",isRequired:!0,type:"email",onChange:m,value:p,placeholder:"your email address"})}),s("div",{css:C`
3481
3481
  position: relative;
3482
3482
  a {
3483
3483
  position: absolute;
@@ -3486,7 +3486,7 @@ fragment UsersTable_users on Query {
3486
3486
  top: var(--ac-global-dimension-size-50);
3487
3487
  font-size: 12px;
3488
3488
  }
3489
- `,children:[e(B,{name:"password",control:g,render:({field:{onChange:m,value:p}})=>e(X,{label:"Password",name:"password",type:"password",isRequired:!0,onChange:m,value:p,placeholder:"your password",onKeyDown:y=>{y.key==="Enter"&&f(d)()}})}),e(Ze,{to:"/forgot-password",children:"Forgot your password?"})]}),e("div",{css:C`
3489
+ `,children:[e(H,{name:"password",control:g,render:({field:{onChange:m,value:p}})=>e(X,{label:"Password",name:"password",type:"password",isRequired:!0,onChange:m,value:p,placeholder:"your password",onKeyDown:y=>{y.key==="Enter"&&f(d)()}})}),e(Ze,{to:"/forgot-password",children:"Forgot your password?"})]}),e("div",{css:C`
3490
3490
  margin-top: var(--ac-global-dimension-size-200);
3491
3491
  margin-bottom: var(--ac-global-dimension-size-50);
3492
3492
  button {
@@ -3551,14 +3551,14 @@ fragment UsersTable_users on Query {
3551
3551
  __typename
3552
3552
  }
3553
3553
  }
3554
- `}}}();ps.hash="f8f5c30b0e00c17cdda7557c73c3c2d3";const Wn=4;function dp(){const n=ne(),a=ge(),[l,t]=D.useMutation(ps),{control:i,handleSubmit:r}=Ie({defaultValues:{currentPassword:"",newPassword:"",confirmPassword:""}}),o=u.useCallback(c=>{l({variables:{input:{currentPassword:c.currentPassword,newPassword:c.newPassword}},onCompleted:()=>{const d=ot({path:"/login",searchParams:{message:"Password has been reset."}});n(d)},onError:d=>{a({title:"Failed to reset password",message:d.message})}})},[l,n,a]);return s(ye,{onSubmit:r(o),children:[e(B,{name:"currentPassword",control:i,rules:{required:"the current is required"},render:({field:{name:c,onChange:d,onBlur:g,value:f},fieldState:{invalid:m,error:p}})=>e(X,{label:"Old Password",type:"password",name:c,isRequired:!0,description:"The current password",errorMessage:p==null?void 0:p.message,validationState:m?"invalid":"valid",onChange:d,onBlur:g,value:f})}),e(B,{name:"newPassword",control:i,rules:{required:"Password is required",minLength:{value:Wn,message:`Password must be at least ${Wn} characters`},validate:(c,d)=>c!==d.currentPassword||"New password must be different"},render:({field:{name:c,onChange:d,onBlur:g,value:f},fieldState:{invalid:m,error:p}})=>e(X,{label:"New Password",type:"password",isRequired:!0,description:`Password must be at least ${Wn} characters`,name:c,errorMessage:p==null?void 0:p.message,validationState:m?"invalid":"valid",onChange:d,onBlur:g,defaultValue:f})}),e(B,{name:"confirmPassword",control:i,rules:{required:"Password is required",minLength:{value:Wn,message:`Password must be at least ${Wn} characters`},validate:(c,d)=>c===d.newPassword||"Passwords do not match"},render:({field:{name:c,onChange:d,onBlur:g,value:f},fieldState:{invalid:m,error:p}})=>e(X,{label:"Confirm Password",isRequired:!0,type:"password",description:"Confirm the new password",name:c,errorMessage:p==null?void 0:p.message,validationState:m?"invalid":"valid",onChange:d,onBlur:g,defaultValue:f})}),e(F,{paddingTop:"size-200",children:s("div",{css:C`
3554
+ `}}}();ps.hash="f8f5c30b0e00c17cdda7557c73c3c2d3";const Wn=4;function dp(){const n=ne(),a=ce(),[l,t]=D.useMutation(ps),{control:i,handleSubmit:r}=Ie({defaultValues:{currentPassword:"",newPassword:"",confirmPassword:""}}),o=u.useCallback(c=>{l({variables:{input:{currentPassword:c.currentPassword,newPassword:c.newPassword}},onCompleted:()=>{const d=ot({path:"/login",searchParams:{message:"Password has been reset."}});n(d)},onError:d=>{a({title:"Failed to reset password",message:d.message})}})},[l,n,a]);return s(ye,{onSubmit:r(o),children:[e(H,{name:"currentPassword",control:i,rules:{required:"the current is required"},render:({field:{name:c,onChange:d,onBlur:g,value:f},fieldState:{invalid:m,error:p}})=>e(X,{label:"Old Password",type:"password",name:c,isRequired:!0,description:"The current password",errorMessage:p==null?void 0:p.message,validationState:m?"invalid":"valid",onChange:d,onBlur:g,value:f})}),e(H,{name:"newPassword",control:i,rules:{required:"Password is required",minLength:{value:Wn,message:`Password must be at least ${Wn} characters`},validate:(c,d)=>c!==d.currentPassword||"New password must be different"},render:({field:{name:c,onChange:d,onBlur:g,value:f},fieldState:{invalid:m,error:p}})=>e(X,{label:"New Password",type:"password",isRequired:!0,description:`Password must be at least ${Wn} characters`,name:c,errorMessage:p==null?void 0:p.message,validationState:m?"invalid":"valid",onChange:d,onBlur:g,defaultValue:f})}),e(H,{name:"confirmPassword",control:i,rules:{required:"Password is required",minLength:{value:Wn,message:`Password must be at least ${Wn} characters`},validate:(c,d)=>c===d.newPassword||"Passwords do not match"},render:({field:{name:c,onChange:d,onBlur:g,value:f},fieldState:{invalid:m,error:p}})=>e(X,{label:"Confirm Password",isRequired:!0,type:"password",description:"Confirm the new password",name:c,errorMessage:p==null?void 0:p.message,validationState:m?"invalid":"valid",onChange:d,onBlur:g,defaultValue:f})}),e(F,{paddingTop:"size-200",children:s("div",{css:C`
3555
3555
  display: flex;
3556
3556
  flex-direction: row;
3557
3557
  gap: var(--ac-global-dimension-size-200);
3558
3558
  & > * {
3559
3559
  width: 50%;
3560
3560
  }
3561
- `,children:[e(M,{variant:"default",onClick:()=>{n(-1)},children:"Cancel"}),e(M,{variant:"primary",type:"submit",disabled:t,children:t?"Resetting...":"Reset Password"})]})})]})}function tf(){return s(Da,{children:[e(h,{direction:"column",gap:"size-200",alignItems:"center",children:e(F,{paddingBottom:"size-200",children:e(dl,{})})}),e(dp,{})]})}const Jn=4,cp="An error occurred. Please try resetting again.";function up({resetToken:n}){const a=ne(),[l,t]=u.useState(null),[i,r]=u.useState(!1),o=u.useCallback(async({resetToken:f,newPassword:m})=>{t(null),r(!0);try{const p=await fetch("/auth/password-reset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:f,password:m})});if(!p.ok){const y=await p.text();t(y);return}}catch{t(cp);return}finally{r(()=>!1)}a(`/login?message=${encodeURIComponent("Password has been reset.")}`)},[t,a]),{control:c,handleSubmit:d,formState:{isDirty:g}}=Ie({defaultValues:{resetToken:n,newPassword:"",confirmPassword:""}});return s(q,{children:[l?e(F,{paddingBottom:"size-100",children:e(ee,{variant:"danger",children:l})}):null,s(ye,{onSubmit:d(o),children:[e(B,{name:"newPassword",control:c,rules:{required:"Password is required",minLength:{value:Jn,message:`Password must be at least ${Jn} characters`}},render:({field:{name:f,onChange:m,onBlur:p,value:y},fieldState:{invalid:k,error:b}})=>e(X,{label:"New Password",type:"password",isRequired:!0,description:`Password must be at least ${Jn} characters`,name:f,errorMessage:b==null?void 0:b.message,validationState:k?"invalid":"valid",onChange:m,onBlur:p,defaultValue:y})}),e(B,{name:"confirmPassword",control:c,rules:{required:"Password is required",minLength:{value:Jn,message:`Password must be at least ${Jn} characters`},validate:(f,m)=>f===m.newPassword||"Passwords do not match"},render:({field:{name:f,onChange:m,onBlur:p,value:y},fieldState:{invalid:k,error:b}})=>e(X,{label:"Confirm Password",isRequired:!0,type:"password",description:"Confirm the new password",name:f,errorMessage:b==null?void 0:b.message,validationState:k?"invalid":"valid",onChange:m,onBlur:p,defaultValue:y})}),e("div",{css:C`
3561
+ `,children:[e(M,{variant:"default",onClick:()=>{n(-1)},children:"Cancel"}),e(M,{variant:"primary",type:"submit",disabled:t,children:t?"Resetting...":"Reset Password"})]})})]})}function tf(){return s(Da,{children:[e(h,{direction:"column",gap:"size-200",alignItems:"center",children:e(F,{paddingBottom:"size-200",children:e(dl,{})})}),e(dp,{})]})}const Jn=4,cp="An error occurred. Please try resetting again.";function up({resetToken:n}){const a=ne(),[l,t]=u.useState(null),[i,r]=u.useState(!1),o=u.useCallback(async({resetToken:f,newPassword:m})=>{t(null),r(!0);try{const p=await fetch("/auth/password-reset",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:f,password:m})});if(!p.ok){const y=await p.text();t(y);return}}catch{t(cp);return}finally{r(()=>!1)}a(`/login?message=${encodeURIComponent("Password has been reset.")}`)},[t,a]),{control:c,handleSubmit:d,formState:{isDirty:g}}=Ie({defaultValues:{resetToken:n,newPassword:"",confirmPassword:""}});return s(q,{children:[l?e(F,{paddingBottom:"size-100",children:e(ee,{variant:"danger",children:l})}):null,s(ye,{onSubmit:d(o),children:[e(H,{name:"newPassword",control:c,rules:{required:"Password is required",minLength:{value:Jn,message:`Password must be at least ${Jn} characters`}},render:({field:{name:f,onChange:m,onBlur:p,value:y},fieldState:{invalid:b,error:k}})=>e(X,{label:"New Password",type:"password",isRequired:!0,description:`Password must be at least ${Jn} characters`,name:f,errorMessage:k==null?void 0:k.message,validationState:b?"invalid":"valid",onChange:m,onBlur:p,defaultValue:y})}),e(H,{name:"confirmPassword",control:c,rules:{required:"Password is required",minLength:{value:Jn,message:`Password must be at least ${Jn} characters`},validate:(f,m)=>f===m.newPassword||"Passwords do not match"},render:({field:{name:f,onChange:m,onBlur:p,value:y},fieldState:{invalid:b,error:k}})=>e(X,{label:"Confirm Password",isRequired:!0,type:"password",description:"Confirm the new password",name:f,errorMessage:k==null?void 0:k.message,validationState:b?"invalid":"valid",onChange:m,onBlur:p,defaultValue:y})}),e("div",{css:C`
3562
3562
  margin-top: var(--ac-global-dimension-size-200);
3563
3563
  margin-bottom: var(--ac-global-dimension-size-50);
3564
3564
  button {
@@ -3570,7 +3570,7 @@ fragment UsersTable_users on Query {
3570
3570
  email
3571
3571
  }
3572
3572
  }
3573
- `}}}();ys.hash="ccd75708c3ba7c1b283f7858dfa8d20e";async function sf(){const n=await D.fetchQuery(xe,ys,{}).toPromise();return n!=null&&n.viewer?n:Pn("/login")}function mp({onResetSent:n}){const[a,l]=u.useState(null),[t,i]=u.useState(!1),r=u.useCallback(async d=>{l(null),i(!0);try{const g=await fetch("/auth/password-reset-email",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)});if(!g.ok){const f=await g.text();l(f);return}n()}finally{i(()=>!1)}},[n,l]),{control:o,handleSubmit:c}=Ie({defaultValues:{email:""}});return s(q,{children:[a?e(F,{paddingBottom:"size-100",children:e(ee,{variant:"danger",children:a})}):null,s(ye,{onSubmit:c(r),children:[e(B,{name:"email",control:o,render:({field:{onChange:d,value:g}})=>e(X,{label:"Email",name:"email",isRequired:!0,type:"email",onChange:d,value:g,placeholder:"your email address",description:"Enter the email address associated with your account."})}),e("div",{css:C`
3573
+ `}}}();ys.hash="ccd75708c3ba7c1b283f7858dfa8d20e";async function sf(){const n=await D.fetchQuery(xe,ys,{}).toPromise();return n!=null&&n.viewer?n:Pn("/login")}function mp({onResetSent:n}){const[a,l]=u.useState(null),[t,i]=u.useState(!1),r=u.useCallback(async d=>{l(null),i(!0);try{const g=await fetch("/auth/password-reset-email",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)});if(!g.ok){const f=await g.text();l(f);return}n()}finally{i(()=>!1)}},[n,l]),{control:o,handleSubmit:c}=Ie({defaultValues:{email:""}});return s(q,{children:[a?e(F,{paddingBottom:"size-100",children:e(ee,{variant:"danger",children:a})}):null,s(ye,{onSubmit:c(r),children:[e(H,{name:"email",control:o,render:({field:{onChange:d,value:g}})=>e(X,{label:"Email",name:"email",isRequired:!0,type:"email",onChange:d,value:g,placeholder:"your email address",description:"Enter the email address associated with your account."})}),e("div",{css:C`
3574
3574
  margin-top: var(--ac-global-dimension-size-200);
3575
3575
  margin-bottom: var(--ac-global-dimension-size-50);
3576
3576
  button {
@@ -3654,14 +3654,14 @@ fragment APIKeysTableFragment on User {
3654
3654
  }
3655
3655
  id
3656
3656
  }
3657
- `}}}();ks.hash="6c32098d55e4cba859dcec73f3ccd28c";const bs=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:["node"],operation:ks,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"APIKeysTableFragment",selections:[{alias:null,args:null,concreteType:"UserApiKey",kind:"LinkedField",name:"apiKeys",plural:!0,selections:[n,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"expiresAt",storageKey:null}],storageKey:null},n],type:"User",abstractKey:null}}();bs.hash="6c32098d55e4cba859dcec73f3ccd28c";const wl=70;function gp({query:n}){const[a,l]=D.useRefetchableFragment(bs,n),t=oe(),[i]=D.useMutation(hs),r=u.useCallback(m=>{i({variables:{input:{id:m}},onCompleted:()=>{t({title:"API key deleted",message:"The key has been deleted and is no longer active."}),u.startTransition(()=>{l({},{fetchPolicy:"network-only"})})}})},[i,t,l]),o=u.useMemo(()=>[...a.apiKeys],[a]),c=u.useMemo(()=>[{header:"Name",accessorKey:"name",size:100,cell:ue},{header:"Description",accessorKey:"description",cell:ue},{header:"Created At",accessorKey:"createdAt",size:wl,cell:Fe},{header:"Expires At",accessorKey:"expiresAt",size:wl,cell:Fe},{header:"",accessorKey:"id",size:10,cell:({row:p})=>e(h,{direction:"row",justifyContent:"end",width:"100%",children:e(tl,{handleDelete:()=>{r(p.original.id)}})}),meta:{textAlign:"right"}}],[r]),d=he({columns:c,data:o,getCoreRowModel:ke()}),g=d.getRowModel().rows,f=d.getRowModel().rows.length===0;return s("table",{css:We,children:[e("thead",{children:d.getHeaderGroups().map(m=>e("tr",{children:m.headers.map(p=>e("th",{colSpan:p.colSpan,children:p.isPlaceholder?null:s("div",{className:p.column.getCanSort()?"cursor-pointer":"",onClick:p.column.getToggleSortingHandler(),style:{left:p.getStart(),width:p.getSize()},children:[Z(p.column.columnDef.header,p.getContext()),p.column.getIsSorted()?e(P,{className:"sort-icon",svg:p.column.getIsSorted()==="asc"?e(I.ArrowUpFilled,{}):e(I.ArrowDownFilled,{})}):null]})},p.id))},m.id))}),f?e(Je,{message:"No Keys"}):e("tbody",{children:g.map(m=>e("tr",{children:m.getVisibleCells().map(p=>e("td",{children:Z(p.column.columnDef.cell,p.getContext())},p.id))},m.id))})]})}function pp({viewer:n}){const[a,l]=u.useState(null),t=ge(),[i,r]=D.useMutation(fs),o=u.useCallback(c=>{i({variables:{input:{...c,expiresAt:c.expiresAt||null}},onCompleted:d=>{l(e(it,{jwt:d.createUserApiKey.jwt}))},onError:d=>{t({title:"Error creating API key",message:d.message})}})},[i,t]);return s(z,{title:"API Keys",variant:"compact",bodyStyle:{padding:0},extra:e(M,{variant:"default",size:"compact",icon:e(P,{svg:e(I.PlusCircleOutline,{})}),onClick:()=>l(e(rt,{onSubmit:o,isCommitting:r})),children:"New Key"}),children:[e(gp,{query:n}),e(W,{onDismiss:()=>{l(null)},children:a})]})}const Ss=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"UserMutationPayload",kind:"LinkedField",name:"patchViewer",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ViewerProfileCardMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ViewerProfileCardMutation",selections:a},params:{cacheID:"03f161df42c71b5924a8ee665e01cdce",id:null,metadata:{},name:"ViewerProfileCardMutation",operationKind:"mutation",text:`mutation ViewerProfileCardMutation(
3657
+ `}}}();ks.hash="6c32098d55e4cba859dcec73f3ccd28c";const bs=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:["node"],operation:ks,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"APIKeysTableFragment",selections:[{alias:null,args:null,concreteType:"UserApiKey",kind:"LinkedField",name:"apiKeys",plural:!0,selections:[n,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"expiresAt",storageKey:null}],storageKey:null},n],type:"User",abstractKey:null}}();bs.hash="6c32098d55e4cba859dcec73f3ccd28c";const wl=70;function gp({query:n}){const[a,l]=D.useRefetchableFragment(bs,n),t=oe(),[i]=D.useMutation(hs),r=u.useCallback(m=>{i({variables:{input:{id:m}},onCompleted:()=>{t({title:"API key deleted",message:"The key has been deleted and is no longer active."}),u.startTransition(()=>{l({},{fetchPolicy:"network-only"})})}})},[i,t,l]),o=u.useMemo(()=>[...a.apiKeys],[a]),c=u.useMemo(()=>[{header:"Name",accessorKey:"name",size:100,cell:me},{header:"Description",accessorKey:"description",cell:me},{header:"Created At",accessorKey:"createdAt",size:wl,cell:Fe},{header:"Expires At",accessorKey:"expiresAt",size:wl,cell:Fe},{header:"",accessorKey:"id",size:10,cell:({row:p})=>e(h,{direction:"row",justifyContent:"end",width:"100%",children:e(tl,{handleDelete:()=>{r(p.original.id)}})}),meta:{textAlign:"right"}}],[r]),d=he({columns:c,data:o,getCoreRowModel:ke()}),g=d.getRowModel().rows,f=d.getRowModel().rows.length===0;return s("table",{css:We,children:[e("thead",{children:d.getHeaderGroups().map(m=>e("tr",{children:m.headers.map(p=>e("th",{colSpan:p.colSpan,children:p.isPlaceholder?null:s("div",{className:p.column.getCanSort()?"cursor-pointer":"",onClick:p.column.getToggleSortingHandler(),style:{left:p.getStart(),width:p.getSize()},children:[Z(p.column.columnDef.header,p.getContext()),p.column.getIsSorted()?e(P,{className:"sort-icon",svg:p.column.getIsSorted()==="asc"?e(I.ArrowUpFilled,{}):e(I.ArrowDownFilled,{})}):null]})},p.id))},m.id))}),f?e(Je,{message:"No Keys"}):e("tbody",{children:g.map(m=>e("tr",{children:m.getVisibleCells().map(p=>e("td",{children:Z(p.column.columnDef.cell,p.getContext())},p.id))},m.id))})]})}function pp({viewer:n}){const[a,l]=u.useState(null),t=ce(),[i,r]=D.useMutation(fs),o=u.useCallback(c=>{i({variables:{input:{...c,expiresAt:c.expiresAt||null}},onCompleted:d=>{l(e(it,{jwt:d.createUserApiKey.jwt}))},onError:d=>{t({title:"Error creating API key",message:d.message})}})},[i,t]);return s(z,{title:"API Keys",variant:"compact",bodyStyle:{padding:0},extra:e(M,{variant:"default",size:"compact",icon:e(P,{svg:e(I.PlusCircleOutline,{})}),onClick:()=>l(e(rt,{onSubmit:o,isCommitting:r})),children:"New Key"}),children:[e(gp,{query:n}),e(W,{onDismiss:()=>{l(null)},children:a})]})}const Ss=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"UserMutationPayload",kind:"LinkedField",name:"patchViewer",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ViewerProfileCardMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ViewerProfileCardMutation",selections:a},params:{cacheID:"03f161df42c71b5924a8ee665e01cdce",id:null,metadata:{},name:"ViewerProfileCardMutation",operationKind:"mutation",text:`mutation ViewerProfileCardMutation(
3658
3658
  $input: PatchViewerInput!
3659
3659
  ) {
3660
3660
  patchViewer(input: $input) {
3661
3661
  __typename
3662
3662
  }
3663
3663
  }
3664
- `}}}();Ss.hash="4a11ca65151d84fe95f636763c91dc68";function yp(){const{viewer:n,refetchViewer:a}=dt(),l=ge(),t=oe(),[i,r]=D.useMutation(Ss),o=ne(),{control:c,handleSubmit:d,formState:{isDirty:g},reset:f}=Ie({defaultValues:{username:(n==null?void 0:n.username)||""}}),m=u.useCallback(p=>{i({variables:{input:{newUsername:p.username}},onCompleted:()=>{t({title:"Profile updated",message:"Your profile has been updated"}),f({username:p.username}),a()},onError:y=>{l({title:"Failed update profile",message:y.message})}})},[i,t,f,a,l]);return n?s(z,{title:"Profile",variant:"compact",bodyStyle:{padding:0},extra:n.authMethod==="LOCAL"&&e(M,{variant:"default",size:"compact",onClick:()=>{o("/reset-password")},children:"Reset Password"}),children:[e(F,{paddingTop:"size-200",paddingStart:"size-200",paddingEnd:"size-200",children:s(h,{direction:"row",gap:"size-200",alignItems:"center",children:[e(st,{name:n.username||n.email,profilePictureUrl:n.profilePictureUrl}),s(h,{direction:"column",gap:"size-50",children:[e(re,{level:2,weight:"heavy",children:n.username||n.email}),e(K,{children:n.role.name.toLocaleLowerCase()})]})]})}),e(F,{children:s(ye,{onSubmit:d(m),children:[s(F,{padding:"size-200",children:[e(X,{label:"Email",value:n.email,isReadOnly:!0}),e(B,{name:"username",control:c,rules:{required:"A username is required as it needs to be unique"},render:({field:{name:p,onChange:y,onBlur:k,value:b},fieldState:{invalid:v,error:S}})=>e(X,{label:"Username",isRequired:!0,description:"A unique username",name:p,errorMessage:S==null?void 0:S.message,validationState:v?"invalid":"valid",onChange:y,onBlur:k,defaultValue:b})})]}),e(F,{paddingTop:"size-100",paddingBottom:"size-100",paddingStart:"size-200",paddingEnd:"size-200",borderTopColor:"dark",borderTopWidth:"thin",children:e(h,{direction:"row",gap:"size-100",justifyContent:"end",children:e(M,{variant:g?"primary":"default",size:"compact",disabled:!g,onClick:()=>{d(m)()},children:r?"Saving...":"Save"})})})]})})]}):null}const fp=C`
3664
+ `}}}();Ss.hash="4a11ca65151d84fe95f636763c91dc68";function yp(){const{viewer:n,refetchViewer:a}=dt(),l=ce(),t=oe(),[i,r]=D.useMutation(Ss),o=ne(),{control:c,handleSubmit:d,formState:{isDirty:g},reset:f}=Ie({defaultValues:{username:(n==null?void 0:n.username)||""}}),m=u.useCallback(p=>{i({variables:{input:{newUsername:p.username}},onCompleted:()=>{t({title:"Profile updated",message:"Your profile has been updated"}),f({username:p.username}),a()},onError:y=>{l({title:"Failed update profile",message:y.message})}})},[i,t,f,a,l]);return n?s(z,{title:"Profile",variant:"compact",bodyStyle:{padding:0},extra:n.authMethod==="LOCAL"&&e(M,{variant:"default",size:"compact",onClick:()=>{o("/reset-password")},children:"Reset Password"}),children:[e(F,{paddingTop:"size-200",paddingStart:"size-200",paddingEnd:"size-200",children:s(h,{direction:"row",gap:"size-200",alignItems:"center",children:[e(st,{name:n.username||n.email,profilePictureUrl:n.profilePictureUrl}),s(h,{direction:"column",gap:"size-50",children:[e(re,{level:2,weight:"heavy",children:n.username||n.email}),e(K,{children:n.role.name.toLocaleLowerCase()})]})]})}),e(F,{children:s(ye,{onSubmit:d(m),children:[s(F,{padding:"size-200",children:[e(X,{label:"Email",value:n.email,isReadOnly:!0}),e(H,{name:"username",control:c,rules:{required:"A username is required as it needs to be unique"},render:({field:{name:p,onChange:y,onBlur:b,value:k},fieldState:{invalid:v,error:S}})=>e(X,{label:"Username",isRequired:!0,description:"A unique username",name:p,errorMessage:S==null?void 0:S.message,validationState:v?"invalid":"valid",onChange:y,onBlur:b,defaultValue:k})})]}),e(F,{paddingTop:"size-100",paddingBottom:"size-100",paddingStart:"size-200",paddingEnd:"size-200",borderTopColor:"dark",borderTopWidth:"thin",children:e(h,{direction:"row",gap:"size-100",justifyContent:"end",children:e(M,{variant:g?"primary":"default",size:"compact",disabled:!g,onClick:()=>{d(m)()},children:r?"Saving...":"Save"})})})]})})]}):null}const fp=C`
3665
3665
  overflow-y: auto;
3666
3666
  `,hp=C`
3667
3667
  padding: var(--ac-global-dimension-size-400);
@@ -3671,11 +3671,11 @@ fragment APIKeysTableFragment on User {
3671
3671
  width: 100%;
3672
3672
  margin-left: auto;
3673
3673
  margin-right: auto;
3674
- `;function df(){const{viewer:n}=dt();return n?e("main",{css:fp,children:e("div",{css:hp,children:s(h,{direction:"column",gap:"size-200",children:[e(yp,{}),e(pp,{viewer:n})]})})}):null}const vs=u.createContext(null);function kp({children:n,...a}){const[l]=u.useState(()=>cd(a));return e(vs.Provider,{value:l,children:n})}function H(n,a){const l=Ke.useContext(vs);if(!l)throw new Error("Missing PlaygroundContext.Provider in the tree");return ya(l,n,a)}const bp=4,Sp={user:["user","human"],ai:["assistant","bot","ai"],system:["system"],tool:["tool"]},vp="Unable to parse span input messages, expected messages which include a role and content.",Cp="Unable to parse span output messages, expected messages which include a role and content.",Fp="Unable to parse span output expected output.value to be present.",Kp="Unable to parse span attributes, attributes must be valid JSON.",xp="Unable to parse model name, expected llm.model_name to be present.",_l={AZURE_OPENAI:[],ANTHROPIC:["claude"],OPENAI:["gpt","o1"]},Dp={OPENAI:"OPENAI_API_KEY",ANTHROPIC:"ANTHROPIC_API_KEY",AZURE_OPENAI:"AZURE_OPENAI_API_KEY"};function Tp(){const n=H(t=>Array.from(new Set(t.instances.map(i=>i.model.provider)))),a=ja(t=>t.setCredential),l=ja(t=>t);return e("div",{css:C`
3674
+ `;function df(){const{viewer:n}=dt();return n?e("main",{css:fp,children:e("div",{css:hp,children:s(h,{direction:"column",gap:"size-200",children:[e(yp,{}),e(pp,{viewer:n})]})})}):null}const vs=u.createContext(null);function kp({children:n,...a}){const[l]=u.useState(()=>cd(a));return e(vs.Provider,{value:l,children:n})}function U(n,a){const l=Ke.useContext(vs);if(!l)throw new Error("Missing PlaygroundContext.Provider in the tree");return ya(l,n,a)}const bp=4,Sp={user:["user","human"],ai:["assistant","bot","ai"],system:["system"],tool:["tool"]},vp="Unable to parse span input messages, expected messages which include a role and content.",Cp="Unable to parse span output messages, expected messages which include a role and content.",Fp="Unable to parse span output expected output.value to be present.",Kp="Unable to parse span attributes, attributes must be valid JSON.",xp="Unable to parse model name, expected llm.model_name to be present.",_l={AZURE_OPENAI:[],ANTHROPIC:["claude"],OPENAI:["gpt","o1"]},Dp={OPENAI:"OPENAI_API_KEY",ANTHROPIC:"ANTHROPIC_API_KEY",AZURE_OPENAI:"AZURE_OPENAI_API_KEY"};function Tp(){const n=U(t=>Array.from(new Set(t.instances.map(i=>i.model.provider)))),a=ja(t=>t.setCredential),l=ja(t=>t);return e("div",{css:C`
3675
3675
  .ac-dropdown-button {
3676
3676
  min-width: 0px;
3677
3677
  }
3678
- `,children:s(tn,{placement:"bottom",children:[e(Ga,{size:"compact",children:"API Keys"}),e(ha,{children:e(F,{padding:"size-200",children:s(h,{direction:"column",gap:"size-100",children:[e(re,{level:2,weight:"heavy",children:"API Keys"}),e(K,{color:"text-700",children:"API keys are stored in your browser and used to communicate with their respective API's."}),e(ye,{children:n.map(t=>{const i=Dp[t];return e(X,{label:i,type:"password",isRequired:!0,onChange:r=>{a({provider:t,value:r})},value:l[t]},t)})})]})})})]})})}const Ip={lineNumbers:!1,highlightActiveLine:!1,foldGutter:!1,highlightActiveLineGutter:!1,bracketMatching:!1,syntaxHighlighting:!1},Lp=[yt.lineWrapping],Pp=({label:n,value:a,onChange:l})=>{const{theme:t}=zn();return e(la,{label:n,children:e(yn,{width:"100%",children:e(sa,{theme:t==="light"?Pd:oa,basicSetup:Ip,value:a,extensions:Lp,onChange:l})})})};function Ap(){const n=H(ct),a=H(ud),l=H(i=>i.setVariableValue),t=H(i=>i.templateLanguage);if(a.length===0){let i="";switch(t){case"F_STRING":{i="{input name}";break}case"MUSTACHE":{i="{{input name}}";break}default:Ce()}return e(F,{padding:"size-100",children:e(h,{direction:"column",justifyContent:"center",alignItems:"center",children:s(K,{color:"text-700",children:["Add variable inputs to your prompt using"," ",e(K,{color:"text-900",children:i})," within your prompt template."]})})})}return e(h,{direction:"column",gap:"size-200",width:"100%",children:a.map((i,r)=>e(Pp,{label:i,value:n[i],onChange:o=>l(i,o)},r))})}function wp(){const n=H(l=>l.inputMode),a=H(l=>l.setInputMode);return s(Vl,{value:n,variant:"inline-button",size:"compact",onChange:l=>{(l==="manual"||l==="dataset")&&a(l)},children:[e(ga,{label:"manual",value:"manual",children:"Manual"}),e(ga,{label:"Dataset",value:"dataset",children:"Dataset"})]})}const Cs=function(){var n={defaultValue:null,kind:"LocalArgument",name:"apiKey"},a={defaultValue:null,kind:"LocalArgument",name:"invocationParameters"},l={defaultValue:null,kind:"LocalArgument",name:"messages"},t={defaultValue:null,kind:"LocalArgument",name:"model"},i={defaultValue:null,kind:"LocalArgument",name:"templateOptions"},r={defaultValue:null,kind:"LocalArgument",name:"tools"},o=[{alias:null,args:[{fields:[{kind:"Variable",name:"apiKey",variableName:"apiKey"},{kind:"Variable",name:"invocationParameters",variableName:"invocationParameters"},{kind:"Variable",name:"messages",variableName:"messages"},{kind:"Variable",name:"model",variableName:"model"},{kind:"Variable",name:"template",variableName:"templateOptions"},{kind:"Variable",name:"tools",variableName:"tools"}],kind:"ObjectValue",name:"input"}],concreteType:null,kind:"LinkedField",name:"chatCompletion",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"content",storageKey:null}],type:"TextChunk",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,concreteType:"FunctionCallChunk",kind:"LinkedField",name:"function",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"arguments",storageKey:null}],storageKey:null}],type:"ToolCallChunk",abstractKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:[n,a,l,t,i,r],kind:"Fragment",metadata:null,name:"PlaygroundOutputSubscription",selections:o,type:"Subscription",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[l,t,a,r,i,n],kind:"Operation",name:"PlaygroundOutputSubscription",selections:o},params:{cacheID:"187fbcd6de7ddfef0a20d669441d6d6f",id:null,metadata:{},name:"PlaygroundOutputSubscription",operationKind:"subscription",text:`subscription PlaygroundOutputSubscription(
3678
+ `,children:s(tn,{placement:"bottom",children:[e(Ga,{size:"compact",children:"API Keys"}),e(ha,{children:e(F,{padding:"size-200",children:s(h,{direction:"column",gap:"size-100",children:[e(re,{level:2,weight:"heavy",children:"API Keys"}),e(K,{color:"text-700",children:"API keys are stored in your browser and used to communicate with their respective API's."}),e(ye,{children:n.map(t=>{const i=Dp[t];return e(X,{label:i,type:"password",isRequired:!0,onChange:r=>{a({provider:t,value:r})},value:l[t]},t)})})]})})})]})})}const Ip={lineNumbers:!1,highlightActiveLine:!1,foldGutter:!1,highlightActiveLineGutter:!1,bracketMatching:!1,syntaxHighlighting:!1},Lp=[yt.lineWrapping],Pp=({label:n,value:a,onChange:l})=>{const{theme:t}=zn();return e(la,{label:n,children:e(yn,{width:"100%",children:e(sa,{theme:t==="light"?Pd:oa,basicSetup:Ip,value:a,extensions:Lp,onChange:l})})})};function Ap(){const n=U(ct),a=U(ud),l=U(i=>i.setVariableValue),t=U(i=>i.templateLanguage);if(a.length===0){let i="";switch(t){case"F_STRING":{i="{input name}";break}case"MUSTACHE":{i="{{input name}}";break}default:Ce()}return e(F,{padding:"size-100",children:e(h,{direction:"column",justifyContent:"center",alignItems:"center",children:s(K,{color:"text-700",children:["Add variable inputs to your prompt using"," ",e(K,{color:"text-900",children:i})," within your prompt template."]})})})}return e(h,{direction:"column",gap:"size-200",width:"100%",children:a.map((i,r)=>e(Pp,{label:i,value:n[i],onChange:o=>l(i,o)},r))})}function wp(){const n=U(l=>l.inputMode),a=U(l=>l.setInputMode);return s(Vl,{value:n,variant:"inline-button",size:"compact",onChange:l=>{(l==="manual"||l==="dataset")&&a(l)},children:[e(ga,{label:"manual",value:"manual",children:"Manual"}),e(ga,{label:"Dataset",value:"dataset",children:"Dataset"})]})}const Cs=function(){var n={defaultValue:null,kind:"LocalArgument",name:"apiKey"},a={defaultValue:null,kind:"LocalArgument",name:"invocationParameters"},l={defaultValue:null,kind:"LocalArgument",name:"messages"},t={defaultValue:null,kind:"LocalArgument",name:"model"},i={defaultValue:null,kind:"LocalArgument",name:"templateOptions"},r={defaultValue:null,kind:"LocalArgument",name:"tools"},o=[{alias:null,args:[{fields:[{kind:"Variable",name:"apiKey",variableName:"apiKey"},{kind:"Variable",name:"invocationParameters",variableName:"invocationParameters"},{kind:"Variable",name:"messages",variableName:"messages"},{kind:"Variable",name:"model",variableName:"model"},{kind:"Variable",name:"template",variableName:"templateOptions"},{kind:"Variable",name:"tools",variableName:"tools"}],kind:"ObjectValue",name:"input"}],concreteType:null,kind:"LinkedField",name:"chatCompletion",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"content",storageKey:null}],type:"TextChunk",abstractKey:null},{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,concreteType:"FunctionCallChunk",kind:"LinkedField",name:"function",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"arguments",storageKey:null}],storageKey:null}],type:"ToolCallChunk",abstractKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:[n,a,l,t,i,r],kind:"Fragment",metadata:null,name:"PlaygroundOutputSubscription",selections:o,type:"Subscription",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[l,t,a,r,i,n],kind:"Operation",name:"PlaygroundOutputSubscription",selections:o},params:{cacheID:"187fbcd6de7ddfef0a20d669441d6d6f",id:null,metadata:{},name:"PlaygroundOutputSubscription",operationKind:"subscription",text:`subscription PlaygroundOutputSubscription(
3679
3679
  $messages: [ChatCompletionMessageInput!]!
3680
3680
  $model: GenerativeModelInput!
3681
3681
  $invocationParameters: InvocationParameters!
@@ -3700,7 +3700,7 @@ fragment APIKeysTableFragment on User {
3700
3700
  `}}}();Cs.hash="ab948845156ab09904236c95cf379b04";const _p=O.object({function:O.object({name:O.string(),arguments:O.string()}).partial()}).partial(),Fs=O.object({[se.message]:O.object({[ve.role]:O.string(),[ve.content]:O.string(),[ve.tool_calls]:O.array(_p).optional()})}),Ep=O.object({[se.llm]:O.object({[we.input_messages]:O.array(Fs)})}),Rp=O.object({[se.llm]:O.object({[we.output_messages]:O.array(Fs)})}),Mp=O.object({[se.output]:O.object({value:O.string()})}),Ks=ut()(O.enum(["user","ai","system","tool"])),Np=ut()(O.object({id:O.number(),role:Ks,content:O.string()})),zp=O.array(Np),Vp=O.object({[se.llm]:O.object({[we.model_name]:O.string()})});function xs(n){return Ks.safeParse(n).success}function $p(n){if(xs(n))return n;for(const[a,l]of Object.entries(Sp))if(l.includes(n))return a;return pd}function Ds(n){return n.map(({message:a})=>({id:xa(),role:$p(a.role),content:a.content}))}function Op(n){const a=Ep.safeParse(n);return a.success?{messageParsingErrors:[],messages:Ds(a.data.llm.input_messages)}:{messageParsingErrors:[vp],messages:null}}function Qp(n){const a=[],l=Rp.safeParse(n);if(l.success)return{output:Ds(l.data.llm.output_messages),outputParsingErrors:a};a.push(Cp);const t=Mp.safeParse(n);return t.success?{output:t.data.output.value,outputParsingErrors:a}:(a.push(Fp),{output:void 0,outputParsingErrors:a})}function jp(n){for(const a of Object.keys(_l))if(_l[a].some(t=>n.includes(t)))return a;return gd}function qp(n){const{success:a,data:l}=Vp.safeParse(n);return a?{modelConfig:{modelName:l.llm.model_name,provider:jp(l.llm.model_name)},parsingErrors:[]}:{modelConfig:null,parsingErrors:[xp]}}function Up(n){const a=md(),{json:l,parseError:t}=al(n.attributes);if(t)return{playgroundInstance:a,parsingErrors:[Kp]};const{messages:i,messageParsingErrors:r}=Op(l),{output:o,outputParsingErrors:c}=Qp(l),{modelConfig:d,parsingErrors:g}=qp(l);return{playgroundInstance:{...a,model:d??a.model,template:i!=null?{__type:"chat",messages:i}:a.template,output:o},parsingErrors:[...r,...c,...g]}}const Bp=n=>zp.safeParse(n).success;function Hp({index:n,title:a}){return s(h,{direction:"row",gap:"size-100",alignItems:"center",children:[e(mt,{index:n}),e("span",{children:a})]})}function Ua({message:n}){const{role:a,content:l,toolCalls:t}=n,i=sl(a);return s(z,{title:a,...i,variant:"compact",children:[l!=null&&e(h,{direction:"column",alignItems:"start",children:l}),t&&t.length>0?t.map(r=>s("pre",{css:C`
3701
3701
  text-wrap: wrap;
3702
3702
  margin: var(--ac-global-dimension-static-size-100) 0;
3703
- `,children:[r.function.name,"(",JSON.stringify(JSON.parse(r.function.arguments),null,2),")"]},r.id)):null]})}function Gp(n){const a=n.playgroundInstanceId,l=H(c=>c.instances.find(d=>d.id===a)),t=H(c=>c.instances.findIndex(d=>d.id===a));if(!l)throw new Error(`Playground instance ${a} not found`);const i=l.activeRunId,r=i!==null,o=u.useMemo(()=>r?e(Xp,{playgroundInstanceId:a},i):Bp(l.output)?l.output.map((d,g)=>e(Ua,{message:d},g)):typeof l.output=="string"?e(Ua,{message:{id:xa(),content:l.output,role:"ai"}}):"click run to see output",[r,l.output,a,i]);return e(z,{title:e(Hp,{index:t,title:"Output"}),collapsible:!0,variant:"compact",children:o})}function Wp({params:n,runId:a,onNext:l,onCompleted:t}){const i=u.useMemo(()=>({subscription:Cs,variables:n,onNext:r=>{r&&l(r)},onCompleted:()=>{t()}}),[a]);return D.useSubscription(i)}function Jp(n){return{content:n.content,role:Zp(n.role)}}function Zp(n){switch(n){case"system":return"SYSTEM";case"user":return"USER";case"tool":return"TOOL";case"ai":return"AI";default:Ce()}}function Xp(n){const a=H(y=>y.instances),l=ja(y=>y),t=a.find(y=>y.id===n.playgroundInstanceId),i=H(y=>y.templateLanguage),r=H(ct),o=H(y=>y.markPlaygroundInstanceComplete);if(!t)throw new Error("No instance found");if(typeof t.activeRunId!="number")throw new Error("No message found");if(t.template.__type!=="chat")throw new Error("We only support chat templates for now");const[c,d]=u.useState(void 0),[g,f]=u.useState([]),m=t.model.provider==="AZURE_OPENAI"?{endpoint:t.model.endpoint,apiVersion:t.model.apiVersion}:{},p={};return t.tools.length&&(p.toolChoice=t.toolChoice),Wp({params:{messages:t.template.messages.map(Jp),model:{providerKey:t.model.provider,name:t.model.modelName||"",...m},invocationParameters:p,templateOptions:{variables:r,language:i},tools:t.tools.map(y=>y.definition),apiKey:l[t.model.provider]},runId:t.activeRunId,onNext:y=>{const k=y.chatCompletion;k.__typename==="TextChunk"?d(b=>(b||"")+k.content):k.__typename==="ToolCallChunk"&&f(b=>{let v=!1;const S=b.map(L=>L.id===k.id?(v=!0,{...L,function:{...L.function,arguments:L.function.arguments+k.function.arguments}}):L);return v||S.push({id:k.id,function:{name:k.function.name,arguments:k.function.arguments}}),S})},onCompleted:()=>{o(n.playgroundInstanceId)}}),!c&&(g.length===0||t.isRunning)?s(h,{direction:"row",gap:"size-100",alignItems:"center",children:[e(P,{svg:e(I.LoadingOutline,{})}),"Running..."]}):e(Ua,{message:{id:xa(),content:c,role:"ai",toolCalls:g}})}function Yp(){const n=H(l=>l.runPlaygroundInstances),a=H(l=>l.instances.some(t=>t.isRunning));return e(M,{variant:"primary",disabled:a,icon:e(P,{svg:e(I.PlayCircleOutline,{})}),loading:a,size:"compact",onClick:()=>{n()},children:a?"Running...":"Run"})}const Ts=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"providerKey"}],a=[{kind:"Variable",name:"providerKey",variableName:"providerKey"}],l={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ModelConfigButtonDialogQuery",selections:[{args:null,kind:"FragmentSpread",name:"ModelProviderPickerFragment"},{args:a,kind:"FragmentSpread",name:"ModelPickerFragment"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ModelConfigButtonDialogQuery",selections:[{alias:null,args:null,concreteType:"GenerativeProvider",kind:"LinkedField",name:"modelProviders",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"key",storageKey:null},l],storageKey:null},{alias:null,args:[{fields:a,kind:"ObjectValue",name:"input"}],concreteType:"GenerativeModel",kind:"LinkedField",name:"models",plural:!0,selections:[l],storageKey:null}]},params:{cacheID:"8e6ad232aae761280ca29a0571fe7c23",id:null,metadata:{},name:"ModelConfigButtonDialogQuery",operationKind:"query",text:`query ModelConfigButtonDialogQuery(
3703
+ `,children:[r.function.name,"(",JSON.stringify(JSON.parse(r.function.arguments),null,2),")"]},r.id)):null]})}function Gp(n){const a=n.playgroundInstanceId,l=U(c=>c.instances.find(d=>d.id===a)),t=U(c=>c.instances.findIndex(d=>d.id===a));if(!l)throw new Error(`Playground instance ${a} not found`);const i=l.activeRunId,r=i!==null,o=u.useMemo(()=>r?e(Xp,{playgroundInstanceId:a},i):Bp(l.output)?l.output.map((d,g)=>e(Ua,{message:d},g)):typeof l.output=="string"?e(Ua,{message:{id:xa(),content:l.output,role:"ai"}}):"click run to see output",[r,l.output,a,i]);return e(z,{title:e(Hp,{index:t,title:"Output"}),collapsible:!0,variant:"compact",children:o})}function Wp({params:n,runId:a,onNext:l,onCompleted:t,onFailed:i}){const r=u.useMemo(()=>({subscription:Cs,variables:n,onNext:o=>{o&&l(o)},onCompleted:()=>{t()},onError:o=>{i(o)}}),[a]);return D.useSubscription(r)}function Jp(n){return{content:n.content,role:Zp(n.role)}}function Zp(n){switch(n){case"system":return"SYSTEM";case"user":return"USER";case"tool":return"TOOL";case"ai":return"AI";default:Ce()}}function Xp(n){const a=U(k=>k.instances),l=ja(k=>k),t=a.find(k=>k.id===n.playgroundInstanceId),i=U(k=>k.updateInstance),r=U(k=>k.templateLanguage),o=U(ct),c=U(k=>k.markPlaygroundInstanceComplete),d=ce();if(!t)throw new Error("No instance found");if(typeof t.activeRunId!="number")throw new Error("No message found");if(t.template.__type!=="chat")throw new Error("We only support chat templates for now");const[g,f]=u.useState(void 0),[m,p]=u.useState([]),y=t.model.provider==="AZURE_OPENAI"?{endpoint:t.model.endpoint,apiVersion:t.model.apiVersion}:{},b={};return t.tools.length&&(b.toolChoice=t.toolChoice),Wp({params:{messages:t.template.messages.map(Jp),model:{providerKey:t.model.provider,name:t.model.modelName||"",...y},invocationParameters:b,templateOptions:{variables:o,language:r},tools:t.tools.map(k=>k.definition),apiKey:l[t.model.provider]},runId:t.activeRunId,onNext:k=>{const v=k.chatCompletion;v.__typename==="TextChunk"?f(S=>(S||"")+v.content):v.__typename==="ToolCallChunk"&&p(S=>{let A=!1;const L=S.map(w=>w.id===v.id?(A=!0,{...w,function:{...w.function,arguments:w.function.arguments+v.function.arguments}}):w);return A||L.push({id:v.id,function:{name:v.function.name,arguments:v.function.arguments}}),L})},onCompleted:()=>{c(n.playgroundInstanceId)},onFailed:()=>{c(n.playgroundInstanceId),i({instanceId:n.playgroundInstanceId,patch:{activeRunId:null}}),d({title:"Failed to get output",message:"Please try again."})}}),!g&&(m.length===0||t.isRunning)?s(h,{direction:"row",gap:"size-100",alignItems:"center",children:[e(P,{svg:e(I.LoadingOutline,{})}),"Running..."]}):e(Ua,{message:{id:xa(),content:g,role:"ai",toolCalls:m}})}function Yp(){const n=U(l=>l.runPlaygroundInstances),a=U(l=>l.instances.some(t=>t.isRunning));return e(M,{variant:"primary",disabled:a,icon:e(P,{svg:e(I.PlayCircleOutline,{})}),loading:a,size:"compact",onClick:()=>{n()},children:a?"Running...":"Run"})}const Ts=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"providerKey"}],a=[{kind:"Variable",name:"providerKey",variableName:"providerKey"}],l={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ModelConfigButtonDialogQuery",selections:[{args:null,kind:"FragmentSpread",name:"ModelProviderPickerFragment"},{args:a,kind:"FragmentSpread",name:"ModelPickerFragment"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ModelConfigButtonDialogQuery",selections:[{alias:null,args:null,concreteType:"GenerativeProvider",kind:"LinkedField",name:"modelProviders",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"key",storageKey:null},l],storageKey:null},{alias:null,args:[{fields:a,kind:"ObjectValue",name:"input"}],concreteType:"GenerativeModel",kind:"LinkedField",name:"models",plural:!0,selections:[l],storageKey:null}]},params:{cacheID:"8e6ad232aae761280ca29a0571fe7c23",id:null,metadata:{},name:"ModelConfigButtonDialogQuery",operationKind:"query",text:`query ModelConfigButtonDialogQuery(
3704
3704
  $providerKey: GenerativeProviderKey!
3705
3705
  ) {
3706
3706
  ...ModelProviderPickerFragment
@@ -3719,16 +3719,16 @@ fragment ModelProviderPickerFragment on Query {
3719
3719
  name
3720
3720
  }
3721
3721
  }
3722
- `}}}();Ts.hash="c9b38e766093b2378047d22b01ef0fbf";const Is={argumentDefinitions:[{defaultValue:"OPENAI",kind:"LocalArgument",name:"providerKey"}],kind:"Fragment",metadata:null,name:"ModelPickerFragment",selections:[{alias:null,args:[{fields:[{kind:"Variable",name:"providerKey",variableName:"providerKey"}],kind:"ObjectValue",name:"input"}],concreteType:"GenerativeModel",kind:"LinkedField",name:"models",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null}],type:"Query",abstractKey:null};Is.hash="1e660ad77ce19db1c1bbe8698a661b4f";function ey({query:n,onChange:a,...l}){const t=D.useFragment(Is,n);return e(Mn,{label:"Model","data-testid":"model-picker",selectedKey:l.modelName??void 0,"aria-label":"model picker",placeholder:"Select a model",onSelectionChange:i=>{typeof i=="string"&&a(i)},width:"100%",...l,children:t.models.map(({name:i})=>e(U,{children:i},i))})}const Ls={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"ModelProviderPickerFragment",selections:[{alias:null,args:null,concreteType:"GenerativeProvider",kind:"LinkedField",name:"modelProviders",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"key",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null}],type:"Query",abstractKey:null};Ls.hash="c83e86a2772127916f7387dca27b74ce";function ny(n){return n==="OPENAI"||n==="AZURE_OPENAI"||n==="ANTHROPIC"}function ay({onChange:n,query:a,...l}){const t=D.useFragment(Ls,a);return e(Mn,{label:"Provider","data-testid":"model-provider-picker",selectedKey:l.provider??void 0,"aria-label":"Model Provider",placeholder:"Select a provider",onSelectionChange:i=>{const r=i;ny(r)&&n(r)},width:"100%",...l,children:t.modelProviders.map(i=>e(U,{children:i.name},i.key))})}function ly({instance:n}){const a=H(t=>t.updateModel),l=u.useCallback(({configKey:t,value:i})=>{a({instanceId:n.id,model:{...n.model,[t]:i}})},[n.id,n.model,a]);return s(q,{children:[e(X,{label:"Deployment Name",value:n.model.modelName??"",onChange:t=>{l({configKey:"modelName",value:t})}}),e(X,{label:"Endpoint",value:n.model.endpoint??"",onChange:t=>{l({configKey:"endpoint",value:t})}}),e(Mn,{label:"API Version",selectedKey:n.model.apiVersion??void 0,"aria-label":"api version picker",placeholder:"Select an AzureOpenAi API Version",onSelectionChange:t=>{typeof t=="string"&&l({configKey:"apiVersion",value:t})},children:fd.map(t=>e(U,{children:t},t))})]})}function ty(n){const[a,l]=u.useState(null),t=H(i=>i.instances.find(r=>r.id===n.playgroundInstanceId));if(!t)throw new Error(`Playground instance ${n.playgroundInstanceId} not found`);return s(u.Fragment,{children:[e(M,{variant:"default",size:"compact",onClick:()=>{u.startTransition(()=>{l(e(G,{title:"Model Configuration",size:"M",children:e(u.Suspense,{children:e(iy,{...n})})}))})},children:s(h,{direction:"row",gap:"size-100",alignItems:"center",children:[e(K,{weight:"heavy",children:yd[t.model.provider]}),e(K,{children:t.model.modelName||"--"})]})}),e(W,{type:"slideOver",isDismissable:!0,onDismiss:()=>{l(null)},children:a})]})}function iy(n){const{playgroundInstanceId:a}=n,l=H(o=>o.updateModel),t=H(o=>o.instances.find(c=>c.id===a));if(!t)throw new Error(`Playground instance ${n.playgroundInstanceId} not found`);const i=D.useLazyLoadQuery(Ts,{providerKey:t.model.provider}),r=u.useCallback(o=>{l({instanceId:a,model:{provider:t.model.provider,modelName:o}})},[t.model.provider,a,l]);return e(F,{padding:"size-200",children:s(ye,{children:[e(ay,{provider:t.model.provider,query:i,onChange:o=>{l({instanceId:a,model:{provider:o,modelName:null}})}}),t.model.provider==="AZURE_OPENAI"?e(ly,{instance:t}):e(ey,{modelName:t.model.modelName,provider:t.model.provider,query:i,onChange:r})]})})}const ry=C`
3722
+ `}}}();Ts.hash="c9b38e766093b2378047d22b01ef0fbf";const Is={argumentDefinitions:[{defaultValue:"OPENAI",kind:"LocalArgument",name:"providerKey"}],kind:"Fragment",metadata:null,name:"ModelPickerFragment",selections:[{alias:null,args:[{fields:[{kind:"Variable",name:"providerKey",variableName:"providerKey"}],kind:"ObjectValue",name:"input"}],concreteType:"GenerativeModel",kind:"LinkedField",name:"models",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null}],type:"Query",abstractKey:null};Is.hash="1e660ad77ce19db1c1bbe8698a661b4f";function ey({query:n,onChange:a,...l}){const t=D.useFragment(Is,n);return e(Mn,{label:"Model","data-testid":"model-picker",selectedKey:l.modelName??void 0,"aria-label":"model picker",placeholder:"Select a model",onSelectionChange:i=>{typeof i=="string"&&a(i)},width:"100%",...l,children:t.models.map(({name:i})=>e(B,{children:i},i))})}const Ls={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"ModelProviderPickerFragment",selections:[{alias:null,args:null,concreteType:"GenerativeProvider",kind:"LinkedField",name:"modelProviders",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"key",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null}],type:"Query",abstractKey:null};Ls.hash="c83e86a2772127916f7387dca27b74ce";function ny(n){return n==="OPENAI"||n==="AZURE_OPENAI"||n==="ANTHROPIC"}function ay({onChange:n,query:a,...l}){const t=D.useFragment(Ls,a);return e(Mn,{label:"Provider","data-testid":"model-provider-picker",selectedKey:l.provider??void 0,"aria-label":"Model Provider",placeholder:"Select a provider",onSelectionChange:i=>{const r=i;ny(r)&&n(r)},width:"100%",...l,children:t.modelProviders.map(i=>e(B,{children:i.name},i.key))})}function ly({instance:n}){const a=U(t=>t.updateModel),l=u.useCallback(({configKey:t,value:i})=>{a({instanceId:n.id,model:{...n.model,[t]:i}})},[n.id,n.model,a]);return s(q,{children:[e(X,{label:"Deployment Name",value:n.model.modelName??"",onChange:t=>{l({configKey:"modelName",value:t})}}),e(X,{label:"Endpoint",value:n.model.endpoint??"",onChange:t=>{l({configKey:"endpoint",value:t})}}),e(Mn,{label:"API Version",selectedKey:n.model.apiVersion??void 0,"aria-label":"api version picker",placeholder:"Select an AzureOpenAi API Version",onSelectionChange:t=>{typeof t=="string"&&l({configKey:"apiVersion",value:t})},children:fd.map(t=>e(B,{children:t},t))})]})}function ty(n){const[a,l]=u.useState(null),t=U(i=>i.instances.find(r=>r.id===n.playgroundInstanceId));if(!t)throw new Error(`Playground instance ${n.playgroundInstanceId} not found`);return s(u.Fragment,{children:[e(M,{variant:"default",size:"compact",onClick:()=>{u.startTransition(()=>{l(e(G,{title:"Model Configuration",size:"M",children:e(u.Suspense,{children:e(iy,{...n})})}))})},children:s(h,{direction:"row",gap:"size-100",alignItems:"center",children:[e(K,{weight:"heavy",children:yd[t.model.provider]}),e(K,{children:t.model.modelName||"--"})]})}),e(W,{type:"slideOver",isDismissable:!0,onDismiss:()=>{l(null)},children:a})]})}function iy(n){const{playgroundInstanceId:a}=n,l=U(o=>o.updateModel),t=U(o=>o.instances.find(c=>c.id===a));if(!t)throw new Error(`Playground instance ${n.playgroundInstanceId} not found`);const i=D.useLazyLoadQuery(Ts,{providerKey:t.model.provider}),r=u.useCallback(o=>{l({instanceId:a,model:{provider:t.model.provider,modelName:o}})},[t.model.provider,a,l]);return e(F,{padding:"size-200",children:s(ye,{children:[e(ay,{provider:t.model.provider,query:i,onChange:o=>{l({instanceId:a,model:{provider:o,modelName:null}})}}),t.model.provider==="AZURE_OPENAI"?e(ly,{instance:t}):e(ey,{modelName:t.model.modelName,provider:t.model.provider,query:i,onChange:r})]})})}const ry=C`
3723
3723
  .ac-field-label {
3724
3724
  display: none;
3725
3725
  }
3726
- `;function sy({role:n,includeLabel:a=!0,onChange:l}){return s(Mn,{selectedKey:n,css:a?void 0:ry,label:"Role","data-testid":"messages-role-picker","aria-label":"Role for the chat message",size:"compact",onSelectionChange:t=>{if(!xs(t))throw new Error(`Invalid chat message role: ${t}`);l(t)},children:[e(U,{children:"System"},"system"),e(U,{children:"User"},"user"),e(U,{children:"AI"},"ai")]})}const Ps=O.object({type:O.literal("function").describe("The type of the tool"),function:O.object({name:O.string().describe("The name of the function"),description:O.string().optional().describe("A description of the function"),parameters:O.object({type:O.literal("object"),properties:O.record(O.object({type:O.enum(["string","number","boolean","object","array","null","integer"]).describe("The type of the parameter"),description:O.string().optional().describe("A description of the parameter"),enum:O.array(O.string()).optional().describe("The allowed values")}).passthrough()).describe("A map of parameter names to their definitions"),required:O.array(O.string()).optional().describe("The required parameters"),additionalProperties:O.boolean().optional().describe("Whether or not additional properties are allowed in the schema"),strict:O.boolean().optional().describe("Whether or not the arguments should exactly match the function definition, only supported for OpenAI models")}).passthrough().describe("The parameters that the function accepts")}).passthrough().describe("The function definition")}).passthrough(),oy=Ws(Ps,{removeAdditionalStrategy:"passthrough"});function dy({playgroundInstanceId:n,tool:a,instanceTools:l}){var c;const t=H(d=>d.updateInstance),[i,r]=u.useState(JSON.stringify(a.definition,null,2)),o=u.useCallback(d=>{r(d);const{json:g}=al(d);if(g==null)return;const{success:f}=Ps.safeParse(g);f&&t({instanceId:n,patch:{tools:l.map(m=>m.id===a.id?{...m,definition:g}:m)}})},[l,n,a.id,t]);return e(z,{collapsible:!0,backgroundColor:"yellow-100",borderColor:"yellow-700",variant:"compact",title:((c=a.definition.function)==null?void 0:c.name)??"Tool",bodyStyle:{padding:0},extra:s(h,{direction:"row",gap:"size-100",children:[e(le,{text:i}),e(M,{"aria-label":"Delete tool",icon:e(P,{svg:e(I.TrashOutline,{})}),variant:"default",size:"compact",onClick:()=>{t({instanceId:n,patch:{tools:l.filter(d=>d.id!==a.id),toolChoice:void 0}})}})]}),children:e(Ee,{value:i,onChange:o,jsonSchema:oy})},a.id)}function cy(n){const a=n.playgroundInstanceId,l=H(o=>o.instances.find(c=>c.id===n.playgroundInstanceId)),t=H(o=>o.updateInstance);if(l==null)throw new Error(`Playground instance ${a} not found`);const{tools:i}=l;if(i==null)throw new Error(`Playground instance ${a} does not have tools`);const r=u.useMemo(()=>i.map(o=>{var c;return(c=o.definition.function)==null?void 0:c.name}).filter(o=>o!=null),[i]);return e(_e,{arrowPosition:"start",children:e(de,{id:"tools",title:"Tools",titleExtra:e(Re,{variant:"light",children:i.length}),children:e(F,{padding:"size-200",children:s(h,{direction:"column",gap:"size-200",children:[e(ye,{children:e(hd,{choice:l.toolChoice,onChange:o=>{t({instanceId:a,patch:{toolChoice:o}})},toolNames:r})}),i.map(o=>e(dy,{playgroundInstanceId:a,tool:o,instanceTools:l.tools},o.id))]})})})})}const As=1,uy=As+1;function my(n){const a=n.playgroundInstanceId,l=H(g=>g.templateLanguage),t=H(g=>g.instances),i=H(g=>g.updateInstance),r=t.find(g=>g.id===a);if(!r)throw new Error(`Playground instance ${a} not found`);const o=r.tools.length>0,{template:c}=r;if(c.__type!=="chat")throw new Error(`Invalid template type ${c.__type}`);const d=Js(cl(to),cl(lo,{coordinateGetter:ao}));return s(Ys,{sensors:d,onDragEnd:({active:g,over:f})=>{if(!f||g.id===f.id)return;const m=c.messages.findIndex(k=>k.id===g.id),p=c.messages.findIndex(k=>k.id===f.id),y=Zs(c.messages,m,p);i({instanceId:a,patch:{template:{__type:"chat",messages:y}}})},children:[e(Xs,{items:c.messages,children:e("ul",{css:C`
3726
+ `;function sy({role:n,includeLabel:a=!0,onChange:l}){return s(Mn,{selectedKey:n,css:a?void 0:ry,label:"Role","data-testid":"messages-role-picker","aria-label":"Role for the chat message",size:"compact",onSelectionChange:t=>{if(!xs(t))throw new Error(`Invalid chat message role: ${t}`);l(t)},children:[e(B,{children:"System"},"system"),e(B,{children:"User"},"user"),e(B,{children:"AI"},"ai")]})}const Ps=O.object({type:O.literal("function").describe("The type of the tool"),function:O.object({name:O.string().describe("The name of the function"),description:O.string().optional().describe("A description of the function"),parameters:O.object({type:O.literal("object"),properties:O.record(O.object({type:O.enum(["string","number","boolean","object","array","null","integer"]).describe("The type of the parameter"),description:O.string().optional().describe("A description of the parameter"),enum:O.array(O.string()).optional().describe("The allowed values")}).passthrough()).describe("A map of parameter names to their definitions"),required:O.array(O.string()).optional().describe("The required parameters"),additionalProperties:O.boolean().optional().describe("Whether or not additional properties are allowed in the schema"),strict:O.boolean().optional().describe("Whether or not the arguments should exactly match the function definition, only supported for OpenAI models")}).passthrough().describe("The parameters that the function accepts")}).passthrough().describe("The function definition")}).passthrough(),oy=Ws(Ps,{removeAdditionalStrategy:"passthrough"});function dy({playgroundInstanceId:n,tool:a,instanceTools:l}){var c;const t=U(d=>d.updateInstance),[i,r]=u.useState(JSON.stringify(a.definition,null,2)),o=u.useCallback(d=>{r(d);const{json:g}=al(d);if(g==null)return;const{success:f}=Ps.safeParse(g);f&&t({instanceId:n,patch:{tools:l.map(m=>m.id===a.id?{...m,definition:g}:m)}})},[l,n,a.id,t]);return e(z,{collapsible:!0,backgroundColor:"yellow-100",borderColor:"yellow-700",variant:"compact",title:((c=a.definition.function)==null?void 0:c.name)??"Tool",bodyStyle:{padding:0},extra:s(h,{direction:"row",gap:"size-100",children:[e(le,{text:i}),e(M,{"aria-label":"Delete tool",icon:e(P,{svg:e(I.TrashOutline,{})}),variant:"default",size:"compact",onClick:()=>{t({instanceId:n,patch:{tools:l.filter(d=>d.id!==a.id),toolChoice:void 0}})}})]}),children:e(Ee,{value:i,onChange:o,jsonSchema:oy})},a.id)}function cy(n){const a=n.playgroundInstanceId,l=U(o=>o.instances.find(c=>c.id===n.playgroundInstanceId)),t=U(o=>o.updateInstance);if(l==null)throw new Error(`Playground instance ${a} not found`);const{tools:i}=l;if(i==null)throw new Error(`Playground instance ${a} does not have tools`);const r=u.useMemo(()=>i.map(o=>{var c;return(c=o.definition.function)==null?void 0:c.name}).filter(o=>o!=null),[i]);return e(_e,{arrowPosition:"start",children:e(de,{id:"tools",title:"Tools",titleExtra:e(Re,{variant:"light",children:i.length}),children:e(F,{padding:"size-200",children:s(h,{direction:"column",gap:"size-200",children:[e(ye,{children:e(hd,{choice:l.toolChoice,onChange:o=>{t({instanceId:a,patch:{toolChoice:o}})},toolNames:r})}),i.map(o=>e(dy,{playgroundInstanceId:a,tool:o,instanceTools:l.tools},o.id))]})})})})}const As=1,uy=As+1;function my(n){const a=n.playgroundInstanceId,l=U(g=>g.templateLanguage),t=U(g=>g.instances),i=U(g=>g.updateInstance),r=t.find(g=>g.id===a);if(!r)throw new Error(`Playground instance ${a} not found`);const o=r.tools.length>0,{template:c}=r;if(c.__type!=="chat")throw new Error(`Invalid template type ${c.__type}`);const d=Js(cl(to),cl(lo,{coordinateGetter:ao}));return s(Ys,{sensors:d,onDragEnd:({active:g,over:f})=>{if(!f||g.id===f.id)return;const m=c.messages.findIndex(b=>b.id===g.id),p=c.messages.findIndex(b=>b.id===f.id),y=Zs(c.messages,m,p);i({instanceId:a,patch:{template:{__type:"chat",messages:y}}})},children:[e(Xs,{items:c.messages,children:e("ul",{css:C`
3727
3727
  display: flex;
3728
3728
  flex-direction: column;
3729
3729
  gap: var(--ac-global-dimension-size-200);
3730
3730
  padding: var(--ac-global-dimension-size-200);
3731
- `,children:c.messages.map((g,f)=>e(gy,{playgroundInstanceId:a,templateLanguage:l,template:c,message:g,index:f},g.id))})}),e(F,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderColor:"dark",borderTopWidth:"thin",borderBottomWidth:o?"thin":void 0,children:s(h,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(M,{variant:"default","aria-label":"add tool",size:"compact",icon:e(P,{svg:e(I.PlusOutline,{})}),onClick:()=>{i({instanceId:a,patch:{tools:[...r.tools,kd(r.tools.length+1)]}})},children:"Tool"}),e(M,{variant:"default","aria-label":"add message",size:"compact",icon:e(P,{svg:e(I.PlusOutline,{})}),onClick:()=>{i({instanceId:a,patch:{template:{__type:"chat",messages:[...c.messages,{id:xa(),role:"user",content:""}]}}})},children:"Message"})]})}),o?e(cy,{...n}):null]})}function gy({playgroundInstanceId:n,templateLanguage:a,template:l,message:t}){const i=H(k=>k.updateInstance),{attributes:r,listeners:o,setNodeRef:c,transform:d,transition:g,setActivatorNodeRef:f,isDragging:m}=eo({id:t.id}),p=sl(t.role),y={transform:no.Translate.toString(d),transition:g,zIndex:m?uy:As};return e("li",{ref:c,style:y,children:e(z,{collapsible:!0,variant:"compact",bodyStyle:{padding:0},...p,title:e(sy,{includeLabel:!1,role:t.role,onChange:k=>{i({instanceId:n,patch:{template:{__type:"chat",messages:l.messages.map(b=>b.id===t.id?{...b,role:k}:b)}}})}}),extra:s(h,{direction:"row",gap:"size-100",children:[t.content!=null&&e(le,{text:t.content}),e(M,{"aria-label":"Delete message",icon:e(P,{svg:e(I.TrashOutline,{})}),variant:"default",size:"compact",onClick:()=>{i({instanceId:n,patch:{template:{__type:"chat",messages:l.messages.filter(k=>k.id!==t.id)}}})}}),e(bd,{ref:f,listeners:o,attributes:r})]}),children:e("div",{children:e(Sd,{height:"100%",value:t.content,"aria-label":"Message content",templateLanguage:a,onChange:k=>{i({instanceId:n,patch:{template:{__type:"chat",messages:l.messages.map(b=>b.id===t.id?{...b,content:k}:b)}}})}})})})})}function py(n){const a=n.playgroundInstanceId,l=H(o=>o.instances),t=l.find(o=>o.id===a),i=l.findIndex(o=>o.id===a);if(!t)throw new Error(`Playground instance ${a} not found`);const{template:r}=t;return e(z,{title:s(h,{direction:"row",gap:"size-100",alignItems:"center",children:[e(mt,{index:i}),e("span",{children:"Prompt"})]}),collapsible:!0,variant:"compact",bodyStyle:{padding:0},extra:s(h,{direction:"row",gap:"size-100",children:[e(ty,{...n}),l.length>1?e(yy,{...n}):null]}),children:r.__type==="chat"?e(my,{...n}):"Completion Template"})}function yy(n){const a=H(l=>l.deleteInstance);return s(Le,{children:[e(kn,{children:e(M,{variant:"default",size:"compact",icon:e(P,{svg:e(I.TrashOutline,{})}),onClick:()=>{a(n.playgroundInstanceId)}})}),e(wn,{children:e(Fn,{children:"Delete this instance of the playground"})})]})}function fy(){const n=H(l=>l.templateLanguage),a=H(l=>l.setTemplateLanguage);return s(Vl,{value:n,variant:"inline-button","aria-label":"Template Language",size:"compact",onChange:l=>{vd(l)&&a(l)},children:[e(ga,{label:"Mustache",value:yl.Mustache,children:"Mustache"}),e(ga,{label:"F-String",value:yl.FString,children:"F-String"})]})}function ws(n){return e(kp,{...n,children:s(h,{direction:"column",height:"100%",children:[e(F,{borderBottomColor:"dark",borderBottomWidth:"thin",padding:"size-200",flex:"none",children:s(h,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e(re,{level:1,children:"Playground"}),s(h,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Tp,{}),e(Yp,{})]})]})}),e(Sy,{})]})})}function hy(){const n=H(l=>l.addInstance),a=H(l=>l.instances.length);return e("div",{onClick:l=>{l.stopPropagation()},children:e(M,{variant:"default",size:"compact","aria-label":"add prompt",icon:e(P,{svg:e(I.PlusCircleOutline,{})}),disabled:a>=bp,onClick:()=>{n()},children:"Prompt"})})}const ky=C`
3731
+ `,children:c.messages.map((g,f)=>e(gy,{playgroundInstanceId:a,templateLanguage:l,template:c,message:g,index:f},g.id))})}),e(F,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderColor:"dark",borderTopWidth:"thin",borderBottomWidth:o?"thin":void 0,children:s(h,{direction:"row",justifyContent:"end",gap:"size-100",children:[e(M,{variant:"default","aria-label":"add tool",size:"compact",icon:e(P,{svg:e(I.PlusOutline,{})}),onClick:()=>{i({instanceId:a,patch:{tools:[...r.tools,kd(r.tools.length+1)]}})},children:"Tool"}),e(M,{variant:"default","aria-label":"add message",size:"compact",icon:e(P,{svg:e(I.PlusOutline,{})}),onClick:()=>{i({instanceId:a,patch:{template:{__type:"chat",messages:[...c.messages,{id:xa(),role:"user",content:""}]}}})},children:"Message"})]})}),o?e(cy,{...n}):null]})}function gy({playgroundInstanceId:n,templateLanguage:a,template:l,message:t}){const i=U(b=>b.updateInstance),{attributes:r,listeners:o,setNodeRef:c,transform:d,transition:g,setActivatorNodeRef:f,isDragging:m}=eo({id:t.id}),p=sl(t.role),y={transform:no.Translate.toString(d),transition:g,zIndex:m?uy:As};return e("li",{ref:c,style:y,children:e(z,{collapsible:!0,variant:"compact",bodyStyle:{padding:0},...p,title:e(sy,{includeLabel:!1,role:t.role,onChange:b=>{i({instanceId:n,patch:{template:{__type:"chat",messages:l.messages.map(k=>k.id===t.id?{...k,role:b}:k)}}})}}),extra:s(h,{direction:"row",gap:"size-100",children:[t.content!=null&&e(le,{text:t.content}),e(M,{"aria-label":"Delete message",icon:e(P,{svg:e(I.TrashOutline,{})}),variant:"default",size:"compact",onClick:()=>{i({instanceId:n,patch:{template:{__type:"chat",messages:l.messages.filter(b=>b.id!==t.id)}}})}}),e(bd,{ref:f,listeners:o,attributes:r})]}),children:e("div",{children:e(Sd,{height:"100%",value:t.content,"aria-label":"Message content",templateLanguage:a,onChange:b=>{i({instanceId:n,patch:{template:{__type:"chat",messages:l.messages.map(k=>k.id===t.id?{...k,content:b}:k)}}})}})})})})}function py(n){const a=n.playgroundInstanceId,l=U(o=>o.instances),t=l.find(o=>o.id===a),i=l.findIndex(o=>o.id===a);if(!t)throw new Error(`Playground instance ${a} not found`);const{template:r}=t;return e(z,{title:s(h,{direction:"row",gap:"size-100",alignItems:"center",children:[e(mt,{index:i}),e("span",{children:"Prompt"})]}),collapsible:!0,variant:"compact",bodyStyle:{padding:0},extra:s(h,{direction:"row",gap:"size-100",children:[e(ty,{...n}),l.length>1?e(yy,{...n}):null]}),children:r.__type==="chat"?e(my,{...n}):"Completion Template"})}function yy(n){const a=U(l=>l.deleteInstance);return s(Le,{children:[e(kn,{children:e(M,{variant:"default",size:"compact",icon:e(P,{svg:e(I.TrashOutline,{})}),onClick:()=>{a(n.playgroundInstanceId)}})}),e(wn,{children:e(Fn,{children:"Delete this instance of the playground"})})]})}function fy(){const n=U(l=>l.templateLanguage),a=U(l=>l.setTemplateLanguage);return s(Vl,{value:n,variant:"inline-button","aria-label":"Template Language",size:"compact",onChange:l=>{vd(l)&&a(l)},children:[e(ga,{label:"Mustache",value:yl.Mustache,children:"Mustache"}),e(ga,{label:"F-String",value:yl.FString,children:"F-String"})]})}function ws(n){return e(kp,{...n,children:s(h,{direction:"column",height:"100%",children:[e(F,{borderBottomColor:"dark",borderBottomWidth:"thin",padding:"size-200",flex:"none",children:s(h,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e(re,{level:1,children:"Playground"}),s(h,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Tp,{}),e(Yp,{})]})]})}),e(Sy,{})]})})}function hy(){const n=U(l=>l.addInstance),a=U(l=>l.instances.length);return e("div",{onClick:l=>{l.stopPropagation()},children:e(M,{variant:"default",size:"compact","aria-label":"add prompt",icon:e(P,{svg:e(I.PlusCircleOutline,{})}),disabled:a>=bp,onClick:()=>{n()},children:"Prompt"})})}const ky=C`
3732
3732
  display: flex;
3733
3733
  flex-direction: column;
3734
3734
  height: 100%;
@@ -3761,7 +3761,7 @@ fragment ModelProviderPickerFragment on Query {
3761
3761
  flex-direction: column;
3762
3762
  height: 100%;
3763
3763
  overflow: auto;
3764
- `;function Sy(){const n=H(t=>t.instances),l=n.length===1;return s(Xe,{direction:l?"horizontal":"vertical",autoSaveId:l?"playground-horizontal":"playground-vertical",children:[e(ce,{children:e("div",{css:ky,children:e(_e,{arrowPosition:"start",size:"L",children:e(de,{title:"Prompts",id:"prompts",extra:s(h,{direction:"row",gap:"size-100",alignItems:"center",children:[e(fy,{}),e(hy,{})]}),children:e(F,{height:"100%",padding:"size-200",paddingBottom:"size-900",children:e(h,{direction:"row",gap:"size-200",children:n.map(t=>e(F,{flex:"1 1 0px",children:e(py,{playgroundInstanceId:t.id},t.id)},t.id))})})})})})}),e(Ye,{css:Kn}),e(ce,{children:e("div",{css:by,children:s(_e,{arrowPosition:"start",size:"L",children:[e(de,{title:"Inputs",id:"input",extra:e(wp,{}),children:e(F,{padding:"size-200",children:e(Ap,{})})}),e(de,{title:"Output",id:"output",children:e(F,{padding:"size-200",height:"100%",children:e(h,{direction:"row",gap:"size-200",children:n.map((t,i)=>e(F,{flex:"1 1 0px",children:e(Gp,{playgroundInstanceId:t.id},i)},i))})})})]})})})]})}function cf(){return e(ws,{})}function uf(){const n=Cn(),a=u.useMemo(()=>n.span.__typename==="Span"?n.span:null,[n.span]);if(!a)throw new Error("Span not found");const{playgroundInstance:l,parsingErrors:t}=u.useMemo(()=>Up(a),[a]);return s(h,{direction:"column",height:"100%",children:[e(vy,{span:a,parsingErrors:t}),e(ws,{instances:[l]})]})}function vy({span:n,parsingErrors:a}){const l=ne(),t=a&&a.length>0,[i,r]=u.useState(!0),[o,c]=u.useState(t);return s(h,{direction:"column",gap:"size-50",children:[i&&e(ee,{variant:"info",title:"LLM Span Replay",banner:!0,dismissable:!0,onDismissClick:()=>{r(!1)},extra:e(M,{variant:"default",icon:e(P,{svg:e(I.ArrowBack,{})}),onClick:()=>{l(`/projects/${n.project.id}/traces/${n.context.traceId}?selectedSpanNodeId=${n.id}`)},children:"Back to Trace"}),children:`Replay and iterate on your LLM call from your ${n.project.name} project`}),o&&t&&e(ee,{variant:"warning",banner:!0,dismissable:!0,onDismissClick:()=>{c(!1)},title:"The following errors occurred when parsing span attributes:",children:e("ul",{children:a.map(d=>e("li",{children:d},d))})})]})}const _s=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"spanId"}],a=[{kind:"Variable",name:"id",variableName:"spanId"}],l={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},i={alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[t,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null},r={alias:null,args:null,concreteType:"SpanContext",kind:"LinkedField",name:"context",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null}],storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"attributes",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"spanPlaygroundPageLoaderQuery",selections:[{alias:"span",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{kind:"InlineFragment",selections:[t,i,r,o],type:"Span",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"spanPlaygroundPageLoaderQuery",selections:[{alias:"span",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{kind:"TypeDiscriminator",abstractKey:"__isNode"},t,{kind:"InlineFragment",selections:[i,r,o],type:"Span",abstractKey:null}],storageKey:null}]},params:{cacheID:"d1df608d16a0a1d1451bcbac7dcfc853",id:null,metadata:{},name:"spanPlaygroundPageLoaderQuery",operationKind:"query",text:`query spanPlaygroundPageLoaderQuery(
3764
+ `;function Sy(){const n=U(t=>t.instances),l=n.length===1;return s(Xe,{direction:l?"horizontal":"vertical",autoSaveId:l?"playground-horizontal":"playground-vertical",children:[e(ue,{children:e("div",{css:ky,children:e(_e,{arrowPosition:"start",size:"L",children:e(de,{title:"Prompts",id:"prompts",extra:s(h,{direction:"row",gap:"size-100",alignItems:"center",children:[e(fy,{}),e(hy,{})]}),children:e(F,{height:"100%",padding:"size-200",paddingBottom:"size-900",children:e(h,{direction:"row",gap:"size-200",children:n.map(t=>e(F,{flex:"1 1 0px",children:e(py,{playgroundInstanceId:t.id},t.id)},t.id))})})})})})}),e(Ye,{css:Kn}),e(ue,{children:e("div",{css:by,children:s(_e,{arrowPosition:"start",size:"L",children:[e(de,{title:"Inputs",id:"input",extra:e(wp,{}),children:e(F,{padding:"size-200",children:e(Ap,{})})}),e(de,{title:"Output",id:"output",children:e(F,{padding:"size-200",height:"100%",children:e(h,{direction:"row",gap:"size-200",children:n.map((t,i)=>e(F,{flex:"1 1 0px",children:e(Gp,{playgroundInstanceId:t.id},i)},i))})})})]})})})]})}function cf(){return e(ws,{})}function uf(){const n=Cn(),a=u.useMemo(()=>n.span.__typename==="Span"?n.span:null,[n.span]);if(!a)throw new Error("Span not found");const{playgroundInstance:l,parsingErrors:t}=u.useMemo(()=>Up(a),[a]);return s(h,{direction:"column",height:"100%",children:[e(vy,{span:a,parsingErrors:t}),e(ws,{instances:[l]})]})}function vy({span:n,parsingErrors:a}){const l=ne(),t=a&&a.length>0,[i,r]=u.useState(!0),[o,c]=u.useState(t);return s(h,{direction:"column",gap:"size-50",children:[i&&e(ee,{variant:"info",title:"LLM Span Replay",banner:!0,dismissable:!0,onDismissClick:()=>{r(!1)},extra:e(M,{variant:"default",icon:e(P,{svg:e(I.ArrowBack,{})}),onClick:()=>{l(`/projects/${n.project.id}/traces/${n.context.traceId}?selectedSpanNodeId=${n.id}`)},children:"Back to Trace"}),children:`Replay and iterate on your LLM call from your ${n.project.name} project`}),o&&t&&e(ee,{variant:"warning",banner:!0,dismissable:!0,onDismissClick:()=>{c(!1)},title:"The following errors occurred when parsing span attributes:",children:e("ul",{children:a.map(d=>e("li",{children:d},d))})})]})}const _s=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"spanId"}],a=[{kind:"Variable",name:"id",variableName:"spanId"}],l={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},i={alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[t,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null},r={alias:null,args:null,concreteType:"SpanContext",kind:"LinkedField",name:"context",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"spanId",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null}],storageKey:null},o={alias:null,args:null,kind:"ScalarField",name:"attributes",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"spanPlaygroundPageLoaderQuery",selections:[{alias:"span",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{kind:"InlineFragment",selections:[t,i,r,o],type:"Span",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"spanPlaygroundPageLoaderQuery",selections:[{alias:"span",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{kind:"TypeDiscriminator",abstractKey:"__isNode"},t,{kind:"InlineFragment",selections:[i,r,o],type:"Span",abstractKey:null}],storageKey:null}]},params:{cacheID:"d1df608d16a0a1d1451bcbac7dcfc853",id:null,metadata:{},name:"spanPlaygroundPageLoaderQuery",operationKind:"query",text:`query spanPlaygroundPageLoaderQuery(
3765
3765
  $spanId: GlobalID!
3766
3766
  ) {
3767
3767
  span: node(id: $spanId) {