import{eI as e,p7 as s}from"./4b4bc88f.z1yoAwwH.js";function t({name:e,base:s,bold:t}){const{weight:n,sources:r}=s||{},{weight:i,sources:o}=t||{};return{fonts:e??void 0,weightBase:n??void 0,sourceBase:r??void 0,weightBold:i??void 0,sourceBold:o??void 0}}class n{constructor(){this.listeners=new Set}listen(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}emit(e){this.listeners.forEach(s=>s(e))}}const r={billingAddress:0,shippingAddress:1,phone:2,firstName:3,paymentMethod:4,installmentsCard:5},i={billingAddress:[],shippingAddress:[],phone:[],firstName:[],paymentMethod:["billingAddress","shippingAddress","firstName","phone"],installmentsCard:["billingAddress","shippingAddress","firstName","phone","paymentMethod"]};class o{constructor(){this.interceptors=new Set,this.resultEmitter=new n}async runInterceptors(){const e=[...this.interceptors];e.sort(({name:e},{name:s})=>r[e]-r[s]);const s=[],t=new Set;for(const{name:n,interceptor:r}of e){if(i[n].some(e=>t.has(e)))continue;const e=await r();s.push(e),e.success||t.add(n)}return this.resultEmitter.emit(c(s)),s}intercept(e,s){const t={interceptor:s,name:e};return this.interceptors.add(t),()=>{this.interceptors.delete(t)}}listenResult(e){return this.resultEmitter.listen(e)}}function a({addressType:e,validate:s,setErrors:t}){const n=s();return n.size>0?(t(n),{success:!1,location:`intercept_${e}_address_has_errors`}):{success:!0}}function c(e){return e.every(e=>e.success)}function d(e){return e.flatMap(e=>!e.success&&"location"in e?[e.location]:[])}function l(e){return e.flatMap(e=>"errors"in e?e.errors??[]:[])}function u({shop:t,checkout:n,paymentMethods:r}){return e(r)&&t.hasFlagEnabled(s)&&n.configuration.layout.isOnePage.value&&!n.isCheckoutLayoutForcedToOnePage.value&&!n.proposal.negotiated.fields.buyerIdentity.value?.purchasingCompany}export{o as S,c as a,d as b,t as f,l as g,u as i,a as v};