1import{T as o,u as e,X as n,x as t,h as s,f as r,q as a}from"./2c1ab0fe.D_oO1jU7.js";import{af as i,ag as l,_ as c,ah as u,ai as p,aj as h,O as y,Q as f,ak as d,X as P}from"./4c290a1e.D9lE9kmU.js";const m=i("CheckoutSheetProtocolSchemaContext");function v(o,e){o.postMessageToConsumer(e)}var w=(o=>(o.Continue="continue",o.Cancel="cancel",o))(w||{});class T{constructor(){this.listeners=new Set}listen(o){return this.listeners.add(o),()=>{this.listeners.delete(o)}}emit(o="continue"){this.listeners.forEach((e=>e(o)))}}const _=n(void 0);function g(){const o=t(_);if(null==o)throw new l("Missing CheckoutProtocolEventContext");return o}function E(o){const e=g();s((()=>e.listen(o)),[o,e])}function S({children:n}){const t=o((()=>new T),[]);return e(_.Provider,{value:t,children:n})}const b=i("MobileCheckoutSdkSchemaContext");function C(){const o=t(m),e=t(b);if(!o&&!e)throw new l("No Checkout Sheet Protocol or Mobile Checkout SDK Schema context found");return o||e}const k=[{brand:"APPLE_PAY",flowType:"applePay"},{brand:"GOOGLE_PAY",flowType:"googlePay"},{brand:"PAYPAL_EXPRESS",flowType:"payPal"},{brand:"SHOPIFY_INSTALLMENTS",flowType:"shopifyInstallments"},{brand:c.AmazonPay,flowType:"amazonPay"},{brand:c.BuyWithPrime,flowType:"buyWithPrime"}];function M(){const{checkout:{identity:o},router:e,shopPay:n}=y(),t=f().paymentLines;return r((()=>{const s="shopPay"===o.current.value,r=e.currentUrlMatches("/shoppay_login"),a=t.value,i=n.session.paymentMethodOption.value,l=[{condition:r,flowType:"shopPayLogin"},{condition:"SHOPIFY_INSTALLMENTS"===i?.name.toUpperCase(),flowType:"shopifyInstallments"},{condition:s,flowType:"shopPay"},...k.map((({brand:o,flowType:e})=>{return{condition:(n=o,Object.values(c).includes(n)?Boolean(d(a,o)):Boolean(P(a,o))),flowType:e};var n}))];return l.find((({condition:o})=>o))?.flowType??"regular"}))}const L=()=>{const{schema:{postMessageHandler:o}}=C(),{observability:e}=y();return{handleViolationEvent:a(((n,t)=>{e.log("checkout_sheet_protocol_violation_event_emitted","Emitting event: `violation`."),o({type:"violation",flowType:t,violationErrors:n})}),[o,e]),handleJourneyProgressionErrorEvent:a(((n,t)=>{e.log("checkout_sheet_protocol_journey_progression_error_event_emitted","Emitting event: `journeyProgressionError`."),o({type:"journeyProgressionError",flowType:t,reasons:n})}),[o,e])}};export{m as C,w as E,b as M,S as P,C as a,M as b,L as c,E as d,v as p,g as u};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.