whatmore-react-assets 1.0.1926 → 1.0.1928

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whatmore-react-assets",
3
- "version": "1.0.1926",
3
+ "version": "1.0.1928",
4
4
  "description": "public repo for all whatmore js and css assets",
5
5
  "main": "whatmore.js",
6
6
  "scripts": {
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkwhatmorelive_react=self.webpackChunkwhatmorelive_react||[]).push([[5866],{1518:function(t,e,o){o.r(e),o.d(e,{fireNeoAtcClick:function(){return n.fireNeoAtcClick},fireNeoBuyNowMetric:function(){return n.fireNeoBuyNowMetric},fireNeoOutsideAtcFunnel:function(){return n.fireNeoOutsideAtcFunnel},fireNeoProductClick:function(){return n.fireNeoProductClick},neoAddAllToCart:function(){return l},neoAddToCart:function(){return u}});var n=o(3297),r=o(5118),i=o(4563),a=o(5443),c=o(2567);function d(t){return(0,a.hG)(t,"brand_metadata->domain_context")}async function s(t,e,o){const{product:d,event:s,customizations:u,widget:l,userType:p,closeClickComponent:m,onState:h}=t,f=(0,c.Ry)(),y=(0,r.getVariantIdFromSelectedOption)(o,e);if(!y)return h&&h("init"),{status:"noop"};h&&h("atcApiCallInProgress");try{const t="55586586685"===f&&"function"===typeof m;await(0,i.initiateNeoCartSliderEvent)(f,t?m:()=>{},t?400:100,window.location.hostname,y,d.client_product_id,l,s&&s.location,p,d.product_link),(0,n.fireNeoAtcMetric)(s,d,1),(0,a.hG)(u,"product_config->navigate_to_cart_page")&&setTimeout(()=>{window.location.href=`${window.Shopify&&window.Shopify.routes&&window.Shopify.routes.root||"/"}cart`},500);const e=o.filter(t=>t&&"Default Title"!==t).join(" \xb7 ");return h&&h("added",e),{status:"added",variantId:y,variantLabel:e}}catch(w){return h&&h("errored"),console.error("Whatmore :: neo ATC add failed",w),{status:"errored"}}}async function u(t){const{product:e,event:o,customizations:n,mode:i="direct",selectedOptions:a,variants:u,onState:l}=t;if(!e||!o)return{status:"noop"};const p=(0,c.Ry)();if(a&&u)return s(t,u,a);let m;l&&l("productVariantDetailsApiCallInProgress");try{m=await(0,r.productDetailsDetailed)(e,d(n),p)}catch(y){return l&&l("errored"),{status:"errored"}}const h=m&&m.variants||[],f=(0,r.getVariantOptions)(m);if((0,r.isSingleVariantProduct)(f)||"direct"===i){if(!(0,r.atleastOneVariantAvailableInStock)(h))return l&&l("errored"),{status:"errored"};return s(t,h,[(0,r.getFirstAvailableOption)(f[0]),(0,r.getFirstAvailableOption)(f[1]),(0,r.getFirstAvailableOption)(f[2])])}return l&&l("awaitingVariantSelection"),{status:"needs_selection",variantOptions:f,variants:h}}async function l(t){const{products:e,event:o,customizations:a,widget:s,userType:u,onState:l}=t;if(!e||0===e.length||!o)return{status:"noop",added:0};const p=(0,c.Ry)();l&&l("productVariantDetailsApiCallInProgress");const m=(await Promise.all(e.map(async t=>{try{const e=await(0,r.productDetailsDetailed)(t,d(a),p),o=e&&e.variants||[],n=(0,r.getVariantOptions)(e);if(!(0,r.isSingleVariantProduct)(n))return null;if(!(0,r.atleastOneVariantAvailableInStock)(o))return null;const i=(0,r.getVariantIdFromSelectedOption)([(0,r.getFirstAvailableOption)(n[0]),(0,r.getFirstAvailableOption)(n[1]),(0,r.getFirstAvailableOption)(n[2])],o);return i?{product:t,variantId:i}:null}catch(e){return null}}))).filter(Boolean);if(0===m.length)return l&&l("init"),{status:"noop",added:0};l&&l("atcApiCallInProgress");try{const t=m.slice(0,-1),e=m[m.length-1];if(t.length){if(!await(0,i.addVariantsBatch)(t.map(t=>t.variantId),1))for(const{product:e,variantId:n}of t)await(0,i.initiateNeoCartSliderEvent)(p,()=>{},100,window.location.hostname,n,e.client_product_id,s,o&&o.location,u,e.product_link)}return await(0,i.initiateNeoCartSliderEvent)(p,()=>{},100,window.location.hostname,e.variantId,e.product.client_product_id,s,o&&o.location,u,e.product.product_link),m.forEach(({product:t})=>(0,n.fireNeoAtcMetric)(o,t,1)),l&&l("added"),{status:"added",added:m.length}}catch(h){return l&&l("errored"),console.error("Whatmore :: neo bulk ATC failed",h),{status:"errored",added:0}}}},3297:function(t,e,o){o.r(e),o.d(e,{fireNeoAtcClick:function(){return m},fireNeoAtcMetric:function(){return w},fireNeoBuyNowMetric:function(){return y},fireNeoOutsideAtcFunnel:function(){return h},fireNeoProductClick:function(){return f}});var n=o(6694),r=o(9383),i=o(5443),a=o(2567),c=o(1637),d=o(7156);const s=["56352899156"];function u(t){if(t)return t.startsWith("index")?"home":t.startsWith("product")?"product_page":t.startsWith("collection")||t.startsWith("page")?"collection_page":void 0}const l={[d.O.EVENT_VIEW]:{gate:"meta_pixel_events->video_click_event",action:"whatmore_video_click_event",custom:"video_clicked"},[d.O.PRODUCT_TILE_SHOPNOW_CLICKED]:{gate:"meta_pixel_events->video_product_tile_click_event",action:"whatmore_product_tile_click_event",custom:"video_product_tile_clicked"}};function p(t,e,o,n,r){const c=l[t];if(c){if("function"===typeof fbq){var d;const t=!!(0,i.hG)(n,c.gate),r=null===o||void 0===o||null===(d=o.meta_actions)||void 0===d?void 0:d[c.custom];if(t||r){const t={id:null===e||void 0===e?void 0:e.client_product_id,product_url:null===e||void 0===e?void 0:e.product_link};fbq("trackCustom",c.action,t),r&&setTimeout(()=>{r.forEach(e=>fbq("trackCustom",e,t))},500)}}var p,m,h;if(s.includes((0,a.Ry)())&&"object"===typeof window.dataLayer)window.dataLayer.push({event:"video_interaction",page_type:null!==(p=u(null===r||void 0===r?void 0:r.landingLocationType))&&void 0!==p?p:"NA",selection_type:c.action,video_name:null!==(m=null===o||void 0===o?void 0:o.event_id)&&void 0!==m?m:"NA",video_percentage:"NA",product_name:null!==(h=null===e||void 0===e?void 0:e.title)&&void 0!==h?h:"NA"})}}function m({event:t,productList:e,ctaList:o=[],customizations:r,widgetSourceDetails:c,interactionType:l}){var p;if(!t||!e||0===e.length)return;const m=(0,a.Ry)();(0,n.trackWhatmoreAnalyticsEvent)({userInteractionType:l||d.O.PRODUCT_TILE_ATC_CLICKED,widgetSourceDetails:c,event:t,productList:e,ctaList:o}),function(t,e,o){var n;if("function"!==typeof fbq)return;const r=!!(0,i.hG)(o,"meta_pixel_events->video_atc_event"),a=null===e||void 0===e||null===(n=e.meta_actions)||void 0===n?void 0:n.video_atc_clicked;if(!r&&!a)return;const c={id:null===t||void 0===t?void 0:t.client_product_id,product_url:null===t||void 0===t?void 0:t.product_link};fbq("trackCustom","whatmore_video_atc_event",c),a&&setTimeout(()=>{a.forEach(t=>fbq("trackCustom",t,c))},500)}(null!==(p=e[1])&&void 0!==p?p:e[0],t,r),function(t,e,o,n){var r,i,a,c,d,l;s.includes(t)&&"object"===typeof window.dataLayer&&window.dataLayer.push({event:"video_interaction",page_type:null!==(r=u(null===e||void 0===e?void 0:e.landingLocationType))&&void 0!==r?r:"NA",selection_type:"whatmore_video_atc_event",video_name:null!==(i=null===o||void 0===o?void 0:o.event_id)&&void 0!==i?i:"NA",video_percentage:"NA",product_name:null!==(a=null!==(c=null===n||void 0===n||null===(d=n[1])||void 0===d?void 0:d.title)&&void 0!==c?c:null===n||void 0===n||null===(l=n[0])||void 0===l?void 0:l.title)&&void 0!==a?a:"NA"})}(m,c,t,e)}function h({event:t,product:e,customizations:o,widgetSourceDetails:i}){var a,c;if(!t)return;(0,r.increaseViewCount)(t);const s=e?[e]:null!==(a=t.products)&&void 0!==a?a:[];(0,n.trackWhatmoreAnalyticsEvent)({userInteractionType:d.O.EVENT_VIEW,widgetSourceDetails:i,event:t,productList:s,ctaList:t.cta}),p(d.O.EVENT_VIEW,null!==(c=s[1])&&void 0!==c?c:s[0],t,o,i),(0,n.trackWhatmoreAnalyticsEvent)({userInteractionType:d.O.PRODUCT_CTA_VIEW,widgetSourceDetails:i,event:t,productList:s,ctaList:t.cta})}function f({event:t,product:e,kind:o,customizations:r,widgetSourceDetails:i}){if(!t||!e)return;const a="thumbnail"===o?d.O.VIDEO_TILE_PRODUCT_THUMBNAIL_CLICKED:d.O.PRODUCT_TILE_SHOPNOW_CLICKED;(0,n.trackWhatmoreAnalyticsEvent)({userInteractionType:a,widgetSourceDetails:i,event:t,productList:[e],ctaList:t.cta}),p(a,e,t,r,i)}function y(t,e){t&&e&&((0,a.U)()||(0,a.Ry)()===c.YZ||(0,r.increaseEventProductBuyNowCount)(t,e))}function w(t,e,o=1){t&&e&&((0,a.U)()||(0,a.Ry)()===c.YZ||(0,r.increaseEventProductAddToCartCount)(t,e,o))}},4563:function(t,e,o){o.r(e),o.d(e,{addVariantsBatch:function(){return s},getCartDetailsShopifyAsync:function(){return c},initiateNeoCartSliderEvent:function(){return f},openNeoCartDrawer:function(){return h},removeOneFromNeoCart:function(){return l},updateCartLineItemPropertiesDirect:function(){return d}});var n=o(5566),r=o(6080),i=o(2567),a=o(5443);async function c(){const t="https://"+window.location.hostname+"/cart.json";return await fetch(t,{method:"GET"})}async function d(t,e,o,c,d="default",s,u,l,p){const m=(0,i.Ry)(),h=u?(0,n.wm)()+("72201044272"==m?`#${c}#${d}#${s?"olduser":"newuser"}:direct`:`#${c}:direct`):p?"_wt_vs":l?"_wt_vi":"";if(""==h||"_wt_vs"==h||"_wt_vi"==h||"77604192550"==m||"64157352183"==m||"80856187185"==m||"86486974743"==m||"62758289602"==m||"65972830359"==m||"75310563627"==m||"86968402213"==m||(0,a.hG)((0,a.VA)(),"order_tracking->track_using_wtot"))return;let f={id:t,quantity:e,properties:{...h?{[r.B_]:h}:{},...o}};return await fetch("https://"+window.location.hostname+"/cart/change.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)}).then(t=>t.json()).catch(t=>{console.error("Whatmore :: Error while updating cart line item properties direct.",t)})}async function s(t,e=1){if(!t||0===t.length)return!0;try{return(await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:t.map(t=>({id:t,quantity:e}))})})).ok}catch(o){return!1}}async function u(t,e,o){const n=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[{id:t,quantity:e}]})});return n.ok?(setTimeout(()=>{o(t)},500),setTimeout(()=>{var t,e;window.location.href=`${(null===(t=window.Shopify)||void 0===t||null===(e=t.routes)||void 0===e?void 0:e.root)||"/"}cart`},1e3),!0):(console.error("[ATC Fallback] Add to cart failed:",n.status),!1)}async function l(t){if(!t)return null;try{const o=await c().then(t=>t.ok?t.json():null),n=o&&Array.isArray(o.items)&&o.items.find(e=>String(e.id)===String(t));if(!n)return null;const r=Math.max(0,(n.quantity||0)-1);if(!(await fetch("/cart/change.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({id:n.key,quantity:r})})).ok)return null;try{window.Rebuy&&window.Rebuy.Cart&&window.Rebuy.Cart.fetchCart()}catch(e){}return document.dispatchEvent(new CustomEvent("cart:refresh",{bubbles:!0})),r}catch(o){return console.error("[Whatmore] neo cart decrement failed:",o),null}}function p(){const t=document.querySelectorAll("[data-minicart-input]");for(let e=0;e<t.length;e++){const o=t[e],n=o.id&&document.querySelector('label.minicart__label[for="'+o.id+'"]');if(n&&n.clientHeight>0&&n.clientWidth>0)return o.checked=!0,!0}return!!t.length&&(t[0].checked=!0,!0)}function m(t){const e=window.gsCartDrawerCore||window.gsCartDrawerManager;return!!e&&(t&&t.length?(window.dispatchEvent(new CustomEvent("cart_changed_gs",{detail:{added:t}})),!0):"function"===typeof e.open&&(e.open(),!0))}async function h(t){const e=window.Rebuy&&window.Rebuy.SmartCart;if(e&&"function"===typeof e.show&&("ready"===e.status||e.hasBoundEvents||document.querySelector("#rebuy-cart"))){try{window.Rebuy.Cart&&window.Rebuy.Cart.fetchCart()}catch(n){}return e.show(),!0}if(m(null))return!0;const o=["[data-cart-open]",'[data-drawer-open="cart"]','[data-action="open-drawer"][data-drawer="cart"]','[data-action="open-drawer"][data-drawer-id="sidebar-cart"]',".js-drawer-open-cart",'a[href$="/cart"]:not([disable-rebuy]):not(.disable-rebuy)'];for(let r=0;r<o.length;r++){const t=document.querySelectorAll(o[r]);for(let e=0;e<t.length;e++)if(!t[e].closest('#CartDrawer, #sidebar-cart, cart-drawer, .gs_cart_drawer, .minicart__holder, .Drawer, .cart-drawer, [data-section-type="cart"]'))return t[e].click(),!0}return!!p()}async function f(t,e,o,s,l="",h="",f="",y="",w="",v="",T=null){(0,i.yI)();const b=t=>{c().then(t=>t.json()).then(e=>{const o=e.items.find(e=>e.id==t);if(!o)return;d(o.key,o.quantity,o.properties,f,y,w,!0,!0,!0)}).catch(t=>{console.error("[Whatmore] updateATCLineItemProperties error:",t)})};if("STRNV8MHJTF"==t||"STR6HU283UZ"==t||"STR9T3LLEJB"==t||"STRWJMIOJNX"==t||"STRUDQ36YAC"==t||"STR1D5ONOZX"==t){console.log("Executing cart refresh script..");return void(document.getElementById("whatsmorecart").value=Math.random())}if("38678331531"===t){const q="In stock \u2014 ship now";async function k(t,e=1){const o=[...document.querySelectorAll('form[action*="/cart/add"]')].find(e=>{var o;return String(null===(o=e.querySelector('[name="id"]'))||void 0===o?void 0:o.value)===String(t)});if(o)return o.requestSubmit(o.querySelector('[type="submit"]')),setTimeout(()=>b(t),1500),!0;const n=await fetch("/cart/add.js?app=upez",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({items:[{id:t,quantity:e,properties:{Fulfilment:q}}]}),_isAddon:!0});if(!n.ok)return console.error("[ATC] Add to cart failed:",n.status),!1;const r=document.querySelector("[data-upez-cart]");return r?r.click():window.location.href="/cart",setTimeout(()=>b(t),500),!0}return void k(l,1).then(()=>{setTimeout(e,o)}).catch(t=>{console.error("[Whatmore] ATC 38678331531 error:",t)})}if("75026858234"===t){try{const N=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[{id:l,quantity:1}]})}),P=await N.json();N.ok?setTimeout(()=>{b(l),window.location.href="/cart"},500):console.error("[Whatmore] ATC 75026858234 failed:",P)}catch(E){console.error("[Whatmore] ATC 75026858234 error:",E)}return void setTimeout(e,o)}if("52398751922"===t||"52429881512"===t){async function W(){var t;const e=window.jQuery;if(!e||!v||"function"!==typeof(null===(t=window.theme)||void 0===t?void 0:t.initAjaxAddToCartForm))return u(l,1,b);const o=await(await fetch(v.split(/[?#]/)[0]+".js")).json();if(!document.querySelector(".ProductJson-"+o.id)){o.options=o.options.map(t=>t.name||t);const t=document.createElement("script");t.type="application/json",t.className="ProductJson-"+o.id,t.textContent=JSON.stringify(o),document.body.appendChild(t)}const n=document.createElement("div");n.style.display="none",n.innerHTML='<form class="ajax-product-form" action="/cart/add" method="post"><input type="hidden" name="id" value="'+l+'"><input type="hidden" name="quantity" value="1"><button type="submit"></button></form>',document.body.appendChild(n);const r=e(n.firstChild);return new Promise(t=>{r.one("cc:addToCart:success cc:addToCart:error",e=>{n.remove();const o="cc:addToCart:success"===e.type;o&&setTimeout(()=>b(l),500),t(o)}),window.theme.initAjaxAddToCartForm(r),r.trigger("submit")})}return void W().then(()=>{setTimeout(e,o)}).catch(t=>{console.error("[Whatmore] ATC Unze error:",t)})}if("65606910124"===t){async function L(t,e=1){const o=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[{id:t,quantity:e}]})});if(!o.ok)return console.error("[ATC] Add to cart failed:",o.status),!1;document.dispatchEvent(new CustomEvent("cart:build"));const n=document.querySelector("cart-drawer");if(!n)return window.location.href="/cart",!0;const r=await(await fetch("/?section_id=cart-drawer")).text(),i=(new DOMParser).parseFromString(r,"text/html");return n.innerHTML=i.querySelector("cart-drawer").innerHTML,n.classList.remove("is-empty"),n.open(),setTimeout(()=>b(t),500),!0}return void L(l,1).then(()=>{setTimeout(e,o)}).catch(t=>{console.error("[Whatmore] ATC 65606910124 error:",t)})}if("17994587"===t||"68660855106"===t){async function J(t,e=1){const o=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-Requested-With":"XMLHttpRequest"},body:JSON.stringify({items:[{id:t,quantity:e}]})});if(!o.ok)return console.error("[ATC] Add to cart failed:",o.status),!1;document.dispatchEvent(new CustomEvent("cart:build"));const n=document.querySelector("cart-drawer");return n&&"function"===typeof n.open?n.open():document.dispatchEvent(new CustomEvent("cart:open")),setTimeout(()=>b(t),500),!0}return void J(l,1).then(()=>{setTimeout(e,o)}).catch(t=>{console.error("[Whatmore] ATC 17994587/68660855106 error:",t)})}if("57217876118"===t){async function R(t,e=1){const o=new FormData;o.append("id",t),o.append("quantity",e),o.append("sections","side-cart");const n=await fetch("/cart/add.js",{method:"POST",body:o,headers:{"X-Requested-With":"XMLHttpRequest",Accept:"application/javascript"}}).then(t=>t.json());n.status?console.error("atc failed",n.description):(window.ajaxCart.load(n),setTimeout(()=>{b(t)},500))}return void R(l,1).then(()=>{setTimeout(e,o)}).catch(t=>{console.error("[Whatmore] ATC 57217876118 error:",t)})}if("75310563627"===t||"72235450550"===t){async function D(t,e=1){const o=new FormData;o.append("id",t),o.append("quantity",e),o.append("sections","cart-drawer,cart-icon-bubble");const n=await fetch("/cart/add.js",{method:"POST",body:o,headers:{Accept:"application/javascript"}}).then(t=>t.json());if(n.status)return void console.error("atc failed",n.description);const r=document.querySelector("cart-drawer");r&&(r.renderContents(n),r.classList.remove("is-empty"),r.open())}return D(l,1).then(()=>{setTimeout(()=>{b(l)},500)}).catch(e=>{console.error(`[Whatmore] ATC ${t} error:`,e)}),void setTimeout(e,o)}if("81308287252"===t)return(async()=>{const t={};(0,a.hG)((0,a.VA)(),"order_tracking->track_using_wtot")||(t[r.B_]=`${(0,n.wm)()}#${f}:direct`);const e=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({id:Number(l),quantity:1,properties:t})}).then(t=>t.json()).catch(()=>null);e&&!e.status?setTimeout(()=>{const t=document.querySelector(".iCartBtnToggle")||document.querySelector("#iCartBtnToggle");t?t.click():console.warn("[Whatmore] iCart toggle not found for 81308287252")},250):console.error("[Whatmore] ATC 81308287252 failed:",e&&e.description)})(),void setTimeout(e,o);if("67841720509"===t){async function I(t,e=1){const o=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({id:Number(t),quantity:e})});o.ok?(document.dispatchEvent(new CustomEvent("on:cart:change",{bubbles:!0,cancelable:!1})),document.dispatchEvent(new CustomEvent("dispatch:cart-drawer:refresh",{bubbles:!0}))):console.error("[Whatmore] ATC 67841720509 failed:",await o.text())}return I(l,1).then(()=>{setTimeout(()=>{b(l)},500)}).catch(t=>{console.error("[Whatmore] ATC 67841720509 error:",t)}),void setTimeout(e,o)}if("72603631788"===t||"5220302897"===t){const M=new FormData;M.append("id",l),M.append("quantity","1"),T&&M.append("properties[Size]",T);try{const V=await fetch("/cart/add.js",{method:"POST",body:M}),x=await V.json();x.id?setTimeout(()=>{b(l),window.location.href="/cart"},500):console.error("Afrozeh ATC failed:",x)}catch(E){console.error("Afrozeh ATC error:",E)}return void setTimeout(e,o)}if("67083239728"===t){try{const F=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[{id:l,quantity:1}]})});F.ok||console.error("[ATC] Add to cart failed:",F.status)}catch(E){console.error("[ATC] Error while adding to cart:",E)}return setTimeout(()=>{b(l)},1e3),void setTimeout(e,o)}if("61442818186"===t){async function G(t,e=1){const o=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[{id:t,quantity:e}]})});if(!o.ok)return void console.error("[ATC] Add to cart failed:",o.status);document.dispatchEvent(new CustomEvent("cart:build"));const n=document.querySelector(".js-drawer-open-cart");n&&n.click()}return G(l,1).then(()=>{setTimeout(()=>{b(l)},500)}).catch(t=>{console.error("[Whatmore] ATC 61442818186 error:",t)}),void setTimeout(e,o)}if("9311420495"===t){async function B(t){const e=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({items:[{id:Number(t),quantity:1}]})}),o=await e.json();if(!e.ok||o.status)return console.error("[Whatmore] ATC 9311420495 failed:",o);document.dispatchEvent(new CustomEvent("ajaxProduct:added",{detail:{product:o}})),setTimeout(()=>b(t),500)}return B(l).catch(t=>{console.error("[Whatmore] ATC 9311420495 error:",t)}),void setTimeout(e,o)}if("56352899156"===t){async function U(t,e=1){const o=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({items:[{id:t,quantity:e}]})}),n=await o.json();if(!o.ok)throw new Error(n.description||n.message||"Could not add to cart");document.dispatchEvent(new CustomEvent("theme:cart:refresh",{bubbles:!0}));const r=Array.prototype.slice.call(document.querySelectorAll("[data-cart-drawer-toggle]")),i=r.filter(t=>null!==t.offsetParent)[0]||r[0];i?i.click():window.location.href="/cart",setTimeout(()=>b(t),500)}return U(l,1).catch(t=>{console.error("[Whatmore] ATC 56352899156 error:",t)}),void setTimeout(e,o)}if("68833706274"===t){async function H(t,e=1){const o=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({items:[{id:t,quantity:e}],sections:"cart-bubble"})}),n=await o.json();if(!o.ok)throw new Error(n.description||n.message||"Could not add to cart");const r=document.getElementById("cart-drawer-toggle");if(!r||!document.getElementById("Cart-Drawer")||"function"!==typeof window.drawerUpateCustom)return void(window.location.href="/cart");await window.drawerUpateCustom();const i=n.sections&&n.sections["cart-bubble"],a=r.querySelector(".thb-item-count"),c=i&&(new DOMParser).parseFromString(i,"text/html").querySelector(".thb-item-count");a&&c&&(a.innerHTML=c.innerHTML),r.click(),setTimeout(()=>b(t),500)}return H(l,1).catch(t=>{console.error("[Whatmore] ATC 68833706274 error:",t)}),void setTimeout(e,o)}if("62226792677"===t){async function X(t,e=1){const o=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[{id:t,quantity:e}]})});var n;o.ok?("function"===typeof(null===(n=window.cleverSopify)||void 0===n?void 0:n.onCartUpdate)&&window.cleverSopify.onCartUpdate(1,1,h),setTimeout(()=>{b(t)},500)):console.error("[ATC] Add to cart failed:",o.status)}return X(l).catch(t=>{console.error("[Whatmore] Error:",t)}),void setTimeout(e,o)}if("64655163636"===t){async function Q(t,e=1){const o=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},body:JSON.stringify({items:[{id:t,quantity:e}]})});return o.ok?(setTimeout(()=>b(t),500),document.getElementById("CartDrawer")?document.dispatchEvent(new CustomEvent("ajaxProduct:added")):setTimeout(()=>{window.location.href="/cart"},500),!0):(console.error("[Whatmore] ATC 64655163636 failed:",o.status),!1)}return Q(l,1).catch(t=>{console.error("[Whatmore] ATC 64655163636 error:",t)}),void setTimeout(e,o)}if("3065315386"===t){async function z(t,e=1){const o=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},body:JSON.stringify({items:[{id:t,quantity:e}]})});return o.ok?(setTimeout(()=>b(t),500),m([{id:t,quantity:e}])||setTimeout(()=>{window.location.href="/cart"},500),!0):(console.error("[Whatmore] ATC 3065315386 failed:",o.status),!1)}return z(l,1).catch(t=>{console.error("[Whatmore] ATC 3065315386 error:",t)}),void setTimeout(e,o)}if("78393540856"===t){async function K(t,e=1){const o=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},body:JSON.stringify({items:[{id:t,quantity:e}]})});return o.ok?(setTimeout(()=>b(t),500),p()||setTimeout(()=>{window.location.href="/cart"},500),!0):(console.error("[Whatmore] ATC 78393540856 failed:",o.status),!1)}return K(l,1).catch(t=>{console.error("[Whatmore] ATC 78393540856 error:",t)}),void setTimeout(e,o)}if("9407168559"===t){async function Z(t,e=1){var o,n;document.dispatchEvent(new CustomEvent("theme:loading:start"));const r=await fetch(`${(null===(o=window.routes)||void 0===o?void 0:o.cartAddUrl)||"/cart/add"}.js`,{method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},body:JSON.stringify({items:[{id:t,quantity:e}]})});return r.ok?(setTimeout(()=>b(t),500),"page"===(null===(n=window.theme)||void 0===n?void 0:n.cartType)?(setTimeout(()=>{var t;window.location.href=(null===(t=window.routes)||void 0===t?void 0:t.cartUrl)||"/cart"},500),!0):(document.documentElement.dispatchEvent(new CustomEvent("product:added",{bubbles:!0,detail:{quantity:e,productAdded:!0,button:null}})),!0)):(document.dispatchEvent(new CustomEvent("theme:loading:end")),console.error("[Whatmore] ATC 9407168559 failed:",r.status),!1)}return Z(l,1).catch(t=>{console.error("[Whatmore] ATC 9407168559 error:",t)}),void setTimeout(e,o)}if("60595503283"===t){async function Y(t,e=1){const o=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"},body:JSON.stringify({items:[{id:t,quantity:e}]})});if(!o.ok)return console.error("[Whatmore] ATC 60595503283 failed:",o.status),!1;setTimeout(()=>b(t),500);return document.querySelector('#sidebar-cart[data-section-type="cart"]')?(document.dispatchEvent(new CustomEvent("product:added",{bubbles:!0,detail:{quantity:e}})),!0):(setTimeout(()=>{window.location.href="/cart"},500),!0)}return Y(l,1).catch(t=>{console.error("[Whatmore] ATC 60595503283 error:",t)}),void setTimeout(e,o)}if("47682683045"===t){async function tt(t,e=1){const o=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[{id:t,quantity:e}]})});return o.ok?(b(t),setTimeout(()=>{document.getElementById("CartDrawer")&&!document.body.classList.contains("template-cart")?document.dispatchEvent(new CustomEvent("ajaxProduct:added")):window.location.href="/cart"},1500),!0):(console.error("[ATC] Add to cart failed:",o.status),!1)}return tt(l,1).catch(t=>{console.error("[Whatmore] ATC 47682683045 error:",t)}),void setTimeout(e,o)}if("64188973306"===t||"74394796311"===t){async function et(t,e=1){const o=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[{id:t,quantity:e}]})});return o.ok?(b(t),setTimeout(async()=>{const t=document.querySelector("cart-drawer-component");if(!t)return void(window.location.href="/cart");const e=await(await fetch("/cart.js")).json();document.dispatchEvent(new CustomEvent("cart:update",{bubbles:!0,detail:{resource:e,sourceId:"whatmore",data:{itemCount:e.item_count,source:"whatmore"}}})),"function"===typeof t.open&&t.open()},1500),!0):(console.error("[ATC] Add to cart failed:",o.status),!1)}return et(l,1).catch(t=>{console.error("[Whatmore] ATC 64188973306 error:",t)}),void setTimeout(e,o)}if("55586586685"===t){async function ot(t,e=1){const o=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[{id:t,quantity:e}]})});return o.ok?(b(t),setTimeout(()=>{const t=document.querySelector("cart-drawer");t?(document.dispatchEvent(new CustomEvent("cart:refresh")),t.show()):window.location.href="/cart"},1500),!0):(console.error("[ATC] Add to cart failed:",o.status),!1)}return ot(l,1).catch(t=>{console.error("[Whatmore] ATC 55586586685 error:",t)}),void setTimeout(e,o)}if("72915616066"===t||"84966080805"===t){function nt(){var t,e;const o=window.customElements.get("cart-drawer")&&document.querySelector("cart-drawer");let n=[];const r=new CustomEvent("cart:prepare-bundled-sections",{bubbles:!0,detail:{sections:n}});document.documentElement.dispatchEvent(r);const i=n.length>0,a="string"===typeof(null===(t=window.themeVariables)||void 0===t||null===(e=t.settings)||void 0===e?void 0:e.cartType);return(!a||"page"!==window.themeVariables.settings.cartType)&&(o&&i&&a)}async function rt(t,e){document.documentElement.dispatchEvent(new CustomEvent("theme:loading:start",{bubbles:!0}));let o=[];document.documentElement.dispatchEvent(new CustomEvent("cart:prepare-bundled-sections",{bubbles:!0,detail:{sections:o}}));const n=await fetch(`${window.Shopify.routes.root}cart/add.js`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[{id:t,quantity:e}],sections:o.join(",")})});if(document.documentElement.dispatchEvent(new CustomEvent("theme:loading:end",{bubbles:!0})),!n.ok)return console.error("[ATC] Add to cart failed:",n.status),document.dispatchEvent(new CustomEvent("cart:refresh")),!1;const r=await n.json(),i=await(await fetch(`${window.Shopify.routes.root}cart.js`)).json();return i.sections=r.sections,document.documentElement.dispatchEvent(new CustomEvent("cart:change",{bubbles:!0,detail:{baseEvent:"variant:add",cart:i}})),setTimeout(()=>{b(t)},500),!0}async function it(t,e=1){return nt()?rt(t,e):u(t,e,b)}return it(l).catch(t=>{console.error("[Whatmore] Error:",t)}),void setTimeout(e,o)}if("44061622423"===t){async function at(t,e=1){const o=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[{id:t,quantity:e}]})});o.ok?window.cart&&"function"===typeof window.cart.getCart?(window.cart.getCart(),setTimeout(()=>{b(t)},500)):fetch("/cart?section_id=api-cart-items").then(t=>t.text()).then(e=>{const o=document.createElement("div");if(o.innerHTML=e,window.cart&&"function"===typeof window.cart.build){const t=o.querySelector("[data-api-content]");t&&window.cart.build(t)}document.dispatchEvent(new CustomEvent("theme:product:added",{bubbles:!0})),setTimeout(()=>{b(t)},500)}).catch(()=>{const e=document.querySelector('[href="/cart"], [data-cart-toggle], a[href*="/cart"]');e&&e.click(),setTimeout(()=>{b(t)},500)}):console.error("[ATC] Add to cart failed:",o.status)}return at(l).catch(t=>{console.error("[Whatmore] Error:",t)}),void setTimeout(e,o)}if("60183445561"===t){async function ct(t,e=1,o="/cart"){const n=new URLSearchParams;n.append("id",t),n.append("quantity",e.toString()),n.append("return_to",o);const r=await fetch("https://tapee.in/cart/add",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:n.toString(),credentials:"include"}),i=await r.text();return r.ok&&setTimeout(()=>{b(t),window.location.href="https://tapee.in/cart"},500),i}return ct(l).catch(t=>{console.error("Error:",t)}),void setTimeout(e,o)}if("22907887"===t){async function dt(t,e=1){const o=new FormData;o.append("id",t),o.append("quantity",e.toString());const n=document.querySelector("cart-notification, cart-drawer");if(n){const t=n.getSectionsToRender();o.append("sections",t.map(t=>t.id).join(","))}o.append("sections_url",window.location.pathname);const r=await fetch("/cart/add.js",{method:"POST",body:o});if(!r.ok){const t=await r.text();throw new Error(`Failed to add to cart: ${t}`)}const i=await r.json();return n&&n.renderContents&&n.renderContents(i),document.body.classList.remove("overflow-hidden"),document.querySelectorAll(".atc-container.active, .atc-variant-container.active, .pdp-atc-container.active").forEach(t=>t.classList.remove("active")),window.dispatchEvent(new CustomEvent("cart:added",{detail:{variantId:t,quantity:e,data:i}})),i}return dt(l).then(t=>{setTimeout(()=>{b(l)},500)}).catch(t=>{console.error("Error:",t)}),void setTimeout(e,o)}if("28575536"===t||"64287408360"===t||"8473575520"===t||"65972830359"===t||"75000480020"===t)return fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:l,quantity:1})}).then(t=>{if(!t.ok)throw new Error("Add to cart failed");return t.json()}).then(t=>{"function"===typeof window.handleFloCartBtn&&window.handleFloCartBtn(),setTimeout(()=>{b(l)},500)}).catch(t=>console.error("[Whatmore] Ripped Up Nutrition ATC error:",t)),void setTimeout(e,o);if("58692075703"===t)return fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:l,quantity:1})}).then(t=>{if(!t.ok)throw new Error("Add to cart failed");return t.json()}).then(t=>{"function"===typeof window.openGokwikSideCart&&window.openGokwikSideCart(),setTimeout(()=>{b(l)},500)}).catch(t=>console.error("[Whatmore] Lakshita ATC error:",t)),void setTimeout(e,o);if("22907887"===t)return fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:l,quantity:1})}).then(t=>t.json()).then(t=>{setTimeout(()=>{b(l)},500)}).catch(t=>console.error("Add to cart error:",t)),void setTimeout(e,o);if("58501496967"===t)return(async()=>{const t=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[{id:l,quantity:1}]})});t.ok?(window.ajaxCart&&"function"===typeof window.ajaxCart.load&&window.ajaxCart.load(),window.jQuery&&window.jQuery("body").trigger("drawer.open"),setTimeout(()=>{b(l)},500)):console.error("[Whatmore] ATC 58501496967 failed:",t.status)})().catch(t=>console.error("[Whatmore] ATC 58501496967 error:",t)),void setTimeout(e,o);if("56444977250"===t){const st=document.querySelector('button[data-pf-type="ProductATC2"]');return st?(h&&st.setAttribute("data-product-id",h),st.click(),setTimeout(()=>{c().then(t=>t.json()).then(t=>{const e=t.items.find(t=>String(t.id)===String(l));if(e){d(e.key,e.quantity,e.properties,f,y,w,!0,!0,!0)}})},500),void setTimeout(e,o)):(fetch(null===v||void 0===v||null===(C=v.split("?"))||void 0===C?void 0:C[0]).then(t=>t.text()).then(t=>{const e=(new DOMParser).parseFromString(t,"text/html").querySelector('button[data-pf-type="ProductATC2"]');e&&h&&e.setAttribute("data-product-id",h)}),void setTimeout(e,o));var C}if("64379584700"===t)return fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:l,quantity:1})}).then(t=>t.json()).then(t=>fetch("/cart.js")).then(t=>t.json()).then(t=>{$(".paira-cart-item-count").text(t.item_count),$(".paira-cartEmpty").hide(),$(".paira-cartNotEmpty").show(),$(".paira-cart-total-price .money").text("Rs. "+t.total_price/100),$(".cart-drop").addClass("open"),$(".cart-icon").trigger("mouseenter"),setTimeout(()=>{b(l)},500)}).catch(t=>console.error("Add to cart error:",t)),void setTimeout(e,o);if("66947219508"===t)return fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({items:[{id:Number(l),quantity:1}]})}).then(async()=>{const t=document.getElementById("mini-cart");t&&"function"===typeof t._rerenderCart&&await t._rerenderCart({detail:{openMiniCart:!0}}),setTimeout(()=>{b(l)},500)}).catch(t=>console.error("[Whatmore] ATC 66947219508 error:",t)),void setTimeout(e,o);if("76767920441"===t)return fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:l,quantity:1})}).then(t=>t.json()).then(t=>{"function"===typeof window.openGokwikSideCart&&window.openGokwikSideCart(),setTimeout(()=>{b(l)},500)}).catch(t=>console.error("Add to cart error:",t)),void setTimeout(e,o);if("26767687757"===t)return fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:l,quantity:1})}).then(t=>t.json()).then(t=>{"function"===typeof window.openGokwikSideCart&&window.openGokwikSideCart(),setTimeout(()=>{b(l)},500)}).catch(t=>console.error("[Whatmore] CHOSEN ATC error:",t)),void setTimeout(e,o);if("70840582336"===t){const ut=l,lt=1,pt=document.querySelector('product-form form.product-form, form[action*="/cart/add"]');if(pt){let mt=pt.querySelector('input[name="id"]');mt||(mt=document.createElement("input"),mt.type="hidden",mt.name="id",pt.appendChild(mt)),mt.disabled=!1,mt.value=ut;const ht=pt.querySelector('input[name="quantity"]');ht&&(ht.value=lt);const ft=pt.querySelector('button[data-add-to-cart], button[type="submit"]');return ft?(ft.dispatchEvent(new MouseEvent("pointerdown",{bubbles:!0})),ft.click(),ft.dispatchEvent(new MouseEvent("pointerup",{bubbles:!0}))):console.warn("[ATC] button not found"),setTimeout(()=>{b(ut)},500),void setTimeout(e,o)}return void fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({id:ut,quantity:lt}),credentials:"same-origin"}).then(()=>{setTimeout(()=>{b(ut)},500),setTimeout(e,o)}).catch(t=>{console.error("[ATC] error for 70840582336:",t),setTimeout(e,o)})}if("64683278550"===t){try{const yt=document.querySelector('form[action="/cart/add"]');if(!yt)return console.warn("[ATC 64683278550] form not found"),void setTimeout(e,o);const wt=yt.querySelector('input[name="id"]');if(!wt)return console.warn("[ATC 64683278550] id input not found"),void setTimeout(e,o);wt.value=l;const vt=yt.querySelector('button[type="submit"]');if(!vt)return console.warn("[ATC 64683278550] submit button not found"),void setTimeout(e,o);vt.click(),setTimeout(()=>{b(l)},500),setTimeout(e,o)}catch(O){console.error("[ATC 64683278550] error:",O),setTimeout(e,o)}return}if("95562924310"===t||"61810999367"===t){try{const Tt=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[{id:l,quantity:1}]})});if(Tt.ok){const bt=await Tt.json();document.dispatchEvent(new CustomEvent("cart:update",{detail:{cart:bt}})),document.dispatchEvent(new CustomEvent("theme:cart:refresh",{detail:{target:"product_flood_atc"},bubbles:!0})),setTimeout(()=>{b(l)},500)}else console.error("[ATC 95562924310] Add to cart failed:",Tt.status)}catch(E){console.error("[ATC 95562924310] error:",E)}return void setTimeout(e,o)}if("45050691744"===t)return fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:l,quantity:1})}).then(t=>t.json()).then(t=>{jQuery.ajax({type:"GET",url:"/",dataType:"html",success:function(t){jQuery(".drawer__inner.cart-drawer-content").html(jQuery(t).find(".drawer__inner.cart-drawer-content").html()),jQuery(".custom_doscunt_bar").html(jQuery(t).find(".custom_doscunt_bar").html()),jQuery(".some_js_items").html(jQuery(t).find(".some_js_items").html()),jQuery(".header-cart-icon__count").html(jQuery(t).find(".header-cart-icon__count").html());try{jQuery("#FreeShippingText").slick({dots:!0,autoplay:!0,autoplaySpeed:2500,arrows:!0})}catch(e){}jQuery("div#HeaderCartIcon button").trigger("click"),setTimeout(()=>{b(l)},500)}})}).catch(t=>console.error("Add to cart error:",t)),void setTimeout(e,o);if("55337746621"===t){async function Ct(t,e=1){var o;await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[{id:t,quantity:e}]})});const n=await fetch("/cart.js").then(t=>t.json());document.querySelectorAll("[data-cart-count]").forEach(t=>{const e=t.querySelector(":scope > span:last-of-type");e&&(e.textContent=n.item_count)});const r=document.querySelector("[data-cart-container]");if(!r)return;const i=((null===(o=r.parentElement)||void 0===o?void 0:o.id)||"").replace("shopify-section-","");let a=null;if(i){const t=await fetch(`/?sections=${encodeURIComponent(i)}`).then(t=>t.json()).catch(()=>null);if(null!==t&&void 0!==t&&t[i]){const e=document.createElement("div");e.innerHTML=t[i];const o=e.querySelector("[data-cart-container]");o&&(a=o.innerHTML)}}if(!a){const t=await fetch("/cart").then(t=>t.text()),e=(new DOMParser).parseFromString(t,"text/html").querySelector("[data-cart-container]");e&&(a=e.innerHTML)}if(!a)return;r.innerHTML=a,r.classList.add("is-drawer-open"),document.body.classList.add("is-scroll-disabled");const c=()=>{r.classList.remove("is-drawer-open"),document.body.classList.remove("is-scroll-disabled")};r.querySelectorAll("[data-cart-drawer-toggle]").forEach(t=>{t.addEventListener("click",t=>{t.preventDefault(),c()})}),document.addEventListener("keydown",t=>{"Escape"===t.key&&c()},{once:!0})}return Ct(l,1).then(()=>{setTimeout(()=>{b(l)},500)}).catch(t=>{console.error("[Whatmore] ATC 55337746621 error:",t)}),void setTimeout(e,o)}if("12175954"===t){async function gt(t,e=1){const o=await fetch(theme.routes.cart_add_url,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[{id:t,quantity:e}]})});return o.ok?(document.dispatchEvent(new CustomEvent("theme:cartchanged",{bubbles:!0,cancelable:!1,detail:{openDrawer:!0}})),setTimeout(()=>{b(t)},500),!0):(console.error("[ATC] Add to cart failed:",o.status),!1)}return gt(l).catch(t=>{console.error("[Whatmore] ATC 12175954 error:",t)}),void setTimeout(e,o)}if("2754609263"===t){const St=()=>{const t=["cart:open","CartDrawer:open","drawerOpen"],e=[document,window];try{window.parent&&window.parent!==window&&window.parent.document&&e.push(window.parent.document)}catch(n){}const o=t=>e.forEach(e=>{try{e.dispatchEvent(new CustomEvent(t,{bubbles:!0}))}catch(n){console.error(`[Whatmore] ATC 2754609263 dispatch ${t} failed:`,n)}});["cart:refresh","cart:build","cart:updated"].forEach(o),setTimeout(()=>t.forEach(o),150)};async function _t(t,e=1){var o,n,r;const i=(null===(o=window.Shopify)||void 0===o||null===(n=o.routes)||void 0===n?void 0:n.root)||"/",a={"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest",Accept:"application/javascript"},c=Number(e)||1,d=()=>fetch(`${i}cart/add.js`,{method:"POST",headers:a,body:JSON.stringify({items:[{id:t,quantity:c}]})}).then(t=>t.json()),s=await fetch(`${i}cart.js`,{headers:{Accept:"application/json"},cache:"no-store"}).then(t=>t.json()).catch(()=>null),u=null===s||void 0===s||null===(r=s.items)||void 0===r?void 0:r.find(e=>e.id==t);let l;var p,m;(u?(l=await fetch(`${i}cart/change.js`,{method:"POST",headers:a,body:JSON.stringify({id:u.key,quantity:u.quantity+c})}).then(t=>t.json()).catch(()=>null),l&&!l.status||(console.warn("[Whatmore] ATC 2754609263 change.js rejected, falling back to add.js"),l=await d())):l=await d(),l&&!l.status)?(St(),setTimeout(()=>{b(t)},500)):console.error("[Whatmore] ATC 2754609263 failed:",(null===(p=l)||void 0===p?void 0:p.description)||(null===(m=l)||void 0===m?void 0:m.message))}return _t(l).catch(t=>{console.error("[Whatmore] ATC 2754609263 error:",t)}),void setTimeout(e,o)}if("25786679341"===t)return(async(t,e)=>{const o={};(0,a.hG)((0,a.VA)(),"order_tracking->track_using_wtot")||(o[r.B_]=`${(0,n.wm)()}#${f}:direct`);const i=await fetch(`${(null===(t=window.Shopify)||void 0===t||null===(e=t.routes)||void 0===e?void 0:e.root)||"/"}cart/add.js`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({items:[{id:Number(l),quantity:1,properties:o}]})}).then(t=>t.json()).catch(()=>null);if(i&&!i.status)if(document.dispatchEvent(new CustomEvent("vd:cart:added",{bubbles:!0,detail:{items:i.items||[i]}})),"function"===typeof window.vdOpenCart)window.vdOpenCart();else{const t=document.querySelector("a.vd-bag");t?t.click():console.warn("[Whatmore] vdOpenCart missing and no .vd-bag for 25786679341")}else console.error("[Whatmore] ATC 25786679341 failed:",i&&i.description)})().catch(t=>{console.error("[Whatmore] ATC 25786679341 error:",t)}),void setTimeout(e,o);if("8111554613"===t)return(async()=>{const t=()=>{const t=document.querySelector("cart-drawer#CartDrawer");t?(document.querySelectorAll(".add-to-cart-popup, .exit-intent-popup").forEach(t=>t.classList.add("hide")),t.removeAttribute("hidden"),t.removeAttribute("inert"),"function"!==typeof t.show||t.open?(t.setAttribute("open","true"),t.setAttribute("active","true")):t.show()):console.warn("[Whatmore] cart-drawer#CartDrawer not found for 8111554613")},e=()=>{const e=document.querySelector("cart-drawer#CartDrawer");let o=!1;const n=()=>{o||(o=!0,r.disconnect(),clearTimeout(i),t())},r=new MutationObserver(()=>{const t=document.querySelector("cart-drawer#CartDrawer");t&&t!==e&&n()});r.observe(document.body,{childList:!0,subtree:!0});const i=setTimeout(n,3e3)};if("function"!==typeof window.cartGiftUpdate){console.warn("[Whatmore] cartGiftUpdate missing for 8111554613, falling back to /cart/add.js");const e=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({items:[{id:Number(l),quantity:1}]})}).then(t=>t.json()).catch(()=>null);return!e||e.status?void console.error("[Whatmore] ATC 8111554613 fallback failed:",e&&e.description):void setTimeout(()=>{b(l),document.dispatchEvent(new CustomEvent("cart:updated",{detail:{cart:e}})),t()},500)}const{price:o,productType:n}=await(async()=>{try{var t,e;const o=await fetch("/cart.js",{headers:{Accept:"application/json"},cache:"no-store"}).then(t=>t.json()),n=null===o||void 0===o||null===(t=o.items)||void 0===t?void 0:t.find(t=>String(t.variant_id)===String(l));if(n)return{price:n.price,productType:null!==(e=n.product_type)&&void 0!==e?e:""}}catch(r){}try{var o,n;const t=(v||window.location.href).split(/[?#]/)[0],e=await fetch(`${t}.js`,{headers:{Accept:"application/json"}}).then(t=>t.json()),r=null===e||void 0===e||null===(o=e.variants)||void 0===o?void 0:o.find(t=>String(t.id)===String(l));if(r)return{price:r.price,productType:null!==(n=e.product_type)&&void 0!==n?n:""}}catch(r){}return{price:0,productType:""}})(),r=()=>{document.removeEventListener("cart:updated",r),clearTimeout(i),b(l),e()},i=setTimeout(()=>{document.removeEventListener("cart:updated",r),b(l),e()},2500);document.addEventListener("cart:updated",r,{once:!1}),window.cartGiftUpdate(String(l),o,1,n,"ADD_TO_CART")})().catch(t=>{console.error("[Whatmore] ATC 8111554613 error:",t)}),void setTimeout(e,o);if("5801421"===t)return(async()=>{const t={};(0,a.hG)((0,a.VA)(),"order_tracking->track_using_wtot")||(t[r.B_]=`${(0,n.wm)()}#${f}:direct`);const e=await fetch("/cart/add.js",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({id:Number(l),quantity:1,properties:t})}).then(t=>t.json()).catch(()=>null);if(!e||e.status)return void console.error("[Whatmore] ATC 5801421 failed:",e&&e.description);let o=!1;const i=()=>{if(o)return!0;const t=window.Rebuy&&window.Rebuy.SmartCart;if(!t||"function"!==typeof t.show)return!1;if("ready"!==t.status&&!t.hasBoundEvents&&!document.querySelector("#rebuy-cart"))return!1;if(!0===t.isOpen||!0===t.isVisible)return o=!0,!0;o=!0;try{window.Rebuy.Cart&&window.Rebuy.Cart.fetchCart()}catch(e){}return t.show(),!0};document.addEventListener("rebuy:smartcart.ready",i,{once:!0});const c=(t=0)=>{if(i())return;if(t<40)return void setTimeout(()=>c(t+1),150);const e=window.Rebuy&&window.Rebuy.SmartCart;if(e&&"function"===typeof e.show)return o=!0,void e.show();const n=document.querySelector('[data-cart-open], a[href$="/cart"]:not([disable-rebuy], .disable-rebuy)');n?n.click():console.warn("[Whatmore] Rebuy SmartCart unavailable for 5801421")};c()})().catch(t=>{console.error("[Whatmore] ATC 5801421 error:",t)}),void setTimeout(e,o);const g=e=>{if("61126934766"==t){let t=e.querySelector(".productView-buttons").querySelector('form[action*="/cart/add"]');if(t)return t}let o=Array.from(e.querySelectorAll("product-form")).find(t=>t.querySelector('form > input[name="id"]')&&t.querySelector('form button[type="submit"]'));return o||(o=Array.from(e.querySelectorAll('form[action*="/cart/add"]')).find(t=>t.querySelector('button[type="submit"]'))),o},S=(e,o,n)=>{const r=e.cloneNode(!0);if(r){r.hasAttribute("data-product-variant-id")&&r.setAttribute("data-product-variant-id",o),r.hasAttribute("data-product-id")&&r.setAttribute("data-product-id",n);let e=r.querySelector('input[name="id"]');if(e)e.setAttribute("value",o),e.hasAttribute("disabled")&&e.removeAttribute("disabled");else{const t=r.querySelector('select[name="id"]');if(t){const e=t.querySelector('option[selected="selected"]');e&&e.setAttribute("value",o)}}const i=r.querySelector('input[name="product-id"]');i&&i.setAttribute("value",n);const a=document.createElement("div");return a.className="whatmore-atc",a.appendChild(r),document.body.appendChild(a),console.log(a,"formElement"),"92319318403"!==t&&"80261644574"!==t||((t,e,o)=>{var n;const r=null!==(n=t.matches)&&void 0!==n&&n.call(t,"form")?t:t.querySelector("form");if(!r)return;let i=r.querySelector('input[name="id"]');i||(i=document.createElement("input"),i.type="hidden",i.name="id",r.prepend(i)),i.value=String(e),i.removeAttribute("disabled");const a=r.querySelector('select[name="id"]');a&&([...a.options].some(t=>t.value===String(e))?(a.value=String(e),[...a.options].forEach(t=>t.selected=t.value===String(e)),a.dispatchEvent(new Event("change",{bubbles:!0}))):a.removeAttribute("name"));const c=r.querySelector('input[name="product-id"]');c&&(c.value=String(o))})(a,o,n),a}},_=t=>{const e=null===t||void 0===t?void 0:t.querySelector('button[type="submit"]');e&&e.click()},A=g(document);if(A||(null===A||void 0===A?void 0:A.length)>0){const At=S(A,l,h);_(At),setTimeout(()=>{b(l)},500),At.remove()}else{var j;fetch(null===v||void 0===v||null===(j=v.split("?"))||void 0===j?void 0:j[0]).then(t=>t.text()).then(t=>{const e=(new DOMParser).parseFromString(t,"text/html"),o=g(e);if(o||(null===o||void 0===o?void 0:o.length)>0){const t=S(o,l,h);_(t),setTimeout(()=>{b(l)},500),t.remove()}})}setTimeout(e,o)}},5118:function(t,e,o){async function n(t,e=""){let o;if("27303477337"===e){var n,r;const e="https://"+window.location.hostname,i=window.location.pathname.split("/");o=e+"/"+(null!==i&&void 0!==i&&null!==(n=i[1])&&void 0!==n&&n.startsWith("en-")?(null===i||void 0===i?void 0:i[1])+"/":"")+(null===t||void 0===t||null===(r=t.product_link)||void 0===r?void 0:r.split(".co")[1])+".js"}else o=(null===t||void 0===t?void 0:t.product_link)+".js";const i=await fetch(o,{method:"GET"});if(!i.ok)throw new Error(`Error! status: ${i.status}`);return await i.json()}async function r(t){if(!t||!t.product_link)return null;const e=await fetch(t.product_link+".json",{method:"GET"});if(!e.ok)throw new Error("Error! status: "+e.status);return e.json()}async function i(t,e,o){if(t)return n(t,o)}function a(t){var e=[],o=[],n=[];const r=t&&t.variants||[],i=t&&t.options||[];return r.forEach(t=>{var r,a,c;t.option1&&e.push({option:t.option1,available:null===(r=t.available)||void 0===r||r,type:i[0]&&i[0].name}),t.option2&&o.push({option:t.option2,available:null===(a=t.available)||void 0===a||a,type:i[1]&&i[1].name}),t.option3&&n.push({option:t.option3,available:null===(c=t.available)||void 0===c||c,type:i[2]&&i[2].name})}),e=e.reduce((t,e,o)=>{var n=t.filter(t=>t.option==e.option);return 0==n.length?[...t,e]:(n[0].available=n[0].available|e.available,t)},[]),o=o.reduce((t,e,o)=>{var n=t.filter(t=>t.option==e.option);return 0==n.length?[...t,e]:(n[0].available=n[0].available|e.available,t)},[]),n=n.reduce((t,e,o)=>{var n=t.filter(t=>t.option==e.option);return 0==n.length?[...t,e]:(n[0].available=n[0].available|e.available,t)},[]),[e,o,n]}function c(t){if(0==t.length)return null;const e=t.filter(t=>t.available);return 0==e.length?null:e[0].option}function d(t){return t[0].length<=1&&t[1].length<=1&&t[2].length<=1}function s(t,e){const o=e.filter(e=>e.option1==t[0]&&e.option2==t[1]&&e.option3==t[2]);return 0==o.length?null:o[0].id}function u(t){if(t&&t.length>=1){return t.filter(t=>t.available).length>=1}return!1}o.r(e),o.d(e,{atleastOneVariantAvailableInStock:function(){return u},getFirstAvailableOption:function(){return c},getVariantIdFromSelectedOption:function(){return s},getVariantOptions:function(){return a},isSingleVariantProduct:function(){return d},productDetailsDetailed:function(){return i},productDetailsShopifyJS:function(){return n},productDetailsShopifyJSON:function(){return r}})},8847:function(t,e,o){o.r(e),o.d(e,{addWhatmoreAttributeToCart:function(){return u}});var n=o(5616),r=o(4563),i=o(2567),a=o(5443),c=o(5566),d=o(6080);async function s(t){return await fetch("https://"+window.location.hostname+"/cart/update.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:t})}).then(t=>t.json()).catch(t=>{console.error("Whatmore :: Error while updating cart attribute.",t)})}async function u(t){var e;let o,u=(0,n.Ak)(),l=null,p=null,m={},h=null,f=null,y=null,w={};const v=(0,i.Ry)();let T=(0,c.CK)(),b=null===(e=localStorage)||void 0===e?void 0:e.wht_is_impression,C=T.length>0;T.forEach(t=>{w.hasOwnProperty(null===t||void 0===t?void 0:t.product_id)||(w[null===t||void 0===t?void 0:t.product_id]={widgetInfo:null===t||void 0===t?void 0:t.widget_info,location:null===t||void 0===t?void 0:t.location,userType:null===t||void 0===t?void 0:t.user_type})});const g=localStorage.getItem("_whatmore_session_id"),S=localStorage.getItem("wht_user_group"),_=window.whatmore&&window.whatmore.abTestConfig&&window.whatmore.abTestConfig.ab_test_id||null,A=window.whatmore&&window.whatmore.abTestConfig&&null!=window.whatmore.abTestConfig.version?window.whatmore.abTestConfig.version:null,j=localStorage.getItem("_whatmore_user_id"),E=localStorage.getItem("_whatmore_last_video_view_session"),O=(()=>{try{var t;return JSON.parse(null!==(t=localStorage.getItem("_whatmore_add_to_cart_products"))&&void 0!==t?t:"[]")}catch(e){return[]}})(),q=new Set(O.map(t=>String(null===t||void 0===t?void 0:t.product_id))),k=(()=>{try{var t;return JSON.parse(null!==(t=localStorage.getItem("_whatmore_buynow_products"))&&void 0!==t?t:"[]")}catch(e){return[]}})(),N=new Set(k.map(t=>String(null===t||void 0===t?void 0:t.variant_id))),P={buynow:3,direct:2,indirect:1};await(0,r.getCartDetailsShopifyAsync)().then(t=>t.json()).then(e=>{u=e.token,o=e.attributes;let n={};try{var r,T;const t=null===(r=o)||void 0===r?void 0:r._wtot;n="string"===typeof t?JSON.parse(t):null!==t&&void 0!==t?t:{};const i=new Set((null!==(T=e.items)&&void 0!==T?T:[]).map(t=>String(null===t||void 0===t?void 0:t.product_id)));n=Object.fromEntries(Object.entries(n).filter(([t])=>i.has(String(t))))}catch(L){n={}}let O=[];if(O=!0===t?e.items.map(t=>{const e=w[null===t||void 0===t?void 0:t.variant_id];return{...t,location:null===e||void 0===e?void 0:e.location,userType:null===e||void 0===e?void 0:e.userType,widget_info:null===e||void 0===e?void 0:e.widgetInfo}}):e.items.map(t=>{const e=w[null===t||void 0===t?void 0:t.product_id];return{...t,location:null===e||void 0===e?void 0:e.location,userType:null===e||void 0===e?void 0:e.userType,widget_info:null===e||void 0===e?void 0:e.widgetInfo}}),0==O.length)return console.debug("Whatmore :: no cart items available for view products"),null;let k={},W={};if(null!=g){const t={wht_session_id:null!==E&&void 0!==E?E:g,wht_user_id:j,...S&&{wht_user_group:S},..._&&{wht_ab_test_id:_},...null!=A&&{wht_ab_test_version:A}};W={[d.Uv]:(0,d.dK)(v)?JSON.stringify(t):t,[d.Um]:""}}if(b||C){const t="1";W[C?d.Rm:d.AG]=t,W[C?d.bZ:d.SW]=""}!(0,a.hG)((0,a.VA)(),"order_tracking->disable_impression_order_tracking")&&(W.hasOwnProperty(d.Uv)||W.hasOwnProperty(d.Rm)&&!o.hasOwnProperty(d.Rm)||W.hasOwnProperty(d.AG)&&!o.hasOwnProperty(d.AG))&&s(W),O.map((e,o)=>{if(l=e.key,p=e.quantity,m=e.properties,h=e.widget_info,f=e.location,y=e.userType,("63330517149"==v||"77604192550"==v||"64157352183"==v||"62758289602"==v||"65972830359"==v||"75310563627"==v||(0,a.hG)((0,a.VA)(),"order_tracking->track_using_wtot"))&&w.hasOwnProperty(JSON.stringify(!0===t?e.variant_id:e.product_id))){const t="65972830359"==v||"75310563627"==v||(0,a.hG)((0,a.VA)(),"order_tracking->track_using_wtot"),o=t?"_wtot":"wtot";let i=(0,c.wm)()+`#${h}`;if(t){var r;const t=N.has(String(null===e||void 0===e?void 0:e.variant_id))?"buynow":q.has(String(null===e||void 0===e?void 0:e.product_id))?"direct":"indirect",o=n[null===e||void 0===e?void 0:e.product_id];i=(null!==(r=P[("string"===typeof o?o:"").split(":")[1]])&&void 0!==r?r:0)>=P[t]?o:i+`:${t}`}k={...k,[null===e||void 0===e?void 0:e.product_id]:i};s({[o]:t?{...n,...k}:k})}null!==m&&d.B_ in m||!w.hasOwnProperty(JSON.stringify(!0===t?e.variant_id:e.product_id))||async function(t,e,o,n,r="default",s,u,l,p){const m=(0,i.Ry)(),h=u?(0,c.wm)()+("72201044272"==m?`#${n}#${r}#${s?"olduser":"newuser"}`:`#${n}`):p?"_wt_vs":l?"_wt_vi":"";if(""==h||"_wt_vs"==h||"_wt_vi"==h||"77604192550"==m||"64157352183"==m||"80856187185"==m||"86486974743"==m||"62758289602"==m||"63046287536"==m||"65972830359"==m||"75310563627"==m||"86968402213"==m||(0,a.hG)((0,a.VA)(),"order_tracking->track_using_wtot"))return;let f={id:t,quantity:e,properties:{...h?{[d.B_]:h}:{},...o}};await fetch("https://"+window.location.hostname+"/cart/change.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)}).then(t=>t.json()).catch(t=>{console.error("Whatmore :: Error while updating cart line item properties.",t)})}(l,p,m,h,f,y,!0,b,C)})}).catch(t=>{console.error("Whatmore :: Error while fetching cart_token for cart attribute update.",t)})}}}]);