import{b as m,r as l,c as h,d as p,e as r,u as x,a as f,j as e,L as g,f as y,B as d,O as k,g as j}from"./index-B8oXSmui.js";import{F as v}from"./file-text-BNJ-nnkB.js";import{U as i}from"./users-szxpqLMm.js";function b(t){const o=m({warn:t?.router===void 0}),c=t?.router||o,n=l.useRef(void 0);return h(c.stores.__store,a=>{if(t?.select){if(t.structuralSharing??c.options.defaultStructuralSharing){const s=p(n.current,t.select(a));return n.current=s,s}return t.select(a)}return a})}const N=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],M=r("history",N);const w=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],_=r("log-out",w);const S=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],L=r("moon",S);const O=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],R=r("settings",O);const T=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],z=r("sun",T),C=[{to:"/app",label:"Communications",icon:v,exact:!0},{to:"/app/recipients",label:"Destinataires",icon:i},{to:"/app/admin/users",label:"Utilisateurs",icon:i},{to:"/app/admin/email",label:"Config. email",icon:R},{to:"/app/history",label:"Historique",icon:M}];function H(){const{user:t,loading:o,signOut:c}=x(),n=f(),a=b({select:s=>s.location.pathname});return l.useEffect(()=>{!o&&!t&&n({to:"/auth"})},[t,o,n]),o||!t?e.jsx("div",{className:"flex min-h-screen items-center justify-center text-muted-foreground",children:"Chargement…"}):e.jsxs("div",{className:"flex min-h-screen bg-background",children:[e.jsxs("aside",{className:"hidden w-64 shrink-0 border-r bg-sidebar md:flex md:flex-col",children:[e.jsxs("div",{className:"flex items-center gap-2 px-6 py-5 font-semibold",children:[e.jsx("img",{src:"/logo.png",alt:"MY STUDIO",className:"h-7 w-7",width:28,height:28}),"MY STUDIO"]}),e.jsx("nav",{className:"flex-1 space-y-1 px-3",children:C.map(s=>{const u="exact"in s&&s.exact?a==="/app"||a==="/app/"||a.startsWith("/app/edit"):a===s.to||a.startsWith(s.to+"/");return e.jsxs(g,{to:s.to,className:y("flex items-center gap-3 rounded-lg px-3 py-2 text-sm transition-colors",u?"bg-sidebar-accent text-sidebar-accent-foreground font-medium":"text-sidebar-foreground/70 hover:bg-sidebar-accent/50"),children:[e.jsx(s.icon,{className:"h-4 w-4"}),s.label]},s.to)})}),e.jsxs("div",{className:"space-y-2 border-t p-4",children:[e.jsx("div",{className:"truncate text-xs text-muted-foreground",children:t.email}),e.jsx(D,{}),e.jsxs(d,{variant:"outline",size:"sm",className:"w-full",onClick:()=>c().then(()=>n({to:"/"})),children:[e.jsx(_,{className:"h-4 w-4"})," Déconnexion"]})]})]}),e.jsx("main",{className:"flex-1 overflow-x-hidden",children:e.jsx(k,{})})]})}function D(){const{theme:t,toggle:o}=j();return e.jsxs(d,{variant:"outline",size:"sm",className:"w-full",onClick:o,children:[t==="dark"?e.jsx(z,{className:"h-4 w-4"}):e.jsx(L,{className:"h-4 w-4"}),t==="dark"?"Mode clair":"Mode sombre"]})}export{H as component};
