import{c as D,v as w,r as d,t as n,j as a,L as p,B as x,S as h}from"./index-coFe3my1.js";import{S as l}from"./skeleton-D0qiqsNs.js";import{U as N,C as v,B as z}from"./BlogCard-CmSupE03.js";import{S as k}from"./SEO-d8TWCFZA.js";import{B as q}from"./Breadcrumb-BsOrhC_q.js";import{f as S}from"./format-CwT1jGkk.js";/**
* @license lucide-react v0.507.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const L=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],_=D("arrow-left",L);function A(){const{slug:r}=w(),[t,m]=d.useState(null),[o,u]=d.useState([]),[f,g]=d.useState(!0);d.useEffect(()=>{r&&P()},[r]);const P=async()=>{g(!0);try{const{data:e,error:s}=await window.ezsite.apis.tablePage(74472,{PageNo:1,PageSize:1,OrderByField:"id",IsAsc:!1,Filters:[{name:"slug",op:"Equal",value:r},{name:"published",op:"Equal",value:!0}]});if(s)throw s;if(e.List&&e.List.length>0){const i=e.List[0];m(i),j(i.category,i.id)}else n({title:"Post not found",description:"The blog post you are looking for does not exist.",variant:"destructive"})}catch(e){n({title:"Error",description:String(e),variant:"destructive"})}finally{g(!1)}},j=async(e,s)=>{try{const{data:i,error:c}=await window.ezsite.apis.tablePage(74472,{PageNo:1,PageSize:3,OrderByField:"publish_date",IsAsc:!1,Filters:[{name:"category",op:"Equal",value:e},{name:"published",op:"Equal",value:!0}]});if(c)throw c;const b=(i.List||[]).filter(B=>B.id!==s);u(b.slice(0,3))}catch(i){console.error("Error fetching related posts:",i)}};if(f)return a.jsx("div",{className:"min-h-screen bg-gradient-to-b from-blue-50 to-white","data-id":"o1xd36lq0","data-path":"src/pages/BlogDetailPage.tsx",children:a.jsx("div",{className:"container mx-auto px-4 py-16","data-id":"6j4r6fzjl","data-path":"src/pages/BlogDetailPage.tsx",children:a.jsxs("div",{className:"max-w-4xl mx-auto","data-id":"664ktqj8v","data-path":"src/pages/BlogDetailPage.tsx",children:[a.jsx(l,{className:"h-12 w-3/4 mb-4","data-id":"ts758amj2","data-path":"src/pages/BlogDetailPage.tsx"}),a.jsx(l,{className:"h-6 w-1/2 mb-8","data-id":"zdmhwa1gd","data-path":"src/pages/BlogDetailPage.tsx"}),a.jsx(l,{className:"h-96 w-full mb-8","data-id":"01ztqx6y6","data-path":"src/pages/BlogDetailPage.tsx"}),a.jsxs("div",{className:"space-y-4","data-id":"2xf5heoab","data-path":"src/pages/BlogDetailPage.tsx",children:[a.jsx(l,{className:"h-4 w-full","data-id":"vqwproqnb","data-path":"src/pages/BlogDetailPage.tsx"}),a.jsx(l,{className:"h-4 w-full","data-id":"y0volres9","data-path":"src/pages/BlogDetailPage.tsx"}),a.jsx(l,{className:"h-4 w-5/6","data-id":"rl3uf1vvg","data-path":"src/pages/BlogDetailPage.tsx"}),a.jsx(l,{className:"h-4 w-full","data-id":"1swzxnsif","data-path":"src/pages/BlogDetailPage.tsx"}),a.jsx(l,{className:"h-4 w-4/5","data-id":"hqyrc4luj","data-path":"src/pages/BlogDetailPage.tsx"})]})]})})});if(!t)return a.jsx("div",{className:"min-h-screen flex items-center justify-center","data-id":"fnetz86ql","data-path":"src/pages/BlogDetailPage.tsx",children:a.jsxs("div",{className:"text-center","data-id":"tjrbh8zjq","data-path":"src/pages/BlogDetailPage.tsx",children:[a.jsx("h1",{className:"text-4xl font-bold text-gray-800 mb-4","data-id":"e6wnz76m7","data-path":"src/pages/BlogDetailPage.tsx",children:"Post Not Found"}),a.jsx(p,{to:"/blog","data-id":"h1yglmrnc","data-path":"src/pages/BlogDetailPage.tsx",children:a.jsx(x,{"data-id":"mxpr4cat1","data-path":"src/pages/BlogDetailPage.tsx",children:"Back to Blog"})})]})});const y={"@context":"https://schema.org","@type":"BlogPosting",headline:t.title,description:t.excerpt,image:t.featured_image,datePublished:t.publish_date,dateModified:t.publish_date,url:`${window.location.origin}/blog/${t.slug}`,author:{"@type":"Person",name:t.author},publisher:{"@type":"Organization",name:"Premier Construction Loans",logo:{"@type":"ImageObject",url:`${window.location.origin}/placeholder.svg`}},articleSection:t.category,mainEntityOfPage:{"@type":"WebPage","@id":`${window.location.origin}/blog/${t.slug}`}};return a.jsxs(a.Fragment,{children:[a.jsx(k,{title:`${t.title} | Premier Construction Loans`,description:t.excerpt,keywords:`${t.category}, construction loans, ${t.title.toLowerCase()}`,ogType:"article",ogImage:t.featured_image,article:{publishedTime:t.publish_date,author:t.author,section:t.category},structuredData:y,"data-id":"1oo8g94t1","data-path":"src/pages/BlogDetailPage.tsx"}),a.jsx("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify({"@context":"https://schema.org","@type":"Article",headline:t.title,description:t.excerpt,image:t.featured_image,datePublished:t.publish_date,author:{"@type":"Person",name:t.author},publisher:{"@type":"Organization",name:"Premier Construction Loans"},url:`${window.location.origin}/blog/${t.slug}`})},"data-id":"8yegky4mz","data-path":"src/pages/BlogDetailPage.tsx"}),a.jsxs("article",{id:"main-content",className:"min-h-screen bg-white","data-id":"5apbdbyy1","data-path":"src/pages/BlogDetailPage.tsx",children:[a.jsx("div",{className:"container mx-auto px-4 pt-8","data-id":"8ejcnjpuu","data-path":"src/pages/BlogDetailPage.tsx",children:a.jsx(q,{items:[{label:"Blog",path:"/blog"},{label:t.title,path:`/blog/${t.slug}`}],"data-id":"m19v1x345","data-path":"src/pages/BlogDetailPage.tsx"})}),a.jsx("div",{className:"bg-gray-50 border-b","data-id":"ukx4y0yus","data-path":"src/pages/BlogDetailPage.tsx",children:a.jsx("div",{className:"container mx-auto px-4 py-4","data-id":"k6ki06qpv","data-path":"src/pages/BlogDetailPage.tsx",children:a.jsx(p,{to:"/blog","data-id":"7goeetxau","data-path":"src/pages/BlogDetailPage.tsx",children:a.jsxs(x,{variant:"ghost",size:"sm","data-id":"nuwq3ucs","data-path":"src/pages/BlogDetailPage.tsx",children:[a.jsx(_,{className:"w-4 h-4 mr-2","data-id":"v1uw972rp","data-path":"src/pages/BlogDetailPage.tsx"}),"Back to Blog"]})})})}),a.jsx("div",{className:"w-full h-96 bg-gray-100","data-id":"r7shbvjt0","data-path":"src/pages/BlogDetailPage.tsx",children:a.jsx("img",{src:t.featured_image,alt:`Featured image for article: ${t.title} - ${t.category} construction loan information`,loading:"lazy",width:"1200",height:"384",onError:e=>{const s=e.target;s.src="https://images.unsplash.com/photo-1560518883-ce09059eeffa?w=1200&h=800&fit=crop&q=80"},className:"w-full h-full object-cover","data-id":"ym6y6gvdl","data-path":"src/pages/BlogDetailPage.tsx"})}),a.jsxs("div",{className:"container mx-auto px-4 py-12 max-w-4xl","data-id":"x188wi1g4","data-path":"src/pages/BlogDetailPage.tsx",children:[a.jsxs("div",{className:"mb-8","data-id":"yz85fbgfk","data-path":"src/pages/BlogDetailPage.tsx",children:[a.jsx("h1",{className:"text-4xl md:text-5xl font-bold text-gray-900 mb-4","data-id":"30b2is7j6","data-path":"src/pages/BlogDetailPage.tsx",children:t.title}),a.jsxs("div",{className:"flex flex-wrap items-center gap-6 text-gray-600","data-id":"wdopxckvl","data-path":"src/pages/BlogDetailPage.tsx",children:[a.jsxs("div",{className:"flex items-center gap-2","data-id":"7ts48o8ne","data-path":"src/pages/BlogDetailPage.tsx",children:[a.jsx(N,{className:"w-5 h-5","aria-hidden":"true","data-id":"2hebfba1l","data-path":"src/pages/BlogDetailPage.tsx"}),a.jsx("span",{"data-id":"2lyeku2uw","data-path":"src/pages/BlogDetailPage.tsx",children:t.author})]}),a.jsxs("div",{className:"flex items-center gap-2","data-id":"e5f1pm9c7","data-path":"src/pages/BlogDetailPage.tsx",children:[a.jsx(v,{className:"w-5 h-5","aria-hidden":"true","data-id":"g11fojh12","data-path":"src/pages/BlogDetailPage.tsx"}),a.jsx("span",{"data-id":"nbw3mqk9v","data-path":"src/pages/BlogDetailPage.tsx",children:S(new Date(t.publish_date),"MMMM d, yyyy")})]}),a.jsx("span",{className:"px-3 py-1 bg-blue-100 text-blue-800 rounded-full text-sm font-medium","data-id":"xc7m87e50","data-path":"src/pages/BlogDetailPage.tsx",children:t.category})]})]}),a.jsx(h,{className:"my-8","data-id":"6mzrtp4hf","data-path":"src/pages/BlogDetailPage.tsx"}),a.jsx("div",{className:"prose prose-lg max-w-none","data-id":"39ha392p2","data-path":"src/pages/BlogDetailPage.tsx",children:t.content.split(`
`).map((e,s)=>a.jsx("p",{className:"mb-4 text-gray-700 leading-relaxed","data-id":"61d4xyhdk","data-path":"src/pages/BlogDetailPage.tsx",children:e},s))}),a.jsx(h,{className:"my-12","data-id":"7r9w15wgy","data-path":"src/pages/BlogDetailPage.tsx"}),a.jsx("div",{className:"bg-gray-50 rounded-lg p-6","data-id":"xmx3tpps1","data-path":"src/pages/BlogDetailPage.tsx",children:a.jsxs("div",{className:"flex items-center gap-4","data-id":"a14ie3gz2","data-path":"src/pages/BlogDetailPage.tsx",children:[a.jsx("div",{className:"w-16 h-16 bg-blue-600 rounded-full flex items-center justify-center text-white text-2xl font-bold","data-id":"pybscglt2","data-path":"src/pages/BlogDetailPage.tsx",children:t.author.charAt(0)}),a.jsxs("div",{"data-id":"pa0lgfm9c","data-path":"src/pages/BlogDetailPage.tsx",children:[a.jsx("h3",{className:"font-semibold text-lg","data-id":"idkdxrmdt","data-path":"src/pages/BlogDetailPage.tsx",children:t.author}),a.jsx("p",{className:"text-gray-600","data-id":"aruo8dm30","data-path":"src/pages/BlogDetailPage.tsx",children:"Construction Loan Expert"})]})]})})]}),o.length>0&&a.jsx("section",{className:"bg-gray-50 py-16","aria-labelledby":"related-articles","data-id":"ueaxsisn2","data-path":"src/pages/BlogDetailPage.tsx",children:a.jsxs("div",{className:"container mx-auto px-4","data-id":"9zglssz3e","data-path":"src/pages/BlogDetailPage.tsx",children:[a.jsx("h2",{id:"related-articles",className:"text-3xl font-bold text-center mb-12","data-id":"irde13zfi","data-path":"src/pages/BlogDetailPage.tsx",children:"Related Articles"}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8 max-w-6xl mx-auto","data-id":"k9lhjbsq","data-path":"src/pages/BlogDetailPage.tsx",children:o.map(e=>a.jsx(z,{...e,"data-id":"3myx1vvxn","data-path":"src/pages/BlogDetailPage.tsx"},e.id))})]})})]})]})}export{A as default};