1import{c_ as c,gP as p}from"./utilities-previous.BNOUhCqt.js";class u{constructor(){this.listeners=new Set}listen(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}emit(e){this.listeners.forEach(t=>t(e))}}const l={billingAddress:0,shippingAddress:1,phone:2,firstName:3,paymentMethod:4,installmentsCard:5},h={billingAddress:[],shippingAddress:[],phone:[],firstName:[],paymentMethod:["billingAddress","shippingAddress","firstName","phone"],installmentsCard:["billingAddress","shippingAddress","firstName","phone","paymentMethod"]};class C{constructor(){this.interceptors=new Set,this.resultEmitter=new u}async runInterceptors(){const e=[...this.interceptors];e.sort(({name:n},{name:i})=>l[n]-l[i]);const t=[],r=new Set;for(const{name:n,interceptor:i}of e){if(h[n].some(a=>r.has(a)))continue;const o=await i();t.push(o),o.success||r.add(n)}return this.resultEmitter.emit(m(t)),t}intercept(e,t){const r={interceptor:t,name:e};return this.interceptors.add(r),()=>{this.interceptors.delete(r)}}listenResult(e){return this.resultEmitter.listen(e)}}function A({addressType:s,validate:e,setErrors:t}){const r=e();return r.size>0?(t(r),{success:!1,location:`intercept_${s}_address_has_errors`}):{success:!0}}function m(s){return s.every(e=>e.success)}function I(s){return s.flatMap(e=>!e.success&&"location"in e?[e.location]:[])}function S(s){return s.flatMap(e=>"errors"in e?e.errors??[]:[])}function y(s,e,t,r){if(!s)return!1;const{expired:n,supportsInstallmentsInterestLoan:i,supportsInstallmentsSplitPayLoan:o}=s,a=c(e.value),d=s.billingAddressValid&&s.billingAddress.address.countryCode&&a?.supportedCountries.includes(s.billingAddress.address.countryCode)&&p(a?.availableLoanTypes,o,i);return!!(n||t.value&&!d||r.value&&!i)}export{C as S,m as a,I as b,S as g,y as i,A as v};
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.