1import{r as o,j as e,x}from"./app-Mnt2IEGe.js";import{G as p}from"./GuestLayout-BYnLiqFZ.js";import"./ApplicationLogo-JvKRx6b1.js";import"./x-B1Pn9Kmg.js";import"./message-circle-D4MbkUVn.js";import"./phone-DSAsYLtt.js";import"./chevron-down-BlAiga6f.js";import"./user-ad0RTXxq.js";import"./package-CT4joqbC.js";import"./map-pin-BuVEKMGp.js";import"./truck-CpGakV_6.js";import"./shopping-cart-DokKNEt4.js";import"./search-BeXkNHdv.js";import"./clock-Dnho5FNh.js";import"./shield-Da3uiB5y.js";import"./mail-Ce-sk81h.js";const f=t=>{const l=t||"";if(!l||typeof window>"u")return{htmlWithIds:l,headings:[]};const a=new DOMParser().parseFromString(l,"text/html"),d=new Set,c=Array.from(a.querySelectorAll("h1,h2,h3")).map(s=>{const r=s.textContent.trim();if(!r)return null;const m=r.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-").replace(/^-+|-+$/g,"")||"heading";let i=m,h=1;for(;d.has(i);)i=`${m}-${h++}`;return d.add(i),s.id=i,{id:i,text:r,level:Number(s.tagName[1])}}).filter(Boolean);return{htmlWithIds:a.body.innerHTML,headings:c}};function M({blog:t,recent:l=[]}){const{htmlWithIds:n,headings:a}=o.useMemo(()=>f(t.body),[t.body]),[d,c]=o.useState(null);return e.jsx(p,{children:e.jsx("div",{className:"bg-slate-100",children:e.jsxs("div",{className:"max-w-6xl mx-auto px-4 sm:px-6 lg:px-8 py-12 space-y-10",children:[e.jsxs("article",{className:"bg-white border shadow-sm overflow-hidden",children:[t.featured_image&&e.jsx("div",{className:"h-90 bg-slate-100 overflow-hidden m-[8px]",children:e.jsx("img",{src:t.featured_image,alt:t.featured_image_alt||t.title,className:"h-full w-full object-cover"})}),e.jsxs("div",{className:"p-8 md:p-12 space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs uppercase tracking-[0.3em] text-slate-400",children:"Insights"}),e.jsx("h1",{className:"text-3xl md:text-4xl font-bold text-slate-900",children:t.title}),t.author&&e.jsx("div",{className:"flex flex-wrap items-center gap-2 text-sm text-slate-500",children:e.jsxs("span",{children:["By ",t.author]})})]}),t.excerpt&&e.jsx("p",{className:"text-lg text-slate-600",children:t.excerpt}),a.length>0&&e.jsxs("div",{className:"rounded-3xl border border-slate-200 bg-slate-50 p-5",children:[e.jsx("h2",{className:"text-sm font-semibold uppercase tracking-[0.3em] text-slate-500 mb-4",children:"Table of Contents"}),e.jsx("nav",{"aria-label":"Table of contents",children:e.jsx("ol",{className:"space-y-2 text-sm text-slate-700",children:a.map(s=>e.jsx("li",{className:s.level===2?"pl-4":s.level===3?"pl-8":"",children:e.jsx("a",{href:`#${s.id}`,className:"hover:text-primary",children:s.text})},s.id))})})]}),e.jsx("div",{className:"blog-content space-y-4 text-slate-700 leading-relaxed",style:{fontFamily:t.font_style||void 0},children:e.jsx("div",{dangerouslySetInnerHTML:{__html:n||t.body||""}})}),Array.isArray(t.faqs)&&t.faqs.length>0&&e.jsxs("section",{className:"rounded-3xl border border-slate-200 bg-slate-50 p-6 mt-8",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("p",{className:"text-xs uppercase tracking-[0.3em] text-slate-500",children:"FAQ"}),e.jsx("h2",{className:"text-2xl font-semibold text-slate-900",children:"Frequently Asked Questions"}),e.jsx("p",{className:"text-sm text-slate-600 mt-2",children:"Help readers quickly find answers to the most important points."})]}),e.jsx("div",{className:"space-y-5",children:t.faqs.map((s,r)=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-lg font-semibold text-slate-900",children:s.question}),e.jsx("p",{className:"text-slate-700 leading-relaxed",children:s.answer})]},r))})]})]})]}),e.jsxs("aside",{className:"bg-white border rounded-3xl shadow-sm p-6 md:p-8 space-y-5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("h2",{className:"text-lg font-semibold text-slate-900",children:"Recent Posts"}),e.jsx(x,{href:route("blogs.index"),className:"inline-flex items-center justify-center rounded-full border border-indigo-200 bg-white px-4 py-2 text-sm font-semibold text-primary hover:border-indigo-400 flex-shrink-0",children:"Browse all posts"})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[l.map(s=>e.jsxs(x,{href:route("blogs.show",s.slug),className:"flex gap-3 sm:flex-col",children:[e.jsx("div",{className:"h-16 w-16 sm:h-32 sm:w-full rounded-2xl bg-slate-100 overflow-hidden flex-shrink-0",children:e.jsx("img",{src:s.featured_image||"/img/haslab-logo.png",alt:s.featured_image_alt||s.title,className:"h-full w-full object-cover"})}),e.jsx("div",{className:"flex-1",children:e.jsx("p",{className:"text-sm font-semibold text-slate-800 hover:text-primary line-clamp-2",children:s.title})})]},s.id)),l.length===0&&e.jsx("p",{className:"text-sm text-slate-500 col-span-full",children:"More articles coming soon."})]})]})]})})})}export{M 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.