1import{d as P,z as f,c,a as d,h as p,y as N,F as A,i as I,e as m,v as M,w as C,t as w,_ as x,O as V,u as q,r as i,a5 as E,o as H,b as L,f as R,L as T}from"./CBb99Q15.js";import{H as F}from"./MkKP6dUC.js";import{p as l}from"./qOmkz0o3.js";import{b}from"./Jd6aBPtE.js";import{h as S}from"./CbGaPIAM.js";import"./BDr1m4Qv.js";const z={class:"promotions"},D={class:"promotions__list"},O=["data-testid"],j={class:"promotion__image-wrap"},G=["src","data-testid"],J=["data-testid"],K=P({__name:"promotions",props:{promotions:{default:()=>[]}},setup(h){const o=h,g=f(()=>o.promotions.map(t=>({title:t.title.rendered,image:t.thumbnail.url,href:t.acf.url||r(t.id),target:t.acf.should_open_in_new_tab?"_blank":""}))),r=t=>l().pagePathById(t);return(t,v)=>(d(),c("div",z,[p("ul",D,[(d(!0),c(A,null,I(g.value,(e,s)=>(d(),c("li",{key:`promotion-${s}`,class:"promotion__item promotion","data-testid":`promotion-item-${s}`},[m(M,{class:"promotion__anchor",href:e.href,target:e.target,"data-testid":`anchor-${s}`},{default:C(()=>[p("div",j,[p("img",{class:"promotion__image",src:e==null?void 0:e.image,alt:"","data-testid":`image-${s}`},null,8,G)]),p("span",{class:"promotion__title","data-testid":`title-${s}`},w(e==null?void 0:e.title),9,J)]),_:2},1032,["href","target","data-testid"])],8,O))),128))]),N(t.$slots,"default",{},void 0,!0)]))}}),Q=x(K,[["__scopeId","data-v-4a651ddb"]]),U={key:0,class:"common-page-content-frame"},W=P({__name:"index",setup(h){const o=V(),g=f(()=>l().indexPage(!0).name),r=f(()=>{var _;const a=(_=o==null?void 0:o.query)==null?void 0:_.category,n=l().headerTitle(a);return S.set({title:n,canonicalTagEnabled:!0}),a}),{$wpRestApi:t,$errorHandler:v}=q(),e=i([]),s=i(0),k=i(1),B=i(100),u=i(!1),y=async()=>{u.value=!0;const a={page:k.value,perPage:B.value};(r==null?void 0:r.value)!==void 0&&(a.category=r.value);const{data:n,totalCount:_,error:$}=await t().promotionsApi(a);$.value!==null?v().handleRestApiError($.value.statusCode):n&&(e.value=n,s.value=_),u.value=!1};return E(()=>{var a;return(a=o.query)==null?void 0:a.category},()=>{b.set([l().indexPage(!0)]),y()}),H(()=>{y()}),b.set([l().indexPage(!0)]),(a,n)=>(d(),c("div",null,[u.value?L("",!0):(d(),c("div",U,[m(F,{"data-testid":"promotions-heading"},{default:C(()=>[R(w(g.value),1)]),_:1}),m(Q,{promotions:e.value},null,8,["promotions"])])),m(T,{loading:u.value},null,8,["loading"])]))}}),st=x(W,[["__scopeId","data-v-bfe8f14a"]]);export{st 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.