import{a as e}from"./chunk-Cyuzqnbw.js";import{i as t,r as n}from"./bundle-mjs-DssaXR6m.js";import{h as r,i,r as a}from"./useBaseUiId-DL38u1cQ.js";import{B as o,c as s,l as c,m as l}from"./api-DTaM-PBA.js";import{Ot as u}from"./index-V977rFVH.js";import{a as d,i as f,n as p,r as m,t as h}from"./useRegisterFieldControl-DOObtV36.js";import{t as g}from"./useControlled-t2_qXo7Q.js";var _=e(t()),v=_.forwardRef(function(e,t){let{render:n,className:s,id:v,name:y,value:b,disabled:x=!1,onValueChange:S,defaultValue:C,autoFocus:w=!1,style:T,...E}=e,{state:D,name:O,disabled:k,setTouched:A,setDirty:j,validityData:M,setFocused:N,setFilled:P,validationMode:F,validation:I}=f(),L=k||x,R=O??y,z={...D,disabled:L},{labelId:B}=m(),V=p({id:v});o(()=>{let e=b!=null;I.inputRef.current?.value||e&&b!==``?P(!0):e&&b===``&&P(!1)},[I.inputRef,P,b]);let H=_.useRef(null);o(()=>{w&&H.current===u(a(H.current))&&N(!0)},[w,N]);let[U]=g({controlled:b,default:C,name:`FieldControl`,state:`value`}),W=b!==void 0,G=W?U:void 0,K=l(()=>I.inputRef.current?.value);return h(I.inputRef,V,G,K),c(`input`,e,{ref:[t,H],state:z,props:[{id:V,disabled:L,name:R,ref:I.inputRef,"aria-labelledby":B,autoFocus:w,...W?{value:G}:{defaultValue:C},onChange(e){let t=e.currentTarget.value;S?.(t,i(r,e.nativeEvent)),j(t!==M.initialValue),P(t!==``)},onFocus(){N(!0)},onBlur(e){A(!0),N(!1),F===`onBlur`&&I.commit(e.currentTarget.value)},onKeyDown(e){e.currentTarget.tagName===`INPUT`&&e.key===`Enter`&&(A(!0),I.commit(e.currentTarget.value))}},I.getInputValidationProps(),E],stateAttributesMapping:d})}),y=n(),b=_.forwardRef(function(e,t){return(0,y.jsx)(v,{ref:t,...e})});function x({className:e,type:t,...n}){return(0,y.jsx)(b,{type:t,"data-slot":`input`,className:s(`h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}export{x as t};