PageSourceSearch

https://www.frandroid.com/wp-content/mu-plugins/optimus/build/js/chunks/SearchResultsPage-DBgqHjaS.js

js frandroid.com collected 2026-09-24 08:28:36 UTC 31,443 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/chunks/AiConversationBody-BJjAx7GK.js","js/chunks/react-Bs4hDxVO.js","js/chunks/hydrateServerComponents-CgeGZCoY.js","js/chunks/site-B6KXgbd2.js","css/hydrateServerComponents-Dd89U9Wp.css","js/chunks/SearchField-aO3WjFcp.js","js/chunks/TextInput-CLPnbPML.js","css/TextInput-B7FXM384.css","css/SearchField-x30d16yW.css","js/chunks/htmlText-DEssuVVd.js","js/chunks/relativeTime-C033wpEl.js","css/AiConversationBody-C1d0vStN.css"])))=>i.map(i=>d[i]);
2import{r as G,S as kt,_ as jt}from"./site-B6KXgbd2.js";import{j as r,r as a}from"./react-Bs4hDxVO.js";import{a as _t,Q as Et,R as Rt,P as Y,U as re,V as me,W as Ct,X as et,Y as Nt,Z as ge,_ as we,$ as Ee,a0 as Le,a1 as Tt,a2 as Z,a3 as ve,a4 as At,a5 as Re,a6 as ee,a7 as P,a8 as Be,a9 as Lt,aa as It,ab as de,ac as qe,ad as Ot,ae as Pt,af as tt,ag as he,ah as Mt,ai as $t,aj as Ft,ak as nt,al as Dt}from"./hydrateServerComponents-CgeGZCoY.js";import{s as rt,S as Bt}from"./SearchField-aO3WjFcp.js";import{d as qt}from"./htmlText-DEssuVVd.js";import{f as zt}from"./relativeTime-C033wpEl.js";const Vt=5*60*1e3,Ht=128*1024,Ut=30,K=new Map,oe=new Map;let ze=!1;function Ve(){for(;K.size>Ut;){const e=K.keys().next();if(e.done)return;K.delete(e.value)}}const Wt="v1";function st(e){return`${G()}:${e}`}function se(e){return`humanoid:search-answer:${Wt}:${st(e)}`}const pe=Et;function Qt(e,t){var s;const n=(s=pe())==null?void 0:s.getItem(se(e));if(!n)return null;try{const i=JSON.parse(n);if(i===null||typeof i!="object"||!("value"in i))return null;const{value:l,expiresAt:u}=i;return typeof u!="number"||u<=t?(Kt(e),null):{value:l,expiresAt:u}}catch{return null}}function Kt(e){var t;try{(t=pe())==null||t.removeItem(se(e))}catch{}}function Gt(e){const t=e.indexOf("?");if(t===-1)return!0;const n=new URLSearchParams(e.slice(t+1)).get("page");return n===null||n==="1"}function Yt(e,t){const n=pe();if(!n||!Gt(e))return;let s;try{s=JSON.stringify(t)}catch{return}if(!(s.length>Ht))try{n.setItem(se(e),s)}catch{if(ze)return;Jt();try{n.setItem(se(e),s)}catch{ze=!0}}}function Jt(){const e=pe();if(e)try{const t=se("");for(const n of Object.keys(e))n.startsWith(t)&&e.removeItem(n)}catch{}}function ce(e,t=Date.now()){const n=st(e),s=K.get(n)??Qt(e,t);if(s&&s.expiresAt>t)return K.set(n,s),Ve(),Promise.resolve(s.value);s&&K.delete(n);const i=oe.get(n);if(i)return i;const l=_t(e).then(u=>{if(u===void 0)return u;const m={value:u,expiresAt:Date.now()+Vt};return K.set(n,m),Ve(),Yt(e,m),u}).finally(()=>{oe.get(n)===l&&oe.delete(n)});return oe.set(n,l),l}function He(e){ce(e).catch(()=>{})}const Xt="loader___FeODX",Zt="mark___BPcD-",en="bars___j4s-X",tn="topBar___-xZvz",nn="midBar___wfQ8L",rn="botBar___sB2b2",sn="label___d4OxC",Q={loader:Xt,mark:Zt,bars:en,topBar:tn,midBar:nn,botBar:rn,label:sn};function on({site:e=G(),height:t=48,label:n,ariaLabel:s="Chargement en cours"}){return r.jsxs("div",{role:"status","aria-label":s,className:Q.loader,children:[e==="frandroid"?r.jsxs("span",{className:Q.bars,style:{"--bar-w":`${t}px`},"aria-hidden":"true",children:[r.jsx("span",{className:Q.topBar}),r.jsx("span",{className:Q.midBar}),r.jsx("span",{className:Q.botBar})]}):r.jsx("span",{className:Q.mark,style:{"--mark-h":`${t}px`},children:r.jsx(Rt,{name:e,display:"mini",height:t,ariaLabel:""})}),n&&r.jsx("span",{className:Q.label,children:n})]})}function an(e){return typeof e.count!="number"||!e.noun?"Tout voir":`Voir les ${e.count} ${e.noun}`}function ot({as:e="h2",children:t,action:n,flush:s=!1}){const i=e;return r.jsxs("div",{className:`flex items-center justify-between gap-300 pt-200 ${s?"":"px-300"}`,children:[r.jsx(i,{className:"m-0 text-left font-fontFamilyPrimary font-dynamicWeight text-xs leading-xs text-font-body",children:t}),n&&r.jsxs(ln,{action:n,children:[r.jsx("span",{className:"font-fontFamilyTertiary text-4xs font-semibold leading-5xs",children:an(n)}),r.jsx("span",{"aria-hidden":!0,className:"inline-flex transition-transform duration-150 group-hover:translate-x-100 group-focus-visible:translate-x-100",children:r.jsx(Y,{name:"arrow-right",size:24,color:"inherit"})})]})]})}function ln({action:e,children:t}){const n="group flex shrink-0 cursor-pointer items-center gap-50 border-0 bg-transparent p-0 text-right no-underline text-font-body focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary";return e.href?r.jsx("a",{href:e.href,className:n,onClick:e.onClick,children:t}):r.jsx("button",{type:"button",className:n,onClick:e.onClick,children:t})}const cn="[data-search-trends]";function un(){return rt(cn)}const dn="[data-search-ai]";function te(){return rt(dn)}const fn={1:"Pollution inutile",2:"À fuir",3:"Nul",4:"Trop limité",5:"Moyen",6:"Correct, mais...",7:"Bon",8:"Très bon",9:"Excellent",10:"Produit de rêve"};function mn(e){return fn[e]??null}const it=36e5,Ue=24*it;function hn(e,t){if(!e||!/^\d{4}-\d{2}-\d{2}$/.test(e))return null;const s=new Date(`${e}T23:59:59`).getTime()-t.getTime();if(Number.isNaN(s)||s<=0)return null;if(s<Ue)return`Plus que ${Math.max(1,Math.floor(s/it))}h`;const i=Math.floor(s/Ue);return i<=1?"Dernier jour !":`Plus que ${i} jours`}const pn="Dernier jour !",xn=new Intl.NumberFormat("fr-FR");function yn(e){const t=Math.round(e*100),n=xn.format(Math.trunc(t/100)),s=t%100;return{type:"price",amount:n,cents:s>0?`,${s.toString().padStart(2,"0")} €`:" €"}}function bn({item:e,viewScope:t,onClick:n,id:s,ordinal:i,thumbnailLoading:l}){const u=qt(e.title??""),m=i===void 0?u:r.jsxs(r.Fragment,{children:[r.jsx("span",{"aria-hidden":"true",className:"mr-100 font-semibold text-primary",children:`[${i}]`}),r.jsx("span",{className:"sr-only",children:`Source ${i} : `}),u]});return t==="products"?r.jsx(vn,{item:e,title:u,onClick:n}):t==="videos"?r.jsx(re,{href:e.permalink,title:u,video:{thumbnail:e.thumbnail??"",description:zt(e.publishDate??"")??""},onClick:n}):r.jsx(re,{id:s,href:e.permalink,thumbnail:e.thumbnail,thumbnailLoading:l,title:m,meta:r.jsx(gn,{item:e,viewScope:t}),onClick:n})}function gn({item:e,viewScope:t}){if(t==="bons-plans"){const n=e.is_deal_never_expiring?null:hn(e.deal_end_date,new Date);return n?r.jsx(wn,{label:n}):null}if(t==="tests"&&typeof e.product_mark=="number"){const n=mn(e.product_mark);return n?r.jsxs("span",{className:"flex items-center gap-100 font-fontFamilySecondary text-4xs leading-4xs text-font-body",children:[r.jsx("strong",{className:"font-bold text-tertiary",children:`${e.product_mark}/10`}),r.jsx("span",{children:n})]}):null}return null}function wn({label:e}){if(e===pn)return r.jsxs("span",{className:"flex w-fit items-center gap-100 rounded-full bg-tertiary px-200 py-100 font-fontFamilySecondary text-4xs font-bold leading-none text-font-body-inverted",children:[r.jsx(Y,{name:"fire",size:16,weight:"fill",color:"inherit"}),e]});const[t,...n]=e.split(/(?=\d)/);return r.jsxs("span",{className:"flex w-fit items-center gap-100 rounded-full bg-transparency-white-90 px-200 py-100 font-fontFamilySecondary text-4xs leading-none text-font-body",children:[r.jsx(Y,{name:"clock",size:16,color:"inherit"}),r.jsxs("span",{children:[t,r.jsx("strong",{className:"font-bold text-tertiary",children:n.join("")})]})]})}function vn({item:e,title:t,onClick:n}){var u,m,y;const s=(u=e.test)==null?void 0:u.rating,i=(m=e.startingPriceOffer)==null?void 0:m.price;if(typeof s!="number"&&typeof i!="number")return r.jsx(re,{href:e.permalink,thumbnail:e.thumbnail,title:t,onClick:n});const l=[{href:e.permalink,label:"Fiche produit",content:e.thumbnail?{type:"photo",image:{src:e.thumbnail,alt:""}}:{type:"number",value:"?"}}];return typeof s=="number"&&l.push({href:((y=e.test)==null?void 0:y.url)??e.permalink,label:"Test",content:{type:"test",score:String(s),outOf:"/10"}}),typeof i=="number"&&l.push({href:e.permalink,label:"Comparer",content:yn(i)}),r.jsx(re,{href:e.permalink,title:t,onClick:n,tiles:l})}const Sn="surface___DDGFB",kn="headerBlock___SzDjD",jn="panelStrip___m-Klw",_n="closeGlass___hr9SJ",En="chip___wS8fQ",Rn="chipCount___DvOaD",Cn="results___RWEt5",J={surface:Sn,headerBlock:kn,panelStrip:jn,closeGlass:_n,chip:En,chipCount:Rn,results:Cn};function Nn({onRestart:e}){return r.jsxs("div",{"data-ai-body-unavailable":!0,className:"flex flex-col items-center gap-200 py-800 text-center",children:[r.jsx(Y,{name:"chat-dots",size:32,color:"indicator"}),r.jsx("p",{className:"m-0 font-fontFamilyTertiary text-3xs font-semibold text-font-body",children:"La conversation n’a pas pu être chargée."}),r.jsx("p",{className:"m-0 max-w-[24rem] font-fontFamilyTertiary text-4xs text-font-indicator",children:"Rechargez la page pour réessayer, ou lancez une nouvelle recherche."}),r.jsx("button",{type:"button","data-ai-body-unavailable-restart":!0,className:"mt-200 cursor-pointer rounded-full border-0 bg-font-body px-400 py-200 font-fontFamilyTertiary text-4xs font-semibold text-font-body-inverted",onClick:e,children:"Revenir à la recherche"})]})}const xe="in-page-search";function ie(e,t,n){me({event:"search-ai-turn","search-location":xe,"search-query":e,"ai-tur
2n-rank":t,"ai-entry-path":n})}function cr(e){me({event:"search-ai-source-click","search-location":xe,position:e})}function ur(e,t,n){me({event:"search-ai-abandon","search-location":xe,"search-query":e,"ai-turn-rank":t,"ai-phase":n})}function dr(e,t){me({event:"search-ai-error","search-location":xe,"search-query":e,"ai-error-code":t})}const Tn=30*24*60*60*1e3,An=10,Ln="v1";function at(){return`humanoid:ai-conversations:${Ln}:${G()}`}function In(e){if(e===null||typeof e!="object")return!1;const{scope:t,id:n}=e;return typeof t=="string"&&(typeof n=="number"||typeof n=="string")}function We(e,t){if(!Array.isArray(e))return;const n=e.filter(t);return n.length>0?n:void 0}function On(e){return typeof e=="string"}function Pn(e){if(e===null||typeof e!="object")return null;const{role:t,content:n,createdAt:s,sources:i,related:l,interrupted:u}=e;if(t!=="user"&&t!=="assistant"||typeof n!="string")return null;const m={role:t,content:n};typeof s=="number"&&(m.createdAt=s);const y=We(i,In);y&&(m.sources=y);const w=We(l,On);return w&&(m.related=w),u===!0&&(m.interrupted=!0),m}function Mn(e){if(e===null||typeof e!="object")return null;const{id:t,messages:n,createdAt:s,updatedAt:i}=e;if(typeof t!="string"||t===""||typeof s!="number"||typeof i!="number"||!Array.isArray(n))return null;const l=n.map(Pn);return l.some(u=>u===null)?null:{id:t,messages:l,createdAt:s,updatedAt:i}}function $n(e){return Array.isArray(e)?e.map(Mn).filter(t=>t!==null):null}function Ie(e){return(Ct(et(),at(),$n)??[]).filter(n=>e-n.updatedAt<Tn).sort((n,s)=>s.updatedAt-n.updatedAt)}function Ce(e,t=Date.now()){return Ie(t).find(n=>n.id===e)??null}function Qe(e){return e.trim().replace(/\s+/gu," ").toLowerCase()}function Fn(e,t=Date.now()){const n=Qe(e);return n===""?null:Ie(t).find(s=>{const i=s.messages[0];return(i==null?void 0:i.role)==="user"&&Qe(i.content)===n})??null}function fr(e,t=Date.now()){const n=Ie(t).filter(i=>i.id!==e.id),s=[e,...n].sort((i,l)=>l.updatedAt-i.updatedAt).slice(0,An);Nt(et(),at(),s)}const Dn=a.lazy(()=>jt(()=>import("./AiConversationBody-BJjAx7GK.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11])).catch(()=>({default:Nn}))),Bn=r.jsx("div",{className:"py-1000","aria-hidden":"true"}),Ke="Continuer la conversation…",qn={width:"auto",minWidth:0},lt={left:"calc(50% - 50vw)",right:"calc(50% - 50vw)"},zn="(min-width: 22.5rem)",Ne={conversationId:"",questions:[]};function Vn(e){return e.id===void 0||e.keyword===""||!te()||Ce(e.id)!==null?Ne:{conversationId:e.id,questions:[e.keyword]}}function ae(e){return te()&&e.id===void 0&&e.keyword!==""&&Re(e.keyword)==="ai"}const Se=2,ke=10,Ge=5,Ye=120,Je=320;function ct(e,t){return`${e}-tab-${t}`}function ut(e,t){return`${e}-panel-${t}`}function Hn(e){a.useEffect(()=>{if(!e)return;let t=null,n="";const s=y=>{t=y,n=y.style.position,y.style.position="static"},i=()=>document.querySelector('header[data-site-header="sticky"]'),l=new MutationObserver(()=>{const y=i();y&&(l.disconnect(),s(y))}),u=i();let m=null;return u?s(u):(l.observe(document.body,{childList:!0,subtree:!0}),m=window.setTimeout(()=>l.disconnect(),1e4)),()=>{m!==null&&window.clearTimeout(m),l.disconnect(),t&&(t.style.position=n)}},[e])}function Te(){return Mt[G()]}function Un(){return $t[G()]}function je(e,t,n,s){return`/search/results?keyword=${encodeURIComponent(e)}&sources=${t}&page=${n}&per_page=${s}`}function Xe(e){return`/search/terms?keyword=${encodeURIComponent(e)}`}function Ze(e){const t={};for(const[n,s]of Object.entries(e.scopes))t[n]=s.total;return t[P]=Object.values(e.scopes).reduce((n,s)=>n+s.total,0),e.terms&&(t[de]=ht(e.terms).reduce((n,s)=>n+s.items.length,0)),t}function dt(){if(typeof document>"u")return!1;const e=document.querySelector('.bn-dock[data-search="open"]');return e!==null&&getComputedStyle(e).display!=="none"}let fe=!1;const ue=new Set;function _e(){const e=dt();if(e!==fe){fe=e;for(const t of ue)t()}}function Wn(e){if(typeof document>"u")return()=>{};ue.size===0&&(fe=dt()),ue.add(e);const t=new MutationObserver(_e);t.observe(document.body,{subtree:!0,attributes:!0,attributeFilter:["data-search"]});const n=window.matchMedia(Le);return n.addEventListener("change",_e),()=>{t.disconnect(),n.removeEventListener("change",_e),ue.delete(e)}}function Qn(){return fe}function Kn(){return a.useSyncExternalStore(Wn,Qn,()=>!1)}
2function le(e){Ae(document.querySelector(".bn-dock form input"),e),Ae(document.querySelector(mt),e)}function ft(){const e=document.querySelector('.bn-dock[data-search="open"] form input');if(e===null)return null;const t=e.closest(".bn-dock");return t!==null&&getComputedStyle(t).display==="none"?null:e}const mt="[data-search-field] input";function ne(e){const t=ft();Ae(t??document.querySelector(mt),e)}function Ae(e,t){!e||e.value===t||(e.value=t,e.dispatchEvent(new Event("input",{bubbles:!0})))}function Gn({variant:e="page",originUrl:t,onRequestClose:n}){const[s,i]=a.useState(()=>ge(window.location.search)),[l,u]=a.useState(null),[m,y]=a.useState("idle"),[w,R]=a.useState(()=>Vn(s)),[h,p]=a.useState(null),b=a.useCallback((o,c)=>{const S=Fn(o);if(S!==null){p({id:S.id,keyword:o}),R({conversationId:S.id,questions:[]});return}const j=we();ie(o,1,c),p({id:j,keyword:o}),R({conversationId:j,questions:[o]})},[]),k=a.useRef(w);k.current=w;const[v,M]=a.useState(!1),T=a.useId().replace(/:/g,"_"),$=a.useRef(null),L=a.useRef(new Set),q=a.useRef(null);Hn(e==="page");const d=Kn(),g=Ee(Le),[E]=a.useState(un),_=a.useCallback(async o=>{q.current=o,y("loading");try{const c=ce(Xe(o)).catch(()=>null),S=await ce(je(o,Te().join(","),1,ke)),j=await c;if(q.current!==o)return;const O={};for(const[B,V]of Object.entries(S.sources))O[B]={items:V.items,total:V.total,maxPages:V.max_pages,loadedPages:1};const z={keyword:o,scopes:O,terms:(j==null?void 0:j.terms)??null};u(z),y("ready"),$.current!==o&&($.current=o,Tt(o,Ze(z)))}catch{if(q.current!==o)return;y("error")}},[]),f=te()?s.id??(h!==null&&ae(s)&&h.keyword===s.keyword?h.id:null):null,x=f!==null,C=w.conversationId===f?w.questions:Ne.questions,I=w.conversationId===f&&w.questions.length===0,ye=a.useMemo(()=>f!==null&&C.length===0&&!I&&Ce(f)===null,[f,C.length,I]);a.useEffect(()=>{x||ae(s)||s.keyword.length>=Se&&_(s.keyword)},[x,s.keyword,_]),a.useEffect(()=>{const o=()=>{const c=ge(window.location.search);if(i(c),ae(c)){b(c.keyword,"address"),le("");return}le(c.id!==void 0?"":c.keyword)};return window.addEventListener("popstate",o),()=>window.removeEventListener("popstate",o)},[b]),a.useLayoutEffect(()=>{const o=ge(window.location.search);if(ae(o)){b(o.keyword,"address"),ne(""),Z(o.keyword,Date.now(),"ai");return}te()&&o.id!==void 0&&o.keyword!==""&&Z(o.keyword,Date.now(),"ai",o.id)},[]);const N=a.useCallback(o=>{window.history.pushState({},"",ve(o)),i(o)},[]),X=a.useCallback(o=>{At(s.keyword,o),N({keyword:s.keyword,tab:o})},[N,s.keyword]),F=a.useRef(null),H=a.useCallback((o,c)=>{var S;(S=F.current)==null||S.call(F,o,c)},[]),D=a.useCallback((o,c="plain",S="input")=>{if(f!==null){if(v)return;if(s.id===void 0){const z={...s,id:f};window.history.replaceState({},"",ve(z)),i(z),Z(s.keyword,Date.now(),"ai",f)}const j=k.current,O=(j.conversationId===f?j.questions.length:0)+1;ie(o,O,S),R(j.conversationId===f?{conversationId:f,questions:[...j.questions,o]}:{conversationId:f,questions:[o]}),ne("");return}if(M(!1),te()&&(c==="ai"||Re(o)==="ai")){if(ne(""),Re(o)==="ai"){if(Z(o,Date.now(),"ai"),S==="history-row")b(o,"history-row");else{const O=we();ie(o,1,S),p({id:O,keyword:o}),R({conversationId:O,questions:[o]})}ee(()=>N({keyword:o,tab:P}));return}const j=we();ie(o,1,S),R({conversationId:j,questions:[o]}),Z(o,Date.now(),"ai",j),ee(()=>N({keyword:o,id:j,tab:P}));return}Z(o,Date.now(),c),ee(()=>N({keyword:o,tab:P}))},[v,N,b,f,s]);a.useEffect(()=>{if(!d)return;const o=c=>{c.preventDefault(),D(c.detail)};return window.addEventListener(Be,o),()=>window.removeEventListener(Be,o)},[d,D]),a.useEffect(()=>{const o=d?ft():null;if(!o)return;const c=o.placeholder;return x&&(o.placeholder=Ke),o.disabled=x&&v,()=>{o.placeholder=c,o.disabled=!1}},[v,x,d]);const xt=a.useCallback(o=>{He(Xe(o)),He(je(o,Te().join(","),1,ke))},[]),Pe=a.useCallback((o,c)=>{M(!1),ne(""),ee(()=>N({keyword:o,id:c,tab:P}))},[N]),yt=a.useCallback((o,c)=>{if(Lt(o,c.kind,c.position),c.conversationId&&te()){Pe(o,c.conversationId);return}ne(o),D(o,c.origin??(c.kind==="ai"?"ai":"plain"),c.kind==="history"?"history-row":"trend-card")},[Pe,D]),Me=a.useRef(null);Me.current=l;const bt=a.useCallback(async o=>{const c=Me.current,S=c==null?void 0:c.scopes[o];if(!(!c||!S||S.loadedPages>=S.maxPages)&&!L.current.has(o)){L.current.add(o);try{const j=S.loadedPages+1,z=(await ce(je(c.keyword,o,j,ke))).sources[o];if(!z)return;u(B=>{if(!B||B.keyword!==c.keyword)return B;const V=B.scopes[o];return!V||V.loadedPages!==S.loadedPages?B:{...B,scopes:{...B.scopes,[o]:{...V,items:[...V.items,...z.items],loadedPages:j}}}})}catch{}finally{L.current.delete(o)}}},[]),gt=a.useCallback(()=>{_(s.keyword)},[_,s.keyword]),be=a.useCallback(()=>{var o;M(!1),ee(()=>N({keyword:"",tab:P})),le(""),window.scrollTo(0,0),(o=document.getElementById("react-search-overlay"))==null||o.scrollTo(0,0)},[N]),wt=a.useCallback(()=>
2{if(s.keyword.length>=Se){ee(()=>{const c={keyword:"",tab:P};window.history.pushState(It,"",t??ve(c)),i(c),le(c.keyword)});return}n?n():window.location.assign("/")},[n,t,s.keyword]),A=l!==null&&l.keyword===s.keyword?l:null,U=a.useMemo(()=>A?Ze(A):null,[A]),$e=a.useMemo(()=>{if(!A||!U)return[];const o=Un().filter(c=>c===de?A.terms!==null:A.scopes[c]!==void 0);return[P,...o.filter(c=>U[c]>0||c===s.tab)]},[A,U,s.tab]),W=s.keyword.length>=Se;a.useEffect(()=>{const o=x?"conversation":"plain";return window.dispatchEvent(new CustomEvent(qe,{detail:o})),()=>{window.dispatchEvent(new CustomEvent(qe,{detail:"plain"}))}},[x]),a.useEffect(()=>{!x&&!W||window.dispatchEvent(new CustomEvent(Ot,{detail:{value:x?"":s.keyword}}))},[x,W,s.keyword]);const Fe=a.useMemo(()=>{var c,S;const o=kt[G()];if(f!==null){const j=((S=(c=Ce(f))==null?void 0:c.messages.find(O=>O.role==="user"))==null?void 0:S.content)??C[0];return j?`${j} — Conversation — ${o}`:`Conversation — ${o}`}return W?`Résultats pour « ${s.keyword} » — ${o}`:`Recherche — ${o}`},[C,W,f,s.keyword]);a.useEffect(()=>{const o=document.title;return document.title=Fe,()=>{document.title=o}},[Fe]);const vt=f!==null?r.jsx(a.Suspense,{fallback:Bn,children:r.jsx(Dn,{conversationId:f,questions:C,onBusyChange:M,onSelectRelated:o=>D(o,"plain","follow-up"),onRestart:be,onNewConversation:be,justOpened:I},f)}):W?St():E?r.jsx(Pt,{onSelect:yt,onPrefetch:xt}):r.jsx("p",{className:"py-800 text-center text-font-body",children:"Saisissez une recherche d’au moins deux caractères."}),De=r.jsx(Bt,{onSubmit:D,clearable:!0,shape:"glass",glyph:x?"ai":"search",autoFocus:e==="overlay"&&g,initialValue:x?"":void 0,placeholder:x?Ke:void 0,disabled:x&&v});return r.jsxs("section",{"aria-label":x?"Recherche":W?`Résultats de recherche pour ${s.keyword}`:"Recherche",className:`mx-auto w-full max-w-[48rem] text-left ${J.surface}`,children:[r.jsx(Yn,{title:x?"Recherche":W?"Résultats":"Recherche",onClose:wt,onNewConversation:x&&!ye?be:void 0,sticky:x,showClose:e==="overlay"||x,field:!d&&g?De:void 0}),vt,!d&&!g&&r.jsx("div",{className:"sticky bottom-400 z-20 mt-600 pt-400","data-search-field":!0,children:De})]});function St(){return r.jsxs(r.Fragment,{children:[U!==null&&r.jsxs("div",{className:"isolate sticky top-0 z-10 -mx-300",children:[r.jsx(tt,{height:"calc(100% + 24px)",className:"z-[1]",style:lt}),r.jsx(Jn,{counts:U,tabs:$e,activeTab:s.tab,idBase:T,onSelect:X,progressRef:F})]}),m==="loading"&&A===null&&r.jsx("div",{className:"py-1000",children:r.jsx(on,{site:G(),label:"Recherche en cours…",ariaLabel:"Chargement des résultats"})}),m==="error"&&r.jsxs("div",{role:"alert",className:"flex flex-col items-center gap-300 py-800 text-center",children:[r.jsx("p",{className:"m-0 font-fontFamilyTertiary text-3xs text-font-body",children:"Une erreur est survenue pendant la recherche."}),r.jsx("button",{type:"button",className:"cursor-pointer rounded-full border-0 bg-font-body px-400 py-200 font-fontFamilyTertiary text-4xs font-semibold text-font-body-inverted",onClick:gt,children:"Réessayer"})]}),r.jsx("p",{"aria-live":"polite",className:"sr-only",children:A!==null&&U!==null?`${he[s.tab]??s.tab} : ${U[s.tab]??0} résultats`:""}),A&&m!=="error"&&r.jsx(Xn,{store:A,tabs:$e,activeTab:s.tab,idBase:T,onSelectTab:X,onLoadMore:bt,onDragProgress:H})]})}}function Yn({title:e,onClose:t,onNewConversation:n,sticky:s=!1,showClose:i=!0,field:l}){const u=Ee(zn),m=Ee(Le),y=s||l!==void 0,w=l!==void 0&&r.jsx("div",{className:"relative z-[2] px-300 pb-200","data-search-field":!0,children:l}),R=r.jsx("button",{type:"button","aria-label":"Fermer la recherche","data-search-close":"",onClick:t,className:`flex h-[3rem] w-[3rem] shrink-0 cursor-pointer items-center justify-center rounded-full border-0 text-font-body focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary ${J.closeGlass}`,children:r.jsx(Y,{name:"arrow-left",size:24,color:"inherit"})}),h=r.jsx("h1",{className:"m-0 flex h-[3rem] grow items-center pl-300 text-left font-fontFamilyPrimary font-dynamicWeight text-m leading-l text-font-body",children:e}),p=`${J.headerBlock} mb-300 ${y?"isolate sticky top-0 z-20 -mx-300":""}`,b=y?r.jsx(tt,{height:"calc(100% + 16px)",className:"z-[1]",style:lt}):null;if(n){const k=r.jsx(Ft,{variant:"question",label:"Nouvelle conversation",icon:r.
2jsx(Y,{name:"plus",size:24,color:"inherit"}),onClick:n,showLabel:u,lift:!1,style:qn,"data-ai-new-conversation-button":""});return r.jsxs(r.Fragment,{children:[!m&&r.jsx("h1",{className:"sr-only",children:e}),r.jsxs("div",{className:p,children:[b,r.jsx("div",{className:"relative z-[2] flex items-center justify-between gap-300 px-300 py-200",children:m?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex min-w-0 grow items-center gap-300",children:[R,h]}),k]}):r.jsxs(r.Fragment,{children:[R,k]})}),w]})]})}return r.jsxs("div",{className:p,children:[b,r.jsxs("div",{className:`relative z-[2] flex items-center gap-300 ${y?"px-300":""}`,style:{minHeight:"4rem"},children:[i&&R,h]}),w]})}function Jn({counts:e,tabs:t,activeTab:n,idBase:s,onSelect:i,progressRef:l}){const u=a.useRef(new Map),m=a.useRef(null),y=a.useRef(n);y.current=n,a.useEffect(()=>{const h=(p,b)=>{const k=m.current;let v=null;t.forEach((M,T)=>{const $=u.current.get(M);if(!$)return;const L=b?T===b[0]?1-p:T===b[1]?p:0:Math.max(0,1-Math.abs(p-T));if($.style.setProperty("--chip-active",String(L)),L>0){const q=$.offsetLeft+$.offsetWidth/2;v=v===null?q*L:v+q*L}}),k&&v!==null&&(k.scrollLeft=v-k.clientWidth/2)};return l.current=h,h(t.indexOf(y.current)),()=>{l.current===h&&(l.current=null)}},[l,t]);const w=a.useCallback((h,p)=>{p?u.current.set(h,p):u.current.delete(h)},[]),R=a.useCallback(h=>{var v;const p=h.key==="ArrowRight"?1:h.key==="ArrowLeft"?-1:0;let b;if(p!==0)b=(t.indexOf(n)+p+t.length)%t.length;else if(h.key==="Home")b=0;else if(h.key==="End")b=t.length-1;else return;h.preventDefault();const k=t[b];k!==n&&(i(k),(v=u.current.get(k))==null||v.focus())},[n,i,t]);return r.jsx("div",{ref:m,role:"tablist","aria-label":"Types de résultats",onKeyDown:R,className:"relative z-[2] flex gap-200 overflow-x-auto px-300 py-200 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:t.map(h=>{const p=h===n,b=he[h]??h,k=e[h]??0;return r.jsxs("button",{ref:v=>w(h,v),type:"button",role:"tab",id:ct(s,h),"aria-selected":p,"aria-controls":ut(s,h),tabIndex:p?0:-1,"aria-label":`${b}, ${k} résultats`,className:`${J.chip} flex h-[2.5rem] shrink-0 cursor-pointer items-center justify-center gap-150 whitespace-nowrap rounded-full border-0 py-0 pl-300 pr-[0.5625rem] font-fontFamilyTertiary text-4xs font-semibold leading-5xs focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary`,style:{"--chip-active":p?1:0},onClick:()=>i(h),children:[r.jsx("span",{children:b}),r.jsx("span",{className:`${J.chipCount} inline-flex h-[1.3125rem] flex-col items-center justify-center rounded-full px-100 text-5xs font-semibold leading-none`,children:k})]},h)})})}function Xn({store:e,tabs:t,activeTab:n,idBase:s,onSelectTab:i,onLoadMore:l,onDragProgress:u}){const m=a.useRef(null),y=a.useRef(new Map),w=a.useRef(null),R=a.useRef(!1),h=a.useRef(null),p=a.useRef(null),b=a.useRef(null),k=a.useCallback(()=>{p.current!==null&&(window.cancelAnimationFrame(p.current),p.current=null),b.current!==null&&(window.clearTimeout(b.current),b.current=null);const d=m.current;d!==null&&(d.style.scrollSnapType="")},[]);a.useEffect(()=>{const d=m.current,g=y.current.get(n);if(!d||!g)return;const E=g.offsetLeft-d.offsetLeft,_=d.scrollLeft;k();const f=!R.current;if(R.current=!0,Math.abs(_-E)<=1)return;if(f||window.matchMedia("(prefers-reduced-motion: reduce)").matches){d.scrollLeft=E;return}d.style.scrollSnapType="none";let x=t.indexOf(n),C=Number.POSITIVE_INFINITY;t.forEach((X,F)=>{const H=y.current.get(X);if(!H)return;const D=Math.abs(H.offsetLeft-d.offsetLeft-_);D<C&&(C=D,x=F)});const I=[x,t.indexOf(n)],ye=performance.now(),N=X=>{const F=Math.min(1,Math.max(0,(X-ye)/Je)),H=1-(1-F)**3;if(d.scrollLeft=_+(E-_)*H,I[0]!==-1&&I[1]!==-1&&u(H,I),F<1){p.current=window.requestAnimationFrame(N);return}p.current=null,b.current!==null&&(window.clearTimeout(b.current),b.current=null),d.style.scrollSnapType=""};p.current=window.requestAnimationFrame(N),b.current=window.setTimeout(()=>{b.current=null,p.current!==null&&(window.cancelAnimationFrame(p.current),p.current=null,d.scrollLeft=E,d.style.scrollSnapType="",I[0]!==-1&&I[1]!==-1&&u(1,I))},Je+Ye)},[n,u,k,t]),a.useEffect(()=>()=>{w.current!==null&&window.clearTimeout(w.current),v.current!==null&&window.cancelAnimationFrame(v.current),p.current!==null&&window.cancelAnimationFrame(p.current),b.current!==null&&window.clearTimeout(b.current)},[]);const v=a.useRef(null),M=a.useCallback(()=>{p.current===null&&v.current===null&&(v.current=window.requestAnimationFrame(()=>{v.current=null;const d=m.current;if(!d)return;const g=t.map(f=>{const x=y.current.get(f);return x?x.offsetLeft-d.offsetLeft:null}),E=d.scrollLeft;let _=null;for(let f=0;f<g.length;f++){const x=g[f],C=g[f+1];if(x!==null&&(C==null||E<C)){_=C!=null&&C>x?f+Math.min(1,Math.max(0,(E-x)/(C-x))):f;break}}_!==null&&u(_)}))},[u,t]),T=a.useCallback(()=>{const d=m.current;if(!d)return null;let g=null;for(const[E,_]of y.current){const f=Math.abs(_.offsetLeft-d.offsetLeft-d.scrollLeft);(!g||f<g.distance)&&(g={tab:E,distance:f})}return(g==null?void 0:g.tab)??null},[]),$=a.useCallback(()=>{k(),h.current=T()},[T,k]),L=a.useCallback(()=>{m.current!==null&&(M(),w.current!==null&&window.clearTimeout(w.current),w.current=window.setTimeout(()=>{if(w.current=null,p.current!==null)return;const g=h.current;h.current=null;const E=T();if(E===null||E===n)return;let _=E;if(g!==null){const f=t.indexOf(g),x=t.indexOf(_);f!==-1&&x!==-1&&Math.abs(x-f)>1&&(_=t[f+Math.sign(x-f)])}_!==n&&i(_)},Ye))},[n,T,i,M,t]),q=a.useCallback((d,g)=>{g?y.current.set(d,g):y.current.delete(d)},[]);return r.jsx("div",{ref:m,onScroll:L,onTouchStart:$,className:`${J.panelStrip} -mx-300 mt-300 flex snap-x snap-mandatory overflow-x-auto overscroll-x-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:t.map(d=>{const g=d===n;return r.jsxs("section",{ref:E=>q(d,E),"data-search-panel":d,role:"tabpanel",id:ut(s,d),"aria-labelledby":ct(s,d),tabIndex:g?0:void 0,inert:!g,className:`box-border w-full shrink-0 basis-full snap-center snap-always px-300 ${g?"":"pointer-events-none max-h-screen overflow-hidden"}`,children:[d===P&&r.jsx(Zn,{store:e,onSelectTab:i}),d===de&&e.terms&&r.jsx(nr,{keyword:e.keyword,terms:e.terms}),d!==P&&d!==de&&e.scopes[d]&&r.jsx(er,{scope:d,data:e.scopes[d],keyword:e.keyword,active:g,onLoadMore:l})]},d)})})}const Zn=a.memo(function({store:t,onSelectTab:n}){const s=Te().map(i=>({scope:i,data:t.scopes[i]})).filter(i=>i.data!==void 0&&i.data.items.length>0);return s.length===0?r.jsx(Oe,{keyword:t.keyword}):r.jsx("div",{className:"flex flex-col gap-300",children:s.map(({scope:i,data:l})=>{const u=he[i]??i;return r.jsxs("div",{className:"flex flex-col gap-300",children:[r.jsx(ot,{action:l.total>Ge?{count:l.total,noun:u.toLowerCase(),onClick:()=>n(i)}:void 0,children:u}),r.jsx(pt,{items:l.items.slice(0,Ge),scope:i,keyword:t.keyword,ariaLabel:u})]},i)})})}),er=a.memo(function({scope:t,data:n,keyword:s,active:i,onLoadMore:l}){const u=a.useRef(null),m=n.loadedPages<n.maxPages;return a.useEffect(()=>{const y=u.current;if(!i||!m||!y)return;const w=new IntersectionObserver(R=>{R.some(h=>h.isIntersecting)&&l(t)},{rootMargin:"200px"});return w.observe(y),()=>w.disconnect()},[i,m,t,l]),n.items.length===0?r.jsx(Oe,{keyword:s}):r.jsxs("div",{children:[r.jsx(pt,{items:n.items,scope:t,keyword:s,ariaLabel:he[t]??t}),m&&r.jsx("div",{ref:u,role:"status",className:"py-400 text-center text-font-body",children:"Chargement…"})]})});function ht(e){return tr.map(t=>({...t,items:e.items.filter(n=>n.kind===t.kind).slice(0,t.limit??1/0)})).filter(t=>t.items.length>0)}const tr=[{kind:"brand",label:"Marques"},{kind:"category",label:"Catégories",limit:5},{kind:"tag",label:"Tags"}],nr=a.memo(function({keyword:t,terms:n}
2){if(n.items.length===0)return r.jsx(Oe,{keyword:t});const s=ht(n);return r.jsx("div",{className:"flex flex-col gap-300",children:s.map(i=>r.jsxs("div",{className:"flex flex-col gap-300",children:[r.jsx(ot,{children:i.label}),r.jsx(nt,{ariaLabel:i.label,children:i.items.map(l=>r.jsx(re,{href:l.link??void 0,title:l.kind==="brand"?l.name:`#${l.name}`},`${l.kind}-${l.slug}`))})]},i.kind))})});function pt({items:e,scope:t,keyword:n,ariaLabel:s}){return r.jsx(nt,{ariaLabel:s,className:J.results,children:e.map((i,l)=>r.jsx(bn,{item:i,viewScope:t,onClick:()=>Dt(n,t,l+1)},`${i.scope}-${i.id}`))})}function Oe({keyword:e}){return r.jsxs("div",{className:"flex flex-col items-center gap-200 py-800 text-center",children:[r.jsx(Y,{name:"magnifying-glass",size:32,color:"indicator"}),r.jsx("p",{className:"m-0 font-fontFamilyTertiary text-3xs font-semibold text-font-body",children:`Aucun résultat pour « ${e} »`}),r.jsx("p",{className:"m-0 font-fontFamilyTertiary text-4xs text-font-indicator",children:"Essayez un autre mot-clé ou une orthographe différente."})]})}const mr=Object.freeze(Object.defineProperty({__proto__:null,default:Gn},Symbol.toStringTag,{value:"Module"}));export{ot as S,bn as a,dr as b,ur as c,mr as d,Ce as r,fr as s,cr as t};

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.