1import{m as e,u as a,t as r,T as t,l as n}from"./2c1ab0fe.GMbxnz74.js";import{W as s,bD as o,bE as i,F as l,bF as u,i as c,bG as d,bH as _,bI as m,bJ as p,bK as y,bL as b,bM as v,bN as f,bO as h}from"./164ad2e3.BbIvMjRY.js";import{S as g,T as E,b3 as P,bM as M,l as S,bN as I,bO as R,bP as T,bQ as A,aQ as V,bR as C,aZ as w,aa as F,a9 as L,bS as O,bT as k,bU as B,bV as D,bW as Y,bX as N,bY as j,W as x,bZ as G,b_ as H,b$ as U,c0 as W,Y as X,bh as z,c1 as J}from"./4c290a1e.C6TDJ9Fn.js";import{h as Q,a as Z,u as q}from"./58314944.1jO_vh_4.js";function K({bannerId:r,errorType:t,children:n,...o}){const{observability:i}=g(),{tone:l,...u}=o;return e(()=>{i.log("error_log_banner_error_banner_rendered","[Displayed Error] Error banner was rendered",{bannerId:r})},[r,i]),a(s,{errorType:t,id:r,tone:l,...u,children:n})}function $(){const{checkout:e,i18n:a,shopPay:n}=g(),s=E(),{value:l}=s.paymentMethods,{value:u}=s.managedByMarketsPro,c=V({managedByMarketsPro:u}),d=r(()=>P({checkout:e})),_=o(),{value:m}=s.deferredTotal,p=n.session.selectedPaymentMethod.value,y=n.session.paymentMethodOption.value,{hasViolations:b}=i(M),v=p&&S(p)?I(p.paymentAttributes.brand):void 0,f=R(),h=t(()=>{if("SHOPIFY_INSTALLMENTS"!==y?.name){if(f.value)return!0;if(!p)return!0;if(_.value&&!m?.amount.amount)return!0;if(S(p)){if(b)return!1;const e=l?.filter(e=>"direct"===e.type).flatMap(e=>e.paymentBrands);if(e&&e.length>0){const a=T(p.paymentAttributes);if(!a)return;return e.includes(a)}}return!A(p)||function(e,a,r){return!e&&a&&r?.some(e=>C(e,["ideal"]))}(d.value,c,l)}},[y?.name,f.value,p,_.value,m?.amount.amount,b,l,d.value,c]),w=t(()=>{if(p&&!1===h){if(S(p))return v?a.translate("payment.brand_not_available",{brand:v}):a.translate("payment.generic_incorrect_card_info");if(A(p))return d.value?a.translate("payment_errors.payment_method_unavailable_with_subscriptions"):a.translate("payment.shop_pay_ideal_unavailable_error")}},[h,p,v,a,d.value]);return{paymentMethods:l,isSelectedPaymentMethodSupported:h,notSupportedError:w,label:v}}function ee(){const{i18n:e,checkout:a,embed:r,shopPay:t}=g(),{delegatedPaymentInstrument:s,inventoryRecoverySignal:o}=w(),{lastJourneyProgression:l}=F(),{progressing:u}=c(),{walletUsedForSubmissionSignal:P,inMemoryApplePayParts:{asPaymentMethod:S},receiptErrorSignal:I}=L(),{paymentMethods:R}=E(),{notSupportedError:T}=$(),{hasViolations:A,violations:V}=i(M),{hasViolations:C}=i(O),{hasViolations:K}=i(k),{hasViolations:ee}=i(B),{hasViolations:ae}=i(D),{violations:re}=i(Y),te=!(("success"===l.value.type||"error"===l.value.type)&&"completion"===l.value.negotiationStage)&&1===re.size&&"PAYMENTS_METHOD"===re.values().next().value.code,{hasViolations:ne}=i(N),se=d(),{hasError:oe,error:ie}=_(j),{hasError:le,error:ue}=m(),{hasError:ce}=p(),{hasError:de}=y(),_e=b(ie?{type:"payment",code:ie}:void 0),me=function(e){const{i18n:a}=g();if(e&&"SURVEY_EXITED"!==e.code)return a.translate("hsa_qualification_errors",{scope:e.code.toLowerCase()})}(ue),pe=x(),ye=pe.generalPaymentError.value,be=pe.generalPaymentErrorCode.value,ve=Q(pe.directPaymentErrors),fe=Z(pe.directPaymentErrors),he=n(!1),ge=v(),Ee=q(ye,be),Pe=Ee&&!G(be)&&!H(be)&&!U(be)&&!W(be),Me=e.translate("order_errors.inventory_reservation_failure"),{hasViolations:Se}=f(J),Ie=Boolean(X(R.value).length),Re=z("billingAddress").value,Te=h().value,Ae="APPLE_PAY"===P.value||Te,Ve="INCORRECT_CVC"===ie&&"CREDIT_CARD"===t?.session.selectedPaymentMethod.value?.paymentMethod,Ce=o.value,we=null!=Ce&&Ce.receiptId===a.latestReceipt.value?.id,Fe="failed"===l.value.type&&"completion"===l.value.negotiationStage,Le=Boolean(Pe||fe||se||Fe),Oe=we&&!Ce.dismissed&&!Le;if(u.value)return{message:void 0,tone:"auto"};let ke,Be="critical";if(r&&a.configuration.isPaymentInstrumentsDelegationEnabled&&s.value&&Se&&!Re&&(ke=e.translate("payment_errors.payment_method_billing_address")),Pe&&(he.current=!0,Be="warning",ke=Ee),se&&(he.current=!0,ke=se),(ve||fe&&(he.current||ce))&&(ke=e.translate("payment.generic_incorrect_card_info")),!(oe&&ie&&_e)||he.current||"GOOGLE_PAY"===P.value||Ae&&!S.value||I.value||ge||Ve||(ke=_e),Fe&&"failed"===l.value.type&&(ke=l.value.fetchFailed?e.translate("order_errors.network_failure"):"decision_rule_block"===l.value.reason?e.translate("payment_errors.generic_error"):e.translate("order_errors.creation_failure")),de&&!he.current&&(ke=e.translate("order_errors.creation_failure")),ce&&!Le&&(we?Oe:!he.current)&&(ke=Me,Oe&&(Be="critical")),le&&me&&!he.current&&(ke=me),ne&&(ke=e.translate("store_credit_errors.generic_error")),C&&
1(ke=e.translate("payment.expired_payment_method")),A){const a=[...V][0],r=a?.nonLocalizedMessage?.split(":")[1]?.toLowerCase().trim();ke=r?e.translate("payment.brand_not_available",{brand:e.translate("payment_brand",{scope:r})}):e.translate("payment.generic_incorrect_card_info")}return ee&&(ke=e.translate("payment.generic_incorrect_card_info")),ae&&(ke=e.translate("payment_errors.method_not_available")),K&&(ke=e.translate("payment_errors.generic_error")),te&&(ke=e.translate("payment_errors.available_methods_updated"),Be="info"),T&&(ke=T,Be="critical"),Ie&&Se&&(ke=e.translate("address_management.invalid_billing_address_selected")),{message:ke,tone:Be,inventoryRecoveryReceiptId:Oe&&ke===Me?a.latestReceipt.value?.id:void 0}}function ae({message:r,tone:t,inventoryRecoveryReceiptId:s}){const{observability:o}=g(),i=n(Boolean(s)).current;return e(()=>{s&&o.counter({name:"inventory_recovery_error_banner_displayed",value:1})},[s,o]),a(te,{identifier:"PaymentErrorBanner",tone:t,suppressAutoFocus:i,children:r})}function re(){const e=ee();return e.message?a(ae,{...e}):null}function te({children:e,identifier:r,tone:t,suppressAutoFocus:n=!1}){return"critical"===t||"warning"===t?a(K,{errorType:l.PaymentError,bannerId:r,tone:t,autoFocus:!n,focusable:n,children:e}):a(u,{tone:t,children:e})}export{K as E,re as P,$ as a,ae as b,te as c,ee 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.