1const jsonString=document.getElementById("cartSteps")?.innerHTML,cartSteps=jsonString?JSON.parse(jsonString):[],samplesString=document.getElementById("cartSamples")?.innerHTML,cartSamples=samplesString?JSON.parse(samplesString):[],refresh=async()=>{await fetch("/cart.js"),document.documentElement.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0}))},updateCart=async updates=>{await fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates})}),await refresh()};document.addEventListener("cart:updated",async function(event){const{items,total_price}=event.detail.cart;total_price>0||!jsonString?handleAddingLogic(total_price,items,cartSamples):total_price===0&&items.length>0&&handleCleaningLogic(items)});async function handleAddingLogic(total_price,items,cartSamples2){const remove=id=>Object.assign(updates,{[`${id}`]:0}),add=id=>Object.assign(updates,{[`${id}`]:1}),samples=items.filter(item=>cartSamples2.includes(item.id));console.log(samples);let samples_length=samples.length,maxStepNumberSamples=0,updates={};for(let i=0;i<cartSteps.length;i++){const step=cartSteps[i],{price,gift,numberSamples}=step;if(total_price/100>=price&&numberSamples>maxStepNumberSamples&&(maxStepNumberSamples=numberSamples),gift){const hasGift=items.some(item=>item.id===gift);total_price/100>=price&&!hasGift?add(gift):total_price/100<price&&hasGift&&remove(gift)}}console.log(samples.length,maxStepNumberSamples);const stepSamplesToRemove=samples.length>maxStepNumberSamples?(console.log("remove samples"),[...samples].splice(maxStepNumberSamples).map(sample=>String(sample.id))):[];console.log(stepSamplesToRemove),stepSamplesToRemove.length&&stepSamplesToRemove.forEach(sample=>{Object.assign(updates,{[sample]:0}),samples_length--}),Object.keys(updates).length>0?await updateCart(updates):await refresh()}async function handleCleaningLogic(items){let updates={};items.map(item=>item.id).forEach(id=>{updates[`${id}`]=0}),await fetch("/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({updates})}),await fetch("/cart.js"),document.documentElement.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0})),await refresh(),window.addingSample=!1}function openNav(){document.getElementById("filtersSidebar").style.width="500px"}function closeNav(){document.getElementById("filtersSidebar").style.width="0"}let scrollpos=window.scrollY,header=document.getElementById("mobile-menu-drawer");function add_class_on_scroll(){header.classList.add("side-menu-top-position")}function remove_class_on_scroll(){header.classList.remove("side-menu-top-position")}window.addEventListener("scroll",function(){scrollpos=window.scrollY,scrollpos>58?add_class_on_scroll():remove_class_on_scroll()});async function setNote(note){await fetch("/cart/update.json",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({note})}),await refresh()}var NoteModal=class extends HTMLElement{constructor(){super(),this.input=document.querySelector("input[name=open-note-modal]"),this.textarea=this.querySelector("textarea"),this.inputFrom=this.querySelector("#senderName"),this.querySelector("#submitNoteModal").addEventListener("click",this.submitNoteModal),this.querySelector("#closeNoteModal").addEventListener("click",this.closeNoteModal),this.init()}init=()=>{const[note,from]=(window.cartNote||"").split(` 2De la part de `);this.textarea.value=note||"",this.inputFrom.value=from||""};submitNoteModal=async()=>{window.cartNote=this.textarea.value+`${this.inputFrom.value.length?` 3De la part de ${this.inputFrom.value}`:""}`,await updateCart({39892626767939:1}),await setNote(window.cartNote),this.classList.remove("show-extra-text")};closeNoteModal=async()=>{this.input.checked=!1,this.input.dispatchEvent(new Event("change",{bubbles:!0}))}};window.customElements.define("note-modal",NoteModal);var NoteModalCheckbox=class extends HTMLElement{constructor(){super(),this.input=this.querySelector("input"),this.input.addEventListener("change",this.onToggle),this.init()}init=()=>{this.input.checked=window.cartNote.length>0};onToggle=async e=>{const modal=document.querySelector("note-modal"),textarea=modal.querySelector("textarea");e.target.checked?(modal.classList.add("show-extra-text"),textarea.setAttribute("is","cart-note"),textarea.setAttribute("id","cart[
3note]")):(textarea.setAttribute("is",""),textarea.setAttribute("id",""),modal.classList.remove("show-extra-text"),await updateCart({39892626767939:0}),textarea.value.length>0&&(textarea.value="",window.cartNote="",await setNote("")))}};window.customElements.define("note-modal-checkbox",NoteModalCheckbox);const FS_norm=s=>(s=(s==null?"":String(s)).toLowerCase().trim().replace(/\s+/g," "),s=s.normalize("NFD").replace(/[Ì-ͯ]/g,""),s==="bouquet parfume"&&(s="bouquet"),s==="un coffret"&&(s="coffret"),s),FS_valueFromOption=opt=>{const v=opt&&opt.value?opt.value:"",i=v.indexOf("=");let raw=i>=0?v.slice(i+1):v;raw=raw.replace(/\+/g," ");try{raw=decodeURIComponent(raw)}catch{}return raw},applyFilter=argElement=>{const filter=document.querySelector(argElement);if(!filter)return;const container=filter.querySelector(".cont-option"),optionsContainer=filter.querySelector(".options"),select=filter.querySelector("select"),text=filter.querySelector(".text"),options=filter.querySelectorAll(".option"),selectOptions=select?select.querySelectorAll("option"):[];!select||!text||options.length<=0||selectOptions.length<=0||(optionsContainer&&optionsContainer.addEventListener("mouseout",function(){container.classList.remove("active")}),options.forEach(i=>{i.addEventListener("click",()=>{text.innerHTML=i.innerHTML,selectOptions.forEach(o=>{o.defaultSelected=!1,i.innerHTML.trim()===o.dataset.option.trim()&&(o.defaultSelected=!0)}),container.classList.add("active")})}))},FS_initCascade=(containerEl,combos)=>{const filters=Array.prototype.slice.call(containerEl.querySelectorAll('.filter-custom-selector[id^="filter-"]')).sort((a,b)=>+a.id.split("-")[1]-+b.id.split("-")[1]);if(filters.length<2)return;const blocks=filters.map(f=>{const select=f.querySelector("select"),head=f.querySelector(".head .text")||f.querySelector(".text"),lis=Array.prototype.slice.call(f.querySelectorAll(".options .option")),opts=Array.prototype.slice.call(select.querySelectorAll("option")),items=lis.map((li,idx)=>{const opt=opts[idx],value=FS_valueFromOption(opt);return{li,opt,value,nvalue:FS_norm(value),label:(opt&&opt.dataset.option?opt.dataset.option:li.textContent).trim()}});return{el:f,select,head,items}}),chosenNorm=b=>{let chosen=null;return b.select.querySelectorAll("option").forEach(o=>{o.defaultSelected&&(chosen=o)}),chosen||(chosen=b.select.options[b.select.selectedIndex]||b.select.options[0]),FS_norm(FS_valueFromOption(chosen))},setChosen=(b,item)=>{const opts=b.select.querySelectorAll("option");opts.forEach(o=>{o.defaultSelected=!1}),item.opt.defaultSelected=!0,b.select.selectedIndex=Array.prototype.indexOf.call(opts,item.opt),b.head&&(b.head.innerHTML=item.label)},applyTo=(b,validSet)=>{const restrict=validSet&&validSet.size>0;let firstVisible=null;b.items.forEach(it=>{const show=!restrict||validSet.has(it.nvalue);it.li.style.display=show?"":"none",show&&!firstVisible&&(firstVisible=it)}),firstVisible||(b.items.forEach(it=>{it.li.style.display=""}),firstVisible=b.items[0]);const cur=chosenNorm(b);!b.items.some(it=>it.nvalue===cur&&it.li.style.display!=="none")&&firstVisible&&setChosen(b,firstVisible)},apply=()=>{const n1=chosenNorm(blocks[0]);if(blocks[1]){const valid2=new Set;combos.forEach(c=>{FS_norm(c[0])===n1&&c[1]&&valid2.add(FS_norm(c[1]))}),applyTo(blocks[1],valid2)}if(blocks[2]){const n2=blocks[1]?chosenNorm(blocks[1]):"",valid3=new Set;combos.forEach(c=>{FS_norm(c[0])===n1&&(!n2||FS_norm(c[1])===n2)&&c[2]&&valid3.add(FS_norm(c[2]))}),applyTo(blocks[2],valid3)}};blocks.forEach(b=>{b.items.forEach(it=>{it.li.addEventListener("click",()=>{setChosen(b,it),apply()})})}),apply()};window.addEventListener("load",event=>{document.querySelectorAll(".btn-fs").forEach(btn=>{btn.addEventListener("click",()=>{let url=document.location.origin+"/collections/all-products/?";document.querySelector(`.${btn.dataset.id}`).querySelectorAll("select").forEach(select=>{url+=`${select.value}&`}),window.location.href=url})}),document.querySelectorAll('.filter-custom-selector[id*="filter"]').forEach(item=>{applyFilter(`#${item.id}`)}),document.querySelectorAll("[data-combos]").forEach(containerEl=>{const url=containerEl.getAttribute("data-combos");url&&fetch(url).then(r=>r.json()).then(combos=>{FS_initCascade(containerEl,combos)}).catch(()=>{})})}); 4//# sourceMappingURL=/cdn/shop/t/149/assets/custom.js.map?v=5092365840906248271790586318
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.