1import{r as m,j as e,aZ as w,bb as S,a_ as C,a$ as E,b0 as P,b_ as L,t as j,f as y}from"./index-Cg7byhA6.js";import{T as A,a as D,b as O,c as R}from"./tabs-C7cpb3cN.js";import{u as B,f as M,g as H,P as u,I as V,a as $}from"./affiliateDeeplinkClassify-DNhUXJGh.js";import{A as v}from"./arrow-up-right-OlPvhNV2.js";const q=({city:l,surface:n="unknown",label:p,variant:x="pill",defaultIntent:s})=>{const{links:o,loading:a}=B(),[t,N]=m.useState(!1),b=m.useMemo(()=>M(o,l),[o,l]),d=m.useMemo(()=>H(b),[b]),i=m.useMemo(()=>Object.keys(d).sort((r,c)=>(u[r]||r).localeCompare(u[c]||c)),[d]),k=m.useMemo(()=>{var g;if(!s||i.length===0)return i[0];let r=i[0],c=-1;for(const h of i){const f=((g=d[h][s])==null?void 0:g.length)??0;f>c&&(r=h,c=f)}return r},[i,d,s]);if(a||i.length===0)return null;const T=r=>{N(r),r&&j("travel_deals_open",{properties:{surface:n,city:l||"global",default_intent:s||null}})},_=x==="inline"?e.jsxs("button",{type:"button",className:"group inline-flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-2.5 text-sm font-semibold transition hover:border-primary hover:bg-accent/40",children:[e.jsx(y,{className:"h-4 w-4 text-primary"}),p||"Travel deals",e.jsx(v,{className:"h-4 w-4 text-muted-foreground transition group-hover:translate-x-0.5 group-hover:text-primary"})]}):e.jsxs("button",{type:"button",className:"group inline-flex items-center gap-1.5 rounded-full border border-primary/30 bg-primary/5 px-3.5 py-1.5 text-xs font-bold uppercase tracking-wider text-primary transition hover:bg-primary/10",children:[e.jsx(y,{className:"h-3.5 w-3.5"}),p||"Travel deals"]});return e.jsxs(w,{open:t,onOpenChange:T,children:[e.jsx(S,{asChild:!0,children:_}),e.jsxs(C,{side:"bottom",className:"h-[85vh] overflow-y-auto sm:max-w-3xl sm:mx-auto",children:[e.jsxs(E,{className:"text-left",children:[e.jsx(P,{className:"font-display text-xl font-extrabold",children:"Travel deals from our partners"}),e.jsx(L,{className:"text-xs",children:"Hand-picked offers from trusted travel sites. We may earn a commission if you book â at no extra cost to you."})]}),e.jsxs(A,{defaultValue:k,className:"mt-4",children:[e.jsx(D,{className:"h-auto flex-wrap justify-start gap-1 bg-transparent p-0",children:i.map(r=>e.jsx(O,{value:r,className:"rounded-full border border-border bg-card data-[state=active]:border-primary data-[state=active]:bg-primary/10 data-[state=active]:text-primary",children:u[r]||r},r))}),i.map(r=>e.jsx(R,{value:r,className:"mt-4 space-y-5",children:e.jsx(F,{provider:r,grouped:d[r],surface:n,city:l,emphasizeIntent:s})},r))]})]})]})},F=({provider:l,grouped:n,surface:p,city:x,emphasizeIntent:s})=>{const o=V.filter(a=>{var t;return(((t=n[a])==null?void 0:t.length)??0)>0});return s&&o.includes(s)&&(o.splice(o.indexOf(s),1),o.unshift(s)),o.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No deals available right now."}):e.jsxs(e.Fragment,{children:[o.map(a=>e.jsxs("section",{className:a===s?"rounded-lg border border-primary/30 bg-primary/5 p-3":"",children:[e.jsxs("h3",{className:`mb-2 text-[11px] font-bold uppercase tracking-widest ${a===s?"text-primary":"text-muted-foreground"}`,children:[$[a],a===s?" · best match":""]}),e.jsx("ul",{className:"grid gap-1.5",children:n[a].map(t=>e.jsx("li",{children:e.jsxs("a",{href:t.click_url,target:"_blank",rel:"noopener noreferrer sponsored",onClick:()=>j("affiliate_deeplink_click",{properties:{provider:l,intent:a,link_id:t.link_id,link_name:t.name,surface:p,city:x||"global"}}),className:"group flex items-center gap-3 rounded-lg border border-border bg-card px-3 py-2.5 transition hover:border-primary hover:bg-accent/40",children:[e.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:t.name}),e.jsx(v,{className:"h-4 w-4 shrink-0 text-muted-foreground transition group-hover:translate-x-0.5 group-hover:text-primary"})]})},t.id))})]},a)),e.jsxs("p",{className:"pt-2 text-[10px] text-muted-foreground",children:["Sponsored â links may earn us a commission. Prices and availability set by ",u[l]||l,"."]})]})};export{q 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.