import{g as L,aW as T,_ as E,Q as $,aX as O}from"./DB-BdW1A.js";import{j as R,a as j,z as B,o as U,L as c,O as u,P as i,U as A,I as p,S as v,H as F,Y as V,W,V as I,u as N}from"./DokyoHAC.js";const H=["id"],M=["id"],J={class:"mb-4 font-heading text-4xl md:mb-8"},Q=["disabled","onClick"],X=["disabled","onClick"],G=R({__name:"SqueezelyProductSlider",props:{id:{type:String,required:!0},headingClass:{type:[String,Array,Object],default:()=>""},settings:{type:Object,default:()=>({showPagination:!0,showNavigation:!0,itemsToShow:1.5,mouseDrag:!1,touchDrag:!1,wheelControl:!1,transition:400,trimWhiteSpace:!1,breakpoints:{800:{itemsToShow:4.5,trimWhiteSpace:!0}}})}},setup(h){const{$config:y}=L(),_=h;let l=null;const t=j(null);B(()=>{const a=document.getElementById(_.id);if(!a)return;const r={attributes:!1,childList:!0,subtree:!1},m=b=>{b.forEach(f=>{f.type==="childList"&&(l=setTimeout(()=>{var z,x,q,w;const s=a.querySelector('[id^="sqzl"]'),e=a.querySelector(".sqzly-personalization.sqzly-custom");if(!s||!e)return;e.querySelectorAll("*").forEach(n=>{n.remove()});const o=JSON.parse(e.textContent||""),d={id:s.id,className:s.className,...((z=/sqzl_div-(?<variantId>[\d]+)-(?<variantRevision>[\d]+)/.exec(s.id))==null?void 0:z.groups)||{},...((x=/sqzly-(?<personalizationId>[\d]+)/.exec(s.className))==null?void 0:x.groups)||{}};t.value={...d,...o,products:((w=(q=o.products)==null?void 0:q.filter(n=>!!n))==null?void 0:w.map(n=>{var k,C;const S={id:+(((C=(k=n==null?void 0:n.productUrl)==null?void 0:k.split("-"))==null?void 0:C.pop())||0),...n,squeezely:d};return delete S.productUrl,S}))||[]}},10))})};new MutationObserver(m).observe(a,r)}),U(()=>{l&&(clearTimeout(l),l=null)});function D(){const a=document.getElementById(_.id);if(!a)return!1;const r=JSON.stringify({id:"test-id",className:"test-id",heading:"Test Slider",products:[{productUrl:"https://til.at.xsar.us:3001/p/fqnanni-pant-broek-paars-867",attributes:{brand:{values:{label:"Freequent"}},name:{values:{label:"FQNanni-pant broek paars"}}},images:[{hash:"images/9acbb0bf5f1a2d3cc2ec2aa0d2144c07.jpg"}],variants:[{referenceKey:"1082153-008-2XL",price:{currencyCode:"EUR",withTax:2400,appliedReductions:[]}}]},null]});a.innerHTML=`
  <div id="sqzly-personalization-preview-xgl449zl4fj" class="sqzly-personalization sqzly-1 sqzly-1-1" style="display: block;">
    <style></style>
    <div class="sqzly-custom sqzl-custom sqzly-personalization">
      ${r}
    </div>
  </div>
  `}return(a,r)=>{var s;const m=T,g=E,b=$,f=O;return c(),u("div",{class:I({hidden:!((s=t.value)!=null&&s.id)})},[i("div",{id:h.id,class:"peer hidden"},null,8,H),t.value?(c(),u("div",{key:0,id:t.value.id,class:"sqzly-personalization w-full pt-8"},[i("div",J,A(t.value.heading),1),p(f,{class:"mt-4",container:"gap-[5px]","with-arrows":""},{"prev-button":v(({prev:e,isPrevEnabled:o})=>[i("button",{class:"btn btn-ghost absolute left-6 top-2/4 -mt-6 hidden w-10 -translate-y-2/4 rounded-full border-0 disabled:opacity-50 md:block",disabled:!o,onClick:d=>e()},[p(g,{class:"relative left-2/4 ml-auto h-[12px] w-[14px] -translate-x-2/4"})],8,Q)]),"next-button":v(({next:e,isNextEnabled:o})=>[i("button",{class:"btn btn-ghost absolute right-6 top-2/4 -mt-6 hidden w-10 -translate-y-2/4 rounded-full border-0 disabled:opacity-50 md:block",disabled:!o,onClick:d=>e()},[p(b,{class:"relative left-2/4 ml-auto h-[12px] w-[14px] -translate-x-2/4"})],8,X)]),default:v(()=>[(c(!0),u(F,null,V(t.value.products,e=>(c(),u("div",{class:"mb-7 w-7/12 flex-none px-[5px] md:w-1/4",key:`product-${e.id}`},[p(m,{"data-test-id":"product-item",product:e,"listing-meta-data":{name:"Squeezely List",id:"SqueezelyProductList"},squeezlyData:{personalizationId:t.value.personalizationId,variantId:t.value.variantId,variantRevision:t.value.variantRevision},"image-loading":"lazy","data-click:product":"emit('click:product', product, index)","data-intersect:product":`
              (productId) => collectRowIntersection(productId, index)
            `,"show-siblings":!1},null,8,["product","squeezlyData"])]))),128))]),_:1})],8,M)):W("",!0),i("button",{type:"button",onClick:D,class:I({block:N(y).public.isDev,hidden:!N(y).public.isDev})}," Test Squeezely Data Insertion ",2)],2)}}});export{G as _};