<!-- 2025-04-11T17:16:35.3884075Z -->
<style>.shoplift-hide { opacity: 0 !important; }</style>
<style id="sl-preview-bar-hide">#preview-bar-iframe, #PBarNextFrameWrapper { display: none !important; }</style>
<script type="text/javascript">(function(rootPath, template, themeRole, themeId, isThemePreview){ /* Generated on 2025-08-26T02:08:57.0412395Z */var G=Object.defineProperty;var j=(g,p,u)=>p in g?G(g,p,{enumerable:!0,configurable:!0,writable:!0,value:u}):g[p]=u;var c=(g,p,u)=>j(g,typeof p!="symbol"?p+"":p,u);(function(){"use strict";var g=" daum[ /]| deusu/| yadirectfetcher|(?:^|[^g])news(?!sapphire)|(?<! (?:channel/|google/))google(?!(app|/google| pixel))|(?<! cu)bots?(?:\\b|_)|(?<!(?: ya| yandex|^job|inapp;) ?)search|(?<!(?:lib))http|(?<![hg]m)score|@[a-z][\\w-]+\\.|\\(\\)|\\.com|\\b\\d{13}\\b|^<|^[\\w \\.\\-\\(?:\\):]+(?:/v?\\d+(?:\\.\\d+)?(?:\\.\\d{1,10})*?)?(?:,|$)|^[^ ]{50,}$|^\\d+\\b|^\\w+/[\\w\\(\\)]*$|^active|^ad muncher|^amaya|^avsdevicesdk/|^biglotron|^bot|^bw/|^clamav[ /]|^client/|^cobweb/|^custom|^ddg[_-]android|^discourse|^dispatch/\\d|^downcast/|^duckduckgo|^facebook|^getright/|^gozilla/|^hobbit|^hotzonu|^hwcdn/|^jeode/|^jetty/|^jigsaw|^microsoft bits|^movabletype|^mozilla/\\d\\.\\d \\(compatible;?\\)$|^mozilla/\\d\\.\\d \\w*$|^navermailapp|^netsurf|^offline|^owler|^postman|^python|^rank|^read|^reed|^rest|^rss|^snapchat|^space bison|^svn|^swcd |^taringa|^thumbor/|^track|^valid|^w3c|^webbandit/|^webcopier|^wget|^whatsapp|^wordpress|^xenu link sleuth|^yahoo|^yandex|^zdm/\\d|^zoom marketplace/|^{{.*}}$|admin|analyzer|archive|ask jeeves/teoma|bit\\.ly/|bluecoat drtr|browsex|burpcollaborator|capture|catch|check|chrome-lighthouse|chromeframe|classifier|clean|cloud|crawl|cypress/|dareboost|datanyze|dejaclick|detect|dmbrowser|download|evc-batch/|feed|firephp|gomezagent|headless|httrack|hubspot marketing grader|hydra|ibisbrowser|images|insight|inspect|iplabel|ips-agent|java(?!;)|library|mail\\.ru/|manager|measure|neustar wpm|node|nutch|offbyone|optimize|pageburst|pagespeed|parser|perl|phantomjs|pingdom|powermarks|preview|proxy|ptst[ /]\\d|reputation|resolver|retriever|rexx;|rigor|rss\\b|scan|scrape|server|sogou|sparkler/|speedcurve|spider|splash|statuscake|synapse|synthetic|tools|torrent|trace|transcoder|url|virtuoso|wappalyzer|watch|webglance|webkit2png|whatcms/|zgrab",p=/bot|spider|crawl|http|lighthouse/i,u;function C(){if(u instanceof RegExp)return u;try{u=new RegExp(g,"i")}catch{u=p}return u}function P(r){return!!r&&C().test(r)}class v{constructor(){c(this,"timestamp");this.timestamp=new Date}}class E extends v{constructor(e,s,i){super();c(this,"type");c(this,"testId");c(this,"hypothesisId");this.type=3,this.testId=e,this.hypothesisId=s,this.timestamp=i}}class x extends v{constructor(e){super();c(this,"type");c(this,"path");this.type=4,this.path=e}}class H extends v{constructor(e){super();c(this,"type");c(this,"cart");this.type=5,this.cart=e}}class S extends Error{constructor(){super();c(this,"isBot");this.isBot=!0}}function R(r,t,e){for(const s of t.selectors){const i=r.querySelectorAll(s.cssSelector);for(let o=0;o<i.length;o++)e(t.testId,t.hypothesisId)}b(r,t,(s,i,o,n,a)=>a(i,o),e)}function V(r,t,e){for(const s of t.selectors)k(r,t.testId,t.hypothesisId,s,e??(()=>{}));b(r,t,k,e??(()=>{}))}function _(r){return r.urlPatterns.reduce((t,e)=>{switch(e.operator){case"contains":return t+`.*${e}.*`;case"endsWith":return t+`.*${e}`;case"startsWith":return t+`${e}.*`}},"")}function b(r,t,e,s){new MutationObserver(()=>{for(const o of t.selectors)e(r,t.testId,t.hypothesisId,o,s)}).observe(r.documentElement,{childList:!0,subtree:!0})}function k(r,t,e,s,i){const o=r.querySelectorAll(s.cssSelector);for(let n=0;n<o.length;n++){let a=o.item(n);if(a instanceof HTMLElement&&a.dataset.shoplift!==""){a.dataset.shoplift="";for(const l of s.actions.sort(N))a=q(r,s.cssSelector,a,l)}}return o.length>0&&i?(i(t,e),!0):!1}function q(r,t,e,s){switch(s.type){case"innerHtml":e.innerHTML=s.value;break;case"attribute":L(e,s.scope,s.value);break;case"css":F(r,t,s.value);break;case"js":M(r,e,s);break;case"copy":return O(e);case"remove":$(e);break;case"move":D(e,parseInt(s.value));break}return e}function L(r,t,e){r.setAttribute(t,e)}function F(r,t,e){var i;const s=r.createElement("style");s.innerHTML=`${t} { ${e} }`,(i=r.getElementsByTagName("head")[0])==null||i.appendChild(s)}function M(r,t,e){Function("document","element",`use strict; ${e.value}`)(r,t)}function O(r){const t=r.cloneNode(!0);if(!r.parentNode)throw"Can't copy node outside of DOM";return r.parentNode.insertBefore(t,r.nextSibling),t}function $(r){r.remove()}function D(r,t){if(t===0)return;const e=Array.prototype.slice.call(r.parentElement.children).indexOf(r),s=Math.min(Math.max(e+t,0),r.parentElement.children.length-1);r.parentElement.children.item(s).insertAdjacentElement(t>0?"afterend":"beforebegin",r)}function N(r,t){return T(r)-T(t)}function T(r){return r.type==="copy"||r.type==="remove"?0:1}function f(r,t){return typeof t=="string"&&/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d+(?:Z|[+-]\d+)/.test(t)?new Date(t):t}function w(r,t){return t}class z{constructor(t,e,s,i,o,n,a,l,h,d,m){c(this,"temporarySessionKey","Shoplift_Session");c(this,"essentialSessionKey","Shoplift_Essential");c(this,"analyticsSessionKey","Shoplift_Analytics");c(this,"legacySessionKey");c(this,"cssHideClass");c(this,"testConfigs");c(this,"inactiveTestConfigs");c(this,"testsFilteredByAudience");c(this,"sendPageView");c(this,"shopliftDebug");c(this,"useGtag");c(this,"getCountryTimeout");c(this,"state");c(this,"shopifyAnalyticsId");c(this,"cookie",document.cookie);c(this,"isSyncing",!1);c(this,"isSyncingGA",!1);c(this,"fetch");c(this,"localStorageSet");c(this,"localStorageGet");c(this,"sessionStorageSet",window.sessionStorage.setItem.bind(window.sessionStorage));c(this,"sessionStorageGet",window.sessionStorage.getItem.bind(window.sessionStorage));c(this,"urlParams",new URLSearchParams(window.location.search));c(this,"device");c(this,"logHistory");this.shop=t,this.host=e,this.eventHost=s,this.disableReferrerOverride=l,this.logHistory=[],this.legacySessionKey=`SHOPLIFT_SESSION_${this.shop}`,this.cssHideClass=i?"shoplift-hide":"",this.testConfigs=d.map(y=>({...y,startAt:new Date(y.startAt),statusHistory:y.statusHistory.map(A=>({...A,createdAt:new Date(A.createdAt)}))})),this.inactiveTestConfigs=m,this.sendPageView=!!o,this.shopliftDebug=n===!0,this.useGtag=a===!0,this.fetch=window.fetch.bind(window),this.localStorageSet=window.localStorage.setItem.bind(window.localStorage),this.localStorageGet=window.localStorage.getItem.bind(window.localStorage);const I=this.getDeviceType();this.device=I!=="tablet"?I:"mobile",this.state=this.loadState(),this.shopifyAnalyticsId=this.getShopifyAnalyticsId(),this.testsFilteredByAudience=d.filter(y=>y.status=="active"),this.getCountryTimeout=h===1000?1e3:h,this.log("State Loaded",JSON.stringify(this.state))}async init(){var t;try{if(this.log("Shoplift script initializing"),window.Shopify&&window.Shopify.designMode){this.log("Skipping script for design mode");return}if(window.location.href.includes("slScreenshot=true")){this.log("Skipping script for screenshot");return}if(window.location.hostname.endsWith(".edgemesh.com")){this.log("Skipping script for preview");return}if(window.location.href.includes("isShopliftMerchant")){const s=this.urlParams.get("isShopliftMerchant")==="true";this.log("Setting merchant session to %s",s),this.state.temporary.isMerchant=s,this.persistTemporaryState()}if(this.state.temporary.isMerchant){this.log("Skipping script for merchant"),(t=document.querySelector("#sl-preview-bar-hide"))==null||t.remove();return}if(P(navigator.userAgent))return;if(navigator.userAgent.includes("Chrome/118")){this.log("Random: %o",[Math.random(),Math.random(),Math.random()]);const s=await this.makeRequest({url:`${this.eventHost}/api/v0/events/ip`,method:"get"}).then(i=>i==null?void 0:i.json());this.log(`IP: ${s}`),this.makeRequest({url:`${this.eventHost}/api/v0/logs`,method:"post",data:JSON.stringify(this.debugState(),w)}).catch()}if(this.shopifyAnalyticsId=this.getShopifyAnalyticsId(),this.monitorConsentChange(),this.checkForThemePreview())return;if(!this.disableReferrerOverride&&this.state.temporary.originalReferrer!=null){this.log(`Overriding referrer from '${document.referrer}' to '${this.state.temporary.originalReferrer}'`);const s=this.state.temporary.originalReferrer;delete this.state.temporary.originalReferrer,this.persistTemporaryState(),Object.defineProperty(document,"referrer",{get:()=>s,enumerable:!0,configurable:!0})}if(await this.refreshVisitor(this.shopifyAnalyticsId),await this.handleVisitorTest()){this.log("Redirecting for visitor test");return}this.setShoplift(),this.showPage(),await this.finalize(),console.log("SHOPLIFT SCRIPT INITIALIZED!")}catch(e){if(e instanceof S)return;throw e}finally{typeof window.shoplift!="object"&&this.setShopliftStub()}}async finalize(){const t=await this.getCartState();t!==null&&this.queueCartUpdate(t),this.pruneStateAndSave(),await this.syncAllEvents()}setShoplift(){this.log("Setting up public API");const e=this.urlParams.get("slVariant")==="true",s=e?null:this.urlParams.get("slVariant");window.shoplift={isHypothesisActive:async i=>{if(this.log("Script checking variant for hypothesis '%s'",i),e)return this.log("Forcing variant for hypothesis '%s'",i),!0;if(s!==null)return this.log("Forcing hypothesis '%s'",s),i===s;const o=this.testConfigs.find(a=>a.hypotheses.some(l=>l.id===i));if(!o)return this.log("No test found for hypothesis '%s'",i),!1;const n=this.state.essential.visitorTests.find(a=>a.testId===o.id);return n?(this.log("Active visitor test found",i),n.hypothesisId===i):(await this.manuallySplitVisitor(o),this.testConfigs.some(a=>a.hypotheses.some(l=>l.id===i&&this.state.essential.visitorTests.some(h=>h.hypothesisId===l.id))))},setAnalyticsConsent:async i=>{await this.onConsentChange(i,!0)},getVisitorData:()=>({visitor:this.state.analytics.visitor,visitorTests:this.state.essential.visitorTests.filter(i=>!i.isInvalid).map(i=>{const{shouldSendToGa:o,...n}=i;return n})})}}setShopliftStub(){this.log("Setting up stubbed public API");const e=this.urlParams.get("slVariant")==="true",s=e?null:this.urlParams.get("slVariant");window.shoplift={isHypothesisActive:i=>Promise.resolve(e||i===s),setAnalyticsConsent:()=>Promise.resolve(),getVisitorData:()=>({visitor:null,visitorTests:[]})}}async manuallySplitVisitor(t){this.log("Starting manual split for test '%s'",t.id),await this.handleVisitorTest([t]),this.saveState(),this.syncAllEvents()}async handleVisitorTest(t){await this.filterTestsByAudience(this.testConfigs,this.state.analytics.visitor??this.buildBaseVisitor(),this.state.essential.visitorTests);let e=t?t.filter(a=>this.testsFilteredByAudience.some(l=>l.id===a.id)):this.testsForUrl(this.testsFilteredByAudience);if(e.length===0)return this.log("No tests found"),!1;this.log("Checking for existing visitor test on page");const s=this.getCurrentVisitorHypothesis(e);if(s){this.log("Found current visitor test");const a=this.considerRedirect(s);return a&&(this.log("Redirecting for current visitor test"),this.redirect(s)),a}this.log("No active test relation for test page");const i=this.testsForUrl(this.inactiveTestConfigs.filter(a=>this.testIsPaused(a)&&a.hypotheses.some(l=>this.state.essential.visitorTests.some(h=>h.hypothesisId===l.id)))).map(a=>a.id);if(i.length>0)return this.log("Visitor has paused tests for test page, skipping test assignment: %o",i),!1;if(this.hasThemeAndOtherTestTypes(this.testsFilteredByAudience)){this.log("Store has both theme and non-theme tests");const a=this.visitorActiveTestType();this.log("Current visitor test type is '%s'",a);let l;switch(a){case"templateOrUrlRedirect":this.log("Filtering to non-theme tests"),l=d=>d!=="theme";break;case"theme":this.log("Filtering to theme tests"),l=d=>d==="theme";break;case null:l=Math.random()>.5?(this.log("Filtering to theme tests"),d=>d==="theme"):(this.log("Filtering to non-theme tests"),d=>d!=="theme");break}const h=e.filter(d=>d.hypotheses.every(m=>!m.isControl||!l(m.type)));this.log(`Blocking visitor from being assigned to filtered test IDs: ["${h.map(d=>d.id).join('", "')}"]`),this.state.essential.visitorTests.push(...h.map(d=>({createdAt:new Date,testId:d.id,hypothesisId:null,isThemeTest:d.hypotheses.some(m=>m.type==="theme"),shouldSendToGa:!1,isSaved:!0,isInvalid:!0,themeId:void 0}))),e=e.filter(d=>d.hypotheses.some(m=>m.isControl&&l(m.type)))}if(e.length===0)return this.log("No tests found"),!1;const o=e[Math.floor(Math.random()*e.length)],n=this.pickHypothesis(o);if(n){this.log("Adding local visitor to test '%s', hypothesis '%s'",o.id,n.id),this.queueAddVisitorToTest(o.id,n);const a=this.considerRedirect(n);return a&&(this.log("Redirecting for new test"),this.redirect(n)),a}return this.log("No hypothesis found"),this.includeInDomTests(),!1}includeInDomTests(){const t=this.getDomTestsForCurrentUrl(),e=this.getVisitorDomHypothesis(t);for(const s of t){this.log("Evaluating dom test '%s'",s.id);const o=e.find(n=>s.hypotheses.some(a=>n.id===a.id))??this.pickHypothesis(s);if(!o){this.log("Failed to pick hypothesis for test");continue}if(o.isControl){this.log("Test has no dom actions to take, detect selector for test inclusion");const n=s.hypotheses.filter(a=>a.id!==o.id).flatMap(a=>{var l;return((l=a.domSelectors)==null?void 0:l.map(h=>({...h,testId:s.id})))??[]});n.length>0&&R(document,{testId:s.id,hypothesisId:o.id,selectors:n},a=>{this.queueAddVisitorToTest(a,o),this.syncAllEvents()});continue}if(!o.domSelectors||o.domSelectors.length===0){this.log("No selectors found, skipping hypothesis");continue}this.log("Watching for selectors"),V(document,{testId:s.id,hypothesisId:o.id,selectors:o.domSelectors},n=>{this.queueAddVisitorToTest(n,o),this.syncAllEvents()})}}considerRedirect(t){if(this.log("Considering redirect for hypothesis '%s'",t.id),t.isControl)return this.log("Skipping redirect for control"),!1;if(t.type==="basicScript"||t.type==="manualScript")return this.log("Skipping redirect for script test"),!1;const e=this.state.essential.visitorTests.find(n=>n.hypothesisId===t.id),s=new URL(window.location.toString()),o=new URLSearchParams(window.location.search).get("view");if(t.type==="theme"){if(!(t.themeId===themeId)){if(this.log("Theme id '%s' is not hypothesis theme ID '%s'",t.themeId,themeId),e&&e.themeId!==t.themeId&&(e.themeId===themeId||!this.isThemePreview()))this.log("On old theme, redirecting and updating local visitor"),e.themeId=t.themeId;else if(this.isThemePreview())return this.log("On non-test theme, skipping redirect"),!1;return this.log("Hiding page to redirect for theme test"),this.hidePage(),!0}return!1}else if(t.type!=="dom"&&t.affix!==template.suffix&&t.affix!==o||t.redirectPath&&!s.pathname.endsWith(t.redirectPath))return this.log("Hiding page to redirect for template test"),this.hidePage(),!0;return this.log("Not redirecting"),!1}redirect(t){if(this.log("Redirecting to hypothesis '%s'",t.id),t.isControl)return;const e=new URL(window.location.toString());if(e.searchParams.delete("view"),t.redirectPath){const s=RegExp("^(/w{2}-w{2})/").exec(e.pathname);if(s&&s.length>1){const i=s[1];e.pathname=`${i}${t.redirectPath}`}else e.pathname=t.redirectPath}else t.type==="theme"?(e.searchParams.set("_ab","0"),e.searchParams.set("_fd","0"),e.searchParams.set("_sc","1"),e.searchParams.set("preview_theme_id",t.themeId.toString())):t.type!=="urlRedirect"&&e.searchParams.set("view",t.affix);this.queueRedirect(e)}async refreshVisitor(t){if(t===null||!this.state.essential.isFirstLoad||!this.testConfigs.some(s=>s.visitorOption!=="all"))return;this.log("Refreshing visitor"),this.hidePage();const e=await this.getVisitor(t);e&&e.id&&this.updateLocalVisitor(e)}buildBaseVisitor(){return{shopifyAnalyticsId:this.shopifyAnalyticsId,device:this.device,country:null,...this.state.essential.initialState}}getInitialState(){const t=this.getUTMValue("utm_source")??"",e=this.getUTMValue("utm_medium")??"",s=this.getUTMValue("utm_campaign")??"",i=this.getUTMValue("utm_content")??"",o=window.document.referrer,n=this.device;return{createdAt:new Date,utmSource:t,utmMedium:e,utmCampaign:s,utmContent:i,referrer:o,device:n}}checkForThemePreview(){var t,e;return this.log("Checking for theme preview"),window.location.hostname.endsWith(".shopifypreview.com")?(this.log("on shopify preview domain"),this.clearThemeBar(!0,!1,this.state),(t=document.querySelector("#sl-preview-bar-hide"))==null||t.remove(),!1):this.isThemePreview()?this.state.essential.visitorTests.some(s=>s.isThemeTest&&s.hypothesisId!=null&&this.getHypothesis(s.hypothesisId)&&s.themeId===themeId)?(this.log("On active theme test, removing theme bar"),this.clearThemeBar(!1,!0,this.state),!1):this.state.essential.visitorTests.some(s=>s.isThemeTest&&s.hypothesisId!=null&&!this.getHypothesis(s.hypothesisId)&&s.themeId===themeId)?(this.log("Visitor is on an inactive theme test, redirecting to main theme"),this.redirectToMainTheme(),!0):this.state.essential.isFirstLoad?(this.log("No visitor found on theme preview, redirecting to main theme"),this.redirectToMainTheme(),!0):this.inactiveTestConfigs.some(s=>s.hypotheses.some(i=>i.themeId===themeId))?(this.log("Current theme is an inactive theme test, redirecting to main theme"),this.redirectToMainTheme(),!0):this.testConfigs.some(s=>s.hypotheses.some(i=>i.themeId===themeId))?(this.log("Falling back to clearing theme bar"),this.clearThemeBar(!1,!0,this.state),!1):(this.log("No tests on current theme, skipping script"),this.clearThemeBar(!0,!1,this.state),(e=document.querySelector("#sl-preview-bar-hide"))==null||e.remove(),!0):(this.log("Not on theme preview"),this.clearThemeBar(!0,!1,this.state),!1)}redirectToMainTheme(){this.hidePage();const t=new URL(window.location.toString());t.searchParams.set("preview_theme_id",""),this.queueRedirect(t)}testsForUrl(t){const e=new URL(window.location.href),s=this.typeFromTemplate();return t.filter(i=>i.hypotheses.some(o=>o.type!=="dom"&&(o.isControl&&o.type===s&&o.affix===template.suffix||o.type==="theme"||o.isControl&&o.type==="urlRedirect"&&o.redirectPath&&e.pathname.endsWith(o.redirectPath)||o.type==="basicScript"))&&(i.ignoreTestViewParameterEnforcement||!e.searchParams.has("view")||i.hypotheses.map(o=>o.affix).includes(e.searchParams.get("view")??"")))}domTestsForUrl(t){const e=new URL(window.location.href);return t.filter(s=>s.hypotheses.some(i=>i.type==="dom"&&i.domSelectors&&i.domSelectors.some(o=>new RegExp(_(o)).test(e.toString()))))}async filterTestsByAudience(t,e,s){const i=[];let o=e.country;!o&&t.some(n=>n.requiresCountry&&!s.some(a=>a.testId===n.id))&&(this.log("Hiding page to check geoip"),this.hidePage(),o=await this.makeJsonRequest({method:"get",url:`${this.eventHost}/api/v0/visitors/get-country`,signal:AbortSignal.timeout(this.getCountryTimeout)}).catch(n=>(this.log("Error getting country",n),null)));for(const n of t){if(this.log("Checking audience for test '%s'",n.id),this.state.essential.visitorTests.some(h=>h.testId===n.id&&h.hypothesisId==null)){console.log(`Skipping blocked test '${n.id}'`);continue}const a=this.visitorCreatedDuringTestActive(n.statusHistory);(s.some(h=>h.testId===n.id&&(n.device==="all"||n.device===e.device&&n.device===this.device))||this.isTargetAudience(n,e,a,o))&&(this.log("Visitor is in audience for test '%s'",n.id),i.push(n))}this.testsFilteredByAudience=i}isTargetAudience(t,e,s,i){const o=this.getChannel(e);return(t.device==="all"||t.device===e.device&&t.device===this.device)&&(t.visitorOption==="all"||t.visitorOption==="new"&&s||t.visitorOption==="returning"&&!s)&&(t.targetAudiences.length===0||t.targetAudiences.reduce((n,a)=>n||a.reduce((l,h)=>l&&h(e,s,o,i),!0),!1))}visitorCreatedDuringTestActive(t){let e="";for(const s of t){if(this.state.analytics.visitor!==null&&this.state.analytics.visitor.createdAt<s.createdAt||this.state.essential.initialState.createdAt<s.createdAt)break;e=s.status}return e==="active"}getDomTestsForCurrentUrl(){return this.domTestsForUrl(this.testsFilteredByAudience)}getCurrentVisitorHypothesis(t){return t.flatMap(e=>e.hypotheses).find(e=>e.type!=="dom"&&this.state.essential.visitorTests.some(s=>s.hypothesisId===e.id))}getVisitorDomHypothesis(t){return t.flatMap(e=>e.hypotheses).filter(e=>e.type==="dom"&&this.state.essential.visitorTests.some(s=>s.hypothesisId===e.id))}getHypothesis(t){return this.testConfigs.filter(e=>e.hypotheses.some(s=>s.id===t)).map(e=>e.hypotheses.find(s=>s.id===t))[0]}hasThemeTest(t){return t.some(e=>e.hypotheses.some(s=>s.type==="theme"))}hasTestThatIsNotThemeTest(t){return t.some(e=>e.hypotheses.some(s=>s.type!=="theme"&&s.type!=="dom"))}hasThemeAndOtherTestTypes(t){return this.hasThemeTest(t)&&this.hasTestThatIsNotThemeTest(t)}testIsPaused(t){return t.status==="paused"||t.status==="incompatible"||t.status==="suspended"}visitorActiveTestType(){const t=this.state.essential.visitorTests.filter(e=>this.testConfigs.some(s=>s.hypotheses.some(i=>i.id==e.hypothesisId)));return t.length===0?null:t.some(e=>e.isThemeTest)?"theme":"templateOrUrlRedirect"}pickHypothesis(t){let e=Math.random();const s=t.hypotheses.reduce((o,n)=>o+n.visitorCount,0);return t.hypotheses.sort((o,n)=>o.isControl?n.isControl?0:-1:n.isControl?1:0).reduce((o,n)=>{if(o!==null)return o;const l=t.hypotheses.reduce((h,d)=>h&&d.visitorCount>20,!0)?n.visitorCount/s-n.trafficPercentage:0;return e<=n.trafficPercentage-l?n:(e-=n.trafficPercentage,null)},null)}typeFromTemplate(){switch(template.type){case"collection-list":return"collectionList";case"page":return"landing";case"article":case"blog":case"cart":case"collection":case"index":case"product":case"search":return template.type;default:return null}}queueRedirect(t){this.saveState(),this.disableReferrerOverride||(this.log(`Saving temporary referrer override '${document.referrer}'`),this.state.temporary.originalReferrer=document.referrer,this.persistTemporaryState()),window.setTimeout(()=>window.location.assign(t),0),window.setTimeout(()=>void this.syncAllEvents(),2e3)}async syncAllEvents(){const t=async()=>{if(this.isSyncing){window.setTimeout(()=>void(async()=>await t())(),500);return}try{this.isSyncing=!0,await this.syncEvents(),this.syncGAEvents()}finally{this.isSyncing=!1}};await t()}async syncEvents(){var s,i;if(!this.state.essential.consentApproved||!this.shopifyAnalyticsId||this.state.analytics.queue.length===0)return;const t=this.state.analytics.queue.length,e=this.state.analytics.queue.splice(0,t);this.log("Syncing %s events",t);try{const o={shop:this.shop,visitorDetails:{shopifyAnalyticsId:this.shopifyAnalyticsId,device:((s=this.state.analytics.visitor)==null?void 0:s.device)??this.device,country:((i=this.state.analytics.visitor)==null?void 0:i.country)??null,...this.state.essential.initialState},events:this.state.essential.visitorTests.filter(a=>!a.isInvalid&&!a.isSaved&&a.hypothesisId!=null).map(a=>new E(a.testId,a.hypothesisId,a.createdAt)).concat(e)};await this.sendEvents(o);const n=await this.getVisitor(this.shopifyAnalyticsId);n!==null&&this.updateLocalVisitor(n);for(const a of this.state.essential.visitorTests.filter(l=>!l.isInvalid&&!l.isSaved))a.isSaved=!0}catch{this.state.analytics.queue.splice(0,0,...e)}finally{this.saveState()}}syncGAEvents(){if(!this.useGtag){this.log("UseGtag is false — skipping GA Events");return}if(!this.state.essential.consentApproved){this.log("Consent not approved — skipping GA Events");return}if(this.isSyncingGA){this.log("Already syncing GA - skipping GA events");return}const t=this.state.essential.visitorTests.filter(e=>e.shouldSendToGa);if(t.length===0){this.log("No GA Events to sync");return}this.isSyncingGA=!0,this.log("Syncing %s GA Events",t.length),Promise.allSettled(t.map(e=>this.sendGtagEvent(e))).then(()=>this.log("All gtag events sent")).finally(()=>this.isSyncingGA=!1)}sendGtagEvent(t){return new Promise(e=>{this.log("Sending GA Event for test %s, hypothesis %s",t.testId,t.hypothesisId);const s=()=>{this.log("GA acknowledged event for hypothesis %s",t.hypothesisId),t.shouldSendToGa=!1,this.persistEssentialState(),e()},i={exp_variant_string:`SL-${t.testId}-${t.hypothesisId}`};this.shopliftDebug&&Object.assign(i,{debug_mode:!0});function o(n,a,l){window.dataLayer=window.dataLayer||[],window.dataLayer.push(arguments)}o("event","experience_impression",{...i,event_callback:s})})}updateLocalVisitor(t){let e;({visitorTests:e,...this.state.analytics.visitor}=t);for(const s of this.state.essential.visitorTests.filter(i=>!e.some(o=>o.testId===i.testId)))s.isSaved=!0,s.isInvalid=!0;for(const s of e)this.state.essential.visitorTests.some(o=>o.testId===s.testId)||this.state.essential.visitorTests.push(s);this.state.analytics.visitor.storedAt=new Date}async getVisitor(t){try{return await this.makeJsonRequest({method:"get",url:`${this.eventHost}/api/v0/visitors/by-key/${this.shop}/${t}`})}catch{return null}}async sendEvents(t){await this.makeRequest({method:"post",url:`${this.eventHost}/api/v0/events`,data:JSON.stringify(t)})}getUTMValue(t){const s=decodeURIComponent(window.location.search.substring(1)).split("&");for(let i=0;i<s.length;i++){const o=s[i].split("=");if(o[0]===t)return o[1]||null}return null}hidePage(){this.log("Hiding page"),this.cssHideClass&&!window.document.documentElement.classList.contains(this.cssHideClass)&&(window.document.documentElement.classList.add(this.cssHideClass),setTimeout(this.removeAsyncHide(this.cssHideClass),2e3))}showPage(){this.cssHideClass&&this.removeAsyncHide(this.cssHideClass)()}getDeviceType(){function t(){let s=!1;return function(i){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(i)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(i.substr(0,4)))&&(s=!0)}(navigator.userAgent||navigator.vendor),s}function e(){let s=!1;return function(i){(/android|ipad|playbook|silk/i.test(i)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(i.substr(0,4)))&&(s=!0)}(navigator.userAgent||navigator.vendor),s}return t()?"mobile":e()?"tablet":"desktop"}removeAsyncHide(t){return()=>{t&&window.document.documentElement.classList.remove(t)}}async getCartState(){try{let t=await this.makeJsonRequest({method:"get",url:`${window.location.origin}/cart.js`});return t===null||(t.note===null&&(t=await this.makeJsonRequest({method:"post",url:`${window.location.origin}/cart/update.js`,data:JSON.stringify({note:""})})),t==null)?null:{token:t.token,total_price:t.total_price,total_discount:t.total_discount,currency:t.currency,items_subtotal_price:t.items_subtotal_price,items:t.items.map(e=>({quantity:e.quantity,variant_id:e.variant_id,key:e.key,price:e.price,final_line_price:e.final_line_price,sku:e.sku,product_id:e.product_id}))}}catch(t){return this.log("Error sending cart info",t),null}}async makeJsonRequest(t){const e=await this.makeRequest(t);return e===null?null:JSON.parse(await e.text(),f)}async makeRequest(t){const{url:e,method:s,headers:i,data:o,signal:n}=t,a=new Headers;if(i)for(const h in i)a.append(h,i[h]);(!i||!i.Accept)&&a.append("Accept","application/json"),(!i||!i["Content-Type"])&&a.append("Content-Type","application/json"),(this.eventHost.includes("ngrok.io")||this.eventHost.includes("ngrok-free.app"))&&a.append("ngrok-skip-browser-warning","1234");const l=await this.fetch(e,{method:s,headers:a,body:o,signal:n});if(!l.ok){if(l.status===204)return null;if(l.status===422){const h=await l.json();if(typeof h<"u"&&h.isBot)throw new S}throw new Error(`Error sending shoplift request ${l.status}`)}return l}queueAddVisitorToTest(t,e){this.state.essential.visitorTests.some(s=>s.testId===t)||this.state.essential.visitorTests.push({createdAt:new Date,testId:t,hypothesisId:e.id,isThemeTest:e.type==="theme",themeId:e.themeId,isSaved:!1,isInvalid:!1,shouldSendToGa:!0})}queueCartUpdate(t){this.queueEvent(new H(t))}queuePageView(t){this.queueEvent(new x(t))}queueEvent(t){!this.state.essential.consentApproved&&this.state.essential.hasConsentInteraction||this.state.analytics.queue.length>10||this.state.analytics.queue.push(t)}legacyGetLocalStorageVisitor(){const t=this.localStorageGet(this.legacySessionKey);if(t)try{return JSON.parse(t,f)}catch{}return null}pruneStateAndSave(){this.state.essential.visitorTests=this.state.essential.visitorTests.filter(t=>this.testConfigs.some(e=>e.id==t.testId)||this.inactiveTestConfigs.filter(e=>this.testIsPaused(e)).some(e=>e.id===t.testId)),this.saveState()}saveState(){this.persistEssentialState(),this.persistAnalyticsState()}loadState(){const t=this.loadAnalyticsState(),e={analytics:t,essential:this.loadEssentialState(t),temporary:this.loadTemporaryState()},s=this.legacyGetLocalStorageVisitor(),i=this.legacyGetCookieVisitor(),o=[s,i].filter(n=>n!==null).sort((n,a)=>+a.storedAt-+n.storedAt)[0];return e.analytics.visitor===null&&o&&({visitorTests:e.essential.visitorTests,...e.analytics.visitor}=o,e.essential.isFirstLoad=!1,e.essential.initialState={createdAt:o.createdAt,referrer:o.referrer,utmCampaign:o.utmCampaign,utmContent:o.utmContent,utmMedium:o.utmMedium,utmSource:o.utmSource,device:o.device},this.deleteCookie("SHOPLIFT"),this.deleteLocalStorage(this.legacySessionKey)),!e.essential.consentApproved&&e.essential.hasConsentInteraction&&this.deleteLocalStorage(this.analyticsSessionKey),e}loadEssentialState(t){var a;const e=this.loadLocalStorage(this.essentialSessionKey),s=this.loadCookie(this.essentialSessionKey),i=this.getInitialState();(a=t.visitor)!=null&&a.device&&(i.device=t.visitor.device);const o={timestamp:new Date,consentApproved:!1,hasConsentInteraction:!1,debugMode:!1,initialState:i,visitorTests:[],isFirstLoad:!0},n=[e,s].filter(l=>l!==null).sort((l,h)=>+h.timestamp-+l.timestamp)[0]??o;return n.initialState||(t.visitor!==null?n.initialState=t.visitor:(n.initialState=i,n.initialState.createdAt=n.timestamp)),n}loadAnalyticsState(){const t=this.loadLocalStorage(this.analyticsSessionKey),e=this.loadCookie(this.analyticsSessionKey),s={timestamp:new Date,visitor:null,queue:[]},i=[t,e].filter(o=>o!==null).sort((o,n)=>+n.timestamp-+o.timestamp)[0]??s;return i.queue.length===0&&t&&t.queue.length>1&&(i.queue=t.queue),i}loadTemporaryState(){const t=this.sessionStorageGet(this.temporarySessionKey),e=t?JSON.parse(t,f):null,s=this.loadCookie(this.temporarySessionKey);return e??s??{isMerchant:!1,timestamp:new Date}}persistEssentialState(){this.log("Persisting essential state"),this.state.essential.isFirstLoad=!1,this.state.essential.timestamp=new Date,this.persistLocalStorageState(this.essentialSessionKey,this.state.essential),this.persistCookieState(this.essentialSessionKey,this.state.essential)}persistAnalyticsState(){this.log("Persisting analytics state"),this.state.essential.consentApproved&&(this.state.analytics.timestamp=new Date,this.persistLocalStorageState(this.analyticsSessionKey,this.state.analytics),this.persistCookieState(this.analyticsSessionKey,{...this.state.analytics,queue:[]}))}persistTemporaryState(){this.log("Setting temporary session state"),this.state.temporary.timestamp=new Date,this.sessionStorageSet(this.temporarySessionKey,JSON.stringify(this.state.temporary)),this.persistCookieState(this.temporarySessionKey,this.state.temporary,!0)}loadLocalStorage(t){const e=this.localStorageGet(t);if(e===null)return null;try{return JSON.parse(e,f)}catch{return null}}loadCookie(t){const e=this.getCookie(t);if(e===null)return null;try{return JSON.parse(e,f)}catch{return null}}persistLocalStorageState(t,e){this.localStorageSet(t,JSON.stringify(e))}persistCookieState(t,e,s=!1){const i=JSON.stringify(e),o=s?"":`expires=${new Date(new Date().getTime()+864e5*365).toUTCString()};`;document.cookie=`${t}=${i};domain=.${window.location.hostname};path=/;SameSite=Strict;${o}`}deleteCookie(t){const e=new Date(0).toUTCString();document.cookie=`${t}=;domain=.${window.location.hostname};path=/;expires=${e};`}deleteLocalStorage(t){window.localStorage.removeItem(t)}getChannel(t){var s;return((s=[{"name":"cross-network","test":(v) => new RegExp(".*cross-network.*", "i").test(v.utmCampaign)},{"name":"direct","test":(v) => v.utmSource === "" && v.utmMedium === ""},{"name":"paid-shopping","test":(v) => (new RegExp("^(?:Google|IGShopping|aax-us-east\.amazon-adsystem\.com|aax\.amazon-adsystem\.com|alibaba|alibaba\.com|amazon|amazon\.co\.uk|amazon\.com|apps\.shopify\.com|checkout\.shopify\.com|checkout\.stripe\.com|cr\.shopping\.naver\.com|cr2\.shopping\.naver\.com|ebay|ebay\.co\.uk|ebay\.com|ebay\.com\.au|ebay\.de|etsy|etsy\.com|m\.alibaba\.com|m\.shopping\.naver\.com|mercadolibre|mercadolibre\.com|mercadolibre\.com\.ar|mercadolibre\.com\.mx|message\.alibaba\.com|msearch\.shopping\.naver\.com|nl\.shopping\.net|no\.shopping\.net|offer\.alibaba\.com|one\.walmart\.com|order\.shopping\.yahoo\.co\.jp|partners\.shopify\.com|s3\.amazonaws\.com|se\.shopping\.net|shop\.app|shopify|shopify\.com|shopping\.naver\.com|shopping\.yahoo\.co\.jp|shopping\.yahoo\.com|shopzilla|shopzilla\.com|simplycodes\.com|store\.shopping\.yahoo\.co\.jp|stripe|stripe\.com|uk\.shopping\.net|walmart|walmart\.com)$", "i").test(v.utmSource) || new RegExp("^(.*(([^a-df-z]|^)shop|shopping).*)$", "i").test(v.utmCampaign)) && new RegExp("^(.*cp.*|ppc|retargeting|paid.*)$", "i").test(v.utmMedium)},{"name":"paid-search","test":(v) => new RegExp("^(?:360\.cn|alice|aol|ar\.search\.yahoo\.com|ask|at\.search\.yahoo\.com|au\.search\.yahoo\.com|auone|avg|babylon|baidu|biglobe|biglobe\.co\.jp|biglobe\.ne\.jp|bing|br\.search\.yahoo\.com|ca\.search\.yahoo\.com|centrum\.cz|ch\.search\.yahoo\.com|cl\.search\.yahoo\.com|cn\.bing\.com|cnn|co\.search\.yahoo\.com|comcast|conduit|daum|daum\.net|de\.search\.yahoo\.com|dk\.search\.yahoo\.com|dogpile|dogpile\.com|duckduckgo|ecosia\.org|email\.seznam\.cz|eniro|es\.search\.yahoo\.com|espanol\.search\.yahoo\.com|exalead\.com|excite\.com|fi\.search\.yahoo\.com|firmy\.cz|fr\.search\.yahoo\.com|globo|go\.mail\.ru|google|google-play|hk\.search\.yahoo\.com|id\.search\.yahoo\.com|in\.search\.yahoo\.com|incredimail|it\.search\.yahoo\.com|kvasir|lens\.google\.com|lite\.qwant\.com|lycos|m\.baidu\.com|m\.naver\.com|m\.search\.naver\.com|m\.sogou\.com|mail\.rambler\.ru|mail\.yandex\.ru|malaysia\.search\.yahoo\.com|msn|msn\.com|mx\.search\.yahoo\.com|najdi|naver|naver\.com|news\.google\.com|nl\.search\.yahoo\.com|no\.search\.yahoo\.com|ntp\.msn\.com|nz\.search\.yahoo\.com|onet|onet\.pl|pe\.search\.yahoo\.com|ph\.search\.yahoo\.com|pl\.search\.yahoo\.com|play\.google\.com|qwant|qwant\.com|rakuten|rakuten\.co\.jp|rambler|rambler\.ru|se\.search\.yahoo\.com|search-results|search\.aol\.co\.uk|search\.aol\.com|search\.google\.com|search\.smt\.docomo\.ne\.jp|search\.ukr\.net|secureurl\.ukr\.net|seznam|seznam\.cz|sg\.search\.yahoo\.com|so\.com|sogou|sogou\.com|sp-web\.search\.auone\.jp|startsiden|startsiden\.no|suche\.aol\.de|terra|th\.search\.yahoo\.com|tr\.search\.yahoo\.com|tut\.by|tw\.search\.yahoo\.com|uk\.search\.yahoo\.com|ukr|us\.search\.yahoo\.com|virgilio|vn\.search\.yahoo\.com|wap\.sogou\.com|webmaster\.yandex\.ru|websearch\.rakuten\.co\.jp|yahoo|yahoo\.co\.jp|yahoo\.com|yandex|yandex\.by|yandex\.com|yandex\.com\.tr|yandex\.fr|yandex\.kz|yandex\.ru|yandex\.ua|yandex\.uz|zen\.yandex\.ru)$", "i").test(v.utmSource) && new RegExp("^(.*cp.*|ppc|retargeting|paid.*)$", "i").test(v.utmMedium)},{"name":"paid-social","test":(v) => new RegExp("^(?:43things|43things\.com|51\.com|5ch\.net|Hatena|ImageShack|academia\.edu|activerain|activerain\.com|activeworlds|activeworlds\.com|addthis|addthis\.com|airg\.ca|allnurses\.com|allrecipes\.com|alumniclass|alumniclass\.com|ameba\.jp|ameblo\.jp|americantowns|americantowns\.com|amp\.reddit\.com|ancestry\.com|anobii|anobii\.com|answerbag|answerbag\.com|answers\.yahoo\.com|aolanswers|aolanswers\.com|apps\.facebook\.com|ar\.pinterest\.com|artstation\.com|askubuntu|askubuntu\.com|asmallworld\.com|athlinks|athlinks\.com|away\.vk\.com|awe\.sm|b\.hatena\.ne\.jp|baby-gaga|baby-gaga\.com|babyblog\.ru|badoo|badoo\.com|bebo|bebo\.com|beforeitsnews|beforeitsnews\.com|bharatstudent|bharatstudent\.com|biip\.no|biswap\.org|bit\.ly|blackcareernetwork\.com|blackplanet|blackplanet\.com|blip\.fm|blog\.com|blog\.feedspot\.com|blog\.goo\.ne\.jp|blog\.naver\.com|blog\.yahoo\.co\.jp|blogg\.no|bloggang\.com|blogger|blogger\.com|blogher|blogher\.com|bloglines|bloglines\.com|blogs\.com|blogsome|blogsome\.com|blogspot|blogspot\.com|blogster|blogster\.com|blurtit|blurtit\.com|bookmarks\.yahoo\.co\.jp|bookmarks\.yahoo\.com|br\.pinterest\.com|brightkite|brightkite\.com|brizzly|brizzly\.com|business\.facebook\.com|buzzfeed|buzzfeed\.com|buzznet|buzznet\.com|cafe\.naver\.com|cafemom|cafemom\.com|camospace|camospace\.com|canalblog\.com|care\.com|care2|care2\.com|caringbridge\.org|catster|catster\.com|cbnt\.io|cellufun|cellufun\.com|centerblog\.net|chat\.zalo\.me|chegg\.com|chicagonow|chicagonow\.com|chiebukuro\.yahoo\.co\.jp|classmates|classmates\.com|classquest|classquest\.com|co\.pinterest\.com|cocolog-nifty|cocolog-nifty\.com|copainsdavant\.linternaute\.com|couchsurfing\.org|cozycot|cozycot\.com|cross\.tv|crunchyroll|crunchyroll\.com|cyworld|cyworld\.com|cz\.pinterest\.com|d\.hatena\.ne\.jp|dailystrength\.org|deluxe\.com|deviantart|deviantart\.com|dianping|dianping\.com|digg|digg\.com|diigo|diigo\.com|discover\.hubpages\.com|disqus|disqus\.com|dogster|dogster\.com|dol2day|dol2day\.com|doostang|doostang\.com|dopplr|dopplr\.com|douban|douban\.com|draft\.blogger\.com|draugiem\.lv|drugs-forum|drugs-forum\.com|dzone|dzone\.com|edublogs\.org|elftown|elftown\.com|epicurious\.com|everforo\.com|exblog\.jp|extole|extole\.com|facebook|facebook\.com|faceparty|faceparty\.com|fandom\.com|fanpop|fanpop\.com|fark|fark\.com|fb|fb\.me|fc2|fc2\.com|feedspot|feministing|feministing\.com|filmaffinity|filmaffinity\.com|flickr|flickr\.com|flipboard|flipboard\.com|folkdirect|folkdirect\.com|foodservice|foodservice\.com|forums\.androidcentral\.com|forums\.crackberry\.com|forums\.imore\.com|forums\.nexopia\.com|forums\.webosnation\.com|forums\.wpcentral\.com|fotki|fotki\.com|fotolog|fotolog\.com|foursquare|foursquare\.com|free\.facebook\.com|friendfeed|friendfeed\.com|fruehstueckstreff\.org|fubar|fubar\.com|gaiaonline|gaiaonline\.com|gamerdna|gamerdna\.com|gather\.com|geni\.com|getpocket\.com|glassboard|glassboard\.com|glassdoor|glassdoor\.com|godtube|godtube\.com|goldenline\.pl|goldstar|goldstar\.com|goo\.gl|gooblog|goodreads|goodreads\.com|google\+|googlegroups\.com|googleplus|govloop|govloop\.com|gowalla|gowalla\.com|gree\.jp|groups\.google\.com|gulli\.com|gutefrage\.net|habbo|habbo\.com|hi5|hi5\.com|hootsuite|hootsuite\.com|houzz|houzz\.com|hoverspot|hoverspot\.com|hr\.com|hu\.pinterest\.com|hubculture|hubculture\.com|hubpages\.com|hyves\.net|hyves\.nl|ibibo|ibibo\.com|id\.pinterest\.com|identi\.ca|ig|imageshack\.com|imageshack\.us|imvu|imvu\.com|in\.pinterest\.com|insanejournal|insanejournal\.com|instagram|instagram\.com|instapaper|instapaper\.com|internations\.org|interpals\.net|intherooms|intherooms\.com|irc-galleria\.net|is\.gd|italki|italki\.com|jammerdirect|jammerdirect\.com|jappy\.com|jappy\.de|kaboodle\.com|kakao|kakao\.com|kakaocorp\.com|kaneva|kaneva\.com|kin\.naver\.com|l\.facebook\.com|l\.instagram\.com|l\.messenger\.com|last\.fm|librarything|librarything\.com|lifestream\.aol\.com|line|line\.me|linkedin|linkedin\.com|listal|listal\.com|listography|listography\.com|livedoor\.com|livedoorblog|livejournal|livejournal\.com|lm\.facebook\.com|lnkd\.in|m\.blog\.naver\.com|m\.cafe\.naver\.com|m\.facebook\.com|m\.kin\.naver\.com|m\.vk\.com|m\.yelp\.com|mbga\.jp|medium\.com|meetin\.org|meetup|meetup\.com|meinvz\.net|meneame\.net|menuism\.com|messages\.google\.com|messages\.yahoo\.co\.jp|messenger|messenger\.com|mix\.com|mixi\.jp|mobile\.facebook\.com|mocospace|mocospace\.com|mouthshut|mouthshut\.com|movabletype|movabletype\.com|mubi|mubi\.com|my\.opera\.com|myanimelist\.net|myheritage|myheritage\.com|mylife|mylife\.com|mymodernmet|mymodernmet\.com|myspace|myspace\.com|netvibes|netvibes\.com|news\.ycombinator\.com|newsshowcase|nexopia|ngopost\.org|niconico|nicovideo\.jp|nightlifelink|nightlifelink\.com|ning|ning\.com|nl\.pinterest\.com|odnoklassniki\.ru|odnoklassniki\.ua|okwave\.jp|old\.reddit\.com|oneworldgroup\.org|onstartups|onstartups\.com|opendiary|opendiary\.com|oshiete\.goo\.ne\.jp|out\.reddit\.com|over-blog\.com|overblog\.com|paper\.li|partyflock\.nl|photobucket|photobucket\.com|pinboard|pinboard\.in|pingsta|pingsta\.com|pinterest|pinterest\.at|pinterest\.ca|pinterest\.ch|pinterest\.cl|pinterest\.co\.kr|pinterest\.co\.uk|pinterest\.com|pinterest\.com\.au|pinterest\.com\.mx|pinterest\.de|pinterest\.es|pinterest\.fr|pinterest\.it|pinterest\.jp|pinterest\.nz|pinterest\.ph|pinterest\.pt|pinterest\.ru|pinterest\.se|pixiv\.net|pl\.pinterest\.com|playahead\.se|plurk|plurk\.com|plus\.google\.com|plus\.url\.google\.com|pocket\.co|posterous|posterous\.com|pro\.homeadvisor\.com|pulse\.yahoo\.com|qapacity|qapacity\.com|quechup|quechup\.com|quora|quora\.com|qzone\.qq\.com|ravelry|ravelry\.com|reddit|reddit\.com|redux|redux\.com|renren|renren\.com|researchgate\.net|reunion|reunion\.com|reverbnation|reverbnation\.com|rtl\.de|ryze|ryze\.com|salespider|salespider\.com|scoop\.it|screenrant|screenrant\.com|scribd|scribd\.com|scvngr|scvngr\.com|secondlife|secondlife\.com|serverfault|serverfault\.com|shareit|sharethis|sharethis\.com|shvoong\.com|sites\.google\.com|skype|skyrock|skyrock\.com|slashdot\.org|slideshare\.net|smartnews\.com|snapchat|snapchat\.com|social|sociallife\.com\.br|socialvibe|socialvibe\.com|spaces\.live\.com|spoke|spoke\.com|spruz|spruz\.com|ssense\.com|stackapps|stackapps\.com|stackexchange|stackexchange\.com|stackoverflow|stackoverflow\.com|stardoll\.com|stickam|stickam\.com|studivz\.net|suomi24\.fi|superuser|superuser\.com|sweeva|sweeva\.com|t\.co|t\.me|tagged|tagged\.com|taggedmail|taggedmail\.com|talkbiznow|talkbiznow\.com|taringa\.net|techmeme|techmeme\.com|tencent|tencent\.com|tiktok|tiktok\.com|tinyurl|tinyurl\.com|toolbox|toolbox\.com|touch\.facebook\.com|tr\.pinterest\.com|travellerspoint|travellerspoint\.com|tripadvisor|tripadvisor\.com|trombi|trombi\.com|trustpilot|tudou|tudou\.com|tuenti|tuenti\.com|tumblr|tumblr\.com|tweetdeck|tweetdeck\.com|twitter|twitter\.com|twoo\.com|typepad|typepad\.com|unblog\.fr|urbanspoon\.com|ushareit\.com|ushi\.cn|vampirefreaks|vampirefreaks\.com|vampirerave|vampirerave\.com|vg\.no|video\.ibm\.com|vk\.com|vkontakte\.ru|wakoopa|wakoopa\.com|wattpad|wattpad\.com|web\.facebook\.com|web\.skype\.com|webshots|webshots\.com|wechat|wechat\.com|weebly|weebly\.com|weibo|weibo\.com|wer-weiss-was\.de|weread|weread\.com|whatsapp|whatsapp\.com|wiki\.answers\.com|wikihow\.com|wikitravel\.org|woot\.com|wordpress|wordpress\.com|wordpress\.org|xanga|xanga\.com|xing|xing\.com|yahoo-mbga\.jp|yammer|yammer\.com|yelp|yelp\.co\.uk|yelp\.com|youroom\.in|za\.pinterest\.com|zalo|zoo\.gr|zooppa|zooppa\.com)$", "i").test(v.utmSource) && new RegExp("^(.*cp.*|ppc|retargeting|paid.*)$", "i").test(v.utmMedium)},{"name":"paid-video","test":(v) => new RegExp("^(?:blog\.twitch\.tv|crackle|crackle\.com|curiositystream|curiositystream\.com|d\.tube|dailymotion|dailymotion\.com|dashboard\.twitch\.tv|disneyplus|disneyplus\.com|fast\.wistia\.net|help\.hulu\.com|help\.netflix\.com|hulu|hulu\.com|id\.twitch\.tv|iq\.com|iqiyi|iqiyi\.com|jobs\.netflix\.com|justin\.tv|m\.twitch\.tv|m\.youtube\.com|music\.youtube\.com|netflix|netflix\.com|player\.twitch\.tv|player\.vimeo\.com|ted|ted\.com|twitch|twitch\.tv|utreon|utreon\.com|veoh|veoh\.com|viadeo\.journaldunet\.com|vimeo|vimeo\.com|wistia|wistia\.com|youku|youku\.com|youtube|youtube\.com)$", "i").test(v.utmSource) && new RegExp("^(.*cp.*|ppc|retargeting|paid.*)$", "i").test(v.utmMedium)},{"name":"display","test":(v) => new RegExp("^(?:display|banner|expandable|interstitial|cpm)$", "i").test(v.utmMedium)},{"name":"paid-other","test":(v) => new RegExp("^(.*cp.*|ppc|retargeting|paid.*)$", "i").test(v.utmMedium)},{"name":"organic-shopping","test":(v) => new RegExp("^(?:360\.cn|alice|aol|ar\.search\.yahoo\.com|ask|at\.search\.yahoo\.com|au\.search\.yahoo\.com|auone|avg|babylon|baidu|biglobe|biglobe\.co\.jp|biglobe\.ne\.jp|bing|br\.search\.yahoo\.com|ca\.search\.yahoo\.com|centrum\.cz|ch\.search\.yahoo\.com|cl\.search\.yahoo\.com|cn\.bing\.com|cnn|co\.search\.yahoo\.com|comcast|conduit|daum|daum\.net|de\.search\.yahoo\.com|dk\.search\.yahoo\.com|dogpile|dogpile\.com|duckduckgo|ecosia\.org|email\.seznam\.cz|eniro|es\.search\.yahoo\.com|espanol\.search\.yahoo\.com|exalead\.com|excite\.com|fi\.search\.yahoo\.com|firmy\.cz|fr\.search\.yahoo\.com|globo|go\.mail\.ru|google|google-play|hk\.search\.yahoo\.com|id\.search\.yahoo\.com|in\.search\.yahoo\.com|incredimail|it\.search\.yahoo\.com|kvasir|lens\.google\.com|lite\.qwant\.com|lycos|m\.baidu\.com|m\.naver\.com|m\.search\.naver\.com|m\.sogou\.com|mail\.rambler\.ru|mail\.yandex\.ru|malaysia\.search\.yahoo\.com|msn|msn\.com|mx\.search\.yahoo\.com|najdi|naver|naver\.com|news\.google\.com|nl\.search\.yahoo\.com|no\.search\.yahoo\.com|ntp\.msn\.com|nz\.search\.yahoo\.com|onet|onet\.pl|pe\.search\.yahoo\.com|ph\.search\.yahoo\.com|pl\.search\.yahoo\.com|play\.google\.com|qwant|qwant\.com|rakuten|rakuten\.co\.jp|rambler|rambler\.ru|se\.search\.yahoo\.com|search-results|search\.aol\.co\.uk|search\.aol\.com|search\.google\.com|search\.smt\.docomo\.ne\.jp|search\.ukr\.net|secureurl\.ukr\.net|seznam|seznam\.cz|sg\.search\.yahoo\.com|so\.com|sogou|sogou\.com|sp-web\.search\.auone\.jp|startsiden|startsiden\.no|suche\.aol\.de|terra|th\.search\.yahoo\.com|tr\.search\.yahoo\.com|tut\.by|tw\.search\.yahoo\.com|uk\.search\.yahoo\.com|ukr|us\.search\.yahoo\.com|virgilio|vn\.search\.yahoo\.com|wap\.sogou\.com|webmaster\.yandex\.ru|websearch\.rakuten\.co\.jp|yahoo|yahoo\.co\.jp|yahoo\.com|yandex|yandex\.by|yandex\.com|yandex\.com\.tr|yandex\.fr|yandex\.kz|yandex\.ru|yandex\.ua|yandex\.uz|zen\.yandex\.ru)$", "i").test(v.utmSource) || new RegExp("^(.*(([^a-df-z]|^)shop|shopping).*)$", "i").test(v.utmCampaign)},{"name":"organic-social","test":(v) => new RegExp("^(?:43things|43things\.com|51\.com|5ch\.net|Hatena|ImageShack|academia\.edu|activerain|activerain\.com|activeworlds|activeworlds\.com|addthis|addthis\.com|airg\.ca|allnurses\.com|allrecipes\.com|alumniclass|alumniclass\.com|ameba\.jp|ameblo\.jp|americantowns|americantowns\.com|amp\.reddit\.com|ancestry\.com|anobii|anobii\.com|answerbag|answerbag\.com|answers\.yahoo\.com|aolanswers|aolanswers\.com|apps\.facebook\.com|ar\.pinterest\.com|artstation\.com|askubuntu|askubuntu\.com|asmallworld\.com|athlinks|athlinks\.com|away\.vk\.com|awe\.sm|b\.hatena\.ne\.jp|baby-gaga|baby-gaga\.com|babyblog\.ru|badoo|badoo\.com|bebo|bebo\.com|beforeitsnews|beforeitsnews\.com|bharatstudent|bharatstudent\.com|biip\.no|biswap\.org|bit\.ly|blackcareernetwork\.com|blackplanet|blackplanet\.com|blip\.fm|blog\.com|blog\.feedspot\.com|blog\.goo\.ne\.jp|blog\.naver\.com|blog\.yahoo\.co\.jp|blogg\.no|bloggang\.com|blogger|blogger\.com|blogher|blogher\.com|bloglines|bloglines\.com|blogs\.com|blogsome|blogsome\.com|blogspot|blogspot\.com|blogster|blogster\.com|blurtit|blurtit\.com|bookmarks\.yahoo\.co\.jp|bookmarks\.yahoo\.com|br\.pinterest\.com|brightkite|brightkite\.com|brizzly|brizzly\.com|business\.facebook\.com|buzzfeed|buzzfeed\.com|buzznet|buzznet\.com|cafe\.naver\.com|cafemom|cafemom\.com|camospace|camospace\.com|canalblog\.com|care\.com|care2|care2\.com|caringbridge\.org|catster|catster\.com|cbnt\.io|cellufun|cellufun\.com|centerblog\.net|chat\.zalo\.me|chegg\.com|chicagonow|chicagonow\.com|chiebukuro\.yahoo\.co\.jp|classmates|classmates\.com|classquest|classquest\.com|co\.pinterest\.com|cocolog-nifty|cocolog-nifty\.com|copainsdavant\.linternaute\.com|couchsurfing\.org|cozycot|cozycot\.com|cross\.tv|crunchyroll|crunchyroll\.com|cyworld|cyworld\.com|cz\.pinterest\.com|d\.hatena\.ne\.jp|dailystrength\.org|deluxe\.com|deviantart|deviantart\.com|dianping|dianping\.com|digg|digg\.com|diigo|diigo\.com|discover\.hubpages\.com|disqus|disqus\.com|dogster|dogster\.com|dol2day|dol2day\.com|doostang|doostang\.com|dopplr|dopplr\.com|douban|douban\.com|draft\.blogger\.com|draugiem\.lv|drugs-forum|drugs-forum\.com|dzone|dzone\.com|edublogs\.org|elftown|elftown\.com|epicurious\.com|everforo\.com|exblog\.jp|extole|extole\.com|facebook|facebook\.com|faceparty|faceparty\.com|fandom\.com|fanpop|fanpop\.com|fark|fark\.com|fb|fb\.me|fc2|fc2\.com|feedspot|feministing|feministing\.com|filmaffinity|filmaffinity\.com|flickr|flickr\.com|flipboard|flipboard\.com|folkdirect|folkdirect\.com|foodservice|foodservice\.com|forums\.androidcentral\.com|forums\.crackberry\.com|forums\.imore\.com|forums\.nexopia\.com|forums\.webosnation\.com|forums\.wpcentral\.com|fotki|fotki\.com|fotolog|fotolog\.com|foursquare|foursquare\.com|free\.facebook\.com|friendfeed|friendfeed\.com|fruehstueckstreff\.org|fubar|fubar\.com|gaiaonline|gaiaonline\.com|gamerdna|gamerdna\.com|gather\.com|geni\.com|getpocket\.com|glassboard|glassboard\.com|glassdoor|glassdoor\.com|godtube|godtube\.com|goldenline\.pl|goldstar|goldstar\.com|goo\.gl|gooblog|goodreads|goodreads\.com|google\+|googlegroups\.com|googleplus|govloop|govloop\.com|gowalla|gowalla\.com|gree\.jp|groups\.google\.com|gulli\.com|gutefrage\.net|habbo|habbo\.com|hi5|hi5\.com|hootsuite|hootsuite\.com|houzz|houzz\.com|hoverspot|hoverspot\.com|hr\.com|hu\.pinterest\.com|hubculture|hubculture\.com|hubpages\.com|hyves\.net|hyves\.nl|ibibo|ibibo\.com|id\.pinterest\.com|identi\.ca|ig|imageshack\.com|imageshack\.us|imvu|imvu\.com|in\.pinterest\.com|insanejournal|insanejournal\.com|instagram|instagram\.com|instapaper|instapaper\.com|internations\.org|interpals\.net|intherooms|intherooms\.com|irc-galleria\.net|is\.gd|italki|italki\.com|jammerdirect|jammerdirect\.com|jappy\.com|jappy\.de|kaboodle\.com|kakao|kakao\.com|kakaocorp\.com|kaneva|kaneva\.com|kin\.naver\.com|l\.facebook\.com|l\.instagram\.com|l\.messenger\.com|last\.fm|librarything|librarything\.com|lifestream\.aol\.com|line|line\.me|linkedin|linkedin\.com|listal|listal\.com|listography|listography\.com|livedoor\.com|livedoorblog|livejournal|livejournal\.com|lm\.facebook\.com|lnkd\.in|m\.blog\.naver\.com|m\.cafe\.naver\.com|m\.facebook\.com|m\.kin\.naver\.com|m\.vk\.com|m\.yelp\.com|mbga\.jp|medium\.com|meetin\.org|meetup|meetup\.com|meinvz\.net|meneame\.net|menuism\.com|messages\.google\.com|messages\.yahoo\.co\.jp|messenger|messenger\.com|mix\.com|mixi\.jp|mobile\.facebook\.com|mocospace|mocospace\.com|mouthshut|mouthshut\.com|movabletype|movabletype\.com|mubi|mubi\.com|my\.opera\.com|myanimelist\.net|myheritage|myheritage\.com|mylife|mylife\.com|mymodernmet|mymodernmet\.com|myspace|myspace\.com|netvibes|netvibes\.com|news\.ycombinator\.com|newsshowcase|nexopia|ngopost\.org|niconico|nicovideo\.jp|nightlifelink|nightlifelink\.com|ning|ning\.com|nl\.pinterest\.com|odnoklassniki\.ru|odnoklassniki\.ua|okwave\.jp|old\.reddit\.com|oneworldgroup\.org|onstartups|onstartups\.com|opendiary|opendiary\.com|oshiete\.goo\.ne\.jp|out\.reddit\.com|over-blog\.com|overblog\.com|paper\.li|partyflock\.nl|photobucket|photobucket\.com|pinboard|pinboard\.in|pingsta|pingsta\.com|pinterest|pinterest\.at|pinterest\.ca|pinterest\.ch|pinterest\.cl|pinterest\.co\.kr|pinterest\.co\.uk|pinterest\.com|pinterest\.com\.au|pinterest\.com\.mx|pinterest\.de|pinterest\.es|pinterest\.fr|pinterest\.it|pinterest\.jp|pinterest\.nz|pinterest\.ph|pinterest\.pt|pinterest\.ru|pinterest\.se|pixiv\.net|pl\.pinterest\.com|playahead\.se|plurk|plurk\.com|plus\.google\.com|plus\.url\.google\.com|pocket\.co|posterous|posterous\.com|pro\.homeadvisor\.com|pulse\.yahoo\.com|qapacity|qapacity\.com|quechup|quechup\.com|quora|quora\.com|qzone\.qq\.com|ravelry|ravelry\.com|reddit|reddit\.com|redux|redux\.com|renren|renren\.com|researchgate\.net|reunion|reunion\.com|reverbnation|reverbnation\.com|rtl\.de|ryze|ryze\.com|salespider|salespider\.com|scoop\.it|screenrant|screenrant\.com|scribd|scribd\.com|scvngr|scvngr\.com|secondlife|secondlife\.com|serverfault|serverfault\.com|shareit|sharethis|sharethis\.com|shvoong\.com|sites\.google\.com|skype|skyrock|skyrock\.com|slashdot\.org|slideshare\.net|smartnews\.com|snapchat|snapchat\.com|social|sociallife\.com\.br|socialvibe|socialvibe\.com|spaces\.live\.com|spoke|spoke\.com|spruz|spruz\.com|ssense\.com|stackapps|stackapps\.com|stackexchange|stackexchange\.com|stackoverflow|stackoverflow\.com|stardoll\.com|stickam|stickam\.com|studivz\.net|suomi24\.fi|superuser|superuser\.com|sweeva|sweeva\.com|t\.co|t\.me|tagged|tagged\.com|taggedmail|taggedmail\.com|talkbiznow|talkbiznow\.com|taringa\.net|techmeme|techmeme\.com|tencent|tencent\.com|tiktok|tiktok\.com|tinyurl|tinyurl\.com|toolbox|toolbox\.com|touch\.facebook\.com|tr\.pinterest\.com|travellerspoint|travellerspoint\.com|tripadvisor|tripadvisor\.com|trombi|trombi\.com|trustpilot|tudou|tudou\.com|tuenti|tuenti\.com|tumblr|tumblr\.com|tweetdeck|tweetdeck\.com|twitter|twitter\.com|twoo\.com|typepad|typepad\.com|unblog\.fr|urbanspoon\.com|ushareit\.com|ushi\.cn|vampirefreaks|vampirefreaks\.com|vampirerave|vampirerave\.com|vg\.no|video\.ibm\.com|vk\.com|vkontakte\.ru|wakoopa|wakoopa\.com|wattpad|wattpad\.com|web\.facebook\.com|web\.skype\.com|webshots|webshots\.com|wechat|wechat\.com|weebly|weebly\.com|weibo|weibo\.com|wer-weiss-was\.de|weread|weread\.com|whatsapp|whatsapp\.com|wiki\.answers\.com|wikihow\.com|wikitravel\.org|woot\.com|wordpress|wordpress\.com|wordpress\.org|xanga|xanga\.com|xing|xing\.com|yahoo-mbga\.jp|yammer|yammer\.com|yelp|yelp\.co\.uk|yelp\.com|youroom\.in|za\.pinterest\.com|zalo|zoo\.gr|zooppa|zooppa\.com)$", "i").test(v.utmSource) || new RegExp("^(?:social|social-network|social-media|sm|social network|social media)$", "i").test(v.utmMedium)},{"name":"organic-video","test":(v) => new RegExp("^(?:blog\.twitch\.tv|crackle|crackle\.com|curiositystream|curiositystream\.com|d\.tube|dailymotion|dailymotion\.com|dashboard\.twitch\.tv|disneyplus|disneyplus\.com|fast\.wistia\.net|help\.hulu\.com|help\.netflix\.com|hulu|hulu\.com|id\.twitch\.tv|iq\.com|iqiyi|iqiyi\.com|jobs\.netflix\.com|justin\.tv|m\.twitch\.tv|m\.youtube\.com|music\.youtube\.com|netflix|netflix\.com|player\.twitch\.tv|player\.vimeo\.com|ted|ted\.com|twitch|twitch\.tv|utreon|utreon\.com|veoh|veoh\.com|viadeo\.journaldunet\.com|vimeo|vimeo\.com|wistia|wistia\.com|youku|youku\.com|youtube|youtube\.com)$", "i").test(v.utmSource) || new RegExp("^(.*video.*)$", "i").test(v.utmMedium)},{"name":"organic-search","test":(v) => new RegExp("^(?:360\.cn|alice|aol|ar\.search\.yahoo\.com|ask|at\.search\.yahoo\.com|au\.search\.yahoo\.com|auone|avg|babylon|baidu|biglobe|biglobe\.co\.jp|biglobe\.ne\.jp|bing|br\.search\.yahoo\.com|ca\.search\.yahoo\.com|centrum\.cz|ch\.search\.yahoo\.com|cl\.search\.yahoo\.com|cn\.bing\.com|cnn|co\.search\.yahoo\.com|comcast|conduit|daum|daum\.net|de\.search\.yahoo\.com|dk\.search\.yahoo\.com|dogpile|dogpile\.com|duckduckgo|ecosia\.org|email\.seznam\.cz|eniro|es\.search\.yahoo\.com|espanol\.search\.yahoo\.com|exalead\.com|excite\.com|fi\.search\.yahoo\.com|firmy\.cz|fr\.search\.yahoo\.com|globo|go\.mail\.ru|google|google-play|hk\.search\.yahoo\.com|id\.search\.yahoo\.com|in\.search\.yahoo\.com|incredimail|it\.search\.yahoo\.com|kvasir|lens\.google\.com|lite\.qwant\.com|lycos|m\.baidu\.com|m\.naver\.com|m\.search\.naver\.com|m\.sogou\.com|mail\.rambler\.ru|mail\.yandex\.ru|malaysia\.search\.yahoo\.com|msn|msn\.com|mx\.search\.yahoo\.com|najdi|naver|naver\.com|news\.google\.com|nl\.search\.yahoo\.com|no\.search\.yahoo\.com|ntp\.msn\.com|nz\.search\.yahoo\.com|onet|onet\.pl|pe\.search\.yahoo\.com|ph\.search\.yahoo\.com|pl\.search\.yahoo\.com|play\.google\.com|qwant|qwant\.com|rakuten|rakuten\.co\.jp|rambler|rambler\.ru|se\.search\.yahoo\.com|search-results|search\.aol\.co\.uk|search\.aol\.com|search\.google\.com|search\.smt\.docomo\.ne\.jp|search\.ukr\.net|secureurl\.ukr\.net|seznam|seznam\.cz|sg\.search\.yahoo\.com|so\.com|sogou|sogou\.com|sp-web\.search\.auone\.jp|startsiden|startsiden\.no|suche\.aol\.de|terra|th\.search\.yahoo\.com|tr\.search\.yahoo\.com|tut\.by|tw\.search\.yahoo\.com|uk\.search\.yahoo\.com|ukr|us\.search\.yahoo\.com|virgilio|vn\.search\.yahoo\.com|wap\.sogou\.com|webmaster\.yandex\.ru|websearch\.rakuten\.co\.jp|yahoo|yahoo\.co\.jp|yahoo\.com|yandex|yandex\.by|yandex\.com|yandex\.com\.tr|yandex\.fr|yandex\.kz|yandex\.ru|yandex\.ua|yandex\.uz|zen\.yandex\.ru)$", "i").test(v.utmSource) || v.utmMedium.toLowerCase() === "organic"},{"name":"referral","test":(v) => new RegExp("^(?:referral|app|link)$", "i").test(v.utmMedium)},{"name":"email","test":(v) => new RegExp("^(?:email|e-mail|e_mail|e mail)$", "i").test(v.utmMedium) || new RegExp("^(?:email|e-mail|e_mail|e mail)$", "i").test(v.utmSource)},{"name":"affiliate","test":(v) => v.utmMedium.toLowerCase() === "affiliate"},{"name":"audio","test":(v) => v.utmMedium.toLowerCase() === "audio"},{"name":"sms","test":(v) => v.utmSource.toLowerCase() === "sms" || v.utmMedium.toLowerCase() === "sms"},{"name":"mobile-push-notification","test":(v) => v.utmSource.toLowerCase() === "firebase" || new RegExp("(?:.*mobile.*|.*notification.*|push$)", "i").test(v.utmMedium)}].find(i=>i.test(t)))==null?void 0:s.name)??"other"}getShopifyAnalyticsId(){return this.getCookie("_shopify_y")}legacyGetCookieVisitor(){const t=this.getCookie("SHOPLIFT");return t===null?null:JSON.parse(t,f)}getCookie(t){const e=this.cookie.split("; ").filter(s=>s.split("=").at(0)===t).at(0);return e===void 0?null:e.split("=").slice(1).join("=")}monitorConsentChange(){document.addEventListener("visitorConsentCollected",t=>void(async()=>await this.onConsentChange(t.detail.analyticsAllowed,!0))()),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>this.loadShopifyConsentApiWithRetry()):this.loadShopifyConsentApiWithRetry()}loadShopifyConsentApiWithRetry(){let t=0;const e=()=>{this.loadShopifyConsentApi()||t++<10&&window.setTimeout(e,100)};e()}loadShopifyConsentApi(){if(window.Shopify){this.log("Loading Shopify features");const t=async()=>{if(!window.Shopify){this.log("Shopify object missing... suddenly?");return}if(window.Shopify.customerPrivacy===void 0){this.log("Shopify CustomerPrivacy api still missing, trying again in 1000ms"),e=window.setTimeout(()=>void(async()=>await t())(),1e3);return}const s=window.Shopify.customerPrivacy.getTrackingConsent();await this.onConsentChange(window.Shopify.customerPrivacy.analyticsProcessingAllowed(),s==="yes")};let e=window.setTimeout(()=>void(async()=>await t())(),5e3);return window.Shopify.loadFeatures([{name:"consent-tracking-api",version:"0.1"}],s=>{(async()=>{if(window.clearTimeout(e),s){this.log("Error loading consent tracking",s);return}await t()})()}),!0}return!1}async onConsentChange(t,e){try{if(this.log("Consent change detected"),this.state.essential.consentApproved=t,this.state.essential.hasConsentInteraction=e,!this.state.essential.consentApproved){this.state.essential.hasConsentInteraction&&(this.state.analytics.queue.length=0),this.saveState();return}this.cookie=document.cookie,this.shopifyAnalyticsId=this.getShopifyAnalyticsId();for(const s of this.state.analytics.queue.filter(i=>i.type===1||i.type===2)){const i=s;i.shopifyAnalyticsId=this.shopifyAnalyticsId}this.saveState(),await this.syncAllEvents()}catch(s){this.log("Error syncing on consent change",s)}}isThemePreview(){return isThemePreview||themeRole!=="main"}clearThemeBar(t,e,s){const i=structuredClone(s);this.log("Looking for theme bar"),this.waitForElement(null,"body").then(o=>this.waitForElement(o,"#preview-bar-iframe, #PBarNextFrameWrapper").then(n=>(this.log("Found theme bar"),e&&(this.log("Removing theme bar"),n.remove()),t?this.makeRequest({url:`${this.eventHost}/api/v0/logs`,method:"post",data:JSON.stringify({...this.debugState(),stateAtEvaluation:i},w)}):Promise.resolve(null)))).catch(o=>console.error(o))}waitForElement(t,e){return new Promise(s=>{const i=document.querySelector(e);if(i){s(i);return}const o=new MutationObserver(n=>{const a=document.querySelector(e);if(a){o.disconnect(),s(a);return}});o.observe(t??document.documentElement,{childList:!0})})}setDebug(t){this.state.essential.debugMode=t,this.saveState()}log(t,...e){this.logHistory.push([`[SL] ${t}`,...e.map(s=>JSON.stringify(s))].join(" ")),!(!this.state.essential.debugMode&&!this.shopliftDebug)&&console.debug(`[SL] ${t}`,...e)}debugState(){return{state:this.state,storage:{essential:this.loadLocalStorage(this.essentialSessionKey),analytics:this.loadLocalStorage(this.analyticsSessionKey)},params:{shop:this.shop,host:this.host,eventHost:this.eventHost,cssHideClass:this.cssHideClass,testConfigs:this.testConfigs,inactiveTestConfigs:this.inactiveTestConfigs,sendPageView:this.sendPageView,isShopifyMerchantCookie:this.getCookie("is_shopify_merchant"),themeId,url:window.location.href,isThemePreview,themeRole},logHistory:this.logHistory}}debug(){const t=this.debugState();console.log(JSON.stringify(t,w,2))}}(async function(){window.shopliftInstance||(window.shopliftInstance=new z("homeceuconnection.myshopify.com","https://app.shoplift.ai","https://events.shoplift.ai",true,false,false,false,false,1000,[{"id":"892989f7-4465-454b-98e9-1a2260ede184","startAt":"2025-08-04T13:46:52.439301Z","requiresCountry":false,"device":"all","status":"active","visitorOption":"all","ignoreTestViewParameterEnforcement":false,"statusHistory":[{"status":"active","createdAt":"2025-08-04T13:46:52.44312Z"}],"hypotheses":[{"visitorCount":1997,"trafficPercentage":0.5,"title":"Original","domSelectors":[],"id":"f25c81e1-7a1c-4955-8d51-369cfb8155ff","type":"index","themeId":181600321824,"affix":"","isControl":true,"redirectPath":null},{"visitorCount":1953,"trafficPercentage":0.5,"title":"Module Moved Up","domSelectors":[],"id":"471ca887-1246-425c-bb0f-7c2b106dd276","type":"index","themeId":181600321824,"affix":"sl-F882EFF3","isControl":false,"redirectPath":null}],"targetAudiences":[],"title":"AB-25081: HomeCEU Homepage Most Popular Module Mov"}],[]),await window.shopliftInstance.init())})()})(); })("/", { suffix: "", type: "article" }, "main", 181600321824, false)</script>
Dementia and the Occupational Therapist – HomeCEU
Skip to content
Dementia and the Occupational Therapist
OTs work holistically with individuals with dementia to achieve the highest quality of life for the patient.
Dementia is a neurocognitive disorder (NCD) that affects millions of people in the United States (American Psychiatric Association [APA], 2013). According to the Diagnostic and Statistical Manual of Mental Disorders, 5th edition (DSM-5, 2013) criteria for NCDs are based upon five domains. Both minor and major NCD fall into these domains.
Complex attention: Sustained (over time), selective (filtered), divided (multiple), processing speed
Executive function: Planning, decision making, working memory (or immediate memory; holding and manipulating information), feedback and error correction, overriding habits and inhibition, mental flexibility (shifting between concepts)
Learning and memory: Recent memory, long-term memory
Language: Expressive and receptive
Perceptual motor: Visuoconstructional, motor, praxis
Social cognition: Recognition of emotions, theory of mind
Recommended course: Dementia Care Practice Recommendations: Clinical Practices to Ensure Compliance Requirements
Minor and major NCD
The DSM-5 defines a minor NCD as known cognitive deficits not attributed to other mental disorders, such as delirium or depression. These are not sufficient to impact independence in activities of daily living (e.g., self-care tasks, medicine management, driving etc.) or instrumental activities of daily living (e.g., cooking, cleaning, finances etc.).
During a formal diagnostic assessment, a person with mild NCD would score one to two standard deviations below the norm.
A major NCD describes a substantial functional cognitive decline and performance on diagnostic assessments as two or more standard deviations below the norm. A decrease in occupational performance levels evidences a major NCD. This requires progressive assistance.
Measuring cognitive decline
Common standardized tools healthcare providers use include:
Occupational therapists to investigate changes in cognition include the Short Test of Mental Status (STMS)
Montreal Cognitive Assessment (MoCA)
Mini-Mental State Examination (MMSE)
Short Blessed Test
The Saint Louis University Mental Status (SLUM) examination
Allen Cognitive Level (ACL) Screen
Cognitive Assessment of Minnesota
Confusion Assessment Method for the ICU (CAM-ICU)
A prominent difference between mild and major NCD is the level of decline in functional cognition and its impact on daily performance. Dementia is considered to be a major NCD according to the DSM-5.
Dementia vs. normal aging
It is imperative to distinguish dementia from normal age-related brain changes and dementia-like symptoms. Other medical conditions such as thyroid irregularity, depression, vitamin deficiencies, and normal pressure hydrocephalus often present with dementia-like symptoms such as decreased functional cognition. Yet these symptoms are reversible, unlike dementia.
Medical conditions like these, or other precipitating factors such as an infection (like a urinary tract infection or sepsis) can often present with a sudden onset of cognitive deficits. This is caused by inflammation in the body and disturbances in blood/oxygen flow to the brain.
However, unlike dementia or major NCD, the cognitive decline associated with delirium is short-term and reversible. In cases of a UTI, the infection clears up after the patient begins antibiotics, and the cognitive deficits usually resolve quickly.
The DMS-5 describes delirium as a disruption in attention and awareness. A patient might present with confusion, agitation and disorientation. Symptoms of delirium can even vary throughout the day. They fall into several categories:
Hyperactive (restlessness, agitation, irritability, etc.)
Hypoactive (poor arousal, withdrawn, etc.)
Mixed delirium, meaning that they can show symptoms of both hyper and hypo and may fluctuate randomly between the two types
Types of dementia
Although Alzheimer’s disease is the most frequent cause of dementia (accounting for 60-80% of all cases), according to the National Institute on Aging, there are other types of dementia. These include frontotemporal dementia, Lewy Body Dementia, and Vascular Dementia.
There are also other progressive medical conditions that can portray dementia-like symptoms such as Parkinson’s Disease dementia, Huntington’s Disease dementia, Korsakoff Syndrome, and Normal Pressure Hydrocephalous.
Alzheimer’s disease
Alzheimer’s is a major degenerative brain disease caused by complex brain changes following cell damage. It leads to dementia symptoms that slowly worsen over time. The Alzheimer’s Association describes the progression of Alzheimer’s dementia by three stages:
Early or mild
Middle or moderate
Late or severe
In the early stages, a person can still function independently. They may begin to show some decline, only noticeable by close friends or family. This may include trouble finding words, misplacing objects, trouble with executive functioning, getting lost during normal routes etc.
The middle or moderate stage of Alzheimer’s occurs when the person has more difficulty with daily tasks and needs greater assistance. They may experience confusion, forgetfulness, have changes in mood or behavior, and have changes in sleep patterns.
In late-stage Alzheimer’s disease (severe), a person requires 24/7 assistance with all areas of occupational performance. Eventually they lose the ability to walk, talk, swallow, and even control their breathing.
Recommended course: Alzheimer’s Disease and Related Disorders in Occupational Therapy Practice, 3rd edition
Caring for dementia patients
In 2018, the Alzheimer’s Association published Dementia Care Practice Recommendations to review the evidence for best practice and quality of care. These recommendations include:
Person-centered care
Early detection and diagnosis
Assessment and care planning
Medical management
Care partner information, education, and support
Management of behavioral and psychological symptoms and activities of daily living
Appropriate staff ratios and training in care facilities
Creation of dignified and therapeutic environments
Service coordination and ease with transitions throughout the continuum of care
The role of the occupational therapist
The occupational therapy practitioner is integrated throughout these recommendations. OTs work holistically with individuals and their families to achieve the highest quality of life for the patient. In the early stages of dementia, occupational therapists can implement compensatory training to help a person maintain independence. Such training may involve the use of schedules, environmental modifications such as labels and signage, and training on apps on via smart devices, and other memory aids.
In the middle to late stages of dementia, occupational therapists can provide family and caregiver training on how to use verbal and visual cues, provide partial or full assistance to daily tasks including safe functional transfers and proper positioning to prevent joint contractures and skin breakdown. The American Occupational Therapy Association (AOTA) also has published practice guidelines, titled Occupational Therapy Practice Guidelines for Adults with Alzheimer’s Disease and Related Major Neurocognitive Disorders , available via the AOTA website.
For additional information, please check out the following resources:Alzheimer’s Association National Institute on Aging
This article was written by Elizabeth D. DeIuliis, OTD, OTR/L, CLA, FNAP.
This article was written by Mehreen Rizvi