chordia-ui 3.9.7 → 3.9.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";const e=require("react/jsx-runtime"),w=require("react"),xt=require("react-dom"),h=require("lucide-react"),Ge=require("./DataTable2.cjs.js"),ve={"8h":8*60*60*1e3,"1d":24*60*60*1e3,"7d":7*24*60*60*1e3,"30d":30*24*60*60*1e3},Ke=void 0,ut={month:"2-digit",day:"2-digit",year:"numeric"},ft={hour:"numeric",minute:"2-digit",hour12:!0};function he(t){if(!t)return null;if(t instanceof Date)return Number.isNaN(t.getTime())?null:t;const n=String(t).trim(),i=n.match(/^(\d{4})-(\d{1,2})-(\d{1,2})/);if(i){const a=new Date(Number(i[1]),Number(i[2])-1,Number(i[3]));return Number.isNaN(a.getTime())?null:a}const r=new Date(n);return Number.isNaN(r.getTime())?null:r}function qe(t,n){return t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()}function Q(t){const n=t instanceof Date?t:he(t);return n?n.toLocaleDateString(Ke,ut):""}function Te(t){return t.toLocaleTimeString(Ke,ft)}function se(t){return`${Q(t)} ${Te(t)}`}function Je(t,n){const i=he(t),r=he(n);return!i||!r?"":qe(i,r)?`${se(i)} – ${Te(r)}`:`${se(i)} – ${se(r)}`}function Ze(t,n){const i=he(t),r=he(n);return!i||!r?null:qe(i,r)?{from:se(i),to:Te(r)}:{from:se(i),to:se(r)}}function je(t){const n=ve[t];if(!n)return null;const i=new Date;return{from:new Date(i.getTime()-n),to:i}}function Qe(t){if(!ve[t])return"";const i=je(t);return i?t==="8h"?Je(i.from,i.to):`${Q(i.from)} – ${Q(i.to)}`:""}const pt="M1.00049 13.5213C7.85975 11.7032 8.88149 4.73912 13.7838 4.73912C19.8344 4.73912 23.6237 17.166 29.1281 17.166C34.5998 17.166 37.4149 4.88121 43.4004 8.61051C47.9764 11.4616 50.6186 1.00024 50.6186 1.00024",ht="M1.00049 16.692C8.88149 15.6975 8.88149 7.79403 13.7838 7.79403C19.8344 7.79403 23.6237 21.4034 29.1281 21.4034C34.5998 21.4034 37.4149 8.93821 43.4004 12.7223C47.9764 15.6152 50.6186 5.00024 50.6186 5.00024V36.0002C50.6186 36.0002 10.8223 36.0002 1.00049 36.0002C1.00049 28.8653 1.00049 19.4871 1.00049 16.692Z";function We(t){if(!Array.isArray(t))return null;const n=t.map(i=>Array.isArray(i)?Number(i[1]):i==null||i===""?NaN:Number(i)).filter(i=>Number.isFinite(i));return n.length>=2?n:null}function et(t,n=52,i=36){const r=We(t);if(!r)return null;const a=Math.min(...r),o=Math.max(...r),d=4,p=o-a||1,k=i-d*2-4,c=D=>(r.length===1?0:D/(r.length-1)*(n-2))+1,y=D=>d+(1-(D-a)/p)*k;let j="";for(let D=0;D<r.length;D++)j+=`${D===0?"M":"L"}${c(D).toFixed(2)},${y(r[D]).toFixed(2)}`;const g=c(r.length-1),m=c(0),$=`${j} L${g.toFixed(2)},${i} L${m.toFixed(2)},${i} Z`;return{line:j,area:$}}function ke(t){const n=We(t);if(!n)return null;const i=n[0],r=n[n.length-1];return r>i?"up":r<i?"down":"up"}const $e="—";function we(t){if(t==null)return!0;const n=String(t).trim();return!!(!n||/^[-−–—]$/.test(n)||/^(n\/a|null|undefined)$/i.test(n))}function Se(t){return!we(t)}function tt(t,n=$e){return we(t)?n:String(t)}function Ee(t){return t!=null&&String(t).trim()!==""}function O(t){return t?Ee(t.value)||Ee(t.delta)?!0:Array.isArray(t.points)&&t.points.length>0:!1}function nt(t){if(we(t))return null;const n=String(t).trim(),i=n.match(/\(\s*([+-])?\s*([\d.]+)/);return i?i[1]==="-"?"down":i[1]==="+"?"up":parseFloat(i[2])<0?"down":"up":/^[-−]/.test(n)?"down":/^\+/.test(n)?"up":/-\d/.test(n)?"down":null}function De(t,n){return nt(n)??(t==="down"?"down":"up")}function yt(t,n,i){return ke(i)??(Se(n)?De(t,n):t==="down"?"down":"up")}const s={ink:"var(--color-text)",muted:"var(--color-text-secondary)",border:"var(--grey-absent)",borderSubtle:"var(--neutral-100)",iconCircle:"var(--surface-hover)",black:"var(--neutral-900)",white:"var(--grey-white)",neutralBorder:"var(--neutral-250)",neutral800:"var(--neutral-800)",neutral600:"var(--neutral-600)",neutral450:"var(--neutral-450)",neutral400:"var(--neutral-400)",neutral300:"var(--neutral-300)",neutral150:"var(--neutral-150)",neutral100:"var(--neutral-100)",beige:"var(--surface-warm-40)",shadowCard:"var(--shadow-card)",railCompliance:"var(--rail-compliance)",accentYellow:"var(--accent-yellow)"},oe="var(--font-sans, 'Averta', ui-sans-serif, system-ui, sans-serif)",W="var(--font-sans, 'Averta', ui-sans-serif, system-ui, sans-serif)";function gt({direction:t="up",color:n=s.muted}){const i="M12.4167 0.75H17.4167M17.4167 0.75V5.75M17.4167 0.75L10.3333 7.83333L6.16667 3.66667L0.75 9.08333",r="M12.4167 9.25H17.4167M17.4167 9.25V4.25M17.4167 9.25L10.3333 2.16667L6.16667 6.33333L0.75 0.91667";return e.jsx("svg",{width:18,height:9.5,viewBox:"0 0 19 10",fill:"none",style:{flexShrink:0},children:e.jsx("path",{d:t==="up"?i:r,stroke:n,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Re(t){if(!t)return"";const n={month:"2-digit",day:"2-digit",year:"numeric"};if(t instanceof Date)return Number.isNaN(t.getTime())?"":t.toLocaleDateString(void 0,n);const i=String(t).trim(),r=i.match(/^(\d{4})-(\d{1,2})-(\d{1,2})/);if(r)return new Date(Number(r[1]),Number(r[2])-1,Number(r[3])).toLocaleDateString(void 0,n);const a=new Date(i);return Number.isNaN(a.getTime())?i:a.toLocaleDateString(void 0,n)}function mt({label:t,active:n=!1,onClick:i}){return e.jsx("button",{type:"button",onClick:i,style:{height:32,minWidth:31,padding:"0 12px",borderRadius:10,border:n?"none":`1px solid ${s.borderSubtle}`,background:n?s.black:s.white,color:n?s.white:s.black,fontFamily:W,fontSize:14,cursor:"pointer"},children:t})}function xe({yLabels:t,xLabels:n=[],points:i,highlightIndex:r,xAxisLabel:a="",yAxisLabel:o=""}){const[d,p]=w.useState(null),k=460,c=110,y=Array.isArray(i)&&i.length>0,j=w.useId(),g=6,m=Array.isArray(n)?n:[],$=m.length<=g?m:Array.from({length:g},(f,b)=>m[Math.round(b*(m.length-1)/(g-1))]),D=Math.max(2,$.length||g),_=Array.from({length:D},(f,b)=>b/(D-1)*k);if(!y)return e.jsxs("div",{style:{display:"flex",gap:8,height:133,width:"100%"},children:[e.jsx("div",{style:{width:24,flexShrink:0}}),e.jsx("div",{style:{flex:1,position:"relative",minWidth:0},children:e.jsx("svg",{width:"100%",height:c+14,viewBox:`0 0 ${k} ${c+14}`,preserveAspectRatio:"none",children:_.map((f,b)=>e.jsx("line",{x1:f,y1:"0",x2:f,y2:c,stroke:s.borderSubtle,strokeDasharray:"2 3",strokeWidth:"1",vectorEffect:"non-scaling-stroke"},`grid-${b}`))})})]});const M=Array.isArray(i[0])?i:i.map((f,b)=>[b,f]),X=M.map(([,f])=>f),B=Math.min(...X),N=Math.max(...X),G=N===B?Math.max(Math.abs(N)*.1,1):(N-B)*.1,K=B-G,u=N+G,A=u-K||1,I=f=>(u-f)/A*c,T=M.map(([f,b])=>[f,I(b)]),Y=t&&t.length?t:Array.from({length:5},(f,b)=>{const L=u-b/4*(u-K),z=Math.abs(L),Z=z>=100?0:z>=10?1:2;return L.toFixed(Z)}),C=T[0][0],ae=T[T.length-1][0]-C||1,ne=8,q=Math.max(1,k-ne*2),E=f=>ne+(f-C)/ae*q,R=f=>{const b=Number(f);if(!Number.isFinite(b))return String(f??"");const L=Math.abs(b),z=L>=100?0:L>=10?1:2;return b.toFixed(z)},ie=T.map(([f,b],L)=>`${L===0?"M":"L"}${E(f)},${b}`).join(" "),J=`${ie} L${E(T[T.length-1][0])},${c} L${E(T[0][0])},${c} Z`,ee=r??T.length-1;return e.jsxs("div",{style:{display:"flex",gap:8,height:a?151:133,width:"100%"},children:[o?e.jsx("div",{style:{display:"flex",alignItems:"center",flexShrink:0},children:e.jsx("span",{style:{writingMode:"vertical-rl",transform:"rotate(180deg)",fontFamily:W,fontSize:10,fontWeight:500,color:s.neutral800,whiteSpace:"nowrap"},children:o})}):null,e.jsx("div",{style:{display:"flex",flexDirection:"column",justifyContent:"space-between",padding:"14px 0",fontFamily:W,fontSize:10,color:s.neutral800,flexShrink:0},children:Y.map(f=>e.jsx("span",{children:f},f))}),e.jsxs("div",{style:{flex:1,position:"relative",minWidth:0},children:[d&&e.jsxs("div",{style:{position:"absolute",left:`${d.xPct}%`,top:`${d.yPct}%`,transform:"translate(-50%, calc(-100% - 10px))",pointerEvents:"none",zIndex:2,background:s.black,color:s.white,borderRadius:6,minWidth:60,padding:"8px 10px",boxShadow:"0 6px 16px rgba(0,0,0,0.18)",fontFamily:W,fontSize:11,lineHeight:1.25,whiteSpace:"nowrap",textAlign:"left"},children:[e.jsx("div",{children:d.label}),e.jsx("div",{style:{fontWeight:600},children:d.value}),e.jsx("div",{style:{position:"absolute",left:"50%",bottom:-5,width:10,height:10,background:s.black,transform:"translateX(-50%) rotate(45deg)",borderRadius:2}})]}),e.jsxs("svg",{width:"100%",height:c+14,viewBox:`0 0 ${k} ${c+14}`,preserveAspectRatio:"none",onMouseLeave:()=>p(null),children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:`area-${j}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",style:{stopColor:s.black,stopOpacity:.08}}),e.jsx("stop",{offset:"100%",style:{stopColor:s.black,stopOpacity:0}})]})}),_.map((f,b)=>e.jsx("line",{x1:f,y1:"0",x2:f,y2:c,stroke:s.borderSubtle,strokeDasharray:"2 3",strokeWidth:"1",vectorEffect:"non-scaling-stroke"},`grid-${b}`)),e.jsx("path",{d:J,fill:`url(#area-${j})`}),e.jsx("path",{d:ie,stroke:s.black,strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"}),T.map(([f,b],L)=>{const z=L===ee;return e.jsx("circle",{cx:E(f),cy:b,r:z?4:3,fill:z?s.black:s.white,stroke:s.black,strokeWidth:"1.5",vectorEffect:"non-scaling-stroke",onMouseEnter:()=>{var Z;p({xPct:E(f)/k*100,yPct:b/(c+28)*100,label:m[L]||`Point ${L+1}`,value:R((Z=M[L])==null?void 0:Z[1])})}},L)})]}),e.jsx("div",{style:{display:"flex",justifyContent:"space-between",paddingRight:6,fontFamily:W,fontSize:10,color:s.neutral800,marginTop:8,marginBottom:4,overflow:"hidden"},children:$.map((f,b)=>e.jsx("span",{style:{whiteSpace:"nowrap"},children:f},b))}),a?e.jsx("div",{style:{textAlign:"center",fontFamily:W,fontSize:10,fontWeight:500,color:s.neutral800},children:a}):null]})]})}function ue({title:t,value:n,delta:i,children:r}){const a=tt(n),o=Se(i),d=o?De("up",i):"up";return e.jsxs("div",{style:{flex:1,background:s.white,border:`1px solid ${s.border}`,borderRadius:8,padding:24,display:"flex",flexDirection:"column",gap:24,minWidth:0,boxShadow:s.shadowCard},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-end"},children:[e.jsx("span",{style:{fontFamily:oe,fontWeight:600,fontSize:15,color:s.ink,lineHeight:1.2},children:t}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"flex-end",gap:4,fontFamily:oe,fontWeight:600},children:[e.jsx("span",{style:{fontSize:20,color:s.black,lineHeight:1},children:a}),o?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3,fontSize:10,color:s.neutral300,lineHeight:1},children:[e.jsx(gt,{direction:d,color:s.neutral300}),i]}):null]})]}),e.jsx("div",{style:{flex:1},children:r})]})}function ze({icon:t,title:n,trailing:i,iconColor:r=s.ink,bordered:a=!1}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,width:"100%",paddingBottom:a?12:0,borderBottom:a?`1px solid ${s.border}`:"none"},children:[e.jsx("div",{style:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(t,{size:22,strokeWidth:1.75,style:{color:r}})}),e.jsx("div",{style:{flex:1,fontFamily:oe,fontWeight:600,fontSize:16,color:s.ink,lineHeight:1.2,textTransform:"uppercase",letterSpacing:"0.02em"},children:n}),i&&e.jsx("div",{style:{fontFamily:W,fontSize:14,color:s.ink},children:i})]})}function bt({text:t,bullet:n,citation:i,date:r,href:a}){const o=t??n??"";return e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",fontFamily:W,fontSize:14,color:s.ink,lineHeight:"24px",gap:16},children:[a?e.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",style:{color:s.ink,textDecoration:"underline",textUnderlineOffset:2,textDecorationColor:s.border,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o}):e.jsx("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o}),e.jsxs("span",{style:{display:"inline-flex",gap:4,whiteSpace:"nowrap"},children:[e.jsx("span",{style:{color:s.ink},children:i}),r?e.jsxs("span",{style:{color:s.muted},children:["(",r,")"]}):null]})]})}function Oe({title:t,summary:n,calls:i,percent:r,delta:a,bullets:o,defaultExpanded:d=!1}){const[p,k]=w.useState(d),c=r??a,y=Se(c),j=y?String(c):$e,m=(y?De("up",j):"up")==="down"?h.TrendingDown:h.TrendingUp,$=Array.isArray(o)?o:[];return e.jsxs("div",{style:{borderTop:`1px solid ${s.border}`},children:[e.jsxs("button",{type:"button",onClick:()=>k(D=>!D),"aria-expanded":p,style:{border:"none",background:"transparent",padding:16,display:"flex",gap:12,alignItems:"flex-start",cursor:"pointer",width:"100%",textAlign:"left",fontFamily:W},children:[e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:12,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[e.jsx("span",{style:{fontFamily:W,fontWeight:500,fontSize:14,color:s.black,lineHeight:"24px"},children:t}),e.jsx("span",{style:{fontFamily:W,fontSize:14,color:s.muted,lineHeight:"24px"},children:n})]}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx(h.Phone,{size:12,color:s.ink,strokeWidth:1.75}),e.jsxs("span",{style:{fontFamily:W,fontSize:12,color:s.ink},children:[i," Interactions"]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[y?e.jsx(m,{size:12,color:s.ink,strokeWidth:1.75}):null,e.jsx("span",{style:{fontFamily:W,fontSize:12,color:y?s.ink:s.muted},children:j})]})]})]}),e.jsx(h.ChevronDown,{size:20,color:s.ink,strokeWidth:2,style:{flexShrink:0,transform:p?"rotate(180deg)":"none",transition:"transform 150ms ease"}})]}),p&&$.length>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"0 16px 16px"},children:$.map((D,_)=>e.jsx(bt,{...D},_))})]})}function _e({label:t,value:n}){return e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 8px 12px",borderBottom:`1px solid ${s.border}`,fontFamily:W,fontSize:13,lineHeight:"1.2"},children:[e.jsx("span",{style:{color:s.ink},children:t}),e.jsx("span",{style:{color:s.muted},children:n})]})}function jt({value:t=0,max:n=5}){const i=typeof t=="number"?t:parseFloat(t)||0,r=Math.floor(i),a=i%1>0&&r<n;return e.jsx("div",{style:{display:"flex",gap:4},children:Array.from({length:n}).map((o,d)=>d<r?e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",background:s.black,display:"inline-block"}},d):d===r&&a?e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:s.black,display:"inline-block"}})},d):e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",background:s.white,border:`1px solid ${s.border}`,display:"inline-block",boxSizing:"border-box"}},d))})}const vt=[{id:"title",label:"Title",width:220,sortable:!0,filterable:!0},{id:"date",label:"Date",width:170,sortable:!0},{id:"duration",label:"Duration",width:170,sortable:!0},{id:"lift",label:"Lift",width:120,sortable:!0},{id:"compass",label:"Compass Score",width:220,sortable:!0,render:t=>{const n=typeof t=="number"?t:parseFloat(t)||0;return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{minWidth:32},children:t}),e.jsx(jt,{value:n})]})}}];function Be({icon:t,title:n}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,width:"100%"},children:[e.jsx("div",{style:{width:34,height:34,borderRadius:9999,background:s.iconCircle,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(t,{size:20,color:s.ink,strokeWidth:1.75})}),e.jsx("span",{style:{fontFamily:oe,fontWeight:600,fontSize:16,color:s.ink,lineHeight:1.2},children:n})]})}function it({agentName:t="",startDate:n="",endDate:i="",totalCalls:r="",onBack:a,className:o="",kpiBaseline:d={value:"",label:"",sub:"",trend:"up"},kpiAgentLift:p={value:"",label:"",sub:"",trend:"down"},kpiScore:k={value:"",label:"",sub:"",trend:"up"},baselineChart:c={value:"",delta:""},agentLiftChart:y={value:"",delta:""},scoreChart:j={value:"",delta:""},csatChart:g={value:"",delta:""},volumeChart:m={value:"",delta:""},guidanceItems:$=[],strengthItems:D=[],callDrivers:_=[],callParadigms:M=[],strengthsTitle:X="",guidanceTitle:B="",callMixTitle:N="",driversTitle:G="",paradigmsTitle:K="",sessionsTitle:u="",baselineChartTitle:A="",agentLiftChartTitle:I="",scoreChartTitle:T="",csatChartTitle:Y="",volumeChartTitle:C="",sessions:ye=[],sessionColumns:ae=[],initialPageSize:ne=10,selectedWindow:q="30d",onWindowChange:E,dateRange:R,onDateRangeChange:ie,sessionsTotal:J=null,sessionsPage:ee=null,sessionsPageSize:f=null,onSessionsPageChange:b,onSessionsPageSizeChange:L,onExport:z,onSessionClick:Z,onSessionsVisibleColumnsChange:le}){const re=!!(R!=null&&R.from&&(R!=null&&R.to)),P=(()=>{if(re||q!=="8h")return null;const F=je("8h");return F?Ze(F.from,F.to):null})(),U=(()=>{if(re||q==="8h")return null;const F=je(q);return F?{from:Q(F.from),to:Q(F.to)}:null})(),de=O(c)||O(y)||O(j),Le=O(g)||O(m);return e.jsxs("div",{className:o,style:{background:s.white,fontFamily:W,color:s.ink,width:"100%",minWidth:1192,boxSizing:"border-box",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"23px 32px",minHeight:78,boxSizing:"border-box"},children:[e.jsx("button",{type:"button","aria-label":"Back",onClick:a,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,background:"transparent",border:"none",cursor:"pointer",color:s.ink,padding:0,flexShrink:0},children:e.jsx(h.ArrowLeft,{size:20,strokeWidth:1.75})}),e.jsx("div",{style:{paddingLeft:16,borderLeft:`1px solid ${s.border}`,flex:1,minWidth:0,alignSelf:"stretch",display:"flex",alignItems:"center"},children:e.jsx("h1",{style:{fontFamily:oe,fontSize:24,fontWeight:400,color:s.ink,margin:0,lineHeight:1,whiteSpace:"nowrap"},children:t})}),e.jsxs("button",{type:"button",onClick:()=>z==null?void 0:z(),disabled:!z,style:{display:"inline-flex",alignItems:"center",gap:8,height:32,padding:"0 16px",borderRadius:10,border:`1px solid ${s.neutralBorder}`,background:s.white,cursor:z?"pointer":"not-allowed",opacity:z?1:.5,fontFamily:W,fontSize:14,lineHeight:"24px",color:s.neutral800,flexShrink:0},children:[e.jsx(h.Download,{size:18,strokeWidth:1.75}),"Export CSV"]})]}),e.jsxs("div",{style:{padding:"0 32px 32px",display:"flex",flexDirection:"column",gap:16},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:16,paddingLeft:49},children:[e.jsxs("div",{style:{display:"flex",gap:16,alignItems:"center"},children:[e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(h.CalendarDays,{size:14,color:s.ink,strokeWidth:1.75,style:{flexShrink:0}}),e.jsx("span",{style:{fontFamily:W,fontSize:12,color:s.ink,lineHeight:1.5},children:(P==null?void 0:P.from)??(U==null?void 0:U.from)??Re(n)}),e.jsx(h.ArrowRight,{size:12,color:s.ink,strokeWidth:1.75,style:{flexShrink:0}}),e.jsx("span",{style:{fontFamily:W,fontSize:12,color:s.ink,lineHeight:1.5},children:(P==null?void 0:P.to)??(U==null?void 0:U.to)??Re(i)})]}),e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(h.Phone,{size:14,color:s.ink,strokeWidth:1.75,style:{flexShrink:0}}),e.jsx("span",{style:{fontFamily:W,fontSize:12,color:s.ink,lineHeight:1.5},children:r})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[[{id:"8h",label:"8h"},{id:"1d",label:"1d"},{id:"7d",label:"7d"},{id:"30d",label:"30d"}].map(F=>e.jsx(mt,{label:F.label,active:!re&&F.id===q,onClick:()=>E==null?void 0:E(F.id)},F.id)),e.jsx(Ie,{value:R,onChange:ie})]})]}),de&&e.jsxs("div",{style:{display:"flex",gap:24},children:[O(c)&&e.jsx(ue,{title:A,value:c.value,delta:c.delta,children:e.jsx(xe,{yLabels:c.yLabels,xLabels:c.xLabels,points:c.points,xAxisLabel:c.xAxisLabel,yAxisLabel:c.yAxisLabel})}),O(y)&&e.jsx(ue,{title:I,value:y.value,delta:y.delta,children:e.jsx(xe,{yLabels:y.yLabels,xLabels:y.xLabels,points:y.points,xAxisLabel:y.xAxisLabel,yAxisLabel:y.yAxisLabel})}),O(j)&&e.jsx(ue,{title:T,value:j.value,delta:j.delta,children:e.jsx(xe,{yLabels:j.yLabels,xLabels:j.xLabels,points:j.points,xAxisLabel:j.xAxisLabel,yAxisLabel:j.yAxisLabel})})]}),Le&&e.jsxs("div",{style:{display:"flex",gap:24},children:[O(g)&&e.jsx(ue,{title:Y,value:g.value,delta:g.delta,children:e.jsx(xe,{yLabels:g.yLabels,xLabels:g.xLabels,points:g.points,xAxisLabel:g.xAxisLabel,yAxisLabel:g.yAxisLabel})}),O(m)&&e.jsx(ue,{title:C,value:m.value,delta:m.delta,children:e.jsx(xe,{yLabels:m.yLabels,xLabels:m.xLabels,points:m.points,xAxisLabel:m.xAxisLabel,yAxisLabel:m.yAxisLabel})})]}),e.jsxs("div",{style:{display:"flex",gap:24,marginTop:8,alignItems:"flex-start"},children:[e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:16,minWidth:0},children:[e.jsx(ze,{icon:h.ShieldCheck,title:X,iconColor:s.railCompliance}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:D.map((F,V)=>e.jsx(Oe,{...F},V))})]}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:16,minWidth:0},children:[e.jsx(ze,{icon:h.Lightbulb,title:B,iconColor:s.railCompliance}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:$.map((F,V)=>e.jsx(Oe,{...F},V))})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,marginTop:8},children:[e.jsx(ze,{icon:h.Phone,title:N,iconColor:s.railCompliance}),e.jsxs("div",{style:{display:"flex",gap:24,alignItems:"flex-start"},children:[e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:8,minWidth:0},children:[e.jsx(Be,{icon:h.FolderKanban,title:G}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:_.map((F,V)=>e.jsx(_e,{...F},V))})]}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:8,minWidth:0},children:[e.jsx(Be,{icon:h.Layers,title:K}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:M.map((F,V)=>e.jsx(_e,{...F},V))})]})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,marginTop:8},children:[u&&e.jsx("span",{style:{fontFamily:oe,fontWeight:600,fontSize:16,color:s.ink,lineHeight:1.2},children:u}),e.jsx(Ge.DataTable2,{data:ye,columns:ae,initialPageSize:ne,totalCount:J,page:ee,pageSize:f,onPageChange:b,onPageSizeChange:L,onRowClick:Z,onVisibleColumnsChange:le})]})]})]})}const fe={value:"",label:"",trend:"up"},l={ink:"var(--color-text)",muted:"var(--color-text-secondary)",border:"var(--grey-absent)",borderSubtle:"var(--neutral-100)",iconCircle:"var(--surface-hover)",black:"var(--neutral-900)",white:"var(--grey-white)",green:"var(--color-green)",red:"var(--color-red-strong)",neutralBorder:"var(--neutral-250)",neutralLight:"var(--neutral-100)",beige:"var(--surface-warm-40)",neutral800:"var(--neutral-800)",textInk:"var(--text-ink)",textFaintGrey:"var(--text-faint-grey)",hoverWarm40:"var(--hover-warm-40)",shadowPopover:"var(--shadow-popover)",shadowDropdown:"var(--shadow-dropdown)",railCompliance:"var(--rail-compliance)"},te="var(--font-sans, 'Averta', ui-sans-serif, system-ui, sans-serif)",S="var(--font-sans, 'Averta', ui-sans-serif, system-ui, sans-serif)";function lt({trend:t="up",points:n,width:i=49.618,height:r=35}){const a=w.useId(),o=et(n),d=o?o.line:pt,p=o?o.area:ht,k=ke(n)??t;return e.jsxs("svg",{width:i,height:r,viewBox:"0 0 52 36",fill:"none",style:{flexShrink:0,transform:!o&&k==="down"?"scaleX(-1)":void 0},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:`spark-${a}`,x1:"9.96776",y1:"16.2053",x2:"9.96776",y2:"36.0002",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:l.ink}),e.jsx("stop",{offset:"1",stopColor:l.white,stopOpacity:"0.01"})]})}),e.jsx("path",{d:p,fill:`url(#spark-${a})`,fillRule:"evenodd",clipRule:"evenodd",opacity:"0.1"}),e.jsx("path",{d,stroke:l.ink,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:!o&&k==="down"?"2 4":void 0})]})}function rt(t,n){return ke(n)??(t==="down"?"down":"up")}function st({direction:t="up",color:n=l.muted}){const i="M12.4167 0.75H17.4167M17.4167 0.75V5.75M17.4167 0.75L10.3333 7.83333L6.16667 3.66667L0.75 9.08333",r="M12.4167 9.25H17.4167M17.4167 9.25V4.25M17.4167 9.25L10.3333 2.16667L6.16667 6.33333L0.75 0.91667";return e.jsx("svg",{width:18,height:9.5,viewBox:"0 0 19 10",fill:"none",style:{flexShrink:0},children:e.jsx("path",{d:t==="up"?i:r,stroke:n,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ye({value:t,label:n,trend:i="up",points:r,muted:a=!1,beigeBg:o=!1,style:d={}}){const p=rt(i,r);return e.jsxs("div",{style:{background:o?l.beige:l.white,border:`1px solid ${l.border}`,borderRadius:8,padding:16,display:"flex",flexDirection:"column",gap:8,boxSizing:"border-box",...d},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[e.jsx(lt,{trend:p,points:r}),e.jsx(st,{direction:p})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,marginTop:8},children:[e.jsx("div",{style:{fontFamily:te,fontSize:28,fontWeight:500,lineHeight:"1.2",color:a?l.muted:l.ink,letterSpacing:"-0.01em"},children:t}),e.jsx("div",{style:{fontFamily:S,fontSize:13,color:l.ink,lineHeight:"1.2"},children:n})]})]})}function Ae({value:t,label:n,trend:i="up",points:r,withDivider:a=!1}){const o=rt(i,r);return e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:8,paddingLeft:a?24:0,borderLeft:a?`1px solid ${l.border}`:"none",minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[e.jsx(lt,{trend:o,points:r}),e.jsx(st,{direction:o})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,marginTop:8},children:[e.jsx("div",{style:{fontFamily:te,fontSize:28,fontWeight:500,lineHeight:"1.2",color:l.muted,letterSpacing:"-0.01em"},children:t}),e.jsx("div",{style:{fontFamily:S,fontSize:13,color:l.ink,lineHeight:"1.2"},children:n})]})]})}function kt({icon:t,children:n,trailing:i}){return e.jsxs("button",{type:"button",style:{display:"inline-flex",alignItems:"center",gap:8,height:32,padding:"0 16px",borderRadius:10,border:`1px solid ${l.neutralBorder}`,background:l.white,cursor:"pointer",fontFamily:S,fontSize:14,color:l.neutral800,whiteSpace:"nowrap"},children:[t&&e.jsx(t,{size:18,strokeWidth:1.75}),n,i&&e.jsx(i,{size:16,strokeWidth:2})]})}const wt=["January","February","March","April","May","June","July","August","September","October","November","December"],St=["Su","Mo","Tu","We","Th","Fr","Sa"];function ge(t){const n=new Date(t);return n.setHours(0,0,0,0),n}function Dt(t,n){const r=new Date(t,n,1).getDay(),a=new Date(t,n,1-r);return Array.from({length:42},(o,d)=>{const p=new Date(a);return p.setDate(a.getDate()+d),p})}function Lt({value:t,onApply:n,onClose:i,anchorRef:r}){const a=w.useRef(null),[o,d]=w.useState(t!=null&&t.from?ge(t.from):null),[p,k]=w.useState(t!=null&&t.to?ge(t.to):null),c=o||new Date,[y,j]=w.useState(c.getFullYear()),[g,m]=w.useState(c.getMonth()),[$,D]=w.useState({top:0,left:0});w.useLayoutEffect(()=>{const u=()=>{if(!(r!=null&&r.current))return;const A=r.current.getBoundingClientRect(),I=320;D({top:A.bottom+6,left:Math.max(8,A.right-I)})};return u(),window.addEventListener("scroll",u,!0),window.addEventListener("resize",u),()=>{window.removeEventListener("scroll",u,!0),window.removeEventListener("resize",u)}},[r]),w.useEffect(()=>{const u=I=>{var T,Y;(T=a.current)!=null&&T.contains(I.target)||(Y=r==null?void 0:r.current)!=null&&Y.contains(I.target)||i()},A=I=>{I.key==="Escape"&&i()};return document.addEventListener("mousedown",u),document.addEventListener("keydown",A),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",A)}},[i,r]);const _=Dt(y,g),M=ge(new Date),X=u=>{const A=ge(u);A>M||(!o||o&&p?(d(A),k(null)):A<o?d(A):k(A))},B=()=>{g===0?(m(11),j(y-1)):m(g-1)},N=()=>{g===11?(m(0),j(y+1)):m(g+1)},G=u=>o&&p&&u>=o&&u<=p,K=u=>o&&u.getTime()===o.getTime()||p&&u.getTime()===p.getTime();return xt.createPortal(e.jsxs("div",{ref:a,style:{position:"fixed",top:$.top,left:$.left,width:320,background:l.white,border:`1px solid ${l.borderSubtle}`,borderRadius:12,boxShadow:l.shadowPopover,padding:16,zIndex:9999,fontFamily:S},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[e.jsx("button",{type:"button",onClick:B,style:Ue,"aria-label":"Previous month",children:e.jsx(h.ChevronLeft,{size:18,strokeWidth:1.75})}),e.jsxs("div",{style:{fontSize:14,fontWeight:600,color:l.ink},children:[wt[g]," ",y]}),e.jsx("button",{type:"button",onClick:N,style:Ue,"aria-label":"Next month",children:e.jsx(h.ChevronRight,{size:18,strokeWidth:1.75})})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:2,marginBottom:4},children:St.map(u=>e.jsx("div",{style:{textAlign:"center",fontSize:12,color:l.muted,padding:"4px 0"},children:u},u))}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:2},children:_.map(u=>{const A=u.getMonth()===g,I=G(u),T=K(u),Y=u.getTime()===M.getTime(),C=u>M;return e.jsx("button",{type:"button",onClick:()=>X(u),disabled:C,"aria-disabled":C,style:{height:36,border:"none",borderRadius:8,background:T?l.black:I?l.hoverWarm40:"transparent",color:T?l.white:C?l.textFaintGrey:A?l.ink:l.muted,fontFamily:S,fontSize:13,fontWeight:Y?500:400,cursor:C?"not-allowed":"pointer",opacity:C?.6:1},children:u.getDate()},u.toISOString())})}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:12,paddingTop:12,borderTop:`1px solid ${l.borderSubtle}`},children:[e.jsx("button",{type:"button",onClick:()=>{d(null),k(null)},style:{background:"transparent",border:"none",padding:0,cursor:"pointer",fontSize:14,fontWeight:500,color:l.ink},children:"Clear"}),e.jsx("button",{type:"button",disabled:!o||!p,onClick:()=>{n({from:o,to:p}),i()},style:{background:!o||!p?l.neutralBorder:l.black,color:l.white,border:"none",borderRadius:10,height:30,padding:"0 16px",fontFamily:S,fontSize:14,fontWeight:600,cursor:!o||!p?"not-allowed":"pointer"},children:"Apply"})]})]}),document.body)}const Ue={display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,border:"none",background:"transparent",borderRadius:6,cursor:"pointer",color:l.ink};function Ie({value:t,onChange:n}){const[i,r]=w.useState(!1),a=w.useRef(null),o=!!(t!=null&&t.from&&(t!=null&&t.to));return e.jsxs(e.Fragment,{children:[e.jsxs("button",{ref:a,type:"button",onClick:()=>r(d=>!d),style:{display:"inline-flex",alignItems:"center",gap:8,height:32,padding:"0 16px",borderRadius:10,border:o?"none":`1px solid ${l.neutralBorder}`,background:o?l.black:l.white,cursor:"pointer",fontFamily:S,fontSize:14,color:o?l.white:l.neutral800,fontWeight:o?600:400,whiteSpace:"nowrap"},children:[e.jsx(h.CalendarDays,{size:18,strokeWidth:1.75}),"Date Range"]}),i&&e.jsx(Lt,{value:t,anchorRef:a,onClose:()=>r(!1),onApply:d=>n==null?void 0:n(d)})]})}function Ft({label:t,active:n=!1,onClick:i}){return e.jsx("button",{type:"button",onClick:i,style:{height:32,minWidth:31,padding:"0 12px",borderRadius:10,border:n?"none":`1px solid ${l.borderSubtle}`,background:n?l.black:l.white,color:n?l.white:l.black,fontFamily:S,fontSize:14,cursor:"pointer"},children:t})}const zt=[{id:"8h",label:"8h"},{id:"1d",label:"1d"},{id:"7d",label:"7d"},{id:"30d",label:"30d"}];function At({value:t=0,max:n=5}){const i=typeof t=="number"?t:parseFloat(t)||0,r=Math.floor(i),a=i%1>0&&r<n;return e.jsx("div",{style:{display:"flex",gap:4},children:Array.from({length:n}).map((o,d)=>d<r?e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",background:l.black,display:"inline-block"}},d):d===r&&a?e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:l.black,display:"inline-block"}})},d):e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",background:l.white,border:`1px solid ${l.border}`,display:"inline-block",boxSizing:"border-box"}},d))})}const Tt=[{id:"agent",label:"Agent",width:180,sortable:!0,filterable:!0},{id:"supervisor",label:"Supervisor",width:170,sortable:!0,filterable:!0},{id:"calls",label:"Calls",width:100,sortable:!0},{id:"baseline",label:"Baseline",width:110,sortable:!0},{id:"lift",label:"Lift",width:100,sortable:!0},{id:"score",label:"Score",width:100,sortable:!0,filterable:!0,filterType:"number"},{id:"compass",label:"Compass Score",width:200,sortable:!0,filterable:!0,filterType:"number",render:t=>e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{minWidth:32},children:t}),e.jsx(At,{value:typeof t=="number"?t:0})]})},{id:"totalDuration",label:"Total Duration",width:150,sortable:!0,filterable:!0,filterType:"duration",filterShowPresets:!1},{id:"avgDuration",label:"Average Duration",width:170,sortable:!0,filterable:!0,filterType:"duration",filterShowPresets:!1}];function me({icon:t,title:n,trailing:i,iconColor:r=l.ink,bordered:a=!1}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,width:"100%",paddingBottom:a?12:0,borderBottom:a?`1px solid ${l.border}`:"none"},children:[e.jsx("div",{style:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(t,{size:22,strokeWidth:1.75,style:{color:r}})}),e.jsx("div",{style:{flex:1,fontFamily:te,fontWeight:600,fontSize:16,color:l.ink,lineHeight:"1.2",textTransform:"uppercase",letterSpacing:"0.02em"},children:n}),i&&e.jsx("div",{style:{fontFamily:S,fontSize:14,color:l.ink},children:i})]})}function Ve({icon:t,title:n}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,width:"100%"},children:[e.jsx("div",{style:{width:34,height:34,borderRadius:9999,background:l.iconCircle,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(t,{size:20,color:l.ink,strokeWidth:1.75})}),e.jsx("span",{style:{fontFamily:te,fontWeight:600,fontSize:16,color:l.ink,lineHeight:"24px"},children:n})]})}function Xe({title:t,summary:n,calls:i,percent:r,bullets:a,defaultExpanded:o=!1}){const[d,p]=w.useState(o),k=Array.isArray(a)?a:[];return e.jsxs("div",{style:{borderTop:`1px solid ${l.border}`},children:[e.jsxs("button",{type:"button",onClick:()=>p(c=>!c),"aria-expanded":d,style:{border:"none",background:"transparent",padding:16,display:"flex",gap:12,alignItems:"flex-start",cursor:"pointer",width:"100%",textAlign:"left",fontFamily:S},children:[e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:12,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[e.jsx("div",{style:{fontFamily:te,fontWeight:600,fontSize:14,color:l.black,lineHeight:"24px"},children:t}),e.jsx("div",{style:{fontFamily:S,fontSize:14,color:l.muted,lineHeight:"24px"},children:n})]}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx(h.Phone,{size:14,color:l.ink,strokeWidth:1.75}),e.jsx("span",{style:{fontFamily:S,fontSize:12,color:l.ink,lineHeight:1.5},children:i})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx(h.TrendingUp,{size:14,color:l.ink,strokeWidth:1.75}),e.jsx("span",{style:{fontFamily:S,fontSize:12,color:l.ink,lineHeight:1.5},children:r})]})]})]}),e.jsx(h.ChevronDown,{size:20,color:l.ink,strokeWidth:2,style:{flexShrink:0,transform:d?"rotate(180deg)":"none",transition:"transform 150ms ease"}})]}),d&&k.length>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"0 16px 16px"},children:k.map((c,y)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",fontFamily:S,fontSize:14,color:l.ink,lineHeight:"24px",gap:16},children:[c.href?e.jsx("a",{href:c.href,target:"_blank",rel:"noopener noreferrer",style:{color:l.ink,textDecoration:"underline",textUnderlineOffset:2,textDecorationColor:l.border,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c.text}):e.jsx("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c.text}),e.jsxs("span",{style:{display:"inline-flex",gap:4,whiteSpace:"nowrap"},children:[e.jsx("span",{style:{color:l.ink},children:c.citation}),e.jsxs("span",{style:{color:l.muted},children:["(",c.date,")"]})]})]},y))})]})}function be({label:t,value:n}){return e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 0",borderBottom:`1px solid ${l.border}`,fontFamily:S,fontSize:13,lineHeight:"24px"},children:[e.jsx("span",{style:{color:l.ink},children:t}),e.jsx("span",{style:{color:l.muted},children:n})]})}function pe({message:t=""}){return t?e.jsx("div",{style:{padding:"16px 0",fontFamily:S,fontSize:13,color:l.muted,lineHeight:1.5},children:t}):null}function Wt({className:t="",onAgentClick:n,title:i="",subtitle:r="",dateRangeLabel:a="",viewByOptions:o=[],initialViewBy:d="",onViewByChange:p,aggregatedByLabel:k="",volumeStat:c=fe,compassStat:y=fe,baselineSubStat:j=fe,agentLiftSubStat:g=fe,scoreSubStat:m=fe,agentRows:$=[],agentColumns:D=[],initialPageSize:_=10,guidanceItems:M=[],strengthItems:X=[],callDrivers:B=[],callParadigms:N=[],topSignalsLeft:G=[],topSignalsRight:K=[],topSignalsTrailing:u="",strengthsTitle:A="",guidanceTitle:I="",callMixTitle:T="",driversTitle:Y="",paradigmsTitle:C="",topSignalsTitle:ye="",emptyStrengthsMessage:ae="",emptyGuidanceMessage:ne="",emptyDriversMessage:q="",emptyParadigmsMessage:E="",emptyTopSignalsMessage:R="",rangeOptions:ie=zt,selectedWindow:J="30d",onWindowChange:ee,dateRangePicker:f,dateRange:b,onDateRangeChange:L,onExport:z,onVisibleColumnsChange:Z}){var Pe,He;const[le,re]=w.useState(null),[P,U]=w.useState(!1),[de,Le]=w.useState(d),[F,V]=w.useState(null),H=b!==void 0?b:F,Fe=!!(H!=null&&H.from&&(H!=null&&H.to)),ot=x=>{V(x),L==null||L(x)},at=x=>{V(null),L==null||L(null),ee==null||ee(x)},Me=w.useRef(null),Ce=w.useRef(null);w.useEffect(()=>{if(!P)return;const x=v=>{var ce,Ne;(ce=Ce.current)!=null&&ce.contains(v.target)||(Ne=Me.current)!=null&&Ne.contains(v.target)||U(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[P]);const dt=((Pe=o.find(x=>x.id===de))==null?void 0:Pe.label)||(((He=o[0])==null?void 0:He.label)??""),ct=x=>{if(n){n(x);return}re(x)};return e.jsxs(e.Fragment,{children:[le&&(()=>{let x=null,v=null;if(Fe)x=H.from,v=H.to;else{const ce=ve[J];ce&&(v=new Date,x=new Date(v.getTime()-ce))}return e.jsx(it,{className:t,agentName:le.agent,startDate:x||"",endDate:v||"",totalCalls:`${le.calls} Calls`,onBack:()=>re(null),selectedWindow:J,dateRange:H})})(),e.jsxs("div",{className:t,style:{background:l.white,fontFamily:S,color:l.ink,width:"100%",minWidth:1192,boxSizing:"border-box",padding:"12px 32px 32px",flexDirection:"column",gap:24,display:le?"none":"flex"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8,paddingTop:12},children:[e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:4},children:[e.jsx("h1",{style:{fontFamily:te,fontSize:24,fontWeight:500,color:l.ink,margin:0,lineHeight:"1.2",letterSpacing:"-0.01em"},children:i}),e.jsx("p",{style:{fontFamily:S,fontSize:14,color:"var(--neutral-950)",margin:0,lineHeight:"1.4"},children:r})]}),e.jsxs("button",{type:"button",onClick:()=>z==null?void 0:z(),disabled:!z,style:{display:"inline-flex",alignItems:"center",gap:8,height:32,padding:"0 16px",borderRadius:10,border:`1px solid ${l.neutralBorder}`,background:l.white,cursor:z?"pointer":"not-allowed",opacity:z?1:.5,fontFamily:S,fontSize:14,color:l.neutral800},children:[e.jsx(h.Download,{size:18,strokeWidth:1.75}),"Export CSV"]})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("button",{type:"button",ref:Me,onClick:()=>U(x=>!x),"aria-haspopup":"listbox","aria-expanded":P,style:{display:"inline-flex",alignItems:"center",gap:8,height:32,padding:"0 16px",borderRadius:10,border:`1px solid ${l.neutralBorder}`,background:l.white,cursor:"pointer",fontFamily:S,fontSize:14,lineHeight:"24px",color:l.neutral800,whiteSpace:"nowrap"},children:[dt,e.jsx(h.ChevronDown,{size:20,strokeWidth:1.75,style:{transform:P?"rotate(180deg)":"none",transition:"transform 120ms ease"}})]}),P&&e.jsxs("div",{ref:Ce,role:"listbox",style:{position:"absolute",top:36,left:0,zIndex:20,background:l.white,border:`1px solid ${l.border}`,borderRadius:4,boxShadow:l.shadowDropdown,display:"flex",flexDirection:"column",minWidth:144,fontFamily:S},children:[k&&e.jsx("div",{style:{padding:12,fontFamily:te,fontWeight:600,fontSize:13,color:l.ink,lineHeight:1.2},children:k}),o.map(x=>{const v=de===x.id;return e.jsxs("button",{type:"button",role:"option","aria-selected":v,onClick:()=>{x.id!==de&&(Le(x.id),p==null||p(x.id)),U(!1)},style:{display:"flex",alignItems:"center",gap:8,padding:v?12:"12px 12px 12px 40px",borderTop:`1px solid ${l.border}`,borderLeft:"none",borderRight:"none",borderBottom:"none",background:"transparent",cursor:"pointer",textAlign:"left",fontFamily:S,fontSize:13,lineHeight:1.2,color:l.ink,width:"100%"},children:[v&&e.jsx(h.Check,{size:20,color:l.ink,strokeWidth:1.75,style:{flexShrink:0}}),e.jsx("span",{children:x.label})]},x.id)})]})]}),e.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[(()=>{const v=(Fe?`${Q(H.from)} – ${Q(H.to)}`:"")||Qe(J)||a;return v?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontFamily:S,fontSize:13,color:l.ink},children:[e.jsx(h.CalendarDays,{size:16,strokeWidth:1.75,color:l.muted}),v]}):null})(),ie.map(x=>e.jsx(Ft,{label:x.label,active:!Fe&&x.id===J,onClick:()=>at(x.id)},x.id)),f?e.jsx(w.Suspense,{fallback:e.jsx(kt,{icon:h.CalendarDays,children:"Date Range"}),children:f}):e.jsx(Ie,{value:H,onChange:ot})]})]}),e.jsxs("div",{style:{display:"flex",gap:24},children:[e.jsx(Ye,{value:c.value,label:c.label,trend:c.trend,points:c.points,style:{width:264,flexShrink:0}}),e.jsx(Ye,{value:y.value,label:y.label,trend:y.trend,points:y.points,style:{width:264,flexShrink:0}}),e.jsxs("div",{style:{flex:1,background:l.beige,border:`1px solid ${l.border}`,borderRadius:8,padding:16,display:"flex",gap:24,alignItems:"stretch",boxSizing:"border-box"},children:[e.jsx(Ae,{value:j.value,label:j.label,trend:j.trend,points:j.points}),e.jsx(Ae,{value:g.value,label:g.label,trend:g.trend,points:g.points,withDivider:!0}),e.jsx(Ae,{value:m.value,label:m.label,trend:m.trend,points:m.points,withDivider:!0})]})]}),e.jsx(Ge.DataTable2,{data:$,columns:D,initialPageSize:_,onRowClick:ct,onVisibleColumnsChange:Z}),e.jsxs("div",{style:{display:"flex",gap:24,alignItems:"flex-start"},children:[e.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:16},children:[e.jsx(me,{icon:h.ShieldCheck,title:A,iconColor:"var(--rail-compliance)"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",borderBottom:`1px solid ${l.border}`,maxHeight:480,overflowY:"auto"},children:X.length===0?e.jsx(pe,{message:ae}):X.map((x,v)=>e.jsx(Xe,{...x},v))})]}),e.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:16},children:[e.jsx(me,{icon:h.Lightbulb,title:I,iconColor:"var(--rail-compliance)"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",borderBottom:`1px solid ${l.border}`,maxHeight:480,overflowY:"auto"},children:M.length===0?e.jsx(pe,{message:ne}):M.map((x,v)=>e.jsx(Xe,{...x},v))})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsx(me,{icon:h.Phone,title:T,iconColor:"var(--rail-compliance)"}),e.jsxs("div",{style:{display:"flex",gap:24,alignItems:"flex-start"},children:[e.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:8},children:[e.jsx(Ve,{icon:h.FolderKanban,title:Y}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:B.length===0?e.jsx(pe,{message:q}):B.map((x,v)=>e.jsx(be,{...x},v))})]}),e.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:8},children:[e.jsx(Ve,{icon:h.Layers,title:C}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:N.length===0?e.jsx(pe,{message:E}):N.map((x,v)=>e.jsx(be,{...x},v))})]})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsx(me,{icon:h.Signal,title:ye,iconColor:"var(--rail-compliance)",trailing:u,bordered:!0}),G.length===0&&K.length===0?e.jsx(pe,{message:R}):e.jsxs("div",{style:{display:"flex",gap:24},children:[e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:G.map((x,v)=>e.jsx(be,{...x},v))}),e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:K.map((x,v)=>e.jsx(be,{...x},v))})]})]})]})]})}exports.DEFAULT_AGENT_COLUMNS=Tt;exports.DEFAULT_SESSION_COLUMNS=vt;exports.DateRangeButton=Ie;exports.METRIC_PLACEHOLDER=$e;exports.PerformanceDetailsPage=it;exports.PerformancePanel=Wt;exports.RANGE_TO_MS=ve;exports.buildSparkPaths=et;exports.computeWindowLabel=Qe;exports.formatEightHourRangeEndpoints=Ze;exports.formatEightHourWindowLabel=Je;exports.formatLocalDate=Q;exports.formatMetricDisplay=tt;exports.getPresetWindowDates=je;exports.hasChartData=O;exports.hasMeaningfulMetric=Se;exports.isNullishMetric=we;exports.normalizeSparkPoints=We;exports.resolveKpiTrend=yt;exports.resolveTrend=De;exports.trendFromPoints=ke;exports.trendFromSignedValue=nt;
1
+ "use strict";const e=require("react/jsx-runtime"),D=require("react"),ct=require("react-dom"),y=require("lucide-react"),Xe=require("./DataTable2.cjs.js"),be={"8h":8*60*60*1e3,"1d":24*60*60*1e3,"7d":7*24*60*60*1e3,"30d":30*24*60*60*1e3},Ge=void 0,xt={month:"2-digit",day:"2-digit",year:"numeric"},ut={hour:"numeric",minute:"2-digit",hour12:!0};function ue(t){if(!t)return null;if(t instanceof Date)return Number.isNaN(t.getTime())?null:t;const n=String(t).trim(),i=n.match(/^(\d{4})-(\d{1,2})-(\d{1,2})/);if(i){const a=new Date(Number(i[1]),Number(i[2])-1,Number(i[3]));return Number.isNaN(a.getTime())?null:a}const r=new Date(n);return Number.isNaN(r.getTime())?null:r}function Ke(t,n){return t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()}function Q(t){const n=t instanceof Date?t:ue(t);return n?n.toLocaleDateString(Ge,xt):""}function ze(t){return t.toLocaleTimeString(Ge,ut)}function ie(t){return`${Q(t)} ${ze(t)}`}function qe(t,n){const i=ue(t),r=ue(n);return!i||!r?"":Ke(i,r)?`${ie(i)} – ${ze(r)}`:`${ie(i)} – ${ie(r)}`}function Je(t,n){const i=ue(t),r=ue(n);return!i||!r?null:Ke(i,r)?{from:ie(i),to:ze(r)}:{from:ie(i),to:ie(r)}}function ge(t){const n=be[t];if(!n)return null;const i=new Date;return{from:new Date(i.getTime()-n),to:i}}function Ze(t){if(!be[t])return"";const i=ge(t);return i?t==="8h"?qe(i.from,i.to):`${Q(i.from)} – ${Q(i.to)}`:""}const ft="M1.00049 13.5213C7.85975 11.7032 8.88149 4.73912 13.7838 4.73912C19.8344 4.73912 23.6237 17.166 29.1281 17.166C34.5998 17.166 37.4149 4.88121 43.4004 8.61051C47.9764 11.4616 50.6186 1.00024 50.6186 1.00024",pt="M1.00049 16.692C8.88149 15.6975 8.88149 7.79403 13.7838 7.79403C19.8344 7.79403 23.6237 21.4034 29.1281 21.4034C34.5998 21.4034 37.4149 8.93821 43.4004 12.7223C47.9764 15.6152 50.6186 5.00024 50.6186 5.00024V36.0002C50.6186 36.0002 10.8223 36.0002 1.00049 36.0002C1.00049 28.8653 1.00049 19.4871 1.00049 16.692Z";function Te(t){if(!Array.isArray(t))return null;const n=t.map(i=>Array.isArray(i)?Number(i[1]):i==null||i===""?NaN:Number(i)).filter(i=>Number.isFinite(i));return n.length>=2?n:null}function Qe(t,n=52,i=36){const r=Te(t);if(!r)return null;const a=Math.min(...r),o=Math.max(...r),d=4,p=o-a||1,k=i-d*2-4,c=w=>(r.length===1?0:w/(r.length-1)*(n-2))+1,m=w=>d+(1-(w-a)/p)*k;let g="";for(let w=0;w<r.length;w++)g+=`${w===0?"M":"L"}${c(w).toFixed(2)},${m(r[w]).toFixed(2)}`;const b=c(r.length-1),j=c(0),I=`${g} L${b.toFixed(2)},${i} L${j.toFixed(2)},${i} Z`;return{line:g,area:I}}function je(t){const n=Te(t);if(!n)return null;const i=n[0],r=n[n.length-1];return r>i?"up":r<i?"down":"up"}const We="—";function ve(t){if(t==null)return!0;const n=String(t).trim();return!!(!n||/^[-−–—]$/.test(n)||/^(n\/a|null|undefined)$/i.test(n))}function ke(t){return!ve(t)}function et(t,n=We){return ve(t)?n:String(t)}function Ne(t){return t!=null&&String(t).trim()!==""}function _(t){return t?Ne(t.value)||Ne(t.delta)?!0:Array.isArray(t.points)&&t.points.length>0:!1}function tt(t){if(ve(t))return null;const n=String(t).trim(),i=n.match(/\(\s*([+-])?\s*([\d.]+)/);return i?i[1]==="-"?"down":i[1]==="+"?"up":parseFloat(i[2])<0?"down":"up":/^[-−]/.test(n)?"down":/^\+/.test(n)?"up":/-\d/.test(n)?"down":null}function we(t,n){return tt(n)??(t==="down"?"down":"up")}function ht(t,n,i){return je(i)??(ke(n)?we(t,n):t==="down"?"down":"up")}const s={ink:"var(--color-text)",muted:"var(--color-text-secondary)",border:"var(--grey-absent)",borderSubtle:"var(--neutral-100)",iconCircle:"var(--surface-hover)",black:"var(--neutral-900)",white:"var(--grey-white)",neutralBorder:"var(--neutral-250)",neutral800:"var(--neutral-800)",neutral600:"var(--neutral-600)",neutral450:"var(--neutral-450)",neutral400:"var(--neutral-400)",neutral300:"var(--neutral-300)",neutral150:"var(--neutral-150)",neutral100:"var(--neutral-100)",beige:"var(--surface-warm-40)",shadowCard:"var(--shadow-card)",railCompliance:"var(--rail-compliance)",accentYellow:"var(--accent-yellow)"},le="var(--font-sans, 'Averta', ui-sans-serif, system-ui, sans-serif)",T="var(--font-sans, 'Averta', ui-sans-serif, system-ui, sans-serif)";function yt({direction:t="up",color:n=s.muted}){const i="M12.4167 0.75H17.4167M17.4167 0.75V5.75M17.4167 0.75L10.3333 7.83333L6.16667 3.66667L0.75 9.08333",r="M12.4167 9.25H17.4167M17.4167 9.25V4.25M17.4167 9.25L10.3333 2.16667L6.16667 6.33333L0.75 0.91667";return e.jsx("svg",{width:18,height:9.5,viewBox:"0 0 19 10",fill:"none",style:{flexShrink:0},children:e.jsx("path",{d:t==="up"?i:r,stroke:n,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ee(t){if(!t)return"";const n={month:"2-digit",day:"2-digit",year:"numeric"};if(t instanceof Date)return Number.isNaN(t.getTime())?"":t.toLocaleDateString(void 0,n);const i=String(t).trim(),r=i.match(/^(\d{4})-(\d{1,2})-(\d{1,2})/);if(r)return new Date(Number(r[1]),Number(r[2])-1,Number(r[3])).toLocaleDateString(void 0,n);const a=new Date(i);return Number.isNaN(a.getTime())?i:a.toLocaleDateString(void 0,n)}function mt({label:t,active:n=!1,onClick:i}){return e.jsx("button",{type:"button",onClick:i,style:{height:32,minWidth:31,padding:"0 12px",borderRadius:10,border:n?"none":`1px solid ${s.borderSubtle}`,background:n?s.black:s.white,color:n?s.white:s.black,fontFamily:T,fontSize:14,cursor:"pointer"},children:t})}function ae({yLabels:t,xLabels:n=[],points:i,highlightIndex:r,xAxisLabel:a="",yAxisLabel:o=""}){const[d,p]=D.useState(null),k=460,c=110,m=Array.isArray(i)&&i.length>0,g=D.useId(),b=6,j=Array.isArray(n)?n:[],I=j.length<=b?j:Array.from({length:b},(u,h)=>j[Math.round(h*(j.length-1)/(b-1))]),w=Math.max(2,I.length||b),N=Array.from({length:w},(u,h)=>h/(w-1)*k);if(!m)return e.jsxs("div",{style:{display:"flex",gap:8,height:133,width:"100%"},children:[e.jsx("div",{style:{width:24,flexShrink:0}}),e.jsx("div",{style:{flex:1,position:"relative",minWidth:0},children:e.jsx("svg",{width:"100%",height:c+14,viewBox:`0 0 ${k} ${c+14}`,preserveAspectRatio:"none",children:N.map((u,h)=>e.jsx("line",{x1:u,y1:"0",x2:u,y2:c,stroke:s.borderSubtle,strokeDasharray:"2 3",strokeWidth:"1",vectorEffect:"non-scaling-stroke"},`grid-${h}`))})})]});const P=Array.isArray(i[0])?i:i.map((u,h)=>[h,u]),X=P.map(([,u])=>u),B=Math.min(...X),E=Math.max(...X),K=E===B?Math.max(Math.abs(E)*.1,1):(E-B)*.1,q=B-K,f=E+K,A=f-q||1,M=u=>(f-u)/A*c,z=P.map(([u,h])=>[u,M(h)]),Y=t&&t.length?t:Array.from({length:5},(u,h)=>{const W=f-h/4*(f-q),$=Math.abs(W),O=$>=100?0:$>=10?1:2;return W.toFixed(O)}),H=z[0][0],se=z[z.length-1][0]-H||1,ee=8,J=Math.max(1,k-ee*2),R=u=>ee+(u-H)/se*J,C=u=>{const h=Number(u);if(!Number.isFinite(h))return String(u??"");const W=Math.abs(h),$=W>=100?0:W>=10?1:2;return h.toFixed($)},Z=z.map(([u,h],W)=>`${W===0?"M":"L"}${R(u)},${h}`).join(" "),te=`${Z} L${R(z[z.length-1][0])},${c} L${R(z[0][0])},${c} Z`,ne=r??z.length-1;return e.jsxs("div",{style:{display:"flex",gap:8,height:a?151:133,width:"100%"},children:[o?e.jsx("div",{style:{display:"flex",alignItems:"center",flexShrink:0},children:e.jsx("span",{style:{writingMode:"vertical-rl",transform:"rotate(180deg)",fontFamily:T,fontSize:10,fontWeight:500,color:s.neutral800,whiteSpace:"nowrap"},children:o})}):null,e.jsx("div",{style:{display:"flex",flexDirection:"column",justifyContent:"space-between",padding:"14px 0",fontFamily:T,fontSize:10,color:s.neutral800,flexShrink:0},children:Y.map(u=>e.jsx("span",{children:u},u))}),e.jsxs("div",{style:{flex:1,position:"relative",minWidth:0},children:[d&&e.jsxs("div",{style:{position:"absolute",left:`${d.xPct}%`,top:`${d.yPct}%`,transform:"translate(-50%, calc(-100% - 10px))",pointerEvents:"none",zIndex:2,background:s.black,color:s.white,borderRadius:6,minWidth:60,padding:"8px 10px",boxShadow:"0 6px 16px rgba(0,0,0,0.18)",fontFamily:T,fontSize:11,lineHeight:1.25,whiteSpace:"nowrap",textAlign:"left"},children:[e.jsx("div",{children:d.label}),e.jsx("div",{style:{fontWeight:600},children:d.value}),e.jsx("div",{style:{position:"absolute",left:"50%",bottom:-5,width:10,height:10,background:s.black,transform:"translateX(-50%) rotate(45deg)",borderRadius:2}})]}),e.jsxs("svg",{width:"100%",height:c+14,viewBox:`0 0 ${k} ${c+14}`,preserveAspectRatio:"none",onMouseLeave:()=>p(null),children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:`area-${g}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",style:{stopColor:s.black,stopOpacity:.08}}),e.jsx("stop",{offset:"100%",style:{stopColor:s.black,stopOpacity:0}})]})}),N.map((u,h)=>e.jsx("line",{x1:u,y1:"0",x2:u,y2:c,stroke:s.borderSubtle,strokeDasharray:"2 3",strokeWidth:"1",vectorEffect:"non-scaling-stroke"},`grid-${h}`)),e.jsx("path",{d:te,fill:`url(#area-${g})`}),e.jsx("path",{d:Z,stroke:s.black,strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"}),z.map(([u,h],W)=>{const $=W===ne;return e.jsx("circle",{cx:R(u),cy:h,r:$?4:3,fill:$?s.black:s.white,stroke:s.black,strokeWidth:"1.5",vectorEffect:"non-scaling-stroke",onMouseEnter:()=>{var O;p({xPct:R(u)/k*100,yPct:h/(c+28)*100,label:j[W]||`Point ${W+1}`,value:C((O=P[W])==null?void 0:O[1])})}},W)})]}),e.jsx("div",{style:{display:"flex",justifyContent:"space-between",paddingRight:6,fontFamily:T,fontSize:10,color:s.neutral800,marginTop:8,marginBottom:4,overflow:"hidden"},children:I.map((u,h)=>e.jsx("span",{style:{whiteSpace:"nowrap"},children:u},h))}),a?e.jsx("div",{style:{textAlign:"center",fontFamily:T,fontSize:10,fontWeight:500,color:s.neutral800},children:a}):null]})]})}function de({title:t,value:n,delta:i,children:r}){const a=et(n),o=ke(i),d=o?we("up",i):"up";return e.jsxs("div",{style:{flex:1,background:s.white,border:`1px solid ${s.border}`,borderRadius:8,padding:24,display:"flex",flexDirection:"column",gap:24,minWidth:0,boxShadow:s.shadowCard},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-end"},children:[e.jsx("span",{style:{fontFamily:le,fontWeight:600,fontSize:15,color:s.ink,lineHeight:1.2},children:t}),e.jsxs("span",{style:{display:"inline-flex",alignItems:"flex-end",gap:4,fontFamily:le,fontWeight:600},children:[e.jsx("span",{style:{fontSize:20,color:s.black,lineHeight:1},children:a}),o?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3,fontSize:10,color:s.neutral300,lineHeight:1},children:[e.jsx(yt,{direction:d,color:s.neutral300}),i]}):null]})]}),e.jsx("div",{style:{flex:1},children:r})]})}function Fe({icon:t,title:n,trailing:i,iconColor:r=s.ink,bordered:a=!1}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,width:"100%",paddingBottom:a?12:0,borderBottom:a?`1px solid ${s.border}`:"none"},children:[e.jsx("div",{style:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(t,{size:22,strokeWidth:1.75,style:{color:r}})}),e.jsx("div",{style:{flex:1,fontFamily:le,fontWeight:600,fontSize:16,color:s.ink,lineHeight:1.2,textTransform:"uppercase",letterSpacing:"0.02em"},children:n}),i&&e.jsx("div",{style:{fontFamily:T,fontSize:14,color:s.ink},children:i})]})}function gt({text:t,bullet:n,citation:i,date:r,href:a}){const o=t??n??"";return e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",fontFamily:T,fontSize:14,color:s.ink,lineHeight:"24px",gap:16},children:[a?e.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",style:{color:s.ink,textDecoration:"underline",textUnderlineOffset:2,textDecorationColor:s.border,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o}):e.jsx("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o}),e.jsxs("span",{style:{display:"inline-flex",gap:4,whiteSpace:"nowrap"},children:[e.jsx("span",{style:{color:s.ink},children:i}),r?e.jsxs("span",{style:{color:s.muted},children:["(",r,")"]}):null]})]})}function Re({title:t,summary:n,calls:i,percent:r,delta:a,bullets:o,defaultExpanded:d=!1}){const[p,k]=D.useState(d),c=r??a,m=ke(c),g=m?String(c):We,j=(m?we("up",g):"up")==="down"?y.TrendingDown:y.TrendingUp,I=Array.isArray(o)?o:[];return e.jsxs("div",{style:{borderTop:`1px solid ${s.border}`},children:[e.jsxs("button",{type:"button",onClick:()=>k(w=>!w),"aria-expanded":p,style:{border:"none",background:"transparent",padding:16,display:"flex",gap:12,alignItems:"flex-start",cursor:"pointer",width:"100%",textAlign:"left",fontFamily:T},children:[e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:12,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[e.jsx("span",{style:{fontFamily:T,fontWeight:500,fontSize:14,color:s.black,lineHeight:"24px"},children:t}),e.jsx("span",{style:{fontFamily:T,fontSize:14,color:s.muted,lineHeight:"24px"},children:n})]}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx(y.Phone,{size:12,color:s.ink,strokeWidth:1.75}),e.jsxs("span",{style:{fontFamily:T,fontSize:12,color:s.ink},children:[i," Interactions"]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[m?e.jsx(j,{size:12,color:s.ink,strokeWidth:1.75}):null,e.jsx("span",{style:{fontFamily:T,fontSize:12,color:m?s.ink:s.muted},children:g})]})]})]}),e.jsx(y.ChevronDown,{size:20,color:s.ink,strokeWidth:2,style:{flexShrink:0,transform:p?"rotate(180deg)":"none",transition:"transform 150ms ease"}})]}),p&&I.length>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"0 16px 16px"},children:I.map((w,N)=>e.jsx(gt,{...w},N))})]})}function Oe({label:t,value:n}){return e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 8px 12px",borderBottom:`1px solid ${s.border}`,fontFamily:T,fontSize:13,lineHeight:"1.2"},children:[e.jsx("span",{style:{color:s.ink},children:t}),e.jsx("span",{style:{color:s.muted},children:n})]})}function bt({value:t=0,max:n=5}){const i=typeof t=="number"?t:parseFloat(t)||0,r=Math.floor(i),a=i%1>0&&r<n;return e.jsx("div",{style:{display:"flex",gap:4},children:Array.from({length:n}).map((o,d)=>d<r?e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",background:s.black,display:"inline-block"}},d):d===r&&a?e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:s.black,display:"inline-block"}})},d):e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",background:s.white,border:`1px solid ${s.border}`,display:"inline-block",boxSizing:"border-box"}},d))})}const jt=[{id:"title",label:"Title",width:220,sortable:!0,filterable:!0},{id:"date",label:"Date",width:170,sortable:!0},{id:"duration",label:"Duration",width:170,sortable:!0},{id:"lift",label:"Lift",width:120,sortable:!0},{id:"compass",label:"Compass Score",width:220,sortable:!0,render:t=>{const n=typeof t=="number"?t:parseFloat(t)||0;return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{minWidth:32},children:t}),e.jsx(bt,{value:n})]})}}];function _e({icon:t,title:n}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,width:"100%"},children:[e.jsx("div",{style:{width:34,height:34,borderRadius:9999,background:s.iconCircle,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(t,{size:20,color:s.ink,strokeWidth:1.75})}),e.jsx("span",{style:{fontFamily:le,fontWeight:600,fontSize:16,color:s.ink,lineHeight:1.2},children:n})]})}function nt({agentName:t="",startDate:n="",endDate:i="",totalCalls:r="",onBack:a,className:o="",kpiBaseline:d={value:"",label:"",sub:"",trend:"up"},kpiAgentLift:p={value:"",label:"",sub:"",trend:"down"},kpiScore:k={value:"",label:"",sub:"",trend:"up"},baselineChart:c={value:"",delta:""},agentLiftChart:m={value:"",delta:""},scoreChart:g={value:"",delta:""},csatChart:b={value:"",delta:""},volumeChart:j={value:"",delta:""},guidanceItems:I=[],strengthItems:w=[],callDrivers:N=[],callParadigms:P=[],strengthsTitle:X="",guidanceTitle:B="",callMixTitle:E="",driversTitle:K="",paradigmsTitle:q="",sessionsTitle:f="",baselineChartTitle:A="",agentLiftChartTitle:M="",scoreChartTitle:z="",csatChartTitle:Y="",volumeChartTitle:H="",sessions:fe=[],sessionColumns:se=[],initialPageSize:ee=10,selectedWindow:J="30d",onWindowChange:R,dateRange:C,onDateRangeChange:Z,sessionsTotal:te=null,sessionsPage:ne=null,sessionsPageSize:u=null,onSessionsPageChange:h,onSessionsPageSizeChange:W,onExport:$,onSessionClick:O,onSessionsVisibleColumnsChange:pe}){const G=!!(C!=null&&C.from&&(C!=null&&C.to)),U=(()=>{if(G||J!=="8h")return null;const S=ge("8h");return S?Je(S.from,S.to):null})(),V=(()=>{if(G||J==="8h")return null;const S=ge(J);return S?{from:Q(S.from),to:Q(S.to)}:null})(),Se=_(c)||_(m)||_(g),De=_(b)||_(j);return e.jsxs("div",{className:o,style:{background:s.white,fontFamily:T,color:s.ink,width:"100%",minWidth:1192,boxSizing:"border-box",display:"flex",flexDirection:"column"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"23px 32px",minHeight:78,boxSizing:"border-box"},children:[e.jsx("button",{type:"button","aria-label":"Back",onClick:a,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:24,height:24,background:"transparent",border:"none",cursor:"pointer",color:s.ink,padding:0,flexShrink:0},children:e.jsx(y.ArrowLeft,{size:20,strokeWidth:1.75})}),e.jsx("div",{style:{paddingLeft:16,borderLeft:`1px solid ${s.border}`,flex:1,minWidth:0,alignSelf:"stretch",display:"flex",alignItems:"center"},children:e.jsx("h1",{style:{fontFamily:le,fontSize:24,fontWeight:400,color:s.ink,margin:0,lineHeight:1,whiteSpace:"nowrap"},children:t})}),e.jsxs("button",{type:"button",onClick:()=>$==null?void 0:$(),disabled:!$,style:{display:"inline-flex",alignItems:"center",gap:8,height:32,padding:"0 16px",borderRadius:10,border:`1px solid ${s.neutralBorder}`,background:s.white,cursor:$?"pointer":"not-allowed",opacity:$?1:.5,fontFamily:T,fontSize:14,lineHeight:"24px",color:s.neutral800,flexShrink:0},children:[e.jsx(y.Download,{size:18,strokeWidth:1.75}),"Export CSV"]})]}),e.jsxs("div",{style:{padding:"0 32px 32px",display:"flex",flexDirection:"column",gap:16},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:16,paddingLeft:49},children:[e.jsxs("div",{style:{display:"flex",gap:16,alignItems:"center"},children:[e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(y.CalendarDays,{size:14,color:s.ink,strokeWidth:1.75,style:{flexShrink:0}}),e.jsx("span",{style:{fontFamily:T,fontSize:12,color:s.ink,lineHeight:1.5},children:(U==null?void 0:U.from)??(V==null?void 0:V.from)??Ee(n)}),e.jsx(y.ArrowRight,{size:12,color:s.ink,strokeWidth:1.75,style:{flexShrink:0}}),e.jsx("span",{style:{fontFamily:T,fontSize:12,color:s.ink,lineHeight:1.5},children:(U==null?void 0:U.to)??(V==null?void 0:V.to)??Ee(i)})]}),e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[e.jsx(y.Phone,{size:14,color:s.ink,strokeWidth:1.75,style:{flexShrink:0}}),e.jsx("span",{style:{fontFamily:T,fontSize:12,color:s.ink,lineHeight:1.5},children:r})]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[[{id:"8h",label:"8h"},{id:"1d",label:"1d"},{id:"7d",label:"7d"},{id:"30d",label:"30d"}].map(S=>e.jsx(mt,{label:S.label,active:!G&&S.id===J,onClick:()=>R==null?void 0:R(S.id)},S.id)),e.jsx($e,{value:C,onChange:Z})]})]}),Se&&e.jsxs("div",{style:{display:"flex",gap:24},children:[_(c)&&e.jsx(de,{title:A,value:c.value,delta:c.delta,children:e.jsx(ae,{yLabels:c.yLabels,xLabels:c.xLabels,points:c.points,xAxisLabel:c.xAxisLabel,yAxisLabel:c.yAxisLabel})}),_(m)&&e.jsx(de,{title:M,value:m.value,delta:m.delta,children:e.jsx(ae,{yLabels:m.yLabels,xLabels:m.xLabels,points:m.points,xAxisLabel:m.xAxisLabel,yAxisLabel:m.yAxisLabel})}),_(g)&&e.jsx(de,{title:z,value:g.value,delta:g.delta,children:e.jsx(ae,{yLabels:g.yLabels,xLabels:g.xLabels,points:g.points,xAxisLabel:g.xAxisLabel,yAxisLabel:g.yAxisLabel})})]}),De&&e.jsxs("div",{style:{display:"flex",gap:24},children:[_(b)&&e.jsx(de,{title:Y,value:b.value,delta:b.delta,children:e.jsx(ae,{yLabels:b.yLabels,xLabels:b.xLabels,points:b.points,xAxisLabel:b.xAxisLabel,yAxisLabel:b.yAxisLabel})}),_(j)&&e.jsx(de,{title:H,value:j.value,delta:j.delta,children:e.jsx(ae,{yLabels:j.yLabels,xLabels:j.xLabels,points:j.points,xAxisLabel:j.xAxisLabel,yAxisLabel:j.yAxisLabel})})]}),e.jsxs("div",{style:{display:"flex",gap:24,marginTop:8,alignItems:"flex-start"},children:[e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:16,minWidth:0},children:[e.jsx(Fe,{icon:y.ShieldCheck,title:X,iconColor:s.railCompliance}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:w.map((S,F)=>e.jsx(Re,{...S},F))})]}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:16,minWidth:0},children:[e.jsx(Fe,{icon:y.Lightbulb,title:B,iconColor:s.railCompliance}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:I.map((S,F)=>e.jsx(Re,{...S},F))})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,marginTop:8},children:[e.jsx(Fe,{icon:y.Phone,title:E,iconColor:s.railCompliance}),e.jsxs("div",{style:{display:"flex",gap:24,alignItems:"flex-start"},children:[e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:8,minWidth:0},children:[e.jsx(_e,{icon:y.FolderKanban,title:K}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:N.map((S,F)=>e.jsx(Oe,{...S},F))})]}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:8,minWidth:0},children:[e.jsx(_e,{icon:y.Layers,title:q}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:P.map((S,F)=>e.jsx(Oe,{...S},F))})]})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,marginTop:8},children:[f&&e.jsx("span",{style:{fontFamily:le,fontWeight:600,fontSize:16,color:s.ink,lineHeight:1.2},children:f}),e.jsx(Xe.DataTable2,{data:fe,columns:se,initialPageSize:ee,totalCount:te,page:ne,pageSize:u,onPageChange:h,onPageSizeChange:W,onRowClick:O,onVisibleColumnsChange:pe})]})]})]})}const ce={value:"",label:"",trend:"up"},l={ink:"var(--color-text)",muted:"var(--color-text-secondary)",border:"var(--grey-absent)",borderSubtle:"var(--neutral-100)",iconCircle:"var(--surface-hover)",black:"var(--neutral-900)",white:"var(--grey-white)",green:"var(--color-green)",red:"var(--color-red-strong)",neutralBorder:"var(--neutral-250)",neutralLight:"var(--neutral-100)",beige:"var(--surface-warm-40)",neutral800:"var(--neutral-800)",textInk:"var(--text-ink)",textFaintGrey:"var(--text-faint-grey)",hoverWarm40:"var(--hover-warm-40)",shadowPopover:"var(--shadow-popover)",shadowDropdown:"var(--shadow-dropdown)",railCompliance:"var(--rail-compliance)"},re="var(--font-sans, 'Averta', ui-sans-serif, system-ui, sans-serif)",L="var(--font-sans, 'Averta', ui-sans-serif, system-ui, sans-serif)";function it({trend:t="up",points:n,width:i=49.618,height:r=35}){const a=D.useId(),o=Qe(n),d=o?o.line:ft,p=o?o.area:pt,k=je(n)??t;return e.jsxs("svg",{width:i,height:r,viewBox:"0 0 52 36",fill:"none",style:{flexShrink:0,transform:!o&&k==="down"?"scaleX(-1)":void 0},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:`spark-${a}`,x1:"9.96776",y1:"16.2053",x2:"9.96776",y2:"36.0002",gradientUnits:"userSpaceOnUse",children:[e.jsx("stop",{stopColor:l.ink}),e.jsx("stop",{offset:"1",stopColor:l.white,stopOpacity:"0.01"})]})}),e.jsx("path",{d:p,fill:`url(#spark-${a})`,fillRule:"evenodd",clipRule:"evenodd",opacity:"0.1"}),e.jsx("path",{d,stroke:l.ink,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:!o&&k==="down"?"2 4":void 0})]})}function lt(t,n){return je(n)??(t==="down"?"down":"up")}function rt({direction:t="up",color:n=l.muted}){const i="M12.4167 0.75H17.4167M17.4167 0.75V5.75M17.4167 0.75L10.3333 7.83333L6.16667 3.66667L0.75 9.08333",r="M12.4167 9.25H17.4167M17.4167 9.25V4.25M17.4167 9.25L10.3333 2.16667L6.16667 6.33333L0.75 0.91667";return e.jsx("svg",{width:18,height:9.5,viewBox:"0 0 19 10",fill:"none",style:{flexShrink:0},children:e.jsx("path",{d:t==="up"?i:r,stroke:n,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Be({value:t,label:n,trend:i="up",points:r,muted:a=!1,beigeBg:o=!1,style:d={}}){const p=lt(i,r);return e.jsxs("div",{style:{background:o?l.beige:l.white,border:`1px solid ${l.border}`,borderRadius:8,padding:16,display:"flex",flexDirection:"column",gap:8,boxSizing:"border-box",...d},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[e.jsx(it,{trend:p,points:r}),e.jsx(rt,{direction:p})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,marginTop:8},children:[e.jsx("div",{style:{fontFamily:re,fontSize:28,fontWeight:500,lineHeight:"1.2",color:a?l.muted:l.ink,letterSpacing:"-0.01em"},children:t}),e.jsx("div",{style:{fontFamily:L,fontSize:13,color:l.ink,lineHeight:"1.2"},children:n})]})]})}function Ae({value:t,label:n,trend:i="up",points:r,withDivider:a=!1}){const o=lt(i,r);return e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:8,paddingLeft:a?24:0,borderLeft:a?`1px solid ${l.border}`:"none",minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[e.jsx(it,{trend:o,points:r}),e.jsx(rt,{direction:o})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,marginTop:8},children:[e.jsx("div",{style:{fontFamily:re,fontSize:28,fontWeight:500,lineHeight:"1.2",color:l.muted,letterSpacing:"-0.01em"},children:t}),e.jsx("div",{style:{fontFamily:L,fontSize:13,color:l.ink,lineHeight:"1.2"},children:n})]})]})}function vt({icon:t,children:n,trailing:i}){return e.jsxs("button",{type:"button",style:{display:"inline-flex",alignItems:"center",gap:8,height:32,padding:"0 16px",borderRadius:10,border:`1px solid ${l.neutralBorder}`,background:l.white,cursor:"pointer",fontFamily:L,fontSize:14,color:l.neutral800,whiteSpace:"nowrap"},children:[t&&e.jsx(t,{size:18,strokeWidth:1.75}),n,i&&e.jsx(i,{size:16,strokeWidth:2})]})}const kt=["January","February","March","April","May","June","July","August","September","October","November","December"],wt=["Su","Mo","Tu","We","Th","Fr","Sa"];function he(t){const n=new Date(t);return n.setHours(0,0,0,0),n}function St(t,n){const r=new Date(t,n,1).getDay(),a=new Date(t,n,1-r);return Array.from({length:42},(o,d)=>{const p=new Date(a);return p.setDate(a.getDate()+d),p})}function Dt({value:t,onApply:n,onClose:i,anchorRef:r}){const a=D.useRef(null),[o,d]=D.useState(t!=null&&t.from?he(t.from):null),[p,k]=D.useState(t!=null&&t.to?he(t.to):null),c=o||new Date,[m,g]=D.useState(c.getFullYear()),[b,j]=D.useState(c.getMonth()),[I,w]=D.useState({top:0,left:0});D.useLayoutEffect(()=>{const f=()=>{if(!(r!=null&&r.current))return;const A=r.current.getBoundingClientRect(),M=320;w({top:A.bottom+6,left:Math.max(8,A.right-M)})};return f(),window.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[r]),D.useEffect(()=>{const f=M=>{var z,Y;(z=a.current)!=null&&z.contains(M.target)||(Y=r==null?void 0:r.current)!=null&&Y.contains(M.target)||i()},A=M=>{M.key==="Escape"&&i()};return document.addEventListener("mousedown",f),document.addEventListener("keydown",A),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",A)}},[i,r]);const N=St(m,b),P=he(new Date),X=f=>{const A=he(f);A>P||(!o||o&&p?(d(A),k(null)):A<o?d(A):k(A))},B=()=>{b===0?(j(11),g(m-1)):j(b-1)},E=()=>{b===11?(j(0),g(m+1)):j(b+1)},K=f=>o&&p&&f>=o&&f<=p,q=f=>o&&f.getTime()===o.getTime()||p&&f.getTime()===p.getTime();return ct.createPortal(e.jsxs("div",{ref:a,style:{position:"fixed",top:I.top,left:I.left,width:320,background:l.white,border:`1px solid ${l.borderSubtle}`,borderRadius:12,boxShadow:l.shadowPopover,padding:16,zIndex:9999,fontFamily:L},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:12},children:[e.jsx("button",{type:"button",onClick:B,style:Ye,"aria-label":"Previous month",children:e.jsx(y.ChevronLeft,{size:18,strokeWidth:1.75})}),e.jsxs("div",{style:{fontSize:14,fontWeight:600,color:l.ink},children:[kt[b]," ",m]}),e.jsx("button",{type:"button",onClick:E,style:Ye,"aria-label":"Next month",children:e.jsx(y.ChevronRight,{size:18,strokeWidth:1.75})})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:2,marginBottom:4},children:wt.map(f=>e.jsx("div",{style:{textAlign:"center",fontSize:12,color:l.muted,padding:"4px 0"},children:f},f))}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:2},children:N.map(f=>{const A=f.getMonth()===b,M=K(f),z=q(f),Y=f.getTime()===P.getTime(),H=f>P;return e.jsx("button",{type:"button",onClick:()=>X(f),disabled:H,"aria-disabled":H,style:{height:36,border:"none",borderRadius:8,background:z?l.black:M?l.hoverWarm40:"transparent",color:z?l.white:H?l.textFaintGrey:A?l.ink:l.muted,fontFamily:L,fontSize:13,fontWeight:Y?500:400,cursor:H?"not-allowed":"pointer",opacity:H?.6:1},children:f.getDate()},f.toISOString())})}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginTop:12,paddingTop:12,borderTop:`1px solid ${l.borderSubtle}`},children:[e.jsx("button",{type:"button",onClick:()=>{d(null),k(null)},style:{background:"transparent",border:"none",padding:0,cursor:"pointer",fontSize:14,fontWeight:500,color:l.ink},children:"Clear"}),e.jsx("button",{type:"button",disabled:!o||!p,onClick:()=>{n({from:o,to:p}),i()},style:{background:!o||!p?l.neutralBorder:l.black,color:l.white,border:"none",borderRadius:10,height:30,padding:"0 16px",fontFamily:L,fontSize:14,fontWeight:600,cursor:!o||!p?"not-allowed":"pointer"},children:"Apply"})]})]}),document.body)}const Ye={display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,border:"none",background:"transparent",borderRadius:6,cursor:"pointer",color:l.ink};function $e({value:t,onChange:n}){const[i,r]=D.useState(!1),a=D.useRef(null),o=!!(t!=null&&t.from&&(t!=null&&t.to));return e.jsxs(e.Fragment,{children:[e.jsxs("button",{ref:a,type:"button",onClick:()=>r(d=>!d),style:{display:"inline-flex",alignItems:"center",gap:8,height:32,padding:"0 16px",borderRadius:10,border:o?"none":`1px solid ${l.neutralBorder}`,background:o?l.black:l.white,cursor:"pointer",fontFamily:L,fontSize:14,color:o?l.white:l.neutral800,fontWeight:o?600:400,whiteSpace:"nowrap"},children:[e.jsx(y.CalendarDays,{size:18,strokeWidth:1.75}),"Date Range"]}),i&&e.jsx(Dt,{value:t,anchorRef:a,onClose:()=>r(!1),onApply:d=>n==null?void 0:n(d)})]})}function Lt({label:t,active:n=!1,onClick:i}){return e.jsx("button",{type:"button",onClick:i,style:{height:32,minWidth:31,padding:"0 12px",borderRadius:10,border:n?"none":`1px solid ${l.borderSubtle}`,background:n?l.black:l.white,color:n?l.white:l.black,fontFamily:L,fontSize:14,cursor:"pointer"},children:t})}const Ft=[{id:"8h",label:"8h"},{id:"1d",label:"1d"},{id:"7d",label:"7d"},{id:"30d",label:"30d"}];function At({value:t=0,max:n=5}){const i=typeof t=="number"?t:parseFloat(t)||0,r=Math.floor(i),a=i%1>0&&r<n;return e.jsx("div",{style:{display:"flex",gap:4},children:Array.from({length:n}).map((o,d)=>d<r?e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",background:l.black,display:"inline-block"}},d):d===r&&a?e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",display:"inline-flex",alignItems:"center",justifyContent:"center"},children:e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:l.black,display:"inline-block"}})},d):e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",background:l.white,border:`1px solid ${l.border}`,display:"inline-block",boxSizing:"border-box"}},d))})}const zt=[{id:"agent",label:"Agent",width:180,sortable:!0,filterable:!0},{id:"supervisor",label:"Supervisor",width:170,sortable:!0,filterable:!0},{id:"calls",label:"Calls",width:100,sortable:!0},{id:"baseline",label:"Baseline",width:110,sortable:!0},{id:"lift",label:"Lift",width:100,sortable:!0},{id:"score",label:"Score",width:100,sortable:!0,filterable:!0,filterType:"number"},{id:"compass",label:"Compass Score",width:200,sortable:!0,filterable:!0,filterType:"number",render:t=>e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:12},children:[e.jsx("span",{style:{minWidth:32},children:t}),e.jsx(At,{value:typeof t=="number"?t:0})]})},{id:"totalDuration",label:"Total Duration",width:150,sortable:!0,filterable:!0,filterType:"duration",filterShowPresets:!1},{id:"avgDuration",label:"Average Duration",width:170,sortable:!0,filterable:!0,filterType:"duration",filterShowPresets:!1}];function ye({icon:t,title:n,trailing:i,iconColor:r=l.ink,bordered:a=!1}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,width:"100%",paddingBottom:a?12:0,borderBottom:a?`1px solid ${l.border}`:"none"},children:[e.jsx("div",{style:{width:24,height:24,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(t,{size:22,strokeWidth:1.75,style:{color:r}})}),e.jsx("div",{style:{flex:1,fontFamily:re,fontWeight:600,fontSize:16,color:l.ink,lineHeight:"1.2",textTransform:"uppercase",letterSpacing:"0.02em"},children:n}),i&&e.jsx("div",{style:{fontFamily:L,fontSize:14,color:l.ink},children:i})]})}function Ue({icon:t,title:n}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16,width:"100%"},children:[e.jsx("div",{style:{width:34,height:34,borderRadius:9999,background:l.iconCircle,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(t,{size:20,color:l.ink,strokeWidth:1.75})}),e.jsx("span",{style:{fontFamily:re,fontWeight:600,fontSize:16,color:l.ink,lineHeight:"24px"},children:n})]})}function Ve({title:t,summary:n,calls:i,percent:r,bullets:a,defaultExpanded:o=!1}){const[d,p]=D.useState(o),k=Array.isArray(a)?a:[];return e.jsxs("div",{style:{borderTop:`1px solid ${l.border}`},children:[e.jsxs("button",{type:"button",onClick:()=>p(c=>!c),"aria-expanded":d,style:{border:"none",background:"transparent",padding:16,display:"flex",gap:12,alignItems:"flex-start",cursor:"pointer",width:"100%",textAlign:"left",fontFamily:L},children:[e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:12,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[e.jsx("div",{style:{fontFamily:re,fontWeight:600,fontSize:14,color:l.black,lineHeight:"24px"},children:t}),e.jsx("div",{style:{fontFamily:L,fontSize:14,color:l.muted,lineHeight:"24px"},children:n})]}),e.jsxs("div",{style:{display:"flex",gap:16},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx(y.Phone,{size:14,color:l.ink,strokeWidth:1.75}),e.jsx("span",{style:{fontFamily:L,fontSize:12,color:l.ink,lineHeight:1.5},children:i})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx(y.TrendingUp,{size:14,color:l.ink,strokeWidth:1.75}),e.jsx("span",{style:{fontFamily:L,fontSize:12,color:l.ink,lineHeight:1.5},children:r})]})]})]}),e.jsx(y.ChevronDown,{size:20,color:l.ink,strokeWidth:2,style:{flexShrink:0,transform:d?"rotate(180deg)":"none",transition:"transform 150ms ease"}})]}),d&&k.length>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"0 16px 16px"},children:k.map((c,m)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",fontFamily:L,fontSize:14,color:l.ink,lineHeight:"24px",gap:16},children:[c.href?e.jsx("a",{href:c.href,target:"_blank",rel:"noopener noreferrer",style:{color:l.ink,textDecoration:"underline",textUnderlineOffset:2,textDecorationColor:l.border,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c.text}):e.jsx("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c.text}),e.jsxs("span",{style:{display:"inline-flex",gap:4,whiteSpace:"nowrap"},children:[e.jsx("span",{style:{color:l.ink},children:c.citation}),e.jsxs("span",{style:{color:l.muted},children:["(",c.date,")"]})]})]},m))})]})}function me({label:t,value:n}){return e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"12px 0",borderBottom:`1px solid ${l.border}`,fontFamily:L,fontSize:13,lineHeight:"24px"},children:[e.jsx("span",{style:{color:l.ink},children:t}),e.jsx("span",{style:{color:l.muted},children:n})]})}function xe({message:t=""}){return t?e.jsx("div",{style:{padding:"16px 0",fontFamily:L,fontSize:13,color:l.muted,lineHeight:1.5},children:t}):null}function Tt({className:t="",onAgentClick:n,dateRangeLabel:i="",viewByOptions:r=[],initialViewBy:a="",onViewByChange:o,aggregatedByLabel:d="",volumeStat:p=ce,compassStat:k=ce,baselineSubStat:c=ce,agentLiftSubStat:m=ce,scoreSubStat:g=ce,agentRows:b=[],agentColumns:j=[],initialPageSize:I=10,guidanceItems:w=[],strengthItems:N=[],callDrivers:P=[],callParadigms:X=[],topSignalsLeft:B=[],topSignalsRight:E=[],topSignalsTrailing:K="",strengthsTitle:q="",guidanceTitle:f="",callMixTitle:A="",driversTitle:M="",paradigmsTitle:z="",topSignalsTitle:Y="",emptyStrengthsMessage:H="",emptyGuidanceMessage:fe="",emptyDriversMessage:se="",emptyParadigmsMessage:ee="",emptyTopSignalsMessage:J="",rangeOptions:R=Ft,selectedWindow:C="30d",onWindowChange:Z,dateRangePicker:te,dateRange:ne,onDateRangeChange:u,onExport:h,hideExport:W=!1,onVisibleColumnsChange:$}){var Ce,Pe;const[O,pe]=D.useState(null),[G,U]=D.useState(!1),[V,Se]=D.useState(a),[De,S]=D.useState(null),F=ne!==void 0?ne:De,Le=!!(F!=null&&F.from&&(F!=null&&F.to)),st=x=>{S(x),u==null||u(x)},ot=x=>{S(null),u==null||u(null),Z==null||Z(x)},Ie=D.useRef(null),Me=D.useRef(null);D.useEffect(()=>{if(!G)return;const x=v=>{var oe,He;(oe=Me.current)!=null&&oe.contains(v.target)||(He=Ie.current)!=null&&He.contains(v.target)||U(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[G]);const at=((Ce=r.find(x=>x.id===V))==null?void 0:Ce.label)||(((Pe=r[0])==null?void 0:Pe.label)??""),dt=x=>{if(n){n(x);return}pe(x)};return e.jsxs(e.Fragment,{children:[O&&(()=>{let x=null,v=null;if(Le)x=F.from,v=F.to;else{const oe=be[C];oe&&(v=new Date,x=new Date(v.getTime()-oe))}return e.jsx(nt,{className:t,agentName:O.agent,startDate:x||"",endDate:v||"",totalCalls:`${O.calls} Calls`,onBack:()=>pe(null),selectedWindow:C,dateRange:F})})(),e.jsxs("div",{className:t,style:{background:l.white,fontFamily:L,color:l.ink,width:"100%",minWidth:1192,boxSizing:"border-box",padding:"12px 32px 32px",flexDirection:"column",gap:24,display:O?"none":"flex"},children:[!W&&e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8,paddingTop:12},children:[e.jsx("div",{style:{flex:1,minWidth:0}}),e.jsxs("button",{type:"button",onClick:()=>h==null?void 0:h(),disabled:!h,style:{display:"inline-flex",alignItems:"center",gap:8,height:32,padding:"0 16px",borderRadius:10,border:`1px solid ${l.neutralBorder}`,background:l.white,cursor:h?"pointer":"not-allowed",opacity:h?1:.5,fontFamily:L,fontSize:14,color:l.neutral800},children:[e.jsx(y.Download,{size:18,strokeWidth:1.75}),"Export CSV"]})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsxs("div",{style:{position:"relative"},children:[e.jsxs("button",{type:"button",ref:Ie,onClick:()=>U(x=>!x),"aria-haspopup":"listbox","aria-expanded":G,style:{display:"inline-flex",alignItems:"center",gap:8,height:32,padding:"0 16px",borderRadius:10,border:`1px solid ${l.neutralBorder}`,background:l.white,cursor:"pointer",fontFamily:L,fontSize:14,lineHeight:"24px",color:l.neutral800,whiteSpace:"nowrap"},children:[at,e.jsx(y.ChevronDown,{size:20,strokeWidth:1.75,style:{transform:G?"rotate(180deg)":"none",transition:"transform 120ms ease"}})]}),G&&e.jsxs("div",{ref:Me,role:"listbox",style:{position:"absolute",top:36,left:0,zIndex:20,background:l.white,border:`1px solid ${l.border}`,borderRadius:4,boxShadow:l.shadowDropdown,display:"flex",flexDirection:"column",minWidth:144,fontFamily:L},children:[d&&e.jsx("div",{style:{padding:12,fontFamily:re,fontWeight:600,fontSize:13,color:l.ink,lineHeight:1.2},children:d}),r.map(x=>{const v=V===x.id;return e.jsxs("button",{type:"button",role:"option","aria-selected":v,onClick:()=>{x.id!==V&&(Se(x.id),o==null||o(x.id)),U(!1)},style:{display:"flex",alignItems:"center",gap:8,padding:v?12:"12px 12px 12px 40px",borderTop:`1px solid ${l.border}`,borderLeft:"none",borderRight:"none",borderBottom:"none",background:"transparent",cursor:"pointer",textAlign:"left",fontFamily:L,fontSize:13,lineHeight:1.2,color:l.ink,width:"100%"},children:[v&&e.jsx(y.Check,{size:20,color:l.ink,strokeWidth:1.75,style:{flexShrink:0}}),e.jsx("span",{children:x.label})]},x.id)})]})]}),e.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[(()=>{const v=(Le?`${Q(F.from)} – ${Q(F.to)}`:"")||Ze(C)||i;return v?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontFamily:L,fontSize:13,color:l.ink},children:[e.jsx(y.CalendarDays,{size:16,strokeWidth:1.75,color:l.muted}),v]}):null})(),R.map(x=>e.jsx(Lt,{label:x.label,active:!Le&&x.id===C,onClick:()=>ot(x.id)},x.id)),te?e.jsx(D.Suspense,{fallback:e.jsx(vt,{icon:y.CalendarDays,children:"Date Range"}),children:te}):e.jsx($e,{value:F,onChange:st})]})]}),e.jsxs("div",{style:{display:"flex",gap:24},children:[e.jsx(Be,{value:p.value,label:p.label,trend:p.trend,points:p.points,style:{width:264,flexShrink:0}}),e.jsx(Be,{value:k.value,label:k.label,trend:k.trend,points:k.points,style:{width:264,flexShrink:0}}),e.jsxs("div",{style:{flex:1,background:l.beige,border:`1px solid ${l.border}`,borderRadius:8,padding:16,display:"flex",gap:24,alignItems:"stretch",boxSizing:"border-box"},children:[e.jsx(Ae,{value:c.value,label:c.label,trend:c.trend,points:c.points}),e.jsx(Ae,{value:m.value,label:m.label,trend:m.trend,points:m.points,withDivider:!0}),e.jsx(Ae,{value:g.value,label:g.label,trend:g.trend,points:g.points,withDivider:!0})]})]}),e.jsx(Xe.DataTable2,{data:b,columns:j,initialPageSize:I,onRowClick:dt,onVisibleColumnsChange:$}),e.jsxs("div",{style:{display:"flex",gap:24,alignItems:"flex-start"},children:[e.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:16},children:[e.jsx(ye,{icon:y.ShieldCheck,title:q,iconColor:"var(--rail-compliance)"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",borderBottom:`1px solid ${l.border}`,maxHeight:480,overflowY:"auto"},children:N.length===0?e.jsx(xe,{message:H}):N.map((x,v)=>e.jsx(Ve,{...x},v))})]}),e.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:16},children:[e.jsx(ye,{icon:y.Lightbulb,title:f,iconColor:"var(--rail-compliance)"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",borderBottom:`1px solid ${l.border}`,maxHeight:480,overflowY:"auto"},children:w.length===0?e.jsx(xe,{message:fe}):w.map((x,v)=>e.jsx(Ve,{...x},v))})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsx(ye,{icon:y.Phone,title:A,iconColor:"var(--rail-compliance)"}),e.jsxs("div",{style:{display:"flex",gap:24,alignItems:"flex-start"},children:[e.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:8},children:[e.jsx(Ue,{icon:y.FolderKanban,title:M}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:P.length===0?e.jsx(xe,{message:se}):P.map((x,v)=>e.jsx(me,{...x},v))})]}),e.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:8},children:[e.jsx(Ue,{icon:y.Layers,title:z}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:X.length===0?e.jsx(xe,{message:ee}):X.map((x,v)=>e.jsx(me,{...x},v))})]})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsx(ye,{icon:y.Signal,title:Y,iconColor:"var(--rail-compliance)",trailing:K,bordered:!0}),B.length===0&&E.length===0?e.jsx(xe,{message:J}):e.jsxs("div",{style:{display:"flex",gap:24},children:[e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:B.map((x,v)=>e.jsx(me,{...x},v))}),e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:E.map((x,v)=>e.jsx(me,{...x},v))})]})]})]})]})}exports.DEFAULT_AGENT_COLUMNS=zt;exports.DEFAULT_SESSION_COLUMNS=jt;exports.DateRangeButton=$e;exports.METRIC_PLACEHOLDER=We;exports.PerformanceDetailsPage=nt;exports.PerformancePanel=Tt;exports.RANGE_TO_MS=be;exports.buildSparkPaths=Qe;exports.computeWindowLabel=Ze;exports.formatEightHourRangeEndpoints=Je;exports.formatEightHourWindowLabel=qe;exports.formatLocalDate=Q;exports.formatMetricDisplay=et;exports.getPresetWindowDates=ge;exports.hasChartData=_;exports.hasMeaningfulMetric=ke;exports.isNullishMetric=ve;exports.normalizeSparkPoints=Te;exports.resolveKpiTrend=ht;exports.resolveTrend=we;exports.trendFromPoints=je;exports.trendFromSignedValue=tt;
2
2
  //# sourceMappingURL=PerformancePanel.cjs.js.map