import{o as e}from"./rolldown-runtime.DAXXjFlN.js";import{r as t}from"./emotion-is-prop-valid.esm.CygBv61C.js";import{$ as n,C as r,Q as i,b as a,nt as o,ot as s,q as c,w as l}from"./Tooltip.PNC8NIZa.js";import{n as u,t as d}from"./useFocusRing.C8atAWyK.js";import{t as f}from"./Hidden.Bpblr2PM.js";import{t as p}from"./useField.CLWVwWoT.js";import{a as m,t as h}from"./useFormValidation.CZGpvO3z.js";import{t as g}from"./useFormReset.Chklfqrk.js";var _=e(t(),1),v=(0,_.createContext)({}),y=(0,_.forwardRef)(function(e,t){[e,t]=i(e,t,v);let{isDisabled:r,isInvalid:c,isReadOnly:l,onHoverStart:u,onHoverChange:f,onHoverEnd:p,...m}=e;r??=!!e[`aria-disabled`]&&e[`aria-disabled`]!==`false`,c??=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`;let{hoverProps:h,isHovered:g}=a({onHoverStart:u,onHoverChange:f,onHoverEnd:p,isDisabled:r}),{isFocused:y,isFocusVisible:b,focusProps:x}=d({within:!0}),S=n({...e,values:{isHovered:g,isFocusWithin:y,isFocusVisible:b,isDisabled:r,isInvalid:c},defaultClassName:`react-aria-Group`});return _.createElement(o.div,{...s(m,x,h),...S,ref:t,role:e.role??`group`,slot:e.slot??void 0,"data-focus-within":y||void 0,"data-hovered":g||void 0,"data-focus-visible":b||void 0,"data-disabled":r||void 0,"data-invalid":c||void 0,"data-readonly":l||void 0},S.children)}),b=(0,_.createContext)({}),x=e=>{let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,...i}=e;return i},S=f(function(e,t){[e,t]=i(e,t,b);let{hoverProps:r,isHovered:c}=a({...e,isDisabled:e.disabled}),{isFocused:l,isFocusVisible:u,focusProps:f}=d({isTextInput:!0,autoFocus:e.autoFocus}),p=!!e[`aria-invalid`]&&e[`aria-invalid`]!==`false`,m=n({...e,values:{isHovered:c,isFocused:l,isFocusVisible:u,isDisabled:e.disabled||!1,isInvalid:p},defaultClassName:`react-aria-Input`});return _.createElement(o.input,{...s(x(e),f,r),...m,ref:t,"data-focused":l||void 0,"data-disabled":e.disabled||void 0,"data-hovered":c||void 0,"data-focus-visible":u||void 0,"data-invalid":p||void 0})});function C(e,t){let{inputElementType:n=`input`,isDisabled:i=!1,isRequired:a=!1,isReadOnly:o=!1,type:d=`text`,validationBehavior:f=`aria`}=e,[v,y]=l(e.value,e.defaultValue||``,e.onChange),{focusableProps:b}=u(e,t),x=m({...e,value:v}),{isInvalid:S,validationErrors:C,validationDetails:w}=x.displayValidation,{labelProps:T,fieldProps:E,descriptionProps:D,errorMessageProps:O}=p({...e,isInvalid:S,errorMessage:e.errorMessage||C}),k=r(e,{labelable:!0}),A={type:d,pattern:e.pattern},[j]=(0,_.useState)(v);return g(t,e.defaultValue??j,y),h(e,x,t),{labelProps:T,inputProps:s(k,n===`input`?A:void 0,{disabled:i,readOnly:o,required:a&&f===`native`,"aria-required":a&&f===`aria`||void 0,"aria-invalid":S||void 0,"aria-errormessage":e[`aria-errormessage`],"aria-activedescendant":e[`aria-activedescendant`],"aria-autocomplete":e[`aria-autocomplete`],"aria-haspopup":e[`aria-haspopup`],"aria-controls":e[`aria-controls`],value:v,onChange:e=>y(c(e).value),autoComplete:e.autoComplete,autoCapitalize:e.autoCapitalize,maxLength:e.maxLength,minLength:e.minLength,name:e.name,form:e.form,placeholder:e.placeholder,inputMode:e.inputMode,autoCorrect:e.autoCorrect,spellCheck:e.spellCheck,enterKeyHint:e.enterKeyHint,onCopy:e.onCopy,onCut:e.onCut,onPaste:e.onPaste,onCompositionEnd:e.onCompositionEnd,onCompositionStart:e.onCompositionStart,onCompositionUpdate:e.onCompositionUpdate,onSelect:e.onSelect,onBeforeInput:e.onBeforeInput,onInput:e.onInput,...b,...E}),descriptionProps:D,errorMessageProps:O,isInvalid:S,validationErrors:C,validationDetails:w}}export{v as a,y as i,b as n,S as r,C as t};