chordia-ui 4.0.2 → 4.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";const t=require("react/jsx-runtime"),i=require("react"),_=require("./sortable.esm.cjs.js"),I=require("lucide-react"),it=require("react-dom"),Ct=require("./CustomFilterChips.cjs.js");require("motion/react");require("recharts");require("./AgentLiftAnalysisCard.cjs.js");require("./TourGuideTooltip.cjs.js");function Dt({dateRangePicker:r,onWeekToDate:l,exportConfig:u,filterChipsConfig:p,trailingActions:S}){const[b,c]=i.useState(!1),y=i.useRef(null),M=i.useRef(null);i.useEffect(()=>{const j=v=>{M.current&&!M.current.contains(v.target)&&y.current&&!y.current.contains(v.target)&&c(!1)};if(b)return document.addEventListener("mousedown",j),()=>{document.removeEventListener("mousedown",j)}},[b]);const F=()=>{c(j=>!j)},k=j=>{c(!1),u!=null&&u.onExport&&u.onExport(j)},O=(()=>{if(!(p!=null&&p.filters))return!1;const j=p.filters,v=p.customFilters||[],z=Object.entries(j).some(([R,E])=>!!(Array.isArray(E)&&E.length||typeof E=="string"&&E.trim()!==""||E&&typeof E=="object"&&(E.min!=null||E.max!=null))),P=v.some(R=>R.active);return z||P})();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}),u&&t.jsxs("div",{className:"relative",children:[t.jsxs("button",{ref:y,onClick:F,disabled:u.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:u.isExporting?"Exporting...":"Export"})]}),t.jsx(I.ChevronDown,{size:16})]}),b&&t.jsx("div",{ref:M,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:(u.types||["csv"]).map(j=>t.jsxs("button",{onClick:()=>k(j),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 ",j.toUpperCase()]},j))})]}),(O||S)&&t.jsxs(t.Fragment,{children:[O&&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:[O&&p&&t.jsx(Ct.CustomFilterChips,{filters:p.filters,onChange:p.onChange,onClear:p.onClear,customFilters:p.customFilters||[],fieldOptions:p.fieldOptions||{}}),S&&t.jsx("div",{className:"flex-shrink-0",children:S})]})]})]})}function at(r){if(r==null)return NaN;const l=String(r).replace(/[,$%]|pp/gi,"").trim(),u=parseFloat(l);return Number.isFinite(u)?u:NaN}function Qt(r){if(r==null)return NaN;const l=String(r).trim(),u=l.match(/^(\d+):(\d+)(?::(\d+))?$/);if(u){const F=+u[1],k=+u[2],D=u[3]!=null?+u[3]:null;return D!=null?F*3600+k*60+D:F*60+k}let p=0,S=!1;const b=l.match(/(\d+)\s*d\b/i),c=l.match(/(\d+)\s*h\b/i),y=l.match(/(\d+)\s*m(?!s)\b/i),M=l.match(/(\d+)\s*s\b/i);return b&&(p+=+b[1]*86400,S=!0),c&&(p+=+c[1]*3600,S=!0),y&&(p+=+y[1]*60,S=!0),M&&(p+=+M[1],S=!0),S?p:NaN}function Yt(r){if(!r)return null;const l=String(r).trim(),u=l.match(/^(\d{1,2})\/(\d{1,2})\/(\d{2,4})$/);if(u){const S=u[3].length===2?2e3+ +u[3]:+u[3],b=new Date(S,+u[1]-1,+u[2]);return isNaN(b.getTime())?null:b}const p=new Date(l);return isNaN(p.getTime())?null:p}function Zt(r){if(!r||r.length===0)return"text";const l=r.slice(0,25),u=p=>l.every(p);return u(p=>/^\d{1,2}\/\d{1,2}\/\d{2,4}$/.test(p)||/^\d{4}-\d{2}-\d{2}/.test(p))?"date":u(p=>/^\d+\s*[dhms]\b/i.test(p)||/^\d+:\d+(:\d+)?$/.test(p))?"duration":u(p=>/^-?[\d,.]+(%|pp)?$/i.test(p))?"number":"text"}function Oe(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 Ft(r){if(r==null||r===""||isNaN(r))return"";const l=Number(r),u=Math.floor(l/3600),p=Math.floor(l%3600/60),S=Math.floor(l%60);return u>0?`${u}h ${p}m`:p>0?`${p}m ${S}s`:`${S}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,u=r.max!==""&&r.max!=null?r.max:null;return l!=null&&u!=null?`${l} – ${u}`:l!=null?`≥ ${l}`:u!=null?`≤ ${u}`:""}if(r.type==="durationRange"){const l=r.minSec!==""&&r.minSec!=null?Ft(r.minSec):null,u=r.maxSec!==""&&r.maxSec!=null?Ft(r.maxSec):null;return l&&u?`${l} – ${u}`:l?`≥ ${l}`:u?`≤ ${u}`:""}if(r.type==="scoreRange"){if(Array.isArray(r.values)&&r.values.length>0)return r.values.slice().sort((p,S)=>p-S).join(", ");const l=r.min!==""&&r.min!=null?r.min:null,u=r.max!==""&&r.max!=null?r.max:null;return l!=null&&u!=null?`${l} – ${u}`:l!=null?`≥ ${l}`:u!=null?`≤ ${u}`:""}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[u,p]=i.useState(!1);return t.jsxs("span",{onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!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,u&&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:u,rightValue:p,onLeftChange:S,onRightChange:b,type:c="number",placeholderLeft:y="Min",placeholderRight:M="Max"}){const F={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"},k={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:k,children:r}),t.jsx("input",{type:c,value:u,onChange:D=>S(D.target.value),placeholder:y,style:F})]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[t.jsx("span",{style:k,children:l}),t.jsx("input",{type:c,value:p,onChange:D=>b(D.target.value),placeholder:M,style:F})]})]})}const jt=[{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 kt(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 u=Number(r);return Number.isFinite(u)?u:null}function st({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 ot({minValue:r,maxValue:l,onMinChange:u,onMaxChange:p,inputType:S="number",inputMode:b="decimal",step:c,placeholder:y="0.0",unit:M}){const F={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:S,inputMode:b,step:c,placeholder:y,value:r,onChange:k=>u(k.target.value),style:F})]}),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:S,inputMode:b,step:c,placeholder:y,value:l,onChange:k=>p(k.target.value),style:F})]})]}),M&&t.jsxs("span",{style:{fontSize:11,color:"#676767",fontFamily:"var(--font-sans)"},children:["Enter durations in ",M==="sec"?"seconds":M]})]})}function sn({column:r,columnId:l,filterType:u="text",position:p,popoverRef:S,distinctValues:b,initialValue:c,onApply:y,onCancel:M,onSearch:F=null,searchMinChars:k=3}){const D=u==="text",O=u==="number",j=u==="date",v=u==="duration",z=u==="score",P=/duration/i.test(String((r==null?void 0:r.label)||l||"")),R=i.useMemo(()=>{if(!z||!Array.isArray(b)||b.length===0)return!1;let m=1/0,h=-1/0;for(const x of b){const w=at(x);Number.isFinite(w)&&(w<m&&(m=w),w>h&&(h=w))}return Number.isFinite(m)&&Number.isFinite(h)&&m>=0&&h<=5},[z,b]),[E,ie]=i.useState(()=>D?new Set(Array.isArray(c)?c:[]):new Set),[fe,G]=i.useState(""),[W,ne]=i.useState(()=>O&&(c==null?void 0:c.type)==="range"&&c.min!=null?c.min:""),[Q,H]=i.useState(()=>O&&(c==null?void 0:c.type)==="range"&&c.max!=null?c.max:""),[q,pe]=i.useState(new Set),[Y,V]=i.useState(()=>v&&(c==null?void 0:c.type)==="durationRange"&&c.minSec!=null&&c.minSec!==""?String(c.minSec):""),[me,ee]=i.useState(()=>v&&(c==null?void 0:c.type)==="durationRange"&&c.maxSec!=null&&c.maxSec!==""?String(c.maxSec):""),[ae,ye]=i.useState(()=>z&&(c==null?void 0:c.type)==="scoreRange"&&Array.isArray(c.values)?new Set(c.values):new Set),[ke,U]=i.useState(()=>z&&(c==null?void 0:c.type)==="scoreRange"&&c.min!=null&&c.min!==""?String(c.min):""),[B,re]=i.useState(()=>z&&(c==null?void 0:c.type)==="scoreRange"&&c.max!=null&&c.max!==""?String(c.max):""),[te,le]=i.useState(()=>j&&(c==null?void 0:c.type)==="dateRange"&&c.from||""),[K,be]=i.useState(()=>j&&(c==null?void 0:c.type)==="dateRange"&&c.to||"");i.useEffect(()=>{D&&ie(new Set(Array.isArray(c)?c:[]))},[l,D]);const[Se,Ce]=i.useState(null),[N,ce]=i.useState(!1),xe=i.useRef(0),Z=fe.trim(),ge=D&&typeof F=="function"&&Z.length>=k;i.useEffect(()=>{if(!D||typeof F!="function")return;if(Z.length<k){Ce(null),ce(!1);return}const m=++xe.current;ce(!0);const h=setTimeout(async()=>{try{const x=await F(Z);if(m!==xe.current)return;const w=Array.isArray(x)?x.map(A=>A&&typeof A=="object"?A.label??A.value:A).filter(A=>A!=null&&A!=="").map(String):[];Ce(w)}catch{m===xe.current&&Ce([])}finally{m===xe.current&&ce(!1)}},300);return()=>clearTimeout(h)},[D,F,Z,k]);const he=i.useMemo(()=>{const m=Z.toLowerCase(),h=ge?Se||[]:m?b.filter(w=>String(w).toLowerCase().includes(m)):b,x=new Map;for(const w of h)x.set(String(w),w);for(const w of E)x.set(String(w),w);return Array.from(x.values()).sort((w,A)=>{const de=E.has(w),ze=E.has(A);return de!==ze?de?-1:1:String(w).localeCompare(String(A))})},[b,Z,E,ge,Se]),De=m=>{ie(h=>{const x=new Set(h);return x.has(m)?x.delete(m):x.add(m),x})},Je=()=>{D&&ie(new Set),O&&(ne(""),H("")),v&&(pe(new Set),V(""),ee("")),z&&(ye(new Set),U(""),re("")),j&&(le(""),be("")),G("")},Re=m=>{pe(h=>{const x=new Set(h);return x.has(m)?x.delete(m):x.add(m),x})},Ee=m=>{ye(h=>{const x=new Set(h);return x.has(m)?x.delete(m):x.add(m),x})},Me=()=>{if(D)return y(Array.from(E));if(O)return y({type:"range",min:W===""?"":Number(W),max:Q===""?"":Number(Q)});if(v){const m=kt(Y),h=kt(me),x=m!=null||h!=null;let w="",A="";if(x)w=m??"",A=h??"";else if(q.size>0){const de=jt.filter(J=>q.has(J.id));w=Math.min(...de.map(J=>J.minSec)),A=de.some(J=>J.maxSec==null)?"":Math.max(...de.map(J=>J.maxSec))}return y({type:"durationRange",minSec:w,maxSec:A})}if(z){const m=ke===""?null:Number(ke),h=B===""?null:Number(B);return m!=null||h!=null?y({type:"scoreRange",values:[],min:m!=null&&Number.isFinite(m)?m:"",max:h!=null&&Number.isFinite(h)?h:""}):y({type:"scoreRange",values:Array.from(ae).sort((w,A)=>w-A),min:"",max:""})}if(j)return y({type:"dateRange",from:te,to:K})};return t.jsxs("div",{ref:S,role:"dialog","aria-label":`Filter ${r.label||l}`,style:{position:"fixed",top:p.top,left:p.left,zIndex:50,width:D?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:[D&&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:fe,onChange:m=>G(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:typeof F=="function"&&Z.length>0&&Z.length<k?t.jsx("div",{style:{fontSize:13,color:"#676767",padding:"8px 4px",textAlign:"center"},children:`Type at least ${k} characters to search`}):N?t.jsx("div",{style:{fontSize:13,color:"#676767",padding:"8px 4px",textAlign:"center"},children:"Searching…"}):he.length===0?t.jsx("div",{style:{fontSize:13,color:"#676767",padding:"8px 4px",textAlign:"center"},children:"No values"}):he.map(m=>{const h=E.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:()=>De(m),style:{position:"absolute",opacity:0,pointerEvents:"none"},tabIndex:-1}),t.jsx("span",{onClick:x=>{x.preventDefault(),De(m)},style:{fontSize:14,lineHeight:"20px",color:"#0B0B0B",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m})]},m)})})]}),O&&t.jsxs(t.Fragment,{children:[t.jsx(st,{children:r.label||"Filter"}),t.jsx(ot,{minValue:W,maxValue:Q,onMinChange:ne,onMaxChange:H,placeholder:P?"00":"0.0",unit:P?"sec":void 0})]}),v&&t.jsxs(t.Fragment,{children:[t.jsx(st,{children:r.label||"Duration"}),r.filterShowPresets===!0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:jt.map(m=>{const h=q.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(ot,{minValue:Y,maxValue:me,onMinChange:V,onMaxChange:ee,inputType:"number",inputMode:"numeric",placeholder:"00",unit:"sec"})]}),z&&t.jsxs(t.Fragment,{children:[t.jsx(st,{children:r.label||"Score"}),R&&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=ae.has(m);return t.jsxs("div",{role:"checkbox","aria-checked":h,tabIndex:0,onClick:()=>Ee(m),onKeyDown:x=>{(x.key===" "||x.key==="Enter")&&(x.preventDefault(),Ee(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"}})]}),R&&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(ot,{minValue:ke,maxValue:B,onMinChange:U,onMaxChange:re,step:"0.1"})]}),j&&t.jsx(rn,{leftLabel:"From",rightLabel:"To",leftValue:te,rightValue:K,onLeftChange:le,onRightChange:be,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:Je,style:{background:"transparent",border:"none",padding:0,cursor:"pointer",fontSize:14,fontWeight:500,color:"#323232",fontFamily:"var(--font-sans)"},children:v&&r.filterShowPresets===!0||z&&R&&r.filterShowPresets===!0?"View All":"Reset"}),t.jsx("button",{type:"button",onClick:Me,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:u="top",align:p="center",styling:S,indicatorColor:b}){const c=typeof l=="string"?l:l!=null?String(l):"",y=typeof b=="string"&&(b.startsWith("#")||b.startsWith("rgb")||b.startsWith("hsl")||b.startsWith("var("))?b:"var(--Grey-Strong, #2E3236)",[M,F]=i.useState(!1),[k,D]=i.useState(!1),[O,j]=i.useState({top:0,left:0,arrowLeft:0,placement:"top"}),v=i.useRef(null),z=i.useRef(null);if(!c)return r;i.useEffect(()=>{D(!0)},[]);const P=i.useCallback(()=>{if(!v.current||!z.current||typeof window>"u")return;const R=v.current.getBoundingClientRect(),E=z.current.getBoundingClientRect(),ie=window.innerWidth,fe=window.innerHeight,G=8,W=10,ne=E.width,Q=E.height,H=R.top,q=fe-R.bottom,pe=u==="bottom"?"bottom":"top";let Y=pe;pe==="top"&&H<Q+W+G&&q>H?Y="bottom":pe==="bottom"&&q<Q+W+G&&H>q&&(Y="top");let V=R.left+R.width/2;p==="start"&&(V=R.left),p==="end"&&(V=R.right);let me=Y==="top"?R.top-Q-W:R.bottom+W,ee=p==="start"?V:p==="end"?V-ne:V-ne/2;me=Math.max(G,Math.min(me,fe-Q-G)),ee=Math.max(G,Math.min(ee,ie-ne-G));const ae=Math.max(10,Math.min(V-ee,ne-10));j({top:me,left:ee,arrowLeft:ae,placement:Y})},[p,u]);return i.useEffect(()=>{if(!M||!k)return;P();const R=()=>P();return window.addEventListener("resize",R),window.addEventListener("scroll",R,!0),()=>{window.removeEventListener("resize",R),window.removeEventListener("scroll",R,!0)}},[M,k,P]),t.jsxs("span",{ref:v,style:{display:"block",width:"100%"},onMouseEnter:()=>F(!0),onMouseLeave:()=>F(!1),children:[r,M&&k&&it.createPortal(t.jsxs("span",{ref:z,style:{position:"fixed",top:`${O.top}px`,left:`${O.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 S=="object"?S:{}},children:[c,t.jsx("span",{style:{position:"absolute",left:`${O.arrowLeft}px`,transform:"translateX(-50%)",width:0,height:0,borderLeft:"6px solid transparent",borderRight:"6px solid transparent",...O.placement==="top"?{top:"100%",borderTop:`7px solid ${y}`}:{bottom:"100%",borderBottom:`7px solid ${y}`}}})]}),document.body)]})}function cn({data:r=[],columns:l=[],initialPageSize:u=10,onRowClick:p,totalCount:S=null,page:b=null,pageSize:c=null,onPageChange:y=null,onPageSizeChange:M=null,onFilterChange:F=null,columnFilters:k=null,onMaxColumnsError:D=null,onSort:O=null,sortFields:j=[],tableId:v=null,isLoading:z=!1,filtersConfig:P=null,columnResizeMinWidth:R=120,columnResizeMaxWidth:E=280,onVisibleColumnsChange:ie=null,hideColumnPicker:fe=!1}){var wt;const{userData:G}=on(),W=(G==null?void 0:G.email)||"anonymous",ne=i.memo(({children:e,content:n,className:s=""})=>{const a=i.useRef(null),[o,f]=i.useState(!1);i.useEffect(()=>{const g=()=>{if(a.current){const T=a.current.scrollWidth>a.current.clientWidth;f(T)}};g();const L=setTimeout(g,0);return window.addEventListener("resize",g),()=>{clearTimeout(L),window.removeEventListener("resize",g)}},[e,n]);const d=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:d}):d});ne.displayName="TruncatedCell";const Q=S!==null&&y!==null,H=F!==null,q=O!==null,[pe,Y]=i.useState(1),[V,me]=i.useState(u),ee=b!==null?b:pe,ae=c!==null?c:V,ye=e=>{y?y(e):Y(e)},ke=e=>{M?M(e):me(e)},U=50,B="action",re=i.useRef(!1),te=i.useMemo(()=>v?`dataTable_columns_${v}:${W}`:`dataTable_columns_${l.map(n=>n.id||n.key).sort().join("_")}:${W}`,[v,l,W]),le=i.useMemo(()=>v?`dataTable_manual_change_${v}:${W}`:null,[v,W]);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(f=>n.some(d=>(d.id||d.key)===f));if(o.length>0)return o}}catch(s){console.warn("Failed to load saved columns from localStorage:",s)}return null},[]);const[K,be]=i.useState({}),[Se,Ce]=i.useState(""),[N,ce]=i.useState(null),[xe,Z]=i.useState({top:0,left:0}),ge=i.useRef(null),he=i.useRef({}),[De,Je]=i.useState(null),[Re,Ee]=i.useState("asc"),Me=i.useCallback((e,n)=>{const s=Oe(n);be(a=>{const o={...a};return s?o[e]=n:delete o[e],o}),y?y(1):Y(1),H&&F&&F(s?{...K,[e]:n}:Object.fromEntries(Object.entries(K).filter(([a])=>a!==e)))},[K,F,H,y]),m=i.useCallback(()=>{be({}),Ce(""),y?y(1):Y(1),H&&F&&F({})},[F,H,y]),h=i.useCallback(e=>{const n=l.find(o=>(o.id||o.key)===e);if(n&&Array.isArray(n.filterOptions)){const o=new Set,f=[];for(const d of n.filterOptions){if(d==null||d==="")continue;const g=typeof d=="object"?JSON.stringify(d):String(d);o.has(g)||(o.add(g),f.push(g))}return f.sort((d,g)=>d.localeCompare(g))}if(!r||r.length===0)return[];const s=new Set,a=[];for(const o of r){const f=o[e];if(f==null)continue;const d=typeof f=="object"?JSON.stringify(f):String(f);s.has(d)||(s.add(d),a.push(d))}return a.sort((o,f)=>o.localeCompare(f))},[r,l]),x=i.useCallback(e=>{const n=l.find(s=>X(s)===e);return n&&n.filterType?n.filterType:Zt(h(e))},[l,h]),w=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}},[]),A=i.useCallback((e,n)=>{if(!n){ce(e);return}const s=n.getBoundingClientRect();Z(w(s)),ce(a=>a===e?null:e)},[w]);i.useEffect(()=>{if(!N)return;const e=n=>{if(ge.current&&ge.current.contains(n.target))return;const s=he.current[N];s&&s.contains(n.target)||Object.values(he.current).some(o=>o&&o.contains(n.target))||ce(null)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[N]),i.useEffect(()=>{if(!N)return;const e=()=>{const n=he.current[N];if(!n)return;const s=n.getBoundingClientRect();Z(w(s))};return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[N,w]),i.useLayoutEffect(()=>{if(!N)return;const e=ge.current,n=he.current[N];if(!e||!n)return;const s=e.offsetWidth,a=n.getBoundingClientRect(),o=8,f=typeof window<"u"?window.innerWidth:1/0;if(!(a.left+s>f-o))return;const g=Math.max(o,a.right-s);Z(L=>L.left===g?L:{...L,left:g})},[N,xe.top]);const de=i.useCallback(e=>!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([,n])=>n==null?!1:typeof n=="string"?n.trim()!=="":!0)),[]),ze=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(!H||k===null)return;const e=de(k);be(n=>ze(n,e)?n:e)},[H,k,de,ze]),i.useCallback((e,n)=>e==="csat_score"&&n==="evaluation.csat_score"?n:e,[]);const J=q&&j.length>0?j[0][0]:De,Ie=q&&j.length>0?j[0][1]:Re,[dn,lt]=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>U&&(n=n.slice(0,U));const a=l.map(d=>d.id||d.key).includes(B);return!n.includes(B)&&a&&(n.length>=U?n=[...n.slice(0,U-1),B]:n=[...n,B]),[...n.filter(d=>d!==B),B]},[l]),[$,Be]=i.useState(()=>{if(typeof window<"u"&&v)try{if(localStorage.getItem(`dataTable_manual_change_${v}:${W}`)==="true"){const a=localStorage.getItem(`dataTable_columns_${v}:${W}`);if(a){const o=JSON.parse(a);if(Array.isArray(o)&&o.length>0){re.current=!0;const f=o.filter(d=>l.some(g=>(g.id||g.key)===d));if(f.length>0)return f.slice(0,U)}}}}catch(s){console.warn("Failed to load saved columns from localStorage:",s)}const n=l.map(s=>s.id||s.key).slice(0,U);return se(n)}),[oe,Qe]=i.useState(!1),[ve,Le]=i.useState([]),[ct,Rt]=i.useState({top:0,left:0,width:0}),[dt,ut]=i.useState(new Set),[ft,pt]=i.useState(new Set),Te=i.useRef(null);Te.current===null&&(Te.current=[...$]);const[ue,Ye]=i.useState(null),[Et,Pe]=i.useState(null),we=i.useRef(null),Ze=i.useRef(null),Ve=i.useRef(null),[mt,et]=i.useState(null),[tt,Mt]=i.useState({}),zt=i.useRef(null),He=i.useRef(null),X=e=>e.id||e.key,_e=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},[]),ht=i.useCallback((e,n)=>tt[e]!=null?`${tt[e]}px`:typeof n=="number"?`${n}px`:n||"auto",[tt]),qe=i.useCallback(e=>{if(!He.current)return;const{columnId:n,startX:s,startWidth:a,minWidth:o,maxWidth:f}=He.current,d=e.clientX-s,g=Math.round(a+d),L=Math.min(f,Math.max(o,g));Mt(T=>({...T,[n]:L}))},[]),Ne=i.useCallback(()=>{He.current=null,document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",qe),document.removeEventListener("mouseup",Ne)},[qe]),Bt=i.useCallback((e,n,s)=>{var Ge;e.preventDefault(),e.stopPropagation();const a=n.id||n.key,o=_e(n.minWidth)??R,f=_e(n.maxWidth)??E,d=Math.min(o,f),g=Math.max(o,f),L=((Ge=e.currentTarget.closest("th"))==null?void 0:Ge.getBoundingClientRect().width)||0,T=_e(s),$e=T??Math.max(d,Math.round(L)||d),nt=Math.min(g,Math.max(d,$e));He.current={columnId:a,startX:e.clientX,startWidth:nt,minWidth:d,maxWidth:g},document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",qe),document.addEventListener("mouseup",Ne)},[E,R,qe,Ne,_e]);i.useEffect(()=>()=>Ne(),[Ne]);const Nt=_.useSensors(_.useSensor(_.PointerSensor),_.useSensor(_.KeyboardSensor,{coordinateGetter:_.sortableKeyboardCoordinates})),Wt=e=>{const{active:n,over:s}=e;if(s&&n.id!==s.id){if(n.id===B||s.id===B){gt("Cannot drop columns on the Action column"),et(null);return}re.current=!0,Be(a=>{const o=a.indexOf(n.id),f=a.indexOf(s.id);if(o!==-1&&f!==-1){const d=_.arrayMove(a,o,f),g=se(d);return yt(g),g}return a}),lt(a=>{const o=a.indexOf(n.id),f=a.indexOf(s.id);return _.arrayMove(a,o,f)})}et(null)},At=e=>{et(e.active.id)},Ke=i.useMemo(()=>{if(H)return r||[];if(!r||r.length===0)return[];const e=Se.trim().toLowerCase(),n=Object.entries(K).filter(([,s])=>Oe(s));return r.filter(s=>{for(const[a,o]of n){const f=s[a];if(f==null)return!1;if(Array.isArray(o)){const d=String(f);if(!o.some(g=>String(g)===d))return!1;continue}if(o.type==="range"){const d=at(f);if(isNaN(d)||o.min!==""&&o.min!=null&&d<Number(o.min)||o.max!==""&&o.max!=null&&d>Number(o.max))return!1;continue}if(o.type==="durationRange"){const d=Qt(f);if(isNaN(d)||o.minSec!==""&&o.minSec!=null&&d<Number(o.minSec)||o.maxSec!==""&&o.maxSec!=null&&d>Number(o.maxSec))return!1;continue}if(o.type==="scoreRange"){const d=at(f);if(isNaN(d))return!1;if(Array.isArray(o.values)&&o.values.length>0){const g=Math.floor(d);if(!o.values.includes(g))return!1;continue}if(o.min!==""&&o.min!=null&&d<Number(o.min)||o.max!==""&&o.max!=null&&d>Number(o.max))return!1;continue}if(o.type==="dateRange"){const d=Yt(f);if(!d)return!1;if(o.from){const g=new Date(o.from+"T00:00:00");if(d<g)return!1}if(o.to){const g=new Date(o.to+"T23:59:59");if(d>g)return!1}continue}}return!(e&&!Object.values(s).some(o=>o==null?!1:String(o).toLowerCase().includes(e)))})},[r,K,Se,H]),We=i.useMemo(()=>q||!J?Ke:[...Ke].sort((e,n)=>{const s=e[J],a=n[J];if(s==null)return 1;if(a==null)return-1;if(typeof s=="number"&&typeof a=="number")return Ie==="asc"?s-a:a-s;const o=String(s).toLowerCase(),f=String(a).toLowerCase();return Ie==="asc"?o.localeCompare(f):f.localeCompare(o)}),[Ke,J,Ie,q]),Xe=i.useMemo(()=>{if(Q)return We;{const e=(ee-1)*ae,n=e+ae;return We.slice(e,n)}},[We,ee,ae,Q]),xt=e=>{q&&O?(O(e),y?y(1):Y(1)):(De===e?Ee(Re==="asc"?"desc":"asc"):(Je(e),Ee("asc")),ye(1))},$t=(e,n)=>{const s=(n||"").split(/\s+/).map(a=>a.trim()).filter(Boolean);Me(e,s)},gt=e=>{Ve.current||(typeof D=="function"&&D(e),Ve.current=setTimeout(()=>{Ve.current=null},3e3))},yt=i.useCallback(e=>{if(typeof window<"u"&&te&&e.length>0&&re.current)try{localStorage.setItem(te,JSON.stringify(e)),le&&localStorage.setItem(le,"true")}catch(n){console.warn("Failed to save columns to localStorage:",n)}},[te,le]),Ot=e=>{e!==B&&Le(n=>n.includes(e)?n.length===1?n:n.filter(s=>s!==e):n.length>=U?(gt("Maximum 9 column selection allowed"),n):se([...n,e]))},It=(e,n)=>{ve[n]!==B&&Ye(n)},Lt=()=>{Ye(null),Pe(null)},Tt=(e,n)=>{e.preventDefault(),ue!==null&&ue!==n&&Pe(n)},Pt=()=>{Pe(null)},Ht=(e,n)=>{e.preventDefault(),ue!==null&&ue!==n&&ve[n]!==B&&ve[ue]!==B&&Le(s=>{const a=_.arrayMove(s,ue,n);return se(a)}),Ye(null),Pe(null)};i.useEffect(()=>{lt(e=>{const n=$.filter(o=>e.includes(o)),s=$.filter(o=>!e.includes(o)),a=e.filter(o=>!$.includes(o));return[...n,...s,...a]})},[$]),i.useEffect(()=>{if(typeof window<"u"&&te&&$.length>0&&re.current)try{const e=se($);localStorage.setItem(te,JSON.stringify(e)),le&&localStorage.setItem(le,"true")}catch(e){console.warn("Failed to save columns to localStorage:",e)}},[$,te,le]),i.useEffect(()=>{ie&&ie($.filter(e=>e!==B))},[$,ie]),i.useEffect(()=>{if(l.length>0&&$.length===0){if(typeof window<"u"&&v)try{if(localStorage.getItem(`dataTable_manual_change_${v}:${W}`)==="true"){const s=localStorage.getItem(`dataTable_columns_${v}:${W}`);if(s){const a=JSON.parse(s);if(Array.isArray(a)&&a.length>0){const o=a.filter(f=>l.some(d=>(d.id||d.key)===f));if(o.length>0){re.current=!0,Be(o.slice(0,U));return}}}}}catch(n){console.warn("Failed to load saved columns from localStorage:",n)}const e=l.map(n=>n.id||n.key);Be(se(e.slice(0,U)))}},[l,v,W,se]);const Fe=i.useMemo(()=>{const e=$.map(n=>l.find(s=>X(s)===n)).filter(Boolean);return se(e.map(X)).map(n=>l.find(s=>X(s)===n)).filter(Boolean)},[l,$]);i.useMemo(()=>Fe.some(e=>e.filterable===!0),[Fe]),i.useEffect(()=>{if(!oe||!we.current)return;const e=()=>{if(we.current){const n=we.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&&we.current&&!we.current.contains(n.target)&&Ze.current&&!Ze.current.contains(n.target)&&Qe(!1)};if(oe)return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[oe]),i.useEffect(()=>{oe&&(Le($),ut(new Set),pt(new Set))},[oe,$]),$.length===1?(wt=l.find(e=>(e.id||e.key)===$[0]))!=null&&wt.label:`${$.length}`;function _t({column:e,isHeaderRow:n=!0}){const s=X(e),a=s===B,o=ht(s,e.width),[f,d]=i.useState(!1),{attributes:g,listeners:L,setNodeRef:T,transform:$e,transition:nt,isDragging:Ge}=_.useSortable({id:s}),Kt={transform:_.CSS.Transform.toString($e),transition:nt,opacity:Ge?.5:1,width:o,minWidth:o};let je=!1;if(q&&j.length>0){const C=j[0][0];(C===s||C==="csat_score"&&s==="evaluation.csat_score")&&(je=!0)}else je=J===s;const Xt=Ie==="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:K[s]||"",onChange:C=>{C.stopPropagation(),$t(s,C.target.value)},onKeyDown:C=>C.stopPropagation(),onMouseDown:C=>C.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 rt=N===s,Ue=Oe(K[s]),Ut=e.sortable!==!1&&(f||je),Jt=e.filterable!==!1&&!a&&(f||rt||Ue);return t.jsxs("th",{ref:T,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!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:f||rt?"#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",{...g,...L,style:{cursor:"grab",color:"rgba(11, 11, 11, 0.36)",display:"inline-flex",alignItems:"center",visibility:f?"visible":"hidden",flexShrink:0},children:t.jsx(I.GripVertical,{size:14})}),t.jsx("span",{onClick:()=>e.sortable!==!1&&xt(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:C=>{C.stopPropagation(),xt(s)},title:"Sort",style:{background:"transparent",border:"none",padding:4,borderRadius:4,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",color:je?"#0b0b0b":"rgba(11, 11, 11, 0.55)",flexShrink:0},children:je?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:C=>{he.current[s]=C},onClick:C=>{C.stopPropagation(),A(s,C.currentTarget)},title:"Filter",style:{position:"relative",background:rt||Ue?"#D8D8D8":"transparent",border:"none",padding:4,borderRadius:4,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",color:Ue?"#0b0b0b":"rgba(11, 11, 11, 0.7)",flexShrink:0},children:[t.jsx(I.ListFilter,{size:14,strokeWidth:1.75}),Ue&&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:C=>Bt(C,e,o),onClick:C=>C.stopPropagation(),onMouseEnter:C=>{C.currentTarget.style.background="rgba(30, 33, 37, 0.18)"},onMouseLeave:C=>{C.currentTarget.style.background="transparent"},style:{position:"absolute",top:0,right:-2,width:4,height:"100%",cursor:"col-resize",zIndex:4,background:"transparent"}})]})}const bt=mt?l.find(e=>X(e)===mt):null,St=({col:e,columnId:n,isSelected:s,draggable:a,isAction:o,actualIndex:f})=>{const d=a&&ue===f,g=a&&Et===f&&ue!==null&&ue!==f;s?ft.has(n):dt.has(n);const L=s?!ft.has(n):dt.has(n);return t.jsxs("div",{draggable:a,onDragStart:a?T=>It(T,f):void 0,onDragEnd:a?Lt:void 0,onDragOver:a?T=>Tt(T,f):void 0,onDragLeave:a?Pt:void 0,onDrop:a?T=>Ht(T,f):void 0,onClick:()=>{o||Ot(n)},style:{display:"flex",alignItems:"center",gap:4,padding:"2px 0",cursor:o?"default":a?"grab":"pointer",opacity:d?.5:1,background:g?"#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:L?"#0B0B0B":"#FFFFFF",border:`1px solid ${L?"#0B0B0B":"#676767"}`,flexShrink:0,marginLeft:8},children:L&&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:Ze,style:{position:"fixed",top:`${ct.top}px`,left:`${ct.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:[ve.map((e,n)=>{if(e===B)return null;const s=l.find(a=>X(a)===e);return s?t.jsx(i.Fragment,{children:St({col:s,columnId:e,isSelected:!0,draggable:!0,isAction:!1,actualIndex:n})},`selected-${e}-${n}`):null}),l.filter(e=>{const n=X(e);return n!==B&&!ve.includes(n)}).map(e=>{const n=X(e);return t.jsx(i.Fragment,{children:St({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=Te.current?[...Te.current]:l.map(X).slice(0,U),s=se(n);if(re.current=!1,Le(s),Be(s),ut(new Set),pt(new Set),typeof window<"u"&&te)try{localStorage.removeItem(te)}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(ve);re.current=!0,Be(n),yt(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,Ae=N?l.find(e=>X(e)===N):null,vt=Ae?t.jsx(sn,{column:Ae,columnId:N,filterType:x(N),position:xe,popoverRef:ge,distinctValues:h(N),initialValue:K[N],onSearch:typeof Ae.onFilterSearch=="function"?Ae.onFilterSearch:null,searchMinChars:Ae.filterSearchMinChars??3,onApply:e=>{Me(N,e),ce(null)},onCancel:()=>ce(null)},N):null;return t.jsxs("div",{className:"w-full",children:[vt&&it.createPortal(vt,document.body),l.length>0&&(P||!fe)&&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:[P&&t.jsx("div",{style:{marginRight:"auto"},children:t.jsx(Dt,{dateRangePicker:P.dateRangePicker,onWeekToDate:P.onWeekToDate,exportConfig:P.exportConfig,filterChipsConfig:P.filterChipsConfig,trailingActions:P.trailingActions})}),!fe&&t.jsxs("div",{style:{position:"relative"},children:[t.jsxs("button",{ref:we,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&&it.createPortal(qt,document.body)]})]})}),Object.keys(K).length>0&&t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",padding:"8px 0"},children:[Object.entries(K).map(([e,n])=>{const s=l.find(d=>X(d)===e);if(!s||!Oe(n))return null;const a=Vt(n),o=en(n),f=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:f}),t.jsx("button",{type:"button",onClick:()=>Me(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:m,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&&Fe.length>0?t.jsxs(_.DndContext,{sensors:Nt,collisionDetection:_.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",...z?{minHeight:320}:{}},children:[z&&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(_.SortableContext,{items:$,strategy:_.horizontalListSortingStrategy,children:Fe.map(e=>t.jsx(_t,{column:e,isHeaderRow:!0},`header-${X(e)}`))})})}),t.jsx("tbody",{children:!z&&Xe.length===0?t.jsx("tr",{children:t.jsx("td",{colSpan:Fe.length,style:{padding:"32px",textAlign:"center",color:"rgba(30, 33, 37, 0.42)",fontSize:"12px",fontFamily:"var(--font-sans)"},children:"No results found"})}):!z&&Xe.length>0?Xe.map((e,n)=>t.jsx("tr",{"data-row-id":e.id||n,style:{borderBottom:"1px solid #e6e6e6",cursor:p?"pointer":"default",transition:"background 0.15s ease"},onClick:p?s=>{s.stopPropagation(),p(e,n)}:void 0,onMouseEnter:s=>{s.currentTarget.style.background="#E6E6E6"},onMouseLeave:s=>{s.currentTarget.style.background="transparent"},children:Fe.map(s=>{const a=X(s),o=ht(a,s.width),f=e[a],d=s.render?s.render(f,e):f,g=o&&o!=="auto",L=typeof d=="string"&&d.trim()!=="",T=g&&L,$e=T?t.jsx(ne,{content:d,children:d}):d;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)",...T&&{maxWidth:o||"200px"}},children:$e},a)})},n)):null})]})})]}),t.jsx(_.DragOverlay,{children:bt?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:bt.label})]})}):null})]}):null,(()=>{const e=!H&&(Se.trim()!==""||Object.values(K).some(s=>Oe(s))),n=Q?e?We.length:S:We.length;return n<=0?null:t.jsx(Ct.Pagination,{page:ee,pageSizeOptions:[5,10,20,50,100],pageSize:ae,totalCount:n,currentDataLength:Xe.length,onPageChange:ye,onPageSizeChange:s=>{ke(s),ye(1)},showPageSizeSelector:!0})})()]})}exports.DataTable2=cn;exports.DataTableFilters=Dt;
1
+ "use strict";const t=require("react/jsx-runtime"),a=require("react"),H=require("./sortable.esm.cjs.js"),$=require("lucide-react"),ft=require("react-dom"),Et=require("./CustomFilterChips.cjs.js");require("motion/react");require("recharts");require("./AgentLiftAnalysisCard.cjs.js");require("./TourGuideTooltip.cjs.js");function Mt({dateRangePicker:r,onWeekToDate:l,exportConfig:u,filterChipsConfig:p,trailingActions:S}){const[b,c]=a.useState(!1),y=a.useRef(null),M=a.useRef(null);a.useEffect(()=>{const j=v=>{M.current&&!M.current.contains(v.target)&&y.current&&!y.current.contains(v.target)&&c(!1)};if(b)return document.addEventListener("mousedown",j),()=>{document.removeEventListener("mousedown",j)}},[b]);const F=()=>{c(j=>!j)},k=j=>{c(!1),u!=null&&u.onExport&&u.onExport(j)},T=(()=>{if(!(p!=null&&p.filters))return!1;const j=p.filters,v=p.customFilters||[],z=Object.entries(j).some(([R,E])=>!!(Array.isArray(E)&&E.length||typeof E=="string"&&E.trim()!==""||E&&typeof E=="object"&&(E.min!=null||E.max!=null))),I=v.some(R=>R.active);return z||I})();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($.CalendarClock,{size:16}),t.jsx("span",{children:"Week to Date"})]}),r&&t.jsx(a.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($.CalendarClock,{size:16}),t.jsx("span",{children:"Loading..."})]}),children:r}),u&&t.jsxs("div",{className:"relative",children:[t.jsxs("button",{ref:y,onClick:F,disabled:u.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($.Download,{size:16}),t.jsx("span",{children:u.isExporting?"Exporting...":"Export"})]}),t.jsx($.ChevronDown,{size:16})]}),b&&t.jsx("div",{ref:M,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:(u.types||["csv"]).map(j=>t.jsxs("button",{onClick:()=>k(j),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 ",j.toUpperCase()]},j))})]}),(T||S)&&t.jsxs(t.Fragment,{children:[T&&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:[T&&p&&t.jsx(Et.CustomFilterChips,{filters:p.filters,onChange:p.onChange,onClear:p.onClear,customFilters:p.customFilters||[],fieldOptions:p.fieldOptions||{}}),S&&t.jsx("div",{className:"flex-shrink-0",children:S})]})]})]})}function pt(r){if(r==null)return NaN;const l=String(r).replace(/[,$%]|pp/gi,"").trim(),u=parseFloat(l);return Number.isFinite(u)?u:NaN}function en(r){if(r==null)return NaN;const l=String(r).trim(),u=l.match(/^(\d+):(\d+)(?::(\d+))?$/);if(u){const F=+u[1],k=+u[2],D=u[3]!=null?+u[3]:null;return D!=null?F*3600+k*60+D:F*60+k}let p=0,S=!1;const b=l.match(/(\d+)\s*d\b/i),c=l.match(/(\d+)\s*h\b/i),y=l.match(/(\d+)\s*m(?!s)\b/i),M=l.match(/(\d+)\s*s\b/i);return b&&(p+=+b[1]*86400,S=!0),c&&(p+=+c[1]*3600,S=!0),y&&(p+=+y[1]*60,S=!0),M&&(p+=+M[1],S=!0),S?p:NaN}function tn(r){if(!r)return null;const l=String(r).trim(),u=l.match(/^(\d{1,2})\/(\d{1,2})\/(\d{2,4})$/);if(u){const S=u[3].length===2?2e3+ +u[3]:+u[3],b=new Date(S,+u[1]-1,+u[2]);return isNaN(b.getTime())?null:b}const p=new Date(l);return isNaN(p.getTime())?null:p}function nn(r){if(!r||r.length===0)return"text";const l=r.slice(0,25),u=p=>l.every(p);return u(p=>/^\d{1,2}\/\d{1,2}\/\d{2,4}$/.test(p)||/^\d{4}-\d{2}-\d{2}/.test(p))?"date":u(p=>/^\d+\s*[dhms]\b/i.test(p)||/^\d+:\d+(:\d+)?$/.test(p))?"duration":u(p=>/^-?[\d,.]+(%|pp)?$/i.test(p))?"number":"text"}function Ie(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 Ct(r){if(r==null||r===""||isNaN(r))return"";const l=Number(r),u=Math.floor(l/3600),p=Math.floor(l%3600/60),S=Math.floor(l%60);return u>0?`${u}h ${p}m`:p>0?`${p}m ${S}s`:`${S}s`}function rn(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,u=r.max!==""&&r.max!=null?r.max:null;return l!=null&&u!=null?`${l} – ${u}`:l!=null?`≥ ${l}`:u!=null?`≤ ${u}`:""}if(r.type==="durationRange"){const l=r.minSec!==""&&r.minSec!=null?Ct(r.minSec):null,u=r.maxSec!==""&&r.maxSec!=null?Ct(r.maxSec):null;return l&&u?`${l} – ${u}`:l?`≥ ${l}`:u?`≤ ${u}`:""}if(r.type==="scoreRange"){if(Array.isArray(r.values)&&r.values.length>0)return r.values.slice().sort((p,S)=>p-S).join(", ");const l=r.min!==""&&r.min!=null?r.min:null,u=r.max!==""&&r.max!=null?r.max:null;return l!=null&&u!=null?`${l} – ${u}`:l!=null?`≥ ${l}`:u!=null?`≤ ${u}`:""}return r.type==="dateRange"?r.from&&r.to?`${r.from} – ${r.to}`:r.from?`from ${r.from}`:r.to?`to ${r.to}`:"":""}function sn(r){return Array.isArray(r)?Math.max(0,r.length-1):0}function on(r){return Array.isArray(r)?r.slice(1).map(String).join(", "):""}function an({count:r,values:l}){const[u,p]=a.useState(!1);return t.jsxs("span",{onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!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,u&&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 ln({leftLabel:r,rightLabel:l,leftValue:u,rightValue:p,onLeftChange:S,onRightChange:b,type:c="number",placeholderLeft:y="Min",placeholderRight:M="Max"}){const F={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"},k={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:k,children:r}),t.jsx("input",{type:c,value:u,onChange:D=>S(D.target.value),placeholder:y,style:F})]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[t.jsx("span",{style:k,children:l}),t.jsx("input",{type:c,value:p,onChange:D=>b(D.target.value),placeholder:M,style:F})]})]})}const Dt=[{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 Rt(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 u=Number(r);return Number.isFinite(u)?u:null}function dt({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 ut({minValue:r,maxValue:l,onMinChange:u,onMaxChange:p,inputType:S="number",inputMode:b="decimal",step:c,placeholder:y="0.0",unit:M}){const F={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:S,inputMode:b,step:c,placeholder:y,value:r,onChange:k=>u(k.target.value),style:F})]}),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:S,inputMode:b,step:c,placeholder:y,value:l,onChange:k=>p(k.target.value),style:F})]})]}),M&&t.jsxs("span",{style:{fontSize:11,color:"#676767",fontFamily:"var(--font-sans)"},children:["Enter durations in ",M==="sec"?"seconds":M]})]})}function cn({column:r,columnId:l,filterType:u="text",position:p,popoverRef:S,distinctValues:b,initialValue:c,onApply:y,onCancel:M,onSearch:F=null,searchMinChars:k=3}){const D=u==="text",T=u==="number",j=u==="date",v=u==="duration",z=u==="score",I=/duration/i.test(String((r==null?void 0:r.label)||l||"")),R=a.useMemo(()=>{if(!z||!Array.isArray(b)||b.length===0)return!1;let m=1/0,h=-1/0;for(const x of b){const w=pt(x);Number.isFinite(w)&&(w<m&&(m=w),w>h&&(h=w))}return Number.isFinite(m)&&Number.isFinite(h)&&m>=0&&h<=5},[z,b]),[E,ie]=a.useState(()=>D?new Set(Array.isArray(c)?c:[]):new Set),[me,U]=a.useState(""),[W,ne]=a.useState(()=>T&&(c==null?void 0:c.type)==="range"&&c.min!=null?c.min:""),[Y,_]=a.useState(()=>T&&(c==null?void 0:c.type)==="range"&&c.max!=null?c.max:""),[q,he]=a.useState(new Set),[Q,V]=a.useState(()=>v&&(c==null?void 0:c.type)==="durationRange"&&c.minSec!=null&&c.minSec!==""?String(c.minSec):""),[xe,ee]=a.useState(()=>v&&(c==null?void 0:c.type)==="durationRange"&&c.maxSec!=null&&c.maxSec!==""?String(c.maxSec):""),[ae,Se]=a.useState(()=>z&&(c==null?void 0:c.type)==="scoreRange"&&Array.isArray(c.values)?new Set(c.values):new Set),[Ee,X]=a.useState(()=>z&&(c==null?void 0:c.type)==="scoreRange"&&c.min!=null&&c.min!==""?String(c.min):""),[B,re]=a.useState(()=>z&&(c==null?void 0:c.type)==="scoreRange"&&c.max!=null&&c.max!==""?String(c.max):""),[te,le]=a.useState(()=>j&&(c==null?void 0:c.type)==="dateRange"&&c.from||""),[K,ve]=a.useState(()=>j&&(c==null?void 0:c.type)==="dateRange"&&c.to||"");a.useEffect(()=>{D&&ie(new Set(Array.isArray(c)?c:[]))},[l,D]);const[we,Me]=a.useState(null),[N,ce]=a.useState(!1),ye=a.useRef(0),Z=me.trim(),be=D&&typeof F=="function"&&Z.length>=k;a.useEffect(()=>{if(!D||typeof F!="function")return;if(Z.length<k){Me(null),ce(!1);return}const m=++ye.current;ce(!0);const h=setTimeout(async()=>{try{const x=await F(Z);if(m!==ye.current)return;const w=Array.isArray(x)?x.map(A=>A&&typeof A=="object"?A.label??A.value:A).filter(A=>A!=null&&A!=="").map(String):[];Me(w)}catch{m===ye.current&&Me([])}finally{m===ye.current&&ce(!1)}},300);return()=>clearTimeout(h)},[D,F,Z,k]);const ge=a.useMemo(()=>{const m=Z.toLowerCase(),h=be?we||[]:m?b.filter(w=>String(w).toLowerCase().includes(m)):b,x=new Map;for(const w of h)x.set(String(w),w);for(const w of E)x.set(String(w),w);return Array.from(x.values()).sort((w,A)=>{const de=E.has(w),Ae=E.has(A);return de!==Ae?de?-1:1:String(w).localeCompare(String(A))})},[b,Z,E,be,we]),ze=m=>{ie(h=>{const x=new Set(h);return x.has(m)?x.delete(m):x.add(m),x})},tt=()=>{D&&ie(new Set),T&&(ne(""),_("")),v&&(he(new Set),V(""),ee("")),z&&(Se(new Set),X(""),re("")),j&&(le(""),ve("")),U("")},Be=m=>{he(h=>{const x=new Set(h);return x.has(m)?x.delete(m):x.add(m),x})},Ne=m=>{Se(h=>{const x=new Set(h);return x.has(m)?x.delete(m):x.add(m),x})},We=()=>{if(D)return y(Array.from(E));if(T)return y({type:"range",min:W===""?"":Number(W),max:Y===""?"":Number(Y)});if(v){const m=Rt(Q),h=Rt(xe),x=m!=null||h!=null;let w="",A="";if(x)w=m??"",A=h??"";else if(q.size>0){const de=Dt.filter(J=>q.has(J.id));w=Math.min(...de.map(J=>J.minSec)),A=de.some(J=>J.maxSec==null)?"":Math.max(...de.map(J=>J.maxSec))}return y({type:"durationRange",minSec:w,maxSec:A})}if(z){const m=Ee===""?null:Number(Ee),h=B===""?null:Number(B);return m!=null||h!=null?y({type:"scoreRange",values:[],min:m!=null&&Number.isFinite(m)?m:"",max:h!=null&&Number.isFinite(h)?h:""}):y({type:"scoreRange",values:Array.from(ae).sort((w,A)=>w-A),min:"",max:""})}if(j)return y({type:"dateRange",from:te,to:K})};return t.jsxs("div",{ref:S,role:"dialog","aria-label":`Filter ${r.label||l}`,style:{position:"fixed",top:p.top,left:p.left,zIndex:50,width:D?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:[D&&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($.Search,{size:16,color:"#989898",strokeWidth:2}),t.jsx("input",{autoFocus:!0,type:"text",value:me,onChange:m=>U(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:typeof F=="function"&&Z.length>0&&Z.length<k?t.jsx("div",{style:{fontSize:13,color:"#676767",padding:"8px 4px",textAlign:"center"},children:`Type at least ${k} characters to search`}):N?t.jsx("div",{style:{fontSize:13,color:"#676767",padding:"8px 4px",textAlign:"center"},children:"Searching…"}):ge.length===0?t.jsx("div",{style:{fontSize:13,color:"#676767",padding:"8px 4px",textAlign:"center"},children:"No values"}):ge.map(m=>{const h=E.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($.Check,{size:14,color:"#FFFFFF",strokeWidth:3})}),t.jsx("input",{type:"checkbox",checked:h,onChange:()=>ze(m),style:{position:"absolute",opacity:0,pointerEvents:"none"},tabIndex:-1}),t.jsx("span",{onClick:x=>{x.preventDefault(),ze(m)},style:{fontSize:14,lineHeight:"20px",color:"#0B0B0B",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m})]},m)})})]}),T&&t.jsxs(t.Fragment,{children:[t.jsx(dt,{children:r.label||"Filter"}),t.jsx(ut,{minValue:W,maxValue:Y,onMinChange:ne,onMaxChange:_,placeholder:I?"00":"0.0",unit:I?"sec":void 0})]}),v&&t.jsxs(t.Fragment,{children:[t.jsx(dt,{children:r.label||"Duration"}),r.filterShowPresets===!0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12},children:Dt.map(m=>{const h=q.has(m.id);return t.jsxs("div",{role:"checkbox","aria-checked":h,tabIndex:0,onClick:()=>Be(m.id),onKeyDown:x=>{(x.key===" "||x.key==="Enter")&&(x.preventDefault(),Be(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($.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(ut,{minValue:Q,maxValue:xe,onMinChange:V,onMaxChange:ee,inputType:"number",inputMode:"numeric",placeholder:"00",unit:"sec"})]}),z&&t.jsxs(t.Fragment,{children:[t.jsx(dt,{children:r.label||"Score"}),R&&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=ae.has(m);return t.jsxs("div",{role:"checkbox","aria-checked":h,tabIndex:0,onClick:()=>Ne(m),onKeyDown:x=>{(x.key===" "||x.key==="Enter")&&(x.preventDefault(),Ne(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($.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"}})]}),R&&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(ut,{minValue:Ee,maxValue:B,onMinChange:X,onMaxChange:re,step:"0.1"})]}),j&&t.jsx(ln,{leftLabel:"From",rightLabel:"To",leftValue:te,rightValue:K,onLeftChange:le,onRightChange:ve,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:tt,style:{background:"transparent",border:"none",padding:0,cursor:"pointer",fontSize:14,fontWeight:500,color:"#323232",fontFamily:"var(--font-sans)"},children:v&&r.filterShowPresets===!0||z&&R&&r.filterShowPresets===!0?"View All":"Reset"}),t.jsx("button",{type:"button",onClick:We,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 dn=()=>({userData:{email:"anonymous"}}),un=r=>t.jsx("img",{...r});function fn({children:r,content:l,direction:u="top",align:p="center",styling:S,indicatorColor:b}){const c=typeof l=="string"?l:l!=null?String(l):"",y=typeof b=="string"&&(b.startsWith("#")||b.startsWith("rgb")||b.startsWith("hsl")||b.startsWith("var("))?b:"var(--Grey-Strong, #2E3236)",[M,F]=a.useState(!1),[k,D]=a.useState(!1),[T,j]=a.useState({top:0,left:0,arrowLeft:0,placement:"top"}),v=a.useRef(null),z=a.useRef(null);if(!c)return r;a.useEffect(()=>{D(!0)},[]);const I=a.useCallback(()=>{if(!v.current||!z.current||typeof window>"u")return;const R=v.current.getBoundingClientRect(),E=z.current.getBoundingClientRect(),ie=window.innerWidth,me=window.innerHeight,U=8,W=10,ne=E.width,Y=E.height,_=R.top,q=me-R.bottom,he=u==="bottom"?"bottom":"top";let Q=he;he==="top"&&_<Y+W+U&&q>_?Q="bottom":he==="bottom"&&q<Y+W+U&&_>q&&(Q="top");let V=R.left+R.width/2;p==="start"&&(V=R.left),p==="end"&&(V=R.right);let xe=Q==="top"?R.top-Y-W:R.bottom+W,ee=p==="start"?V:p==="end"?V-ne:V-ne/2;xe=Math.max(U,Math.min(xe,me-Y-U)),ee=Math.max(U,Math.min(ee,ie-ne-U));const ae=Math.max(10,Math.min(V-ee,ne-10));j({top:xe,left:ee,arrowLeft:ae,placement:Q})},[p,u]);return a.useEffect(()=>{if(!M||!k)return;I();const R=()=>I();return window.addEventListener("resize",R),window.addEventListener("scroll",R,!0),()=>{window.removeEventListener("resize",R),window.removeEventListener("scroll",R,!0)}},[M,k,I]),t.jsxs("span",{ref:v,style:{display:"block",width:"100%"},onMouseEnter:()=>F(!0),onMouseLeave:()=>F(!1),children:[r,M&&k&&ft.createPortal(t.jsxs("span",{ref:z,style:{position:"fixed",top:`${T.top}px`,left:`${T.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 S=="object"?S:{}},children:[c,t.jsx("span",{style:{position:"absolute",left:`${T.arrowLeft}px`,transform:"translateX(-50%)",width:0,height:0,borderLeft:"6px solid transparent",borderRight:"6px solid transparent",...T.placement==="top"?{top:"100%",borderTop:`7px solid ${y}`}:{bottom:"100%",borderBottom:`7px solid ${y}`}}})]}),document.body)]})}function pn({data:r=[],columns:l=[],initialPageSize:u=10,onRowClick:p,totalCount:S=null,page:b=null,pageSize:c=null,onPageChange:y=null,onPageSizeChange:M=null,onFilterChange:F=null,columnFilters:k=null,onMaxColumnsError:D=null,onSort:T=null,sortFields:j=[],tableId:v=null,isLoading:z=!1,filtersConfig:I=null,columnResizeMinWidth:R=120,columnResizeMaxWidth:E=280,onVisibleColumnsChange:ie=null,hideColumnPicker:me=!1}){var kt;const{userData:U}=dn(),W=(U==null?void 0:U.email)||"anonymous",ne=a.memo(({children:e,content:n,className:s=""})=>{const i=a.useRef(null),[o,f]=a.useState(!1);a.useEffect(()=>{const g=()=>{if(i.current){const P=i.current.scrollWidth>i.current.clientWidth;f(P)}};g();const L=setTimeout(g,0);return window.addEventListener("resize",g),()=>{clearTimeout(L),window.removeEventListener("resize",g)}},[e,n]);const d=t.jsx("span",{className:`truncate block ${s}`,ref:i,children:e});return o&&n?t.jsx(fn,{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:d}):d});ne.displayName="TruncatedCell";const Y=S!==null&&y!==null,_=F!==null,q=T!==null,[he,Q]=a.useState(1),[V,xe]=a.useState(u),ee=b!==null?b:he,ae=c!==null?c:V,Se=e=>{y?y(e):Q(e)},Ee=e=>{M?M(e):xe(e)},X=50,B="action",re=a.useRef(!1),te=a.useMemo(()=>v?`dataTable_columns_${v}:${W}`:`dataTable_columns_${l.map(n=>n.id||n.key).sort().join("_")}:${W}`,[v,l,W]),le=a.useMemo(()=>v?`dataTable_manual_change_${v}:${W}`:null,[v,W]);a.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(f=>n.some(d=>(d.id||d.key)===f));if(o.length>0)return o}}catch(s){console.warn("Failed to load saved columns from localStorage:",s)}return null},[]);const[K,ve]=a.useState({}),[we,Me]=a.useState(""),[N,ce]=a.useState(null),[ye,Z]=a.useState({top:0,left:0}),be=a.useRef(null),ge=a.useRef({}),[ze,tt]=a.useState(null),[Be,Ne]=a.useState("asc"),We=a.useCallback((e,n)=>{const s=Ie(n);ve(i=>{const o={...i};return s?o[e]=n:delete o[e],o}),y?y(1):Q(1),_&&F&&F(s?{...K,[e]:n}:Object.fromEntries(Object.entries(K).filter(([i])=>i!==e)))},[K,F,_,y]),m=a.useCallback(()=>{ve({}),Me(""),y?y(1):Q(1),_&&F&&F({})},[F,_,y]),h=a.useCallback(e=>{const n=l.find(o=>(o.id||o.key)===e);if(n&&Array.isArray(n.filterOptions)){const o=new Set,f=[];for(const d of n.filterOptions){if(d==null||d==="")continue;const g=typeof d=="object"?JSON.stringify(d):String(d);o.has(g)||(o.add(g),f.push(g))}return f.sort((d,g)=>d.localeCompare(g))}if(!r||r.length===0)return[];const s=new Set,i=[];for(const o of r){const f=o[e];if(f==null)continue;const d=typeof f=="object"?JSON.stringify(f):String(f);s.has(d)||(s.add(d),i.push(d))}return i.sort((o,f)=>o.localeCompare(f))},[r,l]),x=a.useCallback(e=>{const n=l.find(s=>G(s)===e);return n&&n.filterType?n.filterType:nn(h(e))},[l,h]),w=a.useCallback(e=>{const i=typeof window<"u"?window.innerWidth:1/0;let o=e.left;return o+280>i-8&&(o=Math.max(8,e.right-280)),{top:e.bottom+6,left:o}},[]),A=a.useCallback((e,n)=>{if(!n){ce(e);return}const s=n.getBoundingClientRect();Z(w(s)),ce(i=>i===e?null:e)},[w]);a.useEffect(()=>{if(!N)return;const e=n=>{if(be.current&&be.current.contains(n.target))return;const s=ge.current[N];s&&s.contains(n.target)||Object.values(ge.current).some(o=>o&&o.contains(n.target))||ce(null)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[N]),a.useEffect(()=>{if(!N)return;const e=()=>{const n=ge.current[N];if(!n)return;const s=n.getBoundingClientRect();Z(w(s))};return window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e)}},[N,w]),a.useLayoutEffect(()=>{if(!N)return;const e=be.current,n=ge.current[N];if(!e||!n)return;const s=e.offsetWidth,i=n.getBoundingClientRect(),o=8,f=typeof window<"u"?window.innerWidth:1/0;if(!(i.left+s>f-o))return;const g=Math.max(o,i.right-s);Z(L=>L.left===g?L:{...L,left:g})},[N,ye.top]);const de=a.useCallback(e=>!e||typeof e!="object"?{}:Object.fromEntries(Object.entries(e).filter(([,n])=>n==null?!1:typeof n=="string"?n.trim()!=="":!0)),[]),Ae=a.useCallback((e,n)=>{const s=Object.keys(e||{}),i=Object.keys(n||{});return s.length!==i.length?!1:s.every(o=>e[o]===n[o])},[]);a.useEffect(()=>{if(!_||k===null)return;const e=de(k);ve(n=>Ae(n,e)?n:e)},[_,k,de,Ae]),a.useCallback((e,n)=>e==="csat_score"&&n==="evaluation.csat_score"?n:e,[]);const J=q&&j.length>0?j[0][0]:ze,_e=q&&j.length>0?j[0][1]:Be,[mn,mt]=a.useState(()=>l.map(e=>e.id||e.key)),se=a.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 i=l.map(d=>d.id||d.key).includes(B);return!n.includes(B)&&i&&(n.length>=X?n=[...n.slice(0,X-1),B]:n=[...n,B]),[...n.filter(d=>d!==B),B]},[l]),[O,Oe]=a.useState(()=>{if(typeof window<"u"&&v)try{if(localStorage.getItem(`dataTable_manual_change_${v}:${W}`)==="true"){const i=localStorage.getItem(`dataTable_columns_${v}:${W}`);if(i){const o=JSON.parse(i);if(Array.isArray(o)&&o.length>0){re.current=!0;const f=o.filter(d=>l.some(g=>(g.id||g.key)===d));if(f.length>0)return f.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 se(n)}),[oe,nt]=a.useState(!1),[ue,Fe]=a.useState([]),[ht,zt]=a.useState({top:0,left:0,width:0}),[He,je]=a.useState(new Set),[qe,ke]=a.useState(new Set),fe=a.useRef({}),Ke=a.useRef(null);Ke.current===null&&(Ke.current=[...O]);const[pe,rt]=a.useState(null),[Bt,Ge]=a.useState(null),Ce=a.useRef(null),st=a.useRef(null),ot=a.useRef(null),[xt,it]=a.useState(null),[at,Nt]=a.useState({}),Wt=a.useRef(null),Ue=a.useRef(null),G=e=>e.id||e.key,Xe=a.useCallback(e=>{if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){const n=e.trim();if(n.endsWith("px")){const i=parseFloat(n);return Number.isFinite(i)?i:null}const s=parseFloat(n);return Number.isFinite(s)&&`${s}`===n?s:null}return null},[]),gt=a.useCallback((e,n)=>at[e]!=null?`${at[e]}px`:typeof n=="number"?`${n}px`:n||"auto",[at]),Je=a.useCallback(e=>{if(!Ue.current)return;const{columnId:n,startX:s,startWidth:i,minWidth:o,maxWidth:f}=Ue.current,d=e.clientX-s,g=Math.round(i+d),L=Math.min(f,Math.max(o,g));Nt(P=>({...P,[n]:L}))},[]),Te=a.useCallback(()=>{Ue.current=null,document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",Je),document.removeEventListener("mouseup",Te)},[Je]),At=a.useCallback((e,n,s)=>{var Ve;e.preventDefault(),e.stopPropagation();const i=n.id||n.key,o=Xe(n.minWidth)??R,f=Xe(n.maxWidth)??E,d=Math.min(o,f),g=Math.max(o,f),L=((Ve=e.currentTarget.closest("th"))==null?void 0:Ve.getBoundingClientRect().width)||0,P=Xe(s),Pe=P??Math.max(d,Math.round(L)||d),lt=Math.min(g,Math.max(d,Pe));Ue.current={columnId:i,startX:e.clientX,startWidth:lt,minWidth:d,maxWidth:g},document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",Je),document.addEventListener("mouseup",Te)},[E,R,Je,Te,Xe]);a.useEffect(()=>()=>Te(),[Te]);const Ot=H.useSensors(H.useSensor(H.PointerSensor),H.useSensor(H.KeyboardSensor,{coordinateGetter:H.sortableKeyboardCoordinates})),Tt=e=>{const{active:n,over:s}=e;if(s&&n.id!==s.id){if(n.id===B||s.id===B){bt("Cannot drop columns on the Action column"),it(null);return}re.current=!0,Oe(i=>{const o=i.indexOf(n.id),f=i.indexOf(s.id);if(o!==-1&&f!==-1){const d=H.arrayMove(i,o,f),g=se(d);return St(g),g}return i}),mt(i=>{const o=i.indexOf(n.id),f=i.indexOf(s.id);return H.arrayMove(i,o,f)})}it(null)},$t=e=>{it(e.active.id)},Ye=a.useMemo(()=>{if(_)return r||[];if(!r||r.length===0)return[];const e=we.trim().toLowerCase(),n=Object.entries(K).filter(([,s])=>Ie(s));return r.filter(s=>{for(const[i,o]of n){const f=s[i];if(f==null)return!1;if(Array.isArray(o)){const d=String(f);if(!o.some(g=>String(g)===d))return!1;continue}if(o.type==="range"){const d=pt(f);if(isNaN(d)||o.min!==""&&o.min!=null&&d<Number(o.min)||o.max!==""&&o.max!=null&&d>Number(o.max))return!1;continue}if(o.type==="durationRange"){const d=en(f);if(isNaN(d)||o.minSec!==""&&o.minSec!=null&&d<Number(o.minSec)||o.maxSec!==""&&o.maxSec!=null&&d>Number(o.maxSec))return!1;continue}if(o.type==="scoreRange"){const d=pt(f);if(isNaN(d))return!1;if(Array.isArray(o.values)&&o.values.length>0){const g=Math.floor(d);if(!o.values.includes(g))return!1;continue}if(o.min!==""&&o.min!=null&&d<Number(o.min)||o.max!==""&&o.max!=null&&d>Number(o.max))return!1;continue}if(o.type==="dateRange"){const d=tn(f);if(!d)return!1;if(o.from){const g=new Date(o.from+"T00:00:00");if(d<g)return!1}if(o.to){const g=new Date(o.to+"T23:59:59");if(d>g)return!1}continue}}return!(e&&!Object.values(s).some(o=>o==null?!1:String(o).toLowerCase().includes(e)))})},[r,K,we,_]),$e=a.useMemo(()=>q||!J?Ye:[...Ye].sort((e,n)=>{const s=e[J],i=n[J];if(s==null)return 1;if(i==null)return-1;if(typeof s=="number"&&typeof i=="number")return _e==="asc"?s-i:i-s;const o=String(s).toLowerCase(),f=String(i).toLowerCase();return _e==="asc"?o.localeCompare(f):f.localeCompare(o)}),[Ye,J,_e,q]),Qe=a.useMemo(()=>{if(Y)return $e;{const e=(ee-1)*ae,n=e+ae;return $e.slice(e,n)}},[$e,ee,ae,Y]),yt=e=>{q&&T?(T(e),y?y(1):Q(1)):(ze===e?Ne(Be==="asc"?"desc":"asc"):(tt(e),Ne("asc")),Se(1))},Lt=(e,n)=>{const s=(n||"").split(/\s+/).map(i=>i.trim()).filter(Boolean);We(e,s)},bt=e=>{ot.current||(typeof D=="function"&&D(e),ot.current=setTimeout(()=>{ot.current=null},3e3))},St=a.useCallback(e=>{if(typeof window<"u"&&te&&e.length>0&&re.current)try{localStorage.setItem(te,JSON.stringify(e)),le&&localStorage.setItem(le,"true")}catch(n){console.warn("Failed to save columns to localStorage:",n)}},[te,le]),vt=250,Ze=()=>{Object.values(fe.current).forEach(e=>clearTimeout(e)),fe.current={}},Pt=()=>{const e=ue.filter(n=>!qe.has(n));return He.forEach(n=>{e.includes(n)||e.push(n)}),se(e)},It=e=>{if(e===B)return;if(fe.current[e]){clearTimeout(fe.current[e]),delete fe.current[e],je(s=>{const i=new Set(s);return i.delete(e),i}),ke(s=>{const i=new Set(s);return i.delete(e),i});return}if(ue.includes(e)){if(ue.length-qe.size<=1)return;ke(i=>new Set(i).add(e)),fe.current[e]=setTimeout(()=>{Fe(i=>i.filter(o=>o!==e)),ke(i=>{const o=new Set(i);return o.delete(e),o}),delete fe.current[e]},vt)}else{if(ue.length+He.size>=X){bt("Maximum 9 column selection allowed");return}je(i=>new Set(i).add(e)),fe.current[e]=setTimeout(()=>{Fe(i=>se([...i,e])),je(i=>{const o=new Set(i);return o.delete(e),o}),delete fe.current[e]},vt)}},_t=(e,n)=>{ue[n]!==B&&rt(n)},Ht=()=>{rt(null),Ge(null)},qt=(e,n)=>{e.preventDefault(),pe!==null&&pe!==n&&Ge(n)},Kt=()=>{Ge(null)},Gt=(e,n)=>{e.preventDefault(),pe!==null&&pe!==n&&ue[n]!==B&&ue[pe]!==B&&Fe(s=>{const i=H.arrayMove(s,pe,n);return se(i)}),rt(null),Ge(null)};a.useEffect(()=>{mt(e=>{const n=O.filter(o=>e.includes(o)),s=O.filter(o=>!e.includes(o)),i=e.filter(o=>!O.includes(o));return[...n,...s,...i]})},[O]),a.useEffect(()=>{if(typeof window<"u"&&te&&O.length>0&&re.current)try{const e=se(O);localStorage.setItem(te,JSON.stringify(e)),le&&localStorage.setItem(le,"true")}catch(e){console.warn("Failed to save columns to localStorage:",e)}},[O,te,le]),a.useEffect(()=>{ie&&ie(O.filter(e=>e!==B))},[O,ie]),a.useEffect(()=>{if(l.length>0&&O.length===0){if(typeof window<"u"&&v)try{if(localStorage.getItem(`dataTable_manual_change_${v}:${W}`)==="true"){const s=localStorage.getItem(`dataTable_columns_${v}:${W}`);if(s){const i=JSON.parse(s);if(Array.isArray(i)&&i.length>0){const o=i.filter(f=>l.some(d=>(d.id||d.key)===f));if(o.length>0){re.current=!0,Oe(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);Oe(se(e.slice(0,X)))}},[l,v,W,se]);const De=a.useMemo(()=>{const e=O.map(n=>l.find(s=>G(s)===n)).filter(Boolean);return se(e.map(G)).map(n=>l.find(s=>G(s)===n)).filter(Boolean)},[l,O]);a.useMemo(()=>De.some(e=>e.filterable===!0),[De]),a.useEffect(()=>{if(!oe||!Ce.current)return;const e=()=>{if(Ce.current){const n=Ce.current.getBoundingClientRect(),s=217,i=Math.max(8,n.right-s);zt({top:n.bottom,left:i,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]),a.useEffect(()=>{const e=n=>{oe&&Ce.current&&!Ce.current.contains(n.target)&&st.current&&!st.current.contains(n.target)&&nt(!1)};if(oe)return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[oe]),a.useEffect(()=>{oe&&(Ze(),Fe(O),je(new Set),ke(new Set))},[oe,O]),a.useEffect(()=>()=>Ze(),[]),O.length===1?(kt=l.find(e=>(e.id||e.key)===O[0]))!=null&&kt.label:`${O.length}`;function Ut({column:e,isHeaderRow:n=!0}){const s=G(e),i=s===B,o=gt(s,e.width),[f,d]=a.useState(!1),{attributes:g,listeners:L,setNodeRef:P,transform:Pe,transition:lt,isDragging:Ve}=H.useSortable({id:s}),Jt={transform:H.CSS.Transform.toString(Pe),transition:lt,opacity:Ve?.5:1,width:o,minWidth:o};let Re=!1;if(q&&j.length>0){const C=j[0][0];(C===s||C==="csat_score"&&s==="evaluation.csat_score")&&(Re=!0)}else Re=J===s;const Yt=_e==="asc",Qt=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:Qt?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:K[s]||"",onChange:C=>{C.stopPropagation(),Lt(s,C.target.value)},onKeyDown:C=>C.stopPropagation(),onMouseDown:C=>C.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 ct=N===s,et=Ie(K[s]),Zt=e.sortable!==!1&&(f||Re),Vt=e.filterable!==!1&&!i&&(f||ct||et);return t.jsxs("th",{ref:P,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{...Jt,padding:"0 12px",height:36,textAlign:i?"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:f||ct?"#e6e6e6":"#f2f2f0",borderBottom:"1px solid #e6e6e6",position:"sticky",top:0,zIndex:10,fontFamily:"var(--font-sans)",transition:"background 100ms ease"},children:[!i&&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:i?"center":"flex-start",position:"relative",minHeight:20,minWidth:0,width:"100%",overflow:"hidden"},children:[!i&&t.jsx("div",{...g,...L,style:{cursor:"grab",color:"rgba(11, 11, 11, 0.36)",display:"inline-flex",alignItems:"center",visibility:f?"visible":"hidden",flexShrink:0},children:t.jsx($.GripVertical,{size:14})}),t.jsx("span",{onClick:()=>e.sortable!==!1&&yt(s),title:typeof e.label=="string"?e.label:void 0,style:{cursor:e.sortable!==!1?"pointer":"default",flex:i?"none":1,minWidth:0,lineHeight:"20px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.label}),Zt&&t.jsx("button",{type:"button",onClick:C=>{C.stopPropagation(),yt(s)},title:"Sort",style:{background:"transparent",border:"none",padding:4,borderRadius:4,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",color:Re?"#0b0b0b":"rgba(11, 11, 11, 0.55)",flexShrink:0},children:Re?Yt?t.jsx($.ArrowUp,{size:14,strokeWidth:1.75}):t.jsx($.ArrowDown,{size:14,strokeWidth:1.75}):t.jsx($.ArrowUpDown,{size:14,strokeWidth:1.75})}),Vt&&t.jsxs("button",{type:"button",ref:C=>{ge.current[s]=C},onClick:C=>{C.stopPropagation(),A(s,C.currentTarget)},title:"Filter",style:{position:"relative",background:ct||et?"#D8D8D8":"transparent",border:"none",padding:4,borderRadius:4,cursor:"pointer",display:"inline-flex",alignItems:"center",justifyContent:"center",color:et?"#0b0b0b":"rgba(11, 11, 11, 0.7)",flexShrink:0},children:[t.jsx($.ListFilter,{size:14,strokeWidth:1.75}),et&&t.jsx("span",{"aria-hidden":"true",style:{position:"absolute",top:0,right:0,width:6,height:6,borderRadius:"50%",background:"#0B0B0B"}})]})]}),!i&&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}}),!i&&t.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":`Resize ${e.label||s} column`,title:"Drag to resize column",onMouseDown:C=>At(C,e,o),onClick:C=>C.stopPropagation(),onMouseEnter:C=>{C.currentTarget.style.background="rgba(30, 33, 37, 0.18)"},onMouseLeave:C=>{C.currentTarget.style.background="transparent"},style:{position:"absolute",top:0,right:-2,width:4,height:"100%",cursor:"col-resize",zIndex:4,background:"transparent"}})]})}const wt=xt?l.find(e=>G(e)===xt):null,Ft=({col:e,columnId:n,isSelected:s,draggable:i,isAction:o,actualIndex:f})=>{const d=i&&pe===f,g=i&&Bt===f&&pe!==null&&pe!==f;s?qe.has(n):He.has(n);const L=s?!qe.has(n):He.has(n);return t.jsxs("div",{draggable:i,onDragStart:i?P=>_t(P,f):void 0,onDragEnd:i?Ht:void 0,onDragOver:i?P=>qt(P,f):void 0,onDragLeave:i?Kt:void 0,onDrop:i?P=>Gt(P,f):void 0,onClick:()=>{o||It(n)},style:{display:"flex",alignItems:"center",gap:4,padding:"2px 0",cursor:o?"default":i?"grab":"pointer",opacity:d?.5:1,background:g?"#F2F2F0":"transparent",borderRadius:6},children:[t.jsx("span",{style:{width:16,height:16,display:"inline-flex",alignItems:"center",justifyContent:"center",color:"#989898",visibility:i?"visible":"hidden",flexShrink:0},children:t.jsx($.GripVertical,{size:14,strokeWidth:1.75})}),t.jsx("span",{style:{width:20,height:20,borderRadius:4,display:"inline-flex",alignItems:"center",justifyContent:"center",background:L?"#0B0B0B":"#FFFFFF",border:`1px solid ${L?"#0B0B0B":"#676767"}`,flexShrink:0,marginLeft:8},children:L&&t.jsx($.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})]})},Xt=oe?t.jsxs("div",{ref:st,style:{position:"fixed",top:`${ht.top}px`,left:`${ht.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:[ue.map((e,n)=>{if(e===B)return null;const s=l.find(i=>G(i)===e);return s?t.jsx(a.Fragment,{children:Ft({col:s,columnId:e,isSelected:!0,draggable:!0,isAction:!1,actualIndex:n})},`selected-${e}-${n}`):null}),l.filter(e=>{const n=G(e);return n!==B&&!ue.includes(n)}).map(e=>{const n=G(e);return t.jsx(a.Fragment,{children:Ft({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=Ke.current?[...Ke.current]:l.map(G).slice(0,X),s=se(n);if(re.current=!1,Ze(),Fe(s),Oe(s),je(new Set),ke(new Set),typeof window<"u"&&te)try{localStorage.removeItem(te)}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(),Ze();const n=Pt();Fe(n),je(new Set),ke(new Set),re.current=!0,Oe(n),St(n),nt(!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,Le=N?l.find(e=>G(e)===N):null,jt=Le?t.jsx(cn,{column:Le,columnId:N,filterType:x(N),position:ye,popoverRef:be,distinctValues:h(N),initialValue:K[N],onSearch:typeof Le.onFilterSearch=="function"?Le.onFilterSearch:null,searchMinChars:Le.filterSearchMinChars??3,onApply:e=>{We(N,e),ce(null)},onCancel:()=>ce(null)},N):null;return t.jsxs("div",{className:"w-full",children:[jt&&ft.createPortal(jt,document.body),l.length>0&&(I||!me)&&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:[I&&t.jsx("div",{style:{marginRight:"auto"},children:t.jsx(Mt,{dateRangePicker:I.dateRangePicker,onWeekToDate:I.onWeekToDate,exportConfig:I.exportConfig,filterChipsConfig:I.filterChipsConfig,trailingActions:I.trailingActions})}),!me&&t.jsxs("div",{style:{position:"relative"},children:[t.jsxs("button",{ref:Ce,type:"button",onClick:()=>nt(!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($.Settings2,{size:20,strokeWidth:1.75}),"Columns"]}),oe&&ft.createPortal(Xt,document.body)]})]})}),Object.keys(K).length>0&&t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",padding:"8px 0"},children:[Object.entries(K).map(([e,n])=>{const s=l.find(d=>G(d)===e);if(!s||!Ie(n))return null;const i=rn(n),o=sn(n),f=on(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:i})]}),o>0&&t.jsx(an,{count:o,values:f}),t.jsx("button",{type:"button",onClick:()=>We(e,[]),"aria-label":`Remove ${s.label} filter`,style:{background:"transparent",border:"none",padding:0,cursor:"pointer",display:"inline-flex",color:"#676767"},children:t.jsx($.X,{size:14,strokeWidth:2})})]},`chip-${e}`)}),t.jsx("button",{type:"button",onClick:m,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&&De.length>0?t.jsxs(H.DndContext,{sensors:Ot,collisionDetection:H.closestCenter,onDragStart:$t,onDragEnd:Tt,children:[t.jsxs("div",{style:{borderRadius:8,border:"1px solid #E6E6E6",overflow:"hidden",background:"var(--primary-foreground)",position:"relative",top:"0.5rem",...z?{minHeight:320}:{}},children:[z&&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(un,{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:Wt,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(H.SortableContext,{items:O,strategy:H.horizontalListSortingStrategy,children:De.map(e=>t.jsx(Ut,{column:e,isHeaderRow:!0},`header-${G(e)}`))})})}),t.jsx("tbody",{children:!z&&Qe.length===0?t.jsx("tr",{children:t.jsx("td",{colSpan:De.length,style:{padding:"32px",textAlign:"center",color:"rgba(30, 33, 37, 0.42)",fontSize:"12px",fontFamily:"var(--font-sans)"},children:"No results found"})}):!z&&Qe.length>0?Qe.map((e,n)=>t.jsx("tr",{"data-row-id":e.id||n,style:{borderBottom:"1px solid #e6e6e6",cursor:p?"pointer":"default",transition:"background 0.15s ease"},onClick:p?s=>{s.stopPropagation(),p(e,n)}:void 0,onMouseEnter:s=>{s.currentTarget.style.background="#E6E6E6"},onMouseLeave:s=>{s.currentTarget.style.background="transparent"},children:De.map(s=>{const i=G(s),o=gt(i,s.width),f=e[i],d=s.render?s.render(f,e):f,g=o&&o!=="auto",L=typeof d=="string"&&d.trim()!=="",P=g&&L,Pe=P?t.jsx(ne,{content:d,children:d}):d;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)",...P&&{maxWidth:o||"200px"}},children:Pe},i)})},n)):null})]})})]}),t.jsx(H.DragOverlay,{children:wt?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($.GripVertical,{size:14,className:"text-[var(--text-faint)]"}),t.jsx("span",{className:"text-sm font-semibold text-[var(--text-ink)]",children:wt.label})]})}):null})]}):null,(()=>{const e=!_&&(we.trim()!==""||Object.values(K).some(s=>Ie(s))),n=Y?e?$e.length:S:$e.length;return n<=0?null:t.jsx(Et.Pagination,{page:ee,pageSizeOptions:[5,10,20,50,100],pageSize:ae,totalCount:n,currentDataLength:Qe.length,onPageChange:Se,onPageSizeChange:s=>{Ee(s),Se(1)},showPageSizeSelector:!0})})()]})}exports.DataTable2=pn;exports.DataTableFilters=Mt;
2
2
  //# sourceMappingURL=DataTable2.cjs.js.map