import{o as e}from"./chunk.DuxOD-Sk.js";import{r as t}from"./emotion-is-prop-valid.esm.DV_OErv-.js";import{T as n}from"./utils.B9mvrYZE.js";import{t as r}from"./inputUtils.BdAxEjXK.js";var i=e(t());function a({formId:e,maxChars:t,setDirty:r,setUiValue:a,setValueWithSource:o,additionalAction:s}){return(0,i.useCallback)(i=>{let{value:c}=i.target;t!==0&&c.length>t||(r(!0),a(c),n({formId:e})&&o({value:c,fromUi:!0}),s&&s())},[e,t,r,a,o,s])}function o(e,t,n,a,o,s=!1){return(0,i.useCallback)(i=>{let c=s?i.metaKey||i.ctrlKey:!0;!r(i)||!c||(i.preventDefault(),n&&t(),a.allowFormEnterToSubmit(e)&&a.submitForm(e,o))},[e,o,n,t,a,s])}function s(e,t,n,r){(0,i.useEffect)(()=>{r||e!==t&&n(e)},[e,t,r,n])}export{o as n,a as r,s as t};