PageSourceSearch

https://rockypoint.ai/assets/VacationRentalDetail-DTq-Y4aF.js

js rockypoint.ai collected 2026-10-05 14:42:41 UTC 33,359 bytes, 33 lines download raw bytes

1import{a3 as ts,e as as,a as ns,r as g,b as W,s as N,Q as x,aV as is,az as L,j as e,L as E,t as Ce,o as me,B as w,F as De,H as ls,d as Ie,p as I,w as qe,aT as rs,$ as os,M as cs,C as J,K as X,N as ue,c as Z,a2 as ds,a1 as ms,D as us,aW as Te,X as hs,I as q}from"./index-PtGACUVf.js";import{i as gs,C as xs}from"./calendar-C7TVkOYb.js";import{D as Ae,a as Le,c as Fe,b as ps,e as fs}from"./dialog-1knjOMG6.js";import{A as bs,a as ys,b as js,c as Ns}from"./accordion-C0Ur54yv.js";import{L as M}from"./label-BGYTmHnu.js";import{T as _s}from"./textarea-B113Ozlu.js";import{C as $e}from"./chevron-left-CXyk187g.js";import{P as Be}from"./paw-print-YHUc5ZPV.js";import{B as vs}from"./bed-CBE_cWO1.js";import{B as ws}from"./bath-BiuPki1m.js";import{C as Oe}from"./circle-alert-zZK6adB6.js";import{C as Ve}from"./circle-check-CH_kw0yO.js";import{E as Ee}from"./external-link-ByXnn-Nj.js";import{a as ks}from"./subDays-BTfryw0e.js";import"./differenceInCalendarMonths-jwbKP_Yg.js";import"./startOfMonth-oiJ2Uv4a.js";import"./addWeeks-DUhIpodf.js";import"./endOfWeek-BXxCPcEl.js";import"./endOfMonth-SSXmClIb.js";import"./index-DU2LHGu_.js";import"./index-BoiDcb2D.js";const Re=f=>{const[k,_,c]=f.split("-");return`${_}/${c}/${k}`};function Ss(f,k,_,c,y){const T=(k||"").trim().replace(/^[?&]+/,"");if(!T||!_||!c)return f;const P={checkin:_,checkout:c,checkin_mdy:Re(_),checkout_mdy:Re(c),guests:y?String(y):""},F=T.replace(/\{(checkin_mdy|checkout_mdy|checkin|checkout|guests)\}/g,(i,ee)=>encodeURIComponent(P[ee]));return f+(f.includes("?")?"&":"?")+F}const Ms=f=>/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(f),Js=()=>{var ke,Se;const{id:f}=ts(),[k]=as(),_=k.get("source"),{city:c}=ns(),[y,T]=g.useState(0),[P,F]=g.useState(!1),[i,ee]=g.useState(()=>{const t=k.get("checkin"),n=k.get("checkout"),r=o=>!!o&&/^\d{4}-\d{2}-\d{2}$/.test(o)&&!isNaN(new Date(o+"T00:00:00").getTime());if(r(t)&&r(n)&&n>t){const o=new Date(t+"T00:00:00"),v=new Date;if(v.setHours(0,0,0,0),o>=v)return{from:o,to:new Date(n+"T00:00:00")}}}),Qe=Math.min(30,Math.max(0,parseInt(k.get("guests")||"0")||0)),d=i==null?void 0:i.from,m=i==null?void 0:i.to,[R,he]=g.useState(!1),[Q,se]=g.useState(null),[te,ge]=g.useState(!1),[u,ae]=g.useState(null),[ne,U]=g.useState(!1),[ie,xe]=g.useState(null);g.useEffect(()=>{if(!ne||typeof window>"u")return;const t=window.visualViewport,n=()=>{if(window.innerWidth>=640){xe(null);return}xe({height:t?t.height:window.innerHeight,top:t?t.offsetTop:0})};return n(),t==null||t.addEventListener("resize",n),t==null||t.addEventListener("scroll",n),window.addEventListener("resize",n),()=>{t==null||t.removeEventListener("resize",n),t==null||t.removeEventListener("scroll",n),window.removeEventListener("resize",n)}},[ne]);const[pe,fe]=g.useState(!1),[z,be]=g.useState(null),[l,j]=g.useState({firstName:"",lastName:"",email:"",phone:"",adults:Qe||1,children:0,pets:0,message:""}),{data:s,isLoading:ye}=W({queryKey:["vacation-rental-pms",f],queryFn:async()=>{var Me;const t=Ms(f||""),{data:n,error:r}=await N.from("vacation_rental_properties").select(`
2          *,
3          vacation_rental_images (
4            id,
5            url,
6            caption,
7            sort_order
8          ),
9          businesses (
10            id,
11            name,
12            slug,
13            phone,
14            email,
15            website
16          ),
17          pms_connections (
18            id,
19            pms_type
20          )
21        `).eq(t?"id":"slug",f).eq("is_active",!0).single();if(r)return null;let o=((Me=n==null?void 0:n.pms_connections)==null?void 0:Me.pms_type)??null;if(!o&&(n!=null&&n.pms_connection_id)){const{data:de}=await N.rpc("get_property_pms_type",{p_property_id:n.id});o=de??null}let v=null;if(n!=null&&n.pms_connection_id){const{data:de}=await N.rpc("get_property_booking_link_template",{p_property_id:n.id});v=de??null}return{...n,pms_type_resolved:o,booking_link_template_resolved:v}},enabled:!!f&&_!=="showcase"}),{data:h,isLoading:Ue}=W({queryKey:["vacation-rental-showcase",f],queryFn:async()=>{const{data:t,error:n}=await N.from("business_showcase").select(`
22          *,
23          businesses (
24            id,
25            name,
26            slug,
27            phone,
28            email,
29            website,
30            city,
31            state
32          )
33        `).eq("id",f).eq("is_active",!0).single();return n?null:t},enabled:!!f&&(_==="showcase"||!s&&!ye)}),$=!!(s!=null&&s.pms_connection_id),le=((s==null?void 0:s.pms_type_resolved)||"track").toLowerCase(),p=le==="streamline",B=t=>`${p?"streamline":"track"}-${t}`,[ze,H]=g.useState(!1),He=ye||_==="showcase"&&Ue,{data:O,isLoading:Ye}=W({queryKey:["property-availability",s==null?void 0:s.id,le],queryFn:async()=>
33{if(!(s!=null&&s.pms_connection_id))return[];const t=new Date,n=new Date(t.getTime()+365*24*60*60*1e3),{data:r,error:o}=await N.functions.invoke(B("get-availability"),{body:{pms_connection_id:s.pms_connection_id,unit_id:s.pms_unit_id,start_date:x(t,"yyyy-MM-dd"),end_date:x(n,"yyyy-MM-dd")}});return o||p&&(r==null?void 0:r.success)===!1?(console.error("Error fetching availability:",o),p&&H(!0),[]):(r==null?void 0:r.blocked_dates)||[]},enabled:!!(s!=null&&s.pms_connection_id)&&!!(s!=null&&s.pms_unit_id),staleTime:5*60*1e3}),{data:S}=W({queryKey:["property-pricing",s==null?void 0:s.id,le],queryFn:async()=>{var o;if(!(s!=null&&s.pms_connection_id)||!(s!=null&&s.pms_unit_id))return null;const t=x(new Date,"yyyy-MM-dd"),n=x(ks(new Date,365),"yyyy-MM-dd"),r=await N.functions.invoke(B("get-pricing"),{body:{connectionId:s.pms_connection_id,unitId:s.pms_unit_id,startDate:t,endDate:n}});return p&&(r.error||((o=r.data)==null?void 0:o.success)===!1)?(H(!0),null):(console.log("Pricing data:",r.data),r.data)},enabled:!!(s!=null&&s.pms_connection_id)&&!!(s!=null&&s.pms_unit_id),staleTime:5*60*1e3}),Y=g.useMemo(()=>!O||!Array.isArray(O)?[]:(console.log("Blocked dates from TRACK:",O),O.map(t=>new Date(t+"T00:00:00"))),[O]),K=g.useMemo(()=>{if(!(i!=null&&i.from)||i!=null&&i.to)return null;const t=is(i.from).getTime();return Y.filter(n=>n.getTime()>t).sort((n,r)=>n.getTime()-r.getTime())[0]||null},[Y,i==null?void 0:i.from,i==null?void 0:i.to]),je=K?Y.filter(t=>!gs(t,K)):Y,a=g.useMemo(()=>{var t,n;if(s){const r=(s.vacation_rental_images||[]).sort((o,v)=>(o.sort_order||0)-(v.sort_order||0));return{id:s.id,name:s.name,headline:s.headline,description:s.short_description,long_description:s.long_description,images:r.map(o=>({id:o.id,url:o.url,caption:o.caption||void 0})),bedrooms:s.bedrooms,bathrooms:s.bathrooms,sleeps:s.sleeps,pet_friendly:s.pet_friendly,lodging_type:s.lodging_type,amenities:Array.isArray(s.amenities)?s.amenities:[],address:s.address,city:s.city,state:s.state,latitude:s.latitude,longitude:s.longitude,base_rate:s.base_rate,booking_url:s.booking_url,cta_text:s.cta_text||"Request to Book",business:s.businesses}}if(h){const r=Array.isArray(h.photos)?h.photos:[];return{id:h.id,name:h.title,headline:null,description:h.description,long_description:h.description,images:r.map((o,v)=>({id:`photo-${v}`,url:o})),bedrooms:h.bedrooms,bathrooms:h.bathrooms,sleeps:h.sleeps,pet_friendly:!1,lodging_type:null,amenities:Array.isArray(h.amenities)?h.amenities:[],address:h.address,city:((t=h.businesses)==null?void 0:t.city)||null,state:((n=h.businesses)==null?void 0:n.state)||null,latitude:h.latitude,longitude:h.longitude,base_rate:h.price?parseFloat(h.price):null,booking_url:h.booking_url,cta_text:h.cta_text||"Book Now",business:h.businesses}}return null},[s,h]),A=(t=>{if(!t||!(S!=null&&S.minStayByDate))return(S==null?void 0:S.defaultMinStay)||2;const n=x(t,"yyyy-MM-dd");return S.minStayByDate[n]||S.defaultMinStay||2})(i==null?void 0:i.from),V=i!=null&&i.from&&(i!=null&&i.to)?Math.ceil((i.to.getTime()-i.from.getTime())/(1e3*60*60*24)):0,C=V>=A,re=g.useMemo(()=>{var r;const t=((s==null?void 0:s.booking_url)||((r=s==null?void 0:s.businesses)==null?void 0:r.website)||"").trim();if(!t)return null;const n=/^https?:\/\//i.test(t)?t:`https://${t}`;return Ss(n,s==null?void 0:s.booking_link_template_resolved,d?x(d,"yyyy-MM-dd"):null,m?x(m,"yyyy-MM-dd"):null,(l.adults||0)+(l.children||0)||null)},[s,d,m,l.adults,l.children]),Ke=()=>{s!=null&&s.id&&N.from("vacation_rental_referrals").insert({property_id:s.id,pms_connection_id:s.pms_connection_id||null,source_domain:(c==null?void 0:c.domain)||window.location.hostname,arrival_date:d?x(d,"yyyy-MM-dd"):null,departure_date:m?x(m,"yyyy-MM-dd"):null,adults:l.adults||null,children:l.children||0,outgoing_url:re}).then(({error:t})=>{t&&console.error("Referral log failed:",t.message)})};g.useEffect(()=>{console.log("[VacationRentalDetail] dateRange changed:",{arrivalDate:d==null?void 0:d.toISOString(),departureDate:m==null?void 0:m.toISOString(),isPMS:$,hasConnection:!!(s!=null&&s.pms_connection_id),hasUnitId:!!(s!=null&&s.pms_unit_id),selectedNights:V,requiredMinStay:A,meetsMinStay:C}),d&&m&&$&&(s!=null&&s.pms_connection_id)&&(s!=null&&s.pms_unit_id)&&C?(console.log("[VacationRentalDetail] Triggering checkAvailability - NO NAVIGATION SHOULD OCCUR"),Ge()):(se(null),ae(null))},[d,m,$,s==null?void 0:s.pms_connection_id,s==null?void 0:s.pms_unit_id,C]);const Ge=async()=>
33{if(console.log("[VacationRentalDetail] checkAvailability START - should NOT navigate"),!d||!m||!(s!=null&&s.pms_connection_id)||!(s!=null&&s.pms_unit_id)){console.log("[VacationRentalDetail] checkAvailability - missing required data, returning");return}he(!0),se(null),ae(null);try{console.log(`[VacationRentalDetail] Calling ${B("check-availability")} edge function...`);const t=await N.functions.invoke(B("check-availability"),{body:{pms_connection_id:s.pms_connection_id,unit_id:s.pms_unit_id,arrival_date:x(d,"yyyy-MM-dd"),departure_date:x(m,"yyyy-MM-dd")}});if(console.log("[VacationRentalDetail] availability response received"),t.error)throw new Error(t.error.message);const{available:n}=t.data;console.log("[VacationRentalDetail] Availability result:",n),se(n),n&&(console.log("[VacationRentalDetail] Property is available, fetching quote..."),await We(),console.log("[VacationRentalDetail] fetchQuote completed - STILL should NOT navigate"))}catch(t){console.error("[VacationRentalDetail] Error checking availability:",t),p?H(!0):L({title:"Error checking availability",description:"Please try again later",variant:"destructive"})}finally{console.log("[VacationRentalDetail] checkAvailability END - should NOT have navigated"),he(!1)}},We=async()=>{var t,n;if(console.log("[VacationRentalDetail] fetchQuote START - should NOT navigate"),!d||!m||!(s!=null&&s.pms_connection_id)||!(s!=null&&s.pms_unit_id)){console.log("[VacationRentalDetail] fetchQuote - missing required data, returning");return}ge(!0);try{console.log("[VacationRentalDetail] Calling track-get-quote edge function:",{pms_connection_id:s.pms_connection_id,unit_id:s.pms_unit_id,arrival_date:x(d,"yyyy-MM-dd"),departure_date:x(m,"yyyy-MM-dd"),adults:l.adults,children:l.children});const r=await N.functions.invoke(B("get-quote"),{body:{pms_connection_id:s.pms_connection_id,unit_id:s.pms_unit_id,arrival_date:x(d,"yyyy-MM-dd"),departure_date:x(m,"yyyy-MM-dd"),adults:l.adults||2,children:l.children||0}});if(console.log("[VacationRentalDetail] Quote response received:",r.data,r.error),r.error||p&&((t=r.data)==null?void 0:t.success)===!1)throw new Error(((n=r.error)==null?void 0:n.message)||"quote failed");console.log("[VacationRentalDetail] Setting quote state - NO navigation"),ae(r.data)}catch(r){console.error("[VacationRentalDetail] Error fetching quote:",r),p?H(!0):L({title:"Error fetching quote",description:"Please try again later",variant:"destructive"})}finally{console.log("[VacationRentalDetail] fetchQuote END - should NOT have navigated"),ge(!1)}},Je=async t=>{if(t.preventDefault(),console.log("=== INQUIRY SUBMISSION START ==="),console.log("Property ID:",s==null?void 0:s.id),console.log("PMS Connection ID:",s==null?void 0:s.pms_connection_id),console.log("Arrival Date:",d),console.log("Departure Date:",m),console.log("Guest info:",l),console.log("Quote:",u),!d||!m){L({title:"Please select dates",variant:"destructive"});return}if(!l.firstName||!l.lastName||!l.email){L({title:"Please fill in required fields",variant:"destructive"});return}fe(!0);try{const n={property_id:s==null?void 0:s.id,pms_connection_id:(s==null?void 0:s.pms_connection_id)||null,property_name:(a==null?void 0:a.name)||"",first_name:l.firstName,last_name:l.lastName,email:l.email,phone:l.phone||null,arrival_date:x(d,"yyyy-MM-dd"),departure_date:x(m,"yyyy-MM-dd"),adults:l.adults||1,children:l.children||0,pets:a!=null&&a.pet_friendly&&l.pets||0,quoted_total:(u==null?void 0:u.total)||null,
33notes:l.message.trim()||null,status:"pending",source_city_id:(c==null?void 0:c.id)||null,source_domain:(c==null?void 0:c.domain)||window.location.hostname};console.log("Inquiry data to insert:",n);const{data:r,error:o}=await N.from("vacation_rental_inquiries").insert(n).select().single();if(o)throw console.error("Supabase insert error:",o),console.error("Error code:",o.code),console.error("Error message:",o.message),console.error("Error details:",o.details),o;console.log("Inquiry saved successfully:",r),be({reservationId:r.id}),L({title:"Request Submitted!",description:"The property manager will contact you shortly."}),j({firstName:"",lastName:"",email:"",phone:"",adults:1,children:0,pets:0,message:""})}catch(n){console.error("=== INQUIRY SUBMISSION FAILED ==="),console.error("Full error object:",n),L({title:"Error submitting request",description:(n==null?void 0:n.message)||"Please try again later",variant:"destructive"})}finally{fe(!1)}},Ne=()=>{U(!1),be(null),j({firstName:"",lastName:"",email:"",phone:"",message:"",adults:1,children:0,pets:0})},[oe,Xe]=g.useState(!1),[ce,Ze]=g.useState(!1),G=((a==null?void 0:a.long_description)||"").replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim(),_e=(()=>{if(G.length<=240)return G;const t=G.slice(0,240),n=t.lastIndexOf(" ");return(n>0?t.slice(0,n):t)+"…"})(),Pe=G.length>_e.length;if(He)return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:e.jsx(E,{className:"h-8 w-8 animate-spin text-primary"})});if(!a)return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(Ce,{}),e.jsxs("div",{className:"container mx-auto px-4 py-20 text-center",children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground mb-4",children:"Property Not Found"}),e.jsx("p",{className:"text-muted-foreground mb-6",children:"The vacation rental you're looking for doesn't exist or is no longer available."}),e.jsx(me,{to:"/",children:e.jsx(w,{children:"Return Home"})})]}),e.jsx(De,{cityName:(c==null?void 0:c.name)||"",citySlug:(c==null?void 0:c.slug)||""})]});const b=a.images,D=a.business,ve=()=>{T(t=>t===0?b.length-1:t-1)},we=()=>{T(t=>t===b.length-1?0:t+1)},es=`${a.name||"Vacation Rental"} | ${(c==null?void 0:c.name)||"Vacation Rentals"}`,ss=a.headline||a.description||`Book ${a.name} - ${a.bedrooms} bedrooms, sleeps ${a.sleeps}`;return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsxs(ls,{children:[e.jsx("title",{children:es}),e.jsx("meta",{name:"description",content:ss})]}),e.jsx(Ce,{}),e.jsxs("main",{className:"container mx-auto px-4 py-8",children:[e.jsxs("nav",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-6",children:[e.jsx(me,{to:"/",className:"hover:text-primary",children:"Home"}),e.jsx("span",{children:"/"}),e.jsx(me,{to:"/vacation-rentals",className:"hover:text-primary",children:"Vacation Rentals"}),e.jsx("span",{children:"/"}),e.jsx("span",{className:"text-foreground",children:a.name})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8",children:[e.jsxs("div",{className:"lg:col-span-2 lg:col-start-1 lg:row-start-1 space-y-8",children:[b.length>0&&e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"aspect-[16/9] rounded-2xl overflow-hidden cursor-pointer",onClick:()=>F(!0),children:e.jsx("img",{src:(ke=b[y])==null?void 0:ke.url,alt:((Se=b[y])==null?void 0:Se.caption)||a.name||"Property",className:"w-full h-full object-cover"})}),b.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:t=>{t.stopPropagation(),ve()},className:"absolute left-4 top-1/2 -translate-y-1/2 bg-background/80 hover:bg-background p-2 rounded-full shadow-lg transition-colors",children:e.jsx($e,{className:"h-6 w-6"})}),e.jsx("button",{onClick:t=>{t.stopPropagation(),we()},className:"absolute right-4 top-1/2 -translate-y-1/2 bg-background/80 hover:bg-background p-2 rounded-full shadow-lg transition-colors",children:e.jsx(Ie,{className:"h-6 w-6"})})]}),b.length>1&&e.jsx("div",{className:"flex gap-2 mt-4 overflow-x-auto pb-2",children:b.map((t,n)=>e.jsx("button",{onClick:()=>
33T(n),className:I("flex-shrink-0 w-20 h-14 rounded-lg overflow-hidden border-2 transition-colors",n===y?"border-primary":"border-transparent opacity-70 hover:opacity-100"),children:e.jsx("img",{src:t.url,alt:t.caption||`Image ${n+1}`,className:"w-full h-full object-cover"})},t.id))})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-4",children:[a.lodging_type&&e.jsxs(qe,{variant:"secondary",className:"text-sm",children:[e.jsx(rs,{className:"h-3.5 w-3.5 mr-1"}),a.lodging_type]}),a.pet_friendly&&e.jsxs(qe,{className:"bg-accent text-accent-foreground",children:[e.jsx(Be,{className:"h-3.5 w-3.5 mr-1"}),"Pet Friendly"]})]}),e.jsx("h1",{className:"font-display text-3xl md:text-4xl font-bold text-foreground mb-2",children:a.name}),a.headline&&e.jsx("p",{className:"text-lg text-muted-foreground mb-4",children:a.headline}),e.jsxs("div",{className:"flex flex-wrap items-center gap-6 text-foreground mb-6",children:[a.bedrooms!=null&&e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(vs,{className:"h-5 w-5 text-primary"}),e.jsx("span",{className:"font-medium",children:a.bedrooms})," Bedrooms"]}),a.bathrooms!=null&&e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(ws,{className:"h-5 w-5 text-primary"}),e.jsx("span",{className:"font-medium",children:a.bathrooms})," Bathrooms"]}),a.sleeps!=null&&e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(os,{className:"h-5 w-5 text-primary"}),e.jsx("span",{children:"Sleeps"})," ",e.jsx("span",{className:"font-medium",children:a.sleeps})]})]}),(a.city||a.state)&&e.jsxs("div",{className:"flex items-start gap-2 text-muted-foreground mb-6",children:[e.jsx(cs,{className:"h-5 w-5 mt-0.5 flex-shrink-0"}),e.jsx("span",{children:[a.city,a.state].filter(Boolean).join(", ")})]})]})]}),e.jsxs("div",{className:"space-y-8 order-3 lg:order-none lg:col-span-2 lg:col-start-1 lg:row-start-2",children:[a.long_description&&e.jsxs(J,{children:[e.jsx(X,{children:e.jsx(ue,{children:"About This Property"})}),e.jsx(Z,{children:Pe?e.jsxs(e.Fragment,{children:[!oe&&e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:_e}),e.jsx(bs,{type:"single",collapsible:!0,value:oe?"about":"",onValueChange:t=>Xe(t==="about"),children:e.jsxs(ys,{value:"about",className:"border-b-0",children:[e.jsx(js,{className:"py-2 text-sm text-primary justify-start gap-1.5 [&>svg]:ml-0.5",children:oe?"Show less":"Read full description"}),e.jsx(Ns,{children:e.jsx("div",{className:"prose prose-sm max-w-none text-muted-foreground",dangerouslySetInnerHTML:{__html:a.long_description.replace(/\n/g,"<br/>")}})})]})})]}):e.jsx("div",{className:"prose prose-sm max-w-none text-muted-foreground",dangerouslySetInnerHTML:{__html:a.long_description.replace(/\n/g,"<br/>")}})})]}),a.amenities.length>0&&e.jsxs(J,{children:[e.jsx(X,{children:e.jsx(ue,{children:"Amenities"})}),e.jsxs(Z,{children:[e.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-3",children:(ce?a.amenities:a.amenities.slice(0,6)).map((t,n)=>e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(ds,{className:"h-4 w-4 text-primary flex-shrink-0"}),e.jsx("span",{children:t})]},n))}),a.amenities.length>6&&e.jsxs("button",{onClick:()=>Ze(t=>!t),className:"mt-3 flex items-center gap-1.5 text-sm font-medium text-primary hover:underline",children:[ce?"Show fewer":`Show all ${a.amenities.length} amenities`,e.jsx(ms,{className:I("h-4 w-4 transition-transform duration-200",ce&&"rotate-180")})]})]})]}),a.latitude&&a.longitude&&e.jsxs(J,{children:[e.jsx(X,{children:e.jsx(ue,{children:"Location"})}),e.jsx(Z,{children:e.jsx("div",{className:"aspect-[16/9] rounded-lg overflow-hidden bg-muted",children:e.jsx("iframe",{src:`https://www.openstreetmap.org/export/embed.html?bbox=${a.longitude-.01},${a.latitude-.01},${a.longitude+.01},${a.latitude+.01}&layer=mapnik&marker=${a.latitude},${a.longitude}`,className:"w-full h-full border-0",loading:"lazy",title:"Property location"})})})]})]}),e.jsx("div",{className:"order-2 lg:order-none lg:col-span-1 lg:col-start-3 lg:row-start-1 lg:row-span-2",children:e.jsx("div",{className:"sticky top-24",children:e.jsxs(J,{className:"shadow-lg",children:[e.jsx(X,{children:e.jsx("div",{className:"flex items-baseline gap-2",children:!(u&&u.success&&u.total>0)&&e.jsx("span",{className:"text-lg font-semibold text-foreground",children:"Select dates for pricing"})})}),e.jsxs(Z,{className:"space-y-4",children:[$&&s?e.jsxs(e.Fragment,{children:[!(p&&ze)&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"font-medium text-foreground",children:"Select Your Dates"}),e.jsxs("div",{className:"flex gap-2 text-sm",children:[e.jsxs("div",{className:I("flex-1 p-3 border rounded-md text-center",d?"border-primary bg-primary/5":"border-border"),children:[e.jsx("div",{className:"text-muted-foreground text-xs mb-1",children:"Check In"}),e.jsx("div",{className:I("font-medium",!d&&"text-muted-foreground"),children:d?x(d,"MMM d, yyyy"):"Select date"})]}),e.jsxs("div",{className:I("flex-1 p-3 border rounded-md text-center",m?"border-primary bg-primary/5":"border-border"),children:[e.jsx("div",{className:"text-muted-foreground text-xs mb-1",children:"Check Out"}),e.jsx("div",{className:I("font-medium",!m&&"text-muted-foreground"),children:m?x(m,"MMM d, yyyy"):"Select date"})]})]}),e.jsx("div",{className:"border rounded-lg p-2 flex justify-center",onClick:t=>t.stopPropagation(),onMouseDown:t=>t.stopPropagation(),children:Ye?e.jsxs("div",{className:"flex items-center justify-center p-8",children:[e.jsx(E,{className:"h-6 w-6 animate-spin text-primary"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading availability..."})]}):e.jsx(xs,{mode:"range",selected:i,onSelect:ee,disabled:[{before:new Date},...je,...K?[{after:K}]:[]],numberOfMonths:1,className:"p-0 pointer-events-auto w-full",modifiers:{booked:je},modifiersClassNames:{booked:"line-through text-muted-foreground
33/50 bg-muted cursor-not-allowed"},classNames:{months:"flex justify-center w-full",month:"w-full",table:"w-full",head_row:"flex justify-between",row:"flex w-full justify-between mt-2",day_disabled:"text-muted-foreground/30 cursor-not-allowed hover:bg-transparent",day_selected:"bg-primary text-primary-foreground hover:bg-primary",day_range_middle:"bg-primary/10 text-foreground",day_today:"border border-primary"}})}),e.jsxs("div",{className:"flex items-center justify-center gap-4 text-xs text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-3 h-3 rounded-sm bg-primary"}),e.jsx("span",{children:"Selected"})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("div",{className:"w-3 h-3 rounded-sm bg-muted border"}),e.jsx("span",{children:"Unavailable"})]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(us,{className:"h-4 w-4"}),e.jsxs("span",{children:[A,"-night minimum"]})]}),(i==null?void 0:i.from)&&(i==null?void 0:i.to)&&!C&&e.jsx("div",{className:"bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 rounded-lg p-3",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(Oe,{className:"h-4 w-4 mt-0.5 text-amber-600 dark:text-amber-400 flex-shrink-0"}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm font-medium text-amber-800 dark:text-amber-200",children:[A,"-night minimum for this arrival date"]}),e.jsxs("p",{className:"text-xs text-amber-600 dark:text-amber-400 mt-1",children:["You selected ",V," night",V!==1?"s":"",". Please select at least ",A," nights."]})]})]})}),R&&e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(E,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{className:"text-sm",children:"Checking availability..."})]}),!R&&Q===!0&&C&&e.jsxs("div",{className:"flex items-center gap-2 text-green-600 dark:text-green-400",children:[e.jsx(Ve,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm font-medium",children:"Available for your dates!"})]}),!R&&Q===!1&&e.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[e.jsx(Oe,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm font-medium",children:"Not available for these dates"})]}),te&&e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx(E,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{className:"text-sm",children:"Loading pricing..."})]}),u&&!te&&u.success&&u.total>0&&u.nights>0&&e.jsx("div",{className:"border-t pt-4",children:e.jsxs("p",{className:"text-lg text-foreground",children:[e.jsx("span",{className:"text-2xl font-bold",children:Te(u.total)})," ","total for ",u.nights," night",u.nights!==1?"s":"",", includes all taxes and fees"]})}),u&&!te&&!u.success&&!p&&e.jsxs("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-3 text-sm text-destructive",children:["Unable to get quote: ",u.error]})]}),p?e.jsx(e.Fragment,{children:re?e.jsxs(e.Fragment,{children:[e.jsx("a",{href:re,target:"_blank",rel:"noopener noreferrer",className:"block",onClick:Ke,children:e.jsxs(w,{className:"w-full",size:"lg",children:[e.jsx(Ee,{className:"h-4 w-4 mr-2"}),"Book Direct"]})}),e.jsx(w,{variant:"outline",className:"w-full",disabled:!d||!m,onClick:()=>U(!0),children:d&&m?"Ask a question":"Select dates to ask a question"})]}):e.jsx(w,{className:"w-full",size:"lg",disabled:!d||!m,onClick:()=>U(!0),children:d&&m?"Ask a question":"Select dates to ask a question"})}):e.jsx(w,{className:"w-full",size:"lg",disabled:!d||!m||!C||Q!==!0||R||!u,onClick:()=>U(!0),children:!C&&V>0?`Select at least ${A} nights`:Q===!0&&u?"Request to Book":"Check Dates to Book"})]}):e.jsx(e.Fragment,{children:a.booking_url?e.jsx("a",{href:a.booking_url,target:"_blank",rel:"noopener noreferrer",className:"block",children:e.jsxs(w,{className:"w-full",size:"lg",children:[e.jsx(Ee,{className:"h-4 w-4 mr-2"}),a.cta_text]})}):e.jsx(w,{className:"w-full",size:"lg",disabled:!0,children:"Contact for Booking"})}),D&&e.jsxs("div",{className:"pt-4 border-t space-y-2",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Managed by ",e.jsx("span",{className:"font-medium text-foreground",children:D.name})]}),D.phone&&e.jsx("a",{href:`tel:${D.phone}`,className:"block text-sm text-primary hover:underline",children:D.phone}),D.website&&e.jsx("a",{href:D.website,target:"_blank",rel:"noopener noreferrer",className:"block text-sm text-primary hover:underline",children:"Visit Website"})]})]})]})})})]})]}),e.jsx(Ae,{open:P,onOpenChange:F,children:e.jsxs(Le,{className:"max-w-5xl p-0 bg-black/95",children:[e.jsx(Fe,{className:"sr-only",children:"Image Gallery"}),e.jsxs("div",{className:"relative",children:[e.jsx("button",{onClick:()=>F(!1),className:"absolute top-4 right-4 z-10 bg-background/20 hover:bg-background/40 p-2 rounded-full transition-colors",children:e.jsx(hs,{className:"h-6 w-6 text-white"})}),e.jsx("div",{className:"aspect-[16/9] flex items-center justify-center",children:b[y]&&e.jsx("img",{src:b[y].url,alt:b[y].caption||"Property image",className:"max-h-full max-w-full object-contain"})}),b.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:ve,className:"absolute left-4 top-1/2 -translate-y-1/2 bg-background/20 hover:bg-background/40 p-3 rounded-full transition-colors",children:e.jsx($e,{className:"h-8 w-8 text-white"})}),e.jsx("button",{onClick:we,className:"absolute right-4 top-1/2 -translate-y-1/2 bg-background/20 hover:bg-background/40 p-3 rounded-full transition-colors",children:e.jsx(Ie,{className:"h-8 w-8 text-white"})})]}),e.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 text-white text-sm",children:[y+1," / ",b.length]})]})]})}),$&&e.jsx(Ae,{open:ne,onOpenChange:t=>!t&&Ne(),children:e.jsx(Le,{className:"left-0 top-0 translate-x-0 translate-y-0 max-w-none h-[100dvh] rounded-none border-0 p-0 gap-0 flex flex-col overflow-hidden data-[state=open]:slide-in-from-left-0 data-[state=open]:slide-in-from-top-0 data-[state=closed]:slide-out-to-left-0 data-[state=closed]:slide-out-to-top-0 sm:left-[50%] sm:top-[50%] sm:translate-x-[-50%] sm:translate-y-[-50%] sm:max-w-md 
33sm:h-auto sm:max-h-[90dvh] sm:rounded-lg sm:border",style:ie?{height:`${ie.height}px`,top:`${ie.top}px`}:void 0,children:e.jsxs("div",{"data-inquiry-scroll":!0,className:"flex-1 min-h-0 overflow-y-auto overscroll-contain p-6 pb-10 space-y-4 [-webkit-overflow-scrolling:touch] [touch-action:pan-y]",children:[e.jsxs(ps,{children:[e.jsx(Fe,{children:z?p?"Question Sent!":"Request Submitted!":p?"Ask a question":"Request to Book"}),!z&&e.jsxs(fs,{children:[a.name," • ",d&&m&&`${x(d,"MMM d")} - ${x(m,"MMM d, yyyy")}`]})]}),z?e.jsxs("div",{className:"text-center py-6 space-y-4",children:[e.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:e.jsx(Ve,{className:"h-8 w-8 text-green-600 dark:text-green-400"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-foreground font-medium",children:"Thank you for your request!"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Your confirmation number is:"}),e.jsx("p",{className:"text-lg font-mono font-semibold text-primary",children:z.reservationId}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"We'll be in touch shortly to confirm your booking."})]}),e.jsx(w,{onClick:Ne,className:"w-full",children:"Done"})]}):e.jsxs("form",{onSubmit:Je,className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(M,{htmlFor:"firstName",children:"First Name *"}),e.jsx(q,{id:"firstName",required:!0,value:l.firstName,onChange:t=>j({...l,firstName:t.target.value}),placeholder:"John"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(M,{htmlFor:"lastName",children:"Last Name *"}),e.jsx(q,{id:"lastName",required:!0,value:l.lastName,onChange:t=>j({...l,lastName:t.target.value}),placeholder:"Smith"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(M,{htmlFor:"email",children:"Email *"}),e.jsx(q,{id:"email",type:"email",required:!0,value:l.email,onChange:t=>j({...l,email:t.target.value}),placeholder:"[email protected]"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(M,{htmlFor:"phone",children:"Phone"}),e.jsx(q,{id:"phone",type:"tel",value:l.phone,onChange:t=>j({...l,phone:t.target.value}),placeholder:"(555) 123-4567"})]}),e.jsxs("div",{className:I("grid gap-4",a!=null&&a.pet_friendly?"grid-cols-3":"grid-cols-2"),children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(M,{htmlFor:"adults",children:"Adults *"}),e.jsx(q,{id:"adults",type:"number",min:1,required:!0,value:l.adults,onChange:t=>j({...l,adults:parseInt(t.target.value)||1})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(M,{htmlFor:"children",children:"Children"}),e.jsx(q,{id:"children",type:"number",min:0,value:l.children,onChange:t=>j({...l,children:parseInt(t.target.value)||0})})]}),(a==null?void 0:a.pet_friendly)&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(M,{htmlFor:"pets",children:"Pets"}),e.jsx(q,{id:"pets",type:"number",min:0,value:l.pets,onChange:t=>j({...l,pets:parseInt(t.target.value)||0})})]})]}),!(a!=null&&a.pet_friendly)&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[e.jsx(Be,{className:"inline h-3 w-3 mr-1"}),"This property does not allow pets"]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(M,{htmlFor:"message",children:[p?"Your Question":"Message"," ",p&&"*"]}),e.jsx(_s,{id:"message",required:p,maxLength:1e3,rows:4,value:l.message,onChange:t=>j({...l,message:t.target.value}),placeholder:p?"What would you like to know about this property?":"Anything we should know about your stay? (optional)"})]}),u&&u.success&&u.total>0&&u.nights>0&&e.jsx("div",{className:"bg-muted/50 rounded-lg p-4 space-y-1 text-sm",children:e.jsxs("p",{className:"text-foreground",children:[e.jsx("span",{className:"font-semibold",children:Te(u.total)})," total for ",u.nights," night",u.nights!==1?"s":"",", includes all taxes and fees"]})}),e.jsx(w,{type:"submit",className:"w-full",size:"lg",disabled:pe,children:pe?e.jsxs(e.Fragment,{children:[e.jsx(E,{className:"h-4 w-4 mr-2 animate-spin"}),"Submitting..."]}):"Submit Request"}),e.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"By 
33submitting, you agree to be contacted about your booking request."})]})]})})}),e.jsx(De,{cityName:(c==null?void 0:c.name)||"",citySlug:(c==null?void 0:c.slug)||""})]})};export{Js 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.