import{ENCRYPTED_CARD_NUMBER as e}from"../../../internal/SecuredFields/lib/constants.js";import{selectOne as r}from"../../../internal/SecuredFields/lib/utilities/dom.js";import t from"../../../internal/SecuredFields/lib/CSF/utils/userAgent.js";import{windowScrollTo as i}from"../../../../utils/windowScrollTo.js";import{isSecuredField as o}from"../../../internal/SecuredFields/utils.js";const l=(e,r,l)=>{if(e){if(t.__IS_IOS){var n,s;const e=null===(n=(s=r.current).getRootNode)||void 0===n?void 0:n.call(s),t=null==e?void 0:e.querySelector(`[data-id="${l}"]`);i(t)}o(l)?r.current.setFocusOn(l):d(l,r,t.__IS_IOS)}},n=(e,r,t)=>i=>{e("billingAddress",i.data),r("billingAddress",i.isValid),t("billingAddress",i.errors)},s=(e,r,t)=>i=>{e(i.currentFocusObject),!0===i.focus?r(i.fieldType,i):t(i.fieldType,i)},c=(r,t,i)=>()=>{r.current||(r.current=!0,Promise.resolve().then(()=>{const l=i.findIndex(r=>r===e),n=i.slice(l+1);for(const e of n){if(!o(e)){d(e,t,!1);break}if(!t.current.sfIsOptionalOrHidden(e)){t.current.setFocusOn(e);break}}r.current=!1}))},d=(e,t,i)=>{var o,l;"taxNumber"===e&&(e="kcpTaxNumberOrDOB");const n=null===(o=(l=t.current).getRootNode)||void 0===o?void 0:o.call(l);if("country"===e||"stateOrProvince"===e){const t=r(n,`.adyen-checkout__field--${e} .adyen-checkout__filter-input`);null==t||t.focus({preventScroll:i})}else{const t=r(n,`[name="${e}"]`);null==t||t.focus({preventScroll:i})}};export{n as getAddressHandler,c as getAutoJumpHandler,s as getFocusHandler,l as setFocusOnFirstField};
//# sourceMappingURL=handlers.js.map
