"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7536],{87536:function(e,t,r){r.d(t,{KN:function(){return B},Qr:function(){return j},U2:function(){return g},bc:function(){return U},cI:function(){return eV},t8:function(){return T}});var a=r(67294),s=e=>"checkbox"===e.type,i=e=>e instanceof Date,l=e=>null==e;let u=e=>"object"==typeof e;var n=e=>!l(e)&&!Array.isArray(e)&&u(e)&&!i(e),o=e=>n(e)&&e.target?s(e.target)?e.target.checked:e.target.value:e,f=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,d=(e,t)=>e.has(f(t)),c=e=>{let t=e.constructor&&e.constructor.prototype;return n(t)&&t.hasOwnProperty("isPrototypeOf")},y="undefined"!=typeof window&&void 0!==window.HTMLElement&&"undefined"!=typeof document;function m(e){let t;let r=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(!(y&&(e instanceof Blob||e instanceof FileList))&&(r||n(e))))return e;else if(t=r?[]:{},Array.isArray(e)||c(e))for(let r in e)t[r]=m(e[r]);else t=e;return t}var h=e=>Array.isArray(e)?e.filter(Boolean):[],v=e=>void 0===e,g=(e,t,r)=>{if(!t||!n(e))return r;let a=h(t.split(/[,[\].]+?/)).reduce((e,t)=>l(e)?e:e[t],e);return v(a)||a===e?v(e[t])?r:e[t]:a};let p={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},_={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},b={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},V=a.createContext(null),A=()=>a.useContext(V);var w=(e,t,r,a=!0)=>{let s={defaultValues:t._defaultValues};for(let i in e)Object.defineProperty(s,i,{get:()=>{let s=i;return t._proxyFormState[s]!==_.all&&(t._proxyFormState[s]=!a||_.all),r&&(r[s]=!0),e[s]}});return s},S=e=>n(e)&&!Object.keys(e).length,x=(e,t,r,a)=>{r(e);let{name:s,...i}=e;return S(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(e=>t[e]===(!a||_.all))},F=e=>Array.isArray(e)?e:[e],k=(e,t,r)=>r&&t?e===t:!e||!t||e===t||F(e).some(e=>e&&(e.startsWith(t)||t.startsWith(e)));function D(e){let t=a.useRef(e);t.current=e,a.useEffect(()=>{let r=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{r&&r.unsubscribe()}},[e.disabled])}var C=e=>"string"==typeof e,O=(e,t,r,a,s)=>C(e)?(a&&t.watch.add(e),g(r,e,s)):Array.isArray(e)?e.map(e=>(a&&t.watch.add(e),g(r,e))):(a&&(t.watchAll=!0),r),E=e=>/^\w*$/.test(e),L=e=>h(e.replace(/["|']|\]/g,"").split(/\.|\[/));function T(e,t,r){let a=-1,s=E(t)?[t]:L(t),i=s.length,l=i-1;for(;++a{k(n.current,e.name,u)&&f(m(O(n.current,r._names,e.values||r._formValues,!1,i)))}});let[o,f]=a.useState(r._getWatch(s,i));return a.useEffect(()=>r._removeUnmounted()),o}({control:s,name:r,defaultValue:g(s._formValues,r,g(s._defaultValues,r,e.defaultValue)),exact:!0}),n=function(e){let t=A(),{control:r=t.control,disabled:s,name:i,exact:l}=e||{},[u,n]=a.useState(r._formState),o=a.useRef(!0),f=a.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=a.useRef(i);return d.current=i,D({disabled:s,next:e=>o.current&&k(d.current,e.name,l)&&x(e,f.current,r._updateFormState)&&n({...r._formState,...e}),subject:r._subjects.state}),a.useEffect(()=>(o.current=!0,f.current.isValid&&r._updateValid(!0),()=>{o.current=!1}),[r]),w(u,r,f.current,!1)}({control:s,name:r}),f=a.useRef(s.register(r,{...e.rules,value:u}));return a.useEffect(()=>{let e=s._options.shouldUnregister||i,t=(e,t)=>{let r=g(s._fields,e);r&&(r._f.mount=t)};if(t(r,!0),e){let e=m(g(s._options.defaultValues,r));T(s._defaultValues,r,e),v(g(s._formValues,r))&&T(s._formValues,r,e)}return()=>{(l?e&&!s._state.action:e)?s.unregister(r):t(r,!1)}},[r,s,l,i]),{field:{name:r,value:u,onChange:a.useCallback(e=>f.current.onChange({target:{value:o(e),name:r},type:p.CHANGE}),[r]),onBlur:a.useCallback(()=>f.current.onBlur({target:{value:g(s._formValues,r),name:r},type:p.BLUR}),[r,s]),ref:e=>{let t=g(s._fields,r);t&&e&&(t._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})}},formState:n,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!g(n.errors,r)},isDirty:{enumerable:!0,get:()=>!!g(n.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!g(n.touchedFields,r)},error:{enumerable:!0,get:()=>g(n.errors,r)}})}}let j=e=>e.render(U(e));var B=(e,t,r,a,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[a]:s||!0}}:{};let N=(e,t,r)=>{for(let a of r||Object.keys(e)){let r=g(e,a);if(r){let{_f:e,...a}=r;if(e&&t(e.name)){if(e.ref.focus){e.ref.focus();break}if(e.refs&&e.refs[0].focus){e.refs[0].focus();break}}else n(a)&&N(a,t)}}};var M=e=>({isOnSubmit:!e||e===_.onSubmit,isOnBlur:e===_.onBlur,isOnChange:e===_.onChange,isOnAll:e===_.all,isOnTouch:e===_.onTouched}),R=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length)))),q=(e,t,r)=>{let a=h(g(e,r));return T(a,"root",t[r]),T(e,r,a),e},H=e=>"boolean"==typeof e,P=e=>"file"===e.type,I=e=>"function"==typeof e,W=e=>{if(!y)return!1;let t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},$=e=>C(e),G=e=>"radio"===e.type,K=e=>e instanceof RegExp;let Q={value:!1,isValid:!1},z={value:!0,isValid:!0};var J=e=>{if(Array.isArray(e)){if(e.length>1){let t=e.filter(e=>e&&e.checked&&!e.disabled).map(e=>e.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!v(e[0].attributes.value)?v(e[0].value)||""===e[0].value?z:{value:e[0].value,isValid:!0}:z:Q}return Q};let X={isValid:!1,value:null};var Y=e=>Array.isArray(e)?e.reduce((e,t)=>t&&t.checked&&!t.disabled?{isValid:!0,value:t.value}:e,X):X;function Z(e,t,r="validate"){if($(e)||Array.isArray(e)&&e.every($)||H(e)&&!e)return{type:r,message:$(e)?e:"",ref:t}}var ee=e=>n(e)&&!K(e)?e:{value:e,message:""},et=async(e,t,r,a,i)=>{let{ref:u,refs:o,required:f,maxLength:d,minLength:c,min:y,max:m,pattern:h,validate:p,name:_,valueAsNumber:V,mount:A,disabled:w}=e._f,x=g(t,_);if(!A||w)return{};let F=o?o[0]:u,k=e=>{a&&F.reportValidity&&(F.setCustomValidity(H(e)?"":e||""),F.reportValidity())},D={},O=G(u),E=s(u),L=(V||P(u))&&v(u.value)&&v(x)||W(u)&&""===u.value||""===x||Array.isArray(x)&&!x.length,T=B.bind(null,_,r,D),U=(e,t,r,a=b.maxLength,s=b.minLength)=>{let i=e?t:r;D[_]={type:e?a:s,message:i,ref:u,...T(e?a:s,i)}};if(i?!Array.isArray(x)||!x.length:f&&(!(O||E)&&(L||l(x))||H(x)&&!x||E&&!J(o).isValid||O&&!Y(o).isValid)){let{value:e,message:t}=$(f)?{value:!!f,message:f}:ee(f);if(e&&(D[_]={type:b.required,message:t,ref:F,...T(b.required,t)},!r))return k(t),D}if(!L&&(!l(y)||!l(m))){let e,t;let a=ee(m),s=ee(y);if(l(x)||isNaN(x)){let r=u.valueAsDate||new Date(x),i=e=>new Date(new Date().toDateString()+" "+e),l="time"==u.type,n="week"==u.type;C(a.value)&&x&&(e=l?i(x)>i(a.value):n?x>a.value:r>new Date(a.value)),C(s.value)&&x&&(t=l?i(x)a.value),l(s.value)||(t=r+e.value,s=!l(t.value)&&x.length<+t.value;if((a||s)&&(U(a,e.message,t.message),!r))return k(D[_].message),D}if(h&&!L&&C(x)){let{value:e,message:t}=ee(h);if(K(e)&&!x.match(e)&&(D[_]={type:b.pattern,message:t,ref:u,...T(b.pattern,t)},!r))return k(t),D}if(p){if(I(p)){let e=await p(x,t),a=Z(e,F);if(a&&(D[_]={...a,...T(b.validate,a.message)},!r))return k(a.message),D}else if(n(p)){let e={};for(let a in p){if(!S(e)&&!r)break;let s=Z(await p[a](x,t),F,a);s&&(e={...s,...T(a,s.message)},k(s.message),r&&(D[_]=e))}if(!S(e)&&(D[_]={ref:F,...e},!r))return D}}return k(!0),D};function er(e,t){let r=Array.isArray(t)?t:E(t)?[t]:L(t),a=1===r.length?e:function(e,t){let r=t.slice(0,-1).length,a=0;for(;a{for(let r of e)r.next&&r.next(t)},r=t=>(e.push(t),{unsubscribe:()=>{e=e.filter(e=>e!==t)}}),a=()=>{e=[]};return{get observers(){return e},next:t,subscribe:r,unsubscribe:a}}var es=e=>l(e)||!u(e);function ei(e,t){if(es(e)||es(t))return e===t;if(i(e)&&i(t))return e.getTime()===t.getTime();let r=Object.keys(e),a=Object.keys(t);if(r.length!==a.length)return!1;for(let s of r){let r=e[s];if(!a.includes(s))return!1;if("ref"!==s){let e=t[s];if(i(r)&&i(e)||n(r)&&n(e)||Array.isArray(r)&&Array.isArray(e)?!ei(r,e):r!==e)return!1}}return!0}var el=e=>"select-multiple"===e.type,eu=e=>G(e)||s(e),en=e=>W(e)&&e.isConnected,eo=e=>{for(let t in e)if(I(e[t]))return!0;return!1};function ef(e,t={}){let r=Array.isArray(e);if(n(e)||r)for(let r in e)Array.isArray(e[r])||n(e[r])&&!eo(e[r])?(t[r]=Array.isArray(e[r])?[]:{},ef(e[r],t[r])):l(e[r])||(t[r]=!0);return t}var ed=(e,t)=>(function e(t,r,a){let s=Array.isArray(t);if(n(t)||s)for(let s in t)Array.isArray(t[s])||n(t[s])&&!eo(t[s])?v(r)||es(a[s])?a[s]=Array.isArray(t[s])?ef(t[s],[]):{...ef(t[s])}:e(t[s],l(r)?{}:r[s],a[s]):a[s]=!ei(t[s],r[s]);return a})(e,t,ef(t)),ec=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:a})=>v(e)?e:t?""===e?NaN:e?+e:e:r&&C(e)?new Date(e):a?a(e):e;function ey(e){let t=e.ref;return(e.refs?e.refs.every(e=>e.disabled):t.disabled)?void 0:P(t)?t.files:G(t)?Y(e.refs).value:el(t)?[...t.selectedOptions].map(({value:e})=>e):s(t)?J(e.refs).value:ec(v(t.value)?e.ref.value:t.value,e)}var em=(e,t,r,a)=>{let s={};for(let r of e){let e=g(t,r);e&&T(s,r,e._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:a}},eh=e=>v(e)?e:K(e)?e.source:n(e)?K(e.value)?e.value.source:e.value:e,ev=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function eg(e,t,r){let a=g(e,r);if(a||E(r))return{error:a,name:r};let s=r.split(".");for(;s.length;){let a=s.join("."),i=g(t,a),l=g(e,a);if(i&&!Array.isArray(i)&&r!==a)break;if(l&&l.type)return{name:a,error:l};s.pop()}return{name:r}}var ep=(e,t,r,a,s)=>!s.isOnAll&&(!r&&s.isOnTouch?!(t||e):(r?a.isOnBlur:s.isOnBlur)?!e:(r?!a.isOnChange:!s.isOnChange)||e),e_=(e,t)=>!h(g(e,t)).length&&er(e,t);let eb={mode:_.onSubmit,reValidateMode:_.onChange,shouldFocusError:!0};function eV(e={}){let t=a.useRef(),[r,u]=a.useState({isDirty:!1,isValidating:!1,isLoading:I(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},defaultValues:I(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...function(e={},t){let r,a={...eb,...e},u={submitCount:0,isDirty:!1,isLoading:I(a.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{}},f={},c=(n(a.defaultValues)||n(a.values))&&m(a.defaultValues||a.values)||{},b=a.shouldUnregister?{}:m(c),V={action:!1,mount:!1,watch:!1},A={mount:new Set,unMount:new Set,array:new Set,watch:new Set},w=0,x={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},k={values:ea(),array:ea(),state:ea()},D=e.resetOptions&&e.resetOptions.keepDirtyValues,E=M(a.mode),L=M(a.reValidateMode),U=a.criteriaMode===_.all,j=e=>t=>{clearTimeout(w),w=setTimeout(e,t)},B=async e=>{if(x.isValid||e){let e=a.resolver?S((await X()).errors):await Z(f,!0);e!==u.isValid&&k.state.next({isValid:e})}},$=e=>x.isValidating&&k.state.next({isValidating:e}),G=(e,t=[],r,a,s=!0,i=!0)=>{if(a&&r){if(V.action=!0,i&&Array.isArray(g(f,e))){let t=r(g(f,e),a.argA,a.argB);s&&T(f,e,t)}if(i&&Array.isArray(g(u.errors,e))){let t=r(g(u.errors,e),a.argA,a.argB);s&&T(u.errors,e,t),e_(u.errors,e)}if(x.touchedFields&&i&&Array.isArray(g(u.touchedFields,e))){let t=r(g(u.touchedFields,e),a.argA,a.argB);s&&T(u.touchedFields,e,t)}x.dirtyFields&&(u.dirtyFields=ed(c,b)),k.state.next({name:e,isDirty:eo(e,t),dirtyFields:u.dirtyFields,errors:u.errors,isValid:u.isValid})}else T(b,e,t)},K=(e,t)=>{T(u.errors,e,t),k.state.next({errors:u.errors})},Q=(e,t,r,a)=>{let s=g(f,e);if(s){let i=g(b,e,v(r)?g(c,e):r);v(i)||a&&a.defaultChecked||t?T(b,e,t?i:ey(s._f)):eA(e,i),V.mount&&B()}},z=(e,t,r,a,s)=>{let i=!1,l=!1,n={name:e};if(!r||a){x.isDirty&&(l=u.isDirty,u.isDirty=n.isDirty=eo(),i=l!==n.isDirty);let r=ei(g(c,e),t);l=g(u.dirtyFields,e),r?er(u.dirtyFields,e):T(u.dirtyFields,e,!0),n.dirtyFields=u.dirtyFields,i=i||x.dirtyFields&&!r!==l}if(r){let t=g(u.touchedFields,e);t||(T(u.touchedFields,e,r),n.touchedFields=u.touchedFields,i=i||x.touchedFields&&t!==r)}return i&&s&&k.state.next(n),i?n:{}},J=(t,a,s,i)=>{let l=g(u.errors,t),n=x.isValid&&H(a)&&u.isValid!==a;if(e.delayError&&s?(r=j(()=>K(t,s)))(e.delayError):(clearTimeout(w),r=null,s?T(u.errors,t,s):er(u.errors,t)),(s?!ei(l,s):l)||!S(i)||n){let e={...i,...n&&H(a)?{isValid:a}:{},errors:u.errors,name:t};u={...u,...e},k.state.next(e)}$(!1)},X=async e=>a.resolver(b,a.context,em(e||A.mount,f,a.criteriaMode,a.shouldUseNativeValidation)),Y=async e=>{let{errors:t}=await X();if(e)for(let r of e){let e=g(t,r);e?T(u.errors,r,e):er(u.errors,r)}else u.errors=t;return t},Z=async(e,t,r={valid:!0})=>{for(let s in e){let i=e[s];if(i){let{_f:e,...s}=i;if(e){let s=A.array.has(e.name),l=await et(i,b,U,a.shouldUseNativeValidation&&!t,s);if(l[e.name]&&(r.valid=!1,t))break;t||(g(l,e.name)?s?q(u.errors,l,e.name):T(u.errors,e.name,l[e.name]):er(u.errors,e.name))}s&&await Z(s,t,r)}}return r.valid},ee=()=>{for(let e of A.unMount){let t=g(f,e);t&&(t._f.refs?t._f.refs.every(e=>!en(e)):!en(t._f.ref))&&eL(e)}A.unMount=new Set},eo=(e,t)=>(e&&t&&T(b,e,t),!ei(ek(),c)),ef=(e,t,r)=>O(e,A,{...V.mount?b:v(t)?c:C(e)?{[e]:t}:t},r,t),eV=t=>h(g(V.mount?b:c,t,e.shouldUnregister?g(c,t,[]):[])),eA=(e,t,r={})=>{let a=g(f,e),i=t;if(a){let r=a._f;r&&(r.disabled||T(b,e,ec(t,r)),i=W(r.ref)&&l(t)?"":t,el(r.ref)?[...r.ref.options].forEach(e=>e.selected=i.includes(e.value)):r.refs?s(r.ref)?r.refs.length>1?r.refs.forEach(e=>(!e.defaultChecked||!e.disabled)&&(e.checked=Array.isArray(i)?!!i.find(t=>t===e.value):i===e.value)):r.refs[0]&&(r.refs[0].checked=!!i):r.refs.forEach(e=>e.checked=e.value===i):P(r.ref)?r.ref.value="":(r.ref.value=i,r.ref.type||k.values.next({name:e,values:{...b}})))}(r.shouldDirty||r.shouldTouch)&&z(e,i,r.shouldTouch,r.shouldDirty,!0),r.shouldValidate&&eF(e)},ew=(e,t,r)=>{for(let a in t){let s=t[a],l=`${e}.${a}`,u=g(f,l);!A.array.has(e)&&es(s)&&(!u||u._f)||i(s)?eA(l,s,r):ew(l,s,r)}},eS=(e,r,a={})=>{let s=g(f,e),i=A.array.has(e),n=m(r);T(b,e,n),i?(k.array.next({name:e,values:{...b}}),(x.isDirty||x.dirtyFields)&&a.shouldDirty&&k.state.next({name:e,dirtyFields:ed(c,b),isDirty:eo(e,n)})):!s||s._f||l(n)?eA(e,n,a):ew(e,n,a),R(e,A)&&k.state.next({...u}),k.values.next({name:e,values:{...b}}),V.mount||t()},ex=async e=>{let t=e.target,s=t.name,i=!0,l=g(f,s);if(l){let n,d;let c=t.type?ey(l._f):o(e),y=e.type===p.BLUR||e.type===p.FOCUS_OUT,m=!ev(l._f)&&!a.resolver&&!g(u.errors,s)&&!l._f.deps||ep(y,g(u.touchedFields,s),u.isSubmitted,L,E),h=R(s,A,y);T(b,s,c),y?(l._f.onBlur&&l._f.onBlur(e),r&&r(0)):l._f.onChange&&l._f.onChange(e);let v=z(s,c,y,!1),_=!S(v)||h;if(y||k.values.next({name:s,type:e.type,values:{...b}}),m)return x.isValid&&B(),_&&k.state.next({name:s,...h?{}:v});if(!y&&h&&k.state.next({...u}),$(!0),a.resolver){let{errors:e}=await X([s]),t=eg(u.errors,f,s),r=eg(e,f,t.name||s);n=r.error,s=r.name,d=S(e)}else n=(await et(l,b,U,a.shouldUseNativeValidation))[s],(i=isNaN(c)||c===g(b,s,c))&&(n?d=!1:x.isValid&&(d=await Z(f,!0)));i&&(l._f.deps&&eF(l._f.deps),J(s,d,n,v))}},eF=async(e,t={})=>{let r,s;let i=F(e);if($(!0),a.resolver){let t=await Y(v(e)?e:i);r=S(t),s=e?!i.some(e=>g(t,e)):r}else e?((s=(await Promise.all(i.map(async e=>{let t=g(f,e);return await Z(t&&t._f?{[e]:t}:t)}))).every(Boolean))||u.isValid)&&B():s=r=await Z(f);return k.state.next({...!C(e)||x.isValid&&r!==u.isValid?{}:{name:e},...a.resolver||!e?{isValid:r}:{},errors:u.errors,isValidating:!1}),t.shouldFocus&&!s&&N(f,e=>e&&g(u.errors,e),e?i:A.mount),s},ek=e=>{let t={...c,...V.mount?b:{}};return v(e)?t:C(e)?g(t,e):e.map(e=>g(t,e))},eD=(e,t)=>({invalid:!!g((t||u).errors,e),isDirty:!!g((t||u).dirtyFields,e),isTouched:!!g((t||u).touchedFields,e),error:g((t||u).errors,e)}),eC=e=>{e&&F(e).forEach(e=>er(u.errors,e)),k.state.next({errors:e?u.errors:{}})},eO=(e,t,r)=>{let a=(g(f,e,{_f:{}})._f||{}).ref;T(u.errors,e,{...t,ref:a}),k.state.next({name:e,errors:u.errors,isValid:!1}),r&&r.shouldFocus&&a&&a.focus&&a.focus()},eE=(e,t)=>I(e)?k.values.subscribe({next:r=>e(ef(void 0,t),r)}):ef(e,t,!0),eL=(e,t={})=>{for(let r of e?F(e):A.mount)A.mount.delete(r),A.array.delete(r),t.keepValue||(er(f,r),er(b,r)),t.keepError||er(u.errors,r),t.keepDirty||er(u.dirtyFields,r),t.keepTouched||er(u.touchedFields,r),a.shouldUnregister||t.keepDefaultValue||er(c,r);k.values.next({values:{...b}}),k.state.next({...u,...t.keepDirty?{isDirty:eo()}:{}}),t.keepIsValid||B()},eT=(e,t={})=>{let r=g(f,e),s=H(t.disabled);return T(f,e,{...r||{},_f:{...r&&r._f?r._f:{ref:{name:e}},name:e,mount:!0,...t}}),A.mount.add(e),r?s&&T(b,e,t.disabled?void 0:g(b,e,ey(r._f))):Q(e,!0,t.value),{...s?{disabled:t.disabled}:{},...a.shouldUseNativeValidation?{required:!!t.required,min:eh(t.min),max:eh(t.max),minLength:eh(t.minLength),maxLength:eh(t.maxLength),pattern:eh(t.pattern)}:{},name:e,onChange:ex,onBlur:ex,ref:s=>{if(s){eT(e,t),r=g(f,e);let a=v(s.value)&&s.querySelectorAll&&s.querySelectorAll("input,select,textarea")[0]||s,i=eu(a),l=r._f.refs||[];(i?l.find(e=>e===a):a===r._f.ref)||(T(f,e,{_f:{...r._f,...i?{refs:[...l.filter(en),a,...Array.isArray(g(c,e))?[{}]:[]],ref:{type:a.type,name:e}}:{ref:a}}}),Q(e,!1,void 0,a))}else(r=g(f,e,{}))._f&&(r._f.mount=!1),(a.shouldUnregister||t.shouldUnregister)&&!(d(A.array,e)&&V.action)&&A.unMount.add(e)}}},eU=()=>a.shouldFocusError&&N(f,e=>e&&g(u.errors,e),A.mount),ej=(e,t)=>async r=>{r&&(r.preventDefault&&r.preventDefault(),r.persist&&r.persist());let s=m(b);if(k.state.next({isSubmitting:!0}),a.resolver){let{errors:e,values:t}=await X();u.errors=e,s=t}else await Z(f);er(u.errors,"root"),S(u.errors)?(k.state.next({errors:{}}),await e(s,r)):(t&&await t({...u.errors},r),eU(),setTimeout(eU)),k.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:S(u.errors),submitCount:u.submitCount+1,errors:u.errors})},eB=(e,t={})=>{g(f,e)&&(v(t.defaultValue)?eS(e,g(c,e)):(eS(e,t.defaultValue),T(c,e,t.defaultValue)),t.keepTouched||er(u.touchedFields,e),t.keepDirty||(er(u.dirtyFields,e),u.isDirty=t.defaultValue?eo(e,g(c,e)):eo()),!t.keepError&&(er(u.errors,e),x.isValid&&B()),k.state.next({...u}))},eN=(r,a={})=>{let s=r||c,i=m(s),l=r&&!S(r)?i:c;if(a.keepDefaultValues||(c=s),!a.keepValues){if(a.keepDirtyValues||D)for(let e of A.mount)g(u.dirtyFields,e)?T(l,e,g(b,e)):eS(e,g(l,e));else{if(y&&v(r))for(let e of A.mount){let t=g(f,e);if(t&&t._f){let e=Array.isArray(t._f.refs)?t._f.refs[0]:t._f.ref;if(W(e)){let t=e.closest("form");if(t){t.reset();break}}}}f={}}b=e.shouldUnregister?a.keepDefaultValues?m(c):{}:i,k.array.next({values:{...l}}),k.values.next({values:{...l}})}A={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},V.mount||t(),V.mount=!x.isValid||!!a.keepIsValid,V.watch=!!e.shouldUnregister,k.state.next({submitCount:a.keepSubmitCount?u.submitCount:0,isDirty:a.keepDirty?u.isDirty:!!(a.keepDefaultValues&&!ei(r,c)),isSubmitted:!!a.keepIsSubmitted&&u.isSubmitted,dirtyFields:a.keepDirtyValues?u.dirtyFields:a.keepDefaultValues&&r?ed(c,r):{},touchedFields:a.keepTouched?u.touchedFields:{},errors:a.keepErrors?u.errors:{},isSubmitting:!1,isSubmitSuccessful:!1})},eM=(e,t)=>eN(I(e)?e(b):e,t),eR=(e,t={})=>{let r=g(f,e),a=r&&r._f;if(a){let e=a.refs?a.refs[0]:a.ref;e.focus&&(e.focus(),t.shouldSelect&&e.select())}},eq=e=>{u={...u,...e}},eH=()=>I(a.defaultValues)&&a.defaultValues().then(e=>{eM(e,a.resetOptions),k.state.next({isLoading:!1})});return{control:{register:eT,unregister:eL,getFieldState:eD,_executeSchema:X,_getWatch:ef,_getDirty:eo,_updateValid:B,_removeUnmounted:ee,_updateFieldArray:G,_getFieldArray:eV,_reset:eN,_resetDefaultValues:eH,_updateFormState:eq,_subjects:k,_proxyFormState:x,get _fields(){return f},get _formValues(){return b},get _state(){return V},set _state(value){V=value},get _defaultValues(){return c},get _names(){return A},set _names(value){A=value},get _formState(){return u},set _formState(value){u=value},get _options(){return a},set _options(value){a={...a,...value}}},trigger:eF,register:eT,handleSubmit:ej,watch:eE,setValue:eS,getValues:ek,reset:eM,resetField:eB,clearErrors:eC,unregister:eL,setError:eO,setFocus:eR,getFieldState:eD}}(e,()=>u(e=>({...e}))),formState:r});let f=t.current.control;return f._options=e,D({subject:f._subjects.state,next:e=>{x(e,f._proxyFormState,f._updateFormState,!0)&&u({...f._formState})}}),a.useEffect(()=>{e.values&&!ei(e.values,f._defaultValues)?f._reset(e.values,f._options.resetOptions):f._resetDefaultValues()},[e.values,f]),a.useEffect(()=>{f._state.mount||(f._updateValid(),f._state.mount=!0),f._state.watch&&(f._state.watch=!1,f._subjects.state.next({...f._formState})),f._removeUnmounted()}),t.current.formState=w(r,f),t.current}}}]);