import{Pt as e,Xt as t,ft as n,nn as a,yt as o}from"./630ba094.L_X-5TXi.js";import{Ed as s,Pp as r,XD as i,Xg as d,Yf as l,ip as u,kc as c,xO as p}from"./6ec9a0fa.rdcQt2v8.js";import{t as h}from"./1befea5c.DNUfNYYr.js";import{c as f}from"./674595ba.CBCkPO6g.js";function v(e,t,n,{platform:a,deviceType:o,os:r,isMacintosh:i}){const d="web"===a&&"undefined"!=typeof window&&Boolean(window.ReactNativeWebView);let l=a;d&&(l="Android"===r?"android":"ios");let u=o;return function(e){if(!e||"undefined"==typeof navigator)return!1;const{maxTouchPoints:t}=navigator;return"number"==typeof t&&t>1}(i)?u="tablet":d&&"desktop"===o&&(u="mobile"),{...s(e,t,n),platform:l,deviceType:u}}var y="shop-pay-hsa-details",_=`${y}-description`;function m(){const{checkout:t,shopPay:n}=p(),a=t.negotiator.current.fields.paymentMethods,{paymentLines:o}=t.negotiator.parts,s=f(),r=["ELIGIBLE_LMN_REQUIRED","ELIGIBLE_LMN_NOT_REQUIRED","MIXED_CART"];return e(()=>{const e=c(a.value),i=function({identity:e}){return"shopPay"===e.current.value}({identity:t.identity})&&(null!=e&&r.includes(e)||n.session.hsaRequested.value),{freeOrder:d,giftCard:l,storeCredit:u,redeemables:p}=s.value,h=d||l||u||p;if(!i||n.session.isInstallmentsSelected.value||h)return!1;const f=n.session.selectedPaymentMethods.value[0];if(f)return"CREDIT_CARD"===f.paymentMethod;const v=o.value[0]?.method,y="wallet"===v?.type&&"SHOP_PAY"===v.name?v.walletContent:void 0,_=null!=y&&"paymentMethod"in y&&"CREDIT_CARD"===y.paymentMethod;return"direct"===v?.type||_})}function b(){const{checkout:t,shopPay:n}=p(),a=m();return e(()=>{const e=c(t.proposal.negotiated.fields.paymentMethods.value);return a.value&&("ELIGIBLE_LMN_REQUIRED"===e||"ELIGIBLE_LMN_NOT_REQUIRED"===e)&&n.session.hsaRequested.value})}function E(){const{i18n:n,shopPay:s,checkout:i}=p(),f=e(()=>c(i.proposal.negotiated.fields.paymentMethods.value)),v=e(()=>"ELIGIBLE_LMN_REQUIRED"!==f.value&&"ELIGIBLE_LMN_NOT_REQUIRED"!==f.value),m=e(()=>"MIXED_CART"===f.value),b=s.session.hsaRequested,E=e(()=>!v.value&&b.value),R=e(()=>v.value&&b.value),I=e(()=>m.value||b.value),C=e(()=>m.value?n.translate("payment.shop_pay_hsa.mixed_cart_description"):R.value?n.translate("hsa_qualification_errors.unsupported_checkout"):n.translate("payment.shop_pay_hsa.description")),L=t(e=>{v.value||s.session.unstable_setHsaRequested(e)},[v,s.session]);return o(d,{background:"base",colorLayer:"control",border:"base",borderRadius:"base",children:[o("span",{id:_,hidden:!0,children:C}),o(r,{id:y,open:I.value,summary:o(d,{padding:"base",children:o(h,{label:n.translate("payment.shop_pay_hsa.label"),checked:E.value,disabled:v.value,onChange:L,icon:"none","aria-controls":`${y}-content`,"aria-describedby":_})}),content:o(a,{children:[o(u,{}),o(d,{padding:"base",children:o(l,{type:"small",color:"subdued",children:C})})]})})]})}function R(t){const a=n(t);return e(()=>a.value.some(e=>{if("customField"===e.kind)return i(e).required.value;const t=i(e);return t.behaviors.value.blockProgress&&t.capabilities.blockProgress})).value}var I={Wrapper:"GsMGr",Container:"eDhAI",Section:"P0xJW","Container-fixed":"iRlFp","Container-fixed-entering":"_24aJk","Container-fixed-exiting":"ktbnR","Container-fixed-enter":"PCKgT","Container-fixed-exited":"DvZWz",Shadow:"COpTB","Shadow-enter":"_0hDB9","Shadow-exiting":"P1NPi","Shadow-exited":"lQN1j"},C={Button:"liLqL",Sparkles:"b71fw"},L={Button:"OJbFq",WalletLogoContainer:"wNUaA"},g={StickyFooter:"XR3sZ",StickyFooterExperiment:"_4fPUS",StickyFooterAtBottom:"_5FRe7",StickyFooterBuffer:"ZDqoP",SDKStickyFooterBuffer:"zANgR",EmbedStickyFooterBuffer:"_3A6oJ",ButtonContainer:"K8y4t",SDKButtonContainer:"_7S3NK",EmbedButtonContainer:"SdyJr"},k=function(e){return e.Unknown="unknown",e.Rejected="rejected",e.Errored="errored",e.InvalidTermsCount="invalid_terms_count",e.InvalidRepaymentsCount="invalid_repayments_count",e.UserUnsynchronized="user_unsynchronized",e.InvalidShippingAddress="invalid_shipping_address",e}({});export{I as a,b as c,C as i,m as l,g as n,R as o,L as r,E as s,k as t,v as u};