6 lines
47 KiB
JavaScript
6 lines
47 KiB
JavaScript
exports.id=5500,exports.ids=[5500],exports.modules={2451:(e,t,s)=>{Promise.resolve().then(s.bind(s,81996)),Promise.resolve().then(s.bind(s,85969))},15616:(e,t,s)=>{"use strict";s.d(t,{T:()=>i});var a=s(60687),r=s(43210),n=s(96241);let i=r.forwardRef(({className:e,...t},s)=>(0,a.jsx)("textarea",{className:(0,n.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:s,...t}));i.displayName="Textarea"},24934:(e,t,s)=>{"use strict";s.d(t,{$:()=>c,r:()=>l});var a=s(60687),r=s(43210),n=s(8730),i=s(24224),o=s(96241);let l=(0,i.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),c=r.forwardRef(({className:e,variant:t,size:s,asChild:r=!1,...i},c)=>{let d=r?n.DX:"button";return(0,a.jsx)(d,{className:(0,o.cn)(l({variant:t,size:s,className:e})),ref:c,...i})});c.displayName="Button"},26690:(e,t,s)=>{"use strict";s.d(t,{N:()=>o});var a=s(1926),r=s(10591);function n(e){let t=process.env[e];if(!t)throw Error(`Missing required environment variable: ${e}`);return t}async function i(e){try{let t=await fetch(`${process.env.KEYCLOAK_ISSUER}/protocol/openid-connect/token`,{headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:process.env.KEYCLOAK_CLIENT_ID,client_secret:process.env.KEYCLOAK_CLIENT_SECRET,grant_type:"refresh_token",refresh_token:e.refreshToken||""}),method:"POST"}),s=await t.json();if(!t.ok)throw s;return{...e,accessToken:s.access_token,refreshToken:s.refresh_token??e.refreshToken,accessTokenExpires:Date.now()+1e3*s.expires_in}}catch(t){return console.error("Error refreshing access token:",t),{...e,error:"RefreshAccessTokenError"}}}let o={providers:[(0,a.A)({clientId:n("KEYCLOAK_CLIENT_ID"),clientSecret:n("KEYCLOAK_CLIENT_SECRET"),issuer:n("KEYCLOAK_ISSUER"),authorization:{params:{scope:"openid profile email roles"}},profile(e){console.log("Keycloak profile callback:",{rawProfile:e,rawRoles:e.roles,realmAccess:e.realm_access,groups:e.groups});let t=e.realm_access?.roles||[];console.log("Profile callback raw roles:",t);let s=t.map(e=>e.replace(/^ROLE_/,"").toLowerCase());return console.log("Profile callback cleaned roles:",s),{id:e.sub,name:e.name??e.preferred_username,email:e.email,first_name:e.given_name??"",last_name:e.family_name??"",username:e.preferred_username??e.email?.split("@")[0]??"",role:s}}})],session:{strategy:"jwt",maxAge:2592e3},callbacks:{async jwt({token:e,account:t,profile:s}){if(t&&s){let a=(s.realm_access?.roles||[]).map(e=>e.replace(/^ROLE_/,"").toLowerCase());e.accessToken=t.access_token??"",e.refreshToken=t.refresh_token??"",e.accessTokenExpires=t.expires_at??0,e.sub=s.sub,e.role=a,e.username=s.preferred_username??"",e.first_name=s.given_name??"",e.last_name=s.family_name??""}else if(e.accessToken)try{let t=(0,r.s)(e.accessToken);t.realm_access?.roles&&(e.role=t.realm_access.roles.map(e=>e.replace(/^ROLE_/,"").toLowerCase()))}catch(e){console.error("Error decoding token:",e)}return Date.now()<1e3*e.accessTokenExpires?e:i(e)},async session({session:e,token:t}){if(t.error)throw Error(t.error);let s=Array.isArray(t.role)?t.role:[];return e.user={id:t.sub??"",email:t.email??null,name:t.name??null,image:null,username:t.username??"",first_name:t.first_name??"",last_name:t.last_name??"",role:s,nextcloudInitialized:!1},e.accessToken=t.accessToken,e}},pages:{signIn:"/signin",error:"/signin"},debug:!1}},37826:(e,t,s)=>{"use strict";s.d(t,{Cf:()=>m,Es:()=>p,L3:()=>f,ZJ:()=>d,c7:()=>h,lG:()=>l,rr:()=>x,zM:()=>c});var a=s(60687),r=s(43210),n=s(10991),i=s(11860),o=s(96241);let l=n.bL,c=n.l9,d=n.ZL;n.bm;let u=r.forwardRef(({className:e,...t},s)=>(0,a.jsx)(n.hJ,{ref:s,className:(0,o.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));u.displayName=n.hJ.displayName;let m=r.forwardRef(({className:e,children:t,...s},r)=>(0,a.jsxs)(d,{children:[(0,a.jsx)(u,{}),(0,a.jsxs)(n.UC,{ref:r,className:(0,o.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-white p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...s,children:[t,(0,a.jsxs)(n.bm,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,a.jsx)(i.A,{className:"h-4 w-4"}),(0,a.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));m.displayName=n.UC.displayName;let h=({className:e,...t})=>(0,a.jsx)("div",{className:(0,o.cn)("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});h.displayName="DialogHeader";let p=({className:e,...t})=>(0,a.jsx)("div",{className:(0,o.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});p.displayName="DialogFooter";let f=r.forwardRef(({className:e,...t},s)=>(0,a.jsx)(n.hE,{ref:s,className:(0,o.cn)("text-lg font-semibold leading-none tracking-tight",e),...t}));f.displayName=n.hE.displayName;let x=r.forwardRef(({className:e,...t},s)=>(0,a.jsx)(n.VY,{ref:s,className:(0,o.cn)("text-sm text-muted-foreground",e),...t}));x.displayName=n.VY.displayName},40320:(e,t,s)=>{"use strict";s.d(t,{LayoutWrapper:()=>a});let a=(0,s(12907).registerClientReference)(function(){throw Error("Attempted to call LayoutWrapper() from the server but LayoutWrapper is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/alma/Documents/NeahNew/components/layout/layout-wrapper.tsx","LayoutWrapper")},49307:(e,t,s)=>{Promise.resolve().then(s.bind(s,40320)),Promise.resolve().then(s.bind(s,88639))},51784:(e,t,s)=>{Promise.resolve().then(s.t.bind(s,86346,23)),Promise.resolve().then(s.t.bind(s,27924,23)),Promise.resolve().then(s.t.bind(s,35656,23)),Promise.resolve().then(s.t.bind(s,40099,23)),Promise.resolve().then(s.t.bind(s,38243,23)),Promise.resolve().then(s.t.bind(s,28827,23)),Promise.resolve().then(s.t.bind(s,62763,23)),Promise.resolve().then(s.t.bind(s,97173,23))},55629:(e,t,s)=>{"use strict";s.d(t,{SQ:()=>m,_2:()=>h,lp:()=>p,mB:()=>f,rI:()=>d,ty:()=>u});var a=s(60687),r=s(43210),n=s(38786),i=s(14952),o=s(13964),l=s(65822),c=s(96241);let d=n.bL,u=n.l9;n.YJ,n.ZL,n.Pb,n.z6,r.forwardRef(({className:e,inset:t,children:s,...r},o)=>(0,a.jsxs)(n.ZP,{ref:o,className:(0,c.cn)("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...r,children:[s,(0,a.jsx)(i.A,{className:"ml-auto"})]})).displayName=n.ZP.displayName,r.forwardRef(({className:e,...t},s)=>(0,a.jsx)(n.G5,{ref:s,className:(0,c.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t})).displayName=n.G5.displayName;let m=r.forwardRef(({className:e,sideOffset:t=4,...s},r)=>(0,a.jsx)(n.ZL,{children:(0,a.jsx)(n.UC,{ref:r,sideOffset:t,className:(0,c.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...s})}));m.displayName=n.UC.displayName;let h=r.forwardRef(({className:e,inset:t,...s},r)=>(0,a.jsx)(n.q7,{ref:r,className:(0,c.cn)("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...s}));h.displayName=n.q7.displayName,r.forwardRef(({className:e,children:t,checked:s,...r},i)=>(0,a.jsxs)(n.H_,{ref:i,className:(0,c.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:s,...r,children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(n.VF,{children:(0,a.jsx)(o.A,{className:"h-4 w-4"})})}),t]})).displayName=n.H_.displayName,r.forwardRef(({className:e,children:t,...s},r)=>(0,a.jsxs)(n.hN,{ref:r,className:(0,c.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...s,children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(n.VF,{children:(0,a.jsx)(l.A,{className:"h-2 w-2 fill-current"})})}),t]})).displayName=n.hN.displayName;let p=r.forwardRef(({className:e,inset:t,...s},r)=>(0,a.jsx)(n.JU,{ref:r,className:(0,c.cn)("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...s}));p.displayName=n.JU.displayName;let f=r.forwardRef(({className:e,...t},s)=>(0,a.jsx)(n.wv,{ref:s,className:(0,c.cn)("-mx-1 my-1 h-px bg-muted",e),...t}));f.displayName=n.wv.displayName},58014:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>u});var a=s(37413),r=s(59258),n=s.n(r);s(82704);var i=s(44999),o=s(35426),l=s(26690),c=s(88639),d=s(40320);async function u({children:e}){let t=await (0,o.getServerSession)(l.N),s=(await (0,i.headers)()).get("x-pathname")||"";return(0,a.jsxs)("html",{lang:"fr",children:[(0,a.jsx)("head",{children:(0,a.jsx)("script",{dangerouslySetInnerHTML:{__html:`
|
|
// Disable React DevTools in production
|
|
if (typeof window !== 'undefined' && typeof window.__REACT_DEVTOOLS_GLOBAL_HOOK__ === 'object') {
|
|
window.__REACT_DEVTOOLS_GLOBAL_HOOK__.inject = function() {};
|
|
}
|
|
`}})}),(0,a.jsx)("body",{className:n().className,children:(0,a.jsx)(c.Providers,{children:(0,a.jsx)(d.LayoutWrapper,{isSignInPage:"/signin"===s,isAuthenticated:!!t,children:e})})})]})}(0,s(36781).qF)().catch(console.error)},59821:(e,t,s)=>{"use strict";s.d(t,{E:()=>o});var a=s(60687);s(43210);var r=s(24224),n=s(96241);let i=(0,r.F)("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground",notification:"border-transparent bg-red-500 text-white hover:bg-red-600 absolute -top-1 -right-1 px-1.5 py-0.5 min-w-[1.25rem] h-5 flex items-center justify-center"},shape:{default:"rounded-full",pill:"rounded-full",square:"rounded-md"},size:{default:"text-xs px-2.5 py-0.5",sm:"text-xs px-2 py-0.25 h-3.5 min-w-[1rem]",lg:"text-sm px-3 py-1",notification:"text-xs px-1.5 py-0.5 h-5 min-w-[1.25rem]"}},defaultVariants:{variant:"default",shape:"default",size:"default"}});function o({className:e,variant:t,shape:s,size:r,...o}){return(0,a.jsx)("div",{className:(0,n.cn)(i({variant:t,shape:s,size:r}),e),...o})}},64936:(e,t,s)=>{Promise.resolve().then(s.t.bind(s,16444,23)),Promise.resolve().then(s.t.bind(s,16042,23)),Promise.resolve().then(s.t.bind(s,88170,23)),Promise.resolve().then(s.t.bind(s,49477,23)),Promise.resolve().then(s.t.bind(s,29345,23)),Promise.resolve().then(s.t.bind(s,12089,23)),Promise.resolve().then(s.t.bind(s,46577,23)),Promise.resolve().then(s.t.bind(s,31307,23))},68988:(e,t,s)=>{"use strict";s.d(t,{p:()=>i});var a=s(60687),r=s(43210),n=s(96241);let i=r.forwardRef(({className:e,type:t,...s},r)=>(0,a.jsx)("input",{type:t,className:(0,n.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...s}));i.displayName="Input"},69327:(e,t,s)=>{"use strict";s.d(t,{F:()=>o});var a=s(60687),r=s(43210),n=s(20333),i=s(96241);let o=r.forwardRef(({className:e,children:t,...s},r)=>(0,a.jsxs)(n.bL,{ref:r,className:(0,i.cn)("relative overflow-hidden",e),...s,children:[(0,a.jsx)(n.LM,{className:"h-full w-full rounded-[inherit]",children:t}),(0,a.jsx)(l,{}),(0,a.jsx)(n.OK,{})]}));o.displayName=n.bL.displayName;let l=r.forwardRef(({className:e,orientation:t="vertical",...s},r)=>(0,a.jsx)(n.VM,{ref:r,orientation:t,className:(0,i.cn)("flex touch-none select-none transition-colors","vertical"===t&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===t&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...s,children:(0,a.jsx)(n.lr,{className:"relative flex-1 rounded-full bg-border"})}));l.displayName=n.VM.displayName},71702:(e,t,s)=>{"use strict";s.d(t,{dj:()=>m});var a=s(43210);let r=0,n=new Map,i=e=>{if(n.has(e))return;let t=setTimeout(()=>{n.delete(e),d({type:"REMOVE_TOAST",toastId:e})},1e6);n.set(e,t)},o=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{let{toastId:s}=t;return s?i(s):e.toasts.forEach(e=>{i(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===s||void 0===s?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===t.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},l=[],c={toasts:[]};function d(e){c=o(c,e),l.forEach(e=>{e(c)})}function u({...e}){let t=(r=(r+1)%Number.MAX_SAFE_INTEGER).toString(),s=()=>d({type:"DISMISS_TOAST",toastId:t});return d({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:e=>{e||s()}}}),{id:t,dismiss:s,update:e=>d({type:"UPDATE_TOAST",toast:{...e,id:t}})}}function m(){let[e,t]=a.useState(c);return a.useEffect(()=>(l.push(t),()=>{let e=l.indexOf(t);e>-1&&l.splice(e,1)}),[e]),{...e,toast:u,dismiss:e=>d({type:"DISMISS_TOAST",toastId:e})}}},81996:(e,t,s)=>{"use strict";s.d(t,{LayoutWrapper:()=>eT});var a=s(60687),r=s(43210),n=s(28947),i=s(56843),o=s(41550),l=s(12941),c=s(40228),d=s(48730),u=s(75034),m=s(83753),h=s(2943),p=s(80464),f=s(36999),x=s(63654),g=s(20798),b=s(65822),v=s(40083),j=s(30474),N=s(85814),w=s.n(N),y=s(96241),k=s(10022),A=s(62022),_=s(27351),C=s(58887),E=s(52961),T=s(82080),I=s(81620),S=s(98971),O=s(86121),R=s(59402),L=s(17313),P=s(8403),D=s(47033),z=s(24934),F=s(69327),M=s(16189),B=s(82136);function U({isOpen:e,onClose:t}){let{data:s,status:r}=(0,B.useSession)(),n=(0,M.useRouter)(),i=(0,M.usePathname)();if(console.log("SIDEBAR DEBUG - Session:",s),console.log("SIDEBAR DEBUG - User roles:",s?.user?.role),"loading"===r||"unauthenticated"===r)return null;let l=e=>{if(!e)return!0;if(!s?.user?.role)return!1;let t=Array.isArray(s.user.role)?s.user.role:[s.user.role],a=["offline_access","uma_authorization","default-roles-cercle"],r=t.filter(Boolean).filter(e=>!a.includes(String(e))).map(e=>"string"!=typeof e?"":e.replace(/^\//,"").replace(/^ROLE_/i,"").replace(/^default-roles-[^/]*\//i,"").toLowerCase()).filter(e=>""!==e);if(Array.isArray(e))return e.filter(Boolean).map(e=>"string"==typeof e?e.toLowerCase():"").filter(e=>""!==e).some(e=>r.includes(e));if("string"==typeof e){let t=e.toLowerCase();return r.includes(t)}return!1},c=[{title:"Pages",icon:k.A,href:"/pages",iframe:"https://journal.governance-labs.com/"},{title:"Courrier",icon:o.A,href:"/courrier"},{title:"Dossiers",icon:A.A,href:"/dossiers",iframe:"https://espace.slm-lab.net/apps/files/?embedMode=true&hideNavigation=true"},{title:"Apprendre",icon:_.A,href:"/apprendre",iframe:"https://apprendre.slm-lab.net"},{title:"Parole",icon:C.A,href:"/parole",iframe:"https://parole.slm-lab.net/channel/City"},{title:"Missions",icon:E.A,href:"/mission-tab",iframe:process.env.NEXT_PUBLIC_IFRAME_MISSIONSBOARD_URL},{title:"Chapitre",icon:T.A,href:"/chapitre",iframe:"https://chapitre.slm-lab.net"},{title:"Agilit\xe9",icon:I.A,href:"/agilite",iframe:"https://agilite.slm-lab.net/oidc/login"},...[{title:"Artlab",icon:S.A,href:"/design",iframe:"https://artlab.slm-lab.net",requiredRole:["expression","admin","user","coding","dataintelligence","mediation"]},{title:"Gite",icon:O.A,href:"/gite",iframe:"https://gite.slm-lab.net/user/oauth2/cube",requiredRole:["coding","dataintelligence"]},{title:"Calcul",icon:R.A,href:"/calcul",iframe:"https://calcul.slm-lab.net",requiredRole:"dataintelligence"},{title:"M\xe9diation",icon:L.A,href:"/mediation",iframe:"https://connect.slm-lab.net/realms/cercle/protocol/openid-connect/auth?client_id=mediations.slm-lab.net&redirect_uri=https%3A%2F%2Fmediations.slm-lab.net%2F%3Fopenid_mode%3Dtrue&scope=openid%20profile%20email&response_type=code",requiredRole:"mediation"},{title:"Livres",icon:P.A,href:"/livres",iframe:"https://memoire.slm-lab.net/"}].filter(e=>l(e.requiredRole))],d=(e,s)=>{s&&e?window.open(e,"_blank"):n.push(e),t()};return(0,a.jsxs)(a.Fragment,{children:[e&&(0,a.jsx)("div",{className:"fixed inset-0 z-40 bg-background/80 backdrop-blur-sm",onClick:t}),(0,a.jsx)("div",{className:(0,y.cn)("fixed top-0 left-0 z-50 h-full w-64 transform bg-panel transition-all duration-200 ease-in-out",e?"translate-x-0":"-translate-x-full"),children:(0,a.jsxs)(F.F,{className:"h-full w-full relative",children:[(0,a.jsx)("button",{onClick:t,className:"absolute -right-3 top-1/2 transform -translate-y-1/2 w-6 h-12 bg-black text-white rounded-r-md flex items-center justify-center hover:bg-gray-800 transition-colors z-[60]",children:(0,a.jsx)(D.A,{className:"h-4 w-4"})}),(0,a.jsx)("div",{className:"flex justify-center p-6 border-b",children:(0,a.jsx)(j.default,{src:"/Neahv3 logo.png",alt:"Neah Logo",width:50,height:16.5,className:"text-black"})}),(0,a.jsx)("div",{className:"space-y-1 p-4",children:c.map(e=>(0,a.jsxs)(z.$,{variant:"ghost",className:(0,y.cn)("w-full justify-start gap-2 text-black hover:bg-gray-100",i===e.href&&!e.external&&"bg-gray-100"),onClick:()=>d(e.href,e.external),children:[(0,a.jsx)(e.icon,{className:"h-5 w-5"}),(0,a.jsx)("span",{children:e.title})]},e.title))})]})})]})}var G=s(55629),$=s(75699),K=s(84334),V=s(97051),q=s(13964),Y=s(98712),W=s(93613),J=s(25334),Q=s(59821);let H={total:0,unread:0,sources:{}};var X=s(75836),Z=s(73514);function ee({html:e,className:t}){let s=Z.A.sanitize(e,{USE_PROFILES:{html:!0},ALLOWED_TAGS:["a","p","br","b","i","em","strong","span","div","img","ul","ol","li","h1","h2","h3","h4","h5","h6","code","pre","blockquote"],ALLOWED_ATTR:["href","target","class","id","style","src","alt","data-tagged-user-id","data-mention"]});return(0,a.jsx)("div",{className:t,dangerouslySetInnerHTML:{__html:s}})}let et=(0,r.memo)(function({className:e}){let{data:t,status:s}=(0,B.useSession)(),{notifications:n,notificationCount:i,markAsRead:o,markAllAsRead:l,fetchNotifications:c,loading:d,error:u}=function(){let e,{data:t,status:s}=(0,B.useSession)(),[a,n]=(0,r.useState)([]),[i,o]=(0,r.useState)(H),[l,c]=(0,r.useState)(!1),[d,u]=(0,r.useState)(null),m=(0,r.useRef)(null),h=(0,r.useRef)(0),p=(0,r.useRef)(!1),f=(0,r.useRef)(!1),x=(0,r.useCallback)(async(e=!1)=>{if(!t?.user||!p.current)return;let s=Date.now();if(!e&&s-h.current<5e3)return void console.log("Skipping notification count fetch - too soon");try{u(null),h.current=s,console.log("[useNotifications] Fetching notification count");let e=await fetch("/api/notifications/count",{credentials:"include"});if(!e.ok){let t=await e.text();console.error("Failed to fetch notification count:",{status:e.status,body:t}),u(t||"Failed to fetch notification count");return}let t=await e.json();p.current&&o(t)}catch(e){console.error("Error fetching notification count:",e),u("Failed to fetch notification count")}},[t?.user]),g=(0,r.useCallback)((e=null,function(...t){e&&clearTimeout(e),e=setTimeout(()=>x(...t),300)}),[x]),b=(0,r.useCallback)(async(e=1,s=20)=>{if(!t?.user||!p.current)return;let a=Date.now();if(a-h.current<5e3)return void console.log("Skipping notifications fetch - too soon");c(!0),u(null),h.current=a;try{console.log("[useNotifications] Fetching notifications",{page:e,limit:s});let t=await fetch(`/api/notifications?page=${e}&limit=${s}`,{credentials:"include"});if(!t.ok){let e=await t.text();console.error("Failed to fetch notifications:",{status:t.status,body:e}),u(e||"Failed to fetch notifications");return}let a=await t.json();p.current&&n(a.notifications)}catch(e){console.error("Error fetching notifications:",e),u("Failed to fetch notifications")}finally{p.current&&c(!1)}},[t?.user]),v=(0,r.useCallback)(async e=>{if(!t?.user)return!1;try{console.log("[useNotifications] Marking notification as read:",e);let t=await fetch(`/api/notifications/${e}/read`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"});if(!t.ok){let e=await t.text();return console.error("Failed to mark notification as read:",{status:t.status,body:e}),!1}return n(t=>t.map(t=>t.id===e?{...t,isRead:!0}:t)),g(!0),!0}catch(e){return console.error("Error marking notification as read:",e),!1}},[t?.user,g]),j=(0,r.useCallback)(async()=>{if(!t?.user)return!1;try{console.log("[useNotifications] Marking all notifications as read");let e=await fetch("/api/notifications/read-all",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include"});if(!e.ok){let t=await e.text();return console.error("Failed to mark all notifications as read:",{status:e.status,body:t}),!1}return n(e=>e.map(e=>({...e,isRead:!0}))),g(!0),!0}catch(e){return console.error("Error marking all notifications as read:",e),!1}},[t?.user,g]);(0,r.useCallback)(()=>{if(!f.current)return f.current=!0,m.current&&clearInterval(m.current),m.current=setInterval(()=>{p.current&&g()},6e4),()=>N()},[g]);let N=(0,r.useCallback)(()=>{m.current&&(clearInterval(m.current),m.current=null),f.current=!1},[]);return{notifications:a,notificationCount:i,loading:l,error:d,fetchNotifications:b,fetchNotificationCount:()=>g(!0),markAsRead:v,markAllAsRead:j}}(),m=i.unread>0,[h,p]=(0,r.useState)(!1),[f,x]=(0,r.useState)(!1);console.log("[NOTIFICATION_BADGE] Auth status:",s),console.log("[NOTIFICATION_BADGE] Session:",t?"exists":"null"),console.log("[NOTIFICATION_BADGE] Current notification count:",i),console.log("[NOTIFICATION_BADGE] Current notifications:",n.length>0?`${n.length} loaded`:"none loaded"),console.log("[NOTIFICATION_BADGE] Loading state:",d),console.log("[NOTIFICATION_BADGE] Error state:",u);let g=async()=>{console.log("[NOTIFICATION_BADGE] Manual fetch initiated"),x(!0);try{let e=await fetch("/api/notifications",{credentials:"include"});if(console.log("[NOTIFICATION_BADGE] Manual fetch response:",e.status),e.ok){let t=await e.json();console.log("[NOTIFICATION_BADGE] Manual fetch success:",t)}else console.error("[NOTIFICATION_BADGE] Manual fetch failed:",e.status,await e.text())}catch(e){console.error("[NOTIFICATION_BADGE] Manual fetch error:",e)}c(1,10)};(0,r.useEffect)(()=>{h&&"authenticated"===s&&(console.log("[NOTIFICATION_BADGE] Dropdown opened, fetching notifications"),g())},[h,s]);let b=async e=>{await o(e)},v=async()=>{await l(),p(!1)};(0,r.useEffect)(()=>{"authenticated"===s&&(console.log("[NOTIFICATION_BADGE] Component mounted and authenticated, fetching initial notifications"),g())},[s]);let j=n.slice(0,10),N=u?.includes("Not authenticated")||u?.includes("401");return(0,a.jsx)("div",{className:`relative ${e||""}`,children:(0,a.jsxs)(G.rI,{open:h,onOpenChange:e=>{p(e),e&&"authenticated"===s&&(console.log("[NOTIFICATION_BADGE] Dropdown opened via handleOpenChange, fetching notifications"),g())},children:[(0,a.jsx)(G.ty,{asChild:!0,children:(0,a.jsxs)(z.$,{variant:"ghost",size:"icon",className:"text-white/80 hover:text-white relative p-0",children:[(0,a.jsx)(V.A,{className:"w-5 h-5"}),m&&(0,a.jsx)(Q.E,{variant:"notification",size:"notification",className:"absolute -top-2 -right-2 z-50",children:i.unread>99?"99+":i.unread}),(0,a.jsx)("span",{className:"sr-only",children:"Notifications"})]})}),(0,a.jsxs)(G.SQ,{align:"end",className:"w-80 max-h-[80vh] overflow-y-auto",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between p-4",children:[(0,a.jsx)("h3",{className:"font-medium",children:"Notifications"}),i.unread>0&&(0,a.jsxs)(z.$,{variant:"ghost",size:"sm",onClick:v,children:[(0,a.jsx)(q.A,{className:"h-4 w-4 mr-2"}),"Mark all read"]})]}),(0,a.jsx)(G.mB,{}),d?(0,a.jsxs)("div",{className:"py-8 px-4 text-center",children:[(0,a.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900 mx-auto mb-2"}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"Loading notifications..."})]}):N?(0,a.jsxs)("div",{className:"py-8 px-4 text-center",children:[(0,a.jsx)(Y.A,{className:"h-8 w-8 text-orange-500 mx-auto mb-2"}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground mb-2",children:"Authentication required"}),(0,a.jsx)(z.$,{variant:"outline",size:"sm",onClick:()=>(0,B.signIn)(),children:"Sign in"})]}):u?(0,a.jsxs)("div",{className:"py-8 px-4 text-center",children:[(0,a.jsx)(W.A,{className:"h-8 w-8 text-red-500 mx-auto mb-2"}),(0,a.jsx)("p",{className:"text-sm text-red-500 mb-2",children:u}),(0,a.jsx)(z.$,{variant:"outline",size:"sm",onClick:g,children:"Retry"})]}):0===n.length&&f?(0,a.jsxs)("div",{className:"py-8 px-4 text-center",children:[(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"No notifications found"}),(0,a.jsx)(z.$,{variant:"outline",size:"sm",className:"mt-2",onClick:g,children:"Refresh"})]}):0===n.length?(0,a.jsx)("div",{className:"py-8 px-4 text-center",children:(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"No notifications"})}):(0,a.jsx)(a.Fragment,{children:j.map(e=>(0,a.jsx)(G._2,{className:"px-4 py-3 cursor-default",children:(0,a.jsxs)("div",{className:"w-full",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between",children:[(0,a.jsxs)("div",{className:"max-w-[90%]",children:[(0,a.jsxs)("div",{className:"text-sm font-medium",children:[e.title,!e.isRead&&(0,a.jsx)(Q.E,{variant:"secondary",className:"ml-2 bg-blue-500 text-white",children:"New"}),"leantime"===e.source&&(0,a.jsxs)(Q.E,{variant:"outline",className:"ml-2 text-[10px] py-0 px-1.5 bg-amber-50 text-amber-700 border-amber-200 flex items-center",children:[(0,a.jsx)(E.A,{className:"mr-1 h-2.5 w-2.5"}),"Agilit\xe9"]})]}),(0,a.jsxs)("p",{className:"text-xs text-muted-foreground",children:[(0,X.m)(new Date(e.timestamp),{addSuffix:!0}),e.source&&(0,a.jsxs)("span",{className:"ml-1 opacity-75",children:["• ","leantime"===e.source?"Leantime":e.source]})]})]}),(0,a.jsxs)("div",{className:"flex space-x-1 ml-2",children:[!e.isRead&&(0,a.jsxs)(z.$,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>b(e.id),children:[(0,a.jsx)(q.A,{className:"h-3.5 w-3.5"}),(0,a.jsx)("span",{className:"sr-only",children:"Mark as read"})]}),e.link&&(0,a.jsx)(w(),{href:e.link,target:"_blank",children:(0,a.jsxs)(z.$,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",children:[(0,a.jsx)(J.A,{className:"h-3.5 w-3.5"}),(0,a.jsx)("span",{className:"sr-only",children:"Open"})]})})]})]}),(0,a.jsx)(ee,{html:e.message,className:"text-xs mt-1 notification-message"})]})},e.id))})]})]})})});var es=s(37826),ea=s(10991),er=s(15616),en=s(68988),ei=s(41862),eo=s(11860);let el=r.forwardRef(({className:e,...t},s)=>(0,a.jsx)(ea.hJ,{ref:s,className:(0,y.cn)("fixed inset-0 z-50 bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));function ec({open:e,onOpenChange:t}){let{data:s}=(0,B.useSession)(),[n,i]=(0,r.useState)(""),[o,l]=(0,r.useState)(""),[c,d]=(0,r.useState)(!1),[u,m]=(0,r.useState)(""),h=async()=>{if(!n.trim())return void m("Please enter a title for your note");if(!o.trim())return void m("Please enter content for your note");try{d(!0),m("");let e={id:`user-${s?.user?.id}/notes/${n}${n.endsWith(".md")?"":".md"}`,title:n,content:o,folder:"notes",mime:"text/markdown"};if(!(await fetch("/api/storage/files",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok)throw Error("Failed to save note");i(""),l(""),t(!1)}catch(e){console.error("Error saving note:",e),m("Failed to save your note. Please try again.")}finally{d(!1)}};return(0,a.jsx)(es.lG,{open:e,onOpenChange:t,children:(0,a.jsxs)(es.ZJ,{children:[(0,a.jsx)(el,{}),(0,a.jsxs)(es.Cf,{className:"sm:max-w-[500px] bg-white border-gray-200",children:[(0,a.jsx)(es.c7,{children:(0,a.jsx)(es.L3,{className:"text-gray-900",children:"Quick Note"})}),(0,a.jsxs)("div",{className:"grid gap-4 py-4",children:[u&&(0,a.jsx)("div",{className:"bg-red-50 text-red-500 p-2 rounded-md text-sm",children:u}),(0,a.jsx)("div",{className:"grid grid-cols-4 items-center gap-4",children:(0,a.jsx)(en.p,{id:"title",placeholder:"Note title",className:"col-span-4 text-gray-800 bg-white border-gray-300 placeholder-gray-500",value:n,onChange:e=>i(e.target.value),disabled:c})}),(0,a.jsx)("div",{className:"grid grid-cols-4 items-center gap-4",children:(0,a.jsx)(er.T,{id:"content",placeholder:"What's on your mind?",className:"col-span-4 text-gray-800 bg-white border-gray-300 placeholder-gray-500",rows:10,value:o,onChange:e=>l(e.target.value),disabled:c})})]}),(0,a.jsxs)(es.Es,{children:[(0,a.jsx)(z.$,{variant:"destructive",onClick:()=>t(!1),disabled:c,className:"bg-red-600 hover:bg-red-700 text-white",children:"Cancel"}),(0,a.jsx)(z.$,{onClick:h,disabled:c,className:"bg-blue-600 hover:bg-blue-700 text-white",children:c?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ei.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save Note"})]}),(0,a.jsxs)(ea.bm,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,a.jsx)(eo.A,{className:"h-4 w-4 text-gray-500"}),(0,a.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})})}el.displayName=ea.hJ.displayName;var ed=s(5748),eu=s(23385);function em(){let[e,t]=(0,r.useState)(!1),[s,n]=(0,r.useState)(!1);return e?(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(z.$,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-white/70 hover:text-white hover:bg-transparent",onClick:()=>window.electron?.windowControl.minimize(),"aria-label":"Minimize",children:(0,a.jsx)(ed.A,{className:"h-3 w-3"})}),(0,a.jsx)(z.$,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-white/70 hover:text-white hover:bg-transparent",onClick:()=>window.electron?.windowControl.maximize(),"aria-label":"Maximize",children:(0,a.jsx)(eu.A,{className:"h-3 w-3"})}),(0,a.jsx)(z.$,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-white/70 hover:text-white hover:bg-red-500",onClick:()=>window.electron?.windowControl.close(),"aria-label":"Close",children:(0,a.jsx)(eo.A,{className:"h-3 w-3"})})]}):null}let eh=async()=>{try{let e=await Notification.requestPermission();return"granted"===e}catch(e){return console.error("Error requesting notification permission:",e),!1}};function ep(){let[e,t]=(0,r.useState)(!1),{data:s,status:N}=(0,B.useSession)(),[y,k]=(0,r.useState)("online"),[A,_]=(0,r.useState)(!1);console.log("Session:",s),console.log("Status:",N);let C=e=>{if(!s?.user?.role)return console.log("No user roles found"),!1;let t=Array.isArray(s.user.role)?s.user.role:[s.user.role];console.log("Raw user roles:",t);let a=t.map(e=>e.replace(/^[\/]/,"").replace(/^ROLE_/,"").toLowerCase());console.log("Clean user roles:",a);let r=e.map(e=>e.toLowerCase());console.log("Clean required roles:",r);let n=r.some(e=>a.includes(e));return console.log("Has any role:",n),n},E={online:{color:"text-green-500",label:"Online",notifications:!0},busy:{color:"text-orange-500",label:"Busy",notifications:!1},away:{color:"text-gray-500",label:"Away",notifications:!1}},T=async e=>{if(k(e),"online"!==e){if(await eh()&&"serviceWorker"in navigator){let e=await navigator.serviceWorker.ready;await e.pushManager.getSubscription()?.then(e=>{e&&e.unsubscribe()})}}else eh()},I=[{title:"WP-Admin",icon:n.A,href:"/wp-admin"},...[{title:"Centrale",icon:n.A,href:"/missions",requiredRoles:["entrepreneurship","admin"]},{title:"Equipes",icon:i.A,href:"/equipes",requiredRoles:["admin","entrepreneurship"]},{title:"TheMessage",icon:o.A,href:"/the-message",requiredRoles:["mediation","expression"]}].filter(e=>C(e.requiredRoles))],S=new Date,O=(0,$.GP)(S,"d MMMM yyyy",{locale:K.fr}),R=(0,$.GP)(S,"HH:mm");return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"fixed top-0 left-0 right-0 z-50 bg-black",children:(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 py-1",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,a.jsx)("button",{onClick:()=>t(!0),className:"text-white/80 hover:text-white",children:(0,a.jsx)(l.A,{className:"w-5 h-5"})}),(0,a.jsx)(w(),{href:"/",children:(0,a.jsx)(j.default,{src:"/Neahv2 logo W.png",alt:"Neah Logo",width:40,height:13,className:"text-white"})}),(0,a.jsx)(w(),{href:"/agenda",className:"text-white/80 hover:text-white",children:(0,a.jsx)(c.A,{className:"w-5 h-5"})}),(0,a.jsxs)(w(),{href:"/timetracker",className:"text-white/80 hover:text-white",children:[(0,a.jsx)(d.A,{className:"w-5 h-5"}),(0,a.jsx)("span",{className:"sr-only",children:"TimeTracker"})]}),(0,a.jsxs)("button",{onClick:()=>_(!0),className:"text-white/80 hover:text-white",children:[(0,a.jsx)(u.A,{className:"w-5 h-5"}),(0,a.jsx)("span",{className:"sr-only",children:"Notes"})]}),(0,a.jsxs)(w(),{href:"/alma",className:"text-white/80 hover:text-white",children:[(0,a.jsx)(m.A,{className:"w-5 h-5"}),(0,a.jsx)("span",{className:"sr-only",children:"ALMA"})]}),(0,a.jsxs)(w(),{href:"/vision",className:"text-white/80 hover:text-white",children:[(0,a.jsx)(h.A,{className:"w-5 h-5"}),(0,a.jsx)("span",{className:"sr-only",children:"Vision"})]}),(0,a.jsxs)(w(),{href:"/observatory",className:"text-white/80 hover:text-white",children:[(0,a.jsx)(p.A,{className:"w-5 h-5"}),(0,a.jsx)("span",{className:"sr-only",children:"Observatory"})]}),(0,a.jsxs)(w(),{href:"/radio",className:"text-white/80 hover:text-white",children:[(0,a.jsx)(f.A,{className:"w-5 h-5"}),(0,a.jsx)("span",{className:"sr-only",children:"Radio"})]}),(0,a.jsxs)(w(),{href:"/press",className:"text-white/80 hover:text-white",children:[(0,a.jsx)(x.A,{className:"w-5 h-5"}),(0,a.jsx)("span",{className:"sr-only",children:"Press"})]}),(0,a.jsxs)(w(),{href:"/announcement",className:"text-white/80 hover:text-white",children:[(0,a.jsx)(g.A,{className:"w-5 h-5"}),(0,a.jsx)("span",{className:"sr-only",children:"Announcement"})]})]}),(0,a.jsxs)("div",{className:"hidden md:flex flex-col items-center",children:[(0,a.jsx)("div",{className:"text-white/80 text-xs",children:O}),(0,a.jsx)("div",{className:"text-white text-sm font-medium",children:R})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(em,{}),(0,a.jsx)(et,{}),"authenticated"===N&&s?.user?(0,a.jsxs)(G.rI,{children:[(0,a.jsx)(G.ty,{className:"outline-none",children:(0,a.jsx)("div",{className:"w-8 h-8 rounded-full bg-blue-600 flex items-center justify-center text-white cursor-pointer hover:bg-blue-700 transition-colors",children:(()=>{if(s?.user?.name){let e=s.user.name.split(" ");return e.length>=2?`${e[0][0]}${e[e.length-1][0]}`.toUpperCase():e[0].slice(0,2).toUpperCase()}return"?"})()})}),(0,a.jsxs)(G.SQ,{align:"end",className:"w-56 bg-black/90 border-gray-700",children:[(0,a.jsx)(G.lp,{className:"text-white/80",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsx)("span",{children:s?.user?.name||"User"}),(0,a.jsxs)(G.rI,{children:[(0,a.jsx)(G.ty,{className:"outline-none",children:(0,a.jsxs)("div",{className:"flex items-center space-x-1 text-sm",children:[(0,a.jsx)(b.A,{className:`h-3 w-3 ${E[y].color}`}),(0,a.jsx)("span",{className:"text-gray-400",children:E[y].label})]})}),(0,a.jsxs)(G.SQ,{className:"bg-black/90 border-gray-700",children:[(0,a.jsxs)(G._2,{className:"text-white/80 hover:text-white hover:bg-black/50 cursor-pointer",onClick:()=>T("online"),children:[(0,a.jsx)(b.A,{className:"h-3 w-3 text-green-500 mr-2"}),(0,a.jsx)("span",{children:"Online"})]}),(0,a.jsxs)(G._2,{className:"text-white/80 hover:text-white hover:bg-black/50 cursor-pointer",onClick:()=>T("busy"),children:[(0,a.jsx)(b.A,{className:"h-3 w-3 text-orange-500 mr-2"}),(0,a.jsx)("span",{children:"Busy"})]}),(0,a.jsxs)(G._2,{className:"text-white/80 hover:text-white hover:bg-black/50 cursor-pointer",onClick:()=>T("away"),children:[(0,a.jsx)(b.A,{className:"h-3 w-3 text-gray-500 mr-2"}),(0,a.jsx)("span",{children:"Away"})]})]})]})]})}),(0,a.jsx)(G.mB,{className:"bg-gray-700"}),I.map(e=>(0,a.jsxs)(G._2,{className:"text-white/80 hover:text-white hover:bg-black/50 cursor-pointer",onClick:()=>window.location.href=e.href,children:[(0,a.jsx)(e.icon,{className:"mr-2 h-4 w-4"}),(0,a.jsx)("span",{children:e.title})]},e.title)),(0,a.jsxs)(G._2,{className:"text-white/80 hover:text-white hover:bg-black/50 cursor-pointer",onClick:async()=>{try{await (0,B.signOut)({callbackUrl:"/signin",redirect:!1});let e=new URL(`${process.env.NEXT_PUBLIC_KEYCLOAK_ISSUER}/protocol/openid-connect/logout`);e.searchParams.append("post_logout_redirect_uri",window.location.origin),e.searchParams.append("id_token_hint",s?.accessToken||""),window.location.href=e.toString()}catch(e){console.error("Error during logout:",e),window.location.href="/signin"}},children:[(0,a.jsx)(v.A,{className:"mr-2 h-4 w-4"}),(0,a.jsx)("span",{children:"D\xe9connexion"})]})]})]}):(0,a.jsx)("div",{className:"cursor-pointer text-white/80 hover:text-white",children:(0,a.jsx)("span",{onClick:()=>(0,B.signIn)("keycloak",{callbackUrl:"/"}),children:"Login"})})]})]})}),(0,a.jsx)(U,{isOpen:e,onClose:()=>t(!1)}),(0,a.jsx)(ec,{open:A,onOpenChange:_})]})}function ef(){return(0,a.jsx)("footer",{className:"w-full p-4 bg-black text-white/80",children:(0,a.jsxs)("div",{className:"flex space-x-4 text-sm",children:[(0,a.jsx)(w(),{href:"/support",className:"hover:text-white",children:"Support"}),(0,a.jsx)(w(),{href:"/help",className:"hover:text-white",children:"Centre d'aide"}),(0,a.jsx)(w(),{href:"/privacy",className:"hover:text-white",children:"Confidentialit\xe9"}),(0,a.jsx)(w(),{href:"/tos",className:"hover:text-white",children:"Conditions d'utilisation"})]})})}function ex({children:e}){let{data:t,status:s}=(0,B.useSession)(),r=(0,M.usePathname)();return((0,M.useRouter)(),"loading"===s)?(0,a.jsx)("div",{children:"Chargement..."}):"unauthenticated"===s&&"/signin"!==r?null:(0,a.jsx)(a.Fragment,{children:e})}var eg=s(71702),eb=s(47313),ev=s(24224);let ej=eb.Kq,eN=r.forwardRef(({className:e,...t},s)=>(0,a.jsx)(eb.LM,{ref:s,className:(0,y.cn)("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",e),...t}));eN.displayName=eb.LM.displayName;let ew=(0,ev.F)("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground","new-email":"border-blue-500 bg-blue-600 text-white"}},defaultVariants:{variant:"default"}}),ey=r.forwardRef(({className:e,variant:t,...s},r)=>(0,a.jsx)(eb.bL,{ref:r,className:(0,y.cn)(ew({variant:t}),e),...s}));ey.displayName=eb.bL.displayName,r.forwardRef(({className:e,...t},s)=>(0,a.jsx)(eb.rc,{ref:s,className:(0,y.cn)("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t})).displayName=eb.rc.displayName;let ek=r.forwardRef(({className:e,...t},s)=>(0,a.jsx)(eb.bm,{ref:s,className:(0,y.cn)("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:(0,a.jsx)(eo.A,{className:"h-4 w-4"})}));ek.displayName=eb.bm.displayName;let eA=r.forwardRef(({className:e,...t},s)=>(0,a.jsx)(eb.hE,{ref:s,className:(0,y.cn)("text-sm font-semibold",e),...t}));eA.displayName=eb.hE.displayName;let e_=r.forwardRef(({className:e,...t},s)=>(0,a.jsx)(eb.VY,{ref:s,className:(0,y.cn)("text-sm opacity-90",e),...t}));function eC(){let{toasts:e}=(0,eg.dj)();return(0,a.jsxs)(ej,{children:[e.map(function({id:e,title:t,description:s,action:r,...n}){return(0,a.jsxs)(ey,{...n,children:[(0,a.jsxs)("div",{className:"grid gap-1",children:[t&&(0,a.jsx)(eA,{children:t}),s&&(0,a.jsx)(e_,{children:s})]}),r,(0,a.jsx)(ek,{})]},e)}),(0,a.jsx)(eN,{})]})}e_.displayName=eb.VY.displayName;let eE=["/background/Autumn birger-strahl-6YZgnYaPD5s-unsplash.jpeg","/background/Moneral tobias-reich-VltYe88rkt8-unsplash.jpeg","/background/aaron-burden-cGW1w-qLix8-unsplash.jpg","/background/aaron-burden-xtIYGB0KEqc-unsplash.jpg","/background/art credit library-of-congress-ULl31hxiehE-unsplash.jpeg","/background/art-institute-of-chicago-fayEVJ03T7M-unsplash.jpg","/background/art-institute-of-chicago-j-3IgXK3iJg-unsplash.jpg","/background/art-institute-of-chicago-ueWnHtoaplI-unsplash.jpg","/background/art-institute-of-chicago-yIgLfU6EEBw-unsplash.jpg","/background/birmingham-museums-trust-M9ryRhN4YSI-unsplash.jpg","/background/david-ramirez-LC7lLC9jDzw-unsplash.jpg","/background/europeana-HDIOpM_XXbI-unsplash.jpg","/background/gabor-juhasz-B1Zyw7sdm5w-unsplash.jpg","/background/gonzalo-mendiola-XXCrAQgQnVw-unsplash.jpg","/background/ian-keefe-OgcJIKRnRC8-unsplash.jpg","/background/japan credit dale-scogings-_SBsVi4kmkY-unsplash.jpeg","/background/japan credit david-edelstein-N4DbvTUDikw-unsplash.jpeg","/background/japan credit falco-negenman-K8MMfFifWcE-unsplash.jpeg","/background/japan credit galen-crout-0_xMuEbpFAQ-unsplash.jpeg","/background/japan credit gilly-cLnFkSji734-unsplash.jpeg","/background/japan credit matthew-buchanan-VVi59Xtsd8Y-unsplash.jpeg","/background/japan credit redd-f-Bxzrd0p6yOM-unsplash.jpeg","/background/japan credit redd-f-wPMvPMD9KBI-unsplash.jpeg","/background/japan credit sorasak-_UIN-pFfJ7c-unsplash.jpeg","/background/japan credittianshu-liu-SBK40fdKbAg-unsplash.jpeg","/background/japan.jpeg","/background/joel-holland-TRhGEGdw-YY-unsplash.jpg","/background/marko-blazevic-S7mAngnWV1A-unsplash.jpg","/background/museum-of-new-zealand-te-papa-tongarewa-h2qlQSm7N-0-unsplash.jpg","/background/redd-f-Lm5rkxzgiFQ-unsplash.jpg","/background/spencer-davis-ONVA6s03hg8-unsplash.jpg","/background/summer credit spencer-everett-DdVOCPTofFc-unsplash.jpeg","/background/summer.jpeg","/background/sylvain-mauroux-jYCUBAIUsk8-unsplash.jpg","/background/the-cleveland-museum-of-art-6uIO1CNv3Vc-unsplash.jpg","/background/the-cleveland-museum-of-art-Tl9uudd4DOE-unsplash.jpg","/background/the-cleveland-museum-of-art-WQOzF8TSnRQ-unsplash.jpg","/background/tingfeng-xia-WwKrhith4l4-unsplash.jpg","/background/vegetal credit yuya-murakami-VkcD1QxtY4A-unsplash.jpeg","/background/vegetal ryunosuke-kikuno-U8_eaHSUwdw-unsplash.jpeg"];function eT({children:e,isSignInPage:t,isAuthenticated:s}){let{currentBackground:n,changeBackground:i}=function(){let[e,t]=(0,r.useState)(eE[0]);return{currentBackground:e,changeBackground:()=>{let s=(eE.indexOf(e)+1)%eE.length;t(eE[s])}}}();return(0,a.jsxs)(ex,{children:[!t&&s&&(0,a.jsx)(ep,{}),(0,a.jsx)("div",{className:"min-h-screen",style:t?{}:{backgroundImage:`url('${n}')`,backgroundSize:"cover",backgroundPosition:"center",backgroundRepeat:"no-repeat",backgroundAttachment:"fixed",cursor:"pointer",transition:"background-image 0.5s ease-in-out"},onClick:t?void 0:i,children:(0,a.jsx)("main",{children:e})}),!t&&s&&(0,a.jsx)(ef,{}),(0,a.jsx)(eC,{})]})}},82704:()=>{},85969:(e,t,s)=>{"use strict";s.d(t,{Providers:()=>n});var a=s(60687),r=s(82136);function n({children:e}){return(0,a.jsx)(r.SessionProvider,{children:e})}},88639:(e,t,s)=>{"use strict";s.d(t,{Providers:()=>a});let a=(0,s(12907).registerClientReference)(function(){throw Error("Attempted to call Providers() from the server but Providers is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/Users/alma/Documents/NeahNew/components/providers.tsx","Providers")},96241:(e,t,s)=>{"use strict";s.d(t,{cn:()=>n});var a=s(49384),r=s(82348);function n(...e){return(0,r.QP)((0,a.$)(e))}}}; |