1import{n as U,p as j,P as z,x as p,g as P,K as Y,h as G,e as g,L as J,W as Q,a0 as X,a2 as k,S as Z,V as ee,a1 as te,j as E,q as ae,Y as se,T as ne,R as i,i as w,F as oe,J as ie,f as l,Q as C,l as K,X as le,y as re,d as ce,t as ue,A as de,M as R}from"./B0_i8s_O.js";import{_ as pe}from"./Kidyohh0.js";const ve=U({__name:"ContentfulSection",props:{section:{},siteName:{default:"TaxWell Site"},siteKey:{default:"site"},index:{default:0}},setup(t){const o=t,n=j(z,void 0),u=g(()=>J(o.section.type,n));return(y,v)=>u.value?(p(),P(Y(u.value),{key:0,section:t.section,"site-name":t.siteName,"site-key":t.siteKey,index:t.index},null,8,["section","site-name","site-key","index"])):G("",!0)}}),fe="preview_session_inactive";function A(t){const o=m(t,"statusCode")??m(t,"status");if(o)return o;const n=r(t)?.response,u=m(n,"statusCode")??m(n,"status");if(u)return u;const y=r(t)?.data??r(n)?._data;return m(y,"statusCode")??m(y,"status")}function me(t){if(A(t)!==403)return!1;if((d(t,"code")??d(r(t)?.data,"code")??d(r(r(t)?.response)?._data,"code"))===fe)return!0;const n=d(t,"statusMessage")??d(r(t)?.data,"statusMessage")??d(r(t)?.data,"message")??d(r(r(t)?.response)?._data,"statusMessage")??d(r(r(t)?.response)?._data,"message");return typeof n=="string"&&/^Preview session\b/.test(n)}function m(t,o){const n=r(t)?.[o];return typeof n=="number"&&Number.isInteger(n)&&n>=400&&n<=599?n:void 0}function d(t,o){const n=r(t)?.[o];return typeof n=="string"&&n.length>0?n:void 0}function r(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:void 0}const ge={key:0,id:"main",class:"page page--ds"},ye={key:2,id:"main",class:"page page--constrained"},he={class:"preview-message",role:"alert"},we=["href"],Ce={key:3,id:"main",class:"page"},_e={class:"fallback-home"},be={class:"eyebrow"},Se={key:4,id:"main",class:"page page--constrained"},xe={class:"config-message"},Te=U({__name:"ContentfulPage",props:{routePath:{},allowStaticFallback:{type:Boolean}},async setup(t){let o,n;const u=t,y=Q(),v=le(),h=g(()=>F(u.routePath)),c=g(()=>y.query.preview==="true"),f=S(v.public.siteName,"TaxWell Site"),T=S(v.public.siteKey,"site"),M=S(v.public.homeTitle,f),_=S(v.public.homeBody,"One working Nuxt app, one Contentful Space, and one place to add the first migrated page."),B=g(()=>`/api/preview/exit?path=${encodeURIComponent(h.value)}`),I=g(()=>re(T,h.value,c.value));X(c,s=>{s&&ce(I.value)},{immediate:!0});const{data:a,error:b}=([o,n]=k(()=>Z(()=>I.value,()=>$fetch("/api/page",{query:{path:h.value,preview:c.value?"true":void 0}}),{getCachedData:(s,e)=>{if(!c.value)return e.isHydrating?e.payload.data[s]:e.static.data[s]},watch:[h,c]})),o=await o,n(),o),$=ee();te(()=>{$.value=a.value?.renderType&&a.value?.layer?a.value.layer:null});const N=g(()=>c.value&&me(b.value));if(b.value&&!N.value){const s=c.value?A(b.value)??500:500,e=c.value?"Unable to load Contentful preview.":"Unable to load Contentful page.";throw E({statusCode:s,statusMessage:e})}if(!b.value&&!a.value&&!u.allowStaticFallback){const s=([o,n]=k(()=>H(h.value)),o=await o,n(),o);if(s)[o,n]=k(()=>ae(s.toUrl,{external:!0,redirectCode:s.permanent?301:302})),await o,n();else throw E({statusCode:404,statusMessage:"Page not found."})}se({title:()=>a.value?.seo?.title??a.value?.title??f,description:()=>a.value?.seo?.description??_,robots:()=>O(a.value),ogTitle:()=>a.value?.seo?.socialTitle??a.value?.seo?.title??a.value?.title??f,ogDescription:()=>a.value?.seo?.socialDescription??a.value?.seo?.description??_,ogImage:()=>a.value?.seo?.socialImageUrl,ogImageAlt:()=>a.value?.seo?.socialImageAlt,ogType:()=>a.value?.seo?.openGraphType??"website",twitterTitle:()=>a.value?.seo?.socialTitle??a.value?.seo?.title??a.value?.title??f,twitterDescription:()=>a.value?.seo?.socialDescription??a.value?.seo?.description??_,twitterImage:()=>a.value?.seo?.socialImageUrl,twitterImageAlt:()=>a.value?.seo?.socialImageAlt}),ne({link:()=>{const s=V(a.value?.seo?.canonicalUrl),e=W(a.value?.seo?.canonicalPath??a.value?.path);return s?[{rel:"canonical",href:s}]:e?[{rel:"canonical",href:e}]:[]}});function F(s){return ue(s.split("?")[0]??"/",de(v.public.canonicalPathStyle))}async function H(s){try{return await $fetch("/api/redirect",{query:{path:s}})}catch{return null}}function S(s,e){return typeof s=="string"&&s.length>0?s:e}function O(s){if(c.value)return"noindex,nofollow";
1const e=s?.seo?.noIndex?"noindex":"index",x=s?.seo?.noFollow?"nofollow":"follow";return`${e},${x}`}function V(s){const e=R(s);return e&&/^https?:\/\//i.test(e)?e:void 0}function W(s){const e=R(s);return e&&e.startsWith("/")&&!e.startsWith("//")?e:void 0}return(s,e)=>{const x=ve,q=pe;return i(a)?.renderType&&(i(a).sections?.length??0)>0?(p(),w("main",ge,[(p(!0),w(oe,null,ie(i(a).sections,(D,L)=>(p(),P(x,{key:D.id,section:D,"site-name":i(f),"site-key":i(T),index:L},null,8,["section","site-name","site-key","index"]))),128))])):!i(a)?.renderType&&i(a)?.html?(p(),P(q,{key:1,page:i(a)},null,8,["page"])):i(N)?(p(),w("main",ye,[l("section",he,[e[0]||(e[0]=l("p",{class:"eyebrow"},"Preview unavailable",-1)),e[1]||(e[1]=l("h1",null,"Your Contentful preview session expired.",-1)),e[2]||(e[2]=l("p",null," Open this entry from Contentful again to start a new preview session, or leave preview mode to view published content. ",-1)),l("a",{class:"preview-message__action",href:i(B)},"Leave preview mode",8,we)])])):t.allowStaticFallback?(p(),w("main",Ce,[l("section",_e,[l("div",null,[l("p",be,C(i(f)),1),l("h1",null,C(i(M)),1),l("p",null,C(i(_)),1)])])])):(p(),w("main",Se,[l("section",xe,[e[5]||(e[5]=l("p",{class:"eyebrow"},"Contentful configuration needed",-1)),l("h1",null,"Set the "+C(i(f))+" delivery token to render this page.",1),l("p",null,[e[3]||(e[3]=K(" The Nuxt runtime is wired to the ",-1)),l("code",null,C(i(v).public.siteKey),1),e[4]||(e[4]=K(" Space, but this route does not have published page content yet. ",-1))])])]))}}});
1export{Te as _};
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.