1import{j as e,aQ as ie,au as D,ag as te,r as h,a8 as le,Y as N,bQ as A,av as F,aF as re,bb as ce,z as oe}from"./index-THpNDw-R.js";import{A as de}from"./AdminLayout-Bvd6kpVI.js";import{u as B}from"./useQuery-YTu1LlCd.js";import{S as Y,a as H,b as Z,c as G,d as J}from"./select-V7DHHc3Q.js";import{S as me}from"./skeleton-Cd0iI3Bb.js";import{C as U}from"./circle-check-big-Db64vXRW.js";import{C as I}from"./clock-BJVabZgG.js";import{A as xe}from"./arrow-up-down-Cksou1hE.js";import{B as M}from"./badge-D3jmxmXK.js";import{U as ae}from"./user-DfwtD3RC.js";import{S as ue}from"./skip-forward-R8gy-Q0V.js";import{B as pe}from"./briefcase-CtgRByQU.js";import{C as ge}from"./chevron-up-SlgMXEG4.js";import{S as he}from"./shield-check-DafoaNAl.js";import{D as W}from"./download-CsTJNY-c.js";import{E as be}from"./eye-CAUO2Mne.js";import{P as fe}from"./play-CWGbghTS.js";import{T as ye}from"./triangle-alert-Bhw16-As.js";import{A as je}from"./AdminPageHeader-DCAXptMs.js";import{A as Ne}from"./AdminActionButton-CFD4WeLU.js";import"./index-BB_IdUYW.js";import{D as q}from"./database-CYgO3Csn.js";import{R as we}from"./refresh-cw-BaOns5k4.js";import"./adminAuth-CdO2ZTrV.js";import"./AdminAuthContext-DQckviGB.js";import"./adminConfig-ByiE1NnN.js";import"./format-DjiTlc93.js";import"./parseISO-4uiFBtmk.js";import"./chevron-right-DAgFs4HQ.js";import"./bell-TlsqimA3.js";import"./megaphone-DBO2Tyh0.js";import"./trending-up-BfFHU6nv.js";import"./radio-DWIaCngy.js";import"./chart-column-ViNZY9aO.js";import"./newspaper-DnJS5hgz.js";import"./wand-sparkles-BSyc2Iar.js";import"./image-f7rOdEnC.js";import"./brain-9Gj7jV_6.js";import"./rocket-n4bdhFW1.js";import"./bot-BQ4hX2lP.js";import"./sparkles-Bh9gGTd0.js";import"./settings-DW6cDq-L.js";import"./key-round-gN1DGVJ3.js";import"./external-link-CFgXtxD0.js";import"./index-9t7gNxAu.js";import"./index-DH73SiL4.js";import"./index-Cv_6r8O7.js";import"./index-Dhojajn_.js";import"./index-BEr2a01S.js";import"./index-BRAJGmhz.js";const k=({label:s,value:l,sublabel:d,icon:r,color:a})=>e.jsx("div",{className:"bg-white rounded-xl border border-gray-200 p-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-gray-500",children:s}),e.jsx("div",{className:"text-2xl font-bold text-gray-900 mt-1",children:l}),d&&e.jsx("div",{className:"text-[11px] text-gray-400 mt-0.5",children:d})]}),e.jsx(r,{className:`h-5 w-5 ${a}`})]})});function ve({records:s}){const l=s.length,d=s.filter(n=>n.bigin_sync_status==="synced").length,r=s.filter(n=>n.bigin_sync_status==="failed").length,a=s.filter(n=>n.bigin_sync_status==="pending"||!n.bigin_sync_status).length,c=s.filter(n=>n.bigin_sync_status==="skipped").length,f=s.filter(n=>n.bigin_deal_id).length,y=s.filter(n=>n.bigin_contact_id).length,x=l-c,u=x>0?Math.round(d/x*100):0;return e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3 mb-6",children:[e.jsx(k,{label:"Total Leads",value:l,icon:ie,color:"text-blue-500"}),e.jsx(k,{label:"Synced",value:d,sublabel:`${u}% sync rate`,icon:U,color:"text-green-500"}),e.jsx(k,{label:"Failed",value:r,icon:D,color:"text-red-500"}),e.jsx(k,{label:"Pending",value:a,icon:I,color:"text-amber-500"}),e.jsx(k,{label:"Contacts",value:y,icon:xe,color:"text-indigo-500"}),e.jsx(k,{label:"Deals",value:f,icon:te,color:"text-violet-500"})]})}const X={synced:{label:"Synced",icon:U,cls:"bg-green-50 text-green-700 border-green-200"},failed:{label:"Failed",icon:D,cls:"bg-red-50 text-red-700 border-red-200"},pending:{label:"Pending",icon:I,cls:"bg-amber-50 text-amber-700 border-amber-200"},skipped:{label:"Skipped",icon:ue,cls:"bg-gray-50 text-gray-600 border-gray-200"},anonymous:{label:"Anonymous",icon:ae,cls:"bg-blue-50 text-blue-600 border-blue-200"}},_e={FormSubmission:"Form",Assessment:"Assessment",NewsletterSignup:"Newsletter"},Se={consultation:"Consultation",commercial_consultation:"Commercial",partner_inquiry:"Partner",contact:"Contact",assessment_quote:"Quote Request",mailing_list:"Mailing List",william_chat:"William Chat",faq_contact:"FAQ Contact"};function Ce({record:s}){var w;const[l,d]=h.useState(!1),r=s.bigin_sync_status==="skipped"&&!s.email,a=r?"anonymous":s.bigin_sync_status||"pending",c=X[a]||X.pending,f
1=c.icon,y=_e[s._source]||s._source,x=s.form_type||(s._source==="NewsletterSignup"?"mailing_list":s._source==="Assessment"?"assessment":""),u=Se[x]||x||"Unknown",n=[s.first_name,s.last_name].filter(Boolean).join(" ")||((w=s.email)==null?void 0:w.split("@")[0])||(r?"Anonymous Visitor":"Unknown"),S=s.created_date?new Date(s.created_date).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"",i=s.bigin_synced_at?new Date(s.bigin_synced_at).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):null;return e.jsxs("div",{className:`border rounded-lg bg-white transition-shadow ${l?"shadow-md border-stone-300":"border-gray-200 hover:shadow-sm"}`,children:[e.jsx("button",{onClick:()=>d(!l),className:"w-full text-left p-3 md:p-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`flex items-center justify-center w-8 h-8 rounded-full flex-shrink-0 ${a==="synced"?"bg-green-100":a==="failed"?"bg-red-100":a==="skipped"?"bg-gray-100":a==="anonymous"?"bg-blue-100":"bg-amber-100"}`,children:e.jsx(f,{className:`h-4 w-4 ${a==="synced"?"text-green-600":a==="failed"?"text-red-500":a==="skipped"?"text-gray-500":a==="anonymous"?"text-blue-500":"text-amber-600"}`})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-medium text-sm text-gray-900 truncate",children:n}),e.jsx(M,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:y}),e.jsx(M,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:u})]}),e.jsxs("div",{className:"text-xs text-gray-500 mt-0.5 truncate",children:[s.email," · ",S]})]}),e.jsxs("div",{className:"hidden md:flex items-center gap-2 flex-shrink-0",children:[s.bigin_contact_id&&e.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-indigo-600 bg-indigo-50 px-2 py-0.5 rounded-full",children:[e.jsx(ae,{className:"h-3 w-3"}),"Contact"]}),s.bigin_deal_id&&e.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-violet-600 bg-violet-50 px-2 py-0.5 rounded-full",children:[e.jsx(pe,{className:"h-3 w-3"}),"Deal"]}),e.jsx(M,{className:`text-[10px] px-2 py-0.5 ${c.cls}`,children:c.label})]}),l?e.jsx(ge,{className:"h-4 w-4 text-gray-400 flex-shrink-0"}):e.jsx(le,{className:"h-4 w-4 text-gray-400 flex-shrink-0"})]})}),l&&e.jsxs("div",{className:"px-4 pb-4 pt-0 border-t border-gray-100",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mt-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-[11px] font-semibold uppercase tracking-wider text-gray-400",children:"CRM Sync"}),e.jsxs("div",{className:"space-y-1.5 text-xs",children:[e.jsx(b,{label:"Status",value:e.jsx(M,{className:`text-[10px] ${c.cls}`,children:c.label})}),e.jsx(b,{label:"Contact ID",value:s.bigin_contact_id||e.jsx("span",{className:"text-gray-400",children:"â"})}),e.jsx(b,{label:"Deal ID",value:s.bigin_deal_id||e.jsx("span",{className:"text-gray-400",children:"â"})}),e.jsx(b,{label:"Note ID",value:s.bigin_note_id||e.jsx("span",{className:"text-gray-400",children:"â"})}),i&&e.jsx(b,{label:"Synced at",value:i})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-[11px] font-semibold uppercase tracking-wider text-gray-400",children:"Details"}),e.jsxs("div",{className:"space-y-1.5 text-xs",children:[e.jsx(b,{label:"Country",value:s.country||"â"}),e.jsx(b,{label:"Phone",value:s.phone||"â"}),s.utm_source&&e.jsx(b,{label:"UTM Source",value:s.utm_source}),s.utm_campaign&&e.jsx(b,{label:"Campaign",value:s.utm_campaign}),s.ref_source&&e.jsx(b,{label:"Ref",value:s.ref_source})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"text-[11px] font-semibold uppercase tracking-wider text-gray-400",children:"Email"}),e.jsxs("div",{className:"space-y-1.5 text-xs",children:[e.jsx(b,{label:"Template",value:u}),e.jsx(b,{label:"Status",value:s.bigin_sync_status==="synced"&&s.bigin_contact_id?e.jsxs("span",{className:"text-green-600 flex items-center gap-1",children:[e.jsx(te,{className:"h-3 w-3"}),"Sent via Bigin"]}):s.bigin_sync_status==="skipped"?e.jsx("span",{className:"text-gray-500",children:"Skipped (no email or disabled)"}):s.bigin_sync_status==="failed"?e.jsx("span",{className:"text-red-500",children:"Not sent (sync failed)"}):e.jsx("span",{className:"text-amber-500",children:"Pending sync"})})]})]})]}),s.bigin_sync_error&&!r&&e.jsxs("div",{className:"mt-3 p-2.5 bg-red-50 border border-red-200 rounded-lg",children:[e.jsx("div",{className:"text-[11px] font-semibold text-red-700 mb-1",children:"Sync Error"}),e.jsx("pre",{className:"text-[11px] text-red-600 whitespace-pre-wrap font-mono leading-relaxed",children:s.bigin_sync_error})]}),r&&e.jsx("div",{className:"mt-3 p-2.5 bg-blue-50 border border-blue-200 rounded-lg",children:e.jsx("div",{className:"text-[11px] text-blue-700",children:"This visitor completed an assessment without providing contact details. CRM sync is not needed."})})]})]})}function b({label:s,value:l}){return e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("span",{className:"text-gray-500 flex-shrink-0",children:s}),e.jsx("span",{className:"text-gray-900 text-right truncate max-w-[180px]",children:l})]})}function ke(){const{data:s=[]}=B({queryKey:["zoho-token-cache"],queryFn:()=>N.entities.ZohoTokenCache.filter({cache_key:"bigin_token"},"-updated_date",1),staleTime:3e4}),l=s[0];if(!l)return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg bg-red-50 border border-red-200 text-xs text-red-700",children:[e.jsx(D,{className:"h-3.5 w-3.5"}),"No Bigin token â CRM sync is offline"]});const d=new Date(l.expires_at),r=Date.now()>d.getTime(),a=Math.max(0,Math.round((d.getTime()-Date.now())/6e4)),c=l.last_refresh_error;return c&&c.includes("invalid")?e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg bg-red-50 border border-red-200 text-xs text-red-700",children:[e.jsx(D,{className:"h-3.5 w-3.5"}),"Token error: ",c.substring(0,80)]}):r?e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg bg-green-50 border border-green-200 text-xs text-green-700",children:[e.jsx(I,{className:"h-3.5 w-3.5"}),"Connected â token refreshes automatically · ",l.refresh_count||0," refreshes"]}):e.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-lg bg-green-50 border border-green-200 text-xs text-green-700",children:[e.jsx(U,{className:"h-3.5 w-3.5"}),"Connected â ",a,"m until refresh · ",l.refresh_count||0," refreshes"]})}const ee={explicit:{label:"Opted In (explicit)",color:"text-emerald-700 bg-emerald-50 border-emerald-200"},implied:{label:"Implied Consent (CASL)",color:"text-amber-700 bg-amber-50 border-amber-200"},none:{label:"Not Opted",color:"text-stone-600 bg-stone-50 border-stone-200"}};function Ae(){var T,L,E,R;
1const[s,l]=h.useState(!1),[d,r]=h.useState(null),[a,c]=h.useState(null),[f,y]=h.useState(0),[x,u]=h.useState(null),n=async o=>{u(o?"emailable":"all"),r(null);try{const p=await N.functions.invoke("exportMarketingConsentCSV",{emailable_only:o}),v=typeof p.data=="string"?p.data:JSON.stringify(p.data),j=new Blob([v],{type:"text/csv;charset=utf-8"}),m=URL.createObjectURL(j),_=document.createElement("a");_.href=m,_.download=`marketing-contacts-${o?"emailable":"all"}-${new Date().toISOString().slice(0,10)}.csv`,_.click(),URL.revokeObjectURL(m)}catch(p){r(p.message||"CSV export failed")}finally{u(null)}},S=async o=>{var p,v;l(!0),r(null);try{const j=await N.functions.invoke("backfillMarketingConsentTags",{dry_run:o,limit:200,skip:o?0:f}),m=(j==null?void 0:j.data)||j;if((m==null?void 0:m.status)==="error")throw new Error(m.error||"Backfill failed");if(c({...m,dryRun:o}),!o){const _=(v=(p=m==null?void 0:m.results)==null?void 0:p[0])==null?void 0:v.next_skip;y(typeof _=="number"?_:0)}}catch(j){r(j.message||"Something went wrong")}finally{l(!1)}},i=a==null?void 0:a.totals,w=i==null?void 0:i.breakdown;return e.jsxs("div",{className:"bg-white rounded-xl border border-stone-200 shadow-sm p-5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 flex-wrap",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"h-9 w-9 rounded-lg bg-[#B18C19]/10 flex items-center justify-center flex-shrink-0",children:e.jsx(he,{className:"h-5 w-5 text-[#B18C19]"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-bold text-stone-900",children:"Marketing Consent"}),e.jsx("p",{className:"text-xs text-stone-500 mt-0.5 max-w-md",children:"Tags every contact & deal with consent status (Opted In / Implied / Not Opted) and upgrades Marketing_status for CASL implied-consent leads. Preview first, then run in batches."})]})]}),e.jsxs("div",{className:"flex gap-2 flex-wrap",children:[e.jsxs(A,{variant:"outline",size:"sm",disabled:!!x,onClick:()=>n(!0),className:"border-emerald-200 text-emerald-700 bg-emerald-50 hover:bg-emerald-100",children:[x==="emailable"?e.jsx(F,{className:"h-4 w-4 mr-1.5 animate-spin"}):e.jsx(W,{className:"h-4 w-4 mr-1.5"}),"Emailable CSV"]}),e.jsxs(A,{variant:"outline",size:"sm",disabled:!!x,onClick:()=>n(!1),className:"border-stone-200 text-stone-600 bg-white",children:[x==="all"?e.jsx(F,{className:"h-4 w-4 mr-1.5 animate-spin"}):e.jsx(W,{className:"h-4 w-4 mr-1.5"}),"Full list CSV"]}),e.jsxs(A,{variant:"outline",size:"sm",disabled:s,onClick:()=>S(!0),className:"border-stone-200 text-stone-600 bg-white",children:[s?e.jsx(F,{className:"h-4 w-4 mr-1.5 animate-spin"}):e.jsx(be,{className:"h-4 w-4 mr-1.5"}),"Preview"]}),e.jsxs(A,{size:"sm",disabled:s,onClick:()=>S(!1),className:"bg-[#B18C19] hover:bg-[#9a7815] text-white",children:[s?e.jsx(F,{className:"h-4 w-4 mr-1.5 animate-spin"}):e.jsx(fe,{className:"h-4 w-4 mr-1.5"}),"Run batch",f>0?` (from ${f})`:""]})]})]}),d&&e.jsxs("div",{className:"mt-4 flex items-start gap-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2.5",children:[e.jsx(ye,{className:"h-4 w-4 text-red-600 mt-0.5 flex-shrink-0"}),e.jsx("p",{className:"text-xs text-red-700",children:d})]}),a&&!d&&e.jsxs("div",{className:"mt-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(re,{className:"h-4 w-4 text-emerald-600"}),e.jsxs("p",{className:"text-xs font-semibold text-stone-700",children:[a.dryRun?"Preview":"Batch complete"," · scanned ",(i==null?void 0:i.scanned)??0," records",!a.dryRun&&e.jsxs("span",{className:"text-stone-500 font-normal",children:[" ","· ",(i==null?void 0:i.contacts_tagged)??0," contacts tagged · ",(i==null?void 0:i.deals_tagged)??0," deals tagged"," ","· ",(i==null?void 0:i.status_upgraded)??0," status upgraded",i!=null&&i.errors?` · ${i.errors} errors`:""]})]})]}),w&&e.jsx("div",{className:"grid grid-cols-3 gap-2",children:["explicit","implied","none"].map(o=>e.jsxs("div",{className:`rounded-lg border px-3 py-2.5 ${ee[o].color}`,children:[e.jsx("div",{className:"text-lg font-bold leading-none",children:w[o]??0}),e.jsx("div",{className:"text-[11px] mt-1 font-medium",children:ee[o].label})]},o))}),!a.dryRun&&((L=(T=a==null?void 0:a.results)==null?void 0:T[0])==null?void 0:L.next_skip)!=null&&e.jsxs("p",{className:"text-[11px] text-stone-400 mt-3",children:["More records remain â click âRun batchâ again to continue from ",a.results[0].next_skip,"."]}),!a.dryRun&&((R=(E=a==null?void 0:a.results)==null?void 0:E[0])==null?void 0:R.next_skip)==null&&e.jsx("p",{className:"text-[11px] text-emerald-600 mt-3 font-medium",children:"All records processed for this entity. â"})]})]})}const se=["all","synced","failed","pending","skipped"],Le=["all","FormSubmission","Assessment","NewsletterSignup"],Re={all:"All Sources",FormSubmission:"Forms",Assessment:"Assessments",NewsletterSignup:"Newsletter"};function ks(){const s=ce(),l=new URLSearchParams(window.location.search),d=se.includes(l.get("filter"))?l.get("filter"):"all",[r,a]=h.useState(d),[c,f]=h.useState("all"),[y,x]=h.useState(""),[u,n]=h.useState(0),{data:S=[],isLoading:i}=B({queryKey:["bigin-sync-forms"],queryFn:()=>N.entities.FormSubmission.list("-created_date",200),staleTime:3e4}),{data:w=[],isLoading:T}=B({queryKey:["bigin-sync-assessments"],queryFn:()=>N.entities.Assessment.filter({is_test:!1},"-created_date",200),staleTime:3e4}),{data:L=[],isLoading:E}=B({queryKey:["bigin-sync-newsletters"],queryFn:()=>N.entities.NewsletterSignup.filter({is_test:!1},"-created_date",200).catch(()=>N.entities.NewsletterSignup.list("-created_date",200)),staleTime:3e4}),R=i||T||E;h.useEffect(()=>{const t=[N.entities.FormSubmission.subscribe(()=>{s.invalidateQueries({queryKey:["bigin-sync-forms"]})}),N.entities.Assessment.subscribe(()=>{s.invalidateQueries({queryKey:["bigin-sync-assessments"]})}),N.entities.NewsletterSignup.subscribe(()=>{s.invalidateQueries({queryKey:["bigin-sync-newsletters"]})})];return()=>t.forEach(g=>g())},[s]);const o=h.useMemo(()=>{const t=[...S.map(g=>({...g,_source:"FormSubmission"})),...w.map(g=>({...g,_source:"Assessment"})),...L.map(g=>({...g,_source:"NewsletterSignup"}))];return t.sort((g,P)=>new Date(P.created_date)-new Date(g.created_date)),t},[S,w,L]),p=h.useMemo(()=>o.filter(t=>{var $,K,Q,z,O,V;const g=r==="all"||(t.bigin_sync_status||"pending")===r,P=c==="all"||t._source===c,C=y.toLowerCase(),ne=!C||(($=t.email)==null?void 0:$.toLowerCase().includes(C))||((K=t.first_name)==null?void 0:K.toLowerCase().includes(C))||((Q=t.last_name)==null?void 0:Q.toLowerCase().includes(C))||((z=t.bigin_contact_id)==null?void 0:z.includes(C))||((O=t.bigin_deal_id)==null?void 0:O.includes(C))||((V=t.bigin_sync_error)==null?void 0:V.toLowerCase().includes(C));return g&&P&&ne}),[o,r,c,y]),v=20,j=p.slice(u*v,(u+1)*v),m=Math.ceil(p.length/v),_=()=>{s.invalidateQueries({queryKey:["bigin-sync-forms"]}),s.invalidateQueries({queryKey:["bigin-sync-assessments"]}),s.invalidateQueries({queryKey:["bigin-sync-newsletters"]}),s.invalidateQueries({queryKey:["bigin-token-cache"]})};return e.jsx(de,{title:"CRM Sync Hub",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(je,{icon:q,sectionLabel:"LEADS",title:"CRM Sync Hub",subtitle:"Manage synchronization between the platform and Zoho Bigin",actions:e.jsx(Ne,{variant:"secondary",size:"sm",icon:we,onClick:_,children:"Refresh"})}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 p-4 bg-white rounded-xl border border-stone-200",children:[e.jsx(ke,{}),e.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-stone-400",children:[e.jsx(q,{className:"h-3.5 w-3.5"}),o.length," total records · Real-time updates active"]})]}),!R&&e.jsx(ve,{records:o}),e.jsx(Ae,{}),e.jsx("div",{className:"bg-white rounded-lg border border-stone-200 shadow-sm p-4",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[e.jsx(oe,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-stone-400"}),e.jsx("input",{type:"text",placeholder:"Search email, name, contact ID...",value:y,onChange:t=>{x(t.target.value),n(0)},className:"w-full pl-9 pr-4 py-2 border border-stone-200 rounded-lg text-sm focus:border-[#B18C19] focus:outline-none focus:ring-1 focus:ring-[#B18C19] bg-white text-stone-900 placeholder:text-stone-400 shadow-sm"})]}),e.jsxs(Y,{value:r,onValueChange:t=>{a(t),n(0)},children:[e.jsx(H,{className:"w-36 bg-white border-stone-200 shadow-sm text-stone-600",children:e.jsx(Z,{})}),e.jsx(G,{children:se.map(t=>e.jsx(J,{value:t,className:"capitalize",children:t==="all"?"All Statuses":t==="skipped"?"Spam Filtered":t},t))})]}),e.jsxs(Y,{value:c,onValueChange:t=>{f(t),n(0)},children:[e.jsx(H,{className:"w-36 bg-white border-stone-200 shadow-sm text-stone-600",children:e.jsx(Z,{})}),e.jsx(G,{children:Le.map(t=>e.jsx(J,{value:t,children:Re[t]},t))})]}),(r!=="all"||c!=="all"||y)&&e.jsx("button",{onClick:()=>{a("all"),f("all"),x(""),n(0)},className:"text-xs text-stone-400 hover:text-stone-700 underline px-2",children:"Clear filters"})]})}),R?e.jsx("div",{className:"space-y-2",children:[...Array(5)].map((t,g)=>e.jsx(me,{className:"h-16 w-full rounded-lg"},g))}):p.length===0?e.jsxs("div",{className:"text-center py-16 bg-white rounded-xl border border-stone-200",children:[e.jsx(q,{className:"h-10 w-10 text-stone-300 mx-auto mb-3"}),e.jsx("p",{className:"text-stone-500 font-medium",children:"No records foun
1d"}),e.jsx("p",{className:"text-stone-400 text-sm mt-1",children:"Try adjusting your filters"})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-2 mb-6",children:j.map(t=>e.jsx(Ce,{record:t},`${t._source}-${t.id}`))}),m>1&&e.jsxs("div",{className:"flex items-center justify-between border-t border-stone-200 pt-4",children:[e.jsxs("p",{className:"text-sm text-stone-500",children:["Page ",u+1," of ",m," · ",p.length," records"]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(A,{variant:"outline",size:"sm",disabled:u===0,onClick:()=>n(t=>Math.max(0,t-1)),className:"border-stone-200 text-stone-600 bg-white",children:"Previous"}),e.jsx(A,{variant:"outline",size:"sm",disabled:u+1>=m,onClick:()=>n(t=>t+1),className:"border-stone-200 text-stone-600 bg-white",children:"Next"})]})]})]})]})})}export{ks as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.