1import{d as T,b as E,Y as L,K as G,o as H,c as a,l as t,e,m as j,F as B,r as M,t as v,W as k,i as p,g as h,h as y,v as K,q as Q,T as W,p as P,R as Y,x as J,B as f,k as I,j as l,Q as O}from"./CO-mOBGH.js";const X={class:"min-h-screen flex items-center justify-center bg-gray-50 p-4"},Z={class:"max-w-2xl w-full bg-white rounded-lg shadow-lg overflow-hidden"},ee={class:"bg-[#1b2441] text-white p-6 text-center"},se=["src"],te={class:"p-6"},oe={key:0},re={class:"space-y-3"},ae={key:1,class:"bg-red-50 text-red-500 p-4 rounded-lg mb-4"},le={key:2},ne={class:"flex items-center gap-4"},ie={class:"w-12 h-12 flex-shrink-0"},de=["src"],ce=["src"],ue={class:"flex-grow"},be={class:"text-lg font-semibold text-gray-900"},ve={class:"text-gray-600 text-sm"},fe={class:"flex-shrink-0"},ge={key:0,class:"w-3 h-3 rounded-full bg-primary"},me={key:1,class:"space-y-3"},pe=["onClick"],he={class:"flex items-center gap-4"},ye={class:"w-12 h-12 flex-shrink-0"},_e=["src","alt"],xe={key:1,class:"w-full h-full bg-gray-100 rounded-lg flex items-center justify-center"},we={class:"flex-grow"},ke={class:"text-lg font-semibold text-gray-900"},Ce={key:0,class:"text-gray-600 text-sm mt-1 line-clamp-2"},Se={class:"flex-shrink-0"},Ae={key:0,class:"w-3 h-3 rounded-full bg-primary"},Ve={key:2,class:"text-center py-8 bg-gray-50 rounded-lg"},je={class:"mt-6 flex items-start rounded-sm"},Be=["disabled"],Me={key:0},Pe={key:1},Ie=T({__name:"select-club",setup(Fe){E({title:"Sélection du club"});const b=J(),F=L(),n=f(null),g=f(!1),_=f(!0),m=f(null),c=f([]),i=I(()=>c.value.find(s=>s.unique_name==="vpdive")),C=I(()=>c.value.filter(s=>s.unique_name!=="vpdive")),R=()=>{window.location.href=b.public.baseUrl+"app"},S=async()=>{_.value=!0,m.value=null;try{const s=await Y("/api/user/club");s&&typeof s=="object"&&!Array.isArray(s)?"clubs"in s&&Array.isArray(s.clubs)?c.value=s.clubs:"data"in s&&s.data&&"clubs"in s.data&&Array.isArray(s.data.clubs)?c.value=s.data.clubs:(c.value=[],console.warn("Format de réponse API (objet) non reconnu:",s)):Array.isArray(s)?c.value=s:(c.value=[],console.warn("Format de réponse API non reconnu:",s));const o=F.getActiveClub;if(o?.owner){const d=c.value.find(u=>u.owner===o.owner);d&&(n.value=d)}}catch(s){m.value=s,console.error("Erreur lors du chargement des clubs:",s)}finally{_.value=!1}},A=s=>{n.value=s};function D(s,o){const d=s.replace("#",""),u=parseInt(d.substring(0,2),16),r=parseInt(d.substring(2,4),16),x=parseInt(d.substring(4,6),16),w=o/100,$=Math.min(255,Math.floor(u+(255-u)*w)),q=Math.min(255,Math.floor(r+(255-r)*w)),z=Math.min(255,Math.floor(x+(255-x)*w));return`#${$.toString(16).padStart(2,"0")}${q.toString(16).padStart(2,"0")}${z.toString(16).padStart(2,"0")}`}const V=s=>D(s||"#1b2441",90),{switchClub:N}=G(),U=async()=>{g.value=!0;try{N(n.value?.unique_name||"vpdive")}finally{g.value=!1}};return H(()=>{S()}),(s,o)=>{const d=K,u=W;return l(),a("div",X,[t("div",Z,[t("div",ee,[t("img",{src:e(b).public.baseUrl+"logo.png",alt:"VPDive",class:"w-20 h-20 mx-auto mb-4"},null,8,se),o[1]||(o[1]=t("h1",{class:"text-2xl font-bold"},"Bienvenue sur VPDive",-1)),o[2]||(o[2]=t("p",{class:"mt-2 text-gray-200"},"Veuillez sélectionner un club pour continuer",-1))]),t("div",te,[e(_)?(l(),a("div",oe,[o[4]||(o[4]=j('<div class="mb-6 p-4 border border-gray-200 rounded-lg" data-v-870b6fdf><div class="flex items-center gap-4" data-v-870b6fdf><div class="w-12 h-12 flex-shrink-0 bg-gray-200 rounded-lg animate-pulse" data-v-870b6fdf></div><div class="flex-grow" data-v-870b6fdf><div class="h-5 bg-gray-200 rounded w-1/3 mb-2 animate-pulse" data-v-870b6fdf></div><div class="h-4 bg-gray-100 rounded w-2/3 animate-pulse" data-v-870b6fdf></div></div><div class="flex-shrink-0" data-v-870b6fdf><div class="w-6 h-6 rounded-full border-2 border-gray-200 animate-pulse" data-v-870b6fdf></div></div></div></div><div class="h-5 bg-gray-200 rounded w-1/4 mb-3 animate-pulse" data-v-870b6fdf></div>',2)),t("div",re,[(l(),a(B,null,M(3,r=>t("div",{key:r,class:"p-4 border border-gray-200 rounded-lg"},[...o[3]||(o[3]=[j('<div class="flex items-center gap-4" data-v-870b6fdf><div class="w-12 h-12 flex-shrink-0 bg-gray-200 rounded-lg animate-pulse" data-v-870b6fdf></div><div class="flex-grow" data-v-870b6fdf><div class="h-5 bg-gray-200 rounded w-1/3 mb-2 animate-pulse" data-v-870b6fdf></div><div class="h-4 bg-gray-100 rounded w-2/3 animate-pulse" data-v-870b6fdf></div></div><div class="flex-shrink-0" data-v-870b6fdf><div class="w-6 h-6 rounded-full border-2 border-gray-200 animate-pulse" data-v-870b6fdf></div></div></div>',1)])])),64))])])):e(m)?(l(),a("div",ae,[t("p",null,v(e(m)?.data?.message||"Une erreur est survenue lors du chargement des clubs."),1),t("button",{onClick:S,class:"mt-4 text-primary hover:underline"}," Réessayer ")])):(l(),a("div",le,[e(i)?(l(),a("div",{key:0,class:p(["mb-6 p-4 border border-gray-200 rounded-lg cursor-pointer hover:bg-gray-50 transition-colors",{"border-primary":e(n)?.id===e(i).id}]),style:k(e(n)?.id===e(i).id?{backgroundColor:V(e(i).color)}:{}),onClick:o[0]||(o[0]=r=>A(e(i)))},[t("div",ne,[t("div",ie,[e(i).logo?(l(),a("img",{key:0,src:e(b).public.vpdivePublic+e(i).logo,alt:"VPDive",class:"w-full h-full object-contain"},null,8,de)):(l(),a("img",{key:1,src:e(b).public.baseUrl+"logo.png",alt:"
1VPDive",class:"w-full h-full object-contain"},null,8,ce))]),t("div",ue,[t("h3",be,v(e(i).name),1),t("p",ve,v(e(i).description),1)]),t("div",fe,[t("div",{class:p(["w-6 h-6 rounded-full border-2 border-gray-300 flex items-center justify-center",{"border-primary":e(n)?.id===e(i).id}])},[e(n)?.id===e(i).id?(l(),a("div",ge)):h("",!0)],2)])])],6)):h("",!0),o[9]||(o[9]=t("h2",{class:"text-lg font-semibold mb-3"},"Mes structures",-1)),e(C).length>0?(l(),a("div",me,[(l(!0),a(B,null,M(e(C),r=>(l(),a("div",{key:r.id,class:p(["p-4 border border-gray-200 rounded-lg cursor-pointer hover:bg-gray-50 transition-colors",{"border-primary":e(n)?.id===r.id}]),style:k(e(n)?.id===r.id?{backgroundColor:V(r.color)}:{}),onClick:x=>A(r)},[t("div",he,[t("div",ye,[r.logo?(l(),a("img",{key:0,src:e(b).public.vpdivePublic+r.logo,alt:r.name,class:"w-full h-full object-cover rounded-lg"},null,8,_e)):(l(),a("div",xe,[y(d,{name:"heroicons:building-office-2",class:"w-8 h-8 text-gray-400"})]))]),t("div",we,[t("h3",ke,v(r.name),1),r.description?(l(),a("p",Ce,v(r.description),1)):h("",!0)]),t("div",Se,[t("div",{class:p(["w-6 h-6 rounded-full border-2 border-gray-300 flex items-center justify-center",{"border-primary":e(n)?.id===r.id}])},[e(n)?.id===r.id?(l(),a("div",Ae)):h("",!0)],2)])])],14,pe))),128))])):(l(),a("div",Ve,[y(d,{name:"heroicons:building-office-2",class:"w-12 h-12 text-gray-400 mx-auto mb-4"}),o[6]||(o[6]=t("p",{class:"text-gray-600"},"Vous n'êtes membre d'aucun club pour le moment.",-1)),y(u,{to:"/app/search-club",color:"green",variant:"solid",class:"mt-4 bg-[#69C77F] hover:bg-[#5AB76F]"},{default:Q(()=>[...o[5]||(o[5]=[P(" Rechercher un club ",-1)])]),_:1})])),t("div",je,[t("button",{onClick:R,class:"w-full py-3 mr-4 text-[#1b2441] rounded-md transition-all duration-300",style:{backgroundColor:"white",border:"1px solid #1b2441"}},[...o[7]||(o[7]=[t("span",null,"Retour à l'accueil",-1)])]),t("button",{onClick:U,class:"w-full py-3 text-white rounded-md transition-all duration-300",style:k({backgroundColor:e(n)?.color||"#1b2441"}),disabled:e(g)},[e(g)?(l(),a("span",Me,[y(d,{name:"heroicons:arrow-path",class:"w-5 h-5 animate-spin inline-block mr-2"}),o[8]||(o[8]=P(" Chargement... ",-1))])):(l(),a("span",Pe,"Continuer"))],12,Be)])]))])])])}}}),De=O(Ie,[["__scopeId","data-v-870b6fdf"]]);export{De 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.