text: "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=function(){return(r=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var u in r=arguments[t])Object.prototype.hasOwnProperty.call(r,u)&&(e[u]=r[u]);return e}).apply(this,arguments)};function t(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var u=0;for(n=Object.getOwnPropertySymbols(e);u<n.length;u++)r.indexOf(n[u])<0&&Object.prototype.propertyIsEnumerable.call(e,n[u])&&(t[n[u]]=e[n[u]])}return t}function n(e,r,t,n){return new(t||(t=Promise))((function(u,c){function i(e){try{o(n.next(e))}catch(e){c(e)}}function a(e){try{o(n.throw(e))}catch(e){c(e)}}function o(e){var r;e.done?u(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(i,a)}o((n=n.apply(e,r||[])).next())}))}function u(e,r){var t,n,u,c,i={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]};return c={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function a(c){return function(a){return function(c){if(t)throw new TypeError("Generator is already executing.");for(;i;)try{if(t=1,n&&(u=2&c[0]?n.return:c[0]?n.throw||((u=n.return)&&u.call(n),0):n.next)&&!(u=u.call(n,c[1])).done)return u;switch(n=0,u&&(c=[2&c[0],u.value]),c[0]){case 0:case 1:u=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,n=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(u=i.trys,(u=u.length>0&&u[u.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!u||c[1]>u[0]&&c[1]<u[3])){i.label=c[1];break}if(6===c[0]&&i.label<u[1]){i.label=u[1],u=c;break}if(u&&i.label<u[2]){i.label=u[2],i.ops.push(c);break}u[2]&&i.ops.pop(),i.trys.pop();continue}c=r.call(e,i)}catch(e){c=[6,e],n=0}finally{t=u=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}function c(e){var r="function"==typeof Symbol&&Symbol.iterator,t=r&&e[r],n=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function i(e,r){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var n,u,c=t.call(e),i=[];try{for(;(void 0===r||r-- >0)&&!(n=c.next()).done;)i.push(n.value)}catch(e){u={error:e}}finally{try{n&&!n.done&&(t=c.return)&&t.call(c)}finally{if(u)throw u.error}}return i}function a(){for(var e=[],r=0;r<arguments.length;r++)e=e.concat(i(arguments[r]));return e}var o=function(e){return e instanceof HTMLElement},s="blur",f="change",l="input",d="onBlur",v="onChange",h="onSubmit",y="all",p="max",m="min",b="maxLength",g="minLength",R="pattern",x="required",w="validate";var k=function(e){return null==e},O=function(e){return Array.isArray(e)},V=function(e){return"object"==typeof e},C=function(e){return!k(e)&&!O(e)&&V(e)},E=function(e){return!O(e)&&(/^\w*$/.test(e)||!/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/.test(e))},F=function(e){var r=[];return e.replace(/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,(function(e,t,n,u){r.push(n?u.replace(/\\(\\)?/g,"$1"):t||e)})),r};function S(e,r,t){for(var n=-1,u=E(r)?[r]:F(r),c=u.length,i=c-1;++n<c;){var a=u[n],o=t;if(n!==i){var s=e[a];o=C(s)||O(s)?s:isNaN(+u[n+1])?{}:[]}e[a]=o,e=e[a]}return e}var D=function(e){return Object.entries(e).reduce((function(e,t){var n,u=i(t,2),c=u[0],a=u[1];return E(c)?r(r({},e),((n={})[c]=a,n)):(S(e,c,a),e)}),{})},j=function(e){return void 0===e},A=function(e){return e.filter(Boolean)},B=function(e,r,t){var n=A(r.split(/[,[\].]+?/)).reduce((function(e,r){return k(e)?e:e[r]}),e);return j(n)||n===e?j(e[r])?t:e[r]:n},W=function(e,r){o(e)&&e.removeEventListener&&(e.removeEventListener(l,r),e.removeEventListener(f,r),e.removeEventListener(s,r))},L={isValid:!1,value:""},N=function(e){return O(e)?e.reduce((function(e,r){return r&&r.ref.checked?{isValid:!0,value:r.ref.value}:e}),L):L},P=function(e){return"radio"===e.type},M=function(e){return"file"===e.type},H=function(e){return"checkbox"===e.type},T=function(e){return"select-multiple"===e.type},I={value:!1,isValid:!1},q={value:!0,isValid:!0},z=function(e){if(O(e)){if(e.length>1){var r=e.filter((function(e){return e&&e.ref.checked})).map((function(e){return e.ref.value}));return{value:r,isValid:!!r.length}}var t=e[0].ref,n=t.checked,u=t.value,c=t.attributes;return n?c&&!j(c.value)?j(u)||""===u?q:{value:u,isValid:!0}:q:I}return I};function $(e,r,t){var n=e.current[r];if(n){var u=n.ref.value,c=n.ref;return M(c)?c.files:P(c)?N(n.options).value:T(c)?a(c.options).filter((function(e){return e.selected})).map((function(e){return e.value})):H(c)?z(n.options).value:u}if(t)return t.current[r]}function _(e){return!e||e instanceof HTMLElement&&e.nodeType!==Node.DOCUMENT_NODE&&_(e.parentNode)}var U=function(e){return C(e)&&!Object.keys(e).length};function G(e,r){var t=E(r)?[r]:F(r),n=1==t.length?e:function(e,r){for(var t=r.slice(0,-1).length,n=0;n<t;)e=j(e)?n++:e[r[n++]];return e}(e,t),u=t[t.length-1],c=void 0;n&&delete n[u];for(var i=0;i<t.slice(0,-1).length;i++){var a=-1,o=void 0,s=t.slice(0,-(i+1)),f=s.length-1;for(i>0&&(c=e);++a<s.length;){var l=s[a];o=o?o[l]:e[l],f===a&&(C(o)&&U(o)||O(o)&&!o.filter((function(e){return C(e)&&!U(e)})).length)&&(c?delete c[l]:delete e[l]),c=o}}return e}var J=function(e,r){return e&&e.ref===r};var K=function(e){return"string"==typeof e};var Q=function(e,r,t){var n={},u=function(r){(j(t)||(K(t)?r.startsWith(t):O(t)&&t.find((function(e){return r.startsWith(e)}))))&&(n[r]=$(e,r))};for(var c in e.current)u(c);return function e(r,t){if(!C(r)||!C(t))return t;for(var n in t){var u=r[n],c=t[n];C(u)&&C(c)?r[n]=e(u,c):r[n]=c}return r}(D((r||{}).current||{}),D(n))},X=function(e,r){var t=r.type,n=r.types,u=void 0===n?{}:n,c=r.message;return C(e)&&e.type===t&&e.message===c&&Object.keys(e.types||{}).length===Object.keys(u).length&&Object.entries(e.types||{}).every((function(e){var r=i(e,2),t=r[0],n=r[1];return u[t]===n}))};var Y=function(e){return e instanceof RegExp},Z=function(e){return C(r=e)&&!Y(r)?e:{value:e,message:""};var r},ee=function(e){return"function"==typeof e},re=function(e){return"boolean"==typeof e},te=function(r){return K(r)||C(r)&&e.isValidElement(r)};function ne(e,r,t){if(void 0===t&&(t="validate"),te(e)||re(e)&&!e)return{type:t,message:te(e)?e:"",ref:r}}var ue=function(e,t,n,u,c){var i;if(t){var a=n[e];return r(r({},a),{types:r(r({},a&&a.types?a.types:{}),(i={},i[u]=c||!0,i))})}return{}},ce=function(e,t,a,o){var s=a.ref,f=a.ref,l=f.type,d=f.value,v=a.options,h=a.required,y=a.maxLength,O=a.minLength,V=a.min,E=a.max,F=a.pattern,S=a.validate;return n(void 0,void 0,void 0,(function(){var n,a,f,D,j,A,B,W,L,M,T,I,q,_,G,J,Q,X,ce,ie,ae,oe,se,fe,le,de,ve,he,ye,pe,me,be,ge,Re,xe,we,ke,Oe,Ve,Ce,Ee,Fe,Se,De,je,Ae;return u(this,(function(u){switch(u.label){case 0:return n=e.current,a=s.name,f={},D=P(s),j=H(s),A=D||j,B=""===d,W=ue.bind(null,a,t,f),L=function(e,t,n,u,c){void 0===u&&(u=b),void 0===c&&(c=g);var i=e?t:n;f[a]=r({type:e?u:c,message:i,ref:s},W(e?u:c,i))},h&&(!D&&!j&&(B||k(d))||re(d)&&!d||j&&!z(v).isValid||D&&!N(v).isValid)&&(M=te(h)?{value:!!h,message:h}:Z(h),T=M.value,I=M.message,T&&(f[a]=r({type:x,message:I,ref:A?(n[a].options||[])[0].ref:s},W(x,I)),!t))?[2,f]:(k(V)&&k(E)||(he=void 0,ye=void 0,q=Z(E),_=q.value,G=q.message,J=Z(V),Q=J.value,X=J.message,"number"===l||!l&&!isNaN(d)?(ce=s.valueAsNumber||parseFloat(d),k(_)||(he=ce>_),k(Q)||(ye=ce<Q)):(ie=s.valueAsDate||new Date(d),K(_)&&(he=ie>new Date(_)),K(Q)&&(ye=ie<new Date(Q))),!he&&!ye||(L(!!he,G,X,p,m),t)))&&(!K(d)||B||!y&&!O||(ae=Z(y),oe=ae.value,se=ae.message,fe=Z(O),le=fe.value,de=fe.message,ve=d.toString().length,he=!k(oe)&&ve>oe,ye=!k(le)&&ve<le,!he&&!ye||(L(!!he,se,de),t)))&&(!F||B||(pe=Z(F),me=pe.value,be=pe.message,!Y(me)||me.test(d)||(f[a]=r({type:R,message:be,ref:s},W(R,be)),t)))?S?(ge=$(e,a,o),Re=A&&v?v[0].ref:s,ee(S)?[4,S(ge)]:[3,2]):[3,11]:[2,f];case 1:return xe=u.sent(),(Se=ne(xe,Re))&&(f[a]=r(r({},Se),W(w,Se.message)),!t)?[2,f]:[3,11];case 2:if(!C(S))return[3,11];we={},u.label=3;case 3:u.trys.push([3,8,9,10]),ke=c(Object.entries(S)),Oe=ke.next(),u.label=4;case 4:return Oe.done?[3,7]:(Ve=i(Oe.value,2),Ce=Ve[0],Ee=Ve[1],U(we)||t?[4,Ee(ge)]:[3,7]);case 5:Fe=u.sent(),(Se=ne(Fe,Re,Ce))&&(we=r(r({},Se),W(Ce,Se.message)),t&&(f[a]=we)),u.label=6;case 6:return Oe=ke.next(),[3,4];case 7:return[3,10];case 8:return De=u.sent(),je={error:De},[3,10];case 9:try{Oe&&!Oe.done&&(Ae=ke.return)&&Ae.call(ke)}finally{if(je)throw je.error}return[7];case 10:if(!U(we)&&(f[a]=r({ref:Re},we),!t))return[2,f];u.label=11;case 11:return[2,f]}}))}))},ie=function(e){return k(e)||!V(e)},ae=function(e,r){return Object.entries(r).map((function(t){var n=i(t,2),u=n[0];return function(r,t,n){var u=n?e+"."+t:e+"["+t+"]";return ie(r)?u:ae(u,r)}(n[1],u,C(r))})).flat(1/0)},oe=function(e,r,t,n,u){var c;return t.add(r),U(e)?c=void 0:(c=B(e,r),(C(c)||O(c))&&ae(r,c).forEach((function(e){return t.add(e)}))),j(c)?u?n:B(n,r):c},se=function(e){var r=e.isOnBlur,t=e.isOnChange,n=e.isReValidateOnBlur,u=e.isReValidateOnChange,c=e.isBlurEvent,i=e.isSubmitted;return!e.isOnAll&&((i?n:r)?!c:!(i?u:t)||c)},fe=function(e){return e.substring(0,e.indexOf("["))};function le(e,r){if(!O(e)||!O(r)||e.length!==r.length)return!0;for(var t=0;t<e.length;t++){var n=e[t],u=r[t];if(j(u)||Object.keys(n).length!==Object.keys(u).length)return!0;for(var c in n)if(n[c]!==u[c])return!0}return!1}var de=function(e,r){return RegExp(("^"+r+"[\\d+]").replace(/\[/g,"\\[").replace(/\]/g,"\\]")).test(e)},ve=function(e,r){return a(e).some((function(e){return de(r,e)}))};var he=function(e){return{isOnSubmit:!e||e===h,isOnBlur:e===d,isOnChange:e===v,isOnAll:e===y}},ye=function(e){return P(e)||H(e)},pe="undefined"==typeof window,me="undefined"!=typeof document&&!pe&&!j(window.HTMLElement),be=me?"Proxy"in window:"undefined"!=typeof Proxy;var ge=e.createContext(null);ge.displayName="RHFContext";var Re=function(){return e.useContext(ge)},xe=function(){var e="undefined"==typeof performance?Date.now():1e3*performance.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(r){var t=(16*Math.random()+e)%16|0;return("x"==r?t:3&t|8).toString(16)}))};var we=function(e,r){return j(r)?[]:O(r)?function(e,r){for(var t=-1;++t<e.length;)r.indexOf(t)>=0&&delete e[t];return A(e)}(e,r):function(e,r){return a(e.slice(0,r),e.slice(r+1))}(e,r)},ke=function(e,r,t){return O(e)?(j(e[t])&&(e[t]=void 0),e.splice(t,0,e.splice(r,1)[0]),e):[]},Oe=function(e,r,t){var n=[e[t],e[r]];e[r]=n[0],e[t]=n[1]};function Ve(e,r){return a(O(r)?r:[r||void 0],e)}function Ce(e,r,t){return a(e.slice(0,r),O(t)?t:[t||void 0],e.slice(r))}var Ee=function(e){return O(e)?Array(e.length).fill(void 0):void 0};function Fe(e){if(C(e)){var r={};for(var t in e)r[t]=!0;return[r]}return[!0]}var Se=function(e){return O(e)?e.map(Fe).flat():Fe(e)},De=function(e,t){var n;return r(((n={})[t]=xe(),n),C(e)?e:{value:e})},je=function(e,r){return(O(e)?e:[]).map((function(e){return De(e,r)}))};exports.Controller=function(n){var u=n.name,c=n.rules,a=n.as,o=n.render,s=n.defaultValue,f=n.control,l=n.onFocus,d=t(n,["name","rules","as","render","defaultValue","control","onFocus"]),v=Re(),h=f||v.control,y=h.defaultValuesRef,p=h.setValue,m=h.register,b=h.unregister,g=h.trigger,R=h.mode,x=h.reValidateMode,w=x.isReValidateOnBlur,k=x.isReValidateOnChange,O=h.isSubmittedRef,V=h.touchedFieldsRef,E=h.readFormStateRef,F=h.reRender,D=h.fieldsRef,A=h.fieldArrayNamesRef,W=h.unmountFieldsStateRef,L=!ve(A.current,u),N=function(){return!j(B(W.current,u))&&L?W.current[u]:j(s)?B(y.current,u):s},P=i(e.useState(N()),2),M=P[0],H=P[1],T=e.useRef(M),I=e.useRef(l),q=O.current,z=function(e){return!se(r({isBlurEvent:e,isReValidateOnBlur:w,isReValidateOnChange:k,isSubmitted:q},R))},$=function(e){var r=function(e){return ie(e)||!C(e.target)||C(e.target)&&!e.type?e:j(e.target.value)?e.target.checked:e.target.value}(i(e,1)[0]);return H(r),T.current=r,r},_=e.useCallback((function(){D.current[u]?D.current[u]=r({ref:D.current[u].ref},c):m(Object.defineProperty({name:u,focus:I.current},"value",{set:function(e){H(e),T.current=e},get:function(){return T.current}}),c)}),[D,c,u,I,m]);e.useEffect((function(){return function(){!ve(A.current,u)&&b(u)}}),[b,u,A]),e.useEffect((function(){_()}),[_]),e.useEffect((function(){D.current[u]||(_(),L&&H(N()))}));var U=function(){E.current.touched&&!B(V.current,u)&&(S(V.current,u,!0),F()),z(!0)&&g(u)},G=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return p(u,$(e),{shouldValidate:z(),shouldDirty:!0})},J=r(r({},d),{onChange:G,onBlur:U,name:u,value:M});return a?e.isValidElement(a)?e.cloneElement(a,J):e.createElement(a,J):o?o({onChange:G,onBlur:U,value:M}):null},exports.FormProvider=function(n){var u=n.children,c=t(n,["children"]);return e.createElement(ge.Provider,{value:r({},c)},u)},exports.appendErrors=ue,exports.get=B,exports.transformToNestObject=D,exports.useFieldArray=function(n){var u,o=n.control,s=n.name,f=n.keyName,l=void 0===f?"id":f,d=Re(),v=e.useRef(-1),h=o||d.control,y=h.isWatchAllRef,p=h.resetFieldArrayFunctionRef,m=h.fieldArrayNamesRef,b=h.reRender,g=h.fieldsRef,R=h.defaultValuesRef,x=h.removeFieldEventListener,w=h.errorsRef,k=h.dirtyFieldsRef,V=h.isDirtyRef,C=h.touchedFieldsRef,E=h.readFormStateRef,F=h.watchFieldsRef,D=h.validFieldsRef,W=h.fieldsWithValidationRef,L=h.fieldArrayDefaultValues,N=h.validateSchemaIsValid,P=h.renderWatchedInputs,M=h.getValues,H=function(){return a(B(B(L.current,fe(s))?L.current:R.current,s,[]))},T=e.useRef(H()),I=i(e.useState(je(T.current,l)),2),q=I[0],z=I[1],$=e.useRef(q),_=function(){return B(M()||{},s,$.current).map((function(e,t){return r(r({},$.current[t]),e)}))};$.current=q;var U=function(e){return e.map((function(e){return De(e,l)}))},J=function(e){var r;z(e),E.current.isValid&&N&&N(((r={})[s]=e,r))},K=function(e){(E.current.dirtyFields||E.current.isDirty||E.current.isValid)&&(e=!0),P(s),e&&!y.current&&b()},Q=function(e){for(var r in(E.current.isDirty||E.current.dirtyFields)&&(V.current=j(e)||le(e.map((function(e){void 0===e&&(e={});var r=l;e[r];return t(e,["symbol"==typeof r?r:r+""])})),B(R.current,s,[]))),g.current)de(r,s)&&g.current[r]&&x(g.current[r],!0)},X=function(){Q(),T.current=H(),z(je(T.current,l))};return e.useEffect((function(){var e,r,t=B(L.current,s);if(t&&q.length<t.length&&(t.pop(),S(L.current,s,t)),y.current)b();else if(F){var n=!0;try{for(var u=c(F.current),i=u.next();!i.done;i=u.next()){if(i.value.startsWith(s)){b(),n=!1;break}}}catch(r){e={error:r}}finally{try{i&&!i.done&&(r=u.return)&&r.call(u)}finally{if(e)throw e.error}}n&&P(s)}if(v.current>-1)for(var a in g.current){var o=g.current[a];if(a.startsWith(s+"["+v.current+"]")&&o.ref.focus){o.ref.focus();break}}v.current=-1}),[q,s,L,b,g,F,y]),e.useEffect((function(){var e=p.current,r=m.current;return r.add(s),e[s]=X,S(L.current,s,T.current),function(){Q(),delete e[s],r.delete(s)}}),[]),{swap:e.useCallback((function(e,r){u=!1;var t=_();Oe(t,e,r),Q(t),J(a(t)),O(B(w.current,s))&&Oe(B(w.current,s),e,r),E.current.touched&&C.current[s]&&(Oe(C.current[s],e,r),u=!0),(E.current.dirtyFields||E.current.isDirty)&&k.current[s]&&(Oe(k.current[s],e,r),u=!0),K(u)}),[s]),move:e.useCallback((function(e,r){u=!1;var t=_();ke(t,e,r),Q(t),J(a(t)),O(B(w.current,s))&&ke(B(w.current,s),e,r),E.current.touched&&C.current[s]&&(ke(C.current[s],e,r),u=!0),(E.current.dirtyFields||E.current.isDirty)&&k.current[s]&&(ke(k.current[s],e,r),u=!0),K(u)}),[s]),prepend:e.useCallback((function(e,r){void 0===r&&(r=!0);var t=Ee(e);u=!1,J(Ve(_(),O(e)?U(e):[De(e,l)])),Q(),O(B(w.current,s))&&(w.current[s]=Ve(B(w.current,s),t)),E.current.touched&&C.current[s]&&(C.current[s]=Ve(C.current[s],t),u=!0),(E.current.dirtyFields||E.current.isDirty)&&(k.current[s]=Ve(k.current[s]||[],Se(e)),u=!0),K(u),v.current=r?0:-1}),[s]),append:e.useCallback((function(e,r){void 0===r&&(r=!0),u=!1,J(a($.current,O(e)?U(e):[De(e,l)])),(E.current.dirtyFields||E.current.isDirty)&&(k.current[s]=a(k.current[s]||Ee(q.slice(0,1)),Se(e)),V.current=!0,u=!0),v.current=r?$.current.length:-1,K(u)}),[s]),remove:e.useCallback((function(e){u=!1;var r=_();if(J(we(r,e)),Q(we(r,e)),O(B(w.current,s))&&(S(w.current,s,we(B(w.current,s),e)),A(B(w.current,s,[])).length||G(w.current,s)),E.current.touched&&C.current[s]&&(C.current[s]=we(C.current[s],e),u=!0),(E.current.dirtyFields||E.current.isDirty)&&k.current[s]&&(k.current[s]=we(k.current[s],e),k.current[s].length||delete k.current[s],u=!0),E.current.isValid&&!N)for(var t=-1,n=!1,c=j(e);t++<q.length;){var i=t===q.length-1,a=(O(e)?e:[e]).indexOf(t)>=0;if((a||c)&&(n=!0),n)for(var o in q[t]){var f=s+"["+t+"]."+o;if(a||i||c)D.current.delete(f),W.current.delete(f);else{var l=s+"["+(t-1)+"]."+o;D.current.has(f)&&D.current.add(l),W.current.has(f)&&W.current.add(l)}}}K(u)}),[q,s]),insert:e.useCallback((function(e,r,t){void 0===t&&(t=!0),u=!1;var n=Ee(r),c=_();J(Ce(c,e,O(r)?U(r):[De(r,l)])),Q(Ce(c,e)),O(B(w.current,s))&&(w.current[s]=Ce(B(w.current,s),e,n)),E.current.touched&&C.current[s]&&(C.current[s]=Ce(C.current[s],e,n),u=!0),(E.current.dirtyFields||E.current.isDirty)&&k.current[s]&&(k.current[s]=Ce(k.current[s],e,Se(r)),u=!0),K(u),v.current=t?e:-1}),[s]),fields:q}},exports.useForm=function(t){var d=this,p=void 0===t?{}:t,m=p.mode,b=void 0===m?h:m,g=p.reValidateMode,R=void 0===g?v:g,x=p.resolver,w=p.context,V=p.defaultValues,E=void 0===V?{}:V,F=p.shouldFocusError,L=void 0===F||F,N=p.shouldUnregister,I=void 0===N||N,q=p.criteriaMode,z=e.useRef({}),Y=e.useRef({}),Z=e.useRef({}),re=e.useRef({}),te=e.useRef({}),ne=e.useRef(new Set),ue=e.useRef({}),de=e.useRef({}),ge=e.useRef(new Set),Re=e.useRef(new Set),xe=e.useRef(!0),we=e.useRef(E),ke=e.useRef({}),Oe=e.useRef(!1),Ve=e.useRef(!1),Ce=e.useRef(!1),Ee=e.useRef(!1),Fe=e.useRef(0),Se=e.useRef(!1),De=e.useRef(),je=e.useRef({}),Ae=e.useRef({}),Be=e.useRef(w),We=e.useRef(x),Le=e.useRef(new Set),Ne=i(e.useState(),2)[1],Pe=e.useRef(he(b)),Me=Pe.current,He=Me.isOnSubmit,Te=Me.isOnAll,Ie=q===y,qe=e.useRef({isDirty:!be,dirtyFields:!be,isSubmitted:He,submitCount:!be,touched:!be,isSubmitting:!be,isValid:!be}),ze=e.useRef(he(R)).current,$e=ze.isOnBlur,_e=ze.isOnChange;Be.current=w,We.current=x;var Ue=e.useCallback((function(){return!Oe.current&&Ne({})}),[]),Ge=e.useCallback((function(e,r,t){void 0===t&&(t=!1);var n=t||function(e){var r=e.errors,t=e.name,n=e.error,u=e.validFields,c=e.fieldsWithValidation,i=U(n),a=U(r),o=B(n,t),s=B(r,t);return(!i||!u.has(t))&&(!!(a!==i||!a&&!s||i&&c.has(t)&&!u.has(t))||o&&!X(s,o))}({errors:Y.current,error:r,name:e,validFields:Re.current,fieldsWithValidation:ge.current}),u=B(Y.current,e);if(U(r)?((ge.current.has(e)||We.current)&&(Re.current.add(e),n=n||u),Y.current=G(Y.current,e)):(Re.current.delete(e),n=n||!u||!X(u,r[e]),S(Y.current,e,r[e])),n&&!k(t))return Ue(),!0}),[]),Je=e.useCallback((function(e,r){var t=e.ref,n=e.options,u=me&&o(t)&&k(r)?"":r;P(t)&&n?n.forEach((function(e){var r=e.ref;return r.checked=r.value===u})):M(t)&&!K(u)?t.files=u:T(t)?a(t.options).forEach((function(e){return e.selected=u.includes(e.value)})):H(t)&&n?n.length>1?n.forEach((function(e){var r=e.ref;return r.checked=u.includes(r.value)})):n[0].ref.checked=!!u:t.value=u}),[]),Ke=e.useCallback((function(e){var r=qe.current,t=r.isDirty,n=r.dirtyFields;if(!z.current[e]||!t&&!n)return!1;var u=ke.current[e]!==$(z,e,je),c=B(te.current,e),i=ve(Le.current,e),a=Ee.current;return u?S(te.current,e,!0):G(te.current,e),Ee.current=i&&le(B(nr(),fe(e)),B(we.current,fe(e)))||!U(te.current),t&&a!==Ee.current||n&&c!==B(te.current,e)}),[]),Qe=e.useCallback((function(e,r){return n(d,void 0,void 0,(function(){var t;return u(this,(function(n){switch(n.label){case 0:return z.current[e]?[4,ce(z,Ie,z.current[e],je)]:[3,2];case 1:return t=n.sent(),Ge(e,t,!!r&&null),[2,U(t)];case 2:return[2,!1]}}))}))}),[Ge,Ie]),Xe=e.useCallback((function(e){return n(d,void 0,void 0,(function(){var r,t,n,c,i;return u(this,(function(u){switch(u.label){case 0:return[4,We.current(nr(),Be.current,Ie)];case 1:return r=u.sent().errors,t=xe.current,xe.current=U(r),O(e)?(n=e.map((function(e){var t=B(r,e);return t?S(Y.current,e,t):G(Y.current,e),!t})).every(Boolean),Ue(),[2,n]):(c=B(r,e),Ge(e,c?((i={})[e]=c,i):{},t!==xe.current),[2,!c])}}))}))}),[Ge,Ie]),Ye=e.useCallback((function(e){return n(d,void 0,void 0,(function(){var r,t,c=this;return u(this,(function(i){switch(i.label){case 0:return r=e||Object.keys(z.current),We.current?[2,Xe(r)]:O(r)?[4,Promise.all(r.map((function(e){return n(c,void 0,void 0,(function(){return u(this,(function(r){switch(r.label){case 0:return[4,Qe(e,!0)];case 1:return[2,r.sent()]}}))}))})))]:[3,2];case 1:return t=i.sent(),Ue(),[2,t.every(Boolean)];case 2:return[4,Qe(r)];case 3:return[2,i.sent()]}}))}))}),[Xe,Qe]),Ze=e.useCallback((function(e,r,t){var n=t.shouldDirty,u=t.shouldValidate;ae(e,r).forEach((function(t){var c={},i=z.current[t];i&&(S(c,e,r),Je(i,B(c,t)),n&&Ke(t),u&&Ye(t))}))}),[Ye,Je,Ke]),er=e.useCallback((function(e,r,t){return z.current[e]?(Je(z.current[e],r),t.shouldDirty&&Ke(e)):(ie(r)||Ze(e,r,t),I||(je.current[e]=r),!0)}),[Ke,Je,Ze]),rr=function(e){return Ve.current||ne.current.has(e)||ne.current.has((e.match(/\w+/)||[])[0])},tr=function(e,r){if(void 0===r&&(r=!0),!U(ue.current))for(var t in ue.current)(""===e||ue.current[t].has(e)||ue.current[t].has(fe(e))||!ue.current[t].size)&&(de.current[t](),r=!1);return r};function nr(e){return K(e)?$(z,e,je):O(e)?e.reduce((function(e,t){var n;return r(r({},e),((n={})[t]=$(z,t,je),n))}),{}):Q(z,je)}De.current=De.current?De.current:function(e){var t=e.type,c=e.target;return n(d,void 0,void 0,(function(){var e,n,i,a,o,f,l,d,v;return u(this,(function(u){switch(u.label){case 0:return e=c.name,(n=z.current[e])?(a=t===s,o=!Te&&se(r({isBlurEvent:a,isReValidateOnChange:_e,isReValidateOnBlur:$e,isSubmitted:Ce.current},Pe.current)),f=Ke(e)||rr(e),a&&!B(Z.current,e)&&qe.current.touched&&(S(Z.current,e,!0),f=!0),o?(tr(e),[2,f&&Ue()]):x?[4,x(nr(),Be.current,Ie)]:[3,2]):[3,5];case 1:return l=u.sent().errors,d=xe.current,xe.current=U(l),i=B(l,e)?((v={})[e]=B(l,e),v):{},d!==xe.current&&(f=!0),[3,4];case 2:return[4,ce(z,Ie,n,je)];case 3:i=u.sent(),u.label=4;case 4:tr(e),!Ge(e,i)&&f&&Ue(),u.label=5;case 5:return[2]}}))}))};var ur=e.useCallback((function(e){return void 0===e&&(e={}),n(d,void 0,void 0,(function(){var t,n;return u(this,(function(u){switch(u.label){case 0:return[4,We.current(r(r(r({},we.current),nr()),e),Be.current,Ie)];case 1:return t=u.sent().errors,n=xe.current,xe.current=U(t),n!==xe.current&&Ue(),[2]}}))}))}),[Ie]),cr=e.useCallback((function(e,r){return function(e,r,t,n,u,c){var i=t.ref,a=t.ref,o=a.name,s=a.type,f=t.mutationWatcher,l=e.current[o];if(!u){var d=$(e,o,n);j(d)||(n.current[o]=d)}if(s)if((P(i)||H(i))&&l){var v=l.options;O(v)&&v.length?(A(v).forEach((function(e,t){var n=e.ref,u=e.mutationWatcher;(n&&_(n)&&J(e,n)||c)&&(W(n,r),u&&u.disconnect(),G(v,"["+t+"]"))})),v&&!A(v).length&&delete e.current[o]):delete e.current[o]}else(_(i)&&J(l,i)||c)&&(W(i,r),f&&f.disconnect(),delete e.current[o]);else delete e.current[o]}(z,De.current,e,je,I,r)}),[I]),ir=e.useCallback((function(e,r){!e||ve(Le.current,e.ref.name)&&!r||(cr(e,r),I&&([Y,Z,te,ke].forEach((function(r){return G(r.current,e.ref.name)})),[ge,Re].forEach((function(r){return r.current.delete(e.ref.name)})),(qe.current.isValid||qe.current.touched||qe.current.isDirty)&&(Ee.current=!U(te.current),Ue(),We.current&&ur())))}),[ur,cr]),ar=e.useCallback((function(e,t,n){var u=n?ue.current[n]:ne.current,c=j(t)?we.current:t,i=Q(z,je,e);return K(e)?oe(i,e,u,j(t)?B(c,e):t,!0):O(e)?e.reduce((function(e,t){var n;return r(r({},e),((n={})[t]=oe(i,t,u,c),n))}),{}):(j(n)&&(Ve.current=!0),D(!U(i)&&i||c))}),[]);function or(e,t){void 0===t&&(t={});var n,u,c=e.name,i=e.type,d=e.value,v=r({ref:e},t),h=z.current,y=ye(e),p=h[c],m=!0;if(p&&(y?O(p.options)&&A(p.options).find((function(r){return d===r.ref.value&&r.ref===e})):e===p.ref))h[c]=r(r({},p),t);else{if(i){var b=(g=e,R=function(){return ir(p)},(w=new MutationObserver((function(){_(g)&&(w.disconnect(),R())}))).observe(window.document,{childList:!0,subtree:!0}),w);p=y?r({options:a(A(p&&p.options||[]),[{ref:e,mutationWatcher:b}]),ref:{type:i,name:c}},t):r(r({},v),{mutationWatcher:b})}else p=v;var g,R,w;h[c]=p;var k=j(B(je.current,c));if(U(we.current)&&k||(u=B(k?we.current:je.current,c),m=j(u),n=ve(Le.current,c),m||n||Je(p,u)),x&&!n&&qe.current.isValid?ur():U(t)||(ge.current.add(c),!He&&qe.current.isValid&&ce(z,Ie,p,je).then((function(e){var r=xe.current;U(e)?Re.current.add(c):xe.current=!1,r!==xe.current&&Ue()}))),!(ke.current[c]||n&&m)){var V=$(z,c,je);ke.current[c]=m?C(V)?r({},V):V:u}i&&function(e,r,t){var n=e.ref;o(n)&&t&&(n.addEventListener(r?f:l,t),n.addEventListener(s,t))}(y&&p.options?p.options[p.options.length-1]:p,y||function(e){return"select-one"===e.type}(e),De.current)}}var sr=e.useCallback((function(e){return function(t){return n(d,void 0,void 0,(function(){var n,i,a,o,s,f,l,d,v,h,y,p,m;return u(this,(function(u){switch(u.label){case 0:t&&t.preventDefault&&(t.preventDefault(),t.persist()),n={},i=Q(z,je),qe.current.isSubmitting&&(Se.current=!0,Ue()),u.label=1;case 1:return u.trys.push([1,,14,15]),We.current?[4,We.current(i,Be.current,Ie)]:[3,3];case 2:return a=u.sent(),o=a.errors,s=a.values,Y.current=o,n=o,i=s,[3,10];case 3:u.trys.push([3,8,9,10]),f=c(Object.values(z.current)),l=f.next(),u.label=4;case 4:return l.done?[3,7]:(d=l.value)?(v=d.ref.name,[4,ce(z,Ie,d,je)]):[3,6];case 5:(h=u.sent())[v]?(S(n,v,h[v]),Re.current.delete(v)):ge.current.has(v)&&(G(Y.current,v),Re.current.add(v)),u.label=6;case 6:return l=f.next(),[3,4];case 7:return[3,10];case 8:return y=u.sent(),p={error:y},[3,10];case 9:try{l&&!l.done&&(m=f.return)&&m.call(f)}finally{if(p)throw p.error}return[7];case 10:return U(n)&&Object.keys(Y.current).every((function(e){return Object.keys(z.current).includes(e)}))?(Y.current={},Ue(),[4,e(i,t)]):[3,12];case 11:return u.sent(),[3,13];case 12:Y.current=r(r({},Y.current),n),L&&function(e,r){for(var t in e)if(B(r,t)){var n=e[t];if(n){if(n.ref.focus){n.ref.focus();break}if(n.options){n.options[0].ref.focus();break}}}}(z.current,n),u.label=13;case 13:return[3,15];case 14:return Ce.current=!0,Se.current=!1,Fe.current=Fe.current+1,Ue(),[7];case 15:return[2]}}))}))}}),[L,Ie]);e.useEffect((function(){return Oe.current=!1,function(){Oe.current=!0,z.current&&Object.values(z.current).forEach((function(e){return ir(e,!0)}))}}),[ir]),x||(xe.current=Re.current.size>=ge.current.size&&U(Y.current));var fr={dirtyFields:te.current,isSubmitted:Ce.current,submitCount:Fe.current,touched:Z.current,isDirty:Ee.current,isSubmitting:Se.current,isValid:He?Ce.current&&U(Y.current):xe.current},lr={trigger:Ye,setValue:e.useCallback((function(e,r,t){void 0===t&&(t={});var n=er(e,r,t)||rr(e);tr(e),n&&Ue(),t.shouldValidate&&Ye(e)}),[Ue,er,Ye]),getValues:e.useCallback(nr,[]),register:e.useCallback((function(e,r){if(!pe)if(K(e))or({name:e},r);else{if(!C(e)||!("name"in e))return function(r){return r&&or(r,e)};or(e,r)}}),[we.current]),unregister:e.useCallback((function(e){(O(e)?e:[e]).forEach((function(e){return ir(z.current[e],!0)}))}),[]),formState:be?new Proxy(fr,{get:function(e,r){if(r in e)return qe.current[r]=!0,e[r]}}):fr},dr=r(r({removeFieldEventListener:cr,renderWatchedInputs:tr,watchInternal:ar,reRender:Ue,mode:Pe.current,reValidateMode:{isReValidateOnBlur:$e,isReValidateOnChange:_e},errorsRef:Y,touchedFieldsRef:Z,fieldsRef:z,isWatchAllRef:Ve,watchFieldsRef:ne,resetFieldArrayFunctionRef:Ae,watchFieldsHookRef:ue,watchFieldsHookRenderRef:de,fieldArrayDefaultValues:re,validFieldsRef:Re,dirtyFieldsRef:te,fieldsWithValidationRef:ge,fieldArrayNamesRef:Le,isDirtyRef:Ee,isSubmittedRef:Ce,readFormStateRef:qe,defaultValuesRef:we,unmountFieldsStateRef:je},x?{validateSchemaIsValid:ur}:{}),lr);return r({watch:function(e,r){return ar(e,r)},control:dr,handleSubmit:sr,reset:e.useCallback((function(e,r){var t,n;if(void 0===r&&(r={}),me)try{for(var u=c(Object.values(z.current)),i=u.next();!i.done;i=u.next()){var a=i.value;if(a){var s=a.ref,f=a.options,l=ye(s)&&O(f)?f[0].ref:s;if(o(l))try{l.closest("form").reset();break}catch(e){}}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}z.current={},e&&(we.current=e,tr("")),je.current=I?{}:e||{},Object.values(Ae.current).forEach((function(e){return ee(e)&&e()})),function(e){var r=e.errors,t=e.isDirty,n=e.isSubmitted,u=e.touched,c=e.isValid,i=e.submitCount,a=e.dirtyFields;r||(Y.current={}),u||(Z.current={}),c||(Re.current=new Set,ge.current=new Set,xe.current=!0),t||(Ee.current=!1),a||(te.current={}),n||(Ce.current=!1),i||(Fe.current=0),ke.current={},re.current={},ne.current=new Set,Ve.current=!1}(r),Ue()}),[]),clearErrors:e.useCallback((function(e){e?(O(e)?e:[e]).forEach((function(e){return G(Y.current,e)})):Y.current={},Ue()}),[]),setError:e.useCallback((function(e,t){xe.current=!1,S(Y.current,e,r(r({},t),{ref:(z.current[e]||{}).ref})),Ue()}),[]),errors:Y.current},lr)},exports.useFormContext=Re,exports.useWatch=function(t){var n=t.control,u=t.name,c=t.defaultValue,a=Re(),o=n||a.control,s=o.watchFieldsHookRef,f=o.watchFieldsHookRenderRef,l=o.watchInternal,d=o.defaultValuesRef,v=i(e.useState(j(c)?K(u)?B(d.current,u):O(u)?u.reduce((function(e,t){var n;return r(r({},e),((n={})[t]=B(d.current,t),n))}),{}):d.current:c),2),h=v[0],y=v[1],p=e.useRef(),m=e.useRef(c),b=e.useRef(u),g=e.useCallback((function(){return y(l(b.current,m.current,p.current))}),[y,l,m,b,p]);return e.useEffect((function(){var e=p.current=xe(),r=f.current,t=s.current;return t[e]=new Set,r[e]=g,l(b.current,m.current,e),function(){delete t[e],delete r[e]}}),[b,g,f,s,l,m]),j(h)?c:h};
  //# sourceMappingURL=index.ie11.production.min.js.map
  