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