1import{ah as Ie,bt as _e,r as N,b2 as Q,s as p,bu as b,j as e,B as d,cb as ve,an as je,dt as be,ap as Le,l as X,a4 as J,a5 as Z,a6 as ee,a7 as se,o as c,p as y,ep as Ae,i as Qe,aq as le,dD as G,bw as ie,dN as ne,k as A,x as _,aX as Fe,ce as ze,a2 as oe,b1 as Me,ew as ce,aT as De,aU as $e,fr as Ke,gv as Re,cf as Ue,ca as $,I as Oe,a3 as Ve}from"./index-BTrKqWIn.js";import{L as i}from"./label-t1-XzSMS.js";import{S as V}from"./switch-DqwVG63i.js";import{C as H,b as fe,c as Ne,a as B,d as He}from"./card-vCGE_HIz.js";import{T as Be,a as Xe,b as K,c as R}from"./tabs-Dl7mwtDU.js";import{B as T}from"./badge-BICT-3y_.js";import{S as W}from"./skeleton-C4ETrcps.js";import{S as de,a as ue,b as he,c as me,f as U}from"./select-C5QQdRg6.js";import{C as Ge}from"./seo-BeeBjzgY.js";import{T as We}from"./TestimonyInstagramExporter-D0_wOuBP.js";import{I as O}from"./ImageUploadField-BaZRceEp.js";import{f as xe}from"./formatDistanceToNow-On8Bb1CP.js";import{f as Y}from"./format-BVj67mn_.js";import{f as ge}from"./fr-rJMxQRdi.js";import"./index-CXDJVP3B.js";import"./index-BdQq_4o_.js";import"./MediaLibraryDialog-Dd_5G5O4.js";import"./scroll-area-ChWVu9zF.js";import"./constructNow-BVVOLb7H.js";import"./en-US-Cvlt25QH.js";import"./getRoundingMethod-BUByHx3z.js";import"./endOfMonth-DMbqykJX.js";const pe=u=>u.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),Ye={slug:"",title:"",hook:"",intro:"",body_html:"",cover_url:"",instagram_url:"",related_article_slug:"",question_prompt:"",display_order:0,is_published:!0,seo_title:"",seo_description:""},Je=()=>{const{toast:u}=Ie(),h=_e(),[l,x]=N.useState(null),[g,w]=N.useState(null),[a,n]=N.useState({quote:"",author_name:"",author_context:"",source_label:"",source_url:""}),{data:S=[]}=Q({queryKey:["admin-testimony-topics"],queryFn:async()=>{const{data:r,error:m}=await p.from("testimony_topics").select("*").order("display_order",{ascending:!0});if(m)throw m;return r}}),{data:q=[]}=Q({queryKey:["admin-testimony-highlights",g==null?void 0:g.id],enabled:!!g,queryFn:async()=>{const{data:r,error:m}=await p.from("testimony_highlights").select("*").eq("topic_id",g.id).order("display_order",{ascending:!0});if(m)throw m;return r}}),F=b({mutationFn:async r=>{const m={...r,title:r.title||"",slug:r.slug||pe(r.title||""),display_order:Number(r.display_order)||0},{error:M}=r.id?await p.from("testimony_topics").update(m).eq("id",r.id):await p.from("testimony_topics").insert(m);if(M)throw M},onSuccess:()=>{h.invalidateQueries({queryKey:["admin-testimony-topics"]}),h.invalidateQueries({queryKey:["testimony-topics"]}),x(null),u({title:"Sujet enregistré"})},onError:r=>u({title:"Erreur",description:r.message,variant:"destructive"})}),P=b({mutationFn:async r=>{const{error:m}=await p.from("testimony_topics").delete().eq("id",r);if(m)throw m},onSuccess:()=>{h.invalidateQueries({queryKey:["admin-testimony-topics"]}),u({title:"Sujet supprimé"})}}),z=b({mutationFn:async()=>{const{error:r}=await p.from("testimony_highlights").insert({topic_id:g.id,quote:a.quote,author_name:a.author_name||null,author_context:a.author_context||null,source_label:a.source_label||null,source_url:a.source_url||null,display_order:q.length,is_published:!0});if(r)throw r},onSuccess:()=>{h.invalidateQueries({queryKey:["admin-testimony-highlights",g==null?void 0:g.id]}),n({quote:"",author_name:"",author_context:"",source_label:"",source_url:""}),u({title:"Verbatim ajouté"})},onError:r=>u({title:"Erreur",description:r.message,variant:"destructive"})}),E=b({mutationFn:async r=>{const{error:m}=await p.from("testimony_highlights").delete().eq("id",r);if(m)throw m},onSuccess:()=>h.invalidateQueries({queryKey:["admin-testimony-highlights",g==null?void 0:g.id]})});return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-semibold",children:"Appels à témoignages"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Chaque sujet devient une page indexable /temoignages/slug."})]}),e.jsxs(d,{onClick:()=>x({...Ye}),className:"gap-2",children:[e.jsx(ve,{className:"h-4 w-4"})," Nouveau sujet"]})]}),e.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:S.map(r=>
1e.jsxs(H,{children:[e.jsxs(fe,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx(Ne,{className:"text-base",children:r.title}),e.jsx(T,{variant:r.is_published?"default":"secondary",children:r.is_published?"Publié":"Brouillon"})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["/temoignages/",r.slug]})]}),e.jsxs(B,{className:"space-y-3",children:[r.hook&&e.jsx("p",{className:"text-sm text-muted-foreground",children:r.hook}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(d,{size:"sm",variant:"outline",onClick:()=>x(r),className:"gap-1",children:[e.jsx(je,{className:"h-3.5 w-3.5"})," Ãditer"]}),e.jsxs(d,{size:"sm",variant:"outline",onClick:()=>w(r),className:"gap-1",children:[e.jsx(be,{className:"h-3.5 w-3.5"})," Verbatims"]}),e.jsx(d,{size:"sm",variant:"ghost",asChild:!0,children:e.jsx("a",{href:`/temoignages/${r.slug}`,target:"_blank",rel:"noreferrer",children:e.jsx(Le,{className:"h-3.5 w-3.5"})})}),e.jsx(d,{size:"sm",variant:"ghost",className:"text-destructive",onClick:()=>{confirm(`Supprimer définitivement « ${r.title} » ?`)&&P.mutate(r.id)},children:e.jsx(X,{className:"h-3.5 w-3.5"})})]})]})]},r.id))}),e.jsx(J,{open:!!l,onOpenChange:r=>!r&&x(null),children:e.jsxs(Z,{className:"max-h-[85vh] max-w-2xl overflow-y-auto",children:[e.jsx(ee,{children:e.jsx(se,{children:l!=null&&l.id?"Modifier le sujet":"Nouveau sujet"})}),l&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Titre *"}),e.jsx(c,{value:l.title||"",onChange:r=>x({...l,title:r.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Slug"}),e.jsx(c,{value:l.slug||"",placeholder:pe(l.title||""),onChange:r=>x({...l,slug:r.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Accroche"}),e.jsx(c,{value:l.hook||"",onChange:r=>x({...l,hook:r.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Intro"}),e.jsx(y,{rows:3,value:l.intro||"",onChange:r=>x({...l,intro:r.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Corps éditorial (HTML)"}),e.jsx(y,{rows:5,value:l.body_html||"",onChange:r=>x({...l,body_html:r.target.value})})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Cover (URL)"}),e.jsx(c,{value:l.cover_url||"",onChange:r=>x({...l,cover_url:r.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Post Instagram (URL)"}),e.jsx(c,{value:l.instagram_url||"",onChange:r=>x({...l,instagram_url:r.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Article lié (slug)"}),e.jsx(c,{value:l.related_article_slug||"",onChange:r=>x({...l,related_article_slug:r.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Ordre"}),e.jsx(c,{type:"number",value:l.display_order??0,onChange:r=>x({...l,display_order:Number(r.target.value)})})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Question posée au lecteur"}),e.jsx(y,{rows:2,value:l.question_prompt||"",onChange:r=>x({...l,question_prompt:r.target.value})})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Title SEO"}),e.jsx(c,{value:l.seo_title||"",onChange:r=>x({...l,seo_title:r.target.value})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(i,{children:"Meta description"}),e.jsx(c,{value:l.seo_description||"",onChange:r=>x({...l,seo_description:r.target.value})})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(V,{checked:!!l.is_published,onCheckedChange:r=>x({...l,is_published:r})}),e.jsx(i,{children:"Publié"})]})]}),e.jsxs(Ae,{children:[e.jsx(d,{variant:"outline",onClick:()=>x(null),children:"Annuler"}),e.jsx(d,{onClick:()=>l&&F.mutate(l),disabled:!(l!=null&&l.title)||F.isPending,children:"Enregistrer"})]})]})}),e.jsx(J,{open:!!g,onOpenChange:r=>!r&&w(null),children:e.jsxs(Z,{className:"max-h-[85vh] max-w-2xl overflow-y-auto",children:[e.jsx(ee,{children:e.jsxs(se,{children:["Verbatims â ",g==null?void 0:g.title]})}),e.jsx("div",{className:"space-y-3",children:q.map(r=>e.jsxs("div",{className:"rounded-lg border p-3",children:[e.jsx("p",{className:"whitespace-pre-line text-sm",children:r.quote}),e.jsxs("div",{className:"mt-2 flex items-center justify-between text-xs text-muted-foreground",children:[e.jsxs("span",{children:[r.author_name," ",r.author_context?`â ${r.author_context}`:""]}),e.jsx(d,{size:"sm",variant:"ghost",className:"text-destructive",onClick:()=>E.mutate(r.id),children:e.jsx(X,{className:"h-3.5 w-3.5"})})]})]},r.id))}),e.jsxs("div",{className:"space-y-3 border-t pt-4",children:[e.jsx(i,{children:"Nouveau verbatim (recueilli, jamais inventé)"}),e.jsx(y,{rows:4,placeholder:"Le texte exact du témoignageâ¦",value:a.quote,onChange:r=>n({...a,quote:r.target.value})}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(c,{placeholder:"Prénom",value:a.author_name,onChange:r=>n({...a,author_name:r.target.value})}),e.jsx(c,{placeholder:"Contexte (34 ans, Marseille)",value:a.author_context,onChange:r=>n({...a,author_context:r.target.value})}),e.jsx(c,{placeholder:"Source (Instagram, mailâ¦)",value:a.source_label,onChange:r=>n({...a,source_label:r.target.value})}),e.jsx(c,{placeholder:"URL de la source",value:a.source_url,onChange:r=>n({...a,source_url:r.target.value})})]}),e.jsx(d,{onClick:()=>z.mutate(),disabled:a.quote.trim().length<20||z.isPending,children:"Ajouter"})]})]})})]})},Ze=u=>`${Ge}/lachetoi/${encodeURIComponent(u)}`;function es(u){const h=Math.floor(u/60),l=u%60;return`${h}:${l.toString().padStart(2,"0")}`}function ws(){const u=_e(),[h,l]=N.useState({text:"",context:"",coverImage:"",shareImage:"",votePourLabel:"Pour",voteContreLabel:"Contre",showThumbs:!0}),[x,g]=N.useState(null),w=N.useRef(null),[a,n]=N.useState(null),[S,q]=N.useState(null),F=Qe("instagramExportTestimonies"),[P,z]=N.useState("all"),[E,r]=N.useState("all"),{data:m=[],isLoading:M}=Q({queryKey:["admin-audience-questions"],queryFn:async()=>{const{data:s,error:t}=await p.from("audience_questions").select("*").order("created_at",{ascending:!1});if(t)throw t;return s}}),{data:C=[],isLoading:we}=Q({queryKey:["admin-pending-testimonies"],queryFn:async()=>{const{data:s,error:t}=await p.from("audience_testimonies").select("*").eq("status","pen
1ding").order("created_at",{ascending:!0});if(t)throw t;return s}}),{data:I=[],isLoading:ye}=Q({queryKey:["admin-published-testimonies"],queryFn:async()=>{const{data:s,error:t}=await p.from("audience_testimonies").select("*").in("status",["approved","featured"]).order("status",{ascending:!1}).order("published_at",{ascending:!1});if(t)throw t;return s}}),ae=b({mutationFn:async()=>{const{error:s}=await p.from("audience_questions").insert({question_text:h.text,context_text:h.context||null,cover_image_url:h.coverImage||null,share_image_url:h.shareImage||null,vote_pour_label:h.votePourLabel||"Pour",vote_contre_label:h.voteContreLabel||"Contre",show_thumbs:h.showThumbs});if(s)throw s},onSuccess:()=>{_.success("Question créée"),l({text:"",context:"",coverImage:"",shareImage:"",votePourLabel:"Pour",voteContreLabel:"Contre",showThumbs:!0}),u.invalidateQueries({queryKey:["admin-audience-questions"]})},onError:()=>_.error("Erreur lors de la création")}),te=b({mutationFn:async s=>{const{error:t}=await p.from("audience_questions").update({question_text:s.question_text,context_text:s.context_text,cover_image_url:s.cover_image_url,share_image_url:s.share_image_url||null,cover_video_url:s.cover_video_url||null,vote_pour_label:s.vote_pour_label,vote_contre_label:s.vote_contre_label,show_thumbs:s.show_thumbs??!0,title_size:s.title_size||null,accent_word_red:s.accent_word_red||null,accent_word_green:s.accent_word_green||null,accent_color_red:s.accent_color_red||null,accent_color_green:s.accent_color_green||null,cta_bg_color:s.cta_bg_color||null,cta_text_color:s.cta_text_color||null,highlight_word:s.highlight_word||null,highlight_bg_color:s.highlight_bg_color||null,highlight_text_color:s.highlight_text_color||null,highlight_word_2:s.highlight_word_2||null,highlight_bg_color_2:s.highlight_bg_color_2||null,highlight_text_color_2:s.highlight_text_color_2||null,content_position:s.content_position??80,overlay_opacity:s.overlay_opacity??.6,overlay_height:s.overlay_height??100}).eq("id",s.id);if(t)throw t},onSuccess:()=>{_.success("Question mise à jour"),n(null),u.invalidateQueries({queryKey:["admin-audience-questions"]})},onError:()=>_.error("Erreur lors de la mise à jour")}),Ce=b({mutationFn:async({id:s,isActive:t})=>{const{error:o}=await p.from("audience_questions").update({is_active:t,published_at:t?new Date().toISOString():null}).eq("id",s);if(o)throw o},onSuccess:()=>{_.success("Question mise à jour"),u.invalidateQueries({queryKey:["admin-audience-questions"]})},onError:()=>_.error("Erreur lors de la mise à jour")}),ke=b({mutationFn:async s=>{const{error:t}=await p.from("audience_questions").delete().eq("id",s);if(t)throw t},onSuccess:()=>{_.success("Question supprimée"),u.invalidateQueries({queryKey:["admin-audience-questions"]})},onError:()=>_.error("Erreur lors de la suppression")}),Te=b({mutationFn:async s=>{const{id:t,created_at:o,updated_at:v,published_at:f,...k}=s,j={...k,question_text:`${s.question_text} (copie)`,is_active:!1,published_at:null},{error:D}=await p.from("audience_questions").insert(j);if(D)throw D},onSuccess:()=>{_.success("Question dupliquée"),u.invalidateQueries({queryKey:["admin-audience-questions"]})},onError:s=>_.error((s==null?void 0:s.message)||"Erreur lors de la duplication")}),L=b({mutationFn:async({id:s,status:t})=>{const{data:o}=await p.from("audience_testimonies").select("status, user_id").eq("id",s).maybeSingle(),{error:v}=await p.from("audience_testimonies").update({status:t,moderated_at:new Date().toISOString(),published_at:t==="approved"||t==="featured"?new Date().toISOString():null}).eq("id",s);if(v)throw v;t==="featured"&&(o==null?void 0:o.status)!=="featured"&&(o!=null&&o.user_id)&&await p.rpc("award_contest_points",{p_user_id:o.user_id,p_action:"testimonial_featured",p_points:10,p_metadata:{testimony_id:s}})},onSuccess:(s,t)=>{const o={approved:"Témoignage approuvé",rejected:"Témoignage rejeté",featured:"Témoignage mis en avant"};_.success(o[t.status]),u.invalidateQueries({queryKey:["admin-pending-testimonies"]}
1),u.invalidateQueries({queryKey:["admin-published-testimonies"]})},onError:()=>_.error("Erreur lors de la modération")}),Se=b({mutationFn:async s=>{const t=s.audio_url.split("/").pop();t&&await p.storage.from("audience-testimonies").remove([t]);const{error:o}=await p.from("audience_testimonies").delete().eq("id",s.id);if(o)throw o},onSuccess:()=>{_.success("Témoignage supprimé"),u.invalidateQueries({queryKey:["admin-pending-testimonies"]}),u.invalidateQueries({queryKey:["admin-published-testimonies"]})},onError:()=>_.error("Erreur lors de la suppression")}),qe=s=>{var t;if(s.media_type==="video"){window.open(s.audio_url,"_blank");return}x===s.id?((t=w.current)==null||t.pause(),g(null)):w.current&&(w.current.src=s.audio_url,w.current.play(),g(s.id))},Pe=s=>{const t=document.createElement("a");t.href=s.audio_url;const o=(s.media_type==="video","webm"),v=s.author_name||"temoin";t.download=`temoignage_${v}_${Y(new Date(s.created_at),"yyyy-MM-dd")}.${o}`,t.target="_blank",document.body.appendChild(t),t.click(),document.body.removeChild(t)},Ee=async()=>{const s=[...C,...I];if(s.length===0){_.error("Aucun témoignage à exporter");return}const t=["ID","Date","Titre","Auteur","Position","Durée (s)","Statut","URL média","Type","Avatar URL"],o=s.map(j=>[j.id,Y(new Date(j.created_at),"yyyy-MM-dd HH:mm"),j.title||"",j.author_name||"",j.author_name||"",j.stance||"",j.duration_seconds||0,j.status,j.audio_url,j.media_type||"audio",j.avatar_url||""]),v=[t.join(","),...o.map(j=>j.map(D=>`"${D}"`).join(","))].join(` 2`),f=new Blob([v],{type:"text/csv;charset=utf-8;"}),k=document.createElement("a");k.href=URL.createObjectURL(f),k.download=`temoignages_export_${Y(new Date,"yyyy-MM-dd")}.csv`,document.body.appendChild(k),k.click(),document.body.removeChild(k),_.success(`${s.length} témoignages exportés`)},re=({testimony:s,showModeration:t=!1})=>e.jsxs(H,{className:A("relative",s.status==="featured"&&"border-primary/50 bg-primary/5"),children:[s.stance&&e.jsx("div",{className:A("absolute top-0 left-0 right-0 h-1 rounded-t-lg",s.stance==="pour"?"bg-green-500":"bg-red-500")}),e.jsx(B,{className:"p-4",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx(d,{variant:"outline",size:"icon",className:"shrink-0 h-12 w-12 rounded-full",onClick:()=>qe(s),children:s.media_type==="video"?e.jsx(ce,{className:"h-5 w-5"}):x===s.id?e.jsx(De,{className:"h-5 w-5"}):e.jsx($e,{className:"h-5 w-5 ml-0.5"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[(()=>{var v;const o=m.find(f=>f.id===s.question_id);return o?e.jsxs("div",{className:"text-[11px] uppercase tracking-wide text-muted-foreground mb-1 line-clamp-1 flex items-center gap-1",children:[e.jsx(G,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate",children:(v=o.question_text)==null?void 0:v.replace(/\n/g," ")})]}):null})(),s.title&&e.jsx("h4",{className:"font-medium text-sm mb-1 line-clamp-1",children:s.title}),e.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[s.stance&&(()=>{const o=m.find(f=>f.id===s.question_id),v=s.stance==="pour"?(o==null?void 0:o.vote_pour_label)||"Pour":(o==null?void 0:o.vote_contre_label)||"Contre";return e.jsxs(T,{variant:"outline",className:A("text-xs gap-1",s.stance==="pour"?"text-green-600 border-green-300":"text-red-600 border-red-300"),children:[s.stance==="pour"?e.jsx(Ke,{className:"h-2.5 w-2.5"}):e.jsx(Re,{className:"h-2.5 w-2.5"}),v]})})(),e.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[e.jsx(Ue,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"font-medium",children:s.author_name||"Un témoin"})]}),s.media_type==="video"&&e.jsxs(T,{variant:"outline",className:"text-xs gap-1",children:[e.jsx(ce,{className:"h-2.5 w-2.5"})," Vidéo"]})]}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ie,{className:"h-3 w-3"}),es(s.duration_seconds||0)]}),e.jsx("span",{children:xe(new Date(s.created_at),{addSuffix:!0,locale:ge})}),s.listen_count>0&&e.jsxs("span",{children:[s.listen_count," écoute",s.listen_count>1?"s":""]})]}),s.status==="featured"&&e.jsxs(T,{variant:"secondary",className:"mt-2 gap-1",children:[e.jsx($,{className:"h-3 w-3"})," à la une"]})]}),e.jsx(d,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0",onClick:()=>Pe(s),title:"Télécharger le média brut",children:e.jsx(le,{className:"h-4 w-4"})}),F&&(s.status==="approved"||s.status==="featured")&&e.jsx(d,{variant:"ghost",size:"icon",className:A("h-8 w-8 shrink-0",s.instagram_video_url?"text-pink-600 hover:text-pink-700":"text-pink-500/70 hover:text-pink-600"),onClick:()=>q(s),title:s.instagram_video_url?"Vidéo Instagram prête â rouvrir":"Générer la vidéo Instagram",children:e.jsx(Oe,{className:"h-4 w-4"})}),e.jsx("div",{className:"flex items-center gap-1",children:t?e.jsxs(e.Fragment,{children:[e.jsx(d,{variant:"ghost",size:"icon",className:"h-8 w-8 text-green-600 hover:text-green-700 hover:bg-green-100",onClick:()=>L.mutate({id:s.id,status:"approved"}
2),title:"Approuver",children:e.jsx(oe,{className:"h-4 w-4"})}),e.jsx(d,{variant:"ghost",size:"icon",className:"h-8 w-8 text-amber-600 hover:text-amber-700 hover:bg-amber-100",onClick:()=>L.mutate({id:s.id,status:"featured"}),title:"Mettre à la une",children:e.jsx($,{className:"h-4 w-4"})}),e.jsx(d,{variant:"ghost",size:"icon",className:"h-8 w-8 text-red-600 hover:text-red-700 hover:bg-red-100",onClick:()=>L.mutate({id:s.id,status:"rejected"}),title:"Rejeter",children:e.jsx(Ve,{className:"h-4 w-4"})})]}):e.jsxs(e.Fragment,{children:[s.status==="approved"&&e.jsx(d,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>L.mutate({id:s.id,status:"featured"}),title:"Mettre à la une",children:e.jsx($,{className:"h-4 w-4"})}),s.status==="featured"&&e.jsx(d,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>L.mutate({id:s.id,status:"approved"}),title:"Retirer de la une",children:e.jsx($,{className:"h-4 w-4 fill-current"})}),e.jsx(d,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive",onClick:()=>Se.mutate(s),children:e.jsx(X,{className:"h-4 w-4"})})]})})]})})]});return e.jsxs("div",{className:"space-y-6",children:[e.jsx("audio",{ref:w,onEnded:()=>g(null),className:"hidden"}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(d,{variant:"outline",size:"sm",onClick:Ee,className:"gap-2",children:[e.jsx(le,{className:"h-4 w-4"}),"Exporter tout (CSV)"]})}),e.jsxs(Be,{defaultValue:"questions",className:"w-full",children:[e.jsxs(Xe,{className:"grid w-full grid-cols-4",children:[e.jsxs(K,{value:"questions",className:"gap-2",children:[e.jsx(G,{className:"h-4 w-4"}),"Questions"]}),e.jsxs(K,{value:"moderation",className:"gap-2",children:[e.jsx(ie,{className:"h-4 w-4"}),"En attente",C.length>0&&e.jsx(T,{variant:"destructive",className:"ml-1 h-5 w-5 p-0 justify-center",children:C.length})]}),e.jsxs(K,{value:"published",className:"gap-2",children:[e.jsx(ne,{className:"h-4 w-4"}),"Publiés"]}),e.jsxs(K,{value:"topics",className:"gap-2",children:[e.jsx(be,{className:"h-4 w-4"}),"Sujets"]})]}),e.jsx(R,{value:"topics",children:e.jsx(Je,{})}),e.jsxs(R,{value:"questions",className:"space-y-6",children:[e.jsxs(H,{
2children:[e.jsxs(fe,{children:[e.jsx(Ne,{children:"Nouvelle question"}),e.jsx(He,{children:"Créez une question éditoriale hebdomadaire"})]}),e.jsxs(B,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(i,{children:"Question"}),e.jsx(y,{value:h.text,onChange:s=>l(t=>({...t,text:s.target.value})),placeholder:"Qu'est-ce qui vous donne espoir aujourd'hui ?",className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx(i,{children:"Contexte (optionnel)"}),e.jsx(y,{value:h.context,onChange:s=>l(t=>({...t,context:s.target.value})),placeholder:"Précisions, contexte éditorial...",className:"mt-1",rows:2})]}),e.jsx("div",{children:e.jsx(O,{label:"Image de couverture (URL ou upload)",value:h.coverImage,onChange:s=>l(t=>({...t,coverImage:s})),bucket:"public-assets",folder:"audience-questions"})}),e.jsxs("div",{children:[e.jsx(O,{label:"Miniature de partage (1200Ã630, optionnel)",value:h.shareImage,onChange:s=>l(t=>({...t,shareImage:s})),bucket:"public-assets",folder:"audience-questions-share"}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-1",children:"Format paysage 1200Ã630 utilisé pour l'aperçu sur les réseaux sociaux. Si vide, l'image de couverture est utilisée."})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(i,{children:'Texte bouton "Pour"'}),e.jsx(c,{value:h.votePourLabel,onChange:s=>l(t=>({...t,votePourLabel:s.target.value})),placeholder:"Pour",className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx(i,{children:'Texte bouton "Contre"'}),e.jsx(c,{value:h.voteContreLabel,onChange:s=>l(t=>({...t,voteContreLabel:s.target.value})),placeholder:"Contre",className:"mt-1"})]})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(i,{htmlFor:"new-show-thumbs",className:"text-sm",children:"Afficher les icônes ð / ð"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:`Désactive si la question n'oppose pas un avis "pour/contre" (ex. Ashkénaze / Séfarade).`})]}),e.jsx(V,{id:"new-show-thumbs",checked:h.showThumbs,onCheckedChange:s=>l(t=>({...t,showThumbs:s}))})]}),e.jsxs(d,{onClick:()=>ae.mutate(),disabled:!h.text.trim()||ae.isPending,className:"gap-2",children:[e.jsx(ve,{className:"h-4 w-4"}),"Créer la question"]})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("h3",{className:"font-semibold",children:["Questions (",m.length,")"]}),M?e.jsx("div",{className:"space-y-3",children:[1,2,3].map(s=>e.jsx(W,{className:"h-24"},s))}):m.length===0?e.jsx("p",{className:"text-muted-foreground text-sm",children:"Aucune question créée"}):e.jsx("div",{className:"space-y-3",children:m.map(s=>e.jsx(H,{className:A(s.is_active&&"border-primary bg-primary/5"),children:e.jsx(B,{className:"p-4",children:e.jsxs("div",{className:"flex items-start gap-4",children:[s.cover_image_url&&e.jsx("img",{src:s.cover_image_url,alt:"",className:"w-20 h-20 object-cover rounded-lg shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-medium",children:s.question_text}),s.context_text&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s.context_text}),e.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground flex-wrap",children:[e.jsxs("span",{children:[s.response_count," réponse",s.response_count!==1?"s":""]}),e.jsxs("span",{children:["Créée ",xe(new Date(s.created_at),{addSuffix:!0,locale:ge})]}),s.vote_pour_label&&s.vote_pour_label!=="Pour"&&e.jsx(T,{variant:"outline",className:"text-green-600",children:s.vote_pour_label}),s.vote_contre_label&&s.vote_contre_label!=="Contre"&&e.jsx(T,{variant:"outline",className:"text-red-600",children:s.vote_contre_label})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(i,{htmlFor:`active-${s.id}`,className:"text-xs",children:"Active"}),e.jsx(V,{id:`active-${s.id}`,checked:s.is_active,onCheckedChange:t=>Ce.mutate({id:s.id,isActive:t})})]}),e.jsx(d,{variant:"ghost",size:"icon",className:"h-8 w-8",disabled:!s.slug,title:"Copier le lien de partage (réseaux sociaux)",onClick:async()=>
2{if(!s.slug){_.error("Slug manquant",{description:"Re-sauvegarde la question pour générer un lien."});return}const t=Ze(s.slug);try{await navigator.clipboard.writeText(t),_.success("Lien de partage copié !",{description:"Aperçu avec miniature pour WhatsApp, Facebook, Xâ¦"})}catch{_.error("Impossible de copier",{description:t})}},children:e.jsx(Fe,{className:"h-4 w-4 text-blue-500"})}),e.jsx(d,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>n(s),title:"Modifier",children:e.jsx(G,{className:"h-4 w-4"})}),e.jsx(d,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>Te.mutate(s),title:"Dupliquer",children:e.jsx(ze,{className:"h-4 w-4"})}),e.jsx(d,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive",onClick:()=>ke.mutate(s.id),title:"Supprimer",children:e.jsx(X,{className:"h-4 w-4"})})]})]})})},s.id))})]})]}),e.jsx(R,{value:"moderation",className:"space-y-4",children:(()=>{const s=P==="all"?C:C.filter(t=>t.question_id===P);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[e.jsxs("h3",{className:"font-semibold",children:["Témoignages en attente (",s.length,P!=="all"?` / ${C.length}`:"",")"]}),e.jsxs(de,{value:P,onValueChange:z,children:[e.jsx(ue,{className:"w-[260px]",children:e.jsx(he,{placeholder:"Toutes les questions"})}),e.jsxs(me,{children:[e.jsx(U,{value:"all",children:"Toutes les questions"}),m.map(t=>{var v;const o=C.filter(f=>f.question_id===t.id).length;return e.jsxs(U,{value:t.id,children:[(v=t.question_text)==null?void 0:v.replace(/\n/g," ").slice(0,50),o>0?` (${o})`:""]},t.id)})]})]})]}),we?e.jsx("div",{className:"space-y-3",children:[1,2,3].map(t=>e.jsx(W,{className:"h-20"},t))}):s.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(oe,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"Aucun témoignage en attente"})]}):e.jsx("div",{className:"space-y-3",children:s.map(t=>e.jsx(re,{testimony:t,showModeration:!0},t.id))})]})})()}),e.jsx(R,{value:"published",className:"space-y-4",children:(()=>{const s=E==="all"?I:I.filter(t=>t.question_id===E);return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[e.jsxs("h3",{className:"font-semibold",children:["Témoignages publiés (",s.length,E!=="all"?` / ${I.length}`:"",")"]}),e.jsxs(de,{value:E,onValueChange:r,children:[e.jsx(ue,{className:"w-[260px]",children:e.jsx(he,{placeholder:"Toutes les questions"})}),e.jsxs(me,{children:[e.jsx(U,{value:"all",children:"Toutes les questions"}),m.map(t=>{var v;const o=I.filter(f=>f.question_id===t.id).length;return e.jsxs(U,{value:t.id,children:[(v=t.question_text)==null?void 0:v.replace(/\n/g," ").slice(0,50),o>0?` (${o})`:""]},t.id)})]})]})]}),ye?e.jsx("div",{className:"space-y-3",children:[1,2,3].map(t=>e.jsx(W,{className:"h-20"},t))}):s.length===0?e.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[e.jsx(ne,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),e.jsx("p",{children:"Aucun témoignage publié"})]}):e.jsx("div",{className:"space-y-3",children:s.map(t=>e.jsx(re,{testimony:t},t.id))})]})})()})]}),e.jsx(J,{open:!!a,onOpenChange:s=>!s&&n(null),children:e.jsxs(Z,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[e.jsx(ee,{children:e.jsxs(se,{className:"flex items-center gap-2",children:[e.jsx(je,{className:"h-5 w-5"}),"Modifier la question"]})}),a&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(i,{children:"Question"}),e.jsx(y,{value:a.question_text,onChange:s=>n({...a,question_text:s.target.value}),className:"mt-1",rows:4}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Astuce : appuyez sur Entrée pour structurer la phrase ligne par ligne (comme les carrousels d'accueil)."})]}),e.jsxs("div",{children:[e.jsx(i,{children:"Contexte (optionnel)"}),e.jsx(y,{value:a.context_text||"",onChange:s=>n({...a,context_text:s.target.value||null}),className:"mt-1",rows:2})]}),e.jsx("div",{children:e.jsx(O,{label:"Image de couverture (URL ou upload)",value:a.cover_image_url||"",onChange:s=>n({...a,cover_image_url:s||null}),bucket:"public-assets",folder:"audience-questions"})}),e.jsxs("div",{children:[e.jsx(O,{label:"Miniature de partage (1200Ã630, optionnel)",value:a.share_image_url||"",onChange:s=>n({...a,share_image_url:s||null}),bucket:"public-assets",folder:"audience-questions-share"}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-1",children:"Format paysage 1200Ã630 utilisé pour l'aperçu sur les réseaux sociaux. Si vide, l'image de couverture est utilisée."})]}),e.jsxs("div",{children:[e.jsx(i,{children:"Cover vidéo (YouTube ou MP4) â optionnel"}),e.jsx(c,{value:a.cover_video_url||"",onChange:s=>n({...a,cover_video_url:s.target.value||null}),placeholder:"https://youtube.com/watch?v=⦠ou https://â¦/video.mp4",className:"mt-1"}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-1",children:"Si renseignée, la vidéo s'affiche en fond, autoplay muet en boucle, à la place de l'image."})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(i,{children:'Texte bouton "Pour"'}),e.jsx(c,{value:a.vote_pour_label||"Pour",onChange:s=>n({...a,vote_pour_label:s.target.value}),placeholder:"Pour",className:"mt-1"})]}),e.jsxs("div",{children:[e.jsx(i,{children:'Texte bouton "Contre"'}),e.jsx(c,{value:a.vote_contre_label||"Contre",onChange:s=>n({...a,vote_contre_label:s.target.value}),placeholder:"Contre",className:"mt-1"})]})]}),e.jsxs("div",{className:"rounded-lg border p-3 space-y-3",children:[e.jsx(i,{className:"text-sm font-semibold",children:"Apparence du titre"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-xs",children:"Taille du titre"}
2),e.jsx(c,{value:a.title_size||"",placeholder:"2.6rem",onChange:s=>n({...a,title_size:s.target.value||null})})]}),e.jsxs("div",{children:[e.jsxs(i,{className:"text-xs",children:["Position verticale (",a.content_position??80,"%)"]}),e.jsx("input",{type:"range",min:10,max:95,step:1,value:a.content_position??80,onChange:s=>n({...a,content_position:parseInt(s.target.value)}),className:"w-full mt-3"})]})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-xs",children:"Aperçu"}),e.jsxs("div",{className:"mt-2 relative mx-auto w-[180px] aspect-[9/16] rounded-xl overflow-hidden border bg-black",children:[a.cover_image_url&&e.jsx("img",{src:a.cover_image_url,alt:"",className:"absolute inset-0 w-full h-full object-cover"}),e.jsx("div",{className:"absolute inset-0",style:{backgroundColor:`rgba(0,0,0,${a.overlay_opacity??.6})`}}),e.jsxs("div",{className:"absolute left-2 right-2 -translate-y-full text-white",style:{top:`${a.content_position??80}%`},children:[e.jsx("p",{className:"text-[8px] uppercase tracking-widest opacity-80 mb-1",children:"Question 1/2"}),e.jsx("p",{className:"font-bold uppercase leading-tight whitespace-pre-line",style:{fontFamily:"'Anton', sans-serif",fontSize:"14px"},children:a.question_text?Me(a.question_text,a.accent_word_red,a.accent_word_green,a.accent_color_red,a.accent_color_green,[{word:a.highlight_word,bg:a.highlight_bg_color,color:a.highlight_text_color},{word:a.highlight_word_2,bg:a.highlight_bg_color_2,color:a.highlight_text_color_2}]):"Votre questionâ¦"}),e.jsxs("div",{className:"mt-2 flex gap-1",children:[e.jsx("div",{className:"h-3 flex-1 rounded-full bg-primary/80"}),e.jsx("div",{className:"h-3 flex-1 rounded-full bg-white/30"})]})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-xs",children:"Mot accent 1"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(c,{value:a.accent_word_red||"",placeholder:"ex: NON",onChange:s=>n({...a,accent_word_red:s.target.value||null})}),e.jsx("input",{type:"color",className:"h-10 w-12 rounded border border-input bg-background cursor-pointer shrink-0",value:a.accent_color_red||"#ef4444",onChange:s=>n({...a,accent_color_red:s.target.value}),title:"Couleur du mot"})]})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-xs",children:"Mot accent 2"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(c,{value:a.accent_word_green||"",placeholder:"ex: OUI",onChange:s=>n({...a,accent_word_green:s.target.value||null})}),e.jsx("input",{type:"color",className:"h-10 w-12 rounded border border-input bg-background cursor-pointer shrink-0",value:a.accent_color_green||"#34d399",onChange:s=>n({...a,accent_color_green:s.target.value}),title:"Couleur du mot"})]})]})]}),e.jsxs("p",{className:"text-[11px] text-muted-foreground leading-snug",children:["Astuce : pour cibler précisément un mot répété, utilisez"," ",e.jsx("code",{className:"px-1 rounded bg-muted",children:"{{mot|#ff0000}}"})," dans la question."]}),e.jsxs("div",{className:"space-y-2 pt-1",children:[e.jsx(i,{className:"text-xs font-semibold",children:"Surlignage rectangulaire #1"}),e.jsx(c,{value:a.highlight_word||"",placeholder:"Mot(s) à surligner â ex: oui",onChange:s=>n({...a,highlight_word:s.target.value||null})}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[11px] text-muted-foreground",children:"Fond"}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(c,{value:a.highlight_bg_color||"",placeholder:"#fde047",onChange:s=>n({...a,highlight_bg_color:s.target.value||null})}),e.jsx("input",{type:"color",className:"h-10 w-12 rounded border border-input bg-background cursor-pointer shrink-0",value:a.highlight_bg_color||"#fde047",onChange:s=>n({...a,highlight_bg_color:s.target.value})})]})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[11px] text-muted-foreground",children:"Texte"}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(c,{value:a.highlight_text_color||"",placeholder:"#000000",onChange:s=>n({...a,highlight_text_color:s.target.value||null})}),e.jsx("input",{type:"color",className:"h-10 w-12 rounded border border-input bg-background cursor-pointer shrink-0",value:a.highlight_text_color||"#000000",onChange:s=>n({...a,highlight_text_color:s.target.value})})]})]})]})]}),e.jsxs("div",{className:"space-y-2 pt-1",children:[e.jsx(i,{className:"text-xs font-semibold",children:"Surlignage rectangulaire #2"}),e.jsx(c,{value:a.highlight_word_2||"",placeholder:"Second mot à surligner",onChange:s=>n({...a,highlight_word_2:s.target.value||null})}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-[11px] text-muted-foreground",children:"Fond"}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(c,{value:a.highlight_bg_color_2||"",placeholder:"#fde047",onChange:s=>n({...a,highlight_bg_color_2:s.target.value||null})}),e.jsx("input",{type:"color",className:"h-10 w-12 rounded border border-input bg-background cursor-pointer shrink-0",value:a.highlight_bg_color_2||"#fde047",onChange:s=>n({...a,highlight_bg_color_2:s.target.value})})]})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-[11px] text-muted-foreground",children:"Texte"}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(c,{value:a.highlight_text_color_2||"",placeholder:"#000000",onChange:s=>n({...a,highlight_text_color_2:s.target.value||null})}),e.jsx("input",{type:"color",className:"h-10 w-12 rounded border border-input bg-background cursor-pointer shrink-0",value:a.highlight_text_color_2||"#000000",onChange:s=>n({...a,highlight_text_color_2:s.target.value})})]})]})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-1",children:[e.jsxs("div",{children:[e.jsx(i,{className:"text-xs",children:"CTA â Couleur de fond"}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(c,{value:a.cta_bg_color||"",placeholder:"ex: #ef4444",onChange:s=>n({...a,cta_bg_color:s.target.value||null})}),e.jsx("input",{type:"color",className:"h-10 w-12 rounded border border-input bg-background cursor-pointer shrink-0",value:a.cta_bg_color||"#ef4444",onChange:s=>n({...a,cta_bg_color:s.target.value}),title:"Fond du CTA"})]})]}),e.jsxs("div",{children:[e.jsx(i,{className:"text-xs",children:"CTA â Couleur du texte"}),e.jsxs("div",{className:"flex gap-2 mt-1",children:[e.jsx(c,{value:a.cta_text_color||"",placeholder:"ex: #ffffff",onChange:s=>n({...a,cta_text_color:s.target.value||null})}),e.jsx("input",{type:"color",className:"h-10 w-12 rounded border border-input bg-background cursor-pointer shrink-0",value:a.cta_text_color||"#ffffff",onChange:s=>n({...a,cta_text_color:s.target.value}),title:"Texte du CTA"})]})]})]}),e.jsxs("div",{children:[e.jsxs(i,{className:"text-xs",children:["Opacité de l'overlay (",Math.round((a.overlay_opacity??.6)*100),"%)"]}
2),e.jsx("input",{type:"range",min:0,max:1,step:.05,value:a.overlay_opacity??.6,onChange:s=>n({...a,overlay_opacity:parseFloat(s.target.value)}),className:"w-full mt-2"})]}),e.jsxs("div",{children:[e.jsxs(i,{className:"text-xs",children:["Ãtirement de l'opacité (",a.overlay_height??100,"%)"]}),e.jsx("p",{className:"text-[10px] text-muted-foreground mb-1",children:"100% = couvre toute l'image. Réduire pour ne couvrir que le bas avec un dégradé."}),e.jsx("input",{type:"range",min:10,max:100,step:5,value:a.overlay_height??100,onChange:s=>n({...a,overlay_height:parseInt(s.target.value)}),className:"w-full mt-1"})]})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(i,{htmlFor:"edit-show-thumbs",className:"text-sm",children:"Afficher les icônes ð / ð"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:`Désactive si la question n'oppose pas un avis "pour/contre" (ex. Ashkénaze / Séfarade).`})]}),e.jsx(V,{id:"edit-show-thumbs",checked:a.show_thumbs??!0,onCheckedChange:s=>n({...a,show_thumbs:s})})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[e.jsx(d,{variant:"outline",onClick:()=>n(null),children:"Annuler"}),e.jsx(d,{onClick:()=>te.mutate(a),disabled:!a.question_text.trim()||te.isPending,children:"Enregistrer"})]})]})]})}),S&&(()=>{const s=m.find(t=>t.id===S.question_id);return e.jsx(We,{testimony:S,questionText:s==null?void 0:s.question_text,pourLabel:(s==null?void 0:s.vote_pour_label)||"Pour",contreLabel:(s==null?void 0:s.vote_contre_label)||"Contre",showThumbs:(s==null?void 0:s.show_thumbs)??!0,open:!!S,onOpenChange:t=>!t&&q(null),onVideoGenerated:t=>{u.invalidateQueries({queryKey:["admin-published-testimonies"]}
2),q(o=>o&&{...o,instagram_video_url:t})}})})()]})}export{ws as AudienceSpeaksManager};
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.