(()=>{function E(e){let t=document.cookie.match(new RegExp("(?:^|; )"+e.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,"\\$1")+"=([^;]*)"));if(t)return decodeURIComponent(t[1])}var c,P=new Uint8Array(16);function f(){if(!c&&(c=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!c))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return c(P)}var n=[];for(let e=0;e<256;++e)n.push((e+256).toString(16).slice(1));function x(e,t=0){return n[e[t+0]]+n[e[t+1]]+n[e[t+2]]+n[e[t+3]]+"-"+n[e[t+4]]+n[e[t+5]]+"-"+n[e[t+6]]+n[e[t+7]]+"-"+n[e[t+8]]+n[e[t+9]]+"-"+n[e[t+10]]+n[e[t+11]]+n[e[t+12]]+n[e[t+13]]+n[e[t+14]]+n[e[t+15]]}var B=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),g={randomUUID:B};function Y(e,t,o){if(g.randomUUID&&!t&&!e)return g.randomUUID();e=e||{};let r=e.random||(e.rng||f)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){o=o||0;for(let i=0;i<16;++i)t[o+i]=r[i];return t}return x(r)}var d=Y;var I={canPushState(){return typeof history.pushState!="undefined"},dropLocal(e,t,o){return e.removeItem(this.localKey(t,o))},updateLocal(e,t,o,r,i){let s=this.getLocal(e,t,o),p=this.localKey(t,o),l=s===null?r:i(s);return e.setItem(p,JSON.stringify(l)),l},getLocal(e,t,o){return JSON.parse(e.getItem(this.localKey(t,o)))},updateCurrentState(e){!this.canPushState()||history.replaceState(e(history.state||{}),"",window.location.href)},pushState(e,t,o){if(this.canPushState()){if(o!==window.location.href){if(t.type=="redirect"&&t.scroll){let i=history.state||{};i.scroll=t.scroll,history.replaceState(i,"",window.location.href)}delete t.scroll,history[e+"State"](t,"",o||null);let r=this.getHashTargetEl(window.location.hash);r?r.scrollIntoView():t.type==="redirect"&&window.scroll(0,0)}}else this.redirect(o)},setCookie(e,t){document.cookie=`${e}=${t}`},getCookie(e){return document.cookie.replace(new RegExp(`(?:(?:^|.*;s*)${e}s*=s*([^;]*).*$)|^.*$`),"$1")},redirect(e,t){t&&I.setCookie("__phoenix_flash__",t+"; max-age=60000; path=/"),window.location=e},localKey(e,t){return`${e}-${t}`},getHashTargetEl(e){let t=e.toString().substring(1);if(t!=="")return document.getElementById(t)||document.querySelector(`a[name="${t}"]`)}},m=I;var J="__DF_DEBUG_MODE__",M="true",_=window.sessionStorage;function G(){return _.getItem(J)===M}function L(e){return _.getItem(e)||window[e]}function h(...e){G()&&console.log("[doofinder]",...e)}var D=12*60*60*1e3,b="df",U="random-userid",y="session",j="apps",R=window.localStorage;function S(e){return m.getLocal(R,b,e)}function a(e,t){return m.updateLocal(R,b,e,t,()=>t)}function q(){return{id:d().replaceAll("-",""),expiry:new Date().getTime()+D,live:[]}}function w(){let e=S(y);return(!e||z(e))&&(e=q()),a(y,e)}function z({expiry:e}){return et.live.includes(r))}};function T(e){return window.doofinderLoader?window.doofinderLoader.getRegistry(e):new Promise(t=>{let o;o=r=>{r.detail.name===e&&(document.removeEventListener("doofinder.register",o),t(r.detail.entrypoint))},document.addEventListener("doofinder.register",o)})}function A(e,t=!1){let o=L("__DF_LAYER_SERVER__")||`https://${e.toLowerCase()}-layer.doofinder.com`;return t?o.replace(/^http/,"ws"):o}"use strict";var H=T("layer"),O="doofinder.shopify.installations",k="doofinder.shopify.checkout",$=window.localStorage,K=window.sessionStorage,v=new Set,F='script[src*="cdn.doofinder.com"][src*="loader"]',X=1e3,W=20,C,Q=0;C=setInterval(function(){let e=!!document.querySelector(F);(++Q===W||e)&&(clearInterval(C),e?K.setItem(k,"loader script found"):Z(N()))},X);H.then(e=>{let t=N();e.getTags().forEach(({installationId:o,zone:r,language:i,currency:s})=>{t[o]={zone:r,language:i,currency:s}}),ee(t)});function Z(e){var t;for(let o in e){let r=u.getSessionId(),i=u.isLive("layer","quiz","chat");if(!v.has(r)&&i){v.add(r);let{language:s,currency:p,zone:l,hashid:oe}=e[o],V=A(l);te(`${V}/api/1/stats/${o}/checkout`,{language:s,currency:p,source_url:window.location.href,session_id:r,user_id:u.getUserId(),ga_client_id:(t=E("_ga"))==null?void 0:t.substring(6)})}}K.setItem(k,v.size)}function N(){return JSON.parse($.getItem(O)||"{}")}function ee(e){$.setItem(O,JSON.stringify(e))}function te(e,t){return fetch(e,{mode:"cors",method:"post",headers:{"content-type":"application/json","cache-control":"max-age=0, no-cache, no-store, must-revalidate, post-check=0, pre-check=0"},body:JSON.stringify(t)}).then(o=>o.json())}})();