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 n=(e,r,n)=>{if(e){if(t.__IS_IOS){const e=r.current.getRootNode?.(),t=e?.querySelector(`[data-id="${n}"]`);i(t)}o(n)?r.current.setFocusOn(n):d(n,r,t.__IS_IOS)}},s=(e,r,t)=>i=>{e("billingAddress",i.data),r("billingAddress",i.isValid),t("billingAddress",i.errors)},c=(e,r,t)=>i=>{e(i.currentFocusObject),!0===i.focus?r(i.fieldType,i):t(i.fieldType,i)},l=(r,t,i)=>()=>{r.current||(r.current=!0,Promise.resolve().then(()=>{const n=i.findIndex(r=>r===e),s=i.slice(n+1);for(const e of s){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)=>{"taxNumber"===e&&(e="kcpTaxNumberOrDOB");const o=t.current.getRootNode?.();if("country"===e||"stateOrProvince"===e){const t=r(o,`.adyen-checkout__field--${e} .adyen-checkout__filter-input`);t?.focus({preventScroll:i})}else{const t=r(o,`[name="${e}"]`);t?.focus({preventScroll:i})}};export{s as getAddressHandler,l as getAutoJumpHandler,c as getFocusHandler,n as setFocusOnFirstField};
//# sourceMappingURL=handlers.js.map
