import{g as et}from"./listing-utils-DWgPJQzT.js";import{g as Le}from"./feeRates-DFYxRksI.js";import{e as tt}from"./listingFeeInput-BVaxVJEf.js";const Se=t=>t==="fixed"||t==="per_event"||t==="flat"?"per_event":t==="per_hour"||t==="per_person_per_hour"?t:"per_person",at=[{id:"austin",heading:"Popular venues in Austin",subtitle:"Live music capital & vibrant nightlife",tokens:["austin"],city:"Austin",state:"TX",cta:"Explore Austin venues",viewAllHref:"/venues?location=Austin%2C%20TX"},{id:"dallas",heading:"For your next event in Dallas",subtitle:"Upscale venues in the Design District & beyond",tokens:["dallas"],city:"Dallas",state:"TX",cta:"Discover Dallas venues",viewAllHref:"/venues?location=Dallas%2C%20TX"},{id:"houston",heading:"Top spaces in Houston",subtitle:"Diverse event spaces from downtown to the Heights",tokens:["houston"],city:"Houston",state:"TX",cta:"See Houston venues",viewAllHref:"/venues?location=Houston%2C%20TX"},{id:"philadelphia",heading:"Handpicked venues in Philadelphia",subtitle:"Historic spaces & modern lofts in the city of brotherly love",tokens:["philadelphia","philly"],city:"Philadelphia",state:"PA",cta:"Browse Philadelphia venues",viewAllHref:"/venues?location=Philadelphia%2C%20PA"}],lt=t=>{var ne,oe,re,se,ae,le,ce,ue,de,pe,me,ye,ge,fe,ve,he,be,Te,Ae,Pe,Re,Ie,Fe;const s=et(t)??null,n=s??{},a=t.listingKind==="service",p=(n==null?void 0:n.serviceData)??{},N=Array.isArray(p.offerings)?p.offerings.filter(e=>!!(e&&typeof e=="object")):[],u=a?N[0]:void 0,c=e=>typeof e=="string"&&e.trim().length>0?e.trim():void 0,w=e=>{const i=e==null?void 0:e.trim().toLowerCase();return i?i==="dj"?"DJ":i.split("_").filter(Boolean).map(o=>o.charAt(0).toUpperCase()+o.slice(1)).join(" "):"Service"},b=e=>{if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&e.trim()!==""){const i=Number(e);if(!Number.isNaN(i))return i}},T=n.metadata??{},r=T.pricing??{},$=T.venueDetails??{},m=T.locationDetails??{},A=m.manualFields??{},P=T.location??{},y=P.locationDetails??{},f=y.manualFields??{},S=m.coordinates??{},L=m.position??{},D=m.selection??{},_=y.coordinates??{},x=y.position??{},C=y.selection??{},Q=n;let I;if(typeof r.baseRate=="number")I=r.baseRate;else if(typeof r.baseRate=="string"){const e=Number(r.baseRate);Number.isNaN(e)||(I=e)}const De=[A.streetAddress,A.city,A.state,f.streetAddress,f.city,f.state].filter(e=>typeof e=="string"&&e.trim().length>0).join(", "),_e=t.locationLabel||((ne=n.location)==null?void 0:ne.formatted)||(typeof m.formattedAddress=="string"?m.formattedAddress:void 0)||(typeof y.formattedAddress=="string"?y.formattedAddress:void 0)||De||"Location coming soon",M=Array.isArray((oe=n.media)==null?void 0:oe.gallery)?(((re=n.media)==null?void 0:re.gallery)??[]).filter(e=>e&&e.type!=="video"&&typeof e.url=="string"&&e.url.trim().length>0).sort((e,i)=>{const o=typeof e.order=="number"?e.order:Number.POSITIVE_INFINITY,l=typeof i.order=="number"?i.order:Number.POSITIVE_INFINITY;return o-l}).map(e=>e.url.trim()):[],R=(ae=(se=n==null?void 0:n.media)==null?void 0:se.coverImage)==null?void 0:ae.trim(),V=a?c(p.coverImage):void 0,xe=(()=>{if(a&&V){const e=new Set,i=[];return V&&!e.has(V)&&(e.add(V),i.push(V)),R&&!e.has(R)&&(e.add(R),i.push(R)),M.forEach(o=>{e.has(o)||(e.add(o),i.push(o))}),i}return R&&!M.includes(R)?[R,...M]:M})(),q=Array.isArray((le=n.media)==null?void 0:le.gallery)?(((ce=n.media)==null?void 0:ce.gallery)??[]).filter(e=>e&&e.type==="video"&&typeof e.url=="string"&&e.url.trim().length>0).sort((e,i)=>{const o=typeof e.order=="number"?e.order:Number.POSITIVE_INFINITY,l=typeof i.order=="number"?i.order:Number.POSITIVE_INFINITY;return o-l}).map(e=>e.url.trim()):[],H=(de=(ue=n.location)==null?void 0:ue.city)==null?void 0:de.trim(),Ce=(me=(pe=n.location)==null?void 0:pe.state)==null?void 0:me.trim(),J=(ge=(ye=n.basics)==null?void 0:ye.title)==null?void 0:ge.trim(),W=(ve=(fe=n.basics)==null?void 0:fe.tagline)==null?void 0:ve.trim(),Z=(be=(he=n.basics)==null?void 0:he.description)==null?void 0:be.trim(),B=p.businessInfo&&typeof p.businessInfo=="object"?p.businessInfo:null,j=a?c(p.cardTitle)||c(p.title)||c(B==null?void 0:B.businessName)||c(u==null?void 0:u.name)||`${w((s==null?void 0:s.serviceType)??t.serviceType)}${H?` in ${H}`:""}`:void 0,Ve=a?c(p.tagline)||W:void 0,$e=a?c(p.description)||c(p.cardDescription)||Z||c(u==null?void 0:u.description):void 0,O=Ve||W,E=(Te=n.capacity)==null?void 0:Te.min,G=(Ae=n.capacity)==null?void 0:Ae.max,k={min:typeof E=="number"&&Number.isFinite(E)?E:void 0,max:typeof G=="number"&&Number.isFinite(G)?G:void 0},Me=(()=>{const{min:e,max:i}=k,o=typeof e=="number"&&e>1?e:void 0;if(typeof o=="number"&&typeof i=="number"&&i>=o)return`${o}–${i} guests`;if(typeof o=="number")return`${o}+ guests`;if(typeof i=="number")return`Up to ${i} guests`})(),X=$.eventStyles,Ue=Array.isArray(X)&&X.length>0?X.map(e=>{if(typeof e=="string")return e;if(e&&typeof e=="object"&&"label"in e)return String(e.label??"").trim()}).filter(e=>!!(e&&e.length>0)):void 0,He=n.venueType||(Array.isArray($.subTypes)&&$.subTypes.length>0?$.subTypes[0]:void 0),ee=typeof(r==null?void 0:r.unit)=="string"?r.unit:typeof(r==null?void 0:r.priceUnit)=="string"?r.priceUnit:typeof(r==null?void 0:r.billingUnit)=="string"?r.billingUnit:typeof(u==null?void 0:u.priceType)=="string"?u.priceType:void 0,Be=(()=>{if(!ee)return;switch(String(ee).trim().toLowerCase()){case"per_person":case"per-person":case"person":case"guest":return"per_person";case"per_event":case"per-event":case"event":case"flat":case"fixed":return"per_event";case"per_day":case"per-day":case"day":return"per_day";case"per_hour":case"per-hour":case"hour":case"hourly":default:return"per_hour"}})(),g=e=>{if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){const i=Number(e);return Number.isFinite(i)?i:void 0}},Ee=e=>{const i=g(e.minAttendees);if(typeof i=="number"&&i>0)return i;const o=e.guestLimit&&typeof e.guestLimit=="object"?e.guestLimit:null,l=o?g(o.min):void 0;if(typeof l=="number"&&l>0)return l;const d=g(e.minGuests??e.minGuest);return typeof d=="number"&&d>0?d:null},Ge=e=>{const i=g(e.maxAttendees);if(typeof i=="number"&&i>0)return i;const o=e.guestLimit&&typeof e.guestLimit=="object"?e.guestLimit:null,l=o?g(o.max):void 0;if(typeof l=="number"&&l>0)return l;const d=g(e.maxGuests??e.maxGuest);return typeof d=="number"&&d>0?d:null},Xe=e=>{if(e.includesVenueRental===!0||e.skipBaseRate===!0||e.includesRental===!0)return!0;const i=String(e.packageType??e.type??"").trim().toLowerCase();if(i==="venue_rental"||i==="rental_buyout"||i==="full_buyout"||i==="buyout")return!0;const o=`${String(e.name??"")} ${String(e.description??"")} ${String(e.restrictions??"")}`.trim().toLowerCase();return/(buyout|full[\s-]?buyout|includes?\s+venue\s+rental|venue\s+rental\s+included)/.test(o)},Ye=t.category||(typeof T.category=="string"?T.category:void 0)||n.category||void 0,ze={minimumHours:g(r.minimumHours),cleaningFee:g(r.cleaningFee),securityDeposit:g(r.securityDeposit),overtimeRate:g(r.overtimeRate),pricingNotes:typeof r.pricingNotes=="string"&&r.pricingNotes.trim().length>0?r.pricingNotes.trim():void 0,allowCustomQuotes:typeof r.allowCustomQuotes=="boolean"?r.allowCustomQuotes:void 0},Ke=Array.isArray(r.packages)?r.packages.filter(e=>e&&typeof e=="object"&&e!==null&&"name"in e).map(e=>{const i=e,o=g(i.minPrice)??0,l=g(i.maxPrice);return{id:(typeof i.id=="string"?i.id:void 0)??crypto.randomUUID(),name:typeof i.name=="string"?i.name:"",priceType:Se(i.priceType),minPrice:o,maxPrice:typeof l=="number"&&l!==o?l:null,minAttendees:Ee(i),maxAttendees:Ge(i),includesVenueRental:Xe(i),description:typeof i.description=="string"?i.description:null,restrictions:typeof i.restrictions=="string"?i.restrictions:null}}):void 0,Qe=a?N.map((e,i)=>{const o=g(e.displayPrice??e.price)??0;return{id:c(e.id)??`service-offering-${i}`,name:c(e.name)??`Package ${i+1}`,priceType:Se(e.priceType),minPrice:o,maxPrice:null,minAttendees:null,maxAttendees:null,includesVenueRental:!1,description:c(e.description)??null,restrictions:null}}):void 0,Y=Ke??Qe,v=(e,i)=>{if(!e)return;const o=new Set,l=[e];for(;l.length>0;){const d=l.shift();if(!d||typeof d!="object"||o.has(d))continue;o.add(d);const ke=Array.isArray(d)?Array.from(d.entries()):Object.entries(d);for(const[Ne,U]of ke){if(typeof Ne=="string"&&i.includes(Ne.toLowerCase())){const we=b(U);if(we!==void 0)return we}typeof U=="object"&&U!==null&&l.push(U)}}},qe=[()=>{var e;return[m.latitude,m.lat,y.latitude,y.lat,S.latitude,S.lat,L.latitude,L.lat,D.latitude,D.lat,A.latitude,A.lat,f.latitude,f.lat,_.latitude,_.lat,x.latitude,x.lat,C.latitude,C.lat,(e=n==null?void 0:n.location)==null?void 0:e.latitude,P.latitude,P.lat].map(b).find(i=>i!==void 0)},()=>v(m,["latitude","lat"]),()=>v(y,["latitude","lat"]),()=>v(P,["latitude","lat"]),()=>v(f,["latitude","lat"]),()=>v(Q,["latitude","lat"])],Je=[()=>{var e;return[m.longitude,m.lng,m.lon,y.longitude,y.lng,y.lon,S.longitude,S.lng,S.lon,L.longitude,L.lng,L.lon,D.longitude,D.lng,D.lon,A.longitude,A.lng,A.lon,f.longitude,f.lng,f.lon,_.longitude,_.lng,_.lon,x.longitude,x.lng,x.lon,C.longitude,C.lng,C.lon,(e=n==null?void 0:n.location)==null?void 0:e.longitude,P.longitude,P.lng,P.lon].map(b).find(i=>i!==void 0)},()=>v(m,["longitude","lng","lon"]),()=>v(y,["longitude","lng","lon"]),()=>v(P,["longitude","lng","lon"]),()=>v(f,["longitude","lng","lon"]),()=>v(Q,["longitude","lng","lon"])],We=qe.map(e=>e()).find(e=>e!==void 0)??void 0,Ze=Je.map(e=>e()).find(e=>e!==void 0)??void 0,je=a?c(p.coverImage)||c(u==null?void 0:u.image)||((Pe=n==null?void 0:n.media)==null?void 0:Pe.coverImage):(Re=n==null?void 0:n.media)==null?void 0:Re.coverImage,F=t.stats,h=t.googleReviews,te=F&&(F.averageRating!=null||F.rating!=null||F.reviewCount!=null&&F.reviewCount>0)?F:h&&(h.avgRating!=null&&h.avgRating>0||h.totalReviews!=null&&h.totalReviews>0)?{averageRating:h.avgRating??void 0,rating:h.avgRating??void 0,reviewCount:h.totalReviews??void 0,userRatingCount:h.totalReviews??void 0}:void 0,z=t.displayBaseRate,K=t.displayPriceFrom,ie={listingKind:t.listingKind??"venue",category:t.category??(typeof T.category=="string"?T.category:void 0)??(s==null?void 0:s.category),serviceType:(s==null?void 0:s.serviceType)??t.serviceType,feeOverrides:((Ie=t.pricingFeeSummary)==null?void 0:Ie.feeOverrides)??tt(s),effectiveFeeRates:((Fe=t.pricingFeeSummary)==null?void 0:Fe.effectiveFeeRates)??null},Oe=a&&typeof K=="number"&&K>0?K:typeof z=="number"&&z>0?z:typeof I=="number"&&I>0?Le(I,ie):I;return{id:t.listingId,name:j||J||`Untitled ${t.category} listing`,location:_e,city:H,state:Ce,tagline:O,category:Ye,capacityLabel:Me,eventStyles:Ue,venue_type:a?w((s==null?void 0:s.serviceType)??t.serviceType):He,main_image:je,galleryImages:xe,galleryVideos:q.length>0?q:void 0,packages:Y&&Y.length>0?Y:void 0,baseRate:Oe,priceUnit:Be,pricingDetails:ze,feeInput:ie,capacity:k,latitude:We,longitude:Ze,rawListing:t,highlights:{title:j||J,tagline:O,description:$e||Z},...te&&{stats:te}}};function it(t){const{min:s,max:n}=t,a=typeof s=="number"&&s>1?s:void 0;if(typeof a=="number"&&typeof n=="number"&&n>=a)return`${a}–${n} guests`;if(typeof a=="number")return`${a}+ guests`;if(typeof n=="number")return`Up to ${n} guests`}function nt(t){return{id:t.id,name:t.name,priceType:t.priceType,minPrice:t.minPrice,maxPrice:t.maxPrice??null,minAttendees:null,maxAttendees:null,includesVenueRental:!1,description:t.description??null,restrictions:null}}function ct(t){var N,u,c,w;const s=(u=(N=t.packages)==null?void 0:N.filter(b=>b&&b.id&&(b.name||b.minPrice>0)))==null?void 0:u.map(nt),n=t.pricing.baseRate,a={listingKind:"venue",category:t.category,feeOverrides:t.pricing.feeOverrides??null,effectiveFeeRates:t.pricing.effectiveFeeRates??null},p=typeof n=="number"&&n>0?Le(n,a):n;return{id:t.listingId,name:t.title,location:t.location.formatted,city:t.location.city,state:t.location.state,tagline:t.tagline,category:t.category,capacityLabel:it(t.capacity),eventStyles:t.eventStyles,venue_type:t.venueType,main_image:t.coverImage,galleryImages:t.galleryImages||[],galleryVideos:t.galleryVideos,packages:s&&s.length>0?s:void 0,baseRate:p,priceUnit:t.pricing.priceUnit,pricingDetails:t.pricingDetails,feeInput:a,capacity:t.capacity,latitude:(c=t.location.coordinates)==null?void 0:c.lat,longitude:(w=t.location.coordinates)==null?void 0:w.lng,plecMetadata:t.plecMetadata?{isFeatured:t.plecMetadata.isFeatured,isNew:t.plecMetadata.isNew,isPopular:t.plecMetadata.isPopular,partnerSince:t.plecMetadata.partnerSince}:void 0,verified:t.verified,highlights:t.highlights,stats:t.stats}}export{at as F,lt as b,ct as t};