1import{a as ft,J as we,j as e,K as ue,P as W,Q as bt,R as jt,T as _e,U as xe,r as m,V as Ct,B as q,M as he,v as ye,W as Ye,X as ms,Y as vt,Z as Ne,_ as ce,$ as Ve,a0 as St,a1 as Lt,a2 as Tt,a3 as Gt,a4 as ie,a5 as us,a6 as xs,a7 as Rt,x as E,a8 as We,a9 as It,p as oe,aa as me,ab as ze,ac as se,ad as ae,ae as re,af as Je,s as _t,ag as wt,ah as le,ai as Bt,aj as Pt,ak as Ot,al as de,am as hs,an as ps,ao as pe,ap as ge,aq as fe,ar as gs,as as yt,O as ut,at as fs,i as bs,au as js,av as Ft,aw as Dt,ax as je,ay as ve,N as Xe,az as vs,w as V,aA as Mt,aB as _s,H as ws,y as Nt,aC as qt,aD as zt,aE as Vt,aF as Ut,aG as Ht,aH as $t,aI as ys}from"./index-BGFlaWMN.js";import{L as Ns}from"./languages-zNEOoZdq.js";import{g as ks}from"./sessionUtils-CtkvT435.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const Cs=ft("CloudSun",[["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}],["path",{d:"M15.947 12.65a4 4 0 0 0-5.925-4.128",key:"dpwdj0"}],["path",{d:"M13 22H7a5 5 0 1 1 4.9-6H13a3 3 0 0 1 0 6Z",key:"s09mg5"}]]);/** 7 * @license lucide-react v0.462.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */const Ss=ft("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/** 12 * @license lucide-react v0.462.0 - ISC 13 * 14 * This source code is licensed under the ISC license. 15 * See the LICENSE file in the root directory of this source tree. 16 */const Ls=ft("Route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]),Ts=({location:t,allGuides:s,allLocalGuides:r,allInternationalGuides:n,verifiedReviewCount:a=0})=>{const u=we(),c=[t.country];return t.region&&c.unshift(t.region),e.jsxs("section",{className:"relative min-h-[430px] overflow-hidden bg-foreground",children:[t.image_url&&e.jsx("img",{src:t.image_url,alt:"",className:"absolute inset-0 h-full w-full object-cover"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-foreground
16/90 via-foreground/60 to-foreground/20"}),e.jsxs("div",{className:`relative mx-auto flex min-h-[430px] max-w-7xl flex-col justify-end px-4 sm:px-6 lg:px-8 ${u?"py-8":"py-12"}`,children:[e.jsx("p",{className:"mb-auto text-sm font-semibold text-primary-foreground/80",children:c.join(" · ")}),e.jsxs("div",{className:"max-w-3xl",children:[e.jsxs("div",{className:"mb-4 inline-flex items-center gap-2 rounded-md bg-background/90 px-3 py-1.5 text-xs font-bold uppercase text-primary",children:[e.jsx(ue,{className:"h-4 w-4"}),a.toLocaleString()," verified ",a===1?"review":"reviews"]}),e.jsx("h1",{className:`${u?"text-4xl":"text-5xl md:text-6xl"} font-extrabold text-primary-foreground leading-tight`,children:t.name}),e.jsxs("p",{className:"mt-4 max-w-2xl text-lg leading-7 text-primary-foreground/90",children:["Explore trusted guides, independent reviews and local expertise for ",t.name,"."]})]}),e.jsxs("div",{className:"mt-9 grid grid-cols-2 gap-px overflow-hidden rounded-lg border border-primary-foreground/20 bg-primary-foreground/20 sm:grid-cols-4",children:[t.elevation_m&&e.jsx(qe,{label:"Elevation",value:`${t.elevation_m.toLocaleString()} m`}),e.jsx(qe,{label:"Guides",value:s.length.toLocaleString()}),e.jsx(qe,{label:"Local",value:r.length.toLocaleString()}),e.jsx(qe,{label:"International",value:n.length.toLocaleString()}),e.jsx(qe,{label:"Review proof",value:`${a.toLocaleString()} verified`})]})]})]})},qe=({label:t,value:s})=>
16e.jsxs("div",{className:"bg-foreground/55 px-4 py-4 backdrop-blur-sm",children:[e.jsx("p",{className:"text-[11px] font-bold uppercase text-primary-foreground/60",children:t}),e.jsx("p",{className:"mt-1 text-sm font-bold text-primary-foreground sm:text-base",children:s})]}),ne=t=>({id:t.id,company_name:t.company_name,description:t.description,slogan:t.slogan,average_rating:t.average_rating,total_reviews:t.total_reviews,trust_index:t.trust_index,years_experience:t.years_experience,featured:t.featured,is_priority_placement:t.is_priority_placement,subscription_active:!0,subscription_tier:t.subscription_tier,base_country:t.base_country||"Unknown",operation_scope:"local",certifications:t.certifications||[],languages:t.languages||[],phone:t.phone,website:t.website,has_verified_badge:t.has_verified_badge,guide_images:t.logo_url?[{image_url:t.logo_url,is_logo:!0}]:[],guide_locations:[{price_from:t.price_from,price_to:t.price_to}],logo_url:t.logo_url,created_at:t.created_at,slug:t.slug,price_from:t.price_from,price_to:t.price_to}),Wt=()=>e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"h-6 bg-gray-200 rounded animate-pulse"}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[1,2,3,4].map(t=>e.jsx("div",{className:"h-48 bg-gray-200 rounded animate-pulse"},t))})]}),Kt=({error:t})=>e.jsxs(W,{children:[e.jsx(bt,{children:e.jsx(jt,{className:"text-red-600",children:"Error Loading Guides"})}),e.jsx(_e,{children:e.jsx("p",{children:t})})]}),Gs=({locationName:t})=>{const s=xe(),[r,n]=m.useState(!1),[a,u]=m.useState(!1),[c,x]=m.useState({name:"",email:"",phone:"",travelDate:"",groupSize:"",experienceLevel:"",message:""}),p=async d=>{d.preventDefault(),n(!0);try{const{error:l}=await E.functions.invoke("vetted-guides-inquiry",{body:{...c,locationName:t}});if(l)throw l;u(!0),We.success("Your inquiry has been sent! VettedGuides will contact you within 24 hours.")}catch(l){console.error("Error submitting inquiry:",l),We.error("Failed to send inquiry. Please try again.")}finally{n(!1)}};return a?e.jsxs("div",{className:"text-center py-16",children:[e.jsx("div",{className:"w-20 h-20 mx-auto mb-6 rounded-full bg-green-100 flex items-center justify-center",children:e.jsx(Ct,{className:"h-10 w-10 text-green-600"})}),e.jsx("h3",{className:"text-2xl font-bold text-foreground mb-3",children:"You're All Set!"}),e.jsxs("p",{className:"text-muted-foreground text-lg max-w-md mx-auto mb-6",children:["VettedGuides has received your request and will get back to you within 24 hours with their top guide recommendations for ",t,"."]}),e.jsx(q,{variant:"outline",onClick:()=>s("/destinations"),children:"Explore Other Destinations"})]}):e.jsxs("div",{className:"py-8",children:[e.jsxs("div",{className:"text-center mb-10",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-amber-100 text-amber-800 text-sm font-medium mb-4",children:[e.jsx(he,{className:"h-4 w-4"}),"No Registered Guides Yet"]}),e.jsxs("h2",{className:"text-3xl font-bold text-foreground mb-4",children:["Find Your Perfect Guide for ",t]}),e.jsx("p",{className:"text-muted-foreground text-lg max-w-2xl mx-auto",children:"No registered guides operate here yet. Our partners at VettedGuides can hand-pick an expert for this destination."})]}),e.jsxs(W,{className:"overflow-hidden shadow-lg border-0",children:[e.jsx("div",{className:"bg-gradient-to-r from-sky-600 to-blue-700 p-6 text-white",children:e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("span",{className:"text-2xl font-bold",children:"VettedGuides"}),e.jsx(ye,{variant:"secondary",className:"bg-white/20 text-white border-0",children:"Official Partner"})]}),e.jsx("p",{className:"text-sky-100",children:"Hand-picked guides for the world's greatest adventures"})]}),e.jsxs("a",{href:"https://vettedguides.com",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-sky-100 hover:text-white text-sm",children:["Visit VettedGuides.com",e.jsx(Ye,{className:"h-3 w-3"})]})]})}),e.jsxs(_e,{className:"p-8",children:[e.jsxs("div",{className:"flex flex-wrap justify-center gap-6 mb-8 pb-8 border-b",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx("div",{className:"p-2 rounded-full bg-green-100",children:e.jsx(Ct,{className:"h-4 w-4 text-green-600"})}),e.jsx("span",{className:"text-sm font-medium",children:"100% Free Service"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx("div",{className:"p-2 rounded-full bg-blue-100",children:e.jsx(ms,{className:"h-4 w-4 text-blue-600"})}),e.jsx("span",{className:"text-sm font-medium",children:"Response Within 24hrs"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx("div",{className:"p-2 rounded-full bg-purple-100",children:e.jsx(vt,{className:"h-4 w-4 text-purple-600"})}),e.jsx("span",{className:"text-sm font-medium",children:"Vetted & Verified Guides"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx("div",{className:"p-2 rounded-full bg-orange-100",children:e.jsx(Ne,{className:"h-4 w-4 text-orange-600"})}),e.jsx("span",{className:"text-sm font-medium",children:"Top Guides Only"})]})]}),e.jsxs("div",{className:"max-w-2xl mx-auto",children:[e.jsxs("h3",{className:"text-xl font-semibold text-foreground text-center mb-2",children:["Get Matched with Top Guides for ",t]}),e.jsx("p",{className:"text-muted-foreground text-center mb-6",children:"Fill out this quick form and VettedGuides will personally connect you with their best guides for your adventure."}),e.jsxs("form",{onSubmit:p,className:"space-y-5",children:[e.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"name",children:"Full Name *"}),e.jsx(Ve,{id:"name",placeholder:"John Smith",value:c.name,onChange:d=>x(l=>({...l,name:d.target.value})),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"email",children:"Email Address *"}),e.jsx(Ve,{id:"email",type:"email",placeholder:"[email protected]",value:c.email,onChange:d=>x(l=>({...l,email:d.target.value})),required:!0})]})]}),e.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"phone",children:"Phone Number (Optional)"}),e.jsx(Ve,{id:"phone",type:"tel",placeholder:"+1 (555) 123-4567",value:c.phone,onChange:d=>x(l=>({...l,phone:d.target.value}))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"travelDate",children:"Planned Travel Date"}),e.jsx(Ve,{id:"travelDate",type:"month",value:c.travelDate,onChange:d=>x(l=>({...l,travelDate:d.target.value}))})]})]}),e.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"groupSize",children:"Group Size"}),e.jsxs(St,{value:c.groupSize,onValueChange:d=>x(l=>({...l,groupSize:d})),children:[e.jsx(Lt,{children:e.jsx(Tt,{placeholder:"Select group size"})}),e.jsxs(Gt,{children:[e.jsx(ie,{value:"solo",children:"Solo (1 person)"}),e.jsx(ie,{value:"2-4",children:"Small group (2-4)"}),e.jsx(ie,{value:"5-8",children:"Medium group (5-8)"}),e.jsx(ie,{value:"9+",children:"Large group (9+)"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"experienceLevel",children:"Experience Level"}),e.jsxs(St,{value:c.experienceLevel,onValueChange:d=>x(l=>({...l,experienceLevel:d})),children:[e.jsx(Lt,{children:e.jsx(Tt,{placeholder:"Select experience"})}),e.jsxs(Gt,{children:[e.jsx(ie,{value:"beginner",children:"Beginner"}),e.jsx(ie,{value:"intermediate",children:"Intermediate"}),e.jsx(ie,{value:"advanced",children:"Advanced"}),e.jsx(ie,{value:"expert",children:"Expert"})]})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ce,{htmlFor:"message",children:"Tell Us About Your Plans *"}),e.jsx(us,{id:"message",placeholder:"Share any details about your trip plans, goals, preferences, or questions...",rows:4,value:c.message,onChange:d=>x(l=>({...l,message:d.target.value})),required:!0})]}),e.jsx(q,{type:"submit",className:"w-full h-12 text-base bg-gradient-to-r from-sky-600 to-blue-700 hover:from-sky-700 hover:to-blue-800",disabled:r,children:r?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"animate-spin mr-2",children:"â³"}
16),"Sending..."]}):e.jsxs(e.Fragment,{children:[e.jsx(xs,{className:"h-4 w-4 mr-2"}),"Get My Guide Recommendations"]})}),e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"By submitting, you agree to be contacted by VettedGuides regarding your inquiry. Your information will not be shared with anyone else."})]})]})]})]}),e.jsx(W,{className:"mt-8 border-dashed border-2 bg-muted/30",children:e.jsx(_e,{className:"p-6",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"p-3 rounded-lg bg-primary/10",children:e.jsx(Rt,{className:"h-6 w-6 text-primary"})}),e.jsxs("div",{children:[e.jsx("h4",{className:"font-semibold text-foreground mb-1",children:"Already Know a Guide Company?"}),e.jsx("p",{className:"text-muted-foreground text-sm mb-3",children:"Use our main search bar to find any guide company and read their reviewsâeven if they're not listed on this page."}),e.jsx(q,{variant:"outline",size:"sm",onClick:()=>{s("/"),window.scrollTo({top:0,behavior:"smooth"})},children:"Search All Guides"})]})]})})})]})},Yt=({locationName:t})=>e.jsx(Gs,{locationName:t||"this destination"}),$s=({activeFilter:t,onFilterChange:s,localGuideCount:r,internationalGuideCount:n,topGuideCount:a,totalGuideCount:u,sortBy:c="trust_index",onSortChange:x})=>{const p=[{id:"all",label:"All Guides",count:u},{id:"top",label:"Top Rated",count:a},{id:"local",label:"Local Guides",count:r},{id:"international",label:"International",count:n}];return e.jsxs("div",{"data-south-col":"filters",className:"mb-7 flex flex-col justify-between gap-4 border-b border-border pb-6 lg:flex-row lg:items-end",children:[e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-xs font-bold uppercase text-primary",children:"Guide rankings"}),e.jsx("h2",{className:"text-3xl font-extrabold text-foreground",children:"Guides on this route"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"ERTI combines verified reviews, review recency and profile transparency."})]}),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row",children:[e.jsx("div",{className:"flex flex-wrap items-center gap-1 rounded-md border border-border bg-card p-1",children:p.map(d=>e.jsxs(q,{onClick:()=>s(d.id),variant:"ghost",size:"sm",className:`flex items-center gap-1.5 px-3 py-1.5 text-sm transition-colors 17 ${t===d.id?"bg-secondary text-secondary-foreground hover:bg-secondary/80":"text-muted-foreground hover:bg-accent"} 18 `,children:[e.jsx("span",{children:d.label}),e.jsx(ye,{variant:"outline",className:` 19 text-xs font-semibold px-1.5 py-0 20 ${t===d.id?"bg-white/20 text-white border-white/30":"bg-slate-100 text-slate-500 border-slate-200"} 21 `,children:d.count})]},d.id))}),e.jsxs("label",{children:[e.jsx("span",{className:"sr-only",children:"Sort guides"}),e.jsxs("select",{value:c,onChange:d=>x==null?void 0:x(d.target.value),className:"h-10 min-w-44 rounded-md border border-input bg-card px-3 text-sm font-semibold text-foreground outline-none focus:ring-2 focus:ring-ring",children:[e.jsx("option",{value:"trust_index",children:"Top rated"}),e.jsx("option",{value:"total_reviews",children:"Most reviewed"}),e.jsx("option",{value:"created_at",children:"Newest listed"})]})]})]})]})},As=({guide:t,isDummy:s=!1,onGuideClick:r})=>{var x,p;const n=!!t.trial_ends_at&&new Date(t.trial_ends_at)>new Date,a=t.subscription_tier==="basic"&&!n,u=a?[]:(t.guide_images||[]).filter(d=>!d.is_logo&&d.image_url).slice(0,3),c=a?[]:[t.certifications&&t.certifications.length>0&&{icon:vt,label:"Certified Guides"},t.languages&&t.languages.length>0&&{icon:It,label:"English Speaking"},t.years_experience&&t.years_experience>=1&&{icon:oe,label:`${t.years_experience}+ yrs experience`}].filter(Boolean);return e.jsx(me,{children:e.jsxs(W,{className:`flex items-center p-4 pr-5 transition-all duration-200 ${s?"opacity-80 cursor-default bg-muted/30":"cursor-pointer hover:shadow-md hover:bg-accent/5"} ${a?"grayscale-[50%] opacity-85 border-border/40":"bg-card border-border/60 shadow-sm"}`,onClick:()=>!s&&r(t.id),children:[e.jsxs("div",{className:"flex items-center gap-4 flex-1 min-w-0 pr-4",children:[e.jsx("div",{className:`flex items-center justify-center flex-shrink-0 overflow-hidden ${a?"w-12 h-10 bg-muted rounded-lg":"w-14 h-12 bg-background rounded-lg border border-border/60 shadow-sm"}`,children:t.logo_url?e.jsx(ze,{src:t.logo_url,alt:t.company_name,containerClassName:`${a?"w-12 h-10":"w-14 h-12"} rounded-lg bg-background ${a?"grayscale":""}`,className:a?"grayscale":""}):a?e.jsx(he,{className:"h-5 w-5 text-muted-foreground"}):e.jsx("span",{className:"text-muted-foreground font-bold text-sm",children:t.company_name.charAt(0)})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(se,{children:[e.jsx(ae,{asChild:!0,children:e.jsx("p",{translate:"no",className:"notranslate font-semibold text-foreground text-sm line-clamp-1",children:t.company_name})}),e.jsx(re,{children:e.jsx("p",{translate:"no",className:"notranslate",children:t.company_name})})]}),!a&&e.jsxs(ye,{variant:"outline",className:"text-xs text-green-700 border-green-300 bg-green-50 gap-1",children:[e.jsx(ue,{className:"h-3 w-3"}),"Verified"]}),!a&&t.has_verified_badge&&e.jsxs(se,{children:[e.jsx(ae,{asChild:!0,children:e.jsx("div",{children:e.jsx(Je,{size:"sm"})})}),e.jsx(re,{children:e.jsx("p",{children:"We have verified the authenticity of this registered company"})})]}),!a&&t.certifications&&t.certifications.length>0&&e.jsxs(se,{children:[e.jsx(ae,{asChild:!0,children:e.jsx(_t,{className:"h-4 w-4 text-amber-600 flex-shrink-0"})}),e.jsx(re,{children:e.jsx("p",{children:"Certified Guide"})})]})]}),a?e.jsx("p",{className:"text-xs text-muted-foreground italic mt-0.5",children:"Profile not yet completed"}):e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1 mt-0.5",children:t.slogan||t.description}),!a&&c.length>0&&e.jsx("div",{className:"flex items-center gap-1.5 mt-1.5",children:c.slice(0,3).map((d,l)=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-medium bg-accent/50 text-accent-foreground
21/70 border border-border/40",children:[e.jsx(d.icon,{className:"h-2.5 w-2.5"}),d.label]},l))})]})]}),u.length>0&&e.jsx("div",{className:"flex items-center gap-1.5 mr-4 shrink-0",children:u.map((d,l)=>e.jsx("div",{className:"w-12 h-9 rounded-lg overflow-hidden bg-muted flex-shrink-0",children:e.jsx("img",{src:d.image_url,alt:"",className:"w-full h-full object-cover opacity-40 hover:opacity-100 transition-opacity duration-300",loading:"lazy"})},l))}),e.jsxs("div",{className:"flex flex-col items-center justify-center gap-0.5 w-24 shrink-0 mr-3",children:[e.jsx("span",{className:"text-[9px] font-semibold uppercase tracking-wider text-muted-foreground/70 leading-none",children:"ERTI"}),e.jsx(wt,{trustIndex:t.trust_index||0,size:"sm",showScaleOnly:!0}),e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[t.priceSymbol&&!s&&!a&&e.jsxs(se,{children:[e.jsx(ae,{asChild:!0,children:e.jsx("span",{className:"font-semibold text-green-700 cursor-help",children:t.priceSymbol})}),e.jsx(re,{children:e.jsxs("p",{children:["Typical price: $",(x=t.price_from)==null?void 0:x.toLocaleString()," - $",(p=t.price_to)==null?void 0:p.toLocaleString()]})})]}),e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(Ne,{className:"h-3 w-3"}),t.total_reviews]})]})]}),e.jsx("div",{className:"flex items-center justify-end shrink-0",children:a?e.jsxs(q,{variant:"outline",size:"sm",className:"text-muted-foreground border-border/60",disabled:s,children:[s?"Coming Soon":"Read Reviews",!s&&e.jsx(le,{className:"h-4 w-4 ml-1"})]}):e.jsxs(q,{size:"sm",className:"bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm",disabled:s,children:[s?"Coming Soon":t.subscription_tier==="professional"||t.trial_ends_at&&new Date(t.trial_ends_at)>new Date?"View Profile":"See Reviews",!s&&e.jsx(le,{className:"h-4 w-4 ml-1"})]})})]})})},Jt=({guide:t,isDummy:s=!1,onGuideClick:r})=>{const n=t.subscription_tier==="basic";return e.jsx(W,{className:`transition-all duration-200 overflow-hidden ${s?"opacity-80 cursor-default bg-muted/30":"cursor-pointer active:bg-accent/5"} ${n?"grayscale-[50%] opacity-85 border-border/40 shadow-sm":"bg-card border-border/60 shadow-sm"}`,onClick:()=>!s&&r(t.id),children:e.jsxs("div",{className:"p-2.5 flex items-center gap-2.5",children:[e.jsx("div",{className:`flex items-center justify-center flex-shrink-0 ${n?"w-10 h-8 bg-muted rounded overflow-hidden":"w-11 h-9 bg-white rounded-full border border-primary/20 shadow-sm overflow-hidden"}`,children:t.logo_url?e.jsx(ze,{src:t.logo_url,alt:t.company_name,containerClassName:`${n?"w-10 h-8 rounded":"w-11 h-9 rounded-full"} bg-white ${n?"grayscale":""}`,className:n?"grayscale":""}):n?e.jsx(he,{className:"h-4 w-4 text-muted-foreground"}):e.jsx("span",{className:"text-muted-foreground font-bold text-xs",children:t.company_name.charAt(0)})}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx("h3",{translate:"no",className:"notranslate font-medium text-foreground text-sm line-clamp-1",children:t.company_name}),n?e.jsx("span",{className:"text-[10px] italic text-muted-foreground",children:"Not completed"}):e.jsxs(e.Fragment,{children:[t.has_verified_badge&&e.jsx(Je,{size:"sm"}),t.certifications&&t.certifications.length>0&&e.jsx(_t,{className:"h-3 w-3 text-amber-600 flex-shrink-0"})]})]})}),e.jsx("div",{className:"flex-shrink-0",children:e.jsx(wt,{trustIndex:t.trust_index||0,size:"sm"})}),e.jsx(le,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"})]})})},Ue=t=>[...t].sort((s,r)=>(r.trust_index||0)-(s.trust_index||0)),Qe=(t,s,r,n)=>{const a=(s||[]).map(ne),u=(r||[]).map(ne),c=(n||[]).map(ne);switch(t){case"local":return Ue(a);case"international":return Ue(u);case"top":return[...a,...u,...c].sort((b,w)=>(w.trust_index||0)-(b.trust_index||0));case"lowest":return[...a,...u,...c].sort((b,w)=>(b.trust_index||0)-(w.trust_index||0));case"all":default:const d=Ue(a),l=Ue(u),N=d.slice(0,5),v=l.slice(0,5),h=[...d.slice(5),...l.slice(5),...c].sort((b,w)=>(w.trust_index||0)-(b.trust_index||0));return[...N,...v,...h]}},Xt=t=>{const s=t.map(r=>r.price_from).filter(r=>r!=null&&r>0);return s.length<2?null:{min:Math.min(...s),max:Math.max(...s)}},Qt=(t,s)=>{if(!t||t<=0||!s)return null;const{min:r,max:n}=s,a=n-r;if(a<=0)return null;const u=r+a/3,c=r+2*a/3;return t<u?"$":t<c?"$$":"$$$"},kt=t=>t.slug?`/guide/${t.slug}`:`/guide/id/${t.id}
21`,xt=10,Es=({activeFilter:t,topLocalGuides:s,topInternationalGuides:r,remainingGuides:n,onGuideClick:a,sortBy:u="trust_index"})=>{const c=we(),x=xe(),[p,d]=m.useState(!1),l=m.useMemo(()=>{const S=[...s||[],...r||[],...n||[]];return Xt(S)},[s,r,n]),N=(S,j)=>{x(kt(j))},v=S=>{const j=Qt(S.price_from,l),L=P=>N(P,S);return e.jsx("div",{"data-south-col":"guide-card",children:c?e.jsx(Jt,{guide:{...S,priceSymbol:j},onGuideClick:L}):e.jsx(As,{guide:{...S,priceSymbol:j},onGuideClick:L})},S.id)};if(t!=="all"){const S=Qe(t,s,r,n);return e.jsx(me,{children:e.jsx("div",{className:"space-y-2",children:S.map(v)})})}const h=S=>[...S].sort((j,L)=>u==="total_reviews"?(L.total_reviews||0)-(j.total_reviews||0):u==="created_at"?new Date(L.created_at||0).getTime()-new Date(j.created_at||0).getTime():(L.trust_index||0)-(j.trust_index||0)),b=h(s||[]),w=h(r||[]),$=n||[],C=p?$:$.slice(0,xt),A=$.length>xt;return e.jsxs(me,{children:[b.length>0&&e.jsxs("section",{className:"py-5",children:[e.jsx("div",{className:"border-t border-border/30 mb-5"}),e.jsxs("div",{className:"mb-4 flex items-end justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-extrabold text-foreground",children:"Top Local Guides"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Teams based in-country with deep local expertise"})]}),e.jsx("span",{className:"hidden text-xs font-semibold uppercase text-muted-foreground sm:block",children:"Ranked by ERTI"})]}),e.jsx("div",{className:"space-y-2",children:b.map(v)})]}),w.length>0&&e.jsxs("section",{className:"py-5 -mx-4 px-4 sm:-mx-6 sm:px-6 bg-muted/20 rounded-xl",children:[e.jsx("div",{className:"border-t border-border/30 mb-5"}),e.jsxs("div",{className:"mb-4 flex items-end justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-extrabold text-foreground",children:"Top International Guides"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"International teams operating at this location"})]}),e.jsx("span",{className:"hidden text-xs font-semibold uppercase text-muted-foreground sm:block",children:"Ranked by ERTI"})]}),e.jsx("div",{className:"space-y-2",children:w.map(v)})]}),$.length>0&&e.jsxs("section",{className:"py-5",children:[e.jsx("div",{className:"border-t border-border/30 mb-5"}),e.jsx("h2",{className:"uppercase tracking-wider text-xs font-semibold text-muted-foreground mb-1",children:"Other Operators"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:"All other operators listed for this destination"}),e.jsx("div",{className:"space-y-2",children:C.map(v)}),A&&!p&&e.jsx("div",{className:"flex justify-center mt-6",children:e.jsxs(q,{variant:"outline",onClick:()=>d(!0),className:"gap-2",children:["Show ",$.length-xt," more operators",e.jsx(Bt,{className:"h-4 w-4"})]})})]})]})},Zt=({locationName:t,hiddenCount:s})=>s<=0?null:e.jsx(W,{className:"border-dashed border-2 border-muted bg-muted/30",children:e.jsx(_e,{className:"p-6",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx(Ne,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("h3",{className:"font-semibold text-foreground mb-1",children:["+",s," other guide ",s===1?"company":"companies"," also operate",s===1?"s":""," on ",t]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"These guides haven't subscribed to ExpedReview yet, but you can still look them up! Use the search bar to find any guide company by name and read their reviews."}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Rt,{className:"h-4 w-4"}),e.jsx("span",{children:"Search any company name above"})]}),e.jsx("span",{className:"text-muted-foreground",children:"â¢"}),e.jsxs("a",{href:"https://vettedguides.com",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-sm text-primary hover:underline",children:["Get personalized recommendations",e.
21jsx(Ye,{className:"h-3 w-3"})]})]})]})]})})}),Rs=({guide:t,isDummy:s=!1,onGuideClick:r})=>{var x,p;const n=!!t.trial_ends_at&&new Date(t.trial_ends_at)>new Date,a=t.subscription_tier==="basic"&&!n,u=a?[]:(t.guide_images||[]).filter(d=>!d.is_logo&&d.image_url).slice(0,3),c=a?[]:[t.certifications&&t.certifications.length>0&&{icon:vt,label:"Certified Guides"},t.languages&&t.languages.length>0&&{icon:It,label:"English Speaking"},t.years_experience&&t.years_experience>=1&&{icon:oe,label:`${t.years_experience}+ yrs experience`}].filter(Boolean);return e.jsx(me,{children:e.jsxs(W,{className:`flex items-center p-4 pr-5 transition-all duration-200 ${s?"opacity-80 cursor-default bg-muted/30":"cursor-pointer hover:shadow-md hover:bg-accent/5"} ${a?"grayscale-[50%] opacity-85 border-border/40":"bg-card border-border/60 shadow-sm"}`,onClick:()=>!s&&r(t.id),children:[e.jsxs("div",{className:"flex items-center gap-4 flex-1 min-w-0 pr-4",children:[e.jsx("div",{className:`flex items-center justify-center flex-shrink-0 overflow-hidden ${a?"w-12 h-10 bg-muted rounded-lg":"w-14 h-12 bg-background rounded-lg border border-border/60 shadow-sm"}`,children:t.logo_url?e.jsx(ze,{src:t.logo_url,alt:t.company_name,containerClassName:`${a?"w-12 h-10":"w-14 h-12"} rounded-lg bg-background ${a?"grayscale":""}`,className:a?"grayscale":""}):a?e.jsx(he,{className:"h-5 w-5 text-muted-foreground"}):e.jsx("span",{className:"text-muted-foreground font-bold text-sm",children:t.company_name.charAt(0)})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(se,{children:[e.jsx(ae,{asChild:!0,children:e.jsx("p",{translate:"no",className:"notranslate font-semibold text-foreground text-sm line-clamp-1",children:t.company_name})}),e.jsx(re,{children:e.jsx("p",{translate:"no",className:"notranslate",children:t.company_name})})]}),!a&&e.jsxs(ye,{variant:"outline",className:"text-xs text-green-700 border-green-300 bg-green-50 gap-1",children:[e.jsx(ue,{className:"h-3 w-3"}),"Verified"]}),!a&&t.has_verified_badge&&e.jsxs(se,{children:[e.jsx(ae,{asChild:!0,children:e.jsx("div",{children:e.jsx(Je,{size:"sm"})})}),e.jsx(re,{children:e.jsx("p",{children:"We have verified the authenticity of this registered company"})})]}),!a&&t.certifications&&t.certifications.length>0&&e.jsxs(se,{children:[e.jsx(ae,{asChild:!0,children:e.jsx(_t,{className:"h-4 w-4 text-amber-600 flex-shrink-0"})}),e.jsx(re,{children:e.jsx("p",{children:"Certified Guide"})})]})]}),a?e.jsx("p",{className:"text-xs text-muted-foreground italic mt-0.5",children:"Profile not yet completed"}):e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1 mt-0.5",children:t.slogan||t.description}),!a&&c.length>0&&e.jsx("div",{className:"flex items-center gap-1.5 mt-1.5",children:c.slice(0,3).map((d,l)=>e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-[10px] font-medium bg-accent/50 text-accent-foreground/70 border border-border/40",children:[e.jsx(d.icon,{className:"h-2.5 w-2.5"}),d.label]},l))})]})]}),u.length>0&&e.jsx("div",{className:"flex items-center gap-1.5 mr-4 shrink-0",children:u.map((d,l)=>e.jsx("div",{className:"w-12 h-9 rounded-lg overflow-hidden bg-muted flex-shrink-0",children:e.jsx("img",{src:d.image_url,alt:"",className:"w-full h-full object-cover opacity-40 hover:opacity-100 transition-opacity duration-300",loading:"lazy"})},l))}),e.jsxs("div",{className:"flex flex-col items-center justify-center gap-0.5 w-24 shrink-0 mr-3",children:[e.jsx("span",{className:"text-[9px] font-semibold uppercase tracking-wider text-muted-foreground/70 leading-none",children:"ERTI"}),e.jsx(wt,{trustIndex:t.trust_index||0,size:"sm",showScaleOnly:!0}),e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[t.priceSymbol&&!s&&!a&&e.jsxs(se,{children:[e.jsx(ae,{asChild:!0,children:e.jsx("span",{className:"font-semibold text-green-700 cursor-help",children:t.priceSymbol})}),e.jsx(re,{children:e.jsxs("p",{children:["Typical price: $",(x=t.price_from)==null?void 0:x.toLocaleString()," - $",(p=t.price_to)==null?void 0:p.toLocaleStr
21ing()]})})]}),e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(Ne,{className:"h-3 w-3"}),t.total_reviews]})]})]}),e.jsx("div",{className:"flex items-center justify-end shrink-0",children:a?e.jsxs(q,{variant:"outline",size:"sm",className:"text-muted-foreground border-border/60",disabled:s,children:[s?"Coming Soon":"Read Reviews",!s&&e.jsx(le,{className:"h-4 w-4 ml-1"})]}):e.jsxs(q,{size:"sm",className:"bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm",disabled:s,children:[s?"Coming Soon":t.subscription_tier==="professional"||t.trial_ends_at&&new Date(t.trial_ends_at)>new Date?"View Profile":"See Reviews",!s&&e.jsx(le,{className:"h-4 w-4 ml-1"})]})})]})})},Is=t=>t.replace(/_/g," ").replace(/\b\w/g,s=>s.toUpperCase()),es=(t,s)=>{const r=!!t.trial_ends_at&&new Date(t.trial_ends_at)>new Date,a=!(t.subscription_tier!=="basic"||r),u=(t.certifications||[]).filter(Boolean),c=[];s==="local"&&c.push("Local operator"),s==="international"&&c.push("International operator"),!a&&u.length>0&&c.push(u.length===1?Is(u[0]):`${u.length} certifications`),!a&&t.years_experience&&t.years_experience>=1&&c.push(`${t.years_experience} yrs experience`),!a&&t.languages&&t.languages.length>0&&c.push(t.languages.slice(0,2).join(", "));const x=t.total_reviews||0;return{isSkeleton:a,tags:c,ctaLabel:a?"See reviews":"View profile",reviewLabel:x===1?"1 review":`${x} reviews`}},ts=({guide:t,scope:s,onGuideClick:r})=>{const{isSkeleton:n,tags:a,ctaLabel:u,reviewLabel:c}=es(t,s),x=Number(t.trust_index)||0,p=x===0,d=Ot(x);return e.jsxs(W,{onClick:()=>r(t.id),className:`flex cursor-pointer items-center gap-4 px-4 py-3 transition-colors hover:border-border hover:bg-muted/20 ${n?"border-border/50 bg-muted/20":"bg-card"}`,children:[e.jsx("div",{className:`flex h-11 w-11 shrink-0 items-center justify-center overflow-hidden rounded-md border border-border/60 bg-background ${n?"grayscale":""}`,children:t.logo_url?e.jsx(ze,{src:t.logo_url,alt:t.company_name,containerClassName:"h-11 w-11 rounded-md bg-background"}):n?e.jsx(he,{className:"h-5 w-5 text-muted-foreground"}):e.jsx("span",{className:"text-sm font-bold text-muted-foreground",children:t.company_name.charAt(0)})}),e.jsxs("div",{className:"w-32 shrink-0 border-r border-border/60 pr-4",children:[e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"ERTI"}),p?e.jsx("p",{className:"text-xl font-black leading-tight text-muted-foreground",children:Pt}):e.jsxs("p",{className:`text-2xl font-black leading-none ${d.scoreColor}`,children:[x.toFixed(1),e.jsx("span",{className:"text-sm font-bold text-muted-foreground",children:" / 5"})]}),e.jsx("p",{className:"mt-1 text-xs font-medium text-muted-foreground",children:p?"No reviews yet":c})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{translate:"no",className:"notranslate truncate text-sm font-bold text-foreground",children:t.company_name}),!n&&e.jsxs(ye,{variant:"outline",className:"shrink-0 gap-1 border-border bg-muted/40 text-[10px] font-semibold text-muted-foreground",children:[e.jsx(ue,{className:"h-3 w-3"}),"Verified"]}),!n&&t.has_verified_badge&&e.jsxs(se,{children:[e.jsx(ae,{asChild:!0,children:e.jsx("div",{className:"shrink-0",children:e.jsx(Je,{size:"sm"})})}),e.jsx(re,{children:e.jsx("p",{children:"We have verified the authenticity of this registered company"})})]})]}),e.jsx("p",{className:"mt-1 truncate text-xs text-muted-foreground",children:n&&a.length===0?"Profile not yet completed":a.join(" · ")||"Listed for this route"})]}),e.jsxs(q,{size:"sm",variant:"ghost",className:"shrink-0 px-2 text-muted-foreground hover:bg-muted hover:text-foreground",onClick:l=>{l.stopPropagation(),r(t.id)},children:[u,e.jsx(le,{className:"ml-1 h-4 w-4"})]})]})},ss=({guide:t,scope:s,onGuideClick:r})=>{const{isSkeleton:n,tags:a,ctaLabel:u,reviewLabel:c}=es(t,s),x=Number(t.trust_index)||0,p=x===0,d=Ot(x);return e.jsxs(W,{onClick:()=>r(t.id),className:`cursor-pointer px-3 py-3 ${n?"border-border/50 bg-muted/20":"bg-card"}`,children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:`flex h-10 w-10 shrink-0 items-center justify-center overflow-hidden rounded-md border border-border/60 bg-background ${n?"grayscale":""}`,children:t.logo_url?e.jsx(ze,{src:t.logo_url,alt:t.company_name,containerClassName:"h-10 w-10 rounded-md bg-background"}):n?e.jsx(he,{className:"h-4 w-4 text-muted-foreground"}):e.jsx("span",{className:"text-xs font-bold text-muted-foreground",children:t.company_name.charAt(0)})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("p",{translate:"no",className:"notranslate truncate text-sm font-bold text-foreground",children:t.company_name}),!n&&e.jsxs(ye,{variant:"outline",className:"shrink-0 gap-1 border-border bg-muted/40 text-[10px] font-semibold text-muted-foreground",children:[e.jsx(ue,{className:"h-3 w-3"}),"Verified"]})]}),e.jsxs("div",{className:"mt-2 border-y border-border/60 py-2",children:[e.jsx("span",{className:"mr-2 text-[10px] font-bold uppercase tracking-wider text-muted-foreground",children:"ERTI"}),p?e.jsx("span",{className:"text-xl font-black text-muted-foreground",children:Pt}):e.jsxs("span",{className:`text-2xl font-black leading-none ${d.scoreColor}`,children:[x.toFixed(1),e.jsx("span",{className:"text-sm font-bold text-muted-foreground",children:" / 5"})]}),e.jsx("span",{className:"ml-2 text-xs font-medium text-muted-foreground",children:p?"No reviews yet":c})]}),e.jsx("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:n&&a.length===0?"Profile not yet completed":a.join(" · ")})]})]}),e.jsxs(q,{size:"sm",variant:"outline",className:"mt-3 w-full border-border bg-card text-muted-foreground shadow-none hover:bg-muted hover:text-foreground",onClick:l=>
21{l.stopPropagation(),r(t.id)},children:[u,e.jsx(le,{className:"ml-1 h-4 w-4"})]})]})},Ke=({unratedGuides:t,variant:s="legacy"})=>{const r=xe(),n=we(),a=m.useMemo(()=>Xt(t),[t]);if(!t||t.length===0)return null;const u=(c,x)=>{r(kt(x))};return e.jsxs("section",{className:"py-5",children:[e.jsx("div",{className:"border-t border-border/30 mb-5"}),e.jsx("h2",{className:"uppercase tracking-wider text-xs font-semibold text-muted-foreground mb-1",children:"Servicing this location but no ratings as of yet"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:"These operators are listed for this destination but haven't received any reviews yet"}),e.jsx(me,{children:e.jsx("div",{className:"space-y-2",children:t.map(c=>{const x=Qt(c.price_from,a),p=d=>u(d,c);return s==="v1"?n?e.jsx(ss,{guide:c,onGuideClick:p},c.id):e.jsx(ts,{guide:c,onGuideClick:p},c.id):n?e.jsx(Jt,{guide:{...c,priceSymbol:x},onGuideClick:p},c.id):e.jsx(Rs,{guide:{...c,priceSymbol:x},onGuideClick:p},c.id)})})})]})},Bs=({locationId:t,locationName:s,topLocalGuides:r,topInternationalGuides:n,remainingGuides:a,featuredGuides:u,filteredGuides:c,countries:x,selectedCountries:p,setSelectedCountries:d,selectedTiers:l,setSelectedTiers:N,sortBy:v,setSortBy:h,showCTA:b,onCTAClick:w,totalGuideCount:$=0,unratedGuides:C,unclaimedCompanies:A=[]})=>{const[S,j]=m.useState([]),[L,P]=m.useState(!0),[K,D]=m.useState(null),[R,Y]=m.useState("all"),X=xe();m.useEffect(()=>{if(r||n||a){const B=[...r||[],...n||[],...a||[]].map(k=>{const F=ne(k);return{...F,certifications:F.certifications||[],languages:F.languages||[],trust_index:F.trust_index||0,subscription_tier:F.subscription_tier||"basic"}});j(B),P(!1);return}P(!1)},[r,n,a]);const U=y=>{const B=S.find(k=>k.id===y)||[...r||[],...n||[],...a||[]].find(k=>k.id===y);B&&B.slug?X(`/guide/${B.slug}`):X(`/guide/id/${y}`)},Q=y=>{Y(y)};if(L)return e.jsx(Wt,{});if(K)return e.jsx(Kt,{error:K});const M=Qe(R,r,n,a),g=[...r||[],...n||[],...a||[]],I=(r||[]).length,H=(n||[]).length,T=Math.min(10,g.length),f=g.length,_=$-f;return e.jsxs("div",{className:"space-y-6",children:[e.jsx($s,{activeFilter:R,onFilterChange:Q,localGuideCount:I,internationalGuideCount:H,topGuideCount:T,totalGuideCount:f,sortBy:v,onSortChange:h}),M.length===0&&(!C||C.length===0)?e.jsx(Yt,{locationName:s}):M.length===0?e.jsx(e.Fragment,{children:e.jsx(Ke,{unratedGuides:(C||[]).map(y=>ne(y))})}):e.jsxs(e.Fragment,{children:[e.jsx(Es,{activeFilter:R,topLocalGuides:r,topInternationalGuides:n,remainingGuides:a,onGuideClick:U,sortBy:v}),C&&C.length>0&&e.jsx(Ke,{unratedGuides:C.map(y=>ne(y))}),_>0&&e.jsx(Zt,{locationName:s||"this destination",hiddenCount:_})]}),e.jsxs("div",{className:"flex flex-col justify-between gap-3 border-y border-border bg-muted/50 px-5 py-4 text-sm sm:flex-row sm:items-center",children:[e.jsx("div",{className:"min-w-0",children:A.length>0?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-bold text-foreground",children:"Also listed:"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:A.map(y=>y.company_name).join(" · ")})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-bold text-foreground",children:"Guide company operating here?"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Add or claim your company listing."})]})}),e.jsx(de,{to:"/guide-signup",className:"shrink-0 font-bold text-primary hover:underline",children:"Claim your free profile â"})]})]})},Ps=({locations:t,currentLocationId:s})=>{const r=t.filter(n=>n.id!==s);return r.length===0?null:e.jsxs(W,{className:"mt-4 md:mt-6 border-border/60 shadow-sm",children:[e.jsx(bt,{className:"p-3 md:p-6 pb-2 md:pb-4",children:e.jsxs(jt,{className:"flex items-center gap-2 text-base md:text-xl",children:[e.jsx(oe,{className:"h-4 w-4 md:h-5 md:w-5 text-primary"}),"Related Locations"]})}),e.jsx(_e,{className:"p-3 md:p-6 pt-0 md:pt-0",children:e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-2 lg:grid-cols-3 gap-2 md:gap-4",children:r.map(n=>e.jsx(de,{to:`/location/${n.slug}`,className:"group block",children:e.jsxs("div",{className:"relative overflow-hidden rounded-lg border border-border/80 bg-card shadow-sm transition-all duration-300 hover:shadow-lg hover:border-primary/50",children:[n.image_url?e.jsx("div",{className:"aspect-[4/3] md:aspect-video overflow-hidden",children:e.jsx("img",{src:n.image_url,alt:n.name,className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-105"})}):e.jsx("div",{className:"aspect-[4/3] md:aspect-video bg-muted flex items-center justify-center",children:e.jsx(oe,{className:"h-6 w-6 md:h-8 md:w-8 text-muted-foreground"})}),e.jsxs("div",{className:"p-2 md:p-3",children:[e.jsx("h3",{className:"font-semibold text-xs md:text-base text-foreground group-hover:text-primary transition-colors line-clamp-1",children:n.name}),e.jsxs("p",{className:"text-xs md:text-sm text-muted-foreground flex items-center gap-1 mt-0.5 md:mt-1",children:[e.jsx(oe,{className:"h-2.5 w-2.5 md:h-3 md:w-3"}),n.country]}),e.jsxs("div",{className:"hidden md:flex items-center gap-1 mt-2 text-sm text-primary opacity-0 group-hover:opacity-100 transition-opacity",children:["View Details",e.jsx(hs,{className:"h-3 w-3"})]})]})]})},n.id))})})]})},as=({location:t,relatedLocations:s=[]})=>e.jsxs("div",{className:"max-w-5xl mx-auto pb-4 md:pb-8",children:[e.jsxs(W,{className:"border-border/60 shadow-sm",children:[e.jsx(bt,{className:"p-3 md:p-6 pb-2 md:pb-4",children:e.jsxs(jt,{className:"text-base md:text-xl",children:["All About ",t.name]})}),e.jsx(_e,{className:"p-3 md:p-6 pt-0 md:pt-0",children:e.jsxs(ps,{type:"single",collapsible:!0,defaultValue:"item-1",className:"w-full",children:[e.jsxs(pe,{value:"item-1",children:[e.jsx(ge,{className:"py-2 md:py-4 text-sm md:text-base",children:e.jsxs("div",{className:"flex items-center gap-1.5 md:gap-2",children:[e.jsx(oe,{className:"h-4 w-4 md:h-5 md:w-5 text-primary"}),e.jsx("span",{children:"Location & Geography"})]})}),e.jsxs(fe,{className:"text-sm md:text-base text-muted-foreground leading-relaxed pl-5 md:pl-7",children:[t.name," is located in the ",t.region," region of ",t.country,".",t.elevation_m&&` It stands at an impressive elevation of ${t.elevation_m.toLocaleStr
21ing()} meters (${Math.round(t.elevation_m*3.28084).toLocaleString()} ft).`,"The area is characterized by its dramatic landscapes, including towering peaks, deep valleys, and vast glaciers."]})]}),e.jsxs(pe,{value:"item-2",children:[e.jsx(ge,{className:"py-2 md:py-4 text-sm md:text-base",children:e.jsxs("div",{className:"flex items-center gap-1.5 md:gap-2",children:[e.jsx(gs,{className:"h-4 w-4 md:h-5 md:w-5 text-primary"}),e.jsx("span",{children:"Climbing History"})]})}),e.jsx(fe,{className:"text-sm md:text-base text-muted-foreground leading-relaxed pl-5 md:pl-7",children:t.climbing_history||`Climbing history information for ${t.name} is not available yet.`})]}),e.jsxs(pe,{value:"item-3",children:[e.jsx(ge,{className:"py-2 md:py-4 text-sm md:text-base",children:e.jsxs("div",{className:"flex items-center gap-1.5 md:gap-2",children:[e.jsx(Ls,{className:"h-4 w-4 md:h-5 md:w-5 text-primary"}),e.jsx("span",{children:"Notable Routes"})]})}),e.jsx(fe,{className:"text-sm md:text-base text-muted-foreground leading-relaxed pl-5 md:pl-7",children:t.notable_routes||`Information about notable routes for ${t.name} is not available yet.`})]}),e.jsxs(pe,{value:"item-4",children:[e.jsx(ge,{className:"py-2 md:py-4 text-sm md:text-base",children:e.jsxs("div",{className:"flex items-center gap-1.5 md:gap-2",children:[e.jsx(Ss,{className:"h-4 w-4 md:h-5 md:w-5 text-primary"}),e.jsx("span",{children:"Currency"})]})}),e.jsx(fe,{className:"text-sm md:text-base text-muted-foreground leading-relaxed pl-5 md:pl-7",children:t.currency_info||`Currency information for ${t.name} is not available yet.`})]}),e.jsxs(pe,{value:"item-5",children:[e.jsx(ge,{className:"py-2 md:py-4 text-sm md:text-base",children:e.jsxs("div",{className:"flex items-center gap-1.5 md:gap-2",children:[e.jsx(Ns,{className:"h-4 w-4 md:h-5 md:w-5 text-primary"}),e.jsx("span",{children:"Languages"})]})}),e.jsx(fe,{className:"text-sm md:text-base text-muted-foreground leading-relaxed pl-5 md:pl-7",children:t.languages_info||`Language information for ${t.name} is not available yet.`})]}),e.jsxs(pe,{value:"item-6",children:[e.jsx(ge,{className:"py-2 md:py-4 text-sm md:text-base",children:e.jsxs("div",{className:"flex items-center gap-1.5 md:gap-2",children:[e.jsx(Cs,{className:"h-4 w-4 md:h-5 md:w-5 text-primary"}),e.jsx("span",{children:"Weather & Best Time to Visit"})]})}),e.jsx(fe,{className:"text-sm md:text-base text-muted-foreground leading-relaxed pl-5 md:pl-7",children:t.weather_info||`Weather information for ${t.name} is not available yet.`})]})]})})]}),s.length>0&&e.jsx(Ps,{locations:s,currentLocationId:t.id})]}),rs=({images:t})=>{const[s,r]=m.useState(null),[n,a]=m.useState(!0),u=we(),c=s!==null;m.useEffect(()=>{if(!c)return;const h=b=>{b.key==="Escape"?r(null):b.key==="ArrowLeft"?(b.preventDefault(),r(w=>w!==null?(w-1+t.length)%t.length:null)):b.key==="ArrowRight"&&(b.preventDefault(),r(w=>w!==null?(w+1)%t.length:null))};return document.addEventListener("keydown",h),document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",h),document.body.style.overflow=""}},[c,t.length]);const x=m.useCallback(h=>{a(!0),r(h)},[]),p=m.useCallback(()=>r(null),[]),d=m.useCallback(()=>{a(!0),r(h=>h!==null?(h-1+t.length)%t.length:null)},[t.length]),l=m.useCallback(()=>{a(!0),r(h=>h!==null?(h+1)%t.length:null)},[t.length]),N=()=>{if(t.length<=7)return t.map((w,$)=>$);const h=s??0,b=[];for(let w=-3;w<=3;w++)b.push((h+w+t.length)%t.length);return b};if(t.length===0)return e.jsxs("div",{className:"text-center py-16",children:[e.jsx("div",{className:"bg-muted rounded-full p-6 w-20 h-20 mx-auto mb-4 flex items-center justify-center",children:e.jsx(yt,{className:"h-8 w-8 text-muted-foreground"})}),e.jsx("h3",{className:"text-base font-semibold text-foreground mb-1",children:"No Images Yet"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No operators have uploaded gallery images for this location."})]});const v=s!==null?t[s]:null;return e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:[t.length," images from operators at this location"]})}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3",children:t.map((h,b)=>e.jsxs("button",{onClick:()=>x(b),className:`group relative aspect-square overflow-hidden rounded-lg border border-border bg-muted transition-all duration-300 ${u?"":"opacity-40 hover:opacity-100"}`,children:[e.jsx(ut,{src:h.image_url,size:"medium",alt:h.caption||`${h.company_name} - image ${b+1}`,className:"w-full h-full object-cover"}),e.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/30 transition-all duration-300 flex flex-col items-center justify-end p-2",children:e.jsx("span",{className:"text-white text-xs font-medium opacity-0 group-hover:opacity-100 transition-opacity duration-300 bg-black/50 px-2 py-1 rounded backdrop-blur-sm truncate max-w-full",children:h.company_name})})]},h.id||b))}),c&&v&&e.jsxs("div",{className:"fixed inset-0 z-50 bg-black/95 flex flex-col",onClick:p,children:[e.jsxs("div",{className:"flex items-center justify-between p-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"bg-white/20 text-white px-3 py-1 rounded-full text-sm font-medium backdrop-blur-sm",children:[(s??0)+1," / ",t.length]}),e.jsx("span",{className:"text-white/70 text-sm hidden sm:block",children:v.company_name})]}),e.jsx("button",{onClick:p,className:"text-white hover:bg-white/20 rounded-full p-2 transition-colors","aria-label":"Close",children:e.jsx(fs,{className:"h-6 w-6"})})]}),e.jsxs("div",{className:"flex-1 flex items-center justify-center px-4 relative min-h-0",onClick:p,children:[n&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10",children:e.jsx(bs,{className:"h-10 w-10 animate-spin text-white"})}),t.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:h=>{h.stopPropagation(),d()},className:"absolute left-4 top-1/2 -translate-y-1/2 z-20 bg-black/50 hover:bg-black/70 text-white rounded-full p-3 transition-colors","aria-label":"Previous",children:e.jsx(js,{className:"h-6 w-6"})}),e.jsx("button",{onClick:h=>{h.stopPropagation(),l()},className:"absolute right-4 top-1/2 -translate-y-1/2 z-20 bg-black/50 hover:bg-black/70 text-white rounded-full p-3 transition-colors","aria-label":"Next",children:e.jsx(le,{className:"h-6 w-6"})})]}),e.jsx(ut,{src:v.image_url,size:"large",fallback:v.image_url,alt:v.caption||`Image ${(s??0)+1}`,className:`max-w-full max-h-[70vh] object-contain rounded-lg transition-opacity duration-300 ${n?"opacity-0":"opacity-100"}`,onClick:h=>h.stopPropagation(),onLoad:()=>a(!1)})]}),t.length>1&&e.jsx("div",{className:"p-4",children:e.jsx("div",{className:"flex justify-center items-center gap-2",children:N().map(h=>e.jsx("button",{onClick:b=>{b.stopPropagation(),a(!0),r(h)},className:`flex-shrink-0 w-12 h-12 rounded-md overflow-hidden border-2 transition-all duration-200 ${h===s?"border-white scale-110":"border-white/30 opacity-60 hover:opacity-100"}`,children:e.jsx(ut,{src:t[h].image_url,size:"thumbnail",alt:`Thumbnail ${h+1}`,className:"w-full h-full object-cover"})},h))})})]})]})},Os=({location:t,relatedLocations:s=[],topLocalGuides:r,topInternationalGuides:n,remainingGuides:a,featuredGuides:u,filteredGuides:c,countries:x,selectedCountries:p,setSelectedCountries:d,selectedTiers:l,setSelectedTiers:N,sortBy:v,setSortBy:h,showCTA:b,onCTAClick:w,totalGuideCount:$=0,galleryImages:C=[],unratedGuides:A=[],unclaimedCompanies:S=[]})=>{const j=((r==null?void 0:r.length)||0)+((n==null?void 0:n.length)||0)+((a==null?void 0:a.length)||0);return e.jsxs(Ft,{defaultValue:"guides",className:"w-full",children:[e.jsxs("div",{className:"mb-6 flex flex-col border-b border-slate-200 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs(Dt,{className:"w-full justify-start bg-transparent h-auto p-0 gap-5 sm:w-auto
21sm:gap-6",children:[e.jsxs(je,{value:"guides",className:"bg-transparent px-0 pb-3 pt-1 rounded-none border-b-2 border-transparent data-[state=active]:border-slate-800 data-[state=active]:bg-transparent data-[state=active]:shadow-none text-slate-500 data-[state=active]:text-slate-800 font-medium text-sm flex items-center gap-2",children:[e.jsx(Ne,{className:"h-4 w-4"}),"Guides",e.jsx("span",{className:"text-xs bg-slate-100 text-slate-600 px-1.5 py-0.5 rounded-full font-semibold",children:j})]}),e.jsxs(je,{value:"about",className:"bg-transparent px-0 pb-3 pt-1 rounded-none border-b-2 border-transparent data-[state=active]:border-slate-800 data-[state=active]:bg-transparent data-[state=active]:shadow-none text-slate-500 data-[state=active]:text-slate-800 font-medium text-sm flex items-center gap-2",children:[e.jsx(oe,{className:"h-4 w-4"}),"About"]}),e.jsxs(je,{value:"gallery",className:"bg-transparent px-0 pb-3 pt-1 rounded-none border-b-2 border-transparent data-[state=active]:border-slate-800 data-[state=active]:bg-transparent data-[state=active]:shadow-none text-slate-500 data-[state=active]:text-slate-800 font-medium text-sm flex items-center gap-2",children:[e.jsx(yt,{className:"h-4 w-4"}),"Gallery",C.length>0&&e.jsx("span",{className:"text-xs bg-slate-100 text-slate-600 px-1.5 py-0.5 rounded-full font-semibold",children:C.length})]})]}),e.jsx(q,{asChild:!0,size:"sm",className:"mb-3 w-full sm:mb-2 sm:w-auto",children:e.jsx(de,{to:"/client-dashboard?tab=review",children:"Leave a review"})})]}),e.jsx(ve,{value:"guides",className:"mt-0",children:e.jsx(Bs,{topLocalGuides:r,topInternationalGuides:n,remainingGuides:a,featuredGuides:u,filteredGuides:c,countries:x,selectedCountries:p,setSelectedCountries:d,selectedTiers:l,setSelectedTiers:N,sortBy:v,setSortBy:h,showCTA:b,onCTAClick:w,totalGuideCount:$,locationName:t.name,unratedGuides:A,unclaimedCompanies:S})}),e.jsx(ve,{value:"about",className:"mt-0",children:e.jsx(as,{location:t,relatedLocations:s})}),e.jsx(ve,{value:"gallery",className:"mt-0",children:e.jsx(rs,{images:C})})]})},ns=()=>e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-blue-50",children:[e.jsx(Xe,{}),e.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600"})})})]}),is=()=>{const t=xe();return vs.useEffect(()=>{V.warn("Location not found page displayed")},[]),e.jsxs("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-blue-50",children:[e.jsx(Xe,{}),e.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:e.jsxs("div",{className:"text-center py-20",children:[e.jsx("div",{className:"p-6 bg-white rounded-full w-24 h-24 mx-auto mb-6 flex items-center justify-center shadow-lg",children:e.jsx(he,{className:"h-12 w-12 text-gray-400"})}),e.jsx("h1",{className:"text-3xl font-bold text-gray-900 mb-4",children:"Location Not Found"}),e.jsx("p",{className:"text-gray-600 text-lg mb-8",children:"The destination you're looking for doesn't exist."}),e.jsx(q,{onClick:()=>t("/destinations"),className:"bg-blue-600 hover:bg-blue-700",children:"Browse All Destinations"})]})})]})},Fs=t=>`demo_active_addons_${t}`,Ds=t=>{const[s,r]=m.useState(null),[n,a]=m.useState([]),[u,c]=m.useState([]),[x,p]=m.useState([]),[d,l]=m.useState([]),[N,v]=m.useState([]),[h,b]=m.useState([]),[w,$]=m.useState([]),[C,A]=m.useState([]),[S,j]=m.useState([]),[L,P]=m.useState(0),[K,D]=m.useState(0),[R,Y]=m.useState([]),[X,U]=m.useState(!0);m.useEffect(()=>{t&&Q()},[t]);const Q=async()=>{try{U(!0),V.debug("[B-test] Fetching location data",{identifier:t});const M=t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t);let g,I;if(M){const i=await E.from("locations").select("*").eq("id",t).maybeSingle();g=i.data,I=i.error}else{const i=await E.from("locations").select("*").eq("slug",t).maybeSingle();if(g=i.data,I=i.error,!g&&!I){const o=await E.from("locations").select("*").eq("id",t).maybeSingle();g=o.data,I=o.error}}if(I)throw V.error("[B-test] Error fetching location",{identifier:t,error:I}),I;if(!g){V.warn("[B-test] Location not found",{identifier:t});return}r(g);const[{count:H},{data:T}]=await Promise.all([E.from("reviews_public").select("id",{count:"exact",head:!0}).eq("location_id",g.id).eq("status","approved").eq("verified",!0),E.from("unclaimed_company_locations").select(` 22 unclaimed_guide_companies!inner ( 23 id, 24 company_name, 25 slug, 26 claimed_by, 27 deleted_at 28 ) 29 `).eq("location_id",g.id).is("unclaimed_guide_companies.claimed_by",null).is("unclaimed_guide_companies.deleted_at",null)]);if(D(H||0),Y((T||[]).map(i=>
29i.unclaimed_guide_companies).filter(Boolean).slice(0,6)),g.related_location_ids&&g.related_location_ids.length>0){const{data:i,error:o}=await E.from("locations").select("id, name, country, slug, image_url").in("id",g.related_location_ids);o||a(i||[])}else a([]);const{data:f}=await E.from("subscription_addons").select("id, addon_type").eq("active",!0),_=(f==null?void 0:f.reduce((i,o)=>(i[o.addon_type]=o.id,i),{}))||{},{count:y}=await E.from("guide_locations").select("*",{count:"exact",head:!0}).eq("location_id",g.id),B=await Mt(),{data:k,error:F}=await E.from("guide_locations").select(` 30 *, 31 guide_profiles:guide_profiles_public!inner ( 32 *, 33 guide_images (*), 34 guide_certifications ( 35 id, 36 certification_type, 37 verified 38 ), 39 guide_addon_subscriptions ( 40 id, 41 status, 42 addon_id, 43 location_id, 44 subscription_addons ( 45 addon_type 46 ) 47 ) 48 ) 49 `).eq("location_id",g.id).is("guide_profiles_public.deleted_at",null).or(B,{referencedTable:"guide_profiles_public"});if(F)throw V.error("[B-test] Error fetching guides",{locationId:g.id,error:F}),F;V.debug("[B-test] Raw guides data fetched (ALL tiers)",{count:(k==null?void 0:k.length)||0,locationId:g.id});const{data:te}=await E.from("guide_expedition_package_locations").select("package_id").eq("location_id",g.id),Z=(te||[]).map(i=>i.package_id);let ke=[],Ce=[];if(Z.length>0){const{data:i}=await E.from("guide_expedition_packages").select("*").in("id",Z).eq("active",!0);ke=(i||[]).map(o=>({...o,location_id:g.id})),Ce=Array.from(new Set((i||[]).map(o=>o.guide_id).filter(Boolean)))}const Ze=new Set((k||[]).map(i=>{var o;return(o=i.guide_profiles)==null?void 0:o.id}).filter(Boolean)),Se=Ce.filter(i=>!Ze.has(i));if(Se.length>0){const{data:i,error:o}=await E.from("guide_profiles_public").select(` 50 *, 51 guide_images (*), 52 guide_certifications ( id, certification_type, verified ), 53 guide_addon_subscriptions ( 54 id, status, addon_id, location_id, 55 subscription_addons ( addon_type ) 56 ) 57 `).in("id",Se).is("deleted_at",null).or(B);if(o)V.error("[B-test] Error fetching package-linked guides",{error:o});else{const O=(i||[]).map(z=>({guide_profiles:z,price_from:null,price_to:null}));k.push(...O)}}const Le=k.filter(i=>i.guide_profiles).map(i=>{var Oe,Fe,De,Me;const o=i.guide_profiles,O=(Oe=o.guide_images)==null?void 0:Oe.find(G=>G.is_logo),z=JSON.parse(localStorage.getItem(Fs(o.id))||"[]"),Re=!!o.trial_ends_at&&new Date(o.trial_ends_at)>new Date,Ie=o.subscription_tier==="premium"||o.subscription_tier==="professional"||Re,Be=_.featured_listing,nt=(Fe=o.guide_addon_subscriptions)==null?void 0:Fe.some(G=>{var ee;return G.status==="active"&&((ee=G.subscription_addons)==null?void 0:ee.addon_type)==="featured_listing"&&G.location_id===g.id}),it=Be&&z.includes(Be),ot=Ie||nt||it,Pe=_.verified_badge,lt=(De=o.guide_addon_subscriptions)==null?void 0:De.some(G=>{var ee;return G.status==="active"&&((ee=G.subscription_addons)==null?void 0:ee.addon_type)==="verified_badge"}),dt=Pe&&z.includes(Pe),ct=(o.has_verified_badge||lt||dt)&&o.subscription_tier!=="basic",mt=ke.filter(G=>G.guide_id===o.id);return{id:o.id,company_name:o.company_name,description:o.description,slogan:o.slogan,average_rating:o.average_rating,total_reviews:o.total_reviews,years_experience:o.years_experience,phone:o.phone,website:o.website,certifications:((Me=o.guide_certifications)==null?void 0:Me.filter(G=>G.verified).map(G=>G.certification_type))||[],languages:o.languages||[],featured:ot,is_priority_placement:Ie,subscription_tier:Re?"professional":o.subscription_tier,logo_url:O==null?void 0:O.image_url,price_from:i.price_from,price_to:i.price_to,trust_index:o.trust_index,has_verified_badge:ct,base_country:o.base_country||"Unknown",subscription_active:o.subscription_active,operation_scope:o.operation_scope,guide_images:o.guide_images||[],guide_locations:[i],expedition_packages:mt,created_at:o.created_at,trial_ends_at:o.trial_ends_at}}
57),et=Le.filter(i=>i.trust_index&&i.trust_index>0),Te=i=>{const o=i.subscription_tier,O=i.trial_ends_at&&new Date(i.trial_ends_at)>new Date;return o==="professional"||o==="standard"||o==="premium"||O},tt=Le.filter(i=>!i.trust_index||i.trust_index<=0).sort((i,o)=>{const O=Te(i)?1:0,z=Te(o)?1:0;return O!==z?z-O:(i.company_name||"").localeCompare(o.company_name||"")}),J=et.sort((i,o)=>(o.trust_index||0)-(i.trust_index||0)),Ge=J.filter(i=>i.base_country===g.country),$e=J.filter(i=>i.base_country!==g.country),st=J.filter(i=>i.featured),Ae=Ge,Ee=$e,at=new Set([...Ae.map(i=>i.id),...Ee.map(i=>i.id)]),rt=J.filter(i=>!at.has(i.id));P(J.length),c(J),p(Ae),l(Ee),v(rt),b(Ge),$($e),A(st),j(tt)}catch(M){V.error("[B-test] Error fetching location data",{identifier:t,error:M}),We.error("Failed to load location data")}finally{U(!1)}};return{location:s,relatedLocations:n,topLocalGuides:x,topInternationalGuides:d,remainingGuides:N,allGuides:u,allLocalGuides:h,allInternationalGuides:w,featuredGuides:C,unratedGuides:S,totalGuideCount:L,verifiedReviewCount:K,unclaimedCompanies:R,loading:X}}
57,Ms="leadCaptureDismissed",os=(t=6e4)=>{const[s,r]=m.useState(!1);return m.useEffect(()=>{if(_s())return;const a=setTimeout(()=>{r(!0)},t);return()=>clearTimeout(a)},[t]),{isCaptureCalloutOpen:s,setCaptureCalloutOpen:a=>{a||sessionStorage.setItem(Ms,"true"),r(a)}}},ls=({name:t,country:s,slug:r,imageUrl:n,elevation:a,latitude:u,longitude:c})=>{const x={"@context":"https://schema.org","@type":"TouristDestination",name:t,url:`https://www.expedreview.com/location/${r}`,description:`Find trusted expedition guides for ${t}, ${s}. Read verified reviews and compare guide companies on ExpedReview.`,containedInPlace:{"@type":"Country",name:s}};return n&&(x.image=n),a&&(x.elevation={"@type":"QuantitativeValue",value:a,unitCode:"MTR"}),u&&c&&(x.geo={"@type":"GeoCoordinates",latitude:u,longitude:c}),e.jsx(ws,{children:e.jsx("script",{type:"application/ld+json",children:JSON.stringify(x)})})},qs=()=>{var H,T;const{slug:t}=Nt(),[s,r]=m.useState([]),[n,a]=m.useState([]),[u,c]=m.useState("trust_index"),{isCaptureCalloutOpen:x,setCaptureCalloutOpen:p}=os(3e4),d=t,{location:l,relatedLocations:N,topLocalGuides:v,topInternationalGuides:h,remainingGuides:b,allGuides:w,allLocalGuides:$,allInternationalGuides:C,featuredGuides:A,unratedGuides:S,totalGuideCount:j,verifiedReviewCount:L,unclaimedCompanies:P,loading:K}=Ds(d),D=f=>({...f,certifications:f.certifications||[],languages:f.languages||[],subscription_tier:f.subscription_tier||"basic",trust_index:f.trust_index||0,featured:f.featured||!1}),R=m.useMemo(()=>[...v||[],...h||[],...b||[]].map(D),[v,h,b]),Y=m.useMemo(()=>{const f=new Set(R.map(_=>_.base_country||"Unknown").filter(_=>_&&_!=="Unknown"));return Array.from(f)},[R]),X=()=>{p(!1)},U=m.useMemo(()=>{if(!R)return[];let f=[...R];return s.length>0&&(f=f.filter(_=>s.includes(_.base_country||"Unknown"))),n.length>0&&(f=f.filter(_=>n.includes(_.subscription_tier||"basic"))),f.sort((_,y)=>{switch(u){case"trust_index":return(y.trust_index||0)-(_.trust_index||0);case"total_reviews":return(y.total_reviews||0)-(_.total_reviews||0);case"created_at":const B=_.created_at?new Date(_.created_at).getTime():0;return(y.created_at?new Date(y.created_at).getTime():0)-B;default:return 0}}),f},[R,s,n,u]),Q=m.useMemo(()=>{const f=R.flatMap(y=>(y.guide_images||[]).filter(B=>!B.is_logo).map(B=>({id:B.id,image_url:B.image_url,caption:B.caption,company_name:y.company_name}))),_=new Set;return f.filter(y=>_.has(y.image_url)?!1:(_.add(y.image_url),!0))},[R]);if(K)return e.jsx(ns,{});if(!l)return e.jsx(is,{});const M=(w||[]).map(D),g=($||[]).map(D),I=(C||[]).map(D);return e.jsxs("div",{className:"min-h-screen bg-gray-50",children:[e.jsx(qt,{title:`${l.name} Guides & Reviews | ExpedReview`,description:`Find trusted expedition guides for ${l.name}, ${l.country}. Read verified reviews and choose with confidence on ExpedReview.`,path:`/location/${l.slug||t}`,ogImage:l.image_url||void 0}),e.jsx(ls,{name:l.name,country:l.country,slug:l.slug||t||"",imageUrl:l.image_url,elevation:l.elevation_m,latitude:l.latitude,longitude:l.longitude}),e.jsx("div",{className:"relative z-50",children:e.jsx(Xe,{})}),e.jsx(Ts,{location:l,allGuides:M,allLocalGuides:g,allInternationalGuides:I,verifiedReviewCount:L}),e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[e.jsx(Os,{location:l,relatedLocations:N,topLocalGuides:v||[],topInternationalGuides:h||[],remainingGuides:b||[],featuredGuides:A||[],filteredGuides:U,countries:Y,selectedCountries:s,setSelectedCountries:r,selectedTiers:n,setSelectedTiers:a,sortBy:u,setSortBy:c,showCTA:x,onCTAClick:X,totalGuideCount:j,galleryImages:Q,unratedGuides:S||[],unclaimedCompanies:P}),(l.name.toLowerCase().includes("everest")||((H=l.slug)==null?void 0:H.toLowerCase().includes("everest")))&&e.jsxs("section",{className:"mt-16 border-t border-border pt-8",children:[e.jsx("p",{className:"mb-4 text-xs font-bold uppercase text-muted-foreground",children:"Useful before you go"}),e.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[e.jsxs(de,{to:"/the-complete-mount-everest-equipment-gear-list",className:"flex items-center justify-between rounded-md border border-border bg-card p-4 hover:border-primary",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-bold",children:"Everest gear list"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Down suits, 8,000 m boots and expedition essentials"})]}),e.jsx(Ye,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx("div",{className:"flex items-center rounded-md border border-border bg-card p-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"mb-1 text-sm font-bold",children:"Global Rescue membership"}),e.jsx(zt,{variant:"location",locationName:l.name})]})})]}),((T=l.slug)==null?void 0:T.toLowerCase())==="everest-south-col"&&e.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:"We earn a small commission on purchases made through these links. That keeps ExpedReview running."}),e.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:"Some links are affiliate links. They never affect guide rankings or ERTI scores."})]})]}),e.jsx(Vt,{})]})},zs=({location:t,allGuides:s,allLocalGuides:r,allInternationalGuides:n,verifiedReviewCount:a=0})=>{const u=we(),c=[t.country];t.region&&c.unshift(t.region);const x=s.flatMap(d=>[d.price_from,d.price_to]).filter(d=>typeof d=="number"&&d>0),p=x.length?(()=>{const d=Math.min(...x),l=Math.max(...x);return d===l?ht(d):`${ht(d)}â${ht(l)}`})():null;return e.jsxs("section",{className:"relative min-h-[430px] overflow-hidden bg-foreground",children:[t.image_url&&e.jsx("img",{src:t.image_url,alt:"",className:"absolute inset-0 h-full w-full object-cover"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-foreground
57/90 via-foreground/60 to-foreground/20"}),e.jsxs("div",{className:`relative mx-auto flex min-h-[430px] max-w-7xl flex-col justify-end px-4 sm:px-6 lg:px-8 ${u?"py-8":"py-12"}`,children:[e.jsx("p",{className:"mb-auto text-sm font-semibold text-primary-foreground/80",children:c.join(" · ")}),e.jsxs("div",{className:"max-w-3xl",children:[e.jsxs("div",{className:"mb-4 inline-flex items-center gap-2 rounded-md bg-background/90 px-3 py-1.5 text-xs font-bold uppercase text-primary",children:[e.jsx(ue,{className:"h-4 w-4"}),a.toLocaleString()," verified ",a===1?"review":"reviews"]}),e.jsx("h1",{className:`${u?"text-4xl":"text-5xl md:text-6xl"} font-extrabold text-primary-foreground leading-tight`,children:t.name}),e.jsxs("p",{className:"mt-4 max-w-2xl text-lg leading-7 text-primary-foreground/90",children:["Explore trusted guides, independent reviews and local expertise for ",t.name,"."]})]}),e.jsxs("div",{className:"mt-9 grid grid-cols-2 gap-px overflow-hidden rounded-lg border border-primary-foreground/20 bg-primary-foreground/20 sm:grid-cols-4",children:[t.elevation_m&&e.jsx(be,{label:"Elevation",value:`${t.elevation_m.toLocaleString()} m`}),e.jsx(be,{label:"Guides",value:s.length.toLocaleString()}),e.jsx(be,{label:"Local",value:r.length.toLocaleString()}),e.jsx(be,{label:"International",value:n.length.toLocaleString()}),e.jsx(be,{label:"Review proof",value:`${a.toLocaleString()} verified`}),p&&e.jsx(be,{label:"Price range",value:p})]})]})]})},ht=t=>t>=1e3?`$${Math.round(t/1e3)}k`:`$${t.toLocaleString()}`,be=({label:t,value:s})=>
57e.jsxs("div",{className:"bg-foreground/55 px-4 py-4 backdrop-blur-sm",children:[e.jsx("p",{className:"text-[11px] font-bold uppercase text-primary-foreground/60",children:t}),e.jsx("p",{className:"mt-1 text-sm font-bold text-primary-foreground sm:text-base",children:s})]}),pt=10,Vs=({activeFilter:t,topLocalGuides:s,topInternationalGuides:r,remainingGuides:n,onGuideClick:a,sortBy:u="trust_index"})=>{const c=we(),x=xe(),[p,d]=m.useState(!1),l=j=>{x(kt(j))},N=(j,L)=>{const P=()=>l(j);return e.jsx("div",{"data-south-col":"guide-card",children:c?e.jsx(ss,{guide:j,scope:L,onGuideClick:P}):e.jsx(ts,{guide:j,scope:L,onGuideClick:P})},j.id)},v=new Set((s||[]).map(j=>j.id)),h=j=>v.has(j.id)?"local":"international";if(t!=="all"){const j=Qe(t,s,r,n);return e.jsx(me,{children:e.jsx("div",{className:"space-y-2",children:j.map(L=>N(L,h(L)))})})}const b=j=>[...j].sort((L,P)=>u==="total_reviews"?(P.total_reviews||0)-(L.total_reviews||0):u==="created_at"?new Date(P.created_at||0).getTime()-new Date(L.created_at||0).getTime():(P.trust_index||0)-(L.trust_index||0)),w=b(s||[]),$=b(r||[]),C=n||[],A=p?C:C.slice(0,pt),S=C.length>pt;return e.jsxs(me,{children:[w.length>0&&e.jsxs("section",{className:"pb-8",children:[e.jsxs("div",{className:"mb-6 flex items-end justify-between border-b-2 border-border pb-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-[26px] font-black leading-tight tracking-tight text-foreground sm:text-[34px]",children:"Top Local Guides"}),e.jsx("p",{className:"mt-1 text-sm font-medium text-muted-foreground",children:"Teams based in-country with deep local expertise"})]}),e.jsx("span",{className:"hidden text-xs font-semibold uppercase tracking-wider text-muted-foreground sm:block",children:"Ranked by ERTI"})]}),e.jsx("div",{className:"space-y-2",children:w.map(j=>N(j,"local"))})]}),$.length>0&&e.jsxs("section",{className:"pt-2 pb-8",children:[e.jsxs("div",{className:"mb-6 flex items-end justify-between border-b-2 border-border pb-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-[26px] font-black leading-tight tracking-tight text-foreground sm:text-[34px]",children:"Top International Guides"}),e.jsx("p",{className:"mt-1 text-sm font-medium text-muted-foreground",children:"International teams operating at this location"})]}),e.jsx("span",{className:"hidden text-xs font-semibold uppercase tracking-wider text-muted-foreground sm:block",children:"Ranked by ERTI"})]}),e.jsx("div",{className:"space-y-2",children:$.map(j=>N(j,"international"))})]}),C.length>0&&e.jsxs("section",{className:"border-t border-border/50 py-6",children:[e.jsx("h2",{className:"mb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Other Operators"}),e.jsx("p",{className:"mb-4 text-sm text-muted-foreground",children:"All other operators listed for this destination"}),e.jsx("div",{className:"space-y-2",children:A.map(j=>N(j,h(j)))}),S&&!p&&e.jsx("div",{className:"mt-5 flex justify-center",children:e.jsxs(q,{variant:"outline",onClick:()=>d(!0),className:"gap-2 border-border text-muted-foreground hover:bg-muted hover:text-foreground",children:["Show ",C.length-pt," more operators",e.jsx(Bt,{className:"h-4 w-4"})]})})]})]})},Us=({className:t=""})=>e.jsxs(W,{className:`bg-card p-5 ${t}`,children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[e.jsx(ue,{className:"h-4 w-4 text-brand"}),e.jsx("h2",{className:"text-sm font-extrabold text-foreground",children:"What is ERTI?"})]}),e.jsx("p",{className:"text-sm leading-6 text-muted-foreground",children:"The ExpedReview Trust Index is not a simple average of star ratings. It blends rating quality, how recent the reviews are, verification, and review volume into one score out of 5."}),e.jsxs("ul",{className:"mt-3 space-y-2 text-sm text-muted-foreground",children:[e.jsxs("li",{className:"flex gap-2",children:[e.jsx("span",{className:"mt-1 h-1.5 w-1.5 shrink-0 rounded-full bg-brand"}),"Recent evidence weighs most â fresh reviews count for more, and older ones fade gradually over time."]}),e.jsxs("li",{className:"flex gap-2",children:[e.jsx("span",{className:"mt-1 h-1.5 w-1.5 shrink-0 rounded-full bg-brand"}),"A guide with no verified reviews shows as Unrated â no score is invented for them."]}),e.jsxs("li",{className:"flex gap-2",children:[e.jsx("span",{className:"mt-1 h-1.5 w-1.5 shrink-0 rounded-full bg-brand"}),"Nobody can pay to rank higher. Paid listings never change the ranking."]})]}),e.jsx(de,{to:"/resources/trust",className:"mt-3 inline-block text-xs font-semibold text-muted-foreground underline decoration-brand/40 underline-offset-4 transition-colors hover:text-brand",children:"How ERTI works â"})]}),Hs=({filters:t,activeFilter:s,onFilterChange:r,sortBy:n,onSortChange:a,verifiedReviewCount:u,guideCount:c,localCount:x,internationalCount:p})=>e.jsxs("aside",{className:"space-y-4 lg:sticky lg:top-24 lg:self-start",children:[e.jsx(Us,{}),e.jsxs(W,{"data-south-col":"filters",className:"p-5",children:[e.jsx("h2",{className:"mb-3 text-sm font-extrabold text-foreground",children:"Filter guides"}),e.jsx("div",{className:"space-y-1.5",children:t.map(d=>e.jsxs(q,{variant:"outline",size:"sm",onClick:()=>r(d.id),className:`w-full justify-between px-3 shadow-none ${s===d.id?"border-border bg-muted font-bold text-foreground hover:bg-muted":"border-border/70 bg-card font-medium text-muted-foreground hover:border-border hover:bg-muted/50 hover:text-foreground"}`,children:[e.jsx("span",{className:"text-sm",children:d.label}),e.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:d.count})]},d.id))}),e.jsxs("label",{className:"mt-4 block",children:[e.jsx("span",{className:"mb-1.5 block text-xs font-bold uppercase text-muted-foreground",children:"Sort by"}),e.jsxs("select",{value:n,onChange:d=>
57a(d.target.value),className:"h-10 w-full rounded-md border border-input bg-card px-3 text-sm font-semibold text-foreground outline-none focus:ring-2 focus:ring-ring",children:[e.jsx("option",{value:"trust_index",children:"Top rated"}),e.jsx("option",{value:"total_reviews",children:"Most reviewed"}),e.jsx("option",{value:"created_at",children:"Newest listed"})]})]})]}),e.jsxs(W,{className:"p-5",children:[e.jsx("h2",{className:"mb-3 text-sm font-extrabold text-foreground",children:"Route proof"}),e.jsxs("dl",{className:"space-y-2 text-sm",children:[e.jsx(He,{label:"Verified reviews",value:u.toLocaleString()}),e.jsx(He,{label:"Guide companies",value:c.toLocaleString()}),e.jsx(He,{label:"Local operators",value:x.toLocaleString()}),e.jsx(He,{label:"International",value:p.toLocaleString()})]})]})]}),He=({label:t,value:s})=>e.jsxs("div",{className:"flex items-center justify-between border-b border-border/50 pb-2 last:border-0 last:pb-0",children:[e.jsx("dt",{className:"text-muted-foreground",children:t}),e.jsx("dd",{className:"font-bold text-foreground",children:s})]}),Ws=({locationId:t,locationName:s,topLocalGuides:r,topInternationalGuides:n,remainingGuides:a,featuredGuides:u,filteredGuides:c,countries:x,selectedCountries:p,setSelectedCountries:d,selectedTiers:l,setSelectedTiers:N,sortBy:v,setSortBy:h,showCTA:b,onCTAClick:w,totalGuideCount:$=0,verifiedReviewCount:C=0,unratedGuides:A,unclaimedCompanies:S=[]})=>{const[j,L]=m.useState([]),[P,K]=m.useState(!0),[D,R]=m.useState(null),[Y,X]=m.useState("all"),U=xe();m.useEffect(()=>{if(r||n||a){const F=[...r||[],...n||[],...a||[]].map(te=>{const Z=ne(te);return{...Z,certifications:Z.certifications||[],languages:Z.languages||[],trust_index:Z.trust_index||0,subscription_tier:Z.subscription_tier||"basic"}});L(F),K(!1);return}K(!1)},[r,n,a]);const Q=k=>{const F=j.find(te=>te.id===k)||[...r||[],...n||[],...a||[]].find(te=>te.id===k);F&&F.slug?U(`/guide/${F.slug}`):U(`/guide/id/${k}`)},M=k=>{X(k)};if(P)return e.jsx(Wt,{});if(D)return e.jsx(Kt,{error:D});const g=Qe(Y,r,n,a),I=[...r||[],...n||[],...a||[]],H=(r||[]).length,T=(n||[]).length,f=Math.min(10,I.length),_=I.length,y=$-_,B=[{id:"all",label:"All guides",count:_},{id:"top",label:"Top rated",count:f},{id:"local",label:"Local guides",count:H},{id:"international",label:"International",count:T}];return e.jsxs("div",{className:"grid grid-cols-1 gap-8 lg:grid-cols-[minmax(0,1fr)_320px]",children:[e.jsxs("div",{className:"min-w-0 space-y-6",children:[e.jsxs("div",{className:"border-b border-border pb-5",children:[e.jsx("p",{className:"mb-1 text-xs font-bold uppercase text-primary",children:"Guide rankings"}),e.jsx("h2",{className:"text-3xl font-extrabold text-foreground",children:"Guides on this route"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Ranked by ERTI â verified reviews, review recency and profile transparency. Never by payment."})]}),g.length===0&&(!A||A.length===0)?e.jsx(Yt,{locationName:s}):g.length===0?e.jsx(Ke,{variant:"v1",unratedGuides:(A||[]).map(k=>ne(k))}):e.jsxs(e.Fragment,{children:[e.jsx(Vs,{activeFilter:Y,topLocalGuides:r,topInternationalGuides:n,remainingGuides:a,onGuideClick:Q,sortBy:v}),A&&A.length>0&&e.jsx(Ke,{variant:"v1",unratedGuides:A.map(k=>ne(k))}),y>0&&e.jsx(Zt,{locationName:s||"this destination",hiddenCount:y})]}),e.jsxs("div",{className:"flex flex-col justify-between gap-3 border-y border-border bg-muted/50 px-5 py-4 text-sm sm:flex-row sm:items-center",children:[e.jsx("div",{className:"min-w-0",children:S.length>0?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-bold text-foreground",children:"Also listed:"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:S.map(k=>k.company_name).join(" · ")})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-bold text-foreground",children:"Guide company operating here?"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Add or claim your company listing."})]})}),e.jsx(de,{to:"/guide-signup",className:"shrink-0 font-bold text-primary hover:underline",children:"Claim your free profile â"})]})]}),e.jsx(Hs,{filters:B,activeFilter:Y,onFilterChange:M,sortBy:v,onSortChange:h,verifiedReviewCount:C,guideCount:$||_,localCount:H,internationalCount:T})]})},Ks=({location:t,relatedLocations:s=[],topLocalGuides:r,topInternationalGuides:n,remainingGuides:a,featuredGuides:u,filteredGuides:c,countries:x,selectedCountries:p,setSelectedCountries:d,selectedTiers:l,setSelectedTiers:N,sortBy:v,setSortBy:h,showCTA:b,onCTAClick:w,totalGuideCount:$=0,galleryImages:C=[],unratedGuides:A=[],unclaimedCompanies:S=[],verifiedReviewCount:j=0})=>{const L=((r==null?void 0:r.length)||0)+((n==null?void 0:n.length)||0)+((a==null?void 0:a.length)||0);return e.jsxs(Ft,{defaultValue:"guides",className:"w-full",children:[e.jsxs("div",{className:"mb-6 flex flex-col border-b border-slate-200 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs(Dt,{className:"w-full justify-start bg-transparent h-auto p-0 gap-5 sm:w-auto
57sm:gap-6",children:[e.jsxs(je,{value:"guides",className:"bg-transparent px-0 pb-3 pt-1 rounded-none border-b-2 border-transparent data-[state=active]:border-slate-800 data-[state=active]:bg-transparent data-[state=active]:shadow-none text-slate-500 data-[state=active]:text-slate-800 font-medium text-sm flex items-center gap-2",children:[e.jsx(Ne,{className:"h-4 w-4"}),"Guides",e.jsx("span",{className:"text-xs bg-slate-100 text-slate-600 px-1.5 py-0.5 rounded-full font-semibold",children:L})]}),e.jsxs(je,{value:"about",className:"bg-transparent px-0 pb-3 pt-1 rounded-none border-b-2 border-transparent data-[state=active]:border-slate-800 data-[state=active]:bg-transparent data-[state=active]:shadow-none text-slate-500 data-[state=active]:text-slate-800 font-medium text-sm flex items-center gap-2",children:[e.jsx(oe,{className:"h-4 w-4"}),"About"]}),e.jsxs(je,{value:"gallery",className:"bg-transparent px-0 pb-3 pt-1 rounded-none border-b-2 border-transparent data-[state=active]:border-slate-800 data-[state=active]:bg-transparent data-[state=active]:shadow-none text-slate-500 data-[state=active]:text-slate-800 font-medium text-sm flex items-center gap-2",children:[e.jsx(yt,{className:"h-4 w-4"}),"Gallery",C.length>0&&e.jsx("span",{className:"text-xs bg-slate-100 text-slate-600 px-1.5 py-0.5 rounded-full font-semibold",children:C.length})]})]}),e.jsx(q,{asChild:!0,size:"sm",variant:"outline",className:"mb-3 w-full border-border bg-card text-muted-foreground shadow-none hover:bg-muted hover:text-foreground sm:mb-2 sm:w-auto",children:e.jsx(de,{to:"/client-dashboard?tab=review",children:"Leave a review"})})]}),e.jsx(ve,{value:"guides",className:"mt-0",children:e.jsx(Ws,{topLocalGuides:r,topInternationalGuides:n,remainingGuides:a,featuredGuides:u,filteredGuides:c,countries:x,selectedCountries:p,setSelectedCountries:d,selectedTiers:l,setSelectedTiers:N,sortBy:v,setSortBy:h,showCTA:b,onCTAClick:w,totalGuideCount:$,locationName:t.name,unratedGuides:A,unclaimedCompanies:S,verifiedReviewCount:j})}),e.jsx(ve,{value:"about",className:"mt-0",children:e.jsx(as,{location:t,relatedLocations:s})}),e.jsx(ve,{value:"gallery",className:"mt-0",children:e.jsx(rs,{images:C})})]})},Ys=t=>`demo_active_addons_${t}`,Js=t=>{const[s,r]=m.useState(null),[n,a]=m.useState([]),[u,c]=m.useState([]),[x,p]=m.useState([]),[d,l]=m.useState([]),[N,v]=m.useState([]),[h,b]=m.useState([]),[w,$]=m.useState([]),[C,A]=m.useState([]),[S,j]=m.useState([]),[L,P]=m.useState(0),[K,D]=m.useState(0),[R,Y]=m.useState([]),[X,U]=m.useState(!0);m.useEffect(()=>{t&&Q()},[t]);const Q=async()=>{try{U(!0),V.debug("[B-test] Fetching location data",{identifier:t});const M=t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t);let g,I;if(M){const i=await E.from("locations").select("*").eq("id",t).maybeSingle();g=i.data,I=i.error}else{const i=await E.from("locations").select("*").eq("slug",t).maybeSingle();if(g=i.data,I=i.error,!g&&!I){const o=await E.from("locations").select("*").eq("id",t).maybeSingle();g=o.data,I=o.error}}if(I)throw V.error("[B-test] Error fetching location",{identifier:t,error:I}),I;if(!g){V.warn("[B-test] Location not found",{identifier:t});return}r(g);const[{count:H},{data:T}]=await Promise.all([E.from("reviews_public").select("id",{count:"exact",head:!0}).eq("location_id",g.id).eq("status","approved").eq("verified",!0),E.from("unclaimed_company_locations").select(` 58 unclaimed_guide_companies!inner ( 59 id, 60 company_name, 61 slug, 62 claimed_by, 63 deleted_at 64 ) 65 `).eq("location_id",g.id).is("unclaimed_guide_companies.claimed_by",null).is("unclaimed_guide_companies.deleted_at",null)]);if(D(H||0),Y((T||[]).map(i=>i.unclaimed_guide_companies).filter(Boolean).slice(0,6)),g.related_location_ids&&g.related_location_ids.length>0){const{data:i,error:o}=await E.from("locations").select("id, name, country, slug, image_url").in("id",g.related_location_ids);o||a(i||[])}else a([]);const{data:f}=await E.from("subscription_addons").select("id, addon_type").eq("active",!0),_=(f==null?void 0:f.reduce((i,o)=>(i[o.addon_type]=o.id,i),{}))||{},{count:y}=await E.from("guide_locations").select("*",{count:"exact",head:!0}).eq("location_id",g.id),B=await Mt(),{data:k,error:F}=await E.from("guide_locations").select(` 66 *, 67 guide_profiles:guide_profiles_public!inner ( 68 *, 69 guide_images (*), 70 guide_certifications ( 71 id, 72 certification_type, 73 verified 74 ), 75 guide_addon_subscriptions ( 76 id, 77 status, 78 addon_id, 79 location_id, 80 subscription_addons ( 81 addon_type 82 ) 83 ) 84 ) 85 `).eq("location_id",g.id).is("guide_profiles_public.deleted_at",null).or(B,{referencedTable:"guide_profiles_public"});if(F)throw V.error("[B-test] Error fetching guides",{locationId:g.id,error:F}),F;V.debug("[B-test] Raw guides data fetched (ALL tiers)",{count:(k==null?void 0:k.length)||0,locationId:g.id});const{data:te}=await E.from("guide_expedition_package_locations").select("package_id").eq("location_id",g.id),Z=(te||[]).map(i=>i.package_id);let ke=[],Ce=[];if(Z.length>0){const{data:i}=await E.from("guide_expedition_packages").select("*").in("id",Z).eq("active",!0);ke=(i||[]).map(o=>({...o,location_id:g.id})),Ce=Array.from(new Set((i||[]).map(o=>
85o.guide_id).filter(Boolean)))}const Ze=new Set((k||[]).map(i=>{var o;return(o=i.guide_profiles)==null?void 0:o.id}).filter(Boolean)),Se=Ce.filter(i=>!Ze.has(i));if(Se.length>0){const{data:i,error:o}=await E.from("guide_profiles_public").select(` 86 *, 87 guide_images (*), 88 guide_certifications ( id, certification_type, verified ), 89 guide_addon_subscriptions ( 90 id, status, addon_id, location_id, 91 subscription_addons ( addon_type ) 92 ) 93 `).in("id",Se).is("deleted_at",null).or(B);if(o)V.error("[B-test] Error fetching package-linked guides",{error:o});else{const O=(i||[]).map(z=>({guide_profiles:z,price_from:null,price_to:null}));k.push(...O)}}const Le=k.filter(i=>i.guide_profiles).map(i=>{var Oe,Fe,De,Me;const o=i.guide_profiles,O=(Oe=o.guide_images)==null?void 0:Oe.find(G=>G.is_logo),z=JSON.parse(localStorage.getItem(Ys(o.id))||"[]"),Re=!!o.trial_ends_at&&new Date(o.trial_ends_at)>new Date,Ie=o.subscription_tier==="premium"||o.subscription_tier==="professional"||Re,Be=_.featured_listing,nt=(Fe=o.guide_addon_subscriptions)==null?void 0:Fe.some(G=>{var ee;return G.status==="active"&&((ee=G.subscription_addons)==null?void 0:ee.addon_type)==="featured_listing"&&G.location_id===g.id}),it=Be&&z.includes(Be),ot=Ie||nt||it,Pe=_.verified_badge,lt=(De=o.guide_addon_subscriptions)==null?void 0:De.some(G=>{var ee;return G.status==="active"&&((ee=G.subscription_addons)==null?void 0:ee.addon_type)==="verified_badge"}),dt=Pe&&z.includes(Pe),ct=(o.has_verified_badge||lt||dt)&&o.subscription_tier!=="basic",mt=ke.filter(G=>G.guide_id===o.id);return{id:o.id,company_name:o.company_name,description:o.description,slogan:o.slogan,average_rating:o.average_rating,total_reviews:o.total_reviews,years_experience:o.years_experience,phone:o.phone,website:o.website,certifications:((Me=o.guide_certifications)==null?void 0:Me.filter(G=>G.verified).map(G=>G.certification_type))||[],languages:o.languages||[],featured:ot,is_priority_placement:Ie,subscription_tier:Re?"professional":o.subscription_tier,logo_url:O==null?void 0:O.image_url,price_from:i.price_from,price_to:i.price_to,trust_index:o.trust_index,has_verified_badge:ct,base_country:o.base_country||"Unknown",subscription_active:o.subscription_active,operation_scope:o.operation_scope,guide_images:o.guide_images||[],guide_locations:[i],expedition_packages:mt,created_at:o.created_at,trial_ends_at:o.trial_ends_at}}),et=Le.filter(i=>i.trust_index&&i.trust_index>0),Te=i=>{const o=i.subscription_tier,O=i.trial_ends_at&&new Date(i.trial_ends_at)>new Date;return o==="professional"||o==="standard"||o==="premium"||O},tt=Le.filter(i=>!i.trust_index||i.trust_index<=0).sort((i,o)=>{const O=Te(i)?1:0,z=Te(o)?1:0;return O!==z?z-O:(i.company_name||"").localeCompare(o.company_name||"")}),J=et.sort((i,o)=>(o.trust_index||0)-(i.trust_index||0)),Ge=J.filter(i=>i.base_country===g.country),$e=J.filter(i=>i.base_country!==g.country),st=J.filter(i=>i.featured),Ae=Ge,Ee=$e,at=new Set([...Ae.map(i=>i.id),...Ee.map(i=>i.id)]),rt=J.filter(i=>!at.has(i.id));P(J.length),c(J),p(Ae),l(Ee),v(rt),b(Ge),$($e),A(st),j(tt)}catch(M){V.error("[B-test] Error fetching location data",{identifier:t,error:M}),We.error("Failed to load location data")}finally{U(!1)}};return{location:s,relatedLocations:n,topLocalGuides:x,topInternationalGuides:d,remainingGuides:N,allGuides:u,allLocalGuides:h,allInternationalGuides:w,featuredGuides:C,unratedGuides:S,totalGuideCount:L,verifiedReviewCount:K,unclaimedCompanies:R,loading:X}},Xs="everest-south-col",gt="er_south_col_layout",Qs=60*60*24*30,At=t=>t==="control"||t==="v1",Zs=t=>{if(typeof document>"u")return null;const s=document.cookie.match(new RegExp(`(?:^|; )${t}=([^;]*)`));return s?decodeURIComponent(s[1]):null},Et=(t,s)=>{typeof document>"u"||(document.cookie=`${t}=${encodeURIComponent(s)}; path=/; max-age=${Qs}; SameSite=Lax`)},ea=t=>{let s=0;for(let r=0;r<t.length;r++)s=s*31+t.charCodeAt(r)|0;return Math.abs(s)%2===0?"control":"v1"},ds=t=>{if(typeof window>"u")return"control";const r=new URLSearchParams(t??window.location.search).get("layout");if(At(r))return Et(gt,r),r;const n=Zs(gt);if(At(n))return n;let a="";try{a=ks()}catch{a=String(Math.random())}const u=ea(a);return Et(gt,u),u},ta="/the-complete-mount-everest-equipment-gear-list",sa=[{category:"Down suit",product:"Rab Expedition 8000 Suit",image:"https://bekkcjkhrsfqwznxidkg.supabase.co/storage/v1/object/public/blog-images/everest-gear/rab-expedition-8000-suit.jpg",href:"https://alnk.to/apXM6gi",event:"south_col_essentials_down_suit_click"},{category:"Crampons",product:"Petzl Sarken Crampons",image:"https://bekkcjkhrsfqwznxidkg.supabase.co/storage/v1/object/public/blog-images/everest-gear/petzl-sarken-crampons.jpg",href:"https://alnk.to/6xP6w1c",event:"south_col_essentials_crampons_click"},{category:"Ice axe",product:"Black Diamond Raven Ice Axe",image:"https://bekkcjkhrsfqwznxidkg.supabase.co/storage/v1/object/public/blog-images/everest-gear/black-diamond-raven-ice-axe.jpg",href:"https://alnk.to/h6KzkDK",event:"south_col_essentials_ice_axe_click"}],aa=t=>t&&t.includes("/storage/v1/object/public/")?`${t.replace("/storage/v1/object/public/","/storage/v1/render/image/public/")}
93?width=96&height=96&resize=cover&quality=70`:t,ra=()=>{const{trackEvent:t}=Ht(),s=r=>{Ut(r.event);const n=typeof window<"u"&&window.location.pathname.includes("everest-south-col");t(r.event,{item:r.category,...n?{south_col_layout:ds(window.location.search)}:{}})};return e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-extrabold text-foreground",children:"Everest essentials"}),e.jsx("p",{className:"mb-4 mt-1 text-sm text-muted-foreground",children:"The three pieces climbers ask about most, straight from our tested gear list."}),e.jsx("div",{className:"grid gap-3 sm:grid-cols-3",children:sa.map(r=>e.jsxs("a",{href:r.href,target:"_blank",rel:"noopener noreferrer nofollow sponsored",onClick:()=>s(r),className:"flex items-center gap-3 rounded-md border border-border bg-card p-3 transition-colors hover:border-brand/40",children:[e.jsx("img",{src:aa(r.image),alt:r.product,width:48,height:48,loading:"lazy",decoding:"async",className:"h-12 w-12 shrink-0 rounded-md bg-muted object-contain"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-xs font-bold uppercase tracking-wide text-muted-foreground",children:r.category}),e.jsx("p",{className:"truncate text-sm font-semibold text-foreground",children:r.product}),e.jsx("span",{className:"mt-1 inline-flex items-center rounded border border-border px-1.5 py-0.5 text-[10px] font-bold uppercase tracking-wide text-muted-foreground",children:"Check price"})]}),e.jsx(Ye,{className:"ml-auto h-4 w-4 shrink-0 text-muted-foreground"})]},r.category))}),e.jsx(de,{to:ta,className:"mt-3 inline-block text-sm font-semibold text-muted-foreground hover:text-brand hover:underline",children:"See the full Everest gear list â"}),e.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:"We earn a small commission on purchases made through these links. That keeps ExpedReview running."})]})},na=()=>{var H;const{slug:t}=Nt(),[s,r]=m.useState([]),[n,a]=m.useState([]),[u,c]=m.useState("trust_index"),{isCaptureCalloutOpen:x,setCaptureCalloutOpen:p}=os(3e4),d=t,{location:l,relatedLocations:N,topLocalGuides:v,topInternationalGuides:h,remainingGuides:b,allGuides:w,allLocalGuides:$,allInternationalGuides:C,featuredGuides:A,unratedGuides:S,totalGuideCount:j,verifiedReviewCount:L,unclaimedCompanies:P,loading:K}=Js(d),D=T=>({...T,certifications:T.certifications||[],languages:T.languages||[],subscription_tier:T.subscription_tier||"basic",trust_index:T.trust_index||0,featured:T.featured||!1}),R=m.useMemo(()=>[...v||[],...h||[],...b||[]].map(D),[v,h,b]),Y=m.useMemo(()=>{const T=new Set(R.map(f=>f.base_country||"Unknown").filter(f=>f&&f!=="Unknown"));return Array.from(T)},[R]),X=()=>{p(!1)},U=m.useMemo(()=>{if(!R)return[];let T=[...R];return s.length>0&&(T=T.filter(f=>s.includes(f.base_country||"Unknown"))),n.length>0&&(T=T.filter(f=>n.includes(f.subscription_tier||"basic"))),T.sort((f,_)=>{switch(u){case"trust_index":return(_.trust_index||0)-(f.trust_index||0);case"total_reviews":return(_.total_reviews||0)-(f.total_reviews||0);case"created_at":const y=f.created_at?new Date(f.created_at).getTime():0;return(_.created_at?new Date(_.created_at).getTime():0)-y;default:return 0}}),T},[R,s,n,u]),Q=m.useMemo(()=>{const T=R.flatMap(_=>(_.guide_images||[]).filter(y=>!y.is_logo).map(y=>({id:y.id,image_url:y.image_url,caption:y.caption,company_name:_.company_name}))),f=new Set;return T.filter(_=>f.has(_.image_url)?!1:(f.add(_.image_url),!0))},[R]);if(K)return e.jsx(ns,{});if(!l)return e.jsx(is,{});const M=(w||[]).map(D),g=($||[]).map(D),I=(C||[]).map(D);return e.jsxs("div",{className:"min-h-screen bg-gray-50",children:[e.jsx(qt,{title:`${l.name} Guides & Reviews | ExpedReview`,description:`Find trusted expedition guides for ${l.name}, ${l.country}. Read verified reviews and choose with confidence on ExpedReview.`,path:`/location/${l.slug||t}`,ogImage:l.image_url||void 0}),e.jsx(ls,{name:l.name,country:l.country,slug:l.slug||t||"",imageUrl:l.image_url,elevation:l.elevation_m,latitude:l.latitude,longitude:l.longitude}),e.jsx("div",{className:"relative z-50",children:e.jsx(Xe,{})}),e.jsx(zs,{location:l,allGuides:M,allLocalGuides:g,allInternationalGuides:I,verifiedReviewCount:L}),e.jsxs("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[e.jsx(Ks,{location:l,relatedLocations:N,topLocalGuides:v||[],topInternationalGuides:h||[],remainingGuides:b||[],featuredGuides:A||[],filteredGuides:U,countries:Y,selectedCountries:s,setSelectedCountries:r,selectedTiers:n,setSelectedTiers:a,sortBy:u,setSortBy:c,showCTA:x,onCTAClick:X,totalGuideCount:j,galleryImages:Q,unratedGuides:S||[],unclaimedCompanies:P,verifiedReviewCount:L}),(l.name.toLowerCase().includes("everest")||((H=l.slug)==null?void 0:H.toLowerCase().includes("everest")))&&e.jsxs("section",{className:"mt-16 border-t border-border pt-8",children:[e.jsx("p",{className:"mb-4 text-xs font-bold uppercase text-muted-foreground",children:"Useful before you go"}),e.jsx(ra,{}),e.jsx("div",{className:"mt-6 flex items-center rounded-md border border-border bg-card p-4",children:e.jsxs("div",{children:[e.jsx("h3",{className:"mb-1 text-sm font-bold",children:"Global Rescue membership"}),e.jsx(zt,{variant:"location",locationName:l.name})]})}),e.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:"Some links are affiliate links. They never affect guide rankings or ERTI scores."})]})]}),e.jsx(Vt,{})]})},ia=(t,s)=>{const{trackEvent:r}=Ht(),n=m.useRef({});return m.useEffect(()=>{!s||!t||$t("south_col_layout",t)},[t,s]),{track:m.useCallback((u,c)=>{if(!s||!t)return;const x=`${u}:${JSON.stringify(c??{})}`,p=Date.now();p-(n.current[x]||0)<800||(n.current[x]=p,$t("south_col_layout",t),Ut(u),r(u,{south_col_layout:t,...c}))},[t,s,r])}},ca=()=>{const{slug:t}
93=Nt(),[s]=ys(),r=(t||"").toLowerCase()===Xs,n=m.useMemo(()=>r?ds(s.toString()):null,[r,s.get("layout")]),{track:a}=ia(n,r),u=m.useRef(null);m.useEffect(()=>{const x=u.current;if(!x||!r||!n)return;const p=l=>{var b;const N=l.target;if(!N)return;const v=N.closest("a"),h=(v==null?void 0:v.getAttribute("href"))||"";if(h.includes("the-complete-mount-everest-equipment-gear-list")){a("south_col_everest_gear_click",{href:h});return}if(h.includes("globalrescue.com")){a("south_col_global_rescue_click",{href:h});return}if(h.includes("tab=review")){a("south_col_leave_review_click");return}if(h.startsWith("/guide/")||N.closest('[data-south-col="guide-card"]')){a("south_col_guide_profile_tap",{href:h||"card"});return}if(N.closest('[data-south-col="filters"]')){const w=(((b=N.closest("button"))==null?void 0:b.textContent)||"").trim();a("south_col_filter_change",{control:"filter",value:w})}},d=l=>{const N=l.target;if(!N||!N.closest('[data-south-col="filters"]'))return;const v=N.value;a("south_col_filter_change",{control:"sort",value:v})};return x.addEventListener("click",p,!0),x.addEventListener("change",d,!0),()=>{x.removeEventListener("click",p,!0),x.removeEventListener("change",d,!0)}},[n,r,a]);const c=r&&n==="v1"?e.jsx(na,{}):e.jsx(qs,{});return r?e.jsx("div",{ref:u,"data-south-col-layout":n??void 0,children:c}):c};export{ca 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.