var aliaLauncher=function(exports){"use strict";var R=Object.defineProperty;var k=(e,t,r)=>t in e?R(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var m=(e,t,r)=>k(e,typeof t!="symbol"?t+"":t,r);function assertNever(e,t){throw new Error(`Unhandled discriminated union member: ${JSON.stringify(e)}`)}const JWT_HEADER="x-alia-jwt",SHOP_HEADER="x-alia-shop",SHOPIFY_CUSTOMER_ID_HEADER="x-alia-shopify-customer-id",PREVIEW_KEY_HEADER="x-alia-preview-key";function glob(e,t){return new RegExp("^"+e.replace(/([.?+^$[\]\\(){}|/-])/g,"\\$1").replace(/\*/g,".*")+"$").test(t)}const getStorage=e=>e==="local"?localStorage:sessionStorage;function getFromStorage(e,t){try{const n=getStorage(e).getItem(t);return n?JSON.parse(n):null}catch(r){return console.error(`Error getting ${t} from ${e}Storage:`,r),null}}function setInStorage(e,t,r){try{getStorage(e).setItem(t,JSON.stringify(r))}catch(n){console.error(`Error setting ${t} in ${e}Storage:`,n)}}function unknownErrToStr(e){return typeof e=="string"?e:e instanceof Error?e.message:typeof e=="object"&&e!==null&&"error"in e&&typeof e.error=="string"?e.error:"An unknown error occurred"}async function wait(e){return new Promise(t=>setTimeout(t,e))}async function timeout(e,t){return Promise.race([wait(e),t()])}function createSDKMessages(e){const t=o(e)?e:[],r=new Map;function n(...u){var f;t.push(...u);for(const h of u)(f=r.get(h.type))==null||f.forEach(p=>p(h))}function s({type:u,callback:f,retroactive:h=!1}){const p=f,y=r.get(u)??[];return y.push(p),r.set(u,y),h&&t.filter(l=>l.type===u).forEach(p),()=>{r.set(u,y.filter(v=>v!==f))}}function a(u){n({type:"open",triggerID:u})}function i(){n({type:"close"})}return{push:n,listen:s,open:a,close:i};function c(u){return typeof u=="object"&&u!==null&&"type"in u&&typeof u.type=="string"}function o(u){return Array.isArray(u)&&u.every(c)}}const getDocument=()=>document;function getWindowProperty(e){return window[e]}function setWindowProperty(e,t){window[e]=t}async function loadScript(e){return new Promise((t,r)=>{const n=getDocument().createElement("script");n.src=e,n.async=!0,n.onload=()=>t(n),n.onerror=()=>r(new Error("Failed to load Alia script")),getDocument().head.appendChild(n)})}class Logger{constructor(){m(this,"debugExtensionEnabled",!1);m(this,"appName","launcher");window.postMessage({type:"alia:loaded"},"*"),window.addEventListener("message",t=>{t.data&&t.data.type==="alia:debug_extension_enabled"&&(this.debugExtensionEnabled=!0)})}log(...t){console.log(`[Alia ${this.appName}]`,...t)}debug(...t){this.debugExtensionEnabled&&console.log(`%c[Alia ${this.appName} debug]`,"color: cyan",...t)}error(...t){console.error(`[Alia ${this.appName}]`,...t)}}const logger=new Logger;function attempt(e){try{e()}catch(t){logger.error(t)}}function interceptNavigation({onLinkClick:e,onHistoryChange:t}){getDocument().addEventListener("click",s=>{if(s.target instanceof HTMLElement){const a=s.target.closest("a");a&&(e==null||e(a))}});const r=history.pushState;history.pushState=function(s,a,i){let c;try{c=t==null?void 0:t(i)}catch(o){logger.error("Error intercepting navigation",o)}return r.call(this,s,a,c??i)};const n=history.replaceState;history.replaceState=function(s,a,i){let c;try{c=t==null?void 0:t(i)}catch(o){logger.error("Error intercepting navigation",o)}return n.call(this,s,a,c??i)}}const ALIA_JWT_KEY="alia-jwt";async function launcherFetch({method:e,path:t,args:r,headers:n,keepAlive:s}){var p;const a="body"in r,i=getJWT(),{key:c}=getPreview(),o=(p=shopifyExtensionInfo())==null?void 0:p.customerID,u=await fetch(h(t,"params"in r&&r.params,"query"in r&&r.query),{method:e,keepalive:s,headers:{...a?{"Content-Type":"application/json"}:{},[SHOP_HEADER]:SHOP(),...i?{[JWT_HEADER]:i}:{},...c?{[PREVIEW_KEY_HEADER]:c}:{},...o?{[SHOPIFY_CUSTOMER_ID_HEADER]:o}:{},...n},...a?{body:JSON.stringify("body"in r?r.body:void 0)}:{}});if(u.status===204)return;const f=await u.json();if(u.ok)return f;throw typeof f!="object"||f==null?new Error("An unknown error occurred"):"error"in f&&typeof f.error=="string"?new Error(f.error):new Error("An unknown error occurred");function h(y,v,l){const w=new URL("https://backend.alia-cloudflare.com");for(const[S,I]of Object.entries(v))y=y.replace(`:${S}`,String(I));w.pathname=`/launcher${y}`;for(const[S,I]of Object.entries(l))I!=null&&w.searchParams.set(S,String(I));return w.toString()}}const memStorage=(()=>{const e={};return{setItem:(t,r)=>{e[t]=r},getItem:t=>e[t]}})();function jwtStorages(){const e=[sessionStorage,memStorage];return getPreview().key||e.unshift(localStorage),e}function saveJWT(e){for(const t of jwtStorages())try{t.setItem(ALIA_JWT_KEY,e)}catch{}}function getJWT(){for(const e of jwtStorages())try{const t=e.getItem(ALIA_JWT_KEY);if(t)return t}catch{}return null}function getPreview(){const e="alia_preview_key",t=new URLSearchParams(window.location.search),r=t.get("alia_preview_key");r&&sessionStorage.setItem(e,r);const n=t.get("flow_id"),s=n?parseInt(n):void 0;return{key:sessionStorage.getItem(e),flowID:Number.isNaN(s)?void 0:s}}function getStorageType(){return getPreview().key?"session":"local"}const URL_STORAGE_PARAM="alia_user";function extractJWTFromURL(){attempt(()=>{const t=new URL(window.location.href).searchParams.get(URL_STORAGE_PARAM);if(t){const r=atob(t);saveJWT(r)}return null})}function appendJWTOnDomainChange(e,t){attempt(()=>{const r=[(t==null?void 0:t.primaryDomain)??"",...(t==null?void 0:t.otherDomains)??[]].filter(a=>!!a);if(r.length<=1)return;const n=r.map(a=>new URL(a)).filter(a=>a.hostname!==window.location.hostname),s=a=>(a.searchParams.set(URL_STORAGE_PARAM,btoa(e)),a);interceptNavigation({onLinkClick:a=>{n.some(i=>i.hostname===a.hostname)&&(a.href=s(new URL(a.href)).toString())},onHistoryChange:a=>{if(a)return s(new URL(a)).toString()}})})}function logError(e){return launcherFetch({method:"POST",path:"/errors",args:{body:e}})}async function upsertManyUserFlows(e){return await launcherFetch({method:"POST",path:"/user-flows",args:{body:e}})}async function upsertForPreviewUserFlow(e){return await launcherFetch({method:"POST",path:"/user-flows/preview",args:{body:e}})}async function updateUser(e){return await launcherFetch({method:"POST",path:"/users",args:{query:e}})}async function createUserAction(e){return await launcherFetch({method:"POST",path:"/user-actions",args:{body:e}})}const STORAGE_KEY="alia-user-actions";function getInitialUserActions(e){const t=[...e],r=getFromStorage(getStorageType(),STORAGE_KEY)??[];for(const n of r)n.id&&t.some(s=>s.id===n.id)||t.push(n);return t}class UserActionsStore{constructor(t){m(this,"mediator");this.mediator=t}setActions(t){const r=this.mediator.update(n=>({...n,actions:t(n.actions)}));setInStorage(getStorageType(),STORAGE_KEY,r.actions)}addActions(...t){this.setActions(r=>[...r,...t])}updateByCreatedAt(t,r){this.setActions(n=>n.map(s=>s.createdAt===t&&s.type===r.type?r:s))}async createAction(t){try{const r=new Date().toISOString();this.addActions({...t,type:t.data.type,createdAt:r});const n=await createUserAction(t);this.updateByCreatedAt(r,n)}catch(r){logError({message:`Failed to create ${t.data.type} user action`,data:{action:t,error:unknownErrToStr(r)}})}}}class AliaMediator{constructor(t){m(this,"state");m(this,"subscriptions",[]);m(this,"events",[]);m(this,"eventSubscriptions",new Map);m(this,"userActionsStore");this.state=t,this.userActionsStore=new UserActionsStore(this)}update(t){return this.state={...this.state,...t(this.state)},this.subscriptions.forEach(r=>r(this.state)),this.state}subscribe(t){return this.subscriptions.push(t),()=>{this.subscriptions=this.subscriptions.filter(r=>r!==t)}}emit(t){this.events.push(t);const r=this.eventSubscriptions.get(t.type);r&&r.forEach(n=>n(t))}on(t,r){const n=this.eventSubscriptions.get(t)??[];return n.push(r),this.eventSubscriptions.set(t,n),()=>{var s;this.eventSubscriptions.set(t,((s=this.eventSubscriptions.get(t))==null?void 0:s.filter(a=>a!==r))??[])}}}async function registerForFlow(e){await launcherFetch({method:"POST",path:"/events/flow",args:e,keepAlive:!0})}class SessionTracker{constructor(t){m(this,"isNewSession");m(this,"flowID",null);this.flowID=t??null,this.setupEngagedListeners(),getFromStorage("session",this.getStorageKey())?this.isNewSession=!1:(this.isNewSession=!0,this.setValue({start:Date.now(),isEngaged:!1}))}getStorageKey(){return`alia-session${this.flowID?`-${this.flowID}`:""}`}getValue(){return getFromStorage("session",this.getStorageKey())}setValue(t){setInStorage("session",this.getStorageKey(),t)}setupEngagedListeners(){interceptNavigation({onLinkClick:t=>{t.href&&t.hostname===window.location.hostname&&this.handleEngagedSession()},onHistoryChange:()=>{this.handleEngagedSession()}})}handleNewSession(){this.isNewSession&®isterForFlow({query:{metric:"SESSION"},body:{flowID:this.flowID}})}handleEngagedSession(){const t=this.getValue();t.isEngaged||(registerForFlow({query:{metric:"ENGAGED_SESSION"},body:{flowID:this.flowID}}),this.setValue({...t,isEngaged:!0}))}}function safeEval(code){try{return eval(code)}catch(e){return logger.error("Error evaluating code",{code,error:unknownErrToStr(e)}),null}}async function evaluateKlaviyoIdentifiedCond(e){const t=await klaviyoIsIdentified();return t===void 0?"skip":e.type==="klaviyo.identified"?t:!t}async function klaviyoIsIdentified(){try{const{klaviyo:e}=await klaviyoObject(),t=await timeout(1e3,async()=>await(e==null?void 0:e.isIdentified()));return t===void 0?void 0:t===!0}catch{return}}async function evaluateKlaviyoListCond(e,{integrationUsers:t}){if(!e.listID)return!0;const r=e.listID;if(a()===!0||await getKDPResult(r)===!0)return e.type==="klaviyo.inList";return e.type!=="klaviyo.inList";function a(){var i,c;for(const o of t){if(o.data.type==="KLAVIYO")return((i=o.data.subscribedLists)==null?void 0:i.includes(r))??!1;if(o.data.type==="KLAVIYO_OAUTH")return((c=o.data.subscribedLists)==null?void 0:c.includes(r))??!1}return!1}}async function evaluateKlaviyoSegmentCond(e){if(!e.segmentID)return!0;const t=e.segmentID;return await getKDPResult(t)===!0?e.type==="klaviyo.inSegment":e.type!=="klaviyo.inSegment"}const kdpResults=new Map;async function getKDPResult(e){try{if(kdpResults.has(e))return kdpResults.get(e);const{klaviyo:t}=await klaviyoObject();if(!(t!=null&&t.getGroupMembership))return;const r=await timeout(1e3,async()=>await(t==null?void 0:t.getGroupMembership([e])));if(!Array.isArray(r))return;const n=r.includes(e);return kdpResults.set(e,n),n}catch{return}}async function klaviyoObject(){try{if(!Array.from(getDocument().scripts).find(n=>n.src.includes("klaviyo.js")))return{klaviyo:void 0};const t=()=>getWindowProperty("klaviyo");return t()?{klaviyo:t()}:await timeout(1e3,async()=>await new Promise(n=>{const s=setInterval(()=>{t()&&(n({klaviyo:t()}),clearInterval(s))},100)}))??{klaviyo:void 0}}catch{return{klaviyo:void 0}}}async function evaluateTargetingRuleCond(e,t){var s,a,i,c;if(t.evaluated.includes(e.resource.id))return"skip";const r=e.resource.type==="targetingRule"?(a=(s=t.targetingRules)==null?void 0:s.rules.find(o=>o.id===e.resource.id))==null?void 0:a.config:(c=(i=t.segments.find(o=>o.id===e.resource.id))==null?void 0:i.targeting)==null?void 0:c.rule;if(!r)return"skip";const n=await evaluateTargetingRule(r,{...t,evaluated:[...t.evaluated,e.resource.id]});return n!=="skip"?e.type==="inTargetingRule"?n:!n:e.resource.type==="segment"&&e.type==="notInTargetingRule"?!1:"skip"}async function evaluateCustomCodeCond(e,t){return await Promise.race([safeEval(`(async ({ campaignID, profile: { user, actions } }) => { ${e.code} })(${JSON.stringify({campaignID:t.segmentID,profile:t})})`),wait(1e3)])===!0}const checkCookieMap={klaviyo:async()=>await klaviyoIsIdentified(),smsbump:async()=>{var e,t;return(t=(e=getWindowProperty("smsbump"))==null?void 0:e.isIdentified)==null?void 0:t.call(e)},unveild:async()=>{var e,t;return(t=(e=getWindowProperty("unveild"))==null?void 0:e.checkIfUserIdentified)==null?void 0:t.call(e)},upstack:async()=>{var e,t;return await((t=(e=getWindowProperty("_upsShopifyClient"))==null?void 0:e.isKnown)==null?void 0:t.call(e))}};async function evaluateCookieIdentificationCond(e,t){const n=(await Promise.all(Object.keys(checkCookieMap).filter(s=>!e.exclude.includes(s)).map(async s=>{try{const a=await checkCookieMap[s](t);return a===!0?!0:a===!1?!1:"skip"}catch{return"skip"}}))).some(s=>s===!0);return e.type==="cookie.identified"?n:!n}function evaluateNumFilter(e,t){switch(e.operator){case"eq":return t===e.value;case"neq":return t!==e.value;case"gt":return t>e.value;case"gte":return t>=e.value;case"lt":return tr;case"lt":return nnew URL(o)):[new URL(window.location.href)],i=(e.matchType==="exact"?e.values:e.matchType==="contains"?e.values.map(o=>`*${o}*`):assertNever(e.matchType)).some(o=>s.some(u=>c(e.pageType,u,o)));return e.type==="hasVisitedPage"||e.type==="isOnPage"?i:!i;function c(o,u,f){const h=o==="url"?u.toString():o==="path"?u.pathname+u.search:assertNever(o);return glob(p(f),p(h));function p(y){return y.replace(/\/$/,"")}}}function evaluateNumPagesViewedCond(e,{user:t}){var n;const r=(n=t.profile.history)==null?void 0:n.at(-1);return r?evaluateNumFilter(e.value,r.length):!1}function evaluateNumSessionsCond(e,{user:t}){var r;return evaluateNumFilter(e.value,((r=t.profile.history)==null?void 0:r.length)??0)}function evaluateShopifyNumOrdersCond(e,t){return evaluateNumFilter(e.value,t.user.shopifyNumOrders??0)}function evaluateShopifyCountriesCond(e,t){const r=t.user.country;return r===null?!0:e.type==="shopify.inCountries"?e.countries.includes(r):!e.countries.includes(r)}function evaluateMarketsCond(e,t){const r=t.user.market;return r===null?!0:e.type==="shopify.inMarkets"?e.markets.includes(r):!e.markets.includes(r)}function evaluateLocalesCond(e,t){const r=t.user.language;return r===null?!0:e.type==="shopify.inLocales"?e.locales.includes(r):!e.locales.includes(r)}function evaluateUtmSourceCond(e,t){const r=getLatestParamValue("utm_source",t.user),n=e.values.includes(r);return e.type==="traffic.utmSourceIsIn"?n:!n}function evaluateUtmMediumCond(e,t){const r=getLatestParamValue("utm_medium",t.user),n=e.values.includes(r);return e.type==="traffic.utmMediumIsIn"?n:!n}function getLatestParamValue(e,{profile:t}){const r=t.history.flat();for(const n of r.reverse()){const a=new URL(n).searchParams.get(e);if(a)return a}return null}function evaluateUserCreatedAtCond(e,t){return evaluateRelativeDateFilter(e.value,new Date(t.user.createdAt))}function evaluateUserDeviceCond(e,t){const r=t.user.isMobile;return r===null?!0:e.device==="mobile"?r:!r}function evaluateUserCountriesCond(e,t){const r=t.user.ipCountry;return r===null?"skip":e.type==="user.inCountries"?e.countries.includes(r):!e.countries.includes(r)}function evaluateUserRegionsCond(e,t){const r=t.user.ipRegion;return r===null?"skip":e.type==="user.inRegions"?e.regions.includes(r):!e.regions.includes(r)}function evaluateUserActionCond(e,t){const r=t.actions.some(n=>n.data.type!==e.action.type?!1:e.filters?evaluateUserActionFilters(n,e.filters):!0);return e.type==="user.hasDoneAction"?!!r:!r}function evaluateUserActionFilters(e,t){return t.every(s=>{switch(s.type){case"userAction.date":return r(s);case"userAction.inSegments":case"userAction.notInSegments":return n(s)}});function r(s){return evaluateRelativeDateFilter(s.value,new Date(e.createdAt))}function n(s){const a=s.segmentIDs.some(i=>e.segmentID===i);return s.type==="userAction.inSegments"?a:!a}}async function evaluateCond(e,t){switch(e.type){case"inTargetingRule":case"notInTargetingRule":return evaluateTargetingRuleCond(e,t);case"customCode":return await evaluateCustomCodeCond(e,t);case"klaviyo.identified":case"klaviyo.notIdentified":return await evaluateKlaviyoIdentifiedCond(e);case"klaviyo.inList":case"klaviyo.notInList":return await evaluateKlaviyoListCond(e,t);case"klaviyo.inSegment":case"klaviyo.notInSegment":return await evaluateKlaviyoSegmentCond(e);case"isOnPage":case"isNotOnPage":case"hasVisitedPage":case"hasNotVisitedPage":return evaluatePagesCond(e,t);case"pages.numPagesViewed":return evaluateNumPagesViewedCond(e,t);case"pages.numSessions":return evaluateNumSessionsCond(e,t);case"shopify.numOrders":return evaluateShopifyNumOrdersCond(e,t);case"shopify.inMarkets":case"shopify.notInMarkets":return evaluateMarketsCond(e,t);case"shopify.inLocales":case"shopify.notInLocales":return evaluateLocalesCond(e,t);case"shopify.inCountries":case"shopify.notInCountries":return evaluateShopifyCountriesCond(e,t);case"user.createdAt":return evaluateUserCreatedAtCond(e,t);case"user.device":return evaluateUserDeviceCond(e,t);case"user.inCountries":case"user.notInCountries":return evaluateUserCountriesCond(e,t);case"user.inRegions":case"user.notInRegions":return evaluateUserRegionsCond(e,t);case"user.hasDoneAction":case"user.hasNotDoneAction":return evaluateUserActionCond(e,t);case"traffic.utmSourceIsIn":case"traffic.utmSourceIsNotIn":return evaluateUtmSourceCond(e,t);case"traffic.utmMediumIsIn":case"traffic.utmMediumIsNotIn":return evaluateUtmMediumCond(e,t);case"cookie.identified":case"cookie.notIdentified":return evaluateCookieIdentificationCond(e,t)}}async function evaluateTargetingRule(e,t){switch(e.type){case"and":return evaluateAndRule(e,t);case"or":return evaluateOrRule(e,t)}}async function evaluateAndRule(e,t){const r=await Promise.all(e.conds.map(n=>evaluateCond(n,t)));return r.some(n=>n===!1)?!1:r.some(n=>n==="skip")?"skip":!0}async function evaluateOrRule(e,t){const r=await Promise.all(e.conds.map(n=>evaluateCond(n,t)));return r.some(n=>n===!0)?!0:r.some(n=>n==="skip")?"skip":!1}async function evaluateTargeting({user:e,actions:t,targetingRules:r,segments:n,integrationUsers:s}){return(await Promise.all(n.map(async i=>{try{return await evaluateTargetingRule(i.targeting.rule,{user:e,actions:t,integrationUsers:s,evaluated:[],targetingRules:r,segments:n,segmentID:i.id})===!1?void 0:i.id}catch(c){logger.error(c),logError({message:"Error evaluating targeting rule",data:{error:unknownErrToStr(c)}});return}}))).filter(i=>i!==void 0)}const SHOP=()=>"highstreet-mx.myshopify.com".substring(0);logger.log(SHOP());const BACKEND_URL="https://backend.alia-cloudflare.com",RELEASE_TAG="v2.9.59",MAX_TRIES=5,shopifyExtensionInfo=()=>getWindowProperty("ALIA_SHOPIFY_EXTENSION_INFO");getDocument().readyState!=="loading"?tryInit():getDocument().addEventListener("DOMContentLoaded",()=>{tryInit()},{once:!0});async function tryInit(e=MAX_TRIES){const t="ALIA_HAS_INITIALIZED";if(getWindowProperty(t)){logger.log("Alia already initialized");return}if(setWindowProperty(t,!0),r()){logger.log("Disabled for bot",navigator.userAgent);return}try{await init()}catch(n){if(e<=0){logger.error(`Failed after ${MAX_TRIES} tries`),logError({message:"Init failed",data:{error:unknownErrToStr(n)}});return}else logger.error("Init failed, trying again...",n),await wait(2e3),tryInit(e-1)}function r(){const n=navigator.userAgent;return["Googlebot","bingbot","facebookexternalhit","Storebot-Google","AmazonProductDiscovery","Petalbot","Pinterestbot","Applebot","Twitterbot"].some(s=>n.includes(s))}}async function init(){var h,p,y,v;const{flowID:e,key:t}=getPreview(),r=await f();extractJWTFromURL();const n=new SessionTracker,{jwt:s,disabledReason:a,...i}=await updateUser({path:window.location.pathname+location.search,url:window.location.href,flow_id:e,is_mobile:window.innerWidth<1024,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,ip_address:r,user_agent:navigator.userAgent,country:(h=shopifyExtensionInfo())==null?void 0:h.country,market:(p=shopifyExtensionInfo())==null?void 0:p.market,language:(y=shopifyExtensionInfo())==null?void 0:y.language,release_tag:RELEASE_TAG,new_session:n.isNewSession});if(saveJWT(s),appendJWTOnDomainChange(s,(v=i.merchant)==null?void 0:v.settings),a){logger.debug("Disabled",a);return}n.handleNewSession();const c=e?[]:await evaluateTargeting(i);if(e)logger.debug("Previewing popup",e);else if(!c.length){logger.debug("No matching campaigns");return}const[o]=await Promise.all([(async()=>e?[await upsertForPreviewUserFlow({previewKey:t??"",flowID:e})]:upsertManyUserFlows({segmentIDs:c}))(),loadScript(BACKEND_URL+"/public/app.js")]);if(!o.length){logger.debug("No matching campaigns");return}o.forEach(({userFlow:l})=>{l&&logger.debug(`Matched campaign ${l.segmentID} (${l.segmentTitle}), serving flow ${l.flowID} (${l.flowTitle})`),new SessionTracker(l==null?void 0:l.flowID).handleNewSession()}),setWindowProperty("alia",u());function u(){const l=getWindowProperty("alia"),w=createSDKMessages(l??[]),S=new AliaMediator({actions:getInitialUserActions(i.actions),modalFlowID:D(),user:i.user}),I=o.map(g=>{const d=getDocument().createElement("div");return d.style.position="fixed",getDocument().body.appendChild(d),window.mountAliaCustomerApp({shop:SHOP(),jwt:s,useShadowDOM:g.settings.useShadowDOM,initialData:g,targetingArgs:i,target:d,messages:w,mediator:S})});return A(),{unmount:()=>I.forEach(g=>g()),push:w.push,messages:w,open:w.open,close:w.close,mediator:S};function D(){for(const g of o.map(d=>d.userFlow)){const d=g==null?void 0:g.state.steps.at(-1);if((d==null?void 0:d.step)==="popup"&&!(d!=null&&d.floatingButton))return g==null?void 0:g.flowID}}function A(){try{const g=getWindowProperty("onAliaReady"),d=E=>{typeof E=="function"&&E()};Array.isArray(g)?g.forEach(d):d(g),setWindowProperty("onAliaReady",void 0),setTimeout(A,1e3)}catch(g){console.error("Error calling executeOnReady",g)}}}async function f(){try{const l=await fetch("https://api.ipify.org");return l.status!==200?void 0:await l.text()}catch{return}}}return exports.SHOP=SHOP,exports.shopifyExtensionInfo=shopifyExtensionInfo,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),exports}({});