(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{239:function(e,t,a){Promise.resolve().then(a.bind(a,7340))},7340:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return c}});var n=a(7437),r=a(2265),i=a(9376);function c(){let e=(0,i.useRouter)(),[t,a]=(0,r.useState)(!1);return((0,r.useEffect)(()=>{let t=!1;{let e=window.Capacitor;if(e)try{let a=e.getPlatform();if("android"===a){var n;let a=null===(n=e.Plugins)||void 0===n?void 0:n.App;a&&a.getInfo().then(e=>{(e.id||e.appId||"").includes("admin")&&(t=!0)}).catch(()=>{}),null!==localStorage.getItem("adminPassword")&&(t=!0)}else null!==localStorage.getItem("adminPassword")&&(t=!0)}catch(e){console.warn("Erreur lors de la d\xe9tection Capacitor:",e)}!t&&(window.location.pathname.startsWith("/admin")||window.location.search.includes("admin=true"))&&(t=!0)}if(t){let t=localStorage.getItem("adminPassword");t?fetch("/api/admin/clients",{headers:{Authorization:"Bearer ".concat(t)}}).then(t=>{t.ok?e.replace("/admin"):404===t.status?e.replace("/admin"):(localStorage.removeItem("adminPassword"),e.replace("/admin/login"))}).catch(()=>{e.replace("/admin")}):e.replace("/admin/login")}else e.replace("/accueil");a(!0)},[e]),t)?null:(0,n.jsx)("div",{className:"flex items-center justify-center min-h-screen bg-background dark:bg-background-dark",children:(0,n.jsx)("div",{className:"text-center",children:(0,n.jsx)("p",{className:"text-gray-600 dark:text-gray-400",children:"Chargement..."})})})}},9376:function(e,t,a){"use strict";var n=a(5475);a.o(n,"usePathname")&&a.d(t,{usePathname:function(){return n.usePathname}}),a.o(n,"useRouter")&&a.d(t,{useRouter:function(){return n.useRouter}})}},function(e){e.O(0,[971,117,744],function(){return e(e.s=239)}),_N_E=e.O()}]);