import{useFormControlContext as i}from"./form-control.js";import{ariaAttr as l}from"../../../utils/dist/esm/dom.js";import{callAllHandlers as n}from"../../../utils/dist/esm/function.js";function e(){return(e=Object.assign||function(i){for(var l=1;l<arguments.length;l++){var n=arguments[l];for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(i[e]=n[e])}return i}).apply(this,arguments)}function d(i,l){if(null==i)return{};var n,e,d={},r=Object.keys(i);for(e=0;e<r.length;e++)n=r[e],l.indexOf(n)>=0||(d[n]=i[n]);return d}function r(i){var n=s(i),{isDisabled:r,isInvalid:u,isReadOnly:a,isRequired:o}=n;return e({},d(n,["isDisabled","isInvalid","isReadOnly","isRequired"]),{disabled:r,readOnly:a,required:o,"aria-invalid":l(u),"aria-required":l(o),"aria-readonly":l(a)})}function s(l){var r,s,u,a=i(),{id:o,disabled:t,readOnly:v,required:c,isRequired:b,isInvalid:f,isReadOnly:y,isDisabled:O,onFocus:p,onBlur:R}=l,m=d(l,["id","disabled","readOnly","required","isRequired","isInvalid","isReadOnly","isDisabled","onFocus","onBlur"]),q=[];return null!=a&&a.hasFeedbackText&&null!=a&&a.isInvalid&&q.push(a.feedbackId),null!=a&&a.hasHelpText&&q.push(a.helpTextId),e({},m,{"aria-describedby":q.join(" ")||void 0,id:null!=o?o:null==a?void 0:a.id,isDisabled:null!=(r=null!=t?t:O)?r:null==a?void 0:a.isDisabled,isReadOnly:null!=(s=null!=v?v:y)?s:null==a?void 0:a.isReadOnly,isRequired:null!=(u=null!=c?c:b)?u:null==a?void 0:a.isRequired,isInvalid:null!=f?f:null==a?void 0:a.isInvalid,onFocus:n(null==a?void 0:a.onFocus,p),onBlur:n(null==a?void 0:a.onBlur,R)})}export{r as useFormControl,s as useFormControlProps};
//# sourceMappingURL=use-form-control.js.map
