chordia-ui 3.9.0 → 3.9.1
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.
- package/dist/DataTable2.cjs.js +1 -1
- package/dist/DataTable2.cjs.js.map +1 -1
- package/dist/DataTable2.es.js +611 -604
- package/dist/DataTable2.es.js.map +1 -1
- package/dist/PerformancePanel.cjs.js +1 -1
- package/dist/PerformancePanel.cjs.js.map +1 -1
- package/dist/PerformancePanel.es.js +601 -541
- package/dist/PerformancePanel.es.js.map +1 -1
- package/dist/components/UpdatedInteractionDetails.cjs.js +3 -3
- package/dist/components/UpdatedInteractionDetails.cjs.js.map +1 -1
- package/dist/components/UpdatedInteractionDetails.es.js +98 -92
- package/dist/components/UpdatedInteractionDetails.es.js.map +1 -1
- package/dist/pages/interactionDetails.cjs.js +2 -2
- package/dist/pages/interactionDetails.cjs.js.map +1 -1
- package/dist/pages/interactionDetails.es.js +130 -124
- package/dist/pages/interactionDetails.es.js.map +1 -1
- package/package.json +1 -1
- package/src/components/UpdatedInteractionDetails/UpdatedCoachingSynthesisCard.jsx +8 -1
- package/src/components/data/DataTable2.jsx +19 -5
- package/src/components/pages/interactionDetails/CoachingSynthesisCard.jsx +8 -1
- package/src/components/performance/PerformanceDetailsPage.jsx +62 -3
package/dist/DataTable2.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const t=require("react/jsx-runtime"),i=require("react"),T=require("./sortable.esm.cjs.js"),W=require("lucide-react"),Ze=require("react-dom"),Ft=require("./CustomFilterChips.cjs.js");require("motion/react");require("recharts");require("./AgentLiftAnalysisCard.cjs.js");require("./TourGuideTooltip.cjs.js");function jt({dateRangePicker:r,onWeekToDate:l,exportConfig:d,filterChipsConfig:f,trailingActions:v}){const[y,c]=i.useState(!1),x=i.useRef(null),D=i.useRef(null);i.useEffect(()=>{const S=F=>{D.current&&!D.current.contains(F.target)&&x.current&&!x.current.contains(F.target)&&c(!1)};if(y)return document.addEventListener("mousedown",S),()=>{document.removeEventListener("mousedown",S)}},[y]);const w=()=>{c(S=>!S)},j=S=>{c(!1),d!=null&&d.onExport&&d.onExport(S)},E=(()=>{if(!(f!=null&&f.filters))return!1;const S=f.filters,F=f.customFilters||[],G=Object.entries(S).some(([C,A])=>!!(Array.isArray(A)&&A.length||typeof A=="string"&&A.trim()!==""||A&&typeof A=="object"&&(A.min!=null||A.max!=null))),$=F.some(C=>C.active);return G||$})();return t.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[l&&t.jsxs("button",{onClick:l,className:"inline-flex items-center gap-2 rounded-lg border border-gray-300 bg-white/80 px-4 py-2.5 transition-colors hover:bg-white text-sm font-medium text-gray-900",style:{fontFamily:"var(--font-sans)"},children:[t.jsx(W.CalendarClock,{size:16}),t.jsx("span",{children:"Week to Date"})]}),r&&t.jsx(i.Suspense,{fallback:t.jsxs("div",{className:"inline-flex items-center gap-2 rounded-lg border border-gray-300 bg-white/80 px-4 py-2.5 text-sm font-medium text-gray-400",children:[t.jsx(W.CalendarClock,{size:16}),t.jsx("span",{children:"Loading..."})]}),children:r}),d&&t.jsxs("div",{className:"relative",children:[t.jsxs("button",{ref:x,onClick:w,disabled:d.isExporting,className:"inline-flex items-center justify-between gap-2 rounded-lg border border-gray-300 bg-white/80 px-4 py-2.5 transition-colors hover:bg-white text-sm font-medium text-gray-900 disabled:opacity-50 disabled:cursor-not-allowed min-w-[120px]",style:{fontFamily:"var(--font-sans)"},children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(W.Download,{size:16}),t.jsx("span",{children:d.isExporting?"Exporting...":"Export"})]}),t.jsx(W.ChevronDown,{size:16})]}),y&&t.jsx("div",{ref:D,className:"absolute top-full right-0 mt-2 bg-white rounded-lg shadow-lg border border-gray-200 py-1 z-50 min-w-[120px]",children:(d.types||["csv"]).map(S=>t.jsxs("button",{onClick:()=>j(S),className:"w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-50 transition-colors",style:{fontFamily:"var(--font-sans)"},children:["Export ",S.toUpperCase()]},S))})]}),(E||v)&&t.jsxs(t.Fragment,{children:[E&&t.jsx("div",{className:"h-9 mt-1 w-px bg-gray-300 flex-shrink-0"}),t.jsxs("div",{className:"flex items-center gap-3 justify-end",children:[E&&f&&t.jsx(Ft.CustomFilterChips,{filters:f.filters,onChange:f.onChange,onClear:f.onClear,customFilters:f.customFilters||[],fieldOptions:f.fieldOptions||{}}),v&&t.jsx("div",{className:"flex-shrink-0",children:v})]})]})]})}function Ve(r){if(r==null)return NaN;const l=String(r).replace(/[,$%]|pp/gi,"").trim(),d=parseFloat(l);return Number.isFinite(d)?d:NaN}function Yt(r){if(r==null)return NaN;const l=String(r).trim(),d=l.match(/^(\d+):(\d+)(?::(\d+))?$/);if(d){const w=+d[1],j=+d[2],B=d[3]!=null?+d[3]:null;return B!=null?w*3600+j*60+B:w*60+j}let f=0,v=!1;const y=l.match(/(\d+)\s*d\b/i),c=l.match(/(\d+)\s*h\b/i),x=l.match(/(\d+)\s*m(?!s)\b/i),D=l.match(/(\d+)\s*s\b/i);return y&&(f+=+y[1]*86400,v=!0),c&&(f+=+c[1]*3600,v=!0),x&&(f+=+x[1]*60,v=!0),D&&(f+=+D[1],v=!0),v?f:NaN}function Qt(r){if(!r)return null;const l=String(r).trim(),d=l.match(/^(\d{1,2})\/(\d{1,2})\/(\d{2,4})$/);if(d){const v=d[3].length===2?2e3+ +d[3]:+d[3],y=new Date(v,+d[1]-1,+d[2]);return isNaN(y.getTime())?null:y}const f=new Date(l);return isNaN(f.getTime())?null:f}function Zt(r){if(!r||r.length===0)return"text";const l=r.slice(0,25),d=f=>l.every(f);return d(f=>/^\d{1,2}\/\d{1,2}\/\d{2,4}$/.test(f)||/^\d{4}-\d{2}-\d{2}/.test(f))?"date":d(f=>/^\d+\s*[dhms]\b/i.test(f)||/^\d+:\d+(:\d+)?$/.test(f))?"duration":d(f=>/^-?[\d,.]+(%|pp)?$/i.test(f))?"number":"text"}function ke(r){return r?Array.isArray(r)?r.length>0:r.type==="range"?r.min!==""&&r.min!==void 0&&r.min!==null||r.max!==""&&r.max!==void 0&&r.max!==null:r.type==="durationRange"?r.minSec!==""&&r.minSec!=null||r.maxSec!==""&&r.maxSec!=null:r.type==="scoreRange"?Array.isArray(r.values)&&r.values.length>0||r.min!==""&&r.min!=null||r.max!==""&&r.max!=null:r.type==="dateRange"?!!(r.from||r.to):!1:!1}function St(r){if(r==null||r===""||isNaN(r))return"";const l=Number(r),d=Math.floor(l/3600),f=Math.floor(l%3600/60),v=Math.floor(l%60);return d>0?`${d}h ${f}m`:f>0?`${f}m ${v}s`:`${v}s`}function Vt(r){if(!r)return"";if(Array.isArray(r))return r.length===0?"":String(r[0]);if(r.type==="range"){const l=r.min!==""&&r.min!=null?r.min:null,d=r.max!==""&&r.max!=null?r.max:null;return l!=null&&d!=null?`${l} – ${d}`:l!=null?`≥ ${l}`:d!=null?`≤ ${d}`:""}if(r.type==="durationRange"){const l=r.minSec!==""&&r.minSec!=null?St(r.minSec):null,d=r.maxSec!==""&&r.maxSec!=null?St(r.maxSec):null;return l&&d?`${l} – ${d}`:l?`≥ ${l}`:d?`≤ ${d}`:""}if(r.type==="scoreRange"){if(Array.isArray(r.values)&&r.values.length>0)return r.values.slice().sort((f,v)=>f-v).join(", ");const l=r.min!==""&&r.min!=null?r.min:null,d=r.max!==""&&r.max!=null?r.max:null;return l!=null&&d!=null?`${l} – ${d}`:l!=null?`≥ ${l}`:d!=null?`≤ ${d}`:""}return r.type==="dateRange"?r.from&&r.to?`${r.from} – ${r.to}`:r.from?`from ${r.from}`:r.to?`to ${r.to}`:"":""}function en(r){return Array.isArray(r)?Math.max(0,r.length-1):0}function tn(r){return Array.isArray(r)?r.slice(1).map(String).join(", "):""}function nn({count:r,values:l}){const[d,f]=i.useState(!1);return t.jsxs("span",{onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),style:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",height:22,minWidth:22,padding:"0 6px",background:"#D8D8D8",color:"#0B0B0B",borderRadius:14,fontSize:12,fontWeight:500,lineHeight:1,cursor:"pointer"},children:["+",r,d&&t.jsx("span",{role:"tooltip",style:{position:"absolute",bottom:"calc(100% + 6px)",left:"50%",transform:"translateX(-50%)",background:"#1E2125",color:"#FFFFFF",fontFamily:"var(--font-sans)",fontSize:12,fontWeight:400,lineHeight:"20px",padding:"6px 10px",borderRadius:8,whiteSpace:"nowrap",pointerEvents:"none",zIndex:100,boxShadow:"0 6px 16px rgba(11, 11, 11, 0.18)"},children:l})]})}function rn({leftLabel:r,rightLabel:l,leftValue:d,rightValue:f,onLeftChange:v,onRightChange:y,type:c="number",placeholderLeft:x="Min",placeholderRight:D="Max"}){const w={width:"100%",height:32,borderRadius:8,border:"1px solid #D9D9D9",background:"#FFFFFF",padding:"0 10px",fontFamily:"var(--font-sans)",fontSize:14,color:"#0B0B0B",outline:"none",boxSizing:"border-box"},j={fontSize:12,color:"#676767",marginBottom:4,fontFamily:"var(--font-sans)"};return t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[t.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[t.jsx("span",{style:j,children:r}),t.jsx("input",{type:c,value:d,onChange:B=>v(B.target.value),placeholder:x,style:w})]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[t.jsx("span",{style:j,children:l}),t.jsx("input",{type:c,value:f,onChange:B=>y(B.target.value),placeholder:D,style:w})]})]})}const vt=[{id:"0-60",label:"0 to 60 Sec",minSec:0,maxSec:60},{id:"60-120",label:"1m to 2 m",minSec:60,maxSec:120},{id:"120-180",label:"2m to 3 m",minSec:120,maxSec:180},{id:"180-240",label:"3m to 4m",minSec:180,maxSec:240},{id:"240-300",label:"4m to 5m",minSec:240,maxSec:300},{id:"300+",label:"5 mins and above",minSec:300,maxSec:null}];function wt(r){if(r==null||r==="")return null;const l=String(r).trim().match(/^(\d{1,3}):(\d{2})$/);if(l)return Number(l[1])*60+Number(l[2]);const d=Number(r);return Number.isFinite(d)?d:null}function Ye({children:r}){return t.jsx("div",{style:{fontSize:14,fontWeight:600,color:"#0B0B0B",lineHeight:"20px",padding:"4px 0 2px",fontFamily:"var(--font-sans)"},children:r})}function Qe({minValue:r,maxValue:l,onMinChange:d,onMaxChange:f,inputType:v="number",inputMode:y="decimal",step:c,placeholder:x="0.0",unit:D}){const w={width:"100%",height:30,border:"1px solid #ACADAD",borderRadius:4,padding:"6px 10px",fontSize:13,color:"#0B0B0B",fontFamily:"var(--font-sans)",outline:"none",boxSizing:"border-box"};return t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[t.jsxs("div",{style:{display:"flex",alignItems:"flex-end",gap:8},children:[t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,flex:1,minWidth:0},children:[t.jsx("span",{style:{fontSize:12,color:"#2E3236",fontFamily:"var(--font-sans)"},children:"Min From"}),t.jsx("input",{type:v,inputMode:y,step:c,placeholder:x,value:r,onChange:j=>d(j.target.value),style:w})]}),t.jsx("span",{style:{fontSize:12,fontWeight:600,color:"#323232",paddingBottom:8,fontFamily:"var(--font-sans)"},children:"to"}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,flex:1,minWidth:0},children:[t.jsx("span",{style:{fontSize:12,color:"#2E3236",fontFamily:"var(--font-sans)"},children:"Max"}),t.jsx("input",{type:v,inputMode:y,step:c,placeholder:x,value:l,onChange:j=>f(j.target.value),style:w})]})]}),D&&t.jsxs("span",{style:{fontSize:11,color:"#676767",fontFamily:"var(--font-sans)"},children:["Input values in ",D==="sec"?"seconds":D]})]})}function sn({column:r,columnId:l,filterType:d="text",position:f,popoverRef:v,distinctValues:y,initialValue:c,onApply:x,onCancel:D}){const w=d==="text",j=d==="number",B=d==="date",E=d==="duration",S=d==="score",F=i.useMemo(()=>{if(!S||!Array.isArray(y)||y.length===0)return!1;let p=1/0,h=-1/0;for(const g of y){const P=Ve(g);Number.isFinite(P)&&(P<p&&(p=P),P>h&&(h=P))}return Number.isFinite(p)&&Number.isFinite(h)&&p>=0&&h<=5},[S,y]),[G,$]=i.useState(()=>w?new Set(Array.isArray(c)?c:[]):new Set),[C,A]=i.useState(""),[oe,ce]=i.useState(()=>j&&(c==null?void 0:c.type)==="range"&&c.min!=null?c.min:""),[_,N]=i.useState(()=>j&&(c==null?void 0:c.type)==="range"&&c.max!=null?c.max:""),[Y,Q]=i.useState(new Set),[O,K]=i.useState(()=>E&&(c==null?void 0:c.type)==="durationRange"&&c.minSec!=null&&c.minSec!==""?String(c.minSec):""),[de,U]=i.useState(()=>E&&(c==null?void 0:c.type)==="durationRange"&&c.maxSec!=null&&c.maxSec!==""?String(c.maxSec):""),[Z,ue]=i.useState(()=>S&&(c==null?void 0:c.type)==="scoreRange"&&Array.isArray(c.values)?new Set(c.values):new Set),[J,ie]=i.useState(()=>S&&(c==null?void 0:c.type)==="scoreRange"&&c.min!=null&&c.min!==""?String(c.min):""),[fe,Ce]=i.useState(()=>S&&(c==null?void 0:c.type)==="scoreRange"&&c.max!=null&&c.max!==""?String(c.max):""),[X,M]=i.useState(()=>B&&(c==null?void 0:c.type)==="dateRange"&&c.from||""),[ee,V]=i.useState(()=>B&&(c==null?void 0:c.type)==="dateRange"&&c.to||"");i.useEffect(()=>{w&&$(new Set(Array.isArray(c)?c:[]))},[l,w]);const ae=i.useMemo(()=>{const p=C.trim().toLowerCase();return p?y.filter(h=>String(h).toLowerCase().includes(p)):y},[y,C]),H=p=>{$(h=>{const g=new Set(h);return g.has(p)?g.delete(p):g.add(p),g})},be=()=>{w&&$(new Set),j&&(ce(""),N("")),E&&(Q(new Set),K(""),U("")),S&&(ue(new Set),ie(""),Ce("")),B&&(M(""),V("")),A("")},pe=p=>{Q(h=>{const g=new Set(h);return g.has(p)?g.delete(p):g.add(p),g})},De=p=>{ue(h=>{const g=new Set(h);return g.has(p)?g.delete(p):g.add(p),g})},R=()=>{if(w)return x(Array.from(G));if(j)return x({type:"range",min:oe===""?"":Number(oe),max:_===""?"":Number(_)});if(E){const p=wt(O),h=wt(de),g=p!=null||h!=null;let P="",te="";if(g)P=p??"",te=h??"";else if(Y.size>0){const me=vt.filter(ne=>Y.has(ne.id));P=Math.min(...me.map(ne=>ne.minSec)),te=me.some(ne=>ne.maxSec==null)?"":Math.max(...me.map(ne=>ne.maxSec))}return x({type:"durationRange",minSec:P,maxSec:te})}if(S){const p=J===""?null:Number(J),h=fe===""?null:Number(fe);return p!=null||h!=null?x({type:"scoreRange",values:[],min:p!=null&&Number.isFinite(p)?p:"",max:h!=null&&Number.isFinite(h)?h:""}):x({type:"scoreRange",values:Array.from(Z).sort((P,te)=>P-te),min:"",max:""})}if(B)return x({type:"dateRange",from:X,to:ee})};return t.jsxs("div",{ref:v,role:"dialog","aria-label":`Filter ${r.label||l}`,style:{position:"fixed",top:f.top,left:f.left,zIndex:50,width:w?240:220,background:"#FFFFFF",border:"1px solid #E6E6E6",borderRadius:10,padding:12,display:"flex",flexDirection:"column",gap:10,boxShadow:"0 8px 24px rgba(11, 11, 11, 0.10)",fontFamily:"var(--font-sans)"},children:[w&&t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{background:"#D8D8D8",height:32,borderRadius:10,padding:1,display:"flex",alignItems:"center"},children:t.jsxs("div",{style:{background:"#FFFFFF",flex:1,height:30,borderRadius:10,display:"flex",alignItems:"center",gap:8,padding:"0 8px"},children:[t.jsx(W.Search,{size:16,color:"#989898",strokeWidth:2}),t.jsx("input",{autoFocus:!0,type:"text",value:C,onChange:p=>A(p.target.value),placeholder:"Search",style:{flex:1,border:"none",outline:"none",background:"transparent",fontSize:14,color:"#0B0B0B",minWidth:0,fontFamily:"var(--font-sans)"}})]})}),t.jsx("div",{style:{maxHeight:220,overflowY:"auto",display:"flex",flexDirection:"column",gap:4},children:ae.length===0?t.jsx("div",{style:{fontSize:13,color:"#676767",padding:"8px 4px",textAlign:"center"},children:"No values"}):ae.map(p=>{const h=G.has(p);return t.jsxs("label",{style:{display:"flex",alignItems:"center",gap:12,padding:"6px 4px",cursor:"pointer",borderRadius:6},children:[t.jsx("span",{style:{width:20,height:20,borderRadius:4,display:"inline-flex",alignItems:"center",justifyContent:"center",background:h?"#0B0B0B":"#FFFFFF",border:`1px solid ${h?"#0B0B0B":"#676767"}`,flexShrink:0},children:h&&t.jsx(W.Check,{size:14,color:"#FFFFFF",strokeWidth:3})}),t.jsx("input",{type:"checkbox",checked:h,onChange:()=>H(p),style:{position:"absolute",opacity:0,pointerEvents:"none"},tabIndex:-1}),t.jsx("span",{onClick:g=>{g.preventDefault(),H(p)},style:{fontSize:14,lineHeight:"20px",color:"#0B0B0B",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p})]},p)})})]}),j&&t.jsxs(t.Fragment,{children:[t.jsx(Ye,{children:r.label||"Filter"}),t.jsx(Qe,{minValue:oe,maxValue:_,onMinChange:ce,onMaxChange:N})]}),E&&t.jsxs(t.Fragment,{children:[t.jsx(Ye,{children:r.label||"Duration"}),r.filterShowPresets===!0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:vt.map(p=>{const h=Y.has(p.id);return t.jsxs("div",{role:"checkbox","aria-checked":h,tabIndex:0,onClick:()=>pe(p.id),onKeyDown:g=>{(g.key===" "||g.key==="Enter")&&(g.preventDefault(),pe(p.id))},style:{display:"flex",alignItems:"center",gap:12,cursor:"pointer",userSelect:"none"},children:[t.jsx("span",{style:{width:20,height:20,borderRadius:4,display:"inline-flex",alignItems:"center",justifyContent:"center",background:h?"#0B0B0B":"#FFFFFF",border:`1px solid ${h?"#0B0B0B":"#676767"}`,flexShrink:0},children:h&&t.jsx(W.Check,{size:14,color:"#FFFFFF",strokeWidth:3})}),t.jsx("span",{style:{fontSize:14,lineHeight:"20px",color:"#0B0B0B",fontFamily:"var(--font-sans)"},children:p.label})]},p.id)})}),t.jsx("div",{style:{height:1,background:"#D9D9D9",margin:"0 -12px"}}),t.jsx("div",{style:{fontSize:14,fontWeight:500,color:"#0B0B0B",lineHeight:"20px",padding:"4px 0",fontFamily:"var(--font-sans)"},children:"Custom Range"})]}),t.jsx(Qe,{minValue:O,maxValue:de,onMinChange:K,onMaxChange:U,inputType:"number",inputMode:"numeric",placeholder:"0",unit:"sec"})]}),S&&t.jsxs(t.Fragment,{children:[t.jsx(Ye,{children:r.label||"Score"}),F&&r.filterShowPresets===!0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[1,2,3,4,5].map(p=>{const h=Z.has(p);return t.jsxs("div",{role:"checkbox","aria-checked":h,tabIndex:0,onClick:()=>De(p),onKeyDown:g=>{(g.key===" "||g.key==="Enter")&&(g.preventDefault(),De(p))},style:{display:"flex",alignItems:"center",gap:12,cursor:"pointer",userSelect:"none"},children:[t.jsx("span",{style:{width:20,height:20,borderRadius:4,display:"inline-flex",alignItems:"center",justifyContent:"center",background:h?"#0B0B0B":"#FFFFFF",border:`1px solid ${h?"#0B0B0B":"#676767"}`,flexShrink:0},children:h&&t.jsx(W.Check,{size:14,color:"#FFFFFF",strokeWidth:3})}),t.jsx("span",{style:{fontSize:14,lineHeight:"20px",color:"#0B0B0B",fontFamily:"var(--font-sans)"},children:p})]},p)})}),t.jsx("div",{style:{height:1,background:"#D9D9D9",margin:"0 -12px"}})]}),F&&r.filterShowPresets===!0&&t.jsx("div",{style:{fontSize:14,fontWeight:500,color:"#0B0B0B",lineHeight:"20px",padding:"4px 0",fontFamily:"var(--font-sans)"},children:"Custom Range"}),t.jsx(Qe,{minValue:J,maxValue:fe,onMinChange:ie,onMaxChange:Ce,step:"0.1"})]}),B&&t.jsx(rn,{leftLabel:"From",rightLabel:"To",leftValue:X,rightValue:ee,onLeftChange:M,onRightChange:V,type:"date",placeholderLeft:"",placeholderRight:""}),t.jsx("div",{style:{height:1,background:"#D9D9D9",margin:"0 -12px"}}),t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[t.jsx("button",{type:"button",onClick:be,style:{background:"transparent",border:"none",padding:0,cursor:"pointer",fontSize:14,fontWeight:500,color:"#323232",fontFamily:"var(--font-sans)"},children:E&&r.filterShowPresets===!0||S&&F&&r.filterShowPresets===!0?"View All":"Reset"}),t.jsx("button",{type:"button",onClick:R,style:{background:"#0B0B0B",color:"#FFFFFF",border:"none",borderRadius:10,height:28,padding:"0 14px",fontSize:14,fontWeight:500,cursor:"pointer",fontFamily:"var(--font-sans)"},children:"Apply"})]})]})}const on=()=>({userData:{email:"anonymous"}}),an=r=>t.jsx("img",{...r});function ln({children:r,content:l,direction:d="top",align:f="center",styling:v,indicatorColor:y}){const c=typeof l=="string"?l:l!=null?String(l):"",x=typeof y=="string"&&(y.startsWith("#")||y.startsWith("rgb")||y.startsWith("hsl")||y.startsWith("var("))?y:"var(--Grey-Strong, #2E3236)",[D,w]=i.useState(!1),[j,B]=i.useState(!1),[E,S]=i.useState({top:0,left:0,arrowLeft:0,placement:"top"}),F=i.useRef(null),G=i.useRef(null);if(!c)return r;i.useEffect(()=>{B(!0)},[]);const $=i.useCallback(()=>{if(!F.current||!G.current||typeof window>"u")return;const C=F.current.getBoundingClientRect(),A=G.current.getBoundingClientRect(),oe=window.innerWidth,ce=window.innerHeight,_=8,N=10,Y=A.width,Q=A.height,O=C.top,K=ce-C.bottom,de=d==="bottom"?"bottom":"top";let U=de;de==="top"&&O<Q+N+_&&K>O?U="bottom":de==="bottom"&&K<Q+N+_&&O>K&&(U="top");let Z=C.left+C.width/2;f==="start"&&(Z=C.left),f==="end"&&(Z=C.right);let ue=U==="top"?C.top-Q-N:C.bottom+N,J=f==="start"?Z:f==="end"?Z-Y:Z-Y/2;ue=Math.max(_,Math.min(ue,ce-Q-_)),J=Math.max(_,Math.min(J,oe-Y-_));const ie=Math.max(10,Math.min(Z-J,Y-10));S({top:ue,left:J,arrowLeft:ie,placement:U})},[f,d]);return i.useEffect(()=>{if(!D||!j)return;$();const C=()=>$();return window.addEventListener("resize",C),window.addEventListener("scroll",C,!0),()=>{window.removeEventListener("resize",C),window.removeEventListener("scroll",C,!0)}},[D,j,$]),t.jsxs("span",{ref:F,style:{display:"block",width:"100%"},onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),children:[r,D&&j&&Ze.createPortal(t.jsxs("span",{ref:G,style:{position:"fixed",top:`${E.top}px`,left:`${E.left}px`,background:"var(--Grey-Strong, #2E3236)",color:"var(--Grey-White, #FFF)",fontSize:"12px",lineHeight:1.3,fontWeight:500,padding:"8px 10px",borderRadius:"6px",whiteSpace:"normal",maxWidth:"320px",width:"max-content",boxShadow:"0 6px 18px rgba(0, 0, 0, 0.2)",zIndex:99999,pointerEvents:"none",...typeof v=="object"?v:{}},children:[c,t.jsx("span",{style:{position:"absolute",left:`${E.arrowLeft}px`,transform:"translateX(-50%)",width:0,height:0,borderLeft:"6px solid transparent",borderRight:"6px solid transparent",...E.placement==="top"?{top:"100%",borderTop:`7px solid ${x}`}:{bottom:"100%",borderBottom:`7px solid ${x}`}}})]}),document.body)]})}function cn({data:r=[],columns:l=[],initialPageSize:d=10,onRowClick:f,totalCount:v=null,page:y=null,pageSize:c=null,onPageChange:x=null,onPageSizeChange:D=null,onFilterChange:w=null,columnFilters:j=null,onMaxColumnsError:B=null,onSort:E=null,sortFields:S=[],tableId:F=null,isLoading:G=!1,filtersConfig:$=null,columnResizeMinWidth:C=120,columnResizeMaxWidth:A=280,onVisibleColumnsChange:oe=null,hideColumnPicker:ce=!1}){var bt;const{userData:_}=on(),N=(_==null?void 0:_.email)||"anonymous",Y=i.memo(({children:e,content:n,className:s=""})=>{const a=i.useRef(null),[o,m]=i.useState(!1);i.useEffect(()=>{const b=()=>{if(a.current){const L=a.current.scrollWidth>a.current.clientWidth;m(L)}};b();const I=setTimeout(b,0);return window.addEventListener("resize",b),()=>{clearTimeout(I),window.removeEventListener("resize",b)}},[e,n]);const u=t.jsx("span",{className:`truncate block ${s}`,ref:a,children:e});return o&&n?t.jsx(ln,{content:n,styling:"bg-green-2 text-gray-900 px-3 py-2 text-sm rounded-lg shadow-md border border-gray-300 max-w-xs whitespace-normal",indicatorColor:"bg-green-2",direction:"top",children:u}):u});Y.displayName="TruncatedCell";const Q=v!==null&&x!==null,O=w!==null,K=E!==null,[de,U]=i.useState(1),[Z,ue]=i.useState(d),J=y!==null?y:de,ie=c!==null?c:Z,fe=e=>{x?x(e):U(e)},Ce=e=>{D?D(e):ue(e)},X=50,M="action",ee=i.useRef(!1),V=i.useMemo(()=>F?`dataTable_columns_${F}:${N}`:`dataTable_columns_${l.map(n=>n.id||n.key).sort().join("_")}:${N}`,[F,l,N]),ae=i.useMemo(()=>F?`dataTable_manual_change_${F}:${N}`:null,[F,N]);i.useCallback((e,n)=>{if(typeof window>"u"||!e||!n||n.length===0)return null;try{const s=localStorage.getItem(e);if(s){const o=JSON.parse(s).filter(m=>n.some(u=>(u.id||u.key)===m));if(o.length>0)return o}}catch(s){console.warn("Failed to load saved columns from localStorage:",s)}return null},[]);const[H,be]=i.useState({}),[pe,De]=i.useState(""),[R,p]=i.useState(null),[h,g]=i.useState({top:0,left:0}),P=i.useRef(null),te=i.useRef({}),[me,et]=i.useState(null),[ne,tt]=i.useState("asc"),Pe=i.useCallback((e,n)=>{const s=ke(n);be(a=>{const o={...a};return s?o[e]=n:delete o[e],o}),x?x(1):U(1),O&&w&&w(s?{...H,[e]:n}:Object.fromEntries(Object.entries(H).filter(([a])=>a!==e)))},[H,w,O,x]),kt=i.useCallback(()=>{be({}),De(""),x?x(1):U(1),O&&w&&w({})},[w,O,x]),Te=i.useCallback(e=>{if(!r||r.length===0)return[];const n=new Set,s=[];for(const a of r){const o=a[e];if(o==null)continue;const m=typeof o=="object"?JSON.stringify(o):String(o);n.has(m)||(n.add(m),s.push(m))}return s.sort((a,o)=>a.localeCompare(o))},[r]),Ct=i.useCallback(e=>{const n=l.find(s=>q(s)===e);return n&&n.filterType?n.filterType:Zt(Te(e))},[l,Te]),Re=i.useCallback(e=>{const a=typeof window<"u"?window.innerWidth:1/0;let o=e.left;return o+280>a-8&&(o=Math.max(8,e.right-280)),{top:e.bottom+6,left:o}},[]),Dt=i.useCallback((e,n)=>{if(!n){p(e);return}const s=n.getBoundingClientRect();g(Re(s)),p(a=>a===e?null:e)},[Re]);i.useEffect(()=>{if(!R)return;const e=n=>{if(P.current&&P.current.contains(n.target))return;const s=te.current[R];s&&s.contains(n.target)||p(null)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[R]),i.useEffect(()=>{if(!R)return;const e=()=>{const n=te.current[R];if(!n)return;const s=n.getBoundingClientRect();g(Re(s))};return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[R,Re]),i.useLayoutEffect(()=>{if(!R)return;const e=P.current,n=te.current[R];if(!e||!n)return;const s=e.offsetWidth,a=n.getBoundingClientRect(),o=8,m=typeof window<"u"?window.innerWidth:1/0;if(!(a.left+s>m-o))return;const b=Math.max(o,a.right-s);g(I=>I.left===b?I:{...I,left:b})},[R,h.top]);const nt=i.useCallback(e=>!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([,n])=>n==null?!1:typeof n=="string"?n.trim()!=="":!0)),[]),rt=i.useCallback((e,n)=>{const s=Object.keys(e||{}),a=Object.keys(n||{});return s.length!==a.length?!1:s.every(o=>e[o]===n[o])},[]);i.useEffect(()=>{if(!O||j===null)return;const e=nt(j);be(n=>rt(n,e)?n:e)},[O,j,nt,rt]),i.useCallback((e,n)=>e==="csat_score"&&n==="evaluation.csat_score"?n:e,[]);const Se=K&&S.length>0?S[0][0]:me,Ee=K&&S.length>0?S[0][1]:ne,[dn,st]=i.useState(()=>l.map(e=>e.id||e.key)),re=i.useCallback(e=>{if(!e||e.length===0)return e;let n=Array.from(new Set(e));n.length>X&&(n=n.slice(0,X));const a=l.map(u=>u.id||u.key).includes(M);return!n.includes(M)&&a&&(n.length>=X?n=[...n.slice(0,X-1),M]:n=[...n,M]),[...n.filter(u=>u!==M),M]},[l]),[z,ve]=i.useState(()=>{if(typeof window<"u"&&F)try{if(localStorage.getItem(`dataTable_manual_change_${F}:${N}`)==="true"){const a=localStorage.getItem(`dataTable_columns_${F}:${N}`);if(a){const o=JSON.parse(a);if(Array.isArray(o)&&o.length>0){ee.current=!0;const m=o.filter(u=>l.some(b=>(b.id||b.key)===u));if(m.length>0)return m.slice(0,X)}}}}catch(s){console.warn("Failed to load saved columns from localStorage:",s)}const n=l.map(s=>s.id||s.key).slice(0,X);return re(n)}),[se,_e]=i.useState(!1),[he,Me]=i.useState([]),[ot,Rt]=i.useState({top:0,left:0,width:0}),[it,at]=i.useState(new Set),[lt,ct]=i.useState(new Set),ze=i.useRef(null);ze.current===null&&(ze.current=[...z]);const[le,He]=i.useState(null),[Et,Be]=i.useState(null),xe=i.useRef(null),qe=i.useRef(null),Ke=i.useRef(null),[dt,Xe]=i.useState(null),[Ge,Mt]=i.useState({}),zt=i.useRef(null),Ne=i.useRef(null),q=e=>e.id||e.key,We=i.useCallback(e=>{if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){const n=e.trim();if(n.endsWith("px")){const a=parseFloat(n);return Number.isFinite(a)?a:null}const s=parseFloat(n);return Number.isFinite(s)&&`${s}`===n?s:null}return null},[]),ut=i.useCallback((e,n)=>Ge[e]!=null?`${Ge[e]}px`:typeof n=="number"?`${n}px`:n||"auto",[Ge]),$e=i.useCallback(e=>{if(!Ne.current)return;const{columnId:n,startX:s,startWidth:a,minWidth:o,maxWidth:m}=Ne.current,u=e.clientX-s,b=Math.round(a+u),I=Math.min(m,Math.max(o,b));Mt(L=>({...L,[n]:I}))},[]),we=i.useCallback(()=>{Ne.current=null,document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",$e),document.removeEventListener("mouseup",we)},[$e]),Bt=i.useCallback((e,n,s)=>{var Le;e.preventDefault(),e.stopPropagation();const a=n.id||n.key,o=We(n.minWidth)??C,m=We(n.maxWidth)??A,u=Math.min(o,m),b=Math.max(o,m),I=((Le=e.currentTarget.closest("th"))==null?void 0:Le.getBoundingClientRect().width)||0,L=We(s),je=L??Math.max(u,Math.round(I)||u),Ue=Math.min(b,Math.max(u,je));Ne.current={columnId:a,startX:e.clientX,startWidth:Ue,minWidth:u,maxWidth:b},document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",$e),document.addEventListener("mouseup",we)},[A,C,$e,we,We]);i.useEffect(()=>()=>we(),[we]);const Nt=T.useSensors(T.useSensor(T.PointerSensor),T.useSensor(T.KeyboardSensor,{coordinateGetter:T.sortableKeyboardCoordinates})),Wt=e=>{const{active:n,over:s}=e;if(s&&n.id!==s.id){if(n.id===M||s.id===M){pt("Cannot drop columns on the Action column"),Xe(null);return}ee.current=!0,ve(a=>{const o=a.indexOf(n.id),m=a.indexOf(s.id);if(o!==-1&&m!==-1){const u=T.arrayMove(a,o,m),b=re(u);return mt(b),b}return a}),st(a=>{const o=a.indexOf(n.id),m=a.indexOf(s.id);return T.arrayMove(a,o,m)})}Xe(null)},$t=e=>{Xe(e.active.id)},Ae=i.useMemo(()=>{if(O)return r||[];if(!r||r.length===0)return[];const e=pe.trim().toLowerCase(),n=Object.entries(H).filter(([,s])=>ke(s));return r.filter(s=>{for(const[a,o]of n){const m=s[a];if(m==null)return!1;if(Array.isArray(o)){const u=String(m);if(!o.some(b=>String(b)===u))return!1;continue}if(o.type==="range"){const u=Ve(m);if(isNaN(u)||o.min!==""&&o.min!=null&&u<Number(o.min)||o.max!==""&&o.max!=null&&u>Number(o.max))return!1;continue}if(o.type==="durationRange"){const u=Yt(m);if(isNaN(u)||o.minSec!==""&&o.minSec!=null&&u<Number(o.minSec)||o.maxSec!==""&&o.maxSec!=null&&u>Number(o.maxSec))return!1;continue}if(o.type==="scoreRange"){const u=Ve(m);if(isNaN(u))return!1;if(Array.isArray(o.values)&&o.values.length>0){const b=Math.floor(u);if(!o.values.includes(b))return!1;continue}if(o.min!==""&&o.min!=null&&u<Number(o.min)||o.max!==""&&o.max!=null&&u>Number(o.max))return!1;continue}if(o.type==="dateRange"){const u=Qt(m);if(!u)return!1;if(o.from){const b=new Date(o.from+"T00:00:00");if(u<b)return!1}if(o.to){const b=new Date(o.to+"T23:59:59");if(u>b)return!1}continue}}return!(e&&!Object.values(s).some(o=>o==null?!1:String(o).toLowerCase().includes(e)))})},[r,H,pe,O]),Fe=i.useMemo(()=>K||!Se?Ae:[...Ae].sort((e,n)=>{const s=e[Se],a=n[Se];if(s==null)return 1;if(a==null)return-1;if(typeof s=="number"&&typeof a=="number")return Ee==="asc"?s-a:a-s;const o=String(s).toLowerCase(),m=String(a).toLowerCase();return Ee==="asc"?o.localeCompare(m):m.localeCompare(o)}),[Ae,Se,Ee,K]),Ie=i.useMemo(()=>{if(Q)return Fe;{const e=(J-1)*ie,n=e+ie;return Fe.slice(e,n)}},[Fe,J,ie,Q]),ft=e=>{K&&E?(E(e),x?x(1):U(1)):(me===e?tt(ne==="asc"?"desc":"asc"):(et(e),tt("asc")),fe(1))},At=(e,n)=>{const s=(n||"").split(/\s+/).map(a=>a.trim()).filter(Boolean);Pe(e,s)},pt=e=>{Ke.current||(typeof B=="function"&&B(e),Ke.current=setTimeout(()=>{Ke.current=null},3e3))},mt=i.useCallback(e=>{if(typeof window<"u"&&V&&e.length>0&&ee.current)try{localStorage.setItem(V,JSON.stringify(e)),ae&&localStorage.setItem(ae,"true")}catch(n){console.warn("Failed to save columns to localStorage:",n)}},[V,ae]),It=e=>{e!==M&&Me(n=>n.includes(e)?n.length===1?n:n.filter(s=>s!==e):n.length>=X?(pt("Maximum 9 column selection allowed"),n):re([...n,e]))},Lt=(e,n)=>{he[n]!==M&&He(n)},Ot=()=>{He(null),Be(null)},Pt=(e,n)=>{e.preventDefault(),le!==null&&le!==n&&Be(n)},Tt=()=>{Be(null)},_t=(e,n)=>{e.preventDefault(),le!==null&&le!==n&&he[n]!==M&&he[le]!==M&&Me(s=>{const a=T.arrayMove(s,le,n);return re(a)}),He(null),Be(null)};i.useEffect(()=>{st(e=>{const n=z.filter(o=>e.includes(o)),s=z.filter(o=>!e.includes(o)),a=e.filter(o=>!z.includes(o));return[...n,...s,...a]})},[z]),i.useEffect(()=>{if(typeof window<"u"&&V&&z.length>0&&ee.current)try{const e=re(z);localStorage.setItem(V,JSON.stringify(e)),ae&&localStorage.setItem(ae,"true")}catch(e){console.warn("Failed to save columns to localStorage:",e)}},[z,V,ae]),i.useEffect(()=>{oe&&oe(z.filter(e=>e!==M))},[z,oe]),i.useEffect(()=>{if(l.length>0&&z.length===0){if(typeof window<"u"&&F)try{if(localStorage.getItem(`dataTable_manual_change_${F}:${N}`)==="true"){const s=localStorage.getItem(`dataTable_columns_${F}:${N}`);if(s){const a=JSON.parse(s);if(Array.isArray(a)&&a.length>0){const o=a.filter(m=>l.some(u=>(u.id||u.key)===m));if(o.length>0){ee.current=!0,ve(o.slice(0,X));return}}}}}catch(n){console.warn("Failed to load saved columns from localStorage:",n)}const e=l.map(n=>n.id||n.key);ve(re(e.slice(0,X)))}},[l,F,N,re]);const ge=i.useMemo(()=>{const e=z.map(n=>l.find(s=>q(s)===n)).filter(Boolean);return re(e.map(q)).map(n=>l.find(s=>q(s)===n)).filter(Boolean)},[l,z]);i.useMemo(()=>ge.some(e=>e.filterable===!0),[ge]),i.useEffect(()=>{if(!se||!xe.current)return;const e=()=>{if(xe.current){const n=xe.current.getBoundingClientRect(),s=217,a=Math.max(8,n.right-s);Rt({top:n.bottom,left:a,width:Math.max(n.width||220,220)})}};return e(),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[se]),i.useEffect(()=>{const e=n=>{se&&xe.current&&!xe.current.contains(n.target)&&qe.current&&!qe.current.contains(n.target)&&_e(!1)};if(se)return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[se]),i.useEffect(()=>{se&&(Me(z),at(new Set),ct(new Set))},[se,z]),z.length===1?(bt=l.find(e=>(e.id||e.key)===z[0]))!=null&&bt.label:`${z.length}`;function Ht({column:e,isHeaderRow:n=!0}){const s=q(e),a=s===M,o=ut(s,e.width),[m,u]=i.useState(!1),{attributes:b,listeners:I,setNodeRef:L,transform:je,transition:Ue,isDragging:Le}=T.useSortable({id:s}),Kt={transform:T.CSS.Transform.toString(je),transition:Ue,opacity:Le?.5:1,width:o,minWidth:o};let ye=!1;if(K&&S.length>0){const k=S[0][0];(k===s||k==="csat_score"&&s==="evaluation.csat_score")&&(ye=!0)}else ye=Se===s;const Xt=Ee==="asc",Gt=e.filterable===!0;if(!n)return t.jsx("th",{style:{width:o,minWidth:o,backgroundColor:"var(--primary-foreground)",borderRight:"1px solid #e6e6e6",borderBottom:"1px solid #e6e6e6",boxSizing:"border-box"},className:"sticky top-[57px] z-10 border-b border-[var(--border-strong)] px-4 py-2 text-left",children:Gt?t.jsxs("div",{className:"relative",children:[t.jsx(Filter,{size:12,className:"absolute left-2 top-1/2 -translate-y-1/2 text-[var(--text-faint)] pointer-events-none"}),t.jsx("input",{type:"text",placeholder:"Filter...",value:H[s]||"",onChange:k=>{k.stopPropagation(),At(s,k.target.value)},onKeyDown:k=>k.stopPropagation(),onMouseDown:k=>k.stopPropagation(),className:"w-full pl-7 pr-2 py-1.5 text-xs border border-[var(--border)] rounded text-[var(--text-ink)] placeholder:text-[var(--text-faint)] focus:outline-none focus:border-[var(--border-hover)] focus:ring-1 focus:ring-[var(--focus)] transition-colors",style:{fontFamily:"var(--font-sans)",backgroundColor:"var(--primary-foreground)"},autoComplete:"off"})]}):t.jsx("div",{className:"h-[34px]"})});const Je=R===s,Oe=ke(H[s]),Ut=e.sortable!==!1&&(m||ye),Jt=e.filterable!==!1&&!a&&(m||Je||Oe);return t.jsxs("th",{ref:L,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),style:{...Kt,padding:"0 12px",height:36,textAlign:a?"center":"left",fontWeight:500,fontSize:"14px",letterSpacing:"normal",textTransform:"none",color:"#0b0b0b",cursor:e.sortable!==!1?"pointer":"default",width:o,...typeof o=="string"&&o.endsWith("px")?{maxWidth:o}:{},borderRight:"1px solid #e6e6e6",boxSizing:"border-box",userSelect:"none",whiteSpace:"nowrap",wordBreak:"normal",overflowWrap:"normal",verticalAlign:"middle",background:m||Je?"#e6e6e6":"#f2f2f0",borderBottom:"1px solid #e6e6e6",position:"sticky",top:0,zIndex:10,fontFamily:"var(--font-sans)",transition:"background 100ms ease"},children:[!a&&t.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:"50%",transform:"translateY(-50%)",width:1,height:16,background:"#e6e6e6",pointerEvents:"none",zIndex:1}}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",justifyContent:a?"center":"flex-start",position:"relative",minHeight:20,minWidth:0,width:"100%",overflow:"hidden"},children:[!a&&t.jsx("div",{...b,...I,style:{cursor:"grab",color:"rgba(11, 11, 11, 0.36)",display:"inline-flex",alignItems:"center",visibility:m?"visible":"hidden",flexShrink:0},children:t.jsx(W.GripVertical,{size:14})}),t.jsx("span",{onClick:()=>e.sortable!==!1&&ft(s),title:typeof e.label=="string"?e.label:void 0,style:{cursor:e.sortable!==!1?"pointer":"default",flex:a?"none":1,minWidth:0,lineHeight:"20px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.label}),Ut&&t.jsx("button",{type:"button",onClick:k=>{k.stopPropagation(),ft(s)},title:"Sort",style:{background:"transparent",border:"none",padding:4,borderRadius:4,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",color:ye?"#0b0b0b":"rgba(11, 11, 11, 0.55)",flexShrink:0},children:ye?Xt?t.jsx(W.ArrowUp,{size:14,strokeWidth:1.75}):t.jsx(W.ArrowDown,{size:14,strokeWidth:1.75}):t.jsx(W.ArrowUpDown,{size:14,strokeWidth:1.75})}),Jt&&t.jsxs("button",{type:"button",ref:k=>{te.current[s]=k},onClick:k=>{k.stopPropagation(),Dt(s,k.currentTarget)},title:"Filter",style:{position:"relative",background:Je||Oe?"#D8D8D8":"transparent",border:"none",padding:4,borderRadius:4,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",color:Oe?"#0b0b0b":"rgba(11, 11, 11, 0.7)",flexShrink:0},children:[t.jsx(W.ListFilter,{size:14,strokeWidth:1.75}),Oe&&t.jsx("span",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,width:6,height:6,borderRadius:"50%",background:"#0B0B0B"}})]})]}),!a&&t.jsx("span",{"aria-hidden":"true",style:{position:"absolute",right:0,top:"50%",transform:"translateY(-50%)",width:1,height:16,background:"#e6e6e6",pointerEvents:"none",zIndex:1}}),!a&&t.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":`Resize ${e.label||s} column`,title:"Drag to resize column",onMouseDown:k=>Bt(k,e,o),onClick:k=>k.stopPropagation(),onMouseEnter:k=>{k.currentTarget.style.background="rgba(30, 33, 37, 0.18)"},onMouseLeave:k=>{k.currentTarget.style.background="transparent"},style:{position:"absolute",top:0,right:-2,width:4,height:"100%",cursor:"col-resize",zIndex:4,background:"transparent"}})]})}const ht=dt?l.find(e=>q(e)===dt):null,xt=({col:e,columnId:n,isSelected:s,draggable:a,isAction:o,actualIndex:m})=>{const u=a&&le===m,b=a&&Et===m&&le!==null&&le!==m;s?lt.has(n):it.has(n);const I=s?!lt.has(n):it.has(n);return t.jsxs("div",{draggable:a,onDragStart:a?L=>Lt(L,m):void 0,onDragEnd:a?Ot:void 0,onDragOver:a?L=>Pt(L,m):void 0,onDragLeave:a?Tt:void 0,onDrop:a?L=>_t(L,m):void 0,onClick:()=>{o||It(n)},style:{display:"flex",alignItems:"center",gap:4,padding:"2px 0",cursor:o?"default":a?"grab":"pointer",opacity:u?.5:1,background:b?"#F2F2F0":"transparent",borderRadius:6},children:[t.jsx("span",{style:{width:16,height:16,display:"inline-flex",alignItems:"center",justifyContent:"center",color:"#989898",visibility:a?"visible":"hidden",flexShrink:0},children:t.jsx(W.GripVertical,{size:14,strokeWidth:1.75})}),t.jsx("span",{style:{width:20,height:20,borderRadius:4,display:"inline-flex",alignItems:"center",justifyContent:"center",background:I?"#0B0B0B":"#FFFFFF",border:`1px solid ${I?"#0B0B0B":"#676767"}`,flexShrink:0,marginLeft:8},children:I&&t.jsx(W.Check,{size:14,color:"#FFFFFF",strokeWidth:3})}),t.jsx("span",{style:{flex:1,fontFamily:"var(--font-sans)",fontSize:14,lineHeight:"20px",color:"#0B0B0B",marginLeft:8},children:e.label})]})},qt=se?t.jsxs("div",{ref:qe,style:{position:"fixed",top:`${ot.top}px`,left:`${ot.left}px`,width:217,maxHeight:320,zIndex:49,background:"#FFFFFF",border:"1px solid #E6E6E6",borderRadius:10,overflow:"hidden",display:"flex",flexDirection:"column",fontFamily:"var(--font-sans)",boxShadow:"0 8px 24px rgba(11, 11, 11, 0.08)"},children:[t.jsxs("div",{style:{flex:1,minHeight:0,overflowY:"auto",padding:12,display:"flex",flexDirection:"column",gap:12},children:[he.map((e,n)=>{if(e===M)return null;const s=l.find(a=>q(a)===e);return s?t.jsx(i.Fragment,{children:xt({col:s,columnId:e,isSelected:!0,draggable:!0,isAction:!1,actualIndex:n})},`selected-${e}-${n}`):null}),l.filter(e=>{const n=q(e);return n!==M&&!he.includes(n)}).map(e=>{const n=q(e);return t.jsx(i.Fragment,{children:xt({col:e,columnId:n,isSelected:!1,draggable:!1,isAction:!1,actualIndex:-1})},`unselected-${n}`)})]}),t.jsxs("div",{style:{flexShrink:0,borderTop:"1px solid #D9D9D9",padding:"8px 12px",background:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"space-between",height:46,boxSizing:"border-box"},children:[t.jsx("button",{type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation();const n=ze.current?[...ze.current]:l.map(q).slice(0,X),s=re(n);if(ee.current=!1,Me(s),ve(s),at(new Set),ct(new Set),typeof window<"u"&&V)try{localStorage.removeItem(V)}catch{}},style:{background:"transparent",border:"none",padding:0,cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:14,fontWeight:500,color:"#323232"},children:"Reset"}),t.jsx("button",{type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation();const n=re(he);ee.current=!0,ve(n),mt(n),_e(!1)},style:{background:"#2E3236",color:"#FFFFFF",border:"none",borderRadius:10,height:28,padding:"0 14px",fontFamily:"var(--font-sans)",fontSize:14,fontWeight:600,cursor:"pointer"},children:"Apply"})]})]}):null,gt=R?l.find(e=>q(e)===R):null,yt=gt?t.jsx(sn,{column:gt,columnId:R,filterType:Ct(R),position:h,popoverRef:P,distinctValues:Te(R),initialValue:H[R],onApply:e=>{Pe(R,e),p(null)},onCancel:()=>p(null)},R):null;return t.jsxs("div",{className:"w-full",children:[yt&&Ze.createPortal(yt,document.body),l.length>0&&($||!ce)&&t.jsx("div",{className:"pt-2 pb-1",style:{position:"sticky",zIndex:35,backgroundColor:"var(--primary-foreground)"},children:t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:16,flexWrap:"wrap"},children:[$&&t.jsx("div",{style:{marginRight:"auto"},children:t.jsx(jt,{dateRangePicker:$.dateRangePicker,onWeekToDate:$.onWeekToDate,exportConfig:$.exportConfig,filterChipsConfig:$.filterChipsConfig,trailingActions:$.trailingActions})}),!ce&&t.jsxs("div",{style:{position:"relative"},children:[t.jsxs("button",{ref:xe,type:"button",onClick:()=>_e(!se),style:{display:"inline-flex",alignItems:"center",gap:10,height:32,padding:"0 16px",background:"#FFFFFF",border:"1px solid #D9D9D9",borderRadius:10,cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:14,fontWeight:600,color:"#2E3236",whiteSpace:"nowrap"},children:[t.jsx(W.Settings2,{size:20,strokeWidth:1.75}),"Columns"]}),se&&Ze.createPortal(qt,document.body)]})]})}),Object.keys(H).length>0&&t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",padding:"8px 0"},children:[Object.entries(H).map(([e,n])=>{const s=l.find(u=>q(u)===e);if(!s||!ke(n))return null;const a=Vt(n),o=en(n),m=tn(n);return t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8,height:28,padding:"0 12px",borderRadius:20,border:"1px solid #B2B2B0",background:"#F2F2F0",fontFamily:"var(--font-sans)",fontSize:14,lineHeight:"20px",color:"#0B0B0B",whiteSpace:"nowrap"},children:[t.jsxs("span",{children:[t.jsxs("span",{style:{color:"#676767"},children:[s.label,": "]}),t.jsx("span",{children:a})]}),o>0&&t.jsx(nn,{count:o,values:m}),t.jsx("button",{type:"button",onClick:()=>Pe(e,[]),"aria-label":`Remove ${s.label} filter`,style:{background:"transparent",border:"none",padding:0,cursor:"pointer",display:"inline-flex",color:"#676767"},children:t.jsx(W.X,{size:14,strokeWidth:2})})]},`chip-${e}`)}),t.jsx("button",{type:"button",onClick:kt,style:{marginLeft:"auto",background:"transparent",border:"none",padding:"0 4px",cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:14,fontWeight:500,color:"#323232"},children:"Reset"})]}),l.length>0&&ge.length>0?t.jsxs(T.DndContext,{sensors:Nt,collisionDetection:T.closestCenter,onDragStart:$t,onDragEnd:Wt,children:[t.jsxs("div",{style:{borderRadius:8,border:"1px solid #E6E6E6",overflow:"hidden",background:"var(--primary-foreground)",position:"relative",top:"0.5rem"},children:[G&&t.jsx("div",{style:{position:"absolute",inset:0,background:"rgba(255, 255, 255, 0.9)",backdropFilter:"blur(2px)",zIndex:20,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",borderRadius:"14px"},children:t.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"12px"},children:[t.jsx("p",{style:{fontSize:"13px",color:"rgba(30, 33, 37, 0.6)",margin:0},children:"Loading..."}),t.jsx(an,{src:"/BrandLoading.gif",alt:"Loading",width:50,height:50,unoptimized:!0,className:"mt-1"})]})}),t.jsx("div",{className:"overflow-x-auto custom-thin-scrollbar-hidden",ref:zt,style:{maxHeight:"500px",overflowY:"auto",position:"relative",zIndex:1},children:t.jsxs("table",{style:{width:"auto",minWidth:"100%",tableLayout:"fixed",borderCollapse:"collapse",fontSize:"13px",fontFamily:"var(--font-sans)",border:"1px solid #e6e6e6",boxSizing:"border-box"},children:[t.jsx("thead",{children:t.jsx("tr",{children:t.jsx(T.SortableContext,{items:z,strategy:T.horizontalListSortingStrategy,children:ge.map(e=>t.jsx(Ht,{column:e,isHeaderRow:!0},`header-${q(e)}`))})})}),t.jsx("tbody",{children:!G&&Ie.length===0?t.jsx("tr",{children:t.jsx("td",{colSpan:ge.length,style:{padding:"32px",textAlign:"center",color:"rgba(30, 33, 37, 0.42)",fontSize:"12px",fontFamily:"var(--font-sans)"},children:"No results found"})}):!G&&Ie.length>0?Ie.map((e,n)=>t.jsx("tr",{"data-row-id":e.id||n,style:{borderBottom:"1px solid #e6e6e6",cursor:f?"pointer":"default",transition:"background 0.15s ease"},onClick:f?s=>{s.stopPropagation(),f(e,n)}:void 0,onMouseEnter:s=>{s.currentTarget.style.background="#E6E6E6"},onMouseLeave:s=>{s.currentTarget.style.background="transparent"},children:ge.map(s=>{const a=q(s),o=ut(a,s.width),m=e[a],u=s.render?s.render(m,e):m,b=o&&o!=="auto",I=typeof u=="string"&&u.trim()!=="",L=b&&I,je=L?t.jsx(Y,{content:u,children:u}):u;return t.jsx("td",{style:{padding:"10px 14px",color:"rgba(30, 33, 37, 0.78)",fontSize:"13px",borderRight:"1px solid #e6e6e6",boxSizing:"border-box",width:o,fontFamily:"var(--font-sans)",...L&&{maxWidth:o||"200px"}},children:je},a)})},n)):null})]})})]}),t.jsx(T.DragOverlay,{children:ht?t.jsx("div",{className:"bg-[var(--paper-high)] border border-[var(--border-strong)] rounded px-4 py-2 shadow-lg",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(W.GripVertical,{size:14,className:"text-[var(--text-faint)]"}),t.jsx("span",{className:"text-sm font-semibold text-[var(--text-ink)]",children:ht.label})]})}):null})]}):null,(()=>{const e=!O&&(pe.trim()!==""||Object.values(H).some(s=>ke(s))),n=Q?e?Fe.length:v:Fe.length;return n<=0?null:t.jsx(Ft.Pagination,{page:J,pageSizeOptions:[5,10,20,50,100],pageSize:ie,totalCount:n,currentDataLength:Ie.length,onPageChange:fe,onPageSizeChange:s=>{Ce(s),fe(1)},showPageSizeSelector:!0})})()]})}exports.DataTable2=cn;exports.DataTableFilters=jt;
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),i=require("react"),T=require("./sortable.esm.cjs.js"),I=require("lucide-react"),et=require("react-dom"),Ft=require("./CustomFilterChips.cjs.js");require("motion/react");require("recharts");require("./AgentLiftAnalysisCard.cjs.js");require("./TourGuideTooltip.cjs.js");function jt({dateRangePicker:r,onWeekToDate:l,exportConfig:d,filterChipsConfig:f,trailingActions:v}){const[y,c]=i.useState(!1),g=i.useRef(null),R=i.useRef(null);i.useEffect(()=>{const S=j=>{R.current&&!R.current.contains(j.target)&&g.current&&!g.current.contains(j.target)&&c(!1)};if(y)return document.addEventListener("mousedown",S),()=>{document.removeEventListener("mousedown",S)}},[y]);const w=()=>{c(S=>!S)},F=S=>{c(!1),d!=null&&d.onExport&&d.onExport(S)},M=(()=>{if(!(f!=null&&f.filters))return!1;const S=f.filters,j=f.customFilters||[],q=Object.entries(S).some(([C,$])=>!!(Array.isArray($)&&$.length||typeof $=="string"&&$.trim()!==""||$&&typeof $=="object"&&($.min!=null||$.max!=null))),z=j.some(C=>C.active);return q||z})();return t.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[l&&t.jsxs("button",{onClick:l,className:"inline-flex items-center gap-2 rounded-lg border border-gray-300 bg-white/80 px-4 py-2.5 transition-colors hover:bg-white text-sm font-medium text-gray-900",style:{fontFamily:"var(--font-sans)"},children:[t.jsx(I.CalendarClock,{size:16}),t.jsx("span",{children:"Week to Date"})]}),r&&t.jsx(i.Suspense,{fallback:t.jsxs("div",{className:"inline-flex items-center gap-2 rounded-lg border border-gray-300 bg-white/80 px-4 py-2.5 text-sm font-medium text-gray-400",children:[t.jsx(I.CalendarClock,{size:16}),t.jsx("span",{children:"Loading..."})]}),children:r}),d&&t.jsxs("div",{className:"relative",children:[t.jsxs("button",{ref:g,onClick:w,disabled:d.isExporting,className:"inline-flex items-center justify-between gap-2 rounded-lg border border-gray-300 bg-white/80 px-4 py-2.5 transition-colors hover:bg-white text-sm font-medium text-gray-900 disabled:opacity-50 disabled:cursor-not-allowed min-w-[120px]",style:{fontFamily:"var(--font-sans)"},children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(I.Download,{size:16}),t.jsx("span",{children:d.isExporting?"Exporting...":"Export"})]}),t.jsx(I.ChevronDown,{size:16})]}),y&&t.jsx("div",{ref:R,className:"absolute top-full right-0 mt-2 bg-white rounded-lg shadow-lg border border-gray-200 py-1 z-50 min-w-[120px]",children:(d.types||["csv"]).map(S=>t.jsxs("button",{onClick:()=>F(S),className:"w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-50 transition-colors",style:{fontFamily:"var(--font-sans)"},children:["Export ",S.toUpperCase()]},S))})]}),(M||v)&&t.jsxs(t.Fragment,{children:[M&&t.jsx("div",{className:"h-9 mt-1 w-px bg-gray-300 flex-shrink-0"}),t.jsxs("div",{className:"flex items-center gap-3 justify-end",children:[M&&f&&t.jsx(Ft.CustomFilterChips,{filters:f.filters,onChange:f.onChange,onClear:f.onClear,customFilters:f.customFilters||[],fieldOptions:f.fieldOptions||{}}),v&&t.jsx("div",{className:"flex-shrink-0",children:v})]})]})]})}function tt(r){if(r==null)return NaN;const l=String(r).replace(/[,$%]|pp/gi,"").trim(),d=parseFloat(l);return Number.isFinite(d)?d:NaN}function Yt(r){if(r==null)return NaN;const l=String(r).trim(),d=l.match(/^(\d+):(\d+)(?::(\d+))?$/);if(d){const w=+d[1],F=+d[2],A=d[3]!=null?+d[3]:null;return A!=null?w*3600+F*60+A:w*60+F}let f=0,v=!1;const y=l.match(/(\d+)\s*d\b/i),c=l.match(/(\d+)\s*h\b/i),g=l.match(/(\d+)\s*m(?!s)\b/i),R=l.match(/(\d+)\s*s\b/i);return y&&(f+=+y[1]*86400,v=!0),c&&(f+=+c[1]*3600,v=!0),g&&(f+=+g[1]*60,v=!0),R&&(f+=+R[1],v=!0),v?f:NaN}function Qt(r){if(!r)return null;const l=String(r).trim(),d=l.match(/^(\d{1,2})\/(\d{1,2})\/(\d{2,4})$/);if(d){const v=d[3].length===2?2e3+ +d[3]:+d[3],y=new Date(v,+d[1]-1,+d[2]);return isNaN(y.getTime())?null:y}const f=new Date(l);return isNaN(f.getTime())?null:f}function Zt(r){if(!r||r.length===0)return"text";const l=r.slice(0,25),d=f=>l.every(f);return d(f=>/^\d{1,2}\/\d{1,2}\/\d{2,4}$/.test(f)||/^\d{4}-\d{2}-\d{2}/.test(f))?"date":d(f=>/^\d+\s*[dhms]\b/i.test(f)||/^\d+:\d+(:\d+)?$/.test(f))?"duration":d(f=>/^-?[\d,.]+(%|pp)?$/i.test(f))?"number":"text"}function De(r){return r?Array.isArray(r)?r.length>0:r.type==="range"?r.min!==""&&r.min!==void 0&&r.min!==null||r.max!==""&&r.max!==void 0&&r.max!==null:r.type==="durationRange"?r.minSec!==""&&r.minSec!=null||r.maxSec!==""&&r.maxSec!=null:r.type==="scoreRange"?Array.isArray(r.values)&&r.values.length>0||r.min!==""&&r.min!=null||r.max!==""&&r.max!=null:r.type==="dateRange"?!!(r.from||r.to):!1:!1}function St(r){if(r==null||r===""||isNaN(r))return"";const l=Number(r),d=Math.floor(l/3600),f=Math.floor(l%3600/60),v=Math.floor(l%60);return d>0?`${d}h ${f}m`:f>0?`${f}m ${v}s`:`${v}s`}function Vt(r){if(!r)return"";if(Array.isArray(r))return r.length===0?"":String(r[0]);if(r.type==="range"){const l=r.min!==""&&r.min!=null?r.min:null,d=r.max!==""&&r.max!=null?r.max:null;return l!=null&&d!=null?`${l} – ${d}`:l!=null?`≥ ${l}`:d!=null?`≤ ${d}`:""}if(r.type==="durationRange"){const l=r.minSec!==""&&r.minSec!=null?St(r.minSec):null,d=r.maxSec!==""&&r.maxSec!=null?St(r.maxSec):null;return l&&d?`${l} – ${d}`:l?`≥ ${l}`:d?`≤ ${d}`:""}if(r.type==="scoreRange"){if(Array.isArray(r.values)&&r.values.length>0)return r.values.slice().sort((f,v)=>f-v).join(", ");const l=r.min!==""&&r.min!=null?r.min:null,d=r.max!==""&&r.max!=null?r.max:null;return l!=null&&d!=null?`${l} – ${d}`:l!=null?`≥ ${l}`:d!=null?`≤ ${d}`:""}return r.type==="dateRange"?r.from&&r.to?`${r.from} – ${r.to}`:r.from?`from ${r.from}`:r.to?`to ${r.to}`:"":""}function en(r){return Array.isArray(r)?Math.max(0,r.length-1):0}function tn(r){return Array.isArray(r)?r.slice(1).map(String).join(", "):""}function nn({count:r,values:l}){const[d,f]=i.useState(!1);return t.jsxs("span",{onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),style:{position:"relative",display:"inline-flex",alignItems:"center",justifyContent:"center",height:22,minWidth:22,padding:"0 6px",background:"#D8D8D8",color:"#0B0B0B",borderRadius:14,fontSize:12,fontWeight:500,lineHeight:1,cursor:"pointer"},children:["+",r,d&&t.jsx("span",{role:"tooltip",style:{position:"absolute",bottom:"calc(100% + 6px)",left:"50%",transform:"translateX(-50%)",background:"#1E2125",color:"#FFFFFF",fontFamily:"var(--font-sans)",fontSize:12,fontWeight:400,lineHeight:"20px",padding:"6px 10px",borderRadius:8,whiteSpace:"nowrap",pointerEvents:"none",zIndex:100,boxShadow:"0 6px 16px rgba(11, 11, 11, 0.18)"},children:l})]})}function rn({leftLabel:r,rightLabel:l,leftValue:d,rightValue:f,onLeftChange:v,onRightChange:y,type:c="number",placeholderLeft:g="Min",placeholderRight:R="Max"}){const w={width:"100%",height:32,borderRadius:8,border:"1px solid #D9D9D9",background:"#FFFFFF",padding:"0 10px",fontFamily:"var(--font-sans)",fontSize:14,color:"#0B0B0B",outline:"none",boxSizing:"border-box"},F={fontSize:12,color:"#676767",marginBottom:4,fontFamily:"var(--font-sans)"};return t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[t.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[t.jsx("span",{style:F,children:r}),t.jsx("input",{type:c,value:d,onChange:A=>v(A.target.value),placeholder:g,style:w})]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[t.jsx("span",{style:F,children:l}),t.jsx("input",{type:c,value:f,onChange:A=>y(A.target.value),placeholder:R,style:w})]})]})}const vt=[{id:"0-60",label:"0 to 60 Sec",minSec:0,maxSec:60},{id:"60-120",label:"1m to 2 m",minSec:60,maxSec:120},{id:"120-180",label:"2m to 3 m",minSec:120,maxSec:180},{id:"180-240",label:"3m to 4m",minSec:180,maxSec:240},{id:"240-300",label:"4m to 5m",minSec:240,maxSec:300},{id:"300+",label:"5 mins and above",minSec:300,maxSec:null}];function wt(r){if(r==null||r==="")return null;const l=String(r).trim().match(/^(\d{1,3}):(\d{2})$/);if(l)return Number(l[1])*60+Number(l[2]);const d=Number(r);return Number.isFinite(d)?d:null}function Ze({children:r}){return t.jsx("div",{style:{fontSize:14,fontWeight:600,color:"#0B0B0B",lineHeight:"20px",padding:"4px 0 2px",fontFamily:"var(--font-sans)"},children:r})}function Ve({minValue:r,maxValue:l,onMinChange:d,onMaxChange:f,inputType:v="number",inputMode:y="decimal",step:c,placeholder:g="0.0",unit:R}){const w={width:"100%",height:30,border:"1px solid #ACADAD",borderRadius:4,padding:"6px 10px",fontSize:13,color:"#0B0B0B",fontFamily:"var(--font-sans)",outline:"none",boxSizing:"border-box"};return t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[t.jsxs("div",{style:{display:"flex",alignItems:"flex-end",gap:8},children:[t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,flex:1,minWidth:0},children:[t.jsx("span",{style:{fontSize:12,color:"#2E3236",fontFamily:"var(--font-sans)"},children:"Min From"}),t.jsx("input",{type:v,inputMode:y,step:c,placeholder:g,value:r,onChange:F=>d(F.target.value),style:w})]}),t.jsx("span",{style:{fontSize:12,fontWeight:600,color:"#323232",paddingBottom:8,fontFamily:"var(--font-sans)"},children:"to"}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6,flex:1,minWidth:0},children:[t.jsx("span",{style:{fontSize:12,color:"#2E3236",fontFamily:"var(--font-sans)"},children:"Max"}),t.jsx("input",{type:v,inputMode:y,step:c,placeholder:g,value:l,onChange:F=>f(F.target.value),style:w})]})]}),R&&t.jsxs("span",{style:{fontSize:11,color:"#676767",fontFamily:"var(--font-sans)"},children:["Enter durations in ",R==="sec"?"seconds":R]})]})}function sn({column:r,columnId:l,filterType:d="text",position:f,popoverRef:v,distinctValues:y,initialValue:c,onApply:g,onCancel:R}){const w=d==="text",F=d==="number",A=d==="date",M=d==="duration",S=d==="score",j=/duration/i.test(String((r==null?void 0:r.label)||l||"")),q=i.useMemo(()=>{if(!S||!Array.isArray(y)||y.length===0)return!1;let m=1/0,h=-1/0;for(const x of y){const E=tt(x);Number.isFinite(E)&&(E<m&&(m=E),E>h&&(h=E))}return Number.isFinite(m)&&Number.isFinite(h)&&m>=0&&h<=5},[S,y]),[z,C]=i.useState(()=>w?new Set(Array.isArray(c)?c:[]):new Set),[$,ce]=i.useState(""),[ie,K]=i.useState(()=>F&&(c==null?void 0:c.type)==="range"&&c.min!=null?c.min:""),[B,ee]=i.useState(()=>F&&(c==null?void 0:c.type)==="range"&&c.max!=null?c.max:""),[U,P]=i.useState(new Set),[X,de]=i.useState(()=>M&&(c==null?void 0:c.type)==="durationRange"&&c.minSec!=null&&c.minSec!==""?String(c.minSec):""),[J,Y]=i.useState(()=>M&&(c==null?void 0:c.type)==="durationRange"&&c.maxSec!=null&&c.maxSec!==""?String(c.maxSec):""),[ue,Q]=i.useState(()=>S&&(c==null?void 0:c.type)==="scoreRange"&&Array.isArray(c.values)?new Set(c.values):new Set),[te,me]=i.useState(()=>S&&(c==null?void 0:c.type)==="scoreRange"&&c.min!=null&&c.min!==""?String(c.min):""),[Se,G]=i.useState(()=>S&&(c==null?void 0:c.type)==="scoreRange"&&c.max!=null&&c.max!==""?String(c.max):""),[N,ne]=i.useState(()=>A&&(c==null?void 0:c.type)==="dateRange"&&c.from||""),[Z,ae]=i.useState(()=>A&&(c==null?void 0:c.type)==="dateRange"&&c.to||"");i.useEffect(()=>{w&&C(new Set(Array.isArray(c)?c:[]))},[l,w]);const _=i.useMemo(()=>{const m=$.trim().toLowerCase();return[...m?y.filter(x=>String(x).toLowerCase().includes(m)):y].sort((x,E)=>{const V=z.has(x),pe=z.has(E);return V!==pe?V?-1:1:String(x).localeCompare(String(E))})},[y,$,z]),he=m=>{C(h=>{const x=new Set(h);return x.has(m)?x.delete(m):x.add(m),x})},ve=()=>{w&&C(new Set),F&&(K(""),ee("")),M&&(P(new Set),de(""),Y("")),S&&(Q(new Set),me(""),G("")),A&&(ne(""),ae("")),ce("")},Re=m=>{P(h=>{const x=new Set(h);return x.has(m)?x.delete(m):x.add(m),x})},D=m=>{Q(h=>{const x=new Set(h);return x.has(m)?x.delete(m):x.add(m),x})},fe=()=>{if(w)return g(Array.from(z));if(F)return g({type:"range",min:ie===""?"":Number(ie),max:B===""?"":Number(B)});if(M){const m=wt(X),h=wt(J),x=m!=null||h!=null;let E="",V="";if(x)E=m??"",V=h??"";else if(U.size>0){const pe=vt.filter(re=>U.has(re.id));E=Math.min(...pe.map(re=>re.minSec)),V=pe.some(re=>re.maxSec==null)?"":Math.max(...pe.map(re=>re.maxSec))}return g({type:"durationRange",minSec:E,maxSec:V})}if(S){const m=te===""?null:Number(te),h=Se===""?null:Number(Se);return m!=null||h!=null?g({type:"scoreRange",values:[],min:m!=null&&Number.isFinite(m)?m:"",max:h!=null&&Number.isFinite(h)?h:""}):g({type:"scoreRange",values:Array.from(ue).sort((E,V)=>E-V),min:"",max:""})}if(A)return g({type:"dateRange",from:N,to:Z})};return t.jsxs("div",{ref:v,role:"dialog","aria-label":`Filter ${r.label||l}`,style:{position:"fixed",top:f.top,left:f.left,zIndex:50,width:w?240:220,background:"#FFFFFF",border:"1px solid #E6E6E6",borderRadius:10,padding:12,display:"flex",flexDirection:"column",gap:10,boxShadow:"0 8px 24px rgba(11, 11, 11, 0.10)",fontFamily:"var(--font-sans)"},children:[w&&t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{background:"#D8D8D8",height:32,borderRadius:10,padding:1,display:"flex",alignItems:"center"},children:t.jsxs("div",{style:{background:"#FFFFFF",flex:1,height:30,borderRadius:10,display:"flex",alignItems:"center",gap:8,padding:"0 8px"},children:[t.jsx(I.Search,{size:16,color:"#989898",strokeWidth:2}),t.jsx("input",{autoFocus:!0,type:"text",value:$,onChange:m=>ce(m.target.value),placeholder:"Search",style:{flex:1,border:"none",outline:"none",background:"transparent",fontSize:14,color:"#0B0B0B",minWidth:0,fontFamily:"var(--font-sans)"}})]})}),t.jsx("div",{style:{maxHeight:220,overflowY:"auto",display:"flex",flexDirection:"column",gap:4},children:_.length===0?t.jsx("div",{style:{fontSize:13,color:"#676767",padding:"8px 4px",textAlign:"center"},children:"No values"}):_.map(m=>{const h=z.has(m);return t.jsxs("label",{style:{display:"flex",alignItems:"center",gap:12,padding:"6px 4px",cursor:"pointer",borderRadius:6},children:[t.jsx("span",{style:{width:20,height:20,borderRadius:4,display:"inline-flex",alignItems:"center",justifyContent:"center",background:h?"#0B0B0B":"#FFFFFF",border:`1px solid ${h?"#0B0B0B":"#676767"}`,flexShrink:0},children:h&&t.jsx(I.Check,{size:14,color:"#FFFFFF",strokeWidth:3})}),t.jsx("input",{type:"checkbox",checked:h,onChange:()=>he(m),style:{position:"absolute",opacity:0,pointerEvents:"none"},tabIndex:-1}),t.jsx("span",{onClick:x=>{x.preventDefault(),he(m)},style:{fontSize:14,lineHeight:"20px",color:"#0B0B0B",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m})]},m)})})]}),F&&t.jsxs(t.Fragment,{children:[t.jsx(Ze,{children:r.label||"Filter"}),t.jsx(Ve,{minValue:ie,maxValue:B,onMinChange:K,onMaxChange:ee,placeholder:j?"00":"0.0",unit:j?"sec":void 0})]}),M&&t.jsxs(t.Fragment,{children:[t.jsx(Ze,{children:r.label||"Duration"}),r.filterShowPresets===!0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:vt.map(m=>{const h=U.has(m.id);return t.jsxs("div",{role:"checkbox","aria-checked":h,tabIndex:0,onClick:()=>Re(m.id),onKeyDown:x=>{(x.key===" "||x.key==="Enter")&&(x.preventDefault(),Re(m.id))},style:{display:"flex",alignItems:"center",gap:12,cursor:"pointer",userSelect:"none"},children:[t.jsx("span",{style:{width:20,height:20,borderRadius:4,display:"inline-flex",alignItems:"center",justifyContent:"center",background:h?"#0B0B0B":"#FFFFFF",border:`1px solid ${h?"#0B0B0B":"#676767"}`,flexShrink:0},children:h&&t.jsx(I.Check,{size:14,color:"#FFFFFF",strokeWidth:3})}),t.jsx("span",{style:{fontSize:14,lineHeight:"20px",color:"#0B0B0B",fontFamily:"var(--font-sans)"},children:m.label})]},m.id)})}),t.jsx("div",{style:{height:1,background:"#D9D9D9",margin:"0 -12px"}}),t.jsx("div",{style:{fontSize:14,fontWeight:500,color:"#0B0B0B",lineHeight:"20px",padding:"4px 0",fontFamily:"var(--font-sans)"},children:"Custom Range"})]}),t.jsx(Ve,{minValue:X,maxValue:J,onMinChange:de,onMaxChange:Y,inputType:"number",inputMode:"numeric",placeholder:"00",unit:"sec"})]}),S&&t.jsxs(t.Fragment,{children:[t.jsx(Ze,{children:r.label||"Score"}),q&&r.filterShowPresets===!0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[1,2,3,4,5].map(m=>{const h=ue.has(m);return t.jsxs("div",{role:"checkbox","aria-checked":h,tabIndex:0,onClick:()=>D(m),onKeyDown:x=>{(x.key===" "||x.key==="Enter")&&(x.preventDefault(),D(m))},style:{display:"flex",alignItems:"center",gap:12,cursor:"pointer",userSelect:"none"},children:[t.jsx("span",{style:{width:20,height:20,borderRadius:4,display:"inline-flex",alignItems:"center",justifyContent:"center",background:h?"#0B0B0B":"#FFFFFF",border:`1px solid ${h?"#0B0B0B":"#676767"}`,flexShrink:0},children:h&&t.jsx(I.Check,{size:14,color:"#FFFFFF",strokeWidth:3})}),t.jsx("span",{style:{fontSize:14,lineHeight:"20px",color:"#0B0B0B",fontFamily:"var(--font-sans)"},children:m})]},m)})}),t.jsx("div",{style:{height:1,background:"#D9D9D9",margin:"0 -12px"}})]}),q&&r.filterShowPresets===!0&&t.jsx("div",{style:{fontSize:14,fontWeight:500,color:"#0B0B0B",lineHeight:"20px",padding:"4px 0",fontFamily:"var(--font-sans)"},children:"Custom Range"}),t.jsx(Ve,{minValue:te,maxValue:Se,onMinChange:me,onMaxChange:G,step:"0.1"})]}),A&&t.jsx(rn,{leftLabel:"From",rightLabel:"To",leftValue:N,rightValue:Z,onLeftChange:ne,onRightChange:ae,type:"date",placeholderLeft:"",placeholderRight:""}),t.jsx("div",{style:{height:1,background:"#D9D9D9",margin:"0 -12px"}}),t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[t.jsx("button",{type:"button",onClick:ve,style:{background:"transparent",border:"none",padding:0,cursor:"pointer",fontSize:14,fontWeight:500,color:"#323232",fontFamily:"var(--font-sans)"},children:M&&r.filterShowPresets===!0||S&&q&&r.filterShowPresets===!0?"View All":"Reset"}),t.jsx("button",{type:"button",onClick:fe,style:{background:"#0B0B0B",color:"#FFFFFF",border:"none",borderRadius:10,height:28,padding:"0 14px",fontSize:14,fontWeight:500,cursor:"pointer",fontFamily:"var(--font-sans)"},children:"Apply"})]})]})}const on=()=>({userData:{email:"anonymous"}}),an=r=>t.jsx("img",{...r});function ln({children:r,content:l,direction:d="top",align:f="center",styling:v,indicatorColor:y}){const c=typeof l=="string"?l:l!=null?String(l):"",g=typeof y=="string"&&(y.startsWith("#")||y.startsWith("rgb")||y.startsWith("hsl")||y.startsWith("var("))?y:"var(--Grey-Strong, #2E3236)",[R,w]=i.useState(!1),[F,A]=i.useState(!1),[M,S]=i.useState({top:0,left:0,arrowLeft:0,placement:"top"}),j=i.useRef(null),q=i.useRef(null);if(!c)return r;i.useEffect(()=>{A(!0)},[]);const z=i.useCallback(()=>{if(!j.current||!q.current||typeof window>"u")return;const C=j.current.getBoundingClientRect(),$=q.current.getBoundingClientRect(),ce=window.innerWidth,ie=window.innerHeight,K=8,B=10,ee=$.width,U=$.height,P=C.top,X=ie-C.bottom,de=d==="bottom"?"bottom":"top";let J=de;de==="top"&&P<U+B+K&&X>P?J="bottom":de==="bottom"&&X<U+B+K&&P>X&&(J="top");let Y=C.left+C.width/2;f==="start"&&(Y=C.left),f==="end"&&(Y=C.right);let ue=J==="top"?C.top-U-B:C.bottom+B,Q=f==="start"?Y:f==="end"?Y-ee:Y-ee/2;ue=Math.max(K,Math.min(ue,ie-U-K)),Q=Math.max(K,Math.min(Q,ce-ee-K));const te=Math.max(10,Math.min(Y-Q,ee-10));S({top:ue,left:Q,arrowLeft:te,placement:J})},[f,d]);return i.useEffect(()=>{if(!R||!F)return;z();const C=()=>z();return window.addEventListener("resize",C),window.addEventListener("scroll",C,!0),()=>{window.removeEventListener("resize",C),window.removeEventListener("scroll",C,!0)}},[R,F,z]),t.jsxs("span",{ref:j,style:{display:"block",width:"100%"},onMouseEnter:()=>w(!0),onMouseLeave:()=>w(!1),children:[r,R&&F&&et.createPortal(t.jsxs("span",{ref:q,style:{position:"fixed",top:`${M.top}px`,left:`${M.left}px`,background:"var(--Grey-Strong, #2E3236)",color:"var(--Grey-White, #FFF)",fontSize:"12px",lineHeight:1.3,fontWeight:500,padding:"8px 10px",borderRadius:"6px",whiteSpace:"normal",maxWidth:"320px",width:"max-content",boxShadow:"0 6px 18px rgba(0, 0, 0, 0.2)",zIndex:99999,pointerEvents:"none",...typeof v=="object"?v:{}},children:[c,t.jsx("span",{style:{position:"absolute",left:`${M.arrowLeft}px`,transform:"translateX(-50%)",width:0,height:0,borderLeft:"6px solid transparent",borderRight:"6px solid transparent",...M.placement==="top"?{top:"100%",borderTop:`7px solid ${g}`}:{bottom:"100%",borderBottom:`7px solid ${g}`}}})]}),document.body)]})}function cn({data:r=[],columns:l=[],initialPageSize:d=10,onRowClick:f,totalCount:v=null,page:y=null,pageSize:c=null,onPageChange:g=null,onPageSizeChange:R=null,onFilterChange:w=null,columnFilters:F=null,onMaxColumnsError:A=null,onSort:M=null,sortFields:S=[],tableId:j=null,isLoading:q=!1,filtersConfig:z=null,columnResizeMinWidth:C=120,columnResizeMaxWidth:$=280,onVisibleColumnsChange:ce=null,hideColumnPicker:ie=!1}){var bt;const{userData:K}=on(),B=(K==null?void 0:K.email)||"anonymous",ee=i.memo(({children:e,content:n,className:s=""})=>{const a=i.useRef(null),[o,p]=i.useState(!1);i.useEffect(()=>{const b=()=>{if(a.current){const L=a.current.scrollWidth>a.current.clientWidth;p(L)}};b();const O=setTimeout(b,0);return window.addEventListener("resize",b),()=>{clearTimeout(O),window.removeEventListener("resize",b)}},[e,n]);const u=t.jsx("span",{className:`truncate block ${s}`,ref:a,children:e});return o&&n?t.jsx(ln,{content:n,styling:"bg-green-2 text-gray-900 px-3 py-2 text-sm rounded-lg shadow-md border border-gray-300 max-w-xs whitespace-normal",indicatorColor:"bg-green-2",direction:"top",children:u}):u});ee.displayName="TruncatedCell";const U=v!==null&&g!==null,P=w!==null,X=M!==null,[de,J]=i.useState(1),[Y,ue]=i.useState(d),Q=y!==null?y:de,te=c!==null?c:Y,me=e=>{g?g(e):J(e)},Se=e=>{R?R(e):ue(e)},G=50,N="action",ne=i.useRef(!1),Z=i.useMemo(()=>j?`dataTable_columns_${j}:${B}`:`dataTable_columns_${l.map(n=>n.id||n.key).sort().join("_")}:${B}`,[j,l,B]),ae=i.useMemo(()=>j?`dataTable_manual_change_${j}:${B}`:null,[j,B]);i.useCallback((e,n)=>{if(typeof window>"u"||!e||!n||n.length===0)return null;try{const s=localStorage.getItem(e);if(s){const o=JSON.parse(s).filter(p=>n.some(u=>(u.id||u.key)===p));if(o.length>0)return o}}catch(s){console.warn("Failed to load saved columns from localStorage:",s)}return null},[]);const[_,he]=i.useState({}),[ve,Re]=i.useState(""),[D,fe]=i.useState(null),[m,h]=i.useState({top:0,left:0}),x=i.useRef(null),E=i.useRef({}),[V,pe]=i.useState(null),[Te,re]=i.useState("asc"),_e=i.useCallback((e,n)=>{const s=De(n);he(a=>{const o={...a};return s?o[e]=n:delete o[e],o}),g?g(1):J(1),P&&w&&w(s?{..._,[e]:n}:Object.fromEntries(Object.entries(_).filter(([a])=>a!==e)))},[_,w,P,g]),kt=i.useCallback(()=>{he({}),Re(""),g?g(1):J(1),P&&w&&w({})},[w,P,g]),He=i.useCallback(e=>{if(!r||r.length===0)return[];const n=new Set,s=[];for(const a of r){const o=a[e];if(o==null)continue;const p=typeof o=="object"?JSON.stringify(o):String(o);n.has(p)||(n.add(p),s.push(p))}return s.sort((a,o)=>a.localeCompare(o))},[r]),Ct=i.useCallback(e=>{const n=l.find(s=>H(s)===e);return n&&n.filterType?n.filterType:Zt(He(e))},[l,He]),Ee=i.useCallback(e=>{const a=typeof window<"u"?window.innerWidth:1/0;let o=e.left;return o+280>a-8&&(o=Math.max(8,e.right-280)),{top:e.bottom+6,left:o}},[]),Dt=i.useCallback((e,n)=>{if(!n){fe(e);return}const s=n.getBoundingClientRect();h(Ee(s)),fe(a=>a===e?null:e)},[Ee]);i.useEffect(()=>{if(!D)return;const e=n=>{if(x.current&&x.current.contains(n.target))return;const s=E.current[D];s&&s.contains(n.target)||Object.values(E.current).some(o=>o&&o.contains(n.target))||fe(null)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[D]),i.useEffect(()=>{if(!D)return;const e=()=>{const n=E.current[D];if(!n)return;const s=n.getBoundingClientRect();h(Ee(s))};return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[D,Ee]),i.useLayoutEffect(()=>{if(!D)return;const e=x.current,n=E.current[D];if(!e||!n)return;const s=e.offsetWidth,a=n.getBoundingClientRect(),o=8,p=typeof window<"u"?window.innerWidth:1/0;if(!(a.left+s>p-o))return;const b=Math.max(o,a.right-s);h(O=>O.left===b?O:{...O,left:b})},[D,m.top]);const nt=i.useCallback(e=>!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([,n])=>n==null?!1:typeof n=="string"?n.trim()!=="":!0)),[]),rt=i.useCallback((e,n)=>{const s=Object.keys(e||{}),a=Object.keys(n||{});return s.length!==a.length?!1:s.every(o=>e[o]===n[o])},[]);i.useEffect(()=>{if(!P||F===null)return;const e=nt(F);he(n=>rt(n,e)?n:e)},[P,F,nt,rt]),i.useCallback((e,n)=>e==="csat_score"&&n==="evaluation.csat_score"?n:e,[]);const we=X&&S.length>0?S[0][0]:V,Me=X&&S.length>0?S[0][1]:Te,[dn,st]=i.useState(()=>l.map(e=>e.id||e.key)),se=i.useCallback(e=>{if(!e||e.length===0)return e;let n=Array.from(new Set(e));n.length>G&&(n=n.slice(0,G));const a=l.map(u=>u.id||u.key).includes(N);return!n.includes(N)&&a&&(n.length>=G?n=[...n.slice(0,G-1),N]:n=[...n,N]),[...n.filter(u=>u!==N),N]},[l]),[W,Fe]=i.useState(()=>{if(typeof window<"u"&&j)try{if(localStorage.getItem(`dataTable_manual_change_${j}:${B}`)==="true"){const a=localStorage.getItem(`dataTable_columns_${j}:${B}`);if(a){const o=JSON.parse(a);if(Array.isArray(o)&&o.length>0){ne.current=!0;const p=o.filter(u=>l.some(b=>(b.id||b.key)===u));if(p.length>0)return p.slice(0,G)}}}}catch(s){console.warn("Failed to load saved columns from localStorage:",s)}const n=l.map(s=>s.id||s.key).slice(0,G);return se(n)}),[oe,qe]=i.useState(!1),[xe,ze]=i.useState([]),[ot,Rt]=i.useState({top:0,left:0,width:0}),[it,at]=i.useState(new Set),[lt,ct]=i.useState(new Set),Be=i.useRef(null);Be.current===null&&(Be.current=[...W]);const[le,Ke]=i.useState(null),[Et,Ne]=i.useState(null),ge=i.useRef(null),Xe=i.useRef(null),Ge=i.useRef(null),[dt,Ue]=i.useState(null),[Je,Mt]=i.useState({}),zt=i.useRef(null),We=i.useRef(null),H=e=>e.id||e.key,Ae=i.useCallback(e=>{if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){const n=e.trim();if(n.endsWith("px")){const a=parseFloat(n);return Number.isFinite(a)?a:null}const s=parseFloat(n);return Number.isFinite(s)&&`${s}`===n?s:null}return null},[]),ut=i.useCallback((e,n)=>Je[e]!=null?`${Je[e]}px`:typeof n=="number"?`${n}px`:n||"auto",[Je]),$e=i.useCallback(e=>{if(!We.current)return;const{columnId:n,startX:s,startWidth:a,minWidth:o,maxWidth:p}=We.current,u=e.clientX-s,b=Math.round(a+u),O=Math.min(p,Math.max(o,b));Mt(L=>({...L,[n]:O}))},[]),je=i.useCallback(()=>{We.current=null,document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",$e),document.removeEventListener("mouseup",je)},[$e]),Bt=i.useCallback((e,n,s)=>{var Le;e.preventDefault(),e.stopPropagation();const a=n.id||n.key,o=Ae(n.minWidth)??C,p=Ae(n.maxWidth)??$,u=Math.min(o,p),b=Math.max(o,p),O=((Le=e.currentTarget.closest("th"))==null?void 0:Le.getBoundingClientRect().width)||0,L=Ae(s),Ce=L??Math.max(u,Math.round(O)||u),Ye=Math.min(b,Math.max(u,Ce));We.current={columnId:a,startX:e.clientX,startWidth:Ye,minWidth:u,maxWidth:b},document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",$e),document.addEventListener("mouseup",je)},[$,C,$e,je,Ae]);i.useEffect(()=>()=>je(),[je]);const Nt=T.useSensors(T.useSensor(T.PointerSensor),T.useSensor(T.KeyboardSensor,{coordinateGetter:T.sortableKeyboardCoordinates})),Wt=e=>{const{active:n,over:s}=e;if(s&&n.id!==s.id){if(n.id===N||s.id===N){pt("Cannot drop columns on the Action column"),Ue(null);return}ne.current=!0,Fe(a=>{const o=a.indexOf(n.id),p=a.indexOf(s.id);if(o!==-1&&p!==-1){const u=T.arrayMove(a,o,p),b=se(u);return mt(b),b}return a}),st(a=>{const o=a.indexOf(n.id),p=a.indexOf(s.id);return T.arrayMove(a,o,p)})}Ue(null)},At=e=>{Ue(e.active.id)},Ie=i.useMemo(()=>{if(P)return r||[];if(!r||r.length===0)return[];const e=ve.trim().toLowerCase(),n=Object.entries(_).filter(([,s])=>De(s));return r.filter(s=>{for(const[a,o]of n){const p=s[a];if(p==null)return!1;if(Array.isArray(o)){const u=String(p);if(!o.some(b=>String(b)===u))return!1;continue}if(o.type==="range"){const u=tt(p);if(isNaN(u)||o.min!==""&&o.min!=null&&u<Number(o.min)||o.max!==""&&o.max!=null&&u>Number(o.max))return!1;continue}if(o.type==="durationRange"){const u=Yt(p);if(isNaN(u)||o.minSec!==""&&o.minSec!=null&&u<Number(o.minSec)||o.maxSec!==""&&o.maxSec!=null&&u>Number(o.maxSec))return!1;continue}if(o.type==="scoreRange"){const u=tt(p);if(isNaN(u))return!1;if(Array.isArray(o.values)&&o.values.length>0){const b=Math.floor(u);if(!o.values.includes(b))return!1;continue}if(o.min!==""&&o.min!=null&&u<Number(o.min)||o.max!==""&&o.max!=null&&u>Number(o.max))return!1;continue}if(o.type==="dateRange"){const u=Qt(p);if(!u)return!1;if(o.from){const b=new Date(o.from+"T00:00:00");if(u<b)return!1}if(o.to){const b=new Date(o.to+"T23:59:59");if(u>b)return!1}continue}}return!(e&&!Object.values(s).some(o=>o==null?!1:String(o).toLowerCase().includes(e)))})},[r,_,ve,P]),ke=i.useMemo(()=>X||!we?Ie:[...Ie].sort((e,n)=>{const s=e[we],a=n[we];if(s==null)return 1;if(a==null)return-1;if(typeof s=="number"&&typeof a=="number")return Me==="asc"?s-a:a-s;const o=String(s).toLowerCase(),p=String(a).toLowerCase();return Me==="asc"?o.localeCompare(p):p.localeCompare(o)}),[Ie,we,Me,X]),Oe=i.useMemo(()=>{if(U)return ke;{const e=(Q-1)*te,n=e+te;return ke.slice(e,n)}},[ke,Q,te,U]),ft=e=>{X&&M?(M(e),g?g(1):J(1)):(V===e?re(Te==="asc"?"desc":"asc"):(pe(e),re("asc")),me(1))},$t=(e,n)=>{const s=(n||"").split(/\s+/).map(a=>a.trim()).filter(Boolean);_e(e,s)},pt=e=>{Ge.current||(typeof A=="function"&&A(e),Ge.current=setTimeout(()=>{Ge.current=null},3e3))},mt=i.useCallback(e=>{if(typeof window<"u"&&Z&&e.length>0&&ne.current)try{localStorage.setItem(Z,JSON.stringify(e)),ae&&localStorage.setItem(ae,"true")}catch(n){console.warn("Failed to save columns to localStorage:",n)}},[Z,ae]),It=e=>{e!==N&&ze(n=>n.includes(e)?n.length===1?n:n.filter(s=>s!==e):n.length>=G?(pt("Maximum 9 column selection allowed"),n):se([...n,e]))},Ot=(e,n)=>{xe[n]!==N&&Ke(n)},Lt=()=>{Ke(null),Ne(null)},Pt=(e,n)=>{e.preventDefault(),le!==null&&le!==n&&Ne(n)},Tt=()=>{Ne(null)},_t=(e,n)=>{e.preventDefault(),le!==null&&le!==n&&xe[n]!==N&&xe[le]!==N&&ze(s=>{const a=T.arrayMove(s,le,n);return se(a)}),Ke(null),Ne(null)};i.useEffect(()=>{st(e=>{const n=W.filter(o=>e.includes(o)),s=W.filter(o=>!e.includes(o)),a=e.filter(o=>!W.includes(o));return[...n,...s,...a]})},[W]),i.useEffect(()=>{if(typeof window<"u"&&Z&&W.length>0&&ne.current)try{const e=se(W);localStorage.setItem(Z,JSON.stringify(e)),ae&&localStorage.setItem(ae,"true")}catch(e){console.warn("Failed to save columns to localStorage:",e)}},[W,Z,ae]),i.useEffect(()=>{ce&&ce(W.filter(e=>e!==N))},[W,ce]),i.useEffect(()=>{if(l.length>0&&W.length===0){if(typeof window<"u"&&j)try{if(localStorage.getItem(`dataTable_manual_change_${j}:${B}`)==="true"){const s=localStorage.getItem(`dataTable_columns_${j}:${B}`);if(s){const a=JSON.parse(s);if(Array.isArray(a)&&a.length>0){const o=a.filter(p=>l.some(u=>(u.id||u.key)===p));if(o.length>0){ne.current=!0,Fe(o.slice(0,G));return}}}}}catch(n){console.warn("Failed to load saved columns from localStorage:",n)}const e=l.map(n=>n.id||n.key);Fe(se(e.slice(0,G)))}},[l,j,B,se]);const ye=i.useMemo(()=>{const e=W.map(n=>l.find(s=>H(s)===n)).filter(Boolean);return se(e.map(H)).map(n=>l.find(s=>H(s)===n)).filter(Boolean)},[l,W]);i.useMemo(()=>ye.some(e=>e.filterable===!0),[ye]),i.useEffect(()=>{if(!oe||!ge.current)return;const e=()=>{if(ge.current){const n=ge.current.getBoundingClientRect(),s=217,a=Math.max(8,n.right-s);Rt({top:n.bottom,left:a,width:Math.max(n.width||220,220)})}};return e(),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[oe]),i.useEffect(()=>{const e=n=>{oe&&ge.current&&!ge.current.contains(n.target)&&Xe.current&&!Xe.current.contains(n.target)&&qe(!1)};if(oe)return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[oe]),i.useEffect(()=>{oe&&(ze(W),at(new Set),ct(new Set))},[oe,W]),W.length===1?(bt=l.find(e=>(e.id||e.key)===W[0]))!=null&&bt.label:`${W.length}`;function Ht({column:e,isHeaderRow:n=!0}){const s=H(e),a=s===N,o=ut(s,e.width),[p,u]=i.useState(!1),{attributes:b,listeners:O,setNodeRef:L,transform:Ce,transition:Ye,isDragging:Le}=T.useSortable({id:s}),Kt={transform:T.CSS.Transform.toString(Ce),transition:Ye,opacity:Le?.5:1,width:o,minWidth:o};let be=!1;if(X&&S.length>0){const k=S[0][0];(k===s||k==="csat_score"&&s==="evaluation.csat_score")&&(be=!0)}else be=we===s;const Xt=Me==="asc",Gt=e.filterable===!0;if(!n)return t.jsx("th",{style:{width:o,minWidth:o,backgroundColor:"var(--primary-foreground)",borderRight:"1px solid #e6e6e6",borderBottom:"1px solid #e6e6e6",boxSizing:"border-box"},className:"sticky top-[57px] z-10 border-b border-[var(--border-strong)] px-4 py-2 text-left",children:Gt?t.jsxs("div",{className:"relative",children:[t.jsx(Filter,{size:12,className:"absolute left-2 top-1/2 -translate-y-1/2 text-[var(--text-faint)] pointer-events-none"}),t.jsx("input",{type:"text",placeholder:"Filter...",value:_[s]||"",onChange:k=>{k.stopPropagation(),$t(s,k.target.value)},onKeyDown:k=>k.stopPropagation(),onMouseDown:k=>k.stopPropagation(),className:"w-full pl-7 pr-2 py-1.5 text-xs border border-[var(--border)] rounded text-[var(--text-ink)] placeholder:text-[var(--text-faint)] focus:outline-none focus:border-[var(--border-hover)] focus:ring-1 focus:ring-[var(--focus)] transition-colors",style:{fontFamily:"var(--font-sans)",backgroundColor:"var(--primary-foreground)"},autoComplete:"off"})]}):t.jsx("div",{className:"h-[34px]"})});const Qe=D===s,Pe=De(_[s]),Ut=e.sortable!==!1&&(p||be),Jt=e.filterable!==!1&&!a&&(p||Qe||Pe);return t.jsxs("th",{ref:L,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),style:{...Kt,padding:"0 12px",height:36,textAlign:a?"center":"left",fontWeight:500,fontSize:"14px",letterSpacing:"normal",textTransform:"none",color:"#0b0b0b",cursor:e.sortable!==!1?"pointer":"default",width:o,...typeof o=="string"&&o.endsWith("px")?{maxWidth:o}:{},borderRight:"1px solid #e6e6e6",boxSizing:"border-box",userSelect:"none",whiteSpace:"nowrap",wordBreak:"normal",overflowWrap:"normal",verticalAlign:"middle",background:p||Qe?"#e6e6e6":"#f2f2f0",borderBottom:"1px solid #e6e6e6",position:"sticky",top:0,zIndex:10,fontFamily:"var(--font-sans)",transition:"background 100ms ease"},children:[!a&&t.jsx("span",{"aria-hidden":"true",style:{position:"absolute",left:0,top:"50%",transform:"translateY(-50%)",width:1,height:16,background:"#e6e6e6",pointerEvents:"none",zIndex:1}}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",justifyContent:a?"center":"flex-start",position:"relative",minHeight:20,minWidth:0,width:"100%",overflow:"hidden"},children:[!a&&t.jsx("div",{...b,...O,style:{cursor:"grab",color:"rgba(11, 11, 11, 0.36)",display:"inline-flex",alignItems:"center",visibility:p?"visible":"hidden",flexShrink:0},children:t.jsx(I.GripVertical,{size:14})}),t.jsx("span",{onClick:()=>e.sortable!==!1&&ft(s),title:typeof e.label=="string"?e.label:void 0,style:{cursor:e.sortable!==!1?"pointer":"default",flex:a?"none":1,minWidth:0,lineHeight:"20px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.label}),Ut&&t.jsx("button",{type:"button",onClick:k=>{k.stopPropagation(),ft(s)},title:"Sort",style:{background:"transparent",border:"none",padding:4,borderRadius:4,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",color:be?"#0b0b0b":"rgba(11, 11, 11, 0.55)",flexShrink:0},children:be?Xt?t.jsx(I.ArrowUp,{size:14,strokeWidth:1.75}):t.jsx(I.ArrowDown,{size:14,strokeWidth:1.75}):t.jsx(I.ArrowUpDown,{size:14,strokeWidth:1.75})}),Jt&&t.jsxs("button",{type:"button",ref:k=>{E.current[s]=k},onClick:k=>{k.stopPropagation(),Dt(s,k.currentTarget)},title:"Filter",style:{position:"relative",background:Qe||Pe?"#D8D8D8":"transparent",border:"none",padding:4,borderRadius:4,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",color:Pe?"#0b0b0b":"rgba(11, 11, 11, 0.7)",flexShrink:0},children:[t.jsx(I.ListFilter,{size:14,strokeWidth:1.75}),Pe&&t.jsx("span",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,width:6,height:6,borderRadius:"50%",background:"#0B0B0B"}})]})]}),!a&&t.jsx("span",{"aria-hidden":"true",style:{position:"absolute",right:0,top:"50%",transform:"translateY(-50%)",width:1,height:16,background:"#e6e6e6",pointerEvents:"none",zIndex:1}}),!a&&t.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":`Resize ${e.label||s} column`,title:"Drag to resize column",onMouseDown:k=>Bt(k,e,o),onClick:k=>k.stopPropagation(),onMouseEnter:k=>{k.currentTarget.style.background="rgba(30, 33, 37, 0.18)"},onMouseLeave:k=>{k.currentTarget.style.background="transparent"},style:{position:"absolute",top:0,right:-2,width:4,height:"100%",cursor:"col-resize",zIndex:4,background:"transparent"}})]})}const ht=dt?l.find(e=>H(e)===dt):null,xt=({col:e,columnId:n,isSelected:s,draggable:a,isAction:o,actualIndex:p})=>{const u=a&&le===p,b=a&&Et===p&&le!==null&&le!==p;s?lt.has(n):it.has(n);const O=s?!lt.has(n):it.has(n);return t.jsxs("div",{draggable:a,onDragStart:a?L=>Ot(L,p):void 0,onDragEnd:a?Lt:void 0,onDragOver:a?L=>Pt(L,p):void 0,onDragLeave:a?Tt:void 0,onDrop:a?L=>_t(L,p):void 0,onClick:()=>{o||It(n)},style:{display:"flex",alignItems:"center",gap:4,padding:"2px 0",cursor:o?"default":a?"grab":"pointer",opacity:u?.5:1,background:b?"#F2F2F0":"transparent",borderRadius:6},children:[t.jsx("span",{style:{width:16,height:16,display:"inline-flex",alignItems:"center",justifyContent:"center",color:"#989898",visibility:a?"visible":"hidden",flexShrink:0},children:t.jsx(I.GripVertical,{size:14,strokeWidth:1.75})}),t.jsx("span",{style:{width:20,height:20,borderRadius:4,display:"inline-flex",alignItems:"center",justifyContent:"center",background:O?"#0B0B0B":"#FFFFFF",border:`1px solid ${O?"#0B0B0B":"#676767"}`,flexShrink:0,marginLeft:8},children:O&&t.jsx(I.Check,{size:14,color:"#FFFFFF",strokeWidth:3})}),t.jsx("span",{style:{flex:1,fontFamily:"var(--font-sans)",fontSize:14,lineHeight:"20px",color:"#0B0B0B",marginLeft:8},children:e.label})]})},qt=oe?t.jsxs("div",{ref:Xe,style:{position:"fixed",top:`${ot.top}px`,left:`${ot.left}px`,width:217,maxHeight:320,zIndex:49,background:"#FFFFFF",border:"1px solid #E6E6E6",borderRadius:10,overflow:"hidden",display:"flex",flexDirection:"column",fontFamily:"var(--font-sans)",boxShadow:"0 8px 24px rgba(11, 11, 11, 0.08)"},children:[t.jsxs("div",{style:{flex:1,minHeight:0,overflowY:"auto",padding:12,display:"flex",flexDirection:"column",gap:12},children:[xe.map((e,n)=>{if(e===N)return null;const s=l.find(a=>H(a)===e);return s?t.jsx(i.Fragment,{children:xt({col:s,columnId:e,isSelected:!0,draggable:!0,isAction:!1,actualIndex:n})},`selected-${e}-${n}`):null}),l.filter(e=>{const n=H(e);return n!==N&&!xe.includes(n)}).map(e=>{const n=H(e);return t.jsx(i.Fragment,{children:xt({col:e,columnId:n,isSelected:!1,draggable:!1,isAction:!1,actualIndex:-1})},`unselected-${n}`)})]}),t.jsxs("div",{style:{flexShrink:0,borderTop:"1px solid #D9D9D9",padding:"8px 12px",background:"#FFFFFF",display:"flex",alignItems:"center",justifyContent:"space-between",height:46,boxSizing:"border-box"},children:[t.jsx("button",{type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation();const n=Be.current?[...Be.current]:l.map(H).slice(0,G),s=se(n);if(ne.current=!1,ze(s),Fe(s),at(new Set),ct(new Set),typeof window<"u"&&Z)try{localStorage.removeItem(Z)}catch{}},style:{background:"transparent",border:"none",padding:0,cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:14,fontWeight:500,color:"#323232"},children:"Reset"}),t.jsx("button",{type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation();const n=se(xe);ne.current=!0,Fe(n),mt(n),qe(!1)},style:{background:"#2E3236",color:"#FFFFFF",border:"none",borderRadius:10,height:28,padding:"0 14px",fontFamily:"var(--font-sans)",fontSize:14,fontWeight:600,cursor:"pointer"},children:"Apply"})]})]}):null,gt=D?l.find(e=>H(e)===D):null,yt=gt?t.jsx(sn,{column:gt,columnId:D,filterType:Ct(D),position:m,popoverRef:x,distinctValues:He(D),initialValue:_[D],onApply:e=>{_e(D,e),fe(null)},onCancel:()=>fe(null)},D):null;return t.jsxs("div",{className:"w-full",children:[yt&&et.createPortal(yt,document.body),l.length>0&&(z||!ie)&&t.jsx("div",{className:"pt-2 pb-1",style:{position:"sticky",zIndex:35,backgroundColor:"var(--primary-foreground)"},children:t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:16,flexWrap:"wrap"},children:[z&&t.jsx("div",{style:{marginRight:"auto"},children:t.jsx(jt,{dateRangePicker:z.dateRangePicker,onWeekToDate:z.onWeekToDate,exportConfig:z.exportConfig,filterChipsConfig:z.filterChipsConfig,trailingActions:z.trailingActions})}),!ie&&t.jsxs("div",{style:{position:"relative"},children:[t.jsxs("button",{ref:ge,type:"button",onClick:()=>qe(!oe),style:{display:"inline-flex",alignItems:"center",gap:10,height:32,padding:"0 16px",background:"#FFFFFF",border:"1px solid #D9D9D9",borderRadius:10,cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:14,fontWeight:600,color:"#2E3236",whiteSpace:"nowrap"},children:[t.jsx(I.Settings2,{size:20,strokeWidth:1.75}),"Columns"]}),oe&&et.createPortal(qt,document.body)]})]})}),Object.keys(_).length>0&&t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",padding:"8px 0"},children:[Object.entries(_).map(([e,n])=>{const s=l.find(u=>H(u)===e);if(!s||!De(n))return null;const a=Vt(n),o=en(n),p=tn(n);return t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:8,height:28,padding:"0 12px",borderRadius:20,border:"1px solid #B2B2B0",background:"#F2F2F0",fontFamily:"var(--font-sans)",fontSize:14,lineHeight:"20px",color:"#0B0B0B",whiteSpace:"nowrap"},children:[t.jsxs("span",{children:[t.jsxs("span",{style:{color:"#676767"},children:[s.label,": "]}),t.jsx("span",{children:a})]}),o>0&&t.jsx(nn,{count:o,values:p}),t.jsx("button",{type:"button",onClick:()=>_e(e,[]),"aria-label":`Remove ${s.label} filter`,style:{background:"transparent",border:"none",padding:0,cursor:"pointer",display:"inline-flex",color:"#676767"},children:t.jsx(I.X,{size:14,strokeWidth:2})})]},`chip-${e}`)}),t.jsx("button",{type:"button",onClick:kt,style:{marginLeft:"auto",background:"transparent",border:"none",padding:"0 4px",cursor:"pointer",fontFamily:"var(--font-sans)",fontSize:14,fontWeight:500,color:"#323232"},children:"Reset"})]}),l.length>0&&ye.length>0?t.jsxs(T.DndContext,{sensors:Nt,collisionDetection:T.closestCenter,onDragStart:At,onDragEnd:Wt,children:[t.jsxs("div",{style:{borderRadius:8,border:"1px solid #E6E6E6",overflow:"hidden",background:"var(--primary-foreground)",position:"relative",top:"0.5rem"},children:[q&&t.jsx("div",{style:{position:"absolute",inset:0,background:"rgba(255, 255, 255, 0.9)",backdropFilter:"blur(2px)",zIndex:20,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",borderRadius:"14px"},children:t.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"12px"},children:[t.jsx("p",{style:{fontSize:"13px",color:"rgba(30, 33, 37, 0.6)",margin:0},children:"Loading..."}),t.jsx(an,{src:"/BrandLoading.gif",alt:"Loading",width:50,height:50,unoptimized:!0,className:"mt-1"})]})}),t.jsx("div",{className:"overflow-x-auto custom-thin-scrollbar-hidden",ref:zt,style:{maxHeight:"500px",overflowY:"auto",position:"relative",zIndex:1},children:t.jsxs("table",{style:{width:"auto",minWidth:"100%",tableLayout:"fixed",borderCollapse:"collapse",fontSize:"13px",fontFamily:"var(--font-sans)",border:"1px solid #e6e6e6",boxSizing:"border-box"},children:[t.jsx("thead",{children:t.jsx("tr",{children:t.jsx(T.SortableContext,{items:W,strategy:T.horizontalListSortingStrategy,children:ye.map(e=>t.jsx(Ht,{column:e,isHeaderRow:!0},`header-${H(e)}`))})})}),t.jsx("tbody",{children:!q&&Oe.length===0?t.jsx("tr",{children:t.jsx("td",{colSpan:ye.length,style:{padding:"32px",textAlign:"center",color:"rgba(30, 33, 37, 0.42)",fontSize:"12px",fontFamily:"var(--font-sans)"},children:"No results found"})}):!q&&Oe.length>0?Oe.map((e,n)=>t.jsx("tr",{"data-row-id":e.id||n,style:{borderBottom:"1px solid #e6e6e6",cursor:f?"pointer":"default",transition:"background 0.15s ease"},onClick:f?s=>{s.stopPropagation(),f(e,n)}:void 0,onMouseEnter:s=>{s.currentTarget.style.background="#E6E6E6"},onMouseLeave:s=>{s.currentTarget.style.background="transparent"},children:ye.map(s=>{const a=H(s),o=ut(a,s.width),p=e[a],u=s.render?s.render(p,e):p,b=o&&o!=="auto",O=typeof u=="string"&&u.trim()!=="",L=b&&O,Ce=L?t.jsx(ee,{content:u,children:u}):u;return t.jsx("td",{style:{padding:"10px 14px",color:"rgba(30, 33, 37, 0.78)",fontSize:"13px",borderRight:"1px solid #e6e6e6",boxSizing:"border-box",width:o,fontFamily:"var(--font-sans)",...L&&{maxWidth:o||"200px"}},children:Ce},a)})},n)):null})]})})]}),t.jsx(T.DragOverlay,{children:ht?t.jsx("div",{className:"bg-[var(--paper-high)] border border-[var(--border-strong)] rounded px-4 py-2 shadow-lg",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(I.GripVertical,{size:14,className:"text-[var(--text-faint)]"}),t.jsx("span",{className:"text-sm font-semibold text-[var(--text-ink)]",children:ht.label})]})}):null})]}):null,(()=>{const e=!P&&(ve.trim()!==""||Object.values(_).some(s=>De(s))),n=U?e?ke.length:v:ke.length;return n<=0?null:t.jsx(Ft.Pagination,{page:Q,pageSizeOptions:[5,10,20,50,100],pageSize:te,totalCount:n,currentDataLength:Oe.length,onPageChange:me,onPageSizeChange:s=>{Se(s),me(1)},showPageSizeSelector:!0})})()]})}exports.DataTable2=cn;exports.DataTableFilters=jt;
|
|
2
2
|
//# sourceMappingURL=DataTable2.cjs.js.map
|