!function(){function e(){var e=n("eabUserId");const t=E(),r=A();if(!e&&(t||r)){e=function(){try{if(window.crypto&&window.crypto.getRandomValues){const e=new Uint8Array(16);window.crypto.getRandomValues(e),e[6]=15&e[6]|64,e[8]=63&e[8]|128;const t=Array.from(e).map((e=>e.toString(16).padStart(2,"0")));return[t.slice(0,4).join(""),t.slice(4,6).join(""),t.slice(6,8).join(""),t.slice(8,10).join(""),t.slice(10,16).join("")].join("-")}}catch(e){console.log("Crypto UUID generation failed, falling back to Math.random()",e)}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}();var a=new Date;a.setFullYear(a.getFullYear()+1);var i="; expires="+a.toUTCString();document.cookie="eabUserId="+e+i+"; path=/"}}function t(e,t){var n=new Date;n.setTime(n.getTime()+31536e6);var r="; expires="+n.toUTCString();document.cookie=e+"="+(t||"")+r+"; path=/"}function n(e){for(var t=e+"=",n=document.cookie.split(";"),r=0;r{const[t,r]=e.split("=");n[t]=r})),t.forEach((e=>{const[t,r]=e.split("=");n[t]=r})),Object.entries(n).map((([e,t])=>`${e}=${t}`))}(i,u.search.substring(1).split("&"));if(!u.pathname.startsWith(s)){const e=u.pathname.startsWith("/")?u.pathname.substring(1):u.pathname,t=s.endsWith("/")?s.slice(0,-1):s;l=`${u.origin}${t}/${e}${u.hash}`}l=l.split("?")[0]}return l+(i.length?"?"+i.join("&"):"")}(e,n);!function(e,t,n){var r=l();const a=m[e].data;var i=a.type,s=o(p.split("?")[0]),c=o(n.split("?")[0]);const d=a?.settings?.checkVariant||!1;var u=h.view?h.view:"",f=m[e][t].templateID,g=s!==c;"SPLIT_URL"===i&&(g=function({newUrl:e,testID:t,testVar:n}){try{if("redirectOnlyControlUrl"===m[t].data?.redirectBehavior){if(m[t][n].isControl)return!1}const r=m[t].data,a=r?.settings?.checkVariant||!1,i=new URL(p),s=new URL(e),c=s.searchParams,l=i.searchParams,d=o(i.origin+i.pathname);if(d!==o(s.origin+s.pathname))return!0;for(const[e,t]of c.entries()){if("abtr"===e||"variant"===e&&!a)continue;if(l.get(e)!==t)return!0}return!1}catch(t){return console.error("Error comparing split URLs:",t),o(p.split("?")[0])!==o(e.split("?")[0])}}({newUrl:n,testID:e,testVar:t}));var w=u!==f,b="PAGE"===i&&r===a.page,v="PRODUCT"===i||"SPLIT_URL"===i||"PRODUCT_GROUP"===i;v&&!d&&(n=function(e){try{const t=new URL(e);return t.searchParams.delete("variant"),t.toString()}catch(t){return console.error("Invalid URL provided:",t),e}}(n));(v&&g||b&&w)&&(window.location.href=n)}(e,n,d)}}else!function(e,n){var r=m[e][n],a=r.themeId;if(a){var i=window.Shopify.theme;if(i&&i.id===a)return;if(r.isControl){const e=j(p.includes("?")?p.split("?")[1].split("&"):[],"preview_theme_id","");var o=window.location.pathname+"?"+e;window.location.assign(o)}else{var s=new URLSearchParams(window.location.search);s.set("preview_theme_id",a),t("eabThemeTest",e),window.location.assign(window.location.pathname+"?"+s.toString())}}}(e,n)}function k(e,t){for(var n=0;ne.type?"AND"===e.type?e.conditions.every(x):"OR"===e.type&&e.conditions.some(x):e.conditions.every(x)))}h.eabUserPreview&&t("eabUserPreview","true");var D=function(e){try{var a={};for(var i in y)y[i]&&(a[i]=y[i]);let w=((e,t)=>{let n=!1,r=!1;e.forEach((e=>{const t=m[e];t&&("number"==typeof t.data?.testTrafficPercentage?n=!0:r=!0)}));const a=[],i=[],o=[];let s=0;if(t.forEach((e=>{const t=m[e],n=t.data?.testTrafficPercentage;"number"==typeof n?(a.push(e),s+=n,i.push(s)):o.push(e)})),n)return[];if(r)return o;const c=s,l=Math.max(0,100-c);s+=l,i.push(s);const d=Math.random()*s;var u=k(i,(function(e){return d0){if(!N(e))continue}if("SHIPPING"===c.data.type){const e=c.data.shippingZones,t=e.countriesToInclude||[],r=e.countriesToExclude||[],a=n("localization")||localStorage.getItem("eabCountryCode");let i=!1;if(i=t.length>0?t.includes(a)&&!r.includes(a):!r.includes(a),!i)continue}var l=Object.keys(c).filter((function(e){return"data"!==e&&!c[e].isDone}));if("PRODUCT_GROUP"===s.type){let e={};l=l.filter((function(t){const n=c[t].groupVariationId;return!e[n]&&(e[n]=!0,!0)}))}if(l.length){var d=!0;for(let e=0;e{const[n]=e.split("=");return n===t?(r=!0,`${t}=${a}`):e})),r||e.push(`${t}=${a}`),e}function $(){(h.eabUserId&&t("eabUserId",h.eabUserId),h.eab_tests)&&(decodeURIComponent(h.eab_tests).split("~").forEach((function(e){!function(e){var t=e.split("_"),n=t[0],r=t[1],a="1"===t[2];for(var i in d)if(d[i]&&i.slice(-5)===n){y[i]=r,a&&(I[i]=!0);break}}(e)})),t("ABTL",JSON.stringify(y)),t("ABAU",JSON.stringify(I)))}function M(e){for(var t=e.split("?")[0];"/"===t.charAt(t.length-1);)t=t.slice(0,-1);var n=t.split("/");return n[n.length-1]}function G(){var e=o(O),t=c?e.replace(c,"/"):e;const n=window?.__st?.rid;for(var r in m)if(m[r]&&y[r]){var a=m[r],i=a.data.type;if("PRODUCT_IMAGE"!==i&&"PRODUCT_TIME"!==i&&"CONTENT"!==i&&"SHIPPING"!==i&&"PRICE_PLUS"!==i&&"CHECKOUT"!==i){if("PAGE"===i){if(l()!==a.data.page)continue;if(a.data.testProducts){var s=M(e),d=decodeURIComponent(s),u=n?.toString();if(Array.isArray(a.data.testProducts)&&a.data.testProducts.includes(d)||Array.isArray(a.data.productIds)&&a.data.productIds.includes(u))return r}else{if(!a.data.collections)return r;{const t=M(e);if(a.data.collections.includes(t))return r}}}if("PRODUCT"===i||"PRODUCT_GROUP"===i){if(a.data?.filters?.length>0){if(a.data.filters.some((e=>e?.conditions?.some((e=>"redirectUrls"===e.type))))){if(N(a.data.filters))return r;continue}}const t=decodeURIComponent(e);for(var f in a){if(!a[f]||"data"===f)continue;if(a[f].link===t)return r;const e=a[f].handle;if(t.endsWith(`products/${e}`))return r;if(Number(a[f].id)===n)return r}}if("SPLIT_URL"===i){const n="redirectOnlyControlUrl"===a.data?.redirectBehavior,i=a.data?.settings?.checkVariant||!1;for(let s in a){if(!a[s]||"data"===s)continue;if(n&&!a[s].isControl)continue;let l=o(a[s].link);if(l.includes("?")){const[n,a]=l.split("?");let o;o=c?t.split("?")[0]:e.split("?")[0];const s=new URL(p).searchParams,d=n===o;let u=!0;const f=new URLSearchParams(`?${a}`);for(const[e,t]of f.entries()){if("variant"===e&&!i)continue;if("abtr"===e)continue;const n=s.get(e);if(""===t&&""===n)continue;const r=decodeURIComponent(t||"");if(decodeURIComponent(n||"")!==r){u=!1;break}}if(d&&u)return r}else if(c){if(l===t)return r}else if(l===e)return r}}if("THEME"===i)for(const e in a){if(!a[e]||"data"===e)continue;if(a[e].themeId===window?.Shopify?.theme?.id)return r}}}return null}function J(e,t){if(t.startsWith("*")&&t.endsWith("*")){const n=t.slice(1,-1);return e.includes(n)}if(t.startsWith("*")){const n=t.slice(1);return e.endsWith(n)}return t===e||"*"===t}function V(){const e=E(),t=A();("fbclid"in h||e||t)&&function(){var e=r("ABTL"),t=n("eabUserId"),a=Object.keys(e).map((function(t){var n=t.length>=5?t.slice(-5):t,r=I[t]?"1":"0";return n+"_"+e[t]+"_"+r})).join("~"),i=new URL(p),o=new URLSearchParams(i.search);o.set("eab_tests",a),t&&o.set("eabUserId",t),i.search=o.toString(),window.history.replaceState({},"",i.toString())}()}function B(){if(!u?.disableNoteAttributes){var e=new XMLHttpRequest;e.open("GET","/cart.js"),e.setRequestHeader("Content-Type","application/json"),e.onreadystatechange=function(){if(4===e.readyState&&200===e.status){const t=JSON.parse(e.responseText).attributes||{};(t._eabTestsList||t._eabUserId||t._eabList)&&function(){var e=new XMLHttpRequest;e.open("POST","/cart/update.js"),e.setRequestHeader("Content-Type","application/json"),e.onreadystatechange=function(){4===e.readyState&&200===e.status?console.log("Successfully cleaned up note attributes"):4===e.readyState&&200!==e.status&&console.log("Error cleaning up note attributes")},e.send(JSON.stringify({attributes:{_eabTestsList:null,_eabUserId:null,_eabList:null}}))}()}},e.send()}}const W=()=>{const e=n("eabThemeTest");if(e){const n=d[e],a=n?.data?.isLive;if(!n||!a){r="eabThemeTest",document.cookie=r+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";const e=j(p.includes("?")?p.split("?")[1].split("&"):[],"preview_theme_id","");var t=window.location.pathname+"?"+e;window.location.assign(t)}}var r};function H(e,t){const n=document.createElement("input");return n.type="hidden",n.name=e,n.value=t,n}var q=-1!==window.location.hostname.indexOf("shopifypreview.com");const F=(navigator.userAgent||"").toLowerCase(),X=["googlebot","adsbot","headlesschrome","bingbot","storebot","facebookexternalhit","sebot-wa","amazonproductbot","claudebot","yandexbot","applebot","searchbot","inspectiontool"].some((e=>F.includes(e)));var K="true"===h.elevate_preview;q||K||X||(Object.entries(y).some((([e,t])=>{const n=d[e];return n&&n.data&&"THEME"===n.data.type&&!n[t]?.isControl}))&&function(e,t=1e4){return new Promise(((n,r)=>{const a=document.querySelector(e);if(a)return void n(a);const i=new MutationObserver((()=>{const t=document.querySelector(e);if(t)return i.disconnect(),void n(t)}));i.observe(document.documentElement,{childList:!0,subtree:!0}),setTimeout((()=>{i.disconnect(),r(new Error(`Element with selector "${e}" not found within ${t}ms`))}),t)}))}("#PBarNextFrameWrapper",1e4).then((e=>e.remove())).catch((e=>console.error(e))),function(){try{W(),e(),localStorage.getItem("eabFirstTimeVisit")||(sessionStorage.setItem("eabIsFirstVisit","true"),localStorage.setItem("eabFirstTimeVisit",(new Date).valueOf().toString()));var a=m&&0===Object.keys(m).length;if(a&&u?.cleanupAttributes&&B(),a)return;!function(){try{if(h&&(h.eab_tests||h.eabUserId)&&$(),h&&h.gclid){var e=G();if(!e)return;var n="PRODUCT"===m[e].data.type||"PRODUCT_GROUP"===m[e].data.type||"PRICE_PLUS"===m[e].data.type;const r=u?.excludeGoogleTraffic??!0;e&&!I[e]&&n&&r&&(P[e]=!0,t("eabExcludedTests",JSON.stringify(P)))}}catch(e){console.log("Err url params",e)}}();var i=function(){var e=[];for(var t in m)y&&y[t]||P[t]||e.push(t);return e}();i.length>0&&D(i);var o=G();o&&!("abtr"in _)&&!0!==P[o]&&C(o),V(),function(){try{if(!u?.trackRT)return;const e=r("ABRT")||{};let n=!1;const a={};for(const e in m)if(m[e]){a[e]={name:m[e].data?.name||"Unknown Test",variants:{}};for(const t in m[e]){if("data"===t||!m[e][t])continue;const n=m[e][t].variationName||`Variation ${t}`;a[e].variants[t]=n}}n=JSON.stringify(e)!==JSON.stringify(a),n&&t("ABRT",JSON.stringify(a))}catch(e){console.error("Error in trackRunningTests:",e)}}(),window.addEventListener("load",(function(){!function(){const e=Object.keys(m).filter((e=>"SHIPPING"===m[e].data.type));if(0===e?.length||!e)return;const t=document.querySelectorAll('form[action$="/cart/add"]'),r=n("eabUserId");let a=[];for(let t=0;t{t.querySelector('input[name="properties[_eabVisitorId]"]')||t.appendChild(H("properties[_eabVisitorId]",r));let n=t.querySelector('input[name="properties[_eabShippingTests]"]');e.length>0?n?n.value=i:t.appendChild(H("properties[_eabShippingTests]",i)):n&&t.removeChild(n)})),fetch("/cart.js").then((e=>e.json())).then((async t=>{for(let n=0;n0&&(c._eabVisitorId&&c._eabVisitorId===r||(c._eabVisitorId=r,s=!0)),e.length>0)if(c._eabShippingTests){let t=c._eabShippingTests.split(",");(t.some((t=>!e.includes(t)))||e.some((e=>!t.includes(e))))&&(c._eabShippingTests=i,s=!0)}else c._eabShippingTests=i,s=!0;else c._eabShippingTests&&(delete c._eabShippingTests,s=!0);if(s){const e={id:o,properties:c,quantity:a.quantity};await fetch("/cart/change.js",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}).then((e=>{if(!e.ok)throw new Error(`Failed to update item on line ${o}`);return e.json()})).then((e=>{console.log(`Successfully updated item on line ${o}`)})).catch((e=>{console.error("Error updating cart item:",e)}))}}})).catch((e=>{console.error("Error fetching cart:",e)}))}()})),function(){let e=!1;for(const t in m){if(!y[t]||P[t]||I[t])continue;const n=m[t].data.type;if("PRODUCT_IMAGE"===n||"PRODUCT_TIME"===n||"CONTENT"===n||"PRICE_PLUS"===n||"CHECKOUT"===n||"CUSTOM_CODE"===n||"SHIPPING"===n){if("PRICE_PLUS"===n){const e=window?.Shopify?.currency?.active;if(!(m[t].data.currencies||[]).includes(e))continue}if("CONTENT"===n||"CUSTOM_CODE"===n){const e=m[t].data.pathnames||[],n=window.location.pathname;if(!e.length)continue;const r=m[t].data.excludePathnames||[];if(r.length&&r.some((e=>J(n,e))))continue;if(!e.some((e=>J(n,e))))continue}I[t]=!0,e=!0}}e&&t("ABAU",JSON.stringify(I))}(),function(){if(u?.disableNoteAttributes)return;var e=new XMLHttpRequest;e.open("POST","/cart/update.js"),e.setRequestHeader("Content-Type","application/json"),e.onreadystatechange=function(){4===e.readyState&&200===e.status?console.log("success"):4===e.readyState&&200!==e.status&&console.log("Error getting cart data")};var t={};for(var r in m)I[r]&&(t[r]=y[r]);var a=n("eabUserId");let i={_eabTestsList:JSON.stringify(t),_eabUserId:a,_eabList:JSON.stringify(y)};e.send(JSON.stringify({attributes:i}))}(),s=window?.__st?.rid,s?localStorage.setItem("eabProductPageId",s):localStorage.removeItem("eabProductPageId")}catch(e){console.error("eabos",e)}var s}()),window.addEventListener("load",(function(){!function(e,t){let n=new URL(window.location.href),r=e[`${n.pathname}::${n.searchParams.get("view")||""}`];r&&t(n.toString(),r)}(function(){const e={},t=window.location.origin,n=window?.eab_data?.allTests||{};return Object.keys(n).forEach((r=>{if("settings"===r)return;const a=n[r],{isLive:i,type:o,page:s}=a.data;i&&Object.keys(a).forEach((n=>{if("data"===n)return;let i=a[n].link;if("PAGE"===o&&!i){switch(s){case"index":i=`${t}/`;break;case"collection":i=`${t}/collections/all`;break;case"product":i=`${t}/products`;break;case"page":i=`${t}/pages`;break;default:i=t}a[n].templateID&&(i+="?view="+a[n].templateID)}if(!i)return;let c=new URL(i),l=c.pathname,d=c.searchParams.get("view")||"";e[`${l}::${d}`]={testId:r,variantId:n,pathname:l,view:d,url:i}}))})),e}(),((e,t)=>{var n;n=()=>function(e,t){let n={url:e,...t};fetch("/apps/elevateab/handle404",{method:"POST",body:JSON.stringify(n)})}(e,t),fetch(e,{method:"HEAD",headers:{"Cache-Control":"no-cache, no-store, must-revalidate",Pragma:"no-cache",Expires:"0"}}).then((e=>{404===e.status&&n()}))}))}))}();