1import{k as de,l as le,m as ce,i as A,g as me,u as c,s as S,n as ue,o as ge,p as he,q as fe,t as pe,j as a,h as j,S as ye,v as H,L as xe,w as be,I as _e,b as J,c as X,d as Y,e as ee,f as x,M as te,x as se,y as ae,z as ve,A as we,B as Se,C as je,D as Me}from"./index-DUpyFvrn.js";import{r as u}from"./recharts-BP1V14u_.js";import{f as qe,P as Ne,i as Pe,r as Ce}from"./publicRankings-AO0mnG0Y.js";import{u as Le}from"./usePublicScrollRestore-Iam2kb3E.js";import"./jszip-Dj6QSqRp.js";const B="id, slug, stage_name, home_city_id, is_featured, is_couple, featured_sort_order, sort_order, created_at, status, home_city:cities!models_home_city_id_fkey(name,region,country)";function Be(){const{slug:g}=de(),b=le(),[r,C]=ce(),k=r.toString(),n=`city:${g??""}`,m=r.get("sort")??"az",L=r.get("window")??"month",F=r.get("q")??"",[$,K]=u.useState(F);u.useEffect(()=>{K(r.get("q")??"")},[k]),u.useEffect(()=>{const e=$.trim();if((r.get("q")??"")===e)return;const s=setTimeout(()=>{const i=new URLSearchParams(r);e?i.set("q",e):i.delete("q"),A(n,i),C(i,{replace:!0})},250);return()=>clearTimeout(s)},[$]),u.useEffect(()=>{if(!g||k)return;const e=me(n);e&&C(new URLSearchParams(e),{replace:!0})},[g]);const R=(e,s)=>{const i=new URLSearchParams(r);s?i.set(e,s):i.delete(e),A(n,i),C(i,{replace:!0})},{data:t}=c({queryKey:["city",g],enabled:!!g,queryFn:async()=>(await S.from("cities").select("*").eq("slug",g).maybeSingle()).data}),{data:T=[]}=c({queryKey:["city-models",t==null?void 0:t.id,b.join(",")],enabled:!!(t!=null&&t.id),queryFn:async()=>{const{data:e}=await S.from("model_home_cities").select("model_id").eq("city_id",t.id),s=Array.from(new Set((e??[]).map(i=>i.model_id)));return s.length===0?(await S.from("models").select(B).in("status",b).eq("home_city_id",t.id).order("sort_order")).data??[]:(await S.from("models").select(B).in("status",b).in("id",s).order("sort_order")).data??[]}}),{data:D=[]}=c({queryKey:["city-visiting",t==null?void 0:t.id,b.join(",")],enabled:!!(t!=null&&t.id),queryFn:async()=>{const e=new Date().toISOString().slice(0,10),{data:s}=await S.from("model_travel").select(`model:models!model_travel_model_id_fkey(${B}), start_date, end_date`).eq("city_id",t.id).gte("end_date",e).order("start_date");return(s??[]).filter(i=>{var l;return b.includes((l=i.model)==null?void 0:l.status)})}}),h=Pe(m)?m:null,{data:f}=c({queryKey:["public-rankings","city-models",t==null?void 0:t.id,h,L],queryFn:()=>qe("models",h,L),enabled:!!(t!=null&&t.id&&h),staleTime:1e3*60*10}),{data:_="manual"}=c({queryKey:["featured-sort-mode"],queryFn:je,staleTime:1e3*60,enabled:m==="featured"}),ie=m==="featured"&&(_==="popular_lifetime"||_==="popular_30d"),{data:V}=c({queryKey:["featured-popularity"],enabled:ie,queryFn:Me,staleTime:1e3*60*2}),v=(e,s)=>(e.stage_name??"").localeCompare(s.stage_name??"",void 0,{sensitivity:"base"}),re=e=>{if(h)return Ce(e,(f==null?void 0:f.items)??[],v);if(m==="newest")return[...e].sort((s,i)=>Date.parse(i.created_at??"")-Date.parse(s.created_at??"")||v(s,i));if(m==="featured"){const s=e.filter(l=>l.is_featured),i=e.filter(l=>!l.is_featured).sort(v);return s.sort(_==="manual"?ae("manual"):ae(_,V)),[...s,...i]}return[...e].sort(v)},p=u.useMemo(()=>re(T),[T,m,h,f==null?void 0:f.items,_,V]),y=u.useMemo(()=>[...D.map(s=>{var i;return{...s,id:((i=s.model)==null?void 0:i.id)??s.id}})].sort((s,i)=>(s.start_date??"").localeCompare(i.start_date??"")||(s.end_date??"").localeCompare(i.end_date??"")||v(s.model??{},i.model??{})),[D]),o=[...p.map(e=>e.id),...y.map(e=>{var s;return(s=e.model)==null?void 0:s.id}).filter(Boolean)],w=(F??"").trim().toLowerCase(),O=e=>!w||(e??"").toLowerCase().includes(w),M=w?p.filter(e=>O(e.stage_name)):p,q=w?y.filter(e=>{var s;return O((s=e.model)==null?void 0:s.stage_name)}):y,oe=[...M.map(e=>e.id),...q.map(e=>{var s;return(s=e.model)==null?void 0:s.id}).filter(Boolean)],U=ue(oe,{columns:ge}),d=c({queryKey:["city-media",t==null?void 0:t.id,o.join(",")],enabled:o.length>0&&!U.enabled,queryFn:async()=>he(o),staleTime:1e3*60*5}),N=d.data??{},{data:Q={}}=c({queryKey:["city-card-tags",t==null?void 0:t.id,o.join(",")],enabled:o.length>0,queryFn:async()=>fe(o),staleTime:1e3*60*10}),{data:z={}}=c({queryKey:["city-card-travel",t==null?void 0:t.id,o.join(",")],enabled:o.length>0,queryFn:async()=>pe(o),staleTime:1e3*60*5}),W=e=>{if(!t)return;const s=[...p,...y.map(i=>
1i.model).filter(Boolean)];A(n,r),ve(n,window.location.pathname,window.location.search,e,s.length),we({sourceKey:n,label:`${j(t)} models`,backLabel:`Back to ${j(t)}`,backPath:`/cities/${t.slug}${r.toString()?`?${r.toString()}`:""}`,items:Se(s)})};Le({sourceKey:n,pathname:t?`/cities/${t.slug}`:"",search:r.toString()?`?${r.toString()}`:"",ready:!!t&&p.length+y.length>0});const I=p.length+y.length,ne=M.length+q.length,G=M.length>0,P=q.length>0,Z=r.get("section")==="visiting-soon"||typeof window<"u"&&window.location.hash==="#visiting-soon";if(u.useEffect(()=>{if(typeof window>"u"||!Z||!P)return;let e=!1;const s=(i=0)=>{if(e)return;const l=document.getElementById("visiting-soon");if(l){l.scrollIntoView({behavior:"auto",block:"start"});return}i<20&&requestAnimationFrame(()=>s(i+1))};return requestAnimationFrame(()=>requestAnimationFrame(()=>s(0))),()=>{e=!0}},[P,Z]),!t)return a.jsx("div",{className:"container pt-32 pb-24",children:a.jsx("h1",{className:"font-display text-4xl",children:"City not found"})});const E=j(t)||"City";return a.jsxs("div",{className:"container pt-28 sm:pt-32 pb-16 sm:pb-24",children:[a.jsx(ye,{title:`Companions in ${E}`,description:`Browse Porn Companions models based in or visiting ${E}${t.country?`, ${t.country}`:""}.`,canonicalPath:`/cities/${t.slug}`,jsonLd:{"@context":"https://schema.org","@type":"BreadcrumbList",itemListElement:[{"@type":"ListItem",position:1,name:"Cities",item:`${H}/cities`},{"@type":"ListItem",position:2,name:E,item:`${H}/cities/${t.slug}`}]}}),a.jsx(xe,{to:"/cities",className:"tracked-caps text-primary hover:underline",children:"â All cities"}),a.jsx("h1",{className:"font-display text-4xl sm:text-5xl md:text-7xl mt-4 mb-2 break-words",children:j(t)||"City"}),t.name&&t.country&&a.jsx("p",{className:"tracked-caps text-muted-foreground mb-10 sm:mb-12",children:t.country}),a.jsxs("div",{className:"mb-8 flex flex-col items-start justify-between gap-3 sm:flex-row sm:items-end",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:w?`${ne} of ${I} models`:`${I} models`}),a.jsxs("div",{className:"flex w-full flex-col items-stretch gap-3 sm:w-auto sm:flex-row sm:items-end",children:[a.jsxs("div",{className:"relative w-full sm:w-72",children:[a.jsx(be,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(_e,{type:"search",value:$,onChange:e=>K(e.target.value),placeholder:"Search by nameâ¦",className:"pl-9","aria-label":"Search models by name"})]}),a.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row",children:[a.jsxs(J,{value:m,onValueChange:e=>R("sort",e),children:[a.jsx(X,{className:"w-44",children:a.jsx(Y,{})}),a.jsxs(ee,{children:[a.jsx(x,{value:"az",children:"AâZ"}),a.jsx(x,{value:"newest",children:"Newest"}),a.jsx(x,{value:"featured",children:"Featured first"}),a.jsx(x,{value:"views",children:"Most Viewed"}),a.jsx(x,{value:"popular",children:"Most Popular"})]})]}),h&&a.jsxs(J,{value:L,onValueChange:e=>R("window",e),children:[a.jsx(X,{className:"w-44",children:a.jsx(Y,{})}),a.jsx(ee,{children:Object.entries(Ne).map(([e,s])=>a.jsx(x,{value:e,children:s},e))})]})]})]})]}),G&&a.jsxs("section",{className:"mb-12 sm:mb-16",children:[a.jsx("div",{className:"luxury-divider mb-6 sm:mb-8",children:"Based here"}),a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 sm:gap-6",children:M.map((e,s)=>a.jsx(te,{model:e,media:N[e.id],mediaState:se(N[e.id],{requested:o.length>0,isPending:d.isPending,isFetching:d.isFetching,isError:d.isError,isSuccess:d.isSuccess}),tags:Q[e.id]??[],travelDates:z[e.id]??[],priority:s<4,mediaRef:void 0,navSourceKey:n,onOpenModel:W},e.id))})]}),P&&a.jsxs("section",{id:"visiting-soon",style:{scrollMarginTop:96},children:[a.jsx("div",{className:"luxury-divider mb-6 sm:mb-8",children:"Visiting soon"}),a.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 sm:gap-6",children:q.map(e=>a.jsx(te,{model:e.model,media:N[e.model.id],mediaState:se(N[e.model.id],{requested:o.length>0,isPending:d.isPending,isFetching:d.isFetching,isError:d.isError,isSuccess:d.isSuccess}),tags:Q[e.model.id]??[],travelDates:z[e.model.id]??[],priority:U.enabled,mediaRef:void 0,navSourceKey:n,onOpenModel:W},e.model.id))})]}),!G&&!P&&a.jsx("div",{className:"rounded-md border border-dashed border-border px-6 py-12 text-center text-muted-foreground",children:I===0?`No models listed in ${j(t)||"this location"} yet. Please check back soon.`:`No models match "${F}".`})]})}
1export{Be 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.