var k=Object.defineProperty,G=Object.defineProperties;var S=Object.getOwnPropertyDescriptors;var n=Object.getOwnPropertySymbols;var f=Object.prototype.hasOwnProperty,c=Object.prototype.propertyIsEnumerable;var u=(e,t,r)=>t in e?k(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,s=(e,t)=>{for(var r in t||(t={}))f.call(t,r)&&u(e,r,t[r]);if(n)for(var r of n(t))c.call(t,r)&&u(e,r,t[r]);return e},d=(e,t)=>G(e,S(t));var m=(e,t)=>{var r={};for(var o in e)f.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(e!=null&&n)for(var o of n(e))t.indexOf(o)<0&&c.call(e,o)&&(r[o]=e[o]);return r};import{FormControl as E,InputGroup as P}from"@chakra-ui/react";import{useEffect as U,useRef as b}from"react";import{useController as q}from"react-hook-form";import{jsx as v,jsxs as x}from"react/jsx-runtime";var w=({name:e,acceptedFileTypes:t,control:r,renderChild:o,schema:C})=>{let i=b(),A=q({name:e,control:r,rules:{validate:C.validateSync}}),{field:F}=A,a=F,{ref:g,value:l,onChange:y}=a,R=m(a,["ref","value","onChange"]),{fieldState:{invalid:p,error:z}}=A,h=o({click:()=>i.current.click(),image:l,error:p});return U(()=>{},[l]),v(E,{isInvalid:p,children:x(P,{children:[v("input",d(s({type:"file",accept:t,name:e,ref:i},R),{inputRef:g,style:{display:"none"},onChange:I=>y(I.target.files[0])})),h]})})},L=w;export{L as default};
