import{j as e,av as g,b as p,c as f,d as b,aN as j,aO as N,aw as y,aP as w,S as _,V as v,n as m,a1 as k,H as C,N as P,aQ as B,L as $,h,x as L,aR as S}from"./index-B8-mU-S3.js";import{B as I,b as W,c as A}from"./BlogCard-DY3ap7bV.js";import{A as M}from"./arrow-left-D0P3sjez.js";import{C as R}from"./calendar-zI6p_v5G.js";import{S as O}from"./share-2-CtUrZeHm.js";import{L as T}from"./link-DugUd5dE.js";import{f as u}from"./date-utils-BcQETFuH.js";import"./analytics-Bu8LxldC.js";import"./useQuery-BAyhM4NV.js";const z=({content:o})=>{const n=()=>o.split(`

`).map((c,r)=>{const a=c.trim();if(a.startsWith("### "))return e.jsx("h3",{className:"text-xl font-bold text-foreground mt-8 mb-4",children:a.slice(4)},r);if(a.startsWith("## "))return e.jsx("h2",{className:"text-2xl font-bold text-foreground mt-10 mb-4",children:a.slice(3)},r);if(a.startsWith("# "))return e.jsx("h1",{className:"text-3xl font-bold text-foreground mt-12 mb-6",children:a.slice(2)},r);if(a.startsWith("- ")||a.startsWith("* ")){const s=a.split(`
`).filter(l=>l.startsWith("- ")||l.startsWith("* "));return e.jsx("ul",{className:"list-disc list-inside space-y-2 my-4 text-muted-foreground",children:s.map((l,i)=>e.jsx("li",{children:l.slice(2)},i))},r)}if(/^\d+\./.test(a)){const s=a.split(`
`).filter(l=>/^\d+\./.test(l));return e.jsx("ol",{className:"list-decimal list-inside space-y-2 my-4 text-muted-foreground",children:s.map((l,i)=>e.jsx("li",{children:l.replace(/^\d+\.\s*/,"")},i))},r)}if(a.startsWith("> "))return e.jsx("blockquote",{className:"border-l-4 border-primary pl-4 my-6 italic text-muted-foreground",children:a.slice(2)},r);if(a.startsWith("```")){const s=a.slice(3).replace(/```$/,"");return e.jsx("pre",{className:"bg-secondary rounded-lg p-4 my-6 overflow-x-auto",children:e.jsx("code",{className:"text-sm text-foreground",children:s})},r)}if(a){let s=a.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/\*(.+?)\*/g,"<em>$1</em>").replace(/`(.+?)`/g,'<code class="bg-secondary px-1 rounded text-sm">$1</code>');return e.jsx("p",{className:"text-muted-foreground leading-relaxed my-4",dangerouslySetInnerHTML:{__html:s}},r)}return null});return e.jsx("article",{className:"prose prose-lg max-w-none",children:n()})},D=({posts:o})=>!o||o.length===0?null:e.jsx("section",{className:"py-16 bg-secondary/30 content-auto-lg",children:e.jsxs("div",{className:"max-w-6xl mx-auto px-6",children:[e.jsx("h2",{className:"text-2xl md:text-3xl font-bold text-foreground mb-8 text-center",children:"Related Articles"}),e.jsx("div",{className:"grid md:grid-cols-3 gap-6",children:o.map(n=>e.jsx(I,{post:n},n.id))})]})}),K=()=>{const{slug:o}=g(),n=p();f({pageName:`blog_post_${o}`}),b({pageName:`blog_post_${o}`});const{data:t,isLoading:c,error:r}=W(o||""),{data:a=[]}=A(t?.id||"",t?.category_id||null);j.useEffect(()=>{t?.slug&&N(t.slug,t.category_id||void 0)},[t?.slug,t?.category_id]);const s=async i=>{const d=window.location.href,x=t?.title||"Check out this article";switch(h("blog_share",i),i){case"linkedin":window.open(`https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(d)}`,"_blank");break;case"twitter":window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(d)}&text=${encodeURIComponent(x)}`,"_blank");break;case"copy":await navigator.clipboard.writeText(d),S.success("Link copied to clipboard!");break}};if(c)return e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:e.jsx(y,{className:"h-8 w-8 animate-spin text-primary"})});if(!c&&(r||!t))return e.jsx(w,{to:"/404",replace:!0});const l=t.published_at?u(new Date(t.published_at),"MMMM d, yyyy"):u(new Date(t.created_at),"MMMM d, yyyy");return e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(_,{title:`${t.title} | Cendra AI Blog`,description:t.excerpt||t.title,ogTitle:`${t.title} | Cendra AI Blog`,ogDescription:t.excerpt||t.title,ogImage:t.featured_image_url||void 0,canonicalPath:`/blog/${t.slug}`}),e.jsx(v,{children:e.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"BlogPosting",headline:t.title,description:t.excerpt,image:t.featured_image_url,author:{"@type":"Person",name:t.author_name},publisher:{"@type":"Organization",name:"Cendra AI",logo:{"@type":"ImageObject",url:"https://cendra.ai/cendra-logo.png"}},datePublished:t.published_at||t.created_at,dateModified:t.updated_at,mainEntityOfPage:{"@type":"WebPage","@id":`https://cendra.ai/blog/${t.slug}`}})})}),e.jsxs("section",{className:"relative",children:[e.jsx("div",{className:"absolute top-4 left-4 z-10",children:e.jsxs(m,{variant:"ghost",size:"sm",onClick:()=>n("/blog"),className:"bg-background/80 backdrop-blur-sm hover:bg-background",children:[e.jsx(M,{className:"h-4 w-4 mr-2"}),"Back to Blog"]})}),t.featured_image_url?e.jsx("div",{className:"w-full h-64 md:h-96 lg:h-[28rem] overflow-hidden",children:e.jsx("img",{src:t.featured_image_url,alt:t.title,className:"w-full h-full object-cover",loading:"eager",fetchPriority:"high",decoding:"sync"})}):e.jsx("div",{className:"w-full h-48 md:h-64 bg-gradient-to-br from-primary/10 to-info/10"})]}),e.jsxs("article",{className:"max-w-3xl mx-auto px-6 -mt-16 md:-mt-24 relative z-10",children:[e.jsxs("div",{className:"bg-card rounded-2xl shadow-lg p-6 md:p-10 mb-8",children:[t.category&&e.jsx(k,{variant:"outline",className:"mb-4",children:t.category.name}),e.jsx("h1",{className:"text-3xl md:text-4xl lg:text-5xl font-bold text-foreground mb-6 leading-tight",children:t.title}),e.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-sm text-muted-foreground mb-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[t.author_avatar_url?e.jsx("img",{src:t.author_avatar_url,alt:t.author_name,className:"w-8 h-8 rounded-full object-cover"}):e.jsx("div",{className:"w-8 h-8 rounded-full bg-primary/10 flex items-center justify-center text-primary font-medium",children:t.author_name.charAt(0)}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-foreground",children:t.author_name}),t.author_role&&e.jsxs("span",{className:"hidden sm:inline",children:[" · ",t.author_role]})]})]}),e.jsx("span",{className:"hidden sm:block",children:"·"}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(R,{className:"h-4 w-4"}),l]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(C,{className:"h-4 w-4"}),t.reading_time_minutes," min read"]})]}),e.jsxs("div",{className:"flex items-center gap-3 pt-4 border-t border-border",children:[e.jsxs("span",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[e.jsx(O,{className:"h-4 w-4"}),"Share:"]}),e.jsx("button",{onClick:()=>s("linkedin"),className:"p-2 rounded-lg bg-secondary hover:bg-secondary/80 transition-colors","aria-label":"Share on LinkedIn",children:e.jsx(P,{className:"h-4 w-4"})}),e.jsx("button",{onClick:()=>s("twitter"),className:"p-2 rounded-lg bg-secondary hover:bg-secondary/80 transition-colors","aria-label":"Share on Twitter",children:e.jsx(B,{className:"h-4 w-4"})}),e.jsx("button",{onClick:()=>s("copy"),className:"p-2 rounded-lg bg-secondary hover:bg-secondary/80 transition-colors","aria-label":"Copy link",children:e.jsx(T,{className:"h-4 w-4"})})]})]}),e.jsx("div",{className:"bg-card rounded-2xl shadow-sm p-6 md:p-10",children:e.jsx(z,{content:t.content})}),e.jsx("div",{className:"bg-card rounded-2xl shadow-sm p-6 md:p-8 mt-8",children:e.jsxs("div",{className:"flex items-start gap-4",children:[t.author_avatar_url?e.jsx("img",{src:t.author_avatar_url,alt:t.author_name,className:"w-16 h-16 rounded-full object-cover"}):e.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center text-primary text-xl font-medium",children:t.author_name.charAt(0)}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Written by"}),e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:t.author_name}),t.author_role&&e.jsx("p",{className:"text-sm text-muted-foreground",children:t.author_role})]})]})}),e.jsxs("div",{className:"bg-primary/5 rounded-2xl p-6 md:p-8 mt-8 text-center",children:[e.jsx("h3",{className:"text-xl font-bold text-foreground mb-2",children:"Ready to automate your guest communication?"}),e.jsx("p",{className:"text-muted-foreground mb-6",children:"See how Cendra AI can help your property management business."}),e.jsx($,{to:"/pricing-new",children:e.jsx(m,{size:"lg",className:"bg-primary hover:bg-primary-hover text-primary-foreground",onClick:()=>h("blog_post_cta","view_pricing"),children:"View Pricing"})})]})]}),a.length>0&&e.jsx("div",{className:"mt-16 content-auto-lg",children:e.jsx(D,{posts:a})}),e.jsx(L,{})]})};export{K as default};