PageSourceSearch

https://audocph.com/cdn/shop/t/33/assets/novicell_upsell-shared-1790860190.js

js audocph.com collected 2026-10-01 15:15:02 UTC 10,311 bytes, 9 lines download raw bytes

1import{f as g}from"./novicell_shopify-utility-1790860190.js";const S=new Map;function E(e,n,t=[]){if(!e?.variants?.length)return;const a=document.querySelectorAll(".upsell-drawer-material-selects-switch");function c(){const s=[];return a.forEach(l=>{const r=l.querySelector(".seleceted-option-value")?.textContent.trim();r&&s.push(r)}),s}function u(s){return e.variants.find(l=>s.every((r,d)=>r===l[`option${d+1}`]))||null}function m({fetchStock:s=!0}={}){const l=c(),r=u(l);if(!r)return;const d=document.querySelector(".upsell-drawer-price-lowered"),i=document.querySelector(".upsell-drawer-price-regular");d&&(d.textContent=g(r.price,n).replace(/,/g,".")),i&&(r.compare_at_price&&r.compare_at_price>r.price?i.textContent=g(r.compare_at_price,n).replace(/,/g,"."):i.textContent="");const p=document.querySelector("#upsell-drawer-add-to-cart span");p&&(p.textContent=g(r.price,n)),document.getElementById("upsell-drawer-add-to-cart")?.setAttribute("data-product-id",String(r.id));const h=document.querySelectorAll(".scroll-container img");let y=null;h.forEach(o=>{const w=[o.getAttribute("option1")||"",o.getAttribute("option2")||"",o.getAttribute("option3")||""];l.every(f=>w.includes(f))&&(y=o)}),y&&y.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"}),s&&fetch(`${window.location.origin}/products/${e.handle}?variant=${r.id}`).then(o=>{if(!o.ok)throw new Error("Network response was not ok");return o.text()}).then(o=>{const f=new DOMParser().parseFromString(o,"text/html").querySelector("stock-status"),v=document.querySelector(".upsell-drawer-delivery");f&&v&&(v.innerHTML=f.innerHTML)}).catch(o=>{console.error("Error:",o)})}a.forEach((s,l)=>{const r=s.querySelectorAll("label, img"),d=s.querySelector(".seleceted-option-value");if(r.length>0){const i=t[l],h=(i?[...r].find(y=>y.getAttribute("data-option-value-name")===i):null)||r[0];h.classList.add("active"),d&&(d.textContent=h.getAttribute("data-option-value-name"))}r.forEach(i=>{if(i.hasAttribute("tabindex")||i.setAttribute("tabindex","0"),i.hasAttribute("role")||i.setAttribute("role","button"),!i.hasAttribute("aria-label")){const p=i.getAttribute("data-option-value-name")||i.alt;p&&i.setAttribute("aria-label",p)}i.addEventListener("keydown",p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),i.click())}),i.addEventListener("click",()=>{r.forEach(p=>p.classList.remove("active")),i.classList.add("active"),d&&(d.textContent=i.getAttribute("data-option-value-name")),m()})})}),m({fetchStock:!1})}async function D(e,n){function t(o){return o?String(o).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"):""}const a=e.images.map(o=>{let w="",f="",v="";for(const b of e.variants){b.featured_image!=null&&(b.featured_image.src=b.featured_image.src.replace(/^https:/,""));const q=typeof o=="string"?o:o.src;if(b.featured_image!=null&&b.featured_image.src===q){w=b.option1||"",f=b.option2||"",v=b.option3||"";break}}return`<img src="${typeof o=="string"?o:o.src}&width=308" option1="${t(w)}" option2="${t(f)}" option3="${t(v)}" alt="">`}).join(""),c=document.querySelector(".upsell-gallery-body");c&&(c.innerHTML=a);const u=document.querySelector(".upsell-primary-title"),m=document.querySelector(".upsell-secondary-title");if(e.title){const o=e.title.split(","),w=o[0].trim(),f=o.length>1?o.slice(1).join(",").trim():"";u&&(u.textContent=w,u.hidden=!w),m&&(m.textContent=f)}const s=document.querySelector(".upsell-drawer-price-lowered"),l=document.querySelector(".upsell-drawer-price-regular");s&&(s.textContent=g(e.price,n).replace(/,/g,".")),l&&(e.compare_at_price&&e.compare_at_price>e.price?l.textContent=g(e.compare_at_price,n).replace(/,/g,"."):l.textContent="");const r=document.querySelector(".upsell-drawer-designer span.upsell-drawer-designer-span");r&&(r.textContent=e.vendor||"");const d=document.querySelector(".upsell-drawer-product-description");if(d){const o=d.querySelector("#see-full-product");if(o){const w=d.querySelector(".js-upsell-description");
1w&&w.remove();const f=document.createElement("div");f.className="js-upsell-description",f.innerHTML=e.description||"",d.insertBefore(f,o),o.setAttribute("href","/products/"+e.handle)}}const i=document.getElementById("upsell-drawer-title-link");i&&e.handle&&i.setAttribute("href","/products/"+e.handle);const p=document.querySelector("#upsell-drawer-add-to-cart span");p&&(p.textContent=g(e.price,n));const h=document.getElementById("upsell-drawer-add-to-cart");if(h)if(e.variants&&e.variants.length>0){const o=e.variants[0].id;h.setAttribute("data-product-id",o),h.style.display="flex"}else h.setAttribute("data-product-id",""),h.style.display="none";const y=S.has(e.handle);A(e,S.get(e.handle)??{}),E(e,n),x(e,n,y)}function A(e,n){const t=document.querySelector(".upsell-drawer-material-selects");if(!t||!e.options)return;t.innerHTML="";const a=document.createElement("template");a.innerHTML=`
2    <div class="upsell-drawer-material-selects-switch tw-font-secondary tw-mr-16">
3      <p class="tw-mb-3">
4        <span class="option-name"></span>:<span class="seleceted-option-value tw-font-normal tw-font-primary tw-leading-normal"></span>
5      </p>
6      <div class="upsell-drawer-material-selects-options tw-flex tw-flex-wrap"></div>
7    </div>
8  `,e.options.forEach(c=>{const u=a.content.cloneNode(!0);u.querySelector(".option-name").textContent=c.name;const m=u.querySelector(".upsell-drawer-material-selects-options");c.values.forEach(s=>{const l=n[s];if(l){const r=document.createElement("img");r.className="tw-object-fill tw-cursor-pointer tw-border-0 tw-border-transparent tw-p-0 tw-transition-colors tw-duration-200 tw-ease-in-out tw-mr-3 tw-mb-3",r.alt=s,r.setAttribute("data-option-value-name",s),r.src=l,m.appendChild(r)}else{const r=document.createElement("label");r.textContent=s,r.setAttribute("data-option-value-name",s),r.setAttribute("class","tw-mr-3 tw-mb-3 tw-text-sm tw-text-center tw-cursor-pointer"),m.appendChild(r)}}),t.appendChild(u)})}async function x(e,n,t){try{const a=await fetch(`${window.location.origin}/products/${e.handle}`);if(!a.ok)return;const c=new DOMParser().parseFromString(await a.text(),"text/html");if(!S.has(e.handle)){const l={};c.querySelectorAll(".variant__color-swatch-label[data-tooltip]").forEach(r=>{const d=r.getAttribute("data-tooltip"),i=(r.getAttribute("style")||"").match(/url\(['"]?([^'"?]+)/);d&&i&&(l[d]=i[1])}),S.set(e.handle,l)}const u=c.querySelector("stock-status"),m=document.querySelector(".upsell-drawer-delivery");u&&m&&(m.innerHTML=u.innerHTML);const s=S.get(e.handle)??{};if(!t&&Object.keys(s).length){const l=[];document.querySelectorAll(".upsell-drawer-material-selects-switch").forEach(r=>{const d=r.querySelector(".seleceted-option-value")?.textContent.trim();d&&l.push(d)}),A(e,s),E(e,n,l)}}catch{}}const C=[".close-btn","a[href]","button:not([disabled])",'input:not([disabled]):not([type="hidden"])',"select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");function H(){const e=document.querySelector(".drawer-upsell");if(!e)return;e.classList.add("active"),e.setAttribute("aria-hidden","false"),document.documentElement.style.overflow="hidden";let n=!1;const t=()=>{n||(n=!0,e.removeEventListener("transitionend",a),e.querySelector(C)?.focus())},a=c=>{c.target!==e&&!c.target.classList.contains("drawer__inner")||t()};e.addEventListener("transitionend",a),setTimeout(t,400)}document.addEventListener("click",e=>{const n=e.target.closest(".upsell-add-item-to-cart");if(!n||(e.preventDefault(),n.disabled))return;n.disabled=!0;const t=n.getAttribute("data-product-id");if(!t){n.disabled=!1,document.getElementById("upsell-drawer")?.classList.remove("active");return}(async()=>{try{const a=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({id:Number.parseInt(t,10),quantity:1})});if(!a.ok){const c=await a.json();throw new Error(`Error adding product: ${c.description||a.statusText}`)}await a.json(),await k(),await L()}catch(a){console.error("Error:",a)}finally{n.disabled=!1,document.getElementById("upsell-drawer")?.classList.remove("active")}})()});async function k(){try{const e=await fetch(`/?section_id=cart-drawer&timestamp=${Date.now()}`,{headers:{Accept:"text/html","Cache-Control":"no-cache"}});if(!e.ok)throw new Error(`Sections fetch error: ${e.status}`);const n=await e.text(),t=document.querySelector("cart-drawer");if(!t)return;const a=document.createElement("div");a.innerHTML=n;const c=a.querySelector("cart-drawer");if(!c)return;
8t.innerHTML=c.innerHTML,Array.from(c.attributes).forEach(u=>{u.name!=="id"&&t.setAttribute(u.name,u.value)}),typeof t.open=="function"?t.open():(t.classList.add("active"),t.setAttribute("open","")),await L()}catch{await M()}}async function M(){try{const e=await fetch(`/?sections=cart-drawer,cart-icon-bubble&timestamp=${Date.now()}`,{headers:{Accept:"application/json","Cache-Control":"no-cache"}});if(!e.ok)throw new Error(`Fallback fetch error: ${e.status}`);const n=await e.json();if(n["cart-drawer"]){const t=document.querySelector("cart-drawer");t&&(t.innerHTML=n["cart-drawer"],typeof t.open=="function"?t.open():(t.classList.add("active"),t.setAttribute("open","")))}if(n["cart-icon-bubble"]){const t=document.getElementById("cart-icon-bubble"),a=t&&t.querySelector("[data-cart-count-bubble]");if(a){const c=new DOMParser().parseFromString(n["cart-icon-bubble"],"text/html").querySelector("[data-cart-count-bubble]");c&&(a.innerHTML=c.innerHTML)}}}catch{const e=document.querySelector("cart-drawer");e&&(typeof e.open=="function"?e.open():(e.classList.add("active"),e.setAttribute("open","")))}}async function L(){try{await new Promise(n=>setTimeout(n,300));const e=await fetch("/cart.js?"+Date.now());if(e.ok){const n=await e.json(),t=document.getElementById("cart-icon-bubble");if(t){let a=t.querySelector("div > span[aria-hidden]");n.item_count>0?(a||(a=document.createElement("div"),a.className="max-[990px]:tw-self-end",t.appendChild(a)),a.innerHTML=`<span aria-hidden="true">(${n.item_count})</span><span class="visually-hidden">(${n.item_count} items)</span>`):a&&a.remove()}}}catch(e){console.error("Error updating cart count:",e)}}export{H as o,D as p};
9//# sourceMappingURL=/cdn/shop/t/33/assets/novicell_upsell-shared-1790860190.js.map

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.