1import{E as e}from"./2c1ab0fe.D_oO1jU7.js";import{aF as s,aG as i,aH as n,aI as t,aJ as a,aK as r}from"./4c290a1e.D9lE9kmU.js";import{i as o}from"./e477f96c.dvrL9dgG.js";function d(e,s){return Object.keys(s).every((i=>(s[i]??"")===(e[i]??"")))}function p(e,s){if(!e)return!1;const[i=0,n=0,t=0]=l(e),[a=0,r=0,o=0]=l(s);return i!==a?i>a:n!==r?n>r:t>=o}function l(e){return e.split(".").map((e=>parseInt(e,10)||0))}const u=new Set(["mobilepay","bancontact","blik","bizum","mb","multibanco","mbway","eps","swish","twint","przelewy24","alipay","wechatpay","oxxo","satispay","vipps","konbini","grabpay"]);function c(e,{identity:i,installmentsSelected:n,isApplePayAvailable:t,idealEnabled:a,isBareCardOnly:r,isShopAppLayout:d=!1,shopAppVersion:l}){return r?e.filter((e=>"direct"===e.type)):"shopPay"!==i.current.value?e:n?e.filter((e=>"direct"===e.type)):e.filter((e=>{if("direct"===e.type)return!0;if("customOnsite"===e.type){const s=e.paymentBrands??[];return!!(s.includes("bogus_app_coin")||s.includes("usdc")||a&&s.includes("ideal"))||!!o(e.uiExtension?.appId)&&s.some((e=>function({brand:e,isShopAppLayout:s=!1,shopAppVersion:i}){if(s&&!function(e){return p(e,"2.251.0")}(i))return!1;const n=e.toLowerCase();return u.has(n)}({brand:e,isShopAppLayout:d,shopAppVersion:l})))}return!!s(e)&&t}))}function y(s,{isApplePayAvailable:i}){const{identity:n,shopPay:t,negotiatedFields:o}=s;return e((()=>{return c(o.paymentMethods.value??[],{identity:n,installmentsSelected:!1,isApplePayAvailable:(e=i,"boolean"==typeof e?e:e.value),idealEnabled:r({managedByMarketsPro:o.managedByMarketsPro.value}),isBareCardOnly:!1,isShopAppLayout:a(t.app.config),shopAppVersion:t.app.config.version});var e}))}function h({checkout:e,shopPay:s,observability:a,shippingAddress:r,billingAddress:o,fallbackPhoneNumber:p,buyerAddresses:l}){if(!r&&!o)return{};const u=e.proposal.proposed,c=e.proposal.negotiated.fields,y=i({canUpdateDeliveryAddress:c.canUpdateDeliveryAddress.value,mustSelectProvidedAddress:c.mustSelectProvidedAddress.value,proposedAddress:u.shippingAddress.value,buyerAddresses:l}),h=r&&y?r:void 0,A=o;if(!h&&!A)return{};const b=e.configuration.addressSettings.nonBillingAddressSettings.value;if(h){const e=b.isRequired("phone",{countryCode:h.countryCode,useMerchantSettings:!0})&&!h.phone?p:h.phone;a.log("wallets_shipping_address_update","update with Shop Pay vaulted address",{isPostalCodePadded:n(h.postalCode,h.countryCode),countryCode:h.countryCode}),u.shippingAddress.value={...h,phone:e,oneTimeUse:h.oneTimeUse||!1}}if(A){const e=b.isRequired("phone",{countryCode:A.countryCode,useMerchantSettings:!0})&&!A.phone?p:A.phone;u.billingAddress.value={...A,phone:e}}h&&t(u.shippingAddress),A&&t(u.billingAddress);const f=d(h??u.shippingAddress.value,A??u.billingAddress.value);return s.user.hasCreditCards.value&&(u.billingAddressOption.value=f?"shipping":"custom"),{shippingAddress:h,billingAddress:A}}export{p as a,h as b,c as f,d as i,y as s};
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.