1import{b as e,A as l,u as t,j as o}from"./main-BmYsSTrY.js";import{r as a,f as r,E as n,e as i,I as d}from"./vendor-DI-zMLkP.js";import{f as s,M as u,g as c,O as m,B as p,C as v}from"./index-9Yy5i9pU.js";import{u as _,D as g}from"./embla-carousel-pagination-button-DPSr7RJ3.js";const w=t=>{var o,d;const m=window.__pageData__,{titleColor:p,tagColor:v,component_content:w,isInEcommerceTemplate:h,widgetId:b,productIds:x,autoPlay:y,autoPlaySpeed:D=5e3}=t,[j,f]=a.useState(),[E,C]=a.useState(!1),[I,N]=a.useState(""),T={playOnInit:y===(null==(o=s)?void 0:o.WIDGET_CHECK_TRUE),delay:parseInt(D)||5e3,stopOnInteraction:y!==(null==(d=s)?void 0:d.WIDGET_CHECK_TRUE)},[k,L]=e({active:!0,align:"start",slidesToScroll:1,dragFree:!0,loop:!0},[l(T)]),S=a.useCallback((()=>{L&&L.scrollPrev()}),[L]),U=a.useCallback((()=>{L&&L.scrollNext()}),[L]),{selectedIndex:R,scrollSnaps:W,onDotButtonClick:H}=_(L),O={color:p},G={color:v},{limit:F,tagLine:A,headingText:B,recommendationWidget:K,query:P,operator:M}=JSON.parse(void 0===w?"{}":w),z=()=>{let e="";const{content_model_internal_name:l}=m;return(null==l?void 0:l.startsWith("ecommerce_product"))?e="product":(null==l?void 0:l.startsWith("ecommerce_category"))?e="category":(null==l?void 0:l.startsWith("ecommerce_brand"))?e="brand":"web_pages"===l?e="web_page":window.location.pathname===u()||"/cart/"===window.location.pathname||"/panier/"===window.location.pathname?e="cart":"/checkout/"===window.location.pathname&&(e="checkout"),e},$=()=>{let e="";const{content_model_internal_name:l,content_model_data_id:t}=m;return(null==l?void 0:l.startsWith("ecommerce_product"))||(null==l?void 0:l.startsWith("ecommerce_category"))||(null==l?void 0:l.startsWith("ecommerce_brand"))||"web_pages"===l?e=t:window.location.pathname===u()||"/cart/"===window.location.pathname||"/panier/"===window.location.pathname?e="cart":"/checkout/"===window.location.pathname&&(e="checkout"),e},V=a.useCallback((()=>{if(null==P?void 0:P.length)return[{group:{operator:"OR"===M?"OR":"AND",rules:P.map((e=>({action:e.condition,field_name:"sku"===e.field?"variant_skus":e.field,value:e.value.split(",").map((e=>e.trim()))})))}}]}),[M,P]),q=async e=>{var l,t;try{const{currencyInfo:o}=c(),a=await n.widgetSearch({widget_id:h?b:K?null==K?void 0:K.id:"",fields:"*",skip:0,limit:F?parseInt(F):6,currency:null==o?void 0:o.currency_code,body:{context_type:z(),context_data:$(),products_ids:h?x:[],filter:e}});(null==(l=null==m?void 0:m.content_model_internal_name)?void 0:l.startsWith("ecommerce_category"))&&(null==(t=null==a?void 0:a.Data)?void 0:t.rule_details)&&(a.Data.rule_details.category=null==m?void 0:m.title),f(a),C(!1),N(i.generateUUID())}catch(o){console.error(o)}};return a.useEffect((()=>{const e=new IntersectionObserver(((e,l)=>{null==e||e.forEach((e=>{var t,o,a;e.isIntersecting&&((null==(o=null==(t=null==j?void 0:j.Data)?void 0:t.records)?void 0:o.length)&&0!==(null==(a=null==j?void 0:j.Data)?void 0:a.total_count)&&(async e=>{var l,t,o,a,n,i,d,s,c,p,v,_,g,w,h,b,x,y,D,j,f;const E=[];null==(t=null==(l=null==e?void 0:e.Data)?void 0:l.records)||t.forEach((async l=>{var t,o,a,r,n,i,d,s,u,c,m,p,v,_;const g={sku:null==l?void 0:l.sku,name:null==l?void 0:l.name,price:null==l?void 0:l.calculated_price,brand:null==l?void 0:l.brand,product_category:null==l?void 0:l.category_meta,is_primary_algorithm:null==l?void 0:l.is_primary_algorithm,is_secondary_algorithm:null==l?void 0:l.is_secondary_algorithm,algorithm:null==(o=null==(t=null==e?void 0:e.Data)?void 0:t.rule_details)?void 0:o.algorithm,is_merchandising:null==l?void 0:l.is_merchandising,rule:null==(r=null==(a=null==e?void 0:e.Data)?void 0:a.rule_details)?void 0:r.rule_id,rule_type:null==(i=null==(n=null==e?void 0:e.Data)?void 0:n.rule_details)?void 0:i.rule_type,widget_id:null==(s=null==(d=null==e?void 0:e.Data)?void 0:d.rule_details)?void 0:s.widget_id,context_type:null==(c=null==(u=null==e?void 0:e.Data)?void 0:u.rule_details)?void 0:c.context_type,context_data:null==(p=null==(m=null==e?void 0:e.Data)?void 0:m.rule_details)?void 0:p.context_data,variant:null==(_=null==(v=null==e?void 0:e.Data)?void 0:v.rule_details)?void 0:_.variant,rules:null==l?void 0:l.rule_details};E.push(g)}));const C=z();let I,N;const T=u();window.location.pathname===T||"/cart/"===window.location.pathname||"/panier/"===window.location.pathname||"/search/"===window.location.pathname||"/search"===window.location.pathname||"/checkout/"===window.location.pathname?(I=null,N=$()):(I=$(),N=null==m?void 0:m.title),await r.trackWidgetViewed({noOfResults:null==(o=null==e?void 0:e.Data)?void 0:o.total_count,products_detail:E,sku:null==(n=null==(a=null==e?void 0:e.Data)?void 0:a.records)?void 0:n.map((e=>null==e?void 0:e.sku)),algorithm:null==(d=null==(i=null==e?void 0:e.Data)?void 0:i.rule_details)?void 0:d.algorithm,rule:null==(c=null==(s=null==e?void 0:e.Data)?void 0:s.rule_details)?void 0:c.rule_id,rule_type:null==(v=null==(p=null==e?void 0:e.Data)?void 0:p.rule_details)?void 0:v.rule_type,widget_id:null==(g=null==(_=null==e?void 0:e.Data)?void 0:_.rule_details)?void 0:g.widget_id,context_type:null==(h=null==(w=null==e?void 0:e.Data)?void 0:w.rule_details)?void 0:h.context_type,context_data:null==(x=null==(b=null==e?void 0:e.Data)?void 0:b.rule_details)?void 0:x.context_data,category:null==(D=null==(y=null==e?void 0:e.Data)?void 0:y.rule_details)?void 0:D.category,variant:null==(f=null==(j=null==e?void 0:e.Data)?void 0:j.rule_details)?void 0:f.variant,pageType:C,pageMetaId:I,pageDisplayName:N})})(j),l.disconnect())}
1))}),{threshold:.1}),l=document.getElementById(I);return l&&e.observe(l),()=>{l&&e.unobserve(l)}}),[E]),a.useEffect((()=>{const e=V(),l=()=>{var l;void 0!==K&&(null==(l=null==Object?void 0:Object.keys(K))?void 0:l.length)||void 0!==e&&(null==e?void 0:e.length)?q(e):h&&q()};return l(),document.addEventListener("LOGIN_SUCCESSFUL",(()=>{l()})),document.addEventListener("LOGOUT_SUCCESSFUL",(()=>{l()})),document.removeEventListener("LOGIN_SUCCESSFUL",l),document.removeEventListener("LOGOUT_SUCCESSFUL",l)}),[w,F]),{title_style:O,tag_style:G,tagLine:A,headingText:B,productsData:j,isLoading:E,selectedIndex:R,scrollSnaps:W,DotButton:g,emblaRef:k,onDotButtonClick:H,scrollNext:U,scrollPrev:S,observedDivId:I}},h=e=>{var l,r,n,i,u,c,_,g,h,b,x,y,D,j,f,E,C,I,N,T,k;const{t:L}=t(),{id:S,titleColor:U,tagColor:R,component_content:W,sliderView:H="on",titleTextPosition:O,pagination:G="off",paginationPosition:F,sliderArrows:A="on",isInEcommerceTemplate:B=!1,widgetLabel:K="You May Also Like",widgetId:P,productIds:M=[],autoPlay:z=!0,widgetDescription:$,wrap_container:V="container",loadImagesLazily:q}=e,J={},{title_style:Y,tag_style:Q,tagLine:X,headingText:Z,productsData:ee,isLoading:le,selectedIndex:te,scrollSnaps:oe,DotButton:ae,emblaRef:re,onDotButtonClick:ne,scrollNext:ie,scrollPrev:de,observedDivId:se}=w({titleColor:U,tagColor:R,component_content:W,isInEcommerceTemplate:B,widgetId:P,productIds:M,autoPlay:z});return o.jsx(o.Fragment,{children:B&&!le&&(null==(r=null==(l=null==ee?void 0:ee.Data)?void 0:l.records)?void 0:r.length)?o.jsxs("div",{...J,className:"product-set-outer-section mb-12 md:mb-16 lg:mb-28",children:[(null==K?void 0:K.length)||(null==$?void 0:$.length)?o.jsx("div",{className:"section-title text-center mb-14",children:o.jsxs("div",{className:V,children:[o.jsx("h4",{className:"text-center text-2xl lg:text-3xl xl:text-4xl",dangerouslySetInnerHTML:{__html:K}}),!!(null==$?void 0:$.length)&&o.jsx("p",{className:"text-center mt-1",dangerouslySetInnerHTML:{__html:$}})]})}):o.jsx(o.Fragment,{}),o.jsx("div",{...J,className:"recommendation-widget section-gap product-set-section",id:se,children:o.jsx("div",{className:V,children:(null==(i=null==(n=null==ee?void 0:ee.Data)?void 0:n.records)?void 0:i.length)>4?o.jsxs("div",{className:"embla group/top-arrow embla-top-arrow relative",children:[o.jsx("div",{className:"embla__viewport overflow-hidden",ref:re,children:o.jsx("div",{className:"embla__container flex -mx-4",children:null==(c=null==(u=null==ee?void 0:ee.Data)?void 0:u.records)?void 0:c.map(((e,l)=>{var t;return o.jsx("div",{className:"embla__slide basis-6/12 sm:basis-4/12 lg:basis-3/12 shrink-0 min-w-0 px-4",children:o.jsx(m,{productDetails:e,showActionButtons:!1,mode:"widget",widgetRuleDetails:null==(t=null==ee?void 0:ee.Data)?void 0:t.rule_details,loadImagesLazily:q===s.WIDGET_CHECK_TRUE})},l)}))})}),A===s.WIDGET_CHECK_TRUE&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:"embla__prev embla__arrow absolute top-2/4 left-0 -translate-y-2/4 group-[.embla-top-arrow]/top-arrow:-top-[5.313rem] lg:group-[.embla-top-arrow]/top-arrow:-top-[5.5rem] xl:group-[.embla-top-arrow]/top-arrow:-top-24 group-[.embla-top-arrow]/top-arrow:right-10 group-[.embla-top-arrow]/top-arrow:left-auto group-[.embla-top-arrow]/top-arrow:translate-y-0 w-6 h-6 flex items-center justify-center focus:outline-none","aria-hidden":"true","aria-label":"Left Arrow",type:"button",onClick:de,children:o.jsx(p,{})}),o.jsx("button",{className:"embla__next embla__arrow absolute top-2/4 left-auto right-0 -translate-y-2/4 group-[.embla-top-arrow]/top-arrow:-top-[5.313rem] lg:group-[.embla-top-arrow]/top-arrow:-top-[5.5rem] xl:group-[.embla-top-arrow]/top-arrow:-top-24 group-[.embla-top-arrow]/top-arrow:right-0 group-[.embla-top-arrow]/top-arrow:translate-y-0 w-6 h-6 flex items-center justify-center focus:outline-none","aria-hidden":"true",type:"button","aria-label":"Right Arrow",onClick:ie,children:o.jsx(v,{className:"stroke-neutral-500"})})]}),G===(null==(_=s)?void 0:_.WIDGET_CHECK_TRUE)&&o.jsx("div",{className:`embla__dots mt-8 ${F}`,children:oe.map(((e,l)=>o.jsx(ae,{onClick:()=>ne(l),className:"embla__dot w-2 h-2 border border-solid border-secondary mr-3 last:mr-0".concat(l===te?" embla__dot--selected bg-secondary-default":"")},l)))})]}):o.jsx(o.Fragment,{children:o.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-8",children:null==(h=null==(g=null==ee?void 0:ee.Data)?void 0:g.records)?void 0:h.map(((e,l)=>{var t;return o.jsx(a.Fragment,{children:o.jsx(m,{productDetails:e,showActionButtons:!1,mode:"widget",widgetRuleDetails:null==(t=null==ee?void 0:ee.Data)?void 0:t.rule_details,loadImagesLazily:q===s.WIDGET_CHECK_TRUE})},l.toString())}))})})})})]}):o.jsxs("div",{...J,className:"product-set-outer-section mb-12 md:mb-16 lg:mb-28",children:[((null==X?void 0:X.length)||(null==Z?void 0:Z.length))&&d&&(null==(x=null==(b=null==ee?void 0:ee.Data)?void 0:b.records)?void 0:x.length)||!d?o.jsx("div",{className:"section-title text-center mb-14",children:o.jsxs("div",{className:"container",children:[o.jsx("h4",{className:` text-2xl lg:text-3xl xl:text-4xl ${O}`,style:Y,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:(null==Z?void 0:Z.length)?Z:""}}),(!!(null==X?void 0:X.length)&&d||!d)&&o.jsx("p",{className:`mt-1 ${O}`,style:Q,dangerouslySetInnerHTML:{__html:(null==X?void 0:X.length)?X:""}})]})}):o.jsx(o.Fragment,{}),!le&&(null==(D=null==(y=null==ee?void 0:ee.Data)?void 0:y.records)?void 0:D.length)?o.jsx("div",{...J,className:"recommendation-widget section-gap product-set-section",id:se,children:o.jsx("div",{className:"container",children:H===(null==(j=s)?void 0:j.WIDGET_CHECK_TRUE)&&(null==(E=null==(f=null==ee?void 0:ee.Data)?void 0:f.records)?void 0:E.length)>4?o.jsxs("div",{className:"embla group/top-arrow embla-top-arrow relative",children:[o.jsx("div",{className:"embla__viewport overflow-hidden",ref:re,children:o.jsx("div",{className:"embla__container flex -mx-4",children:null==(I=null==(C=null==ee?void 0:ee.Data)?void 0:C.records)?void 0:I.map(((e,l)=>{var t;return o.jsx("div",{className:"embla__slide basis-6/12 sm:basis-4/12 lg:basis-3/12 shrink-0 min-w-0 px-4",children:o.jsx(m,{productDetails:e,showActionButtons:!1,mode:"widget",widgetRuleDetails:null==(t=null==ee?void 0:ee.Data)?void 0:t.rule_details,loadImagesLazily:q===s.WIDGET_CHECK_TRUE})},l)}))})}),A===s.WIDGET_CHECK_TRUE&&o.jsxs(o.Fragment,{children:[o.jsx("button",{className:"embla__prev embla__arrow absolute top-2/4 left-0 -translate-y-2/4 group-[.embla-top-arrow]/top-arrow:-top-[5.313rem] lg:group-[.embla-top-arrow]/top-arrow:-top-[5.5rem] xl:group-[.embla-top-arrow]/top-arrow:-top-24 group-[.embla-top-arrow]/top-arrow:right-10 group-[.embla-top-arrow]/top-arrow:left-auto group-[.embla-top-arrow]/top-arrow:translate-y-0 w-6 h-6 flex items-center justify-center focus:outline-none","aria-hidden":"true","aria-label":"Left Arrow",type:"button",onClick:de,children:o.jsx(p,{})}),o.jsx("button",{className:"embla__next embla__arrow absolute top-2/4 left-auto right-0 -translate-y-2/4 group-[.embla-top-arrow]/top-arrow:-top-[5.313rem] lg:group-[.embla-top-arrow]/top-arrow:-top-[5.5rem] xl:group-[.embla-top-arrow]/top-arrow:-top-24 group-[.embla-top-arrow]/top-arrow:right-0 group-[.embla-top-arrow]/top-arrow:translate-y-0 w-6 h-6 flex items-center justify-center focus:outline-none","aria-hidden":"true",type:"button","aria-label":"Right Arrow",onClick:ie,children:o.jsx(v,{className:"stroke-neutral-500"})})]}),G===(null==(N=s)?void 0:N.WIDGET_CHECK_TRUE)&&o.jsx("div",{className:`embla__dots mt-8 ${F}`,children:oe.map(((e,l)=>o.jsx(ae,{onClick:()=>ne(l),className:"embla__dot w-2 h-2 border border-solid border-secondary mr-3 last:mr-0".concat(l===te?" embla__dot--selected bg-secondary-default":"")},l)))})]}):o.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-8",children:null==(k=null==(T=null==ee?void 0:ee.Data)?void 0:T.records)?void 0:k.map(((e,l)=>{var t;return o.jsx(a.Fragment,{children:o.jsx(m,{productDetails:e,showActionButtons:!1,mode:"widget",widgetRuleDetails:null==(t=null==ee?void 0:ee.Data)?void 0:t.rule_details,loadImagesLazily:q===s.WIDGET_CHECK_TRUE})},l.toString())}))})})}):o.jsx(o.Fragment,{})]})})};export{h 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.