import{_ as Le,a as Re}from"./BZbwU0ef.js";import{g as ye,h as p,o as r,c as l,H as w,aj as N,b as g,v as De,a as t,w as y,d as E,t as h,x as _,j as s,e as V,cO as Ue,b7 as Be,aT as Ee,r as M,k as je,u as He,s as Ne,am as Ve,an as qe,I as Ae,q as ze,aI as Oe,p as Fe,f as Ke,bK as Ge,a7 as Je,_ as Qe}from"./DgR3D_w1.js";import{a as We}from"./O1F2TMdC.js";const Xe={class:"max-w-1012 mx-auto"},Ye={class:"sm:w-50p bg-white pl-28 pr-35 pt-28 pb-33"},Ze={class:"block font-bold font-agendaCond text-f14 tracking-a09 uppercase mb-8"},et=t("span",{class:"text-green-600"},"Categories:",-1),tt={key:0},st={class:"font-bold text-f24 leading-a25 mb-30 sm:mb-13"},nt=["innerHTML"],ot=ye({__name:"RelatedPostList",props:{relatedPosts:{}},setup(b){const x=b,L=p(()=>x.relatedPosts.slice(0,3));return(v,q)=>{const k=V;return r(),l("div",Xe,[(r(!0),l(w,null,N(s(L),c=>(r(),l("article",{key:c.id,class:"sm:flex mb-30 text-center sm:text-left text-f14 leading-a36"},[g(k,{to:c.link,class:"bg-cover bg-center bg-no-repeat sm:w-50p min-h-200 block",style:De({backgroundImage:`url(${c.featuredImage})`})},null,8,["to","style"]),t("div",Ye,[t("span",Ze,[et,(r(!0),l(w,null,N(c.categories,(i,$)=>(r(),l(w,{key:i==null?void 0:i.name},[g(k,{to:`/blog/category/${i==null?void 0:i.slug}/`,rel:"category tag"},{default:y(()=>[E(h(i==null?void 0:i.name),1)]),_:2},1032,["to"]),$!==c.categories.length-1?(r(),l("span",tt,", ")):_("",!0)],64))),128))]),t("h2",st,[g(k,{to:c.link},{default:y(()=>[E(h(c.title),1)]),_:2},1032,["to"])]),t("div",{class:"hidden sm:block mb-18",innerHTML:c.excerpt},null,8,nt),g(k,{to:c.link,class:"font-bold font-agendaCond text-f14 uppercase tracking-a04 text-green-600 hover:text-green-500 transition duration-300 ease-linear inline-block align-top"},{default:y(()=>[E("Read more")]),_:2},1032,["to"])])]))),128))])}}}),f=b=>(Fe("data-v-558f309d"),b=b(),Ke(),b),at=f(()=>t("section",{"data-bg":"",class:"text-center py-41 sm:pt-74 sm:pb-46 relative bg-gray-200 flex items-center background-header"},[t("span",{class:"inline min-h-159 w-0"})],-1)),rt={class:"container max-w-1180"},lt={class:"md:flex pb-40 sm:pb-60 md:pb-80 text-f14 leading-a36"},it={class:"md:flex-1 wysiwyg md:pl-69 md:pr-51 relative"},ct={class:"mb-15"},dt={class:"block font-bold font-agendaCond text-f14 tracking-a09 uppercase mb-9"},ut=f(()=>t("span",{class:"text-green-600"},"Categories: ",-1)),mt={key:0},pt={class:"font-bold"},_t={key:0,class:"block font-bold font-agendaCond text-f14 uppercase mb-22 md:mb-0"},gt={class:"list-none md:absolute md:left-0 md:top-0 md:w-26 flex items-center md:block -mb-12"},ht={class:"mr-12 mb-12"},ft=["href"],bt={class:"mr-12 mb-12"},xt=["href"],vt={class:"mr-12 mb-12"},kt=["href"],wt={class:"mr-12 mb-12"},yt=["href"],$t=["innerHTML"],Ct={class:"overflow-hidden border-b md:border-b-0 border-t border-gray-100a20 my-25 pt-28 pb-2 sm:pt-36 sm:mt-38 sm:mb-30 text-f13 sm:text-f14 leading-a57"},St={class:"float-left mr-23 w-74 sm:w-128"},It=["src","alt"],Tt={class:"sm:overflow-hidden sm:py-4"},Pt={key:0,class:"text-f15 sm:text-f18 mb-6 sm:mb-12"},Mt={key:1},Lt=f(()=>t("i",{class:"icon-legacy-legacy-chevron-a-left text-f13 mr-11"},null,-1)),Rt=f(()=>t("span",{"data-back-to-posts-link":"",class:"underline"},"Back to Posts",-1)),Dt={class:"md:w-195 pt-30 sm:pt-60 md:pt-0"},Ut=f(()=>t("h3",{class:"hidden sm:block font-bold font-agendaCond text-f14 tracking-a04 mb-10"}," Stay updated: ",-1)),Bt={class:"input-wrap"},Et=f(()=>t("button",{type:"submit",class:"btn btn-green hidden"}," Subscribe ",-1)),jt={key:0,class:"text-center text-green-100 mt-10"},Ht={key:1,class:"error-message text-center mt-10 text-red-100"},Nt={key:0,class:"pt-48 sm:pt-71 bg-green-600a05 -mb-93 pb-129"},Vt={class:"container"},qt=f(()=>t("h3",{class:"text-center font-black text-f30 leading-a12 tracking-a02 mb-24 sm:mb-34"}," Related Posts ",-1)),At=ye({__name:"[slug]",async setup(b){let x,L;Ue(e=>({"353590cc":s(Se)}));const v=Be(),q=Ge(),k=Ee(),c=M("Something went wrong. Please try again."),i=M(""),$=M(!1),C=M(!1),j=M(!1),A=p(()=>{var e;return(e=v==null?void 0:v.params)==null?void 0:e.slug}),{data:m}=([x,L]=je(async()=>We(`blog-post-${A.value}`,async()=>{const[e,a]=await Promise.all([$fetch("/api/content/categories"),$fetch(`/api/content/posts/${v.params.slug}`)]);return{categories:Object.values(e)??[],post:a}},{watch:[A]})),x=await x,L(),x),$e=p(()=>{var e;return((e=m==null?void 0:m.value)==null?void 0:e.categories)??[]}),n=p(()=>{var e;return((e=m==null?void 0:m.value)==null?void 0:e.post)??null});He({title:()=>{var e;return(e=n.seo)==null?void 0:e.title},meta:[{name:"description",content:()=>{var e;return(e=n.seo)==null?void 0:e.metaDesc}},{property:"og:title",content:()=>{var e;return(e=n.seo)==null?void 0:e.opengraphTitle}},{property:"og:description",content:()=>{var e;return(e=n.seo)==null?void 0:e.opengraphDescription}},{property:"og:site_name",content:()=>{var e;return(e=n.seo)==null?void 0:e.opengraphSiteName}},{property:"og:type",content:()=>{var e;return(e=n.seo)==null?void 0:e.opengraphType}},{property:"og:locale",content:()=>{var e;return(e=n.seo)==null?void 0:e.opengraphLocale}},{property:"og:image",content:()=>{var e,a;return(a=(e=n.seo)==null?void 0:e.opengraphImage)==null?void 0:a.sourceUrl}},{name:"twitter:card",content:"summary_large_image"},{name:"twitter:title",content:()=>{var e;return(e=n.seo)==null?void 0:e.opengraphTitle}},{property:"article:modified_time",content:()=>n.modified},{property:"article:published_time",content:()=>n.date}]});const Ce=p(()=>{var e,a,d;return((d=(a=(e=m==null?void 0:m.value)==null?void 0:e.categories)==null?void 0:a.nodes)==null?void 0:d.length)??0}),z=p(()=>{var R,D,U;if(!n.value)return[];const e=v.params.slug,a=(U=(D=(R=n.value)==null?void 0:R.tags)==null?void 0:D.edges)==null?void 0:U.flatMap(S=>S.node.posts.edges),d=[];return a.forEach(S=>{var I,T,P;const o=S.node;!d.find(B=>B.id===o.id)&&o.slug!==e&&d.push({id:o==null?void 0:o.id,slug:o==null?void 0:o.slug,title:o==null?void 0:o.title,link:`/blog/${o==null?void 0:o.slug}/`,categories:(I=o==null?void 0:o.categories)==null?void 0:I.nodes,excerpt:o==null?void 0:o.excerpt,featuredImage:(P=(T=o==null?void 0:o.featuredImage)==null?void 0:T.node)==null?void 0:P.sourceUrl})}),d}),H=p(()=>{var e;return encodeURIComponent(((e=n.value)==null?void 0:e.link)??"")}),O=p(()=>{var e;return encodeURIComponent(((e=n.value)==null?void 0:e.slug)??"")}),Se=p(()=>{var e,a,d;return`url(${(d=(a=(e=n.value)==null?void 0:e.featuredImage)==null?void 0:a.node)==null?void 0:d.sourceUrl})`}),Ie=p(()=>`${q.public.baseApiEnpoint}/api/marketing/blog-subscriptions`),Te=()=>/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@(([^<>()[\]\\.,;:\s@"]+\.)+[^<>()[\]\\.,;:\s@"]{2,})$/i.test(String(i.value).toLowerCase()),Pe=()=>{if(C.value=!1,j.value=!1,!Te()){$.value=!0,C.value=!1;return}$.value=!1;const e={email:i.value,pageUrl:window.location.href,abandonedCartId:k.abandonedCartId};Je.post(Ie.value,e).then(a=>{C.value=!0,i.value=""}).catch(a=>{console.error("There was a problem with your submission:",a),a.response&&a.response.data&&a.response.data.message&&(console.log("Error message from server:",a.response.data.message),c.value=a.response.data.message),j.value=!0,C.value=!1})};return(e,a)=>{var o,I,T,P,B,F,K,G,J,Q,W,X,Y,Z,ee,te,se,ne,oe,ae,re,le,ie,ce,de,ue,me,pe,_e,ge,he,fe,be,xe,ve,ke,we;const d=Re,R=Le,D=V,U=V,S=ot;return r(),l(w,null,[at,t("section",null,[g(R,{categories:s($e)},{search:y(()=>[g(d)]),_:1},8,["categories"]),t("div",rt,[t("article",lt,[t("div",it,[t("header",ct,[t("span",dt,[ut,(r(!0),l(w,null,N((I=(o=s(m))==null?void 0:o.categories)==null?void 0:I.nodes,(u,Me)=>(r(),l(w,{key:u==null?void 0:u.name},[g(D,{to:`/blog/category/${u==null?void 0:u.slug}/`,rel:"category tag"},{default:y(()=>[E(h(u==null?void 0:u.name),1)]),_:2},1032,["to"]),Me!==s(Ce)-1?(r(),l("span",mt,", ")):_("",!0)],64))),128))]),t("h1",pt,h((T=s(n))==null?void 0:T.title),1),(P=s(n))!=null&&P.date?(r(),l("time",_t,h(("formatDate"in e?e.formatDate:s(Oe))((B=s(n))==null?void 0:B.date)),1)):_("",!0),t("ul",gt,[t("li",ht,[t("a",{href:`https://www.facebook.com/sharer/sharer.php?u=${s(H)}`,target:"_blank",class:"share icon-legacy-facebook w-26 h-26 rounded-full border border-green-500 text-green-500 flex items-center justify-center hover:text-green-600 hover:border-green-600 transition duration-300 ease-linear mx-auto"},null,8,ft)]),t("li",bt,[t("a",{href:`https://twitter.com/intent/tweet?url=${s(H)}&text=${s(O)}`,class:"share icon-legacy-twitter w-26 h-26 rounded-full border border-green-500 text-green-500 flex items-center justify-center hover:text-green-600 hover:border-green-600 transition duration-300 ease-linear mx-auto"},null,8,xt)]),t("li",vt,[t("a",{href:`https://www.pinterest.com/pin/create/button/?url=${s(H)}&title=${s(O)}`,class:"share icon-legacy-pinterest w-26 h-26 rounded-full border border-green-500 text-green-500 flex items-center justify-center hover:text-green-600 hover:border-green-600 transition duration-300 ease-linear mx-auto"},null,8,kt)]),t("li",wt,[t("a",{href:`mailto:?body=${(F=s(n))==null?void 0:F.link}`,class:"icon-legacy-mail w-26 h-26 rounded-full border border-green-500 text-green-500 flex items-center justify-center hover:text-green-600 hover:border-green-600 transition duration-300 ease-linear mx-auto"},null,8,yt)])])]),t("div",{class:"wysiwyg-content",innerHTML:(K=s(n))==null?void 0:K.content},null,8,$t),t("footer",Ct,[t("div",St,[(Y=(X=(W=(Q=(J=(G=s(n))==null?void 0:G.author)==null?void 0:J.node)==null?void 0:Q.authorMeta)==null?void 0:W.avatar)==null?void 0:X.node)!=null&&Y.sourceUrl?(r(),l("img",{key:0,src:(oe=(ne=(se=(te=(ee=(Z=s(n))==null?void 0:Z.author)==null?void 0:ee.node)==null?void 0:te.authorMeta)==null?void 0:se.avatar)==null?void 0:ne.node)==null?void 0:oe.sourceUrl,alt:(de=(ce=(ie=(le=(re=(ae=s(n))==null?void 0:ae.author)==null?void 0:re.node)==null?void 0:le.authorMeta)==null?void 0:ie.avatar)==null?void 0:ce.node)==null?void 0:de.altText,class:"attachment-avatar"},null,8,It)):_("",!0)]),t("div",Tt,[(pe=(me=(ue=s(n))==null?void 0:ue.author)==null?void 0:me.node)!=null&&pe.name?(r(),l("h3",Pt,h((he=(ge=(_e=s(n))==null?void 0:_e.author)==null?void 0:ge.node)==null?void 0:he.name),1)):_("",!0),(xe=(be=(fe=s(n))==null?void 0:fe.author)==null?void 0:be.node)!=null&&xe.description?(r(),l("p",Mt,h((we=(ke=(ve=s(n))==null?void 0:ve.author)==null?void 0:ke.node)==null?void 0:we.description),1)):_("",!0)])]),t("div",null,[g(U,{to:"/blog/",class:"text-green-500 hover:text-green-600 inline-flex items-center align-top font-medium font-agendaCond text-f14 uppercase"},{default:y(()=>[Lt,Rt]),_:1})])]),t("div",Dt,[t("div",null,[Ut,t("form",{onSubmit:Ne(Pe,["prevent"]),id:"form-newsletter",class:"subscribe-form",novalidate:"true"},[t("div",Bt,[Ve(t("input",{"onUpdate:modelValue":a[0]||(a[0]=u=>Ae(i)?i.value=u:null),placeholder:"Enter your email",name:"email",id:"email-inputter",required:"",type:"email",class:ze(["input input-c placeholder-gray-100",{"border-red-100 border-2 error":s($)}])},null,2),[[qe,s(i)]])]),Et,s(C)?(r(),l("p",jt," Thank you for subscribing! ")):_("",!0),s(j)?(r(),l("p",Ht,h(s(c)),1)):_("",!0)],32)])])])])]),s(z).length>0?(r(),l("section",Nt,[t("div",Vt,[qt,g(S,{"related-posts":s(z)},null,8,["related-posts"])])])):_("",!0)],64)}}}),Kt=Qe(At,[["__scopeId","data-v-558f309d"]]);export{Kt as default};