1import{f as xe,r as l,e as Z,u as D,j as s,U as q,af as fe,A as Q,T as ve,x as ye,K as be,N as Ie}from"./index-jmx1CJ5H.js";import{T as X,G as je,I as $,b as Ce,c as W}from"./TableCard-B4YTqdId.js";import{K as O}from"./KPIStatCard-R7ImH-8M.js";import{P as Se}from"./PieChartCard-DSvypwF9.js";import{am as V,b as we,o as ee,bP as Ne,aL as te,aN as ae,bQ as Ae,aP as Pe,p as ke,r as se,a4 as ne,aX as ie,a2 as Te,aY as Ee,aZ as Oe,W as re,a$ as De,a5 as _e,u as le,a9 as Le,c as ze,a8 as oe,a7 as z,b2 as Re,b1 as Ke,aF as _,bR as Me,V as M,bS as Y,aa as $e,ab as Fe,ad as K,an as Be,bK as Ue,b6 as We,ah as He,bT as Ge,a1 as ce,ak as Ve,a as Ye,ar as Je,bU as Ze,as as qe,b8 as Qe,aD as Xe,R as et,C as tt,X as at,Y as st,T as nt}from"./ComposedChart-DItjKEdv.js";import{C as it,u as rt,b as lt,c as ot}from"./PieChart-NzNvBUGQ.js";import{L as ct}from"./layout-grid-CPgYrGx9.js";import{U as dt}from"./user-check-BBAEkyPl.js";import{C as ht}from"./calendar-ev8CgJB_.js";import{D as mt}from"./download-DlV7VIMX.js";const pt=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}]],ut=xe("sparkle",pt);var gt=["option","isActive"];function L(){return L=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)({}).hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},L.apply(null,arguments)}function xt(e,t){if(e==null)return{};var a,n,i=ft(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)===-1&&{}.propertyIsEnumerable.call(e,a)&&(i[a]=e[a])}return i}function ft(e,t){if(e==null)return{};var a={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;a[n]=e[n]}return a}function vt(e){var{option:t,isActive:a}=e,n=xt(e,gt);return typeof t=="string"?l.createElement(V,L({option:l.createElement(we,L({type:t},n)),isActive:a,shapeType:"symbols"},n)):l.createElement(V,L({option:t,isActive:a,shapeType:"symbols"},n))}var yt=(e,t,a,n,i,o,r)=>te(e,"xAxis",t,r),bt=(e,t,a,n,i,o,r)=>ae(e,"xAxis",t,r),It=(e,t,a,n,i,o,r)=>te(e,"yAxis",a,r),jt=(e,t,a,n,i,o,r)=>ae(e,"yAxis",a,r),Ct=(e,t,a,n)=>Ae(e,"zAxis",n,!1),St=(e,t,a,n,i)=>i,wt=(e,t,a,n,i,o)=>o,Nt=(e,t,a,n,i,o,r)=>Ne(e,void 0,void 0,r),At=ee([Pe,St],(e,t)=>e.filter(a=>a.type==="scatter").find(a=>a.id===t)),Pt=ee([Nt,yt,bt,It,jt,Ct,At,wt],(e,t,a,n,i,o,r,p)=>{var{chartData:h,dataStartIndex:c,dataEndIndex:g}=e;if(r!=null){var u;if(r?.data!=null&&r.data.length>0?u=r.data:u=h?.slice(c,g+1),!(u==null||t==null||n==null||a==null||i==null||a?.length===0||i?.length===0))return Bt({displayedData:u,xAxis:t,yAxis:n,zAxis:o,scatterSettings:r,xAxisTicks:a,yAxisTicks:i,cells:p})}}),kt=["id"],Tt=["onMouseEnter","onClick","onMouseLeave"],Et=["animationBegin","animationDuration","animationEasing","hide","isAnimationActive","legendType","lineJointType","lineType","shape","xAxisId","yAxisId","zAxisId"];function H(e,t){if(e==null)return{};var a,n,i=Ot(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)a=o[n],t.indexOf(a)===-1&&{}.propertyIsEnumerable.call(e,a)&&(i[a]=e[a])}return i}function Ot(e,t){if(e==null)return{};var a={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;a[n]=e[n]}return a}function E(){return E=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var a=arguments[t];for(var n in a)({}).hasOwnProperty.call(a,n)&&(e[n]=a[n])}return e},E.apply(null,arguments)}function J(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),a.push.apply(a,n)}return a}function w(e){for(var t=1;t<arguments.length;t++){var a=arguments[t]!=null?arguments[t]:{};t%2?J(Object(a),!0).forEach(function(n){Dt(e,n,a[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):J(Object(a)).forEac
1h(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(a,n))})}return e}function Dt(e,t,a){return(t=_t(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function _t(e){var t=Lt(e,"string");return typeof t=="symbol"?t:t+""}function Lt(e,t){if(typeof e!="object"||!e)return e;var a=e[Symbol.toPrimitive];if(a!==void 0){var n=a.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var zt=e=>{var{dataKey:t,name:a,fill:n,legendType:i,hide:o}=e;return[{inactive:o,dataKey:t,type:i,color:n,value:re(a,t),payload:e}]},Rt=l.memo(e=>{var{dataKey:t,points:a,stroke:n,strokeWidth:i,fill:o,name:r,hide:p,tooltipType:h,id:c}=e,g={dataDefinedOnItem:a?.map(u=>u.tooltipPayload),getPosition:u=>{var m;return a==null||(m=a[Number(u)])===null||m===void 0?void 0:m.tooltipPosition},settings:{stroke:n,strokeWidth:i,fill:o,nameKey:void 0,dataKey:t,name:re(r,t),hide:p,type:h,color:o,unit:"",graphicalItemId:c}};return l.createElement(Le,{tooltipEntrySettings:g})});function Kt(e){var{points:t,props:a}
1=e,{line:n,lineType:i,lineJointType:o}=a;if(!n)return null;var r=ce(a),p=Je(n),h,c;if(i==="joint")h=t.map(x=>{var d,f;return{x:(d=x.cx)!==null&&d!==void 0?d:null,y:(f=x.cy)!==null&&f!==void 0?f:null}});else if(i==="fitting"){var{xmin:g,xmax:u,a:m,b:S}=Ze(t),b=x=>m*x+S;h=[{x:g,y:b(g)},{x:u,y:b(u)}]}var v=w(w(w({},r),{},{fill:"none",stroke:r&&r.fill},p),{},{points:h});return l.isValidElement(n)?c=l.cloneElement(n,v):typeof n=="function"?c=n(v):c=l.createElement(qe,E({},v,{type:o})),l.createElement(z,{className:"recharts-scatter-line",key:"recharts-scatter-line"},c)}function Mt(e){var{showLabels:t,points:a,children:n}=e,i=Ue(),o=l.useMemo(()=>a?.map(r=>{var p,h,c={x:(p=r.x)!==null&&p!==void 0?p:0,y:(h=r.y)!==null&&h!==void 0?h:0,width:r.width,height:r.height,lowerWidth:r.width,upperWidth:r.width};return w(w({},c),{},{value:void 0,payload:r.payload,viewBox:c,parentViewBox:i,fill:void 0})}),[i,a]);return l.createElement(We,{value:t?o:void 0},n)}function $t(e){var{points:t,allOtherScatterProps:a}=e,{shape:n,activeShape:i,dataKey:o}=a,{id:r}=a,p=H(a,kt),h=le(He),{onMouseEnter:c,onClick:g,onMouseLeave:u}=a,m=H(a,Tt),S=rt(c,o,r),b=lt(u),v=ot(g,o,r);if(!Ge(t))return null;var x=ce(p);return l.createElement(l.Fragment,null,l.createElement(Kt,{points:t,props:p}),t.map((d,f)=>{var j=i!=null&&i!==!1,C=j&&h===String(f),I=j&&C?i:n,y=w(w(w({},x),d),{},{index:f,[Ve]:String(r)});return l.createElement(oe,{key:"symbol-".concat(d?.cx,"-").concat(d?.cy,"-").concat(d?.size,"-").concat(f),zIndex:C?ne.activeDot:void 0},l.createElement(z,E({className:"recharts-scatter-symbol"},Ye(m,d,f),{onMouseEnter:S(d,f),onMouseLeave:b(d,f),onClick:v(d,f)}),l.createElement(vt,E({option:I,isActive:C},y))))}
1))}function Ft(e){var{previousPointsRef:t,props:a}=e,{points:n,isAnimationActive:i,animationBegin:o,animationDuration:r,animationEasing:p}=a,h=t.current,c=$e(a,"recharts-scatter-"),[g,u]=l.useState(!1),m=l.useCallback(()=>{u(!1)},[]),S=l.useCallback(()=>{u(!0)},[]),b=!g;return l.createElement(Mt,{showLabels:b,points:n},a.children,l.createElement(Fe,{animationId:c,begin:o,duration:r,isActive:i,easing:p,onAnimationEnd:m,onAnimationStart:S,key:c},v=>{var x=v===1?n:n?.map((d,f)=>{var j=h&&h[f];return j?w(w({},d),{},{cx:d.cx==null?void 0:K(j.cx,d.cx,v),cy:d.cy==null?void 0:K(j.cy,d.cy,v),size:K(j.size,d.size,v)}):w(w({},d),{},{size:K(0,d.size,v)})});return v>0&&(t.current=x),l.createElement(z,null,l.createElement($t,{points:x,allOtherScatterProps:a,showLabels:b}))}),l.createElement(Be,{label:a.label}))}function Bt(e){var{displayedData:t,xAxis:a,yAxis:n,zAxis:i,scatterSettings:o,xAxisTicks:r,yAxisTicks:p,cells:h}=e,c=_(a.dataKey)?o.dataKey:a.dataKey,g=_(n.dataKey)?o.dataKey:n.dataKey,u=i&&i.dataKey,m=i?i.range:Me.range,S=m&&m[0],b=a.scale.bandwidth?a.scale.bandwidth():0,v=n.scale.bandwidth?n.scale.bandwidth():0;return t.map((x,d)=>{var f=M(x,c),j=M(x,g),C=!_(u)&&M(x,u)||"-",I=[{name:_(a.dataKey)?o.name:a.name||String(a.dataKey),unit:a.unit||"",value:f,payload:x,dataKey:c,type:o.tooltipType,graphicalItemId:o.id},{name:_(n.dataKey)?o.name:n.name||String(n.dataKey),unit:n.unit||"",value:j,payload:x,dataKey:g,type:o.tooltipType,graphicalItemId:o.id}];C!=="-"&&i!=null&&I.push({name:i.name||i.dataKey,unit:i.unit||"",value:C,payload:x,dataKey:u,type:o.tooltipType,graphicalItemId:o.id});var y=Y({axis:a,ticks:r,bandSize:b,entry:x,index:d,dataKey:c}),T=Y({axis:n,ticks:p,bandSize:v,entry:x,index:d,dataKey:g}),N=C!=="-"&&i!=null?i.scale.map(C):S,A=N==null?0:Math.sqrt(Math.max(N,0)/Math.PI);return w(w({},x),{},{cx:y,cy:T,x:y==null?void 0:y-A,y:T==null?void 0:T-A,width:2*A,height:2*A,size:N,node:{x:f,y:j,z:C},tooltipPayload:I,tooltipPosition:{x:y,y:T},payload:x},h&&h[d]&&h[d].props)})}var Ut=(e,t,a)=>({x:e.cx,y:e.cy,value:Number(a==="x"?e.node.x:e.node.y),errorVal:M(e,t)});function Wt(e){var{hide:t,points:a,className:n,needClip:i,xAxisId:o,yAxisId:r,id:p}=e,h=l.useRef(null);if(t)return null;var c=ze("recharts-scatter",n),g=p;return l.createElement(oe,{zIndex:e.zIndex},l.createElement(z,{className:c,clipPath:i?"url(#clipPath-".concat(g,")"):void 0,id:p},i&&l.createElement("defs",null,l.createElement(Re,{clipPathId:g,xAxisId:o,yAxisId:r})),l.createElement(Ke,{xAxisId:o,yAxisId:r,data:a,dataPointFormatter:Ut,errorBarOffset:0},l.createElement(z,{key:"recharts-scatter-symbols"},l.createElement(Ft,{props:e,previousPointsRef:h})))))}var de={xAxisId:0,yAxisId:0,zAxisId:0,label:!1,line:!1,legendType:"circle",lineType:"joint",lineJointType:"linear",shape:"circle",hide:!1,isAnimationActive:"auto",animationBegin:0,animationDuration:400,animationEasing:"linear",zIndex:ne.scatter};function Ht(e){var t=se(e,de),{animationBegin:a,animationDuration:n,animationEasing:i,hide:o,isAnimationActive:r,legendType:p,lineJointType:h,lineType:c,shape:g,xAxisId:u,yAxisId:m,zAxisId:S}=t,b=H(t,Et),{needClip:v}=De(u,m),x=l.useMemo(()=>_e(e.children,it),[e.children]),d=ie(),f=le(j=>Pt(j,u,m,S,e.id,x,d));return v==null||f==null?null:l.createElement(l.Fragment,null,l.createElement(Rt,{dataKey:e.dataKey,points:f,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,tooltipType:e.tooltipType,id:e.id}),l.createElement(Wt,E({},b,{xAxisId:u,yAxisId:m,zAxisId:S,lineType:c,lineJointType:h,legendType:p,shape:g,hide:o,isAnimationActive:r,animationBegin:a,animationDuration:n,animationEasing:i,points:f,needClip:v})))}function Gt(e){var t=se(e,de),a=ie();return l.createElement(Te,{id:t.id,type:"scatter"},n=>l.createElement(l.Fragment,null,l.createElement(Ee,{legendPayload:zt(t)}),l.createElement(Oe,{type:"scatter",id:n,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:t.zAxisId,dataKey:t.dataKey,hide:t.hide,name:t.name,tooltipType:t.tooltipType,isPanorama:a}),l.createElement(Ht,E({},t,{id:n}))))}var he=l.memo(Gt,ke);he.displayName="Scatter";var Vt=["item"],Yt=l.forwardRef((e,t)=>
1l.createElement(Qe,{chartName:"ScatterChart",defaultTooltipEventType:"item",validateTooltipEventTypes:Vt,tooltipPayloadSearcher:Xe,categoricalChartProps:e,ref:t}));const Jt=async e=>await Z.get(`/compliance/settings/type/Rules Group?companyId=${e}`),Zt=async e=>await Z.get("/reports/coaching-insights-summary",{params:e}),qt=e=>{const t=l.useMemo(()=>e?.correlation?.scatterData||[],[e]),a=e?.kpis||{coachingOpportunities:0,coachingOpportunitiesChange:"0.0%",coachingOpportunitiesIsPos:!0,agentsNeedingCoaching:0,agentsNeedingCoachingChange:"0.0%",agentsNeedingCoachingIsPos:!0,coachingSessions:0,coachingSessionsChange:"0.0%",coachingSessionsIsPos:!0,completedCoaching:0,completedCoachingChange:"0.0%",completedCoachingIsPos:!0,avgImprovement:0,avgImprovementChange:"0.0%",avgImprovementIsPos:!0,coachingImpactScore:0,coachingImpactScoreChange:"0.0%",coachingImpactScoreIsPos:!0,evaluatedInteractions:0},n=e?.coachingImpactHeatmap,i=e?.topCoachingTopics||[],o=e?.coachingImpactOverTime||[],r=e?.coachingImpactByCategory||[],p=l.useMemo(()=>r.length?Math.max(...r.map(C=>C.improvement),1):1,[r]),h=e?.agentCoachingProgress||[{name:"Completed",value:0,percentage:0},{name:"In Progress",value:0,percentage:0},{name:"Not Started",value:0,percentage:0}],c=e?.agentsNeedingImmediateAttention||[],g=e?.workforceInsights||{aht:"00:00",occupancy:0,adherence:0,shrinkage:0},u=e?.correlation||{coef:"0.00",description:"No Correlation"},m=e?.upcomingCoachingPlan||[],S=l.useMemo(()=>{const C=g.aht||"";if(!C||typeof C!="string")return 60;const I=C.split(":");let y=180;return I.length===2&&(y=Number.parseInt(I[0],10)*60+Number.parseInt(I[1],10)),Math.min(100,Math.round(y/300*100))||60},[g.aht]),b=g?.workloadDistribution||[{value:15},{value:68},{value:17}],v=b[0]?.value??15,x=b[1]?.value??68,d=b[2]?.value??17;let f="Balanced",j="text-emerald-500";return v>x&&v>d?(f="Under Utilized",j="text-slate-400"):d>x&&d>v&&(f="Over Utilized",j="text-rose-500"),{kpis:a,scatterData:t,coachingImpactHeatmap:n,topCoachingTopics:i,coachingImpactOverTime:o,coachingImpactByCategory:r,maxImprovement:p,agentCoachingProgress:h,agentsNeedingImmediateAttention:c,workforceInsights:g,ahtPercent:S,underPercent:v,optimalPercent:x,overPercent:d,workloadState:f,workloadColor:j,correlation:u,upcomingCoachingPlan:m}},Qt=()=>{const{t:e}=D(),[t,a]=l.useState("thisMonth"),[n,i]=l.useState(""),[o,r]=l.useState(""),[p,h]=l.useState("all"),[c,g]=l.useState("all"),[u,m]=l.useState([{value:"all",label:e("report.execSummary.filters.allDepartments","All Departments")}]),[S,b]=l.useState(!1),[v,x]=l.useState(null);l.useEffect(()=>{m(I=>I.map(y=>y.value==="all"?{...y,label:e("report.execSummary.filters.allDepartments","All Departments")}:y))},[e]);const d=l.useCallback((I,y)=>{i(I),r(y),a("custom")},[]);l.useEffect(()=>{(async()=>{try{const y=globalThis.localStorage.getItem("user");if(y){const N=JSON.parse(y)?.company_id;if(N){const A=await Jt(N);if(A.data&&Array.isArray(A.data)){const R=A.data.filter(P=>P.mandatory==="Yes").map(P=>({value:P.statement,label:P.statement})),F=Array.from(new Set(R.map(P=>P.value))).map(P=>R.find(B=>B.value===P));m([{value:"all",label:e("report.execSummary.filters.allDepartments","All Departments")},...F])}}}}catch(y){console.error("Failed to load coaching insights filter groups:",y)}})()},[e]);const f=l.useCallback(async()=>{b(!0);try{const I=globalThis.localStorage.getItem("user"),T={company_id:I?JSON.parse(I)?.company_id:null,dateRange:t,team:p,dataType:c,customStartDate:n,customEndDate:o},N=await Zt(T);N?.data&&x(N.data)}catch(I){console.error("Failed to load Coaching & Workforce Insights summary:",I)}finally{setTimeout(()=>b(!1),450)}},[t,p,c,n,o]);l.useEffect(()=>{t==="custom"&&(!n||!o)||f()},[t,p,c,n,o,f]);const j=l.useCallback(()=>{if(!v)return;const I=`data:text/json;charset=utf-8,${encodeURIComponent(JSON.stringify(v,null,2))}`,y=document.createElement("a");y.setAttribute("href",I),y.setAttribute("download",`coaching_insights_report_${t}.json`),document.body.appendChild(y),y.click(),y.remove()},[v,t]),C=qt(v);return{dateRange:t,setDateRange:a,customStartDate:n,customEndDate:o,handleCustomDateSelect:d,team:p,setTeam:h,teamOptions:u,dataType:c,setDataType:g,loading:S,handleRefresh:f,handleExport:j,...C}},Xt=({kpis:e})=>{const{t}=D();return s.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 xl:grid-cols-6 gap-3 mb-6 shrink-0",children:[s.jsx(O,{title:t("report.coachingInsights.kpis.coachingOpport","COACHING OPPORT."),value:(e.coachingOpportunities||0).toLocaleStr
1ing(),icon:ut,iconBgColor:"bg-violet-50",iconColor:"text-violet-500",changeValue:e.coachingOpportunitiesChange,changeLabel:t(""," vs Prev"),isPositive:e.coachingOpportunitiesIsPos}),s.jsx(O,{title:t("report.coachingInsights.kpis.needingCoaching","NEEDING COACHING"),value:(e.agentsNeedingCoaching||0).toLocaleString(),icon:q,iconBgColor:"bg-amber-50",iconColor:"text-amber-600",changeValue:e.agentsNeedingCoachingChange,changeLabel:t(""," vs Prev"),isPositive:e.agentsNeedingCoachingIsPos}),s.jsx(O,{title:t("report.coachingInsights.kpis.coachingSessions","COACHING SESSIONS"),value:(e.coachingSessions||0).toLocaleString(),icon:fe,iconBgColor:"bg-emerald-50",iconColor:"text-emerald-500",changeValue:e.coachingSessionsChange,changeLabel:t(""," vs Prev"),isPositive:e.coachingSessionsIsPos}),s.jsx(O,{title:t("report.coachingInsights.kpis.completedCoaching","COMPLETED COACHING"),value:(e.completedCoaching||0).toLocaleString(),icon:Q,iconBgColor:"bg-blue-50",iconColor:"text-blue-500",changeValue:e.completedCoachingChange,changeLabel:t(""," vs Prev"),isPositive:e.completedCoachingIsPos}),s.jsx(O,{title:t("report.coachingInsights.kpis.avgImprovement","AVG. IMPROVEMENT"),value:(e.avgImprovement||0).toFixed(1),valueSuffix:"%",icon:ve,iconBgColor:"bg-rose-50",iconColor:"text-rose-500",changeValue:e.avgImprovementChange,changeLabel:t(""," vs Prev"),isPositive:e.avgImprovementIsPos}),s.jsx(O,{title:t("report.coachingInsights.kpis.impactScore","IMPACT SCORE"),value:(e.coachingImpactScore||0).toFixed(1),valueSuffix:"/100",icon:ye,iconBgColor:"bg-yellow-50",iconColor:"text-yellow-600",changeValue:e.coachingImpactScoreChange,changeLabel:t(""," vs Prev"),isPositive:e.coachingImpactScoreIsPos})]})},ea=({topCoachingTopics:e=[],coachingImpactOverTime:t=[],coachingImpactByCategory:a=[],maxImprovement:n=0})=>{const{t:i}=D(),o=[{header:i("report.coachingInsights.topTopics.topic","Topic"),key:"topic",align:"left",width:"40%",render:r=>s.jsxs("div",{className:"font-bold text-slate-700 truncate",title:r,children:[s.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-[#EF4444] mr-2 shrink-0 align-middle"}),s.jsx("span",{className:"align-middle",children:r})]})},{header:i("report.coachingInsights.topTopics.agents","Agents"),key:"affectedAgents",align:"right",width:"18%",render:r=>s.jsx("span",{className:"font-semibold text-slate-700",children:r})},{header:i("report.coachingInsights.topTopics.calls","Calls"),key:"interactions",align:"right",width:"17%",render:r=>s.jsx("span",{className:"font-medium text-slate-500",children:r})},{header:i("report.coachingInsights.topTopics.avgScore","Avg Score"),key:"avgScore",align:"right",width:"25%",render:r=>s.jsx("span",{className:"font-bold text-slate-800 pr-1",children:(r||0).toFixed(1)})}];return s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4 mb-4",children:[s.jsx("div",{className:"h-[310px]",children:s.jsx(X,{title:i("report.coachingInsights.topTopics.title","Top Coaching Topics"),data:e,columns:o,minHeight:"310px"})}),s.jsx("div",{className:"h-[310px]",children:s.jsx(je,{title:i("report.coachingInsights.impactOverTime.title","Coaching Impact Over Time"),data:t,xAxisKey:"date",minHeight:"310px",config:[{type:"line",dataKey:"preScore",name:i("report.coachingInsights.impactOverTime.preCoaching","Pre-Coaching Score"),stroke:"#94A3B8",strokeDasharray:"5 5",dot:!1},{type:"line",dataKey:"postScore",name:i("report.coachingInsights.impactOverTime.postCoaching","Post-Coaching Score"),stroke:"#EF4444"}]})}),s.jsx("div",{className:"h-[310px]",children:s.jsx($,{title:i("report.coachingInsights.impactByCategory.title","Coaching Impact by Category"),className:"h-full",minHeight:"310px",children:s.jsx("div",{className:"flex-1 flex flex-col justify-start space-y-2 pt-1 overflow-y-auto custom-scrollbar pr-0.5",children:a.slice(0,5).map((r,p)=>{const h=n>0?r.improvement/n*100:0;return s.jsxs("div",{className:"flex flex-col gap-1 text-[10px] font-bold",children:[s.jsxs("div",{className:"flex justify-between items-center text-slate-600 mb-0.5",children:[s.jsx("span",{className:"truncate pr-2 max-w-[150px]",title:r.category,children:r.category}),s.jsxs("span",{className:"font-black text-slate-800 shrink-0",children:["+",(r.improvement||0).toFixed(1),"%"]})]}),s.jsx("div",{className:"w-full h-1.5 bg-slate-100 rounded-full overflow-hidden",children:s.jsx("div",{style:{width:`${h}%`},className:"h-full bg-[#EF4444] rounded-full transition-all duration-700"})})]},r.category)})})})})]})},ta=["#EF4444","#F87171","#CBD5E1"],aa=(e,t)=>{switch(e){case"Under Utilized":return t("report.coachingInsights.workforce.underUtilized","Under Utilized");case"Optimal":return t("report.coachingInsights.workforce.optimal","Optimal");case"Over Utilized":return t("report.coachingInsights.workforce.overUtilized","Over Utilized");default:return e}},sa=({agentCoachingProgress:e=[],agentsNeedingImmediateAttention:t=[],workforceInsights:a={},ahtPercent:n=0,underPercent:i=0,optimalPercent:o=0,overPercent:r=0,workloadState:p="",workloadColor:h=""})=>{const{t:c}=D(),g=[{header:c("report.coachingInsights.immediateAttention.agent","Agent"),key:"agentName",align:"left",width:"35%",render:(m,S)=>s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{className:"font-bold text-slate-800",children:m}),s.jsx("span",{className:"text-[9px] text-slate-400",children:S.teamName})]})},{header:c("report.coachingInsights.immediateAttention.quality","Quality"),key:"qualityScore",align:"center",width:"18%",render:m=>s.jsxs("span",{className:`px-2 py-0.5 rounded text-[10px] font-bold ${m<70?"bg-red-50 text-red-600":"bg-amber-50 text-amber-600"}`,children:[m,"%"]})},{header:c("report.coachingInsights.immediateAttention.compliance","Compliance"),key:"complianceScore",align:"center",width:"30%",render:m=>s.jsxs("span",{className:`px-2 py-0.5 rounded text-[10px] font-bold ${m<80?"bg-red-50 text-red-600":"bg-amber-50 text-amber-600"}`,children:[m,"%"]})},{header:c("report.coachingInsights.immediateAttention.topIssue","Top Issue"),key:"topIssue",align:"left",width:"29%",render:m=>s.jsx("span",{className:"font-medium text-slate-600 truncate block",title:m,children:m})}],u=aa(p,c);return s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-4 mb-4",children:[s.jsx("div",{className:"lg:col-span-3 h-[310px]",children:s.jsx(Se,{title:c("report.coachingInsights.progress.title","Agent Coaching Progress"),data:e,dataKey:"value",nameKey:"name",colors:ta,minHeight:"310px",centerLabel:c("report.coachingInsights.progress.completion","Completion"),centerValue:`${e[0]?.percentage||0}%`,innerRadius:42,outerRadius:58})}),s.jsx("div",{className:"lg:col-span-6 h-[310px]",children:s.jsx(X,{title:c("report.coachingInsights.immediateAttention.title","Agents Needing Immediate Attention"),data:t,columns:g,minHeight:"310px"})}),s.jsx("div",{className:"lg:col-span-3 h-[310px]",children:s.jsx($,{title:c("report.coachingInsights.workforce.title","Workforce Insights"),className:"h-full flex flex-col justify-between",minHeight:"310px",children:s.jsxs("div",{className:"flex-1 flex flex-col justify-between min-h-0 overflow-hidden select-none",children:[s.jsxs("div",{className:"grid grid-cols-1 gap-1.5",children:[s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsxs("div",{className:"flex justify-between items-center gap-1.5 min-w-0",children:[s.jsx("span",{className:"text-[10px] font-bold text-slate-400 uppercase leading-tight truncate flex-1",title:c("report.coachingInsights.workforce.avgHandleTime","Avg Handle Time"),children:c("report.coachingInsights.workforce.avgHandleTime","Avg Handle Time")}),s.jsx("span",{className:"text-xs font-black text-slate-800 shrink-0",children:a.aht})]}),s.jsx("div",{className:"w-full h-1.5 rounded-full bg-slate-100 overflow-hidden",children:s.jsx("div",{style:{width:`${n}%`},className:"h-full rounded-full bg-emerald-500 transition-all duration-500"})})]}),s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsxs("div",{className:"flex justify-between items-center gap-1.5 min-w-0",children:[s.jsx("span",{className:"text-[10px] font-bold text-slate-400 uppercase leading-tight truncate flex-1",title:c("report.coachingInsights.workforce.occupancy","Occupancy"),children:c("report.coachingInsights.workforce.occupancy","Occupancy")}),s.jsxs("span",{className:"text-xs font-black text-slate-800 shrink-0",children:[a.occupancy,"%"]})]}),s.jsx("div",{className:"w-full h-1.5 rounded-full bg-slate-100 overflow-hidden",children:s.jsx("div",{style:{width:`${a.occupancy}%`},className:"h-full rounded-full bg-emerald-500 transition-all duration-500"})})]}),s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsxs("div",{className:"flex justify-between items-center gap-1.5 min-w-0",children:[s.jsx("span",{className:"text-[10px] font-bold text-slate-400 uppercase leading-tight truncate flex-1",title:c("report.coachingInsights.workforce.scheduleAdherence","Schedule Adherence"),children:c("report.coachingInsights.workforce.scheduleAdherence","Schedule Adherence")}),s.jsxs("span",{className:"text-xs font-black text-slate-800 shrink-0",children:[a.adherence,"%"]})]}),s.jsx("div",{className:"w-full h-1.5 rounded-full bg-slate-100 overflow-hidden",children:s.jsx("div",{style:{width:`${a.adherence}%`},className:"h-full rounded-full bg-emerald-500 transition-all duration-500"})})]}),s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsxs("div",{className:"flex justify-between items-center gap-1.5 min-w-0",children:[s.jsx("span",{className:"text-[10px] font-bold text-slate-400 uppercase leading-tight truncate flex-1",title:c("report.coachingInsights.workforce.shrinkage","Shrinkage"),children:c("report.coachingInsights.workforce.shrinkage","Shrinkage")}),s.jsxs("span",{className:"text-xs font-black text-slate-800 shrink-0",children:[a.shrinkage,"%"]})]}),s.jsx("div",{className:"w-full h-1.5 rounded-full bg-slate-100 overflow-hidden",children:s.jsx("div",{style:{width:`${a.shrinkage}%`},className:"h-full rounded-full bg-rose-500 transition-all duration-500"})})]})]}),s.jsxs("div",{className:"border-t border-slate-100 pt-2 mt-auto shrink-0 select-none",children:[s.jsxs("div",{className:"flex items-start justify-between gap-1 text-[11px] font-bold text-slate-700 min-w-0",children:[s.jsx("span",{className:"leading-tight flex-1 break-words",children:c("report.coachingInsights.workforce.workloadBalance","Workload Balance")}),s.jsx("span",{className:`${h} shrink-0 text-right leading-tight max-w-[52%] break-words`,children:u})]}),s.jsxs("div",{className:"flex h-1.5 rounded-full overflow-hidden bg-slate-100 mt-1.5",children:[s.jsx("div",{style:{width:`${i}%`},className:"bg-slate-400",title:`${c("report.coachingInsights.workforce.underUtilized","Under Utilized")} (${i}%)`}),s.jsx("div",{style:{width:`${o}%`},className:"bg-emerald-500",title:`${c("report.coachingInsights.workforce.optimal","Optimal")} (${o}%)`}),s.jsx("div",{style:{width:`${r}%`},className:"bg-rose-500",title:`${c("report.coachingInsights.workforce.overUtilized","Over Utilized")} (${r}%)`})]}),s.jsxs("div",{className:"flex justify-between text-[8px] font-bold text-slate-400 uppercase tracking-tight mt-1",children:[s.jsxs("span",{children:[c("report.coachingInsights.workforce.underUtilized","Under")," (",i,"%)"]}),s.jsxs("span",{children:[c("report.coachingInsights.workforce.optimal","Optimal")," (",o,"%)"]}),s.jsxs("span",{children:[c("report.coachingInsights.workforce.overUtilized","Over")," (",r,"%)"]})]})]})]})})})]})},na=e=>{if(!e)return"bg-white";const t=Number.parseInt(e);return Number.isNaN(t)?"bg-white":t>=18?"bg-emerald-100 text-emerald-800 font-semibold":t>=15?"bg-teal-50 text-teal-800":t>=12?"bg-amber-50/70 text-amber-800":t>=10?"bg-orange-50 text-orange-800":"bg-rose-50 text-rose-800"},ia=({cx:e,cy:t})=>s.jsx("circle",{cx:e,cy:t,r:3,fill:"#EF4444"}),ra=({coachingImpactHeatmap:e={},correlation:t={},scatterData:a=[]})=>{const{t:n}=D();return s.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-12 gap-4",children:[s.jsx("div",{className:"lg:col-span-8 h-[310px]",children:s.jsx($,{title:n("report.coachingInsights.heatmap.title","Coaching Impact Heatmap"),className:"h-full",minHeight:"310px",children:s.jsx("div",{className:"flex-grow overflow-x-auto overflow-y-auto custom-scrollbar select-none",children:s.jsxs("table",{className:"w-full text-left border-collapse min-w-[420px]",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-slate-100 text-[9px] font-bold text-slate-400 uppercase tracking-wider",children:[s.jsx("th",{className:"py-2 pr-2",children:n("report.coachingInsights.team","Team")}),e?.headers?.slice(1).map(i=>s.jsx("th",{className:"py-2 text-center text-[8px] max-w-[60px] truncate",title:i,children:i},i))]})}),s.jsx("tbody",{children:e?.rows?.map((i,o)=>s.jsxs("tr",{className:"border-b border-slate-50 text-xs text-slate-600",children:[s.jsx("td",{className:"py-2 pr-2 font-bold text-slate-800",children:i.teamName}),e?.headers?.slice(1).map(r=>s.jsx("td",{className:"py-1.5 text-center",children:s.jsx("div",{className:`mx-auto w-[36px] h-[24px] flex items-center justify-center rounded text-[10px] font-bold shadow-sm ${na(i[r])}`,children:i[r]})},r))]},`${i.teamName||o}`))})]})})})}),s.jsx("div",{className:"lg:col-span-4 h-[310px]",children:s.jsx($,{title:n("report.coachingInsights.correlation.title","Performance vs Co
1aching Correlation"),className:"h-full",minHeight:"310px",headerAction:s.jsxs("div",{className:"flex flex-col items-end bg-slate-50 px-2 py-0.5 rounded border border-slate-100 shrink-0",children:[s.jsxs("span",{className:"text-[10px] font-black text-slate-700",children:["r = ",t.coef]}),s.jsx("span",{className:"text-[7px] font-bold text-emerald-500 uppercase",children:t.description})]}),children:s.jsx("div",{className:"h-[210px] w-full relative mt-1",children:s.jsx(et,{width:"100%",height:"100%",children:s.jsxs(Yt,{margin:{top:10,right:15,left:-20,bottom:10},children:[s.jsx(tt,{strokeDasharray:"3 3",stroke:"#e2e8f0",vertical:!1}),s.jsx(at,{type:"number",dataKey:"x",name:n("report.coachingInsights.correlation.sessions","Sessions"),axisLine:!1,tickLine:!1,tick:{fontSize:9,fill:"#64748b"},dy:10,domain:[0,10]}),s.jsx(st,{type:"number",dataKey:"y",name:n("report.coachingInsights.correlation.improvement","Improvement"),axisLine:!1,tickLine:!1,tick:{fontSize:9,fill:"#64748b"},unit:"%",domain:[-10,30]}),s.jsx(nt,{cursor:{strokeDasharray:"3 3"},style:{fontSize:"11px"}}),s.jsx(he,{name:n("report.coachingInsights.correlation.agents","Agents"),data:a,fill:"#EF4444",shape:s.jsx(ia,{})})]})})})})})]})},la=[{value:"today",label:"Today"},{value:"yesterday",label:"Yesterday"},{value:"thisWeek",label:"This Week"},{value:"lastWeek",label:"Last Week"},{value:"thisMonth",label:"This Month"},{value:"lastMonth",label:"Last Month"},{value:"last30days",label:"Last 30 Days"},{value:"last60days",label:"Last 60 Days"},{value:"last90days",label:"Last 90 Days"},{value:"thisQuarter",label:"This Quarter"},{value:"lastQuarter",label:"Last Quarter"},{value:"last3months",label:"Last 3 Months"},{value:"last6months",label:"Last 6 Months"},{value:"last12months",label:"Last 12 Months"},{value:"thisYear",label:"This Year"},{value:"lastYear",label:"Last Year"}],oa=[{value:"all",label:"All Data",icon:ct},{value:"ai",label:"AI Data",icon:be},{value:"human",label:"Human Data",icon:dt}],ya=({setBreadcrumbs:e})=>{const{t,i18n:a}=D(),n=a.dir()==="rtl";l.useEffect(()=>{e&&e([{label:t("sidebar.reportsAnalytics","Reports & Analytics")},{label:t("report.coachingInsights.title","Coaching & Workforce Insights")}])},[e,t]);const{dateRange:i,setDateRange:o,customStartDate:r,customEndDate:p,handleCustomDateSelect:h,dataType:c,setDataType:g,team:u,setTeam:m,teamOptions:S,loading:b,handleRefresh:v,kpis:x,scatterData:d,coachingImpactHeatmap:f,topCoachingTopics:j,coachingImpactOverTime:C,coachingImpactByCategory:I,maxImprovement:y,agentCoachingProgress:T,agentsNeedingImmediateAttention:N,workforceInsights:A,ahtPercent:R,underPercent:G,optimalPercent:F,overPercent:P,workloadState:B,workloadColor:me,correlation:pe}=Qt(),ue=la.map(k=>({...k,label:k.value==="custom"?t("report.execSummary.filters.customRange",k.label):t(`report.execSummary.filters.${k.value}`,k.label)})),ge=oa.map(k=>{let U="humanData";return k.value==="all"?U="allData":k.value==="ai"&&(U="aiData"),{...k,label:t(`report.execSummary.filters.${U}`,k.label)}});return s.jsxs("div",{dir:n?"rtl":"ltr",className:"flex-1 flex flex-col h-full bg-slate-50 overflow-y-auto animate-fadeIn custom-scrollbar outline-none focus:outline-none font-inter",children:[s.jsxs(Ce,{title:t("report.coachingInsights.title","Coaching & Workforce Insights"),subtitle:t("report.coachingInsights.subtitle","Empower your teams with actionable insights and targeted coaching."),icon:Q,children:[s.jsx(W,{value:i,onChange:o,options:ue,icon:ht,title:t("report.coachingInsights.timeRange","Time Range"),onCustomDateSelect:h,startDate:r,endDate:p}),s.jsx(W,{value:c,onChange:g,options:ge,title:t("report.coachingInsights.dataType","Data Type"),sectionTitle:t("report.coachingInsights.dataType","Data Type")}),s.jsx(W,{value:u,onChange:m,options:S,icon:q,title:t("report.execSummary.department","Department")}),s.jsx("button",{onClick:v,disabled:b,className:`hidden sm:block p-1.5 rounded-lg border border-slate-200 text-slate-500 hover:bg-slate-50 hover:text-slate-700 transition-colors bg-white shadow-sm outline-none cursor-pointer ${b?"opacity-50 cursor-not-allowed":""}`,title:t("report.coachingInsights.refreshData","Refresh Data"),children:s.jsx(Ie,{className:`w-3.5 h-3.5 ${b?"animate-spin":""}`})}),s.jsx("button",{className:"hidden sm:flex p-1.5 rounded-lg bg-[#EF4444] hover:bg-red-600 text-white shadow-sm shadow-red-200 transition-all active:scale-95 outline-none cursor-pointer items-center justify-center",title:t("report.coachingInsights.export","Export Data"),children:s.jsx(mt,{className:"w-3.5 h-3.5"})})]}),b?s.jsx("div",{className:"flex-grow flex items-center justify-center h-full bg-slate-50 min-h-[300px]",children:s.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-4 border-[#
1EF4444] border-t-transparent"})}):s.jsxs("div",{className:"p-4 lg:p-6 select-none space-y-6",children:[s.jsx(Xt,{kpis:x}),s.jsx(ea,{topCoachingTopics:j,coachingImpactOverTime:C,coachingImpactByCategory:I,maxImprovement:y}),s.jsx(sa,{agentCoachingProgress:T,agentsNeedingImmediateAttention:N,workforceInsights:A,ahtPercent:R,underPercent:G,optimalPercent:F,overPercent:P,workloadState:B,workloadColor:me}),s.jsx(ra,{coachingImpactHeatmap:f,correlation:pe,scatterData:d})]})]})};export{ya as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.