1import{r as m,bt as D,b2 as M,bu as $,al as z,s as T,x as q,j as e,aL as E,o as Q,p as B,B as A,bx as H,k as V,W,P as L,Z as K,L as g,b9 as X,X as S,I as C,A as F,m as Z,dt as I,R as G}from"./index-BTrKqWIn.js";import{P as J}from"./PageTransition-CCfQQFKo.js";import{S as U}from"./SeoHead-BNbGz3Kb.js";import{c as Y,u as ee,T as te}from"./useTestimonyTopics-B0m52xJQ.js";import{L as se}from"./LikeButton-7cd14q9C.js";import{f as ae}from"./formatDistanceToNow-On8Bb1CP.js";import{f as re}from"./fr-rJMxQRdi.js";import{S as R}from"./skeleton-C4ETrcps.js";import"./seo-BeeBjzgY.js";import"./label-t1-XzSMS.js";import"./HoneypotField-BaBltdFD.js";import"./usePublicFormGuard-BdygCgxs.js";import"./constructNow-BVVOLb7H.js";import"./en-US-Cvlt25QH.js";import"./getRoundingMethod-BUByHx3z.js";import"./endOfMonth-DMbqykJX.js";function ne({highlightId:i}){const[d,x]=m.useState(!1),[u,p]=m.useState(""),[s,n]=m.useState(""),l=D(),{data:a=[]}=M({queryKey:["highlight-comments",i],queryFn:async()=>{const{data:r,error:c}=await T.from("testimony_highlight_comments").select("id, author_name, body, created_at").eq("highlight_id",i).eq("is_published",!0).order("created_at",{ascending:!0});if(c)throw c;return r??[]},staleTime:3e4}),o=$({mutationFn:async()=>{const r=s.trim();if(r.length<2)throw new Error("Ãcrivez au moins deux caractères.");const c=await z(),{error:h}=await T.from("testimony_highlight_comments").insert({highlight_id:i,author_name:u.trim()||null,body:r,fingerprint:c});if(h)throw h},onSuccess:()=>{n(""),l.invalidateQueries({queryKey:["highlight-comments",i]}),q.success("Commentaire publié")},onError:r=>q.error(r.message)});return e.jsxs("div",{className:"mt-5 border-t border-border pt-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(se,{contentType:"testimony_highlight",contentId:i,size:"sm",className:"bg-red-500/10 text-red-600 hover:bg-red-500/20",iconClassName:"text-red-500"}),e.jsxs("button",{type:"button",onClick:()=>x(r=>!r),className:"inline-flex items-center gap-1.5 rounded-full bg-muted px-2.5 py-1 text-[11px] font-medium text-muted-foreground transition-colors hover:text-foreground",children:[e.jsx(E,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"tabular-nums",children:a.length}),e.jsx("span",{children:a.length>1?"commentaires":"commentaire"})]})]}),d&&e.jsxs("div",{className:"mt-4 space-y-4",children:[a.map(r=>e.jsxs("div",{className:"rounded-2xl bg-muted/50 p-4",children:[e.jsx("p",{className:"whitespace-pre-line text-sm leading-relaxed text-foreground",children:r.body}),e.jsxs("p",{className:"mt-2 text-[11px] text-muted-foreground",children:[r.author_name||"Anonyme"," ·"," ",ae(new Date(r.created_at),{addSuffix:!0,locale:re})]})]},r.id)),e.jsxs("div",{className:"space-y-2",children:[e.jsx(Q,{value:u,onChange:r=>p(r.target.value),placeholder:"Votre prénom (facultatif)",maxLength:60}),e.jsx(B,{value:s,onChange:r=>n(r.target.value),placeholder:"Votre réactionâ¦",rows:3,maxLength:2e3}),e.jsxs(A,{size:"sm",onClick:()=>o.mutate(),disabled:o.isPending||s.trim().length<2,children:[e.jsx(H,{className:"mr-2 h-3.5 w-3.5"})," Publier"]})]})]})]})}const N=({value:i,className:d,duration:x=1200})=>{const[u,p]=m.useState(0),s=m.useRef(0),n=m.useRef();m.useEffect(()=>{const a=s.current,o=i;if(a===o)return;const r=performance.now(),c=h=>{const f=Math.min(1,(h-r)/x),j=1-Math.pow(1-f,3);p(Math.round(a+(o-a)*j)),f<1?n.current=requestAnimationFrame(c):s.current=o};return n.current=requestAnimationFrame(c),()=>{n.current&&cancelAnimationFrame(n.current)}},[i,x]);const l=new Intl.NumberFormat("fr-FR").format(u).split("");return e.jsx("span",{className:V("inline-flex max-w-full items-baseline justify-center tabular-nums",d),"aria-label":String(i),children:l.map((a,o)=>/\d/.test(a)?e.jsx("span",{className:"mx-[0.5px] inline-block shrink rounded-[3px] bg-white/10 px-[1.5px] shadow-[inset_0_-1px_0_rgba(0,0,0,0.35)]",children:a},o):e.jsx("span",{className:"mx-[0.5px] opacity-50",children:a},o))})},ve=()=>{const{slug:i}=W(),{data:d,isLoading:x}=Y(i),{data:u}=ee(),p=(u??[]).filter(t=>t.slug!==i).slice(0,4);if(x)return e.jsxs(e.Fragment,{children:[e.jsx(L,{variant:"light"}),e.jsxs("div",{className:"min-h-screen space-y-4 bg-background p-6",children:[e.jsx(R,{className:"h-10 w-2/3"}),e.jsx(R,{className:"h-40 w-full"})]})]});if(!d)return e.jsx(K,{to:"/temoignages",replace:!0});const{topic:s,highlights:n,counts:l}=d,a=s.ig_stats||null,o=t=>t>=1e3?new Intl.NumberFormat("fr-FR").format(Math.round(t)):String(t),r=a!=null&&a.posted_at?new Date(a.posted_at):null,c=(l==null?void 0:l.total)??n.length,h=(l==null?void 0:l.published)??n.length,f=`/temoignages/${s.slug}`,j=t=>(t||"").replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim().toLowerCase(),P=!!s.body_html&&j(s.body_html)===j(s.intro),b=(a==null?void 0:a.comments)??0,v=Array.isArray(s.faq_json)?s.faq_json.filter(t=>(t==null?void 0:t.q)&&(t==null?void 0:t.a)):[],w=[{q:"Comment participer à cet appel à témoignages ?",a:"Le formulaire en bas de page permet d'envoyer son récit. Les champs personnels sont facultatifs : ROOTS écrit toujours à l'auteur avant toute publication."},{q:"Les témoignages publiés sont-ils modifiés ?",a:"Non. Les verbatims sont publiés tels quels, avec au maximum une correction d'orthographe. Rien n'est réécrit, rien n'est inventé."},{q:"D'où viennent ces témoignages ?",a:`Ils proviennent des réponses au carrousel Instagram @roots_officiel${b?` (${o(b)} commentaires reçus)`:""} et des récits envoyés directement sur cette page.`}],_=v.length?[...v,...w.slice(0,1)]:w,k=`https://roots-officiel.com${f}`,O={"@context":"https://schema.org","@graph":[{"@type":"WebPage",name:s.seo_title||s.title,de
1scription:s.seo_description||s.intro||s.hook||void 0,url:k,inLanguage:"fr",isPartOf:{"@type":"WebSite",name:"ROOTS Officiel",url:"https://roots-officiel.com"}},{"@type":"BreadcrumbList",itemListElement:[{"@type":"ListItem",position:1,name:"Témoignages",item:"https://roots-officiel.com/temoignages"},{"@type":"ListItem",position:2,name:s.title,item:k}]},...n.length?[{"@type":"ItemList",name:`Témoignages â ${s.title}`,itemListElement:n.map((t,y)=>({"@type":"ListItem",position:y+1,item:{"@type":"Quotation",text:t.quote,...t.author_name?{spokenByCharacter:{"@type":"Person",name:t.author_name}}:{}}}))}]:[],{"@type":"FAQPage",mainEntity:_.map(t=>({"@type":"Question",name:t.q,acceptedAnswer:{"@type":"Answer",text:t.a}}))},...s.instagram_url?[{"@type":"DiscussionForumPosting",headline:s.title,url:s.instagram_url,...r?{datePublished:r.toISOString()}:{},interactionStatistic:[{"@type":"InteractionCounter",interactionType:"https://schema.org/CommentAction",userInteractionCount:b},{"@type":"InteractionCounter",interactionType:"https://schema.org/LikeAction",userInteractionCount:(a==null?void 0:a.likes)??0}]}]:[]]};return e.jsxs(e.Fragment,{children:[e.jsx(U,{title:s.seo_title||`${s.title} â témoignages | ROOTS`,description:s.seo_description||s.hook||`Témoignages recueillis par ROOTS autour de : ${s.title}.`,path:f,image:s.cover_url||void 0,jsonLd:O}),e.jsx(L,{variant:"light"}),e.jsx(J,{children:e.jsxs("div",{className:"min-h-screen bg-background pb-24",children:[e.jsx("nav",{"aria-label":"Fil d'Ariane",className:"border-b border-border bg-background/80 backdrop-blur",children:e.jsxs("ol",{className:"mx-auto flex max-w-6xl items-center gap-1 overflow-x-auto px-4 py-3 text-xs text-muted-foreground sm:text-sm",children:[e.jsxs("li",{className:"flex shrink-0 items-center gap-1",children:[e.jsx(g,{to:"/",className:"inline-flex items-center hover:text-foreground",children:e.jsx(X,{className:"h-3.5 w-3.5"})}),e.jsx(S,{className:"h-3 w-3 opacity-40"})]}),e.jsxs("li",{className:"flex shrink-0 items-center gap-1",children:[e.jsx(g,{to:"/temoignages",className:"hover:text-foreground",children:"Témoignages"}),e.jsx(S,{className:"h-3 w-3 opacity-40"})]}),e.jsx("li",{className:"max-w-[60vw] truncate font-medium text-foreground",children:s.title})]})}),e.jsx("section",{className:"bg-zinc-950 text-white",children:e.jsxs("div",{className:"mx-auto grid max-w-6xl items-center gap-0 md:grid-cols-2",children:[s.cover_url&&e.jsx("div",{className:"order-1 md:order-none",children:s.instagram_url?e.jsxs("a",{href:s.instagram_url,target:"_blank",rel:"noopener noreferrer",className:"group relative block w-full",children:[e.jsx("img",{src:s.cover_url,alt:s.title,className:"h-auto w-full object-contain"}),e.jsxs("span",{className:"absolute left-4 top-4 inline-flex items-center gap-1.5 rounded-full bg-black/70 px-3 py-1 text-xs font-semibold text-white backdrop-blur",children:[e.jsx(C,{className:"h-3.5 w-3.5"}),"Le carrousel d'origine"]})]}):e.jsx("img",{src:s.cover_url,alt:s.title,className:"h-auto w-full object-contain"})}),e.jsxs("div",{className:"order-2 flex flex-col justify-center px-4 py-12 md:order-none md:px-10 md:py-16",children:[e.jsxs(g,{to:"/temoignages",className:"mb-6 inline-flex items-center gap-2 text-sm text-white/60 hover:text-white",children:[e.jsx(F,{className:"h-4 w-4"})," Tous les témoignages"]}),e.jsx("h1",{className:"font-display text-4xl font-black leading-[1.05] md:text-5xl",children:s.title}),(r||s.instagram_url)&&e.jsxs("p",{className:"mt-4 flex flex-wrap items-center gap-2 text-sm text-white/60",children:[r&&e.jsxs("span",{children:["Publié le"," ",r.toLocaleDateString("fr-FR",{day:"numeric",month:"long",year:"numeric"})]}),s.instagram_url&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"opacity-40",children:"·"}),e.jsxs("a",{href:s.instagram_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 hover:text-white",children:[e.jsx(C,{className:"h-3.5 w-3.5"})," Instagram"]})]})]}),a&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-7 grid grid-cols-2 gap-3 sm:grid-cols-4",children:[{label:"vues",value:a.views||a.reach},{label:"j'aime",value:a.likes},{label:"commentaires",value:a.comments},{label:"partages",value:a.shares}].filter(t=>(t.value??0)>0).map(t=>e.jsxs("div",{className:"min-w-0 overflow-hidden rounded-2xl border border-amber-400/20 bg-white/5 px-2 py-3 text-center",children:[e.jsx(N,{value:t.value,className:"w-full justify-center font-display text-[clamp(0.95rem,4.2vw,1.5rem)] font-black leading-none text-amber-400"}),e.jsx("div",{className:"mt-1 truncate text-[10px] uppercase tracking-wide text-white/50",children:t.label})]},t.label))}),e.jsxs("p",{className:"mt-2 flex items-center gap-1.5 text-[11px] uppercase tracking-wide text-white/40",children:[e.jsx("span",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-red-500"}),"Chiffres Instagram en direct"]})]}),(c>0||b>0)&&e.jsxs("p",{className:"mt-4 text-base text-white/70",children:[e.jsx(N,{value:h,className:"font-display text-2xl font-black text-red-500"})," ","témoignages publiés sur"," ",e.jsx(N,{value:Math.max(b,c),className:"font-display text-2xl font-black text-amber-400"})," ","reçus"]}),s.intro&&e.jsx("p",{className:"mt-5 whitespace-pre-line text-[17px] font-bold leading-relaxed text-white",children:s.intro}),e.jsx("div",{children:e.jsx(A,{asChild:!0,className:"mt-8",children:e.jsx("a",{href:"#temoigner",children:"Raconter le mien"})})})]})]})}),s.body_html&&!P&&e.jsx("section",{className:"px-4 py-12",children:e.jsx("div",{className:"testimony-body mx-auto max-w-2xl text-[18px] leading-[1.7] text-foreground",dangerouslySetInnerHTML:{__html:s.body_html}})}),e.jsx("section",{className:"px-4 py-12",children:e.jsxs("div",{className:"mx-auto max-w-3xl",children:[e.jsx("h2",{className:"mb-8 font-display text-2xl font-bold md:text-3xl",children:"Ce qu'ils ont déjà raconté"}),n.length===0?e.jsx("p",{className:"rounded-3xl border border-dashed border-border p-8 text-center text-muted-foreground",children:"Ce fil vient d'ouvrir. Soyez le premier à le remplir."}):e.jsx("div",{className:"space-y-8",children:n.map((t,y)=>e.jsxs(Z.blockquote,{initial:{opacity:0,y:16},whileInView:{opacity:1,y:0},viewport:{once:!0},transition:{delay:Math.min(y,6)*.04},className:"rounded-3xl border border-border bg-card p-6 md:p-7",children:[e.jsx(I,{className:"mb-3 h-5 w-5 text-primary"}),e.jsx("p",{className:"whitespace-pre-line [font-family:'Times_New_Roman',Times,serif] text-[21px] leading-[1.75] text-foreground md:text-[23px]",children:t.quote}),e.jsxs("footer",{className:"mt-5 block text-xs text-muted-foreground",children:[t.author_name&&e.jsx("span",{className:"font-semibold text-foreground",children:t.author_name}),t.author_context&&e.jsxs("span",{children:[" â ",t.author_context]}),t.source_label&&e.jsx("span",{className:"ml-2 opacity-70",children:t.source_url?e.jsx("a",{href:t.source_url,target:"_blank",rel:"noopener noreferrer",className:"underline decoration-primary underline-offset-2",children:t.source_label}):t.source_label})]}),e.jsx(ne,{highlightId:t.id})]},t.id))}),s.related_article_slug&&e.jsx("div",{className:"mt-4 grid gap-4 sm:grid-cols-2",children:e.jsxs(g,{to:`/article/${s.related_article_slug}`,className:"flex items-center gap-3 rounded-2xl border border-border p-5 transition-colors hover:border-primary",children:[e.jsx(G,{className:"h-5 w-5 text-primary"}),e.jsx("span",{className:"text-sm font-semibold",children:"Ce qui s'est vraiment passé â l'article"})]})})]})}),p.length>0&&e.jsx("section",{className:"border-t border-border px-4 py-12",children:e.jsxs("div",{className:"mx-auto max-w-5xl",children:[e.jsx("h2",{className:"mb-6 font-display text-2xl font-bold md:text-3xl",children:"D'autres récits à découvrir"}),e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:p.map(t=>e.jsxs(g,{to:`/temoignages/${t.slug}`,className:"group flex flex-col overflow-hidden rounded-2xl border border-border bg-card transition-colors hover:border-primary",children:[t.cover_url?e.jsx("div",{className:"w-full overflow-hidden bg-muted",children:e.jsx("img",{src:t.cover_url,alt:t.title,loading:"lazy",className:"h-auto w-full object-contain transition-transform duration-300 group-hover:scale-[1.02]"})}):e.jsx("div",{className:"flex aspect-[4/5] items-center justify-center bg-zinc-950",children:e.jsx(I,{className:"h-8 w-8 text-white/30"})}),e.jsxs("div",{className:"flex flex-1 flex-col p-4",children:[e.jsx("h3",{className:"font-display text-base font-bold leading-snug group-hover:text-primary",children:t.title}),t.hook&&e.jsx("p",{className:"mt-1 line-clamp-2 text-xs text-muted-foreground",children:t.hook})]})]},t.id))}),e.jsx("div",{className:"mt-6",children:e.jsxs(g,{to:"/temoignages",className:"inline-flex items-center gap-2 text-sm font-semibold text-primary hover:underline",children:[e.jsx(F,{className:"h-4 w-4"})," Tous les témoignages"]})})]})}),e.jsx("section",{className:"border-t border-border px-4 py-12",children:e.jsxs("div",{className:"mx-auto max-w-3xl",children:[e.jsx("h2",{className:"mb-6 font-display text-2xl font-bold md:text-3xl",children:"Questions fréquentes"}),e.jsx("div",{className:"space-y-5",children:_.map(t=>e.jsxs("div",{children:[e.jsx("h3",{className:"font-display text-lg font-bold",children:t.q}),e.jsx("p",{className:"mt-1 text-[16px] leading-relaxed text-muted-foreground",children:t.a})]},t.q))})]})}),e.jsx("section",{id:"temoigner",className:"border-t border-border bg-muted/30 px-4 py-12 md:py-16",children:e.jsxs("div",{className:"mx-auto max-w-2xl",children:[e.jsx("h2",{className:"mb-3 font-display text-2xl font-bold",children:"à vous"}),e.jsx("p",{className:"mb-8 text-muted-foreground",children:s.question_prompt||"Racontez votre version. On ne publie rien sans vous avoir écrit avant."}),e.jsx(te,{topicTitle:s.title,prompt:s.question_prompt||void 0})]})})]})})]})};export{ve 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.