var _____WB$wombat$assign$function_____=function(name){return (globalThis._wb_wombat && globalThis._wb_wombat.local_init && globalThis._wb_wombat.local_init(name))||globalThis[name];};if(!globalThis.__WB_pmw){globalThis.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}var window = _____WB$wombat$assign$function_____("window");
var self = _____WB$wombat$assign$function_____("self");
var document = _____WB$wombat$assign$function_____("document");
var location = _____WB$wombat$assign$function_____("location");
var top = _____WB$wombat$assign$function_____("top");
var parent = _____WB$wombat$assign$function_____("parent");
var frames = _____WB$wombat$assign$function_____("frames");
var opener = _____WB$wombat$assign$function_____("opener");
import{Y as p,Z as A,a as n,$ as N,a0 as L,a1 as S,a2 as I,a3 as R,K as u,a4 as g,a5 as k,a6 as v,a7 as c,a8 as C,e as E,j as O,k as T,a9 as b,m as H,aa as _,ab as w,ac as x,ad as z,U as F,d as J,ae as U,z as B,af as D}from"./app.ZXowmuNl.js";const K="_817K8",Y="EHxAn",h={Layout:K,isAnimated:Y,"slide-from-bottom":"ryXE3","slide-to-top":"PJvJ6"};function $({children:e}){const s=p(A);return n("main",{className:N([h.Layout,{[h.isAnimated]:s}]),children:e})}function j(e,s,i){const a=e.purchaseOrder?.paymentLines;if(!a||a.length===0)return;if(a.some(r=>{const t=r?.method;return!t||t.type!=="wallet"?!1:s==="SHOPIFY_INSTALLMENTS"&&t.name!=="SHOPIFY_INSTALLMENTS"?(i.leaveBreadcrumb("Installments do not match",{selectedPaymentMethodName:s,receiptPaymentMethod:t}),!0):!1})){const r=new D("User selected Installments but Shop Pay is used"),t={checkout:{token:e.token,email:e.purchaseOrder?.email,paymentLines:JSON.stringify(a)}};i.notify(r,{metadata:t})}}function V(){const{paymentLines:e}=L(),{value:s}=S(),i=I(),a=R(),[o,r]=u(g(s,e.value)),[t,y]=u(!1),M=k(),l=v({isModalRendered:t,modalPaymentMethodConfig:o}),P=a?.id;c(()=>{M()},[P]);const f=C();a&&a.status==="processed"&&j(a,f,i);const{progress:d}=E();return O({stage:T.Complete,id:"Processing"}),b("Processing"),H(_()),c(()=>{d()},[d]),c(()=>{const m=g(s,e.value);o!==m&&r(m)},[s,o,e.value]),c(()=>w({content:l,role:"alert"}),[l]),n($,{children:[n(x,{}),n(z,{modalPaymentMethodConfig:o,onModalRender:()=>{y(!0)}}),n(F,{inlineAlignment:"center",spacing:"large200",children:[n(J,{maxInlineSize:64,children:n(U,{size:"fill"})}),n(B,{textAlign:"center",children:l})]})]})}export{V as default};