1import{a as g,s as h,dw as j,dA as b,j as e,E as y,ae as v,C as N}from"./index-DNkyyS2h.js";import{C as w}from"./CompanyBanner-CQOkBvpA.js";import{P,u as k}from"./contextual-back-8Vgdqvxf.js";import{H as C}from"./skeletons-D2MP_A0m.js";import{B as L}from"./BackButton-Dtee-_Bg.js";import{L as B}from"./LoadErrorState-BSauOxvA.js";import{B as A}from"./badge-tzLrpf65.js";import{g as E}from"./contexts-DmHpZfp3.js";import{g as S}from"./services-C9G5lLTe.js";import{d as R,ak as z,ac as q,av as x,a7 as p}from"./lucide-icons-C6KeHVVZ.js";import{s as F}from"./schemas-DHlKywPy.js";function c(t){return Array.isArray(t)?t.filter(r=>typeof r=="string"):[]}function O(t){if(!Array.isArray(t))return[];const r=[];for(const n of t){if(!n||typeof n!="object")continue;const s=n;typeof s.id!="string"||typeof s.title!="string"||r.push({id:s.id,title:s.title,description:typeof s.description=="string"?s.description:null,city:typeof s.city=="string"?s.city:null,cover_url:typeof s.cover_url=="string"?s.cover_url:null})}return r}function M(t){return g({queryKey:["conception-public",t],enabled:!!t,queryFn:async()=>{const{data:r,error:n}=await h.rpc("get_public_conception_fiche",{_company_id:t});if(n)throw n;const s=(r??[])[0];return s?{company_id:s.company_id,name:s.name,city:s.city,logo_url:s.logo_url,banner_url:s.banner_url,trade_label:s.trade_label,position_id:s.position_id,secondary_position_ids:c(s.secondary_position_ids),service_ids:c(s.service_ids),context_ids:c(s.context_ids),service_areas:c(s.service_areas),service_radius_km:s.service_radius_km,description:s.description,website:s.website,team_size_label:s.team_size_label,team_description:s.team_description,team_photo_url:s.team_photo_url,realisations:O(s.realisations)}:null}})}function H(t){return(t.position_id?j(t.position_id)?.label:null)??t.trade_label?.trim()??null}function m(t,r){const n=[];for(const s of t){const o=r==="position"?j(s)?.label:r==="service"?S(s)?.label:E(s);o&&n.push(o)}return n}function f(){const{label:t}=k("/","Accueil");return e.jsx(L,{fallback:"/",label:t})}function _(){return e.jsxs("div",{className:"mx-auto max-w-3xl space-y-4 p-4",children:[e.jsx(f,{}),e.jsx(y,{icon:R,title:"Cette fiche n'est pas disponible",description:"Elle n'est pas publiée, ou cette adresse ne correspond à aucune entreprise de conception."})]})}function V(){const{id:t}=b.useParams(),r=F().uuid().safeParse(t).success,n=M(r?t:void 0);return r?n.isPending?e.jsx(C,{}):n.isError?e.jsx("div",{className:"mx-auto max-w-3xl p-4",children:e.jsx(B,{title:"La fiche n'a pas pu être chargée",onRetry:()=>{n.refetch()},isRetrying:n.isFetching})}):n.data?e.jsx(T,{fiche:n.data}):e.jsx(_,{}):e.jsx(_,{})}function d({labels:t}){return t.length===0?null:e.jsx("div",{className:"flex flex-wrap gap-1.5",children:t.map(r=>e.jsx(A,{variant:"secondary",children:r},r))})}function l({title:t,children:r}){return e.jsxs(N,{className:"space-y-3 p-4 md:p-6",children:[e.jsx("h2",{className:"font-display text-lg font-semibold text-foreground",children:t}),r]})}function T({fiche:t}){const r=H(t),n=m(t.secondary_position_ids,"position"),s=m(t.service_ids,"service"),o=m(t.context_ids,"context"),a=t.website?.trim()||null,u=t.service_areas.filter(i=>i.trim().length>0);return e.jsxs("div",{className:"mx-auto max-w-3xl space-y-4 pb-16",children:[e.jsx("div",{className:"px-4 pt-4",children:e.jsx(f,{})}),t.banner_url?e.jsx(w,{ratioBox:!0,bannerUrl:t.banner_url,alt:""}):e.jsx("div",{className:"h-36 bg-muted/40 sm:h-48","aria-hidden":!0}),e.jsxs("div",{className:"space-y-4 px-4",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[t.logo_url?e.jsx("img",{src:t.logo_url,alt:"",className:"h-16 w-16 shrink-0 rounded-xl object-cover"}):e.jsx("span",{className:"flex h-16 w-16 shrink-0 items-center justify-center rounded-xl bg-muted",children:e.jsx(z,{className:"h-6 w-6 text-muted-foreground"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:v}),e.jsx("h1",{className:"font-display text-2xl font-bold text-foreground sm:text-3xl",children:t.name}),r?e.jsx("p",{className:"mt-1 text-md font-medium text-foreground",children:r}):null,t.city?e.jsxs("p",{className:"mt-1 flex items-center gap-1 text-sm text-muted-foreground",children:[e.jsx(q,{className:"h-4 w-4"}),e.jsx("span",{children:t.city})]}):null]})]}),n.length>0?e.jsx(l,{title:"Activités",children:e.jsx(d,{labels:n})}
1):null,s.length>0?e.jsx(l,{title:"Missions",children:e.jsx(d,{labels:s})}):null,o.length>0?e.jsx(l,{title:"Projets",children:e.jsx(d,{labels:o})}):null,u.length>0||t.service_radius_km?e.jsxs(l,{title:"Zone d'intervention",children:[u.length>0?e.jsx(d,{labels:u}):null,t.service_radius_km?e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Rayon de ",t.service_radius_km," km"]}):null]}):null,t.description?.trim()?e.jsxs(l,{title:"Présentation",children:[e.jsx("p",{className:"whitespace-pre-wrap text-sm leading-relaxed text-foreground",children:t.description.trim()}),a?e.jsxs("a",{href:a.startsWith("http")?a:`https://${a}`,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 text-sm font-medium text-foreground underline-offset-2 hover:underline",children:[e.jsx(x,{className:"h-4 w-4"}),"Site internet",e.jsx(p,{className:"h-3.5 w-3.5"})]}):null]}):a?e.jsx(l,{title:"Présentation",children:e.jsxs("a",{href:a.startsWith("http")?a:`https://${a}`,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 text-sm font-medium text-foreground underline-offset-2 hover:underline",children:[e.jsx(x,{className:"h-4 w-4"}),"Site internet",e.jsx(p,{className:"h-3.5 w-3.5"})]})}):null,t.realisations.length>0?e.jsx(l,{title:"Réalisations",children:e.jsx("ul",{className:"space-y-3",children:t.realisations.map(i=>e.jsxs("li",{className:"flex gap-3 rounded-xl bg-muted/40 p-3",children:[i.cover_url?e.jsx("img",{src:i.cover_url,alt:"",className:"h-16 w-16 shrink-0 rounded-lg object-cover"}):null,e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground",children:i.title}),i.city?e.jsx("p",{className:"text-xs text-muted-foreground",children:i.city}):null,i.description?e.jsx("p",{className:"mt-1 line-clamp-3 text-sm text-muted-foreground",children:i.description}):null]})]},i.id))})}):null,t.team_description?.trim()||t.team_size_label||t.team_photo_url?e.jsxs(l,{title:"L'équipe",children:[t.team_size_label?e.jsx("p",{className:"text-sm text-muted-foreground",children:t.team_size_label}):null,t.team_photo_url?e.jsx("img",{src:t.team_photo_url,alt:"",className:"max-h-56 w-full rounded-xl object-cover"}):null,t.team_description?.trim()?e.jsx("p",{className:"whitespace-pre-wrap text-sm leading-relaxed text-foreground",children:t.team_description.trim()}):null]}):null,e.jsx(P,{companyId:t.company_id})]})]})}export{V as component};
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.