import{s as ie,a as C,e as K,b as Z,u as ee,g as te,d as re,c as Ae,o as Je,n as ye,r as Ke}from"../chunks/DHedsUi_.js";import{S as fe,i as ce,k as I,l as v,m as p,n as A,o as q,p as B,d as k,q as X,a as le,w as Be,u as w,c as x,v as Fe,h as N,x as Le,s as Ve,b as m,r as Se,e as T,g as M,f as G,j as U,t as J,G as se,y as Y}from"../chunks/G8UKEBBn.js";import{I as xe,g as Ne,a as Ee,e as oe}from"../chunks/C1tDbyYL.js";import{p as Re}from"../chunks/CEKnDucw.js";import{g as ke}from"../chunks/6cgBTYw-.js";import{a as je,c as we,b as We}from"../chunks/DjUyxgK6.js";import{B as ze}from"../chunks/D3KWQg4I.js";import{C as Xe}from"../chunks/DIz1JgvC.js";import{T as Ye}from"../chunks/C7zepb3B.js";import{C as Ze}from"../chunks/B9ru2HtO.js";import{F as et}from"../chunks/CNY58Upt.js";import{D as tt}from"../chunks/BojKV9te.js";import{U as rt}from"../chunks/Betcpvy2.js";import{U as lt}from"../chunks/BYJWe3D5.js";import{U as nt}from"../chunks/CImgxE6m.js";const at=!1,ot=!1,Ht=Object.freeze(Object.defineProperty({__proto__:null,prerender:at,ssr:ot},Symbol.toStringTag,{value:"Module"}));function st(a){let e;const t=a[2].default,r=Z(t,a,a[3],null);return{c(){r&&r.c()},l(l){r&&r.l(l)},m(l,n){r&&r.m(l,n),e=!0},p(l,n){r&&r.p&&(!e||n&8)&&ee(r,t,l,l[3],e?re(t,l[3],n,null):te(l[3]),null)},i(l){e||(p(r,l),e=!0)},o(l){v(r,l),e=!1},d(l){r&&r.d(l)}}}function it(a){let e,t;const r=[{name:"layout-dashboard"},a[1],{iconNode:a[0]}];let l={$$slots:{default:[st]},$$scope:{ctx:a}};for(let n=0;n{t(1,e=C(C({},e),K(o))),"$$scope"in o&&t(3,l=o.$$scope)},e=K(e),[n,e,r,l]}class ct extends fe{constructor(e){super(),ce(this,e,ft,it,ie,{})}}function ut(a){let e;const t=a[2].default,r=Z(t,a,a[3],null);return{c(){r&&r.c()},l(l){r&&r.l(l)},m(l,n){r&&r.m(l,n),e=!0},p(l,n){r&&r.p&&(!e||n&8)&&ee(r,t,l,l[3],e?re(t,l[3],n,null):te(l[3]),null)},i(l){e||(p(r,l),e=!0)},o(l){v(r,l),e=!1},d(l){r&&r.d(l)}}}function dt(a){let e,t;const r=[{name:"log-out"},a[1],{iconNode:a[0]}];let l={$$slots:{default:[ut]},$$scope:{ctx:a}};for(let n=0;n{t(1,e=C(C({},e),K(o))),"$$scope"in o&&t(3,l=o.$$scope)},e=K(e),[n,e,r,l]}class mt extends fe{constructor(e){super(),ce(this,e,ht,dt,ie,{})}}function gt(a){let e;const t=a[2].default,r=Z(t,a,a[3],null);return{c(){r&&r.c()},l(l){r&&r.l(l)},m(l,n){r&&r.m(l,n),e=!0},p(l,n){r&&r.p&&(!e||n&8)&&ee(r,t,l,l[3],e?re(t,l[3],n,null):te(l[3]),null)},i(l){e||(p(r,l),e=!0)},o(l){v(r,l),e=!1},d(l){r&&r.d(l)}}}function _t(a){let e,t;const r=[{name:"power-off"},a[1],{iconNode:a[0]}];let l={$$slots:{default:[gt]},$$scope:{ctx:a}};for(let n=0;n{t(1,e=C(C({},e),K(o))),"$$scope"in o&&t(3,l=o.$$scope)},e=K(e),[n,e,r,l]}class bt extends fe{constructor(e){super(),ce(this,e,pt,_t,ie,{})}}function He(a,e,t){const r=a.slice();return r[9]=e[t],r}function Oe(a,e,t){const r=a.slice();return r[9]=e[t],r}function $t(a){let e;const t=a[8].default,r=Z(t,a,a[7],null);return{c(){r&&r.c()},l(l){r&&r.l(l)},m(l,n){r&&r.m(l,n),e=!0},p(l,n){r&&r.p&&(!e||n&128)&&ee(r,t,l,l[7],e?re(t,l[7],n,null):te(l[7]),null)},i(l){e||(p(r,l),e=!0)},o(l){v(r,l),e=!1},d(l){r&&r.d(l)}}}function vt(a){var De,Me;let e,t,r,l='🏠 Mes Locations',n,o,u,i,h,c,b,$=(((Me=(De=a[1].name)==null?void 0:De[0])==null?void 0:Me.toUpperCase())??"?")+"",ne,ue,F,R=a[1].name+"",ae,de,L,j,he,me,V,z,ge,_e,Q,S,pe,Te,H=oe(a[2]),g=[];for(let s=0;sv(g[s],1,1,()=>{g[s]=null});let O=oe(a[3]),_=[];for(let s=0;sv(_[s],1,1,()=>{_[s]=null});j=new mt({props:{size:17}}),z=new bt({props:{size:17}});const be=a[8].default,E=Z(be,a,a[7],null);return{c(){e=N("div"),t=N("aside"),r=N("div"),r.innerHTML=l,n=U(),o=N("nav");for(let s=0;s{I($,1)}),X()}i?(t=se(i,h()),B(t.$$.fragment),p(t.$$.fragment,1),A(t,e,r)):t=null}},i(c){u||(t&&p(t.$$.fragment,c),u=!0)},o(c){t&&v(t.$$.fragment,c),u=!1},d(c){c&&k(e),t&&I(t)}}}function qe(a){let e,t,r,l=a[9].label+"",n,o;var u=a[9].icon;function i(h,c){return{props:{size:17}}}return u&&(t=se(u,i())),{c(){e=N("a"),t&&B(t.$$.fragment),r=U(),n=J(l),this.h()},l(h){e=x(h,"A",{href:!0,class:!0});var c=T(e);t&&q(t.$$.fragment,c),r=M(c),n=G(c,l),c.forEach(k),this.h()},h(){w(e,"href",a[9].href),w(e,"class","flex items-center gap-3 px-3 py-2 rounded-lg text-sm transition-colors "+(a[5](a[9].href)?"bg-blue-50 dark:bg-blue-950 text-blue-700 dark:text-blue-300 font-medium":"text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 hover:text-gray-900 dark:hover:text-gray-200"))},m(h,c){le(h,e,c),t&&A(t,e,null),m(e,r),m(e,n),o=!0},p(h,c){if(u!==(u=h[9].icon)){if(t){Y();const b=t;v(b.$$.fragment,1,0,()=>{I(b,1)}),X()}u?(t=se(u,i()),B(t.$$.fragment),p(t.$$.fragment,1),A(t,e,r)):t=null}},i(h){o||(t&&p(t.$$.fragment,h),o=!0)},o(h){t&&v(t.$$.fragment,h),o=!1},d(h){h&&k(e),t&&I(t)}}}function kt(a){let e,t,r,l;const n=[yt,vt,$t],o=[];function u(i,h){return i[0]?i[1]?1:2:0}return e=u(a),t=o[e]=n[e](a),{c(){t.c(),r=Be()},l(i){t.l(i),r=Be()},m(i,h){o[e].m(i,h),le(i,r,h),l=!0},p(i,[h]){let c=e;e=u(i),e===c?o[e].p(i,h):(Y(),v(o[c],1,1,()=>{o[c]=null}),X(),t=o[e],t?t.p(i,h):(t=o[e]=n[e](i),t.c()),p(t,1),t.m(r.parentNode,r))},i(i){l||(p(t),l=!0)},o(i){v(t),l=!1},d(i){i&&k(r),o[e].d(i)}}}async function wt(){if(confirm("ArrĂȘter l'application ?"))try{await fetch("/api/shutdown",{method:"POST",credentials:"include"})}catch{}}function xt(a,e,t){let r,l;Ae(a,Re,$=>t(6,r=$)),Ae(a,we,$=>t(1,l=$));let{$$slots:n={},$$scope:o}=e,u=!1;const i=[{href:"/",label:"Dashboard",icon:ct},{href:"/properties",label:"Biens",icon:ze},{href:"/transactions",label:"Transactions",icon:Xe},{href:"/categories",label:"CatĂ©gories",icon:Ye},{href:"/calendar",label:"Calendrier",icon:Ze},{href:"/documents",label:"Documents",icon:et},{href:"/fiscal",label:"Export fiscal",icon:tt},{href:"/loans",label:"PrĂȘts",icon:ze},{href:"/import",label:"Import bancaire",icon:rt}],h=[{href:"/users",label:"Utilisateurs",icon:lt},{href:"/profile",label:"Mon profil",icon:nt}];Je(async()=>{if(r.url.pathname==="/login"){t(0,u=!0);return}if(!l)try{const $=await je.auth.me();if($)we.set($);else{ke("/login");return}}catch{ke("/login");return}t(0,u=!0)});async function c(){await je.auth.logout(),we.set(null),We.set(null),ke("/login")}function b($){return r.url.pathname===$}return a.$$set=$=>{"$$scope"in $&&t(7,o=$.$$scope)},a.$$.update=()=>{a.$$.dirty&64&&r.url.pathname==="/login"&&t(0,u=!0)},[u,l,i,h,c,b,r,o,n]}class Ot extends fe{constructor(e){super(),ce(this,e,xt,kt,ie,{})}}export{Ot as component,Ht as universal};