import{j as e,r as u}from"./client-BbMi5ewG.js";import{L as j,B as g,D as F,C as L,a as T,b as P,P as B,c as E,d as $,A as M,p as U,e as O,f as z,i as I}from"./index-JsQEnXJ1.js";import{a as h,s as o,u as d}from"./store-jX25q14N.js";import{D as f}from"./dollar-sign-DRtWdm2i.js";import{C as Y}from"./calendar-CjyQ6Zau.js";import{U as q}from"./withIconDefaults-C8UfSjn1.js";import{n as k,l as C,o as H}from"./index-CM0LBdHD.js";import{c as y}from"./utils-Q0fnGDhj.js";import{R as K}from"./refresh-cw-Drw5C3fI.js";import{C as N}from"./calendar-check-B9VltuWN.js";import{B as R}from"./briefcase-C1E6F6kb.js";import{P as V}from"./ProUpgradeBanner-j5GA7rlc.js";import"./vendor-DDjlQeP6.js";import"./lodash-Bd-B7UeG.js";import"./defineProperty-DbXIQDXj.js";import"./typeof-QjJsDpFa.js";import"./apiConfig-D-T4C2Ae.js";import"./index-D59bwJy3.js";import"./toast-1-c8k_LJ.js";import"./preload-helper-Dp1pzeXC.js";import"./CalenderCheck-BuHSX8YD.js";import"./tag-CvsOfBQf.js";import"./shield-Bmp_421z.js";import"./proxy-DChtKkEh.js";import"./circle-check-big-uMTsaxsq.js";import"./crown-BdDHOvET.js";/**
 * @license lucide-react v0.525.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const W=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],X=y("arrow-down",W);/**
 * @license lucide-react v0.525.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const G=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],J=y("arrow-up",G);/**
 * @license lucide-react v0.525.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Q=[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],D=y("user-check",Q);/**
 * @license lucide-react v0.525.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Z=[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]],A=y("users-round",Z),ee=[{key:"this_month",label:"This Month"},{key:"30d",label:"Last 30 Days"},{key:"90d",label:"Last 90 Days"},{key:"1y",label:"1 Year"},{key:"all",label:"All"}];function _(r){return r.toISOString().split("T")[0]}function te(r){const s=new Date;let t=new Date,l=new Date;switch(r){case"this_month":t=new Date(s.getFullYear(),s.getMonth(),1),l=new Date(s.getFullYear(),s.getMonth()+1,0);break;case"30d":t.setDate(t.getDate()-30);break;case"90d":t.setDate(t.getDate()-90);break;case"1y":t.setFullYear(t.getFullYear()-1);break;case"all":t.setDate(t.getDate()-90),l.setDate(l.getDate()+90);break;default:t.setDate(t.getDate()-90),l.setDate(l.getDate()+90)}return{date_from:_(t),date_to:_(l),preset:r}}function se(){const r=h(o),s=d(i=>i(o).getAnalyticsPeriod(),[]);function t(i){r.setAnalyticsPeriod(te(i))}function l(i,a){r.setAnalyticsPeriod({...s,[i]:a,preset:"custom"})}return e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[ee.map(i=>e.jsx("button",{onClick:()=>t(i.key),className:`px-3 py-1.5 text-xs font-medium rounded-md border transition-colors ${s.preset===i.key?"bg-primary text-white border-primary":"bg-white text-title border-border hover:bg-gray-50"}`,children:i.label},i.key)),e.jsxs("div",{className:"flex items-center gap-1.5 ml-2",children:[e.jsx("input",{type:"date",value:s.date_from,onChange:i=>l("date_from",i.target.value),className:"px-2 py-1.5 text-xs border border-border rounded-md bg-white"}),e.jsx("span",{className:"text-xs text-title2",children:"to"}),e.jsx("input",{type:"date",value:s.date_to,onChange:i=>l("date_to",i.target.value),className:"px-2 py-1.5 text-xs border border-border rounded-md bg-white"})]})]})}const re=[{key:"total_revenue",label:"Total Revenue",icon:f,isCurrency:!0,color:"text-emerald-600",bg:"bg-emerald-50"},{key:"total_appointments",label:"Appointments",icon:Y,color:"text-blue-600",bg:"bg-blue-50"},{key:"new_customers",label:"New Customers",icon:q,color:"text-violet-600",bg:"bg-violet-50"},{key:"avg_revenue_per_appt",label:"Avg Revenue",icon:k,isCurrency:!0,color:"text-amber-600",bg:"bg-amber-50"},{key:"cancellation_rate",label:"Cancellation Rate",icon:C,suffix:"%",invertColor:!0,color:"text-red-600",bg:"bg-red-50"}];function ae(){const r=h(o),s=d(a=>a(o).getAnalyticsPeriod(),[]),t=d(a=>a(o).getKpiSummary(),[]),l=d(a=>a(o).getAnalyticsLoading(),[]);u.useEffect(()=>{r.loadKpiSummary({date_from:s.date_from,date_to:s.date_to})},[s.date_from,s.date_to]);const i=(t==null?void 0:t.currency_symbol)||"$";return e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-5 gap-4",children:re.map(a=>{const c=(t==null?void 0:t[a.key])||{},n=c.value??0,b=c.change_pct??0,m=a.invertColor?b<=0:b>=0,x=a.icon;return e.jsxs("div",{className:"bg-white rounded-xl border border-border p-5 flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-medium text-title2",children:a.label}),e.jsx("div",{className:`w-8 h-8 rounded-lg ${a.bg} flex items-center justify-center`,children:e.jsx(x,{className:`w-4 h-4 ${a.color}`})})]}),e.jsx("div",{className:"text-2xl font-bold text-title",children:l.kpi?e.jsx("div",{className:"h-8 w-24 bg-gray-100 rounded animate-pulse"}):e.jsxs(e.Fragment,{children:[a.isCurrency&&i,typeof n=="number"?n.toLocaleString():n,a.suffix||""]})}),!l.kpi&&e.jsxs("div",{className:`flex items-center gap-1 text-xs font-medium ${m?"text-emerald-600":"text-red-500"}`,children:[m?e.jsx(J,{className:"w-3 h-3"}):e.jsx(X,{className:"w-3 h-3"}),Math.abs(b),"%",e.jsx("span",{className:"text-title2 font-normal ml-1",children:"vs prev period"})]})]},a.key)})})}function ie(){const r=h(o),s=d(n=>n(o).getAnalyticsPeriod(),[]),t=d(n=>n(o).getRevenueAnalytics(),[]),l=d(n=>n(o).getAnalyticsLoading(),[]);u.useEffect(()=>{r.loadRevenueAnalytics({date_from:s.date_from,date_to:s.date_to})},[s.date_from,s.date_to]);const i=(t==null?void 0:t.trend)||{labels:[],data:[]},a={labels:i.labels||[],datasets:[{label:"Revenue",data:i.data||[],borderColor:"#4F46E5",backgroundColor:"rgba(79, 70, 229, 0.08)",fill:!0,tension:.4,pointRadius:2,pointHoverRadius:5}]},c={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1},tooltip:{mode:"index",intersect:!1}},scales:{x:{grid:{display:!1},ticks:{color:"#9CA3AF",maxTicksLimit:10}},y:{grid:{color:"rgba(156,163,175,0.1)"},ticks:{color:"#9CA3AF",precision:0}}}};return l.revenue?e.jsx("div",{className:"bg-white rounded-xl border border-border p-6",children:e.jsx("div",{className:"h-[280px] bg-gray-50 rounded animate-pulse"})}):e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-title mb-4",children:"Revenue Trend"}),e.jsx("div",{className:"h-[280px]",children:e.jsx(j,{data:a,options:c})})]})}function oe(){const r=d(a=>a(o).getRevenueAnalytics(),[]),s=d(a=>a(o).getAnalyticsLoading(),[]),t=(r==null?void 0:r.by_service)||[],l={labels:t.map(a=>a.service_name),datasets:[{label:"Revenue",data:t.map(a=>a.revenue),backgroundColor:"#818CF8",borderRadius:4,barThickness:18}]},i={indexAxis:"y",responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1}},scales:{x:{grid:{color:"rgba(156,163,175,0.1)"},ticks:{color:"#9CA3AF",precision:0}},y:{grid:{display:!1},ticks:{color:"#374151",font:{size:11}}}}};return s.revenue?e.jsx("div",{className:"bg-white rounded-xl border border-border p-6",children:e.jsx("div",{className:"h-[200px] bg-gray-50 rounded animate-pulse"})}):e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-title mb-4",children:"Revenue by Service"}),e.jsx("div",{className:"h-[200px]",children:t.length?e.jsx(g,{data:l,options:i}):e.jsx("p",{className:"text-sm text-title2",children:"No data"})})]})}function le(){const r=d(a=>a(o).getRevenueAnalytics(),[]),s=d(a=>a(o).getAnalyticsLoading(),[]),t=(r==null?void 0:r.by_employee)||[],l={labels:t.map(a=>a.employee_name),datasets:[{label:"Revenue",data:t.map(a=>a.revenue),backgroundColor:"#34D399",borderRadius:4,barThickness:18}]},i={indexAxis:"y",responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1}},scales:{x:{grid:{color:"rgba(156,163,175,0.1)"},ticks:{color:"#9CA3AF",precision:0}},y:{grid:{display:!1},ticks:{color:"#374151",font:{size:11}}}}};return s.revenue?e.jsx("div",{className:"bg-white rounded-xl border border-border p-6",children:e.jsx("div",{className:"h-[200px] bg-gray-50 rounded animate-pulse"})}):e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-title mb-4",children:"Revenue by Staff"}),e.jsx("div",{className:"h-[200px]",children:t.length?e.jsx(g,{data:l,options:i}):e.jsx("p",{className:"text-sm text-title2",children:"No data"})})]})}const w={pending:"#FBBF24",confirmed:"#60A5FA",completed:"#34D399",cancelled:"#F87171"};function ne(){const r=h(o),s=d(x=>x(o).getAnalyticsPeriod(),[]),t=d(x=>x(o).getAppointmentAnalytics(),[]),l=d(x=>x(o).getAnalyticsLoading(),[]);u.useEffect(()=>{r.loadAppointmentAnalytics({date_from:s.date_from,date_to:s.date_to})},[s.date_from,s.date_to]);const i=(t==null?void 0:t.by_status)||{},a=Object.keys(w),c=a.map(x=>i[x]||0),n=c.reduce((x,p)=>x+p,0),b={labels:a.map(x=>x.charAt(0).toUpperCase()+x.slice(1)),datasets:[{data:c,backgroundColor:a.map(x=>w[x]),borderWidth:0,hoverOffset:6}]},m={responsive:!0,maintainAspectRatio:!1,cutout:"65%",plugins:{legend:{position:"bottom",labels:{usePointStyle:!0,pointStyle:"circle",padding:12,font:{size:11}}}}};return l.appointments?e.jsx("div",{className:"bg-white rounded-xl border border-border p-6",children:e.jsx("div",{className:"h-[260px] bg-gray-50 rounded animate-pulse"})}):e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-title mb-1",children:"By Status"}),e.jsxs("p",{className:"text-xs text-title2 mb-4",children:[n," total appointments"]}),e.jsx("div",{className:"h-[220px]",children:n>0?e.jsx(F,{data:b,options:m}):e.jsx("p",{className:"text-sm text-title2 text-center pt-16",children:"No data"})})]})}function de(){const r=d(a=>a(o).getAppointmentAnalytics(),[]),s=d(a=>a(o).getAnalyticsLoading(),[]),t=(r==null?void 0:r.over_time)||{labels:[],data:[]},l={labels:t.labels||[],datasets:[{label:"Appointments",data:t.data||[],borderColor:"#6366F1",backgroundColor:"rgba(99, 102, 241, 0.08)",fill:!0,tension:.4,pointRadius:2,pointHoverRadius:5}]},i={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1}},scales:{x:{grid:{display:!1},ticks:{color:"#9CA3AF",maxTicksLimit:8}},y:{grid:{color:"rgba(156,163,175,0.1)"},ticks:{color:"#9CA3AF",precision:0}}}};return s.appointments?e.jsx("div",{className:"bg-white rounded-xl border border-border p-6",children:e.jsx("div",{className:"h-[260px] bg-gray-50 rounded animate-pulse"})}):e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-title mb-4",children:"Appointments Over Time"}),e.jsx("div",{className:"h-[220px]",children:e.jsx(j,{data:l,options:i})})]})}function ce(){const r=d(c=>c(o).getAppointmentAnalytics(),[]),s=d(c=>c(o).getAnalyticsLoading(),[]),l=((r==null?void 0:r.peak_hours)||[]).filter(c=>c.count>0),i={labels:l.map(c=>c.label),datasets:[{label:"Bookings",data:l.map(c=>c.count),backgroundColor:"#A78BFA",borderRadius:4,barThickness:14}]},a={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1}},scales:{x:{grid:{display:!1},ticks:{color:"#9CA3AF",font:{size:10}}},y:{grid:{color:"rgba(156,163,175,0.1)"},ticks:{color:"#9CA3AF",precision:0}}}};return s.appointments?e.jsx("div",{className:"bg-white rounded-xl border border-border p-6",children:e.jsx("div",{className:"h-[260px] bg-gray-50 rounded animate-pulse"})}):e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-title mb-4",children:"Peak Hours"}),e.jsx("div",{className:"h-[220px]",children:l.length?e.jsx(g,{data:i,options:a}):e.jsx("p",{className:"text-sm text-title2",children:"No data"})})]})}function me(){const r=d(a=>a(o).getAppointmentAnalytics(),[]),s=d(a=>a(o).getAnalyticsLoading(),[]),t=(r==null?void 0:r.busiest_days)||[],l={labels:t.map(a=>a.day),datasets:[{label:"Bookings",data:t.map(a=>a.count),backgroundColor:"#38BDF8",borderRadius:4,barThickness:20}]},i={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1}},scales:{x:{grid:{display:!1},ticks:{color:"#374151",font:{size:11}}},y:{grid:{color:"rgba(156,163,175,0.1)"},ticks:{color:"#9CA3AF",precision:0}}}};return s.appointments?e.jsx("div",{className:"bg-white rounded-xl border border-border p-6",children:e.jsx("div",{className:"h-[260px] bg-gray-50 rounded animate-pulse"})}):e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-title mb-4",children:"Busiest Days"}),e.jsx("div",{className:"h-[220px]",children:t.length?e.jsx(g,{data:l,options:i}):e.jsx("p",{className:"text-sm text-title2",children:"No data"})})]})}function xe(){const r=h(o),s=d(n=>n(o).getAnalyticsPeriod(),[]),t=d(n=>n(o).getEmployeeAnalytics(),[]),l=d(n=>n(o).getAnalyticsLoading(),[]),i=d(n=>n(o).getKpiSummary(),[]),a=(i==null?void 0:i.currency_symbol)||"$";u.useEffect(()=>{r.loadEmployeeAnalytics({date_from:s.date_from,date_to:s.date_to})},[s.date_from,s.date_to]);const c=(t==null?void 0:t.performance)||[];return l.employees?e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6",children:[e.jsx("div",{className:"h-8 w-48 bg-gray-100 rounded animate-pulse mb-4"}),e.jsx("div",{className:"space-y-3",children:[1,2,3].map(n=>e.jsx("div",{className:"h-10 bg-gray-50 rounded animate-pulse"},n))})]}):e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-title mb-4",children:"Staff Performance"}),c.length===0?e.jsx("p",{className:"text-sm text-title2",children:"No employee data for this period."}):e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border text-left",children:[e.jsx("th",{className:"py-2.5 pr-4 text-xs font-medium text-title2",children:"Staff"}),e.jsx("th",{className:"py-2.5 px-4 text-xs font-medium text-title2 text-center",children:"Appointments"}),e.jsx("th",{className:"py-2.5 px-4 text-xs font-medium text-title2 text-right",children:"Revenue"}),e.jsx("th",{className:"py-2.5 px-4 text-xs font-medium text-title2 text-center",children:"Completion"}),e.jsx("th",{className:"py-2.5 pl-4 text-xs font-medium text-title2 text-center",children:"Cancelled"})]})}),e.jsx("tbody",{children:c.map(n=>e.jsxs("tr",{className:"border-b border-border/50 last:border-0",children:[e.jsx("td",{className:"py-2.5 pr-4 font-medium text-title",children:n.employee_name}),e.jsx("td",{className:"py-2.5 px-4 text-center text-title",children:n.total_appointments}),e.jsxs("td",{className:"py-2.5 px-4 text-right text-title",children:[a,Number(n.revenue).toLocaleString()]}),e.jsx("td",{className:"py-2.5 px-4 text-center",children:e.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-emerald-50 text-emerald-700",children:[n.completion_rate,"%"]})}),e.jsx("td",{className:"py-2.5 pl-4 text-center",children:e.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-red-50 text-red-600",children:[n.cancellation_rate,"%"]})})]},n.employee_id))})]})})]})}function pe(){const r=h(o),s=d(m=>m(o).getAnalyticsPeriod(),[]),t=d(m=>m(o).getServiceAnalytics(),[]),l=d(m=>m(o).getAnalyticsLoading(),[]);u.useEffect(()=>{r.loadServiceAnalytics({date_from:s.date_from,date_to:s.date_to})},[s.date_from,s.date_to]);const i=(t==null?void 0:t.popular)||[],a=(t==null?void 0:t.revenue)||[],c={labels:i.map(m=>m.service_name),datasets:[{label:"Bookings",data:i.map(m=>m.appointment_count),backgroundColor:"#6366F1",borderRadius:4,barThickness:18}]},n={labels:a.map(m=>m.service_name),datasets:[{label:"Revenue",data:a.map(m=>m.total_revenue),backgroundColor:"#F59E0B",borderRadius:4,barThickness:18}]},b=(m=!1)=>({indexAxis:m?"y":"x",responsive:!0,maintainAspectRatio:!1,plugins:{legend:{display:!1}},scales:{x:{grid:{display:m,color:"rgba(156,163,175,0.1)"},ticks:{color:"#9CA3AF",precision:0,font:{size:11}}},y:{grid:{display:!m,color:"rgba(156,163,175,0.1)"},ticks:{color:"#374151",font:{size:11}}}}});return l.services?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[1,2].map(m=>e.jsx("div",{className:"bg-white rounded-xl border border-border p-6",children:e.jsx("div",{className:"h-[240px] bg-gray-50 rounded animate-pulse"})},m))}):e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-title mb-4",children:"Most Popular Services"}),e.jsx("div",{className:"h-[240px]",children:i.length?e.jsx(g,{data:c,options:b(!0)}):e.jsx("p",{className:"text-sm text-title2",children:"No data"})})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-title mb-4",children:"Revenue per Service"}),e.jsx("div",{className:"h-[240px]",children:a.length?e.jsx(g,{data:n,options:b(!0)}):e.jsx("p",{className:"text-sm text-title2",children:"No data"})})]})]})}function be(){const r=h(o),s=d(p=>p(o).getAnalyticsPeriod(),[]),t=d(p=>p(o).getCustomerAnalytics(),[]),l=d(p=>p(o).getAnalyticsLoading(),[]),i=d(p=>p(o).getKpiSummary(),[]),a=(i==null?void 0:i.currency_symbol)||"$";u.useEffect(()=>{r.loadCustomerAnalytics({date_from:s.date_from,date_to:s.date_to})},[s.date_from,s.date_to]);const c=(t==null?void 0:t.new_vs_returning)||{labels:[],new:[],returning:[]},n=(t==null?void 0:t.top_by_revenue)||[],b=(t==null?void 0:t.retention_rate)??0,m={labels:c.labels||[],datasets:[{label:"New",data:c.new||[],borderColor:"#6366F1",backgroundColor:"rgba(99, 102, 241, 0.08)",fill:!0,tension:.4,pointRadius:2},{label:"Returning",data:c.returning||[],borderColor:"#F59E0B",backgroundColor:"rgba(245, 158, 11, 0.08)",fill:!0,tension:.4,pointRadius:2}]},x={responsive:!0,maintainAspectRatio:!1,plugins:{legend:{position:"top",labels:{usePointStyle:!0,pointStyle:"circle",padding:16,font:{size:11}}}},scales:{x:{grid:{display:!1},ticks:{color:"#9CA3AF",maxTicksLimit:8}},y:{grid:{color:"rgba(156,163,175,0.1)"},ticks:{color:"#9CA3AF",precision:0}}}};return l.customers?e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsx("div",{className:"lg:col-span-2 bg-white rounded-xl border border-border p-6",children:e.jsx("div",{className:"h-[260px] bg-gray-50 rounded animate-pulse"})}),e.jsx("div",{className:"bg-white rounded-xl border border-border p-6",children:e.jsx("div",{className:"h-[260px] bg-gray-50 rounded animate-pulse"})})]}):e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs("div",{className:"lg:col-span-2 bg-white rounded-xl border border-border p-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-title mb-4",children:"New vs Returning Customers"}),e.jsx("div",{className:"h-[260px]",children:e.jsx(j,{data:m,options:x})})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6 flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[e.jsx(K,{className:"w-4 h-4 text-primary"}),e.jsx("h3",{className:"text-sm font-semibold text-title",children:"Retention Rate"})]}),e.jsxs("div",{className:"text-4xl font-bold text-primary mb-1",children:[b,"%"]}),e.jsx("p",{className:"text-xs text-title2 mb-6",children:"customers returned from previous period"}),e.jsx("h4",{className:"text-xs font-medium text-title2 mb-2",children:"Top Customers by Revenue"}),e.jsxs("div",{className:"flex-1 overflow-y-auto space-y-2",children:[n.length===0&&e.jsx("p",{className:"text-xs text-title2",children:"No data"}),n.map((p,S)=>e.jsxs("div",{className:"flex items-center justify-between py-1.5 border-b border-border/50 last:border-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"w-5 h-5 rounded-full bg-primary/10 text-primary text-[10px] font-bold flex items-center justify-center",children:S+1}),e.jsx("span",{className:"text-xs font-medium text-title truncate max-w-[100px]",children:p.customer_name})]}),e.jsxs("span",{className:"text-xs font-semibold text-title",children:[a,Number(p.total_revenue).toLocaleString()]})]},p.customer_id))]})]})]})}L.register(T,P,B,E,$,M,U,O,z,I);const ue=[{id:"revenue",label:"Revenue",icon:f},{id:"appointments",label:"Appointments",icon:N},{id:"staff",label:"Staff",icon:A},{id:"services",label:"Services",icon:R},{id:"customers",label:"Customers",icon:D}];function he(){const[r,s]=u.useState("revenue");return e.jsxs("div",{className:"space-y-5",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx(se,{})}),e.jsx(ae,{}),e.jsxs("div",{className:"bg-white rounded-xl border border-border",children:[e.jsx("div",{className:"flex border-b border-border overflow-x-auto",children:ue.map(t=>{const l=t.icon,i=r===t.id;return e.jsxs("button",{onClick:()=>s(t.id),className:`flex items-center gap-2 px-5 py-3 text-sm font-medium whitespace-nowrap border-b-2 transition-colors ${i?"border-primary text-primary":"border-transparent text-title2 hover:text-title hover:border-gray-200"}`,children:[e.jsx(l,{className:"w-4 h-4"}),t.label]},t.id)})}),e.jsxs("div",{className:"p-5",children:[r==="revenue"&&e.jsxs("div",{className:"space-y-5",children:[e.jsx(ie,{}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:[e.jsx(oe,{}),e.jsx(le,{})]})]}),r==="appointments"&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-5",children:[e.jsx(ne,{}),e.jsx("div",{className:"lg:col-span-2",children:e.jsx(de,{})})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:[e.jsx(ce,{}),e.jsx(me,{})]})]}),r==="staff"&&e.jsx(xe,{}),r==="services"&&e.jsx(pe,{}),r==="customers"&&e.jsx(be,{})]})]})]})}const ge=[{label:"Total Revenue",icon:f,value:"$12,450",color:"text-emerald-600",bg:"bg-emerald-50"},{label:"Appointments",icon:N,value:"248",color:"text-blue-600",bg:"bg-blue-50"},{label:"New Customers",icon:A,value:"36",color:"text-violet-600",bg:"bg-violet-50"},{label:"Avg Revenue",icon:k,value:"$50.20",color:"text-amber-600",bg:"bg-amber-50"},{label:"Cancellation Rate",icon:C,value:"4.8%",color:"text-red-600",bg:"bg-red-50"}],fe=[{id:"revenue",label:"Revenue",icon:f},{id:"appointments",label:"Appointments",icon:N},{id:"staff",label:"Staff",icon:A},{id:"services",label:"Services",icon:R},{id:"customers",label:"Customers",icon:D}];function v({heights:r}){return e.jsx("div",{className:"flex items-end gap-2 h-[200px] pt-6",children:r.map((s,t)=>e.jsx("div",{className:"flex-1 bg-gray-200 rounded-t",style:{height:`${s}%`}},t))})}function ye(){return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-9 h-9 rounded-lg bg-primary/10 flex items-center justify-center",children:e.jsx(H,{className:"w-5 h-5 text-primary"})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-lg font-semibold text-title",children:"Analytics"}),e.jsx("p",{className:"text-xs text-title2",children:"360° view of your business performance"})]})]}),e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:["This Month","Last 30 Days","Last 90 Days","1 Year","All"].map((r,s)=>e.jsx("span",{className:`px-3 py-1.5 text-xs font-medium rounded-md border ${s===0?"bg-primary text-white border-primary":"bg-white text-title border-border"}`,children:r},s))})]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-5 gap-4",children:ge.map(r=>{const s=r.icon;return e.jsxs("div",{className:"bg-white rounded-xl border border-border p-5 flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-medium text-title2",children:r.label}),e.jsx("div",{className:`w-8 h-8 rounded-lg ${r.bg} flex items-center justify-center`,children:e.jsx(s,{className:`w-4 h-4 ${r.color}`})})]}),e.jsx("div",{className:"text-2xl font-bold text-title",children:r.value}),e.jsxs("div",{className:"flex items-center gap-1 text-xs font-medium text-emerald-600",children:["+12.5% ",e.jsx("span",{className:"text-title2 font-normal ml-1",children:"vs prev period"})]})]},r.label)})}),e.jsxs("div",{className:"bg-white rounded-xl border border-border",children:[e.jsx("div",{className:"flex border-b border-border overflow-x-auto",children:fe.map((r,s)=>{const t=r.icon;return e.jsxs("span",{className:`flex items-center gap-2 px-5 py-3 text-sm font-medium whitespace-nowrap border-b-2 ${s===0?"border-primary text-primary":"border-transparent text-title2"}`,children:[e.jsx(t,{className:"w-4 h-4"}),r.label]},r.id)})}),e.jsxs("div",{className:"p-5 space-y-5",children:[e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-title mb-4",children:"Revenue Trend"}),e.jsx(v,{heights:[30,45,55,40,65,70,50,80,60,75,55,90]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-5",children:[e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-title mb-4",children:"Revenue by Service"}),e.jsx(v,{heights:[90,70,55,40,25]})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-border p-6",children:[e.jsx("h3",{className:"text-sm font-semibold text-title mb-4",children:"Revenue by Staff"}),e.jsx(v,{heights:[85,65,50,35]})]})]})]})]})]})}function Ke(){var s;return!((s=window.radius_booking_param)!=null&&s.is_pro)?e.jsxs("div",{children:[e.jsx(V,{title:"Analytics",type:"setting"}),e.jsx("div",{className:"pointer-events-none select-none opacity-50 mt-4",children:e.jsx(ye,{})})]}):e.jsx(he,{})}export{Ke as default};
//# sourceMappingURL=Analytics-DDz6czTq.js.map
