import{r as u,j as e,b as T,aa as ea,v as s,w as C,ab as Ke,ac as je,$ as J,ad as na,y as ue,z as me,D as B,F as H,B as Dn,R as Te,o as sl,ae as sn,af as ce,ag as on,ah as _r,E as _a,ai as Bn,a8 as ae,a1 as qe,a2 as G,a3 as Ar,aj as pe,ak as en,al as Er,am as ya,an as fa,ao as ha,ap as Nn,aq as Ce,ar as ol,n as dl,a as wr,as as Rr,at as Pr,au as cl,av as ul,aw as Mr,c as Nr,d as Vr,ax as $r,G as zr,ay as Qr}from"./vendor-BC3OPQuM.js";import{R as Ie,u as Le,a as Ve,T as Aa,P as ml,b as gl,M as qa,c as Ba,d as Hn,D as Or,e as jr,f as Q,g as pl,h as be,i as ia,j as Tn,k as yl,l as In,m as Ln,n as fl,o as $e,p as Re,C as re,q as ra,r as Be,s as Ea,t as He,E as hl,v as qr,w as Br,L as se,x as Hr,y as Gr,F as Ur,z as Wr,A as dn,B as fe,S as Jr,G as Zr,H as kl,I as Xr,J as Yr,K as Ha,N as es,O as ns,Q as as,U as ls,V as ts,W as is,X as bl,Y as _n,Z as rs,_ as ss,$ as os,a0 as ds,a1 as cs,a2 as cn,a3 as wa,a4 as Sl,a5 as Cn,a6 as Ta,a7 as Sn,a8 as _e,a9 as us,aa as ms,ab as ge,ac as vl,ad as sa,ae as xe,af as Ra,ag as pn,ah as X,ai as Ge,aj as gs,ak as Pa,al as Ee,am as we,an as un,ao as Ma,ap as Cl,aq as ps,ar as Fl,as as Se,at as Pe,au as Gn,av as ys,aw as Un,ax as oa,ay as Kl,az as xl,aA as fs,aB as Dl,aC as Tl,aD as Il,aE as An,aF as En,aG as ze,aH as wn,aI as ve,aJ as hs,aK as Ga,aL as Ll,aM as ks,aN as bs,aO as Ss,aP as fn,aQ as vs,aR as Cs,aS as Fs,aT as Ks,aU as xs,aV as Ds,aW as Ts,aX as Is,aY as Ls,aZ as Fn,a_ as an,a$ as Ia,b0 as hn,b1 as ln,b2 as _s,b3 as da,b4 as As,b5 as Na,b6 as Es,b7 as ws,b8 as aa}from"./components-Dte7_KRd.js";import{D as Va,B as ke,C as q,H as tn,J as ye,K as Rs,l as $a,M as Wn,P as yn,I as P,e as E,N as Ue,a as _l,c as te,p as Rn,q as Pn,t as ie,h as F,n as Al,O as Me,j as x,i as h,L as Qn,Q as El,f as N,S as j,s as Y,U,V as wl,W as Rl,X as Ps,Y as Ms,Z as ca,_ as Kn,v as Jn,T as Fe,d as le,z as Zn,r as mn,$ as z,a0 as Pl,E as ua,b as On,a1 as za,a2 as Ns,y as ma,u as Vs,a3 as $s}from"./vendor-arizeai-NjB3cZzD.js";import{R as We,C as Xn,X as Je,Y as De,a as Ze,T as Xe,B as xn,A as jn,b as Ml,c as Qa,L as Nl,d as zs,P as Qs,e as Os,f as js}from"./vendor-recharts-BXLYwcXF.js";import{p as Oa,R as ga,n as pa,j as qs,E as Bs,k as Hs,c as Gs}from"./vendor-codemirror-gE_JCOgX.js";const Vl=u.createContext(null);function $l(){const n=u.useContext(Vl);if(n===null)throw new Error("useFunctionality must be used within a FunctionalityProvider");return n}function vm(n){return e(Vl.Provider,{value:{authenticationEnabled:window.Config.authenticationEnabled},children:n.children})}const zl=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 {
  functionality {
    modelInferences
  }
  projects {
    edges {
      project: node {
        id
        endTime
      }
    }
  }
}
`}}}();zl.hash="a4bbc4917b3217b8254d68ec7c76dbdd";async function Cm(n){var l;const a=await T.fetchQuery(Ie,zl,{}).toPromise();if(a!=null&&a.functionality.modelInferences)return ea("/model");if((l=a==null?void 0:a.projects.edges)!=null&&l.length){let t=0,i=null;for(const{project:o}of a.projects.edges)o.endTime!=null&&(t++,i=o.id);if(t>1)return ea("/projects");if(t===1&&i!=null)return ea(`/projects/${i}`);const r=a==null?void 0:a.projects.edges[0].project.id;return ea(`/projects/${r}`)}else throw new Error("No functionality available")}const Ql=function(){var n={defaultValue:null,kind:"LocalArgument",name:"endTime"},a={defaultValue:null,kind:"LocalArgument",name:"startTime"},l=[{kind:"Variable",name:"endTime",variableName:"endTime"},{kind:"Variable",name:"startTime",variableName:"startTime"}],t=[{kind:"Literal",name:"first",value:50}],i={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},o={fields:[{kind:"Variable",name:"end",variableName:"endTime"},{kind:"Variable",name:"start",variableName:"startTime"}],kind:"ObjectValue",name:"timeRange"},c={alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},d=[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],m={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};return{fragment:{argumentDefinitions:[n,a],kind:"Fragment",metadata:null,name:"ModelPageQuery",selections:[{args:l,kind:"FragmentSpread",name:"ModelSchemaTable_dimensions"},{args:l,kind:"FragmentSpread",name:"ModelEmbeddingsTable_embeddingDimensions"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,n],kind:"Operation",name:"ModelPageQuery",selections:[{alias:null,args:null,concreteType:"Model",kind:"LinkedField",name:"model",plural:!1,selections:[{alias:null,args:t,concreteType:"DimensionConnection",kind:"LinkedField",name:"dimensions",plural:!1,selections:[{alias:null,args:null,concreteType:"DimensionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"dimension",args:null,concreteType:"Dimension",kind:"LinkedField",name:"node",plural:!1,selections:[i,r,{alias:null,args:null,kind:"ScalarField",name:"type",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"dataType",storageKey:null},{alias:"cardinality",args:[{kind:"Literal",name:"metric",value:"cardinality"},o],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"percentEmpty",args:[{kind:"Literal",name:"metric",value:"percentEmpty"},o],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"min",args:[{kind:"Literal",name:"metric",value:"min"},o],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"mean",args:[{kind:"Literal",name:"metric",value:"mean"},o],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"max",args:[{kind:"Literal",name:"metric",value:"max"},o],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"psi",args:[{kind:"Literal",name:"metric",value:"psi"},o],kind:"ScalarField",name:"driftMetric",storageKey:null}],storageKey:null},c,{alias:null,args:null,concreteType:"Dimension",kind:"LinkedField",name:"node",plural:!1,selections:d,storageKey:null}],storageKey:null},m],storageKey:"dimensions(first:50)"},{alias:null,args:t,filters:null,handle:"connection",key:"ModelSchemaTable_dimensions",kind:"LinkedHandle",name:"dimensions"},{alias:null,args:t,concreteType:"EmbeddingDimensionConnection",kind:"LinkedField",name:"embeddingDimensions",plural:!1,selections:[{alias:null,args:null,concreteType:"EmbeddingDimensionEdge",kind:"LinkedField",name:"edges",plural:!0,selections:[{alias:"embedding",args:null,concreteType:"EmbeddingDimension",kind:"LinkedField",name:"node",plural:!1,selections:[i,r,{alias:"euclideanDistance",args:[{kind:"Literal",name:"metric",value:"euclideanDistance"},o],kind:"ScalarField",name:"driftMetric",storageKey:null}],storageKey:null},c,{alias:null,args:null,concreteType:"EmbeddingDimension",kind:"LinkedField",name:"node",plural:!1,selections:d,storageKey:null}],storageKey:null},m],storageKey:"embeddingDimensions(first:50)"},{alias:null,args:t,filters:null,handle:"connection",key:"ModelEmbeddingsTable_embeddingDimensions",kind:"LinkedHandle",name:"embeddingDimensions"}],storageKey:null}]},params:{cacheID:"18059ac8df6b3c15d5e4bc04ca2c9877",id:null,metadata:{},name:"ModelPageQuery",operationKind:"query",text:`query ModelPageQuery(
  $startTime: DateTime!
  $endTime: DateTime!
) {
  ...ModelSchemaTable_dimensions_3uKjWt
  ...ModelEmbeddingsTable_embeddingDimensions_3uKjWt
}

fragment ModelEmbeddingsTable_embeddingDimensions_3uKjWt on Query {
  model {
    embeddingDimensions(first: 50) {
      edges {
        embedding: node {
          id
          name
          euclideanDistance: driftMetric(metric: euclideanDistance, timeRange: {start: $startTime, end: $endTime})
        }
        cursor
        node {
          __typename
        }
      }
      pageInfo {
        endCursor
        hasNextPage
      }
    }
  }
}

fragment ModelSchemaTable_dimensions_3uKjWt on Query {
  model {
    dimensions(first: 50) {
      edges {
        dimension: node {
          id
          name
          type
          dataType
          cardinality: dataQualityMetric(metric: cardinality, timeRange: {start: $startTime, end: $endTime})
          percentEmpty: dataQualityMetric(metric: percentEmpty, timeRange: {start: $startTime, end: $endTime})
          min: dataQualityMetric(metric: min, timeRange: {start: $startTime, end: $endTime})
          mean: dataQualityMetric(metric: mean, timeRange: {start: $startTime, end: $endTime})
          max: dataQualityMetric(metric: max, timeRange: {start: $startTime, end: $endTime})
          psi: driftMetric(metric: psi, timeRange: {start: $startTime, end: $endTime})
        }
        cursor
        node {
          __typename
        }
      }
      pageInfo {
        endCursor
        hasNextPage
      }
    }
  }
}
`}}}();Ql.hash="b612239336c7638df42037315b00f635";function Fm(n){const{referenceInferences:a}=Le(),{timeRange:l}=Ve(),t=T.useLazyLoadQuery(Ql,{startTime:l.start.toISOString(),endTime:l.end.toISOString()});return s("main",{children:[s(Aa,{children:[e(ml,{}),a?e(gl,{inferencesRole:"reference",timeRange:{start:new Date(a.startTime),end:new Date(a.endTime)}}):null]}),e("section",{css:C`
          margin: var(--px-spacing-lg);
        `,children:e(Va,{title:"Model Schema",variant:"compact",bodyStyle:{padding:0},children:s(ke,{children:[e(q,{name:"All",children:s(tn,{children:[e(ye,{title:"Embeddings",id:"embeddings",children:e(qa,{model:t})}),e(ye,{title:"Dimensions",id:"dimensions",children:e(Ba,{model:t})})]})},"all"),e(q,{name:"Embeddings",children:e(qa,{model:t})},"embeddings"),e(q,{name:"Dimensions",children:e(Ba,{model:t})},"dimensions")]})})}),e(Ke,{})]})}const Ol={fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"EmbeddingPageModelQuery",selections:[{alias:null,args:null,concreteType:"Model",kind:"LinkedField",name:"model",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"MetricSelector_dimensions"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"EmbeddingPageModelQuery",selections:[{alias:null,args:null,concreteType:"Model",kind:"LinkedField",name:"model",plural:!1,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"]})'}],storageKey:null}]},params:{cacheID:"4ccf476dd862525b059197daccd0d4d9",id:null,metadata:{},name:"EmbeddingPageModelQuery",operationKind:"query",text:`query EmbeddingPageModelQuery {
  model {
    ...MetricSelector_dimensions
  }
}

fragment MetricSelector_dimensions on Model {
  numericDimensions: dimensions(include: {dataTypes: [numeric]}) {
    edges {
      node {
        id
        name
        type
      }
    }
  }
}
`}};Ol.hash="374499f7f8ce6919e4a0a4ecbe380c52";const jl=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"},m={defaultValue:null,kind:"LocalArgument",name:"nSamples"},f={defaultValue:null,kind:"LocalArgument",name:"performanceMetric"},g={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},v={alias:null,args:null,kind:"ScalarField",name:"x",storageKey:null},b={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:[v,b,{alias:null,args:null,kind:"ScalarField",name:"z",storageKey:null}],type:"Point3D",abstractKey:null},{kind:"InlineFragment",selections:[v,b],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}],I={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,m,f,g],kind:"Fragment",metadata:null,name:"EmbeddingPageUMAPQuery",selections:[{alias:"embedding",args:p,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[I],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[r,g,c,d,m,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,I,{kind:"TypeDiscriminator",abstractKey:"__isNode"},y],storageKey:null}]},params:{cacheID:"d30210c52f86b9d9a7ac958f866aa93e",id:null,metadata:{},name:"EmbeddingPageUMAPQuery",operationKind:"query",text:`query EmbeddingPageUMAPQuery(
  $id: GlobalID!
  $timeRange: TimeRange!
  $minDist: Float!
  $nNeighbors: Int!
  $nSamples: Int!
  $minClusterSize: Int!
  $clusterMinSamples: Int!
  $clusterSelectionEpsilon: Float!
  $fetchDataQualityMetric: Boolean!
  $dataQualityMetricColumnName: String
  $fetchPerformanceMetric: Boolean!
  $performanceMetric: PerformanceMetric!
) {
  embedding: node(id: $id) {
    __typename
    ... on EmbeddingDimension {
      UMAPPoints(timeRange: $timeRange, minDist: $minDist, nNeighbors: $nNeighbors, nSamples: $nSamples, minClusterSize: $minClusterSize, clusterMinSamples: $clusterMinSamples, clusterSelectionEpsilon: $clusterSelectionEpsilon) {
        data {
          id
          eventId
          coordinates {
            __typename
            ... on Point3D {
              x
              y
              z
            }
            ... on Point2D {
              x
              y
            }
          }
          embeddingMetadata {
            linkToData
            rawData
          }
          eventMetadata {
            predictionId
            predictionLabel
            actualLabel
            predictionScore
            actualScore
          }
        }
        referenceData {
          id
          eventId
          coordinates {
            __typename
            ... on Point3D {
              x
              y
              z
            }
            ... on Point2D {
              x
              y
            }
          }
          embeddingMetadata {
            linkToData
            rawData
          }
          eventMetadata {
            predictionId
            predictionLabel
            actualLabel
            predictionScore
            actualScore
          }
        }
        corpusData {
          id
          eventId
          coordinates {
            __typename
            ... on Point3D {
              x
              y
              z
            }
            ... on Point2D {
              x
              y
            }
          }
          embeddingMetadata {
            linkToData
            rawData
          }
          eventMetadata {
            predictionId
            predictionLabel
            actualLabel
            predictionScore
            actualScore
          }
        }
        clusters {
          id
          eventIds
          driftRatio
          primaryToCorpusRatio
          dataQualityMetric(metric: {columnName: $dataQualityMetricColumnName, metric: mean}) @include(if: $fetchDataQualityMetric) {
            primaryValue
            referenceValue
          }
          performanceMetric(metric: {metric: $performanceMetric}) @include(if: $fetchPerformanceMetric) {
            primaryValue
            referenceValue
          }
        }
        contextRetrievals {
          queryId
          documentId
          relevance
        }
      }
    }
    __isNode: __typename
    id
  }
}
`}}}();jl.hash="f1ee7ce02317f1c3fe96b77af405095f";function Us(){const{theme:n}=Hn();return u.useMemo(()=>n==="light"?Or:jr,[n])}function Ws(){const{embeddingDimensionId:n}=je();if(!n)throw new Error("Missing embeddingDimensionId in URL params");return n}const ql={euclideanDistance:{name:"Euclidean Distance",shortName:"Euc. Distance",definition:"Euclidean distance over time captures how much your primary inferences's embeddings are drifting from the reference data. Euclidean distance of the embeddings is calculated by taking the centroid of the embedding vectors for each inferences and calculating the distance between the two centroids."},queryDistance:{name:"Query Distance",shortName:"Query Distance",definition:"The query distance is the euclidean distance of the centroid of queries from the centroid of the corpus."},accuracyScore:{name:"Accuracy Score",shortName:"Accuracy",definition:"Accuracy classification score. In multi-label classification, this function computes subset accuracy: the set of labels predicted for a sample must exactly match the corresponding set of labels in the ground truth."}};function rn(n){const a=ql[n];return a!=null?a.shortName:n}function ka(n){const a=ql[n];return a&&a.definition!=null&&a.definition||null}function kn(n){return`${n.column}:${n.dir}`}function Js(){const{referenceInferences:n}=Le(),a=!!n,l=Q(d=>d.clusterSort),t=Q(d=>d.setClusterSort),[i,r]=u.useState(!1),o=u.useMemo(()=>{const d=[];return a&&d.push({label:"Most drift",value:kn({column:"driftRatio",dir:"desc"})}),[...d,{label:"Largest clusters",value:kn({column:"size",dir:"desc"})},{label:"Smallest clusters",value:kn({column:"size",dir:"asc"})},{label:"Highest metric value",value:kn({column:"primaryMetricValue",dir:"desc"})},{label:"Lowest metric value",value:kn({column:"primaryMetricValue",dir:"asc"})}]},[a]),c=kn(l);return e("div",{css:d=>C`
        .ac-action-button {
          background: none;
          border: none;
          color: ${"var(--ac-global-text-color-700)"};
          font-size: ${d.typography.sizes.small.fontSize}px;
          line-height: ${d.typography.sizes.small.lineHeight}px;
          cursor: pointer;
          outline: none;
          &:hover {
            color: var(--ac-global-text-color-900);
          }
        }
      `,children:s(yn,{placement:"bottom right","aria-label":"Sort clusters by",isOpen:i,onOpenChange:d=>r(d),children:[s(Rs,{children:["Sort",e("span",{"aria-hidden":!0,"data-testid":"dropdown-caret",css:C`
              margin-left: var(--px-spacing-sm);
              border-bottom-color: #0000;
              border-left-color: #0000;
              border-right-color: #0000;
              border-style: solid;
              border-width: 3px 3px 0;
              content: "";
              display: inline-block;
              height: 0;
              vertical-align: middle;
              width: 0;
            `})]}),e($a,{children:e(Wn,{style:{width:200},selectedKeys:[c],selectionMode:"single",items:o,onSelectionChange:d=>{if(d instanceof Set&&d.size>0){const[m]=d.values(),[f,g]=m.split(":");t({column:f,dir:g})}r(!1)},children:d=>e(J,{children:d.label},d.value)})})]})})}const Bl=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(
  $clusters: [ClusterInput!]!
) {
  exportClusters(clusters: $clusters) {
    fileName
  }
}
`}}}();Bl.hash="b5ff2517dbb0d19a1b24dea1796a3576";function Zs(){const n=Q(r=>r.clusters),{notifyError:a,notifySuccess:l}=pl(),[t,i]=T.useMutation(Bl);return e(Ue,{align:"end",buttonSize:"compact",icon:i?e(P,{svg:e(E.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(J,{children:[e(P,{svg:e(E.Download,{})}),"Export clusters"]},"export_cluster")})}const Hl={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};Hl.hash="55d03de16503d7af254c17cef7d18ee0";const vn=":";function Xs(n){return["drift","performance","dataQuality","retrieval"].includes(n)}function Vn(n){const{type:a,metric:l}=n;switch(a){case"drift":return`${a}${vn}${l}`;case"retrieval":return`${a}${vn}${l}`;case"performance":return`${a}${vn}${l}`;case"dataQuality":{const{name:t}=n.dimension;return`${a}${vn}${l}${vn}${t}`}default:be()}}function Ys({metricKey:n,dimensions:a}){const[l,t,i]=n.split(vn);if(!Xs(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:be()}}const eo=s(Pn,{variant:"info",children:[e(te,{level:4,children:"Analysis Metric"}),s(Rn,{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 no({model:n}){const[,a]=u.useTransition(),l=T.useFragment(Hl,n),{referenceInferences:t,corpusInferences:i}=Le(),r=!!t,o=!!i,c=Q(y=>y.metric),d=Q(y=>y.loading),m=Q(y=>y.setMetric),f=l.numericDimensions.edges.map(y=>y.node),g=f.length>0,p=u.useCallback(y=>{const k=Ys({metricKey:y,dimensions:f});a(()=>{m(k)})},[m,f,a]);return s(_l,{label:"metric",labelExtra:eo,selectedKey:c?Vn(c):void 0,onSelectionChange:p,placeholder:"Select a metric...",isDisabled:d,children:[r?e(na,{title:"Drift",children:e(J,{children:"Euclidean Distance"},Vn({type:"drift",metric:"euclideanDistance"}))}):null,o?e(na,{title:"Retrieval",children:e(J,{children:"Query Distance"},Vn({type:"retrieval",metric:"queryDistance"}))}):null,e(na,{title:"Performance",children:e(J,{children:"Accuracy Score"},Vn({type:"performance",metric:"accuracyScore"}))}),g?e(na,{title:"Data Quality",children:f.map(y=>e(J,{children:`${y.name} avg`},Vn({type:"dataQuality",metric:"average",dimension:y})))}):null]})}const Gl=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"},m={defaultValue:null,kind:"LocalArgument",name:"timeRange"},f=[{kind:"Variable",name:"id",variableName:"embeddingDimensionId"}],g={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],v=[{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}],b={kind:"InlineFragment",selections:[{condition:"fetchDrift",kind:"Condition",passingValue:!0,selections:[{alias:"euclideanDistanceTimeSeries",args:k,concreteType:"DriftTimeSeries",kind:"LinkedField",name:"driftTimeSeries",plural:!1,selections:v,storageKey:null}]},{condition:"fetchQueryDistance",kind:"Condition",passingValue:!0,selections:[{alias:null,args:k,concreteType:"DriftTimeSeries",kind:"LinkedField",name:"retrievalMetricTimeSeries",plural:!1,selections:v,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:v,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:v,storageKey:null}],type:"Dimension",abstractKey:null},I={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:v,storageKey:null}]}],storageKey:null},A={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null};return{fragment:{argumentDefinitions:[n,a,l,t,i,r,o,c,d,m],kind:"Fragment",metadata:null,name:"MetricTimeSeriesQuery",selections:[{alias:"embedding",args:f,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[g,b],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}]},I],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[l,m,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:[A,g,b],storageKey:null},{condition:"fetchDataQuality",kind:"Condition",passingValue:!0,selections:[{alias:"dimension",args:S,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[A,L,{kind:"TypeDiscriminator",abstractKey:"__isNode"},g],storageKey:null}]},I]},params:{cacheID:"a68a8204bf7fdd13e6915b338d4b5497",id:null,metadata:{},name:"MetricTimeSeriesQuery",operationKind:"query",text:`query MetricTimeSeriesQuery(
  $embeddingDimensionId: GlobalID!
  $timeRange: TimeRange!
  $metricGranularity: Granularity!
  $countGranularity: Granularity!
  $fetchDrift: Boolean!
  $fetchQueryDistance: Boolean!
  $fetchDataQuality: Boolean!
  $dimensionId: GlobalID!
  $fetchPerformance: Boolean!
  $performanceMetric: PerformanceMetric!
) {
  embedding: node(id: $embeddingDimensionId) {
    __typename
    id
    ... on EmbeddingDimension {
      euclideanDistanceTimeSeries: driftTimeSeries(metric: euclideanDistance, timeRange: $timeRange, granularity: $metricGranularity) @include(if: $fetchDrift) {
        data {
          timestamp
          value
        }
      }
      retrievalMetricTimeSeries(metric: euclideanDistance, timeRange: $timeRange, granularity: $metricGranularity) @include(if: $fetchQueryDistance) {
        data {
          timestamp
          value
        }
      }
      trafficTimeSeries: dataQualityTimeSeries(metric: count, timeRange: $timeRange, granularity: $countGranularity) {
        data {
          timestamp
          value
        }
      }
    }
  }
  dimension: node(id: $dimensionId) @include(if: $fetchDataQuality) {
    __typename
    ... on Dimension {
      name
      dataQualityTimeSeries(metric: mean, timeRange: $timeRange, granularity: $metricGranularity) {
        data {
          timestamp
          value
        }
      }
    }
    __isNode: __typename
    id
  }
  model {
    performanceTimeSeries(metric: {metric: $performanceMetric}, timeRange: $timeRange, granularity: $metricGranularity) @include(if: $fetchPerformance) {
      data {
        timestamp
        value
      }
    }
  }
}
`}}}();Gl.hash="f31abad2141a5a1c461ef2a598ffa4f3";const Ua=new Intl.NumberFormat([],{maximumFractionDigits:2}),Ul=()=>{const n=$e(),a=n.blue400,l=n.gray500;return{color:a,barColor:l}};function ao({active:n,payload:a,label:l}){var r,o,c;const{color:t,barColor:i}=Ul();if(n&&a&&a.length){const d=((r=a[1])==null?void 0:r.value)??null,m=((o=a[0])==null?void 0:o.value)??null,f=typeof d=="number"?Ua.format(d):"--",g=typeof m=="number"?Ua.format(m):"--";return s(Be,{children:[e(F,{weight:"heavy",textSize:"medium",children:`${Re(new Date(l))}`}),e(re,{color:t,name:((c=a[1])==null?void 0:c.payload.metricName)??"Metric",value:f}),e(re,{color:i,shape:"square",name:"Count",value:g}),e(ra,{}),s("div",{css:C`
            display: flex;
            flex-direction: row;
            align-items: center;
            color: var(--ac-global-color-primary);
            gap: var(--px-spacing-sm);

            margin-top: var(--px-spacing-sm);
          `,children:[e(P,{svg:e(Al,{})}),e("span",{children:"Click to view the point cloud at this time"})]})]})}return null}function lo(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:be()}}function to(n){if(n)switch(n.type){case"drift":return rn(n.metric);case"performance":return rn(n.metric);case"dataQuality":return`${n.dimension.name} avg`;case"retrieval":return rn(n.metric);default:be()}else return"Count"}function io(n){switch(n.type){case"drift":return ka(n.metric);case"performance":return ka(n.metric);case"dataQuality":return null;case"retrieval":return ka(n.metric);default:be()}}function ro({embeddingDimensionId:n}){const a=Q(K=>K.metric),l=a.type==="drift",t=a.type==="retrieval",i=a.type==="dataQuality",r=a.type==="performance",{timeRange:o}=Ve(),{selectedTimestamp:c,setSelectedTimestamp:d}=ia(),m=Tn(o),f=T.useLazyLoadQuery(Gl,{embeddingDimensionId:n,timeRange:{start:o.start.toISOString(),end:o.end.toISOString()},metricGranularity:yl(o),countGranularity:m,fetchDrift:l,fetchQueryDistance:t,fetchDataQuality:i,fetchPerformance:r,dimensionId:a.type==="dataQuality"?a.dimension.id:n,performanceMetric:a.type==="performance"?a.metric:"accuracyScore"}),g=In({samplingIntervalMinutes:m.samplingIntervalMinutes}),p=u.useCallback(K=>{const{activePayload:D}=K;if(D!=null&&D.length>0){const R=D[0].payload;d(new Date(R.timestamp))}},[d]),y=so({data:f,metric:a}),v=oo(f).reduce((K,D)=>(K[D.timestamp]=D.value,K),{})??{},b=y.map(K=>{const D=v[K.timestamp];return{...K,traffic:D,timestamp:new Date(K.timestamp).getTime()}}),S=to(a),L=io(a),{color:I,barColor:A}=Ul();return s("section",{css:C`
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        h3 {
          padding: var(--px-spacing-sm) var(--px-spacing-lg) 0
            var(--px-spacing-lg);
          flex: none;
          display: flex;
          flex-direction: row;
          align-items: center;
          gap: var(--px-spacing-sm);
        }
        & > div {
          flex: 1 1 auto;
          width: 100%;
          overflow: hidden;
        }
      `,children:[s(te,{level:3,children:[lo(a),L!=null?s(Pn,{children:[e(te,{level:4,children:S}),e(Rn,{children:L})]}):null]}),e("div",{children:e(We,{width:"100%",height:"100%",children:s(Xn,{data:b,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:I,stopOpacity:.8}),e("stop",{offset:"95%",stopColor:I,stopOpacity:0})]}),s("linearGradient",{id:"barColor",x1:"0",y1:"0",x2:"0",y2:"1",children:[e("stop",{offset:"5%",stopColor:A,stopOpacity:.3}),e("stop",{offset:"95%",stopColor:A,stopOpacity:0})]})]}),e(Je,{...Ln,tickFormatter:K=>g(new Date(K)),style:{fill:"var(--ac-global-text-color-700)"}}),e(De,{stroke:ie.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(De,{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(Ze,{strokeDasharray:"4 4",stroke:ie.colors.gray200,strokeOpacity:.5}),e(Xe,{content:e(ao,{})}),e(xn,{yAxisId:"right",dataKey:"traffic",fill:"url(#barColor)",spacing:5}),e(jn,{type:"monotone",dataKey:"value",stroke:I,fillOpacity:1,fill:"url(#colorUv)"}),c!=null?e(Ml,{...fl,x:c.getTime()}):null]})})})]})}function so({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:rn(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:rn(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(m=>({metricName:`${d} avg`,...m}))}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:rn(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 oo(n){var a;return((a=n.embedding.trafficTimeSeries)==null?void 0:a.data)!=null?[...n.embedding.trafficTimeSeries.data]:[]}const Wl=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(
  $primaryEventIds: [ID!]!
  $referenceEventIds: [ID!]!
  $corpusEventIds: [ID!]!
) {
  model {
    primaryInferences {
      events(eventIds: $primaryEventIds) {
        id
        dimensions {
          dimension {
            name
            type
          }
          value
        }
        eventMetadata {
          predictionId
          predictionLabel
          predictionScore
          actualLabel
          actualScore
        }
        promptAndResponse {
          prompt
          response
        }
        documentText
      }
    }
    referenceInferences {
      events(eventIds: $referenceEventIds) {
        id
        dimensions {
          dimension {
            name
            type
          }
          value
        }
        eventMetadata {
          predictionId
          predictionLabel
          predictionScore
          actualLabel
          actualScore
        }
        promptAndResponse {
          prompt
          response
        }
        documentText
      }
    }
    corpusInferences {
      events(eventIds: $corpusEventIds) {
        id
        dimensions {
          dimension {
            name
            type
          }
          value
        }
        eventMetadata {
          predictionId
          predictionLabel
          predictionScore
          actualLabel
          actualScore
        }
        promptAndResponse {
          prompt
          response
        }
        documentText
      }
    }
  }
}
`}}}();Wl.hash="4bd627481610322f2acbcf73dfbfaadc";const Wa=C`
  margin: var(--px-spacing-lg);
  display: flex;
  flex-direction: column;
  gap: var(--px-spacing-med);
  & > div {
    display: flex;
    flex-direction: row;
    dt {
      font-weight: bold;
      flex: none;
      width: 130px;
    }
    dd {
      flex: 1 1 auto;
      margin-inline-start: 0;
    }
  }
`;function $n(n){return e("div",{css:C`
        max-height: 200px;
        overflow-y: auto;
      `,children:e("pre",{css:C`
          padding: var(--px-spacing-lg);
          color: var(--ac-global-text-color-900);
          white-space: normal;
          margin: 0;
        `,children:n.children})})}function co({event:n}){const a=n.retrievedDocuments&&n.retrievedDocuments.length>0,l=!n.id.includes("CORPUS");return s("section",{css:C`
        height: 100%;
        overflow-y: auto;
      `,children:[e(po,{event:n}),s(tn,{children:[l?e(ye,{id:"prediction",title:"Prediction Details",children:s("dl",{css:Wa,children:[n.predictionId!=null&&s("div",{children:[e("dt",{children:"Prediction ID"}),e("dd",{css:C`
                      display: flex;
                      align-items: center;
                    `,children:n.predictionId})]}),n.predictionLabel!=null&&s("div",{children:[e("dt",{children:"Prediction Label"}),e("dd",{children:n.predictionLabel})]}),n.predictionScore!=null&&s("div",{children:[e("dt",{children:"Prediction Score"}),e("dd",{children:n.predictionScore})]}),n.actualLabel!=null&&s("div",{children:[e("dt",{children:"Actual Label"}),e("dd",{children:n.actualLabel})]}),n.actualScore!=null&&s("div",{children:[e("dt",{children:"Actual Score"}),e("dd",{children:n.actualScore})]})]})}):e(ye,{id:"document",title:"Document Details",children:e("dl",{css:Wa,children:n.predictionId!=null&&s("div",{children:[e("dt",{children:"Document ID"}),e("dd",{css:C`
                      display: flex;
                      align-items: center;
                    `,children:n.predictionId})]})})}),e(ye,{id:"dimensions",title:"Dimensions",children:e(mo,{dimensions:n.dimensions})}),a&&e(ye,{id:"retrievals",title:"Retrieved Documents",titleExtra:e(Me,{variant:"light",children:n.retrievedDocuments.length}),children:e("ul",{css:C`
                padding: var(--px-spacing-med);
                li + li {
                  margin-top: var(--px-spacing-med);
                }
              `,children:n.retrievedDocuments.map(t=>e("li",{children:e(uo,{document:t})},t.id))})})]})]})}function uo({document:n}){return e(x,{borderRadius:"medium",backgroundColor:"light",children:s(h,{direction:"column",children:[e(x,{width:"100%",borderBottomWidth:"thin",borderBottomColor:"dark",children:s(h,{direction:"row",justifyContent:"space-between",margin:"size-100",alignItems:"center",children:[s(h,{direction:"row",gap:"size-50",alignItems:"center",children:[e(P,{svg:e(E.FileOutline,{})}),s(te,{level:4,children:["document ",n.id]})]}),typeof n.relevance=="number"&&e(Qn,{color:"blue",children:`relevance ${Ea(n.relevance)}`})]})}),e("pre",{css:C`
            padding: var(--px-spacing-lg);
            white-space: normal;
            margin: 0;
          `,children:n.text})]})})}function mo({dimensions:n}){const a=u.useMemo(()=>n.map(i=>({name:i.dimension.name,type:i.dimension.type,value:i.value??"--"})),[n]),l=u.useMemo(()=>[{header:()=>"Name",accessorKey:"name"},{header:()=>"Type",accessorKey:"type"},{header:()=>"Value",accessorKey:"value"}],[]),t=ue({columns:l,data:a,getCoreRowModel:me()});return s("table",{css:He,children:[e("thead",{children:t.getHeaderGroups().map(i=>e("tr",{children:i.headers.map(r=>e("th",{colSpan:r.colSpan,children:r.isPlaceholder?null:e("div",{children:B(r.column.columnDef.header,r.getContext())})},r.id))},i.id))}),t.getCoreRowModel().rows.length?e("tbody",{children:t.getRowModel().rows.map(i=>e("tr",{children:i.getVisibleCells().map(r=>e("td",{children:B(r.column.columnDef.cell,r.getContext())},r.id))},i.id))}):e(yo,{})]})}function go({dataUrl:n}){const a=qr(n),l=Br(n);return a?e("video",{src:n,controls:!0,css:C`
          width: 100%;
          height: 500px;
          background-color: black;
        `}):l?e("audio",{src:n,controls:!0,autoPlay:!0}):e("img",{src:n,alt:"event image",width:"100%",height:"200px",css:C`
        object-fit: contain;
        background-color: black;
      `})}function po({event:n}){const a=n.linkToData||void 0,l=n.rawData,t=n.prompt||n.response?{prompt:n.prompt,response:n.response}:null,i=n.documentText;let r=null;return a?r=s(h,{direction:"column",children:[e(go,{dataUrl:a}),l&&e(tn,{children:e(ye,{id:"raw",title:"Raw Data",children:e($n,{children:l})})})]}):i?r=e(tn,{children:e(ye,{id:"document",title:"Document",children:e($n,{children:i})})}):t?r=s(tn,{children:[e(ye,{id:"prompt",title:"Prompt",children:e($n,{children:t.prompt})}),e(ye,{id:"response",title:"Response",children:e($n,{children:t.response})})]}):n.rawData&&n.rawData&&n.rawData,r}function yo(){return e("tbody",{className:"is-empty",children:e("tr",{children:e("td",{colSpan:100,css:n=>C`
            text-align: center;
            padding: ${n.spacing.margin24}px ${n.spacing.margin24}px !important;
          `,children:e(hl,{graphicKey:"documents",message:"This embedding has no associated dimensions"})})})})}const Jl=function(){var n=[{alias:null,args:null,concreteType:"Model",kind:"LinkedField",name:"model",plural:!1,selections:[{alias:null,args:null,concreteType:"ExportedFile",kind:"LinkedField",name:"exportedFiles",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"fileName",storageKey:null}],storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"ExportSelectionButtonExportsQuery",selections:n,type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"ExportSelectionButtonExportsQuery",selections:n},params:{cacheID:"2f7e3554305121746dc799b6a8d120da",id:null,metadata:{},name:"ExportSelectionButtonExportsQuery",operationKind:"query",text:`query ExportSelectionButtonExportsQuery {
  model {
    exportedFiles {
      fileName
    }
  }
}
`}}}();Jl.hash="7e6db431afe21f137e54505645c787f4";const Zl=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"eventIds"}],a=[{alias:null,args:[{kind:"Variable",name:"eventIds",variableName:"eventIds"}],concreteType:"ExportedFile",kind:"LinkedField",name:"exportEvents",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"fileName",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ExportSelectionButtonMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ExportSelectionButtonMutation",selections:a},params:{cacheID:"d370df04ca30a5059288c7aa298239a8",id:null,metadata:{},name:"ExportSelectionButtonMutation",operationKind:"mutation",text:`mutation ExportSelectionButtonMutation(
  $eventIds: [ID!]!
) {
  exportEvents(eventIds: $eventIds) {
    fileName
  }
}
`}}}();Zl.hash="8b0d6962e2034d4c148d1b9919111d2f";const fo=`import phoenix as px

exports = px.active_session().exports
dataframe = exports[-1]
dataframe`,ho=C`
  .cm-content {
    padding: var(--ac-global-dimension-static-size-100);
  }
`;function ko({value:n}){const{theme:a}=Hn(),l=a==="light"?void 0:pa;return e(ga,{value:n,basicSetup:!1,extensions:[Oa()],editable:!1,theme:l,css:ho})}function bo(){const n=Q(o=>o.selectedEventIds),[a,l]=T.useMutation(Zl),[t,i]=u.useState(null),r=u.useCallback(()=>{a({variables:{eventIds:[...n]},onCompleted:o=>{i(o.exportEvents)}})},[a,n]);return s(H,{children:[e(N,{variant:"default",size:"compact",icon:e(P,{svg:e(El,{})}),"aria-label":"Export selection / cluster",loading:l,onClick:r,children:l?"Exporting":"Export"}),e(U,{type:"slideOver",isDismissable:!0,onDismiss:()=>i(null),children:t!=null&&s(j,{title:"Cluster Exports",size:"M",children:[e(Y,{variant:"success",banner:!0,title:"Export succeeded",extra:e(N,{variant:"success",size:"compact",onClick:()=>{window.open(`/exports?filename=${t.fileName}`,"_self")},children:"Download"})}),s("div",{css:C`
                display: flex;
                flex-direction: column;
                justify-content: space-between;
                align-items: flex-start;
                padding: 16px;
                gap: 16px;
              `,children:[e("p",{css:C`
                  margin: 0;
                  flex: 1 1 auto;
                `,children:"You can retrieve your export in your notebook via"}),e(x,{borderColor:"light",borderWidth:"thin",borderRadius:"medium",children:e(ko,{value:fo})})]}),e(tn,{children:e(ye,{id:"all-exports",title:"Latest Exports",children:e(u.Suspense,{fallback:e(se,{}),children:e(So,{})})})})]})})]})}function So(){const n=T.useLazyLoadQuery(Jl,{},{fetchPolicy:"network-only"});return e(Rl,{children:n.model.exportedFiles.map((a,l)=>e(wl,{children:s("div",{css:C`
              display: flex;
              flex-direction: row;
              justify-content: space-between;
              align-items: center;
            `,children:[a.fileName,e(N,{size:"compact","aria-label":"Download",variant:"default",icon:e(P,{svg:e(El,{})}),onClick:()=>{window.open(`/exports?filename=${a.fileName}`,"_self")}})]})},l))})}function vo(n){const{getInferencesNameByRole:a}=Le(),{events:l,onItemSelected:t}=n,i=Q(m=>m.eventIdToDataMap),r=Q(m=>m.eventIdToGroup),o=Q(m=>m.pointGroupColors),c=Q(m=>m.selectionGridSize),d=Q(m=>m.setHoveredEventId);return e("div",{css:C`
        flex: 1 1 auto;
        overflow-y: auto;
      `,"data-testid":"grid-view-scroll-container",children:e("ul",{"data-grid-size":c,css:C`
          &[data-grid-size="small"] {
            --grid-item-min-width: 100px;
            --grid-item-height: 100px;
          }
          &[data-grid-size="medium"] {
            --grid-item-min-width: 200px;
            --grid-item-height: 200px;
          }
          &[data-grid-size="large"] {
            --grid-item-min-width: 300px;
            --grid-item-height: 200px;
          }
          padding: var(--px-spacing-lg);
          transition: all 0.2s ease-in-out;
          display: grid;
          grid-template-columns: repeat(
            auto-fill,
            minmax(var(--grid-item-min-width), 1fr)
          );
          flex-wrap: wrap;
          gap: var(--px-spacing-lg);
          & > li {
            min-width: var(--grid-item-min-width);
            height: var(--grid-item-height);
          }
        `,children:l.map((m,f)=>{const g=i.get(m.id),{rawData:p=null,linkToData:y=null}=(g==null?void 0:g.embeddingMetadata)??{},{predictionLabel:k=null,actualLabel:v=null}=(g==null?void 0:g.eventMetadata)??{},b=Hr(m.id),S=a(b),L=r[m.id],I=o[L];return e("li",{children:e(Gr,{rawData:p,linkToData:y,inferencesName:S,group:L,onClick:()=>{t(m.id)},onMouseOver:()=>{d(m.id)},onMouseOut:()=>{d(null)},color:I,size:c,predictionLabel:k,actualLabel:v,promptAndResponse:m.promptAndResponse,documentText:m.documentText,autoPlay:!1})},f)})})})}function Co({data:n,onPointSelected:a}){const{primaryInferences:l,referenceInferences:t}=Le(),i=Q(f=>f.metric),[r,o]=u.useState([]),{columns:c,tableData:d}=u.useMemo(()=>{const f=n.filter(I=>I.id.includes("CORPUS")===!1);let g=!1,p=!1,y=!1,k=!1,v=!1;n.forEach(I=>{I.linkToData&&(g=!0),I.rawData&&(p=!0),(I.prompt||I.response)&&(y=!0),I.predictionLabel&&(k=!0),I.actualLabel&&(v=!0)});const b=[];t&&b.push({header:"Inference Set",accessorKey:"id",size:50,cell:({getValue:I})=>e(Fo,{id:I(),primaryInferencesName:l.name,referenceInferencesName:(t==null?void 0:t.name)??"reference"})}),g&&b.push({header:"Link",accessorKey:"linkToData",cell:({getValue:I})=>{const A=I();if(typeof A=="string"){const K=A.split("/").pop();return e(dn,{href:A,children:K})}return null}}),y?(b.push({header:"Prompt",accessorKey:"prompt",cell:fe,size:200}),b.push({header:"Response",accessorKey:"response",cell:fe,size:200})):p&&b.push({header:"Raw Data",accessorKey:"rawData"}),k&&b.push({header:"Prediction Label",accessorKey:"predictionLabel",size:50}),v&&b.push({header:"Actual Label",accessorKey:"actualLabel",size:50});const S=[];if(i&&i.type==="dataQuality"){const I=i.dimension.name;S.push({header:i.dimension.name,accessorKey:"metric",cell:Ur,sortingFn:"basic"}),f.forEach(A=>{var D;const K=(D=A.dimensions.find(R=>R.dimension.name===I))==null?void 0:D.value;A.metric=K!=null?Number(K):null})}return{columns:[...b,...S,{header:"",id:"view-details",size:50,cell:({row:I})=>e(Wr,{"aria-label":"view point details",onClick:()=>{a(I.original.id)},children:"view details"})}],tableData:f}},[n,a,l,t,i]),m=ue({columns:c,data:d,state:{sorting:r},getCoreRowModel:me(),onSortingChange:o,getSortedRowModel:Dn()});return s("table",{css:He,children:[e("thead",{children:m.getHeaderGroups().map(f=>e("tr",{children:f.headers.map(g=>s("th",{children:[g.isPlaceholder?null:s("div",{className:g.column.getCanSort()?"cursor-pointer":"",onClick:g.column.getToggleSortingHandler(),children:[B(g.column.columnDef.header,g.getContext()),g.column.getIsSorted()?e(P,{className:"sort-icon",svg:g.column.getIsSorted()==="asc"?e(E.ArrowDownFilled,{}):e(E.ArrowUpFilled,{})}):null]}),e("div",{onMouseDown:g.getResizeHandler(),onTouchStart:g.getResizeHandler(),className:`resizer ${g.column.getIsResizing()?"isResizing":""}`,style:{transform:g.column.getIsResizing()?`translateX(${m.getState().columnSizingInfo.deltaOffset}px)`:""}})]},g.id))},f.id))}),e("tbody",{children:m.getRowModel().rows.map(f=>e("tr",{children:f.getVisibleCells().map(g=>e("td",{style:{width:g.column.getSize()},children:B(g.column.columnDef.cell,g.getContext())},g.id))},f.id))})]})}function Fo({id:n,primaryInferencesName:a,referenceInferencesName:l}){const t=n.includes("PRIMARY"),i=Us();return s(h,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Zr,{shape:Jr.circle,color:i[t?0:1]}),t?a:l]})}const Ko=C`
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  /* Give spacing for the close icon */
  & > .ac-tabs {
    padding-top: 17px;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    [role="tablist"] {
      flex: none;
    }
    .ac-tabs__pane-container {
      display: flex;
      flex-direction: column;
      flex: 1 1 auto;
      overflow: hidden;
      [role="tabpanel"] {
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        overflow: hidden;
      }
    }
  }
`;function xo({event:n,relevance:a}){return{id:n.eventMetadata.predictionId||"unknown id",text:n.documentText??"empty document",relevance:a}}function Do(){const n=Q(K=>K.selectedEventIds),a=Q(K=>K.setSelectedEventIds),l=Q(K=>K.setSelectedClusterId),t=Q(K=>K.selectionDisplay),[i,r]=Te.useState(null),{primaryEventIds:o,referenceEventIds:c,corpusEventIds:d}=u.useMemo(()=>{const K=[],D=[],R=[];return n.forEach(w=>{w.includes("PRIMARY")?K.push(w):w.includes("CORPUS")?R.push(w):D.push(w)}),{primaryEventIds:K,referenceEventIds:D,corpusEventIds:R}},[n]),m=T.useLazyLoadQuery(Wl,{primaryEventIds:[...o],referenceEventIds:[...c],corpusEventIds:[...d]}),f=u.useMemo(()=>{var w,O,Z,ne,oe,de;const K=((O=(w=m.model)==null?void 0:w.primaryInferences)==null?void 0:O.events)??[],D=((ne=(Z=m.model)==null?void 0:Z.referenceInferences)==null?void 0:ne.events)??[],R=((de=(oe=m.model)==null?void 0:oe.corpusInferences)==null?void 0:de.events)??[];return[...K,...D,...R]},[m]),g=()=>{a(new Set),l(null)},p=Q(K=>K.eventIdToDataMap),y=Q(K=>K.pointData),k=Q(K=>K.selectionSearchText),v=u.useMemo(()=>f.map(K=>{var w,O,Z,ne,oe,de,M;const D=p.get(K.id),R=[];return y!=null&&(D==null?void 0:D.retrievals)!=null&&D.retrievals.forEach(({documentId:V,relevance:_})=>{const $=y[V];$!=null&&R.push(xo({event:$,relevance:_}))}),{id:K.id,predictionId:((w=K.eventMetadata)==null?void 0:w.predictionId)??null,actualLabel:((O=K.eventMetadata)==null?void 0:O.actualLabel)??null,actualScore:((Z=K.eventMetadata)==null?void 0:Z.actualScore)??null,predictionLabel:((ne=K.eventMetadata)==null?void 0:ne.predictionLabel)??null,predictionScore:((oe=K.eventMetadata)==null?void 0:oe.predictionScore)??null,rawData:(D==null?void 0:D.embeddingMetadata.rawData)??null,linkToData:(D==null?void 0:D.embeddingMetadata.linkToData)??null,dimensions:K.dimensions,prompt:((de=K.promptAndResponse)==null?void 0:de.prompt)??null,response:((M=K.promptAndResponse)==null?void 0:M.response)??null,retrievedDocuments:R,documentText:K.documentText??null}}),[f,p,y]),b=u.useMemo(()=>{if(k){const K=k.toLowerCase();return v.filter(D=>{var R,w,O,Z;return D.id.includes(K)||((R=D.documentText)==null?void 0:R.toLowerCase().includes(K))||((w=D.predictionId)==null?void 0:w.includes(K))||((O=D.prompt)==null?void 0:O.toLowerCase().includes(K))||((Z=D.response)==null?void 0:Z.toLowerCase().includes(K))})}return v},[v,k]),S=u.useMemo(()=>{if(k){const K=k.toLowerCase();return f.filter(D=>{var R,w,O,Z,ne,oe,de;return D.id.includes(K)||((R=D.documentText)==null?void 0:R.toLowerCase().includes(K))||((O=(w=D.eventMetadata)==null?void 0:w.predictionId)==null?void 0:O.includes(K))||((ne=(Z=D.promptAndResponse)==null?void 0:Z.prompt)==null?void 0:ne.toLowerCase().includes(K))||((de=(oe=D.promptAndResponse)==null?void 0:oe.response)==null?void 0:de.toLowerCase().includes(K))})}return f},[f,k]),L=u.useMemo(()=>i?v.find(D=>D.id===i)??null:null,[v,i]),I=f.length,A=S.length;return s("section",{css:Ko,children:[s("div",{role:"toolbar",css:C`
          position: absolute;
          top: var(--px-spacing-med);
          right: var(--px-spacing-lg);
          display: flex;
          flex-direction: row-reverse;
          gap: var(--px-spacing-med);
        `,children:[e(N,{variant:"default",size:"compact",icon:e(P,{svg:e(Ps,{})}),"aria-label":"Clear selection",onClick:g}),e(bo,{})]}),e(ke,{children:s(q,{name:"Selection",children:[e(To,{numSelectedEvents:I,numMatchingEvents:A,searchText:k}),t===kl.list?e("div",{css:C`
                flex: 1 1 auto;
                overflow-y: auto;
              `,children:e(Co,{data:b,onPointSelected:r})}):e(vo,{events:S,onItemSelected:r})]})}),e(U,{type:"slideOver",isDismissable:!0,onDismiss:()=>r(null),children:L&&e(j,{title:"Embedding Details",size:"L",children:e(co,{event:L})})})]})}function To({numSelectedEvents:n,numMatchingEvents:a,searchText:l}){const t=Q(m=>m.selectionDisplay),i=Q(m=>m.setSelectionDisplay),r=Q(m=>m.selectionGridSize),o=Q(m=>m.setSelectionGridSize),c=Q(m=>m.setSelectionSearchText),d=u.useMemo(()=>l?`${a}/${n} match "${l}"`:`${n} selected`,[n,a,l]);return e(Aa,{extra:s("div",{css:C`
            display: flex;
            flex-direction: row;
            gap: var(--px-spacing-med);
          `,children:[e(Ms,{placeholder:"Search by text or ID",onChange:m=>{c(m)}}),t===kl.gallery&&e(Xr,{size:r,onChange:o}),e(Yr,{mode:t,onChange:m=>{i(m)}})]}),children:e(F,{children:d})})}const Xl=jl;function Km(){const{referenceInferences:n,corpusInferences:a}=Le(),{timeRange:l}=Ve(),t=u.useMemo(()=>{let i={};return a!=null?i=as():n!=null?i=ls():i=ts(),i={...i,umapParameters:{...window.Config.UMAP}},i},[a,n]);return e(bl,{initialTimestamp:l.end,children:e(is,{...t,children:e(Io,{})})})}function Io(){const n=Ws(),{primaryInferences:a,referenceInferences:l}=Le(),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,m]=u.useState(!0),[f,g,p]=T.useQueryLoader(Xl),{selectedTimestamp:y}=ia(),k=u.useMemo(()=>y??new Date(a.endTime),[y,a.endTime]),v=u.useMemo(()=>({start:sl(k,2).toISOString(),end:k.toISOString()}),[k]),b=T.useLazyLoadQuery(Ol,{});return u.useEffect(()=>{o(),c(!0);const S=r();return g({id:n,timeRange:v,...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,g,p,t,i,r,v]),s("main",{css:C`
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        overflow: hidden;
      `,children:[e(Mo,{}),s(Aa,{extra:s(h,{direction:"row",justifyContent:"center",alignItems:"center",gap:"size-100",children:[e(ca,{onChange:S=>{m(S)},defaultSelected:!0,labelPlacement:"start",children:"Show Timeseries"}),e(Zs,{})]}),children:[e(ml,{}),l?e(gl,{inferencesRole:"reference",timeRange:{start:new Date(l.startTime),end:new Date(l.endTime)}}):null,e(no,{model:b.model})]}),s(sn,{direction:"vertical",children:[d?s(H,{children:[e(ce,{defaultSize:20,collapsible:!0,order:1,children:e(u.Suspense,{fallback:e(se,{}),children:e(ro,{embeddingDimensionId:n})})}),e(on,{css:_n})]}):null,e(ce,{order:2,children:e("div",{css:C`
              width: 100%;
              height: 100%;
              position: relative;
            `,children:e(u.Suspense,{fallback:e(rs,{}),children:f?e(_o,{queryReference:f}):null})})})]})]})}function Lo(n){if(n.__typename!=="Point3D")throw new Error(`Expected Point3D but got ${n.__typename} for coordinates`);return[n.x,n.y,n.z]}function _o({queryReference:n}){const a=T.usePreloadedQuery(Xl,n),l=u.useMemo(()=>{var m,f;return((f=(m=a.embedding)==null?void 0:m.UMAPPoints)==null?void 0:f.data)??[]},[a]),t=u.useMemo(()=>{var m,f;return((f=(m=a.embedding)==null?void 0:m.UMAPPoints)==null?void 0:f.referenceData)??[]},[a]),i=u.useMemo(()=>{var m,f;return((f=(m=a.embedding)==null?void 0:m.UMAPPoints)==null?void 0:f.corpusData)??[]},[a]),r=u.useMemo(()=>{var m,f;return((f=(m=a.embedding)==null?void 0:m.UMAPPoints)==null?void 0:f.contextRetrievals)??[]},[a]),o=u.useMemo(()=>[...l,...t,...i].map(f=>({...f,position:Lo(f.coordinates),metaData:{id:f.eventId}})),[t,l,i]),c=Q(m=>m.setInitialData),d=Q(m=>m.setClusters);return _r(()=>{var f,g;const m=((g=(f=a.embedding)==null?void 0:f.UMAPPoints)==null?void 0:g.clusters)||[];c({points:o,clusters:m,retrievals:r})},[o,n,r,c,d]),e("div",{css:C`
        flex: 1 1 auto;
        display: flex;
        flex-direction: row;
        align-items: stretch;
        width: 100%;
        height: 100%;
      `,"data-testid":"point-cloud-display",children:s(sn,{direction:"horizontal",children:[e(ce,{id:"embedding-left",defaultSize:15,maxSize:30,minSize:10,collapsible:!0,children:s(sn,{autoSaveId:"embedding-controls-vertical",direction:"vertical",children:[e(ce,{css:C`
                display: flex;
                flex-direction: column;
                .ac-tabs {
                  height: 100%;
                  overflow: hidden;
                  display: flex;
                  flex-direction: column;
                  [role="tablist"] {
                    flex: none;
                  }
                  .ac-tabs__pane-container {
                    flex: 1 1 auto;
                    overflow: hidden;
                    display: flex;
                    flex-direction: column;
                    & > div {
                      height: 100%;
                    }
                  }
                }
              `,children:e(Ro,{})}),e(on,{css:_n}),e(ce,{css:C`
                .ac-tabs {
                  height: 100%;
                  overflow: hidden;
                  .ac-tabs__pane-container {
                    height: 100%;
                    overflow-y: auto;
                  }
                }
              `,children:s(ke,{children:[e(q,{name:"Display",children:e(ss,{})}),e(q,{name:"Hyperparameters",children:e(os,{})})]})})]})}),e(on,{css:ds}),e(ce,{children:s("div",{css:C`
              position: relative;
              width: 100%;
              height: 100%;
            `,children:[e(Ao,{}),e(cs,{})]})})]})})}function Ao(){return Q(a=>a.selectedEventIds).size===0?null:e("div",{css:C`
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        right: 0;
      `,"data-testid":"selection-panel",children:s(sn,{direction:"vertical",children:[e(ce,{}),e(on,{css:_n,style:{zIndex:1}}),e(ce,{id:"embedding-point-selection",defaultSize:40,minSize:20,order:2,style:{zIndex:1},children:e(Eo,{children:e(u.Suspense,{fallback:e(se,{}),children:e(Do,{})})})})]})})}function Eo(n){return e("div",{css:C`
        background-color: var(--ac-global-color-grey-75);
        width: 100%;
        height: 100%;
      `,children:n.children})}const wo=1,Ro=Te.memo(function(){const{referenceInferences:a}=Le(),l=Q(g=>g.clusters),t=Q(g=>g.selectedClusterId),i=Q(g=>g.metric),r=Q(g=>g.setSelectedClusterId),o=Q(g=>g.setSelectedEventIds),c=Q(g=>g.setHighlightedClusterId),d=Q(g=>g.setClusterColorMode),m=a==null||i.type==="drift",f=u.useCallback(g=>{d(g===wo?Ha.highlight:Ha.default)},[d]);return s(ke,{onChange:f,children:[e(q,{name:"Clusters",extra:e(Me,{children:l.length}),children:s(h,{direction:"column",height:"100%",children:[e(x,{borderBottomColor:"dark",borderBottomWidth:"thin",backgroundColor:"dark",flex:"none",padding:"size-50",children:e(h,{direction:"row",justifyContent:"end",children:e(Js,{})})}),e(x,{flex:"1 1 auto",overflow:"auto",children:e("ul",{css:g=>C`
                flex: 1 1 auto;
                display: flex;
                flex-direction: column;
                gap: ${g.spacing.margin8}px;
                margin: ${g.spacing.margin8}px;
              `,children:l.map(g=>e("li",{children:e(es,{clusterId:g.id,numPoints:g.eventIds.length,isSelected:t===g.id,driftRatio:g.driftRatio,primaryToCorpusRatio:g.primaryToCorpusRatio,primaryMetricValue:g.primaryMetricValue,referenceMetricValue:g.referenceMetricValue,metricName:Po(i),hideReference:m,onClick:()=>{t!==g.id?(r(g.id),o(new Set(g.eventIds))):(r(null),o(new Set))},onMouseEnter:()=>{c(g.id)},onMouseLeave:()=>{c(null)}})},g.id))})})]})}),e(q,{name:"Configuration",children:e(x,{overflow:"auto",height:"100%",children:e(ns,{})})})]})});function Po(n){const{type:a,metric:l}=n;switch(a){case"dataQuality":return`${n.dimension.name} avg`;case"drift":{switch(l){case"euclideanDistance":return"Cluster Drift";default:be()}break}case"performance":return rn(l);case"retrieval":{switch(l){case"queryDistance":return"% Query";default:be()}break}default:be()}}function Mo(){const{notifyError:n}=pl(),a=Q(t=>t.errorMessage),l=Q(t=>t.setErrorMessage);return u.useEffect(()=>{a!==null&&n({title:"An error occurred",message:a,action:{text:"Dismiss",onClick:()=>{l(null)}}})},[a,n,l]),null}const Yl=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:"name",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"embeddingLoaderQuery",selections:[{alias:"embedding",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{kind:"InlineFragment",selections:[l,t],type:"EmbeddingDimension",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"embeddingLoaderQuery",selections:[{alias:"embedding",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:[t],type:"EmbeddingDimension",abstractKey:null}],storageKey:null}]},params:{cacheID:"cff0ac130f1ef79784f7bef4161ac60d",id:null,metadata:{},name:"embeddingLoaderQuery",operationKind:"query",text:`query embeddingLoaderQuery(
  $id: GlobalID!
) {
  embedding: node(id: $id) {
    __typename
    ... on EmbeddingDimension {
      id
      name
    }
    __isNode: __typename
    id
  }
}
`}}}();Yl.hash="c049e57d92943f64b5e751e0daa89dc8";async function xm(n){const{embeddingDimensionId:a}=n.params;return T.fetchQuery(Ie,Yl,{id:a}).toPromise()}const et=function(){var n={defaultValue:null,kind:"LocalArgument",name:"dimensionId"},a={defaultValue:null,kind:"LocalArgument",name:"hasReference"},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:"Variable",name:"timeRange",variableName:"timeRange"},o=[r],c=[{kind:"Variable",name:"hasReference",variableName:"hasReference"},r],d={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},m=[{alias:null,args:null,kind:"ScalarField",name:"primaryValue",storageKey:null}],f={kind:"Literal",name:"metric",value:"cardinality"},g={kind:"Literal",name:"metric",value:"percentEmpty"},p={kind:"Literal",name:"inferencesRole",value:"reference"};return{fragment:{argumentDefinitions:[n,a,l],kind:"Fragment",metadata:null,name:"DimensionPageQuery",selections:[{alias:"dimension",args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{kind:"InlineFragment",selections:[i,{args:o,kind:"FragmentSpread",name:"DimensionSegmentsBarChart_dimension"},{args:o,kind:"FragmentSpread",name:"DimensionCountStats_dimension"},{args:o,kind:"FragmentSpread",name:"DimensionDriftStats_dimension"},{args:c,kind:"FragmentSpread",name:"DimensionCardinalityStats_dimension"},{args:c,kind:"FragmentSpread",name:"DimensionPercentEmptyStats_dimension"},{args:o,kind:"FragmentSpread",name:"DimensionQuantilesStats_dimension"}],type:"Dimension",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,l,a],kind:"Operation",name:"DimensionPageQuery",selections:[{alias:"dimension",args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[d,{kind:"TypeDiscriminator",abstractKey:"__isNode"},i,{kind:"InlineFragment",selections:[{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:[d,{kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],type:"NominalBin",abstractKey:null},{kind:"InlineFragment",selections:[{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}],storageKey:null},{alias:null,args:null,concreteType:"DatasetValues",kind:"LinkedField",name:"counts",plural:!1,selections:m,storageKey:null}],storageKey:null},{alias:null,args:null,concreteType:"DatasetValues",kind:"LinkedField",name:"totalCounts",plural:!1,selections:m,storageKey:null}],storageKey:null},{alias:"count",args:[{kind:"Literal",name:"metric",value:"count"},r],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"psi",args:[{kind:"Literal",name:"metric",value:"psi"},r],kind:"ScalarField",name:"driftMetric",storageKey:null},{alias:"cardinality",args:[f,r],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"percentEmpty",args:[g,r],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p99",args:[{kind:"Literal",name:"metric",value:"p99"},r],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p75",args:[{kind:"Literal",name:"metric",value:"p75"},r],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p50",args:[{kind:"Literal",name:"metric",value:"p50"},r],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p25",args:[{kind:"Literal",name:"metric",value:"p25"},r],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{alias:"p1",args:[{kind:"Literal",name:"metric",value:"p01"},r],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{condition:"hasReference",kind:"Condition",passingValue:!0,selections:[{alias:"referenceCardinality",args:[p,f],kind:"ScalarField",name:"dataQualityMetric",storageKey:'dataQualityMetric(inferencesRole:"reference",metric:"cardinality")'},{alias:"referencePercentEmpty",args:[p,g],kind:"ScalarField",name:"dataQualityMetric",storageKey:'dataQualityMetric(inferencesRole:"reference",metric:"percentEmpty")'}]}],type:"Dimension",abstractKey:null}],storageKey:null}]},params:{cacheID:"2ad937e56d4647309b9d78ac11f57265",id:null,metadata:{},name:"DimensionPageQuery",operationKind:"query",text:`query DimensionPageQuery(
  $dimensionId: GlobalID!
  $timeRange: TimeRange!
  $hasReference: Boolean!
) {
  dimension: node(id: $dimensionId) {
    __typename
    ... on Dimension {
      id
      ...DimensionSegmentsBarChart_dimension_3E0ZE6
      ...DimensionCountStats_dimension_3E0ZE6
      ...DimensionDriftStats_dimension_3E0ZE6
      ...DimensionCardinalityStats_dimension_1JBzL3
      ...DimensionPercentEmptyStats_dimension_1JBzL3
      ...DimensionQuantilesStats_dimension_3E0ZE6
    }
    __isNode: __typename
    id
  }
}

fragment DimensionCardinalityStats_dimension_1JBzL3 on Dimension {
  id
  cardinality: dataQualityMetric(metric: cardinality, timeRange: $timeRange)
  referenceCardinality: dataQualityMetric(metric: cardinality, inferencesRole: reference) @include(if: $hasReference)
}

fragment DimensionCountStats_dimension_3E0ZE6 on Dimension {
  id
  count: dataQualityMetric(metric: count, timeRange: $timeRange)
}

fragment DimensionDriftStats_dimension_3E0ZE6 on Dimension {
  id
  psi: driftMetric(metric: psi, timeRange: $timeRange)
}

fragment DimensionPercentEmptyStats_dimension_1JBzL3 on Dimension {
  id
  percentEmpty: dataQualityMetric(metric: percentEmpty, timeRange: $timeRange)
  referencePercentEmpty: dataQualityMetric(metric: percentEmpty, inferencesRole: reference) @include(if: $hasReference)
}

fragment DimensionQuantilesStats_dimension_3E0ZE6 on Dimension {
  p99: dataQualityMetric(metric: p99, timeRange: $timeRange)
  p75: dataQualityMetric(metric: p75, timeRange: $timeRange)
  p50: dataQualityMetric(metric: p50, timeRange: $timeRange)
  p25: dataQualityMetric(metric: p25, timeRange: $timeRange)
  p1: dataQualityMetric(metric: p01, timeRange: $timeRange)
}

fragment DimensionSegmentsBarChart_dimension_3E0ZE6 on Dimension {
  id
  segmentsComparison(primaryTimeRange: $timeRange) {
    segments {
      bin {
        __typename
        ... on NominalBin {
          __typename
          name
        }
        ... on IntervalBin {
          __typename
          range {
            start
            end
          }
        }
        ... on MissingValueBin {
          __typename
        }
      }
      counts {
        primaryValue
      }
    }
    totalCounts {
      primaryValue
    }
  }
}
`}}}();et.hash="d194bfd656408e8ba7cb427ddc80fc85";const nt=function(){var n={kind:"Literal",name:"metric",value:"cardinality"};return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"hasReference"},{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],kind:"Fragment",metadata:null,name:"DimensionCardinalityStats_dimension",selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:"cardinality",args:[n,{kind:"Variable",name:"timeRange",variableName:"timeRange"}],kind:"ScalarField",name:"dataQualityMetric",storageKey:null},{condition:"hasReference",kind:"Condition",passingValue:!0,selections:[{alias:"referenceCardinality",args:[{kind:"Literal",name:"inferencesRole",value:"reference"},n],kind:"ScalarField",name:"dataQualityMetric",storageKey:'dataQualityMetric(inferencesRole:"reference",metric:"cardinality")'}]}],type:"Dimension",abstractKey:null}}();nt.hash="8b4edef350e4df49e799afa70ca34918";function No(n){const a=T.useFragment(nt,n.dimension);return s(H,{children:[e(F,{elementType:"h3",textSize:"small",color:"text-700",children:"Cardinality"}),e(F,{textSize:"xlarge",children:cn(a.cardinality)}),a.referenceCardinality!=null&&e(F,{textSize:"medium",color:"designationPurple",children:cn(a.referenceCardinality)})]})}const at=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:"cardinalityTimeSeries",args:[{kind:"Variable",name:"granularity",variableName:"granularity"},{kind:"Literal",name:"metric",value:"cardinality"},{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:"DimensionCardinalityTimeSeriesQuery",selections:[{alias:"dimension",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:"DimensionCardinalityTimeSeriesQuery",selections:[{alias:"dimension",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:"f53e5ac5e0bfd6a0a6c50b761223a617",id:null,metadata:{},name:"DimensionCardinalityTimeSeriesQuery",operationKind:"query",text:`query DimensionCardinalityTimeSeriesQuery(
  $dimensionId: GlobalID!
  $timeRange: TimeRange!
  $granularity: Granularity!
) {
  dimension: node(id: $dimensionId) {
    __typename
    id
    ... on Dimension {
      cardinalityTimeSeries: dataQualityTimeSeries(metric: cardinality, timeRange: $timeRange, granularity: $granularity) {
        data {
          timestamp
          value
        }
      }
    }
  }
}
`}}}();at.hash="88ce04bb2022d5e2bc75c663abd7e5de";const Yn={top:25,right:18,left:18,bottom:5},Vo=new Intl.NumberFormat([],{maximumFractionDigits:2}),lt=()=>{const{gray300:n}=$e();return{color:n}};function $o({active:n,payload:a,label:l}){var i;const{color:t}=lt();if(n&&a&&a.length){const r=((i=a[0])==null?void 0:i.value)??null,o=typeof r=="number"?Vo.format(r):"--";return s(Be,{children:[e(F,{weight:"heavy",textSize:"medium",children:`${Re(new Date(l))}`}),e(re,{color:t,name:"Cardinality",value:o}),e(ra,{})]})}return null}function zo({dimensionId:n}){var c;const{timeRange:a}=Ve(),l=Tn(a),t=T.useLazyLoadQuery(at,{dimensionId:n,timeRange:{start:a.start.toISOString(),end:a.end.toISOString()},granularity:l}),{color:i}=lt(),r=((c=t.dimension.cardinalityTimeSeries)==null?void 0:c.data.map(d=>({timestamp:new Date(d.timestamp).valueOf(),value:d.value})))||[],o=In({samplingIntervalMinutes:l.samplingIntervalMinutes});return e(We,{width:"100%",height:"100%",children:s(Xn,{data:r,margin:Yn,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(Je,{...Ln,tickFormatter:d=>o(new Date(d))}),e(De,{stroke:ie.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(Ze,{strokeDasharray:"4 4",stroke:ie.colors.gray200,strokeOpacity:.5}),e(Xe,{content:e($o,{})}),e(jn,{type:"monotone",dataKey:"value",stroke:i,fillOpacity:1,fill:"url(#cardinalityColorUv)"})]})})}const tt={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};tt.hash="6dccac51f3fb0853276677c692af5a43";function Qo(n){const l=T.useFragment(tt,n.dimension).count??0;return s(H,{children:[e(F,{elementType:"h3",textSize:"small",color:"text-700",children:"Total Count"}),e(F,{textSize:"xlarge",children:cn(l)})]})}const it=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(
  $dimensionId: GlobalID!
  $timeRange: TimeRange!
  $countGranularity: Granularity!
) {
  embedding: node(id: $dimensionId) {
    __typename
    id
    ... on Dimension {
      trafficTimeSeries: dataQualityTimeSeries(metric: count, timeRange: $timeRange, granularity: $countGranularity) {
        data {
          timestamp
          value
        }
      }
    }
  }
}
`}}}();it.hash="9677ef7c6b298554824fe3fd3904c7aa";const Oo=new Intl.NumberFormat([],{maximumFractionDigits:2}),rt=()=>{const{gray300:n}=$e();return{barColor:n}};function jo({active:n,payload:a,label:l}){var i;const{barColor:t}=rt();if(n&&a&&a.length){const r=((i=a[0])==null?void 0:i.value)??null,o=typeof r=="number"?Oo.format(r):"--";return s(Be,{children:[e(F,{weight:"heavy",textSize:"medium",children:`${Re(new Date(l))}`}),e(re,{color:t,shape:"square",name:"Count",value:o})]})}return null}function qo({dimensionId:n}){var d;const{timeRange:a}=Ve(),l=Tn(a),r=(((d=T.useLazyLoadQuery(it,{dimensionId:n,timeRange:{start:a.start.toISOString(),end:a.end.toISOString()},countGranularity:l}).embedding.trafficTimeSeries)==null?void 0:d.data)||[]).map(m=>({...m,timestamp:new Date(m.timestamp).valueOf()})),o=In({samplingIntervalMinutes:l.samplingIntervalMinutes}),{barColor:c}=rt();return e(We,{width:"100%",height:"100%",children:s(Qa,{data:r,margin:Yn,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(Je,{...Ln,tickFormatter:m=>o(new Date(m))}),e(De,{stroke:ie.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(Ze,{strokeDasharray:"4 4",stroke:ie.colors.gray200,strokeOpacity:.5}),e(Xe,{...wa,content:e(jo,{})}),e(xn,{dataKey:"value",fill:"url(#countBarColor)",spacing:5})]})})}const st=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},m={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},m],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},m],storageKey:null}],type:"Dimension",abstractKey:null}],storageKey:null}]},params:{cacheID:"7d11d88f419003f5ee8cd9d11312e427",id:null,metadata:{},name:"DimensionDriftBreakdownSegmentBarChartQuery",operationKind:"query",text:`query DimensionDriftBreakdownSegmentBarChartQuery(
  $dimensionId: GlobalID!
  $timeRange: TimeRange!
) {
  dimension: node(id: $dimensionId) {
    __typename
    id
    ... on Dimension {
      segmentsComparison(primaryTimeRange: $timeRange) {
        segments {
          bin {
            __typename
            ... on NominalBin {
              __typename
              name
            }
            ... on IntervalBin {
              __typename
              range {
                start
                end
              }
            }
            ... on MissingValueBin {
              __typename
            }
          }
          counts {
            primaryValue
            referenceValue
          }
        }
        totalCounts {
          primaryValue
          referenceValue
        }
      }
    }
  }
}
`}}}();st.hash="6bb76e3cce4ee28c333e485b3aa2dffd";const Ja=_a(".2f"),ot=()=>{const{primary:n,reference:a}=$e();return{primaryBarColor:n,referenceBarColor:a}};function Bo({active:n,payload:a,label:l}){var r,o,c,d,m,f;const{primaryBarColor:t,referenceBarColor:i}=ot();if(n&&a&&a.length){const g=(o=(r=a[0])==null?void 0:r.payload)==null?void 0:o.primaryName,p=(c=a[0])==null?void 0:c.value,y=(m=(d=a[0])==null?void 0:d.payload)==null?void 0:m.referenceName,k=(f=a[1])==null?void 0:f.value;return s(Be,{children:[e(F,{elementType:"h3",textSize:"medium",weight:"heavy",children:l}),e(re,{color:t,shape:"square",name:g,value:p!=null?`${Ja(p)}%`:"--"}),e(re,{color:i,shape:"square",name:y,value:k!=null?`${Ja(k)}%`:"--"})]})}return null}function Ho(n){var p,y,k,v,b;const{primaryInferences:a,referenceInferences:l}=Le(),t=a.name,i=(l==null?void 0:l.name)||"reference",{selectedTimestamp:r}=ia(),o=u.useMemo(()=>r??new Date(a.endTime),[r,a.endTime]),c=u.useMemo(()=>({start:sl(o,2).toISOString(),end:o.toISOString()}),[o]),d=T.useLazyLoadQuery(st,{dimensionId:n.dimensionId,timeRange:c}),m=u.useMemo(()=>{var A,K,D,R,w;const S=((A=d.dimension.segmentsComparison)==null?void 0:A.segments)??[],L=((D=(K=d.dimension.segmentsComparison)==null?void 0:K.totalCounts)==null?void 0:D.primaryValue)??0,I=((w=(R=d.dimension.segmentsComparison)==null?void 0:R.totalCounts)==null?void 0:w.referenceValue)??0;return S.map(O=>{var V,_;const Z=((V=O.counts)==null?void 0:V.primaryValue)??0,ne=((_=O.counts)==null?void 0:_.referenceValue)??0,oe=Sl(O.bin),de=Z/L*100,M=ne/I*100;return{name:oe,primaryName:t,referenceName:i,primaryPercent:de,referencePercent:M}})},[(p=d.dimension.segmentsComparison)==null?void 0:p.segments,(k=(y=d.dimension.segmentsComparison)==null?void 0:y.totalCounts)==null?void 0:k.primaryValue,(b=(v=d.dimension.segmentsComparison)==null?void 0:v.totalCounts)==null?void 0:b.referenceValue,t,i]),{primaryBarColor:f,referenceBarColor:g}=ot();return s(h,{direction:"column",height:"100%",children:[e(x,{flex:"none",paddingTop:"size-100",paddingStart:"size-200",children:e(F,{elementType:"h3",textSize:"medium",color:"text-700",children:`Distribution comparison at ${Re(new Date(c.end))}`})}),e(x,{flex:!0,children:e(We,{children:s(Qa,{data:m,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:g,stopOpacity:1}),e("stop",{offset:"95%",stopColor:g,stopOpacity:.5})]})]}),e(Je,{dataKey:"name",style:{fill:"var(--ac-global-text-color-700)"}}),e(De,{stroke:ie.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(Ze,{strokeDasharray:"4 4",stroke:ie.colors.gray200,strokeOpacity:.5}),e(Xe,{...wa,content:e(Bo,{})}),e(xn,{dataKey:"primaryPercent",fill:"url(#dimensionPrimarySegmentsBarColor)"}),e(xn,{dataKey:"referencePercent",fill:"url(#dimensionReferenceSegmentsBarColor)"})]})})})]})}const dt={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};dt.hash="f8a9fb08a14f63906e38bc247d50b189";const Go=s(Pn,{variant:"info",placement:"top end",children:[e(te,{weight:"heavy",level:4,children:"Population Stability Index"}),e(Rn,{children:e(F,{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(dn,{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 Uo(n){const a=T.useFragment(dt,n.dimension);return s(H,{children:[s(h,{direction:"row",alignItems:"center",gap:"size-25",children:[e(F,{elementType:"h3",textSize:"small",color:"text-700",children:"PSI"}),Go]}),e(F,{textSize:"xlarge",children:Cn(a.psi)})]})}const ct=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(
  $dimensionId: GlobalID!
  $timeRange: TimeRange!
  $driftGranularity: Granularity!
  $countGranularity: Granularity!
) {
  embedding: node(id: $dimensionId) {
    __typename
    id
    ... on Dimension {
      driftTimeSeries(metric: psi, timeRange: $timeRange, granularity: $driftGranularity) {
        data {
          timestamp
          value
        }
      }
      trafficTimeSeries: dataQualityTimeSeries(metric: count, timeRange: $timeRange, granularity: $countGranularity) {
        data {
          timestamp
          value
        }
      }
    }
  }
}
`}}}();ct.hash="6312b58dbb252b17efdf08d44dd58630";const ut=()=>{const{orange300:n,gray300:a}=$e();return{color:n,barColor:a}};function Wo({active:n,payload:a,label:l}){var i;const{color:t}=ut();if(n&&a&&a.length){const r=((i=a[1])==null?void 0:i.value)??null;return s(Be,{children:[e(F,{weight:"heavy",textSize:"medium",children:`${Re(new Date(l))}`}),e(re,{color:t,name:"PSI",value:Cn(r)}),e(ra,{}),s("div",{css:C`
            display: flex;
            flex-direction: row;
            align-items: center;
            color: var(--ac-global-color-primary);
            gap: var(--px-spacing-sm);

            margin-top: var(--px-spacing-sm);
          `,children:[e(P,{svg:e(Al,{})}),e("span",{children:"Click to view details"})]})]})}return null}function Jo({dimensionId:n}){var y,k;const{timeRange:a}=Ve(),{selectedTimestamp:l,setSelectedTimestamp:t}=ia(),i=Tn(a),r=T.useLazyLoadQuery(ct,{dimensionId:n,timeRange:{start:a.start.toISOString(),end:a.end.toISOString()},driftGranularity:yl(a),countGranularity:i}),o=((y=r.embedding.driftTimeSeries)==null?void 0:y.data)||[],c=((k=r.embedding.trafficTimeSeries)==null?void 0:k.data.reduce((v,b)=>(v[b.timestamp]=b.value,v),{}))??{},d=o.map(v=>{const b=c[v.timestamp];return{...v,traffic:b,timestamp:new Date(v.timestamp).valueOf()}}),m=In({samplingIntervalMinutes:i.samplingIntervalMinutes}),f=u.useCallback(v=>{const{activePayload:b}=v;if(b!=null&&b.length>0){const S=b[0].payload;t(new Date(S.timestamp))}},[t]),{color:g,barColor:p}=ut();return e(We,{width:"100%",height:"100%",children:s(Xn,{data:d,margin:Yn,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:g,stopOpacity:.8}),e("stop",{offset:"95%",stopColor:g,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(Je,{...Ln,tickFormatter:v=>m(new Date(v))}),e(De,{stroke:ie.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(De,{yAxisId:"right",orientation:"right",tick:!1,tickLine:!1,width:0}),e(Ze,{strokeDasharray:"4 4",stroke:ie.colors.gray200,strokeOpacity:.5}),e(Xe,{content:e(Wo,{})}),e(xn,{yAxisId:"right",dataKey:"traffic",fill:"url(#barColor)",spacing:5}),e(jn,{type:"monotone",dataKey:"value",stroke:g,fillOpacity:1,fill:"url(#dimensionDriftColorUv)"}),l!=null?e(Ml,{...fl,x:l.getTime()}):null]})})}const mt=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}}();mt.hash="1e10d0449d6607d9292f355548c41c78";function Zo(n){const a=T.useFragment(mt,n.dimension);return s(H,{children:[e(F,{elementType:"h3",textSize:"small",color:"text-700",children:"% Empty"}),e(F,{textSize:"xlarge",children:Ta(a.percentEmpty)}),a.referencePercentEmpty!=null&&e(F,{textSize:"medium",color:"designationPurple",children:Ta(a.referencePercentEmpty)})]})}const gt=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(
  $dimensionId: GlobalID!
  $timeRange: TimeRange!
  $granularity: Granularity!
) {
  embedding: node(id: $dimensionId) {
    __typename
    id
    ... on Dimension {
      percentEmptyTimeSeries: dataQualityTimeSeries(metric: percentEmpty, timeRange: $timeRange, granularity: $granularity) {
        data {
          timestamp
          value
        }
      }
    }
  }
}
`}}}();gt.hash="1e843d6c8dbe05b389b24188c6bdb394";const Xo=new Intl.NumberFormat([],{maximumFractionDigits:2}),pt=()=>{const{gray100:n}=$e();return{color:n}};function Yo({active:n,payload:a,label:l}){var i;const{color:t}=pt();if(n&&a&&a.length){const r=((i=a[0])==null?void 0:i.value)??null,o=typeof r=="number"?Xo.format(r):"--";return s(Be,{children:[e(F,{weight:"heavy",textSize:"medium",children:`${Re(new Date(l))}`}),e(re,{color:t,name:"% Empty",value:o})]})}return null}function ed({dimensionId:n}){var c;const{timeRange:a}=Ve(),l=Tn(a),i=((c=T.useLazyLoadQuery(gt,{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=In({samplingIntervalMinutes:l.samplingIntervalMinutes}),{color:o}=pt();return e(We,{width:"100%",height:"100%",children:s(Xn,{data:i,margin:Yn,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(Je,{...Ln,tickFormatter:d=>r(new Date(d))}),e(De,{stroke:ie.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(Ze,{strokeDasharray:"4 4",stroke:ie.colors.gray200,strokeOpacity:.5}),e(Xe,{content:e(Yo,{})}),e(Nl,{type:"monotone",dataKey:"value",stroke:o,fillOpacity:1,fill:"url(#percentEmptyColorUv)"})]})})}const yt=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}}();yt.hash="c306c8eafb1d34be464d3a658d5f94a7";function nd(n){const a=T.useFragment(yt,n.dimension);return e("ul",{css:C`
        display: flex;
        flex-direction: column;
        gap: var(--px-spacing-sm);
      `,children:Object.keys(a).map(l=>{const t=a[l];return s("li",{css:C`
              display: flex;
              flex-direction: column;
              align-items: flex-end;
            `,children:[e(F,{elementType:"h3",textSize:"xsmall",color:"text-700",children:l}),e(F,{textSize:"medium","data-raw":t,children:Ea(t)})]},l)})})}const ft=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:"Variable",name:"granularity",variableName:"granularity"},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:"p99TimeSeries",args:[r,{kind:"Literal",name:"metric",value:"p99"},o],concreteType:"DataQualityTimeSeries",kind:"LinkedField",name:"dataQualityTimeSeries",plural:!1,selections:c,storageKey:null},{alias:"p75TimeSeries",args:[r,{kind:"Literal",name:"metric",value:"p75"},o],concreteType:"DataQualityTimeSeries",kind:"LinkedField",name:"dataQualityTimeSeries",plural:!1,selections:c,storageKey:null},{alias:"p50TimeSeries",args:[r,{kind:"Literal",name:"metric",value:"p50"},o],concreteType:"DataQualityTimeSeries",kind:"LinkedField",name:"dataQualityTimeSeries",plural:!1,selections:c,storageKey:null},{alias:"p25TimeSeries",args:[r,{kind:"Literal",name:"metric",value:"p25"},o],concreteType:"DataQualityTimeSeries",kind:"LinkedField",name:"dataQualityTimeSeries",plural:!1,selections:c,storageKey:null},{alias:"p01TimeSeries",args:[r,{kind:"Literal",name:"metric",value:"p01"},o],concreteType:"DataQualityTimeSeries",kind:"LinkedField",name:"dataQualityTimeSeries",plural:!1,selections:c,storageKey:null}],type:"Dimension",abstractKey:null};return{fragment:{argumentDefinitions:[n,a,l],kind:"Fragment",metadata:null,name:"DimensionQuantilesTimeSeriesQuery",selections:[{alias:"dimension",args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[i,d],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,l,a],kind:"Operation",name:"DimensionQuantilesTimeSeriesQuery",selections:[{alias:"dimension",args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},i,d],storageKey:null}]},params:{cacheID:"0bb3d9faf9d7f0c2e27995120ae24e1c",id:null,metadata:{},name:"DimensionQuantilesTimeSeriesQuery",operationKind:"query",text:`query DimensionQuantilesTimeSeriesQuery(
  $dimensionId: GlobalID!
  $timeRange: TimeRange!
  $granularity: Granularity!
) {
  dimension: node(id: $dimensionId) {
    __typename
    id
    ... on Dimension {
      p99TimeSeries: dataQualityTimeSeries(metric: p99, timeRange: $timeRange, granularity: $granularity) {
        data {
          timestamp
          value
        }
      }
      p75TimeSeries: dataQualityTimeSeries(metric: p75, timeRange: $timeRange, granularity: $granularity) {
        data {
          timestamp
          value
        }
      }
      p50TimeSeries: dataQualityTimeSeries(metric: p50, timeRange: $timeRange, granularity: $granularity) {
        data {
          timestamp
          value
        }
      }
      p25TimeSeries: dataQualityTimeSeries(metric: p25, timeRange: $timeRange, granularity: $granularity) {
        data {
          timestamp
          value
        }
      }
      p01TimeSeries: dataQualityTimeSeries(metric: p01, timeRange: $timeRange, granularity: $granularity) {
        data {
          timestamp
          value
        }
      }
    }
  }
}
`}}}();ft.hash="134f0dad0e0ecc7863dfbb0f437d829b";const ad=_a("~s");var ht=(n=>(n.p99_p01="p99_p01",n.p75_p25="p75_p25",n.p50="p50",n))(ht||{});const ld=new Intl.NumberFormat([],{maximumFractionDigits:2});function zn(n){return typeof n=="number"?ld.format(n):"--"}const kt=()=>{const n=$e();return{outerColor:n.gray500,innerColor:n.gray300,lineColor:n.default}};function td({active:n,payload:a,label:l}){const{outerColor:t,innerColor:i,lineColor:r}=kt();if(n&&a&&a.length){const o=a[0].payload;return s(Be,{children:[e(F,{weight:"heavy",textSize:"medium",children:`${Re(new Date(l))}`}),e(re,{color:t,name:"p99",value:zn(o.p99_p01[0])}),e(re,{color:i,name:"p75",value:zn(o.p75_p25[0])}),e(re,{color:r,name:"p50",value:zn(o.p50)}),e(re,{color:i,name:"p25",value:zn(o.p75_p25[1])}),e(re,{color:t,name:"p01",value:zn(o.p99_p01[1])})]})}return null}function id({dimensionId:n}){var I,A,K,D,R;const{timeRange:a}=Ve(),l=Tn(a),t=T.useLazyLoadQuery(ft,{dimensionId:n,timeRange:{start:a.start.toISOString(),end:a.end.toISOString()},granularity:l}),i=((I=t.dimension.p99TimeSeries)==null?void 0:I.data.map(w=>w))||[],r=((A=t.dimension.p01TimeSeries)==null?void 0:A.data.map(w=>w))||[],o=((K=t.dimension.p75TimeSeries)==null?void 0:K.data.map(w=>w))||[],c=((D=t.dimension.p25TimeSeries)==null?void 0:D.data.map(w=>w))||[],d=((R=t.dimension.p50TimeSeries)==null?void 0:R.data.map(w=>w))||[],m=i.map((w,O)=>({timestamp:new Date(w.timestamp).valueOf(),p99_p01:[w.value,r[O].value],p75_p25:[o[O].value,c[O].value],p50:d[O].value})),f=In({samplingIntervalMinutes:l.samplingIntervalMinutes}),[g,p]=u.useState(Object.keys(ht).reduce((w,O)=>(w[O]=!1,w),{})),y=w=>{g[w.dataKey]||p({...g})},k=()=>{p({...g})},v=w=>{p({...g,[String(w.dataKey)]:!g[w.dataKey]})},{outerColor:b,innerColor:S,lineColor:L}=kt();return e(We,{width:"100%",height:"100%",children:s(Xn,{data:m,margin:Yn,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:b,stopOpacity:.7}),e("stop",{offset:"50%",stopColor:b,stopOpacity:.3}),e("stop",{offset:"90%",stopColor:b,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(Je,{...Ln,tickFormatter:w=>f(new Date(w))}),e(De,{stroke:ie.colors.gray200,label:{value:"Value",angle:-90,position:"insideLeft",style:{textAnchor:"middle",fill:"var(--ac-global-text-color-900)"}},tickFormatter:w=>ad(w),style:{fill:"var(--ac-global-text-color-700)"}}),e(Ze,{strokeDasharray:"4 4",stroke:ie.colors.gray200,strokeOpacity:.5}),e(Xe,{content:e(td,{})}),e(zs,{onClick:v,onMouseOver:y,onMouseOut:k}),e(jn,{type:"monotone",dataKey:"p99_p01",name:"p99 - p01",fillOpacity:1,fill:"url(#p99_p01ColorUV)",stroke:b,hide:g.p99_p01===!0}),e(jn,{type:"monotone",dataKey:"p75_p25",name:"p75 - p25",fillOpacity:1,stroke:S,fill:"url(#p75_p25ColorUV)",hide:g.p75_p25===!0}),e(Nl,{type:"monotone",dataKey:"p50",stroke:L,hide:g.p50===!0})]})})}const bt=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}}();bt.hash="8cef9841e9a5bd7d0d50acb5db9028b0";const rd=_a(".2f"),St=()=>{const{primary:n}=$e();return{color:n}};function sd({active:n,payload:a,label:l}){var i;const{color:t}=St();if(n&&a&&a.length){const r=(i=a[0])==null?void 0:i.value;return e(Be,{children:e(re,{color:t,shape:"square",name:l,value:r!=null?`${rd(r)}%`:"--"})})}return null}function od(n){const a=T.useFragment(bt,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(m=>{var y;const f=((y=m.counts)==null?void 0:y.primaryValue)??0,g=Sl(m.bin),p=f/r*100;return{name:g,percent:p}})},[a]),{color:t}=St();return e(We,{children:s(Qa,{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(Je,{dataKey:"name",style:{fill:"var(--ac-global-text-color-700)"}}),e(De,{stroke:ie.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(Ze,{strokeDasharray:"4 4",stroke:ie.colors.gray200,strokeOpacity:.5}),e(Xe,{...wa,content:e(sd,{})}),e(xn,{dataKey:"percent",fill:"url(#dimensionSegmentsBarColor)",spacing:15})]})})}function Dm(){const{dimensionId:n}=je(),{timeRange:a}=Ve(),l=Bn(),{referenceInferences:t}=Le(),i=t!==null,r=i,o=l.dimension.shape!=="continuous",c=l.dimension.dataType==="numeric",d=ae(),m=T.useLazyLoadQuery(et,{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(bl,{initialTimestamp:new Date(a.end),children:e(U,{type:"slideOver",isDismissable:!0,onDismiss:()=>d(-1),children:e(j,{size:"L",title:l.dimension.name,children:e("main",{css:C`
              padding: var(--px-spacing-med);
              display: flex;
              flex-direction: column;
              min-height: 400px;
              overflow-y: auto;
              height: 100%;
            `,children:e(u.Suspense,{fallback:e(se,{}),children:s(h,{direction:"column",gap:"size-100",children:[e(x,{borderColor:"dark",borderRadius:"medium",borderWidth:"thin",height:"size-1600",children:e(od,{dimension:m.dimension})}),e(x,{borderColor:"dark",borderRadius:"medium",borderWidth:"thin",height:"size-1600","data-testid":"dimension-count-time-series-view",children:s(h,{direction:"row",alignItems:"stretch",height:"100%",children:[e(qo,{dimensionId:n}),e(Sn,{children:e(Qo,{dimension:m.dimension})})]})}),r?e(x,{borderColor:"dark",borderRadius:"medium",borderWidth:"thin",children:s(h,{direction:"column",alignItems:"stretch",children:[e(x,{width:"100%",height:"size-1600",children:s(h,{direction:"row",alignItems:"stretch",height:"100%",children:[e(x,{flex:!0,children:e(Jo,{dimensionId:n})}),e(Sn,{children:e(Uo,{dimension:m.dimension})})]})}),e(x,{height:"size-1600",width:"100%",borderTopColor:"dark",borderTopWidth:"thin",children:e(u.Suspense,{fallback:e(se,{}),children:e(Ho,{dimensionId:n})})})]})}):null,c?e(x,{borderColor:"dark",borderRadius:"medium",borderWidth:"thin",height:"size-3000",children:s(h,{direction:"row",alignItems:"stretch",height:"100%",children:[e(x,{flex:!0,children:e(id,{dimensionId:n})}),e(Sn,{children:e(nd,{dimension:m.dimension})})]})}):null,o?e(x,{borderColor:"dark",borderRadius:"medium",borderWidth:"thin",height:"size-1600",children:s(h,{direction:"row",alignItems:"stretch",height:"100%",children:[e(x,{flex:!0,children:e(zo,{dimensionId:n})}),e(Sn,{children:e(No,{dimension:m.dimension})})]})}):null,e(x,{borderColor:"dark",borderRadius:"medium",borderWidth:"thin",height:"size-1600",children:s(h,{direction:"row",alignItems:"stretch",height:"100%",children:[e(ed,{dimensionId:n}),e(Sn,{children:e(Zo,{dimension:m.dimension})})]})})]})})})})})})}const vt=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:"name",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"dataType",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"shape",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"dimensionLoaderQuery",selections:[{alias:"dimension",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{kind:"InlineFragment",selections:[l,t,i,r],type:"Dimension",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"dimensionLoaderQuery",selections:[{alias:"dimension",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:[t,i,r],type:"Dimension",abstractKey:null}],storageKey:null}]},params:{cacheID:"03a9aafe3f08a9d093b029ff4a9e3253",id:null,metadata:{},name:"dimensionLoaderQuery",operationKind:"query",text:`query dimensionLoaderQuery(
  $id: GlobalID!
) {
  dimension: node(id: $id) {
    __typename
    ... on Dimension {
      id
      name
      dataType
      shape
    }
    __isNode: __typename
    id
  }
}
`}}}();vt.hash="5a662d77e69d2e9bb4eb2af4cad6b722";async function Tm(n){const{dimensionId:a}=n.params;return T.fetchQuery(Ie,vt,{id:a}).toPromise()}const Ct=function(){var n={defaultValue:null,kind:"LocalArgument",name:"id"},a={defaultValue:null,kind:"LocalArgument",name:"traceId"},l=[{kind:"Variable",name:"id",variableName:"id"}],t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},i={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},r={kind:"InlineFragment",selections:[{alias:null,args:[{kind:"Variable",name:"traceId",variableName:"traceId"}],concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[{alias:null,args:[{kind:"Literal",name:"first",value:1e3}],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:[t,{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},i,{alias:null,args:null,kind:"ScalarField",name:"spanKind",storageKey:null},{alias:"statusCode",args:null,kind:"ScalarField",name:"propagatedStatusCode",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"parentId",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:"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}],storageKey:null}],storageKey:null}],storageKey:"spans(first:1000)"}],storageKey:null}],type:"Project",abstractKey:null};return{fragment:{argumentDefinitions:[n,a],kind:"Fragment",metadata:null,name:"TraceDetailsQuery",selections:[{alias:"project",args:l,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[r],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,n],kind:"Operation",name:"TraceDetailsQuery",selections:[{alias:"project",args:l,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},r,{kind:"TypeDiscriminator",abstractKey:"__isNode"},t],storageKey:null}]},params:{cacheID:"22103e9bb1f983529081ca93d60e76ef",id:null,metadata:{},name:"TraceDetailsQuery",operationKind:"query",text:`query TraceDetailsQuery(
  $traceId: ID!
  $id: GlobalID!
) {
  project: node(id: $id) {
    __typename
    ... on Project {
      trace(traceId: $traceId) {
        spans(first: 1000) {
          edges {
            span: node {
              id
              context {
                spanId
                traceId
              }
              name
              spanKind
              statusCode: propagatedStatusCode
              startTime
              parentId
              latencyMs
              tokenCountTotal
              tokenCountPrompt
              tokenCountCompletion
              spanAnnotations {
                name
                label
                score
                annotatorKind
              }
            }
          }
        }
      }
    }
    __isNode: __typename
    id
  }
}
`}}}();Ct.hash="8b568616f23f7d349cac5a31807463fb";const Ft=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},m={alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},f={alias:null,args:null,kind:"ScalarField",name:"parentId",storageKey:null},g={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},v=[{alias:null,args:null,kind:"ScalarField",name:"value",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"mimeType",storageKey:null}],b={alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:v,storageKey:null},S={alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:v,storageKey:null},L={alias:null,args:null,kind:"ScalarField",name:"attributes",storageKey:null},I={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},A={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},K={alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},D={alias:null,args:null,kind:"ScalarField",name:"score",storageKey:null},R={alias:null,args:null,kind:"ScalarField",name:"explanation",storageKey:null},w={alias:null,args:null,concreteType:"DocumentEvaluation",kind:"LinkedField",name:"documentEvaluations",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"documentPosition",storageKey:null},r,K,D,R],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,m,f,g,p,y,k,b,S,L,{kind:"RequiredField",field:I,action:"THROW",path:"span.events"},A,w,{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,m,f,g,p,y,k,b,S,L,I,A,w,{alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[r,K,D,R,{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(
  $spanId: GlobalID!
) {
  span: node(id: $spanId) {
    __typename
    ... on Span {
      id
      context {
        spanId
        traceId
      }
      name
      spanKind
      statusCode: propagatedStatusCode
      statusMessage
      startTime
      parentId
      latencyMs
      tokenCountTotal
      tokenCountPrompt
      tokenCountCompletion
      input {
        value
        mimeType
      }
      output {
        value
        mimeType
      }
      attributes
      events {
        name
        message
        timestamp
      }
      documentRetrievalMetrics {
        evaluationName
        ndcg
        precision
        hit
      }
      documentEvaluations {
        documentPosition
        name
        label
        score
        explanation
      }
      spanAnnotations {
        name
      }
      ...SpanFeedback_annotations
      ...SpanAside_span
    }
    __isNode: __typename
    id
  }
}

fragment SpanAside_span on Span {
  id
  code: statusCode
  startTime
  endTime
  tokenCountTotal
  tokenCountPrompt
  tokenCountCompletion
  spanAnnotations {
    id
    name
    label
    annotatorKind
    score
  }
}

fragment SpanFeedback_annotations on Span {
  spanAnnotations {
    name
    label
    score
    explanation
    annotatorKind
  }
}
`}}}();Ft.hash="eaf52d9b37b1f5a29cae360a05b7c975";const ba=C`
  display: flex;
  align-items: center;
  .ac-text {
    display: inline-block;
    max-width: 9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
`;function he(n){const{name:a,metric:l,k:t,score:i}=n,r=typeof t=="number"?`${l}@${t}`:l,o=u.useMemo(()=>l==="hit"?i?"true":"false":typeof i=="number"&&_e(i)||"--",[i,l]);return s(Fe,{delay:500,offset:3,children:[e(Kn,{children:e("div",{css:us,children:s(h,{direction:"row",gap:"size-100",alignItems:"center",children:[e(ms,{color:"var(--ac-global-color-seafoam-1000)"}),a?e("div",{css:ba,children:e(F,{weight:"heavy",textSize:"small",color:"inherit",children:a})}):null,e("div",{css:ba,children:e(F,{textSize:"small",color:"inherit",children:r})}),e("div",{css:ba,children:e(F,{textSize:"small",children:o})})]})})}),e(Jn,{children:s(h,{direction:"row",gap:"size-100",children:[s(F,{weight:"heavy",color:"inherit",children:[a," ",r]}),e(F,{color:"inherit",children:o})]})})]})}const Kt=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"projectId"},{defaultValue:null,kind:"LocalArgument",name:"spanId"}],a=[{kind:"Variable",name:"id",variableName:"projectId"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"spanAnnotationNames",storageKey:null}],type:"Project",abstractKey:null},i=[{kind:"Variable",name:"id",variableName:"spanId"}],r={kind:"InlineFragment",selections:[{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:"annotatorKind",storageKey:null}],storageKey:null}],type:"Span",abstractKey:null},o={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"EditSpanAnnotationsDialogNewAnnotationQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,t],storageKey:null},{alias:"span",args:i,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,r],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"EditSpanAnnotationsDialogNewAnnotationQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[o,l,t],storageKey:null},{alias:"span",args:i,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[o,l,r],storageKey:null}]},params:{cacheID:"4aa13fbe70360943615a8ff4d4b2a06f",id:null,metadata:{},name:"EditSpanAnnotationsDialogNewAnnotationQuery",operationKind:"query",text:`query EditSpanAnnotationsDialogNewAnnotationQuery(
  $projectId: GlobalID!
  $spanId: GlobalID!
) {
  project: node(id: $projectId) {
    __typename
    id
    ... on Project {
      spanAnnotationNames
    }
  }
  span: node(id: $spanId) {
    __typename
    id
    ... on Span {
      spanAnnotations {
        id
        name
        annotatorKind
      }
    }
  }
}
`}}}();Kt.hash="09b2ee5f96c0192a5618ae6c04c321ae";const xt=function(){var n={defaultValue:null,kind:"LocalArgument",name:"annotationId"},a={defaultValue:null,kind:"LocalArgument",name:"explanation"},l={defaultValue:null,kind:"LocalArgument",name:"label"},t={defaultValue:null,kind:"LocalArgument",name:"name"},i={defaultValue:null,kind:"LocalArgument",name:"score"},r={defaultValue:null,kind:"LocalArgument",name:"spanId"},o=[{items:[{fields:[{kind:"Variable",name:"annotationId",variableName:"annotationId"},{kind:"Literal",name:"annotatorKind",value:"HUMAN"},{kind:"Variable",name:"explanation",variableName:"explanation"},{kind:"Variable",name:"label",variableName:"label"},{kind:"Variable",name:"name",variableName:"name"},{kind:"Variable",name:"score",variableName:"score"}],kind:"ObjectValue",name:"input.0"}],kind:"ListValue",name:"input"}],c=[{kind:"Variable",name:"id",variableName:"spanId"}],d={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:[n,a,l,t,i,r],kind:"Fragment",metadata:null,name:"EditSpanAnnotationsDialogEditAnnotationMutation",selections:[{alias:null,args:o,concreteType:"SpanAnnotationMutationPayload",kind:"LinkedField",name:"patchSpanAnnotations",plural:!1,selections:[{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{alias:null,args:c,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:[r,n,t,l,i,a],kind:"Operation",name:"EditSpanAnnotationsDialogEditAnnotationMutation",selections:[{alias:null,args:o,concreteType:"SpanAnnotationMutationPayload",kind:"LinkedField",name:"patchSpanAnnotations",plural:!1,selections:[{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{alias:null,args:c,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{kind:"TypeDiscriminator",abstractKey:"__isNode"},d,{kind:"InlineFragment",selections:[{alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[d,{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:"8b7ea6d08a6f8f06744567701ccb5f34",id:null,metadata:{},name:"EditSpanAnnotationsDialogEditAnnotationMutation",operationKind:"mutation",text:`mutation EditSpanAnnotationsDialogEditAnnotationMutation(
  $spanId: GlobalID!
  $annotationId: GlobalID!
  $name: String!
  $label: String
  $score: Float
  $explanation: String
) {
  patchSpanAnnotations(input: [{annotationId: $annotationId, name: $name, label: $label, score: $score, explanation: $explanation, annotatorKind: HUMAN}]) {
    query {
      node(id: $spanId) {
        __typename
        ... on Span {
          ...EditSpanAnnotationsDialog_spanAnnotations
        }
        __isNode: __typename
        id
      }
    }
  }
}

fragment EditSpanAnnotationsDialog_spanAnnotations on Span {
  id
  spanAnnotations {
    id
    name
    annotatorKind
    score
    label
    explanation
  }
}
`}}}();xt.hash="46647cda8c9874c89d8a4034bf82fe14";const Dt=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:"EditSpanAnnotationsDialogSpanAnnotationsQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"EditSpanAnnotationsDialog_spanAnnotations"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"EditSpanAnnotationsDialogSpanAnnotationsQuery",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: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:"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}]},params:{cacheID:"8649eb1dd42a29a0d38b9a1538490de4",id:null,metadata:{},name:"EditSpanAnnotationsDialogSpanAnnotationsQuery",operationKind:"query",text:`query EditSpanAnnotationsDialogSpanAnnotationsQuery(
  $id: GlobalID!
) {
  node(id: $id) {
    __typename
    ...EditSpanAnnotationsDialog_spanAnnotations
    __isNode: __typename
    id
  }
}

fragment EditSpanAnnotationsDialog_spanAnnotations on Span {
  id
  spanAnnotations {
    id
    name
    annotatorKind
    score
    label
    explanation
  }
}
`}}}();Dt.hash="07aedb847a2af03a77823f0afc0c98d4";const Tt=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:["node"],operation:Dt,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"EditSpanAnnotationsDialog_spanAnnotations",selections:[n,{alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[n,{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}}();Tt.hash="07aedb847a2af03a77823f0afc0c98d4";const It=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"spanId"}],a=[{kind:"Variable",name:"id",variableName:"spanId"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"EditSpanAnnotationsDialogQuery",selections:[{alias:"span",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{kind:"InlineFragment",selections:[{args:null,kind:"FragmentSpread",name:"EditSpanAnnotationsDialog_spanAnnotations"}],type:"Span",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"EditSpanAnnotationsDialogQuery",selections:[{alias:"span",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l,{kind:"InlineFragment",selections:[{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:"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}]},params:{cacheID:"532b3c148c3bf1411b8820714c68f4e3",id:null,metadata:{},name:"EditSpanAnnotationsDialogQuery",operationKind:"query",text:`query EditSpanAnnotationsDialogQuery(
  $spanId: GlobalID!
) {
  span: node(id: $spanId) {
    __typename
    id
    ... on Span {
      ...EditSpanAnnotationsDialog_spanAnnotations
    }
  }
}

fragment EditSpanAnnotationsDialog_spanAnnotations on Span {
  id
  spanAnnotations {
    id
    name
    annotatorKind
    score
    label
    explanation
  }
}
`}}}();It.hash="36093f4285a168993ec87fd6aac82365";const Lt=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"},{defaultValue:null,kind:"LocalArgument",name:"spanId"}],a=[{items:[{kind:"Variable",name:"input.0",variableName:"input"}],kind:"ListValue",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:"NewSpanAnnotationFormMutation",selections:[{alias:null,args:a,concreteType:"SpanAnnotationMutationPayload",kind:"LinkedField",name:"createSpanAnnotations",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:"NewSpanAnnotationFormMutation",selections:[{alias:null,args:a,concreteType:"SpanAnnotationMutationPayload",kind:"LinkedField",name:"createSpanAnnotations",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:"d6f016f4dfb0c142854c3ecd840b09f5",id:null,metadata:{},name:"NewSpanAnnotationFormMutation",operationKind:"mutation",text:`mutation NewSpanAnnotationFormMutation(
  $input: CreateSpanAnnotationInput!
  $spanId: GlobalID!
) {
  createSpanAnnotations(input: [$input]) {
    query {
      node(id: $spanId) {
        __typename
        ... on Span {
          ...EditSpanAnnotationsDialog_spanAnnotations
        }
        __isNode: __typename
        id
      }
    }
  }
}

fragment EditSpanAnnotationsDialog_spanAnnotations on Span {
  id
  spanAnnotations {
    id
    name
    annotatorKind
    score
    label
    explanation
  }
}
`}}}();Lt.hash="ded0a7a64a2706f6ec472a63c1c57eca";const dd=C`
  color: var(--ac-global-text-color-900);
  font-size: 12px;
`;function _t(n){const{initialData:a,isReadOnly:l,onSubmit:t,isSubmitting:i=!1}=n,{control:r,handleSubmit:o,formState:{isDirty:c,isValid:d},setError:m,reset:f}=qe({defaultValues:a,disabled:l}),g=u.useCallback(y=>{const k=!y.label,v=y.score===""||y.score==null;if(k&&v){m("label",{type:"manual",message:"Label or score is required"}),m("score",{type:"manual",message:"Label or score is required"});return}const b={...y,score:y.score!=null?parseFloat(y.score.toString()):null};t&&t(b),f(b)},[t,m,f]),p=l;return s(mn,{onSubmit:o(g),children:[e(x,{padding:"size-200",children:s(h,{direction:"column",gap:"size-100",children:[s("div",{css:C`
              display: flex;
              flex-direction: row;
              width: 100%;
              overflow: hidden;
              gap: var(--ac-global-dimension-size-100);
              & > * {
                flex: 1 1 auto;
              }
              .ac-textfield {
                min-width: 0;
              }
            `,children:[e(G,{name:"label",control:r,render:({field:{onChange:y,onBlur:k,value:v},fieldState:{invalid:b,error:S}})=>e(le,{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:b?"invalid":"valid",onChange:y,onBlur:k,value:(v==null?void 0:v.toString())||""})}),e(G,{name:"score",control:r,render:({field:{onChange:y,onBlur:k,value:v},fieldState:{invalid:b,error:S}})=>e(le,{label:"Score",type:"number",placeholder:"e.x. 0.8",description:"A numeric grade",errorMessage:S==null?void 0:S.message,isReadOnly:l,validationState:b?"invalid":"valid",onChange:y,onBlur:k,value:(v==null?void 0:v.toString())||""})})]}),s("details",{open:!p,css:dd,children:[e("summary",{children:"Annotation Details"}),e(x,{paddingTop:"size-50",children:e(G,{name:"explanation",control:r,render:({field:{onChange:y,onBlur:k,value:v},fieldState:{invalid:b,error:S}})=>e(Zn,{label:"Explanation",height:70,isReadOnly:l,description:"Why this score or label was given",errorMessage:S==null?void 0:S.message,validationState:b?"invalid":"valid",onChange:y,onBlur:k,value:(v==null?void 0:v.toString())||""})})})]})]})}),e(H,{children:l?null:e(x,{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(N,{variant:c?"primary":"default",type:"submit",size:"compact",disabled:!d||!c||i,children:i?"Saving...":"Save"})})})})]})}function cd(n){const{annotationName:a,spanNodeId:l,onCreated:t}=n,[i,r]=T.useMutation(Lt);return e(_t,{initialData:{name:a},isSubmitting:r,onSubmit:c=>{i({variables:{input:{spanId:l,annotatorKind:"HUMAN",...c},spanId:l},onCompleted:()=>{t()}})}})}const At=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(
  $annotationId: GlobalID!
  $spanId: GlobalID!
) {
  deleteSpanAnnotations(input: {annotationIds: [$annotationId]}) {
    query {
      node(id: $spanId) {
        __typename
        ... on Span {
          ...EditSpanAnnotationsDialog_spanAnnotations
        }
        __isNode: __typename
        id
      }
    }
  }
}

fragment EditSpanAnnotationsDialog_spanAnnotations on Span {
  id
  spanAnnotations {
    id
    name
    annotatorKind
    score
    label
    explanation
  }
}
`}}}();At.hash="a898fcb037b08cb626daaf3d385588ce";function ud(n){const{onDelete:a,isDisabled:l=!1}=n;return e("div",{onClick:t=>{t.preventDefault(),t.stopPropagation()},children:e(Ue,{align:"end",buttonSize:"compact",isDisabled:l,onAction:t=>{switch(t){case"deleteAnnotation":a();break}},children:e(J,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(E.TrashOutline,{})}),e(F,{children:"Delete"})]})},"deleteAnnotation")})})}function md(n){const{annotationId:a,spanNodeId:l,annotationName:t,onSpanAnnotationActionSuccess:i,onSpanAnnotationActionError:r}=n,[o,c]=u.useState(null),[d,m]=T.useMutation(At),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]),g=u.useCallback(()=>{c(s(j,{size:"S",title:"Delete Annotation",children:[e(x,{padding:"size-200",children:e(F,{color:"danger",children:`Are you sure you want to delete annotation ${t}? This cannot be undone.`})}),e(x,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(h,{direction:"row",justifyContent:"end",children:e(N,{variant:"danger",onClick:()=>{f(),c(null)},children:"Delete Annotation"})})})]}))},[f,t]);return s("div",{children:[e(ud,{onDelete:g,isDisabled:m}),e(U,{type:"modal",isDismissable:!0,onDismiss:()=>c(null),children:o})]})}function gd(n){const{projectId:a,spanNodeId:l}=n,[t,i]=u.useState(null),r=ge();return e(j,{title:"Annotate",size:"M",isDismissable:!0,extra:e(pd,{projectId:a,spanNodeId:l,disabled:t!==null,onAnnotationNameSelect:i}),children:s("div",{css:C`
          height: 100%;
          overflow-y: auto;
          padding: var(--ac-global-dimension-size-200);
        `,children:[t&&e(x,{paddingBottom:"size-200",children:e(kd,{spanNodeId:l,name:t,onDelete:()=>{i(null)},onCreated:()=>{i(null),r({title:"New Span Annotation",message:`Annotation ${t} has been created.`})}})}),e(u.Suspense,{children:e(fd,{...n})})]})})}function pd(n){const{projectId:a,disabled:l=!1,spanNodeId:t,onAnnotationNameSelect:i}=n,[r,o]=u.useState(!1);return s(yn,{placement:"bottom end",crossOffset:300,isOpen:r,onOpenChange:c=>{o(c)},children:[e(N,{variant:"default",disabled:l,size:"compact",icon:e(P,{svg:e(E.PlusCircleOutline,{})}),onClick:()=>{o(!0)},children:"New"}),e(yd,{projectId:a,spanNodeId:t,onAnnotationNameSelect:c=>{i(c),o(!1)}})]})}function yd(n){const{projectId:a,spanNodeId:l,onAnnotationNameSelect:t}=n;return e(z,{title:"New Annotation",backgroundColor:"light",borderColor:"light",variant:"compact",bodyStyle:{padding:0},children:e(u.Suspense,{children:e(Sd,{projectId:a,spanId:l,onAnnotationNameSelect:t})})})}function fd(n){const a=T.useLazyLoadQuery(It,{spanId:n.spanNodeId},{fetchPolicy:"store-and-network"});return e(hd,{span:a.span})}function hd(n){const{span:a}=n,[l]=T.useRefetchableFragment(Tt,a),t=l.spanAnnotations||[],i=t.length>0;return s("div",{children:[!i&&e(hl,{graphicKey:"documents",message:"No annotations for this span"}),e("ul",{css:C`
          display: flex;
          flex-direction: column;
          gap: var(--ac-global-dimension-size-200);
        `,children:t.map((r,o)=>e("li",{children:e(bd,{annotation:r,spanNodeId:l.id})},`${o}_${r.name}`))})]})}function kd(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(Et,{kind:"HUMAN"}),e(N,{variant:"default",size:"compact",isDisabled:!0,"aria-label":"delete annotation",icon:e(P,{svg:e(E.CloseOutline,{})}),onClick:t})]}),bodyStyle:{padding:0},children:[e(Y,{variant:"info",banner:!0,children:"Fill out the fields below and click save to create a new annotation."}),e(cd,{annotationName:l,spanNodeId:a,onCreated:i})]})}function bd(n){const{annotation:a,spanNodeId:l}=n,[t,i]=u.useState(null),r=ge(),[o,c]=T.useMutation(xt),d=u.useCallback(m=>{u.startTransition(()=>{o({variables:{annotationId:a.id,spanId:l,...m},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"&&_e(a.score)||null,collapsible:!0,bodyStyle:{padding:0},extra:s(h,{gap:"size-100",alignItems:"center",children:[e(Et,{kind:a.annotatorKind}),e(md,{annotationId:a.id,spanNodeId:l,annotationName:a.name,onSpanAnnotationActionSuccess:m=>{r(m)},onSpanAnnotationActionError:m=>{i(m)}})]}),children:[t&&e(Y,{variant:"danger",banner:!0,children:t.message}),e(_t,{initialData:a,isReadOnly:a.annotatorKind==="LLM",isSubmitting:c,onSubmit:m=>{d(m)}})]})}function Et(n){const{kind:a}=n;return e(Qn,{color:a==="HUMAN"?"blue-900":"orange-900",children:a})}function Sd(n){const{projectId:a,spanId:l,onAnnotationNameSelect:t}=n,i=T.useLazyLoadQuery(Kt,{projectId:a,spanId:l}),[r,o]=u.useState(""),c=u.useMemo(()=>{var f,g;return((g=(f=i==null?void 0:i.span)==null?void 0:f.spanAnnotations)==null?void 0:g.map(p=>p.name))||[]},[i.span.spanAnnotations]),d=u.useMemo(()=>(i.project.spanAnnotationNames||[]).filter(g=>!c.includes(g)),[i.project.spanAnnotationNames,c]),m=d.length>0;return s(H,{children:[e(x,{padding:"size-200",children:s(h,{direction:"row",gap:"size-100",alignItems:"end",children:[e(le,{label:"Annotation Name",value:r,placeholder:"e.x. correctness",onChange:f=>{o(f)}}),e(N,{variant:"primary",onClick:()=>{t(r)},children:"Create"})]})}),m&&s(H,{children:[e(x,{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(Wn,{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(J,{children:f},f))})]})]})}function vd(n){const{spanNodeId:a,projectId:l}=n,[t,i]=u.useState(null);return s(H,{children:[e(N,{variant:"default",icon:e(P,{svg:e(E.EditOutline,{})}),onClick:()=>i(e(gd,{spanNodeId:a,projectId:l})),children:"Annotate"}),e(U,{type:"slideOver",isDismissable:!0,onDismiss:()=>i(null),children:t})]})}const wt=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(
  $id: GlobalID!
) {
  node(id: $id) {
    __typename
    ...SpanAside_span
    __isNode: __typename
    id
  }
}

fragment SpanAside_span on Span {
  id
  code: statusCode
  startTime
  endTime
  tokenCountTotal
  tokenCountPrompt
  tokenCountCompletion
  spanAnnotations {
    id
    name
    label
    annotatorKind
    score
  }
}
`}}}();wt.hash="cb5cab60889623d77ad0c96c98b3f8ac";const Rt=function(){var n={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:["node"],operation:wt,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"SpanAside_span",selections:[n,{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:[n,{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}}();Rt.hash="cb5cab60889623d77ad0c96c98b3f8ac";const Cd=C`
  display: flex;
  padding-top: var(--ac-global-dimension-size-50);
  flex-direction: column;
  gap: var(--ac-global-dimension-size-100);
  align-items: flex-start;
`;function Fd(n){const[a]=T.useRefetchableFragment(Rt,n.span),{startTime:l,endTime:t,code:i,tokenCountCompletion:r,tokenCountPrompt:o,tokenCountTotal:c}=a,d=u.useMemo(()=>new Date(l),[l]),m=u.useMemo(()=>t?new Date(t):null,[t]),f=u.useMemo(()=>m?m.getTime()-d.getTime():null,[m,d]),g=vl(i),p=a.spanAnnotations,y=p.length>0;return e(x,{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(bn,{label:"Status",children:s(h,{direction:"row",gap:"size-50",alignItems:"center",children:[e(sa,{statusCode:i}),e(F,{textSize:"xlarge",color:g,children:i})]})}),e(bn,{label:"Start Time",children:e(F,{textSize:"xlarge",children:Re(d)})}),m&&e(bn,{label:"End Time",children:e(F,{textSize:"xlarge",children:Re(m)})}),e(bn,{label:"Latency",children:e(F,{textSize:"xlarge",children:typeof f=="number"?e(xe,{latencyMs:f,textSize:"xlarge"}):"--"})}),c?e(bn,{label:"Total Tokens",children:e(Ra,{tokenCountTotal:c,tokenCountPrompt:o??0,tokenCountCompletion:r??0,textSize:"xlarge"})},"tokens"):null,y&&e(bn,{label:"Feedback",children:e("ul",{css:Cd,children:p.map(k=>e("li",{children:e(pn,{annotation:k,annotationDisplayPreference:"label"})},k.id))})})]})})}function bn({label:n,children:a}){return s(h,{direction:"column",children:[e(F,{elementType:"h3",textSize:"medium",color:"text-700",children:n}),a]})}function Kd(n){const{spanId:a,traceId:l}=n;return e("div",{css:C`
        button.ac-dropdown-button {
          min-width: 50px;
          .ac-dropdown-button__text {
            padding-right: 10px;
          }
        }
      `,children:s(yn,{placement:"bottom right",children:[e(Pl,{addonBefore:e(P,{svg:e(E.Code,{})}),children:"Code"}),e($a,{children:e(x,{padding:"size-200",children:s(mn,{children:[s(h,{direction:"row",gap:"size-100",alignItems:"end",children:[e(le,{label:"Span ID",isReadOnly:!0,value:a}),e(X,{text:a,size:"normal"})]}),s(h,{direction:"row",gap:"size-100",alignItems:"end",children:[e(le,{label:"Trace ID",isReadOnly:!0,value:l}),e(X,{text:l,size:"normal"})]})]})})})]})})}const Pt={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SpanFeedback_annotations",selections:[{alias:null,args:null,concreteType:"SpanAnnotation",kind:"LinkedField",name:"spanAnnotations",plural:!0,selections:[{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}],storageKey:null}],type:"Span",abstractKey:null};Pt.hash="6199ecd4f0143cffbaa2fe5e19a8739c";function xd(){const[n,a]=u.useState(null);return s(x,{padding:"size-200",children:[s(h,{direction:"column",gap:"size-100",alignItems:"center",children:[e(ua,{graphicKey:"documents"}),e(F,{children:"No annotations for this span"}),e(N,{variant:"default",size:"compact",onClick:()=>{a(e(j,{title:"Span Annotations",isDismissable:!0,children:s(x,{padding:"size-200",children:[e("p",{css:C`
              margin: 0 0 var(--ac-global-dimension-size-100) 0;
            `,children:"Annotations are pivotal for tracking and improving the performance of your application. Phoenix allows for both LLM and HUMAN annotations."}),e(dn,{href:"https://docs.arize.com/phoenix/tracing/concepts-tracing/how-to-evaluate-traces",children:"View annotation documentation"})]})}))},icon:e(P,{svg:e(E.Edit2Outline,{})}),children:"How to Annotate"})]}),e(U,{onDismiss:()=>a(null),isDismissable:!0,children:n})]})}const Dd=[{header:"name",accessorKey:"name",size:100},{header:"label",accessorKey:"label",size:100},{header:"score",accessorKey:"score",size:100},{header:"explanation",accessorKey:"explanation",cell:gs,size:400}];function Za({annotations:n}){const a=u.useMemo(()=>[...n],[n]),l=ue({columns:Dd,data:a,getCoreRowModel:me()}),i=l.getRowModel().rows.length===0;return s("table",{css:He,children:[e("thead",{children:l.getHeaderGroups().map(r=>e("tr",{children:r.headers.map(o=>e("th",{colSpan:o.colSpan,children:o.isPlaceholder?null:e(H,{children:B(o.column.columnDef.header,o.getContext())})},o.id))},r.id))}),i?e(Ge,{}):e("tbody",{children:l.getRowModel().rows.map(r=>e("tr",{children:r.getVisibleCells().map(o=>e("td",{style:{width:o.column.getSize()},children:B(o.column.columnDef.cell,o.getContext())},o.id))},r.id))})]})}function Td({span:n}){const a=T.useFragment(Pt,n),l=u.useMemo(()=>a.spanAnnotations.filter(r=>r.annotatorKind==="HUMAN"),[a.spanAnnotations]),t=u.useMemo(()=>a.spanAnnotations.filter(r=>r.annotatorKind==="LLM"),[a.spanAnnotations]);return a.spanAnnotations.length>0?s(tn,{children:[e(ye,{id:"evaluations",title:"Evaluations",children:e(Za,{annotations:t})}),e(ye,{id:"human",title:"Human Annotations",children:e(Za,{annotations:l})})]}):e(xd,{})}function Id(n){return n==="__REDACTED__"}const Ld=C`
  position: relative;
  overflow: hidden;
  width: 200px;
  height: 200px;
  border-radius: var(--ac-global-rounding-small);
  border: 1px solid var(--ac-global-color-grey-500);
  background-color: var(--ac-global-color-grey-200);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition:
    width 0.1s ease-in-out,
    height 0.1s ease-in-out opacity 0.1s ease-in-out;
  button {
    position: absolute;
    right: var(--ac-global-dimension-size-100);
    top: var(--ac-global-dimension-size-100);
    z-index: 1;
    opacity: 0;
  }
  &:hover button {
    opacity: 1;
  }
  img {
    width: inherit;
    height: inherit;
    object-fit: contain;
  }

  &.is-expanded {
    width: 100%;
    height: 100%;
    img {
      object-fit: cover;
    }
  }
`;function _d(n){const[a,l]=u.useState(!1);let t;const i=Id(n.url);return i?t=e(Ad,{}):t=e("img",{src:n.url}),s("div",{className:Ar({"is-expanded":a}),css:Ld,children:[!i&&e(N,{variant:"default",size:"compact",onClick:()=>l(!a),icon:e(P,{svg:a?e(E.CollapseOutline,{}):e(E.ExpandOutline,{})}),"aria-label":"Expand / Collapse Image"}),t]})}const Ad=()=>s("svg",{width:"130",height:"130",viewBox:"0 0 130 130",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[e("rect",{x:"1.5",y:"1.5",width:"127",height:"127",rx:"6.5",strokeOpacity:"0.8",strokeWidth:"3"}),e("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M40 27.5H90C96.8917 27.5 102.5 33.1083 102.5 40V90C102.5 96.8917 96.8917 102.5 90 102.5H40C33.1083 102.5 27.5 96.8917 27.5 90V40C27.5 33.1083 33.1083 27.5 40 27.5ZM40 35.8333H90C92.3 35.8333 94.1667 37.7 94.1667 40V74.85L80.8208 63.4667C76.6958 59.9583 70.2417 59.9583 66.1542 63.4417L35.8333 88.7417V40C35.8333 37.7 37.7 35.8333 40 35.8333ZM54.5833 50.4167C54.5833 53.8667 51.7833 56.6667 48.3333 56.6667C44.8833 56.6667 42.0833 53.8667 42.0833 50.4167C42.0833 46.9667 44.8833 44.1667 48.3333 44.1667C51.7833 44.1667 54.5833 46.9667 54.5833 50.4167ZM42.3375 94.1667H90C92.3 94.1667 94.1667 92.3 94.1667 90V85.8083L75.4125 69.8083C74.4083 68.9458 72.55 68.9417 71.525 69.8125L42.3375 94.1667Z",fill:"var(--ac-global-color-grey-300)"})]}),Mt=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"DatasetMutationPayload",kind:"LinkedField",name:"addExamplesToDataset",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:"SpanToDatasetExampleDialogAddExampleToDatasetMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"SpanToDatasetExampleDialogAddExampleToDatasetMutation",selections:a},params:{cacheID:"d93c9d47668fc266ba09ecb14c2b72ae",id:null,metadata:{},name:"SpanToDatasetExampleDialogAddExampleToDatasetMutation",operationKind:"mutation",text:`mutation SpanToDatasetExampleDialogAddExampleToDatasetMutation(
  $input: AddExamplesToDatasetInput!
) {
  addExamplesToDataset(input: $input) {
    dataset {
      id
    }
  }
}
`}}}();Mt.hash="75120065d239f28304e9dd91fc34bec9";const Nt=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"spanId"}],a=[{kind:"Variable",name:"id",variableName:"spanId"}],l={kind:"InlineFragment",selections:[{alias:"revision",args:null,concreteType:"SpanAsExampleRevision",kind:"LinkedField",name:"asExampleRevision",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}],type:"Span",abstractKey:null},t={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"SpanToDatasetExampleDialogQuery",selections:[{alias:"span",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l],storageKey:null},{args:null,kind:"FragmentSpread",name:"DatasetPicker__datasets"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"SpanToDatasetExampleDialogQuery",selections:[{alias:"span",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l,{kind:"TypeDiscriminator",abstractKey:"__isNode"},t],storageKey:null},{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:[t,{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],storageKey:null}],storageKey:null}],storageKey:null}]},params:{cacheID:"340325aadd2b2d81cb509e6b6bee7f0b",id:null,metadata:{},name:"SpanToDatasetExampleDialogQuery",operationKind:"query",text:`query SpanToDatasetExampleDialogQuery(
  $spanId: GlobalID!
) {
  span: node(id: $spanId) {
    __typename
    ... on Span {
      revision: asExampleRevision {
        input
        output
        metadata
      }
    }
    __isNode: __typename
    id
  }
  ...DatasetPicker__datasets
}

fragment DatasetPicker__datasets on Query {
  datasets {
    edges {
      dataset: node {
        id
        name
      }
    }
  }
}
`}}}();Nt.hash="5afd1a4eede339492f5473ed17b770b3";const Vt={fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"DatasetPickerRefetchQuery",selections:[{args:null,kind:"FragmentSpread",name:"DatasetPicker__datasets"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"DatasetPickerRefetchQuery",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}]},params:{cacheID:"38a431d0ba6fa8c12622a1cbb3d1e446",id:null,metadata:{},name:"DatasetPickerRefetchQuery",operationKind:"query",text:`query DatasetPickerRefetchQuery {
  ...DatasetPicker__datasets
}

fragment DatasetPicker__datasets on Query {
  datasets {
    edges {
      dataset: node {
        id
        name
      }
    }
  }
}
`}};Vt.hash="03d88d1706089bb63edcd44d04563cbc";const $t={argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:[],operation:Vt}},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};$t.hash="03d88d1706089bb63edcd44d04563cbc";function Ed(n){const[a,l]=T.useRefetchableFragment($t,n.query);return s(h,{direction:"row",gap:"size-100",alignItems:"end",children:[e(_l,{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(J,{children:t.name},t.id))}),e(wd,{onDatasetCreated:()=>{u.startTransition(()=>{l({},{fetchPolicy:"store-and-network"})})}})]})}function wd({onDatasetCreated:n}){const[a,l]=u.useState(null),[t,i]=u.useState(!1),r=ge();return s(yn,{placement:"bottom right",isOpen:t,onOpenChange:o=>{l(null),i(o)},children:[e(N,{variant:"default",icon:e(P,{svg:e(E.PlusCircleOutline,{})}),"aria-label":"Create a new dataset"}),e(z,{title:"Create New Dataset",bodyStyle:{padding:0},variant:"compact",borderColor:"light",backgroundColor:"light",children:s(x,{width:"500px",children:[a?e(Y,{variant:"danger",children:a}):null,e(Pa,{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 Sa={backgroundColor:"light",borderColor:"light",collapsible:!0,bodyStyle:{padding:0}};function Rd({spanId:n,onCompleted:a}){const[l,t]=u.useState(null),i=T.useLazyLoadQuery(Nt,{spanId:n},{fetchPolicy:"store-and-network"}),{span:{revision:r}}=i,[o,c]=T.useMutation(Mt),{control:d,setError:m,handleSubmit:f,formState:{isValid:g}}=qe({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),!Ee(y==null?void 0:y.input))return m("input",{message:"Input must be a valid JSON object"});if(!Ee(y==null?void 0:y.output))return m("output",{message:"Output must be a valid JSON object"});if(!Ee(y==null?void 0:y.metadata))return m("metadata",{message:"Metadata must be a valid JSON object"});if(!(y!=null&&y.datasetId))return m("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,m,n,a]);return e(j,{size:"fullscreen",title:"Add Example to Dataset",extra:e(N,{variant:"primary",size:"compact",disabled:!g||c,loading:c,onClick:f(p),icon:e(P,{svg:e(E.PlusCircleOutline,{})}),children:"Add Example"}),children:e("div",{css:C`
          overflow-y: auto;
          padding: var(--ac-global-dimension-size-400);
          /* Make widths configurable */
          .dataset-picker {
            width: 100%;
            .ac-dropdown--picker,
            .ac-dropdown-button {
              width: 100%;
            }
          }
        `,children:e(h,{direction:"row",justifyContent:"center",children:e(x,{width:"900px",paddingStart:"auto",paddingEnd:"auto",children:s(h,{direction:"column",gap:"size-200",children:[l?e(Y,{variant:"danger",children:l}):null,e(G,{control:d,name:"datasetId",render:({field:{onChange:y,onBlur:k},fieldState:{invalid:v,error:b}})=>e(Ed,{onSelectionChange:y,onBlur:k,validationState:v?"invalid":"valid",errorMessage:b==null?void 0:b.message,query:i})}),e(G,{control:d,name:"input",render:({field:{onChange:y,onBlur:k,value:v},fieldState:{invalid:b,error:S}})=>s(z,{title:"Input",subTitle:"The input to the LLM, retriever, program, etc.",...Sa,children:[b?e(Y,{variant:"danger",banner:!0,children:S==null?void 0:S.message}):null,e(we,{value:v,onChange:y,onBlur:k})]})}),e(G,{control:d,name:"output",render:({field:{onChange:y,onBlur:k,value:v},fieldState:{invalid:b,error:S}})=>s(z,{title:"Output",subTitle:"The output of the LLM or program to be used as an expected output",...Sa,backgroundColor:"green-100",borderColor:"green-700",children:[b?e(Y,{variant:"danger",banner:!0,children:S==null?void 0:S.message}):null,e(we,{value:v,onChange:y,onBlur:k})]})}),e(G,{control:d,name:"metadata",render:({field:{onChange:y,onBlur:k,value:v},fieldState:{invalid:b,error:S}})=>s(z,{title:"Metadata",subTitle:"All data from the span to use during experimentation or evaluation",...Sa,children:[b?e(Y,{variant:"danger",banner:!0,children:S==null?void 0:S.message}):null,e(we,{value:v,onChange:y,onBlur:k})]})})]})})})})})}const Pd=n=>u.useMemo(()=>{try{return{json:JSON.parse(n)}}catch(a){return{json:null,parseError:a}}},[n]),Md=n=>n.events.some(a=>a.name==="exception"),ee={backgroundColor:"light",borderColor:"light",variant:"compact",collapsible:!0};function Nd({spanNodeId:n,projectId:a}){const{span:l}=T.useLazyLoadQuery(Ft,{spanId:n});if(l.__typename!=="Span")throw new Error("Expected a span, but got a different type"+l.__typename);const t=u.useMemo(()=>Md(l),[l]),i=un(o=>o.showSpanAside),r=un(o=>o.setShowSpanAside);return s(h,{direction:"column",flex:"1 1 auto",height:"100%",children:[e(x,{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(Ma,{spanKind:l.spanKind}),e(F,{children:l.name})]}),s(h,{flex:"none",direction:"row",alignItems:"center",gap:"size-100",children:[e(Kd,{traceId:l.context.traceId,spanId:l.context.spanId}),e(zd,{span:l}),e(vd,{spanNodeId:l.id,projectId:a}),s(Fe,{placement:"top",offset:5,children:[e(N,{variant:"default","aria-label":"Toggle showing span details",onClick:()=>{r(!i)},icon:e(P,{svg:i?e(E.SlideIn,{}):e(E.SlideOut,{})})}),e(On,{children:i?"Hide Span Details":"Show Span Details"})]})]})]})}),s(ke,{children:[e(q,{name:"Info",children:s(h,{direction:"row",height:"100%",children:[e($d,{children:e(Cl,{children:e(Qd,{span:l})})}),i?e(Fd,{span:l}):null]})}),e(q,{name:"Feedback",extra:e(Me,{variant:"light",children:l.spanAnnotations.length}),children:o=>o?e(Td,{span:l}):null}),e(q,{name:"Attributes",title:"Attributes",children:e(x,{padding:"size-200",children:e(z,{title:"All Attributes",...ee,titleExtra:Ot,extra:e(X,{text:l.attributes}),bodyStyle:{padding:0},children:e(Qe,{children:l.attributes})})})}),e(q,{name:"Events",extra:e(Me,{variant:t?"danger":"light",children:l.events.length}),children:e(tc,{events:l.events})})]})]})}const Vd=C`
  flex: 1 1 auto;
  overflow-y: auto;
  // Overflow fails to take into account padding
  & > *:after {
    content: "";
    display: block;
    height: var(--ac-global-dimension-static-size-400);
  }
`;function $d({children:n}){return e("div",{css:Vd,"data-testid":"span-info-wrap",children:n})}function zd({span:n}){const[a,l]=u.useState(null),t=ge(),i=ae(),r=u.useCallback(()=>{l(e(Rd,{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(H,{children:[e(N,{variant:"default",icon:e(P,{svg:e(E.DatabaseOutline,{})}),onClick:r,children:"Add to Dataset"}),e(u.Suspense,{children:e(U,{type:"slideOver",isDismissable:!0,onDismiss:()=>l(null),children:a})})]})}function Qd({span:n}){const{spanKind:a,attributes:l}=n,{json:t,parseError:i}=Pd(l),r=u.useMemo(()=>n.statusMessage?e(Y,{variant:"danger",title:"Status Description",children:n.statusMessage}):null,[n]);if(i||!t)return e(x,{padding:"size-200",children:s(h,{direction:"column",gap:"size-200",children:[r,e(Y,{variant:"warning",title:"Un-parsable attributes",children:`Failed to parse span attributes. ${i instanceof Error?i.message:""}`}),e(z,{...ee,title:"Attributes",children:e(x,{padding:"size-100",children:l})})]})});let o;switch(a){case"llm":{o=e(Od,{span:n,spanAttributes:t});break}case"retriever":{o=e(jd,{span:n,spanAttributes:t});break}case"reranker":{o=e(qd,{span:n,spanAttributes:t});break}case"embedding":{o=e(Bd,{span:n,spanAttributes:t});break}case"tool":{o=e(Hd,{span:n,spanAttributes:t});break}default:o=e(zt,{span:n})}return e(x,{padding:"size-200",children:s(h,{direction:"column",gap:"size-200",children:[r,o,t!=null&&t.metadata?e(z,{...ee,title:"Metadata",children:e(Qe,{children:JSON.stringify(t.metadata)})}):null]})})}function Od(n){const{spanAttributes:a,span:l}=n,{input:t,output:i}=l,r=u.useMemo(()=>a[pe.llm]||null,[a]),o=u.useMemo(()=>{if(r==null)return null;const R=r[en.model_name];return typeof R=="string"?R:null},[r]),c=u.useMemo(()=>{var R;return r==null?[]:((R=r[en.input_messages])==null?void 0:R.map(w=>w[pe.message]).filter(Boolean))||[]},[r]),d=u.useMemo(()=>{if(r==null)return[];const R=r[en.tools];return Array.isArray(R)?R==null?void 0:R.map(O=>O[pe.tool]).filter(Boolean):[]},[r]),m=u.useMemo(()=>d.reduce((R,w)=>(w!=null&&w.json_schema&&R.push(w.json_schema),R),[]),[d]),f=u.useMemo(()=>{var R;return r==null?[]:((R=r[en.output_messages])==null?void 0:R.map(w=>w[pe.message]).filter(Boolean))||[]},[r]),g=u.useMemo(()=>{if(r==null)return[];const R=r[en.prompts];return ps(R)?R:[]},[r]),p=u.useMemo(()=>{if(r==null)return null;const R=r[en.prompt_template];return R??null},[r]),y=u.useMemo(()=>r==null?"{}":r[en.invocation_parameters]||"{}",[r]),k=u.useMemo(()=>o==null?null:s(h,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Fl,{spanKind:"llm"}),e(F,{textSize:"large",weight:"heavy",children:o})]}),[o]),v=t!=null&&t.value!=null,b=c.length>0,S=m.length>0,L=i!=null&&i.value!=null,I=f.length>0,A=g.length>0,K=Object.keys(JSON.parse(y)).length>0,D=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(ke,{children:[b?e(q,{name:"Input Messages",hidden:!b,children:e(Xa,{messages:c})}):null,S?e(q,{name:"Tools",hidden:!S,children:e(Jd,{toolSchemas:m})}):null,v?e(q,{name:"Input",hidden:!v,children:e(x,{padding:"size-200",children:e(Se,{children:e(z,{...ee,title:"LLM Input",extra:s(h,{direction:"row",gap:"size-100",children:[e(Pe,{}),e(X,{text:t.value})]}),children:e(Ne,{...t})})})})}):null,D?e(q,{name:"Prompt Template",hidden:!D,children:e(x,{padding:"size-200",children:s(h,{direction:"column",gap:"size-100",children:[e(x,{borderRadius:"medium",borderColor:"light",backgroundColor:"light",borderWidth:"thin",padding:"size-200",children:s(la,{text:p.template,children:[e(F,{color:"text-700",fontStyle:"italic",children:"prompt template"}),e(Qt,{children:p.template})]})}),e(x,{borderRadius:"medium",borderColor:"light",backgroundColor:"light",borderWidth:"thin",padding:"size-200",children:s(la,{text:JSON.stringify(p.variables),children:[e(F,{color:"text-700",fontStyle:"italic",children:"template variables"}),e(Qe,{children:JSON.stringify(p.variables)})]})})]})})}):null,e(q,{name:"Prompts",hidden:!A,children:e(Zd,{prompts:g})}),e(q,{name:"Invocation Params",hidden:!K,children:e(la,{text:y,padding:"size-100",children:e(Qe,{children:y})})})]})}),L||I?e(Va,{...ee,children:s(ke,{children:[I?e(q,{name:"Output Messages",hidden:!I,children:e(Xa,{messages:f})}):null,L?e(q,{name:"Output",hidden:!L,children:e(x,{padding:"size-200",children:e(Se,{children:e(z,{...ee,title:"LLM Output",extra:s(h,{direction:"row",gap:"size-100",children:[e(Pe,{}),e(X,{text:i.value})]}),children:e(Ne,{...i})})})})}):null]})}):null]})}function jd(n){const{spanAttributes:a,span:l}=n,{input:t}=l,i=u.useMemo(()=>a[pe.retrieval]||null,[a]),r=u.useMemo(()=>{var f;return i==null?[]:((f=i[Er.documents])==null?void 0:f.map(g=>g[pe.document]).filter(Boolean))||[]},[i]),o=u.useMemo(()=>l.documentEvaluations.reduce((g,p)=>{const y=p.documentPosition,k=g[y]||[];return{...g,[y]:[...k,p]}},{}),[l.documentEvaluations]),c=t!=null&&t.value!=null,d=r.length>0,m=l.documentRetrievalMetrics.length>0;return s(h,{direction:"column",gap:"size-200",children:[c?e(Se,{children:e(z,{title:"Input",...ee,extra:s(h,{direction:"row",gap:"size-100",children:[e(Pe,{}),e(X,{text:t.value})]}),children:e(Ne,{...t})})}):null,d?e(Se,{children:e(z,{title:"Documents",...ee,titleExtra:m&&e(h,{direction:"row",alignItems:"center",gap:"size-100",children:l.documentRetrievalMetrics.map(f=>s(H,{children:[e(he,{name:f.evaluationName,metric:"ndcg",score:f.ndcg},"ndcg"),e(he,{name:f.evaluationName,metric:"precision",score:f.precision},"precision"),e(he,{name:f.evaluationName,metric:"hit",score:f.hit},"hit")]}))}),extra:e(Pe,{}),children:e("ul",{css:C`
                display: flex;
                flex-direction: column;
                gap: var(--ac-global-dimension-static-size-200);
              `,children:r.map((f,g)=>e("li",{children:e(La,{document:f,documentEvaluations:o[g],borderColor:"seafoam-700",backgroundColor:"seafoam-100",labelColor:"seafoam-1000"})},g))})})}):null]})}function qd(n){const{spanAttributes:a}=n,l=u.useMemo(()=>a[pe.reranker]||null,[a]),t=u.useMemo(()=>l==null?null:l[ya.query]||null,[l]),i=u.useMemo(()=>{var d;return l==null?[]:((d=l[ya.input_documents])==null?void 0:d.map(m=>m[pe.document]).filter(Boolean))||[]},[l]),r=u.useMemo(()=>{var d;return l==null?[]:((d=l[ya.output_documents])==null?void 0:d.map(m=>m[pe.document]).filter(Boolean))||[]},[l]),o=i.length,c=r.length;return s(h,{direction:"column",gap:"size-200",children:[e(Se,{children:t&&e(z,{title:"Query",...ee,children:e(Gn,{children:t})})}),e(z,{title:"Input Documents",titleExtra:e(Me,{variant:"light",children:o}),...ee,defaultOpen:!1,bodyStyle:{padding:0},children:e("ul",{css:C`
              padding: var(--ac-global-dimension-static-size-200);
              display: flex;
              flex-direction: column;
              gap: var(--ac-global-dimension-static-size-200);
            `,children:i.map((d,m)=>e("li",{children:e(La,{document:d,borderColor:"seafoam-700",backgroundColor:"seafoam-100",labelColor:"seafoam-1000"})},m))})}),e(z,{title:"Output Documents",titleExtra:e(Me,{variant:"light",children:c}),...ee,bodyStyle:{padding:0},children:e("ul",{css:C`
              padding: var(--ac-global-dimension-static-size-200);
              display: flex;
              flex-direction: column;
              gap: var(--ac-global-dimension-static-size-200);
            `,children:r.map((d,m)=>e("li",{children:e(La,{document:d,borderColor:"celery-700",backgroundColor:"celery-100",labelColor:"celery-1000"})},m))})})]})}function Bd(n){const{spanAttributes:a}=n,l=u.useMemo(()=>a[pe.embedding]||null,[a]),t=u.useMemo(()=>{var o;return l==null?[]:((o=l[fa.embeddings])==null?void 0:o.map(c=>c[pe.embedding]).filter(Boolean))||[]},[l]),i=t.length>0,r=l==null?void 0:l[fa.model_name];return e(h,{direction:"column",gap:"size-200",children:i?e(z,{title:"Embeddings"+(typeof r=="string"?`: ${r}`:""),...ee,children:e("ul",{css:C`
                display: flex;
                flex-direction: column;
                gap: var(--ac-global-dimension-static-size-200);
              `,children:t.map((o,c)=>e("li",{children:e(Se,{children:e(z,{...ee,backgroundColor:"purple-100",borderColor:"purple-700",title:"Embedded Text",children:e(Gn,{children:o[fa.text]||""})})})},c))})}):e(zt,{span:n.span})})}function Hd(n){const{span:a,spanAttributes:l}=n,{input:t,output:i}=a,r=typeof(t==null?void 0:t.value)=="string",o=typeof(i==null?void 0:i.value)=="string",c=(t==null?void 0:t.mimeType)==="text",d=(i==null?void 0:i.mimeType)==="text",m=u.useMemo(()=>l[pe.tool]||{},[l]),f=Object.keys(m).length>0,g=m[ha.name],p=m[ha.description],y=m[ha.parameters];return!r&&!o&&!f?null:s(h,{direction:"column",gap:"size-200",children:[r?e(Se,{children:e(z,{title:"Input",...ee,extra:s(h,{direction:"row",gap:"size-100",children:[c?e(Pe,{}):null,e(X,{text:t.value})]}),children:e(Ne,{...t})})}):null,o?e(Se,{children:e(z,{title:"Output",...ee,backgroundColor:"green-100",borderColor:"green-700",extra:s(h,{direction:"row",gap:"size-100",children:[d?e(Pe,{}):null,e(X,{text:i.value})]}),children:e(Ne,{...i})})}):null,f?e(z,{title:"Tool"+(typeof g=="string"?`: ${g}`:""),...ee,children:s(h,{direction:"column",children:[p!=null?e(x,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderBottomColor:"dark",borderBottomWidth:"thin",backgroundColor:"light",children:s(h,{direction:"column",alignItems:"start",gap:"size-50",children:[e(F,{color:"text-700",fontStyle:"italic",children:"Description"}),e(F,{children:p})]})}):null,y!=null?e(x,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderBottomColor:"dark",borderBottomWidth:"thin",children:s(h,{direction:"column",alignItems:"start",width:"100%",children:[e(F,{color:"text-700",fontStyle:"italic",children:"Parameters"}),e(Qe,{children:JSON.stringify(y)})]})}):null]})}):null]})}const Gd=["irrelevant","unrelated"];function La({document:n,documentEvaluations:a,backgroundColor:l,borderColor:t,labelColor:i}){const r=n[Nn.metadata],o=a&&a.length,c=n[Nn.content];return e(z,{...ee,backgroundColor:l,borderColor:t,bodyStyle:{padding:0},title:s(h,{direction:"row",gap:"size-50",alignItems:"center",children:[e(P,{svg:e(E.FileOutline,{})}),s(te,{level:4,children:["document ",n[Nn.id]]})]}),extra:typeof n[Nn.score]=="number"&&e(Qn,{color:i,children:`score ${Ea(n[Nn.score])}`}),children:s(h,{direction:"column",children:[c&&e(x,{padding:"size-200",children:e(Gn,{children:c})}),r&&e(H,{children:e(x,{borderColor:t,borderTopWidth:"thin",children:e(Qe,{children:JSON.stringify(r)})})}),o&&e(x,{borderColor:t,borderTopWidth:"thin",padding:"size-200",children:s(h,{direction:"column",gap:"size-100",children:[e(te,{level:3,weight:"heavy",children:"Evaluations"}),e("ul",{children:a.map((d,m)=>{const f=d.label&&Gd.includes(d.label)?"danger":i;return e("li",{children:e(x,{padding:"size-200",borderWidth:"thin",borderColor:t,borderRadius:"medium",children:s(h,{direction:"column",gap:"size-50",children:[s(h,{direction:"row",gap:"size-100",children:[e(F,{weight:"heavy",elementType:"h5",children:d.name}),d.label&&e(Qn,{color:f,shape:"badge",children:d.label}),typeof d.score=="number"&&e(Qn,{color:f,shape:"badge",children:s(h,{direction:"row",gap:"size-50",children:[e(F,{textSize:"xsmall",weight:"heavy",color:"inherit",children:"score"}),e(F,{textSize:"xsmall",children:_e(d.score)})]})})]}),typeof d.explanation&&e("p",{css:C`
                                margin-top: var(
                                  --ac-global-dimension-static-size-100
                                );
                                margin-bottom: 0;
                              `,children:d.explanation})]})})},m)})})]})})]})})}function Ud({message:n}){var c;const a=n[Ce.content],l=n[Ce.contents],t=((c=n[Ce.tool_calls])==null?void 0:c.map(d=>d[pe.tool_call]).filter(Boolean))||[],i=n[Ce.function_call_arguments_json]&&n[Ce.function_call_name],r=n[Ce.role]||"unknown",o=u.useMemo(()=>r==="user"?{backgroundColor:"grey-100",borderColor:"grey-500"}:r==="assistant"?{backgroundColor:"blue-100",borderColor:"blue-700"}:r==="system"?{backgroundColor:"indigo-100",borderColor:"indigo-700"}:["function","tool"].includes(r)?{backgroundColor:"yellow-100",borderColor:"yellow-700"}:{backgroundColor:"grey-100",borderColor:"grey-700"},[r]);return e(Se,{children:s(z,{...ee,...o,title:r+(n[Ce.name]?`: ${n[Ce.name]}`:""),extra:s(h,{direction:"row",gap:"size-100",children:[e(Pe,{}),e(X,{text:a||JSON.stringify(n)})]}),children:[e(Cl,{children:l?e(Yd,{messageContents:l}):null}),s(h,{direction:"column",alignItems:"start",children:[a?e(Gn,{children:a}):null,t.length>0?t.map((d,m)=>{var f,g;return s("pre",{css:C`
                      text-wrap: wrap;
                      margin: var(--ac-global-dimension-static-size-100) 0;
                    `,children:[(f=d==null?void 0:d.function)==null?void 0:f.name,"(",JSON.stringify(JSON.parse((g=d==null?void 0:d.function)==null?void 0:g.arguments),null,2),")"]},m)}):null,i?s("pre",{css:C`
                text-wrap: wrap;
                margin: var(--ac-global-dimension-static-size-100) 0;
              `,children:[n[Ce.function_call_name],"(",JSON.stringify(JSON.parse(n[Ce.function_call_arguments_json]),null,2),")"]}):null]})]})})}function Wd({toolSchema:n,index:a}){return e(z,{title:s(h,{direction:"row",gap:"size-100",alignItems:"center",children:[e(Fl,{spanKind:"tool"}),e(F,{textSize:"large",weight:"heavy",children:"Tool"})]}),titleExtra:s(Me,{variant:"light",children:["#",a+1]}),...ee,backgroundColor:"yellow-100",borderColor:"yellow-700",bodyStyle:{padding:0},extra:e(X,{text:n}),children:e(Ne,{value:n,mimeType:"json"})})}function Xa({messages:n}){return e("ul",{css:C`
        display: flex;
        flex-direction: column;
        gap: var(--ac-global-dimension-static-size-100);
        padding: var(--ac-global-dimension-static-size-200);
      `,children:n.map((a,l)=>e("li",{children:e(Ud,{message:a})},l))})}function Jd({toolSchemas:n}){return e("ul",{css:C`
        display: flex;
        flex-direction: column;
        gap: var(--ac-global-dimension-static-size-100);
        padding: var(--ac-global-dimension-static-size-200);
      `,children:n.map((a,l)=>e("li",{children:e(Wd,{toolSchema:a,index:l})},l))})}function Zd({prompts:n}){return e("ul",{"data-testid":"llm-prompts-list",css:C`
        padding: var(--ac-global-dimension-size-200);
        display: flex;
        flex-direction: column;
        gap: var(--ac-global-dimension-size-100);
      `,children:n.map((a,l)=>e("li",{children:e(x,{backgroundColor:"gray-600",borderColor:"gray-400",borderWidth:"thin",borderRadius:"medium",padding:"size-100",children:e(la,{text:a,children:e(Ne,{value:a,mimeType:"text"})})})},l))})}const Xd=C`
  display: flex;
  flex-direction: row;
  gap: var(--ac-global-dimension-size-200);
  flex-wrap: wrap;
`;function Yd({messageContents:n}){return e("ul",{css:Xd,"data-testid":"message-content-list",children:n.map((a,l)=>e(nc,{messageContentAttribute:a},l))})}const ec=C`
  flex: 1 1 100%;
`;function nc({messageContentAttribute:n}){var r;const{message_content:a}=n,l=a==null?void 0:a.text,t=a==null?void 0:a.image,i=(r=t==null?void 0:t.image)==null?void 0:r.url;return s("li",{css:l?ec:null,children:[l?e("pre",{css:C`
            white-space: pre-wrap;
            padding: 0;
            margin: 0;
          `,children:l}):null,i?e(_d,{url:i}):null]})}function zt({span:n}){const{input:a,output:l}=n,t=a==null&&l==null,i=(a==null?void 0:a.mimeType)==="text",r=(l==null?void 0:l.mimeType)==="text";return s(h,{direction:"column",gap:"size-200",children:[a&&a.value!=null?e(Se,{children:e(z,{title:"Input",...ee,extra:s(h,{direction:"row",gap:"size-100",children:[i?e(Pe,{}):null,e(X,{text:a.value})]}),children:e(Ne,{...a})})}):null,l&&l.value!=null?e(Se,{children:e(z,{title:"Output",...ee,backgroundColor:"green-100",borderColor:"green-700",extra:s(h,{direction:"row",gap:"size-100",children:[r?e(Pe,{}):null,e(X,{text:l.value})]}),children:e(Ne,{...l})})}):null,t?e(z,{title:"All Attributes",titleExtra:Ot,...ee,bodyStyle:{padding:0},extra:e(X,{text:n.attributes}),children:e(Qe,{children:n.attributes})}):null]})}const ac=C`
  .cm-content {
    padding: var(--ac-global-dimension-static-size-200) 0;
  }
  .cm-editor,
  .cm-gutters {
    background-color: transparent;
  }
`;function la({text:n,children:a,padding:l}){const t=l?`var(--ac-global-dimension-${l})`:"0";return s("div",{css:C`
        position: relative;
        .copy-to-clipboard-button {
          transition: opacity 0.2s ease-in-out;
          opacity: 0;
          position: absolute;
          right: ${t};
          top: ${t};
          z-index: 1;
        }
        &:hover .copy-to-clipboard-button {
          opacity: 1;
        }
      `,children:[e(X,{text:n}),a]})}function Qe({children:n}){const{theme:a}=Hn(),l=a==="light"?void 0:pa,{value:t,mimeType:i}=u.useMemo(()=>{try{return{value:JSON.stringify(JSON.parse(n),null,2),mimeType:"json"}}catch{return{value:n,mimeType:"text"}}},[n]);return i==="json"?e(ga,{value:t,basicSetup:{lineNumbers:!0,foldGutter:!0,bracketMatching:!0,syntaxHighlighting:!0,highlightActiveLine:!1,highlightActiveLineGutter:!1},extensions:[qs(),Bs.lineWrapping],editable:!1,theme:l,css:ac}):e(Qt,{children:t})}function Qt({children:n}){return e("pre",{css:C`
        white-space: pre-wrap;
        padding: 0;
      `,children:n})}function Ne({value:n,mimeType:a}){let l;switch(a){case"json":l=e(Qe,{children:n});break;case"text":l=e(Gn,{children:n});break;default:be()}return l}function lc({text:n}){return s(h,{direction:"column",alignItems:"center",flex:"1 1 auto",height:"size-2400",justifyContent:"center",gap:"size-100",children:[e(ua,{graphicKey:"documents"}),e(F,{children:n})]})}function tc({events:n}){return n.length===0?e(lc,{text:"No events"}):e(Rl,{children:n.map((a,l)=>{const t=a.name==="exception";return e(wl,{children:s(h,{direction:"row",alignItems:"center",gap:"size-100",children:[e(x,{flex:"none",children:e("div",{"data-event-type":t?"exception":"info",css:i=>C`
                    &[data-event-type="exception"] {
                      --px-event-icon-color: ${i.colors.statusDanger};
                    }
                    &[data-event-type="info"] {
                      --px-event-icon-color: ${i.colors.statusInfo};
                    }
                    .ac-icon-wrap {
                      color: var(--px-event-icon-color);
                    }
                  `,children:e(P,{svg:t?e(E.AlertTriangleOutline,{}):e(E.InfoOutline,{})})})}),s(h,{direction:"column",gap:"size-25",flex:"1 1 auto",children:[e(F,{weight:"heavy",children:a.name}),e(F,{color:"text-700",children:a.message})]}),e(x,{children:e(F,{color:"text-700",children:new Date(a.timestamp).toLocaleString()})})]})},l)})})}const Ot=e(h,{alignItems:"center",justifyContent:"center",children:e(x,{marginStart:"size-100",children:s(Pn,{children:[e(te,{weight:"heavy",level:4,children:"Span Attributes"}),e(Rn,{children:e(F,{children:"Attributes are key-value pairs that represent metadata associated with a span. For detailed descriptions of specific attributes, consult the semantic conventions section of the OpenInference tracing specification."})}),e("footer",{children:e(dn,{href:"https://github.com/Arize-ai/openinference/blob/main/spec/semantic_conventions.md",children:"Semantic Conventions"})})]})})}),Ya="selectedSpanNodeId";function ic(n){const a=n.find(i=>i.parentId==null);if(a)return a;const l=new Set(n.map(i=>i.context.spanId)),t=n.filter(i=>i.parentId!=null&&!l.has(i.parentId));return t.length===1?t[0]:null}function jt(n){const{traceId:a,projectId:l}=n,[t,i]=ol(),r=T.useLazyLoadQuery(Ct,{traceId:a,id:l},{fetchPolicy:"store-and-network"}),o=u.useMemo(()=>{var g;return(((g=r.project.trace)==null?void 0:g.spans.edges)||[]).map(p=>p.span)},[r]),d=t.get(Ya)??o[0].id,m=u.useMemo(()=>ic(o),[o]);return u.useEffect(()=>()=>{i(f=>(f.delete("spanNodeId"),f),{replace:!0})},[]),s("main",{css:C`
        flex: 1 1 auto;
        overflow: hidden;
        display: flex;
        flex-direction: column;
      `,children:[e(rc,{rootSpan:m}),s(sn,{direction:"horizontal",autoSaveId:"trace-panel-group",css:C`
          flex: 1 1 auto;
          overflow: hidden;
        `,children:[e(ce,{defaultSize:30,minSize:10,maxSize:70,children:e(oc,{children:e(ys,{spans:o,selectedSpanNodeId:d,onSpanClick:f=>{i(g=>(g.set(Ya,f.id),g),{replace:!0})}})})}),e(on,{css:_n}),e(ce,{children:e(sc,{children:d?e(u.Suspense,{fallback:e(se,{}),children:e(Nd,{spanNodeId:d,projectId:l})}):null})})]})]})}function rc({rootSpan:n}){const{latencyMs:a,statusCode:l,spanAnnotations:t}=n??{latencyMs:null,statusCode:"UNSET",spanAnnotations:[]},i=t.length>0,r=vl(l);return e(x,{padding:"size-200",borderBottomWidth:"thin",borderBottomColor:"dark",children:s(h,{direction:"row",gap:"size-400",children:[s(h,{direction:"column",children:[e(F,{elementType:"h3",textSize:"medium",color:"text-700",children:"Trace Status"}),e(F,{textSize:"xlarge",children:s(h,{direction:"row",gap:"size-50",alignItems:"center",children:[e(sa,{statusCode:l}),e(F,{textSize:"xlarge",color:r,children:l})]})})]}),s(h,{direction:"column",children:[e(F,{elementType:"h3",textSize:"medium",color:"text-700",children:"Latency"}),e(F,{textSize:"xlarge",children:typeof a=="number"?e(xe,{latencyMs:a,textSize:"xlarge"}):"--"})]}),i?s(h,{direction:"column",gap:"size-50",children:[e(F,{elementType:"h3",textSize:"medium",color:"text-700",children:"Feedback"}),e(h,{direction:"row",gap:"size-50",children:t.map(o=>e(Un,{annotation:o,children:e(pn,{annotation:o,annotationDisplayPreference:"label"})},o.name))})]}):null]})})}function sc({children:n}){return e("div",{"data-testid":"scrolling-tabs-wrapper",css:C`
        height: 100%;
        overflow: hidden;
        .ac-tabs {
          height: 100%;
          overflow: hidden;
          .ac-tabs__extra {
            width: 100%;
            padding-right: var(--ac-global-dimension-size-200);
            padding-bottom: var(--ac-global-dimension-size-50);
          }
          .ac-tabs__pane-container {
            min-height: 100%;
            height: 100%;
            overflow-y: auto;
            div[role="tabpanel"] {
              height: 100%;
            }
          }
        }
      `,children:n})}function oc({children:n}){return e("div",{"data-testid":"scrolling-panel-content",css:C`
        height: 100%;
        overflow-y: auto;
      `,children:n})}function Im(){const{traceId:n,projectId:a}=je(),l=ae();return e(U,{type:"slideOver",isDismissable:!0,onDismiss:()=>l(`/projects/${a}`),children:e(j,{size:"fullscreen",title:"Trace Details",children:e(jt,{traceId:n,projectId:a})})})}const qt=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},m={alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},f={alias:null,args:null,kind:"ScalarField",name:"latencyMs",storageKey:null},g={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},v={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},b=[{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,m,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},g,{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,v,{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"descendants",plural:!0,selections:[t,c,i,d,m,f,g,{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:b,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:b,storageKey:null},y,k,v],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(
  $id: GlobalID!
  $timeRange: TimeRange!
) {
  project: node(id: $id) {
    __typename
    ...TracesTable_spans
    ...ProjectPageHeader_stats
    ...StreamToggle_data
    __isNode: __typename
    id
  }
}

fragment ProjectPageHeader_stats on Project {
  traceCount(timeRange: $timeRange)
  tokenCountTotal(timeRange: $timeRange)
  latencyMsP50: latencyMsQuantile(probability: 0.5, timeRange: $timeRange)
  latencyMsP99: latencyMsQuantile(probability: 0.99, timeRange: $timeRange)
  spanAnnotationNames
  documentEvaluationNames
  id
}

fragment SpanColumnSelector_annotations on Project {
  spanAnnotationNames
}

fragment StreamToggle_data on Project {
  streamingLastUpdatedAt
  id
}

fragment TracesTable_spans on Project {
  name
  ...SpanColumnSelector_annotations
  rootSpans: spans(first: 50, sort: {col: startTime, dir: desc}, rootSpansOnly: true, timeRange: $timeRange) {
    edges {
      rootSpan: node {
        id
        spanKind
        name
        metadata
        statusCode: propagatedStatusCode
        startTime
        latencyMs
        cumulativeTokenCountTotal
        cumulativeTokenCountPrompt
        cumulativeTokenCountCompletion
        parentId
        input {
          value: truncatedValue
        }
        output {
          value: truncatedValue
        }
        context {
          spanId
          traceId
        }
        spanAnnotations {
          name
          label
          score
          annotatorKind
        }
        documentRetrievalMetrics {
          evaluationName
          ndcg
          precision
          hit
        }
        descendants {
          id
          spanKind
          name
          statusCode: propagatedStatusCode
          startTime
          latencyMs
          parentId
          cumulativeTokenCountTotal: tokenCountTotal
          cumulativeTokenCountPrompt: tokenCountPrompt
          cumulativeTokenCountCompletion: tokenCountCompletion
          input {
            value
          }
          output {
            value
          }
          context {
            spanId
            traceId
          }
          spanAnnotations {
            name
            label
            score
            annotatorKind
          }
          documentRetrievalMetrics {
            evaluationName
            ndcg
            precision
            hit
          }
        }
      }
      cursor
      node {
        __typename
      }
    }
    pageInfo {
      endCursor
      hasNextPage
    }
  }
  id
}
`}}}();qt.hash="e2d168c52b9c1b5fd5543286f4d2786c";const Bt=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:"Literal",name:"first",value:50},{kind:"Literal",name:"sort",value:{col:"startTime",dir:"desc"}},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],o=[{alias:"value",args:null,kind:"ScalarField",name:"truncatedValue",storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ProjectPageSpansQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"SpansTable_spans"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ProjectPageSpansQuery",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:null,args:r,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:[t,{alias:null,args:null,kind:"ScalarField",name:"spanKind",storageKey:null},i,{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:o,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:o,storageKey:null},{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},{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:[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:null,args:r,filters:["sort","filterCondition","timeRange"],handle:"connection",key:"SpansTable_spans",kind:"LinkedHandle",name:"spans"}],type:"Project",abstractKey:null}],storageKey:null}]},params:{cacheID:"09e4f18ba3f2a63560f542088a4329ff",id:null,metadata:{},name:"ProjectPageSpansQuery",operationKind:"query",text:`query ProjectPageSpansQuery(
  $id: GlobalID!
  $timeRange: TimeRange!
) {
  project: node(id: $id) {
    __typename
    ...SpansTable_spans
    __isNode: __typename
    id
  }
}

fragment SpanColumnSelector_annotations on Project {
  spanAnnotationNames
}

fragment SpansTable_spans on Project {
  name
  ...SpanColumnSelector_annotations
  spans(first: 50, sort: {col: startTime, dir: desc}, timeRange: $timeRange) {
    edges {
      span: node {
        id
        spanKind
        name
        metadata
        statusCode
        startTime
        latencyMs
        tokenCountTotal
        tokenCountPrompt
        tokenCountCompletion
        context {
          spanId
          traceId
        }
        input {
          value: truncatedValue
        }
        output {
          value: truncatedValue
        }
        spanAnnotations {
          name
          label
          score
          annotatorKind
        }
        documentRetrievalMetrics {
          evaluationName
          ndcg
          precision
          hit
        }
      }
      cursor
      node {
        __typename
      }
    }
    pageInfo {
      endCursor
      hasNextPage
    }
  }
  id
}
`}}}();Bt.hash="18fe45fad1c124d8c29cdcabf463a213";const Ht=function(){var n={defaultValue:null,kind:"LocalArgument",name:"id"},a={defaultValue:null,kind:"LocalArgument",name:"timeRange"},l=[{kind:"Variable",name:"id",variableName:"id"}],t={kind:"Variable",name:"timeRange",variableName:"timeRange"},i=[t];return{fragment:{argumentDefinitions:[n,a],kind:"Fragment",metadata:null,name:"ProjectPageHeaderQuery",selections:[{alias:null,args:l,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"ProjectPageHeader_stats"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,n],kind:"Operation",name:"ProjectPageHeaderQuery",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"},{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{kind:"InlineFragment",selections:[{alias:null,args:i,kind:"ScalarField",name:"traceCount",storageKey:null},{alias:null,args:i,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},{alias:"latencyMsP50",args:[{kind:"Literal",name:"probability",value:.5},t],kind:"ScalarField",name:"latencyMsQuantile",storageKey:null},{alias:"latencyMsP99",args:[{kind:"Literal",name:"probability",value:.99},t],kind:"ScalarField",name:"latencyMsQuantile",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"spanAnnotationNames",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"documentEvaluationNames",storageKey:null}],type:"Project",abstractKey:null}],storageKey:null}]},params:{cacheID:"264a748e3bb636d71fb6b75523a612fe",id:null,metadata:{},name:"ProjectPageHeaderQuery",operationKind:"query",text:`query ProjectPageHeaderQuery(
  $timeRange: TimeRange
  $id: GlobalID!
) {
  node(id: $id) {
    __typename
    ...ProjectPageHeader_stats
    __isNode: __typename
    id
  }
}

fragment ProjectPageHeader_stats on Project {
  traceCount(timeRange: $timeRange)
  tokenCountTotal(timeRange: $timeRange)
  latencyMsP50: latencyMsQuantile(probability: 0.5, timeRange: $timeRange)
  latencyMsP99: latencyMsQuantile(probability: 0.99, timeRange: $timeRange)
  spanAnnotationNames
  documentEvaluationNames
  id
}
`}}}();Ht.hash="dcce9d160db90e2b5c51eef9971101a4";const Gt=function(){var n={kind:"Variable",name:"timeRange",variableName:"timeRange"},a=[n];return{argumentDefinitions:[{kind:"RootArgument",name:"timeRange"}],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:["node"],operation:Ht,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"ProjectPageHeader_stats",selections:[{alias:null,args:a,kind:"ScalarField",name:"traceCount",storageKey:null},{alias:null,args:a,kind:"ScalarField",name:"tokenCountTotal",storageKey:null},{alias:"latencyMsP50",args:[{kind:"Literal",name:"probability",value:.5},n],kind:"ScalarField",name:"latencyMsQuantile",storageKey:null},{alias:"latencyMsP99",args:[{kind:"Literal",name:"probability",value:.99},n],kind:"ScalarField",name:"latencyMsQuantile",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"spanAnnotationNames",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"documentEvaluationNames",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],type:"Project",abstractKey:null}}();Gt.hash="dcce9d160db90e2b5c51eef9971101a4";const Ut=u.createContext(null);function Mn(){const n=Te.useContext(Ut);if(n===null)throw new Error("useStreamState must be used within a StreamStateProvider");return n}function dc({initialFetchKey:n="initial",children:a}){const l=un(c=>c.traceStreamingEnabled),t=un(c=>c.setTraceStreamingEnabled),[i,r]=u.useState(n),o=u.useCallback(c=>{u.startTransition(()=>{r(c)})},[r]);return e(Ut.Provider,{value:{isStreaming:l,setIsStreaming:t,fetchKey:i,setFetchKey:o},children:a})}const Wt=function(){var n={defaultValue:null,kind:"LocalArgument",name:"annotationName"},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:"annotationName",variableName:"annotationName"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}];return{fragment:{argumentDefinitions:[n,a,l],kind:"Fragment",metadata:null,name:"AnnotationSummaryValueQuery",selections:[{alias:null,args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:i,kind:"FragmentSpread",name:"AnnotationSummaryValueFragment"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[n,l,a],kind:"Operation",name:"AnnotationSummaryValueQuery",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:"AnnotationSummary",kind:"LinkedField",name:"spanAnnotationSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"LabelFraction",kind:"LinkedField",name:"labelFractions",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"fraction",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"meanScore",storageKey:null}],storageKey:null}],type:"Project",abstractKey:null}],storageKey:null}]},params:{cacheID:"bae90b7000aa37d37050070d8504b41c",id:null,metadata:{},name:"AnnotationSummaryValueQuery",operationKind:"query",text:`query AnnotationSummaryValueQuery(
  $annotationName: String!
  $timeRange: TimeRange!
  $id: GlobalID!
) {
  node(id: $id) {
    __typename
    ...AnnotationSummaryValueFragment_4BTVrq
    __isNode: __typename
    id
  }
}

fragment AnnotationSummaryValueFragment_4BTVrq on Project {
  spanAnnotationSummary(annotationName: $annotationName, timeRange: $timeRange) {
    labelFractions {
      label
      fraction
    }
    meanScore
  }
  id
}
`}}}();Wt.hash="0a8e190e4d87acc87c161366f330e3af";const Jt={argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"annotationName"},{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:["node"],operation:Wt,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"AnnotationSummaryValueFragment",selections:[{alias:null,args:[{kind:"Variable",name:"annotationName",variableName:"annotationName"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],concreteType:"AnnotationSummary",kind:"LinkedField",name:"spanAnnotationSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"LabelFraction",kind:"LinkedField",name:"labelFractions",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"fraction",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"meanScore",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],type:"Project",abstractKey:null};Jt.hash="0a8e190e4d87acc87c161366f330e3af";const Zt=function(){var n={defaultValue:null,kind:"LocalArgument",name:"annotationName"},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:"annotationName",variableName:"annotationName"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}];return{fragment:{argumentDefinitions:[n,a,l],kind:"Fragment",metadata:null,name:"AnnotationSummaryQuery",selections:[{alias:"project",args:t,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:i,kind:"FragmentSpread",name:"AnnotationSummaryValueFragment"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[a,n,l],kind:"Operation",name:"AnnotationSummaryQuery",selections:[{alias:"project",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:"AnnotationSummary",kind:"LinkedField",name:"spanAnnotationSummary",plural:!1,selections:[{alias:null,args:null,concreteType:"LabelFraction",kind:"LinkedField",name:"labelFractions",plural:!0,selections:[{alias:null,args:null,kind:"ScalarField",name:"label",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"fraction",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"meanScore",storageKey:null}],storageKey:null}],type:"Project",abstractKey:null}],storageKey:null}]},params:{cacheID:"88dfad5d25db7e03286a789f3ba37c75",id:null,metadata:{},name:"AnnotationSummaryQuery",operationKind:"query",text:`query AnnotationSummaryQuery(
  $id: GlobalID!
  $annotationName: String!
  $timeRange: TimeRange!
) {
  project: node(id: $id) {
    __typename
    ...AnnotationSummaryValueFragment_4BTVrq
    __isNode: __typename
    id
  }
}

fragment AnnotationSummaryValueFragment_4BTVrq on Project {
  spanAnnotationSummary(annotationName: $annotationName, timeRange: $timeRange) {
    labelFractions {
      label
      fraction
    }
    meanScore
  }
  id
}
`}}}();Zt.hash="6a15ba35fe9e1e35aa4c517ab6309a2b";function cc({annotationName:n}){const{projectId:a}=je(),{timeRange:l}=oa(),t=T.useLazyLoadQuery(Zt,{annotationName:n,id:a,timeRange:{start:l.start.toISOString(),end:l.end.toISOString()}});return s(h,{direction:"column",flex:"none",children:[e(F,{elementType:"h3",textSize:"medium",color:"text-700",children:n}),e(u.Suspense,{fallback:e(F,{textSize:"xlarge",children:"--"}),children:e(uc,{annotationName:n,project:t.project})})]})}function uc(n){var y,k;const{project:a,annotationName:l}=n,{fetchKey:t}=Mn(),[i,r]=T.useRefetchableFragment(Jt,a);u.useEffect(()=>{u.startTransition(()=>{r({},{fetchPolicy:"store-and-network"})})},[t,r]);const o=$e(),d=[Kl(l),o.default,o.gray600,o.gray400,o.gray200],m=(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,g=typeof m=="number",p=Array.isArray(f)&&f.length>0;return!g&&!p?e(F,{textSize:"xlarge",children:"--"}):s(Fe,{delay:0,placement:"bottom",children:[e(Kn,{children:s(h,{direction:"row",alignItems:"center",gap:"size-50",children:[p?e(Qs,{width:24,height:24,children:e(Os,{data:f,dataKey:"fraction",nameKey:"label",cx:"50%",cy:"50%",innerRadius:8,outerRadius:11,strokeWidth:0,stroke:"transparent",children:f.map((v,b)=>e(js,{fill:d[b%d.length]},`cell-${b}`))})}):null,e(F,{textSize:"xlarge",children:g?_e(m):"--"})]})}),e(Jn,{children:e(x,{width:"size-2400",children:s(h,{direction:"column",gap:"size-50",children:[p&&e("ul",{children:f.map((v,b)=>e("li",{children:e(re,{color:d[b%d.length],name:v.label,shape:"square",value:xl(v.fraction*100)})},v.label))}),p&&g?e(ra,{}):null,g?s(h,{direction:"row",justifyContent:"space-between",children:[e(F,{children:"mean"}),e(F,{children:_e(m)})]}):null]})})})]})}const Xt=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(
  $evaluationName: String!
  $timeRange: TimeRange!
  $id: GlobalID!
) {
  node(id: $id) {
    __typename
    ...DocumentEvaluationSummaryValueFragment_1dJL9N
    __isNode: __typename
    id
  }
}

fragment DocumentEvaluationSummaryValueFragment_1dJL9N on Project {
  documentEvaluationSummary(evaluationName: $evaluationName, timeRange: $timeRange) {
    averageNdcg
    averagePrecision
    meanReciprocalRank
    hitRate
  }
  id
}
`}}}();Xt.hash="15d0652aa260c80f62acec943f615d93";const Yt={argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"evaluationName"},{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:["node"],operation:Xt,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"DocumentEvaluationSummaryValueFragment",selections:[{alias:null,args:[{kind:"Variable",name:"evaluationName",variableName:"evaluationName"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],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},{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],type:"Project",abstractKey:null};Yt.hash="15d0652aa260c80f62acec943f615d93";const ei=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"evaluationName"},{defaultValue:null,kind:"LocalArgument",name:"id"},{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l=[{kind:"Variable",name:"evaluationName",variableName:"evaluationName"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"DocumentEvaluationSummaryQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:l,kind:"FragmentSpread",name:"DocumentEvaluationSummaryValueFragment"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"DocumentEvaluationSummaryQuery",selections:[{alias:"project",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:l,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:"3ebd1cf66ef8f31c995ec6aae6505e94",id:null,metadata:{},name:"DocumentEvaluationSummaryQuery",operationKind:"query",text:`query DocumentEvaluationSummaryQuery(
  $evaluationName: String!
  $id: GlobalID!
  $timeRange: TimeRange!
) {
  project: node(id: $id) {
    __typename
    ...DocumentEvaluationSummaryValueFragment_1dJL9N
    __isNode: __typename
    id
  }
}

fragment DocumentEvaluationSummaryValueFragment_1dJL9N on Project {
  documentEvaluationSummary(evaluationName: $evaluationName, timeRange: $timeRange) {
    averageNdcg
    averagePrecision
    meanReciprocalRank
    hitRate
  }
  id
}
`}}}();ei.hash="4d50474ffa9b9e4a68d07f6e0777c144";function mc({evaluationName:n}){const{projectId:a}=je(),{timeRange:l}=oa(),t=T.useLazyLoadQuery(ei,{id:a,evaluationName:n,timeRange:{start:l.start.toISOString(),end:l.end.toISOString()}});return s(h,{direction:"column",flex:"none",children:[e(F,{elementType:"h3",textSize:"medium",color:"text-700",children:n}),e(u.Suspense,{fallback:e(F,{textSize:"xlarge",children:"--"}),children:e(gc,{evaluationName:n,project:t==null?void 0:t.project})})]})}function gc(n){var m,f,g,p;const{project:a}=n,{fetchKey:l}=Mn(),[t,i]=T.useRefetchableFragment(Yt,a);u.useEffect(()=>{u.startTransition(()=>{i({},{fetchPolicy:"store-and-network"})})},[l,i]);const r=(m=t==null?void 0:t.documentEvaluationSummary)==null?void 0:m.averageNdcg,o=(f=t==null?void 0:t.documentEvaluationSummary)==null?void 0:f.averagePrecision,c=(g=t==null?void 0:t.documentEvaluationSummary)==null?void 0:g.hitRate,d=(p=t==null?void 0:t.documentEvaluationSummary)==null?void 0:p.meanReciprocalRank;return s(Fe,{delay:0,placement:"bottom",children:[e(Kn,{children:e(h,{direction:"row",alignItems:"center",gap:"size-50",height:"28px",children:s(H,{children:[e(he,{metric:"ndcg",score:r},"ndcg"),e(he,{metric:"precision",score:o},"precision"),e(he,{metric:"hit rate",score:c},"hit")]})})}),e(Jn,{children:e(x,{width:"size-2400",children:s(h,{direction:"column",children:[s(h,{justifyContent:"space-between",children:[e(F,{children:"average ndcg"}),e(F,{children:typeof r=="number"?_e(r):"--"})]}),s(h,{justifyContent:"space-between",children:[e(F,{children:"average precision"}),e(F,{children:typeof o=="number"?_e(o):"--"})]}),s(h,{justifyContent:"space-between",children:[e(F,{children:"mean reciprocal rank"}),e(F,{children:typeof d=="number"?_e(d):"--"})]}),s(h,{justifyContent:"space-between",children:[e(F,{children:"hit rate"}),e(F,{children:typeof c=="number"?_e(c):"--"})]})]})})})]})}function pc(n){const{extra:a}=n,{fetchKey:l}=Mn(),[t,i]=T.useRefetchableFragment(Gt,n.project);u.useEffect(()=>{u.startTransition(()=>{i({},{fetchPolicy:"store-and-network"})})},[l,i]);const r=t==null?void 0:t.latencyMsP50,o=t==null?void 0:t.latencyMsP99,c=t==null?void 0:t.tokenCountTotal,d=t==null?void 0:t.spanAnnotationNames,m=t==null?void 0:t.documentEvaluationNames;return e(x,{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("div",{css:C`
            overflow-x: auto;
            overflow-y: hidden;
            flex: 1 1 auto;
            background-image: linear-gradient(
                to right,
                var(--ac-global-color-grey-75),
                var(--ac-global-color-grey-75)
              ),
              linear-gradient(
                to right,
                var(--ac-global-color-grey-75),
                var(--ac-global-color-grey-75)
              ),
              linear-gradient(
                to right,
                rgba(var(--ac-global-color-grey-300-rgb), 0.9),
                rgba(var(--ac-global-color-grey-300-rgb), 0)
              ),
              linear-gradient(
                to left,
                rgba(var(--ac-global-color-grey-300-rgb), 0.9),
                rgba(var(--ac-global-color-grey-300-rgb), 0)
              );
            background-repeat: no-repeat;
            background-size:
              32px 100%,
              32px 100%,
              32px 100%,
              32px 100%;
            background-position:
              left center,
              right center,
              left center,
              right center;
            background-attachment: local, local, scroll, scroll;
          `,children:s(h,{direction:"row",gap:"size-400",alignItems:"center",children:[s(h,{direction:"column",flex:"none",children:[e(F,{elementType:"h3",textSize:"medium",color:"text-700",children:"Total Traces"}),e(F,{textSize:"xlarge",children:cn(t==null?void 0:t.traceCount)})]}),s(h,{direction:"column",flex:"none",children:[e(F,{elementType:"h3",textSize:"medium",color:"text-700",children:"Total Tokens"}),e(F,{textSize:"xlarge",children:cn(c)})]}),s(h,{direction:"column",flex:"none",children:[e(F,{elementType:"h3",textSize:"medium",color:"text-700",children:"Latency P50"}),r!=null?e(xe,{latencyMs:r,textSize:"xlarge"}):e(F,{textSize:"xlarge",children:"--"})]}),s(h,{direction:"column",flex:"none",children:[e(F,{elementType:"h3",textSize:"medium",color:"text-700",children:"Latency P99"}),o!=null?e(xe,{latencyMs:o,textSize:"xlarge"}):e(F,{textSize:"xlarge",children:"--"})]}),d.map(f=>e(cc,{annotationName:f},f)),m.map(f=>e(mc,{evaluationName:f},`document-${f}`))]})}),e(x,{flex:"none",paddingStart:"size-100",children:a})]})})}const ni=u.createContext(null);function ai(){const n=u.useContext(ni);if(n===null)throw new Error("useSpanFilterCondition must be used within a SpanFilterConditionProvider");return n}function el(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 li=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"},m={kind:"Variable",name:"first",variableName:"first"},f={kind:"Variable",name:"sort",variableName:"sort"},g={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,m,f,{kind:"Variable",name:"timeRange",variableName:"timeRange"}],v=[{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,m,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:[g,{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:v,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:v,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:[g],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(
  $after: String = null
  $filterCondition: String = null
  $first: Int = 50
  $sort: SpanSort = {col: startTime, dir: desc}
  $timeRange: TimeRange
  $id: GlobalID!
) {
  node(id: $id) {
    __typename
    ...SpansTable_spans_1XEuU
    __isNode: __typename
    id
  }
}

fragment SpanColumnSelector_annotations on Project {
  spanAnnotationNames
}

fragment SpansTable_spans_1XEuU on Project {
  name
  ...SpanColumnSelector_annotations
  spans(first: $first, after: $after, sort: $sort, filterCondition: $filterCondition, timeRange: $timeRange) {
    edges {
      span: node {
        id
        spanKind
        name
        metadata
        statusCode
        startTime
        latencyMs
        tokenCountTotal
        tokenCountPrompt
        tokenCountCompletion
        context {
          spanId
          traceId
        }
        input {
          value: truncatedValue
        }
        output {
          value: truncatedValue
        }
        spanAnnotations {
          name
          label
          score
          annotatorKind
        }
        documentRetrievalMetrics {
          evaluationName
          ndcg
          precision
          hit
        }
      }
      cursor
      node {
        __typename
      }
    }
    pageInfo {
      endCursor
      hasNextPage
    }
  }
  id
}
`}}}();li.hash="4827989f55b1c0bd269253b6bc977439";const ti=function(){var n=["spans"],a={alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t=[{alias:"value",args:null,kind:"ScalarField",name:"truncatedValue",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:li,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"SpansTable_spans",selections:[a,{args:null,kind:"FragmentSpread",name:"SpanColumnSelector_annotations"},{alias:"spans",args:[{kind:"Variable",name:"filterCondition",variableName:"filterCondition"},{kind:"Variable",name:"sort",variableName:"sort"},{kind:"Variable",name:"timeRange",variableName:"timeRange"}],concreteType:"SpanConnection",kind:"LinkedField",name:"__SpansTable_spans_connection",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:[l,{alias:null,args:null,kind:"ScalarField",name:"spanKind",storageKey:null},a,{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:t,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:t,storageKey:null},{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},{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:[{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}}();ti.hash="4827989f55b1c0bd269253b6bc977439";const ii=u.createContext(null);function yc({children:n,...a}){const l=u.useRef();return l.current||(l.current=fs(a)),e(ii.Provider,{value:l.current,children:n})}function Oe(n,a){const l=Te.useContext(ii);if(!l)throw new Error("Missing TracingContext.Provider in the tree");return dl(l,n,a)}function ri(n){const{appendFilterCondition:a}=ai(),{annotation:l}=n,{name:t,label:i,score:r}=l,o=u.useMemo(()=>{const c=[];return i!=null&&(c.push({filterName:"Match label",filterCondition:`annotations['${t}'].label == "${i}"`}),c.push({filterName:"Exclude label",filterCondition:`annotations['${t}'].label != "${i}"`})),typeof r=="number"&&(c.push({filterName:"Greater than score",filterCondition:`annotations['${t}'].score > ${r}`}),c.push({filterName:"Less than score",filterCondition:`annotations['${t}'].score < ${r}`}),c.push({filterName:"Equals score",filterCondition:`annotations['${t}'].score == ${r}`})),c},[t,i,r]);return s(x,{borderStartWidth:"thin",borderColor:"dark",paddingStart:"size-200",paddingEnd:"size-100",marginStart:"size-200",width:300,children:[e(F,{textSize:"large",weight:"heavy",children:"Filters"}),e("ul",{css:C`
          display: flex;
          flex-direction: row;
          gap: var(--ac-global-dimension-size-100);
          color: var(--ac-global-color-primary);
          padding: var(--ac-global-dimension-size-100) 0;
          flex-wrap: wrap;
        `,children:o.map(c=>e("li",{children:e(fc,{onClick:()=>{a(c.filterCondition)},children:c.filterName})},c.filterName))})]})}function fc({onClick:n,children:a}){return e("button",{onClick:l=>{l.preventDefault(),l.stopPropagation(),n()},className:"button--reset",css:C`
        color: var(--ac-global-text-color-900);
        border: 1px solid var(--ac-global-color-gray-200);
        border-radius: 4px;
        padding: var(--ac-global-dimension-size-50)
          var(--ac-global-dimension-size-100);
        cursor: pointer;
        transition: background-color 0.2s;
        &:hover {
          background-color: var(--ac-global-color-gray-300);
        }
      `,children:a})}function hc({projectName:n}){const[a,l]=u.useState("Python");return e(j,{title:"Send Traces to this Project",size:"L",children:s(x,{padding:"size-400",overflow:"auto",children:[e(x,{paddingBottom:"size-100",children:e(Dl,{language:a,onChange:l})}),a==="Python"?e(Tl,{projectName:n}):e(Il,{projectName:n})]})})}function si({projectName:n}){const[a,l]=u.useState(null),t=()=>{l(e(hc,{projectName:n}))};return s("tbody",{className:"is-empty",children:[e("tr",{children:e("td",{colSpan:100,css:i=>C`
            text-align: center;
            padding: ${i.spacing.margin24}px ${i.spacing.margin24}px !important;
          `,children:s(h,{direction:"column",gap:"size-200",alignItems:"center",children:["No traces found for this project",e(N,{variant:"default",icon:e(P,{svg:e(E.PlayCircleOutline,{})}),onClick:t,children:"Get Started"})]})})}),e(U,{onDismiss:()=>l(null),isDismissable:!0,type:"slideOver",children:a})]})}const oi={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SpanColumnSelector_annotations",selections:[{alias:null,args:null,kind:"ScalarField",name:"spanAnnotationNames",storageKey:null}],type:"Project",abstractKey:null};oi.hash="ad01e6897ad1ea779eb346d85783b8b4";const kc=["spanKind","name"];function di(n){return e(za,{menu:e(bc,{...n}),triggerProps:{placement:"bottom end"},children:s(h,{direction:"row",alignItems:"center",gap:"size-100",children:[e(P,{svg:e(E.Column,{})}),"Columns"]})})}const ta=C`
  padding: var(--ac-global-dimension-static-size-50)
    var(--ac-global-dimension-static-size-100);
  label {
    display: flex;
    align-items: center;
    gap: var(--ac-global-dimension-static-size-100);
  }
`;function bc(n){const{columns:a}=n,l=Oe(d=>d.columnVisibility),t=Oe(d=>d.setColumnVisibility),i=u.useMemo(()=>a.filter(d=>!kc.includes(d.id)),[a]),r=u.useMemo(()=>i.every(d=>{const m=l[d.id];return m??!0}),[i,l]),o=u.useCallback(d=>{const{name:m,checked:f}=d.target;t({...l,[m]:f})},[l,t]),c=u.useCallback(d=>{const{checked:m}=d.target,f=i.reduce((g,p)=>({...g,[p.id]:m}),{});t(f)},[i,t]);return e("div",{css:C`
        overflow-y: auto;
        max-height: calc(100vh - 200px);
      `,children:s(x,{paddingTop:"size-50",paddingBottom:"size-50",children:[e(x,{borderBottomColor:"dark",borderBottomWidth:"thin",paddingBottom:"size-50",children:e("div",{css:ta,children:s("label",{children:[e("input",{type:"checkbox",name:"toggle-all",checked:r,onChange:c}),"span columns"]})})}),e("ul",{children:i.map(d=>{const m=l[d.id],f=m??!0,g=typeof d.columnDef.header=="string"?d.columnDef.header:d.id;return e("li",{css:ta,children:s("label",{children:[e("input",{type:"checkbox",name:d.id,checked:f,onChange:o}),g]})},d.id)})}),e(Sc,{...n})]})})}function Sc({query:n}){const a=T.useFragment(oi,n),l=Oe(o=>o.annotationColumnVisibility),t=Oe(o=>o.setAnnotationColumnVisibility),i=u.useMemo(()=>a.spanAnnotationNames.every(o=>l[o]||!1),[a.spanAnnotationNames,l]),r=u.useCallback(()=>{const o=a.spanAnnotationNames.reduce((c,d)=>({...c,[d]:!i}),{});t(o)},[a.spanAnnotationNames,t,i]);return s("section",{children:[e(x,{paddingTop:"size-50",paddingBottom:"size-50",borderColor:"dark",borderTopWidth:"thin",borderBottomWidth:"thin",children:e("div",{css:ta,children:s("label",{children:[e("input",{type:"checkbox",name:"toggle-evaluations-all",checked:i,onChange:r}),"feedback"]})})}),e("ul",{children:a.spanAnnotationNames.map(o=>{const c=l[o]??!1;return e("li",{css:ta,children:s("label",{children:[e("input",{type:"checkbox",name:o,checked:c,onChange:()=>{t({...l,[o]:!c})}}),o]})},o)})})]})}const ci=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"condition"},{defaultValue:null,kind:"LocalArgument",name:"id"}],a=[{kind:"Variable",name:"id",variableName:"id"}],l={kind:"InlineFragment",selections:[{alias:null,args:[{kind:"Variable",name:"condition",variableName:"condition"}],concreteType:"ValidationResult",kind:"LinkedField",name:"validateSpanFilterCondition",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"isValid",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"errorMessage",storageKey:null}],storageKey:null}],type:"Project",abstractKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"SpanFilterConditionFieldValidationQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"SpanFilterConditionFieldValidationQuery",selections:[{alias:"project",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},l,{kind:"TypeDiscriminator",abstractKey:"__isNode"},{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],storageKey:null}]},params:{cacheID:"29583e7ec666cef832dc7effb9e75678",id:null,metadata:{},name:"SpanFilterConditionFieldValidationQuery",operationKind:"query",text:`query SpanFilterConditionFieldValidationQuery(
  $condition: String!
  $id: GlobalID!
) {
  project: node(id: $id) {
    __typename
    ... on Project {
      validateSpanFilterCondition(condition: $condition) {
        isValid
        errorMessage
      }
    }
    __isNode: __typename
    id
  }
}
`}}}();ci.hash="22836f192038b0c40201d3b25aad65b4";const ui=C`
  flex: 1 1 auto;
  .cm-content {
    padding: var(--ac-global-dimension-static-size-100) 0;
  }
  .cm-editor {
    background-color: transparent;
  }
  .cm-focused {
    outline: none;
  }
  .cm-selectionLayer .cm-selectionBackground {
    background: var(--ac-global-color-cyan-400) !important;
  }
`,mi=C`
  border-width: var(--ac-global-border-size-thin);
  border-style: solid;
  border-color: var(--ac-global-input-field-border-color);
  border-radius: var(--ac-global-rounding-small);
  background-color: var(--ac-global-input-field-background-color);
  transition: all 0.2s ease-in-out;
  overflow-x: hidden;
  &:hover,
  &[data-is-focused="true"] {
    border-color: var(--ac-global-input-field-border-color-active);
    background-color: var(--ac-global-input-field-background-color-active);
  }
  &[data-is-invalid="true"] {
    border-color: var(--ac-global-color-danger);
  }
  box-sizing: border-box;
`;function vc(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 Cc(n,a){if(!n)return{isValid:!0,errorMessage:null};const l=await wr.fetchQuery(Ie,ci,{condition:n,id:a}).toPromise();if(!l)throw new Error("Filter condition validation is null");return l.project.validateSpanFilterCondition}const Fc=[Hs.of([{key:"Enter",run:n=>!0}]),Oa(),Gs({override:[vc]})];function gi(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:m}=ai(),f=u.useDeferredValue(c),{theme:g}=Hn(),p=g==="dark"?pa:void 0,{projectId:y}=je();u.useEffect(()=>{Cc(f,y).then(b=>{b!=null&&b.isValid?(o(""),u.startTransition(()=>{a(f)})):o((b==null?void 0:b.errorMessage)??"Invalid filter condition")})},[a,f,y]);const k=r!=="",v=c!=="";return s("div",{"data-is-focused":t,"data-is-invalid":k,className:"span-filter-condition-field",css:mi,children:[s(h,{direction:"row",children:[e(Ns,{children:e(P,{svg:e(E.Search,{})})}),e(ga,{css:ui,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:Fc}),e("button",{css:C`
            margin-right: var(--ac-global-dimension-static-size-100);
            color: var(--ac-global-text-color-700);
            visibility: ${v?"visible":"hidden"};
          `,onClick:()=>d(""),className:"button--reset",children:e(P,{svg:e(E.CloseCircleOutline,{})})}),s(yn,{placement:"bottom right",children:[e(Kn,{children:e("button",{css:C`
                color: var(--ac-global-text-color-700);
                background-color: var(--ac-global-color-grey-400);
                padding-left: var(--ac-global-dimension-static-size-100);
                padding-right: var(--ac-global-dimension-static-size-100);
                height: 100%;
              `,className:"button--reset",children:e(P,{svg:e(E.PlusCircleOutline,{})})})}),e(Kc,{onAddFilterConditionSnippet:m})]})]}),s(Fe,{isOpen:k&&t,placement:"bottom",children:[e(Kn,{children:e("div",{})}),e(Jn,{children:r!=""?e(F,{color:"danger",children:r}):e(F,{color:"success",children:"Valid Expression"})})]})]})}function Kc(n){const{onAddFilterConditionSnippet:a}=n;return e(x,{width:"500px",paddingTop:"size-200",paddingStart:"size-200",paddingEnd:"size-200",borderRadius:"medium",borderWidth:"thin",borderColor:"light",backgroundColor:"light",children:s(mn,{children:[e(nn,{label:"filter by kind",initialSnippet:"span_kind == 'LLM'",onAddFilterConditionSnippet:a},"kind"),e(nn,{label:"filter by token count",initialSnippet:"cumulative_token_count.total > 1000",onAddFilterConditionSnippet:a},"token_count"),e(nn,{label:"filter by annotation label",initialSnippet:"annotations['Hallucination'].label == 'hallucinated'",onAddFilterConditionSnippet:a},"annotation_label"),e(nn,{label:"filter by evaluation label",initialSnippet:"evals['Hallucination'].label == 'hallucinated'",onAddFilterConditionSnippet:a},"eval_label"),e(nn,{label:"filter by evaluation score",initialSnippet:"evals['Hallucination'].score < 1",onAddFilterConditionSnippet:a},"eval_score"),e(nn,{label:"filter by metadata",initialSnippet:"metadata['topic'] == 'agent'",onAddFilterConditionSnippet:a},"metadata"),e(nn,{label:"filter by substring",initialSnippet:"'agent' in input.value",onAddFilterConditionSnippet:a},"substring")]})})}function nn(n){const{initialSnippet:a,onAddFilterConditionSnippet:l}=n,[t,i]=u.useState(a),{theme:r}=Hn(),o=r==="light"?void 0:pa;return e(ma,{label:n.label,children:s(h,{direction:"row",width:"100%",gap:"size-100",children:[e("div",{css:C(mi,C`
              flex: 1 1 auto;
            `),children:e(ga,{value:t,basicSetup:{lineNumbers:!1,foldGutter:!1,bracketMatching:!0,syntaxHighlighting:!0,highlightActiveLine:!1,highlightActiveLineGutter:!1},extensions:[Oa()],editable:!0,onChange:i,theme:o,css:ui})}),e(N,{title:"Add to filter condition",variant:"default",onClick:()=>l(t),icon:e(P,{svg:e(E.PlusCircleOutline,{})})})]})})}const pi=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(
  $input: AddSpansToDatasetInput!
) {
  addSpansToDataset(input: $input) {
    dataset {
      id
    }
  }
}
`}}}();pi.hash="5e3aef907285081a06c0e0360045e865";const yi={fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"DatasetSelectorPopoverContentDatasetsQuery",selections:[{args:null,kind:"FragmentSpread",name:"DatasetSelectorPopoverContent_datasets"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"DatasetSelectorPopoverContentDatasetsQuery",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}]},params:{cacheID:"6d459b61a36b99979f025742892941f9",id:null,metadata:{},name:"DatasetSelectorPopoverContentDatasetsQuery",operationKind:"query",text:`query DatasetSelectorPopoverContentDatasetsQuery {
  ...DatasetSelectorPopoverContent_datasets
}

fragment DatasetSelectorPopoverContent_datasets on Query {
  datasets {
    edges {
      dataset: node {
        id
        name
      }
    }
  }
}
`}};yi.hash="40d5267ad0ec2335a73ff2a4d05bbed1";const fi={argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:[],operation:yi}},name:"DatasetSelectorPopoverContent_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};fi.hash="40d5267ad0ec2335a73ff2a4d05bbed1";const hi={fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"DatasetSelectorPopoverContentQuery",selections:[{args:null,kind:"FragmentSpread",name:"DatasetSelectorPopoverContent_datasets"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"DatasetSelectorPopoverContentQuery",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}]},params:{cacheID:"5fb28a402f330dd235295da21efea58b",id:null,metadata:{},name:"DatasetSelectorPopoverContentQuery",operationKind:"query",text:`query DatasetSelectorPopoverContentQuery {
  ...DatasetSelectorPopoverContent_datasets
}

fragment DatasetSelectorPopoverContent_datasets on Query {
  datasets {
    edges {
      dataset: node {
        id
        name
      }
    }
  }
}
`}};hi.hash="7cd8a13144d97d2b5294f2a09c9e1351";function xc(n){const{onCreateNewDataset:a,onDatasetSelected:l}=n,[t,i]=u.useState(""),r=T.useLazyLoadQuery(hi,{},{fetchPolicy:"network-only"});return s(z,{title:"Add to Dataset",variant:"compact",backgroundColor:"light",borderColor:"light",bodyStyle:{padding:0},extra:e(N,{variant:"default",size:"compact",onClick:a,children:"New Dataset"}),children:[e(x,{padding:"size-100",children:e(le,{type:"search",placeholder:"Search datasets",addonBefore:e(P,{svg:e(E.Search,{})}),onChange:o=>{i(o)}})}),e(x,{borderTopWidth:"thin",borderColor:"light",children:e("div",{css:C`
            height: 400px;
            overflow-y: auto;
          `,children:e(Dc,{query:r,search:t,onDatasetSelected:l})})})]})}function Dc(n){const{search:a,onDatasetSelected:l}=n,[t]=T.useRefetchableFragment(fi,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(h,{direction:"column",justifyContent:"center",alignItems:"center",flex:"1 1 auto",children:e(F,{children:"No datasets found"})}):e(Wn,{selectionMode:"single",onSelectionChange:o=>{if(typeof o=="object"){const c=Array.from(o);l(c[0])}},children:i.map(o=>e(J,{children:o.name},o.id))})}function ki(n){const a=ae(),[l,t]=u.useState(null),i=ge(),r=An(),[o,c]=u.useState(!1),{selectedSpans:d,onClearSelection:m}=n,[f,g]=T.useMutation(pi),p=d.length!==1,y=u.useCallback(k=>{f({variables:{input:{datasetId:k,spanIds:d.map(v=>v.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`)}}}),m()},onError:v=>{r({title:"An error occurred",message:`Failed to add spans to dataset: ${v.message}`})}})},[f,d,i,p,m,a,r]);return s("div",{css:C`
        position: absolute;
        bottom: var(--ac-global-dimension-size-400);
        left: 50%;
        transform: translateX(-50%);
      `,children:[e(x,{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(F,{children:`${d.length} span${p?"s":""} selected`}),s(h,{direction:"row",gap:"size-100",children:[e(N,{variant:"default",size:"compact",onClick:m,children:"Cancel"}),s(yn,{placement:"top end",crossOffset:300,isOpen:o,onOpenChange:k=>{c(k)},children:[e(N,{variant:"primary",size:"compact",icon:e(P,{svg:e(E.DatabaseOutline,{})}),loading:g,disabled:g,children:g?"Adding to dataset":"Add to dataset"}),e(u.Suspense,{children:e(xc,{onDatasetSelected:k=>{y(k),c(!1)},onCreateNewDataset:()=>{c(!1),t(e(j,{title:"New Dataset",isDismissable:!0,onDismiss:()=>t(null),children:e(Pa,{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(U,{onDismiss:()=>{t(null)},children:l})]})}const bi=C`
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  overflow: hidden;
  .span-filter-condition-field {
    flex: 1 1 auto;
  }

  // Style the column selector
  .ac-dropdown-button {
    min-width: var(--ac-global-dimension-static-size-300);
  }
`,qn="annotations",Ae=":",Si={col:"startTime",dir:"desc"};function vi(n){let a=null,l=null;if(n.id&&n.id.startsWith(qn)){const[,t,i]=n.id.split(Ae);l={attr:t,name:i}}else a=n.id;return{col:a,evalResultKey:l,dir:n.desc?"desc":"asc"}}const nl=50;function Tc(n){const{fetchKey:a}=Mn(),l=u.useRef(null),[t,i]=u.useState({}),[r,o]=u.useState([]),[c,d]=u.useState(""),m=Oe(M=>M.columnVisibility),f=ae(),{data:g,loadNext:p,hasNext:y,isLoadingNext:k,refetch:v}=T.usePaginationFragment(ti,n.project),b=Oe(M=>M.annotationColumnVisibility),S=u.useMemo(()=>Object.keys(b).filter(M=>b[M]),[b]),L=u.useMemo(()=>g.spans.edges.map(({span:V})=>V),[g]),I=S.map(M=>({header:M,columns:[{header:"label",accessorKey:`${qn}${Ae}label${Ae}${M}`,cell:({row:V})=>{const _=V.original.spanAnnotations.find($=>$.name===M);return _?_.label:null}},{header:"score",accessorKey:`${qn}${Ae}score${Ae}${M}`,cell:({row:V})=>{const _=V.original.spanAnnotations.find($=>$.name===M);return _?_.score:null}}]})),A=[{header:()=>s(h,{direction:"row",gap:"size-50",children:[e("span",{children:"feedback"}),s(Pn,{children:[e(te,{level:3,weight:"heavy",children:"Feedback"}),e(Rn,{children:"Feedback includes evaluations and human annotations logged via the API or set via the UI."})]})]}),accessorKey:"spanAnnotations",enableSorting:!1,cell:({row:M})=>s(h,{direction:"row",gap:"size-50",wrap:"wrap",children:[M.original.spanAnnotations.map(V=>e(Un,{annotation:V,layout:"horizontal",width:"500px",extra:e(ri,{annotation:V}),children:e(pn,{annotation:V,annotationDisplayPreference:"label"})},V.name)),M.original.documentRetrievalMetrics.map(V=>s(H,{children:[e(he,{name:V.evaluationName,metric:"ndcg",score:V.ndcg},"ndcg"),e(he,{name:V.evaluationName,metric:"precision",score:V.precision},"precision"),e(he,{name:V.evaluationName,metric:"hit",score:V.hit},"hit")]}))]})},...I],K=[{id:"select",maxSize:10,header:({table:M})=>e(ze,{checked:M.getIsAllRowsSelected(),indeterminate:M.getIsSomeRowsSelected(),onChange:M.getToggleAllRowsSelectedHandler()}),cell:({row:M})=>e(ze,{checked:M.getIsSelected(),disabled:!M.getCanSelect(),indeterminate:M.getIsSomeSelected(),onChange:M.getToggleSelectedHandler()})},{header:"kind",accessorKey:"spanKind",maxSize:100,enableSorting:!1,cell:({getValue:M})=>e(Ma,{spanKind:M()})},{header:"name",accessorKey:"name",enableSorting:!1,cell:({getValue:M,row:V})=>{const _=V.original,{traceId:$}=_.context;return e(wn,{to:`traces/${$}?selectedSpanNodeId=${_.id}`,children:M()})}},{header:"input",accessorKey:"input.value",cell:fe,enableSorting:!1},{header:"output",accessorKey:"output.value",cell:fe,enableSorting:!1},{header:"metadata",accessorKey:"metadata",cell:fe,enableSorting:!1},...A,{header:"start time",accessorKey:"startTime",cell:ve},{header:"latency",accessorKey:"latencyMs",cell:({getValue:M})=>{const V=M();return V===null||typeof V!="number"?null:e(xe,{latencyMs:V})}},{header:"total tokens",accessorKey:"tokenCountTotal",cell:({row:M,getValue:V})=>{const _=V();return _===null?"--":e(Ra,{tokenCountTotal:_,tokenCountPrompt:M.original.tokenCountPrompt||0,tokenCountCompletion:M.original.tokenCountCompletion||0})}},{header:"status",accessorKey:"statusCode",enableSorting:!1,cell:({getValue:M})=>e(sa,{statusCode:M()})}];u.useEffect(()=>{const M=r[0];u.startTransition(()=>{v({sort:M?vi(M):Si,after:null,first:nl,filterCondition:c},{fetchPolicy:"store-and-network"})})},[r,v,c,a]);const D=u.useCallback(M=>{if(M){const{scrollHeight:V,scrollTop:_,clientHeight:$}=M;V-_-$<300&&!k&&y&&p(nl)}},[y,k,p]),R=ue({columns:K,data:L,state:{sorting:r,columnVisibility:m,rowSelection:t},manualSorting:!0,enableRowSelection:!0,onRowSelectionChange:i,onSortingChange:o,getCoreRowModel:me(),getSortedRowModel:Dn()}),w=R.getRowModel().rows,O=R.getSelectedRowModel().rows,Z=O.map(M=>M.original),ne=u.useCallback(()=>{i({})},[i]),oe=w.length===0,de=R.getAllColumns().filter(M=>M.columns.length===0);return s("div",{css:bi,children:[e(x,{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(gi,{onValidCondition:d}),e(di,{columns:de,query:g})]})}),e("div",{css:C`
          flex: 1 1 auto;
          overflow: auto;
        `,onScroll:M=>D(M.target),ref:l,children:s("table",{css:En,children:[e("thead",{children:R.getHeaderGroups().map(M=>e("tr",{children:M.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:[B(V.column.columnDef.header,V.getContext()),V.column.getIsSorted()?e(P,{className:"sort-icon",svg:V.column.getIsSorted()==="asc"?e(E.ArrowUpFilled,{}):e(E.ArrowDownFilled,{})}):null]})},V.id))},M.id))}),oe?e(si,{projectName:g.name}):e("tbody",{children:w.map(M=>e("tr",{onClick:()=>f(`traces/${M.original.context.traceId}?selectedSpanNodeId=${M.original.id}`),children:M.getVisibleCells().map(V=>e("td",{children:B(V.column.columnDef.cell,V.getContext())},V.id))},M.id))})]})}),O.length?e(ki,{selectedSpans:Z,onClearSelection:ne}):null]})}const Ci=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(
  $id: GlobalID!
) {
  node(id: $id) {
    __typename
    ...StreamToggle_data
    __isNode: __typename
    id
  }
}

fragment StreamToggle_data on Project {
  streamingLastUpdatedAt
  id
}
`}}}();Ci.hash="30a8f0bcf1aa6021b2c9a47866f5dc49";const Fi={argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:["node"],operation:Ci,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};Fi.hash="30a8f0bcf1aa6021b2c9a47866f5dc49";function Ki(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 Ic=2e3;function Lc(n){const{isStreaming:a,setIsStreaming:l,setFetchKey:t}=Mn(),[i,r]=T.useRefetchableFragment(Fi,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]),Ki(c,Ic),e(ca,{labelPlacement:"start",isSelected:a,onChange:()=>{l(!a)},children:"Stream"})}const xi=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"},m={kind:"Variable",name:"first",variableName:"first"},f={kind:"Variable",name:"sort",variableName:"sort"},g={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,m,{kind:"Literal",name:"rootSpansOnly",value:!0},f,{kind:"Variable",name:"timeRange",variableName:"timeRange"}],v={alias:null,args:null,kind:"ScalarField",name:"spanKind",storageKey:null},b={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},I={alias:null,args:null,kind:"ScalarField",name:"parentId",storageKey:null},A=[{alias:"value",args:null,kind:"ScalarField",name:"truncatedValue",storageKey:null}],K={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},D={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},R={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},w=[{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,m,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:[g,{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,v,y,{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null},b,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},I,{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"input",plural:!1,selections:A,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:A,storageKey:null},K,D,R,{alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"descendants",plural:!0,selections:[p,v,y,b,S,L,I,{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:w,storageKey:null},{alias:null,args:null,concreteType:"SpanIOValue",kind:"LinkedField",name:"output",plural:!1,selections:w,storageKey:null},K,D,R],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:[g],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(
  $after: String = null
  $filterCondition: String = null
  $first: Int = 50
  $sort: SpanSort = {col: startTime, dir: desc}
  $timeRange: TimeRange
  $id: GlobalID!
) {
  node(id: $id) {
    __typename
    ...TracesTable_spans_1XEuU
    __isNode: __typename
    id
  }
}

fragment SpanColumnSelector_annotations on Project {
  spanAnnotationNames
}

fragment TracesTable_spans_1XEuU on Project {
  name
  ...SpanColumnSelector_annotations
  rootSpans: spans(first: $first, after: $after, sort: $sort, rootSpansOnly: true, filterCondition: $filterCondition, timeRange: $timeRange) {
    edges {
      rootSpan: node {
        id
        spanKind
        name
        metadata
        statusCode: propagatedStatusCode
        startTime
        latencyMs
        cumulativeTokenCountTotal
        cumulativeTokenCountPrompt
        cumulativeTokenCountCompletion
        parentId
        input {
          value: truncatedValue
        }
        output {
          value: truncatedValue
        }
        context {
          spanId
          traceId
        }
        spanAnnotations {
          name
          label
          score
          annotatorKind
        }
        documentRetrievalMetrics {
          evaluationName
          ndcg
          precision
          hit
        }
        descendants {
          id
          spanKind
          name
          statusCode: propagatedStatusCode
          startTime
          latencyMs
          parentId
          cumulativeTokenCountTotal: tokenCountTotal
          cumulativeTokenCountPrompt: tokenCountPrompt
          cumulativeTokenCountCompletion: tokenCountCompletion
          input {
            value
          }
          output {
            value
          }
          context {
            spanId
            traceId
          }
          spanAnnotations {
            name
            label
            score
            annotatorKind
          }
          documentRetrievalMetrics {
            evaluationName
            ndcg
            precision
            hit
          }
        }
      }
      cursor
      node {
        __typename
      }
    }
    pageInfo {
      endCursor
      hasNextPage
    }
  }
  id
}
`}}}();xi.hash="69e77ceeea7371be4ec13fc702225150";const Di=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}],m={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},g={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:xi,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},m,f,g,{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},m,f,g],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}}();Di.hash="69e77ceeea7371be4ec13fc702225150";const al=50;function Ti(n){const a=[];for(const l of n){const t={...l.span,children:Ti(l.children)};a.push(t)}return a}function _c(n){const a=u.useRef(null),[l,t]=u.useState({}),[i,r]=u.useState([]),[o,c]=u.useState(""),d=ae(),{fetchKey:m}=Mn(),{data:f,loadNext:g,hasNext:p,isLoadingNext:y,refetch:k}=T.usePaginationFragment(Di,n.project),v=Oe(_=>_.annotationColumnVisibility),b=u.useMemo(()=>Object.keys(v).filter(_=>v[_]),[v]),S=u.useMemo(()=>f.rootSpans.edges.map(({rootSpan:$})=>{const W=hs([$,...$.descendants]),[Ye]=Ti(W);return Ye}),[f]),L=b.map(_=>({header:_,columns:[{header:"label",accessorKey:`${qn}${Ae}label${Ae}${_}`,cell:({row:$})=>{const W=$.original.spanAnnotations.find(Ye=>Ye.name===_);return W?W.label:null}},{header:"score",accessorKey:`${qn}${Ae}score${Ae}${_}`,cell:({row:$})=>{const W=$.original.spanAnnotations.find(Ye=>Ye.name===_);return W?W.score:null}}]})),I=[{header:()=>s(h,{direction:"row",gap:"size-50",children:[e("span",{children:"feedback"}),s(Pn,{children:[e(te,{level:3,weight:"heavy",children:"Feedback"}),e(Rn,{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(W=>e(Un,{annotation:W,layout:"horizontal",width:"500px",extra:e(ri,{annotation:W}),children:e(pn,{annotation:W,annotationDisplayPreference:"label"})},W.name)),_.original.documentRetrievalMetrics.map(W=>s(u.Fragment,{children:[e(he,{name:W.evaluationName,metric:"ndcg",score:W.ndcg},"ndcg"),e(he,{name:W.evaluationName,metric:"precision",score:W.precision},"precision"),e(he,{name:W.evaluationName,metric:"hit",score:W.hit},"hit")]},"doc-evals")),$?"--":null]})}},...L],A=[{id:"select",maxSize:10,header:({table:_})=>e(ze,{checked:_.getIsAllRowsSelected(),indeterminate:_.getIsSomeRowsSelected(),onChange:_.getToggleAllRowsSelectedHandler()}),cell:({row:_})=>e(ze,{checked:_.getIsSelected(),disabled:!_.getCanSelect(),indeterminate:_.getIsSomeSelected(),onChange:_.getToggleSelectedHandler()})},{header:()=>s(h,{gap:"size-50",direction:"row",alignItems:"center",children:[e(Ga,{isExpanded:O.getIsAllRowsExpanded(),onClick:O.getToggleAllRowsExpandedHandler(),"aria-label":"Expand all rows"}),"kind"]}),enableSorting:!1,accessorKey:"spanKind",maxSize:100,cell:_=>e("div",{css:C`
              // Since rows are flattened by default,
              // we can use the row.depth property
              // and paddingLeft to visually indicate the depth
              // of the row
              padding-left: ${_.row.depth*2}rem;
            `,children:s(h,{gap:"size-50",children:[_.row.getCanExpand()?e(Ga,{isExpanded:_.row.getIsExpanded(),onClick:_.row.getToggleExpandedHandler(),"aria-label":"Expand row"}):null,e(Ma,{spanKind:_.getValue()})]})})},{header:"name",accessorKey:"name",enableSorting:!1,cell:({getValue:_,row:$})=>{const{traceId:W}=$.original.context;return e(wn,{to:`traces/${W}?selectedSpanNodeId=${$.original.id}`,children:_()})}},{header:"input",accessorKey:"input.value",enableSorting:!1,cell:fe},{header:"output",accessorKey:"output.value",enableSorting:!1,cell:fe},{header:"metadata",accessorKey:"metadata",enableSorting:!1,cell:fe},...I,{header:"start time",accessorKey:"startTime",cell:ve},{header:"latency",accessorKey:"latencyMs",cell:({getValue:_})=>{const $=_();return $===null||typeof $!="number"?null:e(xe,{latencyMs:$})}},{header:"total tokens",minSize:80,accessorKey:"cumulativeTokenCountTotal",cell:({row:_,getValue:$})=>{const W=$();return W===null?"--":e(Ra,{tokenCountTotal:W,tokenCountPrompt:_.original.cumulativeTokenCountPrompt||0,tokenCountCompletion:_.original.cumulativeTokenCountCompletion||0})}},{header:"status",accessorKey:"statusCode",enableSorting:!1,cell:({getValue:_})=>e(sa,{statusCode:_()})}];u.useEffect(()=>{const _=i[0];u.startTransition(()=>{k({sort:_?vi(_):Si,after:null,first:al,filterCondition:o},{fetchPolicy:"store-and-network"})})},[i,k,o,m]);const K=Te.useCallback(_=>{if(_){const{scrollHeight:$,scrollTop:W,clientHeight:Ye}=_;$-W-Ye<300&&!y&&p&&g(al)}},[p,y,g]),[D,R]=u.useState({}),w=Oe(_=>_.columnVisibility),O=ue({columns:A,data:S,onExpandedChange:R,manualSorting:!0,getSubRows:_=>_.children,state:{sorting:i,expanded:D,columnVisibility:w,rowSelection:l},onRowSelectionChange:t,enableSubRowSelection:!1,onSortingChange:r,getCoreRowModel:me(),getSortedRowModel:Dn(),getExpandedRowModel:Rr(),getRowId:_=>_.id}),Z=O.getRowModel().rows,ne=O.getSelectedRowModel().flatRows,oe=ne.map(_=>_.original),de=u.useCallback(()=>{t({})},[t]),M=Z.length===0,V=O.getAllColumns().filter(_=>_.columns.length===0);return s("div",{css:bi,children:[e(x,{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(gi,{onValidCondition:c}),e(di,{columns:V,query:f})]})}),e("div",{css:C`
          flex: 1 1 auto;
          overflow: auto;
        `,onScroll:_=>K(_.target),ref:a,children:s("table",{css:En,children:[e("thead",{children:O.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:[B($.column.columnDef.header,$.getContext()),$.column.getIsSorted()?e(P,{className:"sort-icon",svg:$.column.getIsSorted()==="asc"?e(E.ArrowUpFilled,{}):e(E.ArrowDownFilled,{})}):null]})},$.id))},_.id))}),M?e(si,{projectName:f.name}):e("tbody",{children:Z.map(_=>e("tr",{onClick:()=>d(`traces/${_.original.context.traceId}`),children:_.getVisibleCells().map($=>e("td",{children:B($.column.columnDef.cell,$.getContext())},$.id))},_.id))})]})}),ne.length?e(ki,{selectedSpans:oe,onClearSelection:de}):null]})}const Ac=C`
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  .ac-tabs {
    flex: 1 1 auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    div[role="tablist"] {
      flex: none;
    }
    .ac-tabs__pane-container {
      flex: 1 1 auto;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      div[role="tabpanel"]:not([hidden]) {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        overflow: hidden;
      }
    }
  }
`;function Lm(){const{projectId:n}=je(),{timeRange:a}=oa();return e(u.Suspense,{fallback:e(se,{}),children:e(Ec,{projectId:n,timeRange:a})})}const Ii=Bt;function Ec({projectId:n,timeRange:a}){const l=u.useMemo(()=>({start:a.start.toISOString(),end:a.end.toISOString()}),[a]),t=T.useLazyLoadQuery(qt,{id:n,timeRange:l},{fetchPolicy:"store-and-network"}),[i,r,o]=T.useQueryLoader(Ii),c=u.useCallback(d=>{d===1?r({id:n,timeRange:l}):o()},[o,r,n,l]);return s("main",{css:Ac,children:[e(pc,{project:t.project,extra:s(h,{direction:"row",alignItems:"center",gap:"size-100",children:[e(Lc,{project:t.project}),e(Ll,{})]})}),s(ke,{onChange:c,children:[e(q,{name:"Traces",children:({isSelected:d})=>d&&e(el,{children:e(u.Suspense,{children:e(_c,{project:t.project})})})}),e(q,{name:"Spans",title:"Spans",children:({isSelected:d})=>d&&i&&e(el,{children:e(u.Suspense,{fallback:e(se,{}),children:e(wc,{queryReference:i})})})})]}),e(u.Suspense,{children:e(Ke,{})})]})}function wc({queryReference:n}){const a=T.usePreloadedQuery(Ii,n);return e(Tc,{project:a.project})}const Li=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={kind:"InlineFragment",selections:[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null}],type:"Project",abstractKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"projectLoaderQuery",selections:[{alias:"project",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:"projectLoaderQuery",selections:[{alias:"project",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:"04c84b5bc2a01477851d347af75dcc11",id:null,metadata:{},name:"projectLoaderQuery",operationKind:"query",text:`query projectLoaderQuery(
  $id: GlobalID!
) {
  project: node(id: $id) {
    __typename
    id
    ... on Project {
      name
    }
  }
}
`}}}();Li.hash="3d31e323c06df38ec2eaa6f3adb55e79";async function _m(n){const{projectId:a}=n.params;return await T.fetchQuery(Ie,Li,{id:a}).toPromise()}const Rc=C`
  display: flex;
  direction: row;
  height: 100vh;
  overflow: hidden;
`,Pc=C`
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  height: 100%;
  overflow: hidden;
  padding-left: var(--px-nav-collapsed-width);
`,Mc=C`
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
`,Nc=C`
  display: flex;
  flex-direction: column;
  margin: 0;
  list-style: none;
  gap: var(--ac-global-dimension-size-50);
  padding-inline-start: 0;
`,Vc=C`
  display: flex;
  flex-direction: column;
  gap: var(--ac-global-dimension-size-50);
`;function Am(){return s("div",{css:Rc,"data-testid":"layout",children:[e($c,{}),s("div",{css:Pc,children:[e(bs,{children:e(ks,{})}),e("div",{"data-testid":"content",css:Mc,children:e(u.Suspense,{fallback:e(se,{}),children:e(Ke,{})})})]})]})}function $c(){const n=u.useMemo(()=>window.Config.hasInferences,[]),{authenticationEnabled:a}=$l();return s(Ks,{children:[e(Ss,{}),s(h,{direction:"column",justifyContent:"space-between",flex:"1 1 auto",children:[s("ul",{css:Vc,children:[n&&e("li",{children:e(fn,{to:"/model",text:"Model",icon:e(P,{svg:e(E.CubeOutline,{})})})}),e("li",{children:e(fn,{to:"/projects",text:"Projects",icon:e(P,{svg:e(E.GridOutline,{})})})}),e("li",{children:e(fn,{to:"/datasets",text:"Datasets",icon:e(P,{svg:e(E.DatabaseOutline,{})})})}),e("li",{children:e(fn,{to:"/apis",text:"APIs",icon:e(P,{svg:e(E.Code,{})})})})]}),s("ul",{css:Nc,children:[e("li",{children:e(fn,{to:"/settings",text:"Settings",icon:e(P,{svg:e(E.SettingsOutline,{})})})}),e("li",{children:e(vs,{})}),e("li",{children:e(Cs,{})}),e("li",{children:e(Fs,{})}),a&&e("li",{children:e(fn,{to:"/profile",text:"Profile",icon:e(P,{svg:e(E.PersonOutline,{})})})})]})]})]})}function Em(){const n=Pr(),a=u.useMemo(()=>n instanceof Error&&n.message==="Failed to fetch"?e(zc,{}):e(Qc,{error:n}),[n]);return e("main",{css:C`
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
      `,children:e("section",{css:C`
          width: 500px;
          /* Add spacing on the bottom so it gets pushed down */
          margin-top: 200px;
          display: flex;
          flex-direction: column;
        `,children:a})})}function zc(){return s(H,{children:[s(h,{direction:"column",width:"100%",alignItems:"center",children:[e(ua,{graphicKey:"not found"}),e("h1",{children:"Server disconnected"})]}),e("p",{children:"We are unable to reach the Phoenix server. Please ensure that Phoenix is running and try again."})]})}function Qc({error:n}){return s(H,{children:[s(h,{direction:"column",width:"100%",alignItems:"center",children:[e(ua,{graphicKey:"error"}),e("h1",{children:"Something went wrong"})]}),e("p",{children:"We strive to do our very best but 🐛 bugs happen. It would mean a lot to us if you could file a an issue. If you feel comfortable, please include the error details below in your issue. We will get back to you as soon as we can."}),e("p",{css:C`
          display: flex;
          flex-direction: row;
          justify-content: flex-end;
          gap: var(--px-spacing-med);
        `,children:s("span",{css:C`
            display: inline-flex;
            flex-direction: row;
            align-items: baseline;
            gap: 0.2em;
          `,children:["💙 the",e(dn,{href:"mailto:phoenix-devs@arize.com",children:"phoenix team"})]})}),s("div",{css:C`
          display: flex;
          flex-direction: row;
          justify-content: flex-end;
          align-items: center;
          gap: var(--px-spacing-med);
        `,children:[e(dn,{href:"https://github.com/Arize-ai/phoenix/issues/new?assignees=&labels=bug&template=bug_report.md&title=%5BBUG%5D",children:"file an issue with us"}),e(N,{variant:"primary",size:"compact",onClick:()=>{window.location.href="/"},children:"Return Home"})]}),s("details",{open:!0,children:[e("summary",{children:"error details"}),e("pre",{css:C`
            white-space: pre-wrap;
            overflow-wrap: break-word;
            overflow: hidden;
            overflow-y: auto;
            max-height: 500px;
          `,children:n instanceof Error?n.message:null})]})]})}const _i=function(){var n=[{alias:null,args:null,kind:"ScalarField",name:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"startTime",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"endTime",storageKey:null}],a=[{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:n,storageKey:null},{alias:null,args:null,concreteType:"Inferences",kind:"LinkedField",name:"referenceInferences",plural:!1,selections:n,storageKey:null},{alias:null,args:null,concreteType:"Inferences",kind:"LinkedField",name:"corpusInferences",plural:!1,selections:n,storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"ModelRootQuery",selections:a,type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"ModelRootQuery",selections:a},params:{cacheID:"c3baccc5527002697b40a06eef432a4d",id:null,metadata:{},name:"ModelRootQuery",operationKind:"query",text:`query ModelRootQuery {
  model {
    primaryInferences {
      name
      startTime
      endTime
    }
    referenceInferences {
      name
      startTime
      endTime
    }
    corpusInferences {
      name
      startTime
      endTime
    }
  }
}
`}}}();_i.hash="b73d8f3f532a0c6f88863f3c6dd5734f";const Oc=_i;function wm(){const n=T.useLazyLoadQuery(Oc,{}),{model:{primaryInferences:a,referenceInferences:l,corpusInferences:t}}=n;return e(Ds,{primaryInferences:a,referenceInferences:l??null,corpusInferences:t??null,children:e(xs,{timeRangeBounds:{start:new Date(a.startTime),end:new Date(a.endTime)},children:e(Ke,{})})})}function Rm(){return e(yc,{children:e(dc,{children:e(Ke,{})})})}function Pm(){return e(Ts,{children:e(Ke,{})})}const Ai=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:50,kind:"LocalArgument",name:"first"},{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],a=[{kind:"Variable",name:"after",variableName:"after"},{kind:"Variable",name:"first",variableName:"first"}],l={kind:"Variable",name:"timeRange",variableName:"timeRange"},t=[l];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ProjectsPageProjectsQuery",selections:[{args:a,kind:"FragmentSpread",name:"ProjectsPageProjectsFragment"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ProjectsPageProjectsQuery",selections:[{alias:null,args:a,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:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"gradientStartColor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"gradientEndColor",storageKey:null},{alias:null,args:t,kind:"ScalarField",name:"traceCount",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"endTime",storageKey:null},{alias:"latencyMsP50",args:[{kind:"Literal",name:"probability",value:.5},l],kind:"ScalarField",name:"latencyMsQuantile",storageKey:null},{alias:null,args:t,kind:"ScalarField",name:"tokenCountTotal",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Project",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},{alias:null,args:a,filters:null,handle:"connection",key:"ProjectsPage_projects",kind:"LinkedHandle",name:"projects"}]},params:{cacheID:"ead527a5c3ddda0f6c906c99183edf06",id:null,metadata:{},name:"ProjectsPageProjectsQuery",operationKind:"query",text:`query ProjectsPageProjectsQuery(
  $after: String = null
  $first: Int = 50
  $timeRange: TimeRange
) {
  ...ProjectsPageProjectsFragment_2HEEH6
}

fragment ProjectsPageProjectsFragment_2HEEH6 on Query {
  projects(first: $first, after: $after) {
    edges {
      project: node {
        id
        name
        gradientStartColor
        gradientEndColor
        traceCount(timeRange: $timeRange)
        endTime
        latencyMsP50: latencyMsQuantile(probability: 0.5, timeRange: $timeRange)
        tokenCountTotal(timeRange: $timeRange)
      }
      cursor
      node {
        __typename
      }
    }
    pageInfo {
      endCursor
      hasNextPage
    }
  }
}
`}}}();Ai.hash="56c501357948255461a24411fb6b5847";const Ei=function(){var n=["projects"],a={kind:"Variable",name:"timeRange",variableName:"timeRange"},l=[a];return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:50,kind:"LocalArgument",name:"first"},{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:[],operation:Ai}},name:"ProjectsPageProjectsFragment",selections:[{alias:"projects",args:null,concreteType:"ProjectConnection",kind:"LinkedField",name:"__ProjectsPage_projects_connection",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:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"gradientStartColor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"gradientEndColor",storageKey:null},{alias:null,args:l,kind:"ScalarField",name:"traceCount",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"endTime",storageKey:null},{alias:"latencyMsP50",args:[{kind:"Literal",name:"probability",value:.5},a],kind:"ScalarField",name:"latencyMsQuantile",storageKey:null},{alias:null,args:l,kind:"ScalarField",name:"tokenCountTotal",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Project",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}],type:"Query",abstractKey:null}}();Ei.hash="56c501357948255461a24411fb6b5847";const wi=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"timeRange"}],a=[{kind:"Literal",name:"first",value:50}],l={kind:"Variable",name:"timeRange",variableName:"timeRange"},t=[l];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ProjectsPageQuery",selections:[{args:null,kind:"FragmentSpread",name:"ProjectsPageProjectsFragment"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ProjectsPageQuery",selections:[{alias:null,args:a,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:"name",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"gradientStartColor",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"gradientEndColor",storageKey:null},{alias:null,args:t,kind:"ScalarField",name:"traceCount",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"endTime",storageKey:null},{alias:"latencyMsP50",args:[{kind:"Literal",name:"probability",value:.5},l],kind:"ScalarField",name:"latencyMsQuantile",storageKey:null},{alias:null,args:t,kind:"ScalarField",name:"tokenCountTotal",storageKey:null}],storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"cursor",storageKey:null},{alias:null,args:null,concreteType:"Project",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:"projects(first:50)"},{alias:null,args:a,filters:null,handle:"connection",key:"ProjectsPage_projects",kind:"LinkedHandle",name:"projects"}]},params:{cacheID:"35a420462b10b0f0158d042fd39bfabb",id:null,metadata:{},name:"ProjectsPageQuery",operationKind:"query",text:`query ProjectsPageQuery(
  $timeRange: TimeRange!
) {
  ...ProjectsPageProjectsFragment
}

fragment ProjectsPageProjectsFragment on Query {
  projects(first: 50) {
    edges {
      project: node {
        id
        name
        gradientStartColor
        gradientEndColor
        traceCount(timeRange: $timeRange)
        endTime
        latencyMsP50: latencyMsQuantile(probability: 0.5, timeRange: $timeRange)
        tokenCountTotal(timeRange: $timeRange)
      }
      cursor
      node {
        __typename
      }
    }
    pageInfo {
      endCursor
      hasNextPage
    }
  }
}
`}}}();wi.hash="c28f5ced0b3ec4b3b8277d0aac29de2d";const jc="https://docs.arize.com/phoenix/tracing/how-to-tracing/setup-tracing";function qc(){const[n,a]=u.useState(null);return s("div",{children:[e(N,{variant:"default",icon:e(P,{svg:e(E.GridOutline,{})}),onClick:()=>{a(e(Bc,{}))},children:"New Project"}),e(U,{isDismissable:!0,type:"slideOver",onDismiss:()=>a(null),children:n})]})}function Bc(){const[n,a]=u.useState("Python");return e(j,{title:"Create a New Project",size:"L",children:s(x,{padding:"size-400",overflow:"auto",children:[e(x,{paddingBottom:"size-200",children:e(Dl,{language:n,onChange:a})}),e(x,{paddingBottom:"size-100",children:s(F,{children:["Projects are created when you log your first trace via OpenTelemetry. See the"," ",e(dn,{href:jc,children:"documentation"})," ","for a complete guide."]})}),n==="Python"?e(Tl,{}):e(Il,{})]})})}const Ri=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"Query",kind:"LinkedField",name:"clearProject",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ProjectActionMenuClearMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ProjectActionMenuClearMutation",selections:a},params:{cacheID:"63319b4e42b499db2447817f1dc821fb",id:null,metadata:{},name:"ProjectActionMenuClearMutation",operationKind:"mutation",text:`mutation ProjectActionMenuClearMutation(
  $input: ClearProjectInput!
) {
  clearProject(input: $input) {
    __typename
  }
}
`}}}();Ri.hash="c43eec4d6b882468c611dd9ebf3b095e";const Pi=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"projectId"}],a=[{alias:null,args:[{kind:"Variable",name:"id",variableName:"projectId"}],concreteType:"Query",kind:"LinkedField",name:"deleteProject",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ProjectActionMenuDeleteMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ProjectActionMenuDeleteMutation",selections:a},params:{cacheID:"8b00ab3aaef4c5fb3de24f7295d38499",id:null,metadata:{},name:"ProjectActionMenuDeleteMutation",operationKind:"mutation",text:`mutation ProjectActionMenuDeleteMutation(
  $projectId: GlobalID!
) {
  deleteProject(id: $projectId) {
    __typename
  }
}
`}}}();Pi.hash="3bf82e90b3f2d3485b4efb954e30b2cf";const Mi=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"Query",kind:"LinkedField",name:"clearProject",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"RemoveProjectDataFormMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"RemoveProjectDataFormMutation",selections:a},params:{cacheID:"1b27a3f7535c3f3943b0f2248d1505a6",id:null,metadata:{},name:"RemoveProjectDataFormMutation",operationKind:"mutation",text:`mutation RemoveProjectDataFormMutation(
  $input: ClearProjectInput!
) {
  clearProject(input: $input) {
    __typename
  }
}
`}}}();Mi.hash="212501fe2d6367ec1503bd7a00c1730f";function Hc(n){const{projectId:a}=n,l=u.useRef(null),[t,i]=T.useMutation(Mi),{control:r,handleSubmit:o,setError:c,formState:{isValid:d}}=qe({defaultValues:{endDate:new Date(Date.now()-Is).toISOString().slice(0,16)}}),m=u.useCallback(f=>{const g=cl(f.endDate);if(!ul(g))return c("endDate",{message:"Date is not in a valid format"});t({variables:{input:{id:a,endTime:new Date(g).toISOString()}},onCompleted:()=>{n.onComplete()},onError:p=>{alert("Failed to clear project traces: "+p)}})},[t,a,n,c]);return s("form",{onSubmit:o(m),ref:l,children:[s(x,{padding:"size-200",children:[e(F,{color:"danger",children:"You are about to remove all data before the following date. This cannot be undone."}),e(G,{name:"endDate",control:r,rules:{required:"field is required"},render:({field:{name:f,onChange:g,onBlur:p,value:y},fieldState:{invalid:k,error:v}})=>e(le,{label:"End Date",type:"datetime-local",name:f,description:"The date up to which you want to remove data",errorMessage:v==null?void 0:v.message,validationState:k?"invalid":"valid",onChange:g,onBlur:p,defaultValue:y})})]}),e(x,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(h,{direction:"row",justifyContent:"end",children:e(N,{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 Gc({projectId:n,projectName:a,onProjectDelete:l,onProjectClear:t,onProjectRemoveData:i}){const[r,o]=u.useState(null),c=a!=="default",[d]=T.useMutation(Pi),[m]=T.useMutation(Ri),f=u.useCallback(()=>{u.startTransition(()=>{d({variables:{projectId:n}}),l()})},[d,n,l]),g=u.useCallback(()=>{u.startTransition(()=>{m({variables:{input:{id:n}},onCompleted:()=>{t()},onError:v=>{alert("Failed to clear project: "+v)}})})},[m,n,t]),p=u.useCallback(()=>{o(s(j,{size:"S",title:"Delete Project",children:[e(x,{padding:"size-200",children:e(F,{color:"danger",children:`Are you sure you want to delete project ${a}? This cannot be undone.`})}),e(x,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(h,{direction:"row",justifyContent:"end",children:e(N,{variant:"danger",onClick:()=>{f(),o(null)},children:"Delete Project"})})})]}))},[f,a]),y=u.useCallback(()=>{o(s(j,{size:"S",title:"Clear Project",children:[e(x,{padding:"size-200",children:e(F,{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(x,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(h,{direction:"row",justifyContent:"end",children:e(N,{variant:"danger",onClick:()=>{g(),o(null)},children:"Clear"})})})]}))},[g,a]),k=u.useCallback(()=>{o(e(j,{size:"M",title:"Remove Data",children:e(Hc,{projectId:n,onComplete:()=>{i(),o(null)}})}))},[i,n]);return s("div",{onClick:v=>{v.preventDefault(),v.stopPropagation()},children:[s(Ue,{buttonVariant:"quiet",align:"end",onAction:v=>{switch(v){case"deleteProject":return p();case"clearProject":return y();case"removeProjectData":return k()}},disabledKeys:c?[]:["deleteProject"],children:[e(J,{textValue:"Clear Traces",children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(E.Refresh,{})}),e(F,{children:"Clear Data"})]})},"clearProject"),e(J,{textValue:"Remove Data",children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(E.CloseCircleOutline,{})}),e(F,{children:"Remove Data"})]})},"removeProjectData"),c?e(J,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(E.TrashOutline,{})}),e(F,{children:"Delete"})]})},"deleteProject"):null]}),e(U,{type:"modal",isDismissable:!0,onDismiss:()=>o(null),children:r})]})}function Uc(){const n=un(l=>l.projectsAutoRefreshEnabled),a=un(l=>l.setProjectAutoRefreshEnabled);return e(ca,{labelPlacement:"start",isSelected:n,onChange:()=>{a(!n)},children:"Auto-Refresh"})}const Wc=1e4,Jc=50;function Mm(){const{timeRange:n}=oa();return e(u.Suspense,{fallback:e(se,{}),children:e(Zc,{timeRange:n})})}function Zc({timeRange:n}){const a=un(S=>S.projectsAutoRefreshEnabled),[l,t]=Vs(),i=u.useMemo(()=>({start:n.start.toISOString(),end:n.end.toISOString()}),[n]),r=T.useLazyLoadQuery(wi,{timeRange:i}),{data:o,loadNext:c,hasNext:d,isLoadingNext:m,refetch:f}=T.usePaginationFragment(Ei,r),g=o.projects.edges.map(S=>S.project),p=u.useRef(null),y=u.useCallback(S=>{if(S){const{scrollHeight:L,scrollTop:I,clientHeight:A}=S;L-I-A<300&&!m&&d&&c(Jc)}},[d,m,c]);Ki(()=>{u.startTransition(()=>{f({},{fetchPolicy:"store-and-network"})})},a?Wc: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]),v=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]),b=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`
        flex: 1 1 auto;
        overflow-y: auto;
        overflow-x: hidden;
        padding-bottom: var(--ac-global-dimension-size-750);
      `,onScroll:S=>y(S.target),ref:p,children:[e(x,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",width:"100%",borderBottomColor:"grey-200",borderBottomWidth:"thin",children:s(h,{direction:"row",justifyContent:"end",alignItems:"center",gap:"size-100",children:[e(Uc,{}),e(qc,{}),e(Ll,{})]})}),e(x,{padding:"size-200",width:"100%",children:e("ul",{css:C`
            display: flex;
            flex-direction: row;
            gap: var(--ac-global-dimension-size-200);
            flex-wrap: wrap;
          `,children:g.map(S=>e("li",{children:e(wn,{to:`/projects/${S.id}`,css:C`
                  text-decoration: none;
                `,children:e(Yc,{project:S,onProjectDelete:()=>k(S.name),onProjectClear:()=>v(S.name),onProjectRemoveData:()=>b(S.name)})})},S.id))})}),t]})}function Xc({gradientStartColor:n,gradientEndColor:a}){return e("div",{css:C`
        border-radius: 50%;
        width: 32px;
        height: 32px;
        background: linear-gradient(
          136.27deg,
          ${n} 14.03%,
          ${a} 84.38%
        );
        flex-shrink: 0;
      `})}function Yc({project:n,onProjectDelete:a,onProjectClear:l,onProjectRemoveData:t}){const{endTime:i,traceCount:r,tokenCountTotal:o,latencyMsP50:c,gradientStartColor:d,gradientEndColor:m}=n,f=u.useMemo(()=>i?`Last updated  ${Mr(new Date(i),new Date,{addSuffix:!0})}`:"No traces uploaded yet.",[i]);return s("div",{css:C`
        padding: var(--ac-global-dimension-size-200);
        border: 1px solid var(--ac-global-color-grey-400);
        background-color: var(--ac-global-color-grey-100);
        border-radius: var(--ac-global-rounding-medium);
        height: var(--ac-global-dimension-size-1250);
        width: var(--ac-global-dimension-size-3600);
        transition: border-color 0.2s;
        &:hover {
          border-color: var(--ac-global-color-primary);
        }
        display: flex;
        flex-direction: column;
        justify-content: space-between;
      `,children:[s(h,{direction:"row",justifyContent:"space-between",alignItems:"start",children:[s(h,{direction:"row",gap:"size-100",alignItems:"center",minWidth:0,children:[e(Xc,{gradientStartColor:d,gradientEndColor:m}),s(h,{direction:"column",minWidth:0,children:[e(te,{level:2,css:C`
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
              `,children:n.name}),e(F,{color:"text-700",textSize:"small",fontStyle:"italic",children:f})]})]}),e(Gc,{projectId:n.id,projectName:n.name,onProjectDelete:a,onProjectClear:l,onProjectRemoveData:t})]}),s(h,{direction:"row",justifyContent:"space-between",children:[s(h,{direction:"column",flex:"none",children:[e(F,{elementType:"h3",textSize:"medium",color:"text-700",children:"Total Traces"}),e(F,{textSize:"xlarge",children:cn(r)})]}),s(h,{direction:"column",flex:"none",children:[e(F,{elementType:"h3",textSize:"medium",color:"text-700",children:"Total Tokens"}),e(F,{textSize:"xlarge",children:cn(o)})]}),s(h,{direction:"column",flex:"none",children:[e(F,{elementType:"h3",textSize:"medium",color:"text-700",children:"Latency P50"}),c!=null?e(xe,{latencyMs:c,textSize:"xlarge"}):e(F,{textSize:"xlarge",children:"--"})]})]})]})}const Ni=function(){var n=[{kind:"Literal",name:"first",value:100},{kind:"Literal",name:"sort",value:{col:"createdAt",dir:"desc"}}];return{fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"DatasetsPageQuery",selections:[{args:null,kind:"FragmentSpread",name:"DatasetsTable_datasets"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"DatasetsPageQuery",selections:[{alias:null,args:n,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:'datasets(first:100,sort:{"col":"createdAt","dir":"desc"})'},{alias:null,args:n,filters:["sort"],handle:"connection",key:"DatasetsTable_datasets",kind:"LinkedHandle",name:"datasets"}]},params:{cacheID:"695b221e981c4795492d79faa7d007e4",id:null,metadata:{},name:"DatasetsPageQuery",operationKind:"query",text:`query DatasetsPageQuery {
  ...DatasetsTable_datasets
}

fragment DatasetsTable_datasets on Query {
  datasets(first: 100, sort: {col: createdAt, dir: desc}) {
    edges {
      node {
        id
        name
        description
        metadata
        createdAt
        exampleCount
        experimentCount
        __typename
      }
      cursor
    }
    pageInfo {
      endCursor
      hasNextPage
    }
  }
}
`}}}();Ni.hash="985853a7939f44c0cefdd1a91472c67e";function eu(n){const a=n.split(`
`);return a.length>0?a[0].split(",").map(l=>l.trim()):[]}function nu(n){const{onDatasetCreated:a,onDatasetCreateError:l}=n,[t,i]=u.useState([]),{control:r,handleSubmit:o,resetField:c,formState:{isDirty:d,isValid:m}}=qe({defaultValues:{name:"Dataset "+new Date().toISOString(),input_keys:[],output_keys:[],metadata_keys:[],description:"",metadata:{}}}),f=u.useCallback(g=>{const p=new FormData;return p.append("file",g.file[0]),p.append("name",g.name),p.append("description",g.description),p.append("metadata",JSON.stringify(g.metadata)),g.input_keys.forEach(y=>{p.append("input_keys[]",y)}),g.output_keys.forEach(y=>{p.append("output_keys[]",y)}),g.metadata_keys.forEach(y=>{p.append("metadata_keys[]",y)}),fetch("/v1/datasets/upload?sync=true",{method:"POST",body:p}).then(y=>{if(!y.ok)throw l(new Error(y.statusText||"Failed to create dataset"));return y.json()}).then(y=>{a({name:g.name,id:y.data.dataset_id})})},[l,a]);return s(mn,{onSubmit:o(f),children:[s("div",{css:C`
          padding: var(--ac-global-dimension-size-200);
          .ac-dropdown-button {
            width: 100%;
          }
        `,children:[e(G,{name:"name",control:r,rules:{required:"field is required"},render:({field:{onChange:g,onBlur:p,value:y},fieldState:{invalid:k,error:v}})=>e(le,{label:"Dataset Name",description:"The name of the dataset",errorMessage:v==null?void 0:v.message,validationState:k?"invalid":"valid",onChange:g,onBlur:p,value:y.toString()})}),e(G,{name:"description",control:r,render:({field:{onChange:g,onBlur:p,value:y},fieldState:{invalid:k,error:v}})=>e(Zn,{label:"description",placeholder:"Description of the dataset",isRequired:!1,height:100,errorMessage:v==null?void 0:v.message,validationState:k?"invalid":"valid",onChange:g,onBlur:p,value:y.toString()})}),e(G,{control:r,name:"file",rules:{required:"CSV file is required"},render:({field:{value:g,onChange:p,...y},fieldState:{invalid:k,error:v}})=>e(ma,{label:"CSV file",validationState:k?"invalid":"valid",errorMessage:v==null?void 0:v.message,children:e("input",{...y,onChange:b=>{var L;p(b.target.files),c("input_keys"),c("output_keys"),c("metadata_keys");const S=(L=b.target.files)==null?void 0:L[0];if(S){const I=new FileReader;I.onload=function(A){if(!A.target)return;const K=A.target.result,D=eu(K);i(D)},I.readAsText(S)}},type:"file",id:"file",accept:".csv"})})}),e(G,{name:"input_keys",control:r,rules:{required:"field is required"},render:({field:{value:g,onChange:p},fieldState:{invalid:y,error:k}})=>e(va,{label:"input keys",validationState:y?"invalid":"valid",description:"the columns to use as input",columns:t,selectedColumns:g,onChange:p,errorMessage:k==null?void 0:k.message})}),e(G,{name:"output_keys",control:r,render:({field:{value:g,onChange:p},fieldState:{invalid:y,error:k}})=>e(va,{label:"output keys",validationState:y?"invalid":"valid",description:"the columns to use as output",columns:t,selectedColumns:g,onChange:p,errorMessage:k==null?void 0:k.message})}),e(G,{name:"metadata_keys",control:r,render:({field:{value:g,onChange:p},fieldState:{invalid:y,error:k}})=>e(va,{label:"metadata keys",validationState:y?"invalid":"valid",description:"the columns to use as metadata",columns:t,selectedColumns:g,onChange:p,errorMessage:k==null?void 0:k.message})})]}),e(x,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(h,{direction:"row",justifyContent:"end",children:e(N,{type:"submit",isDisabled:!m,variant:d?"primary":"default",size:"compact",loading:!1,children:"Create Dataset"})})})]})}function va(n){const{columns:a,selectedColumns:l,onChange:t,label:i,validationState:r,description:o,errorMessage:c,...d}=n,m=a.length===0,f=u.useMemo(()=>m?"No columns to select":l.length>0?`${l.join(", ")}`:"No columns selected",[l,m]);return e(ma,{label:i,isDisabled:m,validationState:r,description:o,errorMessage:c,children:e(za,{isDisabled:m,...d,menu:e(Wn,{selectionMode:"multiple",onSelectionChange:g=>{t(Array.from(g))},selectedKeys:new Set(l),children:a.map(g=>e(J,{children:g},g))}),triggerProps:{placement:"bottom end"},children:f})})}const Vi=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(
  $after: String = null
  $first: Int = 100
  $sort: DatasetSort = {col: createdAt, dir: desc}
) {
  ...DatasetsTable_datasets_dWkdd
}

fragment DatasetsTable_datasets_dWkdd on Query {
  datasets(first: $first, after: $after, sort: $sort) {
    edges {
      node {
        id
        name
        description
        metadata
        createdAt
        exampleCount
        experimentCount
        __typename
      }
      cursor
    }
    pageInfo {
      endCursor
      hasNextPage
    }
  }
}
`}}}();Vi.hash="fa378bc7ec26f5e877e6cf90e5ee553d";const $i=function(){var n=["datasets"];return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:100,kind:"LocalArgument",name:"first"},{defaultValue:{col:"createdAt",dir:"desc"},kind:"LocalArgument",name:"sort"}],kind:"Fragment",metadata:{connection:[{count:"first",cursor:"after",direction:"forward",path:n}],refetch:{connection:{forward:{count:"first",cursor:"after"},backward:null,path:n},fragmentPathInResult:[],operation:Vi}},name:"DatasetsTable_datasets",selections:[{alias:"datasets",args:[{kind:"Variable",name:"sort",variableName:"sort"}],concreteType:"DatasetConnection",kind:"LinkedField",name:"__DatasetsTable_datasets_connection",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}],type:"Query",abstractKey:null}}();$i.hash="fa378bc7ec26f5e877e6cf90e5ee553d";const zi=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"datasetId"}],a=[{alias:null,args:[{fields:[{kind:"Variable",name:"datasetId",variableName:"datasetId"}],kind:"ObjectValue",name:"input"}],concreteType:"DatasetMutationPayload",kind:"LinkedField",name:"deleteDataset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"DeleteDatasetDialogMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"DeleteDatasetDialogMutation",selections:a},params:{cacheID:"3d32b97acd630dd7dbc9c85a632a1d49",id:null,metadata:{},name:"DeleteDatasetDialogMutation",operationKind:"mutation",text:`mutation DeleteDatasetDialogMutation(
  $datasetId: GlobalID!
) {
  deleteDataset(input: {datasetId: $datasetId}) {
    __typename
  }
}
`}}}();zi.hash="7066cca7015a7e344b77862b0bdab21c";function au({datasetId:n,datasetName:a,onDatasetDelete:l,onDatasetDeleteError:t}){const[i,r]=T.useMutation(zi),o=u.useCallback(()=>{u.startTransition(()=>{i({variables:{datasetId:n},onCompleted:()=>{l()},onError:c=>{t(c)}})})},[i,n,l,t]);return s(j,{size:"S",title:"Delete Dataset",children:[e(x,{padding:"size-200",children:e(F,{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(x,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(h,{direction:"row",justifyContent:"end",children:e(N,{variant:"danger",onClick:()=>{o()},disabled:r,loading:r,children:"Delete Dataset"})})})]})}function lu({datasetName:n,datasetId:a,datasetDescription:l,datasetMetadata:t,onDatasetEdited:i,onDatasetEditError:r}){return e(j,{title:"Edit Dataset",size:"M",children:e(Ls,{datasetName:n,datasetId:a,datasetDescription:l,datasetMetadata:t,onDatasetEdited:i,onDatasetEditError:r})})}function tu(n){const{datasetId:a,datasetName:l,datasetDescription:t,datasetMetadata:i,onDatasetDelete:r,onDatasetDeleteError:o,onDatasetEdit:c,onDatasetEditError:d}=n,[m,f]=u.useState(null),g=u.useCallback(()=>{f(e(au,{datasetId:a,datasetName:l,onDatasetDelete:()=>{r(),f(null)},onDatasetDeleteError:o}))},[a,l,r,o]),p=u.useCallback(()=>{f(e(lu,{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(Ue,{align:"end",buttonSize:"compact",onAction:y=>{switch(y){case"deleteDataset":g();break;case"editDataset":p();break}},children:[e(J,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(E.TrashOutline,{})}),e(F,{children:"Delete"})]})},"deleteDataset"),e(J,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(E.Edit2Outline,{})}),e(F,{children:"Edit"})]})},"editDataset")]}),e(U,{type:"modal",isDismissable:!0,onDismiss:()=>f(null),children:m})]})}const ll=100;function iu(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 ru(n){const[a,l]=u.useState([]),t=u.useRef(null),i=ae(),r=ge(),o=An(),{data:c,loadNext:d,hasNext:m,isLoadingNext:f,refetch:g}=T.usePaginationFragment($i,n.query),p=u.useMemo(()=>c.datasets.edges.map(S=>S.node),[c]),y=Te.useCallback(S=>{if(S){const{scrollHeight:L,scrollTop:I,clientHeight:A}=S;L-I-A<300&&!f&&m&&d(ll)}},[m,f,d]),k=ue({columns:[{header:"name",accessorKey:"name",cell:({row:S})=>{const I=S.original.experimentCount>0?`${S.original.id}/experiments`:`${S.original.id}/examples`;return e(wn,{to:I,children:S.original.name})}},{header:"description",accessorKey:"description",enableSorting:!1},{header:"created at",accessorKey:"createdAt",cell:ve},{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:Fn},{header:"",id:"actions",enableSorting:!1,size:10,cell:({row:S})=>e(tu,{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.`}),g({},{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.`}),g({},{fetchPolicy:"store-and-network"})},onDatasetDeleteError:L=>{o({title:"Dataset deletion failed",message:L.message})}})}],data:p,state:{sorting:a},getCoreRowModel:me(),getSortedRowModel:Dn(),onSortingChange:l,manualSorting:!0});u.useEffect(()=>{const S=a[0];u.startTransition(()=>{g({sort:S?iu(S):{col:"createdAt",dir:"desc"},after:null,first:ll},{fetchPolicy:"store-and-network"})})},[a,g]);const v=k.getRowModel().rows,b=v.length===0;return e("div",{css:C`
        flex: 1 1 auto;
        overflow: auto;
      `,onScroll:S=>y(S.target),ref:t,children:s("table",{css:En,children:[e("thead",{children:k.getHeaderGroups().map(S=>e("tr",{children:S.headers.map(L=>{var I;return e("th",{colSpan:L.colSpan,children:L.isPlaceholder?null:s("div",{className:L.column.getCanSort()?"cursor-pointer":"",onClick:L.column.getToggleSortingHandler(),style:{textAlign:(I=L.column.columnDef.meta)==null?void 0:I.textAlign},children:[B(L.column.columnDef.header,L.getContext()),L.column.getIsSorted()?e(P,{className:"sort-icon",svg:L.column.getIsSorted()==="asc"?e(E.ArrowUpFilled,{}):e(E.ArrowDownFilled,{})}):null]})},L.id)})},S.id))}),b?e(Ge,{}):e("tbody",{children:v.map(S=>e("tr",{onClick:()=>{const I=S.original.experimentCount>0?`${S.original.id}/experiments`:`${S.original.id}/examples`;i(I)},children:S.getVisibleCells().map(L=>{var I;return e("td",{align:(I=L.column.columnDef.meta)==null?void 0:I.textAlign,children:B(L.column.columnDef.cell,L.getContext())},L.id)})},S.id))})]})})}function Nm(){return e(u.Suspense,{fallback:e(se,{}),children:e(su,{})})}function su(){const[n,a]=u.useState(0),l=T.useLazyLoadQuery(Ni,{},{fetchKey:n,fetchPolicy:"store-and-network"}),t=u.useCallback(()=>{a(i=>i+1)},[a]);return s(h,{direction:"column",height:"100%",children:[e(x,{padding:"size-200",borderBottomWidth:"thin",borderBottomColor:"dark",flex:"none",children:s(h,{direction:"row",justifyContent:"space-between",children:[e(te,{level:1,children:"Datasets"}),e(ou,{onDatasetCreated:t})]})}),e(ru,{query:l})]})}function ou({onDatasetCreated:n}){const a=ae(),l=ge(),t=An(),[i,r]=u.useState(null),o=()=>{r(e(j,{size:"S",title:"New Dataset",children:e(Pa,{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(j,{size:"M",title:"New Dataset from CSV",children:e(nu,{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(H,{children:[s(Ue,{buttonText:"Create Dataset",align:"end",icon:e(P,{svg:e(E.DatabaseOutline,{})}),onAction:d=>{switch(d){case"newDataset":o();break;case"datasetFromCSV":c();break}},children:[e(J,{children:"New Dataset"},"newDataset"),e(J,{children:"Dataset from CSV"},"datasetFromCSV")]}),e(U,{type:"modal",isDismissable:!0,onDismiss:()=>r(null),children:i})]})}const Qi=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(
  $datasetId: GlobalID!
) {
  dataset: node(id: $datasetId) {
    __typename
    id
    ... on Dataset {
      latestVersions: versions(first: 1, sort: {col: createdAt, dir: desc}) {
        edges {
          version: node {
            id
            description
            createdAt
          }
        }
      }
    }
  }
}
`}}}();Qi.hash="a1349b92d8b0c745f5e8039c55b048c7";const du=n=>{const a=(l,t)=>({...n,isRefreshingLatestVersion:!1,refreshLatestVersion:async()=>{const i=t();l({isRefreshingLatestVersion:!0});const r=await cu({datasetId:i.datasetId});l({latestVersion:r,isRefreshingLatestVersion:!1})}});return Nr()(Vr(a))};async function cu({datasetId:n}){var i;const a=await T.fetchQuery(Ie,Qi,{datasetId:n}).toPromise(),l=(i=a==null?void 0:a.dataset.latestVersions)==null?void 0:i.edges;return l&&l.length&&l[0].version||null}const Oi=u.createContext(null);function uu({children:n,...a}){const l=u.useRef();return l.current||(l.current=du(a)),e(Oi.Provider,{value:l.current,children:n})}function gn(n,a){const l=u.useContext(Oi);if(!l)throw new Error("Missing DatasetContext.Provider in the tree");return dl(l,n,a)}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:"addExamplesToDataset",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"AddDatasetExampleDialogMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"AddDatasetExampleDialogMutation",selections:a},params:{cacheID:"718cf02ccb39b279132822bf503e51e6",id:null,metadata:{},name:"AddDatasetExampleDialogMutation",operationKind:"mutation",text:`mutation AddDatasetExampleDialogMutation(
  $input: AddExamplesToDatasetInput!
) {
  addExamplesToDataset(input: $input) {
    __typename
  }
}
`}}}();ji.hash="8d99470f590cd5d28701fa6e3c0330e6";const Ca={backgroundColor:"light",borderColor:"light",collapsible:!0,bodyStyle:{padding:0}};function mu(n){const{datasetId:a,onCompleted:l}=n,[t,i]=u.useState(null),[r,o]=T.useMutation(ji),{control:c,setError:d,handleSubmit:m,formState:{isValid:f}}=qe({defaultValues:{input:"{}",output:"{}",metadata:"{}"}}),g=u.useCallback(p=>{if(i(null),!Ee(p==null?void 0:p.input))return d("input",{message:"Input must be a valid JSON object"});if(!Ee(p==null?void 0:p.output))return d("output",{message:"Output must be a valid JSON object"});if(!Ee(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(j,{size:"L",title:"Add Example",children:[e("div",{css:C`
          overflow-y: auto;
          padding: var(--ac-global-dimension-size-400);
        `,children:e(h,{direction:"row",justifyContent:"center",children:e(x,{width:"900px",paddingStart:"auto",paddingEnd:"auto",children:s(h,{direction:"column",gap:"size-200",children:[t?e(Y,{variant:"danger",children:t}):null,e(G,{control:c,name:"input",render:({field:{onChange:p,onBlur:y,value:k},fieldState:{invalid:v,error:b}})=>s(z,{title:"Input",subTitle:"The input to the LLM, retriever, program, etc.",...Ca,children:[v?e(Y,{variant:"danger",banner:!0,children:b==null?void 0:b.message}):null,e(we,{value:k,onChange:p,onBlur:y})]})}),e(G,{control:c,name:"output",render:({field:{onChange:p,onBlur:y,value:k},fieldState:{invalid:v,error:b}})=>s(z,{title:"Output",subTitle:"The output of the LLM or program to be used as an expected output",...Ca,backgroundColor:"green-100",borderColor:"green-700",children:[v?e(Y,{variant:"danger",banner:!0,children:b==null?void 0:b.message}):null,e(we,{value:k,onChange:p,onBlur:y})]})}),e(G,{control:c,name:"metadata",render:({field:{onChange:p,onBlur:y,value:k},fieldState:{invalid:v,error:b}})=>s(z,{title:"Metadata",subTitle:"All data from the span to use during experimentation or evaluation",...Ca,children:[v?e(Y,{variant:"danger",banner:!0,children:b==null?void 0:b.message}):null,e(we,{value:k,onChange:p,onBlur:y})]})}),e(G,{control:c,name:"description",render:({field:{onChange:p,onBlur:y,value:k},fieldState:{invalid:v,error:b}})=>e(Zn,{label:"Version Description",value:k,onChange:p,onBlur:y,errorMessage:b==null?void 0:b.message,validationState:v?"invalid":"valid",placeholder:"A description of the changes made. Will be displayed in the version history.",height:100})})]})})})}),e(x,{padding:"size-200",borderTopColor:"light",borderTopWidth:"thin",children:e(h,{direction:"row",justifyContent:"end",gap:"size-100",children:e(N,{variant:"primary",size:"compact",disabled:!f||o,loading:o,onClick:m(g),children:"Add Example"})})})]})}function gu(n){const{datasetId:a,onAddExampleCompleted:l}=n,[t,i]=u.useState(null),r=u.useCallback(()=>{i(e(mu,{datasetId:a,onCompleted:()=>{l(),i(null)}}))},[a,l]);return s(H,{children:[e(N,{icon:e(P,{svg:e(E.PlusCircleOutline,{})}),size:"compact",variant:"default",onClick:r,children:"Add Example"}),e(U,{isDismissable:!0,onDismiss:()=>{i(null)},children:t})]})}function pu(){const n=gn(i=>i.datasetId),a=gn(i=>i.latestVersion);let l=`${Ia}/v1/datasets/${n}/examples`;a&&(l+=`?version-id=${a.id}`);const t=u.useMemo(()=>`import phoenix as px
client = px.Client()
# Get the current dataset version
dataset = client.get_dataset(id="${n}"${a?`, version_id="${a.id}"`:""})`,[n,a]);return e("div",{css:C`
        button.ac-dropdown-button {
          min-width: 80px;
          .ac-dropdown-button__text {
            padding-right: 10px;
          }
        }
      `,children:s(yn,{placement:"bottom right",children:[e(Pl,{addonBefore:e(P,{svg:e(E.Code,{})}),children:"Code"}),e($a,{children:s("section",{css:C`
              width: 500px;
              .ac-field {
                flex: 1 1 auto;
              }
            `,children:[e(x,{padding:"size-200",children:s(mn,{children:[s(h,{direction:"row",gap:"size-100",alignItems:"end",width:"100%",children:[e(le,{label:"Dataset ID",isReadOnly:!0,value:n}),e(X,{text:n,size:"normal"})]}),s(h,{direction:"row",gap:"size-100",alignItems:"end",children:[e(le,{label:"Version ID",isReadOnly:!0,value:(a==null?void 0:a.id)||"No Versions",validationState:a?"valid":"invalid"}),e(X,{text:(a==null?void 0:a.id)||"No Versions",disabled:!a,size:"normal"})]})]})}),s(ke,{children:[e(q,{name:"Python",children:e(x,{margin:"size-200",borderColor:"light",borderWidth:"thin",borderRadius:"small",children:e(an,{value:t})})}),e(q,{name:"REST",children:e(x,{padding:"size-200",children:e(mn,{children:s(h,{direction:"row",gap:"size-100",alignItems:"end",children:[e(le,{label:"URL",isReadOnly:!0,value:l}),e(X,{text:l,size:"normal"})]})})})})]})]})})]})})}const qi=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={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:"DatasetHistoryDialogQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{kind:"InlineFragment",selections:[l,{args:null,kind:"FragmentSpread",name:"DatasetHistoryTable_versions"}],type:"Dataset",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"DatasetHistoryDialogQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[t,{kind:"TypeDiscriminator",abstractKey:"__isNode"},l,{kind:"InlineFragment",selections:[{alias:null,args:i,concreteType:"DatasetVersionConnection",kind:"LinkedField",name:"versions",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:[l,{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},t],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:"versions(first:100)"},{alias:null,args:i,filters:null,handle:"connection",key:"DatasetHistoryTable_versions",kind:"LinkedHandle",name:"versions"}],type:"Dataset",abstractKey:null}],storageKey:null}]},params:{cacheID:"df94b4e72c0187fd0fd1c8416af19354",id:null,metadata:{},name:"DatasetHistoryDialogQuery",operationKind:"query",text:`query DatasetHistoryDialogQuery(
  $datasetId: GlobalID!
) {
  dataset: node(id: $datasetId) {
    __typename
    ... on Dataset {
      id
      ...DatasetHistoryTable_versions
    }
    __isNode: __typename
    id
  }
}

fragment DatasetHistoryTable_versions on Dataset {
  versions(first: 100) {
    edges {
      node {
        id
        description
        createdAt
        __typename
      }
      cursor
    }
    pageInfo {
      endCursor
      hasNextPage
    }
  }
  id
}
`}}}();qi.hash="7215c18bda690418c5ecbcb3131a288e";const Bi=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};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"DatasetHistoryTableVersionsQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:l,kind:"FragmentSpread",name:"DatasetHistoryTable_versions"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"DatasetHistoryTableVersionsQuery",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:"DatasetVersionConnection",kind:"LinkedField",name:"versions",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:[i,{alias:null,args:null,kind:"ScalarField",name:"description",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"createdAt",storageKey:null},t],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:l,filters:null,handle:"connection",key:"DatasetHistoryTable_versions",kind:"LinkedHandle",name:"versions"}],type:"Dataset",abstractKey:null}],storageKey:null}]},params:{cacheID:"e8e3a05b4e86c8eaeea98172405fdc7e",id:null,metadata:{},name:"DatasetHistoryTableVersionsQuery",operationKind:"query",text:`query DatasetHistoryTableVersionsQuery(
  $after: String = null
  $first: Int = 100
  $id: GlobalID!
) {
  node(id: $id) {
    __typename
    ...DatasetHistoryTable_versions_2HEEH6
    __isNode: __typename
    id
  }
}

fragment DatasetHistoryTable_versions_2HEEH6 on Dataset {
  versions(first: $first, after: $after) {
    edges {
      node {
        id
        description
        createdAt
        __typename
      }
      cursor
    }
    pageInfo {
      endCursor
      hasNextPage
    }
  }
  id
}
`}}}();Bi.hash="37e453bc58759a1e89bc5862c460de6b";const Hi=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:Bi,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}}();Hi.hash="37e453bc58759a1e89bc5862c460de6b";const yu=100;function fu(n){const a=u.useRef(null),{data:l,loadNext:t,hasNext:i,isLoadingNext:r}=T.usePaginationFragment(Hi,n.dataset),o=u.useMemo(()=>l.versions.edges.map(g=>g.node),[l]),c=Te.useCallback(g=>{if(g){const{scrollHeight:p,scrollTop:y,clientHeight:k}=g;p-y-k<300&&!r&&i&&t(yu)}},[i,r,t]),d=ue({columns:[{header:"version ID",accessorKey:"id"},{header:"description",accessorKey:"description"},{header:"created at",accessorKey:"createdAt",cell:ve}],data:o,getCoreRowModel:me(),getSortedRowModel:Dn()}),m=d.getRowModel().rows,f=m.length===0;return e("div",{css:C`
        flex: 1 1 auto;
        overflow: auto;
      `,onScroll:g=>c(g.target),ref:a,children:s("table",{css:He,children:[e("thead",{children:d.getHeaderGroups().map(g=>e("tr",{children:g.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:[B(p.column.columnDef.header,p.getContext()),p.column.getIsSorted()?e(P,{className:"sort-icon",svg:p.column.getIsSorted()==="asc"?e(E.ArrowUpFilled,{}):e(E.ArrowDownFilled,{})}):null]})},p.id))},g.id))}),f?e(Ge,{}):e("tbody",{children:m.map(g=>e("tr",{children:g.getVisibleCells().map(p=>e("td",{children:B(p.column.columnDef.cell,p.getContext())},p.id))},g.id))})]})})}function hu(n){const{datasetId:a}=n,l=T.useLazyLoadQuery(qi,{datasetId:a});return e(j,{size:"L",title:"Dataset History",children:e("div",{css:C`
          height: 500px;
        `,children:e(fu,{dataset:l.dataset})})})}function ku(n){const{datasetId:a}=n,[l,t]=u.useState(null);return s(H,{children:[s(Fe,{children:[e(N,{variant:"default",icon:e(P,{svg:e(E.ClockOutline,{})}),"aria-label":"Version History",onClick:()=>{t(e(hu,{datasetId:a}))}}),e(On,{children:"Dataset Version History"})]}),e(u.Suspense,{fallback:null,children:e(U,{type:"modal",isDismissable:!0,onDismiss:()=>{t(null)},children:l})})]})}const bu=`pip install arize-phoenix>=${window.Config.platformVersion}`,Su=`import os
# Set the phoenix collector endpoint. Commonly http://localhost:6060 
os.environ["PHOENIX_COLLECTOR_ENDPOINT"] = "<your-phoenix-url>"`,vu=`from phoenix.experiments.types import Example
# Define your task
# Typically should be an LLM call or a call to your application
def my_task(example: Example) -> str:
    # This is just an example of how to return a JSON serializable value
    return f"Hello {example.input["person"]}"`,Cu=`# Define an evaluator. This just an example.
def exact_match(input, output) -> float:
    return 1.0 if output is f"Hello {input}" else 0.0

# Store the evaluators for later use
evaluators = [exact_match]`,Fu=`# Run an experiment
from phoenix.experiments import run_experiment

experiment = run_experiment(dataset, my_task, evaluators=evaluators)`;function Gi(){const[n,a]=u.useState(null),l=u.useCallback(()=>{a(e(j,{title:"Run Experiment",size:"XL",children:e(Ku,{})}))},[]);return s(H,{children:[e(N,{size:"compact",variant:"default",icon:e(P,{svg:e(E.ExperimentOutline,{})}),onClick:l,children:"Run Experiment"}),e(U,{isDismissable:!0,type:"slideOver",onDismiss:()=>{a(null)},children:n})]})}function Ku(){const n=gn(t=>t.datasetName),a=gn(t=>t.latestVersion),l=u.useMemo(()=>`import phoenix as px
# Initialize a phoenix client
client = px.Client()
# Get the current dataset version. You can omit the version for the latest.
dataset = client.get_dataset(name="${n}"${a?`, version_id="${a.id}"`:""})`,[n,a]);return s(x,{padding:"size-400",overflow:"auto",children:[e(x,{paddingBottom:"size-100",children:e(F,{children:"Install Phoenix"})}),e(hn,{children:e(an,{value:bu})}),e(x,{paddingTop:"size-100",paddingBottom:"size-100",children:e(F,{children:"Point to a running instance of Phoenix"})}),e(hn,{children:e(an,{value:Su})}),e(x,{paddingTop:"size-100",paddingBottom:"size-100",children:e(F,{children:"Pull down this dataset"})}),e(hn,{children:e(an,{value:l})}),e(x,{paddingTop:"size-100",paddingBottom:"size-100",children:e(F,{children:"Define your task"})}),e(hn,{children:e(an,{value:vu})}),e(x,{paddingTop:"size-100",paddingBottom:"size-100",children:e(F,{children:"Define evaluators"})}),e(hn,{children:e(an,{value:Cu})}),e(x,{paddingTop:"size-100",paddingBottom:"size-100",children:e(F,{children:"Run an experiment"})}),e(hn,{children:e(an,{value:Fu})})]})}function Vm(){const n=Bn(),a=u.useMemo(()=>{const l=n.dataset.latestVersions;return l!=null&&l.edges&&l.edges.length?l.edges[0].version:null},[n]);return e(uu,{datasetId:n.dataset.id,datasetName:n.dataset.name,latestVersion:a,children:e(u.Suspense,{fallback:e(se,{}),children:e(Du,{dataset:n.dataset})})})}const xu=C`
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  .ac-tabs {
    flex: 1 1 auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    div[role="tablist"] {
      flex: none;
    }
    .ac-tabs__pane-container {
      flex: 1 1 auto;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      div[role="tabpanel"]:not([hidden]) {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        overflow: hidden;
      }
    }
  }
`;function Du({dataset:n}){const a=n.id,l=gn(d=>d.refreshLatestVersion),t=ge(),i=ae(),r=u.useCallback(d=>{d===0?i(`/datasets/${a}/experiments`):d===1&&i(`/datasets/${a}/examples`)},[i,a]),c=$r().pathname.includes("examples")?1:0;return s("main",{css:xu,children:[e(x,{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(F,{elementType:"h1",textSize:"xlarge",weight:"heavy",children:n.name}),e(F,{color:"text-700",children:n.description||"--"})]})})}),s(h,{direction:"row",gap:"size-100",children:[s(Ue,{align:"end",icon:e(P,{svg:e(E.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(J,{children:"Download CSV"},"csv"),e(J,{children:"Download OpenAI Fine-Tuning JSONL"},"openai-ft"),e(J,{children:"Download OpenAI Evals JSONL"},"openai-evals")]}),e(ku,{datasetId:n.id}),e(pu,{}),e(Gi,{}),e(gu,{datasetId:n.id,onAddExampleCompleted:()=>{t({title:"Example added",message:"The example has been added successfully and the version has been updated."}),l()}})]})]})}),s(ke,{onChange:r,defaultIndex:c,children:[e(q,{name:"Experiments",extra:e(Me,{children:n.experimentCount}),children:e(u.Suspense,{children:e(Ke,{})})}),e(q,{name:"Examples",extra:e(Me,{children:n.exampleCount}),children:e(u.Suspense,{children:e(Ke,{})})})]})]})}const Ui=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(
  $id: GlobalID!
) {
  dataset: node(id: $id) {
    __typename
    id
    ... on Dataset {
      id
      name
      description
      exampleCount
      experimentCount
      latestVersions: versions(first: 1, sort: {col: createdAt, dir: desc}) {
        edges {
          version: node {
            id
            description
            createdAt
          }
        }
      }
    }
  }
}
`}}}();Ui.hash="469da2debdebd608c88a6ef83c2540aa";async function $m(n){const{datasetId:a}=n.params;return await T.fetchQuery(Ie,Ui,{id:a}).toPromise()}const Wi=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"exampleId"}],a=[{kind:"Variable",name:"id",variableName:"exampleId"}],l={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},t={alias:null,args:null,kind:"ScalarField",name:"output",storageKey:null},i={alias:"latestRevision",args:null,concreteType:"DatasetExampleRevision",kind:"LinkedField",name:"revision",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"input",storageKey:null},t,{alias:null,args:null,kind:"ScalarField",name:"metadata",storageKey:null}],storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"traceId",storageKey:null},o={alias:null,args:null,concreteType:"Span",kind:"LinkedField",name:"span",plural:!1,selections:[l,{alias:null,args:null,concreteType:"SpanContext",kind:"LinkedField",name:"context",plural:!1,selections:[r],storageKey:null},{alias:null,args:null,concreteType:"Project",kind:"LinkedField",name:"project",plural:!1,selections:[l],storageKey:null}],storageKey:null},c={alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},d=[{kind:"Literal",name:"first",value:100}],m={alias:null,args:null,concreteType:"Trace",kind:"LinkedField",name:"trace",plural:!1,selections:[r,{alias:null,args:null,kind:"ScalarField",name:"projectId",storageKey:null}],storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ExampleDetailsDialogQuery",selections:[{alias:"example",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{kind:"InlineFragment",selections:[l,i,o],type:"DatasetExample",abstractKey:null},{args:null,kind:"FragmentSpread",name:"ExampleExperimentRunsTableFragment"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ExampleDetailsDialogQuery",selections:[{alias:"example",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[c,{kind:"TypeDiscriminator",abstractKey:"__isNode"},l,{kind:"InlineFragment",selections:[i,o,{alias:null,args:d,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:[l,{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},t,m,{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,{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},m],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:[c],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:"experimentRuns(first:100)"},{alias:null,args:d,filters:null,handle:"connection",key:"ExampleExperimentRunsTable_experimentRuns",kind:"LinkedHandle",name:"experimentRuns"}],type:"DatasetExample",abstractKey:null}],storageKey:null}]},params:{cacheID:"6fa23dc80c23ecdf48e57d139d76a721",id:null,metadata:{},name:"ExampleDetailsDialogQuery",operationKind:"query",text:`query ExampleDetailsDialogQuery(
  $exampleId: GlobalID!
) {
  example: node(id: $exampleId) {
    __typename
    ... on DatasetExample {
      id
      latestRevision: revision {
        input
        output
        metadata
      }
      span {
        id
        context {
          traceId
        }
        project {
          id
        }
      }
    }
    ...ExampleExperimentRunsTableFragment
    __isNode: __typename
    id
  }
}

fragment ExampleExperimentRunsTableFragment on DatasetExample {
  experimentRuns(first: 100) {
    edges {
      run: node {
        id
        startTime
        endTime
        error
        output
        trace {
          traceId
          projectId
        }
        annotations {
          edges {
            annotation: node {
              id
              name
              label
              score
              explanation
              annotatorKind
              trace {
                traceId
                projectId
              }
            }
          }
        }
      }
      cursor
      node {
        __typename
      }
    }
    pageInfo {
      endCursor
      hasNextPage
    }
  }
  id
}
`}}}();Wi.hash="65b1c049bacc1ef8739c61af32a9414c";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:"patchDatasetExamples",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"EditExampleDialogMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"EditExampleDialogMutation",selections:a},params:{cacheID:"7217082d3d3796ecb60481d17133c351",id:null,metadata:{},name:"EditExampleDialogMutation",operationKind:"mutation",text:`mutation EditExampleDialogMutation(
  $input: PatchDatasetExamplesInput!
) {
  patchDatasetExamples(input: $input) {
    __typename
  }
}
`}}}();Ji.hash="a5e0e601ed24ffaa37a99ba358f960d3";const Fa={backgroundColor:"light",borderColor:"light",collapsible:!0,bodyStyle:{padding:0}};function Tu(n){const{exampleId:a,onCompleted:l}=n,[t,i]=u.useState(null),[r,o]=T.useMutation(Ji),{control:c,setError:d,handleSubmit:m,formState:{isValid:f}}=qe({defaultValues:n.currentRevision}),g=u.useCallback(p=>{if(i(null),!Ee(p==null?void 0:p.input))return d("input",{message:"Input must be a valid JSON object"});if(!Ee(p==null?void 0:p.output))return d("output",{message:"Output must be a valid JSON object"});if(!Ee(p==null?void 0:p.metadata))return d("metadata",{message:"Metadata must be a valid JSON object"});r({variables:{input:{patches:[{exampleId:a,input:JSON.parse(p.input),output:JSON.parse(p.output),metadata:JSON.parse(p.metadata)}],versionDescription:p.description}},onCompleted:()=>{l()},onError:y=>{i(y.message)}})},[r,a,d,l]);return e(j,{size:"fullscreen",title:`Edit Example: ${a}`,extra:e(N,{variant:"primary",size:"compact",disabled:!f||o,loading:o,onClick:m(g),children:"Save Changes"}),children:e("div",{css:C`
          overflow-y: auto;
          padding: var(--ac-global-dimension-size-400);
          /* Make widths configurable */
          .dataset-picker {
            width: 100%;
            .ac-dropdown--picker,
            .ac-dropdown-button {
              width: 100%;
            }
          }
        `,children:e(h,{direction:"row",justifyContent:"center",children:e(x,{width:"900px",paddingStart:"auto",paddingEnd:"auto",children:s(h,{direction:"column",gap:"size-200",children:[t?e(Y,{variant:"danger",children:t}):null,e(G,{control:c,name:"input",render:({field:{onChange:p,onBlur:y,value:k},fieldState:{invalid:v,error:b}})=>s(z,{title:"Input",subTitle:"The input to the LLM, retriever, program, etc.",...Fa,children:[v?e(Y,{variant:"danger",banner:!0,children:b==null?void 0:b.message}):null,e(we,{value:k,onChange:p,onBlur:y})]})}),e(G,{control:c,name:"output",render:({field:{onChange:p,onBlur:y,value:k},fieldState:{invalid:v,error:b}})=>s(z,{title:"Output",subTitle:"The output of the LLM or program to be used as an expected output",...Fa,backgroundColor:"green-100",borderColor:"green-700",children:[v?e(Y,{variant:"danger",banner:!0,children:b==null?void 0:b.message}):null,e(we,{value:k,onChange:p,onBlur:y})]})}),e(G,{control:c,name:"metadata",render:({field:{onChange:p,onBlur:y,value:k},fieldState:{invalid:v,error:b}})=>s(z,{title:"Metadata",subTitle:"All data from the span to use during experimentation or evaluation",...Fa,children:[v?e(Y,{variant:"danger",banner:!0,children:b==null?void 0:b.message}):null,e(we,{value:k,onChange:p,onBlur:y})]})}),e(G,{control:c,name:"description",render:({field:{onChange:p,onBlur:y,value:k},fieldState:{invalid:v,error:b}})=>e(Zn,{label:"Revision Description",value:k,onChange:p,onBlur:y,errorMessage:b==null?void 0:b.message,validationState:v?"invalid":"valid",placeholder:"A description of the changes made in this revision. Will be displayed in the version history.",height:100})})]})})})})})}function Iu(n){const{onCompleted:a,...l}=n,[t,i]=u.useState(null);return s(H,{children:[e(N,{variant:"default",size:"compact",icon:e(P,{svg:e(E.EditOutline,{})}),onClick:()=>i(e(Tu,{...l,onCompleted:()=>{i(null),a()}})),children:"Edit Example"}),e(U,{type:"slideOver",isDismissable:!0,onDismiss:()=>i(null),children:t})]})}const Zi=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(
  $after: String = null
  $first: Int = 100
  $id: GlobalID!
) {
  node(id: $id) {
    __typename
    ...ExampleExperimentRunsTableFragment_2HEEH6
    __isNode: __typename
    id
  }
}

fragment ExampleExperimentRunsTableFragment_2HEEH6 on DatasetExample {
  experimentRuns(first: $first, after: $after) {
    edges {
      run: node {
        id
        startTime
        endTime
        error
        output
        trace {
          traceId
          projectId
        }
        annotations {
          edges {
            annotation: node {
              id
              name
              label
              score
              explanation
              annotatorKind
              trace {
                traceId
                projectId
              }
            }
          }
        }
      }
      cursor
      node {
        __typename
      }
    }
    pageInfo {
      endCursor
      hasNextPage
    }
  }
  id
}
`}}}();Zi.hash="6ca0f938b309407e8c184a1c13d1c52d";const Xi=function(){var n=["experimentRuns"],a={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},l={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{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:Zi,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"ExampleExperimentRunsTableFragment",selections:[{alias:"experimentRuns",args:null,concreteType:"ExperimentRunConnection",kind:"LinkedField",name:"__ExampleExperimentRunsTable_experimentRuns_connection",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:[a,{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},l,{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:[a,{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},l],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:[{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},a],type:"DatasetExample",abstractKey:null}}();Xi.hash="6ca0f938b309407e8c184a1c13d1c52d";const Lu=100;function _u(){return e("tbody",{className:"is-empty",children:e("tr",{children:e("td",{colSpan:100,css:n=>C`
            text-align: center;
            padding: ${n.spacing.margin24}px ${n.spacing.margin24}px !important;
          `,children:"No experiments have been run for this example."})})})}const Au=C`
  display: flex;
  flex-direction: row;
  align-items: center;
  color: var(--ac-global-color-primary);
  gap: var(--ac-global-dimension-size-50);
`;function Eu({example:n}){const a=u.useRef(null),l=ae(),{data:t,loadNext:i,hasNext:r,isLoadingNext:o}=T.usePaginationFragment(Xi,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]),m=ue({columns:[{header:"start time",accessorKey:"startTime",cell:ve},{header:"output",accessorKey:"output",cell:y=>{var v;const k=(v=y.row.original)==null?void 0:v.error;return k!==null?e(F,{color:"danger",children:k}):e(fe,{...y})}},{header:"latency",accessorKey:"latencyMs",cell:({getValue:y})=>{const k=y();return k===null||typeof k!="number"?"--":e(xe,{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,v)=>{const b=k.annotation;return e(Un,{annotation:b,extra:b.trace&&e(x,{paddingTop:"size-100",children:s("div",{css:Au,children:[e(P,{svg:e(E.InfoOutline,{})}),e("span",{children:"Click to view evaluator trace"})]})}),children:e(pn,{annotation:b,onClick:()=>{b.trace&&l(`/projects/${b.trace.projectId}/traces/${b.trace.traceId}`)}},v)},v)})})},{id:"actions",cell:({row:y})=>{const k=y.original.trace;if(k)return e(N,{variant:"default",size:"compact",icon:e(P,{svg:e(E.Trace,{})}),onClick:()=>{l(`/projects/${k.projectId}/traces/${k.traceId}`)},"aria-label":"view trace"})}}],data:c,getCoreRowModel:me()}),f=m.getRowModel().rows,g=f.length===0,p=u.useCallback(y=>{if(y){const{scrollHeight:k,scrollTop:v,clientHeight:b}=y;k-v-b<300&&!o&&r&&i(Lu)}},[r,o,i]);return e("div",{css:C`
        flex: 1 1 auto;
        overflow: auto;
      `,ref:a,onScroll:y=>p(y.target),children:s("table",{css:En,children:[e("thead",{children:m.getHeaderGroups().map(y=>e("tr",{children:y.headers.map(k=>e("th",{children:e("div",{children:B(k.column.columnDef.header,k.getContext())})},k.id))},y.id))}),g?e(_u,{}):e("tbody",{children:f.map(y=>e("tr",{children:y.getVisibleCells().map(k=>e("td",{children:B(k.column.columnDef.cell,k.getContext())},k.id))},y.id))})]})})}function Yi({exampleId:n,onDismiss:a}){const[l,t]=u.useState(0),i=T.useLazyLoadQuery(Wi,{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:m}=r,f=ae(),g=ge();return e(U,{type:"slideOver",isDismissable:!0,onDismiss:a,children:e(j,{size:"XL",title:`Example: ${n}`,extra:s(h,{direction:"row",gap:"size-100",children:[o?e(N,{variant:"default",size:"compact",onClick:()=>{f(`/projects/${o.projectId}/traces/${o.traceId}?selectedSpanNodeId=${o.id}`)},children:"View Source Span"}):null,e(Iu,{exampleId:n,currentRevision:r,onCompleted:()=>{g({title:"Example updated",message:`Example ${n} has been updated.`}),t(p=>p+1)}})]}),children:s(sn,{direction:"vertical",autoSaveId:"example-panel-group",children:[e(ce,{defaultSize:200,children:e("div",{css:C`
                overflow-y: auto;
                height: 100%;
              `,children:e(h,{direction:"row",justifyContent:"center",children:e(x,{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",...Ka,extra:e(X,{text:c}),children:e(ln,{value:c})}),e(z,{title:"Output",...Ka,extra:e(X,{text:d}),children:e(ln,{value:d})}),e(z,{title:"Metadata",...Ka,extra:e(X,{text:m}),children:e(ln,{value:m})})]})})})})}),e(on,{css:_n}),e(ce,{defaultSize:100,children:s(h,{direction:"column",height:"100%",children:[e(x,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderBottomColor:"dark",borderBottomWidth:"thin",flex:"none",children:e(te,{level:3,children:"Experiment Runs"})}),e(Eu,{example:i.example})]})})]})})})}const Ka={backgroundColor:"light",borderColor:"light",variant:"compact",collapsible:!0,bodyStyle:{padding:0}};function zm(){const{exampleId:n,datasetId:a}=je(),l=ae();return e(Yi,{exampleId:n,onDismiss:()=>{l(`/datasets/${a}/examples`)}})}const er=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(
  $id: GlobalID!
) {
  dataset: node(id: $id) {
    __typename
    id
    ...ExamplesTableFragment
  }
}

fragment ExamplesTableFragment on Dataset {
  examples(first: 100) {
    edges {
      example: node {
        id
        revision {
          input
          output
          metadata
        }
      }
      cursor
      node {
        __typename
      }
    }
    pageInfo {
      endCursor
      hasNextPage
    }
  }
  id
}
`}}}();er.hash="6406bbf43a2e850b384ba9573d8e69de";async function Qm(n){const{datasetId:a}=n.params;return await T.fetchQuery(Ie,er,{id:a}).toPromise()}const nr=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:null,kind:"LocalArgument",name:"datasetVersionId"},{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:"datasetVersionId",variableName:"datasetVersionId"},{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};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ExamplesTableQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:l,kind:"FragmentSpread",name:"ExamplesTableFragment"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ExamplesTableQuery",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:"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:[i,{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:null},{alias:null,args:l,filters:["datasetVersionId"],handle:"connection",key:"ExamplesTable_examples",kind:"LinkedHandle",name:"examples"}],type:"Dataset",abstractKey:null}],storageKey:null}]},params:{cacheID:"ca59c018695d41ca01b5f9d453386886",id:null,metadata:{},name:"ExamplesTableQuery",operationKind:"query",text:`query ExamplesTableQuery(
  $after: String = null
  $datasetVersionId: GlobalID
  $first: Int = 100
  $id: GlobalID!
) {
  node(id: $id) {
    __typename
    ...ExamplesTableFragment_4a6F8Z
    __isNode: __typename
    id
  }
}

fragment ExamplesTableFragment_4a6F8Z on Dataset {
  examples(datasetVersionId: $datasetVersionId, first: $first, after: $after) {
    edges {
      example: node {
        id
        revision {
          input
          output
          metadata
        }
      }
      cursor
      node {
        __typename
      }
    }
    pageInfo {
      endCursor
      hasNextPage
    }
  }
  id
}
`}}}();nr.hash="e04e697cdb44ab2dd115f4562211f6a4";const ar=function(){var n=["examples"],a={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null};return{argumentDefinitions:[{defaultValue:null,kind:"LocalArgument",name:"after"},{defaultValue:null,kind:"LocalArgument",name:"datasetVersionId"},{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:nr,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"ExamplesTableFragment",selections:[{alias:"examples",args:[{kind:"Variable",name:"datasetVersionId",variableName:"datasetVersionId"}],concreteType:"DatasetExampleConnection",kind:"LinkedField",name:"__ExamplesTable_examples_connection",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:[a,{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:[{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},a],type:"Dataset",abstractKey:null}}();ar.hash="e04e697cdb44ab2dd115f4562211f6a4";const lr=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"DatasetMutationPayload",kind:"LinkedField",name:"deleteDatasetExamples",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:"ExampleSelectionToolbarDeleteExamplesMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ExampleSelectionToolbarDeleteExamplesMutation",selections:a},params:{cacheID:"b63159f3c325b9af3dc469692f9329e5",id:null,metadata:{},name:"ExampleSelectionToolbarDeleteExamplesMutation",operationKind:"mutation",text:`mutation ExampleSelectionToolbarDeleteExamplesMutation(
  $input: DeleteDatasetExamplesInput!
) {
  deleteDatasetExamples(input: $input) {
    dataset {
      id
    }
  }
}
`}}}();lr.hash="455bf9e5dc4b9cc655095dc829ef7e12";function wu(n){const a=gn(y=>y.refreshLatestVersion),{selectedExamples:l,onExamplesDeleted:t,onClearSelection:i}=n,[r,o]=u.useState(null),c=ge(),d=An(),[m,f]=T.useMutation(lr),g=l.length!==1,p=u.useCallback(()=>{m({variables:{input:{exampleIds:l.map(y=>y.id)}},onCompleted:()=>{c({title:"Examples Deleted",message:`${l.length} example${g?"s":""} have been deleted.`}),t(),i(),a()},onError:y=>{d({title:"An error occurred",message:`Failed to delete examples: ${y.message}`})}})},[m,l,c,g,t,i,a,d]);return s("div",{css:C`
        position: absolute;
        bottom: var(--ac-global-dimension-size-400);
        left: 50%;
        transform: translateX(-50%);
      `,children:[e(x,{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(F,{children:`${l.length} example${g?"s":""} selected`}),s(h,{direction:"row",gap:"size-100",children:[e(N,{variant:"default",size:"compact",onClick:i,children:"Cancel"}),e(N,{variant:"danger",size:"compact",icon:e(P,{svg:e(E.TrashOutline,{})}),loading:f,disabled:f,onClick:p,children:f?"Deleting...":"Delete Example"+(g?"s":"")})]})]})}),e(U,{onDismiss:()=>{o(null)},children:r})]})}const Ru=100;function Pu({dataset:n}){const a=gn(A=>A.latestVersion),l=u.useRef(null),[t,i]=Te.useState({}),{data:r,loadNext:o,hasNext:c,isLoadingNext:d,refetch:m}=T.usePaginationFragment(ar,n);u.useEffect(()=>{u.startTransition(()=>{m({datasetVersionId:(a==null?void 0:a.id)||null},{fetchPolicy:"store-and-network"})})},[a,m]);const f=u.useMemo(()=>r.examples.edges.map(A=>{const K=A.example,D=K.revision;return{id:K.id,input:D.input,output:D.output,metadata:D.metadata}}),[r]),p=ue({columns:[{id:"select",header:({table:A})=>e(ze,{checked:A.getIsAllRowsSelected(),indeterminate:A.getIsSomeRowsSelected(),onChange:A.getToggleAllRowsSelectedHandler()}),cell:({row:A})=>e(ze,{checked:A.getIsSelected(),disabled:!A.getCanSelect(),indeterminate:A.getIsSomeSelected(),onChange:A.getToggleSelectedHandler()})},{header:"example id",accessorKey:"id",cell:({getValue:A,row:K})=>{const D=K.original.id;return e(wn,{to:`${D}`,children:A()})}},{header:"input",accessorKey:"input",cell:Fn},{header:"output",accessorKey:"output",cell:Fn},{header:"metadata",accessorKey:"metadata",cell:Fn}],data:f,state:{rowSelection:t},onRowSelectionChange:i,getCoreRowModel:me()}),y=p.getRowModel().rows,k=y.length===0,v=p.getSelectedRowModel().rows,b=v.map(A=>A.original),S=u.useCallback(()=>{i({})},[i]),L=u.useCallback(A=>{if(A){const{scrollHeight:K,scrollTop:D,clientHeight:R}=A;K-D-R<300&&!d&&c&&o(Ru)}},[c,d,o]),I=ae();return s("div",{css:C`
        flex: 1 1 auto;
        overflow: auto;
      `,ref:l,onScroll:A=>L(A.target),children:[s("table",{css:En,children:[e("thead",{children:p.getHeaderGroups().map(A=>e("tr",{children:A.headers.map(K=>e("th",{children:e("div",{children:B(K.column.columnDef.header,K.getContext())})},K.id))},A.id))}),k?e(Ge,{}):e("tbody",{children:y.map(A=>e("tr",{onClick:()=>{I(`${A.original.id}`)},children:A.getVisibleCells().map(K=>e("td",{children:B(K.column.columnDef.cell,K.getContext())},K.id))},A.id))})]}),v.length?e(wu,{selectedExamples:b,onClearSelection:S,onExamplesDeleted:()=>{m({},{fetchPolicy:"store-and-network"})}}):null]})}function Om(){const n=Bn();return s(H,{children:[e(Pu,{dataset:n.dataset})," ",e(u.Suspense,{children:e(Ke,{})})]})}const tr=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(
  $id: GlobalID!
) {
  dataset: node(id: $id) {
    __typename
    id
    ... on Dataset {
      ...ExperimentsTableFragment
    }
  }
}

fragment ExperimentsTableFragment on Dataset {
  experimentAnnotationSummaries {
    annotationName
    minScore
    maxScore
  }
  experiments(first: 100) {
    edges {
      experiment: node {
        id
        name
        sequenceNumber
        description
        createdAt
        metadata
        errorRate
        runCount
        averageRunLatencyMs
        project {
          id
        }
        annotationSummaries {
          annotationName
          meanScore
        }
      }
      cursor
      node {
        __typename
      }
    }
    pageInfo {
      endCursor
      hasNextPage
    }
  }
  id
}
`}}}();tr.hash="1461484d9e1232cbb99e1251edabbec3";async function jm(n){const{datasetId:a}=n.params;return await T.fetchQuery(Ie,tr,{id:a}).toPromise()}const ir=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,kind:"ScalarField",name:"annotationName",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ExperimentsTableQuery",selections:[{alias:null,args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[{args:l,kind:"FragmentSpread",name:"ExperimentsTableFragment"}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ExperimentsTableQuery",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:null,concreteType:"ExperimentAnnotationSummary",kind:"LinkedField",name:"experimentAnnotationSummaries",plural:!0,selections:[r,{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:l,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:[i,{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:[i],storageKey:null},{alias:null,args:null,concreteType:"ExperimentAnnotationSummary",kind:"LinkedField",name:"annotationSummaries",plural:!0,selections:[r,{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:null},{alias:null,args:l,filters:null,handle:"connection",key:"ExperimentsTable_experiments",kind:"LinkedHandle",name:"experiments"}],type:"Dataset",abstractKey:null}],storageKey:null}]},params:{cacheID:"1db5ce5523fa9a472c91d093b0e6160e",id:null,metadata:{},name:"ExperimentsTableQuery",operationKind:"query",text:`query ExperimentsTableQuery(
  $after: String = null
  $first: Int = 100
  $id: GlobalID!
) {
  node(id: $id) {
    __typename
    ...ExperimentsTableFragment_2HEEH6
    __isNode: __typename
    id
  }
}

fragment ExperimentsTableFragment_2HEEH6 on Dataset {
  experimentAnnotationSummaries {
    annotationName
    minScore
    maxScore
  }
  experiments(first: $first, after: $after) {
    edges {
      experiment: node {
        id
        name
        sequenceNumber
        description
        createdAt
        metadata
        errorRate
        runCount
        averageRunLatencyMs
        project {
          id
        }
        annotationSummaries {
          annotationName
          meanScore
        }
      }
      cursor
      node {
        __typename
      }
    }
    pageInfo {
      endCursor
      hasNextPage
    }
  }
  id
}
`}}}();ir.hash="c7c7580fe40888ceb86a1701fe4eedf4";const rr=function(){var n=["experiments"],a={alias:null,args:null,kind:"ScalarField",name:"annotationName",storageKey:null},l={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:ir,identifierInfo:{identifierField:"id",identifierQueryVariableName:"id"}}},name:"ExperimentsTableFragment",selections:[{alias:null,args:null,concreteType:"ExperimentAnnotationSummary",kind:"LinkedField",name:"experimentAnnotationSummaries",plural:!0,selections:[a,{alias:null,args:null,kind:"ScalarField",name:"minScore",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"maxScore",storageKey:null}],storageKey:null},{alias:"experiments",args:null,concreteType:"ExperimentConnection",kind:"LinkedField",name:"__ExperimentsTable_experiments_connection",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:[a,{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:[{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:"Dataset",abstractKey:null}}();rr.hash="c7c7580fe40888ceb86a1701fe4eedf4";function Mu({getValue:n}){const a=n(),l=a!==null?a*100:null,t=u.useMemo(()=>{if(l!==null)return l>=80?"red-1100":l>0?"orange-1100":"green-1100"},[l]);return e(F,{color:t,children:Ta(l)})}const sr=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"ExperimentMutationPayload",kind:"LinkedField",name:"deleteExperiments",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"ExperimentSelectionToolbarDeleteExperimentsMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"ExperimentSelectionToolbarDeleteExperimentsMutation",selections:a},params:{cacheID:"3af24cbaf3208c0d5ad1cd9313dd3823",id:null,metadata:{},name:"ExperimentSelectionToolbarDeleteExperimentsMutation",operationKind:"mutation",text:`mutation ExperimentSelectionToolbarDeleteExperimentsMutation(
  $input: DeleteExperimentsInput!
) {
  deleteExperiments(input: $input) {
    __typename
  }
}
`}}}();sr.hash="4ab310746eb51c6a3fcb799d2c972762";function Nu(n){const a=ae(),[l,t]=u.useState(null),[i,r]=T.useMutation(sr),{datasetId:o,selectedExperiments:c,onClearSelection:d,onExperimentsDeleted:m}=n,f=c.length!==1,g=ge(),p=An(),y=u.useCallback(()=>{i({variables:{input:{experimentIds:c.map(v=>v.id)}},onCompleted:()=>{g({title:"Examples Deleted",message:`${c.length} experiment${f?"s":""} have been deleted.`}),m(),d()},onError:v=>{p({title:"An error occurred",message:`Failed to delete examples: ${v.message}`})}})},[i,f,p,g,d,m,c]),k=u.useCallback(()=>{t(s(j,{size:"S",title:"Delete Experiments",children:[e(x,{padding:"size-200",children:e(F,{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(x,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(h,{direction:"row",justifyContent:"end",children:e(N,{variant:"danger",onClick:()=>{y(),t(null)},children:"Delete Experiments"})})})]}))},[y]);return s("div",{css:C`
        position: absolute;
        bottom: var(--ac-global-dimension-size-400);
        left: 50%;
        transform: translateX(-50%);
      `,children:[e(x,{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(F,{children:`${c.length} experiment${f?"s":""} selected`}),s(h,{direction:"row",gap:"size-100",children:[e(N,{variant:"default",size:"compact",onClick:d,children:"Cancel"}),e(N,{variant:"danger",size:"compact",icon:e(P,{svg:e(E.TrashOutline,{})}),loading:r,disabled:r,onClick:k,children:r?"Deleting...":"Delete"}),e(N,{variant:"primary",size:"compact",onClick:()=>{a(`/datasets/${o}/compare?${c.map(v=>`experimentId=${v.id}`).join("&")}`)},icon:e(P,{svg:e(E.ArrowCompareOutline,{})}),children:"Compare Experiments"})]})]})}),e(U,{onDismiss:()=>{t(null)},children:l})]})}const Vu=100;function $u(){return e("tbody",{className:"is-empty",children:e("tr",{children:s("td",{colSpan:100,css:C`
            text-align: center;
            padding: var(--ac-global-dimension-size-400) !important;
            .ac-button {
              margin-top: var(--ac-global-dimension-size-200);
              margin-left: auto;
              margin-right: auto;
            }
          `,children:["No experiments for this dataset. To see how to run experiments on a dataset, check out the documentation.",e(Gi,{})]})})})}function zu({dataset:n}){const a=u.useRef(null),[l,t]=u.useState({}),{data:i,loadNext:r,hasNext:o,isLoadingNext:c,refetch:d}=T.usePaginationFragment(rr,n),m=u.useMemo(()=>i.experiments.edges.map(K=>{const D=K.experiment.annotationSummaries.reduce((R,w)=>(R[w.annotationName]=w,R),{});return{...K.experiment,annotationSummaryMap:D}}),[i]),f=[{id:"select",header:({table:K})=>e(ze,{checked:K.getIsAllRowsSelected(),indeterminate:K.getIsSomeRowsSelected(),onChange:K.getToggleAllRowsSelectedHandler()}),cell:({row:K})=>e(ze,{checked:K.getIsSelected(),disabled:!K.getCanSelect(),indeterminate:K.getIsSomeSelected(),onChange:K.getToggleSelectedHandler()})},{header:"name",accessorKey:"name",minSize:200,cell:({getValue:K,row:D})=>{const R=D.original.id,w=D.original.sequenceNumber;return s(h,{direction:"row",gap:"size-100",children:[e(da,{sequenceNumber:w}),e(wn,{to:`/datasets/${n.id}/compare?experimentId=${R}`,children:K()})]})}},{header:"description",accessorKey:"description",minSize:300,cell:fe},{header:"created at",accessorKey:"createdAt",cell:ve}],g=i.experimentAnnotationSummaries.map(K=>{const{annotationName:D,minScore:R,maxScore:w}=K;return{header:()=>s(h,{direction:"row",gap:"size-100",wrap:!0,alignItems:"center",justifyContent:"end",children:[e(F,{children:D}),e(_s,{annotationName:D})]}),id:`annotation-${D}`,meta:{textAlign:"right"},cell:({row:O})=>{const Z=O.original.annotationSummaryMap[D];return!Z||Z.meanScore==null?e("span",{css:C`
                  float: right;
                `,children:"--"}):e(Qu,{annotationName:D,value:Z.meanScore,min:R,max:w})}}}),p=[{header:"run count",accessorKey:"runCount",meta:{textAlign:"right"},cell:As},{header:"avg latency",accessorKey:"averageRunLatencyMs",meta:{textAlign:"right"},cell:({getValue:K})=>{const D=K();return D===null||typeof D!="number"?"--":e(xe,{latencyMs:D})}},{header:"error rate",accessorKey:"errorRate",meta:{textAlign:"right"},cell:Mu},{header:"metadata",accessorKey:"metadata",minSize:200,cell:Fn},{id:"actions",cell:({row:K})=>{const D=K.original.project,R=K.original.metadata;return e(Ou,{projectId:(D==null?void 0:D.id)||null,experimentId:K.original.id,metadata:R})}}],y=ue({columns:[...f,...g,...p],data:m,getCoreRowModel:me(),state:{rowSelection:l},onRowSelectionChange:t}),k=y.getRowModel().rows,v=y.getSelectedRowModel().rows,b=v.map(K=>K.original),S=u.useCallback(()=>{t({})},[t]),L=k.length===0,I=u.useCallback(K=>{if(K){const{scrollHeight:D,scrollTop:R,clientHeight:w}=K;D-R-w<300&&!c&&o&&r(Vu)}},[o,c,r]),A=ae();return s("div",{css:C`
        flex: 1 1 auto;
        overflow: auto;
        width: table.getTotalSize();
      `,ref:a,onScroll:K=>I(K.target),children:[s("table",{css:En,children:[e("thead",{children:y.getHeaderGroups().map(K=>e("tr",{children:K.headers.map(D=>{var R,w;return e("th",{align:(w=(R=D.column.columnDef)==null?void 0:R.meta)==null?void 0:w.textAlign,children:e("div",{children:B(D.column.columnDef.header,D.getContext())})},D.id)})},K.id))}),L?e($u,{}):e("tbody",{children:k.map(K=>e("tr",{onClick:()=>{A(`/datasets/${n.id}/compare?experimentId=${K.original.id}`)},children:K.getVisibleCells().map(D=>e("td",{children:B(D.column.columnDef.cell,D.getContext())},D.id))},K.id))})]}),v.length?e(Nu,{datasetId:n.id,selectedExperiments:b,onClearSelection:S,onExperimentsDeleted:()=>{d({},{fetchPolicy:"store-and-network"})}}):null]})}function Qu({annotationName:n,value:a,min:l,max:t}){const i=Kl(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(Fe,{children:[e(Kn,{children:s("div",{css:C`
            float: right;
            --mod-barloader-fill-color: ${i};
            display: flex;
            flex-direction: row;
            align-items: center;
            gap: var(--ac-global-dimension-size-100);
          `,children:[Cn(a),e($s,{width:"40px",value:r,"aria-label":"where the mean score lands between overall min max"})]})}),e(Jn,{children:s(x,{width:"size-2400",children:[e(te,{level:3,weight:"heavy",children:n}),s(h,{direction:"column",children:[s(h,{justifyContent:"space-between",children:[e(F,{weight:"heavy",textSize:"small",children:"Mean Score"}),e(F,{textSize:"small",children:Cn(a)})]}),s(h,{justifyContent:"space-between",children:[e(F,{weight:"heavy",textSize:"small",children:"All Experiments Min"}),e(F,{textSize:"small",children:Cn(l)})]}),s(h,{justifyContent:"space-between",children:[e(F,{weight:"heavy",textSize:"small",children:"All Experiments Max"}),e(F,{textSize:"small",children:Cn(t)})]}),s(h,{justifyContent:"space-between",children:[e(F,{weight:"heavy",textSize:"small",children:"Mean Score Percentile"}),e(F,{textSize:"small",children:xl(r)})]})]})]})})]})}function Ou(n){const{projectId:a}=n,l=ae(),[t,i]=u.useState(null),r=ge();return s("div",{onClick:o=>{o.preventDefault(),o.stopPropagation()},children:[s(Ue,{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(j,{title:"Metadata",onDismiss:()=>i(null),children:e(ln,{value:JSON.stringify(n.metadata,null,2)})}));break}case"COPY_EXPERIMENT_ID":{zr(n.experimentId),r({title:"Copied",message:"The experiment ID has been copied to your clipboard"});break}default:be()}},children:[e(J,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(E.Trace,{})}),e(F,{children:"View run traces"})]})},"GO_TO_EXPERIMENT_RUN_TRACES"),e(J,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(E.InfoOutline,{})}),e(F,{children:"View metadata"})]})},"VIEW_METADATA"),e(J,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(E.ClipboardCopy,{})}),e(F,{children:"Copy experiment ID"})]})},"COPY_EXPERIMENT_ID")]}),e(U,{type:"modal",isDismissable:!0,onDismiss:()=>{i(null)},children:t})]})}function qm(){const n=Bn();return s(H,{children:[e(zu,{dataset:n.dataset}),e(u.Suspense,{children:e(Ke,{})})]})}const or=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(
  $experimentIds: [GlobalID!]!
  $datasetId: GlobalID!
) {
  comparisons: compareExperiments(experimentIds: $experimentIds) {
    example {
      id
      revision {
        input
        referenceOutput: output
      }
    }
    runComparisonItems {
      experimentId
      runs {
        output
        error
        startTime
        endTime
        trace {
          traceId
          projectId
        }
        annotations {
          edges {
            annotation: node {
              id
              name
              score
              label
              annotatorKind
              explanation
              trace {
                traceId
                projectId
              }
            }
          }
        }
      }
    }
  }
  dataset: node(id: $datasetId) {
    __typename
    id
    ... on Dataset {
      experiments {
        edges {
          experiment: node {
            id
            name
            sequenceNumber
          }
        }
      }
    }
  }
}
`}}}();or.hash="e6132b301f6d80be7f5c5b0653e25178";const xa={backgroundColor:"light",borderColor:"light",variant:"compact",collapsible:!0,bodyStyle:{padding:0}},ju=C`
  flex: 1 1 auto;
  overflow: auto;
  // Make sure the table fills up the remaining space
  table {
    min-width: 100%;
    td {
      vertical-align: top;
    }
  }
`,dr=C`
  position: relative;
  min-height: 75px;
  .controls {
    transition: opacity 0.2s ease-in-out;
    opacity: 0;
    display: none;
    z-index: 1;
  }
  &:hover .controls {
    opacity: 1;
    display: flex;
    // make them stand out
    .ac-button {
      border-color: var(--ac-global-color-primary);
    }
  }
`,cr=C`
  position: absolute;
  top: -23px;
  right: 0px;
  display: flex;
  flex-direction: row;
  gap: var(--ac-global-dimension-static-size-100);
`,qu=C`
  display: flex;
  flex-direction: row;
  align-items: center;
  color: var(--ac-global-color-primary);
  gap: var(--ac-global-dimension-size-50);
`;function Bu(n){const{datasetId:a,experimentIds:l,displayFullText:t}=n,i=T.useLazyLoadQuery(or,{experimentIds:l,datasetId:a}),r=u.useMemo(()=>{var b,S;return((S=(b=i.dataset)==null?void 0:b.experiments)==null?void 0:S.edges.reduce((L,I)=>(L[I.experiment.id]={...I.experiment},L),{}))||{}},[i]),o=u.useMemo(()=>i.comparisons.map(b=>{const S=b.runComparisonItems.reduce((L,I)=>(L[I.experimentId]=I,L),{});return{...b,id:b.example.id,input:b.example.revision.input,referenceOutput:b.example.revision.referenceOutput,runComparisonMap:S}}),[i]),[c,d]=u.useState(null),m=u.useMemo(()=>[{header:"input",accessorKey:"input",minWidth:500,cell:({row:b})=>s("div",{css:dr,children:[e(ja,{children:e(Na,{json:b.original.input,disableTitle:!0,space:t?2:0})}),e("div",{className:"controls",css:cr,children:s(Fe,{children:[e(N,{variant:"default",size:"compact","aria-label":"View example details",icon:e(P,{svg:e(E.ExpandOutline,{})}),onClick:()=>{u.startTransition(()=>{d(e(u.Suspense,{children:e(Yi,{exampleId:b.original.example.id,onDismiss:()=>{d(null)}})}))})}}),e(On,{children:"View Example"})]})})]})},{header:"reference output",accessorKey:"referenceOutput",minWidth:500,cell:t?Ju:Fn}],[t]),f=u.useMemo(()=>l.map(b=>({header:()=>{var I,A;const S=(I=r[b])==null?void 0:I.name,L=((A=r[b])==null?void 0:A.sequenceNumber)||0;return s(h,{direction:"row",gap:"size-100",wrap:!0,children:[e(da,{sequenceNumber:L}),e(F,{children:S})]})},accessorKey:b,minSize:500,cell:({row:S})=>{var O,Z;const L=S.original.runComparisonMap[b],I=(L==null?void 0:L.runs.length)||0;if(I===0)return e(tl,{});if(I>1)return e(F,{color:"warning",children:`${I} runs`});const A=L==null?void 0:L.runs[0];let K=null;const D=(O=A==null?void 0:A.trace)==null?void 0:O.traceId,R=(Z=A==null?void 0:A.trace)==null?void 0:Z.projectId;D&&R&&(K=s(Fe,{children:[e(N,{variant:"default",className:"trace-button",size:"compact","aria-label":"View run trace",icon:e(P,{svg:e(E.Trace,{})}),onClick:ne=>{ne.preventDefault(),ne.stopPropagation(),u.startTransition(()=>{d(e(pr,{traceId:D,projectId:R,title:"Experiment Run Trace"}))})}}),e(On,{children:"View Trace"})]}));const w=s(H,{children:[s(Fe,{children:[e(N,{variant:"default",className:"expand-button",size:"compact","aria-label":"View example run details",icon:e(P,{svg:e(E.ExpandOutline,{})}),onClick:ne=>{ne.preventDefault(),ne.stopPropagation(),u.startTransition(()=>{d(e(Zu,{selectedExample:S.original,datasetId:a,experimentInfoById:r}))})}}),e(On,{children:"View run details"})]}),K]});return A?e(Wu,{controls:w,children:e(Uu,{...A,displayFullText:t,setDialog:d})}):e(tl,{})}})),[l,r,a,t]),g=u.useMemo(()=>[...m,...f,{id:"tail",minSize:500}],[m,f]),p=ue({columns:g,data:o,getCoreRowModel:me(),columnResizeMode:"onChange"}),y=Te.useMemo(()=>{const b=p.getFlatHeaders(),S={};for(let L=0;L<b.length;L++){const I=b[L];S[`--header-${I.id}-size`]=I.getSize(),S[`--col-${I.column.id}-size`]=I.column.getSize()}return S},[p.getState().columnSizingInfo,p.getState().columnSizing]),v=p.getRowModel().rows.length===0;return s("div",{css:ju,children:[s("table",{css:b=>C(He(b),Es),style:{...y,width:p.getTotalSize(),minWidth:"100%"},children:[e("thead",{children:p.getHeaderGroups().map(b=>e("tr",{children:b.headers.map(S=>s("th",{style:{width:`calc(var(--header-${S==null?void 0:S.id}-size) * 1px)`},children:[e("div",{children:B(S.column.columnDef.header,S.getContext())}),e("div",{onMouseDown:S.getResizeHandler(),onTouchStart:S.getResizeHandler(),className:`resizer ${S.column.getIsResizing()?"isResizing":""}`})]},S.id))},b.id))}),v?e(Ge,{}):p.getState().columnSizingInfo.isResizingColumn?e(Hu,{table:p}):e(ur,{table:p})]}),e(U,{isDismissable:!0,type:"slideOver",onDismiss:()=>{d(null)},children:c})]})}function ur({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:B(l.column.columnDef.cell,l.getContext())},l.id))},a.id))})}const Hu=Te.memo(ur,(n,a)=>n.table.options.data===a.table.options.data);function Gu(n){const{datasetId:a,exampleId:l}=n,t=ae();return e("div",{onClick:i=>{i.preventDefault(),i.stopPropagation()},children:e(Ue,{buttonSize:"compact",align:"end",onAction:i=>{switch(i){case"gotoExample":return t(`/datasets/${a}/examples/${l}`);default:be()}},children:e(J,{children:s(h,{direction:"row",gap:"size-75",justifyContent:"start",alignItems:"center",children:[e(P,{svg:e(E.ExternalLinkOutline,{})}),e(F,{children:"Go to example"})]})},"gotoExample")})})}function Uu(n){const{output:a,error:l,startTime:t,endTime:i,annotations:r,displayFullText:o,setDialog:c}=n;if(l)return e(mr,{error:l});const d=r!=null&&r.edges.length?r.edges.map(m=>m.annotation):[];return s(h,{direction:"column",gap:"size-100",height:"100%",justifyContent:"space-between",children:[e(ja,{children:e(Na,{json:a,disableTitle:!0,space:o?2:0})}),s("ul",{css:C`
          display: flex;
          flex-direction: row;
          gap: var(--ac-global-dimension-static-size-100);
          align-items: center;
          flex-wrap: wrap;
        `,children:[e("li",{children:e(gr,{startTime:t,endTime:i})},"run-latency"),d.map(m=>e("li",{children:e(Un,{annotation:m,extra:m.trace&&e(x,{paddingTop:"size-100",children:s("div",{css:qu,children:[e(P,{svg:e(E.InfoOutline,{})}),e("span",{children:"Click to view evaluator trace"})]})}),children:e(pn,{annotation:m,onClick:()=>{const f=m.trace;f&&u.startTransition(()=>{c(e(pr,{traceId:f.traceId,projectId:f.projectId,title:`Evaluator Trace: ${m.name}`}))})}})})},m.id))]})]})}function Wu(n){return s("div",{css:dr,children:[n.children,e("div",{css:cr,className:"controls",children:n.controls})]})}function mr({error:n}){return s(h,{direction:"row",gap:"size-50",alignItems:"center",children:[e(P,{svg:e(E.AlertCircleOutline,{}),color:"danger"}),e(F,{color:"danger",children:n})]})}function gr({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(xe,{latencyMs:l})}function tl(){return s(h,{direction:"row",gap:"size-50",children:[e(P,{svg:e(E.MinusCircleOutline,{}),color:"grey-800"}),e(F,{color:"text-700",children:"not run"})]})}function Ju({getValue:n}){const a=n();return e(ja,{children:e(Na,{json:a,space:2})})}function ja({children:n}){return e("div",{css:C`
        max-height: 300px;
        overflow-y: auto;
      `,children:n})}function Zu({selectedExample:n,datasetId:a,experimentInfoById:l}){return e(j,{title:`Comparing Experiments for Example: ${n.id}`,size:"fullscreen",extra:e(Gu,{datasetId:a,exampleId:n.id}),children:s(sn,{direction:"vertical",autoSaveId:"example-compare-panel-group",children:[e(ce,{defaultSize:100,children:e("div",{css:C`
              overflow-y: auto;
              height: 100%;
            `,children:e(x,{overflow:"hidden",padding:"size-200",children:s(h,{direction:"row",gap:"size-200",flex:"1 1 auto",children:[e(x,{width:"50%",children:e(z,{title:"Input",...xa,bodyStyle:{padding:0,maxHeight:"300px",overflowY:"auto"},extra:e(X,{text:JSON.stringify(n.input)}),children:e(ln,{value:JSON.stringify(n.input,null,2)})})}),e(x,{width:"50%",children:e(z,{title:"Reference Output",...xa,extra:e(X,{text:JSON.stringify(n.input)}),bodyStyle:{padding:0,maxHeight:"300px",overflowY:"auto"},children:e(ln,{value:JSON.stringify(n.referenceOutput,null,2)})})})]})})})}),e(on,{css:_n}),e(ce,{defaultSize:200,children:s(h,{direction:"column",height:"100%",children:[e(x,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderBottomColor:"dark",borderBottomWidth:"thin",flex:"none",children:e(te,{level:2,children:"Experiments"})}),e("div",{css:C`
                overflow-y: auto;
                height: 100%;
                padding: var(--ac-global-dimension-static-size-200);
              `,children:e("ul",{css:C`
                  display: flex;
                  flex-direction: column;
                  gap: var(--ac-global-dimension-static-size-200);
                `,children:n.runComparisonItems.map(t=>{const i=l[t.experimentId];return e("li",{children:e(z,{...xa,title:i==null?void 0:i.name,titleExtra:e(da,{sequenceNumber:(i==null?void 0:i.sequenceNumber)||0}),children:e("ul",{children:t.runs.map((r,o)=>{var c;return e("li",{children:s(h,{direction:"row",children:[e(x,{flex:!0,children:r.error?e(x,{padding:"size-200",children:e(mr,{error:r.error})}):e(ln,{value:JSON.stringify(r.output,null,2)})}),s(Sn,{width:"size-3000",children:[e(gr,{startTime:r.startTime,endTime:r.endTime}),e("ul",{css:C`
                                      margin-top: var(
                                        --ac-global-dimension-static-size-100
                                      );
                                      display: flex;
                                      flex-direction: column;
                                      justify-content: flex-start;
                                      align-items: flex-end;
                                      gap: var(
                                        --ac-global-dimension-static-size-100
                                      );
                                    `,children:(c=r.annotations)==null?void 0:c.edges.map(d=>e("li",{children:e(pn,{annotation:d.annotation})},d.annotation.id))})]})]})},o)})})})},t.experimentId)})})})]})})]})})}function pr({traceId:n,projectId:a,title:l}){const t=ae();return e(j,{title:l,size:"fullscreen",extra:e(N,{variant:"default",onClick:()=>t(`/projects/${a}/traces/${n}`),children:"View Trace in Project"}),children:e(jt,{traceId:n,projectId:a})})}const yr={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};yr.hash="1aa376b1e9425f49268ac231dc2c0412";function Xu(n){const{dataset:a,selectedExperimentIds:l,onChange:t,label:i,validationState:r,description:o,errorMessage:c,...d}=n,m=T.useFragment(yr,a),f=u.useMemo(()=>m.experiments.edges.map(y=>y.experiment),[m]),g=f.length===0,p=u.useMemo(()=>{if(g)return"No experiments";const y=l.length;return y>0?`${y} experiment${y>1?"s":""}`:"No experiments selected"},[l,g]);return e(ma,{label:i,isDisabled:g,validationState:r,description:o,errorMessage:c,children:e(za,{isDisabled:g,...d,menu:e(Wn,{selectionMode:"multiple",onSelectionChange:y=>{t(Array.from(y))},selectedKeys:new Set(l),children:f.map(y=>e(J,{textValue:y.name,children:s(h,{direction:"column",gap:"size-50",children:[s(h,{direction:"row",gap:"size-100",children:[e(da,{sequenceNumber:y.sequenceNumber}),e(F,{children:y.name})]}),e(F,{textSize:"small",color:"text-700",children:new Date(y.createdAt).toLocaleString()})]})},y.id))}),triggerProps:{placement:"bottom start"},children:p})})}function Bm(){const n=Bn(),[a,l]=u.useState(!1),[t,i]=ol(),r=t.getAll("experimentId"),o=r.length>0;return s("main",{css:C`
        height: 100%;
        display: flex;
        flex-direction: column;
        overflow: hidden;
      `,children:[e(x,{padding:"size-200",borderBottomColor:"dark",borderBottomWidth:"thin",flex:"none",children:s(h,{direction:"column",gap:"size-100",children:[e(te,{level:1,children:"Compare Experiments"}),s(h,{direction:"row",justifyContent:"space-between",alignItems:"end",children:[e(Xu,{dataset:n.dataset,selectedExperimentIds:r,label:"experiments",onChange:c=>{u.startTransition(()=>{t.delete("experimentId"),c.forEach(d=>{t.append("experimentId",d)}),i(t)})}}),e(ca,{onChange:c=>{l(c)},defaultSelected:!1,labelPlacement:"start",children:"Full Text"})]})]})}),o?e(u.Suspense,{fallback:e(se,{}),children:e(Bu,{datasetId:n.dataset.id,experimentIds:r,displayFullText:a})}):e(x,{padding:"size-200",children:e(Y,{variant:"info",title:"No Experiment Selected",children:"Please select one or more experiments."})})]})}const fr=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:"name",storageKey:null};return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"experimentCompareLoaderQuery",selections:[{alias:"dataset",args:a,concreteType:null,kind:"LinkedField",name:"node",plural:!1,selections:[l,{kind:"InlineFragment",selections:[t,{args:null,kind:"FragmentSpread",name:"ExperimentMultiSelector__experiments"}],type:"Dataset",abstractKey:null}],storageKey:null}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"experimentCompareLoaderQuery",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,{kind:"InlineFragment",selections:[t,{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,t,{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}],storageKey:null}]},params:{cacheID:"7e89f99f940098a21985137aae870de7",id:null,metadata:{},name:"experimentCompareLoaderQuery",operationKind:"query",text:`query experimentCompareLoaderQuery(
  $id: GlobalID!
) {
  dataset: node(id: $id) {
    __typename
    id
    ... on Dataset {
      id
      name
      ...ExperimentMultiSelector__experiments
    }
  }
}

fragment ExperimentMultiSelector__experiments on Dataset {
  experiments {
    edges {
      experiment: node {
        id
        name
        sequenceNumber
        createdAt
      }
    }
  }
}
`}}}();fr.hash="fa02088830fd16688f0f2fba9a0009eb";async function Hm(n){const{datasetId:a}=n.params;return await T.fetchQuery(Ie,fr,{id:a}).toPromise()}const hr=function(){var n=[{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}];return{fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"APIKeysCardQuery",selections:[{args:null,kind:"FragmentSpread",name:"SystemAPIKeysTableFragment"},{args:null,kind:"FragmentSpread",name:"UserAPIKeysTableFragment"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"APIKeysCardQuery",selections:[{alias:null,args:null,concreteType:"SystemApiKey",kind:"LinkedField",name:"systemApiKeys",plural:!0,selections:n,storageKey:null},{alias:null,args:null,concreteType:"UserApiKey",kind:"LinkedField",name:"userApiKeys",plural:!0,selections:n,storageKey:null}]},params:{cacheID:"b5ca39f5901adfac7e884cb2555989fa",id:null,metadata:{},name:"APIKeysCardQuery",operationKind:"query",text:`query APIKeysCardQuery {
  ...SystemAPIKeysTableFragment
  ...UserAPIKeysTableFragment
}

fragment SystemAPIKeysTableFragment on Query {
  systemApiKeys {
    id
    name
    description
    createdAt
    expiresAt
  }
}

fragment UserAPIKeysTableFragment on Query {
  userApiKeys {
    id
    name
    description
    createdAt
    expiresAt
  }
}
`}}}();hr.hash="ad967afd45af0d5976982c70eaadb330";const kr=function(){var n={defaultValue:null,kind:"LocalArgument",name:"description"},a={defaultValue:null,kind:"LocalArgument",name:"expiresAt"},l={defaultValue:null,kind:"LocalArgument",name:"name"},t=[{fields:[{kind:"Variable",name:"description",variableName:"description"},{kind:"Variable",name:"expiresAt",variableName:"expiresAt"},{kind:"Variable",name:"name",variableName:"name"}],kind:"ObjectValue",name:"input"}],i={alias:null,args:null,kind:"ScalarField",name:"jwt",storageKey:null},r={alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},o={alias:null,args:null,concreteType:"SystemApiKey",kind:"LinkedField",name:"apiKey",plural:!1,selections:[r],storageKey:null};return{fragment:{argumentDefinitions:[n,a,l],kind:"Fragment",metadata:null,name:"CreateSystemAPIKeyDialogMutation",selections:[{alias:null,args:t,concreteType:"CreateSystemApiKeyMutationPayload",kind:"LinkedField",name:"createSystemApiKey",plural:!1,selections:[i,{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{args:null,kind:"FragmentSpread",name:"SystemAPIKeysTableFragment"}],storageKey:null},o],storageKey:null}],type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[l,n,a],kind:"Operation",name:"CreateSystemAPIKeyDialogMutation",selections:[{alias:null,args:t,concreteType:"CreateSystemApiKeyMutationPayload",kind:"LinkedField",name:"createSystemApiKey",plural:!1,selections:[i,{alias:null,args:null,concreteType:"Query",kind:"LinkedField",name:"query",plural:!1,selections:[{alias:null,args:null,concreteType:"SystemApiKey",kind:"LinkedField",name:"systemApiKeys",plural:!0,selections:[r,{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}],storageKey:null},o],storageKey:null}]},params:{cacheID:"e162ef32e40e2920bbdb388bedd83989",id:null,metadata:{},name:"CreateSystemAPIKeyDialogMutation",operationKind:"mutation",text:`mutation CreateSystemAPIKeyDialogMutation(
  $name: String!
  $description: String = null
  $expiresAt: DateTime = null
) {
  createSystemApiKey(input: {name: $name, description: $description, expiresAt: $expiresAt}) {
    jwt
    query {
      ...SystemAPIKeysTableFragment
    }
    apiKey {
      id
    }
  }
}

fragment SystemAPIKeysTableFragment on Query {
  systemApiKeys {
    id
    name
    description
    createdAt
    expiresAt
  }
}
`}}}();kr.hash="8e8563676b39f1e44ef4bac4057ef7e3";function Yu(n){const{onSystemKeyCreated:a}=n,[l,t]=u.useState(null),{control:i,handleSubmit:r,formState:{isDirty:o,isValid:c},setError:d}=qe({defaultValues:{name:"System",description:"",expiresAt:""}}),[m,f]=T.useMutation(kr),g=u.useCallback(p=>{if(p.expiresAt){const y=cl(p.expiresAt);if(!ul(y))return d("expiresAt",{message:"Date is not in a valid format"});if(y<new Date)return d("expiresAt",{message:"Date must be in the future"})}t(null),m({variables:{...p,expiresAt:p.expiresAt||null},onCompleted:y=>{a(y.createSystemApiKey.jwt)},onError:y=>{t(y.message)}})},[m,a,d]);return s(j,{title:"Create a System Key",isDismissable:!0,children:[l&&e(Y,{variant:"danger",banner:!0,children:l}),s(Qr,{onSubmit:r(g),children:[s(x,{padding:"size-200",children:[e(G,{name:"name",control:i,rules:{required:"System key name is required"},render:({field:{onChange:p,onBlur:y,value:k},fieldState:{invalid:v,error:b}})=>e(le,{label:"Name",description:"A short name to identify this key",errorMessage:b==null?void 0:b.message,validationState:v?"invalid":"valid",onChange:p,onBlur:y,value:k.toString()})}),e(G,{name:"description",control:i,render:({field:{onChange:p,onBlur:y,value:k},fieldState:{invalid:v,error:b}})=>e(Zn,{label:"description",description:"A description of the system key",isRequired:!1,height:100,errorMessage:b==null?void 0:b.message,validationState:v?"invalid":"valid",onChange:p,onBlur:y,value:k==null?void 0:k.toString()})}),e(G,{name:"expiresAt",control:i,render:({field:{name:p,onChange:y,onBlur:k,value:v},fieldState:{invalid:b,error:S}})=>e(le,{label:"Expires At",type:"datetime-local",name:p,description:"The date at which the key will expire. Optional",errorMessage:S==null?void 0:S.message,validationState:b?"invalid":"valid",onChange:y,onBlur:k,defaultValue:v})})]}),e(x,{paddingStart:"size-200",paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderColor:"dark",borderTopWidth:"thin",children:e(h,{direction:"row",gap:"size-100",justifyContent:"end",children:e(N,{variant:o?"primary":"default",type:"submit",size:"compact",disabled:!c||f,children:f?"Creating...":"Create Key"})})})]})]})}const br=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"DeleteSystemApiKeyMutationPayload",kind:"LinkedField",name:"deleteSystemApiKey",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"__typename",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"SystemAPIKeysTableDeleteAPIKeyMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"SystemAPIKeysTableDeleteAPIKeyMutation",selections:a},params:{cacheID:"c65d1d86f282379c1f529a7234b60120",id:null,metadata:{},name:"SystemAPIKeysTableDeleteAPIKeyMutation",operationKind:"mutation",text:`mutation SystemAPIKeysTableDeleteAPIKeyMutation(
  $input: DeleteApiKeyInput!
) {
  deleteSystemApiKey(input: $input) {
    __typename
    id
  }
}
`}}}();br.hash="5b7f3beaf38ac72be768417e2082c889";const Sr={fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"SystemAPIKeysTableQuery",selections:[{args:null,kind:"FragmentSpread",name:"SystemAPIKeysTableFragment"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"SystemAPIKeysTableQuery",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}]},params:{cacheID:"94e06b8cd5879701a5d73bee083ad614",id:null,metadata:{},name:"SystemAPIKeysTableQuery",operationKind:"query",text:`query SystemAPIKeysTableQuery {
  ...SystemAPIKeysTableFragment
}

fragment SystemAPIKeysTableFragment on Query {
  systemApiKeys {
    id
    name
    description
    createdAt
    expiresAt
  }
}
`}};Sr.hash="de0fc04de739f0adfcbdeaff28b16265";const vr={argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:[],operation:Sr}},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};vr.hash="de0fc04de739f0adfcbdeaff28b16265";function Cr({handleDelete:n}){const[a,l]=u.useState(null),t=()=>{l(s(j,{title:"Delete System Key",children:[e(x,{padding:"size-200",children:e(F,{color:"danger",children:"Are you sure you want to delete this key? This cannot be undone and will disable all uses of this key."})}),e(x,{paddingEnd:"size-200",paddingTop:"size-100",paddingBottom:"size-100",borderTopColor:"light",borderTopWidth:"thin",children:e(h,{direction:"row",justifyContent:"end",children:e(N,{variant:"danger",onClick:()=>{n(),l(null)},children:"Delete Key"})})})]}))};return s(H,{children:[e(N,{variant:"danger",size:"compact",icon:e(P,{svg:e(E.TrashOutline,{})}),"aria-label":"Delete System Key",onClick:t}),e(U,{isDismissable:!0,onDismiss:()=>{l(null)},children:a})]})}function em({query:n}){const[a,l]=T.useRefetchableFragment(vr,n),t=ge(),[i]=T.useMutation(br),r=u.useCallback(g=>{i({variables:{input:{id:g}},onCompleted:()=>{t({title:"System key deleted",message:"The system key has been deleted and is no longer active."}),u.startTransition(()=>{l({},{fetchPolicy:"network-only"})})}})},[i,t]),o=u.useMemo(()=>[...a.systemApiKeys],[a]),c=u.useMemo(()=>[{header:"Name",accessorKey:"name"},{header:"Description",accessorKey:"description",cell:fe},{header:"Created At",accessorKey:"createdAt",cell:ve},{header:"Expires At",accessorKey:"expiresAt",cell:ve},{header:"",accessorKey:"id",size:10,cell:({row:p})=>e(h,{direction:"row",justifyContent:"end",width:"100%",children:e(Cr,{handleDelete:()=>{r(p.original.id)}})}),meta:{textAlign:"right"}}],[l,r]),d=ue({columns:c,data:o,getCoreRowModel:me()}),m=d.getRowModel().rows,f=d.getRowModel().rows.length===0;return s("table",{css:He,children:[e("thead",{children:d.getHeaderGroups().map(g=>e("tr",{children:g.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:[B(p.column.columnDef.header,p.getContext()),p.column.getIsSorted()?e(P,{className:"sort-icon",svg:p.column.getIsSorted()==="asc"?e(E.ArrowUpFilled,{}):e(E.ArrowDownFilled,{})}):null]})},p.id))},g.id))}),f?e(Ge,{message:"No Keys"}):e("tbody",{children:m.map(g=>e("tr",{children:g.getVisibleCells().map(p=>e("td",{children:B(p.column.columnDef.cell,p.getContext())},p.id))},g.id))})]})}const Fr={fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"UserAPIKeysTableQuery",selections:[{args:null,kind:"FragmentSpread",name:"UserAPIKeysTableFragment"}],type:"Query",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"UserAPIKeysTableQuery",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}],storageKey:null}]},params:{cacheID:"cd87c66812c50e80c23448d835b9ab43",id:null,metadata:{},name:"UserAPIKeysTableQuery",operationKind:"query",text:`query UserAPIKeysTableQuery {
  ...UserAPIKeysTableFragment
}

fragment UserAPIKeysTableFragment on Query {
  userApiKeys {
    id
    name
    description
    createdAt
    expiresAt
  }
}
`}};Fr.hash="b74ea37cf5a935ebe3ce165a42a5fbf7";const Kr={argumentDefinitions:[],kind:"Fragment",metadata:{refetch:{connection:null,fragmentPathInResult:[],operation:Fr}},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}],storageKey:null}],type:"Query",abstractKey:null};Kr.hash="b74ea37cf5a935ebe3ce165a42a5fbf7";function nm({query:n}){const[a,l]=T.useRefetchableFragment(Kr,n),t=u.useMemo(()=>[...a.userApiKeys],[a]),i=u.useMemo(()=>[{header:"Name",accessorKey:"name"},{header:"Description",accessorKey:"description",cell:fe},{header:"Created At",accessorKey:"createdAt",cell:ve},{header:"Expires At",accessorKey:"expiresAt",cell:ve},{header:"",accessorKey:"id",size:10,cell:()=>e(h,{direction:"row",justifyContent:"end",width:"100%",children:e(Cr,{handleDelete:()=>{u.startTransition(()=>{l({},{fetchPolicy:"network-only"})})}})}),meta:{textAlign:"right"}}],[l]),r=ue({columns:i,data:t,getCoreRowModel:me()}),o=r.getRowModel().rows,c=r.getRowModel().rows.length===0;return s("table",{css:He,children:[e("thead",{children:r.getHeaderGroups().map(d=>e("tr",{children:d.headers.map(m=>e("th",{colSpan:m.colSpan,children:m.isPlaceholder?null:s("div",{className:m.column.getCanSort()?"cursor-pointer":"",onClick:m.column.getToggleSortingHandler(),style:{left:m.getStart(),width:m.getSize()},children:[B(m.column.columnDef.header,m.getContext()),m.column.getIsSorted()?e(P,{className:"sort-icon",svg:m.column.getIsSorted()==="asc"?e(E.ArrowUpFilled,{}):e(E.ArrowDownFilled,{})}):null]})},m.id))},d.id))}),c?e(Ge,{message:"No Keys"}):e("tbody",{children:o.map(d=>e("tr",{children:d.getVisibleCells().map(m=>e("td",{children:B(m.column.columnDef.cell,m.getContext())},m.id))},d.id))})]})}function am(){const n=T.useLazyLoadQuery(hr,{});return s(ke,{children:[e(q,{title:"System Keys",name:"System Keys",children:e(em,{query:n})}),e(q,{title:"User Keys",name:"User Keys",children:e(nm,{query:n})})]})}function lm(){const[n,a]=u.useState(null),l=i=>{a(e(tm,{jwt:i}))},t=()=>{a(e(Yu,{onSystemKeyCreated:l}))};return s("div",{children:[e(Va,{title:"API Keys",variant:"compact",extra:e(N,{variant:"default",size:"compact",icon:e(P,{svg:e(E.PlusCircleOutline,{})}),onClick:t,children:"System Key"}),children:e(u.Suspense,{fallback:e(x,{padding:"size-100",children:e(se,{})}),children:e(am,{})})}),e(U,{onDismiss:()=>{a(null)},children:n})]})}function tm(n){const{jwt:a}=n;return s(j,{title:"New API Key Created",isDismissable:!0,children:[e(Y,{variant:"success",banner:!0,children:"You have successfully created a new API key. The API key will only be displayed once below. Please copy and save it in a secure location."}),e("div",{css:C`
          padding: var(--ac-global-dimension-size-200);
          .ac-field {
            width: 100%;
          }
        `,children:s(h,{direction:"row",gap:"size-100",alignItems:"end",children:[e(le,{label:"API Key",isReadOnly:!0,value:a,minWidth:"100%"}),e(X,{text:a,size:"normal"})]})})]})}const xr={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:"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,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:"475e4a6a89583e17246b7f9fe5b0cb84",id:null,metadata:{},name:"UsersCardQuery",operationKind:"query",text:`query UsersCardQuery {
  ...UsersTable_users
}

fragment UsersTable_users on Query {
  users {
    edges {
      user: node {
        email
        username
        createdAt
        role {
          name
        }
      }
    }
  }
}
`}};xr.hash="2b3e260c950dd1a6a1a6883ff6fb78c4";const Dr=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"input"}],a=[{alias:null,args:[{kind:"Variable",name:"input",variableName:"input"}],concreteType:"UserMutationPayload",kind:"LinkedField",name:"createUser",plural:!1,selections:[{alias:null,args:null,concreteType:"User",kind:"LinkedField",name:"user",plural:!1,selections:[{alias:null,args:null,kind:"ScalarField",name:"id",storageKey:null},{alias:null,args:null,kind:"ScalarField",name:"email",storageKey:null}],storageKey:null}],storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"NewUserDialogMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"NewUserDialogMutation",selections:a},params:{cacheID:"a9bf3794a5355d9d0e0a3acebe7f3809",id:null,metadata:{},name:"NewUserDialogMutation",operationKind:"mutation",text:`mutation NewUserDialogMutation(
  $input: CreateUserInput!
) {
  createUser(input: $input) {
    user {
      id
      email
    }
  }
}
`}}}();Dr.hash="97d1aefa41e8831e57b6bb0d1a078a7c";function im({onNewUserCreated:n,onNewUserCreationError:a,onDismiss:l}){const[t,i]=T.useMutation(Dr),r=u.useCallback(o=>{t({variables:{input:o},onCompleted:c=>{n(c.createUser.user.email)},onError:c=>{a(c)}})},[t,n,a]);return e(U,{onDismiss:l,isDismissable:!0,type:"modal",isKeyboardDismissDisabled:!0,children:e(j,{title:"Add user",children:e(ws,{onSubmit:r,isSubmitting:i})})})}const Tr={argumentDefinitions:[],kind:"Fragment",metadata:null,name:"UsersTable_users",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:"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,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}],type:"Query",abstractKey:null};Tr.hash="a87302705dfc7b091db312313f46ec4f";function rm({query:n}){const a=T.useFragment(Tr,n),l=u.useMemo(()=>a.users.edges.map(({user:o})=>({email:o.email,username:o.username,createdAt:o.createdAt,roleName:o.role.name.toLocaleLowerCase()})),[a]),t=ue({columns:[{header:"email",accessorKey:"email"},{header:"username",accessorKey:"username"},{header:"role",accessorKey:"roleName"},{header:"created at",accessorKey:"createdAt",cell:ve}],data:l,getCoreRowModel:me(),getSortedRowModel:Dn()}),i=t.getRowModel().rows,r=t.getRowModel().rows.length===0;return s("table",{css:He,children:[e("thead",{children:t.getHeaderGroups().map(o=>e("tr",{children:o.headers.map(c=>e("th",{colSpan:c.colSpan,children:c.isPlaceholder?null:s("div",{className:c.column.getCanSort()?"cursor-pointer":"",onClick:c.column.getToggleSortingHandler(),style:{left:c.getStart(),width:c.getSize()},children:[B(c.column.columnDef.header,c.getContext()),c.column.getIsSorted()?e(P,{className:"sort-icon",svg:c.column.getIsSorted()==="asc"?e(E.ArrowUpFilled,{}):e(E.ArrowDownFilled,{})}):null]})},c.id))},o.id))}),r?e(Ge,{}):e("tbody",{children:i.map(o=>e("tr",{children:o.getVisibleCells().map(c=>e("td",{children:B(c.column.columnDef.cell,c.getContext())},c.id))},o.id))})]})}function sm(){const[n,a]=u.useState(0),[l,t]=u.useState(null),i=ge(),r=An(),o=T.useLazyLoadQuery(xr,{},{fetchKey:n,fetchPolicy:"store-and-network"});return s(z,{title:"Users",variant:"compact",bodyStyle:{padding:0},extra:e(N,{onClick:()=>{t(e(im,{onDismiss:()=>{t(null)},onNewUserCreated:c=>{i({title:"User added",message:`User ${c} has been added.`}),a(d=>d+1),t(null)},onNewUserCreationError:c=>{r({title:"Error adding user",message:c.message})}}))},variant:"default",size:"compact",icon:e(P,{svg:e(E.PlusCircleOutline,{})}),children:"Add User"}),children:[e(u.Suspense,{fallback:e(x,{padding:"size-e00",children:e(se,{})}),children:e(rm,{query:o})}),e(U,{onDismiss:()=>{t(null)},children:l})]})}const om=C`
  overflow-y: auto;
`,dm=C`
  padding: var(--ac-global-dimension-size-400);
  max-width: 1000px;
  min-width: 500px;
  box-sizing: border-box;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
`,cm=C`
  .ac-field {
    // Hacky solution to make the text fields fill the remaining space
    width: calc(100% - var(--ac-global-dimension-size-600));
  }
`;function Gm(){const{authenticationEnabled:n}=$l();return e("main",{css:om,children:e("div",{css:dm,children:s(h,{direction:"column",gap:"size-200",width:"100%",children:[e(z,{title:"Platform Settings",variant:"compact",children:s("form",{css:cm,children:[s(h,{direction:"row",gap:"size-100",alignItems:"end",children:[e(le,{label:"Hostname",value:Ia,isReadOnly:!0,description:"Connect to Phoenix over HTTP"}),e(Da,{text:Ia})]}),s(h,{direction:"row",gap:"size-100",alignItems:"end",children:[e(le,{label:"Platform Version",isReadOnly:!0,value:aa,description:"The version of the Phoenix server"}),e(Da,{text:aa})]}),s(h,{direction:"row",gap:"size-100",alignItems:"end",children:[e(le,{label:"Python Version",isReadOnly:!0,value:`pip install 'arize-phoenix==${aa}'`,description:"The version of the Python client library to use to connect to this Phoenix"}),e(Da,{text:aa})]})]})}),n&&e(lm,{}),n&&e(sm,{})]})})})}function Da(n){return e(x,{paddingBottom:"19px",children:e(X,{text:n.text,size:"normal"})})}const il=window.Config.basename,rl={width:"100%",height:"100%",border:"none",backgroundColor:"white"};function Um(){return s("div",{css:C`
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        height: 100%;
        .ac-tabs {
          flex: 1 1 auto;
        }
        .ac-tabs__pane-container,
        .ac-tabs__pane-container > div {
          flex: 1 1 auto;
          height: 100%;
        }
      `,children:[e(Y,{variant:"info",banner:!0,icon:e(P,{svg:e(E.InfoFilled,{})}),children:"These APIs are under active development and are subject to change."}),s(ke,{children:[e(q,{name:"REST",children:({isSelected:n})=>n&&e("iframe",{src:`${il}/docs`,style:rl})}),e(q,{name:"GraphQL",children:({isSelected:n})=>n&&e("iframe",{src:`${il}/graphql`,style:rl})})]})]})}const Ir=function(){var n=[{defaultValue:null,kind:"LocalArgument",name:"email"},{defaultValue:null,kind:"LocalArgument",name:"password"}],a=[{alias:null,args:[{fields:[{kind:"Variable",name:"email",variableName:"email"},{kind:"Variable",name:"password",variableName:"password"}],kind:"ObjectValue",name:"input"}],kind:"ScalarField",name:"login",storageKey:null}];return{fragment:{argumentDefinitions:n,kind:"Fragment",metadata:null,name:"LoginFormMutation",selections:a,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:n,kind:"Operation",name:"LoginFormMutation",selections:a},params:{cacheID:"3028737b93cf12e20a73e49ca3c4ba84",id:null,metadata:{},name:"LoginFormMutation",operationKind:"mutation",text:`mutation LoginFormMutation(
  $email: String!
  $password: String!
) {
  login(input: {email: $email, password: $password})
}
`}}}();Ir.hash="88ab683f7b6bd5c87e77fe2751da8d4c";function um(){const n=ae(),[a,l]=u.useState(null),[t,i]=T.useMutation(Ir),r=u.useCallback(d=>{l(null),t({variables:d,onCompleted:()=>{n("/")},onError:()=>{l("Invalid Login")}})},[t,n]),{control:o,handleSubmit:c}=qe({defaultValues:{email:"",password:""}});return s(H,{children:[a?s(x,{paddingBottom:"size-100",children:[e(Y,{variant:"danger",children:a})," "]}):null,s(mn,{children:[e(G,{name:"email",control:o,render:({field:{onChange:d,value:m}})=>e(le,{label:"Email",name:"email",isRequired:!0,type:"email",onChange:d,value:m,placeholder:"your email address"})}),e(G,{name:"password",control:o,render:({field:{onChange:d,value:m}})=>e(le,{label:"Password",name:"password",type:"password",isRequired:!0,onChange:d,value:m,placeholder:"your password"})}),e("div",{css:C`
            margin-top: var(--ac-global-dimension-size-400);
            margin-bottom: var(--ac-global-dimension-size-50);
            button {
              width: 100%;
            }
          `,children:e(N,{variant:"primary",loading:i,onClick:c(r),children:"Login"})})]})]})}function mm(){return s("svg",{width:"253",height:"63",viewBox:"0 0 682 169",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[s("g",{clipPath:"url(#clip0_290_1904)",children:[e("path",{d:"M147.458 105.593C147.022 103.63 146.028 101.824 144.492 100.222C143.901 99.6064 143.244 99.0233 142.529 98.4978C142.184 98.2432 141.815 98.005 141.437 97.7669C140.969 97.4712 140.484 97.192 139.95 96.921C137.995 95.9191 136.328 94.909 134.866 93.825C134.274 93.3897 133.699 92.9299 133.157 92.4535C131.851 91.312 130.972 90.3348 130.315 89.3C130.102 88.9715 129.913 88.6102 129.732 88.2653C129.658 88.1175 129.543 87.9943 129.412 87.8957C129.173 87.7233 128.869 87.6494 128.565 87.6986C128.097 87.789 127.736 88.1667 127.678 88.6431C127.637 89.0126 127.637 89.4068 127.687 89.8092C127.719 90.0474 127.588 90.2773 127.366 90.3758C127.317 90.4005 127.259 90.4087 127.21 90.4169C126.898 90.4498 126.619 90.6222 126.438 90.885C126.257 91.1478 126.208 91.4681 126.282 91.7719C126.348 92.0347 126.438 92.2236 126.512 92.3714L126.578 92.5028C126.627 92.5931 126.676 92.6917 126.726 92.782C126.873 93.0612 127.021 93.3405 127.202 93.6033C127.547 94.1042 127.933 94.6052 128.393 95.1389C128.541 95.3114 128.565 95.5578 128.459 95.7549C128.352 95.952 128.13 96.0669 127.908 96.0341C125.321 95.681 122.996 95.0979 120.836 94.3013C120.59 94.211 120.335 94.1206 120.097 94.0221C118.158 93.2009 121.658 89.7189 123.259 87.247C130.282 76.4479 131.736 64.0802 131.794 51.5647C131.851 39.4681 130.545 27.5357 128.138 15.7593V15.7429C126.569 5.87173 125.239 2.168 124.401 0.796558C124.22 0.435219 124.023 0.205276 123.818 0.0985162C123.588 -0.0575166 123.465 0.0163937 123.465 0.0163937C123.013 0.0328182 122.495 0.435219 121.871 1.08399C119.251 3.83509 119.399 7.11178 120.122 10.5363C123.432 26.0903 125.921 41.7346 124.787 57.7157C124.007 68.7365 121.953 79.3468 114.248 87.9779C113.789 88.4952 113.287 88.9798 112.786 89.4725C112.211 90.0391 111.316 91.1396 110.651 90.6797C109.764 90.0638 110.552 88.7991 110.831 88.1421C115.341 77.5729 116.639 66.5275 115.949 55.1453C115.932 54.8825 115.908 54.6197 115.891 54.3569V54.3405C115.883 54.1269 115.858 53.9298 115.842 53.7245C115.727 52.2217 115.587 50.7189 115.398 49.2242C113.46 31.1655 111.127 29.9911 111.127 29.9911C110.971 29.8515 110.782 29.7448 110.528 29.6955C109.304 29.4409 108.638 30.5167 108.096 31.3297C105.648 34.9924 106.733 38.8932 107.521 42.753C110.289 56.2703 110.33 69.6645 105.583 82.8124C105.147 84.0113 104.63 85.1775 104.08 86.3272C103.496 87.5508 103.119 89.0783 101.131 88.4213C99.2662 87.8054 99.7918 86.3929 100.03 85.1036C100.654 81.8269 101.155 78.542 101.467 75.2489V75.2653C101.509 74.9368 101.525 74.6247 101.55 74.3127C101.599 73.746 101.632 73.1712 101.665 72.6045C101.689 72.1282 101.714 71.6601 101.739 71.2002C101.747 70.9621 101.763 70.7321 101.763 70.494C102.141 60.0562 100.383 55.3095 99.7179 53.9052C99.644 53.7328 99.5619 53.5767 99.4715 53.4371C98.7815 52.4024 97.6398 52.5256 96.6541 53.5028C94.8388 55.2931 93.8367 57.4118 94.2967 60.0808C95.6438 67.8496 94.8552 75.5445 93.4096 83.1983C93.2124 84.2249 92.7524 86.0973 90.5593 85.6127C89.0644 85.2842 88.7194 84.6437 88.6372 83.3461C88.6537 82.3689 88.6372 81.3916 88.6044 80.4144C88.6044 80.3897 88.6044 80.3651 88.6044 80.3405C88.6044 80.2009 88.588 80.0612 88.588 79.9299C88.588 79.8559 88.5797 79.7902 88.5715 79.7245C88.5058 78.3942 88.399 77.0556 88.2347 75.717C88.2183 75.5856 88.1937 75.4624 88.1773 75.331C87.3394 67.7921 86.247 67.0612 86.247 67.0612C85.5488 66.1497 84.4563 66.3057 83.5117 67.2419C81.6964 69.0322 80.7764 71.1427 81.1543 73.8199C81.4336 75.7745 81.3596 75.175 81.5568 76.8831C81.7128 77.7618 81.8771 79.3632 81.8935 79.8724C81.8525 80.324 81.7375 80.7182 81.4582 81.0139C80.53 82.0076 79.0351 80.9892 77.9015 80.5211C55.9209 71.4302 37.1108 58.6683 20.691 42.523C14.2513 35.945 3.25273 22.6329 3.25273 22.6329C2.84203 22.1566 2.33276 21.8856 1.55243 22.2223C0.114982 22.8383 0.156052 24.6778 0.0246278 26.2217C-0.23822 29.3177 1.42101 31.5597 3.21987 33.662C28.0179 62.5856 58.2783 83.3708 94.8059 93.7675L101.377 95.5085C101.451 95.5249 101.533 95.5496 101.607 95.566C101.624 95.566 101.632 95.566 101.64 95.5742L107.299 97.077L107.456 97.1181C107.267 97.1756 107.061 97.2167 106.839 97.2577C100.613 98.4895 88.2923 96.223 78.3944 93.9153C73.4988 92.8888 68.6854 91.6405 63.9788 90.1541C63.7653 90.0884 63.642 90.0556 63.642 90.0556C45.3577 84.2331 28.6093 74.7972 13.9556 60.4093C12.5674 59.0461 11.286 57.5761 10.0211 56.0897C8.86289 54.71 6.47262 51.8275 5.643 50.8338C5.55265 50.7024 5.45408 50.5875 5.35551 50.4807C5.10909 50.2261 4.80517 50.0619 4.36983 50.1604C3.3513 50.3986 3.05559 51.4498 2.86667 52.3367C2.1192 55.9008 3.25273 58.8983 5.65122 61.5755C20.6582 78.3942 39.4929 89.1358 60.6439 96.1819C72.6528 100.181 85.0067 102.612 97.6069 104.164C90.0911 106.595 82.3617 107.334 74.5667 107.137C59.4775 106.759 45.3248 103.138 32.0264 96.6746C27.1226 94.1535 22.5556 91.3449 21.3564 90.5894C20.6664 90.1213 19.9518 89.8338 19.2454 90.3758C17.9229 91.4024 18.8347 93.2009 19.2618 94.6051C20.075 97.307 21.956 99.1712 24.3956 100.46C46.0641 111.917 68.9401 116.499 93.2946 112.434C95.7588 112.023 98.0998 111.572 100.679 110.701C96.6048 114.224 91.89 116.524 86.9369 118.339C71.6835 123.915 56.5287 123.693 41.4314 119.915C36.5851 118.618 30.9668 116.507 30.9668 116.507C30.1536 116.154 29.3486 116.031 28.7243 116.926C27.6237 118.503 28.5847 120.145 29.5375 121.632C31.7882 125.138 36.1416 125.483 39.5832 126.674C40.7578 127.052 37.5544 129.187 36.5276 129.975C31.5335 133.794 26.6462 137.284 21.6767 140.98L18.424 143.378C17.8654 143.764 17.3726 144.199 17.6272 145.004C17.9229 145.915 18.8675 146.08 19.7875 146.268C23.3442 147.008 26.3833 145.825 29.1925 143.723C35.2134 139.214 41.3493 134.837 47.2387 130.156C49.4811 128.374 51.5182 128.522 54.582 129.31C46.9183 135.083 39.7475 140.495 32.5685 145.899C25.2827 151.376 17.9969 156.854 10.711 162.323L5.89764 165.888C5.82371 165.937 5.758 165.986 5.69229 166.044L5.61836 166.093C5.20766 166.421 4.90374 166.791 4.9941 167.267C5.19123 168.351 6.4644 168.622 7.50758 168.803C11.8117 169.542 14.4813 167.924 17.4219 165.715C32.1496 154.661 46.9266 143.682 61.5721 132.521C64.8577 130.016 68.2337 128.604 72.9731 129.138C68.9401 132.152 65.0631 135.051 61.2436 137.908L50.8611 145.587C50.7871 145.636 50.7132 145.694 50.6475 145.751C50.0972 146.186 49.7111 146.695 49.9247 147.451C50.3189 148.822 51.97 148.987 53.3745 149.2C55.9537 149.586 58.1387 148.675 60.1675 147.164C61.3339 146.293 62.5085 145.439 63.6831 144.593L79.5361 132.004C79.5361 132.004 83.2817 129.327 87.6187 126.871C88.0048 126.633 88.3908 126.387 88.7851 126.148C88.9494 126.075 89.3601 125.886 89.9843 125.59C90.4525 125.352 90.9207 125.114 91.3807 124.892C92.0625 124.547 92.851 124.128 93.7381 123.644C96.2927 122.584 103.611 119.168 109.657 112.73C112.532 110.512 116.581 107.613 119.735 106.217H119.752C119.99 106.111 120.228 106.012 120.458 105.93C120.458 105.93 120.475 105.93 120.483 105.922C120.639 105.864 120.787 105.815 120.935 105.766L121.337 105.61C122.479 105.289 124.335 105.166 124.582 107.679C124.623 108.295 124.615 108.927 124.541 109.593C124.491 110.093 124.393 110.627 124.319 111.054C124.245 111.465 124.417 111.876 124.746 112.122C124.795 112.163 124.853 112.196 124.91 112.22C125.346 112.434 125.871 112.335 126.2 111.974C126.323 111.834 126.446 111.703 126.569 111.572C128.122 109.937 129.699 108.804 131.375 108.114C133.822 107.104 136.303 107.096 138.94 108.106C140.197 108.582 141.379 109.239 142.554 110.102C143.055 110.471 143.556 110.882 144.057 111.334C144.353 111.605 144.648 111.9 144.911 112.163L144.952 112.204L145.166 112.418C145.166 112.418 145.248 112.491 145.289 112.524C145.536 112.705 145.856 112.779 146.168 112.713C146.529 112.631 146.825 112.376 146.957 112.032C146.981 111.966 147.006 111.9 147.031 111.834C147.778 109.617 147.934 107.581 147.499 105.593H147.458Z",fill:"url(#paint0_linear_290_1904)"}),e("path",{d:"M120.113 94.0303C120.195 94.0632 120.269 94.096 120.351 94.1207C120.269 94.0878 120.187 94.0632 120.113 94.0303Z",fill:"#FEDBB5"}),e("path",{d:"M111.283 87.1238C111.283 87.1238 111.267 87.1567 111.267 87.1731C111.267 87.1567 111.283 87.1402 111.283 87.1238Z",fill:"#FEDBB5"}),e("path",{d:"M123.383 87.1074C123.383 87.1074 123.358 87.1487 123.341 87.1652C123.358 87.1487 123.366 87.1239 123.383 87.1074Z",fill:"#FEDBB5"}),e("path",{d:"M104.104 86.3354C103.965 86.6229 103.841 86.9267 103.71 87.2142C103.85 86.9267 103.973 86.6229 104.104 86.3354Z",fill:"#FEDBB5"}),e("path",{d:"M89.0233 84.7422C89.0233 84.7422 89.0233 84.7505 89.0316 84.7588C89.0316 84.7588 89.0316 84.7505 89.0233 84.7422Z",fill:"#FEDBB5"}),e("path",{d:"M89.0644 84.7998C89.1876 84.964 89.3437 85.1118 89.5408 85.235C89.3437 85.1118 89.1876 84.9722 89.0644 84.7998ZM89.0644 84.7833C89.0644 84.7833 89.0644 84.7833 89.0644 84.7915C89.0644 84.7915 89.0644 84.7915 89.0644 84.7833ZM89.0562 84.7751C89.0562 84.7751 89.0562 84.7751 89.0562 84.7833C89.0562 84.7833 89.0562 84.7833 89.0562 84.7751ZM88.6947 83.3626C88.6947 83.3626 88.6947 83.3708 88.6947 83.379C88.6947 83.379 88.6947 83.3708 88.6947 83.3626ZM79.1665 81.0878C79.1665 81.0878 79.1829 81.0878 79.1829 81.096C79.6429 81.2931 80.1029 81.4492 80.53 81.4492C80.7107 81.4492 80.8832 81.4245 81.0393 81.3588C80.875 81.4245 80.7025 81.4492 80.53 81.4492C80.0947 81.4492 79.6265 81.2849 79.1665 81.0878ZM88.629 79.6507C88.629 79.6507 88.629 79.6507 88.629 79.6589C88.629 79.6589 88.629 79.6589 88.629 79.6507Z",fill:"#E5B4A6"}),e("path",{d:"M120.36 94.1206C120.36 94.1206 120.434 94.1535 120.475 94.1617C120.475 94.1617 120.401 94.1289 120.36 94.1206ZM110.273 89.8749C110.273 90.187 110.38 90.4662 110.684 90.6797C110.79 90.7536 110.905 90.7865 111.029 90.7865C111.209 90.7865 111.398 90.7126 111.595 90.5894C111.406 90.7126 111.218 90.7865 111.029 90.7865C110.905 90.7865 110.79 90.7536 110.684 90.6797C110.38 90.4744 110.273 90.187 110.273 89.8749ZM110.914 88.0189C110.914 88.0189 110.881 88.1011 110.864 88.1421C110.881 88.1011 110.897 88.06 110.914 88.0189ZM111.226 87.2798C111.127 87.5262 111.02 87.7726 110.914 88.0189C111.02 87.7726 111.119 87.5262 111.226 87.2798ZM111.267 87.1731C111.267 87.1731 111.234 87.2388 111.226 87.2798C111.242 87.247 111.259 87.2141 111.267 87.1731ZM123.341 87.1731C123.341 87.1731 123.341 87.1813 123.333 87.1895C123.333 87.1895 123.333 87.1813 123.341 87.1731ZM123.391 87.0992C123.391 87.0992 123.391 87.1074 123.382 87.1156C123.382 87.1156 123.382 87.1074 123.391 87.0992ZM111.308 87.0992C111.308 87.0992 111.3 87.132 111.291 87.1402C111.291 87.1238 111.3 87.1074 111.308 87.0992ZM99.8001 86.7707C99.8001 87.4769 100.079 88.0928 101.155 88.446C101.484 88.5527 101.771 88.602 102.026 88.602C102.93 88.602 103.365 87.9615 103.71 87.2306C103.357 87.9697 102.921 88.602 102.026 88.602C101.78 88.602 101.492 88.5527 101.155 88.446C100.088 88.0928 99.8001 87.4769 99.8001 86.7707ZM92.7689 84.9886C92.4486 85.4074 91.9722 85.7195 91.2575 85.7195C91.1836 85.7195 91.1097 85.7195 91.0358 85.7113C91.1097 85.7113 91.1836 85.7195 91.2575 85.7195C91.9722 85.7195 92.4486 85.4157 92.7689 84.9886ZM106.651 79.7081C106.651 79.7081 106.651 79.7081 106.642 79.7081C106.322 80.7511 105.985 81.8023 105.616 82.8452C105.993 81.8023 106.338 80.7593 106.659 79.7081M94.1571 79.1251C93.9846 80.2748 93.7875 81.4163 93.5739 82.566C93.7875 81.4245 93.9846 80.2748 94.1571 79.1251ZM122.191 73.6311C120.623 78.7884 118.175 83.65 114.29 88.0025C113.83 88.5199 113.329 89.0044 112.828 89.4972C113.329 89.0126 113.821 88.5199 114.29 88.0025C118.175 83.65 120.623 78.7884 122.2 73.6311",fill:"#E5B4A6"}),e("path",{opacity:"0.4",d:"M2.20136 22.0745C2.00423 22.0745 1.79066 22.1238 1.55246 22.2223C0.53392 22.6658 0.254644 23.7252 0.139648 24.8503C5.61017 32.0196 27.213 58.4548 61.1943 76.5875C61.1943 76.5875 94.4692 94.1453 127.933 96.0423C125.346 95.6892 123.021 95.1061 120.861 94.3095C120.729 94.2602 120.606 94.2192 120.475 94.1699C108.318 91.542 97.9519 88.2571 90.6168 85.6292C90.7565 85.662 90.8961 85.6784 91.0193 85.6949C90.8879 85.6867 90.7401 85.662 90.5922 85.6292C90.1486 85.5306 89.8037 85.4074 89.5408 85.2432C83.7417 83.1244 80.0454 81.4984 79.1583 81.096C78.7312 80.9153 78.3123 80.6936 77.9344 80.5376C55.9538 71.4466 37.1437 58.6848 20.7239 42.5395C14.2513 35.945 3.25275 22.633 3.25275 22.633C2.97348 22.3045 2.6367 22.0745 2.20136 22.0745Z",fill:"url(#paint1_linear_290_1904)"}),e("path",{opacity:"0.4",d:"M4.62448 50.1358C4.55056 50.1358 4.46842 50.144 4.37806 50.1687C3.35953 50.4068 3.06382 51.458 2.8749 52.3449C2.84204 52.5009 2.80919 52.6652 2.78455 52.8212C19.7711 75.832 42.5732 85.235 42.5732 85.235C65.3341 95.952 84.0128 98.12 95.3892 98.12C100.096 98.12 103.554 97.7505 105.533 97.463C104.63 97.5616 103.636 97.6109 102.568 97.6109C95.8984 97.6109 86.362 95.7795 78.4026 93.9235C73.5071 92.897 68.6937 91.6488 63.987 90.1623C63.7735 90.0966 63.6503 90.0638 63.6503 90.0638C45.3659 84.2413 28.6176 74.8054 13.9638 60.4175C12.5756 59.0543 11.2942 57.5843 10.0293 56.0979C8.87112 54.7182 6.48084 51.8357 5.65123 50.8421C5.56088 50.7107 5.46231 50.5957 5.36374 50.4889C5.16661 50.2836 4.9284 50.1358 4.62448 50.1358Z",fill:"url(#paint2_linear_290_1904)"}),e("path",{opacity:"0.4",d:"M20.0669 90.1049C19.7958 90.1049 19.5247 90.187 19.2537 90.4005C18.1037 91.2874 18.6458 92.7738 19.0812 94.0632C27.5991 99.2287 47.132 109.289 70.2626 109.289C79.0023 109.289 88.243 107.86 97.607 104.189C90.8469 106.382 83.9061 107.195 76.9077 107.195C76.1274 107.195 75.3471 107.186 74.5667 107.162C59.4776 106.784 45.3249 103.162 32.0264 96.6993C27.1227 94.1781 22.5557 91.3695 21.3565 90.614C20.9293 90.3266 20.5022 90.1049 20.0669 90.1049Z",fill:"url(#paint3_linear_290_1904)"}),e("path",{opacity:"0.4",d:"M99.1759 111.949C95.4632 114.791 91.2987 116.762 86.937 118.355C78.7559 121.344 70.5994 122.666 62.4675 122.666C55.4363 122.666 48.4298 121.681 41.4315 119.932C36.5852 118.634 30.9668 116.524 30.9668 116.524C30.6136 116.368 30.2604 116.261 29.9237 116.261C29.4883 116.261 29.0776 116.442 28.7326 116.951C28.2234 117.682 28.1577 118.429 28.3219 119.168C33.6939 121.665 45.2181 126.099 59.2723 126.099C71.4536 126.099 85.5406 122.765 99.1759 111.949Z",fill:"url(#paint4_linear_290_1904)"}),e("path",{opacity:"0.4",d:"M62.9356 129.368C49.7358 129.368 39.7557 126.699 38.4908 126.346C38.8604 126.452 39.2218 126.567 39.5833 126.69C40.7579 127.068 37.5544 129.203 36.5276 129.992C32.8396 132.817 29.2008 135.461 25.5537 138.138H36.7576C40.2897 135.527 43.8052 132.907 47.2387 130.172C48.5119 129.154 49.7275 128.768 51.0993 128.768C52.1342 128.768 53.2678 128.99 54.582 129.335C46.9184 135.108 39.7475 140.52 32.5685 145.924C28.3711 149.077 24.1738 152.231 19.9764 155.384H31.246C41.3821 147.804 51.51 140.216 61.5721 132.546C63.8967 130.78 66.2623 129.557 69.1208 129.179C67.0016 129.318 64.9316 129.376 62.9439 129.376L62.9356 129.368Z",fill:"url(#paint5_linear_290_1904)"}),e("path",{opacity:"0.4",d:"M60.5782 138.409H71.47L79.5115 132.02C79.5115 132.02 83.2571 129.343 87.5941 126.888C87.9801 126.649 88.3662 126.403 88.7605 126.165C88.9248 126.091 89.3354 125.902 89.9597 125.606C90.4279 125.368 90.8961 125.13 91.3561 124.908C92.0625 124.547 92.8921 124.112 93.8121 123.603C86.0499 126.855 78.0987 128.44 70.739 129.056C70.8375 129.056 70.9443 129.056 71.0429 129.056C71.6589 129.056 72.2996 129.088 72.965 129.162C68.9319 132.176 65.0549 135.075 61.2354 137.933L60.5782 138.418V138.409Z",fill:"url(#paint6_linear_290_1904)"}),e("path",{opacity:"0.4",d:"M88.6701 83.3544C88.6865 82.3771 88.6701 81.3999 88.6373 80.4226V80.3487C88.6373 80.2091 88.6208 80.0695 88.6208 79.9381L88.6044 79.7328C88.5633 78.9115 88.4976 78.0903 88.4237 77.2609C85.8281 76.1687 83.3803 74.7726 81.1215 73.1301C81.1379 73.3601 81.1461 73.59 81.179 73.8364C81.4582 75.7909 81.3843 75.1914 81.5814 76.8995C81.7375 77.7783 81.9018 79.3797 81.9182 79.8888C81.8771 80.3405 81.7621 80.7347 81.4829 81.0303C81.1954 81.3342 80.8586 81.4491 80.4972 81.4491C80.0619 81.4491 79.5937 81.2849 79.1337 81.0878C79.9961 81.4738 83.7007 83.108 89.5408 85.2432C88.9165 84.8572 88.7194 84.2742 88.6619 83.3626L88.6701 83.3544Z",fill:"url(#paint7_linear_290_1904)"}),e("path",{opacity:"0.4",d:"M131.022 64.885C128.59 68.2685 125.6 71.2331 122.175 73.6146C120.606 78.7719 118.158 83.6336 114.273 87.9861C113.813 88.5035 113.312 88.988 112.811 89.4807C112.326 89.9488 111.628 90.8029 111.02 90.8029C110.897 90.8029 110.782 90.77 110.675 90.6961C109.788 90.0802 110.577 88.8155 110.856 88.1585C112.31 84.7505 113.427 81.2931 114.257 77.7865C111.825 78.698 109.271 79.3386 106.634 79.6999C106.314 80.7429 105.977 81.794 105.607 82.837C105.172 84.036 104.655 85.2021 104.104 86.3518C103.62 87.3702 103.275 88.602 102.018 88.602C101.771 88.602 101.484 88.5527 101.147 88.446C99.2827 87.83 99.8084 86.4175 100.047 85.1282C100.367 83.4201 100.663 81.7119 100.909 79.9956C98.5927 79.9217 96.3256 79.626 94.1325 79.1168C93.9271 80.4883 93.6889 81.8515 93.4261 83.2148C93.2536 84.1263 92.8675 85.7113 91.2412 85.7113C91.044 85.7113 90.8305 85.6867 90.6005 85.6374C97.9356 88.2735 108.293 91.5584 120.458 94.1863C120.335 94.1371 120.22 94.096 120.105 94.0467C118.167 93.2255 121.666 89.7435 123.268 87.2716C127.777 80.3323 129.987 72.7523 131.005 64.8932L131.022 64.885Z",fill:"url(#paint8_linear_290_1904)"}),e("path",{opacity:"0.5",d:"M129.206 102.497C127.687 102.497 126.151 102.645 124.647 102.916C124.36 102.965 124.081 102.99 123.818 102.99C123.391 102.99 122.988 102.924 122.61 102.809C122.668 102.883 122.734 102.957 122.791 103.039C123.448 103.959 123.793 104.961 123.925 106.004C124.089 106.184 124.229 106.406 124.344 106.694C124.344 106.694 124.344 106.694 124.344 106.71C124.344 106.71 124.344 106.71 124.344 106.718C124.344 106.718 124.344 106.718 124.344 106.726C124.344 106.726 124.344 106.726 124.344 106.735C124.344 106.735 124.344 106.735 124.344 106.743C124.344 106.743 124.344 106.743 124.344 106.751C124.344 106.751 124.344 106.751 124.344 106.759C124.344 106.759 124.344 106.759 124.344 106.768V106.784C124.344 106.784 124.344 106.784 124.344 106.792C124.344 106.792 124.344 106.792 124.344 106.8C124.344 106.8 124.344 106.8 124.344 106.809C124.344 106.809 124.344 106.809 124.344 106.817C124.344 106.817 124.344 106.817 124.344 106.825C124.344 106.825 124.344 106.833 124.344 106.841C124.344 106.841 124.344 106.841 124.344 106.858C124.344 106.858 124.344 106.858 124.344 106.866C124.344 106.866 124.344 106.866 124.344 106.874C124.344 106.874 124.344 106.874 124.344 106.882C124.344 106.882 124.344 106.883 124.344 106.891C124.344 106.891 124.344 106.891 124.344 106.899C124.344 106.899 124.344 106.899 124.344 106.907C124.344 106.907 124.344 106.907 124.344 106.915C124.344 106.915 124.344 106.915 124.344 106.924C124.344 106.924 124.344 106.924 124.344 106.932C124.344 106.932 124.344 106.932 124.344 106.94C124.344 106.94 124.344 106.94 124.344 106.948C124.344 106.948 124.344 106.948 124.344 106.965C124.344 106.965 124.344 106.973 124.344 106.981C124.344 106.981 124.344 106.989 124.344 106.997V107.014C124.344 107.014 124.344 107.022 124.344 107.03C124.344 107.03 124.344 107.039 124.344 107.047C124.344 107.047 124.344 107.055 124.344 107.063C124.344 107.063 124.344 107.071 124.344 107.08C124.344 107.08 124.344 107.088 124.344 107.096C124.344 107.096 124.344 107.104 124.344 107.112C124.344 107.112 124.344 107.121 124.344 107.129C124.344 107.145 124.344 107.162 124.344 107.178C124.344 107.178 124.344 107.186 124.344 107.195C124.344 107.195 124.344 107.227 124.344 107.244C124.344 107.244 124.344 107.252 124.344 107.26V107.277C124.344 107.277 124.344 107.301 124.344 107.31C124.344 107.31 124.344 107.318 124.344 107.326V107.342V107.359C124.36 107.597 124.368 107.843 124.368 108.09C124.368 108.476 124.344 108.87 124.302 109.272C124.253 109.773 124.155 110.307 124.081 110.734C124.072 110.8 124.064 110.865 124.064 110.923C124.064 111.268 124.229 111.588 124.508 111.793L124.672 111.892C124.828 111.966 124.992 112.007 125.157 112.007C125.461 112.007 125.748 111.884 125.962 111.654C126.085 111.514 126.208 111.383 126.331 111.251C127.884 109.617 129.461 108.484 131.136 107.794C132.369 107.285 133.601 107.03 134.857 107.03C136.114 107.03 137.387 107.285 138.702 107.786C139.958 108.262 141.141 108.919 142.316 109.781C142.817 110.151 143.318 110.562 143.819 111.013C144.115 111.284 144.41 111.58 144.673 111.843L144.714 111.884L144.928 112.097L145.051 112.204C145.232 112.335 145.453 112.409 145.675 112.418C144.632 110.192 143.318 108.123 141.461 106.513C137.946 103.466 133.51 102.177 129.001 102.177",fill:"url(#paint9_linear_290_1904)"}),e("path",{opacity:"0.4",d:"M128.779 87.6905L128.582 87.7069C128.114 87.7972 127.752 88.175 127.695 88.6513C127.654 89.0208 127.654 89.415 127.703 89.8174C127.72 89.9488 127.687 90.072 127.629 90.1706C129.51 92.9627 133.584 97.9065 139.769 99.7789C139.769 99.7789 149.331 104.78 146.916 112.032L146.99 111.834C147.737 109.617 147.893 107.581 147.458 105.593C147.022 103.63 146.029 101.824 144.492 100.222C143.901 99.6064 143.244 99.0234 142.529 98.4978C142.184 98.2432 141.815 98.0051 141.437 97.7669C140.969 97.4713 140.484 97.192 139.95 96.921C137.995 95.9191 136.328 94.909 134.866 93.825C134.274 93.3898 133.699 92.9299 133.157 92.4536C131.851 91.3121 130.972 90.3348 130.315 89.3001C130.102 88.9716 129.913 88.6102 129.732 88.2653C129.658 88.1175 129.543 87.9943 129.412 87.8958C129.231 87.7562 129.001 87.6823 128.763 87.6823",fill:"url(#paint10_linear_290_1904)"}),e("path",{opacity:"0.5",d:"M116.647 107.893L118.586 106.768L126.734 95.8535C126.734 95.8535 122.274 95.0076 120.122 94.0303C120.122 94.0303 117.887 104.222 109.632 112.738L112.672 110.488C113.887 109.634 114.988 108.903 116.647 107.893Z",fill:"url(#paint11_linear_290_1904)"}),e("path",{d:"M209.416 49.9962H230.197C245.221 49.9962 252.104 57.7157 252.104 73.5818V81.4409C252.104 97.307 245.221 105.027 230.197 105.027H218.123V148.264H209.416V49.9962ZM230.197 97.0196C239.323 97.0196 243.397 92.9463 243.397 81.8598V73.0152C243.397 62.0682 239.323 57.8553 230.197 57.8553H218.123V97.0196H230.197Z",fill:"var(--ac-global-text-color-900)"}),e("path",{d:"M284.114 49.9962H292.821V93.0941H319.64V49.9962H328.346V148.256H319.64V100.953H292.821V148.256H284.114V49.9962Z",fill:"var(--ac-global-text-color-900)"}),e("path",{d:"M362.451 125.656V72.5963C362.451 57.0177 370.312 48.5919 384.497 48.5919C398.683 48.5919 406.544 57.0177 406.544 72.5963V125.656C406.544 141.234 398.683 149.66 384.497 149.66C370.312 149.66 362.451 141.234 362.451 125.656ZM397.829 126.214V72.0297C397.829 61.5016 393.056 56.451 384.489 56.451C375.922 56.451 371.15 61.5016 371.15 72.0297V126.214C371.15 136.742 375.922 141.653 384.489 141.653C393.056 141.653 397.829 136.742 397.829 126.214Z",fill:"var(--ac-global-text-color-900)"}),e("path",{d:"M440.796 49.9962H480.108V57.8553H449.503V93.0859H474.638V100.945H449.503V140.249H480.108V148.248H440.796V49.9962Z",fill:"var(--ac-global-text-color-900)"}),e("path",{d:"M511.56 49.9962H523.076L548.629 125.935V49.9962H556.769V148.256H547.504L519.56 64.458V148.256H511.56V49.9962Z",fill:"var(--ac-global-text-color-900)"}),e("path",{d:"M592.007 49.9962H600.714V148.256H592.007V49.9962Z",fill:"var(--ac-global-text-color-900)"}),e("path",{d:"M651.674 98.1447L632.437 49.9962H641.702L657.144 89.0209L672.726 49.9962H681.154L661.917 98.1447L681.992 148.256H672.726L656.438 106.989L640.01 148.256H631.591L651.666 98.1447H651.674Z",fill:"var(--ac-global-text-color-900)"})]}),s("defs",{children:[s("linearGradient",{id:"paint0_linear_290_1904",x1:"22.0956",y1:"10.3474",x2:"97.4433",y2:"140.879",gradientUnits:"userSpaceOnUse",children:[e("stop",{stopColor:"#14BAB6"}),e("stop",{offset:"0.5",stopColor:"#00ADEE"}),e("stop",{offset:"1",stopColor:"#0095C4"})]}),s("linearGradient",{id:"paint1_linear_290_1904",x1:"95.422",y1:"114.807",x2:"31.8741",y2:"4.70214",gradientUnits:"userSpaceOnUse",children:[e("stop",{stopColor:"#FDFDFE",stopOpacity:"0"}),e("stop",{offset:"0.11",stopColor:"#FDFDFE",stopOpacity:"0.17"}),e("stop",{offset:"0.3",stopColor:"#FDFDFE",stopOpacity:"0.42"}),e("stop",{offset:"0.47",stopColor:"#FDFDFE",stopOpacity:"0.63"}),e("stop",{offset:"0.64",stopColor:"#FDFDFE",stopOpacity:"0.79"}),e("stop",{offset:"0.78",stopColor:"#FDFDFE",stopOpacity:"0.9"}),e("stop",{offset:"0.91",stopColor:"#FDFDFE",stopOpacity:"0.97"}),e("stop",{offset:"1",stopColor:"#FDFDFE"})]}),s("linearGradient",{id:"paint2_linear_290_1904",x1:"76.6695",y1:"114.126",x2:"30.8746",y2:"34.7951",gradientUnits:"userSpaceOnUse",children:[e("stop",{stopColor:"#FDFDFE",stopOpacity:"0"}),e("stop",{offset:"0.11",stopColor:"#FDFDFE",stopOpacity:"0.17"}),e("stop",{offset:"0.3",stopColor:"#FDFDFE",stopOpacity:"0.42"}),e("stop",{offset:"0.47",stopColor:"#FDFDFE",stopOpacity:"0.63"}),e("stop",{offset:"0.64",stopColor:"#FDFDFE",stopOpacity:"0.79"}),e("stop",{offset:"0.78",stopColor:"#FDFDFE",stopOpacity:"0.9"}),e("stop",{offset:"0.91",stopColor:"#FDFDFE",stopOpacity:"0.97"}),e("stop",{offset:"1",stopColor:"#FDFDFE"})]}),s("linearGradient",{id:"paint3_linear_290_1904",x1:"70.3612",y1:"119.915",x2:"44.7991",y2:"75.6384",gradientUnits:"userSpaceOnUse",children:[e("stop",{stopColor:"#FDFDFE",stopOpacity:"0"}),e("stop",{offset:"0.11",stopColor:"#FDFDFE",stopOpacity:"0.17"}),e("stop",{offset:"0.3",stopColor:"#FDFDFE",stopOpacity:"0.42"}),e("stop",{offset:"0.47",stopColor:"#FDFDFE",stopOpacity:"0.63"}),e("stop",{offset:"0.64",stopColor:"#FDFDFE",stopOpacity:"0.79"}),e("stop",{offset:"0.78",stopColor:"#FDFDFE",stopOpacity:"0.9"}),e("stop",{offset:"0.91",stopColor:"#FDFDFE",stopOpacity:"0.97"}),e("stop",{offset:"1",stopColor:"#FDFDFE"})]}),s("linearGradient",{id:"paint4_linear_290_1904",x1:"71.4208",y1:"128.85",x2:"55.5071",y2:"101.279",gradientUnits:"userSpaceOnUse",children:[e("stop",{stopColor:"#FDFDFE",stopOpacity:"0"}),e("stop",{offset:"0.11",stopColor:"#FDFDFE",stopOpacity:"0.17"}),e("stop",{offset:"0.3",stopColor:"#FDFDFE",stopOpacity:"0.42"}),e("stop",{offset:"0.47",stopColor:"#FDFDFE",stopOpacity:"0.63"}),e("stop",{offset:"0.64",stopColor:"#FDFDFE",stopOpacity:"0.79"}),e("stop",{offset:"0.78",stopColor:"#FDFDFE",stopOpacity:"0.9"}),e("stop",{offset:"0.91",stopColor:"#FDFDFE",stopOpacity:"0.97"}),e("stop",{offset:"1",stopColor:"#FDFDFE"})]}),s("linearGradient",{id:"paint5_linear_290_1904",x1:"44.5363",y1:"126.346",x2:"44.5363",y2:"155.384",gradientUnits:"userSpaceOnUse",children:[e("stop",{stopColor:"#231F20"}),e("stop",{offset:"0.03",stopColor:"#231F20",stopOpacity:"0.9"}),e("stop",{offset:"0.22",stopColor:"#231F20",stopOpacity:"0.4"}),e("stop",{offset:"0.42",stopColor:"#231F20",stopOpacity:"0.1"}),e("stop",{offset:"0.65",stopColor:"#231F20",stopOpacity:"0"})]}),s("linearGradient",{id:"paint6_linear_290_1904",x1:"77.1952",y1:"123.603",x2:"77.1952",y2:"138.409",gradientUnits:"userSpaceOnUse",children:[e("stop",{stopColor:"#231F20"}),e("stop",{offset:"1",stopColor:"#231F20",stopOpacity:"0"})]}),s("linearGradient",{id:"paint7_linear_290_1904",x1:"84.3413",y1:"85.235",x2:"84.3413",y2:"73.1301",gradientUnits:"userSpaceOnUse",children:[e("stop",{stopColor:"#231F20"}),e("stop",{offset:"0.03",stopColor:"#231F20",stopOpacity:"0.95"}),e("stop",{offset:"0.51",stopColor:"#231F20",stopOpacity:"0.26"}),e("stop",{offset:"0.81",stopColor:"#231F20",stopOpacity:"0"})]}),s("linearGradient",{id:"paint8_linear_290_1904",x1:"110.815",y1:"94.1699",x2:"110.815",y2:"64.885",gradientUnits:"userSpaceOnUse",children:[e("stop",{stopColor:"#231F20"}),e("stop",{offset:"0.18",stopColor:"#231F20",stopOpacity:"0.48"}),e("stop",{offset:"0.38",stopColor:"#231F20",stopOpacity:"0.12"}),e("stop",{offset:"0.58",stopColor:"#231F20",stopOpacity:"0"})]}),s("linearGradient",{id:"paint9_linear_290_1904",x1:"138.077",y1:"117.246",x2:"127.969",y2:"99.7278",gradientUnits:"userSpaceOnUse",children:[e("stop",{stopColor:"#231F20"}),e("stop",{offset:"1",stopColor:"#231F20",stopOpacity:"0"})]}),s("linearGradient",{id:"paint10_linear_290_1904",x1:"146.226",y1:"112.434",x2:"131.084",y2:"86.1931",gradientUnits:"userSpaceOnUse",children:[e("stop",{stopColor:"#FDFDFE",stopOpacity:"0"}),e("stop",{offset:"0.11",stopColor:"#FDFDFE",stopOpacity:"0.17"}),e("stop",{offset:"0.3",stopColor:"#FDFDFE",stopOpacity:"0.42"}),e("stop",{offset:"0.47",stopColor:"#FDFDFE",stopOpacity:"0.63"}),e("stop",{offset:"0.64",stopColor:"#FDFDFE",stopOpacity:"0.79"}),e("stop",{offset:"0.78",stopColor:"#FDFDFE",stopOpacity:"0.9"}),e("stop",{offset:"0.91",stopColor:"#FDFDFE",stopOpacity:"0.97"}),e("stop",{offset:"1",stopColor:"#FDFDFE"})]}),s("linearGradient",{id:"paint11_linear_290_1904",x1:"106.889",y1:"107.999",x2:"128.941",y2:"95.2581",gradientUnits:"userSpaceOnUse",children:[e("stop",{stopColor:"#231F20"}),e("stop",{offset:"0.31",stopColor:"#231F20",stopOpacity:"0.5"}),e("stop",{offset:"0.67",stopColor:"#231F20",stopOpacity:"0.13"}),e("stop",{offset:"1",stopColor:"#231F20",stopOpacity:"0"})]}),e("clipPath",{id:"clip0_290_1904",children:e("rect",{width:"682",height:"169",fill:"white"})})]})]})}function Wm(){return s("main",{css:C`
        padding-top: 200px;
        width: 100%;
        height: 100vh;
        overflow: hidden;
        background: radial-gradient(
          90% 60% at 50% 30%,
          rgba(5, 145, 193, 0.4) 0%,
          transparent 100%
        );
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        box-sizing: border-box;
      `,children:[s(x,{borderColor:"light",borderWidth:"thin",width:"size-5000",padding:"size-400",backgroundColor:"dark",marginStart:"auto",marginEnd:"auto",borderRadius:"medium",children:[e(h,{direction:"column",gap:"size-200",alignItems:"center",children:e(x,{paddingBottom:"size-200",children:e(mm,{})})}),e(um,{})]}),s("footer",{css:C`
          display: flex;
          justify-content: center;
          padding: var(--ac-global-dimension-size-400);
          gap: var(--ac-global-dimension-size-200);
          a {
            color: var(--ac-global-text-color-700);
            transition: color 0.2s ease-in-out;
            text-decoration: none;
            &:hover {
              color: var(--ac-global-text-color-900);
              text-decoration: underline;
            }
          }
        `,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}`})]})]})}const Lr=function(){var n=[{alias:null,args:null,kind:"ScalarField",name:"logout",storageKey:null}];return{fragment:{argumentDefinitions:[],kind:"Fragment",metadata:null,name:"LogoutButtonMutation",selections:n,type:"Mutation",abstractKey:null},kind:"Request",operation:{argumentDefinitions:[],kind:"Operation",name:"LogoutButtonMutation",selections:n},params:{cacheID:"9d746e0ae12cb3b7a88ea0a0d4da7727",id:null,metadata:{},name:"LogoutButtonMutation",operationKind:"mutation",text:`mutation LogoutButtonMutation {
  logout
}
`}}}();Lr.hash="573156900cd932369859cbc65bdd1ffa";function gm(){const n=ae(),[a,l]=T.useMutation(Lr);return e(N,{onClick:()=>{a({variables:{},onCompleted:()=>{n("/login")}})},variant:"default",size:"compact",icon:e(P,{svg:e(E.LogOut,{})}),children:l?"Logging out...":"Log out"})}const pm=C`
  overflow-y: auto;
`,ym=C`
  padding: var(--ac-global-dimension-size-400);
  max-width: 800px;
  min-width: 500px;
  box-sizing: border-box;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
`;function Jm(){return e("main",{css:pm,children:e("div",{css:ym,children:e(z,{title:"Profile",extra:e(gm,{}),variant:"compact",children:"Profile goes here"})})})}export{Um as A,Dm as D,Em as E,vm as F,Wm as L,wm as M,Jm as P,Gm as S,Rm as T,Am as a,Fm as b,Km as c,Tm as d,xm as e,Pm as f,Mm as g,Cm as h,Lm as i,Im as j,Nm as k,$m as l,Vm as m,qm as n,jm as o,_m as p,Om as q,Qm as r,zm as s,Hm as t,Us as u,Bm as v};
