chordia-ui 3.9.2 → 3.9.3

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"),ht=require("react-dom"),h=require("lucide-react"),qe=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},Je="en-US",yt={month:"2-digit",day:"2-digit",year:"numeric"},mt={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 o=new Date(Number(i[1]),Number(i[2])-1,Number(i[3]));return Number.isNaN(o.getTime())?null:o}const r=new Date(n);return Number.isNaN(r.getTime())?null:r}function Ze(t,n){return t.getFullYear()===n.getFullYear()&&t.getMonth()===n.getMonth()&&t.getDate()===n.getDate()}function ee(t){const n=t instanceof Date?t:he(t);return n?n.toLocaleDateString(Je,yt):""}function Ce(t){return t.toLocaleTimeString(Je,mt)}function se(t){return`${ee(t)} ${Ce(t)}`}function Qe(t,n){const i=he(t),r=he(n);return!i||!r?"":Ze(i,r)?`${se(i)} – ${Ce(r)}`:`${se(i)} – ${se(r)}`}function et(t,n){const i=he(t),r=he(n);return!i||!r?null:Ze(i,r)?{from:se(i),to:Ce(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 tt(t){if(!ve[t])return"";const i=je(t);return i?t==="8h"?Qe(i.from,i.to):`${ee(i.from)} – ${ee(i.to)}`:""}const nt="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",it="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 ke(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 $e(t,n=52,i=36){const r=ke(t);if(!r)return null;const o=Math.min(...r),a=Math.max(...r),d=4,c=a-o||1,F=i-d*2-4,p=D=>(r.length===1?0:D/(r.length-1)*(n-2))+1,y=D=>d+(1-(D-o)/c)*F;let b="";for(let D=0;D<r.length;D++)b+=`${D===0?"M":"L"}${p(D).toFixed(2)},${y(r[D]).toFixed(2)}`;const v=p(r.length-1),S=p(0),W=`${b} L${v.toFixed(2)},${i} L${S.toFixed(2)},${i} Z`;return{line:b,area:W}}function we(t){const n=ke(t);if(!n)return null;const i=n[0],r=n[n.length-1];return r>i?"up":r<i?"down":"up"}const Ae="—";function Se(t){if(t==null)return!0;const n=String(t).trim();return!!(!n||/^[-−–—]$/.test(n)||/^(n\/a|null|undefined)$/i.test(n))}function ye(t){return!Se(t)}function Ie(t,n=Ae){return Se(t)?n:String(t)}function Oe(t){return t!=null&&String(t).trim()!==""}function U(t){return t?Oe(t.value)||Oe(t.delta)?!0:Array.isArray(t.points)&&t.points.length>0:!1}function lt(t){if(Se(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 lt(n)??(t==="down"?"down":"up")}function rt(t,n,i){return we(i)??(ye(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)"},te="var(--font-sans, 'Averta', ui-sans-serif, system-ui, sans-serif)",z="var(--font-sans, 'Averta', ui-sans-serif, system-ui, sans-serif)";function st({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 _e(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("en-US",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("en-US",n);const o=new Date(i);return Number.isNaN(o.getTime())?i:o.toLocaleDateString("en-US",n)}function gt({trend:t="up",points:n,empty:i=!1,width:r=49.618,height:o=35}){const a=w.useId();if(i)return e.jsx("svg",{width:r,height:o,viewBox:"0 0 52 36",fill:"none",style:{flexShrink:0},children:e.jsx("path",{d:"M2,18 L50,18",stroke:s.ink,strokeWidth:"2",strokeLinecap:"round"})});const d=$e(n),c=d?d.line:nt,F=d?d.area:it;return e.jsxs("svg",{width:r,height:o,viewBox:"0 0 52 36",fill:"none",style:{flexShrink:0,transform:!d&&t==="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:s.ink}),e.jsx("stop",{offset:"1",stopColor:s.white,stopOpacity:"0.01"})]})}),e.jsx("path",{d:F,fill:`url(#spark-${a})`,fillRule:"evenodd",clipRule:"evenodd",opacity:"0.1"}),e.jsx("path",{d:c,stroke:s.ink,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:!d&&t==="down"?"2 4":void 0})]})}function bt({value:t,label:n,sub:i,trend:r="up",points:o}){const a=Ie(t),d=ye(t)||ke(o)!=null,c=rt(r,t,o);return e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:16,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4,flexShrink:0,alignItems:"flex-end"},children:[e.jsx(gt,{trend:c,points:o,empty:!d}),d?e.jsx(st,{direction:c}):null]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,minWidth:0},children:[e.jsx("div",{style:{fontFamily:te,fontSize:28,fontWeight:400,lineHeight:"1.2",color:s.muted,letterSpacing:"-0.01em",whiteSpace:"nowrap"},children:a}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx("span",{style:{fontFamily:z,fontSize:13,color:s.ink,lineHeight:"1.2"},children:n}),e.jsx("span",{style:{fontFamily:z,fontSize:13,color:s.neutral600,lineHeight:"1.2"},children:i})]})]})]})}function jt({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:z,fontSize:14,cursor:"pointer"},children:t})}function ue({yLabels:t,xLabels:n=[],points:i,highlightIndex:r}){const[o,a]=w.useState(null),d=460,c=110,F=Array.isArray(i)&&i.length>0,p=w.useId(),y=6,b=Array.isArray(n)?n:[],v=b.length<=y?b:Array.from({length:y},(x,m)=>b[Math.round(m*(b.length-1)/(y-1))]),S=Math.max(2,v.length||y),W=Array.from({length:S},(x,m)=>m/(S-1)*d);if(!F)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 ${d} ${c+14}`,preserveAspectRatio:"none",children:W.map((x,m)=>e.jsx("line",{x1:x,y1:"0",x2:x,y2:c,stroke:s.borderSubtle,strokeDasharray:"2 3",strokeWidth:"1",vectorEffect:"non-scaling-stroke"},`grid-${m}`))})})]});const D=Array.isArray(i[0])?i:i.map((x,m)=>[m,x]),Y=D.map(([,x])=>x),I=Math.min(...Y),E=Math.max(...Y),X=E===I?Math.max(Math.abs(E)*.1,1):(E-I)*.1,G=I-X,O=E+X,J=O-G||1,f=x=>(O-x)/J*c,j=D.map(([x,m])=>[x,f(m)]),C=t&&t.length?t:Array.from({length:5},(x,m)=>{const T=O-m/4*(O-G),P=Math.abs(T),$=P>=100?0:P>=10?1:2;return T.toFixed($)}),M=j[0][0],_=j[j.length-1][0]-M||1,ie=8,oe=Math.max(1,d-ie*2),q=x=>ie+(x-M)/_*oe,Z=x=>{const m=Number(x);if(!Number.isFinite(m))return String(x??"");const T=Math.abs(m),P=T>=100?0:T>=10?1:2;return m.toFixed(P)},Q=j.map(([x,m],T)=>`${T===0?"M":"L"}${q(x)},${m}`).join(" "),B=`${Q} L${q(j[j.length-1][0])},${c} L${q(j[0][0])},${c} Z`,ae=r??j.length-1;return e.jsxs("div",{style:{display:"flex",gap:8,height:133,width:"100%"},children:[e.jsx("div",{style:{display:"flex",flexDirection:"column",justifyContent:"space-between",padding:"14px 0",fontFamily:z,fontSize:10,color:s.neutral800,flexShrink:0},children:C.map(x=>e.jsx("span",{children:x},x))}),e.jsxs("div",{style:{flex:1,position:"relative",minWidth:0},children:[o&&e.jsxs("div",{style:{position:"absolute",left:`${o.xPct}%`,top:`${o.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:z,fontSize:11,lineHeight:1.25,whiteSpace:"nowrap",textAlign:"left"},children:[e.jsx("div",{children:o.label}),e.jsx("div",{style:{fontWeight:600},children:o.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 ${d} ${c+14}`,preserveAspectRatio:"none",onMouseLeave:()=>a(null),children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:`area-${p}`,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}})]})}),W.map((x,m)=>e.jsx("line",{x1:x,y1:"0",x2:x,y2:c,stroke:s.borderSubtle,strokeDasharray:"2 3",strokeWidth:"1",vectorEffect:"non-scaling-stroke"},`grid-${m}`)),e.jsx("path",{d:B,fill:`url(#area-${p})`}),e.jsx("path",{d:Q,stroke:s.black,strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"}),j.map(([x,m],T)=>{const P=T===ae;return e.jsx("circle",{cx:q(x),cy:m,r:P?4:3,fill:P?s.black:s.white,stroke:s.black,strokeWidth:"1.5",vectorEffect:"non-scaling-stroke",onMouseEnter:()=>{var $;a({xPct:q(x)/d*100,yPct:m/(c+28)*100,label:b[T]||`Point ${T+1}`,value:Z(($=D[T])==null?void 0:$[1])})}},T)})]}),e.jsx("div",{style:{display:"flex",justifyContent:"space-between",paddingRight:6,fontFamily:z,fontSize:10,color:s.neutral800,marginTop:8,marginBottom:4,overflow:"hidden"},children:v.map((x,m)=>e.jsx("span",{style:{whiteSpace:"nowrap"},children:x},m))})]})]})}function xe({title:t,value:n,delta:i,children:r}){const o=Ie(n),a=ye(i),d=a?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:te,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:te,fontWeight:600},children:[e.jsx("span",{style:{fontSize:20,color:s.black,lineHeight:1},children:o}),a?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3,fontSize:10,color:s.neutral300,lineHeight:1},children:[e.jsx(st,{direction:d,color:s.neutral300}),i]}):null]})]}),e.jsx("div",{style:{flex:1},children:r})]})}function Te({icon:t,title:n,trailing:i,iconColor:r=s.ink,bordered:o=!1}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,width:"100%",paddingBottom:o?12:0,borderBottom:o?`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:te,fontWeight:600,fontSize:16,color:s.ink,lineHeight:1.2,textTransform:"uppercase",letterSpacing:"0.02em"},children:n}),i&&e.jsx("div",{style:{fontFamily:z,fontSize:14,color:s.ink},children:i})]})}function vt({text:t,bullet:n,citation:i,date:r,href:o}){const a=t??n??"";return e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",fontFamily:z,fontSize:14,color:s.ink,lineHeight:"24px",gap:16},children:[o?e.jsx("a",{href:o,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:a}):e.jsx("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a}),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 Be({title:t,summary:n,calls:i,percent:r,delta:o,bullets:a,defaultExpanded:d=!1}){const[c,F]=w.useState(d),p=r??o,y=ye(p),b=y?String(p):Ae,S=(y?De("up",b):"up")==="down"?h.TrendingDown:h.TrendingUp,W=Array.isArray(a)?a:[];return e.jsxs("div",{style:{borderTop:`1px solid ${s.border}`},children:[e.jsxs("button",{type:"button",onClick:()=>F(D=>!D),"aria-expanded":c,style:{border:"none",background:"transparent",padding:16,display:"flex",gap:12,alignItems:"flex-start",cursor:"pointer",width:"100%",textAlign:"left",fontFamily:z},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:z,fontWeight:500,fontSize:14,color:s.black,lineHeight:"24px"},children:t}),e.jsx("span",{style:{fontFamily:z,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:z,fontSize:12,color:s.ink},children:[i," calls"]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[y?e.jsx(S,{size:12,color:s.ink,strokeWidth:1.75}):null,e.jsx("span",{style:{fontFamily:z,fontSize:12,color:y?s.ink:s.muted},children:b})]})]})]}),e.jsx(h.ChevronDown,{size:20,color:s.ink,strokeWidth:2,style:{flexShrink:0,transform:c?"rotate(180deg)":"none",transition:"transform 150ms ease"}})]}),c&&W.length>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"0 16px 16px"},children:W.map((D,Y)=>e.jsx(vt,{...D},Y))})]})}function Ue({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:z,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 kt({value:t=0,max:n=5}){const i=typeof t=="number"?t:parseFloat(t)||0,r=Math.floor(i),o=i%1>0&&r<n;return e.jsx("div",{style:{display:"flex",gap:4},children:Array.from({length:n}).map((a,d)=>d<r?e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",background:s.black,display:"inline-block"}},d):d===r&&o?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 wt=[{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(kt,{value:n})]})}}];function Ye({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:te,fontWeight:600,fontSize:16,color:s.ink,lineHeight:1.2},children:n})]})}function ot({agentName:t="",startDate:n="",endDate:i="",totalCalls:r="",onBack:o,className:a="",kpiBaseline:d={value:"",label:"",sub:"",trend:"up"},kpiAgentLift:c={value:"",label:"",sub:"",trend:"down"},kpiScore:F={value:"",label:"",sub:"",trend:"up"},baselineChart:p={value:"",delta:""},agentLiftChart:y={value:"",delta:""},scoreChart:b={value:"",delta:""},csatChart:v={value:"",delta:""},volumeChart:S={value:"",delta:""},guidanceItems:W=[],strengthItems:D=[],callDrivers:Y=[],callParadigms:I=[],strengthsTitle:E="",guidanceTitle:X="",callMixTitle:G="",driversTitle:O="",paradigmsTitle:J="",sessionsTitle:f="",baselineChartTitle:j="",agentLiftChartTitle:C="",scoreChartTitle:M="",csatChartTitle:K="",volumeChartTitle:_="",sessions:ie=[],sessionColumns:oe=[],initialPageSize:q=10,selectedWindow:Z="30d",onWindowChange:Q,dateRange:B,onDateRangeChange:ae,sessionsTotal:x=null,sessionsPage:m=null,sessionsPageSize:T=null,onSessionsPageChange:P,onSessionsPageSizeChange:$,onExport:A,onSessionClick:Le,onSessionsVisibleColumnsChange:le}){const re=!!(B!=null&&B.from&&(B!=null&&B.to)),H=(()=>{if(re||Z!=="8h")return null;const g=je("8h");return g?et(g.from,g.to):null})(),V=(()=>{if(re||Z==="8h")return null;const g=je(Z);return g?{from:ee(g.from),to:ee(g.to)}:null})(),de=U(p)||U(y)||U(b),Fe=U(v)||U(S);return e.jsxs("div",{className:a,style:{background:s.white,fontFamily:z,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:o,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:te,fontSize:24,fontWeight:400,color:s.ink,margin:0,lineHeight:1,whiteSpace:"nowrap"},children:t})}),e.jsxs("button",{type:"button",onClick:()=>A==null?void 0:A(),disabled:!A,style:{display:"inline-flex",alignItems:"center",gap:8,height:32,padding:"0 16px",borderRadius:10,border:`1px solid ${s.neutralBorder}`,background:s.white,cursor:A?"pointer":"not-allowed",opacity:A?1:.5,fontFamily:z,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:z,fontSize:12,color:s.ink,lineHeight:1.5},children:(H==null?void 0:H.from)??(V==null?void 0:V.from)??_e(n)}),e.jsx(h.ArrowRight,{size:12,color:s.ink,strokeWidth:1.75,style:{flexShrink:0}}),e.jsx("span",{style:{fontFamily:z,fontSize:12,color:s.ink,lineHeight:1.5},children:(H==null?void 0:H.to)??(V==null?void 0:V.to)??_e(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:z,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(g=>e.jsx(jt,{label:g.label,active:!re&&g.id===Z,onClick:()=>Q==null?void 0:Q(g.id)},g.id)),e.jsx(Me,{value:B,onChange:ae})]})]}),e.jsx("div",{style:{background:s.beige,border:`1px solid ${s.border}`,borderRadius:8,padding:16,display:"flex",alignItems:"center"},children:[{key:"baseline",kpi:d},{key:"agent-lift",kpi:c},{key:"score",kpi:F}].map((g,N)=>e.jsxs(w.Fragment,{children:[N>0?e.jsx(h.ArrowRight,{size:20,color:s.ink,strokeWidth:1.75,style:{flexShrink:0,margin:"0 24px"}}):null,e.jsx("div",{style:{flex:1,display:"flex",justifyContent:"center",alignItems:"center",minWidth:0},children:e.jsx(bt,{value:g.kpi.value,label:g.kpi.label,sub:g.kpi.sub,trend:g.kpi.trend,points:g.kpi.points})})]},g.key))}),de&&e.jsxs("div",{style:{display:"flex",gap:24},children:[U(p)&&e.jsx(xe,{title:j,value:p.value,delta:p.delta,children:e.jsx(ue,{yLabels:p.yLabels,xLabels:p.xLabels,points:p.points})}),U(y)&&e.jsx(xe,{title:C,value:y.value,delta:y.delta,children:e.jsx(ue,{yLabels:y.yLabels,xLabels:y.xLabels,points:y.points})}),U(b)&&e.jsx(xe,{title:M,value:b.value,delta:b.delta,children:e.jsx(ue,{yLabels:b.yLabels,xLabels:b.xLabels,points:b.points})})]}),Fe&&e.jsxs("div",{style:{display:"flex",gap:24},children:[U(v)&&e.jsx(xe,{title:K,value:v.value,delta:v.delta,children:e.jsx(ue,{yLabels:v.yLabels,xLabels:v.xLabels,points:v.points})}),U(S)&&e.jsx(xe,{title:_,value:S.value,delta:S.delta,children:e.jsx(ue,{yLabels:S.yLabels,xLabels:S.xLabels,points:S.points})})]}),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(Te,{icon:h.ShieldCheck,title:E,iconColor:s.railCompliance}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:D.map((g,N)=>e.jsx(Be,{...g},N))})]}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:16,minWidth:0},children:[e.jsx(Te,{icon:h.Lightbulb,title:X,iconColor:s.railCompliance}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:W.map((g,N)=>e.jsx(Be,{...g},N))})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,marginTop:8},children:[e.jsx(Te,{icon:h.Phone,title:G,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(Ye,{icon:h.FolderKanban,title:O}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:Y.map((g,N)=>e.jsx(Ue,{...g},N))})]}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:8,minWidth:0},children:[e.jsx(Ye,{icon:h.Layers,title:J}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:I.map((g,N)=>e.jsx(Ue,{...g},N))})]})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,marginTop:8},children:[f&&e.jsx("span",{style:{fontFamily:te,fontWeight:600,fontSize:16,color:s.ink,lineHeight:1.2},children:f}),e.jsx(qe.DataTable2,{data:ie,columns:oe,initialPageSize:q,totalCount:x,page:m,pageSize:T,onPageChange:P,onPageSizeChange:$,onRowClick:Le,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)"},ne="var(--font-sans, 'Averta', ui-sans-serif, system-ui, sans-serif)",L="var(--font-sans, 'Averta', ui-sans-serif, system-ui, sans-serif)";function at({trend:t="up",points:n,width:i=49.618,height:r=35}){const o=w.useId(),a=$e(n),d=a?a.line:nt,c=a?a.area:it,F=we(n)??t;return e.jsxs("svg",{width:i,height:r,viewBox:"0 0 52 36",fill:"none",style:{flexShrink:0,transform:!a&&F==="down"?"scaleX(-1)":void 0},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:`spark-${o}`,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:c,fill:`url(#spark-${o})`,fillRule:"evenodd",clipRule:"evenodd",opacity:"0.1"}),e.jsx("path",{d,stroke:l.ink,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:!a&&F==="down"?"2 4":void 0})]})}function dt(t,n){return we(n)??(t==="down"?"down":"up")}function ct({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 Ve({value:t,label:n,trend:i="up",points:r,muted:o=!1,beigeBg:a=!1,style:d={}}){const c=dt(i,r);return e.jsxs("div",{style:{background:a?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(at,{trend:c,points:r}),e.jsx(ct,{direction:c})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,marginTop:8},children:[e.jsx("div",{style:{fontFamily:ne,fontSize:28,fontWeight:500,lineHeight:"1.2",color:o?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 We({value:t,label:n,trend:i="up",points:r,withDivider:o=!1}){const a=dt(i,r);return e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:8,paddingLeft:o?24:0,borderLeft:o?`1px solid ${l.border}`:"none",minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between"},children:[e.jsx(at,{trend:a,points:r}),e.jsx(ct,{direction:a})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8,marginTop:8},children:[e.jsx("div",{style:{fontFamily:ne,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 St({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 Dt=["January","February","March","April","May","June","July","August","September","October","November","December"],Lt=["Su","Mo","Tu","We","Th","Fr","Sa"];function me(t){const n=new Date(t);return n.setHours(0,0,0,0),n}function Ft(t,n){const r=new Date(t,n,1).getDay(),o=new Date(t,n,1-r);return Array.from({length:42},(a,d)=>{const c=new Date(o);return c.setDate(o.getDate()+d),c})}function zt({value:t,onApply:n,onClose:i,anchorRef:r}){const o=w.useRef(null),[a,d]=w.useState(t!=null&&t.from?me(t.from):null),[c,F]=w.useState(t!=null&&t.to?me(t.to):null),p=a||new Date,[y,b]=w.useState(p.getFullYear()),[v,S]=w.useState(p.getMonth()),[W,D]=w.useState({top:0,left:0});w.useLayoutEffect(()=>{const f=()=>{if(!(r!=null&&r.current))return;const j=r.current.getBoundingClientRect(),C=320;D({top:j.bottom+6,left:Math.max(8,j.right-C)})};return f(),window.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[r]),w.useEffect(()=>{const f=C=>{var M,K;(M=o.current)!=null&&M.contains(C.target)||(K=r==null?void 0:r.current)!=null&&K.contains(C.target)||i()},j=C=>{C.key==="Escape"&&i()};return document.addEventListener("mousedown",f),document.addEventListener("keydown",j),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",j)}},[i,r]);const Y=Ft(y,v),I=me(new Date),E=f=>{const j=me(f);j>I||(!a||a&&c?(d(j),F(null)):j<a?d(j):F(j))},X=()=>{v===0?(S(11),b(y-1)):S(v-1)},G=()=>{v===11?(S(0),b(y+1)):S(v+1)},O=f=>a&&c&&f>=a&&f<=c,J=f=>a&&f.getTime()===a.getTime()||c&&f.getTime()===c.getTime();return ht.createPortal(e.jsxs("div",{ref:o,style:{position:"fixed",top:W.top,left:W.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:X,style:Xe,"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:[Dt[v]," ",y]}),e.jsx("button",{type:"button",onClick:G,style:Xe,"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:Lt.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:Y.map(f=>{const j=f.getMonth()===v,C=O(f),M=J(f),K=f.getTime()===I.getTime(),_=f>I;return e.jsx("button",{type:"button",onClick:()=>E(f),disabled:_,"aria-disabled":_,style:{height:36,border:"none",borderRadius:8,background:M?l.black:C?l.hoverWarm40:"transparent",color:M?l.white:_?l.textFaintGrey:j?l.ink:l.muted,fontFamily:L,fontSize:13,fontWeight:K?500:400,cursor:_?"not-allowed":"pointer",opacity:_?.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),F(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:!a||!c,onClick:()=>{n({from:a,to:c}),i()},style:{background:!a||!c?l.neutralBorder:l.black,color:l.white,border:"none",borderRadius:10,height:30,padding:"0 16px",fontFamily:L,fontSize:14,fontWeight:600,cursor:!a||!c?"not-allowed":"pointer"},children:"Apply"})]})]}),document.body)}const Xe={display:"inline-flex",alignItems:"center",justifyContent:"center",width:28,height:28,border:"none",background:"transparent",borderRadius:6,cursor:"pointer",color:l.ink};function Me({value:t,onChange:n}){const[i,r]=w.useState(!1),o=w.useRef(null),a=!!(t!=null&&t.from&&(t!=null&&t.to));return e.jsxs(e.Fragment,{children:[e.jsxs("button",{ref:o,type:"button",onClick:()=>r(d=>!d),style:{display:"inline-flex",alignItems:"center",gap:8,height:32,padding:"0 16px",borderRadius:10,border:a?"none":`1px solid ${l.neutralBorder}`,background:a?l.black:l.white,cursor:"pointer",fontFamily:L,fontSize:14,color:a?l.white:l.neutral800,fontWeight:a?600:400,whiteSpace:"nowrap"},children:[e.jsx(h.CalendarDays,{size:18,strokeWidth:1.75}),"Date Range"]}),i&&e.jsx(zt,{value:t,anchorRef:o,onClose:()=>r(!1),onApply:d=>n==null?void 0:n(d)})]})}function Tt({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 Wt=[{id:"8h",label:"8h"},{id:"1d",label:"1d"},{id:"7d",label:"7d"},{id:"30d",label:"30d"}];function Ct({value:t=0,max:n=5}){const i=typeof t=="number"?t:parseFloat(t)||0,r=Math.floor(i),o=i%1>0&&r<n;return e.jsx("div",{style:{display:"flex",gap:4},children:Array.from({length:n}).map((a,d)=>d<r?e.jsx("span",{style:{width:10,height:10,borderRadius:"50%",background:l.black,display:"inline-block"}},d):d===r&&o?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 $t=[{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(Ct,{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 ge({icon:t,title:n,trailing:i,iconColor:r=l.ink,bordered:o=!1}){return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,width:"100%",paddingBottom:o?12:0,borderBottom:o?`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:ne,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 Ge({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:ne,fontWeight:600,fontSize:16,color:l.ink,lineHeight:"24px"},children:n})]})}function Ke({title:t,summary:n,calls:i,percent:r,bullets:o,defaultExpanded:a=!1}){const[d,c]=w.useState(a),F=Array.isArray(o)?o:[];return e.jsxs("div",{style:{borderTop:`1px solid ${l.border}`},children:[e.jsxs("button",{type:"button",onClick:()=>c(p=>!p),"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:ne,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(h.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(h.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(h.ChevronDown,{size:20,color:l.ink,strokeWidth:2,style:{flexShrink:0,transform:d?"rotate(180deg)":"none",transition:"transform 150ms ease"}})]}),d&&F.length>0&&e.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:"0 16px 16px"},children:F.map((p,y)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",fontFamily:L,fontSize:14,color:l.ink,lineHeight:"24px",gap:16},children:[p.href?e.jsx("a",{href:p.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:p.text}):e.jsx("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p.text}),e.jsxs("span",{style:{display:"inline-flex",gap:4,whiteSpace:"nowrap"},children:[e.jsx("span",{style:{color:l.ink},children:p.citation}),e.jsxs("span",{style:{color:l.muted},children:["(",p.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: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 pe({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 At({className:t="",onAgentClick:n,title:i="",subtitle:r="",dateRangeLabel:o="",viewByOptions:a=[],initialViewBy:d="",onViewByChange:c,aggregatedByLabel:F="",volumeStat:p=fe,compassStat:y=fe,baselineSubStat:b=fe,agentLiftSubStat:v=fe,scoreSubStat:S=fe,agentRows:W=[],agentColumns:D=[],initialPageSize:Y=10,guidanceItems:I=[],strengthItems:E=[],callDrivers:X=[],callParadigms:G=[],topSignalsLeft:O=[],topSignalsRight:J=[],topSignalsTrailing:f="",strengthsTitle:j="",guidanceTitle:C="",callMixTitle:M="",driversTitle:K="",paradigmsTitle:_="",topSignalsTitle:ie="",emptyStrengthsMessage:oe="",emptyGuidanceMessage:q="",emptyDriversMessage:Z="",emptyParadigmsMessage:Q="",emptyTopSignalsMessage:B="",rangeOptions:ae=Wt,selectedWindow:x="30d",onWindowChange:m,dateRangePicker:T,dateRange:P,onDateRangeChange:$,onExport:A,onVisibleColumnsChange:Le}){var Ne,Re;const[le,re]=w.useState(null),[H,V]=w.useState(!1),[de,Fe]=w.useState(d),[g,N]=w.useState(null),R=P!==void 0?P:g,ze=!!(R!=null&&R.from&&(R!=null&&R.to)),ut=u=>{N(u),$==null||$(u)},xt=u=>{N(null),$==null||$(null),m==null||m(u)},Pe=w.useRef(null),He=w.useRef(null);w.useEffect(()=>{if(!H)return;const u=k=>{var ce,Ee;(ce=He.current)!=null&&ce.contains(k.target)||(Ee=Pe.current)!=null&&Ee.contains(k.target)||V(!1)};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[H]);const ft=((Ne=a.find(u=>u.id===de))==null?void 0:Ne.label)||(((Re=a[0])==null?void 0:Re.label)??""),pt=u=>{if(n){n(u);return}re(u)};return e.jsxs(e.Fragment,{children:[le&&(()=>{let u=null,k=null;if(ze)u=R.from,k=R.to;else{const ce=ve[x];ce&&(k=new Date,u=new Date(k.getTime()-ce))}return e.jsx(ot,{className:t,agentName:le.agent,startDate:u||"",endDate:k||"",totalCalls:`${le.calls} Calls`,onBack:()=>re(null),selectedWindow:x,dateRange:R})})(),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: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:ne,fontSize:24,fontWeight:500,color:l.ink,margin:0,lineHeight:"1.2",letterSpacing:"-0.01em"},children:i}),e.jsx("p",{style:{fontFamily:L,fontSize:14,color:"var(--neutral-950)",margin:0,lineHeight:"1.4"},children:r})]}),e.jsxs("button",{type:"button",onClick:()=>A==null?void 0:A(),disabled:!A,style:{display:"inline-flex",alignItems:"center",gap:8,height:32,padding:"0 16px",borderRadius:10,border:`1px solid ${l.neutralBorder}`,background:l.white,cursor:A?"pointer":"not-allowed",opacity:A?1:.5,fontFamily:L,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:Pe,onClick:()=>V(u=>!u),"aria-haspopup":"listbox","aria-expanded":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:"pointer",fontFamily:L,fontSize:14,lineHeight:"24px",color:l.neutral800,whiteSpace:"nowrap"},children:[ft,e.jsx(h.ChevronDown,{size:20,strokeWidth:1.75,style:{transform:H?"rotate(180deg)":"none",transition:"transform 120ms ease"}})]}),H&&e.jsxs("div",{ref:He,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:[F&&e.jsx("div",{style:{padding:12,fontFamily:ne,fontWeight:600,fontSize:13,color:l.ink,lineHeight:1.2},children:F}),a.map(u=>{const k=de===u.id;return e.jsxs("button",{type:"button",role:"option","aria-selected":k,onClick:()=>{u.id!==de&&(Fe(u.id),c==null||c(u.id)),V(!1)},style:{display:"flex",alignItems:"center",gap:8,padding:k?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:[k&&e.jsx(h.Check,{size:20,color:l.ink,strokeWidth:1.75,style:{flexShrink:0}}),e.jsx("span",{children:u.label})]},u.id)})]})]}),e.jsxs("div",{style:{display:"flex",gap:10,alignItems:"center"},children:[(()=>{const k=(ze?`${ee(R.from)} – ${ee(R.to)}`:"")||tt(x)||o;return k?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontFamily:L,fontSize:13,color:l.ink},children:[e.jsx(h.CalendarDays,{size:16,strokeWidth:1.75,color:l.muted}),k]}):null})(),ae.map(u=>e.jsx(Tt,{label:u.label,active:!ze&&u.id===x,onClick:()=>xt(u.id)},u.id)),T?e.jsx(w.Suspense,{fallback:e.jsx(St,{icon:h.CalendarDays,children:"Date Range"}),children:T}):e.jsx(Me,{value:R,onChange:ut})]})]}),e.jsxs("div",{style:{display:"flex",gap:24},children:[e.jsx(Ve,{value:p.value,label:p.label,trend:p.trend,points:p.points,style:{width:264,flexShrink:0}}),e.jsx(Ve,{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(We,{value:b.value,label:b.label,trend:b.trend,points:b.points}),e.jsx(We,{value:v.value,label:v.label,trend:v.trend,points:v.points,withDivider:!0}),e.jsx(We,{value:S.value,label:S.label,trend:S.trend,points:S.points,withDivider:!0})]})]}),e.jsx(qe.DataTable2,{data:W,columns:D,initialPageSize:Y,onRowClick:pt,onVisibleColumnsChange:Le}),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(ge,{icon:h.ShieldCheck,title:j,iconColor:"var(--rail-compliance)"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",borderBottom:`1px solid ${l.border}`,maxHeight:480,overflowY:"auto"},children:E.length===0?e.jsx(pe,{message:oe}):E.map((u,k)=>e.jsx(Ke,{...u},k))})]}),e.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:16},children:[e.jsx(ge,{icon:h.Lightbulb,title:C,iconColor:"var(--rail-compliance)"}),e.jsx("div",{style:{display:"flex",flexDirection:"column",borderBottom:`1px solid ${l.border}`,maxHeight:480,overflowY:"auto"},children:I.length===0?e.jsx(pe,{message:q}):I.map((u,k)=>e.jsx(Ke,{...u},k))})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsx(ge,{icon:h.Phone,title:M,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(Ge,{icon:h.FolderKanban,title:K}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:X.length===0?e.jsx(pe,{message:Z}):X.map((u,k)=>e.jsx(be,{...u},k))})]}),e.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:8},children:[e.jsx(Ge,{icon:h.Layers,title:_}),e.jsx("div",{style:{display:"flex",flexDirection:"column",maxHeight:480,overflowY:"auto"},children:G.length===0?e.jsx(pe,{message:Q}):G.map((u,k)=>e.jsx(be,{...u},k))})]})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsx(ge,{icon:h.Signal,title:ie,iconColor:"var(--rail-compliance)",trailing:f,bordered:!0}),O.length===0&&J.length===0?e.jsx(pe,{message:B}):e.jsxs("div",{style:{display:"flex",gap:24},children:[e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:O.map((u,k)=>e.jsx(be,{...u},k))}),e.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column"},children:J.map((u,k)=>e.jsx(be,{...u},k))})]})]})]})]})}exports.DEFAULT_AGENT_COLUMNS=$t;exports.DEFAULT_SESSION_COLUMNS=wt;exports.DateRangeButton=Me;exports.METRIC_PLACEHOLDER=Ae;exports.PerformanceDetailsPage=ot;exports.PerformancePanel=At;exports.RANGE_TO_MS=ve;exports.buildSparkPaths=$e;exports.computeWindowLabel=tt;exports.formatEightHourRangeEndpoints=et;exports.formatEightHourWindowLabel=Qe;exports.formatLocalDate=ee;exports.formatMetricDisplay=Ie;exports.getPresetWindowDates=je;exports.hasChartData=U;exports.hasMeaningfulMetric=ye;exports.isNullishMetric=Se;exports.normalizeSparkPoints=ke;exports.resolveKpiTrend=rt;exports.resolveTrend=De;exports.trendFromPoints=we;exports.trendFromSignedValue=lt;
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;
2
2
  //# sourceMappingURL=PerformancePanel.cjs.js.map