import{A as F,B as E,F as w,a as n,n as i,o as p,p as d,q as f,r as g,s as y,v,w as I,x as R,y as T,z as x}from"./chunk-BZMISF4F.js";i();i();var B="9db678ead8df7631e47f471f074ea689",k="forms-frontend-app-embed",G="production",H="00bfebe93f1278a02c0049b4dc4aea26d5dc6ce2",L=n((e=!0)=>{let t=["production","staging","staging_qtfb","staging_avwf"];I()||t.push("development"),p.start({apiKey:B,appId:k,appVersion:H,releaseStage:G,trackConsoleErrors:e,enabledReleaseStages:t,endpoints:{notify:"https://error-analytics-production.shopifysvc.com",sessions:"https://error-analytics-sessions-production.shopifysvc.com"}})},"initBugsnagClient"),S=L;i();var h="forms_visit_count",O=n(e=>f(h,e),"setVisitCountValue"),m=n(()=>{let e=g(h);return e?parseInt(e,10):0},"getSessionVisitCountValue"),A=n(()=>{let e=R()||"unknown",t=T(),r=m();(t!==e||!t)&&(r=0,x(e));let o=r+1;O(o)},"incrementVisitCount");i();i();var U=n(()=>{var r;let e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(((r=window==null?void 0:window.navigator)==null?void 0:r.userAgent)||""),t=window.matchMedia&&window.matchMedia("(max-width: 767px)").matches;return e||t},"isMobile"),b=n(e=>!e||e==="all"?!0:U()?e==="mobile":e==="desktop","executeDeviceTypeFilter");i();var P=n(e=>m()>=e.showAfter,"executeVisitFilter");i();function _(e){let t=e.includePageTypes;return e.showOnAllPageTypes||!t?{shouldTrigger:!0,delay:e.delay}:{shouldTrigger:t==null?void 0:t.includes(E()),delay:e.delay}}n(_,"executePageTypeRule");i();var C=n((e,t)=>{let r=n(s=>{s.clientY<=150&&(window.ShopifyForms={...window.ShopifyForms,triggerExitIntent:!0},t(),document.dispatchEvent(o),document.removeEventListener("mouseleave",r))},"handler"),o=new Event(`forms:exit-intent:${e}`);document.addEventListener("mouseleave",r)},"detectExitIntent");i();var D=n(e=>new Promise(t=>setTimeout(t,e)),"waitFor");var M=n(async(e,t,r)=>{let{triggers:o,filters:s}=t,a=!1;if(!o.navigation||!b(s.device))return!1;let c=_(o.navigation);return c.shouldTrigger?(o.displayDetectLeave&&(C(e,r),a=!0),(s.visit?P(s.visit):!0)?(await D(c.delay),r(),!0):a):!1},"executeDisplayRules");i();var V=n(e=>{let t=`[data-forms-id=forms-root-${e}]`,r=document.querySelectorAll(t);return Array.from(r)},"getAllInlineContainers");S(!1);var q=w(),N=n(async(e,t,r,o,s)=>{if(document.getElementById(`app-embed-container-${e}`)&&r.form.layout!=="inline")return;let{setupApp:u}=await import("./App-GSA4TI3L.js");u(e,t,r,s,o)},"importAndRenderApp"),K=n(async(e,t,r,o,s)=>{let{setupApp:a}=await import("./App-GSA4TI3L.js");for(let u of s)a(e,t,r,u,o)},"importAndRenderInlineForms");q||(async()=>{try{let t=await new v({version:2,retries:3}).getMultipleInstances();if(!t||!t.formInstances)return;let{formInstances:r,clientCountry:o}=t;A(),await Y(r,o)}catch(e){if(e instanceof y&&e.status===404)return;d.fromError(e).notify()}})();async function Y(e,t){return Promise.all(e.map(async r=>{let{id:o,styles:s,formDefinition:a,displayRules:u}=r,c=V(o),l=a.form.layout==="inline";if(l&&(c==null?void 0:c.length)>0)return K(o,s,a,t,c);if(!(l&&c.length<1||new F(o).isFormDismissed()))return M(o,u,async()=>{await N(o,s,a,t)})}))}n(Y,"renderAllForms"); //# sourceMappingURL=index.js.map