1import{e as o,aG as M,a6 as _,aH as V,r,y as N,j as e,aI as k,aJ as G,k as b,aK as H,L as K,aL as P,aM as T,a0 as $,a8 as C,V as q,aN as z,U as D}from"./index-CzMEFmtw.js";import{E as U}from"./external-link-DRUqUc_B.js";import{L as A,a as W}from"./log-out-DqPt0kKm.js";import{C as R}from"./chart-column-CkOdDsNL.js";import{I as J}from"./image-DUijihr1.js";import{V as Q}from"./video-CKMpWI1a.js";import{I as X}from"./inbox-DX1wze4V.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const Y=o("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);/** 7 * @license lucide-react v0.462.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const Z=o("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);/** 12 * @license lucide-react v0.462.0 - ISC 13 * 14 * This source code is licensed under the ISC license. 15 * See the LICENSE file in the root directory of this source tree. 16 */const ee=o("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/** 17 * @license lucide-react v0.462.0 - ISC 18 * 19 * This source code is licensed under the ISC license. 20 * See the LICENSE file in the root directory of this source tree. 21 */const te=o("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** 22 * @license lucide-react v0.462.0 - ISC 23 * 24 * This source code is licensed under the ISC license. 25 * See the LICENSE file in the root directory of this source tree. 26 */const se=o("ToggleLeft",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"8",cy:"12",r:"2",key:"1nvbw3"}]]);/** 27 * @license lucide-react v0.462.0 - ISC 28 * 29 * This source code is licensed under the ISC license. 30 * See the LICENSE file in the root directory of this source tree. 31 */const ae=o("UserCheck",[["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"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]),re=[{to:"/admin",label:"Dashboard",icon:W,end:!0,group:"Overview"},{to:"/admin/analytics",label:"Analytics",icon:R,group:"Overview"},{to:"/admin/content",label:"Content",icon:C,group:"Content"},{to:"/admin/blog",label:"Blog",icon:C,group:"Content"},{to:"/admin/media",label:"Media library",icon:J,group:"Content"},{to:"/admin/sections",label:"Sections (show/hide)",icon:se,group:"Content"},{to:"/admin/webinars",label:"Webinars",icon:Q,group:"Programs"},{to:"/admin/careers",label:"Careers",icon:q,group:"Programs"},{to:"/admin/applications",label:"Applications",icon:ae,group:"Programs",badge:"apps"},{to:"/admin/career-hub",label:"Career Hub",icon:z,group:"Programs"},{to:"/admin/forms",label:"Form inbox",icon:X,group:"Growth",badge:"inbox"},{to:"/admin/seo",label:"SEO",icon:b,adminOnly:!0,group:"Growth"},{to:"/admin/users",label:"Team & roles",icon:D,adminOnly:!0,group:"System"},{to:"/admin/settings",label:"Settings",icon:te,adminOnly:!0,group:"System"}],le={"/admin":"Dashboard","/admin/analytics":"Analytics","/admin/content":"Content","/admin/sections":"Sections","/admin/blog":"Blog","/admin/media":"Media library","/admin/webinars":"Webinars","/admin/careers":"Careers","/admin/applications":"Applications","/admin/career-hub":"Career Hub","/admin/forms":"Form inbox","/admin/seo":"SEO","/admin/users":"Team & roles","/admin/settings":"Settings"};function pe(){const{user:d,isStaff:m,isAdmin:c,loading:S,signOut:g}=M(),p=_(),w=V(),[a,F]=r.useState(()=>{const t=localStorage.getItem("hs-admin-collapsed");return t!==null?t==="1":typeof window<"u"&&window.innerWidth<1280}),[l,L]=r.useState({inbox:0,apps:0}),[B,n]=r.useState(!1),[h,j]=r.useState("");r.useEffect(()=>{localStorage.setItem("hs-admin-collapsed",a?"1":"0")},[a]),r.useEffect(()=>{m&&(async()=>{const[t,s]=await Promise.all([N.from("form_submissions").select("id",{count:"exact",head:!0}).eq("status","new"),N.from("job_applications").select("id",{count:"exact",head:!0}).eq("status","new")]);L({inbox:t.count??0,apps:s.count??0})})()},[m,w.pathname]),r.useEffect(()=>{const t=s=>{(s.metaKey||s.ctrlKey)&&s.key.toLowerCase()==="k"&&(s.preventDefault(),n(u=>!u)),s.key==="Escape"&&n(!1)};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[]);const i=r.useMemo(()=>re.filter(t=>t.adminOnly?c:!0),[c]),E=r.useMemo(()=>Array.from(new Set(i.map(t=>t.group))),[i]),v=r.useMemo(()=>{const t=h.trim().toLowerCase();return t?i.filter(s=>s.label.toLowerCase().includes(t)):i},[i,h]);if(S)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-slate-50 via-white to-sky-50",children:e.jsx("div",{className:"w-10 h-10 border-[3px] border-[#F9A01B] border-t-transparent roun
31ded-full animate-spin"})});if(!d)return e.jsx(k,{to:"/admin/login",replace:!0});if(!m)return e.jsx(k,{to:"/admin/login",replace:!0});const y=(d.email??"?").slice(0,2).toUpperCase(),O=le[w.pathname]||"Admin",I=a?"w-[76px]":"w-[260px]";return e.jsxs("div",{className:"min-h-screen flex admin-shell relative",style:{fontFamily:"'DM Sans', ui-sans-serif, system-ui",background:"radial-gradient(1200px 600px at -10% -10%, rgba(44,197,244,0.10), transparent 60%), radial-gradient(900px 500px at 110% -20%, rgba(249,160,27,0.10), transparent 55%), #f6f8fb"},children:[e.jsx("aside",{className:`${I} shrink-0 flex flex-col sticky top-0 h-screen transition-all duration-300 z-40`,children:e.jsxs("div",{className:"m-3 mr-0 flex-1 flex flex-col rounded-2xl bg-white/80 backdrop-blur-xl border border-white shadow-[0_10px_40px_-15px_rgba(15,23,42,0.15)] overflow-hidden",children:[e.jsxs("div",{className:`px-4 py-4 flex items-center gap-3 border-b border-slate-100 ${a?"justify-center":""}`,children:[e.jsx("div",{className:"relative w-10 h-10 rounded-xl bg-white border border-slate-200 flex items-center justify-center overflow-hidden shadow-sm",children:e.jsx("img",{src:G,alt:"Healthserve logo",className:"w-full h-full object-contain p-1"})}),!a&&e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[10px] font-bold uppercase tracking-[0.2em] bg-gradient-to-r from-[#F9A01B] to-[#e07f00] bg-clip-text text-transparent",style:{fontFamily:"'Space Grotesk', ui-sans-serif"},children:"Healthserve"}),e.jsx("div",{className:"text-sm font-bold text-slate-900 truncate",style:{fontFamily:"'Space Grotesk', ui-sans-serif"},children:"Admin console"})]})]}),!a&&e.jsx("div",{className:"px-3 pt-3",children:e.jsxs("button",{onClick:()=>n(!0),className:"w-full flex items-center gap-2 h-9 px-3 rounded-xl bg-slate-50 hover:bg-white border border-slate-200/70 hover:border-slate-300 text-xs text-slate-500 transition",children:[e.jsx(b,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"flex-1 text-left",children:"Quick jumpâ¦"}),e.jsx("kbd",{className:"text-[9px] font-mono px-1.5 py-0.5 rounded bg-white border border-slate-200 text-slate-500",children:"âK"})]})}),e.jsx("nav",{className:"flex-1 p-2 mt-1 space-y-3 overflow-y-auto",children:E.map(t=>e.jsxs("div",{children:[!a&&e.jsx("div",{className:"px-3 pt-2 pb-1 text-[9px] font-bold uppercase tracking-[0.18em] text-slate-400",style:{fontFamily:"'Space Grotesk', ui-sans-serif"},children:t}),e.jsx("div",{className:"space-y-0.5",children:i.filter(s=>s.group===t).map(s=>{const u=s.icon,f=s.badge==="inbox"?l.inbox:s.badge==="apps"?l.apps:0;return e.jsx(H,{to:s.to,end:s.end,title:a?s.label:void 0,className:({isActive:x})=>`group relative flex items-center gap-3 px-3 h-10 rounded-xl text-sm transition-all ${x?"bg-gradient-to-r from-[#F9A01B]/12 via-[#F9A01B]/6 to-transparent text-slate-900 font-semibold":"text-slate-600 hover:bg-slate-100/70 hover:text-slate-900"} ${a?"justify-center":""}`,children:({isActive:x})=>e.jsxs(e.Fragment,{children:[x&&e.jsx("span",{className:"absolute left-0 top-2 bottom-2 w-[3px] rounded-r-full bg-gradient-to-b from-[#F9A01B] to-[#e07f00] shadow-[0_0_10px_rgba(249,160,27,0.6)]"}),e.jsx("span",{className:`w-7 h-7 rounded-lg flex items-center justify-center transition ${x?"bg-white shadow-sm text-[#F9A01B]":"text-slate-500 group-hover:text-slate-800"}`,children:e.jsx(u,{className:"w-[16px] h-[16px]"})}),!a&&e.jsx("span",{className:"truncate flex-1",children:s.label}),!a&&f>0&&e.jsx("span",{className:"text-[10px] font-bold px-1.5 min-w-[20px] h-5 flex items-center justify-center rounded-full bg-gradient-to-br from-[#F9A01B] to-[#e07f00] text-white shadow-sm",children:f}),a&&f>0&&e.jsx("span",{className:"absolute top-1.5 right-1.5 w-2 h-2 rounded-full bg-[#F9A01B] ring-2 ring-white"})]})},s.to)})})]},t))}),e.jsxs("div",{className:"p-2 border-t border-slate-100 space-y-1",children:[e.jsxs("button",{onClick:()=>F(t=>!t),className:`w-full flex items-center gap-3 px-3 h-9 rounded-lg text-xs text-slate-500 hover:bg-slate-100 hover:text-slate-800 ${a?"justify-center":""}`,title:a?"Expand":"Collapse",children:[a?e.jsx(Z,{className:"w-4 h-4"}):e.jsx(Y,{className:"w-4 h-4"}),!a&&e.jsx("span",{children:"Collapse"})]}),e.jsxs("a",{href:"/",target:"_blank",rel:"noreferrer",className:`flex items-center gap-3 px-3 h-9 rounded-lg text-xs text-slate-500 hover:bg-slate-100 hover:text-slate-800 ${a?"justify-center":""}`,title:"View live site",children:[e.jsx(U,{className:"w-4 h-4"}),!a&&e.jsx("span",{children:"View live site"})]}),a?e.jsx("button",{onClick:async()=>{await g(),p("/admin/login")},className:"w-full flex items-center justify-center h-9 rounded-lg text-slate-500 hover:bg-red-50 hover:text-red-600",title:"Sign out",children:e.jsx(A,{className:"w-4 h-4"})}):e.jsxs("div",{className:"mt-2 p-2.5 rounded-xl bg-gradient-to-br from-slate-50 to-white border border-slate-200/70 flex items-center gap-2.5",children:[e.jsx("div",{className:"w-9 h-9 rounded-full bg-gradient-to-br from-[#F9A01B] to-[#e07f00] text-white text-xs font-bold flex items-center justify-center shadow-md ring-2 ring-white",children:y}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-xs font-semibold text-slate-900 truncate",children:d.email}),e.jsx("div",{className:"text-[9px] uppercase tracking-widest text-[#F9A01B] font-bold",children:c?"Administrator":"Editor"})]}),e.jsx("button",{onClick:async()=>{await g(),p("/admin/login")},className:"w-8 h-8 rounded-lg text-slate-400 hover:text-white hover:bg-red-500 flex items-center justify-center transition",title:"Sign out",children:e.jsx(A,{className:"w-4 h-4"})})]})]})]})}),e.jsxs("main",{className:"flex-1 min-w-0 flex flex-col",children:[e.jsxs("header",{className:"sticky top-0 z-30 h-16 flex items-center gap-3 px-6 border-b border-slate-200/60 bg-white/70 backdrop-blur-xl",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"text-slate-400",children:"Admin"}),e.jsx("span",{className:"text-slate-300",children:"/"}),e.jsx("span",{className:"font-semibold text-slate-900",style:{fontFamily:"'Space Grotesk', ui-sans-serif"},children:O})]}),e.jsx("div",{className:"flex-1"}),e.jsxs("button",{onClick:()=>n(!0),className:"hidden md:flex items-center gap-2 h-9 px-3 rounded-xl border border-slate-200 bg-white/80 text-sm text-slate-500 hover:bg-white hover:border-[#F9A01B]/40 transition min-w-[260px] shadow-sm",children:[e.jsx(b,{className:"w-4 h-4"}),e.jsx("span",{className:"flex-1 text-left",children:"Jump to page, sectionâ¦"}),e.jsx("kbd",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-slate-50 border border-slate-200 text-slate-500",children:"âK"})]}),e.jsxs(K,{to:"/admin/forms",className:"relative w-9 h-9 rounded-xl border border-slate-200 bg-white hover:bg-slate-50 flex items-center justify-center text-slate-600 shadow-sm",title:"Inbox",children:[e.jsx(P,{className:"w-4 h-4"}),l.inbox+l.apps>0&&e.jsx("span",{className:"absolute -top-1 -right-1 min-w-[18px] h-[18px] px-1 rounded-full bg-gradient-to-br from-[#F9A01B] to-[#e07f00] text-white text-[10px] font-bold flex items-center justify-center ring-2 ring-white",children:l.inbox+l.apps})]}),e.jsx("div",{className:"h-8 w-px bg-slate-200"}),e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-9 h-9 rounded-full bg-gradient-to-br from-[#2CC5F4] to-[#0ea5e9] text-white text-xs font-bold flex items-center justify-center shadow-md ring-2 ring-white",children:y}),e.jsxs("div",{className:"hidden sm:block leading-tight",children:[e.jsx("div",{className:"text-xs font-semibold text-slate-900 truncate max-w-[160px]",children:d.email}),e.jsx("div",{className:"text-[10px] uppercase tracking-widest text-[#F9A01B] font-bold",children:c?"Administrator":"Editor"})]})]})]}),e.jsx("div",{className:"flex-1 min-w-0 overflow-x-hidden",children:e.jsx(T,{})})]}),B&&e.jsx("div",{className:"fixed inset-0 z-[200] bg-slate-900/40 backdrop-blur-sm flex items-start justify-center pt-24 px-4",onClick:()=>n(!1),children:e.jsxs("div",{className:"w-full max-w-xl bg-white rounded-2xl shadow-2xl border border-slate-200 overflow-hidden animate-scale-in",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center gap-3 px-4 h-12 border-b border-slate-100",children:[e.jsx(ee,{className:"w-4 h-4 text-[#F9A01B]"}),e.jsx("input",{autoFocus:!0,value:h,onChange:t=>j(t.target.value),placeholder:"Search pages, sectionsâ¦",className:"flex-1 bg-transparent outline-none text-sm text-slate-900 placeholder:text-slate-400"}),e.jsx("kbd",{className:"text-[10px] font-mono px-1.5 py-0.5 rounded bg-slate-100 text-slate-500",children:"esc"})]}),e.jsxs("div",{className:"max-h-80 overflow-y-auto py-2",children:[v.length===0&&e.jsx("div",{className:"px-4 py-6 text-center text-sm text-slate-500",children:"No matches"}),v.map(t=>{const s=t.icon;return e.jsxs("button",{onClick:()=>{n(!1),j(""),p(t.to)},className:"w-full flex items-center gap-3 px-4 h-11 text-sm text-slate-700 hover:bg-slate-50",children:[e.jsx(s,{className:"w-4 h-4 text-slate-400"}),e.jsx("span",{className:"flex-1 text-left",children:t.label}),e.jsx("span",{className:"text-[11px] text-slate-400",children:t.group})]},t.to)})]}),e.jsxs("div",{className:"px-4 py-2 border-t border-slate-100 flex items-center gap-2 text-[11px] text-slate-400",children:[e.jsx($,{className:"w-3 h-3 text-[#F9A01B]"}),"Tip: press âK anywhere to open this menu"]}
31)]})})]})}export{pe 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.