import{r as x,j as e,L as O}from"./vendor-react-DgEFbQIi.js";import{aG as V,b1 as G,cd as B,b4 as U,dl as W,B as I,S as u,f as Y,a2 as Z,A as J,bO as M,X as K,cc as A,a as j,x as X,bx as T,cf as q,b3 as Q}from"./index-DFVuS8SP.js";import{I as _}from"./ImageWithFallback-C1HTj5IA.js";import{m as w}from"./vendor-motion-CzLrDd6y.js";import{B as ee}from"./briefcase-C1c67ONC.js";import{g as se}from"./listing-utils-CICni2H8.js";import{C as D}from"./calendar-7-ncaX7W.js";import{C as te}from"./copy-Bg4Oavyf.js";import{B as re}from"./badge-check-D5e4IH5i.js";import{L as ae}from"./layout-grid-AgaMjDGc.js";import{S as ie}from"./star-C0MTo9W6.js";/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const le=V("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);function ne(t){const[l,n]=x.useState([]),[o,a]=x.useState(!0);return x.useEffect(()=>{if(!t){n([]),a(!1);return}(async()=>{try{a(!0);const d=[],c=new Set;let g,h=0;const p=20;for(;h<p;){const m=new URLSearchParams;m.set("ownerPublicId",t),m.set("limit","100"),g&&m.set("cursor",g);const b=await G(`/public/venues?${m.toString()}`);for(const s of b.items??[]){const r=s==null?void 0:s.listingId;if(typeof r=="string"&&r){if(c.has(r))continue;c.add(r)}d.push(s)}if(!b.nextCursor)break;g=b.nextCursor,h+=1}const f=d.filter(m=>{var s,r,v,y;return m.status!=="published"?!1:[m.ownerPublicId,(r=(s=m.draftData)==null?void 0:s.onboardingMetadata)==null?void 0:r.ownerPublicId,(y=(v=m.publishedData)==null?void 0:v.onboardingMetadata)==null?void 0:y.ownerPublicId,m.userId].filter(N=>typeof N=="string").map(N=>N.trim()).filter(Boolean).includes(t)});n(f)}catch(d){console.error("Failed to load published listings:",d),n([])}finally{a(!1)}})()},[t]),{listings:l,loading:o}}function C({activeFilter:t,onFilterChange:l}){return e.jsx("div",{className:"mb-6",children:e.jsxs("div",{className:"relative inline-flex items-center gap-1 bg-[#F2F2F2] p-1.5 rounded-full shadow-sm w-full md:w-auto",children:[e.jsxs("button",{onClick:()=>l("all"),className:`relative z-10 flex-1 md:flex-none px-3 md:px-6 py-2.5 rounded-full text-sm transition-colors duration-200 ${t==="all"?"text-white":"text-gray-600 hover:text-gray-900"}`,children:[t==="all"&&e.jsx(w.div,{layoutId:"activeFilter",className:"absolute inset-0 bg-gray-900 rounded-full shadow-md",transition:{type:"spring",stiffness:300,damping:30}}),e.jsx("span",{className:"relative z-10",children:"All"})]}),e.jsxs("button",{onClick:()=>l("venues"),className:`relative z-10 flex-1 md:flex-none px-3 md:px-6 py-2.5 rounded-full text-sm transition-colors duration-200 flex items-center justify-center gap-2 ${t==="venues"?"text-white":"text-gray-600 hover:text-gray-900"}`,children:[t==="venues"&&e.jsx(w.div,{layoutId:"activeFilter",className:"absolute inset-0 bg-gray-900 rounded-full shadow-md",transition:{type:"spring",stiffness:300,damping:30}}),e.jsx(B,{size:16,className:"relative z-10"}),e.jsx("span",{className:"relative z-10",children:"Venues"})]}),e.jsxs("button",{onClick:()=>l("services"),className:`relative z-10 flex-1 md:flex-none px-3 md:px-6 py-2.5 rounded-full text-sm transition-colors duration-200 flex items-center justify-center gap-2 ${t==="services"?"text-white":"text-gray-600 hover:text-gray-900"}`,children:[t==="services"&&e.jsx(w.div,{layoutId:"activeFilter",className:"absolute inset-0 bg-gray-900 rounded-full shadow-md",transition:{type:"spring",stiffness:300,damping:30}}),e.jsx(ee,{size:16,className:"relative z-10"}),e.jsx("span",{className:"relative z-10",children:"Services"})]})]})})}function de({tabName:t,message:l}){return e.jsx("div",{className:"bg-white rounded-2xl border border-gray-200 shadow-sm p-12 md:p-20 text-center",children:e.jsxs("div",{className:"max-w-md mx-auto",children:[e.jsx("div",{className:"w-20 h-20 bg-gray-100 rounded-full flex items-center justify-center mx-auto mb-6",children:e.jsx("span",{className:"text-3xl",children:"📋"})}),e.jsx("h3",{className:"text-gray-900 mb-2",children:t.charAt(0).toUpperCase()+t.slice(1)}),e.jsx("p",{className:"text-gray-500",children:l||`This section is coming soon. Your ${t} items will appear here once available.`})]})})}function oe({title:t,message:l,icon:n="clipboard",actionLabel:o,actionHref:a}){const i=n==="heart";return e.jsx("div",{className:"rounded-2xl border border-border bg-card p-6 shadow-sm",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-10",children:[e.jsx(w.div,{animate:{y:[0,-4,0],scale:[1,1.02,1]},transition:{duration:2.5,repeat:1/0,ease:"easeInOut"},className:i?"rounded-2xl bg-rose-50 p-6 dark:bg-rose-950/30":"rounded-2xl bg-muted/50 p-6 dark:bg-muted/30",children:i?e.jsx(U,{className:"h-12 w-12 fill-rose-500 text-rose-500 dark:fill-rose-400 dark:text-rose-400"}):e.jsx(W,{className:"h-12 w-12 text-muted-foreground"})}),e.jsx("h3",{className:"text-foreground mt-4 text-center font-semibold",children:t}),e.jsx("p",{className:"text-muted-foreground mt-1 text-center text-sm",children:l}),o&&a&&e.jsx(I,{variant:"link",className:"mt-2 rounded-full text-sm text-primary",asChild:!0,children:e.jsx(O,{to:a,children:o})})]})})}const ce=9;function me(){return Number.isFinite(NaN),ce}function ke({userId:t,showEdit:l=!0}){const{listings:n=[],loading:o}=ne(t),[a,i]=x.useState("all"),d=x.useMemo(me,[]),[c,g]=x.useState(d),h=s=>s&&s.listingKind==="service"?"service":"venue",p=x.useMemo(()=>(n??[]).filter(Boolean).filter(s=>{if(a==="all")return!0;const r=h(s);return a==="venues"?r==="venue":r==="service"}),[n,a]),f=x.useMemo(()=>p.slice().sort((s,r)=>new Date(r.createdAt).getTime()-new Date(s.createdAt).getTime()),[p]);x.useEffect(()=>{g(d)},[a,d]);const m=x.useMemo(()=>f.slice(0,c),[f,c]),b=f.length>m.length;return o?e.jsxs(e.Fragment,{children:[e.jsx(C,{activeFilter:a,onFilterChange:i}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 mt-4",children:[1,2,3].map(s=>e.jsxs("div",{className:"rounded-xl border border-gray-200 overflow-hidden",children:[e.jsx(u,{className:"aspect-video w-full"}),e.jsxs("div",{className:"p-4 space-y-2",children:[e.jsx(u,{className:"h-5 w-3/4"}),e.jsx(u,{className:"h-4 w-1/2"}),e.jsx(u,{className:"h-4 w-full"})]})]},s))})]}):!n||n.length===0?e.jsx(e.Fragment,{children:e.jsx(oe,{title:"No hosted events yet",message:"No events have been hosted yet. Hosted listings will appear here once they do."})}):m.length===0?e.jsxs(e.Fragment,{children:[e.jsx(C,{activeFilter:a,onFilterChange:i}),e.jsx(de,{tabName:"hosted",message:"No listings match your filter yet."})]}):e.jsxs(e.Fragment,{children:[e.jsx(C,{activeFilter:a,onFilterChange:i}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-5 md:gap-6",children:m.map(s=>{var z,L,P,F,E;const r=se(s)??s.draftData,v=((z=r==null?void 0:r.serviceData)==null?void 0:z.cardTitle)||((L=r==null?void 0:r.serviceData)==null?void 0:L.title)||((P=r==null?void 0:r.basics)==null?void 0:P.title)||s.title||"Your listing",y=s.locationLabel||((F=r==null?void 0:r.location)==null?void 0:F.formatted)||"",N=h(s),S=(r==null?void 0:r.serviceData)??{},k=(S.offerings??[])[0],$=N==="service"?S.coverImage||(k==null?void 0:k.image)||"/default-venue-image.png":((E=r==null?void 0:r.media)==null?void 0:E.coverImage)||s.coverImage||"/default-venue-image.png",H=s.createdAt?Y(new Date(s.createdAt),"MMM d, yyyy"):"—";return e.jsxs("div",{className:"group bg-white rounded-2xl overflow-hidden border border-gray-200 shadow-sm hover:shadow-lg transition-all",children:[e.jsxs("div",{className:"relative aspect-[4/3] overflow-hidden",children:[e.jsx(_,{src:$,alt:v,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}),e.jsx("span",{className:`
                    absolute top-4 left-4 px-3 py-1.5 rounded-full text-xs font-medium
                    bg-emerald-100 text-emerald-700
                  `,children:"Confirmed"})]}),e.jsxs("div",{className:"p-5",children:[e.jsx("h3",{className:"text-gray-900 mb-2 text-base font-semibold line-clamp-2",children:v}),e.jsxs("div",{className:"flex items-center gap-1.5 text-gray-600 text-sm mb-3",children:[e.jsx(Z,{size:16}),e.jsx("span",{className:"truncate",children:y})]}),e.jsxs("div",{className:"flex items-center gap-4 text-xs text-gray-500 mb-4",children:[e.jsx(D,{size:14}),e.jsxs("span",{children:["Published · ",H]})]}),e.jsxs("div",{className:`flex ${l?"justify-between":"justify-start"} mt-4`,children:[e.jsx("button",{className:"rounded-full border border-gray-300 glass glass-surface px-4 py-1.5 text-sm",onClick:()=>{const R=h(s)==="service"?`/service/${s.listingId}`:`/venue/${s.listingId}`;window.location.assign(R)},children:"View"}),l&&e.jsxs("button",{className:"rounded-full px-4 py-1.5 text-gray-700 hover:bg-gray-100 transition flex items-center gap-1",onClick:()=>window.location.assign(`/host/listing/${s.listingId}/edit`),children:["Edit ",e.jsx(J,{size:16})]})]})]})]},s.listingId)})}),b&&e.jsx("div",{className:"mt-6 flex justify-center",children:e.jsxs("button",{onClick:()=>g(s=>s+d),className:"rounded-full border border-gray-300 glass glass-surface px-6 py-2 text-sm font-medium hover:bg-gray-100 transition",children:["Show more (",f.length-m.length,")"]})})]})}function Ce({name:t,photoURL:l,profileUrl:n,onClose:o}){const[a,i]=x.useState(!1),d=async()=>{try{await navigator.clipboard.writeText(n),i(!0),setTimeout(()=>i(!1),2e3)}catch(c){console.error("Copy failed",c)}};return e.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4",onClick:o,children:e.jsxs("div",{className:"bg-white rounded-3xl shadow-2xl max-w-md w-full opacity-0 translate-y-4 scale-95 animate-[slideUpAndFade_0.3s_ease-out_forwards]",onClick:c=>c.stopPropagation(),children:[e.jsxs("div",{className:"p-6 md:p-8 border-b border-gray-200",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h2",{className:"text-gray-900",children:"Share Profile"}),e.jsx("button",{onClick:o,className:M.modal.closeButton.buttonClassName,"aria-label":"Close",children:e.jsx(K,{className:M.modal.closeButton.iconSize})})]}),e.jsx("p",{className:"text-gray-500 text-sm",children:"Share your PLEC profile with others"})]}),e.jsxs("div",{className:"p-6 md:p-8",children:[e.jsxs("div",{className:"flex items-center gap-4 mb-6 p-4 bg-gray-50 rounded-2xl",children:[e.jsx(_,{src:l||"/default-avatar.png",alt:t,className:"w-14 h-14 rounded-full object-cover ring-2 ring-white shadow-sm"}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("p",{className:"text-gray-900 text-sm truncate",children:t})})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{className:"block text-gray-700 text-sm mb-3",children:"Profile Link"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex-1 px-4 py-3 bg-gray-50 border border-gray-200 rounded-xl text-gray-600 text-sm truncate",children:n}),e.jsx("button",{onClick:d,className:`px-5 py-3 rounded-xl transition-all shadow-sm flex items-center gap-2 flex-shrink-0 ${a?"bg-green-600 text-white hover:bg-green-700":"bg-gradient-to-r from-brand-400 to-brand-500 hover:brightness-90 text-white"}`,children:a?e.jsxs(e.Fragment,{children:[e.jsx(A,{size:18}),e.jsx("span",{className:"hidden sm:inline",children:"Copied"})]}):e.jsxs(e.Fragment,{children:[e.jsx(te,{size:18}),e.jsx("span",{className:"hidden sm:inline",children:"Copy"})]})})]})]}),a&&e.jsxs("div",{className:"flex items-center gap-2 p-4 bg-green-50 border border-green-200 rounded-xl mb-6",children:[e.jsx("div",{className:"w-8 h-8 rounded-full bg-green-100 flex items-center justify-center flex-shrink-0",children:e.jsx(A,{size:16,className:"text-green-600"})}),e.jsx("p",{className:"text-green-700 text-sm",children:"Link copied to clipboard!"})]}),e.jsx("button",{onClick:o,className:"w-full px-6 py-3.5 glass glass-surface text-gray-700 rounded-xl",children:"Done"})]})]})})}function Ie({displayName:t,photoURL:l,memberSince:n,organization:o,confirmations:a=[],isOwnProfile:i,onEdit:d,onShare:c,onChangePhoto:g,className:h}){const p=l==null?void 0:l.trim();return e.jsx("section",{"aria-label":"Profile",className:j("rounded-3xl border border-border bg-card p-6 shadow-sm md:p-8",h),children:e.jsxs("div",{className:"flex flex-col items-center gap-5 text-center md:flex-row md:gap-7 md:text-left",children:[e.jsxs("div",{className:"relative shrink-0",children:[e.jsx("div",{className:"size-24 overflow-hidden rounded-full bg-muted shadow-sm ring-4 ring-background md:size-28",children:p?e.jsx(X,{originalSrc:p,variant:"medium",alt:t,className:"size-full object-cover"}):i?e.jsxs("button",{type:"button",onClick:g,className:"flex size-full flex-col items-center justify-center gap-1 rounded-full border-2 border-dashed border-border bg-muted/50 text-muted-foreground transition-colors hover:border-brand-300 hover:text-foreground",children:[e.jsx(T,{className:"size-6"}),e.jsx("span",{className:"text-xs font-medium",children:"Add photo"})]}):e.jsx("img",{src:q,alt:t,className:"size-full object-cover"})}),i&&p&&e.jsx("button",{type:"button",onClick:g,"aria-label":"Change profile photo",className:"absolute bottom-0.5 right-0.5 flex size-9 items-center justify-center rounded-full border border-border bg-background text-foreground shadow-sm transition-colors hover:bg-muted",children:e.jsx(T,{className:"size-4"})})]}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h1",{className:"break-words text-3xl leading-tight text-foreground md:text-4xl",children:t}),e.jsxs("p",{className:"mt-1.5 flex flex-col items-center gap-x-2 gap-y-1 text-sm text-muted-foreground md:flex-row md:flex-wrap md:justify-start",children:[n&&e.jsxs("span",{children:["Member since ",n]}),n&&o&&e.jsx("span",{"aria-hidden":!0,className:"hidden md:inline",children:"·"}),o&&e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(B,{className:"size-3.5","aria-hidden":!0}),o]})]}),a.length>0&&e.jsx("ul",{"aria-label":"Confirmed",className:"mt-3 flex flex-wrap justify-center gap-2 md:justify-start",children:a.map(f=>e.jsxs("li",{className:"inline-flex items-center gap-1.5 rounded-full border border-border bg-muted/40 px-3 py-1 text-xs text-foreground",children:[e.jsx(re,{className:"size-3.5 text-emerald-600","aria-hidden":!0}),f.label]},f.key))})]}),e.jsxs("div",{className:j("grid w-full gap-2 md:flex md:w-auto md:shrink-0",i?"grid-cols-2":"grid-cols-1"),children:[i&&d&&e.jsxs(I,{onClick:d,children:[e.jsx(le,{}),"Edit profile"]}),e.jsxs(I,{variant:"outline",onClick:c,children:[e.jsx(Q,{}),"Share"]})]})]})})}function Se({className:t}){return e.jsx("div",{className:j("rounded-3xl border border-border bg-card p-6 shadow-sm md:p-8",t),children:e.jsxs("div",{className:"flex flex-col items-center gap-5 md:flex-row md:gap-7",children:[e.jsx(u,{className:"size-24 shrink-0 rounded-full md:size-28"}),e.jsxs("div",{className:"flex w-full flex-1 flex-col items-center gap-3 md:items-start",children:[e.jsx(u,{className:"h-9 w-56 max-w-full"}),e.jsx(u,{className:"h-4 w-40"}),e.jsx(u,{className:"h-6 w-36 rounded-full"})]}),e.jsxs("div",{className:"grid w-full grid-cols-2 gap-2 md:flex md:w-auto",children:[e.jsx(u,{className:"h-10 rounded-full md:w-32"}),e.jsx(u,{className:"h-10 rounded-full md:w-24"})]})]})})}function ze({items:t,active:l,onChange:n,counts:o={},className:a}){return e.jsx("nav",{"aria-label":"Profile sections",className:j("border-b border-border",a),children:e.jsx("div",{className:"-mb-px flex gap-6 overflow-x-auto scrollbar-hide md:gap-8",children:t.map(i=>{const d=i.id===l,c=o[i.id];return e.jsxs("button",{type:"button",onClick:()=>n(i.id),"aria-current":d?"page":void 0,className:j("relative inline-flex shrink-0 items-center gap-1.5 whitespace-nowrap pb-3 pt-1 text-sm transition-colors",d?"font-medium text-foreground":"text-muted-foreground hover:text-foreground"),children:[i.label,typeof c=="number"&&c>0&&e.jsx("span",{className:"rounded-full bg-muted px-1.5 py-px text-[11px] font-medium tabular-nums text-muted-foreground",children:c}),e.jsx("span",{"aria-hidden":!0,className:j("absolute inset-x-0 bottom-0 h-0.5 rounded-full transition-colors",d?"bg-foreground":"bg-transparent")})]},i.id)})})})}const Le=[{id:"overview",label:"Overview"},{id:"bookings",label:"Bookings"},{id:"listings",label:"Listings"},{id:"saved",label:"Saved"},{id:"reviews",label:"Reviews"},{id:"rewards",label:"Rewards"}],Pe=[{id:"overview",label:"Overview"},{id:"listings",label:"Listings"},{id:"reviews",label:"Reviews"}],Fe=[{id:"bookings",label:"Bookings",icon:D},{id:"listings",label:"Listings",icon:ae},{id:"rating",label:"Rating",icon:ie}];export{C as F,ke as H,de as P,oe as S,le as a,Se as b,Ie as c,ze as d,Le as e,Ce as f,Fe as g,Pe as h,ne as u};